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.7 by loizides, Mon Mar 23 14:56:07 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"
# Line 87 | Line 88 | void HLTFwkMod::BeginRun()
88      fHLTTree = dynamic_cast<TTree*>(file->Get(fHLTTreeName));
89      if (!fHLTTree) {
90        SendError(kAbortAnalysis, "BeginRun",
91 <                "Can not find HLT tree with name %s", fHLTTreeName.Data());
91 >                "Cannot find HLT tree with name %s.", fHLTTreeName.Data());
92      }
93  
94      // get HLT trigger name branch
# Line 95 | Line 96 | void HLTFwkMod::BeginRun()
96        fHLTTree->SetBranchAddress(fHLTTabName, &fHLTTab);
97      } else {
98        SendError(kAbortAnalysis, "BeginRun",
99 <                "Can not find HLT tree branch with name %s", fHLTTabName.Data());
99 >                "Cannot find HLT tree branch with name %s.", fHLTTabName.Data());
100      }
101  
102      // get HLT module labels branch
# Line 103 | Line 104 | void HLTFwkMod::BeginRun()
104        fHLTTree->SetBranchAddress(fHLTLabName, &fHLTLab);
105      } else {
106        SendError(kAbortAnalysis, "BeginRun",
107 <                "Can not find HLT tree branch with name %s", fHLTLabName.Data());
107 >                "Cannot find HLT tree branch with name %s.", fHLTLabName.Data());
108      }
109    }
110  
# Line 111 | Line 112 | void HLTFwkMod::BeginRun()
112    const RunInfo *runinfo = GetRunInfo();
113    if (!runinfo) {
114      SendError(kAbortAnalysis, "BeginRun",
115 <              "Can not obtain run info object from selector");
115 >              "Cannot obtain run info object from selector.");
116      return;
117    }
118  
119    // load trigger table
120    if (runinfo->HltEntry()!=fCurEnt) {
121 +    MDB(kAnalysis, 1)
122 +      Info("BeginRun", "Loading trigger table for run %ld", runinfo->RunNum());
123 +    
124      fCurEnt = runinfo->HltEntry();
125      Bool_t load = LoadTriggerTable();
126      if (!load) {
127        SendError(kAbortAnalysis, "BeginRun",
128 <                "Can not obtain load trigger table info");
128 >                "Cannot load trigger table for next entry (%ld).", fCurEnt);
129        return;
130      }
131 +
132 +    MDB(kAnalysis, 2) {
133 +      Info("BeginRun", "Printing tables for run %ld", runinfo->RunNum());
134 +      cout << " --- Trigger table ---" << endl;
135 +      fTriggers->Print();
136 +      cout << " --- Module lables ---" << endl;
137 +      fLabels->Print();
138 +    }
139    }
140   }
141  
# Line 135 | Line 147 | Bool_t HLTFwkMod::LoadTriggerTable()
147    if (fCurEnt<0)
148      return kFALSE;
149  
150 +  if ((fCurEnt==1) && (fHLTTree->GetEntries()==1)) {
151 +    if (1)
152 +      SendError(kWarning, "LoadTriggerTable",
153 +                "Loading trigger table omitted due to a bug fix for Mit_006.");
154 +    return kTRUE;
155 +  }
156 +
157    // delete old tables
158    fTriggers->Delete();
159    fLabels->Delete();
# Line 144 | Line 163 | Bool_t HLTFwkMod::LoadTriggerTable()
163    fHLTLab = 0;
164    Int_t ret = fHLTTree->GetEvent(fCurEnt);
165    if (ret<0 || fHLTTab==0 || fHLTTab==0 ) {
166 <    ::Error("LoadTriggerTable", "Could not get entries for next event %ud", fCurEnt);
166 >    ::Error("LoadTriggerTable", "Could not get trigger data for next entry (%ld).", fCurEnt);
167      return kFALSE;
168    }
169  
170    // check size of trigger table
171 <  if (fHLTTab->Entries()>fNMaxTriggers) {
171 >  if (fHLTTab->size()>fNMaxTriggers) {
172      SendError(kAbortAnalysis, "LoadTriggerTable",
173 <              "Size of trigger table (%d) larger than maximum (%d)",
174 <              fHLTTab->Entries(), fNMaxTriggers);
173 >              "Size of trigger table (%ld) larger than maximum (%ld).",
174 >              fHLTTab->size(), fNMaxTriggers);
175      return kFALSE;
176    }
177  
178    // add trigger names
179 <  for (UInt_t i=0; i<fHLTTab->Entries(); ++i) {
180 <    TriggerName *tname = new TriggerName(*fHLTTab->At(i),i);
179 >  for (UInt_t i=0; i<fHLTTab->size(); ++i) {
180 >    TriggerName *tname = new TriggerName(fHLTTab->at(i),i);
181      fTriggers->Add(tname);
182    }
183  
184    // add module labels
185 <  for (UInt_t i=0; i<fHLTLab->Entries(); ++i) {
186 <    TriggerName *tname = new TriggerName(*fHLTLab->At(i),i);
185 >  for (UInt_t i=0; i<fHLTLab->size(); ++i) {
186 >    TriggerName *tname = new TriggerName(fHLTLab->at(i),i);
187      fLabels->Add(tname);
188    }
189  
# Line 187 | Line 206 | void HLTFwkMod::Process()
206  
207    fTrigObjs->Delete();
208  
209 <  LoadBranch(fObjsName.Data());
210 <  LoadBranch(fRelsName.Data());
209 >  LoadBranch(fObjsName);
210 >  LoadBranch(fRelsName);
211  
212    for (UInt_t i=0; i<fRels->Entries(); ++i) {
213      const TriggerObjectRel *rel = fRels->At(i);
214 <    if(!rel) continue;
214 >    if (!rel) continue;
215  
216      const TriggerObjectBase *ob = fObjs->At(rel->ObjInd());
217 <    if(!ob) continue;
217 >    if (!ob) continue;
218  
219      TriggerObject *obj = new TriggerObject(rel->TrgId(), rel->Type(), ob->Id(),
220                                             ob->Pt(), ob->Eta(), ob->Phi(), ob->Mass());
221  
222 <    obj->SetTrigName(fHLTTab->Ref(rel->TrgId()).c_str());
223 <    obj->SetModuleName(fHLTLab->Ref(rel->ModInd()).c_str());
224 <    obj->SetFilterName(fHLTLab->Ref(rel->FilterInd()).c_str());
222 >    obj->SetTrigName(fHLTTab->at(rel->TrgId()).c_str());
223 >    obj->SetModuleName(fHLTLab->at(rel->ModInd()).c_str());
224 >    obj->SetFilterName(fHLTLab->at(rel->FilterInd()).c_str());
225      fTrigObjs->Add(obj);
226    }
227   }
# Line 212 | Line 231 | void HLTFwkMod::SlaveBegin()
231   {
232    // Request branches for trigger objects and relation, and publish our tables.
233  
234 <  ReqBranch(fObjsName.Data(), fObjs);
235 <  ReqBranch(fRelsName.Data(), fRels);
234 >  ReqBranch(fObjsName, fObjs);
235 >  ReqBranch(fRelsName, fRels);
236  
237    if (!PublishObj(fTriggers)) {
238      SendError(kAbortAnalysis, "SlaveBegin",

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines