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)
 
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...
 
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...
 
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
 
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::Muon > * 
_recMuonSelector
 
StringCutObjectSelector
< reco::Track > * 
_recMuonTrkSelector
 
StringCutObjectSelector
< reco::PFJet > * 
_recPFJetSelector
 
StringCutObjectSelector
< reco::PFMET > * 
_recPFMETSelector
 
StringCutObjectSelector
< reco::PFTau > * 
_recPFTauSelector
 
StringCutObjectSelector
< reco::Photon > * 
_recPhotonSelector
 
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 61 of file HLTExoticaSubAnalysis.h.

Member Enumeration Documentation

Enumerator
GEN 
RECO 

Definition at line 63 of file HLTExoticaSubAnalysis.h.

63  {
64  GEN = 98,
65  RECO = 99
66  };

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(), 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")),
48 {
49 
50  LogDebug("ExoticaValidation") << "In HLTExoticaSubAnalysis::constructor()";
51 
52  // Specific parameters for this analysis
53  edm::ParameterSet anpset = pset.getParameter<edm::ParameterSet>(analysisname);
54 
55  // If this analysis has a particular set of binnings, use it.
56  // (Taken from the analysis-specific parameter set, of course)
57  // The "true" in the beginning of _pset.insert() means
58  // "overwrite the parameter if need be".
59  if (anpset.exists("parametersTurnOn")) {
60  _parametersTurnOn = anpset.getParameter<std::vector<double> >("parametersTurnOn");
61  _pset.insert(true, "parametersTurnOn", anpset.retrieve("parametersTurnOn"));
62  }
63  if (anpset.exists("parametersEta")) {
64  _parametersEta = anpset.getParameter<std::vector<double> >("parametersEta");
65  _pset.insert(true, "parametersEta", anpset.retrieve("parametersEta"));
66  }
67  if (anpset.exists("parametersPhi")) {
68  _parametersPhi = anpset.getParameter<std::vector<double> >("parametersPhi");
69  _pset.insert(true, "parametersPhi", anpset.retrieve("parametersPhi"));
70  }
71 
72  // Get names of objects that we may want to get from the event.
73  // Notice that genParticles are dealt with separately.
74  this->getNamesOfObjects(anpset);
75 
76  // Since now we have the names, we should register the consumption
77  // of objects.
78  this->registerConsumes(consCollector);
79 
80  // Generic objects: Initialization of basic phase space cuts.
81  for (std::map<unsigned int, edm::InputTag>::const_iterator it = _recLabels.begin();
82  it != _recLabels.end(); ++it) {
83  const std::string objStr = EVTColContainer::getTypeString(it->first);
84  _genCut[it->first] = pset.getParameter<std::string>(std::string(objStr + "_genCut").c_str());
85  _recCut[it->first] = pset.getParameter<std::string>(std::string(objStr + "_recCut").c_str());
86  if (pset.exists(std::string(objStr + "_genCut_leading"))) {
87  _genCut_leading[it->first] = pset.getParameter<std::string>(std::string(objStr + "_genCut_leading").c_str());
88  }
89  if (pset.exists(std::string(objStr + "_recCut_leading"))) {
90  _recCut_leading[it->first] = pset.getParameter<std::string>(std::string(objStr + "_recCut_leading").c_str());
91  }
92  }
93 
94  //--- Updating parameters if has to be modified for this particular specific analysis
95  for (std::map<unsigned int, edm::InputTag>::const_iterator it = _recLabels.begin();
96  it != _recLabels.end(); ++it) {
97  const std::string objStr = EVTColContainer::getTypeString(it->first);
98 
99  try {
100  _genCut[it->first] = anpset.getUntrackedParameter<std::string>(std::string(objStr + "_genCut").c_str());
101  } catch (edm::Exception) {}
102 
103  try {
104  _recCut[it->first] = anpset.getUntrackedParameter<std::string>(std::string(objStr + "_recCut").c_str());
105  } catch (edm::Exception) {}
106 
107  }
108 
110  _hltPathsToCheck = anpset.getParameter<std::vector<std::string> >("hltPathsToCheck");
112  _minCandidates = anpset.getParameter<unsigned int>("minCandidates");
113 
114 }
#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.
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
std::vector< double > _parametersPhi
void insert(bool ok_to_replace, char const *, Entry const &)
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
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
std::vector< double > _parametersTurnOn
static const std::string getTypeString(const unsigned int &objtype)
Tranform types into strings.
StringCutObjectSelector< reco::PFTau > * _recPFTauSelector
HLTExoticaSubAnalysis::~HLTExoticaSubAnalysis ( )

End Constructor.

Definition at line 116 of file HLTExoticaSubAnalysis.cc.

References _genSelectorMap, _recCaloJetSelector, _recElecSelector, _recMuonSelector, _recMuonTrkSelector, _recPFJetSelector, _recPFMETSelector, _recPFTauSelector, _recPhotonSelector, and python.multivaluedict::map().

117 {
118  for (std::map<unsigned int, StringCutObjectSelector<reco::GenParticle>* >::iterator it = _genSelectorMap.begin();
119  it != _genSelectorMap.end(); ++it) {
120  delete it->second;
121  it->second = 0;
122  }
123  delete _recMuonSelector;
124  _recMuonSelector = 0;
125  delete _recMuonTrkSelector;
127  delete _recElecSelector;
128  _recElecSelector = 0;
129  delete _recPhotonSelector;
130  _recPhotonSelector = 0;
131  delete _recPFMETSelector;
132  _recPFMETSelector = 0;
133  delete _recPFTauSelector;
134  _recPFTauSelector = 0;
135  delete _recPFJetSelector;
136  _recPFJetSelector = 0;
137  delete _recCaloJetSelector;
139 }
StringCutObjectSelector< reco::Track > * _recMuonTrkSelector
StringCutObjectSelector< reco::CaloJet > * _recCaloJetSelector
StringCutObjectSelector< reco::PFJet > * _recPFJetSelector
StringCutObjectSelector< reco::GsfElectron > * _recElecSelector
StringCutObjectSelector< reco::Muon > * _recMuonSelector
StringCutObjectSelector< reco::PFMET > * _recPFMETSelector
StringCutObjectSelector< reco::Photon > * _recPhotonSelector
std::map< unsigned int, StringCutObjectSelector< reco::GenParticle > * > _genSelectorMap
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 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: First do the GEN case

GEN CASE ///

Close GEN case

RECO CASE ///

Debugging.

Close RECO case

Definition at line 295 of file HLTExoticaSubAnalysis.cc.

References _genCut, _genCut_leading, _genSelectorMap, _minCandidates, _plotters, _recCut_leading, _recLabels, _shortpath2long, edm::HLTGlobalStatus::accept(), eta(), fillHist(), EVTColContainer::genParticles, getHandlesToObjects(), EVTColContainer::getTypeString(), i, initSelector(), insertCandidates(), j, LogDebug, reco::Candidate::p4(), phi, RecoTauCleanerPlugins::pt, benchmark_cfg::select, edm::TriggerNames::size(), python.multivaluedict::sort(), AlCaHLTBitMon_QueryRunRegistry::string, edm::Event::triggerNames(), EVTColContainer::triggerResults, trigNames, findQualityFiles::v, and reco::Candidate::vertex().

296 {
297  LogDebug("ExoticaValidation") << "In HLTExoticaSubAnalysis::analyze()";
298 
299  // Loop over _recLabels to make sure everything is alright.
300  /*
301  std::cout << "Now printing the _recLabels" << std::endl;
302  for (std::map<unsigned int, edm::InputTag>::iterator it = _recLabels.begin();
303  it != _recLabels.end(); ++it) {
304  std::cout << "Number: " << it->first << "\t" << "Label: " << it->second.label() << std::endl;
305  }
306  */
307 
308  // Initialize the collection (the ones which have not been initialiazed yet)
309  //std::cout << "Setting handles to objects..." << std::endl;
310  this->getHandlesToObjects(iEvent, cols);
311 
312  // Utility map, mapping kinds of objects (GEN, RECO) to strings ("gen","rec")
313  //std::map<Level, std::string> u2str;
314  //u2str[Level::GEN] = "gen";
315  //u2str[Level::RECO] = "rec";
316 
317  // Extract the match structure containing the gen/reco candidates (electron, muons,...). This part is common to all the SubAnalyses
318 
319  //std::map<unsigned int, std::vector<MatchStruct> > sourceMatchMap;
320  //std::vector<MatchStruct> matchesGen; matchesGen.clear();
321  std::vector<reco::LeafCandidate> matchesGen; matchesGen.clear();
322  //std::vector<MatchStruct> matchesReco; matchesReco.clear();
323  std::vector<reco::LeafCandidate> matchesReco; matchesReco.clear();
324  //sourceMatchMap[98] = matchesGen;
325  //sourceMatchMap[99] = matchesReco;
326 
327  //std::cout << "In the beginning: matchesGen.size() = " << matchesGen.size() << std::endl;
328  //std::cout << "In the beginning: matchesReco.size() = " << matchesReco.size() << std::endl;
329 
330  // --- deal with GEN objects first.
331  // Make each good GEN object into the base cand for a MatchStruct
332  // Our definition of "good" is "passes the selector" defined in the config.py
333  // Save all the MatchStructs in the "matchesGen" vector.
334 
335  for (std::map<unsigned int, edm::InputTag>::iterator it = _recLabels.begin();
336  it != _recLabels.end(); ++it) {
337  // Here we are filling the vector of StringCutObjectSelector<reco::GenParticle>
338  // with objects constructed from the strings saved in _genCut.
339  // Initialize selectors when first event
340 
341  //std::cout << "Loop over the kinds of objects: objects of kind " << it->first << std::endl;
342 
343  if (!_genSelectorMap[it->first]) {
345  }
346 
347  // Now loop over the genParticles, and apply the operator() over each of them.
348  // Fancy syntax: for objects X and Y, X.operator()(Y) is the same as X(Y).
349  for (size_t i = 0; i < cols->genParticles->size(); ++i) {
350  //std::cout << "Now matchesGen.size() is " << matchesGen.size() << std::endl;
351  if (_genSelectorMap[it->first]->operator()(cols->genParticles->at(i))) {
352  const reco::Candidate* cand = &(cols->genParticles->at(i));
353  //std::cout << "Found good cand: cand->pt() = " << cand->pt() << std::endl;
354  //matchesGen.push_back(MatchStruct(cand, it->first));
357  reco::LeafCandidate v(0,cand->p4(),cand->vertex(),it->first,0,true);
358  matchesGen.push_back(v);
359  }
360  }
361  }
362 
363  // Sort the matches by pT for later filling of turn-on curve
364  //std::cout << "Before sorting: matchesGen.size() = " << matchesGen.size() << std::endl;
366  std::sort(matchesGen.begin(),
367  matchesGen.end(),
368  comparator);
369  //std::cout << "After sorting: matchesGen.size() = " << matchesGen.size() << std::endl;
370 
371  //std::cout << "Before adding RECO: sourceMatchMap[98].size() = " << sourceMatchMap[98].size() << std::endl;
372  //std::cout << "Before adding RECO: matchesGen.size() = " << matchesGen.size() << std::endl;
373 
374  // --- same for RECO objects
375  // Extraction of the objects candidates
376  for (std::map<unsigned int, edm::InputTag>::iterator it = _recLabels.begin();
377  it != _recLabels.end(); ++it) {
378  //std::cout << "Filling RECO \"matchesReco\" vector for particle kind it->first = "
379  // << it->first << ", which means " << it->second.label() << std::endl;
380  // Reco selectors (the function takes into account if it was instantiated
381  // before or not) ### Thiago ---> Then why don't we put it in the beginRun???
382  this->initSelector(it->first);
383  // -- Storing the matchesReco
384  this->insertCandidates(it->first, cols, &matchesReco);
385  }
386 
387  //std::cout << "After adding RECO: matchesGen.size() = " << matchesGen.size() << std::endl;
388  //std::cout << "After adding RECO: matchesReco.size() = " << matchesReco.size() << std::endl;
389 
390  std::sort(matchesReco.begin(),
391  matchesReco.end(),
392  comparator);
393 
394 
395  // --- All the objects are in place
396  //std::cout << "DEBUG(0)" << std::endl;
397 
398  // -- Trigger Results
399  const edm::TriggerNames trigNames = iEvent.triggerNames(*(cols->triggerResults));
400 
403 
404  //for (std::map<unsigned int, std::vector<MatchStruct> >::iterator it = sourceMatchMap.begin(); it != sourceMatchMap.end(); ++it) {
405  // it->first: gen/reco it->second: HLT matches (std::vector<MatchStruct>)
406 
407  //if (it->second.size() < _minCandidates) { // FIXME: A bug is potentially here: what about the mixed channels?
408  //continue;
409  //}
410 
414  {
415  if(matchesGen.size() < _minCandidates) return; // FIXME: A bug is potentially here: what about the mixed channels?
416  // Okay, there are enough candidates. Move on!
417 
418  // Filling the gen/reco objects (eff-denominators):
419  // Just the first two different ones, if there are more
420  // The countobjects maps uints (object types, really) --> integers.
421  // Example:
422  // | uint | int |
423  // | 0 | 1 | --> 1 muon used
424  // | 1 | 2 | --> 2 electrons used
425  // Initializing the count of the used objects.
426  std::map<unsigned int, int> countobjects;
427  for (std::map<unsigned int, edm::InputTag>::iterator co = _recLabels.begin();
428  co != _recLabels.end(); ++co) {
429  countobjects.insert(std::pair<unsigned int, int>(co->first, 0));
430  }
431 
432  int counttotal = 0;
433  int totalobjectssize2 = 2 * countobjects.size();
434 
435  for (size_t j = 0; j != matchesGen.size(); ++j) {
436  const unsigned int objType = matchesGen[j].pdgId();
437  //std::cout << "(4) Gonna call with " << objType << std::endl;
438  const std::string objTypeStr = EVTColContainer::getTypeString(objType);
439 
440  float pt = matchesGen[j].pt();
441 
442  if (countobjects[objType] == 0) {
443 
444  // Cut for the pt-leading object
446  if ( !select( matchesGen[j] ) ) break;
447 
448  this->fillHist("gen", objTypeStr, "MaxPt1", pt);
449  // Filled the high pt ...
450  ++countobjects[objType];
451  ++counttotal;
452  } else if (countobjects[objType] == 1) {
453  this->fillHist("gen", objTypeStr, "MaxPt2", pt);
454  // Filled the second high pt ...
455  ++countobjects[objType];
456  ++counttotal;
457  } else {
458  // Already the minimum two objects has been filled, get out...
459  if (counttotal == totalobjectssize2) {
460  break;
461  }
462  }
463 
464  float eta = matchesGen[j].eta();
465  float phi = matchesGen[j].phi();
466  float sumEt = 0;//matchesGen[j].sumEt;
467 
468  this->fillHist("gen", objTypeStr, "Eta", eta);
469  this->fillHist("gen", objTypeStr, "Phi", phi);
470  this->fillHist("gen", objTypeStr, "SumEt", sumEt);
471 
472  } // Closes loop in gen
473 
474  // Calling to the plotters analysis (where the evaluation of the different trigger paths are done)
475  //const std::string source = "gen";
476  for (std::vector<HLTExoticaPlotter>::iterator an = _plotters.begin(); an != _plotters.end(); ++an) {
477  const std::string hltPath = _shortpath2long[an->gethltpath()];
478  const bool ispassTrigger = cols->triggerResults->accept(trigNames.triggerIndex(hltPath));
479  LogDebug("ExoticaValidation") << " preparing to call the plotters analysis";
480  an->analyze(ispassTrigger, "gen", matchesGen);
481  LogDebug("ExoticaValidation") << " called the plotter";
482  }
483  }
484 
485 
489  {
490  if(matchesReco.size() < _minCandidates) return; // FIXME: A bug is potentially here: what about the mixed channels?
491 
492  // Okay, there are enough candidates. Move on!
493 
494  // Filling the gen/reco objects (eff-denominators):
495  // Just the first two different ones, if there are more
496  // The countobjects maps uints (object types, really) --> integers.
497  // Example:
498  // | uint | int |
499  // | 0 | 1 | --> 1 muon used
500  // | 1 | 2 | --> 2 electrons used
501  // Initializing the count of the used objects.
502  std::map<unsigned int, int> countobjects;
503  for (std::map<unsigned int, edm::InputTag>::iterator co = _recLabels.begin();
504  co != _recLabels.end(); ++co) {
505  countobjects.insert(std::pair<unsigned int, int>(co->first, 0));
506  }
507 
508  int counttotal = 0;
509  int totalobjectssize2 = 2 * countobjects.size();
510 
512  //std::cout << "Our RECO vector has matchesReco.size() = " << matchesReco.size() << std::endl;
513 
514  for (size_t j = 0; j != matchesReco.size(); ++j) {
515  const unsigned int objType = matchesReco[j].pdgId();
516  //std::cout << "(4) Gonna call with " << objType << std::endl;
517  const std::string objTypeStr = EVTColContainer::getTypeString(objType);
518 
519  float pt = matchesReco[j].pt();
520 
521  if (countobjects[objType] == 0) {
522 
523  // Cut for the pt-leading object
525  if ( !select( matchesReco[j] ) ) break;
526 
527  this->fillHist("rec", objTypeStr, "MaxPt1", pt);
528  // Filled the high pt ...
529  ++countobjects[objType];
530  ++counttotal;
531  } else if (countobjects[objType] == 1) {
532  this->fillHist("rec", objTypeStr, "MaxPt2", pt);
533  // Filled the second high pt ...
534  ++countobjects[objType];
535  ++counttotal;
536  } else {
537  // Already the minimum two objects has been filled, get out...
538  if (counttotal == totalobjectssize2) {
539  break;
540  }
541  }
542 
543  float eta = matchesReco[j].eta();
544  float phi = matchesReco[j].phi();
545  float sumEt = 0;//matchesReco[j].sumEt;
546 
547  this->fillHist("rec", objTypeStr, "Eta", eta);
548  this->fillHist("rec", objTypeStr, "Phi", phi);
549  this->fillHist("rec", objTypeStr, "SumEt", sumEt);
550  } // Closes loop in reco
551 
552  // Calling to the plotters analysis (where the evaluation of the different trigger paths are done)
553  //const std::string source = "reco";
554  for (std::vector<HLTExoticaPlotter>::iterator an = _plotters.begin(); an != _plotters.end(); ++an) {
555  const std::string hltPath = _shortpath2long[an->gethltpath()];
556  const bool ispassTrigger = cols->triggerResults->accept(trigNames.triggerIndex(hltPath));
557  LogDebug("ExoticaValidation") << " preparing to call the plotters analysis";
558  an->analyze(ispassTrigger, "rec", matchesReco);
559  LogDebug("ExoticaValidation") << " called the plotter";
560  }
561  }
562 
563 }
#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:199
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
Strings::size_type size() const
Definition: TriggerNames.cc:39
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
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::map< unsigned int, StringCutObjectSelector< reco::GenParticle > * > _genSelectorMap
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.
void insertCandidates(const unsigned int &objtype, const EVTColContainer *col, std::vector< reco::LeafCandidate > *matches)
const edm::TriggerResults * triggerResults
std::map< std::string, std::string > _shortpath2long
Relation between the short and long versions of the path.
virtual const LorentzVector & p4() const =0
four-momentum Lorentz vector
Definition: DDAxes.h:10
void HLTExoticaSubAnalysis::beginJob ( void  )

Definition at line 142 of file HLTExoticaSubAnalysis.cc.

143 {
144 }
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 190 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, listBenchmarks::pattern, AlCaHLTBitMon_QueryRunRegistry::string, and HLTConfigProvider::triggerNames().

191 {
192 
193  LogDebug("ExoticaValidation") << "In HLTExoticaSubAnalysis::beginRun()";
194 
197 
198  // Initialize the HLT config.
199  bool changedConfig(true);
200  if (!_hltConfig.init(iRun, iSetup, _hltProcessName, changedConfig)) {
201  edm::LogError("ExoticaValidation") << "HLTExoticaSubAnalysis::constructor(): "
202  << "Initialization of HLTConfigProvider failed!";
203  }
204 
205  // Parse the input paths to get them if they are in the table and associate
206  // them to the last filter of the path (in order to extract the objects).
207  _hltPaths.clear();
208  for (size_t i = 0; i < _hltPathsToCheck.size(); ++i) {
209  bool found = false;
210  TPRegexp pattern(_hltPathsToCheck[i]);
211 
212  // Loop over triggerNames from _hltConfig
213  for (size_t j = 0 ; j < _hltConfig.triggerNames().size(); ++j) {
214  std::string thetriggername = _hltConfig.triggerNames()[j];
215  if (TString(thetriggername).Contains(pattern)) {
216  _hltPaths.insert(thetriggername);
217  found = true;
218  }
219  if(verbose>2 && i==0)
220  std::cout << "--- TRIGGER PATH : " << thetriggername << std::endl;
221  }
222 
223  // Oh dear, the path we wanted seems to not be available
224  if (! found && verbose>2) {
225  edm::LogWarning("ExoticaValidation") << "HLTExoticaSubAnalysis::constructor(): In "
226  << _analysisname << " subfolder NOT found the path: '"
227  << _hltPathsToCheck[i] << "*'" ;
228  }
229  } // Close loop over paths to check.
230 
231  // At this point, _hltpaths contains the names of the paths to check
232  // that were found. Let's log it at trace level.
233  LogTrace("ExoticaValidation") << "SubAnalysis: " << _analysisname
234  << "\nHLT Trigger Paths found >>>";
235  for (std::set<std::string>::const_iterator iter = _hltPaths.begin();
236  iter != _hltPaths.end(); ++iter) {
237  LogTrace("ExoticaValidation") << (*iter) << "\n";
238  }
239 
240  // Initialize the plotters (analysers for each trigger path)
241  _plotters.clear();
242  for (std::set<std::string>::iterator iPath = _hltPaths.begin();
243  iPath != _hltPaths.end(); ++iPath) {
244  // Avoiding the dependence of the version number for the trigger paths
245  std::string path = * iPath;
246  std::string shortpath = path;
247  if (path.rfind("_v") < path.length()) {
248  shortpath = path.substr(0, path.rfind("_v"));
249  }
250  _shortpath2long[shortpath] = path;
251 
252  // Objects needed by the HLT path
253  // Thiago: instead of trying to decode the objects from the path,
254  // put the burden on the user to tell us which objects are needed.
255  //const std::vector<unsigned int> objsNeedHLT = this->getObjectsType(shortpath);
256  std::vector<unsigned int> objsNeedHLT;
257  for (std::map<unsigned int, edm::InputTag>::iterator it = _recLabels.begin() ;
258  it != _recLabels.end(); ++it) {
259  objsNeedHLT.push_back(it->first);
260  }
261 
262  /*std::vector<unsigned int> userInstantiate;
263  // Sanity check: the object needed by a trigger path should be
264  // introduced by the user via config python (_recLabels datamember)
265  for (std::map<unsigned int, edm::InputTag>::iterator it = _recLabels.begin() ;
266  it != _recLabels.end(); ++it) {
267  userInstantiate.push_back(it->first);
268  }
269  for (std::vector<unsigned int>::const_iterator it = objsNeedHLT.begin(); it != objsNeedHLT.end();
270  ++it) {
271  if (std::find(userInstantiate.begin(), userInstantiate.end(), *it) ==
272  userInstantiate.end()) {
273  edm::LogError("ExoticaValidation") << "In HLTExoticaSubAnalysis::beginRun, "
274  << "Incoherence found in the python configuration file!!\nThe SubAnalysis '"
275  << _analysisname << "' has been asked to evaluate the trigger path '"
276  << shortpath << "' (found it in 'hltPathsToCheck') BUT this path"
277  << " needs a '" << EVTColContainer::getTypeString(*it)
278  << "' which has not been instantiated ('recVariableLabels'"
279  << ")" ;
280  exit(-1); // This should probably throw an exception...
281  }
282  }
283  */
284  LogTrace("ExoticaValidation") << " --- " << shortpath;
285 
286  // The hlt path, the objects (electrons, muons, photons, ...)
287  // needed to evaluate the path are the argumens of the plotter
288  HLTExoticaPlotter analyzer(_pset, shortpath, objsNeedHLT);
289  _plotters.push_back(analyzer);
290  }// Okay, at this point we have prepared all the plotters.
291 
292 }
#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.
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 784 of file HLTExoticaSubAnalysis.cc.

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

Referenced by subAnalysisBookHistos().

788 {
789  LogDebug("ExoticaValidation") << "In HLTExoticaSubAnalysis::bookHist()";
790  std::string sourceUpper = source;
791  sourceUpper[0] = std::toupper(sourceUpper[0]);
792  std::string name = source + objType + variable ;
793  TH1F * h = 0;
794 
795  if (variable.find("SumEt") != std::string::npos) {
796  std::string title = "Sum ET of " + sourceUpper + " " + objType;
797  const size_t nBins = _parametersTurnOn.size() - 1;
798  float * edges = new float[nBins + 1];
799  for (size_t i = 0; i < nBins + 1; i++) {
800  edges[i] = _parametersTurnOn[i];
801  }
802  h = new TH1F(name.c_str(), title.c_str(), nBins, edges);
803  delete[] edges;
804  }
805  else if (variable.find("MaxPt") != std::string::npos) {
806  std::string desc = (variable == "MaxPt1") ? "Leading" : "Next-to-Leading";
807  std::string title = "pT of " + desc + " " + sourceUpper + " " + objType;
808  const size_t nBins = _parametersTurnOn.size() - 1;
809  float * edges = new float[nBins + 1];
810  for (size_t i = 0; i < nBins + 1; i++) {
811  edges[i] = _parametersTurnOn[i];
812  }
813  h = new TH1F(name.c_str(), title.c_str(), nBins, edges);
814  delete[] edges;
815  } else {
816  std::string symbol = (variable == "Eta") ? "#eta" : "#phi";
817  std::string title = symbol + " of " + sourceUpper + " " + objType;
818  std::vector<double> params = (variable == "Eta") ? _parametersEta : _parametersPhi;
819  int nBins = (int)params[0];
820  double min = params[1];
821  double max = params[2];
822  h = new TH1F(name.c_str(), title.c_str(), nBins, min, max);
823  }
824 
825  h->Sumw2();
826  // This is the trick, that takes a normal TH1F and puts it in in the DQM
827  // machinery. Seems to be easy!
828  // Updated to use the new iBooker machinery.
829  _elements[name] = iBooker.book1D(name, h);
830  delete h;
831 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
std::vector< double > _parametersPhi
dictionary edges
const T & max(const T &a, const T &b)
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
std::vector< double > _parametersTurnOn
std::map< std::string, MonitorElement * > _elements
Structure of the MonitorElements.
static std::string const source
Definition: EdmProvDump.cc:43
void HLTExoticaSubAnalysis::fillHist ( const std::string &  source,
const std::string &  objType,
const std::string &  variable,
const float &  value 
)
private

Definition at line 834 of file HLTExoticaSubAnalysis.cc.

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

Referenced by analyze().

838 {
839  std::string sourceUpper = source;
840  sourceUpper[0] = toupper(sourceUpper[0]);
841  std::string name = source + objType + variable ;
842 
843  LogDebug("ExoticaValidation") << "In HLTExoticaSubAnalysis::fillHist() " << name << " " << value;
844  _elements[name]->Fill(value);
845  LogDebug("ExoticaValidation") << "In HLTExoticaSubAnalysis::fillHist() " << name << " worked";
846 }
#define LogDebug(id)
std::map< std::string, MonitorElement * > _elements
Structure of the MonitorElements.
static std::string const source
Definition: EdmProvDump.cc:43
void HLTExoticaSubAnalysis::getHandlesToObjects ( const edm::Event iEvent,
EVTColContainer col 
)
private

Gets the collections themselves.

Definition at line 710 of file HLTExoticaSubAnalysis.cc.

References _genParticleToken, _tokens, _trigResultsToken, EVTColContainer::CALOJET, EVTColContainer::ELEC, EVTColContainer::genParticles, edm::Event::getByToken(), EVTColContainer::isCommonInit(), edm::HandleBase::isValid(), LogDebug, EVTColContainer::MUON, EVTColContainer::MUONTRACK, EVTColContainer::PFJET, EVTColContainer::PFMET, EVTColContainer::PFTAU, EVTColContainer::PHOTON, edm::Handle< T >::product(), EVTColContainer::set(), and EVTColContainer::triggerResults.

Referenced by analyze().

711 {
712  LogDebug("ExoticaValidation") << "In HLTExoticaSubAnalysis::getHandlesToObjects()";
713 
714  if (! col->isCommonInit()) {
715  // Extract the trigger results (path info, pass,...)
717  iEvent.getByToken(_trigResultsToken, trigResults);
718  if (trigResults.isValid()) {
719  col->triggerResults = trigResults.product();
720  LogDebug("ExoticaValidation") << "Added handle to triggerResults";
721  }
722 
723  // Extract the genParticles
725  iEvent.getByToken(_genParticleToken, genPart);
726  if (genPart.isValid()) {
727  col->genParticles = genPart.product();
728  LogDebug("ExoticaValidation") << "Added handle to genParticles";
729  }
730  }
731 
732  // Loop over the tokens and extract all other objects
733  LogDebug("ExoticaValidation") << "We have got " << _tokens.size() << "tokens";
734  for (std::map<unsigned int, edm::EDGetToken>::iterator it = _tokens.begin();
735  it != _tokens.end(); ++it) {
736  if (it->first == EVTColContainer::MUON) {
738  iEvent.getByToken(it->second, theHandle);
739  col->set(theHandle.product());
740  }
741  else if (it->first == EVTColContainer::MUONTRACK) {
743  iEvent.getByToken(it->second, theHandle);
744  col->set(theHandle.product());
745  }
746  else if (it->first == EVTColContainer::ELEC) {
748  iEvent.getByToken(it->second, theHandle);
749  col->set(theHandle.product());
750  }
751  else if (it->first == EVTColContainer::PHOTON) {
753  iEvent.getByToken(it->second, theHandle);
754  col->set(theHandle.product());
755  }
756  else if (it->first == EVTColContainer::PFMET) {
758  iEvent.getByToken(it->second, theHandle);
759  col->set(theHandle.product());
760  }
761  else if (it->first == EVTColContainer::PFTAU) {
763  iEvent.getByToken(it->second, theHandle);
764  col->set(theHandle.product());
765  }
766  else if (it->first == EVTColContainer::PFJET) {
768  iEvent.getByToken(it->second, theHandle);
769  col->set(theHandle.product());
770  }
771  else if (it->first == EVTColContainer::CALOJET) {
773  iEvent.getByToken(it->second, theHandle);
774  col->set(theHandle.product());
775  }
776  else {
777  edm::LogError("ExoticaValidation") << "HLTExoticaSubAnalysis::getHandlesToObjects "
778  << " NOT IMPLEMENTED (yet) ERROR: '" << it->first << "'";
779  }
780  }
781 }
#define LogDebug(id)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:446
const reco::GenParticleCollection * genParticles
edm::EDGetTokenT< edm::TriggerResults > _trigResultsToken
void set(const reco::MuonCollection *v)
Setter: multiple overloaded function.
bool isValid() const
Definition: HandleBase.h:76
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 600 of file HLTExoticaSubAnalysis.cc.

References _analysisname, _genSelectorMap, _recLabels, EVTColContainer::CALOJET, EVTColContainer::ELEC, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), LogDebug, EVTColContainer::MUON, EVTColContainer::MUONTRACK, EVTColContainer::PFJET, EVTColContainer::PFMET, EVTColContainer::PFTAU, and EVTColContainer::PHOTON.

Referenced by HLTExoticaSubAnalysis().

601 {
602  LogDebug("ExoticaValidation") << "In HLTExoticaSubAnalysis::getNamesOfObjects()";
603 
604  if (anpset.exists("recMuonLabel")) {
605  _recLabels[EVTColContainer::MUON] = anpset.getParameter<edm::InputTag>("recMuonLabel");
607  }
608  if (anpset.exists("recMuonTrkLabel")) {
609  _recLabels[EVTColContainer::MUONTRACK] = anpset.getParameter<edm::InputTag>("recMuonTrkLabel");
611  }
612  if (anpset.exists("recElecLabel")) {
613  _recLabels[EVTColContainer::ELEC] = anpset.getParameter<edm::InputTag>("recElecLabel");
615  }
616  if (anpset.exists("recPhotonLabel")) {
617  _recLabels[EVTColContainer::PHOTON] = anpset.getParameter<edm::InputTag>("recPhotonLabel");
619  }
620  if (anpset.exists("recPFMETLabel")) {
621  _recLabels[EVTColContainer::PFMET] = anpset.getParameter<edm::InputTag>("recPFMETLabel");
623  }
624  if (anpset.exists("recPFTauLabel")) {
625  _recLabels[EVTColContainer::PFTAU] = anpset.getParameter<edm::InputTag>("recPFTauLabel");
627  }
628  if (anpset.exists("recPFJetLabel")) {
629  _recLabels[EVTColContainer::PFJET] = anpset.getParameter<edm::InputTag>("recPFJetLabel");
631  }
632  if (anpset.exists("recCaloJetLabel")) {
633  _recLabels[EVTColContainer::CALOJET] = anpset.getParameter<edm::InputTag>("recCaloJetLabel");
635  }
636 
637  if (_recLabels.size() < 1) {
638  edm::LogError("ExoticaValidation") << "HLTExoticaSubAnalysis::getNamesOfObjects, "
639  << "Not included any object (recMuonLabel, recElecLabel, ...) "
640  << "in the analysis " << _analysisname;
641  return;
642  }
643 }
#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 567 of file HLTExoticaSubAnalysis.cc.

