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
 
DQMStoredqmStore
 
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 54 of file HeavyFlavorValidation.cc.

Constructor & Destructor Documentation

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

Definition at line 121 of file HeavyFlavorValidation.cc.

References genParticlesTag, genParticlesToken, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), recoMuonsTag, recoMuonsToken, triggerProcessName, triggerResultsTag, triggerResultsToken, triggerSummaryAODTag, and triggerSummaryRAWTag.

121  :
122 //get parameters
123  dqmFolder(pset.getUntrackedParameter<string>("DQMFolder")),
124  triggerProcessName(pset.getUntrackedParameter<string>("TriggerProcessName")),
125  triggerPathName(pset.getUntrackedParameter<string>("TriggerPathName")),
126  motherIDs(pset.getUntrackedParameter<vector<int> >("MotherIDs")),
127  genGlobDeltaRMatchingCut(pset.getUntrackedParameter<double>("GenGlobDeltaRMatchingCut")),
128  globL1DeltaRMatchingCut(pset.getUntrackedParameter<double>("GlobL1DeltaRMatchingCut")),
129  globL2DeltaRMatchingCut(pset.getUntrackedParameter<double>("GlobL2DeltaRMatchingCut")),
130  globL3DeltaRMatchingCut(pset.getUntrackedParameter<double>("GlobL3DeltaRMatchingCut")),
131  deltaEtaBins(pset.getUntrackedParameter<vector<double> >("DeltaEtaBins")),
132  deltaPhiBins(pset.getUntrackedParameter<vector<double> >("DeltaPhiBins")),
133  muonPtBins(pset.getUntrackedParameter<vector<double> >("MuonPtBins")),
134  muonEtaBins(pset.getUntrackedParameter<vector<double> >("MuonEtaBins")),
135  muonPhiBins(pset.getUntrackedParameter<vector<double> >("MuonPhiBins")),
136  dimuonPtBins(pset.getUntrackedParameter<vector<double> >("DimuonPtBins")),
137  dimuonEtaBins(pset.getUntrackedParameter<vector<double> >("DimuonEtaBins")),
138  dimuonDRBins(pset.getUntrackedParameter<vector<double> >("DimuonDRBins")),
139  muonMass(0.106)
140 {
141  triggerSummaryRAWTag = consumes<TriggerEventWithRefs>(InputTag( pset.getUntrackedParameter<string>("TriggerSummaryRAW"), "", triggerProcessName));
142  triggerSummaryAODTag = consumes<TriggerEvent>(InputTag( pset.getUntrackedParameter<string>("TriggerSummaryAOD"), "", triggerProcessName));
143  triggerResultsTag = InputTag( pset.getUntrackedParameter<string>("TriggerResults"), "", triggerProcessName);
144  triggerResultsToken = consumes<TriggerResults>(triggerResultsTag);
145  recoMuonsTag = pset.getParameter<InputTag>("RecoMuons");
146  recoMuonsToken = consumes<MuonCollection>(recoMuonsTag);
147  genParticlesTag = pset.getParameter<InputTag>("GenParticles");
148  genParticlesToken = consumes<GenParticleCollection>(genParticlesTag);
149 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
EDGetTokenT< TriggerEvent > triggerSummaryAODTag
EDGetTokenT< TriggerEventWithRefs > triggerSummaryRAWTag
EDGetTokenT< MuonCollection > recoMuonsToken
EDGetTokenT< GenParticleCollection > genParticlesToken
EDGetTokenT< TriggerResults > triggerResultsToken
HeavyFlavorValidation::~HeavyFlavorValidation ( )
override

Definition at line 714 of file HeavyFlavorValidation.cc.

References DEFINE_FWK_MODULE.

714  {
715 }

Member Function Documentation

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

Definition at line 288 of file HeavyFlavorValidation.cc.

References funct::abs(), edm::HLTGlobalStatus::accept(), ALCARECOTkAlJpsiMuMu_cff::charge, PVValHelper::eta, f, trigger::TriggerEventWithRefs::filterIndex(), trigger::TriggerEvent::filterKeys(), filterNamesLevels, trigger::TriggerEvent::filterTag(), spr::find(), plotBeamSpotDB::first, genGlobDeltaRMatchingCut, runTauDisplay::genMuons, GenHFHadronMatcher_cfi::genParticles, genParticlesTag, genParticlesToken, edm::Event::getByToken(), getMotherId(), trigger::TriggerEvent::getObjects(), trigger::TriggerEventWithRefs::getObjects(), globL1DeltaRMatchingCut, globL2DeltaRMatchingCut, globL3DeltaRMatchingCut, mps_fire::i, edm::HandleBase::isValid(), relativeConstraints::keys, LogDebug, match(), motherIDs, muonMass, AlCaHLTBitMon_ParallelJobs::p, phi, EnergyCorrector::pt, recoMuonsTag, recoMuonsToken, edm::second(), edm::TriggerNames::size(), findQualityFiles::size, trigger::TriggerEvent::sizeFilters(), HiIsolationCommonParameters_cff::track, trigger::TriggerL1Mu, trigger::TriggerMuon, edm::TriggerNames::triggerName(), edm::Event::triggerNames(), triggerPathName, triggerProcessName, triggerResults, triggerResultsTag, triggerResultsToken, triggerSummaryAODTag, triggerSummaryRAWTag, x, y, and z.

288  {
289  if(filterNamesLevels.empty()){
290  return;
291  }
292 //access the containers and create LeafCandidate copies
293  vector<LeafCandidate> genMuons;
295  iEvent.getByToken(genParticlesToken, genParticles);
296  if(genParticles.isValid()){
297  for(GenParticleCollection::const_iterator p=genParticles->begin(); p!= genParticles->end(); ++p){
298  if( p->status() == 1 && std::abs(p->pdgId())==13 &&
299  ( find( motherIDs.begin(), motherIDs.end(), -1 )!=motherIDs.end() || find( motherIDs.begin(), motherIDs.end(), getMotherId(&(*p)) )!=motherIDs.end() ) ){
300  genMuons.push_back( *p );
301  }
302  }
303  }else{
304  LogDebug("HLTriggerOfflineHeavyFlavor")<<"Could not access GenParticleCollection"<<endl;
305  }
306  sort(genMuons.begin(), genMuons.end(), GreaterByPt<LeafCandidate>());
307  ME["genMuon_size"]->Fill(genMuons.size());
308  LogDebug("HLTriggerOfflineHeavyFlavor")<<"GenParticleCollection from "<<genParticlesTag<<" has size: "<<genMuons.size()<<endl;
309 
310  vector<LeafCandidate> globMuons;
311  vector<LeafCandidate> globMuons_position;
312  Handle<MuonCollection> recoMuonsHandle;
313  iEvent.getByToken(recoMuonsToken, recoMuonsHandle);
314  if(recoMuonsHandle.isValid()){
315  for(MuonCollection::const_iterator p=recoMuonsHandle->begin(); p!= recoMuonsHandle->end(); ++p){
316  if(p->isGlobalMuon()){
317  globMuons.push_back(*p);
318  globMuons_position.push_back( LeafCandidate( p->charge(), math::XYZTLorentzVector(p->outerTrack()->innerPosition().x(), p->outerTrack()->innerPosition().y(), p->outerTrack()->innerPosition().z(), 0.) ) );
319  }
320  }
321  }else{
322  LogDebug("HLTriggerOfflineHeavyFlavor")<<"Could not access reco Muons"<<endl;
323  }
324  ME["globMuon_size"]->Fill(globMuons.size());
325  LogDebug("HLTriggerOfflineHeavyFlavor")<<"Global Muons from "<<recoMuonsTag<<" has size: "<<globMuons.size()<<endl;
326 
327 // access RAW trigger event
328  vector<vector<LeafCandidate> > muonsAtFilter;
329  vector<vector<LeafCandidate> > muonPositionsAtFilter;
330  for(size_t i=0; i<filterNamesLevels.size(); i++){
331  muonsAtFilter.push_back(vector<LeafCandidate>());
332  muonPositionsAtFilter.push_back(vector<LeafCandidate>());
333  }
334  Handle<TriggerEventWithRefs> rawTriggerEvent;
335  iEvent.getByToken( triggerSummaryRAWTag, rawTriggerEvent );
336  if( rawTriggerEvent.isValid() ){
337  for(size_t i=0; i<filterNamesLevels.size(); i++){
338  size_t index = rawTriggerEvent->filterIndex(InputTag( filterNamesLevels[i].first, "", triggerProcessName ));
339  if ( index < rawTriggerEvent->size() ){
340  if( filterNamesLevels[i].second==1 ){
341  vector<L1MuonParticleRef> l1Cands;
342  rawTriggerEvent->getObjects( index, TriggerL1Mu, l1Cands );
343  for(size_t j=0; j<l1Cands.size(); j++){
344  muonsAtFilter[i].push_back(*l1Cands[j]);
345  }
346  }else{
347  vector<RecoChargedCandidateRef> hltCands;
348  rawTriggerEvent->getObjects( index, TriggerMuon, hltCands );
349  for(size_t j=0; j<hltCands.size(); j++){
350  muonsAtFilter[i].push_back(*hltCands[j]);
351  if( filterNamesLevels[i].second==2 ){
352  muonPositionsAtFilter[i].push_back( LeafCandidate( hltCands[j]->charge(), math::XYZTLorentzVector(hltCands[j]->track()->innerPosition().x(), hltCands[j]->track()->innerPosition().y(), hltCands[j]->track()->innerPosition().z(), 0.) ) );
353  }
354  }
355  }
356  }
357  ME[TString::Format("filt%dMuon_size",int(i+1))]->Fill(muonsAtFilter[i].size());
358  LogDebug("HLTriggerOfflineHeavyFlavor")<<"Filter \""<<filterNamesLevels[i].first<<"\" has "<<muonsAtFilter[i].size()<<" muons"<<endl;
359  }
360  }else{
361  LogDebug("HLTriggerOfflineHeavyFlavor")<<"Could not access RAWTriggerEvent"<<endl;
362  }
363 
364 // access AOD trigger event
365  vector<LeafCandidate> pathMuons;
366  Handle<TriggerEvent> aodTriggerEvent;
367  iEvent.getByToken(triggerSummaryAODTag,aodTriggerEvent);
368  if(aodTriggerEvent.isValid()){
369  TriggerObjectCollection allObjects = aodTriggerEvent->getObjects();
370  for(int i=0; i<aodTriggerEvent->sizeFilters(); i++){
371  if(aodTriggerEvent->filterTag(i)==InputTag((filterNamesLevels.end()-1)->first,"",triggerProcessName)){
372  Keys keys = aodTriggerEvent->filterKeys(i);
373  for(size_t j=0; j<keys.size(); j++){
374  pathMuons.push_back( LeafCandidate( allObjects[keys[j]].id()>0 ? 1 : -1, math::PtEtaPhiMLorentzVector( allObjects[keys[j]].pt(), allObjects[keys[j]].eta(), allObjects[keys[j]].phi(), muonMass ) ) );
375  }
376  }
377  }
378  ME["pathMuon_size"]->Fill(pathMuons.size());
379  LogDebug("HLTriggerOfflineHeavyFlavor")<<"Path \""<<triggerPathName<<"\" has "<<pathMuons.size()<<" muons at last filter \""<<(filterNamesLevels.end()-1)->first<<"\""<<endl;
380  }else{
381  LogDebug("HLTriggerOfflineHeavyFlavor")<<"Could not access AODTriggerEvent"<<endl;
382  }
383 
384 // access Trigger Results
385  bool triggerFired = false;
387  iEvent.getByToken(triggerResultsToken,triggerResults);
388  if(triggerResults.isValid()){
389  LogDebug("HLTriggerOfflineHeavyFlavor")<<"Successfully initialized "<<triggerResultsTag<<endl;
390  const edm::TriggerNames & triggerNames = iEvent.triggerNames(*triggerResults);
391  bool hlt_exists = false;
392  for ( unsigned int i=0; i!=triggerNames.size(); i++) {
393  TString hlt_name = triggerNames.triggerName(i);
394  if (hlt_name.Contains(triggerPathName)) {
395  triggerFired = triggerResults->accept( i );
396  hlt_exists = true;
397  break;
398  }
399  }
400  if (!hlt_exists) {
401  LogDebug("HLTriggerOfflineHeavyFlavor")<<triggerResultsTag<<" has no trigger: "<<triggerPathName<<endl;
402  }
403  }else{
404  LogDebug("HLTriggerOfflineHeavyFlavor")<<"Could not initialize "<<triggerResultsTag<<endl;
405  }
406 
407 //create matching maps
408  vector<int> glob_gen(genMuons.size(),-1);
409  match( ME["globGen_deltaEtaDeltaPhi"], genMuons, globMuons, genGlobDeltaRMatchingCut, glob_gen );
410  vector<vector<int> > filt_glob;
411  for(size_t i=0; i<filterNamesLevels.size(); i++){
412  filt_glob.push_back( vector<int>(globMuons.size(),-1) );
413  if( filterNamesLevels[i].second == 1 ){
414  match( ME[TString::Format("filt%dGlob_deltaEtaDeltaPhi",int(i+1))], globMuons_position, muonsAtFilter[i] ,globL1DeltaRMatchingCut, filt_glob[i] );
415  }else if( filterNamesLevels[i].second == 2 ){
416  match( ME[TString::Format("filt%dGlob_deltaEtaDeltaPhi",int(i+1))], globMuons_position, muonPositionsAtFilter[i] ,globL2DeltaRMatchingCut, filt_glob[i] );
417  }else if( filterNamesLevels[i].second > 2){
418  match( ME[TString::Format("filt%dGlob_deltaEtaDeltaPhi",int(i+1))], globMuons, muonsAtFilter[i] ,globL3DeltaRMatchingCut, filt_glob[i] );
419  }
420  }
421  vector<int> path_glob(globMuons.size(),-1);
422  if( (filterNamesLevels.end()-1)->second == 1 ){
423  match( ME["pathGlob_deltaEtaDeltaPhi"], globMuons_position, pathMuons ,globL1DeltaRMatchingCut, path_glob );
424  }else if( (filterNamesLevels.end()-1)->second == 2 ){
425  match( ME["pathGlob_deltaEtaDeltaPhi"], globMuons, pathMuons ,globL2DeltaRMatchingCut, path_glob );
426  }else if( (filterNamesLevels.end()-1)->second > 2){
427  match( ME["pathGlob_deltaEtaDeltaPhi"], globMuons, pathMuons ,globL3DeltaRMatchingCut, path_glob );
428  }
429 
430 //fill histos
431  bool first = true;
432  for(size_t i=0; i<genMuons.size(); i++){
433  ME["genMuon_genEtaPt"]->Fill(genMuons[i].eta(), genMuons[i].pt());
434  ME["genMuon_genEtaPhi"]->Fill(genMuons[i].eta(), genMuons[i].phi());
435  if(glob_gen[i] != -1) {
436  ME["resGlobGen_genEtaPt"]->Fill(genMuons[i].eta(), genMuons[i].pt(), (globMuons[glob_gen[i]].pt()-genMuons[i].pt())/genMuons[i].pt() );
437  ME["globMuon_genEtaPt"]->Fill(genMuons[i].eta(), genMuons[i].pt());
438  ME["globMuon_genEtaPhi"]->Fill(genMuons[i].eta(), genMuons[i].phi());
439  ME["globMuon_recoEtaPt"]->Fill(globMuons[glob_gen[i]].eta(), globMuons[glob_gen[i]].pt());
440  ME["globMuon_recoEtaPhi"]->Fill(globMuons[glob_gen[i]].eta(), globMuons[glob_gen[i]].phi());
441  for(size_t f=0; f<filterNamesLevels.size(); f++) {
442  if(filt_glob[f][glob_gen[i]] != -1) {
443  ME[TString::Format("resFilt%dGlob_recoEtaPt",int(f+1))]->Fill(globMuons[glob_gen[i]].eta(), globMuons[glob_gen[i]].pt(), (muonsAtFilter[f][filt_glob[f][glob_gen[i]]].pt()-globMuons[glob_gen[i]].pt())/globMuons[glob_gen[i]].pt() );
444  ME[TString::Format("filt%dMuon_recoEtaPt",int(f+1))]->Fill(globMuons[glob_gen[i]].eta(), globMuons[glob_gen[i]].pt());
445  ME[TString::Format("filt%dMuon_recoEtaPhi",int(f+1))]->Fill(globMuons[glob_gen[i]].eta(), globMuons[glob_gen[i]].phi());
446  }else{
447  break;
448  }
449  }
450  if(path_glob[glob_gen[i]] != -1){
451  ME["resPathGlob_recoEtaPt"]->Fill(globMuons[glob_gen[i]].eta(), globMuons[glob_gen[i]].pt(), (pathMuons[path_glob[glob_gen[i]]].pt()-globMuons[glob_gen[i]].pt())/globMuons[glob_gen[i]].pt() );
452  ME["pathMuon_recoEtaPt"]->Fill(globMuons[glob_gen[i]].eta(), globMuons[glob_gen[i]].pt());
453  ME["pathMuon_recoEtaPhi"]->Fill(globMuons[glob_gen[i]].eta(), globMuons[glob_gen[i]].phi());
454  }
455 //highest pt muon
456  if( first ){
457  first = false;
458  if( triggerFired ){
459  ME["resultMuon_recoEtaPt"]->Fill(globMuons[glob_gen[i]].eta(), globMuons[glob_gen[i]].pt());
460  ME["resultMuon_recoEtaPhi"]->Fill(globMuons[glob_gen[i]].eta(), globMuons[glob_gen[i]].phi());
461  }
462  }
463  }
464  }
465 
466 //fill dimuon histograms (highest pT, opposite charge)
467  int secondMuon = 0;
468  for(size_t j=1; j<genMuons.size(); j++){
469  if(genMuons[0].charge()*genMuons[j].charge()==-1){
470  secondMuon = j;
471  break;
472  }
473  }
474  if(secondMuon > 0){
475 //two generated
476  double genDimuonPt = (genMuons[0].p4()+genMuons[secondMuon].p4()).pt();
477  double genDimuonEta = (genMuons[0].p4()+genMuons[secondMuon].p4()).eta();
478  double genDimuonRap = (genMuons[0].p4()+genMuons[secondMuon].p4()).Rapidity();
479  double genDimuonDR = deltaR<LeafCandidate,LeafCandidate>( genMuons[0], genMuons[secondMuon] );
480  bool highPt = genMuons[0].pt()>7. && genMuons[secondMuon].pt()>7;
481  ME["genDimuon_genEtaPt"]->Fill( genDimuonEta, genDimuonPt );
482  ME["genDimuon_genRapPt"]->Fill( genDimuonRap, genDimuonPt );
483  if(highPt) ME["genDimuon_genPtDR"]->Fill( genDimuonPt, genDimuonDR );
484 //two global
485  if(glob_gen[0]!=-1 && glob_gen[secondMuon]!=-1){
486  ME["globDimuon_genEtaPt"]->Fill( genDimuonEta, genDimuonPt );
487  ME["globDimuon_genRapPt"]->Fill( genDimuonRap, genDimuonPt );
488  if(highPt) ME["globDimuon_genPtDR"]->Fill( genDimuonPt, genDimuonDR );
489  double globDimuonPt = (globMuons[glob_gen[0]].p4()+globMuons[glob_gen[secondMuon]].p4()).pt();
490  double globDimuonEta = (globMuons[glob_gen[0]].p4()+globMuons[glob_gen[secondMuon]].p4()).eta();
491  double globDimuonRap = (globMuons[glob_gen[0]].p4()+globMuons[glob_gen[secondMuon]].p4()).Rapidity();
492  double globDimuonDR = deltaR<LeafCandidate,LeafCandidate>( globMuons[glob_gen[0]], globMuons[glob_gen[secondMuon]] );
493  double globDimuonDRpos = deltaR<LeafCandidate,LeafCandidate>( globMuons_position[glob_gen[0]], globMuons_position[glob_gen[secondMuon]] );
494  ME["globDimuon_recoEtaPt"]->Fill( globDimuonEta, globDimuonPt );
495  ME["globDimuon_recoRapPt"]->Fill( globDimuonRap, globDimuonPt );
496  if(highPt) ME["globDimuon_recoPtDR"]->Fill( globDimuonPt, globDimuonDR );
497  if(highPt) ME["globDimuon_recoPtDRpos"]->Fill( globDimuonPt, globDimuonDRpos );
498 //two filter objects
499  for(size_t f=0; f<filterNamesLevels.size(); f++){
500  if(filt_glob[f][glob_gen[0]] != -1 && filt_glob[f][glob_gen[secondMuon]] != -1){
501  ME[TString::Format("diFilt%dDimuon_recoEtaPt",int(f+1))]->Fill( globDimuonEta, globDimuonPt );
502  ME[TString::Format("diFilt%dDimuon_recoRapPt",int(f+1))]->Fill( globDimuonRap, globDimuonPt );
503  if(highPt) ME[TString::Format("diFilt%dDimuon_recoPtDR",int(f+1))]->Fill( globDimuonPt, globDimuonDR );
504  if(highPt) ME[TString::Format("diFilt%dDimuon_recoPtDRpos",int(f+1))]->Fill( globDimuonPt, globDimuonDRpos );
505  }else{
506  break;
507  }
508  }
509 //one filter object
510  for(size_t f=0; f<filterNamesLevels.size(); f++){
511  if(filt_glob[f][glob_gen[0]] != -1 || filt_glob[f][glob_gen[secondMuon]] != -1){
512  ME[TString::Format("filt%dDimuon_recoEtaPt",int(f+1))]->Fill( globDimuonEta, globDimuonPt );
513  ME[TString::Format("filt%dDimuon_recoRapPt",int(f+1))]->Fill( globDimuonRap, globDimuonPt );
514  if(highPt) ME[TString::Format("filt%dDimuon_recoPtDR",int(f+1))]->Fill( globDimuonPt, globDimuonDR );
515  if(highPt) ME[TString::Format("filt%dDimuon_recoPtDRpos",int(f+1))]->Fill( globDimuonPt, globDimuonDRpos );
516  }else{
517  break;
518  }
519  }
520 //two path objects
521  if(path_glob[glob_gen[0]] != -1 && path_glob[glob_gen[secondMuon]] != -1){
522  ME["diPathDimuon_recoEtaPt"]->Fill( globDimuonEta, globDimuonPt );
523  ME["diPathDimuon_recoRapPt"]->Fill( globDimuonRap, globDimuonPt );
524  if(highPt) ME["diPathDimuon_recoPtDR"]->Fill( globDimuonPt, globDimuonDR );
525  if(highPt) ME["diPathDimuon_recoPtDRpos"]->Fill( globDimuonPt, globDimuonDRpos );
526  }
527 //one path object
528  if(path_glob[glob_gen[0]] != -1 || path_glob[glob_gen[secondMuon]] != -1){
529  ME["pathDimuon_recoEtaPt"]->Fill( globDimuonEta, globDimuonPt );
530  ME["pathDimuon_recoRapPt"]->Fill( globDimuonRap, globDimuonPt );
531  if(highPt) ME["pathDimuon_recoPtDR"]->Fill( globDimuonPt, globDimuonDR );
532  if(highPt) ME["pathDimuon_recoPtDRpos"]->Fill( globDimuonPt, globDimuonDRpos );
533  }
534 //trigger result
535  if( triggerFired ){
536  ME["resultDimuon_recoEtaPt"]->Fill( globDimuonEta, globDimuonPt );
537  ME["resultDimuon_recoRapPt"]->Fill( globDimuonRap, globDimuonPt );
538  if(highPt) ME["resultDimuon_recoPtDR"]->Fill( globDimuonPt, globDimuonDR );
539  if(highPt) ME["resultDimuon_recoPtDRpos"]->Fill( globDimuonPt, globDimuonDRpos );
540  }
541  }
542  }
543 }
#define LogDebug(id)
size
Write out results.
trigger::size_type sizeFilters() const
Definition: TriggerEvent.h:135
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
enum start value shifted to 81 so as to avoid clashes with PDG codes
bool accept() const
Has at least one path accepted the event?
const Keys & filterKeys(trigger::size_type index) const
Definition: TriggerEvent.h:111
vector< pair< string, int > > filterNamesLevels
Strings::size_type size() const
Definition: TriggerNames.cc:39
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
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)
void match(MonitorElement *me, vector< LeafCandidate > &from, vector< LeafCandidate > &to, double deltaRMatchingCut, vector< int > &map)
const TriggerObjectCollection & getObjects() const
Definition: TriggerEvent.h:98
EDGetTokenT< TriggerEventWithRefs > triggerSummaryRAWTag
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double f[11][100]
static std::string const triggerResults
Definition: EdmProvDump.cc:41
bool isValid() const
Definition: HandleBase.h:74
size_type filterIndex(const edm::InputTag &filterTag) const
index from tag
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
Definition: TriggerObject.h:81
const edm::InputTag filterTag(trigger::size_type index) const
Definition: TriggerEvent.h:103
EDGetTokenT< MuonCollection > recoMuonsToken
std::string const & triggerName(unsigned int index) const
Definition: TriggerNames.cc:27
std::vector< size_type > Keys
void getObjects(size_type filter, Vids &ids, VRphoton &photons) const
extract Ref<C>s for a specific filter and of specific physics type
EDGetTokenT< GenParticleCollection > genParticlesToken
EDGetTokenT< TriggerResults > triggerResultsToken
edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const override
Definition: Event.cc:301
void HeavyFlavorValidation::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  iRun,
edm::EventSetup const &  iSetup 
)
overrideprotected

Definition at line 189 of file HeavyFlavorValidation.cc.

References DQMStore::IBooker::cd(), deltaEtaBins, deltaPhiBins, dimuonDRBins, dimuonEtaBins, dimuonPtBins, dqmFolder, filterNamesLevels, plotBeamSpotDB::first, mps_fire::i, muonEtaBins, muonPhiBins, muonPtBins, myBook1D(), myBook2D(), myBookProfile2D(), DQMStore::IBooker::setCurrentFolder(), triggerPathName, and triggerProcessName.

191  {
192  ibooker.cd();
194 
195  // create Monitor Elements
196  // Eta Pt Single
197  myBook2D(ibooker, "genMuon_genEtaPt", muonEtaBins, "#mu eta", muonPtBins, " #mu pT (GeV)");
198  myBook2D(ibooker, "globMuon_genEtaPt", muonEtaBins, "#mu eta", muonPtBins, " #mu pT (GeV)");
199  myBook2D(ibooker, "globMuon_recoEtaPt", muonEtaBins, "#mu eta", muonPtBins, " #mu pT (GeV)");
200 
201  for(size_t i=0; i<filterNamesLevels.size(); i++){
202  myBook2D(ibooker, TString::Format("filt%dMuon_recoEtaPt",int(i+1)), muonEtaBins, "#mu eta", muonPtBins, " #mu pT (GeV)", filterNamesLevels[i].first);
203  }
204  myBook2D(ibooker, "pathMuon_recoEtaPt", muonEtaBins, "#mu eta", muonPtBins, " #mu pT (GeV)", triggerPathName);
205  myBook2D(ibooker, "resultMuon_recoEtaPt", muonEtaBins, "#mu eta", muonPtBins, " #mu pT (GeV)");
206  // Eta Pt Single Resolution
207  myBookProfile2D(ibooker, "resGlobGen_genEtaPt", muonEtaBins, "#mu eta", muonPtBins, " #mu pT (GeV)");
208  for(size_t i=0; i<filterNamesLevels.size(); i++){
209  myBookProfile2D(ibooker, TString::Format("resFilt%dGlob_recoEtaPt",int(i+1)), muonEtaBins, "#mu eta", muonPtBins, " #mu pT (GeV)", filterNamesLevels[i].first);
210  }
211  myBookProfile2D(ibooker, "resPathGlob_recoEtaPt", muonEtaBins, "#mu eta", muonPtBins, " #mu pT (GeV)", triggerPathName);
212  // Eta Pt Double
213  myBook2D(ibooker, "genDimuon_genEtaPt", dimuonEtaBins, "#mu#mu eta", dimuonPtBins, " #mu#mu pT (GeV)");
214  myBook2D(ibooker, "globDimuon_genEtaPt", dimuonEtaBins, "#mu#mu eta", dimuonPtBins, " #mu#mu pT (GeV)");
215  myBook2D(ibooker, "globDimuon_recoEtaPt", dimuonEtaBins, "#mu#mu eta", dimuonPtBins, " #mu#mu pT (GeV)");
216  for(size_t i=0; i<filterNamesLevels.size(); i++){
217  myBook2D(ibooker, TString::Format("filt%dDimuon_recoEtaPt",int(i+1)), dimuonEtaBins, "#mu#mu eta", dimuonPtBins, " #mu#mu pT (GeV)", filterNamesLevels[i].first);
218  }
219  myBook2D(ibooker, "pathDimuon_recoEtaPt", dimuonEtaBins, "#mu#mu eta", dimuonPtBins, " #mu#mu pT (GeV)", triggerPathName);
220  myBook2D(ibooker, "resultDimuon_recoEtaPt", dimuonEtaBins, "#mu#mu eta", dimuonPtBins, " #mu#mu pT (GeV)");
221  for(size_t i=0; i<filterNamesLevels.size(); i++){
222  myBook2D(ibooker, TString::Format("diFilt%dDimuon_recoEtaPt",int(i+1)), dimuonEtaBins, "#mu#mu eta", dimuonPtBins, " #mu#mu pT (GeV)", filterNamesLevels[i].first);
223  }
224  myBook2D(ibooker, "diPathDimuon_recoEtaPt", dimuonEtaBins, "#mu#mu eta", dimuonPtBins, " #mu#mu pT (GeV)", triggerPathName);
225  // Eta Phi Single
226  myBook2D(ibooker, "genMuon_genEtaPhi", muonEtaBins, "#mu eta", muonPhiBins, "#mu phi");
227  myBook2D(ibooker, "globMuon_genEtaPhi", muonEtaBins, "#mu eta", muonPhiBins, "#mu phi");
228  myBook2D(ibooker, "globMuon_recoEtaPhi", muonEtaBins, "#mu eta", muonPhiBins, "#mu phi");
229  for(size_t i=0; i<filterNamesLevels.size(); i++){
230  myBook2D(ibooker, TString::Format("filt%dMuon_recoEtaPhi",int(i+1)), muonEtaBins, "#mu eta", muonPhiBins, "#mu phi", filterNamesLevels[i].first);
231  }
232  myBook2D(ibooker, "pathMuon_recoEtaPhi", muonEtaBins, "#mu eta", muonPhiBins, "#mu phi", triggerPathName);
233  myBook2D(ibooker, "resultMuon_recoEtaPhi", muonEtaBins, "#mu eta", muonPhiBins, "#mu phi");
234  // Rap Pt Double
235  myBook2D(ibooker, "genDimuon_genRapPt", dimuonEtaBins, "#mu#mu rapidity", dimuonPtBins, " #mu#mu pT (GeV)");
236  myBook2D(ibooker, "globDimuon_genRapPt", dimuonEtaBins, "#mu#mu rapidity", dimuonPtBins, " #mu#mu pT (GeV)");
237  myBook2D(ibooker, "globDimuon_recoRapPt", dimuonEtaBins, "#mu#mu rapidity", dimuonPtBins, " #mu#mu pT (GeV)");
238  for(size_t i=0; i<filterNamesLevels.size(); i++){
239  myBook2D(ibooker, TString::Format("filt%dDimuon_recoRapPt",int(i+1)), dimuonEtaBins, "#mu#mu rapidity", dimuonPtBins, " #mu#mu pT (GeV)", filterNamesLevels[i].first);
240  }
241  myBook2D(ibooker, "pathDimuon_recoRapPt", dimuonEtaBins, "#mu#mu rapidity", dimuonPtBins, " #mu#mu pT (GeV)", triggerPathName);
242  myBook2D(ibooker, "resultDimuon_recoRapPt", dimuonEtaBins, "#mu#mu rapidity", dimuonPtBins, " #mu#mu pT (GeV)");
243  for(size_t i=0; i<filterNamesLevels.size(); i++){
244  myBook2D(ibooker, TString::Format("diFilt%dDimuon_recoRapPt",int(i+1)), dimuonEtaBins, "#mu#mu rapidity", dimuonPtBins, " #mu#mu pT (GeV)", filterNamesLevels[i].first);
245  }
246  myBook2D(ibooker, "diPathDimuon_recoRapPt", dimuonEtaBins, "#mu#mu rapidity", dimuonPtBins, " #mu#mu pT (GeV)", triggerPathName);
247  // Pt DR Double
248  myBook2D(ibooker, "genDimuon_genPtDR", dimuonPtBins, " #mu#mu pT (GeV)", dimuonDRBins, "#mu#mu #Delta R at IP");
249  myBook2D(ibooker, "globDimuon_genPtDR", dimuonPtBins, " #mu#mu pT (GeV)", dimuonDRBins, "#mu#mu #Delta R at IP");
250  myBook2D(ibooker, "globDimuon_recoPtDR", dimuonPtBins, " #mu#mu pT (GeV)", dimuonDRBins, "#mu#mu #Delta R at IP");
251  for(size_t i=0; i<filterNamesLevels.size(); i++){
252  myBook2D(ibooker, TString::Format("filt%dDimuon_recoPtDR",int(i+1)), dimuonPtBins, " #mu#mu pT (GeV)", dimuonDRBins, "#mu#mu #Delta R at IP", filterNamesLevels[i].first);
253  }
254  myBook2D(ibooker, "pathDimuon_recoPtDR", dimuonPtBins, " #mu#mu pT (GeV)", dimuonDRBins, "#mu#mu #Delta R at IP", triggerPathName);
255  for(size_t i=0; i<filterNamesLevels.size(); i++){
256  myBook2D(ibooker, TString::Format("diFilt%dDimuon_recoPtDR",int(i+1)), dimuonPtBins, " #mu#mu pT (GeV)", dimuonDRBins, "#mu#mu #Delta R at IP", filterNamesLevels[i].first);
257  }
258  myBook2D(ibooker, "diPathDimuon_recoPtDR", dimuonPtBins, " #mu#mu pT (GeV)", dimuonDRBins, "#mu#mu #Delta R at IP", triggerPathName);
259  myBook2D(ibooker, "resultDimuon_recoPtDR", dimuonPtBins, " #mu#mu pT (GeV)", dimuonDRBins, "#mu#mu #Delta R at IP");
260  // Pt DRpos Double
261  myBook2D(ibooker, "globDimuon_recoPtDRpos", dimuonPtBins, " #mu#mu pT (GeV)", dimuonDRBins, "#mu#mu #Delta R in MS");
262  for(size_t i=0; i<filterNamesLevels.size(); i++){
263  myBook2D(ibooker, TString::Format("filt%dDimuon_recoPtDRpos",int(i+1)), dimuonPtBins, " #mu#mu pT (GeV)", dimuonDRBins, "#mu#mu #Delta R in MS", filterNamesLevels[i].first);
264  }
265  myBook2D(ibooker, "pathDimuon_recoPtDRpos", dimuonPtBins, " #mu#mu pT (GeV)", dimuonDRBins, "#mu#mu #Delta R in MS", triggerPathName);
266  for(size_t i=0; i<filterNamesLevels.size(); i++){
267  myBook2D(ibooker, TString::Format("diFilt%dDimuon_recoPtDRpos",int(i+1)), dimuonPtBins, " #mu#mu pT (GeV)", dimuonDRBins, "#mu#mu #Delta R in MS", filterNamesLevels[i].first);
268  }
269  myBook2D(ibooker, "diPathDimuon_recoPtDRpos", dimuonPtBins, " #mu#mu pT (GeV)", dimuonDRBins, "#mu#mu #Delta R in MS", triggerPathName);
270  myBook2D(ibooker, "resultDimuon_recoPtDRpos", dimuonPtBins, " #mu#mu pT (GeV)", dimuonDRBins, "#mu#mu #Delta R in MS");
271 
272  // Matching
273  myBook2D(ibooker, "globGen_deltaEtaDeltaPhi", deltaEtaBins, "#Delta eta", deltaPhiBins, "#Delta phi");
274  for(size_t i=0; i<filterNamesLevels.size(); i++){
275  myBook2D(ibooker, TString::Format("filt%dGlob_deltaEtaDeltaPhi",int(i+1)), deltaEtaBins, "#Delta eta", deltaPhiBins, "#Delta phi", filterNamesLevels[i].first);
276  }
277  myBook2D(ibooker, "pathGlob_deltaEtaDeltaPhi", deltaEtaBins, "#Delta eta", deltaPhiBins, "#Delta phi", triggerPathName);
278  // Size of containers
279  vector<double> sizeBins; sizeBins.push_back(10); sizeBins.push_back(0); sizeBins.push_back(10);
280  myBook1D(ibooker, "genMuon_size", sizeBins, "container size" );
281  myBook1D(ibooker, "globMuon_size", sizeBins, "container size" );
282  for(size_t i=0; i<filterNamesLevels.size(); i++){
283  myBook1D(ibooker, TString::Format("filt%dMuon_size",int(i+1)), sizeBins, "container size", filterNamesLevels[i].first);
284  }
285  myBook1D(ibooker, "pathMuon_size", sizeBins, "container size", triggerPathName );
286 }
void myBook2D(DQMStore::IBooker &ibooker, TString name, vector< double > &xBins, TString xLabel, vector< double > &yBins, TString yLabel, TString title)
vector< pair< string, int > > filterNamesLevels
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)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
void HeavyFlavorValidation::dqmBeginRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)
overrideprotected

Definition at line 151 of file HeavyFlavorValidation.cc.

References filterNamesLevels, filters, getFilterLevel(), HLTConfigProvider::init(), hcalDigis_cfi::level, LogDebug, HLTConfigProvider::moduleLabels(), edm::moduleName(), str, AlCaHLTBitMon_QueryRunRegistry::string, HLTConfigProvider::triggerNames(), triggerPathName, and triggerProcessName.

151  {
152  //discover HLT configuration
153  HLTConfigProvider hltConfig;
154  bool isChanged;
155  if(hltConfig.init(iRun, iSetup, triggerProcessName, isChanged)){
156  LogDebug("HLTriggerOfflineHeavyFlavor") << "Successfully initialized HLTConfigProvider with process name: "<<triggerProcessName<<endl;
157  }else{
158  LogWarning("HLTriggerOfflineHeavyFlavor") << "Could not initialize HLTConfigProvider with process name: "<<triggerProcessName<<endl;
159  return;
160  }
161  vector<string> triggerNames = hltConfig.triggerNames();
162  for (const auto &trigName : triggerNames) {
163  // TString triggerName = trigName;
164  if (trigName.find(triggerPathName) != std::string::npos) {
165  vector<string> moduleNames = hltConfig.moduleLabels( trigName );
166  for (const auto &moduleName : moduleNames) {
167  const int level = getFilterLevel(moduleName, hltConfig);
168  if (level > 0) {
169  filterNamesLevels.push_back( {moduleName, level} );
170  }
171  }
172  break;
173  }
174  }
175 
176  if(filterNamesLevels.empty()){
177  LogDebug("HLTriggerOfflineHeavyFlavor")<<"Bad Trigger Path: "<<triggerPathName<<endl;
178  return;
179  }else{
181  str.reserve(512); // avoid too many realloctions in the following loop (allows for filter names with roughly 100 chars each)
182  for (const auto &filters : filterNamesLevels) str = str + " " + filters.first;
183  LogDebug("HLTriggerOfflineHeavyFlavor")<<"Trigger Path: "<<triggerPathName<<" has filters:"<<str;
184  }
185 }
#define LogDebug(id)
const std::vector< std::string > & triggerNames() const
names of trigger paths
vector< pair< string, int > > filterNamesLevels
std::vector< TPRegexp > filters
Definition: eve_filter.cc:22
int getFilterLevel(const std::string &moduleName, const HLTConfigProvider &hltConfig)
std::string moduleName(Provenance const &provenance)
Definition: Provenance.cc:27
const std::vector< std::string > & moduleLabels(unsigned int trigger) const
label(s) of module(s) on a trigger path
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor
#define str(s)
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 652 of file HeavyFlavorValidation.cc.

References edm::contains(), funct::m, HLTConfigProvider::moduleEDMType(), HLTConfigProvider::moduleType(), AnalysisDataFormats_SUSYBSMObjects::ms, alignCSCRings::s, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by dqmBeginRun().

653 {
654  // helper lambda to check if a string contains a substring
655  const auto contains = [](const std::string &s, const std::string &sub) -> bool {
656  return s.find(sub) != std::string::npos;
657  };
658 
659  // helper lambda to check if a string contains any of a list of substrings
660  const auto containsAny = [](const std::string &s, const std::vector<std::string> &subs) -> bool {
661  for (const auto &sub : subs) {
662  if (s.find(sub) != std::string::npos) return true;
663  }
664  return false;
665  };
666 
667  // helper lambda to check if string s is any of the strings in vector ms
668  const auto isAnyOf = [](const std::string &s, const std::vector<std::string>& ms) -> bool {
669  for (const auto &m : ms) {
670  if (s == m) return true;
671  }
672  return false;
673  };
674 
675  // tmadlener, 20.08.2017:
676  // define the valid module names for the different "levels", to add a little bit more stability
677  // to the checking compared to just doing some name matching.
678  // Note, that the name matching is not completely remved, since at level 4 and 5 some of the
679  // valid modules are the same, so that the name matching is still needed.
680  // With the current definition this yields the exact same levels as before, but weeds out some
681  // of the "false" positives at level 3 (naming matches also to some HLTMuonL1TFilter modules due to
682  // the 'forIterL3' in the name)
683  const std::string l1Filter = "HLTMuonL1TFilter";
684  const std::string l2Filter = "HLTMuonL2FromL1TPreFilter";
685  const std::vector<std::string> l3Filters = {"HLTMuonDimuonL3Filter", "HLTMuonL3PreFilter"};
686  const std::vector<std::string> l4Filters = {"HLTDisplacedmumuFilter", "HLTDiMuonGlbTrkFilter",
687  "HLTMuonTrackMassFilter"};
688  const std::vector<std::string> l5Filters = {"HLTmumutkFilter", "HLT2MuonMuonDZ", "HLTDisplacedmumuFilter"};
689 
690  if (contains(moduleName, "Filter") && hltConfig.moduleEDMType(moduleName) == "EDFilter") {
691  if (contains(moduleName, "L1") && !contains(moduleName, "ForIterL3") &&
692  hltConfig.moduleType(moduleName) == l1Filter) {
693  return 1;
694  }
695  if (contains(moduleName, "L2") && hltConfig.moduleType(moduleName) == l2Filter) {
696  return 2;
697  }
698  if (contains(moduleName, "L3") && isAnyOf(hltConfig.moduleType(moduleName), l3Filters)) {
699  return 3;
700  }
701  if (containsAny(moduleName, {"DisplacedmumuFilter", "DiMuon", "MuonL3Filtered", "TrackMassFiltered"}) &&
702  isAnyOf(hltConfig.moduleType(moduleName), l4Filters)) {
703  return 4;
704  }
705  if (containsAny(moduleName, {"Vertex", "Dz"}) &&
706  isAnyOf(hltConfig.moduleType(moduleName), l5Filters)) {
707  return 5;
708  }
709  }
710 
711  return -1;
712 }
const std::string moduleType(const std::string &module) const
C++ class name of module.
bool contains(EventRange const &lh, EventID const &rh)
Definition: EventRange.cc:38
const std::string moduleEDMType(const std::string &module) const
C++ base class name of module.
std::string moduleName(Provenance const &provenance)
Definition: Provenance.cc:27
susybsm::MuonSegment ms
Definition: classes.h:31
int HeavyFlavorValidation::getMotherId ( const Candidate p)
private

