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.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 151 | 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 207 | Line 219 | void HLTFwkMod::Process()
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   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines