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

Comparing UserCode/MitAna/TreeMod/src/HLTFwkMod.cc (file contents):
Revision 1.4 by loizides, Fri Feb 13 14:45:29 2009 UTC vs.
Revision 1.13 by loizides, Mon Oct 26 11:04:56 2009 UTC

# Line 3 | Line 3
3   #include "MitAna/TreeMod/interface/HLTFwkMod.h"
4   #include <TFile.h>
5   #include <TTree.h>
6 + #include "MitAna/DataUtil/interface/Debug.h"
7   #include "MitAna/DataTree/interface/Names.h"
8   #include "MitAna/DataTree/interface/TriggerName.h"
9 < #include "MitAna/DataTree/interface/TriggerObject.h"
9 > #include "MitAna/DataTree/interface/TriggerTable.h"
10 > #include "MitAna/DataTree/interface/TriggerObjectBaseCol.h"
11 > #include "MitAna/DataTree/interface/TriggerObjectRelCol.h"
12 > #include "MitAna/DataTree/interface/TriggerObjectCol.h"
13 > #include "MitAna/DataTree/interface/TriggerObjectsTable.h"
14  
15   using namespace mithep;
16  
# Line 87 | Line 92 | void HLTFwkMod::BeginRun()
92      fHLTTree = dynamic_cast<TTree*>(file->Get(fHLTTreeName));
93      if (!fHLTTree) {
94        SendError(kAbortAnalysis, "BeginRun",
95 <                "Can not find HLT tree with name %s", fHLTTreeName.Data());
95 >                "Cannot find HLT tree with name %s.", fHLTTreeName.Data());
96      }
97  
98      // get HLT trigger name branch
# Line 95 | Line 100 | void HLTFwkMod::BeginRun()
100        fHLTTree->SetBranchAddress(fHLTTabName, &fHLTTab);
101      } else {
102        SendError(kAbortAnalysis, "BeginRun",
103 <                "Can not find HLT tree branch with name %s", fHLTTabName.Data());
103 >                "Cannot find HLT tree branch with name %s.", fHLTTabName.Data());
104      }
105  
106      // get HLT module labels branch
# Line 103 | Line 108 | void HLTFwkMod::BeginRun()
108        fHLTTree->SetBranchAddress(fHLTLabName, &fHLTLab);
109      } else {
110        SendError(kAbortAnalysis, "BeginRun",
111 <                "Can not find HLT tree branch with name %s", fHLTLabName.Data());
111 >                "Cannot find HLT tree branch with name %s.", fHLTLabName.Data());
112      }
113    }
114  
# Line 111 | Line 116 | void HLTFwkMod::BeginRun()
116    const RunInfo *runinfo = GetRunInfo();
117    if (!runinfo) {
118      SendError(kAbortAnalysis, "BeginRun",
119 <              "Can not obtain run info object from selector");
119 >              "Cannot obtain run info object from selector.");
120      return;
121    }
122  
123    // load trigger table
124    if (runinfo->HltEntry()!=fCurEnt) {
125 +    MDB(kAnalysis, 1)
126 +      Info("BeginRun", "Loading trigger table for run %ld", runinfo->RunNum());
127 +    
128      fCurEnt = runinfo->HltEntry();
129      Bool_t load = LoadTriggerTable();
130      if (!load) {
131        SendError(kAbortAnalysis, "BeginRun",
132 <                "Can not obtain load trigger table info");
132 >                "Cannot load trigger table for next entry (%ld).", fCurEnt);
133        return;
134      }
135 +
136 +    MDB(kAnalysis, 2) {
137 +      Info("BeginRun", "Printing tables for run %ld", runinfo->RunNum());
138 +      cout << " --- Trigger table ---" << endl;
139 +      fTriggers->Print();
140 +      cout << " --- Module lables ---" << endl;
141 +      fLabels->Print();
142 +    }
143    }
144   }
145  
# Line 135 | Line 151 | Bool_t HLTFwkMod::LoadTriggerTable()
151    if (fCurEnt<0)
152      return kFALSE;
153  
138  if ((fCurEnt==1) && (fHLTTree->GetEntries()==1)) {
139    if (1)
140      SendError(kWarning, "LoadTriggerTable",
141                "Loading trigger table omitted due to a bug fix for Mit_006.");
142    return kTRUE;
143  }
144
154    // delete old tables
155    fTriggers->Delete();
156    fLabels->Delete();
# Line 151 | Line 160 | Bool_t HLTFwkMod::LoadTriggerTable()
160    fHLTLab = 0;
161    Int_t ret = fHLTTree->GetEvent(fCurEnt);
162    if (ret<0 || fHLTTab==0 || fHLTTab==0 ) {
163 <    ::Error("LoadTriggerTable", "Could not get entries for next event %ud", fCurEnt);
163 >    SendError(kAbortAnalysis, "LoadTriggerTable",
164 >              "Could not get trigger data for next entry (%ld).", fCurEnt);
165      return kFALSE;
166    }
167  
168    // check size of trigger table
169 <  if (fHLTTab->Entries()>fNMaxTriggers) {
169 >  if (fHLTTab->size()>fNMaxTriggers) {
170      SendError(kAbortAnalysis, "LoadTriggerTable",
171 <              "Size of trigger table (%d) larger than maximum (%d)",
172 <              fHLTTab->Entries(), fNMaxTriggers);
171 >              "Size of trigger table (%ld) larger than maximum (%ld).",
172 >              fHLTTab->size(), fNMaxTriggers);
173      return kFALSE;
174    }
175  
176    // add trigger names
177 <  for (UInt_t i=0; i<fHLTTab->Entries(); ++i) {
178 <    TriggerName *tname = new TriggerName(*fHLTTab->At(i),i);
177 >  for (UInt_t i=0; i<fHLTTab->size(); ++i) {
178 >    TriggerName *tname = new TriggerName(fHLTTab->at(i),i);
179      fTriggers->Add(tname);
180    }
181  
182    // add module labels
183 <  for (UInt_t i=0; i<fHLTLab->Entries(); ++i) {
184 <    TriggerName *tname = new TriggerName(*fHLTLab->At(i),i);
183 >  for (UInt_t i=0; i<fHLTLab->size(); ++i) {
184 >    TriggerName *tname = new TriggerName(fHLTLab->at(i),i);
185      fLabels->Add(tname);
186    }
187  
# Line 197 | Line 207 | void HLTFwkMod::Process()
207    LoadBranch(fObjsName);
208    LoadBranch(fRelsName);
209  
210 <  for (UInt_t i=0; i<fRels->Entries(); ++i) {
210 >  const UInt_t n = fRels->GetEntries();
211 >  for (UInt_t i=0; i<n; ++i) {
212      const TriggerObjectRel *rel = fRels->At(i);
213      if (!rel) continue;
214  
# Line 207 | Line 218 | void HLTFwkMod::Process()
218      TriggerObject *obj = new TriggerObject(rel->TrgId(), rel->Type(), ob->Id(),
219                                             ob->Pt(), ob->Eta(), ob->Phi(), ob->Mass());
220  
221 <    obj->SetTrigName(fHLTTab->Ref(rel->TrgId()).c_str());
222 <    obj->SetModuleName(fHLTLab->Ref(rel->ModInd()).c_str());
223 <    obj->SetFilterName(fHLTLab->Ref(rel->FilterInd()).c_str());
221 >    obj->SetTrigName(fHLTTab->at(rel->TrgId()).c_str());
222 >    obj->SetModuleName(fHLTLab->at(rel->ModInd()).c_str());
223 >    obj->SetFilterName(fHLTLab->at(rel->FilterInd()).c_str());
224 >    if (obj->TagInd()>=0)
225 >      obj->SetTagName(fHLTLab->at(obj->TagInd()).c_str());
226 >    else
227 >      obj->SetTagName("Unknown");
228 >
229      fTrigObjs->Add(obj);
230    }
231   }
# Line 219 | Line 235 | void HLTFwkMod::SlaveBegin()
235   {
236    // Request branches for trigger objects and relation, and publish our tables.
237  
238 +  if (fObjsName != Names::gkHltObjBrn)
239 +    fRelsName = Form("%sRelation",fObjsName.Data());
240 +
241    ReqBranch(fObjsName, fObjs);
242    ReqBranch(fRelsName, fRels);
243  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines