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.8 by loizides, Wed Mar 11 10:07:12 2009 UTC vs.
Revision 1.9 by loizides, Thu Mar 12 18:24:33 2009 UTC

# 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 105 | 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      SendError(kWarning, "CheckAndAddBranch",
117 <              "Dropped branch with name %s and class %s.", bname, cname);
117 >              "Dropped branch '%s' and class '%s'.", bname, cname);
118      return;
119    }
120  
121    // add branch to accepted branch list
122    SendError(kWarning, "CheckAndAddBranch",
123 <            "Kept branch with name %s and class %s.", bname, cname);
123 >            "Kept branch '%s' and class '%s'.", bname, cname);
124  
125    fBrNameList.push_back(string(bname));
126    fBrClassList.push_back(string(cname));
# Line 177 | 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 185 | 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->SetSkimmed(eh->Skimmed()+1);
216 >    fAllEventHeader->SetSkimmed(eh->Skimmed());
217 >  }
218  
219    fAllTree->Fill();
220   }
# Line 351 | Line 372 | void OutputMod::Process()
372    fEventHeader->SetRunNum(runnum);
373  
374    // fill all event header
354  //  *** note that we need to read an existing tree in
355  //      the future to make sure we can do skims of skims ***
375    FillAllEventHeader(kFALSE);
376  
377    // look-up if entry is in map
# Line 403 | Line 422 | void OutputMod::ProcessAll()
422    ++fCounter;
423  
424    // prepare for tree filling
406  if (!fTreeWriter->BeginEvent(kFALSE)) {
407    SendError(kAbortAnalysis, "ProcessAll", "Begin event failed!");
408    return;
409  }
410
425    FillAllEventHeader(kTRUE);
426   }
427  
# Line 436 | Line 450 | void OutputMod::SetupBranches()
450      const char *cname = fBrClassList.at(i).c_str();
451      if (!fBranches[i]) {
452        SendError(kWarning, "SetupBranches",
453 <                "Pointer for branch with name %s and class %s is NULL.", bname, cname);
453 >                "Pointer for branch '%s' and class '%s' is NULL.", bname, cname);
454        continue;
455      }
456      fTreeWriter->AddBranch(bname, cname, &fBranches[i]);
# Line 473 | 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  
483  // get pointer to fAllTreeIn todo
484  // todo
501    // deal here with published objects
502    // todo
503  
# Line 498 | 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  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines