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