11 |
|
#include <TProof.h> |
12 |
|
#include <TROOT.h> |
13 |
|
#include <TBrowser.h> |
14 |
+ |
#include <TTreeCacheUnzip.h> |
15 |
|
#include "MitAna/DataUtil/interface/Debug.h" |
16 |
|
#include "MitAna/DataTree/interface/Names.h" |
17 |
|
#include "MitAna/TAM/interface/TAMVirtualLoader.h" |
32 |
|
fUseProof(useproof), |
33 |
|
fUseHLT(kTRUE), |
34 |
|
fHierarchy(kTRUE), |
35 |
< |
fDoProxy(kTRUE), |
35 |
> |
fDoProxy(kFALSE), |
36 |
> |
fDoObjTabClean(kTRUE), |
37 |
> |
fParallel(kFALSE), |
38 |
|
fState(kPristine), |
39 |
|
fNFriends(0), |
40 |
|
fList(new TList), |
46 |
|
fChain(0), |
47 |
|
fSet(0), |
48 |
|
fDeleteList(new TList), |
49 |
< |
fTreeName(Names::gkEvtTreeName), |
47 |
< |
fCompLevel(2), |
49 |
> |
fCompLevel(7), |
50 |
|
fProof(0), |
51 |
< |
fDoNEvents(TChain::kBigNumber) |
51 |
> |
fDoNEvents(TChain::kBigNumber), |
52 |
> |
fSkipNEvents(0), |
53 |
> |
fPrintScale(1), |
54 |
> |
fCacheSize(-1), |
55 |
> |
fTreeName(Names::gkEvtTreeName), |
56 |
> |
fEvtHdrName(Names::gkEvtHeaderBrn), |
57 |
> |
fRunTreeName(Names::gkRunTreeName), |
58 |
> |
fRunInfoName(Names::gkRunInfoBrn), |
59 |
> |
fAllEvtHdrBrn(Names::gkAllEvtHeaderBrn), |
60 |
> |
fLATreeName(Names::gkLATreeName), |
61 |
> |
fLAHdrName(Names::gkLAHeaderBrn), |
62 |
> |
fHLTTreeName(Names::gkHltTreeName), |
63 |
> |
fAllEvtTreeName(Names::gkAllEvtTreeName), |
64 |
> |
fHLTObjsName(Names::gkHltObjBrn) |
65 |
|
{ |
66 |
|
// Default constructor. |
67 |
|
|
87 |
|
delete fDeleteList; |
88 |
|
delete fSelector; |
89 |
|
delete fSuperMods; |
90 |
< |
fOutput = 0; // owned by TAM |
90 |
> |
fOutput = 0; // owned by TAM |
91 |
|
|
92 |
|
delete fProof; |
93 |
|
} |
203 |
|
ifstream in; |
204 |
|
in.open(pname); |
205 |
|
if (!in) { |
206 |
< |
Error("AddFiles", "Can not open file with name %s", pname); |
206 |
> |
Error("AddFiles", "Cannot open file with name %s", pname); |
207 |
|
return kFALSE; |
208 |
|
} |
209 |
|
|
302 |
|
return; |
303 |
|
} |
304 |
|
|
290 |
– |
|
305 |
|
if (!files.IsNull()) { // add local files |
306 |
|
Info("FileInputFromEnv", "Got from environment:\n" |
307 |
|
"\n\tMIT_FILES=%s\n", files.Data()); |
323 |
|
catalog.Data(), book.Data(), dataset.Data(), filesets.Data()); |
324 |
|
|
325 |
|
Catalog cat(catalog); |
326 |
< |
TString tok(";"); |
327 |
< |
TObjArray *arr = filesets.Tokenize(tok); |
328 |
< |
if (arr) { |
315 |
< |
for (Int_t i=0; i<arr->GetEntries(); ++i) { |
316 |
< |
TObjString *fileset = dynamic_cast<TObjString*>(arr->At(i)); |
317 |
< |
if (!fileset) continue; |
318 |
< |
Dataset *d = cat.FindDataset(book, dataset, fileset->String()); |
319 |
< |
if (!d) |
320 |
< |
continue; |
326 |
> |
if (filesets.IsNull()) { |
327 |
> |
Dataset *d = cat.FindDataset(book, dataset); |
328 |
> |
if (d) { |
329 |
|
AddDataset(d); |
330 |
|
delete d; |
331 |
|
} |
332 |
< |
delete arr; |
332 |
> |
} else { |
333 |
> |
TString tok(";"); |
334 |
> |
TObjArray *arr = filesets.Tokenize(tok); |
335 |
> |
if (arr) { |
336 |
> |
for (Int_t i=0; i<arr->GetEntries(); ++i) { |
337 |
> |
TObjString *fileset = dynamic_cast<TObjString*>(arr->At(i)); |
338 |
> |
if (!fileset) continue; |
339 |
> |
Dataset *d = cat.FindDataset(book, dataset, fileset->String()); |
340 |
> |
if (!d) |
341 |
> |
continue; |
342 |
> |
AddDataset(d); |
343 |
> |
delete d; |
344 |
> |
} |
345 |
> |
delete arr; |
346 |
> |
} |
347 |
|
} |
348 |
|
} |
349 |
|
|
387 |
|
fSet = new TDSet("TTree",fTreeName); |
388 |
|
|
389 |
|
for (Int_t i=0; i<fNFriends; ++i) { |
368 |
– |
|
390 |
|
TList *l = dynamic_cast<TList*>(fList->At(i)); |
391 |
|
if (!l) { |
392 |
|
Fatal("Init", "List %d not found!", i); |
398 |
|
while (TObjString *obj = dynamic_cast<TObjString*>(next())) { |
399 |
|
fChain->Add(obj->GetName()); |
400 |
|
fSet->Add(obj->GetName()); |
401 |
+ |
if (fCacheSize<0 && obj->GetString().Contains("/castor/")) |
402 |
+ |
fCacheSize = 64*1024*1024; |
403 |
|
} |
381 |
– |
|
404 |
|
} else { |
383 |
– |
|
405 |
|
TChain *chain = new TChain(fTreeName); |
406 |
|
TDSet *set = new TDSet("TTree",fTreeName); |
407 |
|
|
409 |
|
while (TObjString *obj = dynamic_cast<TObjString*>(next())) { |
410 |
|
chain->Add(obj->GetName()); |
411 |
|
set->Add(obj->GetName()); |
412 |
+ |
if (fCacheSize<0 && obj->GetString().Contains("/castor/")) |
413 |
+ |
fCacheSize = 64*1024*1024; |
414 |
|
} |
415 |
|
|
416 |
|
TString alias("TAMTREE_"); // aliases currently not used |
422 |
|
fDeleteList->Add(chain); |
423 |
|
fDeleteList->Add(set); |
424 |
|
} |
402 |
– |
|
425 |
|
} |
426 |
|
|
427 |
+ |
if (fParallel) |
428 |
+ |
TTreeCacheUnzip::SetParallelUnzip(TTreeCacheUnzip::kEnable); |
429 |
+ |
|
430 |
+ |
if (fCacheSize>=0) |
431 |
+ |
fChain->SetCacheSize(fCacheSize); |
432 |
+ |
|
433 |
|
// create our customized loader plugin for TAM |
434 |
|
TreeLoader *bl = new TreeLoader; |
435 |
|
fLoaders->Add(bl); |
437 |
|
|
438 |
|
// create our ana framework module |
439 |
|
AnaFwkMod *anamod = new AnaFwkMod; |
440 |
+ |
anamod->SetSkipNEvents(fSkipNEvents); |
441 |
+ |
anamod->SetPrintScale(fPrintScale); |
442 |
|
fDeleteList->Add(anamod); |
443 |
|
|
444 |
|
// create our HLT framework module |
445 |
|
HLTFwkMod *hltmod = 0; |
446 |
|
if (fUseHLT) { |
447 |
|
hltmod = new HLTFwkMod; |
448 |
+ |
hltmod->SetHLTObjsName(GetHLTObjsName()); |
449 |
+ |
hltmod->SetHLTTreeName(GetHLTTreeName()); |
450 |
|
fDeleteList->Add(hltmod); |
451 |
|
} |
452 |
|
|
469 |
|
} else { |
470 |
|
|
471 |
|
// when not running Proof, we must make a selector |
472 |
< |
fSelector = new Selector; |
473 |
< |
fSelector->SetDoProxy(fDoProxy); |
474 |
< |
|
475 |
< |
fSelector->AddInput(anamod); |
472 |
> |
Selector *sel = new Selector; |
473 |
> |
sel->SetDoProxy(fDoProxy); |
474 |
> |
sel->SetDoObjTabClean(fDoObjTabClean); |
475 |
> |
sel->SetDoRunInfo(kTRUE); |
476 |
> |
sel->SetAllEvtHdrBrn(GetAllEvtHdrBrn()); |
477 |
> |
sel->SetAllEvtTreeName(GetAllEvtTreeName()); |
478 |
> |
sel->SetEvtHdrName(GetEvtHdrName()); |
479 |
> |
sel->SetLAHdrName(GetLAHdrName()); |
480 |
> |
sel->SetLATreeName(GetLATreeName()); |
481 |
> |
sel->SetRunInfoName(GetRunInfoName()); |
482 |
> |
sel->SetRunTreeName(GetRunTreeName()); |
483 |
> |
sel->AddInput(anamod); |
484 |
> |
fSelector = sel; |
485 |
|
|
486 |
|
if (hltmod) |
487 |
|
fSelector->AddInput(hltmod); |