Definition at line 545 of file HeavyFlavorValidation.cc.

References reco::Candidate::mother(), and reco::Candidate::pdgId().

Referenced by analyze().

545  {
546  const Candidate* mother = p->mother();
547  if( mother ){
548  if( mother->pdgId() == p->pdgId() ){
549  return getMotherId(mother);
550  }else{
551  return mother->pdgId();
552  }
553  }else{
554  return 0;
555  }
556 }
virtual const Candidate * mother(size_type i=0) const =0
return pointer to mother
int getMotherId(const Candidate *p)
virtual int pdgId() const =0
PDG identifier.
void HeavyFlavorValidation::match ( MonitorElement me,
vector< LeafCandidate > &  from,
vector< LeafCandidate > &  to,
double  deltaRMatchingCut,
vector< int > &  map 
)
private

Definition at line 558 of file HeavyFlavorValidation.cc.

References PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR, PVValHelper::eta, MonitorElement::Fill(), mps_fire::i, gen::k, and phi.

Referenced by analyze().

558  {
559  vector<double> dR(from.size());
560  for(size_t i=0; i<from.size(); i++){
561  map[i] = -1;
562  dR[i] = 10.;
563  //find closest
564  for(size_t j=0; j<to.size(); j++){
565  double dRtmp = deltaR<double>(from[i].eta(), from[i].phi(), to[j].eta(), to[j].phi());
566  if( dRtmp < dR[i] ){
567  dR[i] = dRtmp;
568  map[i] = j;
569  }
570  }
571  //fill matching histo
572  if( map[i] != -1 ){
573  me->Fill( to[map[i]].eta()-from[i].eta(), deltaPhi<double>(to[map[i]].phi(), from[i].phi()) );
574  }
575  //apply matching cut
576  if( dR[i] > dRMatchingCut ){
577  map[i] = -1;
578  }
579  //remove duplication
580  if( map[i] != -1 ){
581  for(size_t k=0; k<i; k++){
582  if( map[k] != -1 && map[i] == map[k] ){
583  if( dR[i] < dR[k] ){
584  map[k] = -1;
585  }else{
586  map[i] = -1;
587  }
588  break;
589  }
590  }
591  }
592  }
593 }
void Fill(long long x)
int k[5][pyjets_maxn]
void HeavyFlavorValidation::myBook1D ( DQMStore::IBooker ibooker,
TString  name,
vector< double > &  xBins,
TString  label,
TString  title 
)
private

