3 |
|
#include "MitAna/TreeMod/interface/OutputMod.h" |
4 |
|
#include "MitAna/TreeMod/interface/HLTFwkMod.h" |
5 |
|
#include "MitAna/DataUtil/interface/Debug.h" |
6 |
+ |
#include "MitAna/DataTree/interface/BranchTable.h" |
7 |
+ |
#include "MitAna/DataTree/interface/EventHeaderCol.h" |
8 |
|
#include "MitAna/DataTree/interface/Names.h" |
9 |
|
#include "MitAna/DataUtil/interface/TreeWriter.h" |
10 |
|
#include "MitAna/TreeMod/interface/TreeBranchLoader.h" |
23 |
|
fMaxSize(1024), |
24 |
|
fCompLevel(9), |
25 |
|
fSplitLevel(99), |
26 |
< |
fBranchSize(32*1024), |
26 |
> |
fBranchSize(16*1024), |
27 |
|
fDoReset(kFALSE), |
28 |
+ |
fUseBrDep(kTRUE), |
29 |
|
fCheckTamBr(kTRUE), |
30 |
< |
fKeepTamBr(kTRUE), |
30 |
> |
fKeepTamBr(kFALSE), |
31 |
|
fTreeWriter(0), |
32 |
|
fEventHeader(0), |
33 |
|
fAllEventHeader(0), |
34 |
|
fRunInfo(0), |
35 |
|
fLaHeader(0), |
36 |
+ |
fBranchTable(0), |
37 |
+ |
fBranches(0), |
38 |
|
fNBranchesMax(1024), |
39 |
|
fRunTree(0), |
40 |
|
fLATree(0), |
41 |
|
fAllTree(0), |
42 |
< |
fL1Tree(0), |
42 |
> |
fSkimmedIn(0), |
43 |
|
fHltTree(0), |
44 |
+ |
fHLTTab(new vector<string>), |
45 |
+ |
fHLTLab(new vector<string>), |
46 |
|
fRunEntries(0), |
40 |
– |
fOrigL1Entry(-1), |
41 |
– |
fL1Entries(0), |
42 |
– |
fOrigHltEntry(-1), |
47 |
|
fHltEntries(0), |
48 |
< |
fFileNum(0), |
48 |
> |
fFileNum(-1), |
49 |
|
fLastWrittenEvt(-1), |
50 |
|
fLastSeenEvt(-1), |
51 |
|
fCounter(0) |
63 |
|
|
64 |
|
if (!fHltTree) { |
65 |
|
HLTFwkMod *hm = const_cast<HLTFwkMod*>(GetHltFwkMod()); |
66 |
< |
fTreeWriter->AddBranchToTree(hm->HLTTreeName(), hm->HLTTabName(), &(hm->fHLTTab), 32000, 0); |
67 |
< |
fTreeWriter->AddBranchToTree(hm->HLTTreeName(), hm->HLTLabName(), &(hm->fHLTLab), 32000, 0); |
66 |
> |
fTreeWriter->AddBranchToTree(hm->HLTTreeName(), hm->HLTTabName(), |
67 |
> |
TClass::GetClass(typeid(*fHLTTab))->GetName(), |
68 |
> |
&fHLTTab, 32000, 0); |
69 |
> |
fTreeWriter->AddBranchToTree(hm->HLTTreeName(), hm->HLTLabName(), |
70 |
> |
TClass::GetClass(typeid(*fHLTLab))->GetName(), |
71 |
> |
&fHLTLab, 32000, 0); |
72 |
|
fTreeWriter->SetAutoFill(hm->HLTTreeName(), 0); |
73 |
|
fHltTree = fTreeWriter->GetTree(hm->HLTTreeName()); |
74 |
|
} |
109 |
|
|
110 |
|
if (!decision_found) { // no decision found: still drop branch |
111 |
|
Warning("CheckAndAddBranch", |
112 |
< |
"No decision found for branch with name %s and class %s. Branch therefore dropped!", |
112 |
> |
"No decision found for branch '%s' and class '%s'. Branch therefore dropped!", |
113 |
|
bname, cname); |
114 |
|
return; |
115 |
|
} |
116 |
|
|
117 |
|
if (!decision) { // drop branch according to request |
118 |
< |
Info("CheckAndAddBranch", "Dropped branch with name %s and class %s.", bname, cname); |
118 |
> |
Info("CheckAndAddBranch", |
119 |
> |
"Dropped branch '%s' and class '%s'", bname, cname); |
120 |
|
return; |
121 |
|
} |
122 |
|
|
123 |
|
// add branch to accepted branch list |
124 |
< |
Info("CheckAndAddBranch", "Kept branch with name %s and class %s.", bname, cname); |
124 |
> |
Info("CheckAndAddBranch", |
125 |
> |
"Kept branch '%s' and class '%s'", bname, cname); |
126 |
|
|
127 |
|
fBrNameList.push_back(string(bname)); |
128 |
|
fBrClassList.push_back(string(cname)); |
129 |
+ |
} |
130 |
|
|
131 |
< |
// request branch |
132 |
< |
RequestBranch(bname); |
131 |
> |
//-------------------------------------------------------------------------------------------------- |
132 |
> |
Bool_t OutputMod::CheckAndResolveBranchDep() |
133 |
> |
{ |
134 |
> |
// Checks dependency in BranchTable. Resolve dependency automatically if fUserBrDep is kTRUE. |
135 |
> |
|
136 |
> |
TFile *cfile = const_cast<TFile*>(GetSel()->GetCurrentFile()); |
137 |
> |
if (!cfile) |
138 |
> |
return kFALSE; |
139 |
> |
|
140 |
> |
BranchTable *br = dynamic_cast<BranchTable*>(cfile->Get(Names::gkBranchTable)); |
141 |
> |
if (!br) |
142 |
> |
return kFALSE; |
143 |
> |
|
144 |
> |
TList *blist = br->GetBranches(); |
145 |
> |
if (!blist) |
146 |
> |
return kFALSE; |
147 |
> |
|
148 |
> |
fBranchTable = new BranchTable; |
149 |
> |
fBranchTable->SetName(Names::gkBranchTable); |
150 |
> |
fBranchTable->SetOwner(); |
151 |
> |
|
152 |
> |
TList sht; |
153 |
> |
sht.SetOwner(kTRUE); |
154 |
> |
for (UInt_t i=0; i<fBrNameList.size(); ++i) { |
155 |
> |
sht.Add(new TObjString(fBrNameList.at(i).c_str())); |
156 |
> |
} |
157 |
> |
|
158 |
> |
for (UInt_t i=0; i<fBrNameList.size(); ++i) { |
159 |
> |
TString brname(fBrNameList.at(i)); |
160 |
> |
if (!blist->FindObject(brname)) |
161 |
> |
continue; |
162 |
> |
TList *bdeps = br->GetDepBranches(brname); |
163 |
> |
if (!bdeps) |
164 |
> |
continue; |
165 |
> |
|
166 |
> |
// check dependency |
167 |
> |
TIter iter(bdeps->MakeIterator()); |
168 |
> |
const TObjString *n = dynamic_cast<const TObjString*>(iter.Next()); |
169 |
> |
while (n) { |
170 |
> |
if (sht.FindObject(n->GetName())) { |
171 |
> |
// dependent branch is already accepted |
172 |
> |
fBranchTable->Add(new BranchName(brname,n->GetName())); |
173 |
> |
} else { |
174 |
> |
if (fUseBrDep) { |
175 |
> |
const TObjArray *arr = GetSel()->GetTree()->GetTree()->GetListOfBranches(); |
176 |
> |
TBranch *br = dynamic_cast<TBranch*>(arr->FindObject(n->GetName())); |
177 |
> |
if (!br) { |
178 |
> |
Error("CheckAndResolveBranchDep", |
179 |
> |
"Could not get branch '%s' to resolve dependency for branch '%s'", |
180 |
> |
n->GetName(), brname.Data()); |
181 |
> |
} else { |
182 |
> |
Info("CheckAndResolveBranchDep", |
183 |
> |
"Adding branch '%s' to resolve dependency for branch '%s'", |
184 |
> |
n->GetName(), brname.Data()); |
185 |
> |
fBrNameList.push_back(string(n->GetName())); |
186 |
> |
fBrClassList.push_back(br->GetClassName()); |
187 |
> |
sht.Add(new TObjString(n->GetName())); |
188 |
> |
fBranchTable->Add(new BranchName(brname,n->GetName())); |
189 |
> |
} |
190 |
> |
} else { |
191 |
> |
Warning("CheckAndResolveBranchDep", |
192 |
> |
"Unresolved dependency of branch '%s' and '%s' ", |
193 |
> |
n->GetName(), brname.Data()); |
194 |
> |
} |
195 |
> |
} |
196 |
> |
n = dynamic_cast<const TObjString*>(iter.Next()); |
197 |
> |
} |
198 |
> |
delete bdeps; |
199 |
> |
} |
200 |
> |
delete blist; |
201 |
> |
return kTRUE; |
202 |
|
} |
203 |
|
|
204 |
|
//-------------------------------------------------------------------------------------------------- |
205 |
< |
void OutputMod::CheckAndResolveDep(Bool_t solve) |
205 |
> |
void OutputMod::CheckAndResolveTAMDep(Bool_t solve) |
206 |
|
{ |
207 |
|
// Check if TAM has loaded additional branches. If requested try to solve the the dependency |
208 |
|
// by adding the branch to the list of branches. |
234 |
|
const char *cname = br->GetClassName(); |
235 |
|
|
236 |
|
if (solve) { |
237 |
< |
Info("CheckAndResolveDep", "Resolving dependency for loaded branch %s and class %s", |
238 |
< |
bname,cname); |
237 |
> |
Info("CheckAndResolveTAMDep", |
238 |
> |
"Resolving dependency for loaded branch '%s' and class '%s'", bname,cname); |
239 |
|
|
240 |
|
fBrNameList.push_back(string(bname)); |
241 |
|
fBrClassList.push_back(string(cname)); |
242 |
|
fBranches[GetNBranches()-1] = reinterpret_cast<TObject*>(loader->GetAddress()); |
243 |
|
|
244 |
|
} else { |
245 |
< |
Warning("CheckAndResolveDep", "Unresolved dependency for loaded branch %s and class %s", |
245 |
> |
Warning("CheckAndResolveTAMDep", |
246 |
> |
"Unresolved dependency for loaded branch '%s' and class '%s'", |
247 |
|
bname,cname); |
248 |
|
} |
249 |
|
} |
252 |
|
//-------------------------------------------------------------------------------------------------- |
253 |
|
void OutputMod::EndRun() |
254 |
|
{ |
255 |
< |
// Todo |
255 |
> |
// Nothing to be done at this point. |
256 |
|
} |
257 |
|
|
258 |
|
//-------------------------------------------------------------------------------------------------- |
260 |
|
{ |
261 |
|
// Fill event header into the all-event-header tree. |
262 |
|
|
263 |
+ |
if (!fTreeWriter->BeginEvent(kFALSE)) { |
264 |
+ |
SendError(kAbortAnalysis, "FillAllEventHeader", "Begin event failed!"); |
265 |
+ |
return; |
266 |
+ |
} |
267 |
+ |
|
268 |
+ |
if (fSkimmedIn) { // copy alread skimmed headers if any there |
269 |
+ |
for(UInt_t i=0; i<fSkimmedIn->Entries(); ++i) { |
270 |
+ |
const EventHeader *eh = fSkimmedIn->At(i); |
271 |
+ |
fAllEventHeader->SetEvtNum(eh->EvtNum()); |
272 |
+ |
fAllEventHeader->SetLumiSec(eh->LumiSec()); |
273 |
+ |
fAllEventHeader->SetRunNum(eh->RunNum()); |
274 |
+ |
fAllEventHeader->SetRunEntry(eh->RunEntry()); |
275 |
+ |
fAllEventHeader->SetSkimmed(eh->Skimmed()+1); |
276 |
+ |
fAllTree->Fill(); |
277 |
+ |
} |
278 |
+ |
} |
279 |
+ |
|
280 |
|
const EventHeader *eh = GetEventHeader(); |
281 |
|
fAllEventHeader->SetEvtNum(eh->EvtNum()); |
282 |
|
fAllEventHeader->SetLumiSec(eh->LumiSec()); |
283 |
|
fAllEventHeader->SetRunNum(eh->RunNum()); |
284 |
< |
if (isremoved) |
284 |
> |
if (isremoved) { |
285 |
|
fAllEventHeader->SetRunEntry(-1); |
286 |
< |
else |
286 |
> |
fAllEventHeader->SetSkimmed(eh->Skimmed()+1); |
287 |
> |
} else { |
288 |
|
fAllEventHeader->SetRunEntry(eh->RunEntry()); |
289 |
< |
fAllEventHeader->SetIsRemoved(isremoved); |
289 |
> |
fAllEventHeader->SetSkimmed(eh->Skimmed()); |
290 |
> |
} |
291 |
|
|
292 |
|
fAllTree->Fill(); |
293 |
|
} |
294 |
|
|
295 |
|
//-------------------------------------------------------------------------------------------------- |
196 |
– |
void OutputMod::FillL1Info() |
197 |
– |
{ |
198 |
– |
// Not doing anything here until the production writes out L1 information. |
199 |
– |
|
200 |
– |
if (!fL1Tree) |
201 |
– |
return; |
202 |
– |
} |
203 |
– |
|
204 |
– |
//-------------------------------------------------------------------------------------------------- |
296 |
|
void OutputMod::FillHltInfo() |
297 |
|
{ |
298 |
|
// Write HLT trigger table if needed. |
300 |
|
if (!fHltTree) |
301 |
|
return; |
302 |
|
|
303 |
< |
if (fOrigHltEntry == GetHltFwkMod()->fCurEnt) |
303 |
> |
HLTFwkMod *hm = const_cast<HLTFwkMod*>(GetHltFwkMod()); |
304 |
> |
vector<string> *trigtable = hm->fHLTTab; |
305 |
> |
vector<string> *labels = hm->fHLTLab; |
306 |
> |
|
307 |
> |
Bool_t doCopy = kFALSE; |
308 |
> |
if (fHLTTab->size()==0) { |
309 |
> |
doCopy = kTRUE; |
310 |
> |
} else { |
311 |
> |
// check if existing table contains all necessary paths: |
312 |
> |
// if so keep it, otherwise store the new one |
313 |
> |
|
314 |
> |
if ((fHLTTab->size() != trigtable->size()) || |
315 |
> |
(fHLTLab->size() != labels->size())) { |
316 |
> |
doCopy = kTRUE; |
317 |
> |
} else { |
318 |
> |
// need to check more thoroughly |
319 |
> |
|
320 |
> |
for (UInt_t i=0; i<trigtable->size(); ++i) { |
321 |
> |
if (trigtable->at(i) != fHLTTab->at(i)) { |
322 |
> |
doCopy = kTRUE; |
323 |
> |
break; |
324 |
> |
} |
325 |
> |
} |
326 |
> |
if (!doCopy) { |
327 |
> |
for (UInt_t i=0; i<labels->size(); ++i) { |
328 |
> |
if (labels->at(i) != fHLTLab->at(i)) { |
329 |
> |
doCopy = kTRUE; |
330 |
> |
break; |
331 |
> |
} |
332 |
> |
} |
333 |
> |
} |
334 |
> |
} |
335 |
> |
} |
336 |
> |
|
337 |
> |
if (!doCopy) |
338 |
|
return; |
339 |
|
|
340 |
< |
fHltTree->Fill(); |
341 |
< |
fOrigHltEntry = GetHltFwkMod()->fCurEnt; |
340 |
> |
fHLTTab->resize(trigtable->size()); |
341 |
> |
copy(trigtable->begin(),trigtable->end(), fHLTTab->begin()); |
342 |
> |
fHLTLab->resize(labels->size()); |
343 |
> |
copy(labels->begin(),labels->end(), fHLTLab->begin()); |
344 |
> |
|
345 |
|
++fHltEntries; |
346 |
+ |
fHltTree->Fill(); |
347 |
|
} |
348 |
|
|
349 |
|
//-------------------------------------------------------------------------------------------------- |
371 |
|
Bool_t OutputMod::Notify() |
372 |
|
{ |
373 |
|
// On first notify, loop over list of branches to determine the list of kept branches. |
374 |
< |
|
374 |
> |
cout << "NOOOOOOOOOOOOOTIIIFYYYYYYYYYYYY" <<endl; |
375 |
|
if (GetNEventsProcessed() != 0) |
376 |
|
return kTRUE; |
377 |
|
|
378 |
< |
TTree *tree=const_cast<TTree*>(GetSel()->GetTree()); |
378 |
> |
const TTree *tree=GetSel()->GetTree(); |
379 |
|
if (!tree) |
380 |
|
return kFALSE; |
381 |
|
|
382 |
< |
TObjArray *arr = tree->GetTree()->GetListOfBranches(); |
382 |
> |
const TObjArray *arr = tree->GetTree()->GetListOfBranches(); |
383 |
|
if (!arr) |
384 |
|
return kFALSE; |
385 |
|
|
393 |
|
continue; |
394 |
|
|
395 |
|
if (!cls->InheritsFrom("TObject")) { |
396 |
< |
Warning("Notify", "Found branch %s where class %s does not derive from TObject.", |
396 |
> |
Warning("Notify", "Found branch '%s' where class '%s' does not derive from TObject", |
397 |
|
br->GetName(), br->GetClassName()); |
398 |
|
continue; |
399 |
|
} |
401 |
|
CheckAndAddBranch(br->GetName(), br->GetClassName()); |
402 |
|
} |
403 |
|
|
404 |
+ |
if (!CheckAndResolveBranchDep()) |
405 |
+ |
return kFALSE; |
406 |
+ |
|
407 |
+ |
RequestBranches(); |
408 |
|
return kTRUE; |
409 |
|
} |
410 |
|
|
414 |
|
// Loop over requested branches and load them. |
415 |
|
|
416 |
|
for (UInt_t i=0; i<GetNBranches(); ++i) { |
417 |
+ |
cout << i << " " << fBrNameList.at(i)<< endl; |
418 |
|
LoadBranch(fBrNameList.at(i).c_str()); |
419 |
|
} |
420 |
|
} |
439 |
|
++fCounter; |
440 |
|
|
441 |
|
// prepare for tree filling |
442 |
< |
fTreeWriter->BeginEvent(fDoReset); |
442 |
> |
if (!fTreeWriter->BeginEvent(fDoReset)) { |
443 |
> |
SendError(kAbortAnalysis, "Process", "Begin event failed!"); |
444 |
> |
return; |
445 |
> |
} |
446 |
|
|
447 |
|
if (GetNEventsProcessed() == 0 && fCheckTamBr) { |
448 |
< |
CheckAndResolveDep(fKeepTamBr); |
448 |
> |
CheckAndResolveTAMDep(fKeepTamBr); |
449 |
|
} |
450 |
|
|
451 |
|
// load all our branches |
460 |
|
if (fTreeWriter->GetFileNumber()!=fFileNum) { |
461 |
|
fRunmap.clear(); |
462 |
|
fRunEntries = 0; |
463 |
< |
fL1Entries = -1; |
327 |
< |
fHltEntries = -1; |
463 |
> |
fHltEntries = 0; |
464 |
|
fFileNum = fTreeWriter->GetFileNumber(); |
465 |
+ |
fTreeWriter->StoreObject(fBranchTable); |
466 |
|
} |
467 |
|
|
468 |
|
UInt_t runnum = GetEventHeader()->RunNum(); |
479 |
|
fEventHeader->SetRunNum(runnum); |
480 |
|
|
481 |
|
// fill all event header |
345 |
– |
// *** note that we need to read an existing tree in |
346 |
– |
// the future to make sure we can do skims of skims *** |
482 |
|
FillAllEventHeader(kFALSE); |
483 |
|
|
484 |
|
// look-up if entry is in map |
499 |
|
fRunmap.insert(pair<UInt_t,Int_t>(runnum,runentry)); |
500 |
|
fRunInfo->SetRunNum(runnum); |
501 |
|
|
367 |
– |
Int_t l1entry = fL1Entries; |
368 |
– |
FillL1Info(); |
369 |
– |
fRunInfo->SetL1Entry(l1entry); |
370 |
– |
|
502 |
|
Int_t hltentry = fHltEntries; |
503 |
|
FillHltInfo(); |
504 |
< |
fRunInfo->SetHltEntry(hltentry); |
504 |
> |
if (hltentry < fHltEntries) |
505 |
> |
fRunInfo->SetHltEntry(hltentry); |
506 |
> |
else |
507 |
> |
fRunInfo->SetHltEntry(hltentry-1); |
508 |
|
|
509 |
|
fRunTree->Fill(); |
510 |
< |
|
510 |
> |
|
511 |
|
IncNEventsProcessed(); |
512 |
< |
fTreeWriter->EndEvent(fDoReset); |
512 |
> |
|
513 |
> |
if (!fTreeWriter->EndEvent(fDoReset)) { |
514 |
> |
SendError(kAbortAnalysis, "Process", "End event failed!"); |
515 |
> |
return; |
516 |
> |
} |
517 |
|
} |
518 |
|
|
519 |
|
//-------------------------------------------------------------------------------------------------- |
523 |
|
|
524 |
|
if (GetSel()->GetCurEvt() == fLastSeenEvt) |
525 |
|
return; |
526 |
+ |
|
527 |
|
fLastSeenEvt = GetSel()->GetCurEvt(); |
528 |
|
++fCounter; |
529 |
|
|
530 |
+ |
// prepare for tree filling |
531 |
|
FillAllEventHeader(kTRUE); |
532 |
|
} |
533 |
|
|
534 |
|
//-------------------------------------------------------------------------------------------------- |
535 |
< |
void OutputMod::RequestBranch(const char *bname) |
535 |
> |
void OutputMod::RequestBranches() |
536 |
|
{ |
537 |
< |
// Request given branch from TAM. |
537 |
> |
// Loop over requested branches and request them. |
538 |
|
|
539 |
< |
if (GetNBranches()>=fNBranchesMax) { |
540 |
< |
Error("RequestBranch", "Can not request branch for %bname" |
541 |
< |
"since maximum number of branches [%d] is reached", bname, fNBranchesMax); |
542 |
< |
return; |
539 |
> |
cout << "Requestbbbbbbbbbbbbbbrrrrrrrrrrrrrrrrrrrrrrr " << endl; |
540 |
> |
|
541 |
> |
for (UInt_t i=0; i<GetNBranches(); ++i) { |
542 |
> |
if (i>=fNBranchesMax) { |
543 |
> |
SendError(kAbortAnalysis, "RequestBranches", "Cannot request branch '%s' " |
544 |
> |
"since maximum number of branches [%d] is reached", |
545 |
> |
fBrNameList.at(i).c_str(), fNBranchesMax); |
546 |
> |
return; |
547 |
> |
} |
548 |
> |
fBranches[i] = 0; |
549 |
> |
cout << "Request " << i << " " << fBrNameList.at(i) << endl; |
550 |
> |
TAModule::ReqBranch(fBrNameList.at(i).c_str(), fBranches[i]); |
551 |
|
} |
404 |
– |
|
405 |
– |
fBranches[GetNBranches()-1] = 0; |
406 |
– |
TAModule::ReqBranch(bname, fBranches[GetNBranches()-1]); |
552 |
|
} |
553 |
|
|
554 |
|
//-------------------------------------------------------------------------------------------------- |
560 |
|
const char *bname = fBrNameList.at(i).c_str(); |
561 |
|
const char *cname = fBrClassList.at(i).c_str(); |
562 |
|
if (!fBranches[i]) { |
563 |
< |
Error("SetupBranches", "Pointer for branch with name %s and class %s is NULL.", |
564 |
< |
bname, cname); |
563 |
> |
SendError(kWarning, "SetupBranches", |
564 |
> |
"Pointer for branch '%s' and class '%s' is NULL", bname, cname); |
565 |
|
continue; |
566 |
|
} |
567 |
< |
fTreeWriter->AddBranch(bname, cname, &fBranches[i]); |
567 |
> |
Int_t bsize = fBranchSize; |
568 |
> |
TString cnamestr(cname); |
569 |
> |
if ((bsize<128*1024) && (cnamestr.Contains("mithep::MCParticle"))) { |
570 |
> |
bsize=128*1024; |
571 |
> |
} else if ((bsize<32*1024) && (cnamestr.Contains("mithep::CaloTower"))) { |
572 |
> |
bsize=32*1024; |
573 |
> |
} |
574 |
> |
|
575 |
> |
fTreeWriter->AddBranch(bname, cname, &fBranches[i], bsize); |
576 |
|
} |
577 |
|
} |
578 |
|
|
606 |
|
fLaHeader = new LAHeader; |
607 |
|
tname = GetSel()->GetLATreeName(); |
608 |
|
fTreeWriter->AddBranchToTree(tname, GetSel()->GetLAHdrName(), &fLaHeader); |
609 |
< |
fTreeWriter->SetAutoFill(tname,0); |
609 |
> |
fTreeWriter->SetAutoFill(tname, 0); |
610 |
|
fLATree = fTreeWriter->GetTree(tname); |
611 |
|
fAllEventHeader = new EventHeader; |
612 |
|
tname = GetSel()->GetAllEvtTreeName(); |
613 |
|
fTreeWriter->AddBranchToTree(tname, GetSel()->GetAllEvtHdrBrn(), &fAllEventHeader); |
614 |
|
fAllTree = fTreeWriter->GetTree(tname); |
615 |
+ |
fTreeWriter->SetAutoFill(tname, 0); |
616 |
|
|
617 |
< |
// get pointer to fAllTreeIn todo |
618 |
< |
// todo |
465 |
< |
// deal here with published objects |
466 |
< |
// todo |
617 |
> |
// get pointer to all event headers |
618 |
> |
fSkimmedIn = GetPublicObj<EventHeaderCol>(Names::gkSkimmedHeaders); |
619 |
|
|
620 |
|
// create TObject space for TAM |
621 |
< |
fBranches = new TObject*[fNBranchesMax]; |
621 |
> |
fBranches = new TObject*[fNBranchesMax + fAddList.size()]; |
622 |
> |
|
623 |
> |
// deal here with additional published objects |
624 |
> |
for (UInt_t i=0; i<fAddList.size(); ++i) { |
625 |
> |
TString objname(fAddList.at(i)); |
626 |
> |
TObject *obj = FindPublicObj(objname); |
627 |
> |
if (obj) { |
628 |
> |
fBranches[fNBranchesMax+i] = obj; |
629 |
> |
fTreeWriter->AddBranch(objname, &fBranches[fNBranchesMax+i]); |
630 |
> |
Info("SlaveBegin", "Adding additional branch named '%s' as requested", objname.Data()); |
631 |
> |
} else { |
632 |
> |
SendError(kAbortAnalysis, "SlaveBegin", |
633 |
> |
"Object named '%s' for additional branch is NULL", objname.Data()); |
634 |
> |
} |
635 |
> |
} |
636 |
|
|
637 |
|
// adjust checks for TAM branches |
638 |
|
if (fKeepTamBr) |
644 |
|
{ |
645 |
|
// Terminate tree writing and do cleanup. |
646 |
|
|
647 |
+ |
RetractObj(Names::gkSkimmedHeaders); |
648 |
+ |
|
649 |
|
delete fTreeWriter; |
650 |
|
fTreeWriter = 0; |
651 |
|
|
657 |
|
delete[] fBranches; |
658 |
|
|
659 |
|
Double_t frac = 100.*GetNEventsProcessed()/fCounter; |
660 |
< |
Info("SlaveTerminate", "Stored %.2g%% events (%ld out of %ld)", |
660 |
> |
Info("SlaveTerminate", "Stored %.2f%% events (%ld out of %ld)", |
661 |
|
frac, GetNEventsProcessed(), fCounter); |
662 |
|
} |