41 |
|
fL1Entries(0), |
42 |
|
fOrigHltEntry(-1), |
43 |
|
fHltEntries(0), |
44 |
< |
fFileNum(0) |
44 |
> |
fFileNum(0), |
45 |
> |
fLastWrittenEvt(-1), |
46 |
> |
fLastSeenEvt(-1), |
47 |
> |
fCounter(0) |
48 |
|
{ |
49 |
|
// Constructor. |
50 |
|
} |
70 |
|
void OutputMod::CheckAndAddBranch(const char *bname, const char *cname) |
71 |
|
{ |
72 |
|
// Check if the given branch should be kept or dropped. |
73 |
< |
|
73 |
> |
|
74 |
|
if (IsAcceptedBranch(bname)) |
75 |
|
return; |
76 |
|
|
77 |
|
// populate regular expression list if this was not yet done |
78 |
< |
if (fCmdReList.size() != fCmdList.Entries()) { |
79 |
< |
for (UInt_t i=0; i<fCmdList.Entries(); ++i) { |
80 |
< |
const char *ptr = fCmdList.At(i)->c_str(); |
78 |
> |
if (fCmdReList.size() != fCmdList.size()) { |
79 |
> |
for (UInt_t i=0; i<fCmdList.size(); ++i) { |
80 |
> |
const char *ptr = fCmdList.at(i).c_str(); |
81 |
|
fCmdReList.push_back(TRegexp(ptr+5,kTRUE)); |
82 |
|
if (ptr[0]=='k') |
83 |
|
fCmdDeList.push_back(kTRUE); |
91 |
|
Bool_t decision = kFALSE; |
92 |
|
Bool_t decision_found = kFALSE; |
93 |
|
|
94 |
< |
for (UInt_t i=0; i<fCmdList.Entries(); ++i) { |
94 |
> |
for (UInt_t i=0; i<fCmdList.size(); ++i) { |
95 |
|
TRegexp &re(fCmdReList.at(i)); |
96 |
|
if (brname.Index(re) == kNPOS) |
97 |
|
continue; |
114 |
|
// add branch to accepted branch list |
115 |
|
Info("CheckAndAddBranch", "Kept branch with name %s and class %s.", bname, cname); |
116 |
|
|
117 |
< |
fBrNameList.AddCopy(string(bname)); |
118 |
< |
fBrClassList.AddCopy(string(cname)); |
117 |
> |
fBrNameList.push_back(string(bname)); |
118 |
> |
fBrClassList.push_back(string(cname)); |
119 |
|
|
120 |
|
// request branch |
121 |
|
RequestBranch(bname); |
129 |
|
|
130 |
|
const THashTable &ht = GetSel()->GetBranchTable(); |
131 |
|
|
132 |
< |
TIterator *iter = ht.MakeIterator(); |
133 |
< |
const TAMBranchInfo *next = dynamic_cast<const TAMBranchInfo*>(iter->Next()); |
132 |
> |
TIter iter(ht.MakeIterator()); |
133 |
> |
const TAMBranchInfo *next = dynamic_cast<const TAMBranchInfo*>(iter.Next()); |
134 |
|
|
135 |
|
while (next) { |
136 |
|
const TAMBranchInfo *cur = next; |
137 |
< |
next = dynamic_cast<const TAMBranchInfo*>(iter->Next()); |
137 |
> |
next = dynamic_cast<const TAMBranchInfo*>(iter.Next()); |
138 |
|
Bool_t isloaded = cur->IsLoaded(); |
139 |
|
if (!isloaded) |
140 |
|
continue; |
157 |
|
Info("CheckAndResolveDep", "Resolving dependency for loaded branch %s and class %s", |
158 |
|
bname,cname); |
159 |
|
|
160 |
< |
fBrNameList.AddCopy(string(bname)); |
161 |
< |
fBrClassList.AddCopy(string(cname)); |
160 |
> |
fBrNameList.push_back(string(bname)); |
161 |
> |
fBrClassList.push_back(string(cname)); |
162 |
|
fBranches[GetNBranches()-1] = reinterpret_cast<TObject*>(loader->GetAddress()); |
163 |
|
|
164 |
|
} else { |
169 |
|
} |
170 |
|
|
171 |
|
//-------------------------------------------------------------------------------------------------- |
172 |
+ |
void OutputMod::EndRun() |
173 |
+ |
{ |
174 |
+ |
// Todo |
175 |
+ |
} |
176 |
+ |
|
177 |
+ |
//-------------------------------------------------------------------------------------------------- |
178 |
|
void OutputMod::FillAllEventHeader(Bool_t isremoved) |
179 |
|
{ |
180 |
|
// Fill event header into the all-event-header tree. |
204 |
|
//-------------------------------------------------------------------------------------------------- |
205 |
|
void OutputMod::FillHltInfo() |
206 |
|
{ |
207 |
< |
// Todo. |
207 |
> |
// Write HLT trigger table if needed. |
208 |
|
|
209 |
|
if (!fHltTree) |
210 |
|
return; |
225 |
|
|
226 |
|
// search in branch list |
227 |
|
for (UInt_t i=0; i<GetNBranches(); ++i) { |
228 |
< |
if (fBrNameList.At(i)->compare(bname) == 0) |
228 |
> |
if (fBrNameList.at(i).compare(bname) == 0) |
229 |
|
return kTRUE; |
230 |
|
} |
231 |
|
|
281 |
|
// Loop over requested branches and load them. |
282 |
|
|
283 |
|
for (UInt_t i=0; i<GetNBranches(); ++i) { |
284 |
< |
LoadBranch(fBrNameList.At(i)->c_str()); |
284 |
> |
LoadBranch(fBrNameList.at(i).c_str()); |
285 |
|
} |
286 |
|
} |
287 |
|
|
291 |
|
// Write out the kept branches of the current event. Make sure the meta information is |
292 |
|
// correctly updated. |
293 |
|
|
294 |
+ |
if (GetSel()->GetCurEvt() == fLastSeenEvt) { |
295 |
+ |
Warning("Process", "Event with %ul already seen", fLastSeenEvt); |
296 |
+ |
return; |
297 |
+ |
} |
298 |
+ |
fLastSeenEvt = GetSel()->GetCurEvt(); |
299 |
+ |
|
300 |
+ |
if (GetSel()->GetCurEvt() == fLastWrittenEvt) { |
301 |
+ |
Warning("Process", "Event with %ul already written", fLastWrittenEvt); |
302 |
+ |
return; |
303 |
+ |
} |
304 |
+ |
fLastWrittenEvt = GetSel()->GetCurEvt(); |
305 |
+ |
++fCounter; |
306 |
+ |
|
307 |
+ |
// prepare for tree filling |
308 |
|
fTreeWriter->BeginEvent(fDoReset); |
309 |
|
|
310 |
|
if (GetNEventsProcessed() == 0 && fCheckTamBr) { |
311 |
|
CheckAndResolveDep(fKeepTamBr); |
312 |
|
} |
313 |
|
|
314 |
+ |
// load all our branches |
315 |
|
LoadBranches(); |
316 |
|
|
317 |
+ |
// pass our branches to tree writer if on first event |
318 |
|
if (GetNEventsProcessed() == 0) { |
319 |
< |
SetupBranches(); |
319 |
> |
SetupBranches(); |
320 |
|
} |
321 |
|
|
322 |
|
// reset per file quantities if a new file was opened |
383 |
|
{ |
384 |
|
// Called by the Selector class for events that were skipped. |
385 |
|
|
386 |
+ |
if (GetSel()->GetCurEvt() == fLastSeenEvt) |
387 |
+ |
return; |
388 |
+ |
fLastSeenEvt = GetSel()->GetCurEvt(); |
389 |
+ |
++fCounter; |
390 |
+ |
|
391 |
|
FillAllEventHeader(kTRUE); |
392 |
|
} |
393 |
|
|
403 |
|
} |
404 |
|
|
405 |
|
fBranches[GetNBranches()-1] = 0; |
406 |
< |
ReqBranch(bname, fBranches[GetNBranches()-1]); |
406 |
> |
TAModule::ReqBranch(bname, fBranches[GetNBranches()-1]); |
407 |
|
} |
408 |
|
|
409 |
|
//-------------------------------------------------------------------------------------------------- |
412 |
|
// Setup branches in tree writer. |
413 |
|
|
414 |
|
for (UInt_t i=0; i<GetNBranches(); ++i) { |
415 |
< |
const char *bname = fBrNameList.At(i)->c_str(); |
416 |
< |
const char *cname = fBrClassList.At(i)->c_str(); |
415 |
> |
const char *bname = fBrNameList.at(i).c_str(); |
416 |
> |
const char *cname = fBrClassList.at(i).c_str(); |
417 |
|
if (!fBranches[i]) { |
418 |
|
Error("SetupBranches", "Pointer for branch with name %s and class %s is NULL.", |
419 |
|
bname, cname); |
487 |
|
delete fAllEventHeader; |
488 |
|
|
489 |
|
delete[] fBranches; |
460 |
– |
} |
490 |
|
|
491 |
+ |
Double_t frac = 100.*GetNEventsProcessed()/fCounter; |
492 |
+ |
Info("SlaveTerminate", "Stored %.2g%% events (%ld out of %ld)", |
493 |
+ |
frac, GetNEventsProcessed(), fCounter); |
494 |
+ |
} |