Definition at line 637 of file HeavyFlavorValidation.cc.

References DQMStore::IBooker::book1D(), h, mps_fire::i, createfilelist::int, and dataset::name.

Referenced by bookHistograms().

638 {
639 // dqmStore->setCurrentFolder(dqmFolder+"/"+folder);
640  int binsN = bins.size()==3 ? (int)bins[0]+1 : bins.size();
641  Double_t *myBins = new Double_t[ binsN ];
642  for(int i=0; i<binsN; i++){
643  myBins[i] = bins.size()==3 ? bins[1] + i*(bins[2]-bins[1])/bins[0] : bins[i] ;
644  }
645  TH1F *h = new TH1F( name, name, binsN-1, myBins );
646  h->SetXTitle(label);
647  h->SetTitle(title);
648  ME[name] = ibooker.book1D( name.Data(), h );
649  delete h;
650 }
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
Definition: ME.h:11
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:118
void HeavyFlavorValidation::myBook1D ( DQMStore::IBooker ibooker,
TString  name,
vector< double > &  xBins,
TString  label 
)
inlineprivate

Definition at line 74 of file HeavyFlavorValidation.cc.

References edm::moduleName(), and AlCaHLTBitMon_QueryRunRegistry::string.

74  {
75  myBook1D(ibooker, name, xBins, label, name );
76  }
void myBook1D(DQMStore::IBooker &ibooker, TString name, vector< double > &xBins, TString label, TString title)
void HeavyFlavorValidation::myBook2D ( DQMStore::IBooker ibooker,
TString  name,
vector< double > &  xBins,
TString  xLabel,
vector< double > &  yBins,
TString  yLabel,
TString  title 
)
private

