CMS 3D CMS Logo

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

#include <HLTExoticaSubAnalysis.h>

Public Types

enum  Level { Level::GEN = 98, Level::RECO = 99 }
 

Public Member Functions

void analyze (const edm::Event &iEvent, const edm::EventSetup &iEventSetup, EVTColContainer *cols)
 
void beginJob ()
 
void beginRun (const edm::Run &iRun, const edm::EventSetup &iEventSetup)
 
 HLTExoticaSubAnalysis (const edm::ParameterSet &pset, const std::string &analysisname, edm::ConsumesCollector &&consCollector)
 Constructor. More...
 
void subAnalysisBookHistos (DQMStore::IBooker &iBooker, const edm::Run &iRun, const edm::EventSetup &iSetup)
 
 ~HLTExoticaSubAnalysis ()
 End Constructor. More...
 

Private Member Functions

void bookHist (DQMStore::IBooker &iBooker, const std::string &source, const std::string &objType, const std::string &variable)
 The internal functions to book and fill histograms. More...
 
void fillHist (const std::string &source, const std::string &objType, const std::string &variable, const float &value)
 
void getHandlesToObjects (const edm::Event &iEvent, EVTColContainer *col)
 Gets the collections themselves. More...
 
void getNamesOfObjects (const edm::ParameterSet &anpset)
 Creates the maps that map which collection should come from which label. More...
 
const std::vector< unsigned int > getObjectsType (const std::string &hltpath) const
 closes analyze method More...
 
void initSelector (const unsigned int &objtype)
 Initializes the selectors of the objects based on which object it is. More...
 
void insertCandidates (const unsigned int &objtype, const EVTColContainer *col, std::vector< reco::LeafCandidate > *matches, std::map< int, double > &theSumEt)
 
void registerConsumes (edm::ConsumesCollector &consCollector)
 Registers consumption of objects. More...
 

Private Attributes

std::string _analysisname
 The name of this sub-analysis. More...
 
std::map< std::string,
MonitorElement * > 
_elements
 Structure of the MonitorElements. More...
 
std::map< unsigned int,
std::string > 
_genCut
 gen/rec objects cuts More...
 
std::map< unsigned int,
std::string > 
_genCut_leading
 gen/rec pt-leading objects cuts More...
 
StringCutObjectSelector
< reco::GenMET > * 
_genMETSelector
 
edm::InputTag _genParticleLabel
 
edm::EDGetTokenT
< reco::GenParticleCollection
_genParticleToken
 And also the tokens to get the object collections. More...
 
std::map< unsigned int,
StringCutObjectSelector
< reco::GenParticle > * > 
_genSelectorMap
 
HLTConfigProvider _hltConfig
 Interface to the HLT information. More...
 
std::set< std::string > _hltPaths
 The hlt paths found in the hltConfig. More...
 
std::vector< std::string > _hltPathsToCheck
 The hlt paths to check for. More...
 
std::string _hltProcessName
 The labels of the object collections to be used in this analysis. More...
 
StringCutObjectSelector
< l1extra::L1EtMissParticle > * 
_l1METSelector
 
unsigned int _minCandidates
 The minimum number of reco/gen candidates needed by the analysis. More...
 
std::vector< double > _parametersEta
 Some kinematical parameters. More...
 
std::vector< double > _parametersPhi
 
std::vector< double > _parametersTurnOn
 
std::vector< HLTExoticaPlotter_plotters
 The plotters: managers of each hlt path where the plots are done. More...
 
edm::ParameterSet _pset
 Internal, working copy of the PSet passed from above. More...
 
StringCutObjectSelector
< reco::CaloJet > * 
_recCaloJetSelector
 
StringCutObjectSelector
< reco::CaloMET > * 
_recCaloMETSelector
 
std::map< unsigned int,
std::string > 
_recCut
 
std::map< unsigned int,
std::string > 
_recCut_leading
 
StringCutObjectSelector
< reco::GsfElectron > * 
_recElecSelector
 
std::map< unsigned int,
edm::InputTag
_recLabels
 
StringCutObjectSelector
< reco::MET > * 
_recMETSelector
 
StringCutObjectSelector
< reco::Muon > * 
_recMuonSelector
 
StringCutObjectSelector
< reco::Track > * 
_recMuonTrkSelector
 
StringCutObjectSelector
< reco::PFJet > * 
_recPFJetSelector
 
StringCutObjectSelector
< reco::PFMET > * 
_recPFMETSelector
 
StringCutObjectSelector
< reco::PFMET > * 
_recPFMHTSelector
 
StringCutObjectSelector
< reco::PFTau > * 
_recPFTauSelector
 
StringCutObjectSelector
< reco::Photon > * 
_recPhotonSelector
 
StringCutObjectSelector
< reco::Track > * 
_recTrackSelector
 
std::map< std::string,
std::string > 
_shortpath2long
 Relation between the short and long versions of the path. More...
 
std::map< unsigned int,
edm::EDGetToken
_tokens
 
edm::InputTag _trigResultsLabel
 
edm::EDGetTokenT
< edm::TriggerResults
_trigResultsToken
 

Detailed Description

This class is the main workhorse of the package. It makes the histograms for one given analysis, taking care of all HLT paths related to that analysis.

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

Author
Thiago R. Fernandez Perez Tomei Based and adapted from: J. Duarte Campderros code from HLTriggerOffline/Higgs J. Klukas, M. Vander Donckt and J. Alcaraz code from the HLTriggerOffline/Muon package.

Definition at line 65 of file HLTExoticaSubAnalysis.h.

Member Enumeration Documentation

Enumerator
GEN 
RECO 

Definition at line 67 of file HLTExoticaSubAnalysis.h.

67  {
68  GEN = 98,
69  RECO = 99
70  };

Constructor & Destructor Documentation

HLTExoticaSubAnalysis::HLTExoticaSubAnalysis ( const edm::ParameterSet pset,
const std::string &  analysisname,
edm::ConsumesCollector &&  consCollector 
)

Constructor.

Get the vector of paths to check, for this particular analysis.

Get the minimum candidates, for this particular analysis.

Definition at line 28 of file HLTExoticaSubAnalysis.cc.

References _genCut, _genCut_leading, _hltPathsToCheck, _minCandidates, _parametersEta, _parametersPhi, _parametersTurnOn, _pset, _recCut, _recCut_leading, _recLabels, edm::ParameterSet::exists(), edm::ParameterSet::existsAs(), getNamesOfObjects(), edm::ParameterSet::getParameter(), EVTColContainer::getTypeString(), edm::ParameterSet::getUntrackedParameter(), edm::ParameterSet::insert(), LogDebug, registerConsumes(), edm::ParameterSet::retrieve(), and AlCaHLTBitMon_QueryRunRegistry::string.

30  :
31  _pset(pset),
32  _analysisname(analysisname),
33  _minCandidates(0),
34  _hltProcessName(pset.getParameter<std::string>("hltProcessName")),
35  _genParticleLabel(pset.getParameter<std::string>("genParticleLabel")),
36  _trigResultsLabel("TriggerResults", "", _hltProcessName),
37  _parametersEta(pset.getParameter<std::vector<double> >("parametersEta")),
38  _parametersPhi(pset.getParameter<std::vector<double> >("parametersPhi")),
39  _parametersTurnOn(pset.getParameter<std::vector<double> >("parametersTurnOn")),
44  _recMETSelector(0),
47  _genMETSelector(0),
49  _l1METSelector(0),
54 {
55 
56  LogDebug("ExoticaValidation") << "In HLTExoticaSubAnalysis::constructor()";
57 
58  // Specific parameters for this analysis
59  edm::ParameterSet anpset = pset.getParameter<edm::ParameterSet>(analysisname);
60 
61  // If this analysis has a particular set of binnings, use it.
62  // (Taken from the analysis-specific parameter set, of course)
63  // The "true" in the beginning of _pset.insert() means
64  // "overwrite the parameter if need be".
65  if (anpset.exists("parametersTurnOn")) {
66  _parametersTurnOn = anpset.getParameter<std::vector<double> >("parametersTurnOn");
67  _pset.insert(true, "parametersTurnOn", anpset.retrieve("parametersTurnOn"));
68  }
69  if (anpset.exists("parametersEta")) {
70  _parametersEta = anpset.getParameter<std::vector<double> >("parametersEta");
71  _pset.insert(true, "parametersEta", anpset.retrieve("parametersEta"));
72  }
73  if (anpset.exists("parametersPhi")) {
74  _parametersPhi = anpset.getParameter<std::vector<double> >("parametersPhi");
75  _pset.insert(true, "parametersPhi", anpset.retrieve("parametersPhi"));
76  }
77 
78  // Get names of objects that we may want to get from the event.
79  // Notice that genParticles are dealt with separately.
80  this->getNamesOfObjects(anpset);
81 
82  // Since now we have the names, we should register the consumption
83  // of objects.
84  this->registerConsumes(consCollector);
85 
86  // Generic objects: Initialization of basic phase space cuts.
87  for (std::map<unsigned int, edm::InputTag>::const_iterator it = _recLabels.begin();
88  it != _recLabels.end(); ++it) {
89  const std::string objStr = EVTColContainer::getTypeString(it->first);
90  _genCut[it->first] = pset.getParameter<std::string>(objStr + "_genCut");
91  _recCut[it->first] = pset.getParameter<std::string>(objStr + "_recCut");
92  auto const genCutParam = objStr + "_genCut_leading";
93  if (pset.exists(genCutParam)) {
94  _genCut_leading[it->first] = pset.getParameter<std::string>(genCutParam);
95  } else {
96  _genCut_leading[it->first] = "pt>0"; // no cut
97  }
98  auto const recCutParam = objStr + "_recCut_leading";
99  if (pset.exists(recCutParam)) {
100  _recCut_leading[it->first] = pset.getParameter<std::string>(recCutParam);
101  } else {
102  _recCut_leading[it->first] = "pt>0"; // no cut
103  }
104  }
105 
106  //--- Updating parameters if has to be modified for this particular specific analysis
107  for (std::map<unsigned int, edm::InputTag>::const_iterator it = _recLabels.begin();
108  it != _recLabels.end(); ++it) {
109  const std::string objStr = EVTColContainer::getTypeString(it->first);
110 
111  auto const genCutParam = objStr + "_genCut";
112  if(anpset.existsAs<std::string>(genCutParam,false) ) {
113  _genCut[it->first] = anpset.getUntrackedParameter<std::string>(genCutParam);
114  }
115 
116  auto const recCutParam = objStr + "_recCut";
117  if(anpset.existsAs<std::string>(recCutParam,false) ) {
118  _recCut[it->first] = anpset.getUntrackedParameter<std::string>(recCutParam);
119  }
120 
121  }
122 
124  _hltPathsToCheck = anpset.getParameter<std::vector<std::string> >("hltPathsToCheck");
126  _minCandidates = anpset.getParameter<unsigned int>("minCandidates");
127 
128 }
#define LogDebug(id)
StringCutObjectSelector< reco::Track > * _recMuonTrkSelector
T getParameter(std::string const &) const
unsigned int _minCandidates
The minimum number of reco/gen candidates needed by the analysis.
Entry const & retrieve(char const *) const
T getUntrackedParameter(std::string const &, T const &) const
void getNamesOfObjects(const edm::ParameterSet &anpset)
Creates the maps that map which collection should come from which label.
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:185
std::map< unsigned int, std::string > _genCut
gen/rec objects cuts
bool exists(std::string const &parameterName) const
checks if a parameter exists
StringCutObjectSelector< reco::CaloJet > * _recCaloJetSelector
StringCutObjectSelector< reco::GenMET > * _genMETSelector
std::vector< double > _parametersPhi
void insert(bool ok_to_replace, char const *, Entry const &)
StringCutObjectSelector< reco::MET > * _recMETSelector
std::map< unsigned int, std::string > _genCut_leading
gen/rec pt-leading objects cuts
StringCutObjectSelector< reco::PFJet > * _recPFJetSelector
std::map< unsigned int, edm::InputTag > _recLabels
StringCutObjectSelector< reco::GsfElectron > * _recElecSelector
std::map< unsigned int, std::string > _recCut_leading
StringCutObjectSelector< reco::Muon > * _recMuonSelector
edm::ParameterSet _pset
Internal, working copy of the PSet passed from above.
std::vector< double > _parametersEta
Some kinematical parameters.
std::map< unsigned int, std::string > _recCut
StringCutObjectSelector< reco::Track > * _recTrackSelector
std::vector< std::string > _hltPathsToCheck
The hlt paths to check for.
std::string _hltProcessName
The labels of the object collections to be used in this analysis.
void registerConsumes(edm::ConsumesCollector &consCollector)
Registers consumption of objects.
StringCutObjectSelector< reco::PFMET > * _recPFMETSelector
std::string _analysisname
The name of this sub-analysis.
StringCutObjectSelector< reco::Photon > * _recPhotonSelector
StringCutObjectSelector< l1extra::L1EtMissParticle > * _l1METSelector
std::vector< double > _parametersTurnOn
StringCutObjectSelector< reco::CaloMET > * _recCaloMETSelector
static const std::string getTypeString(const unsigned int &objtype)
Tranform types into strings.
StringCutObjectSelector< reco::PFMET > * _recPFMHTSelector
StringCutObjectSelector< reco::PFTau > * _recPFTauSelector
HLTExoticaSubAnalysis::~HLTExoticaSubAnalysis ( )

