CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes
HLTMuonValidator Class Reference

#include <HLTMuonValidator.h>

Inheritance diagram for HLTMuonValidator:
edm::EDAnalyzer edm::EDAnalyzer edm::EDConsumerBase edm::EDConsumerBase

Classes

struct  matchesByDescendingPt
 
struct  MatchStruct
 

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob ()
 
virtual void beginRun (const edm::Run &, const edm::EventSetup &)
 
 HLTMuonValidator (const edm::ParameterSet &)
 
 HLTMuonValidator (const edm::ParameterSet &)
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &) override
 
void analyzePath (const edm::Event &, const std::string &, const std::string &, const std::vector< MatchStruct > &, edm::Handle< trigger::TriggerEventWithRefs >)
 
virtual void beginJob () override
 
virtual void beginRun (const edm::Run &, const edm::EventSetup &) override
 
void bookHist (std::string, std::string, std::string, std::string)
 
virtual void endJob () override
 
virtual void endRun (const edm::Run &, const edm::EventSetup &) override
 
void findMatches (std::vector< MatchStruct > &, std::vector< l1extra::L1MuonParticleRef >, std::vector< std::vector< const reco::RecoChargedCandidate * > >)
 
void initializeHists ()
 
std::vector< std::string > moduleLabels (std::string)
 
std::vector< std::string > stepLabels (const std::vector< std::string > &)
 

Private Attributes

std::vector< HLTMuonPlotteranalyzers_
 
double cutMaxEta_
 
unsigned int cutMotherId_
 
std::vector< double > cutsDr_
 
std::map< std::string, double > cutsMinPt_
 
DQMStoredbe_
 
std::map< std::string,
MonitorElement * > 
elements_
 
std::map< std::string,
std::vector< std::string > > 
filterLabels_
 
std::string genMuonCut_
 
StringCutObjectSelector
< reco::GenParticle > * 
genMuonSelector_
 
std::string genParticleLabel_
 
HLTConfigProvider hltConfig_
 
std::set< std::string > hltPaths_
 
std::vector< std::string > hltPathsToCheck_
 
std::string hltProcessName_
 
std::string l1CandLabel_
 
L1MuonMatcherAlgo l1Matcher_
 
std::string l2CandLabel_
 
std::string l3CandLabel_
 
boost::tuple< edm::EDGetTokenT
< trigger::TriggerEventWithRefs >
, edm::EDGetTokenT
< reco::GenParticleCollection >
, edm::EDGetTokenT
< reco::MuonCollection > > 
myTokens_
 
std::vector< double > parametersEta_
 
std::vector< double > parametersPhi_
 
std::vector< double > parametersTurnOn_
 
edm::ParameterSet pset_
 
std::string recMuonCut_
 
std::string recMuonLabel_
 
StringCutObjectSelector
< reco::Muon > * 
recMuonSelector_
 
std::map< std::string,
std::vector< std::string > > 
stepLabels_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- 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)
 

Detailed Description

Generate histograms for muon trigger efficiencies Documentation available on the CMS TWiki: https://twiki.cern.ch/twiki/bin/view/CMS/MuonHLTOfflinePerformance

Author
J. Klukas, M. Vander Donckt, J. Alcaraz

Definition at line 58 of file HLTMuonValidator.h.

Constructor & Destructor Documentation

HLTMuonValidator::HLTMuonValidator ( const edm::ParameterSet pset)

Definition at line 96 of file HLTMuonValidator.cc.

References edm::EDConsumerBase::consumesCollector(), HLTMuonPlotter::getTokens(), myTokens_, and pset_.

96  :
97  pset_(pset),
98  hltProcessName_(pset.getParameter<string>("hltProcessName")),
99  hltPathsToCheck_(pset.getParameter<vstring>("hltPathsToCheck"))
100 {
101 
103 
104 }
T getParameter(std::string const &) const
vector< string > vstring
Definition: ExoticaDQM.cc:75
edm::ParameterSet pset_
boost::tuple< edm::EDGetTokenT< trigger::TriggerEventWithRefs >, edm::EDGetTokenT< reco::GenParticleCollection >, edm::EDGetTokenT< reco::MuonCollection > > myTokens_
static boost::tuple< edm::EDGetTokenT< trigger::TriggerEventWithRefs >, edm::EDGetTokenT< reco::GenParticleCollection >, edm::EDGetTokenT< reco::MuonCollection > > getTokens(const edm::ParameterSet &, edm::ConsumesCollector &&)
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
std::string hltProcessName_
std::vector< std::string > hltPathsToCheck_
HLTMuonValidator::HLTMuonValidator ( const edm::ParameterSet )
explicit

Member Function Documentation

virtual void HLTMuonValidator::analyze ( const edm::Event ,
const edm::EventSetup  
)
overrideprivatevirtual

Implements edm::EDAnalyzer.

void HLTMuonValidator::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Implements edm::EDAnalyzer.

Definition at line 198 of file HLTMuonValidator.cc.

References analyzers_.

200 {
201 
202  vector<HLTMuonPlotter>::iterator iter;
203  for (iter = analyzers_.begin(); iter != analyzers_.end(); ++iter) {
204  iter->analyze(iEvent, iSetup);
205  }
206 
207 }
std::vector< HLTMuonPlotter > analyzers_
void HLTMuonValidator::analyzePath ( const edm::Event ,
const std::string &  ,
const std::string &  ,
const std::vector< MatchStruct > &  ,
edm::Handle< trigger::TriggerEventWithRefs  
)
private
virtual void HLTMuonValidator::beginJob ( )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

void HLTMuonValidator::beginJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 212 of file HLTMuonValidator.cc.

213 {
214 }
virtual void HLTMuonValidator::beginRun ( const edm::Run ,
const edm::EventSetup  
)
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

void HLTMuonValidator::beginRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 151 of file HLTMuonValidator.cc.

References analyzers_, hltConfig_, CreateSqliteForCondDB_cfg::hltPaths, hltPathsToCheck_, hltProcessName_, i, HLTConfigProvider::init(), j, tablePrinter::labels, moduleLabels(), myTokens_, getHLTPrescaleColumns::path, listBenchmarks::pattern, pset_, stepLabels(), relval_steps::steps, and HLTConfigProvider::triggerNames().

153 {
154  // Initialize hltConfig
155  bool changedConfig;
156  if (!hltConfig_.init(iRun, iSetup, hltProcessName_, changedConfig)) {
157  LogError("HLTMuonVal") << "Initialization of HLTConfigProvider failed!!";
158  return;
159  }
160 
161  // Get the set of trigger paths we want to make plots for
162  set<string> hltPaths;
163  for (size_t i = 0; i < hltPathsToCheck_.size(); i++) {
164  TPRegexp pattern(hltPathsToCheck_[i]);
165  for (size_t j = 0; j < hltConfig_.triggerNames().size(); j++)
166  if (TString(hltConfig_.triggerNames()[j]).Contains(pattern))
167  hltPaths.insert(hltConfig_.triggerNames()[j]);
168  }
169 
170  // Initialize the analyzers
171  analyzers_.clear();
172  set<string>::iterator iPath;
173  for (iPath = hltPaths.begin(); iPath != hltPaths.end(); iPath++) {
174 
175  string path = * iPath;
176  string shortpath = path;
177  if (path.rfind("_v") < path.length())
178  shortpath = path.substr(0, path.rfind("_v"));
179 
180  vector<string> labels = moduleLabels(path);
181  vector<string> steps = stepLabels(labels);
182 
183  if (labels.size() > 0 && steps.size() > 0) {
184  HLTMuonPlotter analyzer(pset_, shortpath, labels, steps, myTokens_);
185  analyzers_.push_back(analyzer);
186  }
187  }
188 
189  // Call the beginRun (which books all the histograms)
190  vector<HLTMuonPlotter>::iterator iter;
191  for (iter = analyzers_.begin(); iter != analyzers_.end(); ++iter) {
192  iter->beginRun(iRun, iSetup);
193  }
194 
195 }
int i
Definition: DBlmapReader.cc:9
std::vector< std::string > stepLabels(const std::vector< std::string > &)
const std::vector< std::string > & triggerNames() const
names of trigger paths
std::vector< HLTMuonPlotter > analyzers_
edm::ParameterSet pset_
boost::tuple< edm::EDGetTokenT< trigger::TriggerEventWithRefs >, edm::EDGetTokenT< reco::GenParticleCollection >, edm::EDGetTokenT< reco::MuonCollection > > myTokens_
int j
Definition: DBlmapReader.cc:9
std::vector< std::string > moduleLabels(std::string)
HLTConfigProvider hltConfig_
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor
std::string hltProcessName_
std::vector< std::string > hltPathsToCheck_
void HLTMuonValidator::bookHist ( std::string  ,
std::string  ,
std::string  ,
std::string   
)
private
void HLTMuonValidator::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 233 of file HLTMuonValidator.cc.

234 {
235 }
void HLTMuonValidator::endRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 219 of file HLTMuonValidator.cc.

221 {
222 
223  // vector<HLTMuonPlotter>::iterator iter;
224  // for (iter = analyzers_.begin(); iter != analyzers_.end(); ++iter) {
225  // iter->endRun(iRun, iSetup);
226  // }
227 
228 }
void HLTMuonValidator::findMatches ( std::vector< MatchStruct > &  ,
std::vector< l1extra::L1MuonParticleRef ,
std::vector< std::vector< const reco::RecoChargedCandidate * > >   
)
private
void HLTMuonValidator::initializeHists ( )
private
vector< string > HLTMuonValidator::moduleLabels ( std::string  )
private

Definition at line 109 of file HLTMuonValidator.cc.

References hltConfig_, and HLTConfigProvider::moduleLabels().

Referenced by beginRun().

109  {
110 
111  vector<string> modules = hltConfig_.moduleLabels(path);
112  vector<string>::iterator iter = modules.begin();
113 
114  while (iter != modules.end())
115  if (iter->find("Filtered") == string::npos)
116  iter = modules.erase(iter);
117  else
118  ++iter;
119 
120  return modules;
121 
122 }
const std::vector< std::string > & moduleLabels(unsigned int trigger) const
label(s) of module(s) on a trigger path
HLTConfigProvider hltConfig_
vector< string > HLTMuonValidator::stepLabels ( const std::vector< std::string > &  )
private

Definition at line 125 of file HLTMuonValidator.cc.

References spr::find(), i, and relval_steps::steps.

Referenced by beginRun().

125  {
126  vector<string> steps(1, "All");
127  for (size_t i = 0; i < modules.size(); i++) {
128  if (modules[i].find("IsoFiltered") != string::npos) {
129  if (modules[i].find("L3") != string::npos)
130  steps.push_back("L3Iso");
131  else
132  steps.push_back("L2Iso");
133  }
134  else if (modules[i].find("L3") != string::npos)
135  steps.push_back("L3");
136  else if (modules[i].find("L2") != string::npos)
137  steps.push_back("L2");
138  else if (modules[i].find("L1") != string::npos)
139  steps.push_back("L1");
140  else
141  return vector<string>();
142  }
143  if (steps.size() < 2 || steps[1] != "L1")
144  return vector<string>();
145  return steps;
146 
147 }
int i
Definition: DBlmapReader.cc:9
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7

Member Data Documentation

std::vector<HLTMuonPlotter> HLTMuonValidator::analyzers_
private
double HLTMuonValidator::cutMaxEta_
private

Definition at line 123 of file HLTMuonValidator.h.

unsigned int HLTMuonValidator::cutMotherId_
private

Definition at line 124 of file HLTMuonValidator.h.

std::vector<double> HLTMuonValidator::cutsDr_
private

Definition at line 125 of file HLTMuonValidator.h.

std::map<std::string, double> HLTMuonValidator::cutsMinPt_
private

Definition at line 121 of file HLTMuonValidator.h.

DQMStore * HLTMuonValidator::dbe_
private

Definition at line 136 of file HLTMuonValidator.h.

std::map<std::string, MonitorElement *> HLTMuonValidator::elements_
private

Definition at line 137 of file HLTMuonValidator.h.

std::map<std::string, std::vector<std::string> > HLTMuonValidator::filterLabels_
private

Definition at line 109 of file HLTMuonValidator.h.

std::string HLTMuonValidator::genMuonCut_
private

Definition at line 126 of file HLTMuonValidator.h.

StringCutObjectSelector<reco::GenParticle>* HLTMuonValidator::genMuonSelector_
private

Definition at line 129 of file HLTMuonValidator.h.

std::string HLTMuonValidator::genParticleLabel_
private

Definition at line 111 of file HLTMuonValidator.h.

HLTConfigProvider HLTMuonValidator::hltConfig_
private

Definition at line 132 of file HLTMuonValidator.h.

Referenced by beginRun(), and moduleLabels().

std::set<std::string> HLTMuonValidator::hltPaths_
private

Definition at line 108 of file HLTMuonValidator.h.

std::vector< std::string > HLTMuonValidator::hltPathsToCheck_
private

Definition at line 107 of file HLTMuonValidator.h.

Referenced by beginRun().

std::string HLTMuonValidator::hltProcessName_
private

Definition at line 105 of file HLTMuonValidator.h.

Referenced by beginRun().

std::string HLTMuonValidator::l1CandLabel_
private

Definition at line 113 of file HLTMuonValidator.h.

L1MuonMatcherAlgo HLTMuonValidator::l1Matcher_
private

Definition at line 134 of file HLTMuonValidator.h.

std::string HLTMuonValidator::l2CandLabel_
private

Definition at line 114 of file HLTMuonValidator.h.

std::string HLTMuonValidator::l3CandLabel_
private

Definition at line 115 of file HLTMuonValidator.h.

Definition at line 72 of file HLTMuonValidator.cc.

Referenced by beginRun(), and HLTMuonValidator().

std::vector<double> HLTMuonValidator::parametersEta_
private

Definition at line 117 of file HLTMuonValidator.h.

std::vector<double> HLTMuonValidator::parametersPhi_
private

Definition at line 118 of file HLTMuonValidator.h.

std::vector<double> HLTMuonValidator::parametersTurnOn_
private

Definition at line 119 of file HLTMuonValidator.h.

edm::ParameterSet HLTMuonValidator::pset_
private

Definition at line 62 of file HLTMuonValidator.cc.

Referenced by beginRun(), and HLTMuonValidator().

std::string HLTMuonValidator::recMuonCut_
private

Definition at line 127 of file HLTMuonValidator.h.

std::string HLTMuonValidator::recMuonLabel_
private

Definition at line 112 of file HLTMuonValidator.h.

StringCutObjectSelector<reco::Muon >* HLTMuonValidator::recMuonSelector_
private

Definition at line 130 of file HLTMuonValidator.h.

std::map<std::string, std::vector<std::string> > HLTMuonValidator::stepLabels_
private

Definition at line 138 of file HLTMuonValidator.h.