CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
HeavyFlavorValidation Class Reference

#include <HLTriggerOfflineHeavyFlavor/src/HeavyFlavorValidation.cc>

Inheritance diagram for HeavyFlavorValidation:

Public Member Functions

 HeavyFlavorValidation (const edm::ParameterSet &)
 
 ~HeavyFlavorValidation () override
 

Protected Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
void dqmBeginRun (const edm::Run &, const edm::EventSetup &) override
 

Private Member Functions

int getFilterLevel (const std::string &moduleName, const HLTConfigProvider &hltConfig)
 
int getMotherId (const Candidate *p)
 
void match (MonitorElement *me, vector< LeafCandidate > &from, vector< LeafCandidate > &to, double deltaRMatchingCut, vector< int > &map)
 
void myBook1D (DQMStore::IBooker &ibooker, TString name, vector< double > &xBins, TString label, TString title)
 
void myBook1D (DQMStore::IBooker &ibooker, TString name, vector< double > &xBins, TString label)
 
void myBook2D (DQMStore::IBooker &ibooker, TString name, vector< double > &xBins, TString xLabel, vector< double > &yBins, TString yLabel, TString title)
 
void myBook2D (DQMStore::IBooker &ibooker, TString name, vector< double > &xBins, TString xLabel, vector< double > &yBins, TString yLabel)
 
void myBookProfile2D (DQMStore::IBooker &ibooker, TString name, vector< double > &xBins, TString xLabel, vector< double > &yBins, TString yLabel, TString title)
 
void myBookProfile2D (DQMStore::IBooker &ibooker, TString name, vector< double > &xBins, TString xLabel, vector< double > &yBins, TString yLabel)
 

Private Attributes

vector< double > deltaEtaBins
 
vector< double > deltaPhiBins
 
vector< double > dimuonDRBins
 
vector< double > dimuonEtaBins
 
vector< double > dimuonPtBins
 
string dqmFolder
 
vector< pair< string, int > > filterNamesLevels
 
double genGlobDeltaRMatchingCut
 
InputTag genParticlesTag
 
EDGetTokenT< GenParticleCollectiongenParticlesToken
 
double globL1DeltaRMatchingCut
 
double globL2DeltaRMatchingCut
 
double globL3DeltaRMatchingCut
 
map< TString, MonitorElement * > ME
 
vector< int > motherIDs
 
vector< double > muonEtaBins
 
const double muonMass
 
vector< double > muonPhiBins
 
vector< double > muonPtBins
 
InputTag recoMuonsTag
 
EDGetTokenT< MuonCollectionrecoMuonsToken
 
string triggerPathName
 
string triggerProcessName
 
InputTag triggerResultsTag
 
EDGetTokenT< TriggerResultstriggerResultsToken
 
EDGetTokenT< TriggerEventtriggerSummaryAODTag
 
EDGetTokenT< TriggerEventWithRefstriggerSummaryRAWTag
 

Detailed Description

Description: Analyzer to fill Monitoring Elements for muon, dimuon and trigger path efficiency studies (HLT/RECO, RECO/GEN)

Implementation: matching is based on closest in delta R, no duplicates allowed. Generated to Global based on momentum at IP; L1, L2, L2v to Global based on position in muon system, L3 to Global based on momentum at IP.

Definition at line 51 of file HeavyFlavorValidation.cc.

Constructor & Destructor Documentation

◆ HeavyFlavorValidation()

HeavyFlavorValidation::HeavyFlavorValidation ( const edm::ParameterSet pset)
explicit

Definition at line 145 of file HeavyFlavorValidation.cc.

References genParticlesTag, genParticlesToken, HLT_2022v12_cff::InputTag, muonDTDigis_cfi::pset, recoMuonsTag, recoMuonsToken, triggerProcessName, triggerResultsTag, triggerResultsToken, triggerSummaryAODTag, and triggerSummaryRAWTag.

146  : //get parameters
147  dqmFolder(pset.getUntrackedParameter<string>("DQMFolder")),
148  triggerProcessName(pset.getUntrackedParameter<string>("TriggerProcessName")),
149  triggerPathName(pset.getUntrackedParameter<string>("TriggerPathName")),
150  motherIDs(pset.getUntrackedParameter<vector<int> >("MotherIDs")),
151  genGlobDeltaRMatchingCut(pset.getUntrackedParameter<double>("GenGlobDeltaRMatchingCut")),
152  globL1DeltaRMatchingCut(pset.getUntrackedParameter<double>("GlobL1DeltaRMatchingCut")),
153  globL2DeltaRMatchingCut(pset.getUntrackedParameter<double>("GlobL2DeltaRMatchingCut")),
154  globL3DeltaRMatchingCut(pset.getUntrackedParameter<double>("GlobL3DeltaRMatchingCut")),
155  deltaEtaBins(pset.getUntrackedParameter<vector<double> >("DeltaEtaBins")),
156  deltaPhiBins(pset.getUntrackedParameter<vector<double> >("DeltaPhiBins")),
157  muonPtBins(pset.getUntrackedParameter<vector<double> >("MuonPtBins")),
158  muonEtaBins(pset.getUntrackedParameter<vector<double> >("MuonEtaBins")),
159  muonPhiBins(pset.getUntrackedParameter<vector<double> >("MuonPhiBins")),
160  dimuonPtBins(pset.getUntrackedParameter<vector<double> >("DimuonPtBins")),
161  dimuonEtaBins(pset.getUntrackedParameter<vector<double> >("DimuonEtaBins")),
162  dimuonDRBins(pset.getUntrackedParameter<vector<double> >("DimuonDRBins")),
163  muonMass(0.106) {
164  triggerSummaryRAWTag = consumes<TriggerEventWithRefs>(
165  InputTag(pset.getUntrackedParameter<string>("TriggerSummaryRAW"), "", triggerProcessName));
167  consumes<TriggerEvent>(InputTag(pset.getUntrackedParameter<string>("TriggerSummaryAOD"), "", triggerProcessName));
168  triggerResultsTag = InputTag(pset.getUntrackedParameter<string>("TriggerResults"), "", triggerProcessName);
169  triggerResultsToken = consumes<TriggerResults>(triggerResultsTag);
170  recoMuonsTag = pset.getParameter<InputTag>("RecoMuons");
171  recoMuonsToken = consumes<MuonCollection>(recoMuonsTag);
172  genParticlesTag = pset.getParameter<InputTag>("GenParticles");
173  genParticlesToken = consumes<GenParticleCollection>(genParticlesTag);
174 }
EDGetTokenT< TriggerEvent > triggerSummaryAODTag
EDGetTokenT< TriggerEventWithRefs > triggerSummaryRAWTag
EDGetTokenT< MuonCollection > recoMuonsToken
EDGetTokenT< GenParticleCollection > genParticlesToken
EDGetTokenT< TriggerResults > triggerResultsToken

◆ ~HeavyFlavorValidation()

HeavyFlavorValidation::~HeavyFlavorValidation ( )
override

Definition at line 961 of file HeavyFlavorValidation.cc.

961 {}

Member Function Documentation

◆ analyze()

void HeavyFlavorValidation::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprotected

Definition at line 457 of file HeavyFlavorValidation.cc.

References funct::abs(), ALCARECOTkAlJpsiMuMu_cff::charge, PVValHelper::eta, trigger::TriggerEventWithRefs::filterIndex(), trigger::TriggerEvent::filterKeys(), filterNamesLevels, trigger::TriggerEvent::filterTag(), spr::find(), first, genGlobDeltaRMatchingCut, runTauDisplay::genMuons, AJJGenJetFilter_cfi::genParticles, genParticlesTag, genParticlesToken, getMotherId(), trigger::TriggerEvent::getObjects(), trigger::TriggerEventWithRefs::getObjects(), globL1DeltaRMatchingCut, globL2DeltaRMatchingCut, globL3DeltaRMatchingCut, mps_fire::i, iEvent, HLT_2022v12_cff::InputTag, edm::HandleBase::isValid(), dqmiolumiharvest::j, relativeConstraints::keys, LogDebug, match(), motherIDs, muonMass, AlCaHLTBitMon_ParallelJobs::p, phi, DiDispStaMuonMonitor_cfi::pt, recoMuonsTag, recoMuonsToken, edm::second(), findQualityFiles::size, trigger::TriggerEvent::sizeFilters(), jetUpdater_cfi::sort, HLT_2022v12_cff::track, trigger::TriggerL1Mu, trigger::TriggerMuon, L1TEGammaOffline_cfi::triggerNames, triggerPathName, triggerProcessName, triggerResults, triggerResultsTag, triggerResultsToken, triggerSummaryAODTag, triggerSummaryRAWTag, x, y, and z.