End Constructor.

Definition at line 130 of file HLTExoticaSubAnalysis.cc.

References _genMETSelector, _genSelectorMap, _l1METSelector, _recCaloJetSelector, _recCaloMETSelector, _recElecSelector, _recMETSelector, _recMuonSelector, _recMuonTrkSelector, _recPFJetSelector, _recPFMETSelector, _recPFMHTSelector, _recPFTauSelector, _recPhotonSelector, _recTrackSelector, and python.multivaluedict::map().

131 {
132  for (std::map<unsigned int, StringCutObjectSelector<reco::GenParticle>* >::iterator it = _genSelectorMap.begin();
133  it != _genSelectorMap.end(); ++it) {
134  delete it->second;
135  it->second = 0;
136  }
137  delete _recMuonSelector;
138  _recMuonSelector = 0;
139  delete _recMuonTrkSelector;
141  delete _recTrackSelector;
142  _recTrackSelector = 0;
143  delete _recElecSelector;
144  _recElecSelector = 0;
145  delete _recPhotonSelector;
146  _recPhotonSelector = 0;
147  delete _recMETSelector;
148  _recMETSelector = 0;
149  delete _recPFMETSelector;
150  _recPFMETSelector = 0;
151  delete _recPFMHTSelector;
152  _recPFMHTSelector = 0;
153  delete _genMETSelector;
154  _genMETSelector = 0;
155  delete _recCaloMETSelector;
157  delete _l1METSelector;
158  _l1METSelector = 0;
159  delete _recPFTauSelector;
160  _recPFTauSelector = 0;
161  delete _recPFJetSelector;
162  _recPFJetSelector = 0;
163  delete _recCaloJetSelector;
165 }
StringCutObjectSelector< reco::Track > * _recMuonTrkSelector
StringCutObjectSelector< reco::CaloJet > * _recCaloJetSelector
StringCutObjectSelector< reco::GenMET > * _genMETSelector
StringCutObjectSelector< reco::MET > * _recMETSelector
StringCutObjectSelector< reco::PFJet > * _recPFJetSelector
StringCutObjectSelector< reco::GsfElectron > * _recElecSelector
StringCutObjectSelector< reco::Muon > * _recMuonSelector
StringCutObjectSelector< reco::Track > * _recTrackSelector
StringCutObjectSelector< reco::PFMET > * _recPFMETSelector
StringCutObjectSelector< reco::Photon > * _recPhotonSelector
std::map< unsigned int, StringCutObjectSelector< reco::GenParticle > * > _genSelectorMap
StringCutObjectSelector< l1extra::L1EtMissParticle > * _l1METSelector
StringCutObjectSelector< reco::CaloMET > * _recCaloMETSelector
StringCutObjectSelector< reco::PFMET > * _recPFMHTSelector
StringCutObjectSelector< reco::PFTau > * _recPFTauSelector

Member Function Documentation

void HLTExoticaSubAnalysis::analyze ( const edm::Event iEvent,
const edm::EventSetup iEventSetup,
EVTColContainer cols 
)

Method to fill all relevant histograms. Notice that we update the EVTColContaner to point to the collections we want.

We are going to make a fake reco::LeafCandidate, with our particleType as the pdgId. This is an alternative to the older implementation with MatchStruct.

Filling the histograms if pass the minimum amount of candidates needed by the analysis:

GEN CASE ///

Close GEN case

RECO CASE ///

Debugging.

Close RECO case

Definition at line 341 of file HLTExoticaSubAnalysis.cc.

References _analysisname, _genCut, _genCut_leading, _genSelectorMap, _minCandidates, _plotters, _recCut_leading, _recLabels, _shortpath2long, edm::HLTGlobalStatus::accept(), dtNoiseDBValidation_cfg::cerr, gather_cfg::cout, eta(), fillHist(), EVTColContainer::genParticles, getHandlesToObjects(), EVTColContainer::getTypeString(), i, initSelector(), insertCandidates(), j, findQualityFiles::jj, LogDebug, reco::Candidate::p4(), phi, EnergyCorrector::pt, benchmark_cfg::select, AlCaHLTBitMon_QueryRunRegistry::string, edm::TriggerNames::triggerIndex(), edm::Event::triggerNames(), EVTColContainer::triggerResults, trigNames, findQualityFiles::v, and reco::Candidate::vertex().

