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...
 
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...
 
std::map< unsigned int,
std::string > 
_recCut
 
StringCutObjectSelector
< reco::GsfElectron > * 
_recElecSelector
 
StringCutObjectSelector
< reco::PFJet > * 
_recJetSelector
 
std::map< unsigned int,
edm::InputTag
_recLabels
 
StringCutObjectSelector
< reco::Muon > * 
_recMuonSelector
 
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 57 of file HLTExoticaSubAnalysis.h.

Member Enumeration Documentation

Enumerator
GEN 
RECO 

Definition at line 59 of file HLTExoticaSubAnalysis.h.

59  {
60  GEN = 98,
61  RECO = 99
62  };

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 26 of file HLTExoticaSubAnalysis.cc.

References _genCut, _hltPathsToCheck, _minCandidates, _parametersEta, _parametersPhi, _parametersTurnOn, _pset, _recCut, _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.

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

End Constructor.

Definition at line 106 of file HLTExoticaSubAnalysis.cc.

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

107 {
108  for (std::map<unsigned int, StringCutObjectSelector<reco::GenParticle>* >::iterator it = _genSelectorMap.begin();
109  it != _genSelectorMap.end(); ++it) {
110  delete it->second;
111  it->second = 0;
112  }
113  delete _recMuonSelector;
114  _recMuonSelector = 0;
115  delete _recElecSelector;
116  _recElecSelector = 0;
117  delete _recPhotonSelector;
118  _recPhotonSelector = 0;
119  delete _recPFMETSelector;
120  _recPFMETSelector = 0;
121  delete _recPFTauSelector;
122  _recPFTauSelector = 0;
123  delete _recJetSelector;
124  _recJetSelector = 0;
125 }
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::PFJet > * _recJetSelector
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 279 of file HLTExoticaSubAnalysis.cc.

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

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

129 {
130 }
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 176 of file HLTExoticaSubAnalysis.cc.

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

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

735 {
736  LogDebug("ExoticaValidation") << "In HLTExoticaSubAnalysis::bookHist()";
737  std::string sourceUpper = source;
738  sourceUpper[0] = std::toupper(sourceUpper[0]);
739  std::string name = source + objType + variable ;
740  TH1F * h = 0;
741 
742  if (variable.find("SumEt") != std::string::npos) {
743  std::string title = "Sum ET of " + sourceUpper + " " + objType;
744  const size_t nBins = _parametersTurnOn.size() - 1;
745  float * edges = new float[nBins + 1];
746  for (size_t i = 0; i < nBins + 1; i++) {
747  edges[i] = _parametersTurnOn[i];
748  }
749  h = new TH1F(name.c_str(), title.c_str(), nBins, edges);
750  delete[] edges;
751  }
752  else if (variable.find("MaxPt") != std::string::npos) {
753  std::string desc = (variable == "MaxPt1") ? "Leading" : "Next-to-Leading";
754  std::string title = "pT of " + desc + " " + sourceUpper + " " + objType;
755  const size_t nBins = _parametersTurnOn.size() - 1;
756  float * edges = new float[nBins + 1];
757  for (size_t i = 0; i < nBins + 1; i++) {
758  edges[i] = _parametersTurnOn[i];
759  }
760  h = new TH1F(name.c_str(), title.c_str(), nBins, edges);
761  delete[] edges;
762  } else {
763  std::string symbol = (variable == "Eta") ? "#eta" : "#phi";
764  std::string title = symbol + " of " + sourceUpper + " " + objType;
765  std::vector<double> params = (variable == "Eta") ? _parametersEta : _parametersPhi;
766  int nBins = (int)params[0];
767  double min = params[1];
768  double max = params[2];
769  h = new TH1F(name.c_str(), title.c_str(), nBins, min, max);
770  }
771 
772  h->Sumw2();
773  // This is the trick, that takes a normal TH1F and puts it in in the DQM
774  // machinery. Seems to be easy!
775  // Updated to use the new iBooker machinery.
776  _elements[name] = iBooker.book1D(name, h);
777  delete h;
778 }
#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:113
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:43
void HLTExoticaSubAnalysis::fillHist ( const std::string &  source,
const std::string &  objType,
const std::string &  variable,
const float &  value 
)
private

Definition at line 781 of file HLTExoticaSubAnalysis.cc.

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

Referenced by analyze().

785 {
786  std::string sourceUpper = source;
787  sourceUpper[0] = toupper(sourceUpper[0]);
788  std::string name = source + objType + variable ;
789 
790  LogDebug("ExoticaValidation") << "In HLTExoticaSubAnalysis::fillHist() " << name << " " << value;
791  _elements[name]->Fill(value);
792  LogDebug("ExoticaValidation") << "In HLTExoticaSubAnalysis::fillHist() " << name << " worked";
793 }
#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 667 of file HLTExoticaSubAnalysis.cc.

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

Referenced by analyze().

668 {
669  LogDebug("ExoticaValidation") << "In HLTExoticaSubAnalysis::getHandlesToObjects()";
670 
671  if (! col->isCommonInit()) {
672  // Extract the trigger results (path info, pass,...)
674  iEvent.getByToken(_trigResultsToken, trigResults);
675  if (trigResults.isValid()) {
676  col->triggerResults = trigResults.product();
677  LogDebug("ExoticaValidation") << "Added handle to triggerResults";
678  }
679 
680  // Extract the genParticles
682  iEvent.getByToken(_genParticleToken, genPart);
683  if (genPart.isValid()) {
684  col->genParticles = genPart.product();
685  LogDebug("ExoticaValidation") << "Added handle to genParticles";
686  }
687  }
688 
689  // Loop over the tokens and extract all other objects
690  LogDebug("ExoticaValidation") << "We have got " << _tokens.size() << "tokens";
691  for (std::map<unsigned int, edm::EDGetToken>::iterator it = _tokens.begin();
692  it != _tokens.end(); ++it) {
693  if (it->first == EVTColContainer::MUON) {
695  iEvent.getByToken(it->second, theHandle);
696  col->set(theHandle.product());
697  }
698  else if (it->first == EVTColContainer::ELEC) {
700  iEvent.getByToken(it->second, theHandle);
701  col->set(theHandle.product());
702  }
703  else if (it->first == EVTColContainer::PHOTON) {
705  iEvent.getByToken(it->second, theHandle);
706  col->set(theHandle.product());
707  }
708  else if (it->first == EVTColContainer::PFMET) {
710  iEvent.getByToken(it->second, theHandle);
711  col->set(theHandle.product());
712  }
713  else if (it->first == EVTColContainer::PFTAU) {
715  iEvent.getByToken(it->second, theHandle);
716  col->set(theHandle.product());
717  }
718  else if (it->first == EVTColContainer::JET) {
720  iEvent.getByToken(it->second, theHandle);
721  col->set(theHandle.product());
722  }
723  else {
724  edm::LogError("ExoticaValidation") << "HLTExoticaSubAnalysis::getHandlesToObjects "
725  << " NOT IMPLEMENTED (yet) ERROR: '" << it->first << "'";
726  }
727  }
728 }
#define LogDebug(id)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
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 575 of file HLTExoticaSubAnalysis.cc.

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

Referenced by HLTExoticaSubAnalysis().

576 {
577  LogDebug("ExoticaValidation") << "In HLTExoticaSubAnalysis::getNamesOfObjects()";
578 
579  if (anpset.exists("recMuonLabel")) {
580  _recLabels[EVTColContainer::MUON] = anpset.getParameter<edm::InputTag>("recMuonLabel");
582  }
583  if (anpset.exists("recElecLabel")) {
584  _recLabels[EVTColContainer::ELEC] = anpset.getParameter<edm::InputTag>("recElecLabel");
586  }
587  if (anpset.exists("recPhotonLabel")) {
588  _recLabels[EVTColContainer::PHOTON] = anpset.getParameter<edm::InputTag>("recPhotonLabel");
590  }
591  if (anpset.exists("recPFMETLabel")) {
592  _recLabels[EVTColContainer::PFMET] = anpset.getParameter<edm::InputTag>("recPFMETLabel");
594  }
595  if (anpset.exists("recPFTauLabel")) {
596  _recLabels[EVTColContainer::PFTAU] = anpset.getParameter<edm::InputTag>("recPFTauLabel");
598  }
599  if (anpset.exists("recJetLabel")) {
600  _recLabels[EVTColContainer::JET] = anpset.getParameter<edm::InputTag>("recJetLabel");
602  }
603 
604  if (_recLabels.size() < 1) {
605  edm::LogError("ExoticaValidation") << "HLTExoticaSubAnalysis::getNamesOfObjects, "
606  << "Not included any object (recMuonLabel, recElecLabel, ...) "
607  << "in the analysis " << _analysisname;
608  return;
609  }
610 }
#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 544 of file HLTExoticaSubAnalysis.cc.

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

545 {
546  LogDebug("ExoticaValidation") << "In HLTExoticaSubAnalysis::getObjectsType()";
547 
548  static const unsigned int objSize = 6;
549  static const unsigned int objtriggernames[] = {
556  };
557 
558  std::set<unsigned int> objsType;
559  // The object to deal has to be entered via the config .py
560  for (unsigned int i = 0; i < objSize; ++i) {
561  //std::cout << "(5) Gonna call with " << objtriggernames[i] << std::endl;
562  std::string objTypeStr = EVTColContainer::getTypeString(objtriggernames[i]);
563  // Check if it is needed this object for this trigger
564  if (! TString(hltPath).Contains(objTypeStr)) {
565  continue;
566  }
567 
568  objsType.insert(objtriggernames[i]);
569  }
570 
571  return std::vector<unsigned int>(objsType.begin(), objsType.end());
572 }
#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 796 of file HLTExoticaSubAnalysis.cc.

References _recCut, _recElecSelector, _recJetSelector, _recMuonSelector, _recPFMETSelector, _recPFTauSelector, _recPhotonSelector, EVTColContainer::ELEC, EVTColContainer::JET, LogDebug, EVTColContainer::MUON, EVTColContainer::PFMET, EVTColContainer::PFTAU, and EVTColContainer::PHOTON.

Referenced by analyze().

797 {
798 
799  LogDebug("ExoticaValidation") << "In HLTExoticaSubAnalysis::initSelector()";
800 
801  if (objtype == EVTColContainer::MUON && _recMuonSelector == 0) {
803  } else if (objtype == EVTColContainer::ELEC && _recElecSelector == 0) {
805  } else if (objtype == EVTColContainer::PHOTON && _recPhotonSelector == 0) {
807  } else if (objtype == EVTColContainer::PFMET && _recPFMETSelector == 0) {
809  } else if (objtype == EVTColContainer::PFTAU && _recPFTauSelector == 0) {
811  } else if (objtype == EVTColContainer::JET && _recJetSelector == 0) {
813  }
814  /* else
815  {
816  FIXME: ERROR NOT IMPLEMENTED
817  }*/
818 }
#define LogDebug(id)
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::PFJet > * _recJetSelector
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 821 of file HLTExoticaSubAnalysis.cc.

References _recElecSelector, _recJetSelector, _recMuonSelector, _recPFMETSelector, _recPFTauSelector, _recPhotonSelector, EVTColContainer::ELEC, EVTColContainer::electrons, i, EVTColContainer::JET, EVTColContainer::jets, LogDebug, m, EVTColContainer::MUON, EVTColContainer::muons, EVTColContainer::PFMET, EVTColContainer::pfMETs, EVTColContainer::PFTAU, EVTColContainer::pfTaus, EVTColContainer::PHOTON, and EVTColContainer::photons.

Referenced by analyze().

