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 }
 

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 61 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(), cmsRelvalreport::exit, edm::ParameterSet::getParameter(), EVTColContainer::getTypeString(), edm::ParameterSet::getUntrackedParameter(), NptPlots, and AlCaHLTBitMon_QueryRunRegistry::string.

34  :
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")),
44  _recoHtJetLabel(iC.consumes<reco::PFJetCollection>(pset.getUntrackedParameter<std::string>("recoHtJetLabel","ak4PFJetsCHS"))),
45  _parametersEta(pset.getParameter<std::vector<double> >("parametersEta")),
46  _parametersPhi(pset.getParameter<std::vector<double> >("parametersPhi")),
47  _parametersPu(pset.getParameter<std::vector<double> >("parametersPu")),
48  _parametersHt(0),
49  _parametersTurnOn(pset.getParameter<std::vector<double> >("parametersTurnOn")),
51  _genJetSelector(nullptr),
52  _recMuonSelector(nullptr),
53  _recElecSelector(nullptr),
54  _recCaloMETSelector(nullptr),
55  _recPFMETSelector(nullptr),
56  _recPFTauSelector(nullptr),
57  _recPhotonSelector(nullptr),
58  _recPFJetSelector(nullptr),
59  _recTrackSelector(nullptr),
60  _NminOneCuts(0),
61  _useNminOneCuts(false)
62 {
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  {
69  _parametersTurnOn = anpset.getParameter<std::vector<double> >("parametersTurnOn");
70  _pset.addParameter("parametersTurnOn",_parametersTurnOn);
71  }
72  this->bookobjects( anpset, iC );
73  // Generic objects: Initialization of cuts
74  for(std::map<unsigned int,std::string>::const_iterator it = _recLabels.begin();
75  it != _recLabels.end(); ++it)
76  {
77  const std::string objStr = EVTColContainer::getTypeString(it->first);
78  _genCut[it->first] = pset.getParameter<std::string>( objStr+"_genCut" );
79  _recCut[it->first] = pset.getParameter<std::string>( objStr+"_recCut" );
80  _cutMinPt[it->first] = pset.getParameter<double>( objStr+"_cutMinPt" );
81  _cutMaxEta[it->first] = pset.getParameter<double>( objStr+"_cutMaxEta" );
82  }
83  //--- Updating parameters if has to be modified for this particular specific analysis
84  for(std::map<unsigned int,std::string>::const_iterator it = _recLabels.begin();
85  it != _recLabels.end(); ++it)
86  {
87  const std::string objStr = EVTColContainer::getTypeString(it->first);
88  if(anpset.existsAs<std::string>( objStr+"_genCut", false))
89  {
90  _genCut[it->first] = anpset.getUntrackedParameter<std::string>( objStr+"_genCut" );
91  }
92  if(anpset.existsAs<std::string>( objStr+"_recCut", false))
93  {
94  _recCut[it->first] = anpset.getUntrackedParameter<std::string>( objStr+"_recCut" );
95  }
96  if(anpset.existsAs<double>( objStr+"_cutMinPt" , false) )
97  {
98  _cutMinPt[it->first] = anpset.getUntrackedParameter<double>( objStr+"_cutMinPt" );
99  }
100  if(anpset.existsAs<double>( objStr+"_cutMaxEta" ,false) )
101  {
102  _cutMaxEta[it->first] = anpset.getUntrackedParameter<double>( objStr+"_cutMaxEta" );
103  }
104  }
105  _hltPathsToCheck = anpset.getParameter<std::vector<std::string> >("hltPathsToCheck");
106  _minCandidates = anpset.getParameter<unsigned int>("minCandidates");
107 
108  std::vector<double> default_parametersHt;
109  default_parametersHt.push_back(100);
110  default_parametersHt.push_back(0);
111  default_parametersHt.push_back(1000);
112  _parametersHt = pset.getUntrackedParameter<std::vector<double> >("parametersHt",default_parametersHt);
113 
114  _HtJetPtMin = anpset.getUntrackedParameter<double>("HtJetPtMin", -1);
115  _HtJetEtaMax = anpset.getUntrackedParameter<double>("HtJetEtaMax", -1);
116 
117  if( _HtJetPtMin>0 && _HtJetEtaMax>0 ) _bookHtPlots = true;
118  else _bookHtPlots = false;
119 
120  if( pset.exists("pileUpInfoLabel") )
121  {
122  _puSummaryInfo = iC.consumes<std::vector< PileupSummaryInfo > >(pset.getParameter<std::string>("pileUpInfoLabel"));
123  }
124 
125  if( anpset.existsAs<std::vector<double>>( "NminOneCuts" , false) )
126  {
127  _NminOneCuts = anpset.getUntrackedParameter<std::vector<double> >("NminOneCuts");
128  if( _NminOneCuts.size() < 9 + _minCandidates ) {
129  edm::LogError("HiggsValidation") << "In HLTHiggsSubAnalysis::HLTHiggsSubAnalysis, "
130  << "Incoherence found in the python configuration file!!\nThe SubAnalysis '"
131  << _analysisname << "' has a vector NminOneCuts with size "
132  << _NminOneCuts.size() << ", while it needs to be at least of size "
133  << (9 + _minCandidates) << ".";
134  exit(-1);
135  }
136  if( (_NminOneCuts[0] || _NminOneCuts[1]) && _minCandidates < 4 )
137  {
138  edm::LogError("HiggsValidation") << "In HLTHiggsSubAnalysis::HLTHiggsSubAnalysis, "
139  << "Incoherence found in the python configuration file!!\nThe SubAnalysis '"
140  << _analysisname << "' has a vector NminOneCuts with a dEtaqq of mqq cut on the least b-tagged jets of the first 4 jets while only requiring "
141  << _minCandidates << " jets.";
142  exit(-1);
143  }
144  if( _NminOneCuts[5] && _minCandidates < 3 )
145  {
146  edm::LogError("HiggsValidation") << "In HLTHiggsSubAnalysis::HLTHiggsSubAnalysis, "
147  << "Incoherence found in the python configuration file!!\nThe SubAnalysis '"
148  << _analysisname << "' has a vector NminOneCuts with a CSV3 cut while only requiring "
149  << _minCandidates << " jets.";
150  exit(-1);
151  }
152  if( (_NminOneCuts[2] || _NminOneCuts[4]) && _minCandidates < 2 )
153  {
154  edm::LogError("HiggsValidation") << "In HLTHiggsSubAnalysis::HLTHiggsSubAnalysis, "
155  << "Incoherence found in the python configuration file!!\nThe SubAnalysis '"
156  << _analysisname << "' has a vector NminOneCuts with a dPhibb or CSV2 cut using the second most b-tagged jet while only requiring "
157  << _minCandidates << " jet.";
158  exit(-1);
159  }
160  for(std::vector<double>::const_iterator it = _NminOneCuts.begin(); it != _NminOneCuts.end(); ++it)
161  {
162  if( *it ) {
163  _useNminOneCuts = true;
164  break;
165  }
166  }
167  }
168 // NptPlots = ( _useNminOneCuts ? _minCandidates : 2 );
170 }
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:186
edm::EDGetTokenT< reco::GenParticleCollection > _genParticleLabel
std::map< unsigned int, std::string > _genCut
gen/rec objects cuts
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::vector< double > _parametersPu
StringCutObjectSelector< reco::Track > * _recTrackSelector
std::map< unsigned int, std::string > _recCut
StringCutObjectSelector< reco::GenJet > * _genJetSelector
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:144
edm::EDGetTokenT< std::vector< PileupSummaryInfo > > _puSummaryInfo
std::map< unsigned int, std::string > _recLabels
std::map< unsigned int, double > _cutMinPt
StringCutObjectSelector< reco::PFTau > * _recPFTauSelector
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.
std::map< unsigned int, double > _cutMaxEta
void bookobjects(const edm::ParameterSet &anpset, edm::ConsumesCollector &iC)
StringCutObjectSelector< reco::Photon > * _recPhotonSelector
StringCutObjectSelector< reco::PFJet > * _recPFJetSelector
static const std::string getTypeString(const unsigned int &objtype)
Tranform types into strings.
StringCutObjectSelector< reco::GsfElectron > * _recElecSelector
HLTHiggsSubAnalysis::~HLTHiggsSubAnalysis ( )

Definition at line 172 of file HLTHiggsSubAnalysis.cc.

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

173 {
174  for(std::map<unsigned int,StringCutObjectSelector<reco::GenParticle>* >::iterator it = _genSelectorMap.begin();
175  it != _genSelectorMap.end(); ++it)
176  {
177  delete it->second;
178  it->second =nullptr;
179  }
180  delete _genJetSelector;
181  _genJetSelector =nullptr;
182  delete _recMuonSelector;
183  _recMuonSelector =nullptr;
184  delete _recElecSelector;
185  _recElecSelector =nullptr;
186  delete _recPhotonSelector;
187  _recPhotonSelector =nullptr;
188  delete _recCaloMETSelector;
189  _recCaloMETSelector =nullptr;
190  delete _recPFMETSelector;
191  _recPFMETSelector =nullptr;
192  delete _recPFTauSelector;
193  _recPFTauSelector =nullptr;
194  delete _recPFJetSelector;
195  _recPFJetSelector =nullptr;
196  delete _recTrackSelector;
197  _recTrackSelector =nullptr;
198 }
StringCutObjectSelector< reco::CaloMET > * _recCaloMETSelector
StringCutObjectSelector< reco::PFMET > * _recPFMETSelector
StringCutObjectSelector< reco::Track > * _recTrackSelector
std::map< unsigned int, StringCutObjectSelector< reco::GenParticle > * > _genSelectorMap
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 394 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(), TriggerAnalyzer::hltPath, mps_fire::i, initAndInsertJets(), initobjects(), InitSelector(), insertcandidates(), edm::HandleBase::isValid(), genParticles_cff::map, patRefSel_triggerMatching_cfi::matches, MuonErrorMatrixAnalyzer_cfi::maxPt, NptPlots, electrons_cff::objType, passJetCuts(), passOtherCuts(), EVTColContainer::PFJET, EVTColContainer::PFMET, phi, EnergyCorrector::pt, RECO, source, AlCaHLTBitMon_QueryRunRegistry::string, groupFilesInBlocks::temp, edm::TriggerNames::triggerIndex(), edm::Event::triggerNames(), EVTColContainer::triggerResults, and trigNames.

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

Definition at line 201 of file HLTHiggsSubAnalysis.cc.

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

Definition at line 207 of file HLTHiggsSubAnalysis.cc.

References _analysisname, _analyzers, _hltConfig, _hltPaths, _hltPathsToCheck, _hltProcessName, _NminOneCuts, _pset, _recLabels, _shortpath2long, cmsRelvalreport::exit, spr::find(), runEdmFileComparison::found, getObjectsType(), EVTColContainer::getTypeString(), mps_fire::i, HLTConfigProvider::init(), LogDebug, LogTrace, NptPlots, callgraph::path, listBenchmarks::pattern, AlCaHLTBitMon_QueryRunRegistry::string, and HLTConfigProvider::triggerNames().

