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

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 &)
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Member Functions

void analyzePath (const edm::Event &, const std::string &, const std::string &, const std::vector< MatchStruct >, edm::Handle< trigger::TriggerEventWithRefs >)
 
void bookHist (std::string, std::string, std::string, std::string)
 
void findMatches (std::vector< MatchStruct > &, std::vector< l1extra::L1MuonParticleRef >, std::vector< std::vector< const reco::RecoChargedCandidate * > >)
 
void initializeHists ()
 

Private Attributes

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_
 
std::vector< double > parametersEta_
 
std::vector< double > parametersPhi_
 
std::vector< double > parametersTurnOn_
 
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
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Detailed Description

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

Date:
2010/11/04 12:56:32
Revision:
1.11
Author
J. Klukas, M. Vander Donckt, J. Alcaraz

Definition at line 60 of file HLTMuonValidator.h.

Constructor & Destructor Documentation

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

Definition at line 37 of file HLTMuonValidator.cc.

References cutsDr_, dbe_, genMuonCut_, genMuonSelector_, genParticleLabel_, edm::ParameterSet::getParameter(), hltPathsToCheck_, hltProcessName_, l1CandLabel_, l2CandLabel_, l3CandLabel_, cmsCodeRules.cppFunctionSkipper::operator, parametersEta_, parametersPhi_, parametersTurnOn_, recMuonCut_, recMuonLabel_, recMuonSelector_, and DQMStore::setVerbose().

37  :
38  l1Matcher_(pset)
39 {
40 
41  hltProcessName_ = pset.getParameter< string >("hltProcessName");
42  hltPathsToCheck_ = pset.getParameter< vector<string> >("hltPathsToCheck");
43 
44  genParticleLabel_ = pset.getParameter<string>("genParticleLabel");
45  recMuonLabel_ = pset.getParameter<string>( "recMuonLabel");
46  l1CandLabel_ = pset.getParameter<string>( "l1CandLabel");
47  l2CandLabel_ = pset.getParameter<string>( "l2CandLabel");
48  l3CandLabel_ = pset.getParameter<string>( "l3CandLabel");
49 
50  cutsDr_ = pset.getParameter< vector<double> >("cutsDr" );
51 
52  parametersEta_ = pset.getParameter< vector<double> >("parametersEta");
53  parametersPhi_ = pset.getParameter< vector<double> >("parametersPhi");
54  parametersTurnOn_ = pset.getParameter< vector<double> >("parametersTurnOn");
55 
56  genMuonCut_ = pset.getParameter<string>("genMuonCut");
57  recMuonCut_ = pset.getParameter<string>("recMuonCut");
58 
59  genMuonSelector_ = 0;
60  recMuonSelector_ = 0;
61 
63  dbe_->setVerbose(0);
64 
65 }
T getParameter(std::string const &) const
std::string recMuonLabel_
std::vector< double > cutsDr_
std::string l2CandLabel_
std::vector< std::string > hltPathsToCheck_
StringCutObjectSelector< reco::GenParticle > * genMuonSelector_
std::vector< double > parametersPhi_
L1MuonMatcherAlgo l1Matcher_
void setVerbose(unsigned level)
Definition: DQMStore.cc:196
StringCutObjectSelector< reco::Muon > * recMuonSelector_
std::string l3CandLabel_
std::string recMuonCut_
std::string genParticleLabel_
std::vector< double > parametersTurnOn_
std::string genMuonCut_
std::string hltProcessName_
std::vector< double > parametersEta_
std::string l1CandLabel_

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 212 of file HLTMuonValidator.cc.

References analyzePath(), edm::HandleBase::failedToGet(), genMuonCut_, genMuonSelector_, genParticleLabel_, genParticleCandidates2GenParticles_cfi::genParticles, edm::Event::getByLabel(), hltPaths_, i, edm::HandleBase::isValid(), LogTrace, recMuonCut_, recMuonLabel_, recMuonSelector_, python.multivaluedict::sort(), and LaserTracksInput_cfi::source.

213 {
214 
215  static int eventNumber = 0;
216  eventNumber++;
217  LogTrace("HLTMuonVal") << "In HLTMuonValidator::analyze, "
218  << "Event: " << eventNumber;
219 
220  Handle< TriggerEventWithRefs> rawTriggerEvent;
221  Handle< MuonCollection> recMuons;
223 
224  iEvent.getByLabel("hltTriggerSummaryRAW", rawTriggerEvent);
225  if (rawTriggerEvent.failedToGet())
226  {LogError("HLTMuonVal") << "No trigger summary found"; return;}
227  iEvent.getByLabel( recMuonLabel_, recMuons );
228  iEvent.getByLabel(genParticleLabel_, genParticles );
229 
230  vector<string> sources;
231  if (genParticles.isValid()) sources.push_back("gen");
232  if ( recMuons.isValid()) sources.push_back("rec");
233 
234  for (size_t sourceNo = 0; sourceNo < sources.size(); sourceNo++) {
235 
236  string source = sources[sourceNo];
237 
238  // If this is the first event, initialize selectors
243 
244  // Make each good gen/rec muon into the base cand for a MatchStruct
245  vector<MatchStruct> matches;
246  if (source == "gen" && genParticles.isValid())
247  for (size_t i = 0; i < genParticles->size(); i++)
248  if ((*genMuonSelector_)(genParticles->at(i)))
249  matches.push_back(MatchStruct(& genParticles->at(i)));
250  if (source == "rec" && recMuons.isValid())
251  for (size_t i = 0; i < recMuons->size(); i++)
252  if ((*recMuonSelector_)(recMuons->at(i)))
253  matches.push_back(MatchStruct(& recMuons->at(i)));
254 
255  // Sort the MatchStructs by pT for later filling of turn-on curve
256  sort(matches.begin(), matches.end(), matchesByDescendingPt());
257 
258  set<string>::iterator iPath;
259  for (iPath = hltPaths_.begin(); iPath != hltPaths_.end(); iPath++)
260  analyzePath(iEvent, * iPath, source, matches, rawTriggerEvent);
261 
262  } // End loop over sources
263 
264 }
int i
Definition: DBlmapReader.cc:9
std::string recMuonLabel_
std::set< std::string > hltPaths_
StringCutObjectSelector< reco::GenParticle > * genMuonSelector_
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:355
#define LogTrace(id)
StringCutObjectSelector< reco::Muon > * recMuonSelector_
bool failedToGet() const
Definition: HandleBase.h:80
std::string recMuonCut_
std::string genParticleLabel_
std::string genMuonCut_
void analyzePath(const edm::Event &, const std::string &, const std::string &, const std::vector< MatchStruct >, edm::Handle< trigger::TriggerEventWithRefs >)
void HLTMuonValidator::analyzePath ( const edm::Event ,
const std::string &  ,
const std::string &  ,
const std::vector< MatchStruct ,
edm::Handle< trigger::TriggerEventWithRefs  
)
private

Definition at line 269 of file HLTMuonValidator.cc.

References prof2calltree::count, cutsMinPt_, elements_, eta(), HcalObjRepresent::Fill(), filterLabels_, findMatches(), edm::Event::getByLabel(), hltProcessName_, i, edm::HandleBase::isValid(), j, l2CandLabel_, l3CandLabel_, testEve_cfg::level, LogTrace, maxEta, path(), phi, findQualityFiles::size, launcher::step, stepLabels_, GlobalPosition_Frontier_DevDB_cff::tag, trigger::TriggerL1Mu, and trigger::TriggerMuon.

Referenced by analyze().

274 {
275 
276  const bool skipFilters = (path == "NoFilters");
277 
278  const float maxEta = elements_[path + "_" + "CutMaxEta"]->getFloatValue();
279  const bool isDoubleMuonPath = (path.find("Double") != string::npos);
280  const size_t nFilters = filterLabels_[path].size();
281  const size_t nSteps = stepLabels_[path].size();
282  const size_t nStepsHlt = nSteps - 2;
283  const int nObjectsToPassPath = (isDoubleMuonPath) ? 2 : 1;
284  vector< L1MuonParticleRef > candsL1;
285  vector< vector< RecoChargedCandidateRef > > refsHlt(nStepsHlt);
286  vector< vector< const RecoChargedCandidate * > > candsHlt(nStepsHlt);
287 
288  for (size_t i = 0; i < nFilters; i++) {
289  const int hltStep = i - 1;
291  size_t iFilter = rawTriggerEvent->filterIndex(tag);
292  if (iFilter < rawTriggerEvent->size()) {
293  if (i == 0)
294  rawTriggerEvent->getObjects(iFilter, TriggerL1Mu, candsL1);
295  else
296  rawTriggerEvent->getObjects(iFilter, TriggerMuon,
297  refsHlt[hltStep]);
298  }
299  else if (!skipFilters)
300  LogTrace("HLTMuonVal") << "No collection with label " << tag;
301  }
302  if (skipFilters) {
305  iEvent.getByLabel(l2CandLabel_, handleCandsL2);
306  iEvent.getByLabel(l3CandLabel_, handleCandsL3);
307  if (handleCandsL2.isValid())
308  for (size_t i = 0; i < handleCandsL2->size(); i++)
309  candsHlt[0].push_back(& handleCandsL2->at(i));
310  if (handleCandsL3.isValid())
311  for (size_t i = 0; i < handleCandsL3->size(); i++)
312  candsHlt[1].push_back(& handleCandsL3->at(i));
313  }
314  else for (size_t i = 0; i < nStepsHlt; i++)
315  for (size_t j = 0; j < refsHlt[i].size(); j++)
316  if (refsHlt[i][j].isAvailable()) {
317  candsHlt[i].push_back(& * refsHlt[i][j]);
318  } else {
319  LogWarning("HLTMuonValidator")
320  << "Ref refsHlt[i][j]: product not available "
321  << i << " " << j;
322  }
323 
324  // Add trigger objects to the MatchStructs
325  findMatches(matches, candsL1, candsHlt);
326 
327  vector<size_t> matchesInEtaRange;
328  vector<bool> hasMatch(matches.size(), true);
329 
330  for (size_t step = 0; step < nSteps; step++) {
331 
332  const size_t hltStep = (step >= 2) ? step - 2 : 0;
333  const size_t level = (step == 1) ? 1 :
334  (step == 2) ? 2 :
335  (step == 3) ? ((nStepsHlt == 4) ? 2 : 3) :
336  (step >= 4) ? 3 :
337  0; // default value when step == 0
338 
339  for (size_t j = 0; j < matches.size(); j++) {
340  if (level == 0) {
341  if (fabs(matches[j].candBase->eta()) < maxEta)
342  matchesInEtaRange.push_back(j);
343  }
344  else if (level == 1) {
345  if (matches[j].candL1 == 0)
346  hasMatch[j] = false;
347  }
348  else if (level >= 2) {
349  if (matches[j].candHlt[hltStep] == 0)
350  hasMatch[j] = false;
351  else if (!hasMatch[j]) {
352  LogTrace("HLTMuonVal") << "Match found for HLT step " << hltStep
353  << " of " << nStepsHlt
354  << " without previous match!";
355  break;
356  }
357  }
358  }
359 
360  if (std::count(hasMatch.begin(), hasMatch.end(), true) <
361  nObjectsToPassPath)
362  break;
363 
364  string pre = path + "_" + source + "Pass";
365  string post = "_" + stepLabels_[path][step];
366 
367  for (size_t j = 0; j < matches.size(); j++) {
368  float pt = matches[j].candBase->pt();
369  float eta = matches[j].candBase->eta();
370  float phi = matches[j].candBase->phi();
371  if (hasMatch[j]) {
372  if (matchesInEtaRange.size() >= 1 && j == matchesInEtaRange[0])
373  elements_[pre + "MaxPt1" + post]->Fill(pt);
374  if (matchesInEtaRange.size() >= 2 && j == matchesInEtaRange[1])
375  elements_[pre + "MaxPt2" + post]->Fill(pt);
376  if (pt > cutsMinPt_[path]) {
377  elements_[pre + "Eta" + post]->Fill(eta);
378  if (fabs(eta) < maxEta)
379  elements_[pre + "Phi" + post]->Fill(phi);
380  }
381  }
382  }
383 
384  }
385 
386 }
int i
Definition: DBlmapReader.cc:9
std::map< std::string, std::vector< std::string > > stepLabels_
list step
Definition: launcher.py:15
enum start value shifted to 81 so as to avoid clashes with PDG codes
double maxEta
std::string l2CandLabel_
T eta() const
int path() const
Definition: HLTadd.h:3
int iEvent
Definition: GenABIO.cc:243
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
int j
Definition: DBlmapReader.cc:9
bool isValid() const
Definition: HandleBase.h:76
std::map< std::string, MonitorElement * > elements_
#define LogTrace(id)
std::map< std::string, std::vector< std::string > > filterLabels_
std::string l3CandLabel_
std::string hltProcessName_
tuple level
Definition: testEve_cfg.py:34
void findMatches(std::vector< MatchStruct > &, std::vector< l1extra::L1MuonParticleRef >, std::vector< std::vector< const reco::RecoChargedCandidate * > >)
tuple size
Write out results.
std::map< std::string, double > cutsMinPt_
Definition: DDAxes.h:10
void HLTMuonValidator::beginJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 70 of file HLTMuonValidator.cc.

71 {
72 }
void HLTMuonValidator::beginRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 77 of file HLTMuonValidator.cc.

References filterLabels_, hltConfig_, hltPaths_, hltPathsToCheck_, hltProcessName_, i, L1MuonMatcherAlgo::init(), HLTConfigProvider::init(), initializeHists(), j, l1Matcher_, listBenchmarks::pattern, inputsource_file_cfi::runNumber, and HLTConfigProvider::triggerNames().

78 {
79 
80  static int runNumber = 0;
81  runNumber++;
82 
83  l1Matcher_.init(iSetup);
84 
85  bool changedConfig;
86  if (!hltConfig_.init(iRun, iSetup, hltProcessName_, changedConfig)) {
87  LogError("HLTMuonVal") << "Initialization of HLTConfigProvider failed!!";
88  return;
89  }
90 
91  hltPaths_.clear();
92  filterLabels_.clear();
93  vector<string> validTriggerNames = hltConfig_.triggerNames();
94  for (size_t i = 0; i < hltPathsToCheck_.size(); i++) {
95  TPRegexp pattern(hltPathsToCheck_[i]);
96  for (size_t j = 0; j < validTriggerNames.size(); j++)
97  if (TString(validTriggerNames[j]).Contains(pattern))
98  hltPaths_.insert(validTriggerNames[j]);
99  // Add fake HLT path where we bypass all filters
100  if (TString("NoFilters").Contains(pattern))
101  hltPaths_.insert("NoFilters");
102  }
103 
104  initializeHists();
105 
106 }
int i
Definition: DBlmapReader.cc:9
void init(const edm::EventSetup &iSetup)
Call this method at the beginning of each run, to initialize geometry, magnetic field and propagators...
const std::vector< std::string > & triggerNames() const
names of trigger paths
std::set< std::string > hltPaths_
std::vector< std::string > hltPathsToCheck_
L1MuonMatcherAlgo l1Matcher_
int j
Definition: DBlmapReader.cc:9
std::map< std::string, std::vector< std::string > > filterLabels_
HLTConfigProvider hltConfig_
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
std::string hltProcessName_
void HLTMuonValidator::bookHist ( std::string  ,
std::string  ,
std::string  ,
std::string   
)
private

Definition at line 476 of file HLTMuonValidator.cc.

References DQMStore::book1D(), dbe_, prof2calltree::edges, elements_, h, i, label, max(), min, mergeVDriftHistosByStation::name, parametersEta_, parametersPhi_, parametersTurnOn_, LaserTracksInput_cfi::source, and indexGen::title.

Referenced by initializeHists().

478 {
479 
480  string sourceUpper = source;
481  sourceUpper[0] = toupper(sourceUpper[0]);
482  string name = source + "Pass" + type + "_" + label;
483  string rootName = path + "_" + name;
484  TH1F * h;
485 
486  if (type.find("MaxPt") != string::npos) {
487  string desc = (type == "MaxPt1") ? "Leading" : "Next-to-Leading";
488  string title = "pT of " + desc + " " + sourceUpper + " Muon "+
489  "matched to " + label;
490  const size_t nBins = parametersTurnOn_.size() - 1;
491  float * edges = new float[nBins + 1];
492  for (size_t i = 0; i < nBins + 1; i++) edges[i] = parametersTurnOn_[i];
493  h = new TH1F(rootName.c_str(), title.c_str(), nBins, edges);
494  }
495 
496  else {
497  string symbol = (type == "Eta") ? "#eta" : "#phi";
498  string title = symbol + " of " + sourceUpper + " Muons " +
499  "matched to " + label;
500  vector<double> params = (type == "Eta") ? parametersEta_ : parametersPhi_;
501  int nBins = (int)params[0];
502  double min = params[1];
503  double max = params[2];
504  h = new TH1F(rootName.c_str(), title.c_str(), nBins, min, max);
505  }
506 
507  h->Sumw2();
508  elements_[rootName] = dbe_->book1D(name, h);
509  delete h;
510 
511 }
type
Definition: HCALResponse.h:22
int i
Definition: DBlmapReader.cc:9
const std::string & label
Definition: MVAComputer.cc:186
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:514
#define min(a, b)
Definition: mlp_lapack.h:161
dictionary edges
int path() const
Definition: HLTadd.h:3
std::vector< double > parametersPhi_
const T & max(const T &a, const T &b)
std::map< std::string, MonitorElement * > elements_
std::vector< double > parametersTurnOn_
std::vector< double > parametersEta_
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
void HLTMuonValidator::findMatches ( std::vector< MatchStruct > &  matches,
std::vector< l1extra::L1MuonParticleRef candsL1,
std::vector< std::vector< const reco::RecoChargedCandidate * > >  candsHlt 
)
private

Definition at line 391 of file HLTMuonValidator.cc.

References begin, cutsDr_, deltaR(), reco::Candidate::eta(), i, edm::eventsetup::heterocontainer::insert(), j, kNull, testEve_cfg::level, and reco::Candidate::phi().

Referenced by analyzePath().

395 {
396 
397  set<size_t>::iterator it;
398 
399  set<size_t> indicesL1;
400  for (size_t i = 0; i < candsL1.size(); i++)
401  indicesL1.insert(i);
402 
403  vector< set<size_t> > indicesHlt(candsHlt.size());
404  for (size_t i = 0; i < candsHlt.size(); i++)
405  for (size_t j = 0; j < candsHlt[i].size(); j++)
406  indicesHlt[i].insert(j);
407 
408  for (size_t i = 0; i < matches.size(); i++) {
409 
410  const Candidate * cand = matches[i].candBase;
411 
412  double bestDeltaR = cutsDr_[0];
413  size_t bestMatch = kNull;
414  for (it = indicesL1.begin(); it != indicesL1.end(); it++) {
415  if (candsL1[*it].isAvailable()) {
416  double dR = deltaR(cand->eta(), cand->phi(),
417  candsL1[*it]->eta(), candsL1[*it]->phi());
418  if (dR < bestDeltaR) {
419  bestMatch = *it;
420  bestDeltaR = dR;
421  }
422  // TrajectoryStateOnSurface propagated;
423  // float dR = 999., dPhi = 999.;
424  // bool isValid = l1Matcher_.match(* cand, * candsL1[*it],
425  // dR, dPhi, propagated);
426  // if (isValid && dR < bestDeltaR) {
427  // bestMatch = *it;
428  // bestDeltaR = dR;
429  // }
430  } else {
431  LogWarning("HLTMuonValidator")
432  << "Ref candsL1[*it]: product not available "
433  << *it;
434  }
435  }
436  if (bestMatch != kNull)
437  matches[i].candL1 = & * candsL1[bestMatch];
438  indicesL1.erase(bestMatch);
439 
440  matches[i].candHlt.assign(candsHlt.size(), 0);
441  for (size_t j = 0; j < candsHlt.size(); j++) {
442  size_t level = (candsHlt.size() == 4) ? (j < 2) ? 2 : 3 :
443  (candsHlt.size() == 2) ? (j < 1) ? 2 : 3 :
444  2;
445  bestDeltaR = cutsDr_[level - 2];
446  bestMatch = kNull;
447  for (it = indicesHlt[j].begin(); it != indicesHlt[j].end(); it++) {
448  double dR = deltaR(cand->eta(), cand->phi(),
449  candsHlt[j][*it]->eta(), candsHlt[j][*it]->phi());
450  if (dR < bestDeltaR) {
451  bestMatch = *it;
452  bestDeltaR = dR;
453  }
454  }
455  if (bestMatch != kNull)
456  matches[i].candHlt[j] = candsHlt[j][bestMatch];
457  indicesHlt[j].erase(bestMatch);
458  }
459 
460 // cout << " Muon: " << cand->eta() << ", ";
461 // if (matches[i].candL1) cout << matches[i].candL1->eta() << ", ";
462 // else cout << "none, ";
463 // for (size_t j = 0; j < candsHlt.size(); j++)
464 // if (matches[i].candHlt[j]) cout << matches[i].candHlt[j]->eta() << ", ";
465 // else cout << "none, ";
466 // cout << endl;
467 
468  }
469 
470 }
int i
Definition: DBlmapReader.cc:9
const unsigned int kNull
std::vector< double > cutsDr_
int j
Definition: DBlmapReader.cc:9
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
#define begin
Definition: vmac.h:31
tuple level
Definition: testEve_cfg.py:34
bool insert(Storage &, ItemType *, const IdTag &)
virtual double phi() const =0
momentum azimuthal angle
virtual double eta() const =0
momentum pseudorapidity
void HLTMuonValidator::initializeHists ( )
private

Definition at line 111 of file HLTMuonValidator.cc.

References DQMStore::bookFloat(), bookHist(), cutsMinPt_, dbe_, elements_, filterLabels_, spr::find(), DQMStore::get(), hltConfig_, hltPaths_, i, j, HLTConfigProvider::moduleLabels(), path(), DQMStore::setCurrentFolder(), LaserTracksInput_cfi::source, stepLabels_, and dtT0WireCalibration_cfg::threshold.

Referenced by beginRun().

112 {
113 
114  vector<string> sources(2);
115  sources[0] = "gen";
116  sources[1] = "rec";
117 
118  set<string>::iterator iPath;
119 
120  for (iPath = hltPaths_.begin(); iPath != hltPaths_.end(); iPath++) {
121 
122  string path = * iPath;
123 
124  if (path == "NoFilters") {
125  filterLabels_[path].push_back("hltL1sL1SingleMuOpenL1SingleMu0");
126  // The L2 and L3 collections will be built manually later on
127  filterLabels_[path].push_back("");
128  filterLabels_[path].push_back("");
129  }
130 
131  vector<string> moduleLabels;
132  if (path != "NoFilters") moduleLabels = hltConfig_.moduleLabels(path);
133 
134  for (size_t i = 0; i < moduleLabels.size(); i++)
135  if (moduleLabels[i].find("Filtered") != string::npos)
136  filterLabels_[path].push_back(moduleLabels[i]);
137 
138  double cutMaxEta = 2.4;
139 
140 
141  // Choose a pT cut for gen/rec muons based on the pT cut in the path
142  unsigned int threshold = 3;
143  TPRegexp ptRegexp("Mu([0-9]*)");
144  TObjArray * regexArray = ptRegexp.MatchS(path);
145  if (regexArray->GetEntriesFast() == 2) {
146  threshold = atoi(((TObjString *)regexArray->At(1))->GetString());
147  }
148  delete regexArray;
149  // We select a whole number min pT cut slightly above the path's final
150  // pt threshold, then subtract a bit to let through particle gun muons with
151  // exact integer pT:
152  double cutMinPt = ceil(threshold * 1.1) - 0.01;
153  if (cutMinPt < 0. || path == "NoFilters") cutMinPt = 0.;
154  cutsMinPt_[path] = cutMinPt;
155 
156  string baseDir = "HLT/Muon/Distributions/";
157  string pathSansSuffix = path;
158  if (path.rfind("_v") < path.length())
159  pathSansSuffix = path.substr(0, path.rfind("_v"));
160  dbe_->setCurrentFolder(baseDir + pathSansSuffix);
161 
162  if (dbe_->get(baseDir + path + "/CutMinPt") == 0) {
163 
164  elements_[path + "_" + "CutMinPt" ] = dbe_->bookFloat("CutMinPt" );
165  elements_[path + "_" + "CutMaxEta"] = dbe_->bookFloat("CutMaxEta");
166  elements_[path + "_" + "CutMinPt" ]->Fill(cutMinPt);
167  elements_[path + "_" + "CutMaxEta"]->Fill(cutMaxEta);
168 
169  // Standardize the names that will be applied to each step
170  const int nFilters = filterLabels_[path].size();
171  stepLabels_[path].push_back("All");
172  stepLabels_[path].push_back("L1");
173  if (nFilters == 2) {
174  stepLabels_[path].push_back("L2");
175  }
176  if (nFilters == 3) {
177  stepLabels_[path].push_back("L2");
178  stepLabels_[path].push_back("L3");
179  }
180  if (nFilters == 5) {
181  stepLabels_[path].push_back("L2");
182  stepLabels_[path].push_back("L2Iso");
183  stepLabels_[path].push_back("L3");
184  stepLabels_[path].push_back("L3Iso");
185  }
186 
187  // string l1Name = path + "_L1Quality";
188  // elements_[l1Name.c_str()] =
189  // dbe_->book1D("L1Quality", "Quality of L1 Muons", 8, 0, 8);
190  // for (size_t i = 0; i < 8; i++)
191  // elements_[l1Name.c_str()]->setBinLabel(i + 1, Form("%i", i));
192 
193  for (size_t i = 0; i < sources.size(); i++) {
194  string source = sources[i];
195  for (size_t j = 0; j < stepLabels_[path].size(); j++) {
196  bookHist(path, stepLabels_[path][j], source, "Eta");
197  bookHist(path, stepLabels_[path][j], source, "Phi");
198  bookHist(path, stepLabels_[path][j], source, "MaxPt1");
199  bookHist(path, stepLabels_[path][j], source, "MaxPt2");
200  }
201  }
202 
203  }
204 
205  }
206 
207 }
int i
Definition: DBlmapReader.cc:9
std::map< std::string, std::vector< std::string > > stepLabels_
std::set< std::string > hltPaths_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
MonitorElement * bookFloat(const char *name)
Book float.
Definition: DQMStore.cc:451
int path() const
Definition: HLTadd.h:3
int j
Definition: DBlmapReader.cc:9
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1265
std::map< std::string, MonitorElement * > elements_
std::map< std::string, std::vector< std::string > > filterLabels_
const std::vector< std::string > & moduleLabels(unsigned int trigger) const
label(s) of module(s) on a trigger path
HLTConfigProvider hltConfig_
void bookHist(std::string, std::string, std::string, std::string)
std::map< std::string, double > cutsMinPt_
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:232