Definition at line 595 of file HeavyFlavorValidation.cc.

References DQMStore::IBooker::book2D(), PVValHelper::eta, h, mps_fire::i, createfilelist::int, dataset::name, and EnergyCorrector::pt.

Referenced by bookHistograms().

596 {
597 // dqmStore->setCurrentFolder(dqmFolder+"/"+folder);
598  int ptN = ptBins.size()==3 ? (int)ptBins[0]+1 : ptBins.size();
599  Double_t *pt = new Double_t[ ptN ];
600  for(int i=0; i<ptN; i++){
601  pt[i] = ptBins.size()==3 ? ptBins[1] + i*(ptBins[2]-ptBins[1])/ptBins[0] : ptBins[i] ;
602  }
603  int etaN = etaBins.size()==3 ? (int)etaBins[0]+1 : etaBins.size();
604  Double_t *eta = new Double_t[ etaN ];
605  for(int i=0; i<etaN; i++){
606  eta[i] = etaBins.size()==3 ? etaBins[1] + i*(etaBins[2]-etaBins[1])/etaBins[0] : etaBins[i] ;
607  }
608  TH2F *h = new TH2F( name, name, ptN-1, pt, etaN-1, eta );
609  h->SetXTitle(ptLabel);
610  h->SetYTitle(etaLabel);
611  h->SetTitle(title);
612  ME[name] = ibooker.book2D( name.Data(), h );
613  delete h;
614 }
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
Definition: ME.h:11
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:136
void HeavyFlavorValidation::myBook2D ( DQMStore::IBooker ibooker,
TString  name,
vector< double > &  xBins,
TString  xLabel,
vector< double > &  yBins,
TString  yLabel 
)
inlineprivate