822 {
823 
824  LogDebug("ExoticaValidation") << "In HLTExoticaSubAnalysis::insertCandidates()";
825 
826  if (objType == EVTColContainer::MUON) {
827  for (size_t i = 0; i < cols->muons->size(); i++) {
828  LogDebug("ExoticaValidation") << "Inserting muon " << i ;
829  if (_recMuonSelector->operator()(cols->muons->at(i))) {
830  reco::LeafCandidate m(0, cols->muons->at(i).p4(), cols->muons->at(i).vertex(), objType, 0, true);
831  matches->push_back(m);
832  }
833  }
834  } else if (objType == EVTColContainer::ELEC) {
835  for (size_t i = 0; i < cols->electrons->size(); i++) {
836  LogDebug("ExoticaValidation") << "Inserting electron " << i ;
837  if (_recElecSelector->operator()(cols->electrons->at(i))) {
838  reco::LeafCandidate m(0, cols->electrons->at(i).p4(), cols->electrons->at(i).vertex(), objType, 0, true);
839  matches->push_back(m);
840  }
841  }
842  } else if (objType == EVTColContainer::PHOTON) {
843  for (size_t i = 0; i < cols->photons->size(); i++) {
844  LogDebug("ExoticaValidation") << "Inserting photon " << i ;
845  if (_recPhotonSelector->operator()(cols->photons->at(i))) {
846  reco::LeafCandidate m(0, cols->photons->at(i).p4(), cols->photons->at(i).vertex(), objType, 0, true);
847  matches->push_back(m);
848  }
849  }
850  } else if (objType == EVTColContainer::PFMET) {
854  for (size_t i = 0; i < cols->pfMETs->size(); i++) {
855  LogDebug("ExoticaValidation") << "Inserting PFMET " << i ;
856  if (_recPFMETSelector->operator()(cols->pfMETs->at(i))) {
857  reco::LeafCandidate m(0, cols->pfMETs->at(i).p4(), cols->pfMETs->at(i).vertex(), objType, 0, true);
858  matches->push_back(m);
859  }
860  }
861  } else if (objType == EVTColContainer::PFTAU) {
862  for (size_t i = 0; i < cols->pfTaus->size(); i++) {
863  LogDebug("ExoticaValidation") << "Inserting PFtau " << i ;
864  if (_recPFTauSelector->operator()(cols->pfTaus->at(i))) {
865  reco::LeafCandidate m(0, cols->pfTaus->at(i).p4(), cols->pfTaus->at(i).vertex(), objType, 0, true);
866  matches->push_back(m);
867  }
868  }
869  } else if (objType == EVTColContainer::JET) {
870  for (size_t i = 0; i < cols->jets->size(); i++) {
871  LogDebug("ExoticaValidation") << "Inserting jet " << i ;
872  if (_recJetSelector->operator()(cols->jets->at(i))) {
873  reco::LeafCandidate m(0, cols->jets->at(i).p4(), cols->jets->at(i).vertex(), objType, 0, true);
874  matches->push_back(m);
875  }
876  }
877  }
878 
879  /* else
880  {
881  FIXME: ERROR NOT IMPLEMENTED
882  }*/
883 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
StringCutObjectSelector< reco::GsfElectron > * _recElecSelector
StringCutObjectSelector< reco::Muon > * _recMuonSelector
StringCutObjectSelector< reco::PFMET > * _recPFMETSelector
StringCutObjectSelector< reco::Photon > * _recPhotonSelector
StringCutObjectSelector< reco::PFJet > * _recJetSelector
StringCutObjectSelector< reco::PFTau > * _recPFTauSelector
void HLTExoticaSubAnalysis::registerConsumes ( edm::ConsumesCollector consCollector)
private

Registers consumption of objects.

Definition at line 614 of file HLTExoticaSubAnalysis.cc.

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

Referenced by HLTExoticaSubAnalysis().

615 {
616  // Register that we are getting genParticles
618 
619  // Register that we are getting the trigger results
621  // Loop over _recLabels, see what we need, and register.
622  // Then save the registered token in _tokens.
623  // Remember: _recLabels is a map<uint, edm::InputTag>
624  // Remember: _tokens is a map<uint, edm::EDGetToken>
625  LogDebug("ExoticaValidation") << "We have got " << _recLabels.size() << "recLabels";
626  for (std::map<unsigned int, edm::InputTag>::iterator it = _recLabels.begin();
627  it != _recLabels.end(); ++it) {
628  if (it->first == EVTColContainer::MUON) {
629  edm::EDGetTokenT<reco::MuonCollection> particularToken = iC.consumes<reco::MuonCollection>(it->second);
630  edm::EDGetToken token(particularToken);
631  _tokens[it->first] = token;
632  }
633  else if (it->first == EVTColContainer::ELEC) {
634  edm::EDGetTokenT<reco::GsfElectronCollection> particularToken = iC.consumes<reco::GsfElectronCollection>(it->second);
635  edm::EDGetToken token(particularToken);
636  _tokens[it->first] = token;
637  }
638  else if (it->first == EVTColContainer::PHOTON) {
639  edm::EDGetTokenT<reco::PhotonCollection> particularToken = iC.consumes<reco::PhotonCollection>(it->second);
640  edm::EDGetToken token(particularToken);
641  _tokens[it->first] = token;
642  }
643  else if (it->first == EVTColContainer::PFMET) {
644  edm::EDGetTokenT<reco::PFMETCollection> particularToken = iC.consumes<reco::PFMETCollection>(it->second);
645  edm::EDGetToken token(particularToken);
646  _tokens[it->first] = token;
647  }
648  else if (it->first == EVTColContainer::PFTAU) {
649  edm::EDGetTokenT<reco::PFTauCollection> particularToken = iC.consumes<reco::PFTauCollection>(it->second);
650  edm::EDGetToken token(particularToken);
651  _tokens[it->first] = token;
652  }
653  else if (it->first == EVTColContainer::JET) {
654  edm::EDGetTokenT<reco::PFJetCollection> particularToken = iC.consumes<reco::PFJetCollection>(it->second);
655  edm::EDGetToken token(particularToken);
656  _tokens[it->first] = token;
657  }
658  else {
659  edm::LogError("ExoticaValidation") << "HLTExoticaSubAnalysis::registerConsumes"
660  << " NOT IMPLEMENTED (yet) ERROR: '" << it->second.label() << "'";
661  }
662  }
663 
664 }
#define LogDebug(id)
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
std::vector< PFTau > PFTauCollection
collection of PFTau objects
Definition: PFTauFwd.h:9
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.
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 139 of file HLTExoticaSubAnalysis.cc.

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

142 {
143 
144  LogDebug("ExoticaValidation") << "In HLTExoticaSubAnalysis::subAnalysisBookHistos()";
145 
146  // Create the folder structure inside HLT/Exotica
147  std::string baseDir = "HLT/Exotica/" + _analysisname + "/";
148  iBooker.setCurrentFolder(baseDir);
149 
150  // Book the gen/reco analysis-dependent histograms (denominators)
151  for (std::map<unsigned int, edm::InputTag>::const_iterator it = _recLabels.begin();
152  it != _recLabels.end(); ++it) {
153  const std::string objStr = EVTColContainer::getTypeString(it->first);
154  std::vector<std::string> sources(2);
155  sources[0] = "gen";
156  sources[1] = "rec";
157 
158  for (size_t i = 0; i < sources.size(); i++) {
159  std::string source = sources[i];
160  bookHist(iBooker, source, objStr, "Eta");
161  bookHist(iBooker, source, objStr, "Phi");
162  bookHist(iBooker, source, objStr, "MaxPt1");
163  bookHist(iBooker, source, objStr, "MaxPt2");
164  bookHist(iBooker, source, objStr, "SumEt");
165  }
166  } // closes loop in _recLabels
167 
168  // Call the plotterBookHistos() (which books all the path dependent histograms)
169  LogDebug("ExoticaValidation") << " number of plotters = " << _plotters.size();
170  for (std::vector<HLTExoticaPlotter>::iterator it = _plotters.begin();
171  it != _plotters.end(); ++it) {
172  it->plotterBookHistos(iBooker, iRun, iSetup);
173  }
174 }
#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 111 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 159 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 139 of file HLTExoticaSubAnalysis.h.

Referenced by analyze(), and HLTExoticaSubAnalysis().

edm::InputTag HLTExoticaSubAnalysis::_genParticleLabel
private

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

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

HLTConfigProvider HLTExoticaSubAnalysis::_hltConfig
private

Interface to the HLT information.

Definition at line 156 of file HLTExoticaSubAnalysis.h.

Referenced by beginRun().

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

The hlt paths found in the hltConfig.

Definition at line 119 of file HLTExoticaSubAnalysis.h.

Referenced by beginRun().

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

The hlt paths to check for.

Definition at line 117 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 124 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 114 of file HLTExoticaSubAnalysis.h.

Referenced by analyze(), and HLTExoticaSubAnalysis().

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

Some kinematical parameters.

Definition at line 134 of file HLTExoticaSubAnalysis.h.

Referenced by bookHist(), and HLTExoticaSubAnalysis().

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

Definition at line 135 of file HLTExoticaSubAnalysis.h.

Referenced by bookHist(), and HLTExoticaSubAnalysis().

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

Definition at line 136 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 153 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 108 of file HLTExoticaSubAnalysis.h.

Referenced by beginRun(), and HLTExoticaSubAnalysis().

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

Definition at line 140 of file HLTExoticaSubAnalysis.h.

Referenced by HLTExoticaSubAnalysis(), and initSelector().

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

Definition at line 146 of file HLTExoticaSubAnalysis.h.

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

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

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

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

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

Definition at line 147 of file HLTExoticaSubAnalysis.h.

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

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

Definition at line 148 of file HLTExoticaSubAnalysis.h.

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

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

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

Referenced by analyze(), and beginRun().

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

Definition at line 131 of file HLTExoticaSubAnalysis.h.

Referenced by getHandlesToObjects(), and registerConsumes().

edm::InputTag HLTExoticaSubAnalysis::_trigResultsLabel
private

Definition at line 126 of file HLTExoticaSubAnalysis.h.

Referenced by registerConsumes().

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

Definition at line 130 of file HLTExoticaSubAnalysis.h.

Referenced by getHandlesToObjects(), and registerConsumes().