1 |
loizides |
1.21 |
// $Id: FillerMetaInfos.cc,v 1.20 2008/10/07 00:27:13 loizides Exp $
|
2 |
loizides |
1.1 |
|
3 |
|
|
#include "MitProd/TreeFiller/interface/FillerMetaInfos.h"
|
4 |
|
|
#include "FWCore/MessageLogger/interface/MessageLogger.h"
|
5 |
loizides |
1.5 |
#include "FWCore/Framework/interface/TriggerNames.h"
|
6 |
loizides |
1.1 |
#include "DataFormats/Common/interface/Handle.h"
|
7 |
loizides |
1.5 |
#include "DataFormats/Common/interface/TriggerResults.h"
|
8 |
loizides |
1.14 |
#include "DataFormats/HLTReco/interface/TriggerEvent.h"
|
9 |
loizides |
1.1 |
#include "MitAna/DataTree/interface/Names.h"
|
10 |
loizides |
1.5 |
#include "MitAna/DataTree/interface/EventHeader.h"
|
11 |
|
|
#include "MitAna/DataTree/interface/LAHeader.h"
|
12 |
loizides |
1.16 |
#include "MitAna/DataTree/interface/TriggerName.h"
|
13 |
loizides |
1.5 |
#include "MitAna/DataTree/interface/RunInfo.h"
|
14 |
loizides |
1.8 |
#include <TObjectTable.h>
|
15 |
loizides |
1.14 |
#include <TIterator.h>
|
16 |
sixie |
1.13 |
|
17 |
loizides |
1.1 |
using namespace std;
|
18 |
|
|
using namespace edm;
|
19 |
|
|
using namespace mithep;
|
20 |
|
|
|
21 |
loizides |
1.12 |
bool mithep::FillerMetaInfos::instance_ = 0;
|
22 |
|
|
|
23 |
loizides |
1.8 |
//--------------------------------------------------------------------------------------------------
|
24 |
loizides |
1.7 |
FillerMetaInfos::FillerMetaInfos(const ParameterSet &cfg, bool active) :
|
25 |
loizides |
1.12 |
BaseFiller(cfg,"MetaInfos",(instance_==0||active?1:0)),
|
26 |
loizides |
1.2 |
evtName_(Conf().getUntrackedParameter<string>("evtName",Names::gkEvtHeaderBrn)),
|
27 |
|
|
runName_(Conf().getUntrackedParameter<string>("runName",Names::gkRunInfoBrn)),
|
28 |
loizides |
1.4 |
lahName_(Conf().getUntrackedParameter<string>("lahName",Names::gkLAHeaderBrn)),
|
29 |
loizides |
1.16 |
l1Active_(Conf().getUntrackedParameter<bool>("l1Active",true)),
|
30 |
|
|
l1TableName_(Conf().getUntrackedParameter<string>("l1TableName",Names::gkL1TableBrn)),
|
31 |
|
|
l1BitsName_(Conf().getUntrackedParameter<string>("l1BitsName",Names::gkL1BitBrn)),
|
32 |
|
|
l1ObjsName_(Conf().getUntrackedParameter<string>("l1ObjsName",Names::gkL1ObjBrn)),
|
33 |
|
|
hltActive_(Conf().getUntrackedParameter<bool>("hltActive",true)),
|
34 |
|
|
hltProcName_(Conf().getUntrackedParameter<string>("hltProcName","HLT")),
|
35 |
|
|
hltResName_(Conf().getUntrackedParameter<string>("hltResName","TriggerResults::HLT")),
|
36 |
|
|
hltEvtName_(Conf().getUntrackedParameter<string>("hltEvtName","hltTriggerSummaryAOD::HLT")),
|
37 |
|
|
hltTableName_(Conf().getUntrackedParameter<string>("hltTableName",Names::gkHltTableBrn)),
|
38 |
|
|
hltLabelName_(Conf().getUntrackedParameter<string>("hltLabelName",Names::gkHltLabelBrn)),
|
39 |
|
|
hltBitsName_(Conf().getUntrackedParameter<string>("hltBitsName",Names::gkHltBitBrn)),
|
40 |
|
|
hltObjsName_(Conf().getUntrackedParameter<string>("hltObjsName",Names::gkHltObjBrn)),
|
41 |
loizides |
1.5 |
tws_(0),
|
42 |
loizides |
1.2 |
eventHeader_(new EventHeader()),
|
43 |
loizides |
1.3 |
evtLAHeader_(new LAHeader()),
|
44 |
loizides |
1.2 |
runInfo_(new RunInfo()),
|
45 |
|
|
runTree_(0),
|
46 |
loizides |
1.3 |
laTree_(0),
|
47 |
|
|
runEntries_(0),
|
48 |
loizides |
1.16 |
l1Entries_(0),
|
49 |
|
|
l1Table_(0),
|
50 |
|
|
l1Tree_(0),
|
51 |
|
|
hltBits_(new BitMask256),
|
52 |
|
|
hltTable_(new Vector<string>),
|
53 |
|
|
hltTabMap_(0),
|
54 |
|
|
hltLabels_(new Vector<string>),
|
55 |
|
|
hltLabMap_(0),
|
56 |
|
|
hltObjs_(new TriggerObjectBaseArr),
|
57 |
|
|
hltRels_(new TriggerObjectRelArr),
|
58 |
|
|
hltTree_(0),
|
59 |
|
|
hltEntries_(0),
|
60 |
loizides |
1.3 |
fileNum_(0)
|
61 |
loizides |
1.1 |
{
|
62 |
loizides |
1.3 |
// Constructor.
|
63 |
loizides |
1.12 |
|
64 |
|
|
instance_=1;
|
65 |
loizides |
1.1 |
}
|
66 |
|
|
|
67 |
loizides |
1.8 |
//--------------------------------------------------------------------------------------------------
|
68 |
loizides |
1.1 |
FillerMetaInfos::~FillerMetaInfos()
|
69 |
|
|
{
|
70 |
loizides |
1.3 |
// Destructor.
|
71 |
|
|
|
72 |
loizides |
1.2 |
delete eventHeader_;
|
73 |
loizides |
1.8 |
delete evtLAHeader_;
|
74 |
loizides |
1.2 |
delete runInfo_;
|
75 |
loizides |
1.16 |
delete l1Table_;
|
76 |
|
|
delete hltTable_;
|
77 |
|
|
delete hltLabels_;
|
78 |
|
|
delete hltObjs_;
|
79 |
|
|
delete hltRels_;
|
80 |
loizides |
1.3 |
eventHeader_ = 0;
|
81 |
loizides |
1.8 |
evtLAHeader_ = 0;
|
82 |
loizides |
1.3 |
runInfo_ = 0;
|
83 |
loizides |
1.16 |
l1Table_ = 0;
|
84 |
|
|
hltTable_ = 0;
|
85 |
|
|
hltLabels_ = 0;
|
86 |
|
|
hltObjs_ = 0;
|
87 |
|
|
hltRels_ = 0;
|
88 |
loizides |
1.3 |
runTree_ = 0;
|
89 |
|
|
laTree_ = 0;
|
90 |
loizides |
1.16 |
hltTree_ = 0;
|
91 |
|
|
l1Tree_ = 0;
|
92 |
loizides |
1.1 |
}
|
93 |
|
|
|
94 |
loizides |
1.8 |
//--------------------------------------------------------------------------------------------------
|
95 |
loizides |
1.2 |
void FillerMetaInfos::BookDataBlock(TreeWriter &tws)
|
96 |
loizides |
1.1 |
{
|
97 |
loizides |
1.3 |
// Create run info tre and book our branches.
|
98 |
|
|
|
99 |
|
|
// add branches to main tree
|
100 |
loizides |
1.2 |
tws.AddBranch(evtName_.c_str(),"mithep::EventHeader",&eventHeader_);
|
101 |
loizides |
1.16 |
tws.AddBranch(hltBitsName_.c_str(),"mithep::BitMask256",&hltBits_);
|
102 |
|
|
tws.AddBranch(hltObjsName_.c_str(),&hltObjs_);
|
103 |
|
|
tws.AddBranch(Form("%sRelation",hltObjsName_.c_str()),&hltRels_);
|
104 |
loizides |
1.20 |
tws.GetTree()->BranchRef();
|
105 |
loizides |
1.3 |
|
106 |
|
|
// add branches to run info tree
|
107 |
|
|
tws.AddBranchToTree(Names::gkRunTreeName,runName_.c_str(),"mithep::RunInfo",&runInfo_);
|
108 |
loizides |
1.2 |
tws.SetAutoFill(Names::gkRunTreeName,0);
|
109 |
|
|
runTree_=tws.GetTree(Names::gkRunTreeName);
|
110 |
loizides |
1.3 |
|
111 |
|
|
// add branches to lookahead tree
|
112 |
|
|
tws.AddBranchToTree(Names::gkLATreeName,Names::gkLAHeaderBrn,"mithep::LAHeader",&evtLAHeader_);
|
113 |
|
|
tws.SetAutoFill(Names::gkLATreeName,0);
|
114 |
|
|
laTree_=tws.GetTree(Names::gkLATreeName);
|
115 |
|
|
|
116 |
loizides |
1.16 |
// add branches to L1 trigger info tree
|
117 |
|
|
|
118 |
|
|
// add branches to HLT trigger info tree
|
119 |
|
|
tws.AddBranchToTree(Names::gkHltTreeName,hltTableName_.c_str(),&hltTable_,32000,0);
|
120 |
|
|
tws.AddBranchToTree(Names::gkHltTreeName,hltLabelName_.c_str(),&hltLabels_,32000,0);
|
121 |
|
|
tws.SetAutoFill(Names::gkHltTreeName,0);
|
122 |
|
|
hltTree_=tws.GetTree(Names::gkHltTreeName);
|
123 |
|
|
|
124 |
loizides |
1.3 |
// store pointer to tree writer
|
125 |
|
|
tws_ = &tws;
|
126 |
loizides |
1.1 |
}
|
127 |
|
|
|
128 |
loizides |
1.8 |
//--------------------------------------------------------------------------------------------------
|
129 |
loizides |
1.5 |
void FillerMetaInfos::FillDataBlock(const edm::Event &event,
|
130 |
loizides |
1.1 |
const edm::EventSetup &setup)
|
131 |
|
|
{
|
132 |
loizides |
1.3 |
// Fill our data structures.
|
133 |
|
|
|
134 |
|
|
// clear map if a new file was opened
|
135 |
|
|
if (tws_->GetFileNumber()!=fileNum_) {
|
136 |
|
|
runmap_.clear();
|
137 |
|
|
fileNum_ = tws_->GetFileNumber();
|
138 |
|
|
runEntries_ = 0;
|
139 |
loizides |
1.16 |
l1Entries_ = -1;
|
140 |
|
|
hltEntries_ = -1;
|
141 |
loizides |
1.3 |
}
|
142 |
|
|
|
143 |
|
|
UInt_t runnum = event.id().run();
|
144 |
|
|
|
145 |
|
|
// store look ahead information
|
146 |
|
|
if (runEntries_>0) {
|
147 |
|
|
evtLAHeader_->SetRunNum(runnum);
|
148 |
|
|
laTree_->Fill();
|
149 |
loizides |
1.21 |
if(0) { // check for memory leak in usage of ROOT objects
|
150 |
loizides |
1.14 |
if(laTree_->GetEntries() % 100==0)
|
151 |
|
|
gObjectTable->Print();
|
152 |
|
|
}
|
153 |
loizides |
1.3 |
}
|
154 |
|
|
|
155 |
loizides |
1.2 |
// fill event header
|
156 |
|
|
eventHeader_->SetEvtNum(event.id().event());
|
157 |
|
|
eventHeader_->SetLumiSec(event.luminosityBlock());
|
158 |
|
|
eventHeader_->SetRunNum(runnum);
|
159 |
|
|
|
160 |
loizides |
1.3 |
// look-up if entry is in map
|
161 |
loizides |
1.2 |
map<UInt_t,Int_t>::iterator riter = runmap_.find(runnum);
|
162 |
|
|
if (riter != runmap_.end()) {
|
163 |
|
|
Int_t runentry = riter->second;
|
164 |
|
|
eventHeader_->SetRunEntry(runentry);
|
165 |
loizides |
1.16 |
FillHltTrig(event,setup);
|
166 |
loizides |
1.2 |
return;
|
167 |
|
|
}
|
168 |
loizides |
1.1 |
|
169 |
loizides |
1.2 |
// fill new run info
|
170 |
|
|
Int_t runentry = runEntries_;
|
171 |
loizides |
1.16 |
++runEntries_;
|
172 |
loizides |
1.2 |
eventHeader_->SetRunEntry(runentry);
|
173 |
|
|
runmap_.insert(pair<UInt_t,Int_t>(runnum,runentry));
|
174 |
loizides |
1.16 |
runInfo_->SetRunNum(runnum);
|
175 |
|
|
|
176 |
|
|
Int_t l1entry = l1Entries_;
|
177 |
|
|
//FillL1Info(event,setup);
|
178 |
|
|
//FillL1Trigger(event,setup);
|
179 |
loizides |
1.21 |
if (l1entry < l1Entries_) {
|
180 |
|
|
l1Tree_->Fill();
|
181 |
|
|
runInfo_->SetL1Entry(l1entry);
|
182 |
|
|
} else {
|
183 |
|
|
runInfo_->SetL1Entry(l1entry-1);
|
184 |
|
|
}
|
185 |
loizides |
1.2 |
|
186 |
loizides |
1.16 |
Int_t hltentry = hltEntries_;
|
187 |
loizides |
1.14 |
FillHltInfo(event,setup);
|
188 |
loizides |
1.16 |
FillHltTrig(event,setup);
|
189 |
loizides |
1.21 |
if (hltentry < hltEntries_) {
|
190 |
|
|
runInfo_->SetHltEntry(hltentry);
|
191 |
loizides |
1.16 |
hltTree_->Fill();
|
192 |
loizides |
1.21 |
} else {
|
193 |
|
|
runInfo_->SetHltEntry(hltentry-1);
|
194 |
|
|
}
|
195 |
loizides |
1.14 |
|
196 |
loizides |
1.2 |
runTree_->Fill();
|
197 |
loizides |
1.1 |
}
|
198 |
loizides |
1.5 |
|
199 |
loizides |
1.8 |
//--------------------------------------------------------------------------------------------------
|
200 |
loizides |
1.5 |
void FillerMetaInfos::FillHltInfo(const edm::Event &event,
|
201 |
|
|
const edm::EventSetup &setup)
|
202 |
|
|
{
|
203 |
loizides |
1.16 |
// Fill HLT trigger table if it changed.
|
204 |
loizides |
1.5 |
|
205 |
loizides |
1.14 |
if (!hltActive_) return;
|
206 |
|
|
|
207 |
loizides |
1.21 |
// check if we can access the hlt config information
|
208 |
loizides |
1.16 |
if (!hltConfig_.init(hltProcName_)) {
|
209 |
loizides |
1.21 |
edm::LogError("FillerMetaInfos") << "Can not access hlt config using "
|
210 |
|
|
<< hltProcName_ << std::endl;
|
211 |
loizides |
1.14 |
return;
|
212 |
loizides |
1.16 |
}
|
213 |
loizides |
1.14 |
|
214 |
loizides |
1.21 |
// check size of menu... < 256
|
215 |
loizides |
1.16 |
if (hltConfig_.size()>hltBits_->Size()) {
|
216 |
loizides |
1.21 |
edm::LogError("FillerMetaInfos") << "HLT config contains too many paths "
|
217 |
|
|
<< hltConfig_.size() << " > " << hltBits_->Size() << std::endl;
|
218 |
loizides |
1.16 |
return;
|
219 |
|
|
}
|
220 |
loizides |
1.14 |
|
221 |
loizides |
1.16 |
Vector<string> *trigtable = new Vector<string>;
|
222 |
|
|
map<string,Short_t> *tabmap = new map<string,Short_t>;
|
223 |
|
|
Vector<string> *labels = new Vector<string>;
|
224 |
|
|
map<string,Short_t> *labmap = new map<string,Short_t>;
|
225 |
|
|
|
226 |
loizides |
1.21 |
// loop over hlt paths
|
227 |
loizides |
1.16 |
for(UInt_t i=0;i<hltConfig_.size();++i) {
|
228 |
|
|
|
229 |
|
|
tabmap->insert(pair<string,Short_t>(hltConfig_.triggerName(i),i));
|
230 |
|
|
trigtable->AddCopy(hltConfig_.triggerName(i));
|
231 |
|
|
const vector<string> &mLabels(hltConfig_.moduleLabels(i));
|
232 |
|
|
for (UInt_t j=0; j<mLabels.size(); ++j) {
|
233 |
loizides |
1.19 |
|
234 |
loizides |
1.16 |
const string& label(mLabels[j]);
|
235 |
|
|
|
236 |
loizides |
1.19 |
// remove characters which do not work: negation is included as !ModuleName
|
237 |
|
|
// (this might require a change in the underlying CMSSW HLT fwk, so watch out).
|
238 |
|
|
const char *lptr = &label[0];
|
239 |
|
|
if (label[0] == '!')
|
240 |
|
|
++lptr;
|
241 |
|
|
|
242 |
|
|
map<string,Short_t>::iterator riter = labmap->find(lptr);
|
243 |
loizides |
1.16 |
if (riter == labmap->end()) {
|
244 |
loizides |
1.19 |
labmap->insert(pair<string,Short_t>(lptr,labels->Entries()));
|
245 |
|
|
labels->AddCopy(lptr);
|
246 |
loizides |
1.16 |
}
|
247 |
loizides |
1.19 |
|
248 |
|
|
const string type(hltConfig_.moduleType(lptr));
|
249 |
loizides |
1.16 |
riter = labmap->find(type);
|
250 |
|
|
if (riter == labmap->end()) {
|
251 |
|
|
labmap->insert(pair<string,Short_t>(type,labels->Entries()));
|
252 |
|
|
labels->AddCopy(type);
|
253 |
loizides |
1.14 |
}
|
254 |
|
|
}
|
255 |
|
|
}
|
256 |
|
|
|
257 |
loizides |
1.16 |
if (hltTable_->Entries()>=0) {
|
258 |
loizides |
1.21 |
// check if existing table contains all necessary paths:
|
259 |
|
|
// if so keep it, otherwise store the new one
|
260 |
|
|
|
261 |
|
|
if ((hltTable_->Entries()>=trigtable->Entries()) &&
|
262 |
|
|
(hltLabels_->Entries()>=labels->Entries())) {
|
263 |
|
|
|
264 |
|
|
bool newEntryFound = false;
|
265 |
|
|
for (UInt_t i=0; i<trigtable->Entries(); ++i) {
|
266 |
|
|
map<string,Short_t>::iterator riter = tabmap->find(*trigtable->At(i));
|
267 |
|
|
if (riter == tabmap->end()) {
|
268 |
|
|
newEntryFound = true;
|
269 |
|
|
break;
|
270 |
|
|
}
|
271 |
|
|
}
|
272 |
|
|
if (!newEntryFound) {
|
273 |
|
|
for (UInt_t i=0; i<labels->Entries(); ++i) {
|
274 |
|
|
map<string,Short_t>::iterator riter = labmap->find(*labels->At(i));
|
275 |
|
|
if (riter == labmap->end()) {
|
276 |
|
|
newEntryFound = true;
|
277 |
|
|
break;
|
278 |
|
|
}
|
279 |
|
|
}
|
280 |
|
|
}
|
281 |
|
|
|
282 |
|
|
if (!newEntryFound) {
|
283 |
|
|
if (verbose_>1)
|
284 |
|
|
cout << "FillHltInfo: Kept previous HLT information" << endl;
|
285 |
|
|
|
286 |
|
|
delete trigtable;
|
287 |
|
|
delete labels;
|
288 |
|
|
delete labmap;
|
289 |
|
|
delete tabmap;
|
290 |
|
|
return;
|
291 |
|
|
}
|
292 |
loizides |
1.16 |
}
|
293 |
loizides |
1.20 |
}
|
294 |
loizides |
1.16 |
|
295 |
loizides |
1.21 |
// new hlt entry
|
296 |
loizides |
1.16 |
delete hltTable_;
|
297 |
|
|
delete hltLabels_;
|
298 |
|
|
delete hltTabMap_;
|
299 |
|
|
delete hltLabMap_;
|
300 |
|
|
hltTable_ = trigtable;
|
301 |
|
|
hltLabels_ = labels;
|
302 |
|
|
hltTabMap_ = tabmap;
|
303 |
|
|
hltLabMap_ = labmap;
|
304 |
|
|
hltEntries_++;
|
305 |
|
|
}
|
306 |
|
|
|
307 |
|
|
//--------------------------------------------------------------------------------------------------
|
308 |
|
|
void FillerMetaInfos::FillHltTrig(const edm::Event &event,
|
309 |
|
|
const edm::EventSetup &setup)
|
310 |
|
|
{
|
311 |
|
|
// Fill HLT trigger objects along triggered paths.
|
312 |
|
|
|
313 |
|
|
if (!hltActive_) return;
|
314 |
|
|
|
315 |
|
|
// reset trigger objects
|
316 |
|
|
hltObjs_->Reset();
|
317 |
|
|
hltRels_->Reset();
|
318 |
loizides |
1.14 |
|
319 |
loizides |
1.16 |
// get HLT trigger information
|
320 |
loizides |
1.14 |
Handle<TriggerResults> triggerResultsHLT;
|
321 |
loizides |
1.16 |
GetProduct(hltResName_, triggerResultsHLT, event);
|
322 |
loizides |
1.5 |
|
323 |
loizides |
1.16 |
// get HLT trigger object information
|
324 |
|
|
Handle<trigger::TriggerEvent> triggerEventHLT;
|
325 |
|
|
GetProduct(hltEvtName_, triggerEventHLT, event);
|
326 |
|
|
|
327 |
|
|
if (verify_)
|
328 |
|
|
assert(triggerResultsHLT->size()==hltConfig_.size());
|
329 |
|
|
|
330 |
|
|
// reset bitmask
|
331 |
|
|
hltBits_->Clear();
|
332 |
|
|
|
333 |
|
|
//map between EDM and OAK trigger object indices
|
334 |
|
|
std::map<Int_t,Int_t> objmap;
|
335 |
|
|
|
336 |
|
|
// loop over trigger paths
|
337 |
|
|
const UInt_t N = hltConfig_.size();
|
338 |
|
|
for(UInt_t i=0;i<N;++i) {
|
339 |
|
|
|
340 |
|
|
const string &name(hltConfig_.triggerName(i));
|
341 |
|
|
const UInt_t tind(hltConfig_.triggerIndex(name.c_str()));
|
342 |
|
|
if (verify_)
|
343 |
|
|
assert(tind==i);
|
344 |
|
|
|
345 |
|
|
if (verbose_>0)
|
346 |
|
|
cout << "Trigger: path " << name << " [" << i << "]" << endl;
|
347 |
|
|
|
348 |
|
|
if (!triggerResultsHLT->accept(tind))
|
349 |
|
|
continue;
|
350 |
|
|
|
351 |
|
|
// get our trigger bit
|
352 |
|
|
map<string,Short_t>::iterator riter = hltTabMap_->find(name);
|
353 |
|
|
if (riter == hltTabMap_->end()) {
|
354 |
|
|
PrintErrorAndExit(Form("Trigger %s not found\n", name.c_str()));
|
355 |
|
|
}
|
356 |
|
|
|
357 |
|
|
UInt_t mytind = riter->second;
|
358 |
|
|
if (verify_) {
|
359 |
|
|
if (mytind!=tind)
|
360 |
|
|
PrintErrorAndExit(Form("Trigger for %s index does not match: %ud %ud\n",
|
361 |
|
|
name.c_str(), mytind, tind));
|
362 |
|
|
}
|
363 |
|
|
|
364 |
|
|
// set trigger bit
|
365 |
|
|
hltBits_->SetBit(mytind);
|
366 |
sixie |
1.13 |
|
367 |
loizides |
1.16 |
// modules on this trigger path
|
368 |
|
|
const UInt_t M(hltConfig_.size(tind));
|
369 |
|
|
const UInt_t mind(triggerResultsHLT->index(tind));
|
370 |
|
|
assert (mind<M);
|
371 |
|
|
|
372 |
|
|
const vector<string> &mLabels(hltConfig_.moduleLabels(tind));
|
373 |
|
|
|
374 |
|
|
if (verbose_>1)
|
375 |
|
|
cout << " Last active module - label/type: "
|
376 |
|
|
<< mLabels[mind] << "/" << hltConfig_.moduleType(mLabels[mind])
|
377 |
|
|
<< " [" << mind << " out of 0-" << (M-1) << " on this path]" << endl;
|
378 |
|
|
|
379 |
|
|
// loop over modules on path
|
380 |
|
|
for (UInt_t j=0; j<=mind; ++j) {
|
381 |
|
|
const string &mLabel(mLabels[j]);
|
382 |
|
|
|
383 |
|
|
// check whether the module is packed up in TriggerEvent product
|
384 |
|
|
const UInt_t find(triggerEventHLT->filterIndex(InputTag(mLabel,"",hltProcName_)));
|
385 |
|
|
if (find>=triggerEventHLT->sizeFilters())
|
386 |
|
|
continue;
|
387 |
|
|
|
388 |
|
|
const string mType(hltConfig_.moduleType(mLabel));
|
389 |
|
|
if (verbose_>1)
|
390 |
|
|
cout << " 'L3' filter in slot " << j << " - label/type "
|
391 |
|
|
<< mLabel << "/" << mType << endl;
|
392 |
|
|
|
393 |
|
|
// find index for module label/type name
|
394 |
|
|
Short_t modind = -1;
|
395 |
|
|
map<string,Short_t>::iterator riter = hltLabMap_->find(mLabel);
|
396 |
|
|
if (riter != hltLabMap_->end()) {
|
397 |
|
|
modind = riter->second;
|
398 |
|
|
}
|
399 |
loizides |
1.17 |
assert(modind!=-1);
|
400 |
|
|
|
401 |
|
|
Short_t filind = -1;
|
402 |
loizides |
1.16 |
riter = hltLabMap_->find(mType);
|
403 |
|
|
if (riter != hltLabMap_->end()) {
|
404 |
loizides |
1.17 |
filind = riter->second;
|
405 |
loizides |
1.16 |
}
|
406 |
loizides |
1.17 |
assert(filind!=-1);
|
407 |
loizides |
1.14 |
|
408 |
loizides |
1.16 |
// find trigger objects
|
409 |
|
|
const trigger::Vids &vids(triggerEventHLT->filterIds(find));
|
410 |
|
|
const trigger::Keys &keys(triggerEventHLT->filterKeys(find));
|
411 |
|
|
const trigger::size_type nVids(vids.size());
|
412 |
|
|
const trigger::size_type nKeys(keys.size());
|
413 |
|
|
assert(nVids==nKeys);
|
414 |
|
|
|
415 |
|
|
if (verbose_>2)
|
416 |
|
|
cout << " " << nVids << " accepted 'L3' objects found: " << endl;
|
417 |
|
|
|
418 |
|
|
// loop over trigger objects
|
419 |
|
|
const trigger::TriggerObjectCollection &toc(triggerEventHLT->getObjects());
|
420 |
|
|
for (trigger::size_type k=0; k<nVids; ++k) {
|
421 |
|
|
Int_t tocind = keys[k];
|
422 |
|
|
|
423 |
|
|
// get trigger object
|
424 |
|
|
const trigger::TriggerObject &tobj(toc[tocind]);
|
425 |
|
|
if (verbose_>2)
|
426 |
|
|
cout << " " << k << " " << vids[k] << "/" << keys[k] << ": "
|
427 |
|
|
<< tobj.id() << " " << tobj.pt() << " " << tobj.eta()
|
428 |
|
|
<< " " << tobj.phi() << " " << tobj.mass() << endl;
|
429 |
|
|
|
430 |
|
|
// look-up if entry is in map
|
431 |
|
|
Int_t objind = -1;
|
432 |
|
|
map<Int_t,Int_t>::iterator riter = objmap.find(tocind);
|
433 |
|
|
if (riter == objmap.end()) { // add new trigger object
|
434 |
|
|
objind = hltObjs_->Entries();
|
435 |
|
|
objmap.insert(pair<Int_t,Int_t>(tocind,objind));
|
436 |
|
|
TriggerObjectBase *trigObj = hltObjs_->Allocate();
|
437 |
loizides |
1.17 |
new (trigObj) TriggerObjectBase(tobj.id(),tobj.pt(),tobj.eta(),tobj.phi(),tobj.mass());
|
438 |
loizides |
1.16 |
} else { // use existing trigger object
|
439 |
|
|
objind = riter->second;
|
440 |
|
|
}
|
441 |
loizides |
1.14 |
|
442 |
loizides |
1.16 |
TriggerObjectRel *trigRel = hltRels_->Allocate();
|
443 |
loizides |
1.17 |
new (trigRel) TriggerObjectRel(mytind,vids[k],objind,modind,filind);
|
444 |
loizides |
1.16 |
}
|
445 |
|
|
}
|
446 |
|
|
}
|
447 |
|
|
hltObjs_->Trim();
|
448 |
|
|
hltRels_->Trim();
|
449 |
loizides |
1.5 |
}
|