30 namespace std {}
using namespace std;
32 ClassImp(ROOT::Internal::TBranchProxyDirector);
38 void NotifyDirected(Detail::TBranchProxy *x) { x->Notify(); }
41 void ResetReadEntry(TFriendProxy *fp) { fp->ResetReadEntry(); }
45 Update(TTree *newtree) : fNewTree(newtree) {}
47 void operator()(TFriendProxy *x) { x->Update(fNewTree); }
51 TBranchProxyDirector::TBranchProxyDirector(TTree* tree, Long64_t i) :
58 TBranchProxyDirector::TBranchProxyDirector(TTree* tree, Int_t i) :
66 void TBranchProxyDirector::Attach(Detail::TBranchProxy* p) {
71 fDirected.push_back(p);
74 void TBranchProxyDirector::Attach(TFriendProxy* p) {
79 fFriends.push_back(p);
82 TH1F* TBranchProxyDirector::CreateHistogram(
const char *options) {
85 Int_t nbins = gEnv->GetValue(
"Hist.Binning.1D.x",100);
86 Double_t vmin=0, vmax=0;
87 Double_t xmin=0, xmax=0;
88 Bool_t canExtend = kTRUE;
89 TString opt( options );
90 Bool_t optSame = opt.Contains(
"same");
91 if (optSame) canExtend = kFALSE;
93 if (gPad && optSame) {
94 TListIter np(gPad->GetListOfPrimitives());
97 while ((op = np()) && !oldhtemp) {
98 if (op->InheritsFrom(TH1::Class())) oldhtemp = (TH1 *)op;
101 nbins = oldhtemp->GetXaxis()->GetNbins();
102 vmin = oldhtemp->GetXaxis()->GetXmin();
103 vmax = oldhtemp->GetXaxis()->GetXmax();
105 vmin = gPad->GetUxmin();
106 vmax = gPad->GetUxmax();
111 if (xmin < xmax) canExtend = kFALSE;
113 TH1F *hist =
new TH1F(
"htemp",
"htemp",nbins,vmin,vmax);
114 hist->SetLineColor(fTree->GetLineColor());
115 hist->SetLineWidth(fTree->GetLineWidth());
116 hist->SetLineStyle(fTree->GetLineStyle());
117 hist->SetFillColor(fTree->GetFillColor());
118 hist->SetFillStyle(fTree->GetFillStyle());
119 hist->SetMarkerStyle(fTree->GetMarkerStyle());
120 hist->SetMarkerColor(fTree->GetMarkerColor());
121 hist->SetMarkerSize(fTree->GetMarkerSize());
122 if (canExtend) hist->SetCanExtend(TH1::kAllAxes);
123 hist->GetXaxis()->SetTitle(
"var");
124 hist->SetBit(kCanDelete);
125 hist->SetDirectory(0);
127 if (opt.Length() && opt.Contains(
"e")) hist->Sumw2();
131 TTree* TBranchProxyDirector::SetTree(TTree *newtree) {
137 TTree* oldtree = fTree;
139 if(!Notify())
return nullptr;
143 Bool_t TBranchProxyDirector::Notify() {
146 for_each(fDirected.begin(),fDirected.end(),NotifyDirected);
147 for (
auto brProxy : fDirected) {
148 retVal = retVal && brProxy->Notify();
150 Update update(fTree);
151 for_each(fFriends.begin(),fFriends.end(),update);