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.1 by loizides, Sun Sep 28 02:38:40 2008 UTC vs.
Revision 1.9 by loizides, Mon Jun 15 15:00:17 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"
10 + #include "MitAna/DataTree/interface/TriggerObjectCol.h"
11  
12   using namespace mithep;
13  
# Line 87 | Line 89 | void HLTFwkMod::BeginRun()
89      fHLTTree = dynamic_cast<TTree*>(file->Get(fHLTTreeName));
90      if (!fHLTTree) {
91        SendError(kAbortAnalysis, "BeginRun",
92 <                "Can not find HLT tree with name %s", fHLTTreeName.Data());
92 >                "Cannot find HLT tree with name %s.", fHLTTreeName.Data());
93      }
94  
95      // get HLT trigger name branch
# Line 95 | Line 97 | void HLTFwkMod::BeginRun()
97        fHLTTree->SetBranchAddress(fHLTTabName, &fHLTTab);
98      } else {
99        SendError(kAbortAnalysis, "BeginRun",
100 <                "Can not find HLT tree branch with name %s", fHLTTabName.Data());
100 >                "Cannot find HLT tree branch with name %s.", fHLTTabName.Data());
101      }
102  
103      // get HLT module labels branch
# Line 103 | Line 105 | void HLTFwkMod::BeginRun()
105        fHLTTree->SetBranchAddress(fHLTLabName, &fHLTLab);
106      } else {
107        SendError(kAbortAnalysis, "BeginRun",
108 <                "Can not find HLT tree branch with name %s", fHLTLabName.Data());
108 >                "Cannot find HLT tree branch with name %s.", fHLTLabName.Data());
109      }
110    }
111  
# Line 111 | Line 113 | void HLTFwkMod::BeginRun()
113    const RunInfo *runinfo = GetRunInfo();
114    if (!runinfo) {
115      SendError(kAbortAnalysis, "BeginRun",
116 <              "Can not obtain run info object from selector");
116 >              "Cannot obtain run info object from selector.");
117      return;
118    }
119  
120    // load trigger table
121    if (runinfo->HltEntry()!=fCurEnt) {
122 +    MDB(kAnalysis, 1)
123 +      Info("BeginRun", "Loading trigger table for run %ld", runinfo->RunNum());
124 +    
125      fCurEnt = runinfo->HltEntry();
126      Bool_t load = LoadTriggerTable();
127      if (!load) {
128        SendError(kAbortAnalysis, "BeginRun",
129 <                "Can not obtain load trigger table info");
129 >                "Cannot load trigger table for next entry (%ld).", fCurEnt);
130        return;
131      }
132 +
133 +    MDB(kAnalysis, 2) {
134 +      Info("BeginRun", "Printing tables for run %ld", runinfo->RunNum());
135 +      cout << " --- Trigger table ---" << endl;
136 +      fTriggers->Print();
137 +      cout << " --- Module lables ---" << endl;
138 +      fLabels->Print();
139 +    }
140    }
141   }
142  
# Line 144 | Line 157 | Bool_t HLTFwkMod::LoadTriggerTable()
157    fHLTLab = 0;
158    Int_t ret = fHLTTree->GetEvent(fCurEnt);
159    if (ret<0 || fHLTTab==0 || fHLTTab==0 ) {
160 <    ::Error("LoadTriggerTable", "Could not get entries for next event %ud", fCurEnt);
160 >    SendError(kAbortAnalysis, "LoadTriggerTable",
161 >              "Could not get trigger data for next entry (%ld).", fCurEnt);
162      return kFALSE;
163    }
164  
165    // check size of trigger table
166 <  if (fHLTTab->Entries()>fNMaxTriggers) {
166 >  if (fHLTTab->size()>fNMaxTriggers) {
167      SendError(kAbortAnalysis, "LoadTriggerTable",
168 <              "Size of trigger table (%d) larger than maximum (%d)",
169 <              fHLTTab->Entries(), fNMaxTriggers);
168 >              "Size of trigger table (%ld) larger than maximum (%ld).",
169 >              fHLTTab->size(), fNMaxTriggers);
170      return kFALSE;
171    }
172  
173    // add trigger names
174 <  for (UInt_t i=0; i<fHLTTab->Entries(); ++i) {
175 <    TriggerName *tname = new TriggerName(*fHLTTab->At(i),i);
174 >  for (UInt_t i=0; i<fHLTTab->size(); ++i) {
175 >    TriggerName *tname = new TriggerName(fHLTTab->at(i),i);
176      fTriggers->Add(tname);
177    }
178  
179    // add module labels
180 <  for (UInt_t i=0; i<fHLTLab->Entries(); ++i) {
181 <    TriggerName *tname = new TriggerName(*fHLTLab->At(i),i);
180 >  for (UInt_t i=0; i<fHLTLab->size(); ++i) {
181 >    TriggerName *tname = new TriggerName(fHLTLab->at(i),i);
182      fLabels->Add(tname);
183    }
184  
# Line 187 | Line 201 | void HLTFwkMod::Process()
201  
202    fTrigObjs->Delete();
203  
204 <  LoadBranch(fObjsName.Data());
205 <  LoadBranch(fRelsName.Data());
204 >  LoadBranch(fObjsName);
205 >  LoadBranch(fRelsName);
206  
207    for (UInt_t i=0; i<fRels->Entries(); ++i) {
208      const TriggerObjectRel *rel = fRels->At(i);
209 <    if(!rel) continue;
209 >    if (!rel) continue;
210  
211      const TriggerObjectBase *ob = fObjs->At(rel->ObjInd());
212 <    if(!ob) continue;
212 >    if (!ob) continue;
213  
214      TriggerObject *obj = new TriggerObject(rel->TrgId(), rel->Type(), ob->Id(),
215                                             ob->Pt(), ob->Eta(), ob->Phi(), ob->Mass());
216  
217 <    obj->SetTrigName(fHLTTab->Ref(rel->TrgId()).c_str());
218 <    obj->SetModuleName(fHLTLab->Ref(rel->ModInd()).c_str());
219 <    obj->SetFilterName(fHLTLab->Ref(rel->FilterInd()).c_str());
217 >    obj->SetTrigName(fHLTTab->at(rel->TrgId()).c_str());
218 >    obj->SetModuleName(fHLTLab->at(rel->ModInd()).c_str());
219 >    obj->SetFilterName(fHLTLab->at(rel->FilterInd()).c_str());
220      fTrigObjs->Add(obj);
221    }
222   }
# Line 212 | Line 226 | void HLTFwkMod::SlaveBegin()
226   {
227    // Request branches for trigger objects and relation, and publish our tables.
228  
229 <  ReqBranch(fObjsName.Data(), fObjs);
230 <  ReqBranch(fRelsName.Data(), fRels);
229 >  ReqBranch(fObjsName, fObjs);
230 >  ReqBranch(fRelsName, fRels);
231  
232    if (!PublishObj(fTriggers)) {
233      SendError(kAbortAnalysis, "SlaveBegin",

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines