CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
HLTHiggsSubAnalysis Class Reference

#include <HLTHiggsSubAnalysis.h>

Public Types

enum  { GEN, RECO }
 
typedef dqm::legacy::DQMStore DQMStore
 
typedef dqm::legacy::MonitorElement MonitorElement
 

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)
 
void bookHistograms (DQMStore::IBooker &)
 
const std::vector< unsigned int > getObjectsType (const std::string &hltpath) const
 Extract what objects need this analysis. More...
 
 HLTHiggsSubAnalysis (const edm::ParameterSet &pset, const std::string &analysisname, edm::ConsumesCollector &&iC)
 
 ~HLTHiggsSubAnalysis ()
 

Private Member Functions

void bookHist (const std::string &source, const std::string &objType, const std::string &variable, DQMStore::IBooker &)
 
void bookobjects (const edm::ParameterSet &anpset, edm::ConsumesCollector &iC)
 
void fillHist (const std::string &source, const std::string &objType, const std::string &variable, const float &value)
 
void initAndInsertJets (const edm::Event &iEvent, EVTColContainer *cols, std::vector< MatchStruct > *matches)
 
void initobjects (const edm::Event &iEvent, EVTColContainer *col)
 
void InitSelector (const unsigned int &objtype)
 
void insertcandidates (const unsigned int &objtype, const EVTColContainer *col, std::vector< MatchStruct > *matches)
 
void passJetCuts (std::vector< MatchStruct > *matches, std::map< std::string, bool > &jetCutResult, float &dEtaqq, float &mqq, float &dPhibb, float &CSV1, float &CSV2, float &CSV3)
 
void passOtherCuts (const std::vector< MatchStruct > &matches, std::map< std::string, bool > &jetCutResult)
 

Private Attributes

std::string _analysisname
 
std::vector< HLTHiggsPlotter_analyzers
 
bool _bookHtPlots
 
std::map< unsigned int, double > _cutMaxEta
 
std::map< unsigned int, double > _cutMinPt
 
std::map< unsigned int, unsigned int > _cutMotherId
 
std::map< unsigned int, std::vector< double > > _cutsDr
 
std::map< std::string, MonitorElement * > _elements
 
std::map< unsigned int, std::string > _genCut
 gen/rec objects cuts More...
 
edm::EDGetTokenT< reco::GenJetCollection_genJetLabel
 
StringCutObjectSelector< reco::GenJet > * _genJetSelector
 
edm::EDGetTokenT< reco::GenParticleCollection_genParticleLabel
 
std::map< unsigned int, StringCutObjectSelector< reco::GenParticle > * > _genSelectorMap
 
std::string _histDirectory
 
HLTConfigProvider _hltConfig
 
std::set< std::string > _hltPaths
 the hlt paths found in the hltConfig More...
 
std::vector< std::string > _hltPathsToCheck
 the hlt paths with regular expressions More...
 
std::string _hltProcessName
 
double _HtJetEtaMax
 
double _HtJetPtMin
 
unsigned int _minCandidates
 The minimum number of reco/gen candidates needed by the analysis. More...
 
std::vector< double > _NminOneCuts
 
std::vector< double > _parametersEta
 Some kinematical parameters. More...
 
std::vector< double > _parametersHt
 
std::vector< double > _parametersPhi
 
std::vector< double > _parametersPu
 
std::vector< double > _parametersTurnOn
 
edm::ParameterSet _pset
 
edm::EDGetTokenT< std::vector< PileupSummaryInfo > > _puSummaryInfo
 
StringCutObjectSelector< reco::CaloMET > * _recCaloMETSelector
 
std::map< unsigned int, std::string > _recCut
 
StringCutObjectSelector< reco::GsfElectron > * _recElecSelector
 
std::map< unsigned int, std::string > _recLabels
 
edm::EDGetTokenT< reco::CaloMETCollection_recLabelsCaloMET
 
edm::EDGetTokenT< reco::GsfElectronCollection_recLabelsElec
 
edm::EDGetTokenT< reco::MuonCollection_recLabelsMuon
 
edm::EDGetTokenT< reco::PFJetCollection_recLabelsPFJet
 
edm::EDGetTokenT< reco::PFMETCollection_recLabelsPFMET
 
edm::EDGetTokenT< reco::PFTauCollection_recLabelsPFTau
 
edm::EDGetTokenT< reco::PhotonCollection_recLabelsPhoton
 
StringCutObjectSelector< reco::Muon > * _recMuonSelector
 
edm::EDGetTokenT< reco::PFJetCollection_recoHtJetLabel
 
StringCutObjectSelector< reco::PFJet > * _recPFJetSelector
 
StringCutObjectSelector< reco::PFMET > * _recPFMETSelector
 
StringCutObjectSelector< reco::PFTau > * _recPFTauSelector
 
StringCutObjectSelector< reco::Photon > * _recPhotonSelector
 
edm::EDGetTokenT< reco::JetTagCollection_recTagPFJet
 
StringCutObjectSelector< reco::Track > * _recTrackSelector
 
std::map< std::string, std::string > _shortpath2long
 Relation between the short version of a path. More...
 
edm::EDGetTokenT< edm::TriggerResults_trigResultsTag
 
bool _useNminOneCuts
 
unsigned int NptPlots
 

Detailed Description

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

Author
J. Duarte Campderros (based and adapted on J. Klukas, M. Vander Donckt and J. Alcaraz code from the HLTriggerOffline/Muon package)

Definition at line 59 of file HLTHiggsSubAnalysis.h.

Member Typedef Documentation

Definition at line 61 of file HLTHiggsSubAnalysis.h.

Definition at line 62 of file HLTHiggsSubAnalysis.h.

Member Enumeration Documentation

anonymous enum
Enumerator
GEN 
RECO 

Definition at line 64 of file HLTHiggsSubAnalysis.h.

Constructor & Destructor Documentation

HLTHiggsSubAnalysis::HLTHiggsSubAnalysis ( const edm::ParameterSet pset,
const std::string &  analysisname,
edm::ConsumesCollector &&  iC 
)

Definition at line 32 of file HLTHiggsSubAnalysis.cc.

References _analysisname, _bookHtPlots, _cutMaxEta, _cutMinPt, _genCut, _hltPathsToCheck, _HtJetEtaMax, _HtJetPtMin, _minCandidates, _NminOneCuts, _parametersHt, _parametersTurnOn, _pset, _puSummaryInfo, _recCut, _recLabels, _useNminOneCuts, edm::ParameterSet::addParameter(), bookobjects(), edm::ParameterSet::exists(), edm::ParameterSet::existsAs(), beamvalidation::exit(), edm::ParameterSet::getParameter(), EVTColContainer::getTypeString(), edm::ParameterSet::getUntrackedParameter(), NptPlots, and AlCaHLTBitMon_QueryRunRegistry::string.

35  : _pset(pset),
36  _analysisname(analysisname),
37  _minCandidates(0),
38  _HtJetPtMin(0),
39  _HtJetEtaMax(0),
40  _hltProcessName(pset.getParameter<std::string>("hltProcessName")),
41  _histDirectory(pset.getParameter<std::string>("histDirectory")),
45  pset.getUntrackedParameter<std::string>("recoHtJetLabel", "ak4PFJetsCHS"))),
46  _parametersEta(pset.getParameter<std::vector<double>>("parametersEta")),
47  _parametersPhi(pset.getParameter<std::vector<double>>("parametersPhi")),
48  _parametersPu(pset.getParameter<std::vector<double>>("parametersPu")),
49  _parametersHt(0),
50  _parametersTurnOn(pset.getParameter<std::vector<double>>("parametersTurnOn")),
52  _genJetSelector(nullptr),
53  _recMuonSelector(nullptr),
54  _recElecSelector(nullptr),
55  _recCaloMETSelector(nullptr),
56  _recPFMETSelector(nullptr),
57  _recPFTauSelector(nullptr),
58  _recPhotonSelector(nullptr),
59  _recPFJetSelector(nullptr),
60  _recTrackSelector(nullptr),
61  _NminOneCuts(0),
62  _useNminOneCuts(false) {
63  // Specific parameters for this analysis
64  edm::ParameterSet anpset = pset.getParameter<edm::ParameterSet>(analysisname);
65  // Collections labels (but genparticles already initialized)
66  // initializing _recLabels data member)
67  if (anpset.exists("parametersTurnOn")) {
68  _parametersTurnOn = anpset.getParameter<std::vector<double>>("parametersTurnOn");
69  _pset.addParameter("parametersTurnOn", _parametersTurnOn);
70  }
71  this->bookobjects(anpset, iC);
72  // Generic objects: Initialization of cuts
73  for (std::map<unsigned int, std::string>::const_iterator it = _recLabels.begin(); it != _recLabels.end(); ++it) {
74  const std::string objStr = EVTColContainer::getTypeString(it->first);
75  _genCut[it->first] = pset.getParameter<std::string>(objStr + "_genCut");
76  _recCut[it->first] = pset.getParameter<std::string>(objStr + "_recCut");
77  _cutMinPt[it->first] = pset.getParameter<double>(objStr + "_cutMinPt");
78  _cutMaxEta[it->first] = pset.getParameter<double>(objStr + "_cutMaxEta");
79  }
80  //--- Updating parameters if has to be modified for this particular specific analysis
81  for (std::map<unsigned int, std::string>::const_iterator it = _recLabels.begin(); it != _recLabels.end(); ++it) {
82  const std::string objStr = EVTColContainer::getTypeString(it->first);
83  if (anpset.existsAs<std::string>(objStr + "_genCut", false)) {
84  _genCut[it->first] = anpset.getUntrackedParameter<std::string>(objStr + "_genCut");
85  }
86  if (anpset.existsAs<std::string>(objStr + "_recCut", false)) {
87  _recCut[it->first] = anpset.getUntrackedParameter<std::string>(objStr + "_recCut");
88  }
89  if (anpset.existsAs<double>(objStr + "_cutMinPt", false)) {
90  _cutMinPt[it->first] = anpset.getUntrackedParameter<double>(objStr + "_cutMinPt");
91  }
92  if (anpset.existsAs<double>(objStr + "_cutMaxEta", false)) {
93  _cutMaxEta[it->first] = anpset.getUntrackedParameter<double>(objStr + "_cutMaxEta");
94  }
95  }
96  _hltPathsToCheck = anpset.getParameter<std::vector<std::string>>("hltPathsToCheck");
97  _minCandidates = anpset.getParameter<unsigned int>("minCandidates");
98 
99  std::vector<double> default_parametersHt;
100  default_parametersHt.push_back(100);
101  default_parametersHt.push_back(0);
102  default_parametersHt.push_back(1000);
103  _parametersHt = pset.getUntrackedParameter<std::vector<double>>("parametersHt", default_parametersHt);
104 
105  _HtJetPtMin = anpset.getUntrackedParameter<double>("HtJetPtMin", -1);
106  _HtJetEtaMax = anpset.getUntrackedParameter<double>("HtJetEtaMax", -1);
107 
108  if (_HtJetPtMin > 0 && _HtJetEtaMax > 0)
109  _bookHtPlots = true;
110  else
111  _bookHtPlots = false;
112 
113  if (pset.exists("pileUpInfoLabel")) {
114  _puSummaryInfo = iC.consumes<std::vector<PileupSummaryInfo>>(pset.getParameter<std::string>("pileUpInfoLabel"));
115  }
116 
117  if (anpset.existsAs<std::vector<double>>("NminOneCuts", false)) {
118  _NminOneCuts = anpset.getUntrackedParameter<std::vector<double>>("NminOneCuts");
119  if (_NminOneCuts.size() < 9 + _minCandidates) {
120  edm::LogError("HiggsValidation") << "In HLTHiggsSubAnalysis::HLTHiggsSubAnalysis, "
121  << "Incoherence found in the python configuration file!!\nThe SubAnalysis '"
122  << _analysisname << "' has a vector NminOneCuts with size "
123  << _NminOneCuts.size() << ", while it needs to be at least of size "
124  << (9 + _minCandidates) << ".";
125  exit(-1);
126  }
127  if ((_NminOneCuts[0] || _NminOneCuts[1]) && _minCandidates < 4) {
128  edm::LogError("HiggsValidation") << "In HLTHiggsSubAnalysis::HLTHiggsSubAnalysis, "
129  << "Incoherence found in the python configuration file!!\nThe SubAnalysis '"
130  << _analysisname
131  << "' has a vector NminOneCuts with a dEtaqq of mqq cut on the least b-tagged "
132  "jets of the first 4 jets while only requiring "
133  << _minCandidates << " jets.";
134  exit(-1);
135  }
136  if (_NminOneCuts[5] && _minCandidates < 3) {
137  edm::LogError("HiggsValidation") << "In HLTHiggsSubAnalysis::HLTHiggsSubAnalysis, "
138  << "Incoherence found in the python configuration file!!\nThe SubAnalysis '"
139  << _analysisname
140  << "' has a vector NminOneCuts with a CSV3 cut while only requiring "
141  << _minCandidates << " jets.";
142  exit(-1);
143  }
144  if ((_NminOneCuts[2] || _NminOneCuts[4]) && _minCandidates < 2) {
145  edm::LogError("HiggsValidation") << "In HLTHiggsSubAnalysis::HLTHiggsSubAnalysis, "
146  << "Incoherence found in the python configuration file!!\nThe SubAnalysis '"
147  << _analysisname
148  << "' has a vector NminOneCuts with a dPhibb or CSV2 cut using the second most "
149  "b-tagged jet while only requiring "
150  << _minCandidates << " jet.";
151  exit(-1);
152  }
153  for (std::vector<double>::const_iterator it = _NminOneCuts.begin(); it != _NminOneCuts.end(); ++it) {
154  if (*it) {
155  _useNminOneCuts = true;
156  break;
157  }
158  }
159  }
160  // NptPlots = ( _useNminOneCuts ? _minCandidates : 2 );
162 }
std::vector< double > _parametersTurnOn
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
StringCutObjectSelector< reco::CaloMET > * _recCaloMETSelector
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:160
edm::EDGetTokenT< reco::GenParticleCollection > _genParticleLabel
edm::EDGetTokenT< reco::PFJetCollection > _recoHtJetLabel
unsigned int _minCandidates
The minimum number of reco/gen candidates needed by the analysis.
std::vector< double > _NminOneCuts
std::vector< GenJet > GenJetCollection
collection of GenJet objects
edm::ParameterSet _pset
bool exists(std::string const &parameterName) const
checks if a parameter exists
StringCutObjectSelector< reco::PFMET > * _recPFMETSelector
edm::EDGetTokenT< reco::GenJetCollection > _genJetLabel
std::map< unsigned int, std::string > _recCut
std::vector< double > _parametersPu
StringCutObjectSelector< reco::Track > * _recTrackSelector
StringCutObjectSelector< reco::GenJet > * _genJetSelector
std::map< unsigned int, std::string > _genCut
gen/rec objects cuts
edm::EDGetTokenT< std::vector< PileupSummaryInfo > > _puSummaryInfo
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:124
std::map< unsigned int, double > _cutMaxEta
StringCutObjectSelector< reco::PFTau > * _recPFTauSelector
std::map< unsigned int, double > _cutMinPt
edm::EDGetTokenT< edm::TriggerResults > _trigResultsTag
std::vector< double > _parametersHt
StringCutObjectSelector< reco::Muon > * _recMuonSelector
std::vector< PFJet > PFJetCollection
collection of PFJet objects
std::vector< double > _parametersPhi
std::vector< std::string > _hltPathsToCheck
the hlt paths with regular expressions
std::vector< double > _parametersEta
Some kinematical parameters.
void bookobjects(const edm::ParameterSet &anpset, edm::ConsumesCollector &iC)
StringCutObjectSelector< reco::Photon > * _recPhotonSelector
std::map< unsigned int, std::string > _recLabels
StringCutObjectSelector< reco::PFJet > * _recPFJetSelector
static const std::string getTypeString(const unsigned int &objtype)
Tranform types into strings.
StringCutObjectSelector< reco::GsfElectron > * _recElecSelector
def exit(msg="")
HLTHiggsSubAnalysis::~HLTHiggsSubAnalysis ( )

Definition at line 164 of file HLTHiggsSubAnalysis.cc.

References _genJetSelector, _genSelectorMap, _recCaloMETSelector, _recElecSelector, _recMuonSelector, _recPFJetSelector, _recPFMETSelector, _recPFTauSelector, _recPhotonSelector, _recTrackSelector, and genParticles_cff::map.

164  {
165  for (std::map<unsigned int, StringCutObjectSelector<reco::GenParticle>*>::iterator it = _genSelectorMap.begin();
166  it != _genSelectorMap.end();
167  ++it) {
168  delete it->second;
169  it->second = nullptr;
170  }
171  delete _genJetSelector;
172  _genJetSelector = nullptr;
173  delete _recMuonSelector;
174  _recMuonSelector = nullptr;
175  delete _recElecSelector;
176  _recElecSelector = nullptr;
177  delete _recPhotonSelector;
178  _recPhotonSelector = nullptr;
179  delete _recCaloMETSelector;
180  _recCaloMETSelector = nullptr;
181  delete _recPFMETSelector;
182  _recPFMETSelector = nullptr;
183  delete _recPFTauSelector;
184  _recPFTauSelector = nullptr;
185  delete _recPFJetSelector;
186  _recPFJetSelector = nullptr;
187  delete _recTrackSelector;
188  _recTrackSelector = nullptr;
189 }
StringCutObjectSelector< reco::CaloMET > * _recCaloMETSelector
StringCutObjectSelector< reco::PFMET > * _recPFMETSelector
std::map< unsigned int, StringCutObjectSelector< reco::GenParticle > * > _genSelectorMap
StringCutObjectSelector< reco::Track > * _recTrackSelector
StringCutObjectSelector< reco::GenJet > * _genJetSelector
StringCutObjectSelector< reco::PFTau > * _recPFTauSelector
StringCutObjectSelector< reco::Muon > * _recMuonSelector
StringCutObjectSelector< reco::Photon > * _recPhotonSelector
StringCutObjectSelector< reco::PFJet > * _recPFJetSelector
StringCutObjectSelector< reco::GsfElectron > * _recElecSelector

Member Function Documentation

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

Definition at line 370 of file HLTHiggsSubAnalysis.cc.

References _analysisname, _analyzers, _bookHtPlots, _elements, _genCut, _genJetLabel, _genJetSelector, _genSelectorMap, _hltPathsToCheck, _HtJetEtaMax, _HtJetPtMin, _minCandidates, _NminOneCuts, _puSummaryInfo, _recLabels, _recoHtJetLabel, _shortpath2long, _useNminOneCuts, edm::HLTGlobalStatus::accept(), PVValHelper::eta, fillHist(), GEN, EVTColContainer::genJets, EVTColContainer::genParticles, edm::Event::getByToken(), EVTColContainer::getTypeString(), zMuMuMuonUserData::hltPath, mps_fire::i, initAndInsertJets(), initobjects(), InitSelector(), insertcandidates(), edm::HandleBase::isValid(), dqmiolumiharvest::j, genParticles_cff::map, patCandidatesForDimuonsSequences_cff::matches, MuonErrorMatrixAnalyzer_cfi::maxPt, NptPlots, electrons_cff::objType, passJetCuts(), passOtherCuts(), EVTColContainer::PFJET, EVTColContainer::PFMET, phi, DiDispStaMuonMonitor_cfi::pt, RECO, source, AlCaHLTBitMon_QueryRunRegistry::string, groupFilesInBlocks::temp, edm::TriggerNames::triggerIndex(), edm::Event::triggerNames(), EVTColContainer::triggerResults, and trigNames.

370  {
371  // Initialize the collection (the ones which hasn't been initialiazed yet)
372  this->initobjects(iEvent, cols);
373  // utility map
374  std::map<unsigned int, std::string> u2str;
375  u2str[GEN] = "gen";
376  u2str[RECO] = "rec";
377 
378  std::map<unsigned int, double> Htmap;
379  Htmap[GEN] = 0.;
380  Htmap[RECO] = 0.;
381 
383  iEvent.getByToken(_puSummaryInfo, puInfo);
384  int nbMCvtx = -1;
385  if (puInfo.isValid()) {
386  std::vector<PileupSummaryInfo>::const_iterator PVI;
387  for (PVI = puInfo->begin(); PVI != puInfo->end(); ++PVI) {
388  if (PVI->getBunchCrossing() == 0) {
389  nbMCvtx = PVI->getPU_NumInteractions();
390  break;
391  }
392  }
393  }
394 
395  // Extract the match structure containing the gen/reco candidates (electron, muons,...)
396  // common to all the SubAnalysis
397  //---- Generation
398  // Make each good gen object into the base cand for a MatchStruct
399  std::vector<MatchStruct>* matches = new std::vector<MatchStruct>;
400  // bool alreadyMu = false;
401  for (std::map<unsigned int, std::string>::iterator it = _recLabels.begin(); it != _recLabels.end(); ++it) {
402  // Use genJets for jet matchstructs
403  if (it->first == EVTColContainer::PFJET) {
404  // Skip genJets for N-1 plots
405  if (!_useNminOneCuts) {
406  // Initialize selectors when first event
407  if (!_genJetSelector) {
409  }
410  for (size_t i = 0; i < cols->genJets->size(); ++i) {
411  if (_genJetSelector->operator()(cols->genJets->at(i))) {
412  matches->push_back(MatchStruct(&cols->genJets->at(i), it->first));
413  }
414  }
415  }
416  }
417  // Use genParticles
418  else {
419  // Avoiding the TkMu and Mu case
420  /* if( alreadyMu )
421  {
422  continue;
423  }*/
424  // Initialize selectors when first event
425  if (!_genSelectorMap[it->first]) {
427  }
428 
429  for (size_t i = 0; i < cols->genParticles->size(); ++i) {
430  if (_genSelectorMap[it->first]->operator()(cols->genParticles->at(i))) {
431  matches->push_back(MatchStruct(&cols->genParticles->at(i), it->first));
432  }
433  }
434  /* if( it->first == EVTColContainer::MUON || it->first == EVTColContainer::TRACK )
435  {
436  alreadyMu = true;
437  }*/
438  }
439  }
440  // Sort the MatchStructs by pT for later filling of turn-on curve
441  std::sort(matches->begin(), matches->end(), matchesByDescendingPt());
442 
443  // Map to reference the source (gen/reco) with the recoCandidates
444  std::map<unsigned int, std::vector<MatchStruct>> sourceMatchMap; // To be a pointer to delete
445  // --- Storing the generating candidates
446  sourceMatchMap[GEN] = *matches;
447 
448  // Reuse the vector
449  matches->clear();
450  // --- same for RECO objects
451 
452  // Different treatment for jets (b-tag)
453  std::map<std::string, bool> nMinOne;
454  std::map<std::string, bool> jetCutResult;
455  float dEtaqq;
456  float mqq;
457  float dPhibb;
458  float CSV1;
459  float CSV2;
460  float CSV3;
461  bool passAllCuts = false;
462  if (_recLabels.find(EVTColContainer::PFJET) != _recLabels.end()) {
463  // Initialize jet selector
465  // Initialize and insert pfJets
466  this->initAndInsertJets(iEvent, cols, matches);
467  // Make sure to skip events that don't have enough jets
468  if (matches->size() < NptPlots) {
469  delete matches;
470  return;
471  }
472  // Cuts on multiple jet events (RECO)
473  if (_useNminOneCuts) {
474  this->passJetCuts(matches, jetCutResult, dEtaqq, mqq, dPhibb, CSV1, CSV2, CSV3);
475  }
476  }
477  // Extraction of the objects candidates
478  for (std::map<unsigned int, std::string>::iterator it = _recLabels.begin(); it != _recLabels.end(); ++it) {
479  // Reco selectors (the function takes into account if it was instantiated
480  // before or not
481  this->InitSelector(it->first);
482  // -- Storing the matches
483  this->insertcandidates(it->first, cols, matches);
484  }
485 
486  // Sort the MatchStructs by pT for later filling of turn-on curve
487  std::sort(matches->begin(), matches->end(), matchesByDescendingPt());
488 
489  if (_useNminOneCuts) {
490  // Check non-jet N-1 Cuts
491  this->passOtherCuts(*matches, jetCutResult);
492 
493  // Make N-1 booleans from jetCutResults
494  for (std::map<std::string, bool>::const_iterator it = jetCutResult.begin(); it != jetCutResult.end(); ++it) {
495  nMinOne[it->first] = true;
496  for (std::map<std::string, bool>::const_iterator it2 = jetCutResult.begin(); it2 != jetCutResult.end(); ++it2) {
497  //ignore CSV2,CSV3 cut plotting CSV1
498  if (it->first == "CSV1" && it2->first == "CSV3")
499  continue;
500  if (it->first == "CSV1" && it2->first == "CSV2")
501  continue;
502 
503  //ignore CSV3 plotting cut CSV2
504  if (it->first == "CSV2" && it2->first == "CSV3")
505  continue;
506 
507  if (it->first != it2->first && !(it2->second)) {
508  nMinOne[it->first] = false;
509  break;
510  }
511  }
512  }
513  bool temp = false;
514  for (std::map<std::string, bool>::const_iterator it = nMinOne.begin(); it != nMinOne.end(); ++it) {
515  if (temp && it->second) {
516  passAllCuts = true;
517  break;
518  }
519  if (it->second)
520  temp = true;
521  }
522  }
523 
524  // --- Storing the reco candidates
525  sourceMatchMap[RECO] = *matches;
526  // --- All the objects are in place
527  delete matches;
528 
529  // -- Trigger Results
530  const edm::TriggerNames& trigNames = iEvent.triggerNames(*(cols->triggerResults));
531 
532  if (_bookHtPlots) {
534  iEvent.getByToken(_recoHtJetLabel, recoJet);
535  if (recoJet.isValid()) {
536  for (reco::PFJetCollection::const_iterator iJet = recoJet->begin(); iJet != recoJet->end(); iJet++) {
537  double pt = iJet->pt();
538  double eta = iJet->eta();
539  if (pt > _HtJetPtMin && fabs(eta) < _HtJetEtaMax) {
540  Htmap[RECO] += pt;
541  }
542  }
543  }
544 
546  iEvent.getByToken(_genJetLabel, genJet);
547  if (genJet.isValid()) {
548  for (reco::GenJetCollection::const_iterator iJet = genJet->begin(); iJet != genJet->end(); iJet++) {
549  double pt = iJet->pt();
550  double eta = iJet->eta();
551  if (pt > _HtJetPtMin && fabs(eta) < _HtJetEtaMax) {
552  Htmap[GEN] += pt;
553  }
554  }
555  }
556  }
557 
558  // Filling the histograms if pass the minimum amount of candidates needed by the analysis:
559  // GEN + RECO CASE in the same loop
560  for (std::map<unsigned int, std::vector<MatchStruct>>::iterator it = sourceMatchMap.begin();
561  it != sourceMatchMap.end();
562  ++it) {
563  // it->first: gen/reco it->second: matches (std::vector<MatchStruc>)
564  if (it->second.size() < _minCandidates) // FIXME: A bug is potentially here: what about the mixed channels?
565  {
566  continue;
567  }
568 
569  // Filling the gen/reco objects (eff-denominators):
570  // Just the first two different ones, if there are more
571  std::map<unsigned int, int>* countobjects = new std::map<unsigned int, int>;
572  // Initializing the count of the used object
573  for (std::map<unsigned int, std::string>::iterator co = _recLabels.begin(); co != _recLabels.end(); ++co) {
574  if (!(_useNminOneCuts && co->first == EVTColContainer::PFJET && it->first == GEN)) // genJets are not there
575  countobjects->insert(std::pair<unsigned int, int>(co->first, 0));
576  }
577  int counttotal = 0;
578  const int totalobjectssize2 = NptPlots * countobjects->size();
579  for (size_t j = 0; j < it->second.size(); ++j) {
580  const unsigned int objType = it->second[j].objType;
581  const std::string objTypeStr = EVTColContainer::getTypeString(objType);
582 
583  float pt = (it->second)[j].pt;
584  float eta = (it->second)[j].eta;
585  float phi = (it->second)[j].phi;
586 
587  // PFMET N-1 cut
588  if (_useNminOneCuts && objType == EVTColContainer::PFMET && _NminOneCuts[8] && !nMinOne["PFMET"]) {
589  continue;
590  }
591 
592  TString maxPt;
593  if ((unsigned)(*countobjects)[objType] < NptPlots) {
594  maxPt = "MaxPt";
595  maxPt += (*countobjects)[objType] + 1;
596  if (_useNminOneCuts && objType == EVTColContainer::PFJET) {
597  if (nMinOne[maxPt.Data()]) {
598  this->fillHist(u2str[it->first], objTypeStr, maxPt.Data(), pt);
599  }
600  } else {
601  this->fillHist(u2str[it->first], objTypeStr, maxPt.Data(), pt);
602  }
603  // Filled the high pt ...
604  ++((*countobjects)[objType]);
605  ++counttotal;
606  } else {
607  if ((unsigned)(*countobjects)[objType] < _minCandidates) { // To get correct results for HZZ
608  ++((*countobjects)[objType]);
609  ++counttotal;
610  } else
611  continue; // Otherwise too many entries in Eta and Phi distributions
612  }
613 
614  // Jet N-1 Cuts
615  if (_useNminOneCuts && objType == EVTColContainer::PFJET) {
616  if (passAllCuts) {
617  this->fillHist(u2str[it->first], objTypeStr, "Eta", eta);
618  this->fillHist(u2str[it->first], objTypeStr, "Phi", phi);
619  }
620  } else {
621  this->fillHist(u2str[it->first], objTypeStr, "Eta", eta);
622  this->fillHist(u2str[it->first], objTypeStr, "Phi", phi);
623  }
624 
625  // Already the minimum two objects has been filled, get out...
626  if (counttotal == totalobjectssize2) {
627  break;
628  }
629  }
630  delete countobjects;
631 
632  if (_useNminOneCuts && it->first == RECO) {
633  if (_NminOneCuts[0] && nMinOne["dEtaqq"]) {
634  this->fillHist(u2str[it->first], EVTColContainer::getTypeString(EVTColContainer::PFJET), "dEtaqq", dEtaqq);
635  }
636  if (_NminOneCuts[1] && nMinOne["mqq"]) {
637  this->fillHist(u2str[it->first], EVTColContainer::getTypeString(EVTColContainer::PFJET), "mqq", mqq);
638  }
639  if (_NminOneCuts[2] && nMinOne["dPhibb"]) {
640  this->fillHist(u2str[it->first], EVTColContainer::getTypeString(EVTColContainer::PFJET), "dPhibb", dPhibb);
641  }
642  if (_NminOneCuts[3]) {
643  std::string nameCSVplot = "CSV1";
644  if (_NminOneCuts[6])
645  nameCSVplot = "maxCSV";
646  if (nMinOne[nameCSVplot])
647  this->fillHist(u2str[it->first], EVTColContainer::getTypeString(EVTColContainer::PFJET), nameCSVplot, CSV1);
648  }
649  if (_NminOneCuts[4] && nMinOne["CSV2"]) {
650  this->fillHist(u2str[it->first], EVTColContainer::getTypeString(EVTColContainer::PFJET), "CSV2", CSV2);
651  }
652  if (_NminOneCuts[5] && nMinOne["CSV3"]) {
653  this->fillHist(u2str[it->first], EVTColContainer::getTypeString(EVTColContainer::PFJET), "CSV3", CSV3);
654  }
655  }
656 
657  //fill the efficiency vs nb of interactions
658  std::string nameVtxPlot = "trueVtxDist_" + _analysisname + "_" + u2str[it->first];
659  if ((!_useNminOneCuts) || it->first == RECO)
660  _elements[nameVtxPlot]->Fill(nbMCvtx);
661 
662  //fill the efficiency vs sum pT of jets
663  std::string nameHtPlot = "HtDist_" + _analysisname + "_" + u2str[it->first];
664  if (_bookHtPlots)
665  _elements[nameHtPlot]->Fill(Htmap[it->first]);
666 
667  // Calling to the plotters analysis (where the evaluation of the different trigger paths are done)
668  std::string SummaryName = "SummaryPaths_" + _analysisname + "_" + u2str[it->first];
669  const std::string source = u2str[it->first];
670  for (std::vector<HLTHiggsPlotter>::iterator an = _analyzers.begin(); an != _analyzers.end(); ++an) {
671  const std::string hltPath = _shortpath2long[an->gethltpath()];
672  const std::string fillShortPath = an->gethltpath();
673  const bool ispassTrigger = cols->triggerResults->accept(trigNames.triggerIndex(hltPath));
674 
675  if (_useNminOneCuts) {
676  an->analyze(ispassTrigger, source, it->second, nMinOne, dEtaqq, mqq, dPhibb, CSV1, CSV2, CSV3, passAllCuts);
677  } else {
678  an->analyze(ispassTrigger, source, it->second, _minCandidates);
679  }
680 
681  int refOfThePath = -1;
682  for (size_t itePath = 0; itePath < _hltPathsToCheck.size(); itePath++) {
683  refOfThePath++;
684  if (TString(hltPath).Contains(_hltPathsToCheck[itePath]))
685  break;
686  }
687  _elements[SummaryName]->Fill(refOfThePath);
688  if (ispassTrigger) {
689  _elements[SummaryName + "_passingHLT"]->Fill(refOfThePath, 1);
690  if ((!_useNminOneCuts) || it->first == RECO)
691  _elements[nameVtxPlot + "_" + fillShortPath]->Fill(nbMCvtx);
692  if (_bookHtPlots)
693  _elements[nameHtPlot + "_" + fillShortPath]->Fill(Htmap[it->first]);
694  } else {
695  _elements[SummaryName + "_passingHLT"]->Fill(refOfThePath, 0);
696  }
697  }
698  }
699 }
void InitSelector(const unsigned int &objtype)
std::map< std::string, std::string > _shortpath2long
Relation between the short version of a path.
void passJetCuts(std::vector< MatchStruct > *matches, std::map< std::string, bool > &jetCutResult, float &dEtaqq, float &mqq, float &dPhibb, float &CSV1, float &CSV2, float &CSV3)
void initobjects(const edm::Event &iEvent, EVTColContainer *col)
edm::EDGetTokenT< reco::PFJetCollection > _recoHtJetLabel
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
unsigned int _minCandidates
The minimum number of reco/gen candidates needed by the analysis.
std::map< std::string, MonitorElement * > _elements
std::vector< double > _NminOneCuts
bool accept() const
Has at least one path accepted the event?
const reco::GenParticleCollection * genParticles
edm::EDGetTokenT< reco::GenJetCollection > _genJetLabel
std::map< unsigned int, StringCutObjectSelector< reco::GenParticle > * > _genSelectorMap
void passOtherCuts(const std::vector< MatchStruct > &matches, std::map< std::string, bool > &jetCutResult)
const reco::GenJetCollection * genJets
unsigned int triggerIndex(std::string const &name) const
Definition: TriggerNames.cc:24
StringCutObjectSelector< reco::GenJet > * _genJetSelector
std::map< unsigned int, std::string > _genCut
gen/rec objects cuts
void initAndInsertJets(const edm::Event &iEvent, EVTColContainer *cols, std::vector< MatchStruct > *matches)
edm::EDGetTokenT< std::vector< PileupSummaryInfo > > _puSummaryInfo
std::vector< HLTHiggsPlotter > _analyzers
bool isValid() const
Definition: HandleBase.h:70
static const char *const trigNames[]
Definition: EcalDumpRaw.cc:57
void fillHist(const std::string &source, const std::string &objType, const std::string &variable, const float &value)
Helper structure to order MatchStruct.
Definition: MatchStruct.cc:58
void insertcandidates(const unsigned int &objtype, const EVTColContainer *col, std::vector< MatchStruct > *matches)
std::vector< std::string > _hltPathsToCheck
the hlt paths with regular expressions
std::map< unsigned int, std::string > _recLabels
static const std::string getTypeString(const unsigned int &objtype)
Tranform types into strings.
const edm::TriggerResults * triggerResults
static std::string const source
Definition: EdmProvDump.cc:47
edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const override
Definition: Event.cc:265
void HLTHiggsSubAnalysis::beginJob ( void  )

Definition at line 191 of file HLTHiggsSubAnalysis.cc.

191 {}
void HLTHiggsSubAnalysis::beginRun ( const edm::Run iRun,
const edm::EventSetup iEventSetup 
)

Definition at line 193 of file HLTHiggsSubAnalysis.cc.

References _analysisname, _analyzers, _hltConfig, _hltPaths, _hltPathsToCheck, _hltProcessName, _NminOneCuts, _pset, _recLabels, _shortpath2long, ramdisk_dqm_sourceclient-live_cfg::analyzer, beamvalidation::exit(), spr::find(), newFWLiteAna::found, getObjectsType(), EVTColContainer::getTypeString(), mps_fire::i, HLTConfigProvider::init(), dqmiolumiharvest::j, LogDebug, LogTrace, NptPlots, castor_dqm_sourceclient_file_cfg::path, topSingleLeptonDQM_PU_cfi::pattern, AlCaHLTBitMon_QueryRunRegistry::string, and HLTConfigProvider::triggerNames().

193  {
194  // Initialize the confighlt
195  bool changedConfig;
196  if (!_hltConfig.init(iRun, iSetup, _hltProcessName, changedConfig)) {
197  edm::LogError("HiggsValidations") << "HLTHiggsSubAnalysis::beginRun: "
198  << "Initializtion of HLTConfigProvider failed!!";
199  }
200 
201  // Parse the input paths to get them if there are in the table
202  // and associate them the last filter of the path (in order to extract the
203  _hltPaths.clear();
204  for (size_t i = 0; i < _hltPathsToCheck.size(); ++i) {
205  bool found = false;
206  TPRegexp pattern(_hltPathsToCheck[i]);
207  for (size_t j = 0; j < _hltConfig.triggerNames().size(); ++j) {
208  std::string thetriggername = _hltConfig.triggerNames()[j];
209  if (TString(thetriggername).Contains(pattern)) {
210  _hltPaths.insert(thetriggername);
211  found = true;
212  }
213  }
214  if (!found) {
215  LogDebug("HiggsValidations") << "HLTHiggsSubAnalysis::beginRun, In " << _analysisname
216  << " subfolder NOT found the path: '" << _hltPathsToCheck[i] << "*'";
217  }
218  }
219 
220  LogTrace("HiggsValidation") << "SubAnalysis: " << _analysisname << "\nHLT Trigger Paths found >>>";
221  // Initialize the plotters (analysers for each trigger path)
222  _analyzers.clear();
223  for (std::set<std::string>::iterator iPath = _hltPaths.begin(); iPath != _hltPaths.end(); ++iPath) {
224  // Avoiding the dependence of the version number for
225  // the trigger paths
226  std::string path = *iPath;
227  std::string shortpath = path;
228  if (path.rfind("_v") < path.length()) {
229  shortpath = path.substr(0, path.rfind("_v"));
230  }
231  _shortpath2long[shortpath] = path;
232 
233  // Objects needed by the HLT path
234  const std::vector<unsigned int> objsNeedHLT = this->getObjectsType(shortpath);
235  // Sanity check: the object needed by a trigger path should be
236  // introduced by the user via config python (_recLabels datamember)
237  std::vector<unsigned int> userInstantiate;
238  for (std::map<unsigned int, std::string>::iterator it = _recLabels.begin(); it != _recLabels.end(); ++it) {
239  userInstantiate.push_back(it->first);
240  }
241  for (std::vector<unsigned int>::const_iterator it = objsNeedHLT.begin(); it != objsNeedHLT.end(); ++it) {
242  if (std::find(userInstantiate.begin(), userInstantiate.end(), *it) == userInstantiate.end()) {
243  edm::LogError("HiggsValidation") << "In HLTHiggsSubAnalysis::beginRun, "
244  << "Incoherence found in the python configuration file!!\nThe SubAnalysis '"
245  << _analysisname << "' has been asked to evaluate the trigger path '"
246  << shortpath << "' (found it in 'hltPathsToCheck') BUT this path"
247  << " needs a '" << EVTColContainer::getTypeString(*it)
248  << "' which has not been instantiate ('recVariableLabels'"
249  << ")";
250  exit(-1);
251  }
252  }
253  LogTrace("HiggsValidation") << " --- " << shortpath;
254 
255  // the hlt path, the objects (elec,muons,photons,...)
256  // needed to evaluate the path are the argumens of the plotter
257  HLTHiggsPlotter analyzer(_pset, shortpath, objsNeedHLT, NptPlots, _NminOneCuts);
258  _analyzers.push_back(analyzer);
259  }
260 }
#define LogDebug(id)
std::map< std::string, std::string > _shortpath2long
Relation between the short version of a path.
std::vector< double > _NminOneCuts
const std::vector< std::string > & triggerNames() const
names of trigger paths
edm::ParameterSet _pset
std::set< std::string > _hltPaths
the hlt paths found in the hltConfig
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
HLTConfigProvider _hltConfig
std::vector< HLTHiggsPlotter > _analyzers
#define LogTrace(id)
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor
const std::vector< unsigned int > getObjectsType(const std::string &hltpath) const
Extract what objects need this analysis.
std::vector< std::string > _hltPathsToCheck
the hlt paths with regular expressions
std::map< unsigned int, std::string > _recLabels
static const std::string getTypeString(const unsigned int &objtype)
Tranform types into strings.
def exit(msg="")
void HLTHiggsSubAnalysis::bookHist ( const std::string &  source,
const std::string &  objType,
const std::string &  variable,
DQMStore::IBooker ibooker 
)
private

Definition at line 862 of file HLTHiggsSubAnalysis.cc.

References _elements, _parametersEta, _parametersPhi, _parametersTurnOn, dqm::dqmstoreimpl::DQMStore::IBooker::book1D(), SelectiveReadoutTask_cfi::edges, EVTColContainer::getTypeString(), h, mps_fire::i, createfilelist::int, SiStripPI::max, min(), Skims_PA_cff::name, seedmultiplicitymonitor_newtracking_cfi::nBins, electrons_cff::objType, CalibrationSummaryClient_cfi::params, EVTColContainer::PFJET, EVTColContainer::PFMET, source, AlCaHLTBitMon_QueryRunRegistry::string, overlapproblemtsosanalyzer_cfi::title, and taus_updatedMVAIds_cff::variable.

Referenced by bookHistograms().

865  {
866  std::string sourceUpper = source;
867  sourceUpper[0] = std::toupper(sourceUpper[0]);
869  TH1F* h = nullptr;
870 
871  if (variable.find("MaxPt") != std::string::npos) {
872  std::string desc;
873  if (variable == "MaxPt1")
874  desc = "Leading";
875  else if (variable == "MaxPt2")
876  desc = "Next-to-Leading";
877  else
878  desc = variable.substr(5, 6) + "th Leading";
879  std::string title = "pT of " + desc + " " + sourceUpper + " " + objType;
880  const size_t nBinsStandard = _parametersTurnOn.size() - 1;
881  size_t nBins = nBinsStandard;
882  float* edges = new float[nBinsStandard + 1];
883  for (size_t i = 0; i < nBinsStandard + 1; i++) {
884  edges[i] = _parametersTurnOn[i];
885  }
886 
888  if (objType == jetObj) {
889  const size_t nBinsJets = 25;
890  nBins = nBinsJets;
891  delete[] edges;
892  edges = new float[nBinsJets + 1];
893  for (size_t i = 0; i < nBinsJets + 1; i++) {
894  edges[i] = i * 10;
895  }
896  }
898  const size_t nBinsJets = 30;
899  nBins = nBinsJets;
900  delete[] edges;
901  edges = new float[nBinsJets + 1];
902  for (size_t i = 0; i < nBinsJets + 1; i++) {
903  edges[i] = i * 10;
904  }
905  }
906  h = new TH1F(name.c_str(), title.c_str(), nBins, edges);
907  delete[] edges;
908  } else if (variable == "dEtaqq") {
909  std::string title = "#Delta #eta_{qq} of " + sourceUpper + " " + objType;
910  int nBins = 20;
911  double min = 0;
912  double max = 4.8;
913  h = new TH1F(name.c_str(), title.c_str(), nBins, min, max);
914  } else if (variable == "mqq") {
915  std::string title = "m_{qq} of " + sourceUpper + " " + objType;
916  int nBins = 20;
917  double min = 0;
918  double max = 1000;
919  h = new TH1F(name.c_str(), title.c_str(), nBins, min, max);
920  } else if (variable == "dPhibb") {
921  std::string title = "#Delta #phi_{bb} of " + sourceUpper + " " + objType;
922  int nBins = 10;
923  double min = 0;
924  double max = 3.1416;
925  h = new TH1F(name.c_str(), title.c_str(), nBins, min, max);
926  } else if (variable == "CSV1") {
927  std::string title = "CSV1 of " + sourceUpper + " " + objType;
928  int nBins = 20;
929  double min = 0;
930  double max = 1;
931  h = new TH1F(name.c_str(), title.c_str(), nBins, min, max);
932  } else if (variable == "CSV2") {
933  std::string title = "CSV2 of " + sourceUpper + " " + objType;
934  int nBins = 20;
935  double min = 0;
936  double max = 1;
937  h = new TH1F(name.c_str(), title.c_str(), nBins, min, max);
938  } else if (variable == "CSV3") {
939  std::string title = "CSV3 of " + sourceUpper + " " + objType;
940  int nBins = 20;
941  double min = 0;
942  double max = 1;
943  h = new TH1F(name.c_str(), title.c_str(), nBins, min, max);
944  } else if (variable == "maxCSV") {
945  std::string title = "max CSV of " + sourceUpper + " " + objType;
946  int nBins = 20;
947  double min = 0;
948  double max = 1;
949  h = new TH1F(name.c_str(), title.c_str(), nBins, min, max);
950  } else {
951  std::string symbol = (variable == "Eta") ? "#eta" : "#phi";
952  std::string title = symbol + " of " + sourceUpper + " " + objType;
953  std::vector<double> params = (variable == "Eta") ? _parametersEta : _parametersPhi;
954 
955  int nBins = (int)params[0];
956  double min = params[1];
957  double max = params[2];
958  h = new TH1F(name.c_str(), title.c_str(), nBins, min, max);
959  }
960  h->Sumw2();
961  _elements[name] = ibooker.book1D(name, h);
962  delete h;
963 }
std::vector< double > _parametersTurnOn
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
std::map< std::string, MonitorElement * > _elements
T min(T a, T b)
Definition: MathUtil.h:58
std::vector< double > _parametersPhi
std::vector< double > _parametersEta
Some kinematical parameters.
static const std::string getTypeString(const unsigned int &objtype)
Tranform types into strings.
static std::string const source
Definition: EdmProvDump.cc:47
void HLTHiggsSubAnalysis::bookHistograms ( DQMStore::IBooker ibooker)

Definition at line 262 of file HLTHiggsSubAnalysis.cc.

References _analysisname, _analyzers, _bookHtPlots, _elements, _histDirectory, _hltPathsToCheck, _NminOneCuts, _parametersHt, _parametersPu, _recLabels, _useNminOneCuts, ALCARECODTCalibSynchDQM_cff::baseDir, dqm::dqmstoreimpl::DQMStore::IBooker::book1D(), bookHist(), EVTColContainer::getTypeString(), mps_fire::i, createfilelist::int, dqmiolumiharvest::j, MuonErrorMatrixAnalyzer_cfi::maxPt, MTVHistoProducerAlgoForTrackerBlock_cfi::maxPu, HLT_2018_cff::minHt, MTVHistoProducerAlgoForTrackerBlock_cfi::minPu, NptPlots, castor_dqm_sourceclient_file_cfg::path, EVTColContainer::PFJET, dqm::dqmstoreimpl::DQMStore::IBooker::setCurrentFolder(), source, CalibrationSummaryClient_cfi::sources, and AlCaHLTBitMon_QueryRunRegistry::string.

262  {
264  ibooker.setCurrentFolder(baseDir);
265  // Book the gen/reco analysis-dependent histograms (denominators)
266  std::vector<std::string> sources(2);
267  sources[0] = "gen";
268  sources[1] = "rec";
269 
270  for (std::map<unsigned int, std::string>::const_iterator it = _recLabels.begin(); it != _recLabels.end(); ++it) {
271  const std::string objStr = EVTColContainer::getTypeString(it->first);
272  TString maxPt;
273 
274  for (size_t i = 0; i < sources.size(); i++) {
276  if (_useNminOneCuts && it->first == EVTColContainer::PFJET) {
277  if (source == "gen")
278  continue;
279  else {
280  // N-1 jet plots (dEtaqq, mqq, dPhibb, CSV1, maxCSV_jets, maxCSV_E, PFMET, pt1, pt2, pt3, pt4)
281  if (_NminOneCuts[0])
282  bookHist(source, objStr, "dEtaqq", ibooker);
283  if (_NminOneCuts[1])
284  bookHist(source, objStr, "mqq", ibooker);
285  if (_NminOneCuts[2])
286  bookHist(source, objStr, "dPhibb", ibooker);
287  if (_NminOneCuts[3]) {
288  if (_NminOneCuts[6])
289  bookHist(source, objStr, "maxCSV", ibooker);
290  else
291  bookHist(source, objStr, "CSV1", ibooker);
292  }
293  if (_NminOneCuts[4])
294  bookHist(source, objStr, "CSV2", ibooker);
295  if (_NminOneCuts[5])
296  bookHist(source, objStr, "CSV3", ibooker);
297  }
298  }
299 
300  bookHist(source, objStr, "Eta", ibooker);
301  bookHist(source, objStr, "Phi", ibooker);
302  for (unsigned int i = 0; i < NptPlots; i++) {
303  maxPt = "MaxPt";
304  maxPt += i + 1;
305  bookHist(source, objStr, maxPt.Data(), ibooker);
306  }
307  }
308  }
309 
310  // Call the bookHistograms (which books all the path dependent histograms)
311  for (std::vector<HLTHiggsPlotter>::iterator it = _analyzers.begin(); it != _analyzers.end(); ++it) {
312  it->bookHistograms(ibooker, _useNminOneCuts);
313  }
314  //booking the histograms for overall trigger efficiencies
315  for (size_t i = 0; i < sources.size(); i++) {
316  std::string nameGlobalEfficiency = "SummaryPaths_" + _analysisname + "_" + sources[i];
317 
318  _elements[nameGlobalEfficiency] = ibooker.book1D(
319  nameGlobalEfficiency.c_str(), nameGlobalEfficiency.c_str(), _hltPathsToCheck.size(), 0, _hltPathsToCheck.size());
320 
321  std::string nameGlobalEfficiencyPassing = nameGlobalEfficiency + "_passingHLT";
322  _elements[nameGlobalEfficiencyPassing] = ibooker.book1D(nameGlobalEfficiencyPassing.c_str(),
323  nameGlobalEfficiencyPassing.c_str(),
324  _hltPathsToCheck.size(),
325  0,
326  _hltPathsToCheck.size());
327 
328  std::string titlePu = "nb of interations in the event";
329  std::string nameVtxPlot = "trueVtxDist_" + _analysisname + "_" + sources[i];
330  std::vector<double> paramsPu = _parametersPu;
331  int nBinsPu = (int)paramsPu[0];
332  double minPu = paramsPu[1];
333  double maxPu = paramsPu[2];
334 
335  std::string titleHt = "sum of jet pT in the event";
336  std::string nameHtPlot = "HtDist_" + _analysisname + "_" + sources[i];
337  std::vector<double> paramsHt = _parametersHt;
338  int nBinsHt = (int)paramsHt[0];
339  double minHt = paramsHt[1];
340  double maxHt = paramsHt[2];
341 
342  if ((!_useNminOneCuts) || sources[i] == "rec")
343  _elements[nameVtxPlot] = ibooker.book1D(nameVtxPlot.c_str(), titlePu.c_str(), nBinsPu, minPu, maxPu);
344  if (_bookHtPlots)
345  _elements[nameHtPlot] = ibooker.book1D(nameHtPlot.c_str(), titleHt.c_str(), nBinsHt, minHt, maxHt);
346  for (size_t j = 0; j < _hltPathsToCheck.size(); j++) {
347  //declare the efficiency vs interaction plots
349  std::string shortpath = path;
350  if (path.rfind("_v") < path.length()) {
351  shortpath = path.substr(0, path.rfind("_v"));
352  }
353  std::string titlePassingPu = "nb of interations in the event passing path " + shortpath;
354  if ((!_useNminOneCuts) || sources[i] == "rec")
355  _elements[nameVtxPlot + "_" + shortpath] =
356  ibooker.book1D(nameVtxPlot + "_" + shortpath, titlePassingPu.c_str(), nBinsPu, minPu, maxPu);
357 
358  std::string titlePassingHt = "sum of jet pT in the event passing path " + shortpath;
359  if (_bookHtPlots)
360  _elements[nameHtPlot + "_" + shortpath] =
361  ibooker.book1D(nameHtPlot + "_" + shortpath, titlePassingHt.c_str(), nBinsHt, minHt, maxHt);
362 
363  //fill the bin labels of the summary plot
364  _elements[nameGlobalEfficiency]->setBinLabel(j + 1, shortpath);
365  _elements[nameGlobalEfficiencyPassing]->setBinLabel(j + 1, shortpath);
366  }
367  }
368 }
std::map< std::string, MonitorElement * > _elements
std::vector< double > _NminOneCuts
std::vector< double > _parametersPu
std::vector< HLTHiggsPlotter > _analyzers
void bookHist(const std::string &source, const std::string &objType, const std::string &variable, DQMStore::IBooker &)
std::vector< double > _parametersHt
std::vector< std::string > _hltPathsToCheck
the hlt paths with regular expressions
std::map< unsigned int, std::string > _recLabels
static const std::string getTypeString(const unsigned int &objtype)
Tranform types into strings.
static std::string const source
Definition: EdmProvDump.cc:47
void HLTHiggsSubAnalysis::bookobjects ( const edm::ParameterSet anpset,
edm::ConsumesCollector iC 
)
private

Definition at line 744 of file HLTHiggsSubAnalysis.cc.

References _analysisname, _genJetSelector, _genSelectorMap, _recLabels, _recLabelsCaloMET, _recLabelsElec, _recLabelsMuon, _recLabelsPFJet, _recLabelsPFMET, _recLabelsPFTau, _recLabelsPhoton, _recTagPFJet, EVTColContainer::CALOMET, edm::ConsumesCollector::consumes(), EVTColContainer::ELEC, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), EVTColContainer::MUON, EVTColContainer::PFJET, EVTColContainer::PFMET, EVTColContainer::PFTAU, EVTColContainer::PHOTON, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by HLTHiggsSubAnalysis().

744  {
745  if (anpset.exists("recMuonLabel")) {
746  _recLabels[EVTColContainer::MUON] = anpset.getParameter<std::string>("recMuonLabel");
749  }
750  if (anpset.exists("recElecLabel")) {
751  _recLabels[EVTColContainer::ELEC] = anpset.getParameter<std::string>("recElecLabel");
754  }
755  if (anpset.exists("recPhotonLabel")) {
756  _recLabels[EVTColContainer::PHOTON] = anpset.getParameter<std::string>("recPhotonLabel");
759  }
760  if (anpset.exists("recCaloMETLabel")) {
761  _recLabels[EVTColContainer::CALOMET] = anpset.getParameter<std::string>("recCaloMETLabel");
764  }
765  if (anpset.exists("recPFMETLabel")) {
766  _recLabels[EVTColContainer::PFMET] = anpset.getParameter<std::string>("recPFMETLabel");
769  }
770  if (anpset.exists("recPFTauLabel")) {
771  _recLabels[EVTColContainer::PFTAU] = anpset.getParameter<std::string>("recPFTauLabel");
774  }
775  if (anpset.exists("recJetLabel")) {
776  _recLabels[EVTColContainer::PFJET] = anpset.getParameter<std::string>("recJetLabel");
778  if (anpset.exists("jetTagLabel"))
780  _genJetSelector = nullptr;
781  }
782  /*if( anpset.exists("recTrackLabel") )
783  {
784  _recLabels[EVTColContainer::TRACK] = anpset.getParameter<std::string>("recTrackLabel");
785  _genSelectorMap[EVTColContainer::TRACK] = 0 ;
786  }*/
787 
788  if (_recLabels.empty()) {
789  edm::LogError("HiggsValidation") << "HLTHiggsSubAnalysis::bookobjects, "
790  << "Not included any object (recMuonLabel, recElecLabel, ...) "
791  << "in the analysis " << _analysisname;
792  return;
793  }
794 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
std::vector< PFTau > PFTauCollection
collection of PFTau objects
Definition: PFTauFwd.h:9
edm::EDGetTokenT< reco::PFMETCollection > _recLabelsPFMET
edm::EDGetTokenT< reco::PFJetCollection > _recLabelsPFJet
edm::EDGetTokenT< reco::PFTauCollection > _recLabelsPFTau
bool exists(std::string const &parameterName) const
checks if a parameter exists
std::map< unsigned int, StringCutObjectSelector< reco::GenParticle > * > _genSelectorMap
edm::EDGetTokenT< reco::JetTagCollection > _recTagPFJet
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
std::vector< Muon > MuonCollection
collection of Muon objects
Definition: MuonFwd.h:9
edm::EDGetTokenT< reco::PhotonCollection > _recLabelsPhoton
edm::EDGetTokenT< reco::CaloMETCollection > _recLabelsCaloMET
StringCutObjectSelector< reco::GenJet > * _genJetSelector
std::vector< reco::CaloMET > CaloMETCollection
collection of CaloMET objects
edm::EDGetTokenT< reco::GsfElectronCollection > _recLabelsElec
std::vector< Photon > PhotonCollection
collectin of Photon objects
Definition: PhotonFwd.h:9
std::vector< PFJet > PFJetCollection
collection of PFJet objects
edm::EDGetTokenT< reco::MuonCollection > _recLabelsMuon
std::vector< reco::PFMET > PFMETCollection
collection of PFMET objects
std::map< unsigned int, std::string > _recLabels
void HLTHiggsSubAnalysis::fillHist ( const std::string &  source,
const std::string &  objType,
const std::string &  variable,
const float &  value 
)
private

Definition at line 965 of file HLTHiggsSubAnalysis.cc.

References _elements, Skims_PA_cff::name, source, AlCaHLTBitMon_QueryRunRegistry::string, and taus_updatedMVAIds_cff::variable.

Referenced by analyze().

968  {
969  std::string sourceUpper = source;
970  sourceUpper[0] = toupper(sourceUpper[0]);
972 
973  _elements[name]->Fill(value);
974 }
std::map< std::string, MonitorElement * > _elements
Definition: value.py:1
static std::string const source
Definition: EdmProvDump.cc:47
const std::vector< unsigned int > HLTHiggsSubAnalysis::getObjectsType ( const std::string &  hltpath) const

Extract what objects need this analysis.

Definition at line 702 of file HLTHiggsSubAnalysis.cc.

References EVTColContainer::CALOMET, EVTColContainer::ELEC, EVTColContainer::getTypeString(), mps_fire::i, EVTColContainer::MUON, EVTColContainer::PFJET, EVTColContainer::PFMET, EVTColContainer::PFTAU, EVTColContainer::PHOTON, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by beginRun().

702  {
703  static const unsigned int objSize = 7;
704  static const unsigned int objtriggernames[] = {EVTColContainer::MUON,
707  // EVTColContainer::TRACK, // Note is tracker muon
712 
713  std::set<unsigned int> objsType;
714  // The object to deal has to be entered via the config .py
715  for (unsigned int i = 0; i < objSize; ++i) {
716  std::string objTypeStr = EVTColContainer::getTypeString(objtriggernames[i]);
717  // Check if it is needed this object for this trigger
718  if (!TString(hltPath).Contains(objTypeStr)) {
719  if ((objtriggernames[i] == EVTColContainer::PFJET &&
720  TString(hltPath).Contains("WHbbBoost")) || // fix for HLT_Ele27_WPLoose_Gsf_WHbbBoost_v
721  (objtriggernames[i] == EVTColContainer::PFJET && TString(hltPath).Contains("CSV")) || // fix for ZnnHbb PFJET
722  (objtriggernames[i] == EVTColContainer::PFMET && TString(hltPath).Contains("MHT")) || // fix for ZnnHbb PFMET
723  (objtriggernames[i] == EVTColContainer::PHOTON && TString(hltPath).Contains("Diphoton"))) {
724  objsType.insert(objtriggernames[i]); //case of the New Diphoton paths
725  }
726  continue;
727  }
728  if ((objtriggernames[i] == EVTColContainer::CALOMET &&
729  (TString(hltPath).Contains("PFMET") || TString(hltPath).Contains("MHT"))) || // fix for PFMET
730  (objtriggernames[i] == EVTColContainer::PFJET && TString(hltPath).Contains("JetIdCleaned") &&
731  !TString(hltPath).Contains(TRegexp("Jet[^I]"))) || // fix for Htaunu
732  (objtriggernames[i] == EVTColContainer::MUON && TString(hltPath).Contains("METNoMu"))) // fix for VBFHToInv
733  {
734  continue;
735  }
736 
737  objsType.insert(objtriggernames[i]);
738  }
739 
740  return std::vector<unsigned int>(objsType.begin(), objsType.end());
741 }
static const std::string getTypeString(const unsigned int &objtype)
Tranform types into strings.
void HLTHiggsSubAnalysis::initAndInsertJets ( const edm::Event iEvent,
EVTColContainer cols,
std::vector< MatchStruct > *  matches 
)
private

Definition at line 1003 of file HLTHiggsSubAnalysis.cc.

References _recLabelsPFJet, _recPFJetSelector, _recTagPFJet, _useNminOneCuts, TtFullHadHypKinFit_cfi::bTag, edm::Event::getByToken(), EVTColContainer::PFJET, edm::Handle< T >::product(), and EVTColContainer::set().

Referenced by analyze().

1005  {
1007  iEvent.getByToken(_recLabelsPFJet, PFJetHandle);
1008  cols->set(PFJetHandle.product());
1009 
1011  if (_useNminOneCuts) {
1012  iEvent.getByToken(_recTagPFJet, JetTagHandle);
1013  }
1014 
1015  for (reco::PFJetCollection::const_iterator it = PFJetHandle->begin(); it != PFJetHandle->end(); ++it) {
1016  reco::PFJetRef jetRef(PFJetHandle, it - PFJetHandle->begin());
1017  reco::JetBaseRef jetBaseRef(jetRef);
1018 
1019  if (_recPFJetSelector->operator()(*it)) {
1020  if (_useNminOneCuts) {
1021  float bTag = (*(JetTagHandle.product()))[jetBaseRef];
1022  matches->push_back(MatchStruct(&*it, EVTColContainer::PFJET, bTag));
1023  } else {
1024  matches->push_back(MatchStruct(&*it, EVTColContainer::PFJET));
1025  }
1026  }
1027  }
1028 }
edm::EDGetTokenT< reco::PFJetCollection > _recLabelsPFJet
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
edm::EDGetTokenT< reco::JetTagCollection > _recTagPFJet
void set(const reco::MuonCollection *v)
Setter: multiple overloaded function.
T const * product() const
Definition: Handle.h:69
StringCutObjectSelector< reco::PFJet > * _recPFJetSelector
void HLTHiggsSubAnalysis::initobjects ( const edm::Event iEvent,
EVTColContainer col 
)
private

Definition at line 796 of file HLTHiggsSubAnalysis.cc.

References _genJetLabel, _genParticleLabel, _recLabels, _recLabelsCaloMET, _recLabelsElec, _recLabelsMuon, _recLabelsPFMET, _recLabelsPFTau, _recLabelsPhoton, _trigResultsTag, _useNminOneCuts, EVTColContainer::CALOMET, EVTColContainer::ELEC, EVTColContainer::genJets, EVTColContainer::genParticles, edm::Event::getByToken(), EVTColContainer::isCommonInit(), edm::HandleBase::isValid(), EVTColContainer::MUON, EVTColContainer::PFJET, EVTColContainer::PFMET, EVTColContainer::PFTAU, EVTColContainer::PHOTON, edm::Handle< T >::product(), EVTColContainer::set(), and EVTColContainer::triggerResults.

Referenced by analyze().

796  {
797  /*if( col != 0 && col->isAllInit() )
798  {
799  // Already init, not needed to do nothing
800  return;
801  }*/
802  if (!col->isCommonInit()) {
803  // extract the trigger results (path info, pass,...)
805  iEvent.getByToken(_trigResultsTag, trigResults);
806  if (trigResults.isValid()) {
807  col->triggerResults = trigResults.product();
808  }
809 
810  // GenParticle collection if is there (genJets only if there need to be jets)
812  iEvent.getByToken(_genParticleLabel, genPart);
813  if (genPart.isValid()) {
814  col->genParticles = genPart.product();
815  }
816  }
817 
818  for (std::map<unsigned int, std::string>::iterator it = _recLabels.begin(); it != _recLabels.end(); ++it) {
819  if (it->first == EVTColContainer::MUON) {
821  iEvent.getByToken(_recLabelsMuon, theHandle);
822  col->set(theHandle.product());
823  } else if (it->first == EVTColContainer::ELEC) {
825  iEvent.getByToken(_recLabelsElec, theHandle);
826  col->set(theHandle.product());
827  } else if (it->first == EVTColContainer::PHOTON) {
829  iEvent.getByToken(_recLabelsPhoton, theHandle);
830  col->set(theHandle.product());
831  } else if (it->first == EVTColContainer::CALOMET) {
833  iEvent.getByToken(_recLabelsCaloMET, theHandle);
834  col->set(theHandle.product());
835  } else if (it->first == EVTColContainer::PFMET) {
837  iEvent.getByToken(_recLabelsPFMET, theHandle);
838  col->set(theHandle.product());
839  } else if (it->first == EVTColContainer::PFTAU) {
841  iEvent.getByToken(_recLabelsPFTau, theHandle);
842  col->set(theHandle.product());
843  }
844  // PFJets loaded in seperate function initAndInsertJets because they need to be combined with the btags using the Handle (not the product) and for ordering them seperately in the MatchStruct's
845  else if (it->first == EVTColContainer::PFJET) {
846  if (!_useNminOneCuts) {
847  // GenJet collection
849  iEvent.getByToken(_genJetLabel, genJet);
850  if (genJet.isValid()) {
851  col->genJets = genJet.product();
852  }
853  }
854  } else {
855  edm::LogError("HiggsValidation") << "HLTHiggsSubAnalysis::initobjects "
856  << " NOT IMPLEMENTED (yet) ERROR: '" << it->second << "'";
857  //return; ??
858  }
859  }
860 }
edm::EDGetTokenT< reco::PFMETCollection > _recLabelsPFMET
edm::EDGetTokenT< reco::GenParticleCollection > _genParticleLabel
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
edm::EDGetTokenT< reco::PFTauCollection > _recLabelsPFTau
const reco::GenParticleCollection * genParticles
edm::EDGetTokenT< reco::GenJetCollection > _genJetLabel
edm::EDGetTokenT< reco::PhotonCollection > _recLabelsPhoton
edm::EDGetTokenT< reco::CaloMETCollection > _recLabelsCaloMET
void set(const reco::MuonCollection *v)
Setter: multiple overloaded function.
const reco::GenJetCollection * genJets
bool isValid() const
Definition: HandleBase.h:70
edm::EDGetTokenT< edm::TriggerResults > _trigResultsTag
edm::EDGetTokenT< reco::GsfElectronCollection > _recLabelsElec
T const * product() const
Definition: Handle.h:69
edm::EDGetTokenT< reco::MuonCollection > _recLabelsMuon
std::map< unsigned int, std::string > _recLabels
const edm::TriggerResults * triggerResults
void HLTHiggsSubAnalysis::InitSelector ( const unsigned int &  objtype)
private

Definition at line 977 of file HLTHiggsSubAnalysis.cc.

References _recCaloMETSelector, _recCut, _recElecSelector, _recMuonSelector, _recPFJetSelector, _recPFMETSelector, _recPFTauSelector, _recPhotonSelector, EVTColContainer::CALOMET, EVTColContainer::ELEC, EVTColContainer::MUON, EVTColContainer::PFJET, EVTColContainer::PFMET, EVTColContainer::PFTAU, and EVTColContainer::PHOTON.

Referenced by analyze().

977  {
978  if (objtype == EVTColContainer::MUON && _recMuonSelector == nullptr) {
980  } else if (objtype == EVTColContainer::ELEC && _recElecSelector == nullptr) {
982  } else if (objtype == EVTColContainer::PHOTON && _recPhotonSelector == nullptr) {
984  } else if (objtype == EVTColContainer::CALOMET && _recCaloMETSelector == nullptr) {
986  } else if (objtype == EVTColContainer::PFMET && _recPFMETSelector == nullptr) {
988  } else if (objtype == EVTColContainer::PFTAU && _recPFTauSelector == nullptr) {
990  } else if (objtype == EVTColContainer::PFJET && _recPFJetSelector == nullptr) {
992  }
993  /*else if( objtype == EVTColContainer::TRACK && _recTrackSelector == 0)
994  {
995  _recTrackSelector = new StringCutObjectSelector<reco::Track>(_recCut[objtype]);
996  }*/
997  /* else
998  {
999 FIXME: ERROR NO IMPLEMENTADO
1000  }*/
1001 }
StringCutObjectSelector< reco::CaloMET > * _recCaloMETSelector
StringCutObjectSelector< reco::PFMET > * _recPFMETSelector
std::map< unsigned int, std::string > _recCut
StringCutObjectSelector< reco::PFTau > * _recPFTauSelector
StringCutObjectSelector< reco::Muon > * _recMuonSelector
StringCutObjectSelector< reco::Photon > * _recPhotonSelector
StringCutObjectSelector< reco::PFJet > * _recPFJetSelector
StringCutObjectSelector< reco::GsfElectron > * _recElecSelector
void HLTHiggsSubAnalysis::insertcandidates ( const unsigned int &  objtype,
const EVTColContainer col,
std::vector< MatchStruct > *  matches 
)
private

Definition at line 1145 of file HLTHiggsSubAnalysis.cc.

References _recCaloMETSelector, _recElecSelector, _recMuonSelector, _recPFMETSelector, _recPFTauSelector, _recPhotonSelector, EVTColContainer::CALOMET, EVTColContainer::caloMETs, EVTColContainer::ELEC, EVTColContainer::electrons, mps_fire::i, EVTColContainer::MUON, EVTColContainer::muons, electrons_cff::objType, EVTColContainer::PFMET, EVTColContainer::pfMETs, EVTColContainer::PFTAU, EVTColContainer::pfTaus, EVTColContainer::PHOTON, and EVTColContainer::photons.

Referenced by analyze().

1147  {
1148  if (objType == EVTColContainer::MUON) {
1149  for (size_t i = 0; i < cols->muons->size(); i++) {
1150  if (_recMuonSelector->operator()(cols->muons->at(i))) {
1151  matches->push_back(MatchStruct(&cols->muons->at(i), objType));
1152  }
1153  }
1154  } else if (objType == EVTColContainer::ELEC) {
1155  for (size_t i = 0; i < cols->electrons->size(); i++) {
1156  if (_recElecSelector->operator()(cols->electrons->at(i))) {
1157  matches->push_back(MatchStruct(&cols->electrons->at(i), objType));
1158  }
1159  }
1160  } else if (objType == EVTColContainer::PHOTON) {
1161  for (size_t i = 0; i < cols->photons->size(); i++) {
1162  if (_recPhotonSelector->operator()(cols->photons->at(i))) {
1163  matches->push_back(MatchStruct(&cols->photons->at(i), objType));
1164  }
1165  }
1166  } else if (objType == EVTColContainer::CALOMET) {
1167  for (size_t i = 0; i < cols->caloMETs->size(); i++) {
1168  if (_recCaloMETSelector->operator()(cols->caloMETs->at(i))) {
1169  matches->push_back(MatchStruct(&cols->caloMETs->at(i), objType));
1170  }
1171  }
1172  } else if (objType == EVTColContainer::PFMET) {
1173  for (size_t i = 0; i < cols->pfMETs->size(); i++) {
1174  if (_recPFMETSelector->operator()(cols->pfMETs->at(i))) {
1175  matches->push_back(MatchStruct(&cols->pfMETs->at(i), objType));
1176  }
1177  }
1178  } else if (objType == EVTColContainer::PFTAU) {
1179  for (size_t i = 0; i < cols->pfTaus->size(); i++) {
1180  if (_recPFTauSelector->operator()(cols->pfTaus->at(i))) {
1181  matches->push_back(MatchStruct(&cols->pfTaus->at(i), objType));
1182  }
1183  }
1184  }
1185  // else if( objType == EVTColContainer::PFJET )
1186  // {
1187  // already inserted
1188  // }
1189  /*else if( objType == EVTColContainer::TRACK )
1190  {
1191  for(size_t i = 0; i < cols->tracks->size(); i++)
1192  {
1193  if(_recTrackSelector->operator()(cols->tracks->at(i)))
1194  {
1195  matches->push_back(MatchStruct(&cols->tracks->at(i),objType));
1196  }
1197  }
1198  }*/
1199  /*
1200  else FIXME: Control errores
1201  {
1202  }
1203  */
1204 }
StringCutObjectSelector< reco::CaloMET > * _recCaloMETSelector
StringCutObjectSelector< reco::PFMET > * _recPFMETSelector
StringCutObjectSelector< reco::PFTau > * _recPFTauSelector
StringCutObjectSelector< reco::Muon > * _recMuonSelector
StringCutObjectSelector< reco::Photon > * _recPhotonSelector
StringCutObjectSelector< reco::GsfElectron > * _recElecSelector
void HLTHiggsSubAnalysis::passJetCuts ( std::vector< MatchStruct > *  matches,
std::map< std::string, bool > &  jetCutResult,
float &  dEtaqq,
float &  mqq,
float &  dPhibb,
float &  CSV1,
float &  CSV2,
float &  CSV3 
)
private

Definition at line 1030 of file HLTHiggsSubAnalysis.cc.

References _NminOneCuts, PVValHelper::eta, mps_fire::i, createfilelist::int, MuonErrorMatrixAnalyzer_cfi::maxPt, ECF_cff::Njets, NptPlots, phi, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by analyze().

1038  { //dEtaqq, mqq, dPhibb, CSV1, CSV2, CSV3, maxCSV_jets, maxCSV_E, PFMET, pt1, pt2, pt3, pt4
1039 
1040  // Perform pt cuts
1041  std::sort(matches->begin(), matches->end(), matchesByDescendingPt());
1042  TString maxPt;
1043  for (unsigned int i = 0; i < NptPlots; i++) {
1044  maxPt = "MaxPt";
1045  maxPt += i + 1;
1046  if ((*matches)[i].pt > _NminOneCuts[9 + i])
1047  jetCutResult[maxPt.Data()] = true;
1048  else
1049  jetCutResult[maxPt.Data()] = false;
1050  }
1051 
1052  unsigned int NbTag = ((_NminOneCuts[0] || _NminOneCuts[1]) ? 4 : 8);
1053  if (matches->size() < NbTag)
1054  NbTag = matches->size();
1055  // Perform b-tag ordered cuts
1056  std::sort(matches->begin(), matches->begin() + NbTag, matchesByDescendingBtag());
1057 
1058  if (_NminOneCuts[0]) {
1059  jetCutResult["dEtaqq"] = false;
1060  if (matches->size() > 2) {
1061  dEtaqq = fabs((*matches)[2].eta - (*matches)[3].eta);
1062  if (dEtaqq > _NminOneCuts[0])
1063  jetCutResult["dEtaqq"] = true;
1064  }
1065  }
1066 
1067  if (_NminOneCuts[1]) {
1068  jetCutResult["mqq"] = false;
1069  if (matches->size() > 2) {
1070  mqq = ((*matches)[2].lorentzVector + (*matches)[3].lorentzVector).M();
1071  if (mqq > _NminOneCuts[1])
1072  jetCutResult["mqq"] = true;
1073  }
1074  }
1075 
1076  if (_NminOneCuts[2]) {
1077  jetCutResult["dPhibb"] = false;
1078  if (matches->size() > 1) {
1079  dPhibb = fmod(fabs((*matches)[0].phi - (*matches)[1].phi), 3.1416);
1080  if (dPhibb < _NminOneCuts[2])
1081  jetCutResult["dPhibb"] = true;
1082  }
1083  }
1084 
1085  if (_NminOneCuts[4]) {
1086  std::string nameCSV2plot = "CSV2";
1087  jetCutResult[nameCSV2plot] = false;
1088  if (matches->size() > 1) {
1089  CSV2 = (*matches)[1].bTag;
1090  if (CSV2 > _NminOneCuts[4])
1091  jetCutResult[nameCSV2plot] = true;
1092  }
1093  }
1094 
1095  if (_NminOneCuts[5]) {
1096  std::string nameCSV3plot = "CSV3";
1097  jetCutResult[nameCSV3plot] = false;
1098  if (matches->size() > 2) {
1099  CSV3 = (*matches)[2].bTag;
1100  if (CSV3 > _NminOneCuts[5])
1101  jetCutResult[nameCSV3plot] = true;
1102  }
1103  }
1104 
1105  if (_NminOneCuts[3]) {
1106  CSV1 = (*matches)[0].bTag;
1107  std::string nameCSVplot = "CSV1";
1108  if (_NminOneCuts[6])
1109  nameCSVplot = "maxCSV";
1110 
1111  if (CSV1 > _NminOneCuts[3])
1112  jetCutResult[nameCSVplot] = true;
1113  else
1114  jetCutResult[nameCSVplot] = false;
1115 
1116  // max(CSV)
1117  if (_NminOneCuts[6]) {
1118  std::sort(matches->begin(), matches->end(), matchesByDescendingPt());
1119  CSV1 = (*matches)[0].bTag;
1120  unsigned int Njets = (unsigned int)_NminOneCuts[6];
1121  if (_NminOneCuts[6] > matches->size())
1122  Njets = matches->size();
1123  for (unsigned int i = 1; i < (unsigned int)Njets; ++i) {
1124  if ((*matches)[i].bTag > CSV1 && (*matches)[i].pt > _NminOneCuts[7])
1125  CSV1 = (*matches)[i].bTag;
1126  }
1127  }
1128  }
1129 }
std::vector< double > _NminOneCuts
Helper structure to order MatchStruct.
Definition: MatchStruct.cc:58
void HLTHiggsSubAnalysis::passOtherCuts ( const std::vector< MatchStruct > &  matches,
std::map< std::string, bool > &  jetCutResult 
)
private

Definition at line 1131 of file HLTHiggsSubAnalysis.cc.

References _NminOneCuts, and EVTColContainer::PFMET.

Referenced by analyze().

1132  {
1133  if (_NminOneCuts[8]) {
1134  jetCutResult["PFMET"] = false;
1135  for (std::vector<MatchStruct>::const_iterator it = matches.begin(); it != matches.end(); ++it) {
1136  if (it->objType == EVTColContainer::PFMET) {
1137  if (it->pt > _NminOneCuts[8])
1138  jetCutResult["PFMET"] = true;
1139  break;
1140  }
1141  }
1142  }
1143 }
std::vector< double > _NminOneCuts

Member Data Documentation

std::string HLTHiggsSubAnalysis::_analysisname
private
std::vector<HLTHiggsPlotter> HLTHiggsSubAnalysis::_analyzers
private

Definition at line 170 of file HLTHiggsSubAnalysis.h.

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

bool HLTHiggsSubAnalysis::_bookHtPlots
private

Definition at line 105 of file HLTHiggsSubAnalysis.h.

Referenced by analyze(), bookHistograms(), and HLTHiggsSubAnalysis().

std::map<unsigned int, double> HLTHiggsSubAnalysis::_cutMaxEta
private

Definition at line 144 of file HLTHiggsSubAnalysis.h.

Referenced by HLTHiggsSubAnalysis().

std::map<unsigned int, double> HLTHiggsSubAnalysis::_cutMinPt
private

Definition at line 143 of file HLTHiggsSubAnalysis.h.

Referenced by HLTHiggsSubAnalysis().

std::map<unsigned int, unsigned int> HLTHiggsSubAnalysis::_cutMotherId
private

Definition at line 145 of file HLTHiggsSubAnalysis.h.

std::map<unsigned int, std::vector<double> > HLTHiggsSubAnalysis::_cutsDr
private

Definition at line 146 of file HLTHiggsSubAnalysis.h.

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

Definition at line 173 of file HLTHiggsSubAnalysis.h.

Referenced by analyze(), bookHist(), bookHistograms(), and fillHist().

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

gen/rec objects cuts

Definition at line 148 of file HLTHiggsSubAnalysis.h.

Referenced by analyze(), and HLTHiggsSubAnalysis().

edm::EDGetTokenT<reco::GenJetCollection> HLTHiggsSubAnalysis::_genJetLabel
private

Definition at line 121 of file HLTHiggsSubAnalysis.h.

Referenced by analyze(), and initobjects().

StringCutObjectSelector<reco::GenJet>* HLTHiggsSubAnalysis::_genJetSelector
private

Definition at line 154 of file HLTHiggsSubAnalysis.h.

Referenced by analyze(), bookobjects(), and ~HLTHiggsSubAnalysis().

edm::EDGetTokenT<reco::GenParticleCollection> HLTHiggsSubAnalysis::_genParticleLabel
private

Definition at line 120 of file HLTHiggsSubAnalysis.h.

Referenced by initobjects().

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

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

Definition at line 153 of file HLTHiggsSubAnalysis.h.

Referenced by analyze(), bookobjects(), and ~HLTHiggsSubAnalysis().

std::string HLTHiggsSubAnalysis::_histDirectory
private

Definition at line 108 of file HLTHiggsSubAnalysis.h.

Referenced by bookHistograms().

HLTConfigProvider HLTHiggsSubAnalysis::_hltConfig
private

Definition at line 172 of file HLTHiggsSubAnalysis.h.

Referenced by beginRun().

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

the hlt paths found in the hltConfig

Definition at line 113 of file HLTHiggsSubAnalysis.h.

Referenced by beginRun().

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

the hlt paths with regular expressions

Definition at line 111 of file HLTHiggsSubAnalysis.h.

Referenced by analyze(), beginRun(), bookHistograms(), and HLTHiggsSubAnalysis().

std::string HLTHiggsSubAnalysis::_hltProcessName
private

Definition at line 107 of file HLTHiggsSubAnalysis.h.

Referenced by beginRun().

double HLTHiggsSubAnalysis::_HtJetEtaMax
private

Definition at line 103 of file HLTHiggsSubAnalysis.h.

Referenced by analyze(), and HLTHiggsSubAnalysis().

double HLTHiggsSubAnalysis::_HtJetPtMin
private

Definition at line 102 of file HLTHiggsSubAnalysis.h.

Referenced by analyze(), and HLTHiggsSubAnalysis().

unsigned int HLTHiggsSubAnalysis::_minCandidates
private

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

Definition at line 100 of file HLTHiggsSubAnalysis.h.

Referenced by analyze(), and HLTHiggsSubAnalysis().

std::vector<double> HLTHiggsSubAnalysis::_NminOneCuts
private
std::vector<double> HLTHiggsSubAnalysis::_parametersEta
private

Some kinematical parameters.

Definition at line 136 of file HLTHiggsSubAnalysis.h.

Referenced by bookHist().

std::vector<double> HLTHiggsSubAnalysis::_parametersHt
private

Definition at line 139 of file HLTHiggsSubAnalysis.h.

Referenced by bookHistograms(), and HLTHiggsSubAnalysis().

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

Definition at line 137 of file HLTHiggsSubAnalysis.h.

Referenced by bookHist().

std::vector<double> HLTHiggsSubAnalysis::_parametersPu
private

Definition at line 138 of file HLTHiggsSubAnalysis.h.

Referenced by bookHistograms().

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

Definition at line 140 of file HLTHiggsSubAnalysis.h.

Referenced by bookHist(), and HLTHiggsSubAnalysis().

edm::ParameterSet HLTHiggsSubAnalysis::_pset
private

Definition at line 95 of file HLTHiggsSubAnalysis.h.

Referenced by beginRun(), and HLTHiggsSubAnalysis().

edm::EDGetTokenT<std::vector<PileupSummaryInfo> > HLTHiggsSubAnalysis::_puSummaryInfo
private

Definition at line 133 of file HLTHiggsSubAnalysis.h.

Referenced by analyze(), and HLTHiggsSubAnalysis().

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

Definition at line 157 of file HLTHiggsSubAnalysis.h.

Referenced by InitSelector(), insertcandidates(), and ~HLTHiggsSubAnalysis().

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

Definition at line 149 of file HLTHiggsSubAnalysis.h.

Referenced by HLTHiggsSubAnalysis(), and InitSelector().

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

Definition at line 156 of file HLTHiggsSubAnalysis.h.

Referenced by InitSelector(), insertcandidates(), and ~HLTHiggsSubAnalysis().

std::map<unsigned int, std::string> HLTHiggsSubAnalysis::_recLabels
private
edm::EDGetTokenT<reco::CaloMETCollection> HLTHiggsSubAnalysis::_recLabelsCaloMET
private

Definition at line 128 of file HLTHiggsSubAnalysis.h.

Referenced by bookobjects(), and initobjects().

edm::EDGetTokenT<reco::GsfElectronCollection> HLTHiggsSubAnalysis::_recLabelsElec
private

Definition at line 126 of file HLTHiggsSubAnalysis.h.

Referenced by bookobjects(), and initobjects().

edm::EDGetTokenT<reco::MuonCollection> HLTHiggsSubAnalysis::_recLabelsMuon
private

Definition at line 125 of file HLTHiggsSubAnalysis.h.

Referenced by bookobjects(), and initobjects().

edm::EDGetTokenT<reco::PFJetCollection> HLTHiggsSubAnalysis::_recLabelsPFJet
private

Definition at line 131 of file HLTHiggsSubAnalysis.h.

Referenced by bookobjects(), and initAndInsertJets().

edm::EDGetTokenT<reco::PFMETCollection> HLTHiggsSubAnalysis::_recLabelsPFMET
private

Definition at line 129 of file HLTHiggsSubAnalysis.h.

Referenced by bookobjects(), and initobjects().

edm::EDGetTokenT<reco::PFTauCollection> HLTHiggsSubAnalysis::_recLabelsPFTau
private

Definition at line 130 of file HLTHiggsSubAnalysis.h.

Referenced by bookobjects(), and initobjects().

edm::EDGetTokenT<reco::PhotonCollection> HLTHiggsSubAnalysis::_recLabelsPhoton
private

Definition at line 127 of file HLTHiggsSubAnalysis.h.

Referenced by bookobjects(), and initobjects().

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

Definition at line 155 of file HLTHiggsSubAnalysis.h.

Referenced by InitSelector(), insertcandidates(), and ~HLTHiggsSubAnalysis().

edm::EDGetTokenT<reco::PFJetCollection> HLTHiggsSubAnalysis::_recoHtJetLabel
private

Definition at line 122 of file HLTHiggsSubAnalysis.h.

Referenced by analyze().

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

Definition at line 161 of file HLTHiggsSubAnalysis.h.

Referenced by initAndInsertJets(), InitSelector(), and ~HLTHiggsSubAnalysis().

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

Definition at line 158 of file HLTHiggsSubAnalysis.h.

Referenced by InitSelector(), insertcandidates(), and ~HLTHiggsSubAnalysis().

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

Definition at line 159 of file HLTHiggsSubAnalysis.h.

Referenced by InitSelector(), insertcandidates(), and ~HLTHiggsSubAnalysis().

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

Definition at line 160 of file HLTHiggsSubAnalysis.h.

Referenced by InitSelector(), insertcandidates(), and ~HLTHiggsSubAnalysis().

edm::EDGetTokenT<reco::JetTagCollection> HLTHiggsSubAnalysis::_recTagPFJet
private

Definition at line 132 of file HLTHiggsSubAnalysis.h.

Referenced by bookobjects(), and initAndInsertJets().

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

Definition at line 162 of file HLTHiggsSubAnalysis.h.

Referenced by ~HLTHiggsSubAnalysis().

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

Relation between the short version of a path.

Definition at line 116 of file HLTHiggsSubAnalysis.h.

Referenced by analyze(), and beginRun().

edm::EDGetTokenT<edm::TriggerResults> HLTHiggsSubAnalysis::_trigResultsTag
private

Definition at line 141 of file HLTHiggsSubAnalysis.h.

Referenced by initobjects().

bool HLTHiggsSubAnalysis::_useNminOneCuts
private
unsigned int HLTHiggsSubAnalysis::NptPlots
private