208 {
209  // Initialize the confighlt
210  bool changedConfig;
211  if(!_hltConfig.init(iRun,iSetup,_hltProcessName,changedConfig))
212  {
213  edm::LogError("HiggsValidations") << "HLTHiggsSubAnalysis::beginRun: "
214  << "Initializtion of HLTConfigProvider failed!!";
215  }
216 
217 
218  // Parse the input paths to get them if there are in the table
219  // and associate them the last filter of the path (in order to extract the
220  _hltPaths.clear();
221  for(size_t i = 0; i < _hltPathsToCheck.size(); ++i)
222  {
223  bool found = false;
224  TPRegexp pattern(_hltPathsToCheck[i]);
225  for(size_t j = 0 ; j < _hltConfig.triggerNames().size(); ++j)
226  {
227  std::string thetriggername = _hltConfig.triggerNames()[j];
228  if(TString(thetriggername).Contains(pattern))
229  {
230  _hltPaths.insert(thetriggername);
231  found = true;
232  }
233  }
234  if( ! found )
235  {
236  LogDebug("HiggsValidations") << "HLTHiggsSubAnalysis::beginRun, In "
237  << _analysisname << " subfolder NOT found the path: '"
238  << _hltPathsToCheck[i] << "*'" ;
239  }
240  }
241 
242  LogTrace("HiggsValidation") << "SubAnalysis: " << _analysisname
243  << "\nHLT Trigger Paths found >>>";
244  // Initialize the plotters (analysers for each trigger path)
245  _analyzers.clear();
246  for(std::set<std::string>::iterator iPath = _hltPaths.begin();
247  iPath != _hltPaths.end(); ++iPath)
248  {
249  // Avoiding the dependence of the version number for
250  // the trigger paths
251  std::string path = * iPath;
252  std::string shortpath = path;
253  if(path.rfind("_v") < path.length())
254  {
255  shortpath = path.substr(0, path.rfind("_v"));
256  }
257  _shortpath2long[shortpath] = path;
258 
259  // Objects needed by the HLT path
260  const std::vector<unsigned int> objsNeedHLT = this->getObjectsType(shortpath);
261  // Sanity check: the object needed by a trigger path should be
262  // introduced by the user via config python (_recLabels datamember)
263  std::vector<unsigned int> userInstantiate;
264  for(std::map<unsigned int,std::string>::iterator it = _recLabels.begin() ;
265  it != _recLabels.end(); ++it)
266  {
267  userInstantiate.push_back(it->first);
268  }
269  for(std::vector<unsigned int>::const_iterator it = objsNeedHLT.begin(); it != objsNeedHLT.end();
270  ++it)
271  {
272  if( std::find(userInstantiate.begin(),userInstantiate.end(), *it) ==
273  userInstantiate.end() )
274  {
275  edm::LogError("HiggsValidation") << "In HLTHiggsSubAnalysis::beginRun, "
276  << "Incoherence found in the python configuration file!!\nThe SubAnalysis '"
277  << _analysisname << "' has been asked to evaluate the trigger path '"
278  << shortpath << "' (found it in 'hltPathsToCheck') BUT this path"
279  << " needs a '" << EVTColContainer::getTypeString(*it)
280  << "' which has not been instantiate ('recVariableLabels'"
281  << ")" ;
282  exit(-1);
283  }
284  }
285  LogTrace("HiggsValidation") << " --- " << shortpath;
286 
287  // the hlt path, the objects (elec,muons,photons,...)
288  // needed to evaluate the path are the argumens of the plotter
289  HLTHiggsPlotter analyzer(_pset, shortpath,objsNeedHLT, NptPlots, _NminOneCuts);
290  _analyzers.push_back(analyzer);
291  }
292 }
#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:20
HLTConfigProvider _hltConfig
std::vector< HLTHiggsPlotter > _analyzers
std::map< unsigned int, std::string > _recLabels
#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
static const std::string getTypeString(const unsigned int &objtype)
Tranform types into strings.
void HLTHiggsSubAnalysis::bookHist ( const std::string &  source,
const std::string &  objType,
const std::string &  variable,
DQMStore::IBooker ibooker 
)
private

Definition at line 944 of file HLTHiggsSubAnalysis.cc.

References _elements, _parametersEta, _parametersPhi, _parametersTurnOn, DQMStore::IBooker::book1D(), EVTColContainer::getTypeString(), h, mps_fire::i, createfilelist::int, SiStripPI::max, min(), dataset::name, electrons_cff::objType, EVTColContainer::PFJET, EVTColContainer::PFMET, source, AlCaHLTBitMon_QueryRunRegistry::string, fftjetcommon_cfi::title, and taus_updatedMVAIds_cff::variable.

Referenced by bookHistograms().