342 {
343  LogDebug("ExoticaValidation") << "In HLTExoticaSubAnalysis::analyze()";
344 
345  if(verbose>2) std::cerr << "### Category : " << _analysisname << std::endl;
346  // Loop over _recLabels to make sure everything is alright.
347  /*
348  std::cout << "Now printing the _recLabels" << std::endl;
349  for (std::map<unsigned int, edm::InputTag>::iterator it = _recLabels.begin();
350  it != _recLabels.end(); ++it) {
351  std::cout << "Number: " << it->first << "\t" << "Label: " << it->second.label() << std::endl;
352  }
353  */
354 
355  // Initialize the collection (the ones which have not been initialiazed yet)
356  //std::cout << "Setting handles to objects..." << std::endl;
357  this->getHandlesToObjects(iEvent, cols);
358 
359  // Utility map, mapping kinds of objects (GEN, RECO) to strings ("gen","rec")
360  //std::map<Level, std::string> u2str;
361  //u2str[Level::GEN] = "gen";
362  //u2str[Level::RECO] = "rec";
363 
364  // Extract the match structure containing the gen/reco candidates (electron, muons,...). This part is common to all the SubAnalyses
365  std::vector<reco::LeafCandidate> matchesGen; matchesGen.clear();
366  std::vector<reco::LeafCandidate> matchesReco; matchesReco.clear();
367  std::map<int , double> theSumEt; // map< pdgId ; SumEt > in order to keep track of the MET type
368 
369  // --- deal with GEN objects first.
370  // Make each good GEN object into the base cand for a MatchStruct
371  // Our definition of "good" is "passes the selector" defined in the config.py
372  // Save all the MatchStructs in the "matchesGen" vector.
373 
374  for (std::map<unsigned int, edm::InputTag>::iterator it = _recLabels.begin();
375  it != _recLabels.end(); ++it) {
376  // Here we are filling the vector of StringCutObjectSelector<reco::GenParticle>
377  // with objects constructed from the strings saved in _genCut.
378  // Initialize selectors when first event
379 
380  //std::cout << "Loop over the kinds of objects: objects of kind " << it->first << std::endl;
381 
382 
383  if (!_genSelectorMap[it->first]) {
385  }
386 
387  const std::string objTypeStr = EVTColContainer::getTypeString(it->first);
388  // genAnyMET doesn't make sense. No need their matchesGens
389  if ( TString(objTypeStr).Contains("MET") ||
390  TString(objTypeStr).Contains("MHT") ||
391  TString(objTypeStr).Contains("Jet") ) continue;
392 
393  // Now loop over the genParticles, and apply the operator() over each of them.
394  // Fancy syntax: for objects X and Y, X.operator()(Y) is the same as X(Y).
395  for (size_t i = 0; i < cols->genParticles->size(); ++i) {
396  //std::cout << "Now matchesGen.size() is " << matchesGen.size() << std::endl;
397  if (_genSelectorMap[it->first]->operator()(cols->genParticles->at(i))) {
398  const reco::Candidate* cand = &(cols->genParticles->at(i));
399  //std::cout << "Found good cand: cand->pt() = " << cand->pt() << std::endl;
400  //matchesGen.push_back(MatchStruct(cand, it->first));
403  reco::LeafCandidate v(0,cand->p4(),cand->vertex(),it->first,0,true);
404 
405  matchesGen.push_back(v);
406  }
407  }
408  }
409 
410  // Sort the matches by pT for later filling of turn-on curve
411  //std::cout << "Before sorting: matchesGen.size() = " << matchesGen.size() << std::endl;
412 
413  // GreaterByPt<reco::LeafCandidate> comparator;
414  // std::sort(matchesGen.begin(),
415  // matchesGen.end(),
416  // comparator);
417 
418  // --- same for RECO objects
419  // Extraction of the objects candidates
420  if(verbose>0) std::cout << "-- enter loop over recLabels" << std::endl;
421  for (std::map<unsigned int, edm::InputTag>::iterator it = _recLabels.begin();
422  it != _recLabels.end(); ++it) {
423  //std::cout << "Filling RECO \"matchesReco\" vector for particle kind it->first = "
424  // << it->first << ", which means " << it->second.label() << std::endl;
425  // Reco selectors (the function takes into account if it was instantiated
426  // before or not) ### Thiago ---> Then why don't we put it in the beginRun???
427  this->initSelector(it->first);
428  // -- Storing the matchesReco
429  this->insertCandidates(it->first, cols, &matchesReco, theSumEt);
430  if(verbose>0) std::cout << "--- " << EVTColContainer::getTypeString(it->first)
431  << " sumEt=" << theSumEt[it->first] << std::endl;
432  }
433 
434  // std::sort(matchesReco.begin(),
435  // matchesReco.end(),
436  // comparator);
437 
438  // -- Trigger Results
439  const edm::TriggerNames trigNames = iEvent.triggerNames(*(cols->triggerResults));
440 
442 
443  //for (std::map<unsigned int, std::vector<MatchStruct> >::iterator it = sourceMatchMap.begin(); it != sourceMatchMap.end(); ++it) {
444  // it->first: gen/reco it->second: HLT matches (std::vector<MatchStruct>)
445 
446  //if (it->second.size() < _minCandidates) { // FIXME: A bug is potentially here: what about the mixed channels?
447  //continue;
448  //}
449 
453  if(verbose>2) std::cerr << "### matchesGen.size() = " << matchesGen.size() << std::endl;
454  if( matchesGen.size() >= _minCandidates) { // FIXME: A bug is potentially here: what about the mixed channels?
455  // Okay, there are enough candidates. Move on!
456 
457  // Filling the gen/reco objects (eff-denominators):
458  // Just the first two different ones, if there are more
459  // The countobjects maps uints (object types, really) --> integers.
460  // Example:
461  // | uint | int |
462  // | 0 | 1 | --> 1 muon used
463  // | 1 | 2 | --> 2 electrons used
464 
465  // Initializing the count of the used objects.
466  std::map<unsigned int, int> countobjects;
467  for (std::map<unsigned int, edm::InputTag>::iterator co = _recLabels.begin();
468  co != _recLabels.end(); ++co) {
469  //countobjects->insert(std::pair<unsigned int, int>(co->first, 0));
470  countobjects.insert(std::pair<unsigned int, int>(co->first, 0));
471  }
472 
473  int counttotal = 0;
474  //int totalobjectssize2 = 2 * countobjects->size();
475  int totalobjectssize2 = 2 * countobjects.size();
476 
477 
478  bool isPassedLeadingCut = true;
479  // We will proceed only when cuts for the pt-leading are satisified.
480  for (size_t j = 0; j != matchesGen.size(); ++j) {
481  const unsigned int objType = matchesGen[j].pdgId();
482  // Cut for the pt-leading object
484  if ( !select( matchesGen[j] ) ) { // No interest case
485  isPassedLeadingCut = false; // Will skip the following matchesGen loop
486  matchesGen.clear();
487  break;
488  }
489  }
490 
491  for (size_t j = 0; ( j != matchesGen.size() ) && isPassedLeadingCut; ++j) {
492  const unsigned int objType = matchesGen[j].pdgId();
493  //std::cout << "(4) Gonna call with " << objType << std::endl;
494  const std::string objTypeStr = EVTColContainer::getTypeString(objType);
495 
496  float pt = matchesGen[j].pt();
497 
498  if (countobjects[objType] == 0) {
499  this->fillHist("gen", objTypeStr, "MaxPt1", pt);
500  ++(countobjects[objType]);
501  ++counttotal;
502  }
503  else if (countobjects[objType] == 1) {
504  this->fillHist("gen", objTypeStr, "MaxPt2", pt);
505  ++(countobjects[objType]);
506  ++counttotal;
507  }
508  else {
509  // Already the minimum two objects has been filled, get out...
510  if (counttotal == totalobjectssize2) {
511  size_t max_size = matchesGen.size();
512  for ( size_t jj = j; jj < max_size; jj++ ) {
513  matchesGen.erase(matchesGen.end());
514  }
515  break;
516  }
517  }
518 
519  float eta = matchesGen[j].eta();
520  float phi = matchesGen[j].phi();
521 
522  this->fillHist("gen", objTypeStr, "Eta", eta);
523  this->fillHist("gen", objTypeStr, "Phi", phi);
524 
525  } // Closes loop in gen
526 
527  // Calling to the plotters analysis (where the evaluation of the different trigger paths are done)
528  //const std::string source = "gen";
529  for (std::vector<HLTExoticaPlotter>::iterator an = _plotters.begin(); an != _plotters.end(); ++an) {
530  const std::string hltPath = _shortpath2long[an->gethltpath()];
531  const bool ispassTrigger = cols->triggerResults->accept(trigNames.triggerIndex(hltPath));
532  LogDebug("ExoticaValidation") << " preparing to call the plotters analysis";
533  an->analyze(ispassTrigger, "gen", matchesGen, theSumEt);
534  LogDebug("ExoticaValidation") << " called the plotter";
535  }
536  }
537 
541  if(verbose>2) std::cerr << "### matchesReco.size() = " << matchesReco.size() << std::endl;
542 
543  {
544  if(matchesReco.size() < _minCandidates) return; // FIXME: A bug is potentially here: what about the mixed channels?
545 
546  // Okay, there are enough candidates. Move on!
547 
548  // Filling the gen/reco objects (eff-denominators):
549  // Just the first two different ones, if there are more
550  // The countobjects maps uints (object types, really) --> integers.
551  // Example:
552  // | uint | int |
553  // | 0 | 1 | --> 1 muon used
554  // | 1 | 2 | --> 2 electrons used
555  // Initializing the count of the used objects.
556  //std::map<unsigned int, int> * countobjects = new std::map<unsigned int, int>;
557  std::map<unsigned int, int> countobjects;
558  for (std::map<unsigned int, edm::InputTag>::iterator co = _recLabels.begin();
559  co != _recLabels.end(); ++co) {
560  countobjects.insert(std::pair<unsigned int, int>(co->first, 0));
561  }
562 
563  int counttotal = 0;
564  //int totalobjectssize2 = 2 * countobjects->size();
565  int totalobjectssize2 = 2 * countobjects.size();
566 
568  //std::cout << "Our RECO vector has matchesReco.size() = " << matchesReco.size() << std::endl;
569 
570 
571  bool isPassedLeadingCut = true;
572  // We will proceed only when cuts for the pt-leading are satisified.
573  for (size_t j = 0; j != matchesReco.size(); ++j) {
574  const unsigned int objType = matchesReco[j].pdgId();
575  // Cut for the pt-leading object
577  if ( !select( matchesReco[j] ) ) { // No interest case
578  isPassedLeadingCut = false; // Will skip the following matchesReco loop
579  matchesReco.clear();
580  break;
581  }
582  }
583 
584  for (size_t j = 0; ( j != matchesReco.size() ) && isPassedLeadingCut; ++j) {
585  const unsigned int objType = matchesReco[j].pdgId();
586  //std::cout << "(4) Gonna call with " << objType << std::endl;
587  const std::string objTypeStr = EVTColContainer::getTypeString(objType);
588 
589  float pt = matchesReco[j].pt();
590 
591  if (countobjects[objType] == 0) {
592  this->fillHist("rec", objTypeStr, "MaxPt1", pt);
593  ++(countobjects[objType]);
594  ++counttotal;
595  }
596  else if (countobjects[objType] == 1) {
597  if( ! ( TString(objTypeStr).Contains("MET") || TString(objTypeStr).Contains("MHT") ) ) {
598  this->fillHist("rec", objTypeStr, "MaxPt2", pt);
599  }
600  ++(countobjects[objType]);
601  ++counttotal;
602  }
603  else {
604  // Already the minimum two objects has been filled, get out...
605  if (counttotal == totalobjectssize2) {
606  size_t max_size = matchesReco.size();
607  for ( size_t jj = j; jj < max_size; jj++ ) {
608  matchesReco.erase(matchesReco.end());
609  }
610  break;
611  }
612  }
613 
614  float eta = matchesReco[j].eta();
615  float phi = matchesReco[j].phi();
616 
617  if ( !( TString(objTypeStr).Contains("MET") || TString(objTypeStr).Contains("MHT") ) ) {
618  this->fillHist("rec", objTypeStr, "Eta", eta);
619  this->fillHist("rec", objTypeStr, "Phi", phi);
620  }
621  else {
622  this->fillHist("rec", objTypeStr, "SumEt", theSumEt[objType]);
623  }
624 
625  } // Closes loop in reco
626 
627  //LogDebug("ExoticaValidation") << " deleting countobjects";
628  //delete countobjects;
629 
630  // Calling to the plotters analysis (where the evaluation of the different trigger paths are done)
631  //const std::string source = "reco";
632  for (std::vector<HLTExoticaPlotter>::iterator an = _plotters.begin(); an != _plotters.end(); ++an) {
633  const std::string hltPath = _shortpath2long[an->gethltpath()];
634  const bool ispassTrigger = cols->triggerResults->accept(trigNames.triggerIndex(hltPath));
635  LogDebug("ExoticaValidation") << " preparing to call the plotters analysis";
636  an->analyze(ispassTrigger, "rec", matchesReco, theSumEt);
637  LogDebug("ExoticaValidation") << " called the plotter";
638  }
639  }
640 
641 }
#define LogDebug(id)
unsigned int _minCandidates
The minimum number of reco/gen candidates needed by the analysis.
int i
Definition: DBlmapReader.cc:9
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const
Definition: Event.cc:208
std::map< unsigned int, std::string > _genCut
gen/rec objects cuts
bool accept() const
Has at least one path accepted the event?
std::vector< HLTExoticaPlotter > _plotters
The plotters: managers of each hlt path where the plots are done.
void fillHist(const std::string &source, const std::string &objType, const std::string &variable, const float &value)
const reco::GenParticleCollection * genParticles
T eta() const
std::map< unsigned int, std::string > _genCut_leading
gen/rec pt-leading objects cuts
std::map< unsigned int, edm::InputTag > _recLabels
std::map< unsigned int, std::string > _recCut_leading
unsigned int triggerIndex(std::string const &name) const
Definition: TriggerNames.cc:32
int j
Definition: DBlmapReader.cc:9
virtual const Point & vertex() const =0
vertex position
static const char *const trigNames[]
Definition: EcalDumpRaw.cc:74
void getHandlesToObjects(const edm::Event &iEvent, EVTColContainer *col)
Gets the collections themselves.
std::string _analysisname
The name of this sub-analysis.
std::map< unsigned int, StringCutObjectSelector< reco::GenParticle > * > _genSelectorMap
tuple cout
Definition: gather_cfg.py:121
void initSelector(const unsigned int &objtype)
Initializes the selectors of the objects based on which object it is.
static const std::string getTypeString(const unsigned int &objtype)
Tranform types into strings.
const edm::TriggerResults * triggerResults
std::map< std::string, std::string > _shortpath2long
Relation between the short and long versions of the path.
void insertCandidates(const unsigned int &objtype, const EVTColContainer *col, std::vector< reco::LeafCandidate > *matches, std::map< int, double > &theSumEt)
virtual const LorentzVector & p4() const =0
four-momentum Lorentz vector
Definition: DDAxes.h:10
void HLTExoticaSubAnalysis::beginJob ( void  )

Definition at line 168 of file HLTExoticaSubAnalysis.cc.

169 {
170 }
void HLTExoticaSubAnalysis::beginRun ( const edm::Run iRun,
const edm::EventSetup iEventSetup 
)

Construct the plotters right here. For that we need to create the _hltPaths vector.

Definition at line 236 of file HLTExoticaSubAnalysis.cc.

References _analysisname, _hltConfig, _hltPaths, _hltPathsToCheck, _hltProcessName, _plotters, _pset, _recLabels, _shortpath2long, gather_cfg::cout, newFWLiteAna::found, i, HLTConfigProvider::init(), getDQMSummary::iter, j, LogDebug, LogTrace, cmsHarvester::path, chain::pattern, AlCaHLTBitMon_QueryRunRegistry::string, and HLTConfigProvider::triggerNames().

