CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FourVectorHLTriggerOffline.cc
Go to the documentation of this file.
1 // $Id: FourVectorHLTriggerOffline.cc,v 1.40 2011/10/28 16:34:34 olzem Exp $
2 // See header file for information.
3 #include "TMath.h"
6 
7 #include <map>
8 #include <utility>
9 
10 
11 using namespace edm;
12 using namespace trigger;
13 
15  resetMe_(true), currentRun_(-99)
16 {
17  LogDebug("FourVectorHLTriggerOffline") << "constructor...." ;
18 
20  if ( ! dbe_ ) {
21  LogInfo("FourVectorHLTriggerOffline") << "unabel to get DQMStore service?";
22  }
23  if (iConfig.getUntrackedParameter < bool > ("DQMStore", false)) {
24  dbe_->setVerbose(0);
25  }
26 
27  dirname_ = iConfig.getUntrackedParameter("dirname",
28  std::string("HLT/FourVector/"));
29  //dirname_ += iConfig.getParameter<std::string>("@module_label");
30 
31  if (dbe_ != 0 ) {
32  dbe_->setCurrentFolder(dirname_);
33  }
34 
35  processname_ = iConfig.getParameter<std::string>("processname");
36 
37  // plotting paramters
38  ptMin_ = iConfig.getUntrackedParameter<double>("ptMin",0.);
39  ptMax_ = iConfig.getUntrackedParameter<double>("ptMax",1000.);
40  nBins_ = iConfig.getUntrackedParameter<unsigned int>("Nbins",20);
41 
42  plotAll_ = iConfig.getUntrackedParameter<bool>("plotAll", false);
43  // this is the list of paths to look at.
44  std::vector<edm::ParameterSet> paths =
45  iConfig.getParameter<std::vector<edm::ParameterSet> >("paths");
46  for(std::vector<edm::ParameterSet>::iterator
47  pathconf = paths.begin() ; pathconf != paths.end();
48  pathconf++) {
49  std::pair<std::string, std::string> custompathnamepair;
50  custompathnamepair.first =pathconf->getParameter<std::string>("pathname");
51  custompathnamepair.second = pathconf->getParameter<std::string>("denompathname");
52  custompathnamepairs_.push_back(custompathnamepair);
53  // customdenompathnames_.push_back(pathconf->getParameter<std::string>("denompathname"));
54  // custompathnames_.push_back(pathconf->getParameter<std::string>("pathname"));
55  }
56 
57  if (hltPaths_.size() > 0)
58  {
59  // book a histogram of scalers
60  scalersSelect = dbe_->book1D("selectedScalers","Selected Scalers", hltPaths_.size(), 0.0, (double)hltPaths_.size());
61  }
62 
63 
64  triggerSummaryLabel_ = iConfig.getParameter<edm::InputTag>("triggerSummaryLabel");
65  triggerSummary_token_ = consumes<TriggerEvent>(iConfig.getParameter<edm::InputTag>("triggerSummaryLabel"));
66  triggerResultsLabel_ = iConfig.getParameter<edm::InputTag>("triggerResultsLabel");
67  triggerResults_token_ = consumes<TriggerResults>(iConfig.getParameter<edm::InputTag>("triggerResultsLabel"));
68 
71 
72 
73  genParticles_token_ = consumes<reco::GenParticleCollection>(iConfig.getUntrackedParameter<edm::InputTag>(("genParticles"),edm::InputTag("genParticles")));
74  iterativeCone5GenJets_token_ = consumes<reco::GenJetCollection>(iConfig.getUntrackedParameter<edm::InputTag>(("iterativeCone5GenJets"),edm::InputTag("iterativeCone5GenJets")));
75  genMetTrue_token_ = consumes<reco::GenMETCollection>(iConfig.getUntrackedParameter<edm::InputTag>(("genMetTrue"),edm::InputTag("genMetTrue")));
76  muonCollection_ = consumes<reco::MuonCollection>(iConfig.getUntrackedParameter<edm::InputTag>(("muons"),edm::InputTag("muons")));
77  gsfElectronCollection_ = consumes<reco::GsfElectronCollection>(iConfig.getUntrackedParameter<edm::InputTag>(("gsfElectrons"),edm::InputTag("gsfElectrons")));
78  caloRecoTauCollection_ = consumes<reco::CaloTauCollection>(iConfig.getUntrackedParameter<edm::InputTag>(("caloRecoTauProducer"),edm::InputTag("caloRecoTauProducer")));
79  caloJetCollection_ = consumes<reco::CaloJetCollection>(iConfig.getUntrackedParameter<edm::InputTag>(("iterativeCone5CaloJets"),edm::InputTag("iterativeCone5CaloJets")));
80  jetTagCollection_ = consumes<reco::JetTagCollection>(iConfig.getUntrackedParameter<edm::InputTag>(("jetTagCollection"),edm::InputTag("jetProbabilityBJetTags")));
81  softMuonBJetTags_ = consumes<reco::JetTagCollection>(iConfig.getUntrackedParameter<edm::InputTag>(("softMuonBJetTags"),edm::InputTag("softMuonBJetTags")));
82  caloMetCollection_ = consumes<reco::CaloMETCollection>(iConfig.getUntrackedParameter<edm::InputTag>(("metCollection"),edm::InputTag("met")));
83  photonCollection_ = consumes<reco::PhotonCollection>(iConfig.getUntrackedParameter<edm::InputTag>(("photonCollection"),edm::InputTag("photons")));
84  trackCollection_ = consumes<reco::TrackCollection>(iConfig.getUntrackedParameter<edm::InputTag>(("trackCollection"),edm::InputTag("pixelTracks")));
85 
86  electronEtaMax_ = iConfig.getUntrackedParameter<double>("electronEtaMax",2.5);
87  electronEtMin_ = iConfig.getUntrackedParameter<double>("electronEtMin",3.0);
88  electronDRMatch_ =iConfig.getUntrackedParameter<double>("electronDRMatch",0.3);
89 
90  muonEtaMax_ = iConfig.getUntrackedParameter<double>("muonEtaMax",2.1);
91  muonEtMin_ = iConfig.getUntrackedParameter<double>("muonEtMin",3.0);
92  muonDRMatch_ =iConfig.getUntrackedParameter<double>("muonDRMatch",0.3);
93 
94  tauEtaMax_ = iConfig.getUntrackedParameter<double>("tauEtaMax",2.5);
95  tauEtMin_ = iConfig.getUntrackedParameter<double>("tauEtMin",3.0);
96  tauDRMatch_ =iConfig.getUntrackedParameter<double>("tauDRMatch",0.3);
97 
98  jetEtaMax_ = iConfig.getUntrackedParameter<double>("jetEtaMax",5.0);
99  jetEtMin_ = iConfig.getUntrackedParameter<double>("jetEtMin",10.0);
100  jetDRMatch_ =iConfig.getUntrackedParameter<double>("jetDRMatch",0.3);
101 
102  bjetEtaMax_ = iConfig.getUntrackedParameter<double>("bjetEtaMax",2.5);
103  bjetEtMin_ = iConfig.getUntrackedParameter<double>("bjetEtMin",10.0);
104  bjetDRMatch_ =iConfig.getUntrackedParameter<double>("bjetDRMatch",0.3);
105 
106  photonEtaMax_ = iConfig.getUntrackedParameter<double>("photonEtaMax",2.5);
107  photonEtMin_ = iConfig.getUntrackedParameter<double>("photonEtMin",3.0);
108  photonDRMatch_ =iConfig.getUntrackedParameter<double>("photonDRMatch",0.3);
109 
110  trackEtaMax_ = iConfig.getUntrackedParameter<double>("trackEtaMax",2.5);
111  trackEtMin_ = iConfig.getUntrackedParameter<double>("trackEtMin",3.0);
112  trackDRMatch_ =iConfig.getUntrackedParameter<double>("trackDRMatch",0.3);
113 
114  metMin_ = iConfig.getUntrackedParameter<double>("metMin",10.0);
115  htMin_ = iConfig.getUntrackedParameter<double>("htMin",10.0);
116  sumEtMin_ = iConfig.getUntrackedParameter<double>("sumEtMin",10.0);
117 
118 }
119 
120 
122 {
123 
124  // do anything here that needs to be done at desctruction time
125  // (e.g. close files, deallocate resources etc.)
126 
127 }
128 
129 
130 //
131 // member functions
132 //
133 
134 // ------------ method called to for each event ------------
135 void
137 {
138  using namespace edm;
139  using namespace trigger;
140  ++nev_;
141  LogDebug("FourVectorHLTriggerOffline")<< " analyze...." ;
142 
145  if(!genParticles.isValid()) {
146  edm::LogInfo("FourVectorHLTriggerOffline") << "genParticles not found, "
147  "skipping event";
148  return;
149  }
150 
153  if(!genJets.isValid()) {
154  edm::LogInfo("FourVectorHLTriggerOffline") << "genJets not found, "
155  "skipping event";
156  return;
157  }
158 
160  iEvent.getByToken(genMetTrue_token_,genMets);
161  if(!genMets.isValid()) {
162  edm::LogInfo("FourVectorHLTriggerOffline") << "genMets not found, "
163  "skipping event";
164  return;
165  }
166 
169  if(!triggerResults.isValid()) {
171  if(!triggerResults.isValid()) {
172  edm::LogInfo("FourVectorHLTriggerOffline") << "TriggerResults not found, "
173  "skipping event";
174  return;
175  }
176  }
177  const edm::TriggerNames & triggerNames = iEvent.triggerNames(*triggerResults);
178  int npath = triggerResults->size();
179 
180  edm::Handle<TriggerEvent> triggerObj;
181  iEvent.getByToken(triggerSummary_token_,triggerObj);
182  if(!triggerObj.isValid()) {
183  iEvent.getByToken(triggerSummaryLabelFU_,triggerObj);
184  if(!triggerObj.isValid()) {
185  edm::LogInfo("FourVectorHLTriggerOffline") << "TriggerEvent not found, "
186  "skipping event";
187  return;
188  }
189  }
190 
192  iEvent.getByToken(muonCollection_,muonHandle);
193  if(!muonHandle.isValid()) {
194  edm::LogInfo("FourVectorHLTriggerOffline") << "muonHandle not found, ";
195  // "skipping event";
196  // return;
197  }
198 
201  if(!gsfElectrons.isValid()) {
202  edm::LogInfo("FourVectorHLTriggerOffline") << "gsfElectrons not found, ";
203  //"skipping event";
204  //return;
205  }
206 
208  iEvent.getByToken(caloRecoTauCollection_,tauHandle);
209  if(!tauHandle.isValid()) {
210  edm::LogInfo("FourVectorHLTriggerOffline") << "tauHandle not found, ";
211  //"skipping event";
212  //return;
213  }
214 
216  iEvent.getByToken(caloJetCollection_,jetHandle);
217  if(!jetHandle.isValid()) {
218  edm::LogInfo("FourVectorHLTriggerOffline") << "jetHandle not found, ";
219  //"skipping event";
220  //return;
221  }
222 
223  // Get b tag information
225  iEvent.getByToken(jetTagCollection_, bTagIPHandle);
226  if (!bTagIPHandle.isValid()) {
227  edm::LogInfo("FourVectorHLTriggerOffline") << "mTagIPHandle trackCountingHighEffJetTags not found, ";
228  //"skipping event";
229  //return;
230  }
231 
232  // Get b tag information
234  iEvent.getByToken(softMuonBJetTags_, bTagMuHandle);
235  if (!bTagMuHandle.isValid()) {
236  edm::LogInfo("FourVectorHLTriggerOffline") << "bTagMuHandle not found, ";
237  //"skipping event";
238  //return;
239  }
240 
242  iEvent.getByToken(caloMetCollection_,metHandle);
243  if(!metHandle.isValid()) {
244  edm::LogInfo("FourVectorHLTriggerOffline") << "metHandle not found, ";
245  //"skipping event";
246  //return;
247  }
248 
250  iEvent.getByToken(photonCollection_,photonHandle);
251  if(!photonHandle.isValid()) {
252  edm::LogInfo("FourVectorHLTriggerOffline") << "photonHandle not found, ";
253  //"skipping event";
254  //return;
255  }
256 
258  iEvent.getByToken(trackCollection_,trackHandle);
259  if(!trackHandle.isValid()) {
260  edm::LogInfo("FourVectorHLTriggerOffline") << "trackHandle not found, ";
261  //"skipping event";
262  //return;
263  }
264 
265  const trigger::TriggerObjectCollection & toc(triggerObj->getObjects());
266 
267  // electron Monitor
268  // ------------
270  eleMon.setReco(gsfElectrons);
271  eleMon.setMC(genParticles, 11, 1);
272  eleMon.setLimits(electronEtaMax_, electronEtMin_, electronDRMatch_);
273 
274  eleMon.pushTriggerType(TriggerElectron);
275  eleMon.pushTriggerType(TriggerL1NoIsoEG);
276  eleMon.pushTriggerType(TriggerL1IsoEG);
277 
278  eleMon.pushL1TriggerType(TriggerL1NoIsoEG);
279  eleMon.pushL1TriggerType(TriggerL1IsoEG);
280 
281  // muon Monitor
282  // ------------
284  muoMon.setReco(muonHandle);
285  muoMon.setMC(genParticles, 13, 1);
286  muoMon.setLimits(muonEtaMax_, muonEtMin_, muonDRMatch_);
287 
288  muoMon.pushTriggerType(TriggerMuon);
289  muoMon.pushTriggerType(TriggerL1Mu);
290 
291  muoMon.pushL1TriggerType(TriggerL1Mu);
292 
293  // tau Monitor
294  // ------------
296  tauMon.setReco(tauHandle);
297  tauMon.setMC(genParticles, 15, 3);
298  tauMon.setLimits(tauEtaMax_, tauEtMin_, tauDRMatch_);
299 
300  tauMon.pushTriggerType(TriggerTau);
301  tauMon.pushTriggerType(TriggerL1TauJet);
302 
303  tauMon.pushL1TriggerType(TriggerL1TauJet);
304  tauMon.pushL1TriggerType(TriggerL1CenJet);
305  tauMon.pushL1TriggerType(TriggerL1ForJet);
306 
307  // photon Monitor
308  // ------------
310  phoMon.setReco(photonHandle);
311  phoMon.setMC(genParticles, 22, 1);
312  phoMon.setLimits(photonEtaMax_, photonEtMin_, photonDRMatch_);
313 
314  phoMon.pushTriggerType(TriggerPhoton);
315 
316  phoMon.pushL1TriggerType(TriggerL1NoIsoEG);
317  phoMon.pushL1TriggerType(TriggerL1IsoEG);
318 
319  // jet Monitor - NOTICE: we use genJets for MC
320  // -------------------------------------------
322  jetMon.setReco(jetHandle);
323  jetMon.setGenJets(true, genJets);
324  jetMon.setLimits(jetEtaMax_, jetEtMin_, jetDRMatch_);
325 
326  jetMon.pushTriggerType(TriggerJet);
327  jetMon.pushTriggerType(TriggerL1CenJet);
328  jetMon.pushTriggerType(TriggerL1ForJet);
329 
330  jetMon.pushL1TriggerType(TriggerL1CenJet);
331  jetMon.pushL1TriggerType(TriggerL1ForJet);
332  jetMon.pushL1TriggerType(TriggerL1TauJet);
333 
334  // btag Monitor - NOTICE: we use genJets for MC
335  // -------------------------------------------
336  //objMon<reco::JetTagCollection> btagIPMon;
337  objMon<reco::CaloJetCollection> btagIPMon; // CaloJet will not be used, this is only place holder
338  //btagIPMon.setReco(jetHandle);
339  btagIPMon.setRecoB(bTagIPHandle);
340  btagIPMon.setMC(genParticles, 5, 3);
341  btagIPMon.setGenJets(true, genJets);
342  btagIPMon.setBJetsFlag(true);
343  btagIPMon.setLimits(bjetEtaMax_, bjetEtMin_, bjetDRMatch_);
344 
345  btagIPMon.pushTriggerType(TriggerBJet);
346  btagIPMon.pushTriggerType(TriggerJet);
347 
348  btagIPMon.pushL1TriggerType(TriggerL1CenJet);
349  btagIPMon.pushL1TriggerType(TriggerL1ForJet);
350  btagIPMon.pushL1TriggerType(TriggerL1TauJet);
351 
352  //objMon<reco::JetTagCollection> btagMuMon;
353  objMon<reco::CaloJetCollection> btagMuMon; // CaloJet will not be used, this is only place holder
354  //btagMuMon.setReco(jetHandle);
355  btagMuMon.setRecoB(bTagMuHandle);
356  btagMuMon.setMC(genParticles, 5, 3);
357  btagMuMon.setGenJets(true, genJets);
358  btagMuMon.setBJetsFlag(true);
359  btagMuMon.setLimits(bjetEtaMax_, bjetEtMin_, bjetDRMatch_);
360 
361  btagMuMon.pushTriggerType(TriggerBJet);
362  btagMuMon.pushTriggerType(TriggerJet);
363 
364  btagMuMon.pushL1TriggerType(TriggerL1CenJet);
365  btagMuMon.pushL1TriggerType(TriggerL1ForJet);
366  btagMuMon.pushL1TriggerType(TriggerL1TauJet);
367 
368 
369  objMon<reco::CaloJetCollection> btagMon; // Generic btagMon
370 
371  for(PathInfoCollection::iterator v = hltPaths_.begin();
372  v!= hltPaths_.end(); ++v )
373 {
374  //LogTrace("FourVectorHLTriggerOffline") << " path " << v->getPath() << std::endl;
375  if (v->getPath().find("BTagIP") != std::string::npos ) btagMon = btagIPMon;
376  else btagMon = btagMuMon;
377 
378 
379  // did we pass the denomPath?
380  bool denompassed = false;
381  for(int i = 0; i < npath; ++i) {
382  if (triggerNames.triggerName(i).find(v->getDenomPath()) != std::string::npos && triggerResults->accept(i))
383  {
384  denompassed = true;
385  break;
386  }
387  }
388 
389  if (denompassed)
390  {
391 
392  eleMon.clearSets();
393  muoMon.clearSets();
394  tauMon.clearSets();
395  phoMon.clearSets();
396  jetMon.clearSets();
397  btagMon.clearSets();
398 
399  // UNUSED
400  // int triggertype = 0;
401  // triggertype = v->getObjectType();
402 
403  bool l1accept = false;
404  edm::InputTag l1testTag(v->getl1Path(),"",processname_);
405  const int l1index = triggerObj->filterIndex(l1testTag);
406  if ( l1index >= triggerObj->sizeFilters() ) {
407  edm::LogInfo("FourVectorHLTriggerOffline") << "no index "<< l1index << " of that name " << v->getl1Path() << "\t" << "\t" << l1testTag;
408  continue; // not in this event
409  }
410 
411  const trigger::Vids & idtype = triggerObj->filterIds(l1index);
412  const trigger::Keys & l1k = triggerObj->filterKeys(l1index);
413  l1accept = l1k.size() > 0;
414 
415 
416  eleMon.monitorDenominator(v, l1accept, idtype, l1k, toc);
417  muoMon.monitorDenominator(v, l1accept, idtype, l1k, toc);
418  tauMon.monitorDenominator(v, l1accept, idtype, l1k, toc);
419  phoMon.monitorDenominator(v, l1accept, idtype, l1k, toc);
420  jetMon.monitorDenominator(v, l1accept, idtype, l1k, toc);
421  btagMon.monitorDenominator(v, l1accept, idtype, l1k, toc);
422 
423  eleMon.fillL1Match(this);
424  muoMon.fillL1Match(this);
425  tauMon.fillL1Match(this);
426  phoMon.fillL1Match(this);
427  jetMon.fillL1Match(this);
428  btagMon.fillL1Match(this);
429 
430  // did we pass the numerator path?
431  bool numpassed = false;
432  for(int i = 0; i < npath; ++i) {
433 
434  if (triggerNames.triggerName(i) == v->getPath() && triggerResults->accept(i)) numpassed = true;
435 
436  }
437 
438  if (numpassed)
439  {
440 
441  if (!l1accept) {
442  edm::LogInfo("FourVectorHLTriggerOffline") << "l1 seed path not accepted for hlt path "<< v->getPath() << "\t" << v->getl1Path();
443  }
444 
445  // fill scaler histograms
446  edm::InputTag filterTag = v->getTag();
447 
448  // loop through indices and see if the filter is on the list of filters used by this path
449 
450  if (v->getLabel() == "dummy"){
451  const std::vector<std::string> filterLabels = hltConfig_.moduleLabels(v->getPath());
452  //loop over labels
453  for (std::vector<std::string>::const_iterator labelIter= filterLabels.begin(); labelIter!=filterLabels.end(); labelIter++)
454  {
455 
456  //std::cout << v->getPath() << "\t" << *labelIter << std::endl;
457  // last match wins...
458  edm::InputTag testTag(*labelIter,"",processname_);
459  int testindex = triggerObj->filterIndex(testTag);
460  if ( !(testindex >= triggerObj->sizeFilters()) ) {
461 
462  //std::cout << "found one! " << v->getPath() << "\t" << testTag.label() << std::endl;
463  filterTag = testTag; v->setLabel(*labelIter);}
464  }
465  }
466 
467  const int index = triggerObj->filterIndex(filterTag);
468  if ( index >= triggerObj->sizeFilters() ) {
469 
470  // std::cout << "WTF no index "<< index << " of that name "
471  // << filterTag << std::endl;
472  continue; // not in this event
473 
474  }
475 
476  //LogDebug("FourVectorHLTriggerOffline") << "filling ... " ;
477  const trigger::Keys & k = triggerObj->filterKeys(index);
478  // const trigger::Vids & idtype = triggerObj->filterIds(index);
479  // assume for now the first object type is the same as all objects in the collection
480  // std::cout << filterTag << "\t" << idtype.size() << "\t" << k.size() << std::endl;
481  // std::cout << "path " << v->getPath() << " trigger type "<<triggertype << std::endl;
482  //if (k.size() > 0) v->getNOnHisto()->Fill(k.size());
483 
484 
485  unsigned int NOn=0;
486 
487  for (trigger::Keys::const_iterator ki = k.begin(); ki !=k.end(); ++ki ) {
488 
489  eleMon.monitorOnline(idtype, l1k, ki, toc, NOn);
490  muoMon.monitorOnline(idtype, l1k, ki, toc, NOn);
491  tauMon.monitorOnline(idtype, l1k, ki, toc, NOn);
492  phoMon.monitorOnline(idtype, l1k, ki, toc, NOn);
493  jetMon.monitorOnline(idtype, l1k, ki, toc, NOn);
494  btagMon.monitorOnline(idtype, l1k, ki, toc, NOn);
495 
496  } //online object loop
497 
498  eleMon.fillOnlineMatch(this, l1k, toc);
499  muoMon.fillOnlineMatch(this, l1k, toc);
500  tauMon.fillOnlineMatch(this, l1k, toc);
501  phoMon.fillOnlineMatch(this, l1k, toc);
502  jetMon.fillOnlineMatch(this, l1k, toc);
503  btagMon.fillOnlineMatch(this, l1k, toc);
504 
505  eleMon.monitorOffline(this);
506  muoMon.monitorOffline(this);
507  tauMon.monitorOffline(this);
508  phoMon.monitorOffline(this);
509  jetMon.monitorOffline(this);
510  btagMon.monitorOffline(this);
511 
512  eleMon.fillOffMatch(this);
513  muoMon.fillOffMatch(this);
514  tauMon.fillOffMatch(this);
515  phoMon.fillOffMatch(this);
516  jetMon.fillOffMatch(this);
517  btagMon.fillOffMatch(this);
518 
519 
520  } //numpassed
521 
522 
523 
524  } //denompassed
525 
526  } //pathinfo loop
527 
528 }
529 
530 
531 
532 // -- method called once each job just before starting event loop --------
533 void
535 {
536  nev_ = 0;
537  DQMStore *dbe = 0;
538  dbe = Service<DQMStore>().operator->();
539 
540  if (dbe) {
541  dbe->setCurrentFolder(dirname_);
542  dbe->rmdir(dirname_);
543  }
544 
545 
546  if (dbe) {
547  dbe->setCurrentFolder(dirname_);
548  }
549 }
550 
551 // - method called once each job just after ending the event loop ------------
552 void
554 {
555  LogInfo("FourVectorHLTriggerOffline") << "analyzed " << nev_ << " events";
556  return;
557 }
558 
559 
560 // BeginRun
562 {
563  LogDebug("FourVectorHLTriggerOffline") << "beginRun, run " << run.id();
564  // HLT config does not change within runs!
565 
566  bool changed(false);
567  if (!hltConfig_.init(run, c, processname_, changed)) {
568  processname_ = "FU";
569  if (!hltConfig_.init(run, c, processname_, changed)){
570  LogDebug("FourVectorHLTriggerOffline") << "HLTConfigProvider failed to initialize.";
571  }
572  // check if trigger name in (new) config
573  // std::cout << "Available TriggerNames are: " << std::endl;
574  // hltConfig_.dump("Triggers");
575  }
576 
577 
578  if (1)
579  {
580  DQMStore *dbe = 0;
581  dbe = Service<DQMStore>().operator->();
582 
583  if (dbe) {
584  dbe->setCurrentFolder(dirname_);
585  }
586 
587 
588  const unsigned int n(hltConfig_.size());
589  if (plotAll_){
590  for (unsigned int j=0; j!=n; ++j) {
592  std::string l1pathname = "dummy";
593  for (unsigned int i=0; i!=n; ++i) {
594  // std::cout << hltConfig_.triggerName(i) << std::endl;
595 
596  std::string denompathname = hltConfig_.triggerName(i);
597  int objectType = 0;
598  int denomobjectType = 0;
599  //parse pathname to guess object type
600  if (pathname.find("MET") != std::string::npos)
601  objectType = trigger::TriggerMET;
602  if (pathname.find("SumET") != std::string::npos)
603  objectType = trigger::TriggerTET;
604  if (pathname.find("HT") != std::string::npos)
605  objectType = trigger::TriggerTET;
606  if (pathname.find("Jet") != std::string::npos)
607  objectType = trigger::TriggerJet;
608  if (pathname.find("Mu") != std::string::npos)
609  objectType = trigger::TriggerMuon;
610  if (pathname.find("Ele") != std::string::npos)
611  objectType = trigger::TriggerElectron;
612  if (pathname.find("Photon") != std::string::npos)
613  objectType = trigger::TriggerPhoton;
614  if (pathname.find("Tau") != std::string::npos)
615  objectType = trigger::TriggerTau;
616  if (pathname.find("IsoTrack") != std::string::npos)
617  objectType = trigger::TriggerTrack;
618  if (pathname.find("BTag") != std::string::npos)
619  objectType = trigger::TriggerBJet;
620 
621  //parse denompathname to guess denomobject type
622  if (denompathname.find("MET") != std::string::npos)
623  denomobjectType = trigger::TriggerMET;
624  if (denompathname.find("SumET") != std::string::npos)
625  denomobjectType = trigger::TriggerTET;
626  if (denompathname.find("HT") != std::string::npos)
627  denomobjectType = trigger::TriggerTET;
628  if (denompathname.find("Jet") != std::string::npos)
629  denomobjectType = trigger::TriggerJet;
630  if (denompathname.find("Mu") != std::string::npos)
631  denomobjectType = trigger::TriggerMuon;
632  if (denompathname.find("Ele") != std::string::npos)
633  denomobjectType = trigger::TriggerElectron;
634  if (denompathname.find("Photon") != std::string::npos)
635  denomobjectType = trigger::TriggerPhoton;
636  if (denompathname.find("Tau") != std::string::npos)
637  denomobjectType = trigger::TriggerTau;
638  if (denompathname.find("IsoTrack") != std::string::npos)
639  denomobjectType = trigger::TriggerTrack;
640  if (denompathname.find("BTag") != std::string::npos)
641  denomobjectType = trigger::TriggerBJet;
642 
643  // find L1 condition for numpath with numpath objecttype
644 
645  // find PSet for L1 global seed for numpath,
646  // list module labels for numpath
647  std::vector<std::string> numpathmodules = hltConfig_.moduleLabels(pathname);
648 
649  for(std::vector<std::string>::iterator numpathmodule = numpathmodules.begin();
650  numpathmodule!= numpathmodules.end(); ++numpathmodule ) {
651  // std::cout << pathname << "\t" << *numpathmodule << "\t" << hltConfig_.moduleType(*numpathmodule) << std::endl;
652  if (hltConfig_.moduleType(*numpathmodule) == "HLTLevel1GTSeed")
653  {
654  edm::ParameterSet l1GTPSet = hltConfig_.modulePSet(*numpathmodule);
655  // std::cout << l1GTPSet.getParameter<std::string>("L1SeedsLogicalExpression") << std::endl;
656  // l1pathname = l1GTPSet.getParameter<std::string>("L1SeedsLogicalExpression");
657  l1pathname = *numpathmodule;
658  break;
659  }
660  }
661 
662 
663 
664  std::string filtername("dummy");
665  float ptMin = 0.0;
666  float ptMax = 100.0;
667  if (plotAll_ && denomobjectType == objectType && objectType != 0)
668  hltPaths_.push_back(PathInfo(denompathname, pathname, l1pathname, filtername, processname_, objectType, ptMin, ptMax));
669 
670  }
671  }
672 
673  }
674  else
675  {
676  // plot all diagonal combinations plus any other specified pairs
677  for (unsigned int i=0; i!=n; ++i) {
678  std::string denompathname = "";
680  std::string l1pathname = "dummy";
681  int objectType = 0;
682  // int denomobjectType = 0; // UNUSED
683  //parse pathname to guess object type
684  if (pathname.find("MET") != std::string::npos)
685  objectType = trigger::TriggerMET;
686  if (pathname.find("SumET") != std::string::npos)
687  objectType = trigger::TriggerTET;
688  if (pathname.find("HT") != std::string::npos)
689  objectType = trigger::TriggerTET;
690  if (pathname.find("Jet") != std::string::npos)
691  objectType = trigger::TriggerJet;
692  if (pathname.find("Mu") != std::string::npos)
693  objectType = trigger::TriggerMuon;
694  if (pathname.find("Ele") != std::string::npos)
695  objectType = trigger::TriggerElectron;
696  if (pathname.find("Photon") != std::string::npos)
697  objectType = trigger::TriggerPhoton;
698  if (pathname.find("Tau") != std::string::npos)
699  objectType = trigger::TriggerTau;
700  if (pathname.find("IsoTrack") != std::string::npos)
701  objectType = trigger::TriggerTrack;
702  if (pathname.find("BTag") != std::string::npos)
703  objectType = trigger::TriggerBJet;
704 
705  // UNUSED
706  // //parse denompathname to guess denomobject type
707  // if (denompathname.find("MET") != std::string::npos)
708  // denomobjectType = trigger::TriggerMET;
709  // if (denompathname.find("SumET") != std::string::npos)
710  // denomobjectType = trigger::TriggerTET;
711  // if (denompathname.find("HT") != std::string::npos)
712  // denomobjectType = trigger::TriggerTET;
713  // if (denompathname.find("Jet") != std::string::npos)
714  // denomobjectType = trigger::TriggerJet;
715  // if (denompathname.find("Mu") != std::string::npos)
716  // denomobjectType = trigger::TriggerMuon;
717  // if (denompathname.find("Ele") != std::string::npos)
718  // denomobjectType = trigger::TriggerElectron;
719  // if (denompathname.find("Photon") != std::string::npos)
720  // denomobjectType = trigger::TriggerPhoton;
721  // if (denompathname.find("Tau") != std::string::npos)
722  // denomobjectType = trigger::TriggerTau;
723  // if (denompathname.find("IsoTrack") != std::string::npos)
724  // denomobjectType = trigger::TriggerTrack;
725  // if (denompathname.find("BTag") != std::string::npos)
726  // denomobjectType = trigger::TriggerBJet;
727  // find L1 condition for numpath with numpath objecttype
728 
729  // find PSet for L1 global seed for numpath,
730  // list module labels for numpath
731  std::vector<std::string> numpathmodules = hltConfig_.moduleLabels(pathname);
732 
733  for(std::vector<std::string>::iterator numpathmodule = numpathmodules.begin();
734  numpathmodule!= numpathmodules.end(); ++numpathmodule ) {
735  // std::cout << pathname << "\t" << *numpathmodule << "\t" << hltConfig_.moduleType(*numpathmodule) << std::endl;
736  if (hltConfig_.moduleType(*numpathmodule) == "HLTLevel1GTSeed")
737  {
738  edm::ParameterSet l1GTPSet = hltConfig_.modulePSet(*numpathmodule);
739  // std::cout << l1GTPSet.getParameter<std::string>("L1SeedsLogicalExpression") << std::endl;
740  //l1pathname = l1GTPSet.getParameter<std::string>("L1SeedsLogicalExpression");
741  l1pathname = *numpathmodule;
742  break;
743  }
744  }
745 
746 
747 
748 
749 
750  std::string filtername("dummy");
751  float ptMin = 0.0;
752  float ptMax = 100.0;
753  if (objectType == trigger::TriggerPhoton) ptMax = 100.0;
754  if (objectType == trigger::TriggerElectron) ptMax = 100.0;
755  if (objectType == trigger::TriggerMuon) ptMax = 100.0;
756  if (objectType == trigger::TriggerTau) ptMax = 100.0;
757  if (objectType == trigger::TriggerJet) ptMax = 300.0;
758  if (objectType == trigger::TriggerBJet) ptMax = 300.0;
759  if (objectType == trigger::TriggerMET) ptMax = 300.0;
760  if (objectType == trigger::TriggerTET) ptMax = 300.0;
761  if (objectType == trigger::TriggerTrack) ptMax = 100.0;
762 
763  if (objectType != 0){
764  hltPaths_.push_back(PathInfo(denompathname, pathname, l1pathname, filtername, processname_, objectType, ptMin, ptMax));
765  //create folder for pathname
766  }
767  }
768  // now loop over denom/num path pairs specified in cfg,
769  // recording the off-diagonal ones
770  for (std::vector<std::pair<std::string, std::string> >::iterator custompathnamepair = custompathnamepairs_.begin(); custompathnamepair != custompathnamepairs_.end(); ++custompathnamepair)
771  {
772  if (custompathnamepair->first != custompathnamepair->second)
773  {
774 
775  std::string denompathname = custompathnamepair->second;
776  std::string pathname = custompathnamepair->first;
777 
778  // check that these exist
779  bool foundfirst = false;
780  bool foundsecond = false;
781  for (unsigned int i=0; i!=n; ++i) {
782  if (hltConfig_.triggerName(i) == denompathname) foundsecond = true;
783  if (hltConfig_.triggerName(i) == pathname) foundfirst = true;
784  }
785  if (!foundfirst)
786  {
787  edm::LogInfo("FourVectorHLTriggerOffline") << "pathname not found, ignoring " << pathname;
788  continue;
789  }
790  if (!foundsecond)
791  {
792  edm::LogInfo("FourVectorHLTriggerOffline") << "denompathname not found, ignoring " << pathname;
793  continue;
794  }
795 
796  //std::cout << pathname << "\t" << denompathname << std::endl;
797  std::string l1pathname = "dummy";
798  int objectType = 0;
799  //int denomobjectType = 0;
800  //parse pathname to guess object type
801  if (pathname.find("MET") != std::string::npos)
802  objectType = trigger::TriggerMET;
803  if (pathname.find("SumET") != std::string::npos)
804  objectType = trigger::TriggerTET;
805  if (pathname.find("HT") != std::string::npos)
806  objectType = trigger::TriggerTET;
807  if (pathname.find("Jet") != std::string::npos)
808  objectType = trigger::TriggerJet;
809  if (pathname.find("Mu") != std::string::npos)
810  objectType = trigger::TriggerMuon;
811  if (pathname.find("Ele") != std::string::npos)
812  objectType = trigger::TriggerElectron;
813  if (pathname.find("Photon") != std::string::npos)
814  objectType = trigger::TriggerPhoton;
815  if (pathname.find("Tau") != std::string::npos)
816  objectType = trigger::TriggerTau;
817  if (pathname.find("IsoTrack") != std::string::npos)
818  objectType = trigger::TriggerTrack;
819  if (pathname.find("BTag") != std::string::npos)
820  objectType = trigger::TriggerBJet;
821  // find L1 condition for numpath with numpath objecttype
822 
823  // find PSet for L1 global seed for numpath,
824  // list module labels for numpath
825 
826  std::vector<std::string> numpathmodules = hltConfig_.moduleLabels(pathname);
827 
828  for(std::vector<std::string>::iterator numpathmodule = numpathmodules.begin();
829  numpathmodule!= numpathmodules.end(); ++numpathmodule ) {
830  // std::cout << pathname << "\t" << *numpathmodule << "\t" << hltConfig_.moduleType(*numpathmodule) << std::endl;
831  if (hltConfig_.moduleType(*numpathmodule) == "HLTLevel1GTSeed")
832  {
833  edm::ParameterSet l1GTPSet = hltConfig_.modulePSet(*numpathmodule);
834  // std::cout << l1GTPSet.getParameter<std::string>("L1SeedsLogicalExpression") << std::endl;
835  // l1pathname = l1GTPSet.getParameter<std::string>("L1SeedsLogicalExpression");
836  l1pathname = *numpathmodule;
837  //std::cout << *numpathmodule << std::endl;
838  break;
839  }
840  }
841 
842 
843 
844 
845 
846  std::string filtername("dummy");
847  float ptMin = 0.0;
848  float ptMax = 100.0;
849  if (objectType == trigger::TriggerPhoton) ptMax = 100.0;
850  if (objectType == trigger::TriggerElectron) ptMax = 100.0;
851  if (objectType == trigger::TriggerMuon) ptMax = 100.0;
852  if (objectType == trigger::TriggerTau) ptMax = 100.0;
853  if (objectType == trigger::TriggerJet) ptMax = 300.0;
854  if (objectType == trigger::TriggerBJet) ptMax = 300.0;
855  if (objectType == trigger::TriggerMET) ptMax = 300.0;
856  if (objectType == trigger::TriggerTET) ptMax = 300.0;
857  if (objectType == trigger::TriggerTrack) ptMax = 100.0;
858 
859  if (objectType != 0)
860  hltPaths_.push_back(PathInfo(denompathname, pathname, l1pathname, filtername, processname_, objectType, ptMin, ptMax));
861 
862  }
863  }
864 
865  }
866 
867 
868 
869  // now set up all of the histos for each path
870  for(PathInfoCollection::iterator v = hltPaths_.begin();
871  v!= hltPaths_.end(); ++v ) {
872  MonitorElement *NOn, *onEtOn, *onEtavsonPhiOn=0;
873  MonitorElement *NMc, *mcEtMc, *mcEtavsmcPhiMc=0;
874  MonitorElement *NOff, *offEtOff, *offEtavsoffPhiOff=0;
875  MonitorElement *NL1, *l1EtL1, *l1Etavsl1PhiL1=0;
876  MonitorElement *NL1On, *l1EtL1On, *l1Etavsl1PhiL1On=0;
877  MonitorElement *NL1Off, *offEtL1Off, *offEtavsoffPhiL1Off=0;
878  MonitorElement *NOnOff, *offEtOnOff, *offEtavsoffPhiOnOff=0;
879  MonitorElement *NL1Mc, *mcEtL1Mc, *mcEtavsmcPhiL1Mc=0;
880  MonitorElement *NOffMc, *mcEtOffMc, *mcEtavsmcPhiOffMc=0;
881  MonitorElement *NOnMc, *mcEtOnMc, *mcEtavsmcPhiOnMc=0;
882  MonitorElement *NL1OnUM, *l1EtL1OnUM, *l1Etavsl1PhiL1OnUM=0;
883  MonitorElement *NL1OffUM, *offEtL1OffUM, *offEtavsoffPhiL1OffUM=0;
884  MonitorElement *NOnOffUM, *offEtOnOffUM, *offEtavsoffPhiOnOffUM=0;
885  MonitorElement *NL1McUM, *mcEtL1McUM, *mcEtavsmcPhiL1McUM=0;
886  MonitorElement *NOffMcUM, *mcEtOffMcUM, *mcEtavsmcPhiOffMcUM=0;
887  MonitorElement *NOnMcUM, *mcEtOnMcUM, *mcEtavsmcPhiOnMcUM=0;
888  MonitorElement *mcDRL1Mc, *mcDROnMc, *mcDROffMc,
889  *offDRL1Off, *offDROnOff, *l1DRL1On=0;
890  std::string labelname("dummy");
891  labelname = v->getPath() + "_wrt_" + v->getDenomPath();
892  std::string histoname(labelname+"_NOn");
893  std::string title(labelname+" N online");
894 
895 
896 
897  double histEtaMax = 2.5;
898  if (v->getObjectType() == trigger::TriggerMuon || v->getObjectType() == trigger::TriggerL1Mu)
899  {
900  histEtaMax = muonEtaMax_;
901  }
902  else if (v->getObjectType() == trigger::TriggerElectron || v->getObjectType() == trigger::TriggerL1NoIsoEG || v->getObjectType() == trigger::TriggerL1IsoEG )
903  {
904  histEtaMax = electronEtaMax_;
905  }
906  else if (v->getObjectType() == trigger::TriggerTau || v->getObjectType() == trigger::TriggerL1TauJet )
907  {
908  histEtaMax = tauEtaMax_;
909  }
910  else if (v->getObjectType() == trigger::TriggerJet || v->getObjectType() == trigger::TriggerL1CenJet || v->getObjectType() == trigger::TriggerL1ForJet )
911  {
912  histEtaMax = jetEtaMax_;
913  }
914  else if (v->getObjectType() == trigger::TriggerBJet)
915  {
916  histEtaMax = bjetEtaMax_;
917  }
918  else if (v->getObjectType() == trigger::TriggerMET || v->getObjectType() == trigger::TriggerL1ETM )
919  {
920  histEtaMax = 5.0;
921  }
922  else if (v->getObjectType() == trigger::TriggerPhoton)
923  {
924  histEtaMax = photonEtaMax_;
925  }
926  else if (v->getObjectType() == trigger::TriggerTrack)
927  {
928  histEtaMax = trackEtaMax_;
929  }
930 
931  TString pathfolder = dirname_ + TString("/") + v->getPath();
932  dbe_->setCurrentFolder(pathfolder.Data());
933 
934  NOn = dbe->book1D(histoname.c_str(),
935  title.c_str(),10,
936  0.5,
937  10.5);
938 
939  histoname = labelname+"_NMc";
940  title = labelname+" N Mc";
941  NMc = dbe->book1D(histoname.c_str(),
942  title.c_str(),10,
943  0.5,
944  10.5);
945 
946  histoname = labelname+"_NOff";
947  title = labelname+" N Off";
948  NOff = dbe->book1D(histoname.c_str(),
949  title.c_str(),10,
950  0.5,
951  10.5);
952 
953  histoname = labelname+"_NL1";
954  title = labelname+" N L1";
955  NL1 = dbe->book1D(histoname.c_str(),
956  title.c_str(),10,
957  0.5,
958  10.5);
959 
960  histoname = labelname+"_NL1On";
961  title = labelname+" N L1On";
962  NL1On = dbe->book1D(histoname.c_str(),
963  title.c_str(),10,
964  0.5,
965  10.5);
966 
967  histoname = labelname+"_NL1Off";
968  title = labelname+" N L1Off";
969  NL1Off = dbe->book1D(histoname.c_str(),
970  title.c_str(),10,
971  0.5,
972  10.5);
973 
974  histoname = labelname+"_NOnOff";
975  title = labelname+" N OnOff";
976  NOnOff = dbe->book1D(histoname.c_str(),
977  title.c_str(),10,
978  0.5,
979  10.5);
980 
981  histoname = labelname+"_NL1Mc";
982  title = labelname+" N L1Mc";
983  NL1Mc = dbe->book1D(histoname.c_str(),
984  title.c_str(),10,
985  0.5,
986  10.5);
987 
988  histoname = labelname+"_NOffMc";
989  title = labelname+" N OffMc";
990  NOffMc = dbe->book1D(histoname.c_str(),
991  title.c_str(),10,
992  0.5,
993  10.5);
994 
995  histoname = labelname+"_NOnMc";
996  title = labelname+" N OnMc";
997  NOnMc = dbe->book1D(histoname.c_str(),
998  title.c_str(),10,
999  0.5,
1000  10.5);
1001 
1002  histoname = labelname+"_NL1OnUM";
1003  title = labelname+" N L1OnUM";
1004  NL1OnUM = dbe->book1D(histoname.c_str(),
1005  title.c_str(),10,
1006  0.5,
1007  10.5);
1008 
1009  histoname = labelname+"_NL1OffUM";
1010  title = labelname+" N L1OffUM";
1011  NL1OffUM = dbe->book1D(histoname.c_str(),
1012  title.c_str(),10,
1013  0.5,
1014  10.5);
1015 
1016  histoname = labelname+"_NOnOffUM";
1017  title = labelname+" N OnOffUM";
1018  NOnOffUM = dbe->book1D(histoname.c_str(),
1019  title.c_str(),10,
1020  0.5,
1021  10.5);
1022 
1023  histoname = labelname+"_NL1McUM";
1024  title = labelname+" N L1McUM";
1025  NL1McUM = dbe->book1D(histoname.c_str(),
1026  title.c_str(),10,
1027  0.5,
1028  10.5);
1029 
1030  histoname = labelname+"_NOffMcUM";
1031  title = labelname+" N OffMcUM";
1032  NOffMcUM = dbe->book1D(histoname.c_str(),
1033  title.c_str(),10,
1034  0.5,
1035  10.5);
1036 
1037  histoname = labelname+"_NOnMcUM";
1038  title = labelname+" N OnMcUM";
1039  NOnMcUM = dbe->book1D(histoname.c_str(),
1040  title.c_str(),10,
1041  0.5,
1042  10.5);
1043 
1044  histoname = labelname+"_mcEtMc";
1045  title = labelname+" mcE_t Mc";
1046  mcEtMc = dbe->book1D(histoname.c_str(),
1047  title.c_str(),nBins_,
1048  v->getPtMin(),
1049  v->getPtMax());
1050 
1051  histoname = labelname+"_onEtOn";
1052  title = labelname+" onE_t online";
1053  onEtOn = dbe->book1D(histoname.c_str(),
1054  title.c_str(),nBins_,
1055  v->getPtMin(),
1056  v->getPtMax());
1057 
1058  histoname = labelname+"_offEtOff";
1059  title = labelname+" offE_t offline";
1060  offEtOff = dbe->book1D(histoname.c_str(),
1061  title.c_str(),nBins_,
1062  v->getPtMin(),
1063  v->getPtMax());
1064 
1065  histoname = labelname+"_l1EtL1";
1066  title = labelname+" l1E_t L1";
1067  l1EtL1 = dbe->book1D(histoname.c_str(),
1068  title.c_str(),nBins_,
1069  v->getPtMin(),
1070  v->getPtMax());
1071 
1072  int nBins2D = 10;
1073 
1074  histoname = labelname+"_mcEtamcPhiMc";
1075  title = labelname+" mc#eta vs mc#phi Mc";
1076  mcEtavsmcPhiMc = dbe->book2D(histoname.c_str(),
1077  title.c_str(),
1078  nBins2D,-histEtaMax,histEtaMax,
1079  nBins2D,-TMath::Pi(), TMath::Pi());
1080 
1081  histoname = labelname+"_onEtaonPhiOn";
1082  title = labelname+" on#eta vs on#phi online";
1083  onEtavsonPhiOn = dbe->book2D(histoname.c_str(),
1084  title.c_str(),
1085  nBins2D,-histEtaMax,histEtaMax,
1086  nBins2D,-TMath::Pi(), TMath::Pi());
1087 
1088  histoname = labelname+"_offEtaoffPhiOff";
1089  title = labelname+" off#eta vs off#phi offline";
1090  offEtavsoffPhiOff = dbe->book2D(histoname.c_str(),
1091  title.c_str(),
1092  nBins2D,-histEtaMax,histEtaMax,
1093  nBins2D,-TMath::Pi(), TMath::Pi());
1094 
1095  histoname = labelname+"_l1Etal1PhiL1";
1096  title = labelname+" l1#eta vs l1#phi L1";
1097  l1Etavsl1PhiL1 = dbe->book2D(histoname.c_str(),
1098  title.c_str(),
1099  nBins2D,-histEtaMax,histEtaMax,
1100  nBins2D,-TMath::Pi(), TMath::Pi());
1101 
1102  histoname = labelname+"_l1EtL1On";
1103  title = labelname+" l1E_t L1+online";
1104  l1EtL1On = dbe->book1D(histoname.c_str(),
1105  title.c_str(),nBins_,
1106  v->getPtMin(),
1107  v->getPtMax());
1108 
1109  histoname = labelname+"_offEtL1Off";
1110  title = labelname+" offE_t L1+offline";
1111  offEtL1Off = dbe->book1D(histoname.c_str(),
1112  title.c_str(),nBins_,
1113  v->getPtMin(),
1114  v->getPtMax());
1115 
1116  histoname = labelname+"_offEtOnOff";
1117  title = labelname+" offE_t online+offline";
1118  offEtOnOff = dbe->book1D(histoname.c_str(),
1119  title.c_str(),nBins_,
1120  v->getPtMin(),
1121  v->getPtMax());
1122 
1123  histoname = labelname+"_mcEtL1Mc";
1124  title = labelname+" mcE_t L1+MC truth";
1125  mcEtL1Mc = dbe->book1D(histoname.c_str(),
1126  title.c_str(),nBins_,
1127  v->getPtMin(),
1128  v->getPtMax());
1129 
1130  histoname = labelname+"_mcEtOffMc";
1131  title = labelname+" mcE_t Off+MC truth";
1132  mcEtOffMc = dbe->book1D(histoname.c_str(),
1133  title.c_str(),nBins_,
1134  v->getPtMin(),
1135  v->getPtMax());
1136 
1137  histoname = labelname+"_mcEtOnMc";
1138  title = labelname+" mcE_t online+MC truth";
1139  mcEtOnMc = dbe->book1D(histoname.c_str(),
1140  title.c_str(),nBins_,
1141  v->getPtMin(),
1142  v->getPtMax());
1143 
1144  histoname = labelname+"_l1Etal1PhiL1On";
1145  title = labelname+" l1#eta vs l1#phi L1+online";
1146  l1Etavsl1PhiL1On = dbe->book2D(histoname.c_str(),
1147  title.c_str(),
1148  nBins2D,-histEtaMax,histEtaMax,
1149  nBins2D,-TMath::Pi(), TMath::Pi());
1150 
1151  histoname = labelname+"_offEtaoffPhiL1Off";
1152  title = labelname+" off#eta vs off#phi L1+offline";
1153  offEtavsoffPhiL1Off = dbe->book2D(histoname.c_str(),
1154  title.c_str(),
1155  nBins2D,-histEtaMax,histEtaMax,
1156  nBins2D,-TMath::Pi(), TMath::Pi());
1157 
1158  histoname = labelname+"_offEtaoffPhiOnOff";
1159  title = labelname+" off#eta vs off#phi online+offline";
1160  offEtavsoffPhiOnOff = dbe->book2D(histoname.c_str(),
1161  title.c_str(),
1162  nBins2D,-histEtaMax,histEtaMax,
1163  nBins2D,-TMath::Pi(), TMath::Pi());
1164 
1165  histoname = labelname+"_mcEtamcPhiL1Mc";
1166  title = labelname+" mc#eta vs mc#phi L1+MC truth";
1167  mcEtavsmcPhiL1Mc = dbe->book2D(histoname.c_str(),
1168  title.c_str(),
1169  nBins2D,-histEtaMax,histEtaMax,
1170  nBins2D,-TMath::Pi(), TMath::Pi());
1171 
1172  histoname = labelname+"_mcEtamcPhiOffMc";
1173  title = labelname+" mc#eta vs mc#phi Off+MC truth";
1174  mcEtavsmcPhiOffMc = dbe->book2D(histoname.c_str(),
1175  title.c_str(),
1176  nBins2D,-histEtaMax,histEtaMax,
1177  nBins2D,-TMath::Pi(), TMath::Pi());
1178 
1179 
1180  histoname = labelname+"_mcEtamcPhiOnMc";
1181  title = labelname+" mc#eta vs mc#phi online+MC truth";
1182  mcEtavsmcPhiOnMc = dbe->book2D(histoname.c_str(),
1183  title.c_str(),
1184  nBins2D,-histEtaMax,histEtaMax,
1185  nBins2D,-TMath::Pi(), TMath::Pi());
1186 
1187  histoname = labelname+"_l1EtL1OnUM";
1188  title = labelname+" l1E_t L1+onlineUM";
1189  l1EtL1OnUM = dbe->book1D(histoname.c_str(),
1190  title.c_str(),nBins_,
1191  v->getPtMin(),
1192  v->getPtMax());
1193 
1194  histoname = labelname+"_offEtL1OffUM";
1195  title = labelname+" offE_t L1+offlineUM";
1196  offEtL1OffUM = dbe->book1D(histoname.c_str(),
1197  title.c_str(),nBins_,
1198  v->getPtMin(),
1199  v->getPtMax());
1200 
1201  histoname = labelname+"_offEtOnOffUM";
1202  title = labelname+" offE_t online+offlineUM";
1203  offEtOnOffUM = dbe->book1D(histoname.c_str(),
1204  title.c_str(),nBins_,
1205  v->getPtMin(),
1206  v->getPtMax());
1207 
1208  histoname = labelname+"_mcEtL1McUM";
1209  title = labelname+" mcE_t L1+MC truthUM";
1210  mcEtL1McUM = dbe->book1D(histoname.c_str(),
1211  title.c_str(),nBins_,
1212  v->getPtMin(),
1213  v->getPtMax());
1214 
1215  histoname = labelname+"_mcEtOffMcUM";
1216  title = labelname+" mcE_t Off+MC truthUM";
1217  mcEtOffMcUM = dbe->book1D(histoname.c_str(),
1218  title.c_str(),nBins_,
1219  v->getPtMin(),
1220  v->getPtMax());
1221 
1222  histoname = labelname+"_mcEtOnMcUM";
1223  title = labelname+" mcE_t online+MC truthUM";
1224  mcEtOnMcUM = dbe->book1D(histoname.c_str(),
1225  title.c_str(),nBins_,
1226  v->getPtMin(),
1227  v->getPtMax());
1228 
1229  histoname = labelname+"_l1Etal1PhiL1OnUM";
1230  title = labelname+" l1#eta vs l1#phi L1+onlineUM";
1231  l1Etavsl1PhiL1OnUM = dbe->book2D(histoname.c_str(),
1232  title.c_str(),
1233  nBins2D,-histEtaMax,histEtaMax,
1234  nBins2D,-TMath::Pi(), TMath::Pi());
1235 
1236  histoname = labelname+"_offEtaoffPhiL1OffUM";
1237  title = labelname+" off#eta vs off#phi L1+offlineUM";
1238  offEtavsoffPhiL1OffUM = dbe->book2D(histoname.c_str(),
1239  title.c_str(),
1240  nBins2D,-histEtaMax,histEtaMax,
1241  nBins2D,-TMath::Pi(), TMath::Pi());
1242 
1243  histoname = labelname+"_offEtaoffPhiOnOffUM";
1244  title = labelname+" off#eta vs off#phi online+offlineUM";
1245  offEtavsoffPhiOnOffUM = dbe->book2D(histoname.c_str(),
1246  title.c_str(),
1247  nBins2D,-histEtaMax,histEtaMax,
1248  nBins2D,-TMath::Pi(), TMath::Pi());
1249 
1250  histoname = labelname+"_mcEtamcPhiL1McUM";
1251  title = labelname+" mc#eta vs mc#phi L1+MC truthUM";
1252  mcEtavsmcPhiL1McUM = dbe->book2D(histoname.c_str(),
1253  title.c_str(),
1254  nBins2D,-histEtaMax,histEtaMax,
1255  nBins2D,-TMath::Pi(), TMath::Pi());
1256 
1257  histoname = labelname+"_mcEtamcPhiOffMcUM";
1258  title = labelname+" mc#eta vs mc#phi Off+MC truthUM";
1259  mcEtavsmcPhiOffMcUM = dbe->book2D(histoname.c_str(),
1260  title.c_str(),
1261  nBins2D,-histEtaMax,histEtaMax,
1262  nBins2D,-TMath::Pi(), TMath::Pi());
1263 
1264  histoname = labelname+"_mcEtamcPhiOnMcUM";
1265  title = labelname+" mc#eta vs mc#phi online+MC truthUM";
1266  mcEtavsmcPhiOnMcUM = dbe->book2D(histoname.c_str(),
1267  title.c_str(),
1268  nBins2D,-histEtaMax,histEtaMax,
1269  nBins2D,-TMath::Pi(), TMath::Pi());
1270 
1271  histoname = labelname+"_l1DRL1On";
1272  title = labelname+" l1DR L1+online";
1273  l1DRL1On = dbe->book1D(histoname.c_str(),
1274  title.c_str(),nBins_, 0, 1.);
1275 
1276  histoname = labelname+"_offDRL1Off";
1277  title = labelname+" offDR L1+offline";
1278  offDRL1Off = dbe->book1D(histoname.c_str(),
1279  title.c_str(),nBins_, 0, 1.);
1280 
1281  histoname = labelname+"_offDROnOff";
1282  title = labelname+" offDR online+offline";
1283  offDROnOff = dbe->book1D(histoname.c_str(),
1284  title.c_str(),nBins_, 0, 1.);
1285 
1286  histoname = labelname+"_mcDRL1Mc";
1287  title = labelname+" mcDR L1+MC truth";
1288  mcDRL1Mc = dbe->book1D(histoname.c_str(),
1289  title.c_str(),nBins_, 0, 1.);
1290 
1291  histoname = labelname+"_mcDROffMc";
1292  title = labelname+" mcDR Off+MC truth";
1293  mcDROffMc = dbe->book1D(histoname.c_str(),
1294  title.c_str(),nBins_, 0, 1.);
1295 
1296  histoname = labelname+"_mcDROnMc";
1297  title = labelname+" mcDR online+MC truth";
1298  mcDROnMc = dbe->book1D(histoname.c_str(),
1299  title.c_str(),nBins_, 0, 1.);
1300 
1301 
1302  v->setHistos( NMc, mcEtMc, mcEtavsmcPhiMc, NOn, onEtOn, onEtavsonPhiOn, NOff, offEtOff, offEtavsoffPhiOff, NL1, l1EtL1, l1Etavsl1PhiL1, NL1On, l1EtL1On, l1Etavsl1PhiL1On, NL1Off, offEtL1Off, offEtavsoffPhiL1Off, NOnOff, offEtOnOff, offEtavsoffPhiOnOff, NL1Mc, mcEtL1Mc, mcEtavsmcPhiL1Mc, NOffMc, mcEtOffMc, mcEtavsmcPhiOffMc, NOnMc, mcEtOnMc, mcEtavsmcPhiOnMc, NL1OnUM, l1EtL1OnUM, l1Etavsl1PhiL1OnUM, NL1OffUM, offEtL1OffUM, offEtavsoffPhiL1OffUM, NOnOffUM, offEtOnOffUM, offEtavsoffPhiOnOffUM, NL1McUM, mcEtL1McUM, mcEtavsmcPhiL1McUM, NOffMcUM, mcEtOffMcUM, mcEtavsmcPhiOffMcUM, NOnMcUM, mcEtOnMcUM, mcEtavsmcPhiOnMcUM, mcDRL1Mc, mcDROnMc, mcDROffMc, offDRL1Off, offDROnOff, l1DRL1On
1303 );
1304 
1305 
1306  }
1307  }
1308  return;
1309 
1310 
1311 
1312 }
1313 
1316 {
1317  LogDebug("FourVectorHLTriggerOffline") << "endRun, run " << run.id();
1318 }
1319 
1322 {
1323 
1324  LogDebug("FourVectorHLTriggerOffline") << "cleanDRMatchSet(mmset& tempSet) " << std::endl;
1325  LogDebug("FourVectorHLTriggerOffline") << "size of the set (before CLEANED)= " << tempSet.size() << " maps." << std::endl;
1326 
1327  if(tempSet.size() < 2) return;
1328 
1329  bool cleanedOneMap = false;
1330 
1331  // cleaning needed if the set has at least two maps
1332 
1333  while(! cleanedOneMap && tempSet.size() > 1) {
1334 
1335  cleanedOneMap=false;
1336 
1337  //LogTrace("FourVectorHLTriggerOffline") << "cleaning: size of the set = " << tempSet.size() << " maps." << std::endl;
1338 
1339  int imap = 0;
1340  for ( mmset::iterator setIter_i = tempSet.begin( ); setIter_i != tempSet.end( ); setIter_i++ )
1341  {
1342 
1343  fimmap tempMap_j = *setIter_i;
1344 
1345  //LogTrace("FourVectorHLTriggerOffline") << " map " << imap << std::endl;
1346  //LogTrace("FourVectorHLTriggerOffline") << " --------" << std::endl;
1347  for (fimmap::iterator it = tempMap_j.begin(); it != tempMap_j.end(); ++it)
1348  {
1349 
1350  //LogTrace("FourVectorHLTriggerOffline") << " " << (*it).first << " : " << (*it).second << std::endl;
1351 
1352  }
1353 
1354  imap++;
1355 
1356  }
1357 
1358  // loop i
1359  for ( mmset::iterator setIter_i = tempSet.begin( ); setIter_i != tempSet.end( ); setIter_i++ )
1360  {
1361 
1362  fimmap tempMap_i = *setIter_i;
1363  fimmap::iterator it = tempMap_i.begin();
1364  int topValue = (*it).second;
1365  //LogTrace("FourVectorHLTriggerOffline") << " topValue = " << topValue << std::endl;
1366 
1367 
1368  mmset::iterator tempIter_i = setIter_i;
1369 
1370  // from all the other maps, clean entries that have mapped value "topValue"
1371  // loop j
1372  for ( mmset::iterator setIter_j = ++tempIter_i; setIter_j != tempSet.end( ); )
1373  {
1374 
1375  fimmap tempMap_j = *setIter_j;
1376  //LogTrace("FourVectorHLTriggerOffline") << " size of the map = " << tempMap_j.size() << std::endl;
1377 
1378  for (fimmap::iterator it = tempMap_j.begin(); it != tempMap_j.end(); )
1379  {
1380 
1381  if(topValue == (*it).second)
1382  {
1383 
1384  //LogTrace("FourVectorHLTriggerOffline") << " Ridding map of a doubly-matched object." << std::endl;
1385  tempMap_j.erase(it++);
1386 
1387  cleanedOneMap = true;
1388 
1389  }
1390  else ++it;
1391 
1392  } //end for
1393 
1394  if(cleanedOneMap)
1395  {
1396 
1397  //remove the old map from the set
1398  tempSet.erase(setIter_j++);
1399 
1400  // insert in the set the new map if it is not an empty map
1401  if(! tempMap_j.empty()) tempSet.insert(tempMap_j);
1402 
1403  break; // break from loop j
1404 
1405  } // end if
1406  else ++setIter_j;
1407 
1408  }// end loop j
1409 
1410  if(cleanedOneMap) break; // break from loop i
1411 
1412  } // end loop i
1413 
1414  if(cleanedOneMap)
1415  {
1416 
1417  // continue cleaning (in while loop)
1418  // but reset flag first
1419  cleanedOneMap=false;
1420  continue;
1421 
1422  }
1423  else {
1424 
1425  // finished cleaing (break from while loop)
1426  break;
1427 
1428  }
1429 
1430 } // end while
1431 
1432  //LogTrace("FourVectorHLTriggerOffline") << "cleaned: size of the set = " << tempSet.size() << " maps." << std::endl;
1433  int jmap = 0;
1434 
1435  for ( mmset::iterator setIter_i = tempSet.begin( ); setIter_i != tempSet.end( ); setIter_i++ )
1436  {
1437 
1438  fimmap tempMap_j = *setIter_i;
1439 
1440  //LogTrace("FourVectorHLTriggerOffline") << " map " << jmap << std::endl;
1441  //LogTrace("FourVectorHLTriggerOffline") << " --------" << std::endl;
1442 
1443  for (fimmap::iterator it = tempMap_j.begin(); it != tempMap_j.end(); ++it)
1444  {
1445 
1446  //LogTrace("FourVectorHLTriggerOffline") << " " << (*it).first << " : " << (*it).second << std::endl;
1447 
1448  }
1449 
1450  jmap++;
1451 
1452  } // end for
1453 
1454 
1455  return;
1456 }
1457 
#define LogDebug(id)
unsigned int size() const
number of trigger paths in trigger table
const double Pi
T getParameter(std::string const &) const
edm::EDGetTokenT< trigger::TriggerEvent > triggerSummary_token_
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const
Definition: Event.cc:199
RunID const & id() const
Definition: RunBase.h:41
const std::string moduleType(const std::string &module) const
C++ class name of module.
void endRun(const edm::Run &run, const edm::EventSetup &c)
EndRun.
FourVectorHLTriggerOffline(const edm::ParameterSet &)
const std::string & triggerName(unsigned int triggerIndex) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:446
enum start value shifted to 81 so as to avoid clashes with PDG codes
edm::EDGetTokenT< reco::GenParticleCollection > genParticles_token_
edm::EDGetTokenT< reco::CaloJetCollection > caloJetCollection_
edm::EDGetTokenT< reco::CaloTauCollection > caloRecoTauCollection_
edm::EDGetTokenT< trigger::TriggerEvent > triggerSummaryLabelFU_
edm::EDGetTokenT< reco::JetTagCollection > softMuonBJetTags_
std::multimap< float, int > fimmap
edm::EDGetTokenT< reco::TrackCollection > trackCollection_
const edm::ParameterSet & modulePSet(const std::string &module) const
ParameterSet of module.
virtual void analyze(const edm::Event &, const edm::EventSetup &)
edm::EDGetTokenT< reco::GsfElectronCollection > gsfElectronCollection_
edm::EDGetTokenT< reco::JetTagCollection > jetTagCollection_
std::set< fimmap, std::less< fimmap > > mmset
int iEvent
Definition: GenABIO.cc:230
edm::EDGetTokenT< edm::TriggerResults > triggerResultsLabelFU_
edm::EDGetTokenT< reco::GenMETCollection > genMetTrue_token_
void cleanDRMatchSet(mmset &tempSet)
Clean DR Match Set.
void setReco(edm::Handle< T > offColl)
int j
Definition: DBlmapReader.cc:9
static std::string const triggerResults
Definition: EdmProvDump.cc:41
void beginRun(const edm::Run &run, const edm::EventSetup &c)
int k[5][pyjets_maxn]
const std::vector< std::string > & moduleLabels(unsigned int trigger) const
label(s) of module(s) on a trigger path
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
Definition: TriggerObject.h:81
edm::EDGetTokenT< reco::MuonCollection > muonCollection_
std::vector< size_type > Keys
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor
edm::EDGetTokenT< reco::PhotonCollection > photonCollection_
std::string const & label() const
Definition: InputTag.h:42
edm::EDGetTokenT< reco::CaloMETCollection > caloMetCollection_
std::vector< std::pair< std::string, std::string > > custompathnamepairs_
edm::EDGetTokenT< reco::GenJetCollection > iterativeCone5GenJets_token_
std::string const & instance() const
Definition: InputTag.h:43
void setRecoB(edm::Handle< reco::JetTagCollection > offCollB)
std::vector< int > Vids
Definition: Run.h:41
edm::EDGetTokenT< edm::TriggerResults > triggerResults_token_