30 ClassImp(TProofChain);
35 TProofChain::TProofChain() : TChain()
40 fDirectory = gDirectory;
47 TProofChain::TProofChain(TChain *chain, Bool_t gettreeheader) : TChain()
51 fSet = chain ?
new TDSet((
const TChain &)(*chain)) : 0;
52 fDirectory = gDirectory;
54 gProof->AddChain(chain);
56 if (gProof->IsLite()) {
60 if (gettreeheader && fSet)
61 fTree = gProof->GetTreeHeader(fSet);
65 fEntryList = (chain) ? chain->GetEntryList() : 0;
66 fEventList = (chain) ? chain->GetEventList() : 0;
72 TProofChain::TProofChain(TDSet *dset, Bool_t gettreeheader) : TChain()
77 fDirectory = gDirectory;
80 if (gettreeheader && dset)
81 fTree = gProof->GetTreeHeader(dset);
86 fChain =
new TChain(fTree->GetName());
87 TIter nxe(fSet->GetListOfElements());
89 while ((e = (TDSetElement *) nxe())) {
90 fChain->AddFile(e->GetName());
93 if (TestBit(kProofLite))
96 TObject *en = (dset) ? dset->GetEntryList() : 0;
98 if (en->InheritsFrom(
"TEntryList")) {
99 fEntryList = (TEntryList *) en;
101 fEventList = (TEventList *) en;
109 TProofChain::~TProofChain()
114 TIter nxp(gROOT->GetListOfSockets());
118 if ((p = dynamic_cast<TProof *>(o)))
119 p->RemoveChain(fChain);
120 if (fTree == fChain) fTree = 0;
121 if (TestBit(kOwnsChain)) {
139 void TProofChain::Browse(TBrowser *b)
149 Long64_t TProofChain::Draw(
const char *varexp,
const TCut &selection,
150 Option_t *option, Long64_t nentries, Long64_t firstentry)
153 Error(
"Draw",
"no active PROOF session");
158 fReadEntry = firstentry;
162 fSet->SetEntryList(fEntryList);
163 }
else if (fEventList) {
164 fSet->SetEntryList(fEventList);
167 fSet->SetEntryList(0);
171 FillDrawAttributes(gProof);
176 Long64_t rv = fSet->Draw(varexp, selection, option, nentries, firstentry);
185 Long64_t TProofChain::Draw(
const char *varexp,
const char *selection,
186 Option_t *option,Long64_t nentries, Long64_t firstentry)
189 Error(
"Draw",
"no active PROOF session");
194 fReadEntry = firstentry;
198 fSet->SetEntryList(fEntryList);
199 }
else if (fEventList) {
200 fSet->SetEntryList(fEventList);
203 fSet->SetEntryList(0);
207 FillDrawAttributes(gProof);
212 Long64_t rv = fSet->Draw(varexp, selection, option, nentries, firstentry);
220 void TProofChain::AddAliases()
222 TList *al = fChain->GetListOfAliases();
223 if (al && al->GetSize() > 0) {
225 TNamed *nm = 0, *nmo = 0;
227 while ((nm = (TNamed *)nxa())) {
228 names += nm->GetName();
230 nma.Form(
"alias:%s", nm->GetName());
231 nmo = (TNamed *)((gProof->GetInputList()) ? gProof->GetInputList()->FindObject(nma) : 0);
233 nmo->SetTitle(nm->GetTitle());
235 gProof->AddInput(
new TNamed(nma.Data(), nm->GetTitle()));
238 nmo = (TNamed *)((gProof->GetInputList()) ? gProof->GetInputList()->FindObject(
"PROOF_ListOfAliases") : 0);
240 nmo->SetTitle(names.Data());
242 gProof->AddInput(
new TNamed(
"PROOF_ListOfAliases", names.Data()));
261 void TProofChain::FillDrawAttributes(TProof *p)
264 Error(
"FillDrawAttributes",
"invalid PROOF or mother chain pointers!");
269 p->SetParameter(
"PROOF_ChainWeight", fChain->GetWeight());
272 p->SetParameter(
"PROOF_LineColor", (Int_t) fChain->GetLineColor());
273 p->SetParameter(
"PROOF_LineStyle", (Int_t) fChain->GetLineStyle());
274 p->SetParameter(
"PROOF_LineWidth", (Int_t) fChain->GetLineWidth());
277 p->SetParameter(
"PROOF_MarkerColor", (Int_t) fChain->GetMarkerColor());
278 p->SetParameter(
"PROOF_MarkerSize", (Int_t) fChain->GetMarkerSize()*1000);
279 p->SetParameter(
"PROOF_MarkerStyle", (Int_t) fChain->GetMarkerStyle());
282 p->SetParameter(
"PROOF_FillColor", (Int_t) fChain->GetFillColor());
283 p->SetParameter(
"PROOF_FillStyle", (Int_t) fChain->GetFillStyle());
286 Info(
"FillDrawAttributes",
"line: color:%d, style:%d, width:%d",
287 fChain->GetLineColor(), fChain->GetLineStyle(), fChain->GetLineWidth());
288 Info(
"FillDrawAttributes",
"marker: color:%d, style:%d, size:%f",
289 fChain->GetMarkerColor(), fChain->GetMarkerStyle(), fChain->GetMarkerSize());
290 Info(
"FillDrawAttributes",
"area: color:%d, style:%d",
291 fChain->GetFillColor(), fChain->GetFillStyle());
299 TBranch *TProofChain::FindBranch(
const char* branchname)
301 return (fTree ? fTree->FindBranch(branchname) : (TBranch *)0);
308 TLeaf *TProofChain::FindLeaf(
const char* searchname)
310 return (fTree ? fTree->FindLeaf(searchname) : (TLeaf *)0);
317 TBranch *TProofChain::GetBranch(
const char *name)
319 return (fTree ? fTree->GetBranch(name) : (TBranch *)0);
326 Bool_t TProofChain::GetBranchStatus(
const char *branchname)
const
328 return (fTree ? fTree->GetBranchStatus(branchname) : kFALSE);
335 TVirtualTreePlayer *TProofChain::GetPlayer()
337 return (fTree ? fTree->GetPlayer() : (TVirtualTreePlayer *)0);
346 Long64_t TProofChain::Process(
const char *filename, Option_t *option,
347 Long64_t nentries, Long64_t firstentry)
353 }
else if (fEventList) {
357 return fSet->Process(filename, option, nentries, firstentry, enl);
364 Long64_t TProofChain::Process(TSelector *selector, Option_t *option,
365 Long64_t nentries, Long64_t firstentry)
371 }
else if (fEventList) {
375 return fSet->Process(selector, option, nentries, firstentry, enl);
381 void TProofChain::SetDebug(Int_t level, Long64_t min, Long64_t max)
383 TTree::SetDebug(level, min, max);
389 void TProofChain::SetName(
const char *name)
391 TTree::SetName(name);
398 Long64_t TProofChain::GetEntries()
const
401 if (TestBit(kProofLite)) {
402 return (fTree ? fTree->GetEntries() : (Long64_t)(-1));
404 return (fTree ? fTree->GetMaxEntryLoop() : (Long64_t)(-1));
412 Long64_t TProofChain::GetEntries(
const char *selection)
414 if (TestBit(kProofLite)) {
415 return (fTree ? fTree->GetEntries(selection) : (Long64_t)(-1));
417 Warning(
"GetEntries",
"GetEntries(selection) not yet implemented");
418 return ((Long64_t)(-1));
425 void TProofChain::Progress(Long64_t total, Long64_t processed)
427 if (gROOT->IsInterrupted() && gProof)
428 gProof->StopProcess(kTRUE);
431 fReadEntry = processed;
437 Long64_t TProofChain::GetReadEntry()
const
445 void TProofChain::ReleaseProof()
449 gProof->Disconnect(
"Progress(Long64_t,Long64_t)",
450 this,
"Progress(Long64_t,Long64_t)");
456 void TProofChain::ConnectProof()
459 gProof->Connect(
"Progress(Long64_t,Long64_t)",
"TProofChain",
460 this,
"Progress(Long64_t,Long64_t)");