237 {
238 
239  LogDebug("ExoticaValidation") << "In HLTExoticaSubAnalysis::beginRun()";
240 
243 
244  // Initialize the HLT config.
245  bool changedConfig(true);
246  if (!_hltConfig.init(iRun, iSetup, _hltProcessName, changedConfig)) {
247  edm::LogError("ExoticaValidation") << "HLTExoticaSubAnalysis::constructor(): "
248  << "Initialization of HLTConfigProvider failed!";
249  }
250 
251  // Parse the input paths to get them if they are in the table and associate
252  // them to the last filter of the path (in order to extract the objects).
253  _hltPaths.clear();
254  for (size_t i = 0; i < _hltPathsToCheck.size(); ++i) {
255  bool found = false;
256  TPRegexp pattern(_hltPathsToCheck[i]);
257 
258  // Loop over triggerNames from _hltConfig
259  for (size_t j = 0 ; j < _hltConfig.triggerNames().size(); ++j) {
260  std::string thetriggername = _hltConfig.triggerNames()[j];
261  if (TString(thetriggername).Contains(pattern)) {
262  _hltPaths.insert(thetriggername);
263  found = true;
264  }
265  if(verbose>2 && i==0)
266  std::cout << "--- TRIGGER PATH : " << thetriggername << std::endl;
267  }
268 
269  // Oh dear, the path we wanted seems to not be available
270  if (! found && verbose>2) {
271  edm::LogWarning("ExoticaValidation") << "HLTExoticaSubAnalysis::constructor(): In "
272  << _analysisname << " subfolder NOT found the path: '"
273  << _hltPathsToCheck[i] << "*'" ;
274  }
275  } // Close loop over paths to check.
276 
277  // At this point, _hltpaths contains the names of the paths to check
278  // that were found. Let's log it at trace level.
279  LogTrace("ExoticaValidation") << "SubAnalysis: " << _analysisname
280  << "\nHLT Trigger Paths found >>>";
281  for (std::set<std::string>::const_iterator iter = _hltPaths.begin();
282  iter != _hltPaths.end(); ++iter) {
283  LogTrace("ExoticaValidation") << (*iter) << "\n";
284  }
285 
286  // Initialize the plotters (analysers for each trigger path)
287  _plotters.clear();
288  for (std::set<std::string>::iterator iPath = _hltPaths.begin();
289  iPath != _hltPaths.end(); ++iPath) {
290  // Avoiding the dependence of the version number for the trigger paths
291  std::string path = * iPath;
292  std::string shortpath = path;
293  if (path.rfind("_v") < path.length()) {
294  shortpath = path.substr(0, path.rfind("_v"));
295  }
296  _shortpath2long[shortpath] = path;
297 
298  // Objects needed by the HLT path
299  // Thiago: instead of trying to decode the objects from the path,
300  // put the burden on the user to tell us which objects are needed.
301  //const std::vector<unsigned int> objsNeedHLT = this->getObjectsType(shortpath);
302  std::vector<unsigned int> objsNeedHLT;
303  for (std::map<unsigned int, edm::InputTag>::iterator it = _recLabels.begin() ;
304  it != _recLabels.end(); ++it) {
305  objsNeedHLT.push_back(it->first);
306  }
307 
308  /*std::vector<unsigned int> userInstantiate;
309  // Sanity check: the object needed by a trigger path should be
310  // introduced by the user via config python (_recLabels datamember)
311  for (std::map<unsigned int, edm::InputTag>::iterator it = _recLabels.begin() ;
312  it != _recLabels.end(); ++it) {
313  userInstantiate.push_back(it->first);
314  }
315  for (std::vector<unsigned int>::const_iterator it = objsNeedHLT.begin(); it != objsNeedHLT.end();
316  ++it) {
317  if (std::find(userInstantiate.begin(), userInstantiate.end(), *it) ==
318  userInstantiate.end()) {
319  edm::LogError("ExoticaValidation") << "In HLTExoticaSubAnalysis::beginRun, "
320  << "Incoherence found in the python configuration file!!\nThe SubAnalysis '"
321  << _analysisname << "' has been asked to evaluate the trigger path '"
322  << shortpath << "' (found it in 'hltPathsToCheck') BUT this path"
323  << " needs a '" << EVTColContainer::getTypeString(*it)
324  << "' which has not been instantiated ('recVariableLabels'"
325  << ")" ;
326  exit(-1); // This should probably throw an exception...
327  }
328  }
329  */
330  LogTrace("ExoticaValidation") << " --- " << shortpath;
331 
332  // The hlt path, the objects (electrons, muons, photons, ...)
333  // needed to evaluate the path are the argumens of the plotter
334  HLTExoticaPlotter analyzer(_pset, shortpath, objsNeedHLT);
335  _plotters.push_back(analyzer);
336  }// Okay, at this point we have prepared all the plotters.
337 
338 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
const std::vector< std::string > & triggerNames() const
names of trigger paths
std::vector< HLTExoticaPlotter > _plotters
The plotters: managers of each hlt path where the plots are done.
list pattern
Definition: chain.py:104
std::map< unsigned int, edm::InputTag > _recLabels
tuple path
else: Piece not in the list, fine.
edm::ParameterSet _pset
Internal, working copy of the PSet passed from above.
int j
Definition: DBlmapReader.cc:9
HLTConfigProvider _hltConfig
Interface to the HLT information.
std::vector< std::string > _hltPathsToCheck
The hlt paths to check for.
#define LogTrace(id)
std::string _hltProcessName
The labels of the object collections to be used in this analysis.
std::string _analysisname
The name of this sub-analysis.
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor
tuple cout
Definition: gather_cfg.py:121
std::set< std::string > _hltPaths
The hlt paths found in the hltConfig.
std::map< std::string, std::string > _shortpath2long
Relation between the short and long versions of the path.
void HLTExoticaSubAnalysis::bookHist ( DQMStore::IBooker iBooker,
const std::string &  source,
const std::string &  objType,
const std::string &  variable 
)
private

The internal functions to book and fill histograms.

Definition at line 956 of file HLTExoticaSubAnalysis.cc.

References _elements, _parametersEta, _parametersPhi, _parametersTurnOn, DQMStore::IBooker::book1D(), prof2calltree::edges, h, i, LogDebug, bookConverter::max, min(), mergeVDriftHistosByStation::name, source, AlCaHLTBitMon_QueryRunRegistry::string, and indexGen::title.

Referenced by subAnalysisBookHistos().

960 {
961  LogDebug("ExoticaValidation") << "In HLTExoticaSubAnalysis::bookHist()";
962  std::string sourceUpper = source;
963  sourceUpper[0] = std::toupper(sourceUpper[0]);
964  std::string name = source + objType + variable ;
965  TH1F * h = 0;
966 
967  if (variable.find("SumEt") != std::string::npos) {
968  std::string title = "Sum ET of " + sourceUpper + " " + objType;
969  const size_t nBins = _parametersTurnOn.size() - 1;
970  float * edges = new float[nBins + 1];
971  for (size_t i = 0; i < nBins + 1; i++) {
972  edges[i] = _parametersTurnOn[i];
973  }
974  h = new TH1F(name.c_str(), title.c_str(), nBins, edges);
975  delete[] edges;
976  }
977 
978  else if (variable.find("MaxPt") != std::string::npos) {
979  std::string desc = (variable == "MaxPt1") ? "Leading" : "Next-to-Leading";
980  std::string title = "pT of " + desc + " " + sourceUpper + " " + objType;
981  const size_t nBins = _parametersTurnOn.size() - 1;
982  float * edges = new float[nBins + 1];
983  for (size_t i = 0; i < nBins + 1; i++) {
984  edges[i] = _parametersTurnOn[i];
985  }
986  h = new TH1F(name.c_str(), title.c_str(), nBins, edges);
987  delete[] edges;
988  }
989 
990  else {
991  std::string symbol = (variable == "Eta") ? "#eta" : "#phi";
992  std::string title = symbol + " of " + sourceUpper + " " + objType;
993  std::vector<double> params = (variable == "Eta") ? _parametersEta : _parametersPhi;
994  int nBins = (int)params[0];
995  double min = params[1];
996  double max = params[2];
997  h = new TH1F(name.c_str(), title.c_str(), nBins, min, max);
998  }
999 
1000  h->Sumw2();
1001  // This is the trick, that takes a normal TH1F and puts it in in the DQM
1002  // machinery. Seems to be easy!
1003  // Updated to use the new iBooker machinery.
1004  _elements[name] = iBooker.book1D(name, h);
1005  delete h;
1006 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
std::vector< double > _parametersPhi
dictionary edges
std::vector< double > _parametersEta
Some kinematical parameters.
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
T min(T a, T b)
Definition: MathUtil.h:58
std::vector< double > _parametersTurnOn
std::map< std::string, MonitorElement * > _elements
Structure of the MonitorElements.
static std::string const source
Definition: EdmProvDump.cc:42
void HLTExoticaSubAnalysis::fillHist ( const std::string &  source,
const std::string &  objType,
const std::string &  variable,
const float &  value 
)
private

Definition at line 1009 of file HLTExoticaSubAnalysis.cc.

References _elements, LogDebug, mergeVDriftHistosByStation::name, source, AlCaHLTBitMon_QueryRunRegistry::string, and relativeConstraints::value.

Referenced by analyze().

1013 {
1014  std::string sourceUpper = source;
1015  sourceUpper[0] = toupper(sourceUpper[0]);
1016  std::string name = source + objType + variable ;
1017 
1018  LogDebug("ExoticaValidation") << "In HLTExoticaSubAnalysis::fillHist() " << name << " " << value;
1019  _elements[name]->Fill(value);
1020  LogDebug("ExoticaValidation") << "In HLTExoticaSubAnalysis::fillHist() " << name << " worked";
1021 }
#define LogDebug(id)
std::map< std::string, MonitorElement * > _elements
Structure of the MonitorElements.
static std::string const source
Definition: EdmProvDump.cc:42
void HLTExoticaSubAnalysis::getHandlesToObjects ( const edm::Event iEvent,
EVTColContainer col 
)
private

Gets the collections themselves.

Definition at line 852 of file HLTExoticaSubAnalysis.cc.

References _genParticleToken, _tokens, _trigResultsToken, EVTColContainer::CALOJET, EVTColContainer::CALOMET, EVTColContainer::ELEC, EVTColContainer::GENMET, EVTColContainer::genParticles, edm::Event::getByToken(), EVTColContainer::isCommonInit(), edm::HandleBase::isValid(), EVTColContainer::L1MET, LogDebug, EVTColContainer::MET, EVTColContainer::MUON, EVTColContainer::MUTRK, EVTColContainer::PFJET, EVTColContainer::PFMET, EVTColContainer::PFMHT, EVTColContainer::PFTAU, EVTColContainer::PHOTON, edm::Handle< T >::product(), EVTColContainer::set(), EVTColContainer::setPFMHT(), EVTColContainer::TRACK, and EVTColContainer::triggerResults.

Referenced by analyze().

853 {
854  LogDebug("ExoticaValidation") << "In HLTExoticaSubAnalysis::getHandlesToObjects()";
855 
856  if (! col->isCommonInit()) {
857  // Extract the trigger results (path info, pass,...)
859  iEvent.getByToken(_trigResultsToken, trigResults);
860  if (trigResults.isValid()) {
861  col->triggerResults = trigResults.product();
862  LogDebug("ExoticaValidation") << "Added handle to triggerResults";
863  }
864 
865  // Extract the genParticles
867  iEvent.getByToken(_genParticleToken, genPart);
868  if (genPart.isValid()) {
869  col->genParticles = genPart.product();
870  LogDebug("ExoticaValidation") << "Added handle to genParticles";
871  }
872  }
873 
874  // Loop over the tokens and extract all other objects
875  LogDebug("ExoticaValidation") << "We have got " << _tokens.size() << "tokens";
876  for (std::map<unsigned int, edm::EDGetToken>::iterator it = _tokens.begin();
877  it != _tokens.end(); ++it) {
878  if (it->first == EVTColContainer::MUON) {
880  iEvent.getByToken(it->second, theHandle);
881  if (theHandle.isValid()) col->set(theHandle.product());
882  }
883  else if (it->first == EVTColContainer::MUTRK) {
885  iEvent.getByToken(it->second, theHandle);
886  if (theHandle.isValid()) col->set(theHandle.product());
887  }
888  else if (it->first == EVTColContainer::TRACK) {
890  iEvent.getByToken(it->second, theHandle);
891  if (theHandle.isValid()) col->set(theHandle.product());
892  }
893  else if (it->first == EVTColContainer::ELEC) {
895  iEvent.getByToken(it->second, theHandle);
896  if (theHandle.isValid()) col->set(theHandle.product());
897  }
898  else if (it->first == EVTColContainer::PHOTON) {
900  iEvent.getByToken(it->second, theHandle);
901  if (theHandle.isValid()) col->set(theHandle.product());
902  }
903  else if (it->first == EVTColContainer::MET) {
905  iEvent.getByToken(it->second, theHandle);
906  if (theHandle.isValid()) col->set(theHandle.product());
907  }
908  else if (it->first == EVTColContainer::PFMET) {
910  iEvent.getByToken(it->second, theHandle);
911  if (theHandle.isValid()) col->set(theHandle.product());
912  }
913  else if (it->first == EVTColContainer::PFMHT) {
915  iEvent.getByToken(it->second, theHandle);
916  if (theHandle.isValid()) col->setPFMHT(theHandle.product());
917  }
918  else if (it->first == EVTColContainer::GENMET) {
920  iEvent.getByToken(it->second, theHandle);
921  if (theHandle.isValid()) col->set(theHandle.product());
922  }
923  else if (it->first == EVTColContainer::CALOMET) {
925  iEvent.getByToken(it->second, theHandle);
926  if (theHandle.isValid()) col->set(theHandle.product());
927  }
928  else if (it->first == EVTColContainer::L1MET) {
930  iEvent.getByToken(it->second, theHandle);
931  if (theHandle.isValid()) col->set(theHandle.product());
932  }
933  else if (it->first == EVTColContainer::PFTAU) {
935  iEvent.getByToken(it->second, theHandle);
936  if (theHandle.isValid()) col->set(theHandle.product());
937  }
938  else if (it->first == EVTColContainer::PFJET) {
940  iEvent.getByToken(it->second, theHandle);
941  if (theHandle.isValid()) col->set(theHandle.product());
942  }
943  else if (it->first == EVTColContainer::CALOJET) {
945  iEvent.getByToken(it->second, theHandle);
946  if (theHandle.isValid()) col->set(theHandle.product());
947  }
948  else {
949  edm::LogError("ExoticaValidation") << "HLTExoticaSubAnalysis::getHandlesToObjects "
950  << " NOT IMPLEMENTED (yet) ERROR: '" << it->first << "'";
951  }
952  }
953 }
#define LogDebug(id)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:449
const reco::GenParticleCollection * genParticles
edm::EDGetTokenT< edm::TriggerResults > _trigResultsToken
void setPFMHT(const reco::PFMETCollection *v)
void set(const reco::MuonCollection *v)
Setter: multiple overloaded function.
bool isValid() const
Definition: HandleBase.h:75
T const * product() const
Definition: Handle.h:81
std::map< unsigned int, edm::EDGetToken > _tokens
edm::EDGetTokenT< reco::GenParticleCollection > _genParticleToken
And also the tokens to get the object collections.
const edm::TriggerResults * triggerResults
void HLTExoticaSubAnalysis::getNamesOfObjects ( const edm::ParameterSet anpset)
private

Creates the maps that map which collection should come from which label.

Definition at line 684 of file HLTExoticaSubAnalysis.cc.

References _analysisname, _genSelectorMap, _recLabels, EVTColContainer::CALOJET, EVTColContainer::CALOMET, EVTColContainer::ELEC, edm::ParameterSet::exists(), EVTColContainer::GENMET, edm::ParameterSet::getParameter(), EVTColContainer::L1MET, LogDebug, EVTColContainer::MET, EVTColContainer::MUON, EVTColContainer::MUTRK, EVTColContainer::PFJET, EVTColContainer::PFMET, EVTColContainer::PFMHT, EVTColContainer::PFTAU, EVTColContainer::PHOTON, and EVTColContainer::TRACK.

Referenced by HLTExoticaSubAnalysis().

685 {
686  LogDebug("ExoticaValidation") << "In HLTExoticaSubAnalysis::getNamesOfObjects()";
687 
688  if (anpset.exists("recMuonLabel")) {
689  _recLabels[EVTColContainer::MUON] = anpset.getParameter<edm::InputTag>("recMuonLabel");
691  }
692  if (anpset.exists("recMuonTrkLabel")) {
693  _recLabels[EVTColContainer::MUTRK] = anpset.getParameter<edm::InputTag>("recMuonTrkLabel");
695  }
696  if (anpset.exists("recTrackLabel")) {
697  _recLabels[EVTColContainer::TRACK] = anpset.getParameter<edm::InputTag>("recTrackLabel");
699  }
700  if (anpset.exists("recElecLabel")) {
701  _recLabels[EVTColContainer::ELEC] = anpset.getParameter<edm::InputTag>("recElecLabel");
703  }
704  if (anpset.exists("recPhotonLabel")) {
705  _recLabels[EVTColContainer::PHOTON] = anpset.getParameter<edm::InputTag>("recPhotonLabel");
707  }
708  if (anpset.exists("recMETLabel")) {
709  _recLabels[EVTColContainer::MET] = anpset.getParameter<edm::InputTag>("recMETLabel");
711  }
712  if (anpset.exists("recPFMETLabel")) {
713  _recLabels[EVTColContainer::PFMET] = anpset.getParameter<edm::InputTag>("recPFMETLabel");
715  }
716  if (anpset.exists("recPFMHTLabel")) {
717  _recLabels[EVTColContainer::PFMHT] = anpset.getParameter<edm::InputTag>("recPFMHTLabel");
719  }
720  if (anpset.exists("genMETLabel")) {
723  }
724  if (anpset.exists("recCaloMETLabel")) {
725  _recLabels[EVTColContainer::CALOMET] = anpset.getParameter<edm::InputTag>("recCaloMETLabel");
727  }
728  if (anpset.exists("hltMETLabel")) {
731  }
732  if (anpset.exists("l1METLabel")) {
735  }
736  if (anpset.exists("recPFTauLabel")) {
737  _recLabels[EVTColContainer::PFTAU] = anpset.getParameter<edm::InputTag>("recPFTauLabel");
739  }
740  if (anpset.exists("recPFJetLabel")) {
741  _recLabels[EVTColContainer::PFJET] = anpset.getParameter<edm::InputTag>("recPFJetLabel");
743  }
744  if (anpset.exists("recCaloJetLabel")) {
745  _recLabels[EVTColContainer::CALOJET] = anpset.getParameter<edm::InputTag>("recCaloJetLabel");
747  }
748 
749  if (_recLabels.size() < 1) {
750  edm::LogError("ExoticaValidation") << "HLTExoticaSubAnalysis::getNamesOfObjects, "
751  << "Not included any object (recMuonLabel, recElecLabel, ...) "
752  << "in the analysis " << _analysisname;
753  return;
754  }
755 }
#define LogDebug(id)
T getParameter(std::string const &) const
bool exists(std::string const &parameterName) const
checks if a parameter exists
std::map< unsigned int, edm::InputTag > _recLabels
std::string _analysisname
The name of this sub-analysis.
std::map< unsigned int, StringCutObjectSelector< reco::GenParticle > * > _genSelectorMap
const std::vector< unsigned int > HLTExoticaSubAnalysis::getObjectsType ( const std::string &  hltpath) const
private

closes analyze method

Return the objects (muons,electrons,photons,...) needed by a HLT path. Will in general return: 0 for muon, 1 for electron, 2 for photon, 3 for PFMET, 4 for PFTau, 5 for Jet. Notice that this function is really based on a parsing of the name of the path; any incongruences there may lead to problems.

Definition at line 645 of file HLTExoticaSubAnalysis.cc.

References EVTColContainer::CALOJET, EVTColContainer::CALOMET, EVTColContainer::ELEC, EVTColContainer::GENMET, EVTColContainer::getTypeString(), i, EVTColContainer::L1MET, LogDebug, EVTColContainer::MET, EVTColContainer::MUON, EVTColContainer::MUTRK, EVTColContainer::PFJET, EVTColContainer::PFMET, EVTColContainer::PFMHT, EVTColContainer::PFTAU, EVTColContainer::PHOTON, AlCaHLTBitMon_QueryRunRegistry::string, and EVTColContainer::TRACK.

646 {
647  LogDebug("ExoticaValidation") << "In HLTExoticaSubAnalysis::getObjectsType()";
648 
649  static const unsigned int objSize = 14;
650  static const unsigned int objtriggernames[] = {
665  };
666 
667  std::set<unsigned int> objsType;
668  // The object to deal has to be entered via the config .py
669  for (unsigned int i = 0; i < objSize; ++i) {
670  //std::cout << "(5) Gonna call with " << objtriggernames[i] << std::endl;
671  std::string objTypeStr = EVTColContainer::getTypeString(objtriggernames[i]);
672  // Check if it is needed this object for this trigger
673  if (! TString(hltPath).Contains(objTypeStr)) {
674  continue;
675  }
676 
677  objsType.insert(objtriggernames[i]);
678  }
679 
680  return std::vector<unsigned int>(objsType.begin(), objsType.end());
681 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
static const std::string getTypeString(const unsigned int &objtype)
Tranform types into strings.
void HLTExoticaSubAnalysis::initSelector ( const unsigned int &  objtype)
private

Initializes the selectors of the objects based on which object it is.

Definition at line 1024 of file HLTExoticaSubAnalysis.cc.

References _genMETSelector, _l1METSelector, _recCaloJetSelector, _recCaloMETSelector, _recCut, _recElecSelector, _recMETSelector, _recMuonSelector, _recMuonTrkSelector, _recPFJetSelector, _recPFMETSelector, _recPFMHTSelector, _recPFTauSelector, _recPhotonSelector, _recTrackSelector, EVTColContainer::CALOJET, EVTColContainer::CALOMET, EVTColContainer::ELEC, EVTColContainer::GENMET, EVTColContainer::L1MET, LogDebug, EVTColContainer::MET, EVTColContainer::MUON, EVTColContainer::MUTRK, EVTColContainer::PFJET, EVTColContainer::PFMET, EVTColContainer::PFMHT, EVTColContainer::PFTAU, EVTColContainer::PHOTON, and EVTColContainer::TRACK.

Referenced by analyze().

1025 {
1026 
1027  LogDebug("ExoticaValidation") << "In HLTExoticaSubAnalysis::initSelector()";
1028 
1029  if (objtype == EVTColContainer::MUON && _recMuonSelector == 0) {
1031  } else if (objtype == EVTColContainer::MUTRK && _recMuonTrkSelector == 0) {
1033  } else if (objtype == EVTColContainer::TRACK && _recTrackSelector == 0) {
1035  } else if (objtype == EVTColContainer::ELEC && _recElecSelector == 0) {
1037  } else if (objtype == EVTColContainer::PHOTON && _recPhotonSelector == 0) {
1039  } else if (objtype == EVTColContainer::MET && _recMETSelector == 0) {
1041  } else if (objtype == EVTColContainer::PFMET && _recPFMETSelector == 0) {
1043  } else if (objtype == EVTColContainer::PFMHT && _recPFMHTSelector == 0) {
1045  } else if (objtype == EVTColContainer::GENMET && _genMETSelector == 0) {
1047  } else if (objtype == EVTColContainer::CALOMET && _recCaloMETSelector == 0) {
1049  } else if (objtype == EVTColContainer::L1MET && _l1METSelector == 0) {
1051  } else if (objtype == EVTColContainer::PFTAU && _recPFTauSelector == 0) {
1053  } else if (objtype == EVTColContainer::PFJET && _recPFJetSelector == 0) {
1055  } else if (objtype == EVTColContainer::CALOJET && _recCaloJetSelector == 0) {
1057  }
1058  /* else
1059  {
1060  FIXME: ERROR NOT IMPLEMENTED
1061  }*/
1062 }
#define LogDebug(id)
StringCutObjectSelector< reco::Track > * _recMuonTrkSelector
StringCutObjectSelector< reco::CaloJet > * _recCaloJetSelector
StringCutObjectSelector< reco::GenMET > * _genMETSelector
StringCutObjectSelector< reco::MET > * _recMETSelector
StringCutObjectSelector< reco::PFJet > * _recPFJetSelector
StringCutObjectSelector< reco::GsfElectron > * _recElecSelector
StringCutObjectSelector< reco::Muon > * _recMuonSelector
std::map< unsigned int, std::string > _recCut
StringCutObjectSelector< reco::Track > * _recTrackSelector
StringCutObjectSelector< reco::PFMET > * _recPFMETSelector
StringCutObjectSelector< reco::Photon > * _recPhotonSelector
StringCutObjectSelector< l1extra::L1EtMissParticle > * _l1METSelector
StringCutObjectSelector< reco::CaloMET > * _recCaloMETSelector
StringCutObjectSelector< reco::PFMET > * _recPFMHTSelector
StringCutObjectSelector< reco::PFTau > * _recPFTauSelector
void HLTExoticaSubAnalysis::insertCandidates ( const unsigned int &  objtype,
const EVTColContainer col,
std::vector< reco::LeafCandidate > *  matches,
std::map< int, double > &  theSumEt 
)
private

This function applies the selectors initialized previously to the objects, and matches the passing objects to HLT objects.

This is a special case. Passing a PFMET* to the constructor of MatchStruct will trigger the usage of the special constructor which also sets the sumEt member.

Definition at line 1065 of file HLTExoticaSubAnalysis.cc.

References _genMETSelector, _l1METSelector, _recCaloJetSelector, _recCaloMETSelector, _recElecSelector, _recMuonSelector, _recMuonTrkSelector, _recPFJetSelector, _recPFMETSelector, _recPFMHTSelector, _recPFTauSelector, _recPhotonSelector, _recTrackSelector, EVTColContainer::CALOJET, EVTColContainer::caloJets, EVTColContainer::CALOMET, EVTColContainer::caloMETs, EVTColContainer::ELEC, EVTColContainer::electrons, EVTColContainer::GENMET, EVTColContainer::genMETs, i, EVTColContainer::L1MET, EVTColContainer::l1METs, LogDebug, contentValuesFiles::m, EVTColContainer::MUON, EVTColContainer::muons, EVTColContainer::MUTRK, EVTColContainer::PFJET, EVTColContainer::pfJets, EVTColContainer::PFMET, EVTColContainer::pfMETs, EVTColContainer::PFMHT, EVTColContainer::pfMHTs, EVTColContainer::PFTAU, EVTColContainer::pfTaus, EVTColContainer::PHOTON, EVTColContainer::photons, EVTColContainer::TRACK, and EVTColContainer::tracks.

Referenced by analyze().

1066 {
1067 
1068  LogDebug("ExoticaValidation") << "In HLTExoticaSubAnalysis::insertCandidates()";
1069 
1070  theSumEt[objType] = -1;
1071 
1072  if (objType == EVTColContainer::MUON) {
1073  for (size_t i = 0; i < cols->muons->size(); i++) {
1074  LogDebug("ExoticaValidation") << "Inserting muon " << i ;
1075  if (_recMuonSelector->operator()(cols->muons->at(i))) {
1076  reco::LeafCandidate m(0, cols->muons->at(i).p4(), cols->muons->at(i).vertex(), objType, 0, true);
1077  matches->push_back(m);
1078  }
1079  }
1080  } else if (objType == EVTColContainer::MUTRK) {
1081  for (size_t i = 0; i < cols->tracks->size(); i++) {
1082  LogDebug("ExoticaValidation") << "Inserting muonTrack " << i ;
1083  if (_recMuonTrkSelector->operator()(cols->tracks->at(i))) {
1084  ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double>> mom4;
1085  ROOT::Math::XYZVector mom3 = cols->tracks->at(i).momentum();
1086  mom4.SetXYZT(mom3.x(),mom3.y(),mom3.z(),mom3.r());
1087  reco::LeafCandidate m(0, mom4, cols->tracks->at(i).vertex(), objType, 0, true);
1088  matches->push_back(m);
1089  }
1090  }
1091  } else if (objType == EVTColContainer::TRACK) {
1092  for (size_t i = 0; i < cols->tracks->size(); i++) {
1093  LogDebug("ExoticaValidation") << "Inserting Track " << i ;
1094  if (_recTrackSelector->operator()(cols->tracks->at(i))) {
1095  ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double>> mom4;
1096  ROOT::Math::XYZVector mom3 = cols->tracks->at(i).momentum();
1097  mom4.SetXYZT(mom3.x(),mom3.y(),mom3.z(),mom3.r());
1098  reco::LeafCandidate m(0, mom4, cols->tracks->at(i).vertex(), objType, 0, true);
1099  matches->push_back(m);
1100  }
1101  }
1102  } else if (objType == EVTColContainer::ELEC) {
1103  for (size_t i = 0; i < cols->electrons->size(); i++) {
1104  LogDebug("ExoticaValidation") << "Inserting electron " << i ;
1105  if (_recElecSelector->operator()(cols->electrons->at(i))) {
1106  reco::LeafCandidate m(0, cols->electrons->at(i).p4(), cols->electrons->at(i).vertex(), objType, 0, true);
1107  matches->push_back(m);
1108  }
1109  }
1110  } else if (objType == EVTColContainer::PHOTON) {
1111  for (size_t i = 0; i < cols->photons->size(); i++) {
1112  LogDebug("ExoticaValidation") << "Inserting photon " << i ;
1113  if (_recPhotonSelector->operator()(cols->photons->at(i))) {
1114  reco::LeafCandidate m(0, cols->photons->at(i).p4(), cols->photons->at(i).vertex(), objType, 0, true);
1115  matches->push_back(m);
1116  }
1117  }
1118  } else if (objType == EVTColContainer::PFMET) {
1122  for (size_t i = 0; i < cols->pfMETs->size(); i++) {
1123  LogDebug("ExoticaValidation") << "Inserting PFMET " << i ;
1124  if (_recPFMETSelector->operator()(cols->pfMETs->at(i))) {
1125  reco::LeafCandidate m(0, cols->pfMETs->at(i).p4(), cols->pfMETs->at(i).vertex(), objType, 0, true);
1126  matches->push_back(m);
1127  if(i==0) theSumEt[objType] = cols->pfMETs->at(i).sumEt();
1128  }
1129  }
1130  } else if (objType == EVTColContainer::PFMHT) {
1131  for (size_t i = 0; i < cols->pfMHTs->size(); i++) {
1132  LogDebug("ExoticaValidation") << "Inserting PFMHT " << i ;
1133  if (_recPFMHTSelector->operator()(cols->pfMHTs->at(i))) {
1134  reco::LeafCandidate m(0, cols->pfMHTs->at(i).p4(), cols->pfMHTs->at(i).vertex(), objType, 0, true);
1135  matches->push_back(m);
1136  if(i==0) theSumEt[objType] = cols->pfMHTs->at(i).sumEt();
1137  }
1138  }
1139  } else if (objType == EVTColContainer::GENMET) {
1140  for (size_t i = 0; i < cols->genMETs->size(); i++) {
1141  LogDebug("ExoticaValidation") << "Inserting GENMET " << i ;
1142  if (_genMETSelector->operator()(cols->genMETs->at(i))) {
1143  reco::LeafCandidate m(0, cols->genMETs->at(i).p4(), cols->genMETs->at(i).vertex(), objType, 0, true);
1144  matches->push_back(m);
1145  if(i==0) theSumEt[objType] = cols->genMETs->at(i).sumEt();
1146  }
1147  }
1148  } else if (objType == EVTColContainer::CALOMET) {
1149  for (size_t i = 0; i < cols->caloMETs->size(); i++) {
1150  LogDebug("ExoticaValidation") << "Inserting CALOMET " << i ;
1151  if (_recCaloMETSelector->operator()(cols->caloMETs->at(i))) {
1152  reco::LeafCandidate m(0, cols->caloMETs->at(i).p4(), cols->caloMETs->at(i).vertex(), objType, 0, true);
1153  matches->push_back(m);
1154  if(i==0) theSumEt[objType] = cols->caloMETs->at(i).sumEt();
1155  }
1156  }
1157  } else if (objType == EVTColContainer::L1MET) {
1158  for (size_t i = 0; i < cols->l1METs->size(); i++) {
1159  LogDebug("ExoticaValidation") << "Inserting L1MET " << i ;
1160  if (_l1METSelector->operator()(cols->l1METs->at(i))) {
1161  reco::LeafCandidate m(0, cols->l1METs->at(i).p4(), cols->l1METs->at(i).vertex(), objType, 0, true);
1162  matches->push_back(m);
1163  if(i==0) theSumEt[objType] = cols->l1METs->at(i).etTotal();
1164  }
1165  }
1166  } else if (objType == EVTColContainer::PFTAU) {
1167  for (size_t i = 0; i < cols->pfTaus->size(); i++) {
1168  LogDebug("ExoticaValidation") << "Inserting PFtau " << i ;
1169  if (_recPFTauSelector->operator()(cols->pfTaus->at(i))) {
1170  reco::LeafCandidate m(0, cols->pfTaus->at(i).p4(), cols->pfTaus->at(i).vertex(), objType, 0, true);
1171  matches->push_back(m);
1172  }
1173  }
1174  } else if (objType == EVTColContainer::PFJET) {
1175  for (size_t i = 0; i < cols->pfJets->size(); i++) {
1176  LogDebug("ExoticaValidation") << "Inserting jet " << i ;
1177  if (_recPFJetSelector->operator()(cols->pfJets->at(i))) {
1178  reco::LeafCandidate m(0, cols->pfJets->at(i).p4(), cols->pfJets->at(i).vertex(), objType, 0, true);
1179  matches->push_back(m);
1180  }
1181  }
1182  } else if (objType == EVTColContainer::CALOJET) {
1183  for (size_t i = 0; i < cols->caloJets->size(); i++) {
1184  LogDebug("ExoticaValidation") << "Inserting jet " << i ;
1185  if (_recCaloJetSelector->operator()(cols->caloJets->at(i))) {
1186  reco::LeafCandidate m(0, cols->caloJets->at(i).p4(), cols->caloJets->at(i).vertex(), objType, 0, true);
1187  matches->push_back(m);
1188  }
1189  }
1190  }
1191 
1192  /* else
1193  {
1194  FIXME: ERROR NOT IMPLEMENTED
1195  }*/
1196 }
#define LogDebug(id)
StringCutObjectSelector< reco::Track > * _recMuonTrkSelector
int i
Definition: DBlmapReader.cc:9
StringCutObjectSelector< reco::CaloJet > * _recCaloJetSelector
StringCutObjectSelector< reco::GenMET > * _genMETSelector
StringCutObjectSelector< reco::PFJet > * _recPFJetSelector
StringCutObjectSelector< reco::GsfElectron > * _recElecSelector
StringCutObjectSelector< reco::Muon > * _recMuonSelector
StringCutObjectSelector< reco::Track > * _recTrackSelector
Transform3DPJ::Vector XYZVector
StringCutObjectSelector< reco::PFMET > * _recPFMETSelector
StringCutObjectSelector< reco::Photon > * _recPhotonSelector
StringCutObjectSelector< l1extra::L1EtMissParticle > * _l1METSelector
StringCutObjectSelector< reco::CaloMET > * _recCaloMETSelector
StringCutObjectSelector< reco::PFMET > * _recPFMHTSelector
StringCutObjectSelector< reco::PFTau > * _recPFTauSelector
void HLTExoticaSubAnalysis::registerConsumes ( edm::ConsumesCollector consCollector)
private

Registers consumption of objects.

Definition at line 759 of file HLTExoticaSubAnalysis.cc.

References _genParticleLabel, _genParticleToken, _recLabels, _tokens, _trigResultsLabel, _trigResultsToken, EVTColContainer::CALOJET, EVTColContainer::CALOMET, edm::ConsumesCollector::consumes(), EVTColContainer::ELEC, EVTColContainer::GENMET, EVTColContainer::L1MET, LogDebug, EVTColContainer::MET, EVTColContainer::MUON, EVTColContainer::MUTRK, EVTColContainer::PFJET, EVTColContainer::PFMET, EVTColContainer::PFMHT, EVTColContainer::PFTAU, EVTColContainer::PHOTON, and EVTColContainer::TRACK.

Referenced by HLTExoticaSubAnalysis().

760 {
761  // Register that we are getting genParticles
763 
764  // Register that we are getting the trigger results
766  // Loop over _recLabels, see what we need, and register.
767  // Then save the registered token in _tokens.
768  // Remember: _recLabels is a map<uint, edm::InputTag>
769  // Remember: _tokens is a map<uint, edm::EDGetToken>
770  LogDebug("ExoticaValidation") << "We have got " << _recLabels.size() << "recLabels";
771  for (std::map<unsigned int, edm::InputTag>::iterator it = _recLabels.begin();
772  it != _recLabels.end(); ++it) {
773  if (it->first == EVTColContainer::MUON) {
774  edm::EDGetTokenT<reco::MuonCollection> particularToken = iC.consumes<reco::MuonCollection>(it->second);
775  edm::EDGetToken token(particularToken);
776  _tokens[it->first] = token;
777  }
778  else if (it->first == EVTColContainer::MUTRK) {
779  edm::EDGetTokenT<reco::TrackCollection> particularToken = iC.consumes<reco::TrackCollection>(it->second);
780  edm::EDGetToken token(particularToken);
781  _tokens[it->first] = token;
782  }
783  else if (it->first == EVTColContainer::TRACK) {
784  edm::EDGetTokenT<reco::TrackCollection> particularToken = iC.consumes<reco::TrackCollection>(it->second);
785  edm::EDGetToken token(particularToken);
786  _tokens[it->first] = token;
787  }
788  else if (it->first == EVTColContainer::ELEC) {
789  edm::EDGetTokenT<reco::GsfElectronCollection> particularToken = iC.consumes<reco::GsfElectronCollection>(it->second);
790  edm::EDGetToken token(particularToken);
791  _tokens[it->first] = token;
792  }
793  else if (it->first == EVTColContainer::PHOTON) {
794  edm::EDGetTokenT<reco::PhotonCollection> particularToken = iC.consumes<reco::PhotonCollection>(it->second);
795  edm::EDGetToken token(particularToken);
796  _tokens[it->first] = token;
797  }
798  else if (it->first == EVTColContainer::MET) {
799  edm::EDGetTokenT<reco::METCollection> particularToken = iC.consumes<reco::METCollection>(it->second);
800  edm::EDGetToken token(particularToken);
801  _tokens[it->first] = token;
802  }
803  else if (it->first == EVTColContainer::PFMET) {
804  edm::EDGetTokenT<reco::PFMETCollection> particularToken = iC.consumes<reco::PFMETCollection>(it->second);
805  edm::EDGetToken token(particularToken);
806  _tokens[it->first] = token;
807  }
808  else if (it->first == EVTColContainer::PFMHT) {
809  edm::EDGetTokenT<reco::PFMETCollection> particularToken = iC.consumes<reco::PFMETCollection>(it->second);
810  edm::EDGetToken token(particularToken);
811  _tokens[it->first] = token;
812  }
813  else if (it->first == EVTColContainer::GENMET) {
814  edm::EDGetTokenT<reco::GenMETCollection> particularToken = iC.consumes<reco::GenMETCollection>(it->second);
815  edm::EDGetToken token(particularToken);
816  _tokens[it->first] = token;
817  }
818  else if (it->first == EVTColContainer::CALOMET) {
819  edm::EDGetTokenT<reco::CaloMETCollection> particularToken = iC.consumes<reco::CaloMETCollection>(it->second);
820  edm::EDGetToken token(particularToken);
821  _tokens[it->first] = token;
822  }
823  else if (it->first == EVTColContainer::L1MET) {
825  edm::EDGetToken token(particularToken);
826  _tokens[it->first] = token;
827  }
828  else if (it->first == EVTColContainer::PFTAU) {
829  edm::EDGetTokenT<reco::PFTauCollection> particularToken = iC.consumes<reco::PFTauCollection>(it->second);
830  edm::EDGetToken token(particularToken);
831  _tokens[it->first] = token;
832  }
833  else if (it->first == EVTColContainer::PFJET) {
834  edm::EDGetTokenT<reco::PFJetCollection> particularToken = iC.consumes<reco::PFJetCollection>(it->second);
835  edm::EDGetToken token(particularToken);
836  _tokens[it->first] = token;
837  }
838  else if (it->first == EVTColContainer::CALOJET) {
839  edm::EDGetTokenT<reco::CaloJetCollection> particularToken = iC.consumes<reco::CaloJetCollection>(it->second);
840  edm::EDGetToken token(particularToken);
841  _tokens[it->first] = token;
842  }
843  else {
844  edm::LogError("ExoticaValidation") << "HLTExoticaSubAnalysis::registerConsumes"
845  << " NOT IMPLEMENTED (yet) ERROR: '" << it->second.label() << "'";
846  }
847  }
848 
849 }
#define LogDebug(id)
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
std::vector< PFTau > PFTauCollection
collection of PFTau objects
Definition: PFTauFwd.h:9
std::vector< reco::GenMET > GenMETCollection
collection of GenMET objects
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:13
edm::EDGetTokenT< edm::TriggerResults > _trigResultsToken
std::vector< reco::MET > METCollection
collection of MET objects
Definition: METCollection.h:23
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
std::vector< Muon > MuonCollection
collection of Muon objects
Definition: MuonFwd.h:9
std::map< unsigned int, edm::InputTag > _recLabels
std::vector< reco::CaloMET > CaloMETCollection
collection of CaloMET objects
std::vector< Photon > PhotonCollection
collectin of Photon objects
Definition: PhotonFwd.h:9
std::map< unsigned int, edm::EDGetToken > _tokens
std::vector< PFJet > PFJetCollection
collection of PFJet objects
std::vector< reco::PFMET > PFMETCollection
collection of PFMET objects
edm::EDGetTokenT< reco::GenParticleCollection > _genParticleToken
And also the tokens to get the object collections.
std::vector< L1EtMissParticle > L1EtMissParticleCollection
std::vector< CaloJet > CaloJetCollection
collection of CaloJet objects
void HLTExoticaSubAnalysis::subAnalysisBookHistos ( DQMStore::IBooker iBooker,
const edm::Run iRun,
const edm::EventSetup iSetup 
)

Method to book all relevant histograms in the DQMStore. Uses the IBooker interface for thread safety. Intended to be called from master object.

Definition at line 179 of file HLTExoticaSubAnalysis.cc.

References _analysisname, _plotters, _recLabels, bookHist(), EVTColContainer::getTypeString(), i, LogDebug, DQMStore::IBooker::setCurrentFolder(), source, and AlCaHLTBitMon_QueryRunRegistry::string.

182 {
183 
184  LogDebug("ExoticaValidation") << "In HLTExoticaSubAnalysis::subAnalysisBookHistos()";
185 
186  // Create the folder structure inside HLT/Exotica
187  std::string baseDir = "HLT/Exotica/" + _analysisname + "/";
188  iBooker.setCurrentFolder(baseDir);
189 
190  // Book the gen/reco analysis-dependent histograms (denominators)
191  for (std::map<unsigned int, edm::InputTag>::const_iterator it = _recLabels.begin();
192  it != _recLabels.end(); ++it) {
193  const std::string objStr = EVTColContainer::getTypeString(it->first);
194  std::vector<std::string> sources(2);
195  sources[0] = "gen";
196  sources[1] = "rec";
197 
198  for (size_t i = 0; i < sources.size(); i++) {
199  std::string source = sources[i];
200 
201  if ( source == "gen" ) {
202  if ( TString(objStr).Contains("MET") ||
203  TString(objStr).Contains("MHT") ||
204  TString(objStr).Contains("Jet") ) {
205  continue;
206  } else {
207  bookHist(iBooker, source, objStr, "MaxPt1");
208  bookHist(iBooker, source, objStr, "MaxPt2");
209  bookHist(iBooker, source, objStr, "Eta");
210  bookHist(iBooker, source, objStr, "Phi");
211  }
212  } else { // reco
213  if ( TString(objStr).Contains("MET") ||
214  TString(objStr).Contains("MHT") ) {
215  bookHist(iBooker, source, objStr, "MaxPt1");
216  bookHist(iBooker, source, objStr, "SumEt");
217  } else {
218  bookHist(iBooker, source, objStr, "MaxPt1");
219  bookHist(iBooker, source, objStr, "MaxPt2");
220  bookHist(iBooker, source, objStr, "Eta");
221  bookHist(iBooker, source, objStr, "Phi");
222  }
223  }
224 
225  }
226  } // closes loop in _recLabels
227 
228  // Call the plotterBookHistos() (which books all the path dependent histograms)
229  LogDebug("ExoticaValidation") << " number of plotters = " << _plotters.size();
230  for (std::vector<HLTExoticaPlotter>::iterator it = _plotters.begin();
231  it != _plotters.end(); ++it) {
232  it->plotterBookHistos(iBooker, iRun, iSetup);
233  }
234 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
std::vector< HLTExoticaPlotter > _plotters
The plotters: managers of each hlt path where the plots are done.
std::map< unsigned int, edm::InputTag > _recLabels
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
std::string _analysisname
The name of this sub-analysis.
static const std::string getTypeString(const unsigned int &objtype)
Tranform types into strings.
static std::string const source
Definition: EdmProvDump.cc:42
void bookHist(DQMStore::IBooker &iBooker, const std::string &source, const std::string &objType, const std::string &variable)
The internal functions to book and fill histograms.

Member Data Documentation

std::string HLTExoticaSubAnalysis::_analysisname
private

The name of this sub-analysis.

Definition at line 119 of file HLTExoticaSubAnalysis.h.

Referenced by analyze(), beginRun(), getNamesOfObjects(), and subAnalysisBookHistos().

std::map<std::string, MonitorElement *> HLTExoticaSubAnalysis::_elements
private

Structure of the MonitorElements.

Definition at line 178 of file HLTExoticaSubAnalysis.h.

Referenced by bookHist(), and fillHist().

std::map<unsigned int, std::string> HLTExoticaSubAnalysis::_genCut
private

gen/rec objects cuts

Definition at line 147 of file HLTExoticaSubAnalysis.h.

Referenced by analyze(), and HLTExoticaSubAnalysis().

std::map<unsigned int, std::string> HLTExoticaSubAnalysis::_genCut_leading
private

gen/rec pt-leading objects cuts

Definition at line 150 of file HLTExoticaSubAnalysis.h.

Referenced by analyze(), and HLTExoticaSubAnalysis().

StringCutObjectSelector<reco::GenMET>* HLTExoticaSubAnalysis::_genMETSelector
private

Definition at line 163 of file HLTExoticaSubAnalysis.h.

Referenced by initSelector(), insertCandidates(), and ~HLTExoticaSubAnalysis().

edm::InputTag HLTExoticaSubAnalysis::_genParticleLabel
private

Definition at line 133 of file HLTExoticaSubAnalysis.h.

Referenced by registerConsumes().

edm::EDGetTokenT<reco::GenParticleCollection> HLTExoticaSubAnalysis::_genParticleToken
private

And also the tokens to get the object collections.

Definition at line 137 of file HLTExoticaSubAnalysis.h.

Referenced by getHandlesToObjects(), and registerConsumes().

std::map<unsigned int, StringCutObjectSelector<reco::GenParticle> *> HLTExoticaSubAnalysis::_genSelectorMap
private

The concrete String selectors (use the string cuts introduced via the config python)

Definition at line 155 of file HLTExoticaSubAnalysis.h.

Referenced by analyze(), getNamesOfObjects(), and ~HLTExoticaSubAnalysis().

HLTConfigProvider HLTExoticaSubAnalysis::_hltConfig
private

Interface to the HLT information.

Definition at line 175 of file HLTExoticaSubAnalysis.h.

Referenced by beginRun().

std::set<std::string> HLTExoticaSubAnalysis::_hltPaths
private

The hlt paths found in the hltConfig.

Definition at line 127 of file HLTExoticaSubAnalysis.h.

Referenced by beginRun().

std::vector<std::string> HLTExoticaSubAnalysis::_hltPathsToCheck
private

The hlt paths to check for.

Definition at line 125 of file HLTExoticaSubAnalysis.h.

Referenced by beginRun(), and HLTExoticaSubAnalysis().

std::string HLTExoticaSubAnalysis::_hltProcessName
private

The labels of the object collections to be used in this analysis.

Definition at line 132 of file HLTExoticaSubAnalysis.h.

Referenced by beginRun().

StringCutObjectSelector<l1extra::L1EtMissParticle>* HLTExoticaSubAnalysis::_l1METSelector
private

Definition at line 165 of file HLTExoticaSubAnalysis.h.

Referenced by initSelector(), insertCandidates(), and ~HLTExoticaSubAnalysis().

unsigned int HLTExoticaSubAnalysis::_minCandidates
private

The minimum number of reco/gen candidates needed by the analysis.

Definition at line 122 of file HLTExoticaSubAnalysis.h.

Referenced by analyze(), and HLTExoticaSubAnalysis().

std::vector<double> HLTExoticaSubAnalysis::_parametersEta
private

Some kinematical parameters.

Definition at line 142 of file HLTExoticaSubAnalysis.h.

Referenced by bookHist(), and HLTExoticaSubAnalysis().

std::vector<double> HLTExoticaSubAnalysis::_parametersPhi
private

Definition at line 143 of file HLTExoticaSubAnalysis.h.

Referenced by bookHist(), and HLTExoticaSubAnalysis().

std::vector<double> HLTExoticaSubAnalysis::_parametersTurnOn
private

Definition at line 144 of file HLTExoticaSubAnalysis.h.

Referenced by bookHist(), and HLTExoticaSubAnalysis().

std::vector<HLTExoticaPlotter> HLTExoticaSubAnalysis::_plotters
private

The plotters: managers of each hlt path where the plots are done.

Definition at line 172 of file HLTExoticaSubAnalysis.h.

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

edm::ParameterSet HLTExoticaSubAnalysis::_pset
private

Internal, working copy of the PSet passed from above.

Definition at line 116 of file HLTExoticaSubAnalysis.h.

Referenced by beginRun(), and HLTExoticaSubAnalysis().

StringCutObjectSelector<reco::CaloJet>* HLTExoticaSubAnalysis::_recCaloJetSelector
private

Definition at line 169 of file HLTExoticaSubAnalysis.h.

Referenced by initSelector(), insertCandidates(), and ~HLTExoticaSubAnalysis().

StringCutObjectSelector<reco::CaloMET>* HLTExoticaSubAnalysis::_recCaloMETSelector
private

Definition at line 164 of file HLTExoticaSubAnalysis.h.

Referenced by initSelector(), insertCandidates(), and ~HLTExoticaSubAnalysis().

std::map<unsigned int, std::string> HLTExoticaSubAnalysis::_recCut
private

Definition at line 148 of file HLTExoticaSubAnalysis.h.

Referenced by HLTExoticaSubAnalysis(), and initSelector().

std::map<unsigned int, std::string> HLTExoticaSubAnalysis::_recCut_leading
private

Definition at line 151 of file HLTExoticaSubAnalysis.h.

Referenced by analyze(), and HLTExoticaSubAnalysis().

StringCutObjectSelector<reco::GsfElectron>* HLTExoticaSubAnalysis::_recElecSelector
private

Definition at line 159 of file HLTExoticaSubAnalysis.h.

Referenced by initSelector(), insertCandidates(), and ~HLTExoticaSubAnalysis().

std::map<unsigned int, edm::InputTag> HLTExoticaSubAnalysis::_recLabels
private
StringCutObjectSelector<reco::MET>* HLTExoticaSubAnalysis::_recMETSelector
private

Definition at line 160 of file HLTExoticaSubAnalysis.h.

Referenced by initSelector(), and ~HLTExoticaSubAnalysis().

StringCutObjectSelector<reco::Muon>* HLTExoticaSubAnalysis::_recMuonSelector
private

Definition at line 156 of file HLTExoticaSubAnalysis.h.

Referenced by initSelector(), insertCandidates(), and ~HLTExoticaSubAnalysis().

StringCutObjectSelector<reco::Track>* HLTExoticaSubAnalysis::_recMuonTrkSelector
private

Definition at line 157 of file HLTExoticaSubAnalysis.h.

Referenced by initSelector(), insertCandidates(), and ~HLTExoticaSubAnalysis().

StringCutObjectSelector<reco::PFJet>* HLTExoticaSubAnalysis::_recPFJetSelector
private

Definition at line 168 of file HLTExoticaSubAnalysis.h.

Referenced by initSelector(), insertCandidates(), and ~HLTExoticaSubAnalysis().

StringCutObjectSelector<reco::PFMET>* HLTExoticaSubAnalysis::_recPFMETSelector
private

Definition at line 161 of file HLTExoticaSubAnalysis.h.

Referenced by initSelector(), insertCandidates(), and ~HLTExoticaSubAnalysis().

StringCutObjectSelector<reco::PFMET>* HLTExoticaSubAnalysis::_recPFMHTSelector
private

Definition at line 162 of file HLTExoticaSubAnalysis.h.

Referenced by initSelector(), insertCandidates(), and ~HLTExoticaSubAnalysis().

StringCutObjectSelector<reco::PFTau>* HLTExoticaSubAnalysis::_recPFTauSelector
private

Definition at line 166 of file HLTExoticaSubAnalysis.h.

Referenced by initSelector(), insertCandidates(), and ~HLTExoticaSubAnalysis().

StringCutObjectSelector<reco::Photon>* HLTExoticaSubAnalysis::_recPhotonSelector
private

Definition at line 167 of file HLTExoticaSubAnalysis.h.

Referenced by initSelector(), insertCandidates(), and ~HLTExoticaSubAnalysis().

StringCutObjectSelector<reco::Track>* HLTExoticaSubAnalysis::_recTrackSelector
private

Definition at line 158 of file HLTExoticaSubAnalysis.h.

Referenced by initSelector(), insertCandidates(), and ~HLTExoticaSubAnalysis().

std::map<std::string, std::string> HLTExoticaSubAnalysis::_shortpath2long
private

Relation between the short and long versions of the path.

Definition at line 129 of file HLTExoticaSubAnalysis.h.

Referenced by analyze(), and beginRun().

std::map<unsigned int, edm::EDGetToken> HLTExoticaSubAnalysis::_tokens
private

Definition at line 139 of file HLTExoticaSubAnalysis.h.

Referenced by getHandlesToObjects(), and registerConsumes().

edm::InputTag HLTExoticaSubAnalysis::_trigResultsLabel
private

Definition at line 134 of file HLTExoticaSubAnalysis.h.

Referenced by registerConsumes().

edm::EDGetTokenT<edm::TriggerResults> HLTExoticaSubAnalysis::_trigResultsToken
private

Definition at line 138 of file HLTExoticaSubAnalysis.h.

Referenced by getHandlesToObjects(), and registerConsumes().