Member Data Documentation

double HLTMuonValidator::cutMaxEta_
private

Definition at line 125 of file HLTMuonValidator.h.

unsigned int HLTMuonValidator::cutMotherId_
private

Definition at line 126 of file HLTMuonValidator.h.

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

Definition at line 127 of file HLTMuonValidator.h.

Referenced by findMatches(), and HLTMuonValidator().

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

Definition at line 123 of file HLTMuonValidator.h.

Referenced by analyzePath(), and initializeHists().

DQMStore* HLTMuonValidator::dbe_
private

Definition at line 138 of file HLTMuonValidator.h.

Referenced by bookHist(), HLTMuonValidator(), and initializeHists().

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

Definition at line 139 of file HLTMuonValidator.h.

Referenced by analyzePath(), bookHist(), and initializeHists().

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

Definition at line 111 of file HLTMuonValidator.h.

Referenced by analyzePath(), beginRun(), and initializeHists().

std::string HLTMuonValidator::genMuonCut_
private

Definition at line 128 of file HLTMuonValidator.h.

Referenced by analyze(), and HLTMuonValidator().

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

Definition at line 131 of file HLTMuonValidator.h.

Referenced by analyze(), and HLTMuonValidator().

std::string HLTMuonValidator::genParticleLabel_
private

Definition at line 113 of file HLTMuonValidator.h.

Referenced by analyze(), and HLTMuonValidator().

HLTConfigProvider HLTMuonValidator::hltConfig_
private

Definition at line 134 of file HLTMuonValidator.h.

Referenced by beginRun(), and initializeHists().

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

Definition at line 110 of file HLTMuonValidator.h.

Referenced by analyze(), beginRun(), and initializeHists().

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

Definition at line 109 of file HLTMuonValidator.h.

Referenced by beginRun(), and HLTMuonValidator().

std::string HLTMuonValidator::hltProcessName_
private

Definition at line 107 of file HLTMuonValidator.h.

Referenced by analyzePath(), beginRun(), and HLTMuonValidator().

std::string HLTMuonValidator::l1CandLabel_
private

Definition at line 115 of file HLTMuonValidator.h.

Referenced by HLTMuonValidator().

L1MuonMatcherAlgo HLTMuonValidator::l1Matcher_
private

Definition at line 136 of file HLTMuonValidator.h.

Referenced by beginRun().

std::string HLTMuonValidator::l2CandLabel_
private

Definition at line 116 of file HLTMuonValidator.h.

Referenced by analyzePath(), and HLTMuonValidator().

std::string HLTMuonValidator::l3CandLabel_
private

Definition at line 117 of file HLTMuonValidator.h.

Referenced by analyzePath(), and HLTMuonValidator().

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

Definition at line 119 of file HLTMuonValidator.h.

Referenced by bookHist(), and HLTMuonValidator().

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

Definition at line 120 of file HLTMuonValidator.h.

Referenced by bookHist(), and HLTMuonValidator().

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

Definition at line 121 of file HLTMuonValidator.h.

Referenced by bookHist(), and HLTMuonValidator().

std::string HLTMuonValidator::recMuonCut_
private

Definition at line 129 of file HLTMuonValidator.h.

Referenced by analyze(), and HLTMuonValidator().

std::string HLTMuonValidator::recMuonLabel_
private

Definition at line 114 of file HLTMuonValidator.h.

Referenced by analyze(), and HLTMuonValidator().

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

Definition at line 132 of file HLTMuonValidator.h.

Referenced by analyze(), and HLTMuonValidator().

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

Definition at line 140 of file HLTMuonValidator.h.

Referenced by analyzePath(), and initializeHists().