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:
DQMEDAnalyzer edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > > edm::stream::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 HeavyFlavorValidation (const edm::ParameterSet &)
 
 ~HeavyFlavorValidation ()
 
- Public Member Functions inherited from DQMEDAnalyzer
virtual void beginRun (edm::Run const &, edm::EventSetup const &) final
 
virtual void beginStream (edm::StreamID id) final
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer (void)
 
virtual void endLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
virtual void endRunSummary (edm::Run const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
uint32_t streamId () const
 
- Public Member Functions inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
 EDAnalyzer ()=default
 
- Public Member Functions inherited from edm::stream::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDAnalyzerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Protected Member Functions

virtual 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
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Private Member Functions

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
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDAnalyzerBase
typedef EDAnalyzerAdaptorBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from DQMEDAnalyzer
static std::shared_ptr< dqmDetails::NoCacheglobalBeginLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *)
 
static std::shared_ptr< dqmDetails::NoCacheglobalBeginRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *)
 
static void globalEndLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *, dqmDetails::NoCache *)
 
static void globalEndRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *, dqmDetails::NoCache *)
 
- Static Public Member Functions inherited from edm::stream::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

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

Constructor & Destructor Documentation

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

Definition at line 108 of file HeavyFlavorValidation.cc.

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

108  :
109 //get parameters
110  dqmFolder(pset.getUntrackedParameter<string>("DQMFolder")),
111  triggerProcessName(pset.getUntrackedParameter<string>("TriggerProcessName")),
112  triggerPathName(pset.getUntrackedParameter<string>("TriggerPathName")),
113  motherIDs(pset.getUntrackedParameter<vector<int> >("MotherIDs")),
114  genGlobDeltaRMatchingCut(pset.getUntrackedParameter<double>("GenGlobDeltaRMatchingCut")),
115  globL1DeltaRMatchingCut(pset.getUntrackedParameter<double>("GlobL1DeltaRMatchingCut")),
116  globL2DeltaRMatchingCut(pset.getUntrackedParameter<double>("GlobL2DeltaRMatchingCut")),
117  globL3DeltaRMatchingCut(pset.getUntrackedParameter<double>("GlobL3DeltaRMatchingCut")),
118  deltaEtaBins(pset.getUntrackedParameter<vector<double> >("DeltaEtaBins")),
119  deltaPhiBins(pset.getUntrackedParameter<vector<double> >("DeltaPhiBins")),
120  muonPtBins(pset.getUntrackedParameter<vector<double> >("MuonPtBins")),
121  muonEtaBins(pset.getUntrackedParameter<vector<double> >("MuonEtaBins")),
122  muonPhiBins(pset.getUntrackedParameter<vector<double> >("MuonPhiBins")),
123  dimuonPtBins(pset.getUntrackedParameter<vector<double> >("DimuonPtBins")),
124  dimuonEtaBins(pset.getUntrackedParameter<vector<double> >("DimuonEtaBins")),
125  dimuonDRBins(pset.getUntrackedParameter<vector<double> >("DimuonDRBins")),
126  muonMass(0.106)
127 {
128  triggerSummaryRAWTag = consumes<TriggerEventWithRefs>(InputTag( pset.getUntrackedParameter<string>("TriggerSummaryRAW"), "", triggerProcessName));
129  triggerSummaryAODTag = consumes<TriggerEvent>(InputTag( pset.getUntrackedParameter<string>("TriggerSummaryAOD"), "", triggerProcessName));
130  triggerResultsTag = InputTag( pset.getUntrackedParameter<string>("TriggerResults"), "", triggerProcessName);
131  triggerResultsToken = consumes<TriggerResults>(triggerResultsTag);
132  recoMuonsTag = pset.getParameter<InputTag>("RecoMuons");
133  recoMuonsToken = consumes<MuonCollection>(recoMuonsTag);
134  genParticlesTag = pset.getParameter<InputTag>("GenParticles");
135  genParticlesToken = consumes<GenParticleCollection>(genParticlesTag);
136 }
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 ( )

Definition at line 652 of file HeavyFlavorValidation.cc.

References DEFINE_FWK_MODULE.

652  {
653 }

Member Function Documentation

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

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, diffTreeTool::index, 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.size()==0){
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:460
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
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const override
Definition: Event.cc:239
void HeavyFlavorValidation::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  iRun,
edm::EventSetup const &  iSetup 
)
overrideprotectedvirtual

Implements DQMEDAnalyzer.

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)
void cd(void)
Definition: DQMStore.cc:269
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:277
void HeavyFlavorValidation::dqmBeginRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)
overrideprotected

Definition at line 138 of file HeavyFlavorValidation.cc.

References filterNamesLevels, mps_fire::i, HLTConfigProvider::init(), hcalDigis_cfi::level, LogDebug, HLTConfigProvider::moduleEDMType(), HLTConfigProvider::moduleLabels(), dataset::name, HLTConfigProvider::triggerNames(), triggerPathName, and triggerProcessName.

138  {
139  //discover HLT configuration
140  HLTConfigProvider hltConfig;
141  bool isChanged;
142  if(hltConfig.init(iRun, iSetup, triggerProcessName, isChanged)){
143  LogDebug("HLTriggerOfflineHeavyFlavor") << "Successfully initialized HLTConfigProvider with process name: "<<triggerProcessName<<endl;
144  }else{
145  LogWarning("HLTriggerOfflineHeavyFlavor") << "Could not initialize HLTConfigProvider with process name: "<<triggerProcessName<<endl;
146  return;
147  }
148  stringstream os;
149  vector<string> triggerNames = hltConfig.triggerNames();
150  for( size_t i = 0; i < triggerNames.size(); i++) {
151  TString triggerName = triggerNames[i];
152  if (triggerName.Contains(triggerPathName)){
153  vector<string> moduleNames = hltConfig.moduleLabels( triggerNames[i] );
154  for( size_t j = 0; j < moduleNames.size(); j++) {
155  TString name = moduleNames[j];
156  // MK 2016-12-09: added requirement for the module EDM type to be
157  // EDFilter, as without it the name check can match also any EDProducer
158  // (and would be fragile; ok I think it is still fragile, but the added
159  // check allows PR #16792 to go forward)
160  if(name.Contains("Filter") && hltConfig.moduleEDMType(moduleNames[j]) == "EDFilter"){
161  int level = 0;
162  if(name.Contains("L1"))
163  level = 1;
164  if(name.Contains("L2"))
165  level = 2;
166  if(name.Contains("L3"))
167  level = 3;
168  if(name.Contains("mumuFilter") || name.Contains("DiMuon") || name.Contains("MuonL3Filtered") || name.Contains("TrackMassFiltered"))
169  level = 4;
170  if(name.Contains("Vertex") || name.Contains("Dz"))
171  level = 5;
172  filterNamesLevels.push_back( pair<string,int>(moduleNames[j],level) );
173  os<<" "<<moduleNames[j];
174  }
175  }
176  break;
177  }
178  }
179  if(filterNamesLevels.size()==0){
180  LogDebug("HLTriggerOfflineHeavyFlavor")<<"Bad Trigger Path: "<<triggerPathName<<endl;
181  return;
182  }else{
183  LogDebug("HLTriggerOfflineHeavyFlavor")<<"Trigger Path: "<<triggerPathName<<" has filters:"<<os.str();
184  }
185 }
#define LogDebug(id)
const std::vector< std::string > & triggerNames() const
names of trigger paths
vector< pair< string, int > > filterNamesLevels
const std::string moduleEDMType(const std::string &module) const
C++ base class name of module.
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
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:115
void HeavyFlavorValidation::myBook1D ( DQMStore::IBooker ibooker,
TString  name,
vector< double > &  xBins,
TString  label 
)
inlineprivate

Definition at line 73 of file HeavyFlavorValidation.cc.

73  {
74  myBook1D(ibooker, name, xBins, label, name );
75  }
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:133
void HeavyFlavorValidation::myBook2D ( DQMStore::IBooker ibooker,
TString  name,
vector< double > &  xBins,
TString  xLabel,
vector< double > &  yBins,
TString  yLabel 
)
inlineprivate

Definition at line 65 of file HeavyFlavorValidation.cc.

65  {
66  myBook2D(ibooker, name, xBins, xLabel, yBins, yLabel, name);
67  }
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:163
void HeavyFlavorValidation::myBookProfile2D ( DQMStore::IBooker ibooker,
TString  name,
vector< double > &  xBins,
TString  xLabel,
vector< double > &  yBins,
TString  yLabel 
)
inlineprivate

Definition at line 69 of file HeavyFlavorValidation.cc.

References diffTwoXMLs::label.

69  {
70  myBookProfile2D(ibooker, name, xBins, xLabel, yBins, yLabel, name);
71  }
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 94 of file HeavyFlavorValidation.cc.

Referenced by bookHistograms().

vector<double> HeavyFlavorValidation::deltaPhiBins
private

Definition at line 95 of file HeavyFlavorValidation.cc.

Referenced by bookHistograms().

vector<double> HeavyFlavorValidation::dimuonDRBins
private

Definition at line 101 of file HeavyFlavorValidation.cc.

Referenced by bookHistograms().

vector<double> HeavyFlavorValidation::dimuonEtaBins
private

Definition at line 100 of file HeavyFlavorValidation.cc.

Referenced by bookHistograms().

vector<double> HeavyFlavorValidation::dimuonPtBins
private

Definition at line 99 of file HeavyFlavorValidation.cc.

Referenced by bookHistograms().

string HeavyFlavorValidation::dqmFolder
private

Definition at line 76 of file HeavyFlavorValidation.cc.

Referenced by bookHistograms().

DQMStore* HeavyFlavorValidation::dqmStore
private

Definition at line 102 of file HeavyFlavorValidation.cc.

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

Definition at line 104 of file HeavyFlavorValidation.cc.

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

double HeavyFlavorValidation::genGlobDeltaRMatchingCut
private

Definition at line 90 of file HeavyFlavorValidation.cc.

Referenced by analyze().

InputTag HeavyFlavorValidation::genParticlesTag
private

Definition at line 86 of file HeavyFlavorValidation.cc.

Referenced by analyze(), and HeavyFlavorValidation().

EDGetTokenT<GenParticleCollection> HeavyFlavorValidation::genParticlesToken
private

Definition at line 87 of file HeavyFlavorValidation.cc.

Referenced by analyze(), and HeavyFlavorValidation().

double HeavyFlavorValidation::globL1DeltaRMatchingCut
private

Definition at line 91 of file HeavyFlavorValidation.cc.

Referenced by analyze().

double HeavyFlavorValidation::globL2DeltaRMatchingCut
private

Definition at line 92 of file HeavyFlavorValidation.cc.

Referenced by analyze().

double HeavyFlavorValidation::globL3DeltaRMatchingCut
private

Definition at line 93 of file HeavyFlavorValidation.cc.

Referenced by analyze().

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

Definition at line 103 of file HeavyFlavorValidation.cc.

vector<int> HeavyFlavorValidation::motherIDs
private

Definition at line 89 of file HeavyFlavorValidation.cc.

Referenced by analyze().

vector<double> HeavyFlavorValidation::muonEtaBins
private

Definition at line 97 of file HeavyFlavorValidation.cc.

Referenced by bookHistograms().

const double HeavyFlavorValidation::muonMass
private

Definition at line 105 of file HeavyFlavorValidation.cc.

Referenced by analyze().

vector<double> HeavyFlavorValidation::muonPhiBins
private

Definition at line 98 of file HeavyFlavorValidation.cc.

Referenced by bookHistograms().

vector<double> HeavyFlavorValidation::muonPtBins
private

Definition at line 96 of file HeavyFlavorValidation.cc.

Referenced by bookHistograms().

InputTag HeavyFlavorValidation::recoMuonsTag
private

Definition at line 84 of file HeavyFlavorValidation.cc.

Referenced by analyze(), and HeavyFlavorValidation().

EDGetTokenT<MuonCollection> HeavyFlavorValidation::recoMuonsToken
private

Definition at line 85 of file HeavyFlavorValidation.cc.

Referenced by analyze(), and HeavyFlavorValidation().

string HeavyFlavorValidation::triggerPathName
private

Definition at line 78 of file HeavyFlavorValidation.cc.

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

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

Definition at line 82 of file HeavyFlavorValidation.cc.

Referenced by analyze(), and HeavyFlavorValidation().

EDGetTokenT<TriggerResults> HeavyFlavorValidation::triggerResultsToken
private

Definition at line 83 of file HeavyFlavorValidation.cc.

Referenced by analyze(), and HeavyFlavorValidation().

EDGetTokenT<TriggerEvent> HeavyFlavorValidation::triggerSummaryAODTag
private

Definition at line 81 of file HeavyFlavorValidation.cc.

Referenced by analyze(), and HeavyFlavorValidation().

EDGetTokenT<TriggerEventWithRefs> HeavyFlavorValidation::triggerSummaryRAWTag
private

Definition at line 80 of file HeavyFlavorValidation.cc.

Referenced by analyze(), and HeavyFlavorValidation().