1 |
|
// $Id$ |
2 |
|
|
3 |
|
#include "MitAna/TreeMod/interface/Analysis.h" |
4 |
+ |
#include <memory> |
5 |
|
#include <Riostream.h> |
6 |
|
#include <TFile.h> |
7 |
|
#include <TList.h> |
12 |
|
#include <TProof.h> |
13 |
|
#include <TROOT.h> |
14 |
|
#include <TBrowser.h> |
15 |
+ |
#include <TTreeCacheUnzip.h> |
16 |
|
#include "MitAna/DataUtil/interface/Debug.h" |
17 |
|
#include "MitAna/DataTree/interface/Names.h" |
18 |
|
#include "MitAna/TAM/interface/TAMVirtualLoader.h" |
35 |
|
fHierarchy(kTRUE), |
36 |
|
fDoProxy(kFALSE), |
37 |
|
fDoObjTabClean(kTRUE), |
38 |
+ |
fParallel(kFALSE), |
39 |
|
fState(kPristine), |
40 |
|
fNFriends(0), |
41 |
|
fList(new TList), |
47 |
|
fChain(0), |
48 |
|
fSet(0), |
49 |
|
fDeleteList(new TList), |
50 |
< |
fTreeName(Names::gkEvtTreeName), |
48 |
< |
fCompLevel(2), |
50 |
> |
fCompLevel(7), |
51 |
|
fProof(0), |
52 |
|
fDoNEvents(TChain::kBigNumber), |
53 |
< |
fCacheSize(134217728) |
53 |
> |
fSkipNEvents(0), |
54 |
> |
fPrintScale(1), |
55 |
> |
fCacheSize(-1), |
56 |
> |
fTreeName(Names::gkEvtTreeName), |
57 |
> |
fEvtHdrName(Names::gkEvtHeaderBrn), |
58 |
> |
fRunTreeName(Names::gkRunTreeName), |
59 |
> |
fRunInfoName(Names::gkRunInfoBrn), |
60 |
> |
fAllEvtHdrBrn(Names::gkAllEvtHeaderBrn), |
61 |
> |
fLATreeName(Names::gkLATreeName), |
62 |
> |
fLAHdrName(Names::gkLAHeaderBrn), |
63 |
> |
fHLTTreeName(Names::gkHltTreeName), |
64 |
> |
fAllEvtTreeName(Names::gkAllEvtTreeName), |
65 |
> |
fHLTObjsName(Names::gkHltObjBrn) |
66 |
|
{ |
67 |
|
// Default constructor. |
68 |
|
|
88 |
|
delete fDeleteList; |
89 |
|
delete fSelector; |
90 |
|
delete fSuperMods; |
91 |
< |
fOutput = 0; // owned by TAM |
91 |
> |
fOutput = 0; // owned by TAM |
92 |
|
|
93 |
|
delete fProof; |
94 |
|
} |
204 |
|
ifstream in; |
205 |
|
in.open(pname); |
206 |
|
if (!in) { |
207 |
< |
Error("AddFiles", "Can not open file with name %s", pname); |
207 |
> |
Error("AddFiles", "Cannot open file with name %s", pname); |
208 |
|
return kFALSE; |
209 |
|
} |
210 |
|
|
212 |
|
while (in) { |
213 |
|
TString line; |
214 |
|
line.ReadLine(in); |
201 |
– |
cout << line << endl; |
215 |
|
if (!line.EndsWith(".root")) |
216 |
|
continue; |
204 |
– |
cout << line << endl; |
217 |
|
|
218 |
|
if (!AddFile(line)) { |
219 |
|
Error("AddFiles", "Error adding file with name %s", line.Data()); |
384 |
|
|
385 |
|
fChain = new TChain(fTreeName); |
386 |
|
fSet = new TDSet("TTree",fTreeName); |
375 |
– |
|
376 |
– |
fChain->SetCacheSize(fCacheSize); |
387 |
|
|
388 |
|
for (Int_t i=0; i<fNFriends; ++i) { |
379 |
– |
|
389 |
|
TList *l = dynamic_cast<TList*>(fList->At(i)); |
390 |
|
if (!l) { |
391 |
|
Fatal("Init", "List %d not found!", i); |
397 |
|
while (TObjString *obj = dynamic_cast<TObjString*>(next())) { |
398 |
|
fChain->Add(obj->GetName()); |
399 |
|
fSet->Add(obj->GetName()); |
400 |
+ |
if (fCacheSize<0 && obj->GetString().Contains("/castor/")) |
401 |
+ |
fCacheSize = 64*1024*1024; |
402 |
|
} |
392 |
– |
|
403 |
|
} else { |
394 |
– |
|
404 |
|
TChain *chain = new TChain(fTreeName); |
405 |
|
TDSet *set = new TDSet("TTree",fTreeName); |
406 |
|
|
408 |
|
while (TObjString *obj = dynamic_cast<TObjString*>(next())) { |
409 |
|
chain->Add(obj->GetName()); |
410 |
|
set->Add(obj->GetName()); |
411 |
+ |
if (fCacheSize<0 && obj->GetString().Contains("/castor/")) |
412 |
+ |
fCacheSize = 64*1024*1024; |
413 |
|
} |
414 |
|
|
415 |
|
TString alias("TAMTREE_"); // aliases currently not used |
421 |
|
fDeleteList->Add(chain); |
422 |
|
fDeleteList->Add(set); |
423 |
|
} |
413 |
– |
|
424 |
|
} |
425 |
|
|
426 |
+ |
if (fParallel) |
427 |
+ |
TTreeCacheUnzip::SetParallelUnzip(TTreeCacheUnzip::kEnable); |
428 |
+ |
|
429 |
+ |
if (fCacheSize>=0) |
430 |
+ |
fChain->SetCacheSize(fCacheSize); |
431 |
+ |
|
432 |
|
// create our customized loader plugin for TAM |
433 |
|
TreeLoader *bl = new TreeLoader; |
434 |
|
fLoaders->Add(bl); |
436 |
|
|
437 |
|
// create our ana framework module |
438 |
|
AnaFwkMod *anamod = new AnaFwkMod; |
439 |
+ |
anamod->SetSkipNEvents(fSkipNEvents); |
440 |
+ |
anamod->SetPrintScale(fPrintScale); |
441 |
|
fDeleteList->Add(anamod); |
442 |
|
|
443 |
|
// create our HLT framework module |
444 |
|
HLTFwkMod *hltmod = 0; |
445 |
|
if (fUseHLT) { |
446 |
|
hltmod = new HLTFwkMod; |
447 |
+ |
hltmod->SetHLTObjsName(GetHLTObjsName()); |
448 |
+ |
hltmod->SetHLTTreeName(GetHLTTreeName()); |
449 |
|
fDeleteList->Add(hltmod); |
450 |
|
} |
451 |
|
|
468 |
|
} else { |
469 |
|
|
470 |
|
// when not running Proof, we must make a selector |
471 |
< |
fSelector = new Selector; |
472 |
< |
fSelector->SetDoProxy(fDoProxy); |
473 |
< |
fSelector->SetDoObjTabClean(fDoObjTabClean); |
474 |
< |
|
475 |
< |
fSelector->AddInput(anamod); |
471 |
> |
Selector *sel = new Selector; |
472 |
> |
sel->SetDoProxy(fDoProxy); |
473 |
> |
sel->SetDoObjTabClean(fDoObjTabClean); |
474 |
> |
sel->SetDoRunInfo(kTRUE); |
475 |
> |
sel->SetAllEvtHdrBrn(GetAllEvtHdrBrn()); |
476 |
> |
sel->SetAllEvtTreeName(GetAllEvtTreeName()); |
477 |
> |
sel->SetEvtHdrName(GetEvtHdrName()); |
478 |
> |
sel->SetLAHdrName(GetLAHdrName()); |
479 |
> |
sel->SetLATreeName(GetLATreeName()); |
480 |
> |
sel->SetRunInfoName(GetRunInfoName()); |
481 |
> |
sel->SetRunTreeName(GetRunTreeName()); |
482 |
> |
sel->AddInput(anamod); |
483 |
> |
fSelector = sel; |
484 |
|
|
485 |
|
if (hltmod) |
486 |
|
fSelector->AddInput(hltmod); |