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" |
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 |
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 |
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 |
|
|
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 |
|
|
147 |
|
if (fCurEnt<0) |
148 |
|
return kFALSE; |
149 |
|
|
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 |
– |
|
150 |
|
// delete old tables |
151 |
|
fTriggers->Delete(); |
152 |
|
fLabels->Delete(); |
156 |
|
fHLTLab = 0; |
157 |
|
Int_t ret = fHLTTree->GetEvent(fCurEnt); |
158 |
|
if (ret<0 || fHLTTab==0 || fHLTTab==0 ) { |
159 |
< |
::Error("LoadTriggerTable", "Could not get entries for next event %ud", fCurEnt); |
159 |
> |
SendError(kAbortAnalysis, "LoadTriggerTable", |
160 |
> |
"Could not get trigger data for next entry (%ld).", fCurEnt); |
161 |
|
return kFALSE; |
162 |
|
} |
163 |
|
|
164 |
|
// check size of trigger table |
165 |
< |
if (fHLTTab->Entries()>fNMaxTriggers) { |
165 |
> |
if (fHLTTab->size()>fNMaxTriggers) { |
166 |
|
SendError(kAbortAnalysis, "LoadTriggerTable", |
167 |
< |
"Size of trigger table (%d) larger than maximum (%d)", |
168 |
< |
fHLTTab->Entries(), fNMaxTriggers); |
167 |
> |
"Size of trigger table (%ld) larger than maximum (%ld).", |
168 |
> |
fHLTTab->size(), fNMaxTriggers); |
169 |
|
return kFALSE; |
170 |
|
} |
171 |
|
|
172 |
|
// add trigger names |
173 |
< |
for (UInt_t i=0; i<fHLTTab->Entries(); ++i) { |
174 |
< |
TriggerName *tname = new TriggerName(*fHLTTab->At(i),i); |
173 |
> |
for (UInt_t i=0; i<fHLTTab->size(); ++i) { |
174 |
> |
TriggerName *tname = new TriggerName(fHLTTab->at(i),i); |
175 |
|
fTriggers->Add(tname); |
176 |
|
} |
177 |
|
|
178 |
|
// add module labels |
179 |
< |
for (UInt_t i=0; i<fHLTLab->Entries(); ++i) { |
180 |
< |
TriggerName *tname = new TriggerName(*fHLTLab->At(i),i); |
179 |
> |
for (UInt_t i=0; i<fHLTLab->size(); ++i) { |
180 |
> |
TriggerName *tname = new TriggerName(fHLTLab->at(i),i); |
181 |
|
fLabels->Add(tname); |
182 |
|
} |
183 |
|
|
213 |
|
TriggerObject *obj = new TriggerObject(rel->TrgId(), rel->Type(), ob->Id(), |
214 |
|
ob->Pt(), ob->Eta(), ob->Phi(), ob->Mass()); |
215 |
|
|
216 |
< |
obj->SetTrigName(fHLTTab->Ref(rel->TrgId()).c_str()); |
217 |
< |
obj->SetModuleName(fHLTLab->Ref(rel->ModInd()).c_str()); |
218 |
< |
obj->SetFilterName(fHLTLab->Ref(rel->FilterInd()).c_str()); |
216 |
> |
obj->SetTrigName(fHLTTab->at(rel->TrgId()).c_str()); |
217 |
> |
obj->SetModuleName(fHLTLab->at(rel->ModInd()).c_str()); |
218 |
> |
obj->SetFilterName(fHLTLab->at(rel->FilterInd()).c_str()); |
219 |
|
fTrigObjs->Add(obj); |
220 |
|
} |
221 |
|
} |