457  {
458  if (filterNamesLevels.empty()) {
459  return;
460  }
461  //access the containers and create LeafCandidate copies
462  vector<LeafCandidate> genMuons;
465  if (genParticles.isValid()) {
466  for (GenParticleCollection::const_iterator p = genParticles->begin(); p != genParticles->end(); ++p) {
467  if (p->status() == 1 && std::abs(p->pdgId()) == 13 &&
468  (find(motherIDs.begin(), motherIDs.end(), -1) != motherIDs.end() ||
469  find(motherIDs.begin(), motherIDs.end(), getMotherId(&(*p))) != motherIDs.end())) {
470  genMuons.push_back(*p);
471  }
472  }
473  } else {
474  LogDebug("HLTriggerOfflineHeavyFlavor") << "Could not access GenParticleCollection" << endl;
475  }
477  ME["genMuon_size"]->Fill(genMuons.size());
478  LogDebug("HLTriggerOfflineHeavyFlavor")
479  << "GenParticleCollection from " << genParticlesTag << " has size: " << genMuons.size() << endl;
480 
481  vector<LeafCandidate> globMuons;
482  vector<LeafCandidate> globMuons_position;
483  Handle<MuonCollection> recoMuonsHandle;
484  iEvent.getByToken(recoMuonsToken, recoMuonsHandle);
485  if (recoMuonsHandle.isValid()) {
486  for (MuonCollection::const_iterator p = recoMuonsHandle->begin(); p != recoMuonsHandle->end(); ++p) {
487  if (p->isGlobalMuon()) {
488  globMuons.push_back(*p);
489  globMuons_position.push_back(LeafCandidate(p->charge(),
490  math::XYZTLorentzVector(p->outerTrack()->innerPosition().x(),
491  p->outerTrack()->innerPosition().y(),
492  p->outerTrack()->innerPosition().z(),
493  0.)));
494  }
495  }
496  } else {
497  LogDebug("HLTriggerOfflineHeavyFlavor") << "Could not access reco Muons" << endl;
498  }
499  ME["globMuon_size"]->Fill(globMuons.size());
500  LogDebug("HLTriggerOfflineHeavyFlavor")
501  << "Global Muons from " << recoMuonsTag << " has size: " << globMuons.size() << endl;
502 
503  // access RAW trigger event
504  vector<vector<LeafCandidate> > muonsAtFilter;
505  vector<vector<LeafCandidate> > muonPositionsAtFilter;
506  for (size_t i = 0; i < filterNamesLevels.size(); i++) {
507  muonsAtFilter.push_back(vector<LeafCandidate>());
508  muonPositionsAtFilter.push_back(vector<LeafCandidate>());
509  }
510  Handle<TriggerEventWithRefs> rawTriggerEvent;
511  iEvent.getByToken(triggerSummaryRAWTag, rawTriggerEvent);
512  if (rawTriggerEvent.isValid()) {
513  for (size_t i = 0; i < filterNamesLevels.size(); i++) {
514  size_t index = rawTriggerEvent->filterIndex(InputTag(filterNamesLevels[i].first, "", triggerProcessName));
515  if (index < rawTriggerEvent->size()) {
516  if (filterNamesLevels[i].second == 1) {
517  vector<L1MuonParticleRef> l1Cands;
518  rawTriggerEvent->getObjects(index, TriggerL1Mu, l1Cands);
519  for (size_t j = 0; j < l1Cands.size(); j++) {
520  muonsAtFilter[i].push_back(*l1Cands[j]);
521  }
522  } else {
523  vector<RecoChargedCandidateRef> hltCands;
524  rawTriggerEvent->getObjects(index, TriggerMuon, hltCands);
525  for (size_t j = 0; j < hltCands.size(); j++) {
526  muonsAtFilter[i].push_back(*hltCands[j]);
527  if (filterNamesLevels[i].second == 2) {
528  muonPositionsAtFilter[i].push_back(
529  LeafCandidate(hltCands[j]->charge(),
530  math::XYZTLorentzVector(hltCands[j]->track()->innerPosition().x(),
531  hltCands[j]->track()->innerPosition().y(),
532  hltCands[j]->track()->innerPosition().z(),
533  0.)));
534  }
535  }
536  }
537  }
538  //ME[TString::Format("filt%dMuon_size", int(i + 1))]->Fill(muonsAtFilter[i].size());
539  LogDebug("HLTriggerOfflineHeavyFlavor")
540  << "Filter \"" << filterNamesLevels[i].first << "\" has " << muonsAtFilter[i].size() << " muons" << endl;
541  }
542  } else {
543  LogDebug("HLTriggerOfflineHeavyFlavor") << "Could not access RAWTriggerEvent" << endl;
544  }
545 
546  // access AOD trigger event
547  vector<LeafCandidate> pathMuons;
548  Handle<TriggerEvent> aodTriggerEvent;
549  iEvent.getByToken(triggerSummaryAODTag, aodTriggerEvent);
550  if (aodTriggerEvent.isValid()) {
551  TriggerObjectCollection allObjects = aodTriggerEvent->getObjects();
552  for (int i = 0; i < aodTriggerEvent->sizeFilters(); i++) {
553  if (aodTriggerEvent->filterTag(i) == InputTag((filterNamesLevels.end() - 1)->first, "", triggerProcessName)) {
554  Keys keys = aodTriggerEvent->filterKeys(i);
555  for (size_t j = 0; j < keys.size(); j++) {
556  pathMuons.push_back(LeafCandidate(
557  allObjects[keys[j]].id() > 0 ? 1 : -1,
559  allObjects[keys[j]].pt(), allObjects[keys[j]].eta(), allObjects[keys[j]].phi(), muonMass)));
560  }
561  }
562  }
563  ME["pathMuon_size"]->Fill(pathMuons.size());
564  LogDebug("HLTriggerOfflineHeavyFlavor")
565  << "Path \"" << triggerPathName << "\" has " << pathMuons.size() << " muons at last filter \""
566  << (filterNamesLevels.end() - 1)->first << "\"" << endl;
567  } else {
568  LogDebug("HLTriggerOfflineHeavyFlavor") << "Could not access AODTriggerEvent" << endl;
569  }
570 
571  // access Trigger Results
572  bool triggerFired = false;
575  if (triggerResults.isValid()) {
576  LogDebug("HLTriggerOfflineHeavyFlavor") << "Successfully initialized " << triggerResultsTag << endl;
577  const edm::TriggerNames &triggerNames = iEvent.triggerNames(*triggerResults);
578  bool hlt_exists = false;
579  for (unsigned int i = 0; i != triggerNames.size(); i++) {
580  TString hlt_name = triggerNames.triggerName(i);
581  if (hlt_name.Contains(triggerPathName)) {
582  triggerFired = triggerResults->accept(i);
583  hlt_exists = true;
584  break;
585  }
586  }
587  if (!hlt_exists) {
588  LogDebug("HLTriggerOfflineHeavyFlavor") << triggerResultsTag << " has no trigger: " << triggerPathName << endl;
589  }
590  } else {
591  LogDebug("HLTriggerOfflineHeavyFlavor") << "Could not initialize " << triggerResultsTag << endl;
592  }
593 
594  //create matching maps
595  vector<int> glob_gen(genMuons.size(), -1);
596  match(ME["globGen_deltaEtaDeltaPhi"], genMuons, globMuons, genGlobDeltaRMatchingCut, glob_gen);
597  vector<vector<int> > filt_glob;
598  /*
599  for (size_t i = 0; i < filterNamesLevels.size(); i++) {
600  filt_glob.push_back(vector<int>(globMuons.size(), -1));
601  if (filterNamesLevels[i].second == 1) {
602  match(ME[TString::Format("filt%dGlob_deltaEtaDeltaPhi", int(i + 1))],
603  globMuons_position,
604  muonsAtFilter[i],
605  globL1DeltaRMatchingCut,
606  filt_glob[i]);
607  } else if (filterNamesLevels[i].second == 2) {
608  match(ME[TString::Format("filt%dGlob_deltaEtaDeltaPhi", int(i + 1))],
609  globMuons_position,
610  muonPositionsAtFilter[i],
611  globL2DeltaRMatchingCut,
612  filt_glob[i]);
613  } else if (filterNamesLevels[i].second > 2) {
614  match(ME[TString::Format("filt%dGlob_deltaEtaDeltaPhi", int(i + 1))],
615  globMuons,
616  muonsAtFilter[i],
617  globL3DeltaRMatchingCut,
618  filt_glob[i]);
619  }
620  }
621  */
622  vector<int> path_glob(globMuons.size(), -1);
623  if ((filterNamesLevels.end() - 1)->second == 1) {
624  match(ME["pathGlob_deltaEtaDeltaPhi"], globMuons_position, pathMuons, globL1DeltaRMatchingCut, path_glob);
625  } else if ((filterNamesLevels.end() - 1)->second == 2) {
626  match(ME["pathGlob_deltaEtaDeltaPhi"], globMuons, pathMuons, globL2DeltaRMatchingCut, path_glob);
627  } else if ((filterNamesLevels.end() - 1)->second > 2) {
628  match(ME["pathGlob_deltaEtaDeltaPhi"], globMuons, pathMuons, globL3DeltaRMatchingCut, path_glob);
629  }
630 
631  //fill histos
632  bool first = true;
633  for (size_t i = 0; i < genMuons.size(); i++) {
634  ME["genMuon_genEtaPt"]->Fill(genMuons[i].eta(), genMuons[i].pt());
635  ME["genMuon_genEtaPhi"]->Fill(genMuons[i].eta(), genMuons[i].phi());
636  if (glob_gen[i] != -1) {
637  ME["resGlobGen_genEtaPt"]->Fill(
638  genMuons[i].eta(), genMuons[i].pt(), (globMuons[glob_gen[i]].pt() - genMuons[i].pt()) / genMuons[i].pt());
639  ME["globMuon_genEtaPt"]->Fill(genMuons[i].eta(), genMuons[i].pt());
640  ME["globMuon_genEtaPhi"]->Fill(genMuons[i].eta(), genMuons[i].phi());
641  ME["globMuon_recoEtaPt"]->Fill(globMuons[glob_gen[i]].eta(), globMuons[glob_gen[i]].pt());
642  ME["globMuon_recoEtaPhi"]->Fill(globMuons[glob_gen[i]].eta(), globMuons[glob_gen[i]].phi());
643  /*
644  for (size_t f = 0; f < filterNamesLevels.size(); f++) {
645  if (filt_glob[f][glob_gen[i]] != -1) {
646  ME[TString::Format("resFilt%dGlob_recoEtaPt", int(f + 1))]->Fill(
647  globMuons[glob_gen[i]].eta(),
648  globMuons[glob_gen[i]].pt(),
649  (muonsAtFilter[f][filt_glob[f][glob_gen[i]]].pt() - globMuons[glob_gen[i]].pt()) /
650  globMuons[glob_gen[i]].pt());
651  ME[TString::Format("filt%dMuon_recoEtaPt", int(f + 1))]->Fill(globMuons[glob_gen[i]].eta(),
652  globMuons[glob_gen[i]].pt());
653  ME[TString::Format("filt%dMuon_recoEtaPhi", int(f + 1))]->Fill(globMuons[glob_gen[i]].eta(),
654  globMuons[glob_gen[i]].phi());
655  } else {
656  break;
657  }
658  }
659  */
660  if (path_glob[glob_gen[i]] != -1) {
661  ME["resPathGlob_recoEtaPt"]->Fill(
662  globMuons[glob_gen[i]].eta(),
663  globMuons[glob_gen[i]].pt(),
664  (pathMuons[path_glob[glob_gen[i]]].pt() - globMuons[glob_gen[i]].pt()) / globMuons[glob_gen[i]].pt());
665  ME["pathMuon_recoEtaPt"]->Fill(globMuons[glob_gen[i]].eta(), globMuons[glob_gen[i]].pt());
666  ME["pathMuon_recoEtaPhi"]->Fill(globMuons[glob_gen[i]].eta(), globMuons[glob_gen[i]].phi());
667  }
668  //highest pt muon
669  if (first) {
670  first = false;
671  if (triggerFired) {
672  ME["resultMuon_recoEtaPt"]->Fill(globMuons[glob_gen[i]].eta(), globMuons[glob_gen[i]].pt());
673  ME["resultMuon_recoEtaPhi"]->Fill(globMuons[glob_gen[i]].eta(), globMuons[glob_gen[i]].phi());
674  }
675  }
676  }
677  }
678 
679  //fill dimuon histograms (highest pT, opposite charge)
680  int secondMuon = 0;
681  for (size_t j = 1; j < genMuons.size(); j++) {
682  if (genMuons[0].charge() * genMuons[j].charge() == -1) {
683  secondMuon = j;
684  break;
685  }
686  }
687  if (secondMuon > 0) {
688  //two generated
689  double genDimuonPt = (genMuons[0].p4() + genMuons[secondMuon].p4()).pt();
690  double genDimuonEta = (genMuons[0].p4() + genMuons[secondMuon].p4()).eta();
691  double genDimuonRap = (genMuons[0].p4() + genMuons[secondMuon].p4()).Rapidity();
692  double genDimuonDR = deltaR<LeafCandidate, LeafCandidate>(genMuons[0], genMuons[secondMuon]);
693  bool highPt = genMuons[0].pt() > 7. && genMuons[secondMuon].pt() > 7;
694  ME["genDimuon_genEtaPt"]->Fill(genDimuonEta, genDimuonPt);
695  ME["genDimuon_genRapPt"]->Fill(genDimuonRap, genDimuonPt);
696  if (highPt)
697  ME["genDimuon_genPtDR"]->Fill(genDimuonPt, genDimuonDR);
698  //two global
699  if (glob_gen[0] != -1 && glob_gen[secondMuon] != -1) {
700  ME["globDimuon_genEtaPt"]->Fill(genDimuonEta, genDimuonPt);
701  ME["globDimuon_genRapPt"]->Fill(genDimuonRap, genDimuonPt);
702  if (highPt)
703  ME["globDimuon_genPtDR"]->Fill(genDimuonPt, genDimuonDR);
704  double globDimuonPt = (globMuons[glob_gen[0]].p4() + globMuons[glob_gen[secondMuon]].p4()).pt();
705  double globDimuonEta = (globMuons[glob_gen[0]].p4() + globMuons[glob_gen[secondMuon]].p4()).eta();
706  double globDimuonRap = (globMuons[glob_gen[0]].p4() + globMuons[glob_gen[secondMuon]].p4()).Rapidity();
707  double globDimuonDR =
708  deltaR<LeafCandidate, LeafCandidate>(globMuons[glob_gen[0]], globMuons[glob_gen[secondMuon]]);
709  double globDimuonDRpos = deltaR<LeafCandidate, LeafCandidate>(globMuons_position[glob_gen[0]],
710  globMuons_position[glob_gen[secondMuon]]);
711  ME["globDimuon_recoEtaPt"]->Fill(globDimuonEta, globDimuonPt);
712  ME["globDimuon_recoRapPt"]->Fill(globDimuonRap, globDimuonPt);
713  if (highPt)
714  ME["globDimuon_recoPtDR"]->Fill(globDimuonPt, globDimuonDR);
715  if (highPt)
716  ME["globDimuon_recoPtDRpos"]->Fill(globDimuonPt, globDimuonDRpos);
717  //two filter objects
718  /*
719  for (size_t f = 0; f < filterNamesLevels.size(); f++) {
720  if (filt_glob[f][glob_gen[0]] != -1 && filt_glob[f][glob_gen[secondMuon]] != -1) {
721  ME[TString::Format("diFilt%dDimuon_recoEtaPt", int(f + 1))]->Fill(globDimuonEta, globDimuonPt);
722  ME[TString::Format("diFilt%dDimuon_recoRapPt", int(f + 1))]->Fill(globDimuonRap, globDimuonPt);
723  if (highPt)
724  ME[TString::Format("diFilt%dDimuon_recoPtDR", int(f + 1))]->Fill(globDimuonPt, globDimuonDR);
725  if (highPt)
726  ME[TString::Format("diFilt%dDimuon_recoPtDRpos", int(f + 1))]->Fill(globDimuonPt, globDimuonDRpos);
727  } else {
728  break;
729  }
730  }
731  */
732  //one filter object
733  /*
734  for (size_t f = 0; f < filterNamesLevels.size(); f++) {
735  if (filt_glob[f][glob_gen[0]] != -1 || filt_glob[f][glob_gen[secondMuon]] != -1) {
736  ME[TString::Format("filt%dDimuon_recoEtaPt", int(f + 1))]->Fill(globDimuonEta, globDimuonPt);
737  ME[TString::Format("filt%dDimuon_recoRapPt", int(f + 1))]->Fill(globDimuonRap, globDimuonPt);
738  if (highPt)
739  ME[TString::Format("filt%dDimuon_recoPtDR", int(f + 1))]->Fill(globDimuonPt, globDimuonDR);
740  if (highPt)
741  ME[TString::Format("filt%dDimuon_recoPtDRpos", int(f + 1))]->Fill(globDimuonPt, globDimuonDRpos);
742  } else {
743  break;
744  }
745  }
746  */
747  //two path objects
748  if (path_glob[glob_gen[0]] != -1 && path_glob[glob_gen[secondMuon]] != -1) {
749  ME["diPathDimuon_recoEtaPt"]->Fill(globDimuonEta, globDimuonPt);
750  ME["diPathDimuon_recoRapPt"]->Fill(globDimuonRap, globDimuonPt);
751  if (highPt)
752  ME["diPathDimuon_recoPtDR"]->Fill(globDimuonPt, globDimuonDR);
753  if (highPt)
754  ME["diPathDimuon_recoPtDRpos"]->Fill(globDimuonPt, globDimuonDRpos);
755  }
756  //one path object
757  if (path_glob[glob_gen[0]] != -1 || path_glob[glob_gen[secondMuon]] != -1) {
758  ME["pathDimuon_recoEtaPt"]->Fill(globDimuonEta, globDimuonPt);
759  ME["pathDimuon_recoRapPt"]->Fill(globDimuonRap, globDimuonPt);
760  if (highPt)
761  ME["pathDimuon_recoPtDR"]->Fill(globDimuonPt, globDimuonDR);
762  if (highPt)
763  ME["pathDimuon_recoPtDRpos"]->Fill(globDimuonPt, globDimuonDRpos);
764  }
765  //trigger result
766  if (triggerFired) {
767  ME["resultDimuon_recoEtaPt"]->Fill(globDimuonEta, globDimuonPt);
768  ME["resultDimuon_recoRapPt"]->Fill(globDimuonRap, globDimuonPt);
769  if (highPt)
770  ME["resultDimuon_recoPtDR"]->Fill(globDimuonPt, globDimuonDR);
771  if (highPt)
772  ME["resultDimuon_recoPtDRpos"]->Fill(globDimuonPt, globDimuonDRpos);
773  }
774  }
775  }
776 }
size
Write out results.
const Keys & filterKeys(trigger::size_type index) const
Definition: TriggerEvent.h:118
enum start value shifted to 81 so as to avoid clashes with PDG codes
trigger::size_type sizeFilters() const
Definition: TriggerEvent.h:146
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
const edm::InputTag filterTag(trigger::size_type index) const
Definition: TriggerEvent.h:108
EDGetTokenT< TriggerEvent > triggerSummaryAODTag
U second(std::pair< T, U > const &p)
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:25
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
Definition: ME.h:11
int getMotherId(const Candidate *p)
int iEvent
Definition: GenABIO.cc:224
size_type filterIndex(const edm::InputTag &filterTag) const
index from tag
void match(MonitorElement *me, vector< LeafCandidate > &from, vector< LeafCandidate > &to, double deltaRMatchingCut, vector< int > &map)
EDGetTokenT< TriggerEventWithRefs > triggerSummaryRAWTag
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const TriggerObjectCollection & getObjects() const
Definition: TriggerEvent.h:101
static std::string const triggerResults
Definition: EdmProvDump.cc:44
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
Definition: TriggerObject.h:75
EDGetTokenT< MuonCollection > recoMuonsToken
std::vector< size_type > Keys
bool isValid() const
Definition: HandleBase.h:70
EDGetTokenT< GenParticleCollection > genParticlesToken
EDGetTokenT< TriggerResults > triggerResultsToken
vector< pair< string, int > > filterNamesLevels
void getObjects(size_type filter, Vids &ids, VRphoton &photons) const
extract Ref<C>s for a specific filter and of specific physics type
#define LogDebug(id)