References EVTColContainer::CALOJET, EVTColContainer::ELEC, EVTColContainer::getTypeString(), i, LogDebug, EVTColContainer::MUON, EVTColContainer::MUONTRACK, EVTColContainer::PFJET, EVTColContainer::PFMET, EVTColContainer::PFTAU, EVTColContainer::PHOTON, and AlCaHLTBitMon_QueryRunRegistry::string.

568 {
569  LogDebug("ExoticaValidation") << "In HLTExoticaSubAnalysis::getObjectsType()";
570 
571  static const unsigned int objSize = 7;
572  static const unsigned int objtriggernames[] = {
581  };
582 
583  std::set<unsigned int> objsType;
584  // The object to deal has to be entered via the config .py
585  for (unsigned int i = 0; i < objSize; ++i) {
586  //std::cout << "(5) Gonna call with " << objtriggernames[i] << std::endl;
587  std::string objTypeStr = EVTColContainer::getTypeString(objtriggernames[i]);
588  // Check if it is needed this object for this trigger
589  if (! TString(hltPath).Contains(objTypeStr)) {
590  continue;
591  }
592 
593  objsType.insert(objtriggernames[i]);
594  }
595 
596  return std::vector<unsigned int>(objsType.begin(), objsType.end());
597 }
#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 849 of file HLTExoticaSubAnalysis.cc.

References _recCaloJetSelector, _recCut, _recElecSelector, _recMuonSelector, _recMuonTrkSelector, _recPFJetSelector, _recPFMETSelector, _recPFTauSelector, _recPhotonSelector, EVTColContainer::CALOJET, EVTColContainer::ELEC, LogDebug, EVTColContainer::MUON, EVTColContainer::MUONTRACK, EVTColContainer::PFJET, EVTColContainer::PFMET, EVTColContainer::PFTAU, and EVTColContainer::PHOTON.

Referenced by analyze().

850 {
851 
852  LogDebug("ExoticaValidation") << "In HLTExoticaSubAnalysis::initSelector()";
853 
854  if (objtype == EVTColContainer::MUON && _recMuonSelector == 0) {
856  } else if (objtype == EVTColContainer::MUONTRACK && _recMuonTrkSelector == 0) {
858  } else if (objtype == EVTColContainer::ELEC && _recElecSelector == 0) {
860  } else if (objtype == EVTColContainer::PHOTON && _recPhotonSelector == 0) {
862  } else if (objtype == EVTColContainer::PFMET && _recPFMETSelector == 0) {
864  } else if (objtype == EVTColContainer::PFTAU && _recPFTauSelector == 0) {
866  } else if (objtype == EVTColContainer::PFJET && _recPFJetSelector == 0) {
868  } else if (objtype == EVTColContainer::CALOJET && _recCaloJetSelector == 0) {
870  }
871  /* else
872  {
873  FIXME: ERROR NOT IMPLEMENTED
874  }*/
875 }
#define LogDebug(id)
StringCutObjectSelector< reco::Track > * _recMuonTrkSelector
StringCutObjectSelector< reco::CaloJet > * _recCaloJetSelector
StringCutObjectSelector< reco::PFJet > * _recPFJetSelector
StringCutObjectSelector< reco::GsfElectron > * _recElecSelector
StringCutObjectSelector< reco::Muon > * _recMuonSelector
std::map< unsigned int, std::string > _recCut
StringCutObjectSelector< reco::PFMET > * _recPFMETSelector
StringCutObjectSelector< reco::Photon > * _recPhotonSelector
StringCutObjectSelector< reco::PFTau > * _recPFTauSelector
void HLTExoticaSubAnalysis::insertCandidates ( const unsigned int &  objtype,
const EVTColContainer col,
std::vector< reco::LeafCandidate > *  matches 
)
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 878 of file HLTExoticaSubAnalysis.cc.

References _recCaloJetSelector, _recElecSelector, _recMuonSelector, _recMuonTrkSelector, _recPFJetSelector, _recPFMETSelector, _recPFTauSelector, _recPhotonSelector, EVTColContainer::CALOJET, EVTColContainer::caloJets, EVTColContainer::ELEC, EVTColContainer::electrons, i, LogDebug, m, EVTColContainer::MUON, EVTColContainer::muons, EVTColContainer::MUONTRACK, EVTColContainer::muonTracks, EVTColContainer::PFJET, EVTColContainer::pfJets, EVTColContainer::PFMET, EVTColContainer::pfMETs, EVTColContainer::PFTAU, EVTColContainer::pfTaus, EVTColContainer::PHOTON, and EVTColContainer::photons.

Referenced by analyze().

879 {
880 
881  LogDebug("ExoticaValidation") << "In HLTExoticaSubAnalysis::insertCandidates()";
882 
883  if (objType == EVTColContainer::MUON) {
884  for (size_t i = 0; i < cols->muons->size(); i++) {
885  LogDebug("ExoticaValidation") << "Inserting muon " << i ;
886  if (_recMuonSelector->operator()(cols->muons->at(i))) {
887  reco::LeafCandidate m(0, cols->muons->at(i).p4(), cols->muons->at(i).vertex(), objType, 0, true);
888  matches->push_back(m);
889  }
890  }
891  } else if (objType == EVTColContainer::MUONTRACK) {
892  for (size_t i = 0; i < cols->muonTracks->size(); i++) {
893  LogDebug("ExoticaValidation") << "Inserting muonTrack " << i ;
894  if (_recMuonTrkSelector->operator()(cols->muonTracks->at(i))) {
895  ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double>> mom4;
896  ROOT::Math::XYZVector mom3 = cols->muonTracks->at(i).innerMomentum();
897  mom4.SetXYZT(mom3.x(),mom3.y(),mom3.z(),mom3.r());
898  reco::LeafCandidate m(0, mom4, cols->muonTracks->at(i).vertex(), objType, 0, true);
899  matches->push_back(m);
900  }
901  }
902  } else if (objType == EVTColContainer::ELEC) {
903  for (size_t i = 0; i < cols->electrons->size(); i++) {
904  LogDebug("ExoticaValidation") << "Inserting electron " << i ;
905  if (_recElecSelector->operator()(cols->electrons->at(i))) {
906  reco::LeafCandidate m(0, cols->electrons->at(i).p4(), cols->electrons->at(i).vertex(), objType, 0, true);
907  matches->push_back(m);
908  }
909  }
910  } else if (objType == EVTColContainer::PHOTON) {
911  for (size_t i = 0; i < cols->photons->size(); i++) {
912  LogDebug("ExoticaValidation") << "Inserting photon " << i ;
913  if (_recPhotonSelector->operator()(cols->photons->at(i))) {
914  reco::LeafCandidate m(0, cols->photons->at(i).p4(), cols->photons->at(i).vertex(), objType, 0, true);
915  matches->push_back(m);
916  }
917  }
918  } else if (objType == EVTColContainer::PFMET) {
922  for (size_t i = 0; i < cols->pfMETs->size(); i++) {
923  LogDebug("ExoticaValidation") << "Inserting PFMET " << i ;
924  if (_recPFMETSelector->operator()(cols->pfMETs->at(i))) {
925  reco::LeafCandidate m(0, cols->pfMETs->at(i).p4(), cols->pfMETs->at(i).vertex(), objType, 0, true);
926  matches->push_back(m);
927  }
928  }
929  } else if (objType == EVTColContainer::PFTAU) {
930  for (size_t i = 0; i < cols->pfTaus->size(); i++) {
931  LogDebug("ExoticaValidation") << "Inserting PFtau " << i ;
932  if (_recPFTauSelector->operator()(cols->pfTaus->at(i))) {
933  reco::LeafCandidate m(0, cols->pfTaus->at(i).p4(), cols->pfTaus->at(i).vertex(), objType, 0, true);
934  matches->push_back(m);
935  }
936  }
937  } else if (objType == EVTColContainer::PFJET) {
938  for (size_t i = 0; i < cols->pfJets->size(); i++) {
939  LogDebug("ExoticaValidation") << "Inserting jet " << i ;
940  if (_recPFJetSelector->operator()(cols->pfJets->at(i))) {
941  reco::LeafCandidate m(0, cols->pfJets->at(i).p4(), cols->pfJets->at(i).vertex(), objType, 0, true);
942  matches->push_back(m);
943  }
944  }
945  } else if (objType == EVTColContainer::CALOJET) {
946  for (size_t i = 0; i < cols->caloJets->size(); i++) {
947  LogDebug("ExoticaValidation") << "Inserting jet " << i ;
948  if (_recCaloJetSelector->operator()(cols->caloJets->at(i))) {
949  reco::LeafCandidate m(0, cols->caloJets->at(i).p4(), cols->caloJets->at(i).vertex(), objType, 0, true);
950  matches->push_back(m);
951  }
952  }
953  }
954 
955  /* else
956  {
957  FIXME: ERROR NOT IMPLEMENTED
958  }*/
959 }
#define LogDebug(id)
StringCutObjectSelector< reco::Track > * _recMuonTrkSelector
int i
Definition: DBlmapReader.cc:9
StringCutObjectSelector< reco::CaloJet > * _recCaloJetSelector
StringCutObjectSelector< reco::PFJet > * _recPFJetSelector
StringCutObjectSelector< reco::GsfElectron > * _recElecSelector
StringCutObjectSelector< reco::Muon > * _recMuonSelector
Transform3DPJ::Vector XYZVector
StringCutObjectSelector< reco::PFMET > * _recPFMETSelector
StringCutObjectSelector< reco::Photon > * _recPhotonSelector
StringCutObjectSelector< reco::PFTau > * _recPFTauSelector
void HLTExoticaSubAnalysis::registerConsumes ( edm::ConsumesCollector consCollector)
private

Registers consumption of objects.

Definition at line 647 of file HLTExoticaSubAnalysis.cc.

References _genParticleLabel, _genParticleToken, _recLabels, _tokens, _trigResultsLabel, _trigResultsToken, EVTColContainer::CALOJET, edm::ConsumesCollector::consumes(), EVTColContainer::ELEC, LogDebug, EVTColContainer::MUON, EVTColContainer::MUONTRACK, EVTColContainer::PFJET, EVTColContainer::PFMET, EVTColContainer::PFTAU, and EVTColContainer::PHOTON.

Referenced by HLTExoticaSubAnalysis().