946 {
947  std::string sourceUpper = source;
948  sourceUpper[0] = std::toupper(sourceUpper[0]);
950  TH1F * h = nullptr;
951 
952  if(variable.find("MaxPt") != std::string::npos)
953  {
954  std::string desc;
955  if (variable == "MaxPt1") desc = "Leading";
956  else if (variable == "MaxPt2") desc = "Next-to-Leading";
957  else desc = variable.substr(5,6) + "th Leading";
958  std::string title = "pT of " + desc + " " + sourceUpper + " " + objType;
959  const size_t nBinsStandard = _parametersTurnOn.size() - 1;
960  size_t nBins = nBinsStandard;
961  float * edges = new float[nBinsStandard + 1];
962  for(size_t i = 0; i < nBinsStandard + 1; i++)
963  {
964  edges[i] = _parametersTurnOn[i];
965  }
966 
968  if( objType == jetObj ) {
969  const size_t nBinsJets = 25;
970  nBins = nBinsJets;
971  delete [] edges;
972  edges = new float[nBinsJets+1];
973  for(size_t i = 0; i < nBinsJets + 1; i++)
974  {
975  edges[i] = i*10;
976  }
977  }
979  const size_t nBinsJets = 30;
980  nBins = nBinsJets;
981  delete [] edges;
982  edges = new float[nBinsJets+1];
983  for(size_t i = 0; i < nBinsJets + 1; i++)
984  {
985  edges[i] = i*10;
986  }
987  }
988  h = new TH1F(name.c_str(), title.c_str(), nBins, edges);
989  delete [] edges;
990  }
991  else if( variable == "dEtaqq" ){
992  std::string title = "#Delta #eta_{qq} of " + sourceUpper + " " + objType;
993  int nBins = 20;
994  double min = 0;
995  double max = 4.8;
996  h = new TH1F(name.c_str(), title.c_str(), nBins, min, max);
997  }
998  else if ( variable == "mqq" ){
999  std::string title = "m_{qq} of " + sourceUpper + " " + objType;
1000  int nBins = 20;
1001  double min = 0;
1002  double max = 1000;
1003  h = new TH1F(name.c_str(), title.c_str(), nBins, min, max);
1004  }
1005  else if ( variable == "dPhibb" ){
1006  std::string title = "#Delta #phi_{bb} of " + sourceUpper + " " + objType;
1007  int nBins = 10;
1008  double min = 0;
1009  double max = 3.1416;
1010  h = new TH1F(name.c_str(), title.c_str(), nBins, min, max);
1011  }
1012  else if ( variable == "CSV1" ){
1013  std::string title = "CSV1 of " + sourceUpper + " " + objType;
1014  int nBins = 20;
1015  double min = 0;
1016  double max = 1;
1017  h = new TH1F(name.c_str(), title.c_str(), nBins, min, max);
1018  }
1019  else if ( variable == "CSV2" ){
1020  std::string title = "CSV2 of " + sourceUpper + " " + objType;
1021  int nBins = 20;
1022  double min = 0;
1023  double max = 1;
1024  h = new TH1F(name.c_str(), title.c_str(), nBins, min, max);
1025  }
1026  else if ( variable == "CSV3" ){
1027  std::string title = "CSV3 of " + sourceUpper + " " + objType;
1028  int nBins = 20;
1029  double min = 0;
1030  double max = 1;
1031  h = new TH1F(name.c_str(), title.c_str(), nBins, min, max);
1032  }
1033  else if ( variable == "maxCSV" ){
1034  std::string title = "max CSV of " + sourceUpper + " " + objType;
1035  int nBins = 20;
1036  double min = 0;
1037  double max = 1;
1038  h = new TH1F(name.c_str(), title.c_str(), nBins, min, max);
1039  }
1040  else
1041  {
1042  std::string symbol = (variable == "Eta") ? "#eta" : "#phi";
1043  std::string title = symbol + " of " + sourceUpper + " " + objType;
1044  std::vector<double> params = (variable == "Eta") ? _parametersEta : _parametersPhi;
1045 
1046  int nBins = (int)params[0];
1047  double min = params[1];
1048  double max = params[2];
1049  h = new TH1F(name.c_str(), title.c_str(), nBins, min, max);
1050  }
1051  h->Sumw2();
1052  _elements[name] = ibooker.book1D(name, h);
1053  delete h;
1054 }
std::vector< double > _parametersTurnOn
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
std::map< std::string, MonitorElement * > _elements
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
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:43
void HLTHiggsSubAnalysis::bookHistograms ( DQMStore::IBooker ibooker)

Definition at line 294 of file HLTHiggsSubAnalysis.cc.

References _analysisname, _analyzers, _bookHtPlots, _elements, _histDirectory, _hltPathsToCheck, _NminOneCuts, _parametersHt, _parametersPu, _recLabels, _useNminOneCuts, DQMStore::IBooker::book1D(), bookHist(), EVTColContainer::getTypeString(), mps_fire::i, createfilelist::int, MuonErrorMatrixAnalyzer_cfi::maxPt, MTVHistoProducerAlgoForTrackerBlock_cfi::maxPu, MTVHistoProducerAlgoForTrackerBlock_cfi::minPu, NptPlots, callgraph::path, EVTColContainer::PFJET, DQMStore::IBooker::setCurrentFolder(), source, and AlCaHLTBitMon_QueryRunRegistry::string.

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

Definition at line 796 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, nullptr, EVTColContainer::PFJET, EVTColContainer::PFMET, EVTColContainer::PFTAU, EVTColContainer::PHOTON, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by HLTHiggsSubAnalysis().

797 {
798  if( anpset.exists("recMuonLabel") )
799  {
800  _recLabels[EVTColContainer::MUON] = anpset.getParameter<std::string>("recMuonLabel");
803  }
804  if( anpset.exists("recElecLabel") )
805  {
806  _recLabels[EVTColContainer::ELEC] = anpset.getParameter<std::string>("recElecLabel");
809  }
810  if( anpset.exists("recPhotonLabel") )
811  {
812  _recLabels[EVTColContainer::PHOTON] = anpset.getParameter<std::string>("recPhotonLabel");
815  }
816  if( anpset.exists("recCaloMETLabel") )
817  {
818  _recLabels[EVTColContainer::CALOMET] = anpset.getParameter<std::string>("recCaloMETLabel");
821  }
822  if( anpset.exists("recPFMETLabel") )
823  {
824  _recLabels[EVTColContainer::PFMET] = anpset.getParameter<std::string>("recPFMETLabel");
827  }
828  if( anpset.exists("recPFTauLabel") )
829  {
830  _recLabels[EVTColContainer::PFTAU] = anpset.getParameter<std::string>("recPFTauLabel");
833  }
834  if( anpset.exists("recJetLabel") )
835  {
836  _recLabels[EVTColContainer::PFJET] = anpset.getParameter<std::string>("recJetLabel");
838  if( anpset.exists("jetTagLabel") )
840  _genJetSelector = nullptr;
841  }
842  /*if( anpset.exists("recTrackLabel") )
843  {
844  _recLabels[EVTColContainer::TRACK] = anpset.getParameter<std::string>("recTrackLabel");
845  _genSelectorMap[EVTColContainer::TRACK] = 0 ;
846  }*/
847 
848  if( _recLabels.empty() )
849  {
850  edm::LogError("HiggsValidation") << "HLTHiggsSubAnalysis::bookobjects, "
851  << "Not included any object (recMuonLabel, recElecLabel, ...) "
852  << "in the analysis " << _analysisname;
853  return;
854  }
855 }
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
#define nullptr
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
std::map< unsigned int, StringCutObjectSelector< reco::GenParticle > * > _genSelectorMap
StringCutObjectSelector< reco::GenJet > * _genJetSelector
std::map< unsigned int, std::string > _recLabels
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
void HLTHiggsSubAnalysis::fillHist ( const std::string &  source,
const std::string &  objType,
const std::string &  variable,
const float &  value 
)
private