◆ bookHistograms()

void HeavyFlavorValidation::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  iRun,
edm::EventSetup const &  iSetup 
)
overrideprotected

Definition at line 216 of file HeavyFlavorValidation.cc.

References dqm::implementation::NavigatorBase::cd(), deltaEtaBins, deltaPhiBins, dimuonDRBins, dimuonEtaBins, dimuonPtBins, dqmFolder, muonEtaBins, muonPhiBins, muonPtBins, myBook1D(), myBook2D(), myBookProfile2D(), dqm::implementation::NavigatorBase::setCurrentFolder(), triggerPathName, and triggerProcessName.

218  {
219  ibooker.cd();
221 
222  // create Monitor Elements
223  // Eta Pt Single
224  myBook2D(ibooker, "genMuon_genEtaPt", muonEtaBins, "#mu eta", muonPtBins, " #mu pT (GeV)");
225  myBook2D(ibooker, "globMuon_genEtaPt", muonEtaBins, "#mu eta", muonPtBins, " #mu pT (GeV)");
226  myBook2D(ibooker, "globMuon_recoEtaPt", muonEtaBins, "#mu eta", muonPtBins, " #mu pT (GeV)");
227  /*
228  for (size_t i = 0; i < filterNamesLevels.size(); i++) {
229  myBook2D(ibooker,
230  TString::Format("filt%dMuon_recoEtaPt", int(i + 1)),
231  muonEtaBins,
232  "#mu eta",
233  muonPtBins,
234  " #mu pT (GeV)",
235  filterNamesLevels[i].first);
236  }
237  */
238  myBook2D(ibooker, "pathMuon_recoEtaPt", muonEtaBins, "#mu eta", muonPtBins, " #mu pT (GeV)", triggerPathName);
239  myBook2D(ibooker, "resultMuon_recoEtaPt", muonEtaBins, "#mu eta", muonPtBins, " #mu pT (GeV)");
240  // Eta Pt Single Resolution
241  myBookProfile2D(ibooker, "resGlobGen_genEtaPt", muonEtaBins, "#mu eta", muonPtBins, " #mu pT (GeV)");
242  /*
243  for (size_t i = 0; i < filterNamesLevels.size(); i++) {
244  myBookProfile2D(ibooker,
245  TString::Format("resFilt%dGlob_recoEtaPt", int(i + 1)),
246  muonEtaBins,
247  "#mu eta",
248  muonPtBins,
249  " #mu pT (GeV)",
250  filterNamesLevels[i].first);
251  }
252  */
254  ibooker, "resPathGlob_recoEtaPt", muonEtaBins, "#mu eta", muonPtBins, " #mu pT (GeV)", triggerPathName);
255  // Eta Pt Double
256  myBook2D(ibooker, "genDimuon_genEtaPt", dimuonEtaBins, "#mu#mu eta", dimuonPtBins, " #mu#mu pT (GeV)");
257  myBook2D(ibooker, "globDimuon_genEtaPt", dimuonEtaBins, "#mu#mu eta", dimuonPtBins, " #mu#mu pT (GeV)");
258  myBook2D(ibooker, "globDimuon_recoEtaPt", dimuonEtaBins, "#mu#mu eta", dimuonPtBins, " #mu#mu pT (GeV)");
259  /*
260  for (size_t i = 0; i < filterNamesLevels.size(); i++) {
261  myBook2D(ibooker,
262  TString::Format("filt%dDimuon_recoEtaPt", int(i + 1)),
263  dimuonEtaBins,
264  "#mu#mu eta",
265  dimuonPtBins,
266  " #mu#mu pT (GeV)",
267  filterNamesLevels[i].first);
268  }
269  */
270  myBook2D(
271  ibooker, "pathDimuon_recoEtaPt", dimuonEtaBins, "#mu#mu eta", dimuonPtBins, " #mu#mu pT (GeV)", triggerPathName);
272  myBook2D(ibooker, "resultDimuon_recoEtaPt", dimuonEtaBins, "#mu#mu eta", dimuonPtBins, " #mu#mu pT (GeV)");
273  /*
274  for (size_t i = 0; i < filterNamesLevels.size(); i++) {
275  myBook2D(ibooker,
276  TString::Format("diFilt%dDimuon_recoEtaPt", int(i + 1)),
277  dimuonEtaBins,
278  "#mu#mu eta",
279  dimuonPtBins,
280  " #mu#mu pT (GeV)",
281  filterNamesLevels[i].first);
282  }
283  */
284  myBook2D(
285  ibooker, "diPathDimuon_recoEtaPt", dimuonEtaBins, "#mu#mu eta", dimuonPtBins, " #mu#mu pT (GeV)", triggerPathName);
286  // Eta Phi Single
287  myBook2D(ibooker, "genMuon_genEtaPhi", muonEtaBins, "#mu eta", muonPhiBins, "#mu phi");
288  myBook2D(ibooker, "globMuon_genEtaPhi", muonEtaBins, "#mu eta", muonPhiBins, "#mu phi");
289  myBook2D(ibooker, "globMuon_recoEtaPhi", muonEtaBins, "#mu eta", muonPhiBins, "#mu phi");
290  /*
291  for (size_t i = 0; i < filterNamesLevels.size(); i++) {
292  myBook2D(ibooker,
293  TString::Format("filt%dMuon_recoEtaPhi", int(i + 1)),
294  muonEtaBins,
295  "#mu eta",
296  muonPhiBins,
297  "#mu phi",
298  filterNamesLevels[i].first);
299  }
300  */
301  myBook2D(ibooker, "pathMuon_recoEtaPhi", muonEtaBins, "#mu eta", muonPhiBins, "#mu phi", triggerPathName);
302  myBook2D(ibooker, "resultMuon_recoEtaPhi", muonEtaBins, "#mu eta", muonPhiBins, "#mu phi");
303  // Rap Pt Double
304  myBook2D(ibooker, "genDimuon_genRapPt", dimuonEtaBins, "#mu#mu rapidity", dimuonPtBins, " #mu#mu pT (GeV)");
305  myBook2D(ibooker, "globDimuon_genRapPt", dimuonEtaBins, "#mu#mu rapidity", dimuonPtBins, " #mu#mu pT (GeV)");
306  myBook2D(ibooker, "globDimuon_recoRapPt", dimuonEtaBins, "#mu#mu rapidity", dimuonPtBins, " #mu#mu pT (GeV)");
307  /*
308  for (size_t i = 0; i < filterNamesLevels.size(); i++) {
309  myBook2D(ibooker,
310  TString::Format("filt%dDimuon_recoRapPt", int(i + 1)),
311  dimuonEtaBins,
312  "#mu#mu rapidity",
313  dimuonPtBins,
314  " #mu#mu pT (GeV)",
315  filterNamesLevels[i].first);
316  }
317  */
318  myBook2D(ibooker,
319  "pathDimuon_recoRapPt",
321  "#mu#mu rapidity",
322  dimuonPtBins,
323  " #mu#mu pT (GeV)",
325  myBook2D(ibooker, "resultDimuon_recoRapPt", dimuonEtaBins, "#mu#mu rapidity", dimuonPtBins, " #mu#mu pT (GeV)");
326  /*
327  for (size_t i = 0; i < filterNamesLevels.size(); i++) {
328  myBook2D(ibooker,
329  TString::Format("diFilt%dDimuon_recoRapPt", int(i + 1)),
330  dimuonEtaBins,
331  "#mu#mu rapidity",
332  dimuonPtBins,
333  " #mu#mu pT (GeV)",
334  filterNamesLevels[i].first);
335  }
336  */
337  myBook2D(ibooker,
338  "diPathDimuon_recoRapPt",
340  "#mu#mu rapidity",
341  dimuonPtBins,
342  " #mu#mu pT (GeV)",
344  // Pt DR Double
345  myBook2D(ibooker, "genDimuon_genPtDR", dimuonPtBins, " #mu#mu pT (GeV)", dimuonDRBins, "#mu#mu #Delta R at IP");
346  myBook2D(ibooker, "globDimuon_genPtDR", dimuonPtBins, " #mu#mu pT (GeV)", dimuonDRBins, "#mu#mu #Delta R at IP");
347  myBook2D(ibooker, "globDimuon_recoPtDR", dimuonPtBins, " #mu#mu pT (GeV)", dimuonDRBins, "#mu#mu #Delta R at IP");
348  /*
349  for (size_t i = 0; i < filterNamesLevels.size(); i++) {
350  myBook2D(ibooker,
351  TString::Format("filt%dDimuon_recoPtDR", int(i + 1)),
352  dimuonPtBins,
353  " #mu#mu pT (GeV)",
354  dimuonDRBins,
355  "#mu#mu #Delta R at IP",
356  filterNamesLevels[i].first);
357  }
358  */
359  myBook2D(ibooker,
360  "pathDimuon_recoPtDR",
361  dimuonPtBins,
362  " #mu#mu pT (GeV)",
363  dimuonDRBins,
364  "#mu#mu #Delta R at IP",
366  /*
367  for (size_t i = 0; i < filterNamesLevels.size(); i++) {
368  myBook2D(ibooker,
369  TString::Format("diFilt%dDimuon_recoPtDR", int(i + 1)),
370  dimuonPtBins,
371  " #mu#mu pT (GeV)",
372  dimuonDRBins,
373  "#mu#mu #Delta R at IP",
374  filterNamesLevels[i].first);
375  }
376  */
377  myBook2D(ibooker,
378  "diPathDimuon_recoPtDR",
379  dimuonPtBins,
380  " #mu#mu pT (GeV)",
381  dimuonDRBins,
382  "#mu#mu #Delta R at IP",
384  myBook2D(ibooker, "resultDimuon_recoPtDR", dimuonPtBins, " #mu#mu pT (GeV)", dimuonDRBins, "#mu#mu #Delta R at IP");
385  // Pt DRpos Double
386  myBook2D(ibooker, "globDimuon_recoPtDRpos", dimuonPtBins, " #mu#mu pT (GeV)", dimuonDRBins, "#mu#mu #Delta R in MS");
387  /*
388  for (size_t i = 0; i < filterNamesLevels.size(); i++) {
389  myBook2D(ibooker,
390  TString::Format("filt%dDimuon_recoPtDRpos", int(i + 1)),
391  dimuonPtBins,
392  " #mu#mu pT (GeV)",
393  dimuonDRBins,
394  "#mu#mu #Delta R in MS",
395  filterNamesLevels[i].first);
396  }
397  */
398  myBook2D(ibooker,
399  "pathDimuon_recoPtDRpos",
400  dimuonPtBins,
401  " #mu#mu pT (GeV)",
402  dimuonDRBins,
403  "#mu#mu #Delta R in MS",
405  /*
406  for (size_t i = 0; i < filterNamesLevels.size(); i++) {
407  myBook2D(ibooker,
408  TString::Format("diFilt%dDimuon_recoPtDRpos", int(i + 1)),
409  dimuonPtBins,
410  " #mu#mu pT (GeV)",
411  dimuonDRBins,
412  "#mu#mu #Delta R in MS",
413  filterNamesLevels[i].first);
414  }
415  */
416  myBook2D(ibooker,
417  "diPathDimuon_recoPtDRpos",
418  dimuonPtBins,
419  " #mu#mu pT (GeV)",
420  dimuonDRBins,
421  "#mu#mu #Delta R in MS",
423  myBook2D(
424  ibooker, "resultDimuon_recoPtDRpos", dimuonPtBins, " #mu#mu pT (GeV)", dimuonDRBins, "#mu#mu #Delta R in MS");
425 
426  // Matching
427  myBook2D(ibooker, "globGen_deltaEtaDeltaPhi", deltaEtaBins, "#Delta eta", deltaPhiBins, "#Delta phi");
428  /*
429  for (size_t i = 0; i < filterNamesLevels.size(); i++) {
430  myBook2D(ibooker,
431  TString::Format("filt%dGlob_deltaEtaDeltaPhi", int(i + 1)),
432  deltaEtaBins,
433  "#Delta eta",
434  deltaPhiBins,
435  "#Delta phi",
436  filterNamesLevels[i].first);
437  }
438  */
439  myBook2D(
440  ibooker, "pathGlob_deltaEtaDeltaPhi", deltaEtaBins, "#Delta eta", deltaPhiBins, "#Delta phi", triggerPathName);
441  // Size of containers
442  vector<double> sizeBins;
443  sizeBins.push_back(10);
444  sizeBins.push_back(0);
445  sizeBins.push_back(10);
446  myBook1D(ibooker, "genMuon_size", sizeBins, "container size");
447  myBook1D(ibooker, "globMuon_size", sizeBins, "container size");
448  /*
449  for (size_t i = 0; i < filterNamesLevels.size(); i++) {
450  myBook1D(
451  ibooker, TString::Format("filt%dMuon_size", int(i + 1)), sizeBins, "container size", filterNamesLevels[i].first);
452  }
453  */
454  myBook1D(ibooker, "pathMuon_size", sizeBins, "container size", triggerPathName);
455 }
void myBook2D(DQMStore::IBooker &ibooker, TString name, vector< double > &xBins, TString xLabel, vector< double > &yBins, TString yLabel, TString title)
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
void myBookProfile2D(DQMStore::IBooker &ibooker, TString name, vector< double > &xBins, TString xLabel, vector< double > &yBins, TString yLabel, TString title)
void myBook1D(DQMStore::IBooker &ibooker, TString name, vector< double > &xBins, TString label, TString title)

◆ dqmBeginRun()

void HeavyFlavorValidation::dqmBeginRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)
overrideprotected

Definition at line 176 of file HeavyFlavorValidation.cc.

References filterNamesLevels, filters, getFilterLevel(), HltComparatorCreateWorkflow::hltConfig, personalPlayback::level, LogDebug, EcalCalibMonitorClient_cfi::moduleName, str, AlCaHLTBitMon_QueryRunRegistry::string, L1TEGammaOffline_cfi::triggerNames, triggerPathName, triggerProcessName, and cscTnPEfficiencyTask_cfi::trigName.

176  {
177  //discover HLT configuration
179  bool isChanged;
180  if (hltConfig.init(iRun, iSetup, triggerProcessName, isChanged)) {
181  LogDebug("HLTriggerOfflineHeavyFlavor")
182  << "Successfully initialized HLTConfigProvider with process name: " << triggerProcessName << endl;
183  } else {
184  LogWarning("HLTriggerOfflineHeavyFlavor")
185  << "Could not initialize HLTConfigProvider with process name: " << triggerProcessName << endl;
186  return;
187  }
188  vector<string> triggerNames = hltConfig.triggerNames();
189  for (const auto &trigName : triggerNames) {
190  // TString triggerName = trigName;
191  if (trigName.find(triggerPathName) != std::string::npos) {
192  vector<string> moduleNames = hltConfig.moduleLabels(trigName);
193  for (const auto &moduleName : moduleNames) {
195  if (level > 0) {
196  filterNamesLevels.push_back({moduleName, level});
197  }
198  }
199  break;
200  }
201  }
202 
203  if (filterNamesLevels.empty()) {
204  LogDebug("HLTriggerOfflineHeavyFlavor") << "Bad Trigger Path: " << triggerPathName << endl;
205  return;
206  } else {
208  str.reserve(
209  512); // avoid too many realloctions in the following loop (allows for filter names with roughly 100 chars each)
210  for (const auto &filters : filterNamesLevels)
211  str = str + " " + filters.first;
212  LogDebug("HLTriggerOfflineHeavyFlavor") << "Trigger Path: " << triggerPathName << " has filters:" << str;
213  }
214 }
std::vector< TPRegexp > filters
Definition: eve_filter.cc:22
int getFilterLevel(const std::string &moduleName, const HLTConfigProvider &hltConfig)
Log< level::Warning, false > LogWarning
vector< pair< string, int > > filterNamesLevels
#define str(s)
#define LogDebug(id)

◆ getFilterLevel()

int HeavyFlavorValidation::getFilterLevel ( const std::string &  moduleName,
const HLTConfigProvider hltConfig 
)
private

Get the filter "level" (as it is defined for the use of this module and its corresponding harvesting module).

level 1 - 3 -> more or less synonymously to the the trigger levels level 4 and 5 -> vertex, dz, track, etc.. filters

See the comments in the definition for some more details.

Definition at line 899 of file HeavyFlavorValidation.cc.

References edm::contains(), HltComparatorCreateWorkflow::hltConfig, l1Filter_cfi::l1Filter, visualization-live-secondInstance_cfg::m, EcalCalibMonitorClient_cfi::moduleName, alignCSCRings::s, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by dqmBeginRun().

899  {
900  // helper lambda to check if a string contains a substring
901  const auto contains = [](const std::string &s, const std::string &sub) -> bool {
902  return s.find(sub) != std::string::npos;
903  };
904 
905  // helper lambda to check if a string contains any of a list of substrings
906  const auto containsAny = [](const std::string &s, const std::vector<std::string> &subs) -> bool {
907  for (const auto &sub : subs) {
908  if (s.find(sub) != std::string::npos)
909  return true;
910  }
911  return false;
912  };
913 
914  // helper lambda to check if string s is any of the strings in vector ms
915  const auto isAnyOf = [](const std::string &s, const std::vector<std::string> &ms) -> bool {
916  for (const auto &m : ms) {
917  if (s == m)
918  return true;
919  }
920  return false;
921  };
922 
923  // tmadlener, 20.08.2017:
924  // define the valid module names for the different "levels", to add a little bit more stability
925  // to the checking compared to just doing some name matching.
926  // Note, that the name matching is not completely remved, since at level 4 and 5 some of the
927  // valid modules are the same, so that the name matching is still needed.
928  // With the current definition this yields the exact same levels as before, but weeds out some
929  // of the "false" positives at level 3 (naming matches also to some HLTMuonL1TFilter modules due to
930  // the 'forIterL3' in the name)
931  const std::string l1Filter = "HLTMuonL1TFilter";
932  const std::string l2Filter = "HLTMuonL2FromL1TPreFilter";
933  const std::vector<std::string> l3Filters = {"HLTMuonDimuonL3Filter", "HLTMuonL3PreFilter"};
934  const std::vector<std::string> l4Filters = {
935  "HLTDisplacedmumuFilter", "HLTDiMuonGlbTrkFilter", "HLTMuonTrackMassFilter"};
936  const std::vector<std::string> l5Filters = {"HLTmumutkFilter", "HLT2MuonMuonDZ", "HLTDisplacedmumuFilter"};
937 
938  if (contains(moduleName, "Filter") && hltConfig.moduleEDMType(moduleName) == "EDFilter") {
939  if (contains(moduleName, "L1") && !contains(moduleName, "ForIterL3") &&
940  hltConfig.moduleType(moduleName) == l1Filter) {
941  return 1;
942  }
943  if (contains(moduleName, "L2") && hltConfig.moduleType(moduleName) == l2Filter) {
944  return 2;
945  }
946  if (contains(moduleName, "L3") && isAnyOf(hltConfig.moduleType(moduleName), l3Filters)) {
947  return 3;
948  }
949  if (containsAny(moduleName, {"DisplacedmumuFilter", "DiMuon", "MuonL3Filtered", "TrackMassFiltered"}) &&
950  isAnyOf(hltConfig.moduleType(moduleName), l4Filters)) {
951  return 4;
952  }
953  if (containsAny(moduleName, {"Vertex", "Dz"}) && isAnyOf(hltConfig.moduleType(moduleName), l5Filters)) {
954  return 5;
955  }
956  }
957 
958  return -1;
959 }
bool contains(EventRange const &lh, EventID const &rh)
Definition: EventRange.cc:37

◆ getMotherId()

int HeavyFlavorValidation::getMotherId ( const Candidate p)
private

Definition at line 778 of file HeavyFlavorValidation.cc.

References AlCaHLTBitMon_ParallelJobs::p, and reco::Candidate::pdgId().

Referenced by analyze().

778  {
779  const Candidate *mother = p->mother();
780  if (mother) {
781  if (mother->pdgId() == p->pdgId()) {
782  return getMotherId(mother);
783  } else {
784  return mother->pdgId();
785  }
786  } else {
787  return 0;
788  }
789 }
int getMotherId(const Candidate *p)
virtual int pdgId() const =0
PDG identifier.

◆ match()

void HeavyFlavorValidation::match ( MonitorElement me,
vector< LeafCandidate > &  from,
vector< LeafCandidate > &  to,
double  deltaRMatchingCut,
vector< int > &  map 
)
private

Definition at line 791 of file HeavyFlavorValidation.cc.

References HGC3DClusterGenMatchSelector_cfi::dR, PVValHelper::eta, mps_fire::i, dqmiolumiharvest::j, dqmdumpme::k, genParticles_cff::map, hlt_dqm_clientPB-live_cfg::me, and phi.

Referenced by analyze().

795  {
796  vector<double> dR(from.size());
797  for (size_t i = 0; i < from.size(); i++) {
798  map[i] = -1;
799  dR[i] = 10.;
800  //find closest
801  for (size_t j = 0; j < to.size(); j++) {
802  double dRtmp = deltaR<double>(from[i].eta(), from[i].phi(), to[j].eta(), to[j].phi());
803  if (dRtmp < dR[i]) {
804  dR[i] = dRtmp;
805  map[i] = j;
806  }
807  }
808  //fill matching histo
809  if (map[i] != -1) {
810  me->Fill(to[map[i]].eta() - from[i].eta(), deltaPhi<double>(to[map[i]].phi(), from[i].phi()));
811  }
812  //apply matching cut
813  if (dR[i] > dRMatchingCut) {
814  map[i] = -1;
815  }
816  //remove duplication
817  if (map[i] != -1) {
818  for (size_t k = 0; k < i; k++) {
819  if (map[k] != -1 && map[i] == map[k]) {
820  if (dR[i] < dR[k]) {
821  map[k] = -1;
822  } else {
823  map[i] = -1;
824  }
825  break;
826  }
827  }
828  }
829  }
830 }

◆ myBook1D() [1/2]

void HeavyFlavorValidation::myBook1D ( DQMStore::IBooker ibooker,
TString  name,
vector< double > &  xBins,
TString  label,
TString  title 
)
private

Definition at line 884 of file HeavyFlavorValidation.cc.

References trigObjTnPSource_cfi::bins, dqm::implementation::IBooker::book1D(), h, mps_fire::i, createfilelist::int, label, Skims_PA_cff::name, and runGCPTkAlMap::title.

Referenced by bookHistograms().

885  {
886  // dqmStore->setCurrentFolder(dqmFolder+"/"+folder);
887  int binsN = bins.size() == 3 ? (int)bins[0] + 1 : bins.size();
888  Double_t *myBins = new Double_t[binsN];
889  for (int i = 0; i < binsN; i++) {
890  myBins[i] = bins.size() == 3 ? bins[1] + i * (bins[2] - bins[1]) / bins[0] : bins[i];
891  }
892  TH1F *h = new TH1F(name, name, binsN - 1, myBins);
893  h->SetXTitle(label);
894  h->SetTitle(title);
895  ME[name] = ibooker.book1D(name.Data(), h);
896  delete h;
897 }
Definition: ME.h:11
char const * label
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4

◆ myBook1D() [2/2]

void HeavyFlavorValidation::myBook1D ( DQMStore::IBooker ibooker,
TString  name,
vector< double > &  xBins,
TString  label 
)
inlineprivate

Definition at line 99 of file HeavyFlavorValidation.cc.

References label, Skims_PA_cff::name, and multiplicitycorr_cfi::xBins.

99  {
100  myBook1D(ibooker, name, xBins, label, name);
101  }
char const * label
void myBook1D(DQMStore::IBooker &ibooker, TString name, vector< double > &xBins, TString label, TString title)

◆ myBook2D() [1/2]

void HeavyFlavorValidation::myBook2D ( DQMStore::IBooker ibooker,
TString  name,
vector< double > &  xBins,
TString  xLabel,
vector< double > &  yBins,
TString  yLabel,
TString  title 
)
private

Definition at line 832 of file HeavyFlavorValidation.cc.

References dqm::implementation::IBooker::book2D(), PVValHelper::eta, HLT_2022v12_cff::etaBins, h, mps_fire::i, createfilelist::int, Skims_PA_cff::name, DiDispStaMuonMonitor_cfi::pt, L1EGammaClusterEmuProducer_cfi::ptBins, and runGCPTkAlMap::title.

Referenced by bookHistograms().

838  {
839  // dqmStore->setCurrentFolder(dqmFolder+"/"+folder);
840  int ptN = ptBins.size() == 3 ? (int)ptBins[0] + 1 : ptBins.size();
841  Double_t *pt = new Double_t[ptN];
842  for (int i = 0; i < ptN; i++) {
843  pt[i] = ptBins.size() == 3 ? ptBins[1] + i * (ptBins[2] - ptBins[1]) / ptBins[0] : ptBins[i];
844  }
845  int etaN = etaBins.size() == 3 ? (int)etaBins[0] + 1 : etaBins.size();
846  Double_t *eta = new Double_t[etaN];
847  for (int i = 0; i < etaN; i++) {
848  eta[i] = etaBins.size() == 3 ? etaBins[1] + i * (etaBins[2] - etaBins[1]) / etaBins[0] : etaBins[i];
849  }
850  TH2F *h = new TH2F(name, name, ptN - 1, pt, etaN - 1, eta);
851  h->SetXTitle(ptLabel);
852  h->SetYTitle(etaLabel);
853  h->SetTitle(title);
854  ME[name] = ibooker.book2D(name.Data(), h);
855  delete h;
856 }
Definition: ME.h:11
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:212
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4

◆ myBook2D() [2/2]

void HeavyFlavorValidation::myBook2D ( DQMStore::IBooker ibooker,
TString  name,
vector< double > &  xBins,
TString  xLabel,
vector< double > &  yBins,
TString  yLabel 
)
inlineprivate

Definition at line 75 of file HeavyFlavorValidation.cc.

References Skims_PA_cff::name, multiplicitycorr_cfi::xBins, and multiplicitycorr_cfi::yBins.

80  {
81  myBook2D(ibooker, name, xBins, xLabel, yBins, yLabel, name);
82  }
void myBook2D(DQMStore::IBooker &ibooker, TString name, vector< double > &xBins, TString xLabel, vector< double > &yBins, TString yLabel, TString title)

◆ myBookProfile2D() [1/2]

void HeavyFlavorValidation::myBookProfile2D ( DQMStore::IBooker ibooker,
TString  name,
vector< double > &  xBins,
TString  xLabel,
vector< double > &  yBins,
TString  yLabel,
TString  title 
)
private

Definition at line 858 of file HeavyFlavorValidation.cc.

References dqm::implementation::IBooker::bookProfile2D(), PVValHelper::eta, HLT_2022v12_cff::etaBins, h, mps_fire::i, createfilelist::int, Skims_PA_cff::name, DiDispStaMuonMonitor_cfi::pt, L1EGammaClusterEmuProducer_cfi::ptBins, and runGCPTkAlMap::title.

Referenced by bookHistograms().

864  {
865  // dqmStore->setCurrentFolder(dqmFolder+"/"+folder);
866  int ptN = ptBins.size() == 3 ? (int)ptBins[0] + 1 : ptBins.size();
867  Double_t *pt = new Double_t[ptN];
868  for (int i = 0; i < ptN; i++) {
869  pt[i] = ptBins.size() == 3 ? ptBins[1] + i * (ptBins[2] - ptBins[1]) / ptBins[0] : ptBins[i];
870  }
871  int etaN = etaBins.size() == 3 ? (int)etaBins[0] + 1 : etaBins.size();
872  Double_t *eta = new Double_t[etaN];
873  for (int i = 0; i < etaN; i++) {
874  eta[i] = etaBins.size() == 3 ? etaBins[1] + i * (etaBins[2] - etaBins[1]) / etaBins[0] : etaBins[i];
875  }
876  TProfile2D *h = new TProfile2D(name, name, ptN - 1, pt, etaN - 1, eta);
877  h->SetXTitle(ptLabel);
878  h->SetYTitle(etaLabel);
879  h->SetTitle(title);
880  ME[name] = ibooker.bookProfile2D(name.Data(), h);
881  delete h;
882 }
MonitorElement * bookProfile2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, double lowZ, double highZ, char const *option="s", FUNC onbooking=NOOP())
Definition: DQMStore.h:476
Definition: ME.h:11
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4

◆ myBookProfile2D() [2/2]

void HeavyFlavorValidation::myBookProfile2D ( DQMStore::IBooker ibooker,
TString  name,
vector< double > &  xBins,
TString  xLabel,
vector< double > &  yBins,
TString  yLabel 
)
inlineprivate

Definition at line 90 of file HeavyFlavorValidation.cc.

References Skims_PA_cff::name, multiplicitycorr_cfi::xBins, and multiplicitycorr_cfi::yBins.

95  {
96  myBookProfile2D(ibooker, name, xBins, xLabel, yBins, yLabel, name);
97  }
void myBookProfile2D(DQMStore::IBooker &ibooker, TString name, vector< double > &xBins, TString xLabel, vector< double > &yBins, TString yLabel, TString title)

Member Data Documentation

◆ deltaEtaBins

vector<double> HeavyFlavorValidation::deltaEtaBins
private

Definition at line 132 of file HeavyFlavorValidation.cc.

Referenced by bookHistograms().

◆ deltaPhiBins

vector<double> HeavyFlavorValidation::deltaPhiBins
private

Definition at line 133 of file HeavyFlavorValidation.cc.

Referenced by bookHistograms().

◆ dimuonDRBins

vector<double> HeavyFlavorValidation::dimuonDRBins
private

Definition at line 139 of file HeavyFlavorValidation.cc.

Referenced by bookHistograms().

◆ dimuonEtaBins

vector<double> HeavyFlavorValidation::dimuonEtaBins
private

Definition at line 138 of file HeavyFlavorValidation.cc.

Referenced by bookHistograms().

◆ dimuonPtBins

vector<double> HeavyFlavorValidation::dimuonPtBins
private

Definition at line 137 of file HeavyFlavorValidation.cc.

Referenced by bookHistograms().

◆ dqmFolder

string HeavyFlavorValidation::dqmFolder
private

Definition at line 114 of file HeavyFlavorValidation.cc.

Referenced by bookHistograms().

◆ filterNamesLevels

vector<pair<string, int> > HeavyFlavorValidation::filterNamesLevels
private

Definition at line 141 of file HeavyFlavorValidation.cc.

Referenced by analyze(), and dqmBeginRun().

◆ genGlobDeltaRMatchingCut

double HeavyFlavorValidation::genGlobDeltaRMatchingCut
private

Definition at line 128 of file HeavyFlavorValidation.cc.

Referenced by analyze().

◆ genParticlesTag

InputTag HeavyFlavorValidation::genParticlesTag
private

Definition at line 124 of file HeavyFlavorValidation.cc.

Referenced by analyze(), and HeavyFlavorValidation().

◆ genParticlesToken

EDGetTokenT<GenParticleCollection> HeavyFlavorValidation::genParticlesToken
private

Definition at line 125 of file HeavyFlavorValidation.cc.

Referenced by analyze(), and HeavyFlavorValidation().

◆ globL1DeltaRMatchingCut

double HeavyFlavorValidation::globL1DeltaRMatchingCut
private

Definition at line 129 of file HeavyFlavorValidation.cc.

Referenced by analyze().

◆ globL2DeltaRMatchingCut

double HeavyFlavorValidation::globL2DeltaRMatchingCut
private

Definition at line 130 of file HeavyFlavorValidation.cc.

Referenced by analyze().

◆ globL3DeltaRMatchingCut

double HeavyFlavorValidation::globL3DeltaRMatchingCut
private

Definition at line 131 of file HeavyFlavorValidation.cc.

Referenced by analyze().

◆ ME

map<TString, MonitorElement *> HeavyFlavorValidation::ME
private

Definition at line 140 of file HeavyFlavorValidation.cc.

◆ motherIDs

vector<int> HeavyFlavorValidation::motherIDs
private

Definition at line 127 of file HeavyFlavorValidation.cc.

Referenced by analyze().

◆ muonEtaBins

vector<double> HeavyFlavorValidation::muonEtaBins
private

Definition at line 135 of file HeavyFlavorValidation.cc.

Referenced by bookHistograms().

◆ muonMass

const double HeavyFlavorValidation::muonMass
private

Definition at line 142 of file HeavyFlavorValidation.cc.

Referenced by analyze().

◆ muonPhiBins

vector<double> HeavyFlavorValidation::muonPhiBins
private

Definition at line 136 of file HeavyFlavorValidation.cc.

Referenced by bookHistograms().

◆ muonPtBins

vector<double> HeavyFlavorValidation::muonPtBins
private

Definition at line 134 of file HeavyFlavorValidation.cc.

Referenced by bookHistograms().

◆ recoMuonsTag

InputTag HeavyFlavorValidation::recoMuonsTag
private

Definition at line 122 of file HeavyFlavorValidation.cc.

Referenced by analyze(), and HeavyFlavorValidation().

◆ recoMuonsToken

EDGetTokenT<MuonCollection> HeavyFlavorValidation::recoMuonsToken
private

Definition at line 123 of file HeavyFlavorValidation.cc.

Referenced by analyze(), and HeavyFlavorValidation().

◆ triggerPathName

string HeavyFlavorValidation::triggerPathName
private

Definition at line 116 of file HeavyFlavorValidation.cc.

Referenced by analyze(), bookHistograms(), and dqmBeginRun().

◆ triggerProcessName

string HeavyFlavorValidation::triggerProcessName
private

◆ triggerResultsTag

InputTag HeavyFlavorValidation::triggerResultsTag
private

Definition at line 120 of file HeavyFlavorValidation.cc.

Referenced by analyze(), and HeavyFlavorValidation().

◆ triggerResultsToken

EDGetTokenT<TriggerResults> HeavyFlavorValidation::triggerResultsToken
private

Definition at line 121 of file HeavyFlavorValidation.cc.

Referenced by analyze(), and HeavyFlavorValidation().

◆ triggerSummaryAODTag

EDGetTokenT<TriggerEvent> HeavyFlavorValidation::triggerSummaryAODTag
private

Definition at line 119 of file HeavyFlavorValidation.cc.

Referenced by analyze(), and HeavyFlavorValidation().

◆ triggerSummaryRAWTag

EDGetTokenT<TriggerEventWithRefs> HeavyFlavorValidation::triggerSummaryRAWTag
private

Definition at line 118 of file HeavyFlavorValidation.cc.

Referenced by analyze(), and HeavyFlavorValidation().