Definition at line 66 of file HeavyFlavorValidation.cc.

66  {
67  myBook2D(ibooker, name, xBins, xLabel, yBins, yLabel, name);
68  }
void myBook2D(DQMStore::IBooker &ibooker, TString name, vector< double > &xBins, TString xLabel, vector< double > &yBins, TString yLabel, TString title)
void HeavyFlavorValidation::myBookProfile2D ( DQMStore::IBooker ibooker,
TString  name,
vector< double > &  xBins,
TString  xLabel,
vector< double > &  yBins,
TString  yLabel,
TString  title 
)
private

Definition at line 616 of file HeavyFlavorValidation.cc.

References DQMStore::IBooker::bookProfile2D(), PVValHelper::eta, h, mps_fire::i, createfilelist::int, dataset::name, and EnergyCorrector::pt.

Referenced by bookHistograms().

617 {
618 // dqmStore->setCurrentFolder(dqmFolder+"/"+folder);
619  int ptN = ptBins.size()==3 ? (int)ptBins[0]+1 : ptBins.size();
620  Double_t *pt = new Double_t[ ptN ];
621  for(int i=0; i<ptN; i++){
622  pt[i] = ptBins.size()==3 ? ptBins[1] + i*(ptBins[2]-ptBins[1])/ptBins[0] : ptBins[i] ;
623  }
624  int etaN = etaBins.size()==3 ? (int)etaBins[0]+1 : etaBins.size();
625  Double_t *eta = new Double_t[ etaN ];
626  for(int i=0; i<etaN; i++){
627  eta[i] = etaBins.size()==3 ? etaBins[1] + i*(etaBins[2]-etaBins[1])/etaBins[0] : etaBins[i] ;
628  }
629  TProfile2D *h = new TProfile2D( name, name, ptN-1, pt, etaN-1, eta );
630  h->SetXTitle(ptLabel);
631  h->SetYTitle(etaLabel);
632  h->SetTitle(title);
633  ME[name] = ibooker.bookProfile2D( name.Data(), h );
634  delete h;
635 }
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
Definition: ME.h:11
MonitorElement * bookProfile2D(Args &&...args)
Definition: DQMStore.h:166
void HeavyFlavorValidation::myBookProfile2D ( DQMStore::IBooker ibooker,
TString  name,
vector< double > &  xBins,
TString  xLabel,
vector< double > &  yBins,
TString  yLabel 
)
inlineprivate

Definition at line 70 of file HeavyFlavorValidation.cc.

References diffTwoXMLs::label.

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

Member Data Documentation

vector<double> HeavyFlavorValidation::deltaEtaBins
private

Definition at line 107 of file HeavyFlavorValidation.cc.

Referenced by bookHistograms().

vector<double> HeavyFlavorValidation::deltaPhiBins
private

Definition at line 108 of file HeavyFlavorValidation.cc.

Referenced by bookHistograms().

vector<double> HeavyFlavorValidation::dimuonDRBins
private

Definition at line 114 of file HeavyFlavorValidation.cc.

Referenced by bookHistograms().

vector<double> HeavyFlavorValidation::dimuonEtaBins
private

Definition at line 113 of file HeavyFlavorValidation.cc.

Referenced by bookHistograms().

vector<double> HeavyFlavorValidation::dimuonPtBins
private

Definition at line 112 of file HeavyFlavorValidation.cc.

Referenced by bookHistograms().

string HeavyFlavorValidation::dqmFolder
private

Definition at line 89 of file HeavyFlavorValidation.cc.

Referenced by bookHistograms().

DQMStore* HeavyFlavorValidation::dqmStore
private

Definition at line 115 of file HeavyFlavorValidation.cc.

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

Definition at line 117 of file HeavyFlavorValidation.cc.

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

double HeavyFlavorValidation::genGlobDeltaRMatchingCut
private

Definition at line 103 of file HeavyFlavorValidation.cc.

Referenced by analyze().

InputTag HeavyFlavorValidation::genParticlesTag
private

Definition at line 99 of file HeavyFlavorValidation.cc.

Referenced by analyze(), and HeavyFlavorValidation().

EDGetTokenT<GenParticleCollection> HeavyFlavorValidation::genParticlesToken
private

Definition at line 100 of file HeavyFlavorValidation.cc.

Referenced by analyze(), and HeavyFlavorValidation().

double HeavyFlavorValidation::globL1DeltaRMatchingCut
private

Definition at line 104 of file HeavyFlavorValidation.cc.

Referenced by analyze().

double HeavyFlavorValidation::globL2DeltaRMatchingCut
private

Definition at line 105 of file HeavyFlavorValidation.cc.

Referenced by analyze().

double HeavyFlavorValidation::globL3DeltaRMatchingCut
private

Definition at line 106 of file HeavyFlavorValidation.cc.

Referenced by analyze().

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

Definition at line 116 of file HeavyFlavorValidation.cc.

vector<int> HeavyFlavorValidation::motherIDs
private

Definition at line 102 of file HeavyFlavorValidation.cc.

Referenced by analyze().

vector<double> HeavyFlavorValidation::muonEtaBins
private

Definition at line 110 of file HeavyFlavorValidation.cc.

Referenced by bookHistograms().

const double HeavyFlavorValidation::muonMass
private

Definition at line 118 of file HeavyFlavorValidation.cc.

Referenced by analyze().

vector<double> HeavyFlavorValidation::muonPhiBins
private

Definition at line 111 of file HeavyFlavorValidation.cc.

Referenced by bookHistograms().

vector<double> HeavyFlavorValidation::muonPtBins
private

Definition at line 109 of file HeavyFlavorValidation.cc.

Referenced by bookHistograms().

InputTag HeavyFlavorValidation::recoMuonsTag
private

Definition at line 97 of file HeavyFlavorValidation.cc.

Referenced by analyze(), and HeavyFlavorValidation().

EDGetTokenT<MuonCollection> HeavyFlavorValidation::recoMuonsToken
private

Definition at line 98 of file HeavyFlavorValidation.cc.

Referenced by analyze(), and HeavyFlavorValidation().

string HeavyFlavorValidation::triggerPathName
private

Definition at line 91 of file HeavyFlavorValidation.cc.

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

string HeavyFlavorValidation::triggerProcessName
private
InputTag HeavyFlavorValidation::triggerResultsTag
private

Definition at line 95 of file HeavyFlavorValidation.cc.

Referenced by analyze(), and HeavyFlavorValidation().

EDGetTokenT<TriggerResults> HeavyFlavorValidation::triggerResultsToken
private

Definition at line 96 of file HeavyFlavorValidation.cc.

Referenced by analyze(), and HeavyFlavorValidation().

EDGetTokenT<TriggerEvent> HeavyFlavorValidation::triggerSummaryAODTag
private

Definition at line 94 of file HeavyFlavorValidation.cc.

Referenced by analyze(), and HeavyFlavorValidation().

EDGetTokenT<TriggerEventWithRefs> HeavyFlavorValidation::triggerSummaryRAWTag
private

Definition at line 93 of file HeavyFlavorValidation.cc.

Referenced by analyze(), and HeavyFlavorValidation().