Definition at line 1056 of file HLTHiggsSubAnalysis.cc.

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

Referenced by analyze().

1058 {
1059  std::string sourceUpper = source;
1060  sourceUpper[0] = toupper(sourceUpper[0]);
1062 
1063  _elements[name]->Fill(value);
1064 }
std::map< std::string, MonitorElement * > _elements
Definition: value.py:1
static std::string const source
Definition: EdmProvDump.cc:43
const std::vector< unsigned int > HLTHiggsSubAnalysis::getObjectsType ( const std::string &  hltpath) const

Extract what objects need this analysis.

Definition at line 750 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().

751 {
752  static const unsigned int objSize = 7;
753  static const unsigned int objtriggernames[] = {
757 // EVTColContainer::TRACK, // Note is tracker muon
762  };
763 
764  std::set<unsigned int> objsType;
765  // The object to deal has to be entered via the config .py
766  for(unsigned int i = 0; i < objSize; ++i)
767  {
768  std::string objTypeStr = EVTColContainer::getTypeString( objtriggernames[i] );
769  // Check if it is needed this object for this trigger
770  if( ! TString(hltPath).Contains(objTypeStr) )
771  {
772  if( (objtriggernames[i] == EVTColContainer::PFJET && TString(hltPath).Contains("WHbbBoost") ) || // fix for HLT_Ele27_WPLoose_Gsf_WHbbBoost_v
773  (objtriggernames[i] == EVTColContainer::PFJET && TString(hltPath).Contains("CSV") ) || // fix for ZnnHbb PFJET
774  (objtriggernames[i] == EVTColContainer::PFMET && TString(hltPath).Contains("MHT")) || // fix for ZnnHbb PFMET
775  (objtriggernames[i] == EVTColContainer::PHOTON && TString(hltPath).Contains("Diphoton")) )
776  {
777  objsType.insert(objtriggernames[i]); //case of the New Diphoton paths
778  }
779  continue;
780  }
781  if( ( objtriggernames[i] == EVTColContainer::CALOMET && (TString(hltPath).Contains("PFMET") || TString(hltPath).Contains("MHT") ) ) || // fix for PFMET
782  (objtriggernames[i] == EVTColContainer::PFJET && TString(hltPath).Contains("JetIdCleaned") && ! TString(hltPath).Contains(TRegexp("Jet[^I]"))) || // fix for Htaunu
783  (objtriggernames[i] == EVTColContainer::MUON && TString(hltPath).Contains("METNoMu")) ) // fix for VBFHToInv
784  {
785  continue;
786  }
787 
788  objsType.insert(objtriggernames[i]);
789  }
790 
791  return std::vector<unsigned int>(objsType.begin(),objsType.end());
792 }
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 1109 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().

1111 {
1113  iEvent.getByToken(_recLabelsPFJet, PFJetHandle);
1114  cols->set(PFJetHandle.product());
1115 
1117  if( _useNminOneCuts ) {
1118  iEvent.getByToken(_recTagPFJet, JetTagHandle);
1119  }
1120 
1121  for(reco::PFJetCollection::const_iterator it = PFJetHandle->begin();
1122  it != PFJetHandle->end(); ++it)
1123  {
1124  reco::PFJetRef jetRef(PFJetHandle, it - PFJetHandle->begin());
1125  reco::JetBaseRef jetBaseRef(jetRef);
1126 
1127  if(_recPFJetSelector->operator()(*it))
1128  {
1129  if( _useNminOneCuts)
1130  {
1131  float bTag = (*(JetTagHandle.product()))[jetBaseRef];
1132  matches->push_back(MatchStruct(&*it,EVTColContainer::PFJET, bTag));
1133  }
1134  else {
1135  matches->push_back(MatchStruct(&*it,EVTColContainer::PFJET));
1136  }
1137  }
1138  }
1139 }
edm::EDGetTokenT< reco::PFJetCollection > _recLabelsPFJet
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:508
edm::EDGetTokenT< reco::JetTagCollection > _recTagPFJet
void set(const reco::MuonCollection *v)
Setter: multiple overloaded function.
T const * product() const
Definition: Handle.h:81
StringCutObjectSelector< reco::PFJet > * _recPFJetSelector
void HLTHiggsSubAnalysis::initobjects ( const edm::Event iEvent,
EVTColContainer col 
)
private

Definition at line 857 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().

858 {
859  /*if( col != 0 && col->isAllInit() )
860  {
861  // Already init, not needed to do nothing
862  return;
863  }*/
864  if( ! col->isCommonInit() )
865  {
866  // extract the trigger results (path info, pass,...)
868  iEvent.getByToken(_trigResultsTag,trigResults);
869  if( trigResults.isValid() )
870  {
871  col->triggerResults = trigResults.product();
872  }
873 
874  // GenParticle collection if is there (genJets only if there need to be jets)
876  iEvent.getByToken(_genParticleLabel,genPart);
877  if( genPart.isValid() )
878  {
879  col->genParticles = genPart.product();
880  }
881  }
882 
883  for(std::map<unsigned int,std::string>::iterator it = _recLabels.begin();
884  it != _recLabels.end(); ++it)
885  {
886  if( it->first == EVTColContainer::MUON )
887  {
889  iEvent.getByToken(_recLabelsMuon, theHandle);
890  col->set(theHandle.product());
891  }
892  else if( it->first == EVTColContainer::ELEC )
893  {
895  iEvent.getByToken(_recLabelsElec, theHandle);
896  col->set(theHandle.product());
897  }
898  else if( it->first == EVTColContainer::PHOTON )
899  {
901  iEvent.getByToken(_recLabelsPhoton, theHandle);
902  col->set(theHandle.product());
903  }
904  else if( it->first == EVTColContainer::CALOMET )
905  {
907  iEvent.getByToken(_recLabelsCaloMET, theHandle);
908  col->set(theHandle.product());
909  }
910  else if( it->first == EVTColContainer::PFMET )
911  {
913  iEvent.getByToken(_recLabelsPFMET, theHandle);
914  col->set(theHandle.product());
915  }
916  else if( it->first == EVTColContainer::PFTAU )
917  {
919  iEvent.getByToken(_recLabelsPFTau, theHandle);
920  col->set(theHandle.product());
921  }
922  // 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
923  else if( it->first == EVTColContainer::PFJET )
924  {
925  if( ! _useNminOneCuts) {
926  // GenJet collection
928  iEvent.getByToken(_genJetLabel,genJet);
929  if( genJet.isValid() )
930  {
931  col->genJets = genJet.product();
932  }
933  }
934  }
935  else
936  {
937  edm::LogError("HiggsValidation") << "HLTHiggsSubAnalysis::initobjects "
938  << " NOT IMPLEMENTED (yet) ERROR: '" << it->second << "'";
939  //return; ??
940  }
941  }
942 }
edm::EDGetTokenT< reco::PFMETCollection > _recLabelsPFMET
edm::EDGetTokenT< reco::GenParticleCollection > _genParticleLabel
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:508
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
std::map< unsigned int, std::string > _recLabels
bool isValid() const
Definition: HandleBase.h:74
edm::EDGetTokenT< edm::TriggerResults > _trigResultsTag
edm::EDGetTokenT< reco::GsfElectronCollection > _recLabelsElec
T const * product() const
Definition: Handle.h:81
edm::EDGetTokenT< reco::MuonCollection > _recLabelsMuon
const edm::TriggerResults * triggerResults
void HLTHiggsSubAnalysis::InitSelector ( const unsigned int &  objtype)
private

Definition at line 1069 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().

1070 {
1071  if( objtype == EVTColContainer::MUON && _recMuonSelector == nullptr )
1072  {
1074  }
1075  else if( objtype == EVTColContainer::ELEC && _recElecSelector == nullptr)
1076  {
1078  }
1079  else if( objtype == EVTColContainer::PHOTON && _recPhotonSelector == nullptr)
1080  {
1082  }
1083  else if( objtype == EVTColContainer::CALOMET && _recCaloMETSelector == nullptr)
1084  {
1086  }
1087  else if( objtype == EVTColContainer::PFMET && _recPFMETSelector == nullptr)
1088  {
1090  }
1091  else if( objtype == EVTColContainer::PFTAU && _recPFTauSelector == nullptr )
1092  {
1094  }
1095  else if( objtype == EVTColContainer::PFJET && _recPFJetSelector == nullptr )
1096  {
1098  }
1099  /*else if( objtype == EVTColContainer::TRACK && _recTrackSelector == 0)
1100  {
1101  _recTrackSelector = new StringCutObjectSelector<reco::Track>(_recCut[objtype]);
1102  }*/
1103 /* else
1104  {
1105 FIXME: ERROR NO IMPLEMENTADO
1106  }*/
1107 }
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 1237 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().

1239 {
1241  {
1242  for(size_t i = 0; i < cols->muons->size(); i++)
1243  {
1244  if(_recMuonSelector->operator()(cols->muons->at(i)))
1245  {
1246  matches->push_back(MatchStruct(&cols->muons->at(i),objType));
1247  }
1248  }
1249  }
1250  else if( objType == EVTColContainer::ELEC )
1251  {
1252  for(size_t i = 0; i < cols->electrons->size(); i++)
1253  {
1254  if(_recElecSelector->operator()(cols->electrons->at(i)))
1255  {
1256  matches->push_back(MatchStruct(&cols->electrons->at(i),objType));
1257  }
1258  }
1259  }
1260  else if( objType == EVTColContainer::PHOTON )
1261  {
1262  for(size_t i = 0; i < cols->photons->size(); i++)
1263  {
1264  if(_recPhotonSelector->operator()(cols->photons->at(i)))
1265  {
1266  matches->push_back(MatchStruct(&cols->photons->at(i),objType));
1267  }
1268  }
1269  }
1270  else if( objType == EVTColContainer::CALOMET )
1271  {
1272  for(size_t i = 0; i < cols->caloMETs->size(); i++)
1273  {
1274  if(_recCaloMETSelector->operator()(cols->caloMETs->at(i)))
1275  {
1276  matches->push_back(MatchStruct(&cols->caloMETs->at(i),objType));
1277  }
1278  }
1279  }
1280  else if( objType == EVTColContainer::PFMET )
1281  {
1282  for(size_t i = 0; i < cols->pfMETs->size(); i++)
1283  {
1284  if(_recPFMETSelector->operator()(cols->pfMETs->at(i)))
1285  {
1286  matches->push_back(MatchStruct(&cols->pfMETs->at(i),objType));
1287  }
1288  }
1289  }
1290  else if( objType == EVTColContainer::PFTAU )
1291  {
1292  for(size_t i = 0; i < cols->pfTaus->size(); i++)
1293  {
1294  if(_recPFTauSelector->operator()(cols->pfTaus->at(i)))
1295  {
1296  matches->push_back(MatchStruct(&cols->pfTaus->at(i),objType));
1297  }
1298  }
1299  }
1300 // else if( objType == EVTColContainer::PFJET )
1301 // {
1302 // already inserted
1303 // }
1304  /*else if( objType == EVTColContainer::TRACK )
1305  {
1306  for(size_t i = 0; i < cols->tracks->size(); i++)
1307  {
1308  if(_recTrackSelector->operator()(cols->tracks->at(i)))
1309  {
1310  matches->push_back(MatchStruct(&cols->tracks->at(i),objType));
1311  }
1312  }
1313  }*/
1314  /*
1315  else FIXME: Control errores
1316  {
1317  }
1318  */
1319 }
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 1141 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().

1142 { //dEtaqq, mqq, dPhibb, CSV1, CSV2, CSV3, maxCSV_jets, maxCSV_E, PFMET, pt1, pt2, pt3, pt4
1143 
1144  // Perform pt cuts
1145  std::sort(matches->begin(), matches->end(), matchesByDescendingPt());
1146  TString maxPt;
1147  for( unsigned int i=0; i < NptPlots; i++ )
1148  {
1149  maxPt = "MaxPt";
1150  maxPt += i+1;
1151  if( (*matches)[i].pt > _NminOneCuts[9+i] ) jetCutResult[maxPt.Data()] = true;
1152  else jetCutResult[maxPt.Data()] = false;
1153  }
1154 
1155  unsigned int NbTag = ( (_NminOneCuts[0] || _NminOneCuts[1]) ? 4 : 8 );
1156  if( matches->size() < NbTag ) NbTag = matches->size();
1157  // Perform b-tag ordered cuts
1158  std::sort(matches->begin(), matches->begin()+NbTag, matchesByDescendingBtag());
1159 
1160  if( _NminOneCuts[0] ) {
1161  jetCutResult["dEtaqq"] = false;
1162  if (matches->size() > 2){
1163  dEtaqq = fabs((*matches)[2].eta - (*matches)[3].eta);
1164  if( dEtaqq > _NminOneCuts[0] ) jetCutResult["dEtaqq"] = true;
1165  }
1166  }
1167 
1168  if( _NminOneCuts[1] ) {
1169  jetCutResult["mqq"] = false;
1170  if (matches->size() > 2){
1171  mqq = ((*matches)[2].lorentzVector + (*matches)[3].lorentzVector).M();
1172  if( mqq > _NminOneCuts[1] ) jetCutResult["mqq"] = true;
1173  }
1174  }
1175 
1176  if( _NminOneCuts[2] ) {
1177  jetCutResult["dPhibb"] = false;
1178  if (matches->size() > 1){
1179  dPhibb = fmod(fabs((*matches)[0].phi - (*matches)[1].phi),3.1416);
1180  if( dPhibb < _NminOneCuts[2] ) jetCutResult["dPhibb"] = true;
1181  }
1182  }
1183 
1184  if( _NminOneCuts[4] ) {
1185  std::string nameCSV2plot = "CSV2";
1186  jetCutResult[nameCSV2plot] = false;
1187  if (matches->size() > 1){
1188  CSV2 = (*matches)[1].bTag;
1189  if( CSV2 > _NminOneCuts[4] ) jetCutResult[nameCSV2plot] = true;
1190  }
1191  }
1192 
1193  if( _NminOneCuts[5] ) {
1194  std::string nameCSV3plot = "CSV3";
1195  jetCutResult[nameCSV3plot] = false;
1196  if (matches->size() > 2){
1197  CSV3 = (*matches)[2].bTag;
1198  if( CSV3 > _NminOneCuts[5] ) jetCutResult[nameCSV3plot] = true;
1199  }
1200  }
1201 
1202 
1203  if( _NminOneCuts[3] ) {
1204  CSV1 = (*matches)[0].bTag;
1205  std::string nameCSVplot = "CSV1";
1206  if ( _NminOneCuts[6] ) nameCSVplot = "maxCSV";
1207 
1208  if( CSV1 > _NminOneCuts[3] ) jetCutResult[nameCSVplot] = true;
1209  else jetCutResult[nameCSVplot] = false;
1210 
1211  // max(CSV)
1212  if( _NminOneCuts[6] ) {
1213  std::sort(matches->begin(), matches->end(), matchesByDescendingPt());
1214  CSV1 = (*matches)[0].bTag;
1215  unsigned int Njets = (unsigned int) _NminOneCuts[6];
1216  if ( _NminOneCuts[6] > matches->size()) Njets = matches->size();
1217  for(unsigned int i=1; i < (unsigned int) Njets ; ++i) {
1218  if( (*matches)[i].bTag > CSV1 && (*matches)[i].pt > _NminOneCuts[7] ) CSV1 = (*matches)[i].bTag;
1219  }
1220  }
1221  }
1222 }
std::vector< double > _NminOneCuts
Helper structure to order MatchStruct.
Definition: MatchStruct.cc:82
void HLTHiggsSubAnalysis::passOtherCuts ( const std::vector< MatchStruct > &  matches,
std::map< std::string, bool > &  jetCutResult 
)
private

Definition at line 1224 of file HLTHiggsSubAnalysis.cc.

References _NminOneCuts, and EVTColContainer::PFMET.

Referenced by analyze().

1224  {
1225  if( _NminOneCuts[8] ) {
1226  jetCutResult["PFMET"] = false;
1227  for(std::vector<MatchStruct>::const_iterator it = matches.begin(); it != matches.end(); ++it)
1228  {
1229  if( it->objType == EVTColContainer::PFMET ) {
1230  if( it->pt > _NminOneCuts[8] ) jetCutResult["PFMET"] = true;
1231  break;
1232  }
1233  }
1234  }
1235 }
std::vector< double > _NminOneCuts

Member Data Documentation

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

Definition at line 175 of file HLTHiggsSubAnalysis.h.

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

bool HLTHiggsSubAnalysis::_bookHtPlots
private

Definition at line 110 of file HLTHiggsSubAnalysis.h.

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

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

Definition at line 149 of file HLTHiggsSubAnalysis.h.

Referenced by HLTHiggsSubAnalysis().

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

Definition at line 148 of file HLTHiggsSubAnalysis.h.

Referenced by HLTHiggsSubAnalysis().

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

Definition at line 150 of file HLTHiggsSubAnalysis.h.

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

Definition at line 151 of file HLTHiggsSubAnalysis.h.

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

Definition at line 178 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 153 of file HLTHiggsSubAnalysis.h.

Referenced by analyze(), and HLTHiggsSubAnalysis().

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

Definition at line 126 of file HLTHiggsSubAnalysis.h.

Referenced by analyze(), and initobjects().

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

Definition at line 159 of file HLTHiggsSubAnalysis.h.

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

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

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

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

std::string HLTHiggsSubAnalysis::_histDirectory
private

Definition at line 113 of file HLTHiggsSubAnalysis.h.

Referenced by bookHistograms().

HLTConfigProvider HLTHiggsSubAnalysis::_hltConfig
private

Definition at line 177 of file HLTHiggsSubAnalysis.h.

Referenced by beginRun().

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

the hlt paths found in the hltConfig

Definition at line 118 of file HLTHiggsSubAnalysis.h.

Referenced by beginRun().

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

the hlt paths with regular expressions

Definition at line 116 of file HLTHiggsSubAnalysis.h.

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

std::string HLTHiggsSubAnalysis::_hltProcessName
private

Definition at line 112 of file HLTHiggsSubAnalysis.h.

Referenced by beginRun().

double HLTHiggsSubAnalysis::_HtJetEtaMax
private

Definition at line 108 of file HLTHiggsSubAnalysis.h.

Referenced by analyze(), and HLTHiggsSubAnalysis().

double HLTHiggsSubAnalysis::_HtJetPtMin
private

Definition at line 107 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 105 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 141 of file HLTHiggsSubAnalysis.h.

Referenced by bookHist().

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

Definition at line 144 of file HLTHiggsSubAnalysis.h.

Referenced by bookHistograms(), and HLTHiggsSubAnalysis().

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

Definition at line 142 of file HLTHiggsSubAnalysis.h.

Referenced by bookHist().

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

Definition at line 143 of file HLTHiggsSubAnalysis.h.

Referenced by bookHistograms().

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

Definition at line 145 of file HLTHiggsSubAnalysis.h.

Referenced by bookHist(), and HLTHiggsSubAnalysis().

edm::ParameterSet HLTHiggsSubAnalysis::_pset
private

Definition at line 100 of file HLTHiggsSubAnalysis.h.

Referenced by beginRun(), and HLTHiggsSubAnalysis().

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

Definition at line 138 of file HLTHiggsSubAnalysis.h.

Referenced by analyze(), and HLTHiggsSubAnalysis().

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

Definition at line 162 of file HLTHiggsSubAnalysis.h.

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

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

Definition at line 154 of file HLTHiggsSubAnalysis.h.

Referenced by HLTHiggsSubAnalysis(), and InitSelector().

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

Definition at line 161 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 133 of file HLTHiggsSubAnalysis.h.

Referenced by bookobjects(), and initobjects().

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

Definition at line 131 of file HLTHiggsSubAnalysis.h.

Referenced by bookobjects(), and initobjects().

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

Definition at line 130 of file HLTHiggsSubAnalysis.h.

Referenced by bookobjects(), and initobjects().

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

Definition at line 136 of file HLTHiggsSubAnalysis.h.

Referenced by bookobjects(), and initAndInsertJets().

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

Definition at line 134 of file HLTHiggsSubAnalysis.h.

Referenced by bookobjects(), and initobjects().

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

Definition at line 135 of file HLTHiggsSubAnalysis.h.

Referenced by bookobjects(), and initobjects().

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

Definition at line 132 of file HLTHiggsSubAnalysis.h.

Referenced by bookobjects(), and initobjects().

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

Definition at line 160 of file HLTHiggsSubAnalysis.h.

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

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

Definition at line 127 of file HLTHiggsSubAnalysis.h.

Referenced by analyze().

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

Definition at line 166 of file HLTHiggsSubAnalysis.h.

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

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

Definition at line 163 of file HLTHiggsSubAnalysis.h.

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

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

Definition at line 164 of file HLTHiggsSubAnalysis.h.

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

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

Definition at line 165 of file HLTHiggsSubAnalysis.h.

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

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

Definition at line 137 of file HLTHiggsSubAnalysis.h.

Referenced by bookobjects(), and initAndInsertJets().

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

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

Referenced by analyze(), and beginRun().

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

Definition at line 146 of file HLTHiggsSubAnalysis.h.

Referenced by initobjects().

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