ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/TreeMod/src/OutputMod.cc
(Generate patch)

Comparing UserCode/MitAna/TreeMod/src/OutputMod.cc (file contents):
Revision 1.6 by loizides, Mon Mar 2 13:26:45 2009 UTC vs.
Revision 1.10 by loizides, Mon Mar 23 14:39:52 2009 UTC

# Line 21 | Line 21 | OutputMod::OutputMod(const char *name, c
21    fMaxSize(1024),
22    fCompLevel(9),
23    fSplitLevel(99),
24 <  fBranchSize(32*1024),
24 >  fBranchSize(64*1024),
25    fDoReset(kFALSE),
26    fCheckTamBr(kTRUE),
27    fKeepTamBr(kTRUE),
# Line 30 | Line 30 | OutputMod::OutputMod(const char *name, c
30    fAllEventHeader(0),
31    fRunInfo(0),
32    fLaHeader(0),
33 +  fBranches(0),
34    fNBranchesMax(1024),
35    fRunTree(0),
36    fLATree(0),
37    fAllTree(0),
38 +  fSkimmedIn(0),
39    fL1Tree(0),
40    fHltTree(0),
41    fRunEntries(0),
# Line 59 | Line 61 | void OutputMod::BeginRun()
61  
62    if (!fHltTree) {
63      HLTFwkMod *hm = const_cast<HLTFwkMod*>(GetHltFwkMod());
64 <    fTreeWriter->AddBranchToTree(hm->HLTTreeName(), hm->HLTTabName(), &(hm->fHLTTab), 32000, 0);
65 <    fTreeWriter->AddBranchToTree(hm->HLTTreeName(), hm->HLTLabName(), &(hm->fHLTLab), 32000, 0);
64 >    fTreeWriter->AddBranchToTree(hm->HLTTreeName(), hm->HLTTabName(),
65 >                                 TClass::GetClass(typeid(*hm->fHLTTab))->GetName(),
66 >                                 &(hm->fHLTTab), 32000, 0);
67 >    fTreeWriter->AddBranchToTree(hm->HLTTreeName(), hm->HLTLabName(),
68 >                                 TClass::GetClass(typeid(*hm->fHLTLab))->GetName(),
69 >                                 &(hm->fHLTLab), 32000, 0);
70      fTreeWriter->SetAutoFill(hm->HLTTreeName(), 0);
71      fHltTree = fTreeWriter->GetTree(hm->HLTTreeName());
72    }
# Line 101 | Line 107 | void OutputMod::CheckAndAddBranch(const
107  
108    if (!decision_found) { // no decision found: still drop branch
109      Warning("CheckAndAddBranch",
110 <            "No decision found for branch with name %s and class %s. Branch therefore dropped!",
110 >            "No decision found for branch '%s' and class '%s'. Branch therefore dropped!",
111              bname, cname);
112      return;
113    }
114  
115    if (!decision) { // drop branch according to request
116 <    Info("CheckAndAddBranch", "Dropped branch with name %s and class %s.", bname, cname);
116 >    SendError(kWarning, "CheckAndAddBranch",
117 >              "Dropped branch '%s' and class '%s'.", bname, cname);
118      return;
119    }
120  
121    // add branch to accepted branch list
122 <  Info("CheckAndAddBranch", "Kept branch with name %s and class %s.", bname, cname);
122 >  SendError(kWarning, "CheckAndAddBranch",
123 >            "Kept branch '%s' and class '%s'.", bname, cname);
124  
125    fBrNameList.push_back(string(bname));
126    fBrClassList.push_back(string(cname));
# Line 154 | Line 162 | void OutputMod::CheckAndResolveDep(Bool_
162      const char *cname = br->GetClassName();
163  
164      if (solve) {
165 <      Info("CheckAndResolveDep", "Resolving dependency for loaded branch %s and class %s",
166 <           bname,cname);
165 >      SendError(kWarning, "CheckAndResolveDep",
166 >                "Resolving dependency for loaded branch %s and class %s", bname,cname);
167  
168        fBrNameList.push_back(string(bname));
169        fBrClassList.push_back(string(cname));
# Line 171 | Line 179 | void OutputMod::CheckAndResolveDep(Bool_
179   //--------------------------------------------------------------------------------------------------
180   void OutputMod::EndRun()
181   {
182 <  // Todo
182 >  // Nothing to be done at this point.
183   }
184  
185   //--------------------------------------------------------------------------------------------------
# Line 179 | Line 187 | void OutputMod::FillAllEventHeader(Bool_
187   {
188    // Fill event header into the all-event-header tree.
189  
190 +  if (!fTreeWriter->BeginEvent(kFALSE)) {
191 +    SendError(kAbortAnalysis, "FillAllEventHeader", "Begin event failed!");
192 +    return;
193 +  }
194 +
195 +  if (fSkimmedIn) { // copy alread skimmed headers if any there
196 +    for(UInt_t i=0; i<fSkimmedIn->Entries(); ++i) {
197 +      const EventHeader *eh = fSkimmedIn->At(i);
198 +      fAllEventHeader->SetEvtNum(eh->EvtNum());
199 +      fAllEventHeader->SetLumiSec(eh->LumiSec());
200 +      fAllEventHeader->SetRunNum(eh->RunNum());
201 +      fAllEventHeader->SetRunEntry(eh->RunEntry());
202 +      fAllEventHeader->SetSkimmed(eh->Skimmed()+1);
203 +      fAllTree->Fill();
204 +    }
205 +  }
206 +
207    const EventHeader *eh = GetEventHeader();
208    fAllEventHeader->SetEvtNum(eh->EvtNum());
209    fAllEventHeader->SetLumiSec(eh->LumiSec());
210    fAllEventHeader->SetRunNum(eh->RunNum());
211 <  if (isremoved)
211 >  if (isremoved) {
212      fAllEventHeader->SetRunEntry(-1);
213 <  else
213 >    fAllEventHeader->SetSkimmed(eh->Skimmed()+1);
214 >  } else {
215      fAllEventHeader->SetRunEntry(eh->RunEntry());
216 <  fAllEventHeader->SetIsRemoved(isremoved);
216 >    fAllEventHeader->SetSkimmed(eh->Skimmed());
217 >  }
218  
219    fAllTree->Fill();
220   }
# Line 305 | Line 332 | void OutputMod::Process()
332    ++fCounter;
333  
334    // prepare for tree filling
335 <  fTreeWriter->BeginEvent(fDoReset);
335 >  if (!fTreeWriter->BeginEvent(fDoReset)) {
336 >    SendError(kAbortAnalysis, "Process", "Begin event failed!");
337 >    return;
338 >  }
339  
340    if (GetNEventsProcessed() == 0 && fCheckTamBr) {
341      CheckAndResolveDep(fKeepTamBr);    
# Line 342 | Line 372 | void OutputMod::Process()
372    fEventHeader->SetRunNum(runnum);
373  
374    // 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 ***
375    FillAllEventHeader(kFALSE);
376  
377    // look-up if entry is in map
# Line 375 | Line 403 | void OutputMod::Process()
403    fRunTree->Fill();
404    
405    IncNEventsProcessed();
406 <  fTreeWriter->EndEvent(fDoReset);
406 >
407 >  if (!fTreeWriter->EndEvent(fDoReset)) {
408 >    SendError(kAbortAnalysis, "Process", "End event failed!");
409 >    return;
410 >  }
411   }
412  
413   //--------------------------------------------------------------------------------------------------
# Line 385 | Line 417 | void OutputMod::ProcessAll()
417  
418    if (GetSel()->GetCurEvt() == fLastSeenEvt)
419      return;
420 +
421    fLastSeenEvt = GetSel()->GetCurEvt();
422    ++fCounter;
423  
424 +  // prepare for tree filling
425    FillAllEventHeader(kTRUE);
426   }
427  
# Line 397 | Line 431 | void OutputMod::RequestBranch(const char
431    // Request given branch from TAM.
432  
433    if (GetNBranches()>=fNBranchesMax) {
434 <    Error("RequestBranch", "Can not request branch for %bname"
435 <          "since maximum number of branches [%d] is reached", bname, fNBranchesMax);
434 >    SendError(kAbortAnalysis, "RequestBranch", "Cannot request branch for %bname"
435 >              "since maximum number of branches [%d] is reached", bname, fNBranchesMax);
436      return;
437    }
438    
# Line 415 | Line 449 | void OutputMod::SetupBranches()
449      const char *bname = fBrNameList.at(i).c_str();
450      const char *cname = fBrClassList.at(i).c_str();
451      if (!fBranches[i]) {
452 <      Error("SetupBranches", "Pointer for branch with name %s and class %s is NULL.",
453 <            bname, cname);
452 >      SendError(kWarning, "SetupBranches",
453 >                "Pointer for branch '%s' and class '%s' is NULL.", bname, cname);
454        continue;
455      }
456      fTreeWriter->AddBranch(bname, cname, &fBranches[i]);
# Line 453 | Line 487 | void OutputMod::SlaveBegin()
487    fLaHeader = new LAHeader;
488    tname = GetSel()->GetLATreeName();
489    fTreeWriter->AddBranchToTree(tname, GetSel()->GetLAHdrName(), &fLaHeader);
490 <  fTreeWriter->SetAutoFill(tname,0);
490 >  fTreeWriter->SetAutoFill(tname, 0);
491    fLATree = fTreeWriter->GetTree(tname);
492    fAllEventHeader = new EventHeader;
493    tname = GetSel()->GetAllEvtTreeName();
494    fTreeWriter->AddBranchToTree(tname, GetSel()->GetAllEvtHdrBrn(), &fAllEventHeader);
495    fAllTree = fTreeWriter->GetTree(tname);
496 +  fTreeWriter->SetAutoFill(tname, 0);
497 +
498 +  // get pointer to all event headers
499 +  fSkimmedIn = GetPublicObj<EventHeaderCol>(Names::gkSkimmedHeaders);
500  
463  // get pointer to fAllTreeIn todo
464  // todo
501    // deal here with published objects
502    // todo
503  
# Line 478 | Line 514 | void OutputMod::SlaveTerminate()
514   {
515    // Terminate tree writing and do cleanup.
516  
517 +  RetractObj(Names::gkSkimmedHeaders);
518 +
519    delete fTreeWriter;
520    fTreeWriter = 0;
521  
# Line 489 | Line 527 | void OutputMod::SlaveTerminate()
527    delete[] fBranches;
528  
529    Double_t frac =  100.*GetNEventsProcessed()/fCounter;
530 <  Info("SlaveTerminate", "Stored %.2g%% events (%ld out of %ld)",
531 <       frac, GetNEventsProcessed(), fCounter);
530 >  SendError(kWarning, "SlaveTerminate", "Stored %.2g%% events (%ld out of %ld)",
531 >            frac, GetNEventsProcessed(), fCounter);
532   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines