CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HLTObjectMonitor.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: DQM/HLTObjectMonitor
4 // Class: HLTObjectMonitor
5 //
13 //
14 // Original Author: Charles Nicholas Mueller
15 // Created: Sun, 22 Mar 2015 22:29:00 GMT
16 //
17 //
18 
19 
20 // system include files
21 #include <memory>
22 #include <sys/time.h>
23 #include <cstdlib>
24 
25 // user include files
31 
39 
41 
42 //for collections
52 
56 
57 #include "TMath.h"
58 #include "TStyle.h"
59 #include "TLorentzVector.h"
60 
61 #include <unordered_map>
62 //
63 // class declaration
64 //
65 
66 //using namespace edm;
67 using namespace trigger;
68 using std::vector;
69 using std::string;
70 using std::unordered_map;
71 
73  struct hltPlot
74  {
75 
77  string pathName;
78  string pathNameOR;
79  string moduleName;
80  string moduleNameOR;
81  int pathIndex = -99;
82  int pathIndexOR = -99;
83  string plotLabel;
84  string xAxisLabel;
85  int nBins;
86  double xMin;
87  double xMax;
89 
90  };
91 
92  public:
93  explicit HLTObjectMonitor(const edm::ParameterSet&);
95 
96  // static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
97 
98 
99  private:
100  void analyze(const edm::Event&, const edm::EventSetup&) override;
101  virtual void bookHistograms(DQMStore::IBooker &i, edm::Run const&, edm::EventSetup const&) override;
102  void dqmBeginRun(edm::Run const&, edm::EventSetup const&) override;
103  void endRun(edm::Run const&, edm::EventSetup const&) override;
104  vector<hltPlot*> plotList;
105  //virtual void beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override;
106  //virtual void endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override;
108  double get_wall_time(void);
109  // ----------member data ---------------------------
110 
115  string backupFolder;
116  unordered_map<string, bool> acceptMap;
117  unordered_map<hltPlot*, edm::ParameterSet*> plotMap;
118 
119  //set Token(-s)
129 
130  //declare params
168 
169  string processName_;
170 
208 
209 };
210 
211 //
212 // constants, enums and typedefs
213 //
214 
215 //
216 // static data member definitions
217 //
218 
219 //
220 // constructors and destructor
221 //
223 
224 {
225  //now do what ever initialization is needed
226  debugPrint = false;
227 
228  topDirectoryName = "HLT/ObjectMonitor";
229  mainShifterFolder = topDirectoryName+"/MainShifter";
230  backupFolder = topDirectoryName+"/Backup";
231 
232  //parse params
233  processName_ = iConfig.getParameter<string>("processName");
234 
235  rsq_pset = iConfig.getParameter<edm::ParameterSet> ("rsq");
236  plotMap[&rsq_] = &rsq_pset;
237  mr_pset = iConfig.getParameter<edm::ParameterSet> ("mr");
238  plotMap[&mr_] = &mr_pset;
239  alphaT_pset = iConfig.getParameter<edm::ParameterSet> ("alphaT");
240  plotMap[&alphaT_] = &alphaT_pset;
241  photonPt_pset = iConfig.getParameter<edm::ParameterSet>("photonPt");
242  plotMap[&photonPt_] = &photonPt_pset;
243  photonEta_pset = iConfig.getParameter<edm::ParameterSet>("photonEta");
244  plotMap[&photonEta_] = &photonEta_pset;
245  photonPhi_pset = iConfig.getParameter<edm::ParameterSet>("photonPhi");
246  plotMap[&photonPhi_] = &photonPhi_pset;
247  muonPt_pset = iConfig.getParameter<edm::ParameterSet>("muonPt");
248  plotMap[&muonPt_] = &muonPt_pset;
249  muonEta_pset = iConfig.getParameter<edm::ParameterSet>("muonEta");
250  plotMap[&muonEta_] = &muonEta_pset;
251  muonPhi_pset = iConfig.getParameter<edm::ParameterSet>("muonPhi");
252  plotMap[&muonPhi_] = &muonPhi_pset;
253  l2muonPt_pset = iConfig.getParameter<edm::ParameterSet>("l2muonPt");
254  plotMap[&l2muonPt_] = &l2muonPt_pset;
255  l2muonEta_pset = iConfig.getParameter<edm::ParameterSet>("l2muonEta");
256  plotMap[&l2muonEta_] = &l2muonEta_pset;
257  l2muonPhi_pset = iConfig.getParameter<edm::ParameterSet>("l2muonPhi");
258  plotMap[&l2muonPhi_] = &l2muonPhi_pset;
259  l2NoBPTXmuonPt_pset = iConfig.getParameter<edm::ParameterSet>("l2NoBPTXmuonPt");
260  plotMap[&l2NoBPTXmuonPt_] = &l2NoBPTXmuonPt_pset;
261  l2NoBPTXmuonEta_pset = iConfig.getParameter<edm::ParameterSet>("l2NoBPTXmuonEta");
262  plotMap[&l2NoBPTXmuonEta_] = &l2NoBPTXmuonEta_pset;
263  l2NoBPTXmuonPhi_pset = iConfig.getParameter<edm::ParameterSet>("l2NoBPTXmuonPhi");
264  plotMap[&l2NoBPTXmuonPhi_] = &l2NoBPTXmuonPhi_pset;
265  electronPt_pset = iConfig.getParameter<edm::ParameterSet>("electronPt");
266  plotMap[&electronPt_] = &electronPt_pset;
267  electronEta_pset = iConfig.getParameter<edm::ParameterSet>("electronEta");
268  plotMap[&electronEta_] = &electronEta_pset;
269  electronPhi_pset = iConfig.getParameter<edm::ParameterSet>("electronPhi");
270  plotMap[&electronPhi_] = &electronPhi_pset;
271  jetPt_pset = iConfig.getParameter<edm::ParameterSet>("jetPt");
272  plotMap[&jetPt_] = &jetPt_pset;
273  jetAK8Mass_pset = iConfig.getParameter<edm::ParameterSet>("jetAK8Mass");
274  plotMap[&jetAK8Mass_] = &jetAK8Mass_pset;
275  diMuonLowMass_pset = iConfig.getParameter<edm::ParameterSet>("diMuonLowMass");
276  plotMap[&diMuonLowMass_] = &diMuonLowMass_pset;
277  caloMetPt_pset = iConfig.getParameter<edm::ParameterSet>("caloMetPt");
278  plotMap[&caloMetPt_] = &caloMetPt_pset;
279  caloMetPhi_pset = iConfig.getParameter<edm::ParameterSet>("caloMetPhi");
280  plotMap[&caloMetPhi_] = &caloMetPhi_pset;
281  pfMetPt_pset = iConfig.getParameter<edm::ParameterSet>("pfMetPt");
282  plotMap[&pfMetPt_] = &pfMetPt_pset;
283  pfMetPhi_pset = iConfig.getParameter<edm::ParameterSet>("pfMetPhi");
284  plotMap[&pfMetPhi_] = &pfMetPhi_pset;
285  caloHtPt_pset = iConfig.getParameter<edm::ParameterSet>("caloHtPt");
286  plotMap[&caloHtPt_] = &caloHtPt_pset;
287  pfHtPt_pset = iConfig.getParameter<edm::ParameterSet>("pfHtPt");
288  plotMap[&pfHtPt_] = &pfHtPt_pset;
289  bJetPhi_pset = iConfig.getParameter<edm::ParameterSet>("bJetPhi");
290  plotMap[&bJetPhi_] = &bJetPhi_pset;
291  bJetEta_pset = iConfig.getParameter<edm::ParameterSet>("bJetEta");
292  plotMap[&bJetEta_] = &bJetEta_pset;
293  bJetCSVCalo_pset = iConfig.getParameter<edm::ParameterSet>("bJetCSVCalo");
294  plotMap[&bJetCSVCalo_] = &bJetCSVCalo_pset;
295  bJetCSVPF_pset = iConfig.getParameter<edm::ParameterSet>("bJetCSVPF");
296  plotMap[&bJetCSVPF_] = &bJetCSVPF_pset;
297  diMuonMass_pset = iConfig.getParameter<edm::ParameterSet>("diMuonMass");
298  plotMap[&diMuonMass_] = &diMuonMass_pset;
299  diElecMass_pset = iConfig.getParameter<edm::ParameterSet>("diElecMass");
300  plotMap[&diElecMass_] = &diElecMass_pset;
301  muonDxy_pset = iConfig.getParameter<edm::ParameterSet>("muonDxy");
302  plotMap[&muonDxy_] = &muonDxy_pset;
303  jetAK8Pt_pset = iConfig.getParameter<edm::ParameterSet>("jetAK8Pt");
304  plotMap[&jetAK8Pt_] = &jetAK8Pt_pset;
305  tauPt_pset = iConfig.getParameter<edm::ParameterSet>("tauPt");
306  plotMap[&tauPt_] = &tauPt_pset;
307  wallTime_pset = iConfig.getParameter<edm::ParameterSet>("wallTime");
308  plotMap[&wallTime_] = &wallTime_pset;
309 
310 
311  for (auto item = plotMap.begin(); item != plotMap.end(); item++)
312  {
313  (*item->first).pathName = (*item->second).getParameter<string>("pathName");
314  (*item->first).moduleName = (*item->second).getParameter<string>("moduleName");
315  (*item->first).nBins = (*item->second).getParameter<int>("NbinsX");
316  (*item->first).xMin = (*item->second).getParameter<double>("Xmin");
317  (*item->first).xMax = (*item->second).getParameter<double>("Xmax");
318  (*item->first).xAxisLabel = (*item->second).getParameter<string>("axisLabel");
319  (*item->first).plotLabel = (*item->second).getParameter<string>("plotLabel");
320  (*item->first).displayInPrimary = (*item->second).getParameter<bool>("mainWorkspace");
321 
322  if ((*item->second).exists("pathName_OR"))
323  {
324  (*item->first).pathNameOR = (*item->second).getParameter<string>("pathName_OR");
325  }
326  if ((*item->second).exists("moduleName_OR"))
327  {
328  (*item->first).moduleNameOR = (*item->second).getParameter<string>("moduleName_OR");
329  }
330 
331  plotList.push_back(item->first);
332  }
333  plotMap.clear();
334 
335  //set Token(s)
336  triggerResultsToken_ = consumes<edm::TriggerResults>(edm::InputTag("TriggerResults","", processName_));
337  aodTriggerToken_ = consumes<trigger::TriggerEvent>(edm::InputTag("hltTriggerSummaryAOD", "", processName_));
338  lumiScalersToken_ = consumes<LumiScalersCollection>(edm::InputTag("hltScalersRawToDigi","",""));
339  beamSpotToken_ = consumes<reco::BeamSpot>(edm::InputTag("hltOnlineBeamSpot","",processName_));
340  chargedCandToken_ = consumes<vector<reco::RecoChargedCandidate>>(edm::InputTag("hltL3NoFiltersNoVtxMuonCandidates","",processName_));
341  csvCaloTagsToken_ = consumes<reco::JetTagCollection>(edm::InputTag("hltCombinedSecondaryVertexBJetTagsCalo","",processName_));
342  csvPfTagsToken_ = consumes<reco::JetTagCollection>(edm::InputTag("hltCombinedSecondaryVertexBJetTagsPF","",processName_));
343  csvCaloJetsToken_ = consumes<vector<reco::CaloJet>>(edm::InputTag("hltSelector8CentralJetsL1FastJet","",processName_));
344  csvPfJetsToken_ = consumes<vector<reco::PFJet>>(edm::InputTag("hltPFJetForBtag","",processName_));
345 
346 }
347 
348 
350 {
351 
352  // do anything here that needs to be done at desctruction time
353  // (e.g. close files, deallocate resources etc.)
354 
355 }
356 
357 
358 //
359 // member functions
360 //
361 
362 // ------------ method called for each event ------------
363 void
365 {
366  double start = get_wall_time();
367 
368  using namespace edm;
369 
370  if (debugPrint) std::cout << "Inside analyze(). " << std::endl;
371 
372  // access trigger results
375  if (!triggerResults.isValid()) return;
376 
377  edm::Handle<trigger::TriggerEvent> aodTriggerEvent;
378  iEvent.getByToken(aodTriggerToken_, aodTriggerEvent);
379  if (!aodTriggerEvent.isValid()) return;
380 
381  //reset everything to not accepted at beginning of each event
382  unordered_map<string, bool> firedMap = acceptMap;
383  for (auto plot: plotList) //loop over paths
384  {
385  if (firedMap[plot->pathName]) continue;
386  bool triggerAccept = false;
387  const TriggerObjectCollection objects = aodTriggerEvent->getObjects();
388  edm::InputTag moduleFilter;
390  if(plot->pathIndex > 0 && triggerResults->accept(plot->pathIndex) && hltConfig_.saveTags(plot->moduleName))
391  {
392  moduleFilter = edm::InputTag(plot->moduleName,"",processName_);
393  pathName = plot->pathName;
394  triggerAccept = true;
395  }
396  else if(plot->pathIndexOR > 0 && triggerResults->accept(plot->pathIndexOR) && hltConfig_.saveTags(plot->moduleNameOR))
397  {
398  if (firedMap[plot->pathNameOR]) continue;
399  moduleFilter = edm::InputTag(plot->moduleNameOR,"",processName_);
400  pathName = plot->pathNameOR;
401  triggerAccept = true;
402  }
403 
404  if (triggerAccept)
405  {
406  unsigned int moduleFilterIndex = aodTriggerEvent->filterIndex(moduleFilter);
407 
408  if (moduleFilterIndex+1 > aodTriggerEvent->sizeFilters()) return;
409  const Keys &keys = aodTriggerEvent->filterKeys( moduleFilterIndex );
410 
416 
417  //PFHT pt
418  if (pathName == pfHtPt_.pathName)
419  {
420  for (const auto & key : keys) pfHtPt_.ME->Fill(objects[key].pt());
421  }
422 
423  //jet pt
424  else if (pathName == jetPt_.pathName)
425  {
426  for (const auto & key : keys) jetPt_.ME->Fill(objects[key].pt());
427  }
428 
429  //photon pt + eta + phi (all use same path)
430  else if (pathName == photonPt_.pathName)
431  {
432  for (const auto & key : keys)
433  {
434  photonPt_.ME->Fill(objects[key].pt());
435  photonEta_.ME->Fill(objects[key].eta());
436  photonPhi_.ME->Fill(objects[key].phi());
437  }
438  }
439 
440  //electron pt + eta + phi (all use same path)
441  else if (pathName == electronPt_.pathName)
442  {
443  for (const auto & key : keys)
444  {
445  electronPt_.ME->Fill(objects[key].pt());
446  electronEta_.ME->Fill(objects[key].eta());
447  electronPhi_.ME->Fill(objects[key].phi());
448  }
449  }
450 
451  //muon pt + eta + phi (all use same path)
452  else if (pathName == muonPt_.pathName)
453  {
454  for (const auto & key : keys)
455  {
456  muonPt_.ME->Fill(objects[key].pt());
457  muonEta_.ME->Fill(objects[key].eta());
458  muonPhi_.ME->Fill(objects[key].phi());
459  }
460  }
461 
462  //l2muon pt
463  else if (pathName == l2muonPt_.pathName)
464  {
465  for (const auto & key : keys)
466  {
467  l2muonPt_.ME->Fill(objects[key].pt());
468  l2muonEta_.ME->Fill(objects[key].eta());
469  l2muonPhi_.ME->Fill(objects[key].phi());
470  }
471  }
472 
473  //l2NoBPTXmuon pt
474  else if (pathName == l2NoBPTXmuonPt_.pathName)
475  {
476  for (const auto & key : keys)
477  {
478  l2NoBPTXmuonPt_.ME->Fill(objects[key].pt());
479  l2NoBPTXmuonEta_.ME->Fill(objects[key].eta());
480  l2NoBPTXmuonPhi_.ME->Fill(objects[key].phi());
481  }
482  }
483 
484  //Razor
485  else if (pathName == mr_.pathName)
486  {
487  double onlineMR = 0, onlineRsq = 0;
488  for (const auto & key : keys)
489  {
490  if(objects[key].id() == 0){ //the MET object containing MR and Rsq will show up with ID = 0
491  onlineMR = objects[key].px(); //razor variables stored in dummy reco::MET objects
492  onlineRsq = objects[key].py();
493  }
494  mr_.ME->Fill(onlineMR);
495  rsq_.ME->Fill(onlineRsq);
496  }
497  }
498 
499  //alphaT
500  else if (pathName == alphaT_.pathName)
501  {
502  std::vector<ROOT::Math::LorentzVector<ROOT::Math::PtEtaPhiM4D<double>>> alphaT_jets;
503  for (const auto & key : keys)
504  {
505  ROOT::Math::LorentzVector<ROOT::Math::PtEtaPhiM4D<double>> JetLVec(objects[key].pt(),objects[key].eta(),objects[key].phi(),objects[key].mass());
506  alphaT_jets.push_back(JetLVec);
507  }
508 
509  float alphaT = AlphaT(alphaT_jets,false).value();
510  alphaT_.ME->Fill(alphaT);
511  }
512 
513  //tau pt
514  else if (pathName == tauPt_.pathName)
515  {
516  for (const auto & key : keys) tauPt_.ME->Fill(objects[key].pt());
517  }
518 
519  //caloMET pt+phi
520  else if (pathName == caloMetPt_.pathName)
521  {
522  for (const auto & key : keys)
523  {
524  caloMetPt_.ME->Fill(objects[key].pt());
525  caloMetPhi_.ME->Fill(objects[key].phi());
526  }
527  }
528 
529  //caloHT pt
530  else if (pathName == caloHtPt_.pathName)
531  {
532  for (const auto & key : keys)
533  {
534  if(objects[key].id()==89) caloHtPt_.ME->Fill(objects[key].pt());
535  }
536  }
537 
538  //jetAK8 pt + mass
539  else if (pathName == jetAK8Pt_.pathName)
540  {
541  for (const auto & key : keys)
542  {
543  jetAK8Pt_.ME->Fill(objects[key].pt());
544  jetAK8Mass_.ME->Fill(objects[key].mass());
545  }
546  }
547 
548  //PFMET pt + phi
549  else if (pathName == pfMetPt_.pathName)
550  {
551  for (const auto & key : keys)
552  {
553  pfMetPt_.ME->Fill(objects[key].pt());
554  pfMetPhi_.ME->Fill(objects[key].phi());
555  }
556  }
557 
558  // bjet eta + phi
559  else if (pathName == bJetEta_.pathName || pathName == bJetEta_.pathNameOR)
560  {
561  for (const auto & key : keys)
562  {
563  bJetEta_.ME->Fill(objects[key].eta());
564  bJetPhi_.ME->Fill(objects[key].phi());
565  }
566  }
567 
568  //b-tagging CSV information
569  if (pathName == bJetCSVPF_.pathName)
570  {
572  iEvent.getByToken(csvPfTagsToken_, csvPfTags);
574  iEvent.getByToken(csvPfJetsToken_, csvPfJets);
575 
576  if (csvPfTags.isValid() && csvPfJets.isValid())
577  {
578  for (auto iter = csvPfTags->begin(); iter != csvPfTags->end(); iter++) bJetCSVPF_.ME->Fill(iter->second);
579  }
580  }
581  if (pathName == bJetCSVCalo_.pathName)
582  {
584  iEvent.getByToken(csvCaloTagsToken_, csvCaloTags);
586  iEvent.getByToken(csvCaloJetsToken_, csvCaloJets);
587 
588  if (csvCaloTags.isValid() && csvCaloJets.isValid())
589  {
590  for (auto iter = csvCaloTags->begin(); iter != csvCaloTags->end(); iter++) bJetCSVCalo_.ME->Fill(iter->second);
591  }
592  }
593 
594  //muon dxy(use an unique path)
595  else if (pathName == muonDxy_.pathName)
596  {
598  iEvent.getByToken(chargedCandToken_, recoChargedCands);
599  edm::Handle<reco::BeamSpot> recoBeamSpot;
600  iEvent.getByToken(beamSpotToken_, recoBeamSpot);
601  double muon_dxy;
602 
603  if (recoChargedCands.isValid() && recoBeamSpot.isValid())
604  {
605  for (const auto & key : keys)
606  {
607  muon_dxy = dxyFinder(objects[key].eta(), objects[key].phi(), recoChargedCands, recoBeamSpot);
608  if (muon_dxy != -99.) muonDxy_.ME->Fill(muon_dxy);
609  }
610  }
611  }
612 
613  // ////////////////////////////////
614  // ///
615  // /// double-object plots
616  // ///
617  // ////////////////////////////////
618 
619  //double muon low mass
620  else if (pathName == diMuonLowMass_.pathName)
621  {
622  const double mu_mass(.105658);
623  unsigned int kCnt0 = 0;
624  for (const auto & key0: keys)
625  {
626  unsigned int kCnt1 = 0;
627  for (const auto & key1: keys)
628  {
629  if (key0 != key1 && kCnt1 > kCnt0) // avoid filling hists with same objs && avoid double counting separate objs
630  {
631  if (abs(objects[key0].id()) == 13 && (objects[key0].id()+objects[key1].id()==0)) // check muon id and dimuon charge
632  {
633  TLorentzVector mu1, mu2, dimu;
634  mu1.SetPtEtaPhiM(objects[key0].pt(), objects[key0].eta(), objects[key0].phi(), mu_mass);
635  mu2.SetPtEtaPhiM(objects[key1].pt(), objects[key1].eta(), objects[key1].phi(), mu_mass);
636  dimu = mu1+mu2;
637  diMuonLowMass_.ME->Fill(dimu.M());
638  }
639  }
640  kCnt1 +=1;
641  }
642  kCnt0 +=1;
643  }
644  } //end double object plot
645 
646  else if (pathName == diMuonMass_.pathName || pathName == diMuonMass_.pathNameOR)
647  {
648  const double mu_mass(.105658);
649  unsigned int kCnt0 = 0;
650  for (const auto & key0: keys)
651  {
652  unsigned int kCnt1 = 0;
653  for (const auto & key1: keys)
654  {
655  if (key0 != key1 && kCnt1 > kCnt0) // avoid filling hists with same objs && avoid double counting separate objs
656  {
657  if (abs(objects[key0].id()) == 13 && (objects[key0].id()+objects[key1].id()==0)) // check muon id and dimuon charge
658  {
659  TLorentzVector mu1, mu2, dimu;
660  mu1.SetPtEtaPhiM(objects[key0].pt(), objects[key0].eta(), objects[key0].phi(), mu_mass);
661  mu2.SetPtEtaPhiM(objects[key1].pt(), objects[key1].eta(), objects[key1].phi(), mu_mass);
662  dimu = mu1+mu2;
663  diMuonMass_.ME->Fill(dimu.M());
664  }
665  }
666  kCnt1 +=1;
667  }
668  kCnt0 +=1;
669  }
670  }
671 
672  else if (pathName == diElecMass_.pathName)
673  {
674  unsigned int kCnt0 = 0;
675  for (const auto & key0: keys)
676  {
677  unsigned int kCnt1 = 0;
678  for (const auto & key1: keys)
679  {
680  if (key0 != key1 && kCnt1 > kCnt0) // avoid filling hists with same objs && avoid double counting separate objs
681  {
682  // if (abs(objects[key0].id()) == 11 && (objects[key0].id()+objects[key1].id()==0)) // id is not filled for electrons
683  // {
684  TLorentzVector el1, el2, diEl;
685  el1.SetPtEtaPhiM(objects[key0].pt(), objects[key0].eta(), objects[key0].phi(), 0);
686  el2.SetPtEtaPhiM(objects[key1].pt(), objects[key1].eta(), objects[key1].phi(), 0);
687  diEl = el1+el2;
688  diElecMass_.ME->Fill(diEl.M());
689  // }
690  }
691  kCnt1 +=1;
692  }
693  kCnt0 +=1;
694  }
695  } //end double object plot
696 
697  firedMap[pathName] = true;
698  } //end if trigger accept
699  } //end loop over plots/paths
700 
701  // sleep(1); //sleep for 1s, used to calibrate timing
702  double end = get_wall_time();
703  double wallTime = end - start;
704  wallTime_.ME->Fill(wallTime);
705 }
706 
707 // ------------ method called when starting to processes a run ------------
708 void
710 {
711  if (debugPrint) std::cout << "Calling beginRun. " << std::endl;
712  bool changed = true;
713  if (hltConfig_.init(iRun, iSetup, processName_, changed))
714  {
715  if (debugPrint) std::cout << "Extracting HLTconfig. " << std::endl;
716  }
717 
718  //get path indicies from menu
719  string pathName_noVersion;
720  vector<string> triggerPaths = hltConfig_.triggerNames();
721 
722  for (const auto & pathName : triggerPaths)
723  {
724  pathName_noVersion = hltConfig_.removeVersion(pathName);
725  for (auto plot : plotList)
726  {
727  if (plot->pathName == pathName_noVersion)
728  {
729  (*plot).pathIndex = hltConfig_.triggerIndex(pathName);
730  }
731  else if (plot->pathNameOR == pathName_noVersion)
732  {
733  (*plot).pathIndexOR = hltConfig_.triggerIndex(pathName);
734  }
735  }
736  }
737  vector<hltPlot*> plotList_temp;
738  for (auto plot : plotList)
739  {
740  if (plot->pathIndex > 0 || plot->pathIndexOR > 0)
741  {
742  plotList_temp.push_back(plot);
743  acceptMap[plot->pathName] = false;
744  if (plot->pathIndexOR > 0) acceptMap[plot->pathNameOR] = false;
745  }
746  }
747  //now re-assign plotList to contain only the plots with paths in the menu.
748  plotList = plotList_temp;
749  plotList_temp.clear();
750 
751 }
752 
753 // ------------ method called when ending the processing of a run ------------
754 
755 void
757 {
758  if (debugPrint) std::cout << "Calling endRun. " << std::endl;
759 }
760 
762 {
763 
769 
770  //book wall time separately
771  ibooker.setCurrentFolder(mainShifterFolder);
772  wallTime_.ME = ibooker.book1D(wallTime_.plotLabel,wallTime_.pathName,wallTime_.nBins,wallTime_.xMin,wallTime_.xMax);
773  wallTime_.ME->setAxisTitle(wallTime_.xAxisLabel);
774 
775  for (auto plot : plotList)
776  {
777  std::string display_pathNames = plot->pathName;
778  if (!plot->pathNameOR.empty()) display_pathNames = plot->pathName + " OR " + plot->pathNameOR;
779 
780  if (plot->displayInPrimary)
781  {
782  ibooker.setCurrentFolder(mainShifterFolder);
783  (*plot).ME = ibooker.book1D(plot->plotLabel,display_pathNames.c_str(),plot->nBins,plot->xMin,plot->xMax);
784  (*plot).ME->setAxisTitle(plot->xAxisLabel);
785  //need to add OR statement
786  }
787  else
788  {
789  ibooker.setCurrentFolder(backupFolder);
790  (*plot).ME = ibooker.book1D(plot->plotLabel,display_pathNames.c_str(),plot->nBins,plot->xMin,plot->xMax);
791  (*plot).ME->setAxisTitle(plot->xAxisLabel);
792  }
793  }
794 
795 }
796 
798 {
799  double dxy = -99.;
800  for (reco::RecoChargedCandidateCollection::const_iterator l3Muon = recoChargedCands->begin(); l3Muon != recoChargedCands->end(); l3Muon++)
801  {
802  if (deltaR(eta,phi,l3Muon->eta(),l3Muon->phi()) < 0.1)
803  {
804  dxy = (-(l3Muon->vx()-recoBeamSpot->x0()) * l3Muon->py() + (l3Muon->vy()-recoBeamSpot->y0()) * l3Muon->px())/l3Muon->pt();
805  break;
806  }
807  }
808  return dxy;
809 }
810 
812 {
813  struct timeval time;
814  if (gettimeofday(&time,NULL)) return 0;
815  return (double)time.tv_sec + (double)time.tv_usec * .000001;
816 }
817 
818 // ------------ method called when starting to processes a luminosity block ------------
819 /*
820 void
821 HLTObjectMonitor::beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&)
822 {
823 }
824 */
825 
826 // ------------ method called when ending the processing of a luminosity block ------------
827 /*
828 void
829 HLTObjectMonitor::endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&)
830 {
831 }
832 */
833 
834 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
835 // void
836 // HLTObjectMonitor::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
837 // //The following says we do not know what parameters are allowed so do no validation
838 // // Please change this to state exactly what you do use, even if it is no parameters
839 // edm::ParameterSetDescription desc;
840 // desc.setUnknown();
841 // descriptions.addDefault(desc);
842 // }
843 
844 //define this as a plug-in
edm::ParameterSet caloMetPt_pset
T getParameter(std::string const &) const
edm::ParameterSet bJetPhi_pset
int i
Definition: DBlmapReader.cc:9
edm::ParameterSet bJetCSVCalo_pset
tuple start
Check for commandline option errors.
Definition: dqm_diff.py:58
edm::ParameterSet caloHtPt_pset
void dqmBeginRun(edm::Run const &, edm::EventSetup const &) override
edm::ParameterSet jetAK8Mass_pset
edm::ParameterSet pfMetPhi_pset
edm::ParameterSet muonPhi_pset
void analyze(const edm::Event &, const edm::EventSetup &) override
edm::ParameterSet l2muonEta_pset
edm::ParameterSet photonPhi_pset
edm::ParameterSet electronPt_pset
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
edm::ParameterSet bJetCSVPF_pset
edm::ParameterSet muonEta_pset
edm::ParameterSet diMuonMass_pset
void endRun(edm::Run const &, edm::EventSetup const &) override
edm::ParameterSet muonDxy_pset
edm::EDGetTokenT< LumiScalersCollection > lumiScalersToken_
#define NULL
Definition: scimark2.h:8
edm::ParameterSet l2NoBPTXmuonEta_pset
edm::EDGetTokenT< edm::TriggerResults > triggerResultsToken_
void bookHistograms(fwlite::EventContainer &eventCont)
edm::ParameterSet l2muonPt_pset
edm::EDGetTokenT< vector< reco::PFJet > > csvPfJetsToken_
triggerResultsToken_(consumes< edm::TriggerResults >(edm::InputTag("TriggerResults")))
HLTObjectMonitor(const edm::ParameterSet &)
edm::ParameterSet wallTime_pset
edm::ParameterSet diElecMass_pset
int iEvent
Definition: GenABIO.cc:230
std::string moduleName(Provenance const &provenance)
Definition: Provenance.cc:27
edm::ParameterSet photonPt_pset
edm::EDGetTokenT< trigger::TriggerEvent > aodTriggerToken_
edm::ParameterSet electronEta_pset
edm::ParameterSet bJetEta_pset
edm::ParameterSet alphaT_pset
edm::EDGetTokenT< reco::RecoChargedCandidateCollection > chargedCandToken_
edm::ParameterSet tauPt_pset
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
unordered_map< hltPlot *, edm::ParameterSet * > plotMap
edm::ParameterSet rsq_pset
#define end
Definition: vmac.h:37
edm::ParameterSet mr_pset
static std::string const triggerResults
Definition: EdmProvDump.cc:41
edm::ParameterSet pfHtPt_pset
bool isValid() const
Definition: HandleBase.h:75
string key
FastSim: produces sample of signal events, overlayed with premixed minbias events.
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken_
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
Definition: TriggerObject.h:81
edm::ParameterSet jetPt_pset
HLTConfigProvider hltConfig_
edm::ParameterSet diMuonLowMass_pset
edm::ParameterSet jetAK8Pt_pset
edm::ParameterSet l2muonPhi_pset
edm::ParameterSet muonPt_pset
double dxyFinder(double, double, edm::Handle< reco::RecoChargedCandidateCollection >, edm::Handle< reco::BeamSpot >)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:276
edm::ParameterSet pfMetPt_pset
edm::ParameterSet electronPhi_pset
std::vector< size_type > Keys
edm::EDGetTokenT< reco::JetTagCollection > csvCaloTagsToken_
edm::EDGetTokenT< reco::JetTagCollection > csvPfTagsToken_
edm::ParameterSet photonEta_pset
Geom::Phi< T > phi() const
edm::ParameterSet l2NoBPTXmuonPhi_pset
double get_wall_time(void)
if(dp >Float(M_PI)) dp-
tuple cout
Definition: gather_cfg.py:145
edm::EDGetTokenT< vector< reco::CaloJet > > csvCaloJetsToken_
edm::ParameterSet caloMetPhi_pset
vector< hltPlot * > plotList
static std::string const triggerPaths
Definition: EdmProvDump.cc:42
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
edm::ParameterSet l2NoBPTXmuonPt_pset
Definition: Run.h:43
virtual void bookHistograms(DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override
unordered_map< string, bool > acceptMap