648 {
649  // Register that we are getting genParticles
651 
652  // Register that we are getting the trigger results
654  // Loop over _recLabels, see what we need, and register.
655  // Then save the registered token in _tokens.
656  // Remember: _recLabels is a map<uint, edm::InputTag>
657  // Remember: _tokens is a map<uint, edm::EDGetToken>
658  LogDebug("ExoticaValidation") << "We have got " << _recLabels.size() << "recLabels";
659  for (std::map<unsigned int, edm::InputTag>::iterator it = _recLabels.begin();
660  it != _recLabels.end(); ++it) {
661  if (it->first == EVTColContainer::MUON) {
662  edm::EDGetTokenT<reco::MuonCollection> particularToken = iC.consumes<reco::MuonCollection>(it->second);
663  edm::EDGetToken token(particularToken);
664  _tokens[it->first] = token;
665  }
666  else if (it->first == EVTColContainer::MUONTRACK) {
667  edm::EDGetTokenT<reco::TrackCollection> particularToken = iC.consumes<reco::TrackCollection>(it->second);
668  edm::EDGetToken token(particularToken);
669  _tokens[it->first] = token;
670  }
671  else if (it->first == EVTColContainer::ELEC) {
672  edm::EDGetTokenT<reco::GsfElectronCollection> particularToken = iC.consumes<reco::GsfElectronCollection>(it->second);
673  edm::EDGetToken token(particularToken);
674  _tokens[it->first] = token;
675  }
676  else if (it->first == EVTColContainer::PHOTON) {
677  edm::EDGetTokenT<reco::PhotonCollection> particularToken = iC.consumes<reco::PhotonCollection>(it->second);
678  edm::EDGetToken token(particularToken);
679  _tokens[it->first] = token;
680  }
681  else if (it->first == EVTColContainer::PFMET) {
682  edm::EDGetTokenT<reco::PFMETCollection> particularToken = iC.consumes<reco::PFMETCollection>(it->second);
683  edm::EDGetToken token(particularToken);
684  _tokens[it->first] = token;
685  }
686  else if (it->first == EVTColContainer::PFTAU) {
687  edm::EDGetTokenT<reco::PFTauCollection> particularToken = iC.consumes<reco::PFTauCollection>(it->second);
688  edm::EDGetToken token(particularToken);
689  _tokens[it->first] = token;
690  }
691  else if (it->first == EVTColContainer::PFJET) {
692  edm::EDGetTokenT<reco::PFJetCollection> particularToken = iC.consumes<reco::PFJetCollection>(it->second);
693  edm::EDGetToken token(particularToken);
694  _tokens[it->first] = token;
695  }
696  else if (it->first == EVTColContainer::CALOJET) {
697  edm::EDGetTokenT<reco::CaloJetCollection> particularToken = iC.consumes<reco::CaloJetCollection>(it->second);
698  edm::EDGetToken token(particularToken);
699  _tokens[it->first] = token;
700  }
701  else {
702  edm::LogError("ExoticaValidation") << "HLTExoticaSubAnalysis::registerConsumes"
703  << " NOT IMPLEMENTED (yet) ERROR: '" << it->second.label() << "'";
704  }
705  }
706 
707 }
#define LogDebug(id)
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
std::vector< PFTau > PFTauCollection
collection of PFTau objects
Definition: PFTauFwd.h:9
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:13
edm::EDGetTokenT< edm::TriggerResults > _trigResultsToken
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< 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< 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 153 of file HLTExoticaSubAnalysis.cc.

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

156 {
157 
158  LogDebug("ExoticaValidation") << "In HLTExoticaSubAnalysis::subAnalysisBookHistos()";
159 
160  // Create the folder structure inside HLT/Exotica
161  std::string baseDir = "HLT/Exotica/" + _analysisname + "/";
162  iBooker.setCurrentFolder(baseDir);
163 
164  // Book the gen/reco analysis-dependent histograms (denominators)
165  for (std::map<unsigned int, edm::InputTag>::const_iterator it = _recLabels.begin();
166  it != _recLabels.end(); ++it) {
167  const std::string objStr = EVTColContainer::getTypeString(it->first);
168  std::vector<std::string> sources(2);
169  sources[0] = "gen";
170  sources[1] = "rec";
171 
172  for (size_t i = 0; i < sources.size(); i++) {
173  std::string source = sources[i];
174  bookHist(iBooker, source, objStr, "Eta");
175  bookHist(iBooker, source, objStr, "Phi");
176  bookHist(iBooker, source, objStr, "MaxPt1");
177  bookHist(iBooker, source, objStr, "MaxPt2");
178  bookHist(iBooker, source, objStr, "SumEt");
179  }
180  } // closes loop in _recLabels
181 
182  // Call the plotterBookHistos() (which books all the path dependent histograms)
183  LogDebug("ExoticaValidation") << " number of plotters = " << _plotters.size();
184  for (std::vector<HLTExoticaPlotter>::iterator it = _plotters.begin();
185  it != _plotters.end(); ++it) {
186  it->plotterBookHistos(iBooker, iRun, iSetup);
187  }
188 }
#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:43
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 115 of file HLTExoticaSubAnalysis.h.

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

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

Structure of the MonitorElements.

Definition at line 168 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 143 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 146 of file HLTExoticaSubAnalysis.h.

Referenced by analyze(), and HLTExoticaSubAnalysis().

edm::InputTag HLTExoticaSubAnalysis::_genParticleLabel
private

Definition at line 129 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 133 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 151 of file HLTExoticaSubAnalysis.h.

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

HLTConfigProvider HLTExoticaSubAnalysis::_hltConfig
private

Interface to the HLT information.

Definition at line 165 of file HLTExoticaSubAnalysis.h.

Referenced by beginRun().

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

The hlt paths found in the hltConfig.

Definition at line 123 of file HLTExoticaSubAnalysis.h.

Referenced by beginRun().

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

The hlt paths to check for.

Definition at line 121 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 128 of file HLTExoticaSubAnalysis.h.

Referenced by beginRun().

unsigned int HLTExoticaSubAnalysis::_minCandidates
private

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

Definition at line 118 of file HLTExoticaSubAnalysis.h.

Referenced by analyze(), and HLTExoticaSubAnalysis().

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

Some kinematical parameters.

Definition at line 138 of file HLTExoticaSubAnalysis.h.

Referenced by bookHist(), and HLTExoticaSubAnalysis().

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

Definition at line 139 of file HLTExoticaSubAnalysis.h.

Referenced by bookHist(), and HLTExoticaSubAnalysis().

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

Definition at line 140 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 162 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 112 of file HLTExoticaSubAnalysis.h.

Referenced by beginRun(), and HLTExoticaSubAnalysis().

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

Definition at line 159 of file HLTExoticaSubAnalysis.h.

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

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

Definition at line 144 of file HLTExoticaSubAnalysis.h.

Referenced by HLTExoticaSubAnalysis(), and initSelector().

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

Definition at line 147 of file HLTExoticaSubAnalysis.h.

Referenced by analyze(), and HLTExoticaSubAnalysis().

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

Definition at line 154 of file HLTExoticaSubAnalysis.h.

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

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

Definition at line 152 of file HLTExoticaSubAnalysis.h.

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

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

Definition at line 153 of file HLTExoticaSubAnalysis.h.

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

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

Definition at line 158 of file HLTExoticaSubAnalysis.h.

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

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

Definition at line 155 of file HLTExoticaSubAnalysis.h.

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

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

Definition at line 156 of file HLTExoticaSubAnalysis.h.

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

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

Definition at line 157 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 125 of file HLTExoticaSubAnalysis.h.

Referenced by analyze(), and beginRun().

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

Definition at line 135 of file HLTExoticaSubAnalysis.h.

Referenced by getHandlesToObjects(), and registerConsumes().

edm::InputTag HLTExoticaSubAnalysis::_trigResultsLabel
private

Definition at line 130 of file HLTExoticaSubAnalysis.h.

Referenced by registerConsumes().

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

Definition at line 134 of file HLTExoticaSubAnalysis.h.

Referenced by getHandlesToObjects(), and registerConsumes().