CMS 3D CMS Logo

EmDQM.h
Go to the documentation of this file.
1 #ifndef HLTriggerOffline_Egamma_EmDQM_H
2 #define HLTriggerOffline_Egamma_EmDQM_H
3 
4 // Base Class Headers
29 #include "HepMC/GenParticle.h"
31 
32 #include <boost/lexical_cast.hpp>
33 #include <boost/regex.hpp>
34 
35 #include "TDirectory.h"
36 #include "TFile.h"
37 #include "TH1F.h"
38 #include <Math/VectorUtil.h>
39 #include <cmath>
40 #include <iostream>
41 #include <memory>
42 #include <string>
43 #include <vector>
44 
45 class EmDQM;
46 
47 template <class T>
48 class HistoFiller {
49 public:
52 
54  const edm::Event &,
55  unsigned int,
56  unsigned int,
57  std::vector<reco::Particle> &,
58  bool &);
59  // std::vector<edm::EDGetTokenT<edm::AssociationMap<edm::OneToValue< T ,
60  // float>>>> isoNameTokens_;
61 
62 private:
64 };
65 
66 class EmDQM : public DQMOneEDAnalyzer<> {
67 public:
69  friend class HistoFiller<reco::RecoEcalCandidateCollection>;
70  friend class HistoFiller<l1extra::L1EmParticleCollection>;
71 
73  explicit EmDQM(const edm::ParameterSet &pset);
74 
76  ~EmDQM() override;
77 
78  // Operations
79 
80  void analyze(const edm::Event &event, const edm::EventSetup &) override;
81 
82  void dqmBeginRun(edm::Run const &, edm::EventSetup const &) override;
83  void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override;
84  void dqmEndRun(edm::Run const &, edm::EventSetup const &) override;
85 
86 private:
87  // interface to DQM framework
89 
90  HistoFiller<reco::ElectronCollection> *histoFillerEle;
91  HistoFiller<reco::RecoEcalCandidateCollection> *histoFillerClu;
92  HistoFiller<l1extra::L1EmParticleCollection> *histoFillerL1NonIso;
93  HistoFiller<reco::RecoEcalCandidateCollection> *histoFillerPho;
94  HistoFiller<l1extra::L1EmParticleCollection> *histoFillerL1Iso;
95 
96  // run in automatic configuration generation mode
98  // parameter set from config file
100  // global parameters
102  unsigned int verbosity_;
103  double genEtaAcc_;
104  double genEtAcc_;
106  double ptMax_;
107  double ptMin_;
108  double etaMax_;
109  double phiMax_;
110  unsigned int nbins_;
111  double eta2DMax_;
112  double phi2DMax_;
113  unsigned int nbins2D_;
119 
126  bool checkGeneratedParticlesRequirement(const edm::Event &event);
127 
132  bool checkRecoParticlesRequirement(const edm::Event &event);
133 
136 
137  // routines to build validation configuration from HLTConfiguration
138  int countSubstring(const std::string &, const std::string &);
139  std::vector<std::vector<std::string>> findEgammaPaths();
140  std::vector<std::string> getFilterModules(const std::string &);
141  double getPrimaryEtCut(const std::string &);
142  edm::ParameterSet makePSetForL1SeedFilter(const std::string &);
144  edm::ParameterSet makePSetForEtFilter(const std::string &);
146  edm::ParameterSet makePSetForPixelMatchFilter(const std::string &);
151 
152  // set validation configuration parameters for a trigger path
153  void SetVarsFromPSet(std::vector<edm::ParameterSet>::iterator);
154 
155  // generated parameter set for trigger path
156  std::vector<edm::ParameterSet> paramSets;
157  // input from generated parameter set
158  unsigned int pathIndex;
160  unsigned int numOfHLTCollectionLabels; // Will be size of above vector
161  std::vector<std::string> theHLTCollectionHumanNames; // Human-readable names for the collections
165  std::vector<std::vector<edm::InputTag>> isoNames; // there has to be a better solution
166  std::vector<std::pair<double, double>> plotBounds;
167  std::vector<unsigned int> nCandCuts;
168  // paramters for generator study
169  unsigned int reqNum;
171  // plotting parameters
172  double plotEtMin;
173  double plotPtMin;
174  double plotPtMax;
175 
183 
186  unsigned int gencut_;
187 
190  std::set<std::string> hltCollectionLabelsFound;
191 
194  std::set<std::string> hltCollectionLabelsMissed;
195 
197  // Create Histogram containers
199  // Et & eta distributions
200  std::vector<std::vector<MonitorElement *>> etahists;
201  std::vector<std::vector<MonitorElement *>> phihists;
202  std::vector<std::vector<MonitorElement *>> ethists;
203  std::vector<std::vector<MonitorElement *>> etahistmatchs;
204  std::vector<std::vector<MonitorElement *>> phihistmatchs;
205  std::vector<std::vector<MonitorElement *>> ethistmatchs;
206  std::vector<std::vector<MonitorElement *>> histEtOfHltObjMatchToGens;
207  std::vector<std::vector<MonitorElement *>> histEtaOfHltObjMatchToGens;
208  std::vector<std::vector<MonitorElement *>> histPhiOfHltObjMatchToGens;
209  std::vector<std::vector<MonitorElement *>> etaphihists;
210  std::vector<std::vector<MonitorElement *>> etaphihistmatchs;
211  std::vector<std::vector<MonitorElement *>> histEtaPhiOfHltObjMatchToGens;
212  // Plots of efficiency per step
213  std::vector<MonitorElement *> totals;
214  std::vector<MonitorElement *> totalmatchs;
215  // generator histograms
216  std::vector<MonitorElement *> etgens;
217  std::vector<MonitorElement *> etagens;
218  std::vector<MonitorElement *> phigens;
219  std::vector<MonitorElement *> etaphigens;
220 
221  GreaterByPt<reco::Particle> pTComparator_;
222  GreaterByPt<reco::GenParticle> pTGenComparator_;
223 
224  // tokens for data access
225  edm::EDGetTokenT<edm::View<reco::Candidate>> genParticles_token;
226  edm::EDGetTokenT<trigger::TriggerEventWithRefs> triggerObject_token;
227  edm::EDGetTokenT<edm::TriggerResults> hltResults_token;
228  edm::EDGetTokenT<edm::View<reco::Candidate>> gencutColl_fidWenu_token;
229  edm::EDGetTokenT<edm::View<reco::Candidate>> gencutColl_fidZee_token;
230  edm::EDGetTokenT<edm::View<reco::Candidate>> gencutColl_fidTripleEle_token;
231  edm::EDGetTokenT<edm::View<reco::Candidate>> gencutColl_fidGammaJet_token;
232  edm::EDGetTokenT<edm::View<reco::Candidate>> gencutColl_fidDiGamma_token;
233  edm::EDGetTokenT<edm::View<reco::Candidate>> gencutColl_manualConf_token;
234 
235  // static variables
236  //
237  // trigger types considered
238  static const unsigned TYPE_SINGLE_ELE = 0;
239  static const unsigned TYPE_DOUBLE_ELE = 1;
240  static const unsigned TYPE_SINGLE_PHOTON = 2;
241  static const unsigned TYPE_DOUBLE_PHOTON = 3;
242  static const unsigned TYPE_TRIPLE_ELE = 4;
243 
244  // verbosity levels
245  static const unsigned OUTPUT_SILENT = 0;
246  static const unsigned OUTPUT_ERRORS = 1;
247  static const unsigned OUTPUT_WARNINGS = 2;
248  static const unsigned OUTPUT_ALL = 3;
249 };
250 #endif
EmDQM::hltResults_token
edm::EDGetTokenT< edm::TriggerResults > hltResults_token
Definition: EmDQM.h:227
EmDQM::genParticles_token
edm::EDGetTokenT< edm::View< reco::Candidate > > genParticles_token
Definition: EmDQM.h:225
EmDQM::totalmatchs
std::vector< MonitorElement * > totalmatchs
Definition: EmDQM.h:214
EmDQM::dqmEndRun
void dqmEndRun(edm::Run const &, edm::EventSetup const &) override
Definition: EmDQM.cc:1078
Handle.h
electrons_cff.bool
bool
Definition: electrons_cff.py:393
EmDQM::verbosity_
unsigned int verbosity_
Definition: EmDQM.h:102
GreaterByPt
Definition: PtComparator.h:24
MessageLogger.h
EmDQM::theHLTOutputTypes
std::vector< int > theHLTOutputTypes
Definition: EmDQM.h:163
EmDQM::plotBounds
std::vector< std::pair< double, double > > plotBounds
Definition: EmDQM.h:166
EmDQM::dirname_
std::string dirname_
Definition: EmDQM.h:88
EmDQM::etgens
std::vector< MonitorElement * > etgens
Definition: EmDQM.h:216
TriggerResults.h
EmDQM::gencutColl_fidZee_token
edm::EDGetTokenT< edm::View< reco::Candidate > > gencutColl_fidZee_token
Definition: EmDQM.h:229
EmDQM::etahists
std::vector< std::vector< MonitorElement * > > etahists
Definition: EmDQM.h:200
EmDQM::etahistmatchs
std::vector< std::vector< MonitorElement * > > etahistmatchs
Definition: EmDQM.h:203
HistoFiller::fillHistos
void fillHistos(edm::Handle< trigger::TriggerEventWithRefs > &, const edm::Event &, unsigned int, unsigned int, std::vector< reco::Particle > &, bool &)
Definition: EmDQM.cc:911
EmDQM::makePSetForOneOEMinusOneOPFilter
edm::ParameterSet makePSetForOneOEMinusOneOPFilter(const std::string &)
Definition: EmDQM.cc:1328
edm::EDGetTokenT
Definition: EDGetToken.h:33
EmDQM::checkRecoParticlesRequirement
bool checkRecoParticlesRequirement(const edm::Event &event)
Definition: EmDQM.cc:669
AssociationMap.h
EmDQM::etaphigens
std::vector< MonitorElement * > etaphigens
Definition: EmDQM.h:219
EmDQM::makePSetForEgammaGenericFilter
edm::ParameterSet makePSetForEgammaGenericFilter(const std::string &)
Definition: EmDQM.cc:1379
EmDQM::etaphihists
std::vector< std::vector< MonitorElement * > > etaphihists
Definition: EmDQM.h:209
EmDQM::OUTPUT_ERRORS
static const unsigned OUTPUT_ERRORS
Definition: EmDQM.h:246
EmDQM::hltConfig_
HLTConfigProvider hltConfig_
The instance of the HLTConfigProvider as a data member.
Definition: EmDQM.h:135
EmDQM::numOfHLTCollectionLabels
unsigned int numOfHLTCollectionLabels
Definition: EmDQM.h:160
EmDQM::gencutColl_fidWenu_token
edm::EDGetTokenT< edm::View< reco::Candidate > > gencutColl_fidWenu_token
Definition: EmDQM.h:228
HistoFiller
Definition: EmDQM.h:48
TriggerEventWithRefs.h
EmDQM::hltCollectionLabelsMissedPerPath
std::vector< std::set< std::string > > hltCollectionLabelsMissedPerPath
Definition: EmDQM.h:193
EmDQM::pdgGen
int pdgGen
Definition: EmDQM.h:170
TriggerTypeDefs.h
DQMOneEDAnalyzer
Definition: DQMOneEDAnalyzer.h:20
DQMStore.h
PtComparator.h
EmDQM::OUTPUT_SILENT
static const unsigned OUTPUT_SILENT
Definition: EmDQM.h:245
EmDQM::hltCollectionLabelsFound
std::set< std::string > hltCollectionLabelsFound
Definition: EmDQM.h:190
EmDQM::theL1Seed
edm::InputTag theL1Seed
Definition: EmDQM.h:162
EmDQM::makePSetForElectronGenericFilter
edm::ParameterSet makePSetForElectronGenericFilter(const std::string &)
Definition: EmDQM.cc:1558
EDAnalyzer.h
EmDQM::findEgammaPaths
std::vector< std::vector< std::string > > findEgammaPaths()
Definition: EmDQM.cc:1130
EmDQM::plotEtMin
double plotEtMin
Definition: EmDQM.h:172
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
EmDQM::phiMax_
double phiMax_
Definition: EmDQM.h:109
EmDQM::hltCollectionLabelsFoundPerPath
std::vector< std::set< std::string > > hltCollectionLabelsFoundPerPath
Definition: EmDQM.h:189
EmDQM::histoFillerL1NonIso
HistoFiller< l1extra::L1EmParticleCollection > * histoFillerL1NonIso
Definition: EmDQM.h:92
watchdog.const
const
Definition: watchdog.py:83
edm::Handle< trigger::TriggerEventWithRefs >
HistoFiller::dqm
EmDQM * dqm
Definition: EmDQM.h:63
EmDQM::pTGenComparator_
GreaterByPt< reco::GenParticle > pTGenComparator_
Definition: EmDQM.h:222
DQMOneEDAnalyzer.h
EmDQM::noPhiPlots_
bool noPhiPlots_
Definition: EmDQM.h:117
EmDQM::OUTPUT_ALL
static const unsigned OUTPUT_ALL
Definition: EmDQM.h:248
EmDQM::plotPtMax
double plotPtMax
Definition: EmDQM.h:174
EmDQM::getFilterModules
std::vector< std::string > getFilterModules(const std::string &)
Definition: EmDQM.cc:1186
GenParticle.h
EmDQM::histEtaPhiOfHltObjMatchToGens
std::vector< std::vector< MonitorElement * > > histEtaPhiOfHltObjMatchToGens
Definition: EmDQM.h:211
EmDQM::theHLTCollectionLabels
std::vector< edm::InputTag > theHLTCollectionLabels
Definition: EmDQM.h:159
EmDQM::histoFillerL1Iso
HistoFiller< l1extra::L1EmParticleCollection > * histoFillerL1Iso
Definition: EmDQM.h:94
MakerMacros.h
EmDQM::dqmBeginRun
void dqmBeginRun(edm::Run const &, edm::EventSetup const &) override
Definition: EmDQM.cc:64
EmDQM::histoFillerEle
HistoFiller< reco::ElectronCollection > * histoFillerEle
Definition: EmDQM.h:90
EmDQM::gencutColl_fidGammaJet_token
edm::EDGetTokenT< edm::View< reco::Candidate > > gencutColl_fidGammaJet_token
Definition: EmDQM.h:231
EmDQM::analyze
void analyze(const edm::Event &event, const edm::EventSetup &) override
Definition: EmDQM.cc:733
EmDQM::etagens
std::vector< MonitorElement * > etagens
Definition: EmDQM.h:217
EmDQM::gencut_
unsigned int gencut_
Definition: EmDQM.h:186
EmDQM::histPhiOfHltObjMatchToGens
std::vector< std::vector< MonitorElement * > > histPhiOfHltObjMatchToGens
Definition: EmDQM.h:208
Service.h
HistoFiller::HistoFiller
HistoFiller(EmDQM *d)
Definition: EmDQM.h:50
EmDQM::TYPE_DOUBLE_PHOTON
static const unsigned TYPE_DOUBLE_PHOTON
Definition: EmDQM.h:241
EmDQM::hltCollectionLabelsMissed
std::set< std::string > hltCollectionLabelsMissed
Definition: EmDQM.h:194
EmDQM::phihists
std::vector< std::vector< MonitorElement * > > phihists
Definition: EmDQM.h:201
EmDQM::SetVarsFromPSet
void SetVarsFromPSet(std::vector< edm::ParameterSet >::iterator)
Definition: EmDQM.cc:1633
EmDQM::pset
const edm::ParameterSet & pset
Definition: EmDQM.h:99
RefToBase.h
EmDQM::TYPE_SINGLE_PHOTON
static const unsigned TYPE_SINGLE_PHOTON
Definition: EmDQM.h:240
EmDQM::triggerObject_
edm::InputTag triggerObject_
Definition: EmDQM.h:101
EmDQM::histoFillerPho
HistoFiller< reco::RecoEcalCandidateCollection > * histoFillerPho
Definition: EmDQM.h:93
L1EmParticleFwd.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
EmDQM::isoNames
std::vector< std::vector< edm::InputTag > > isoNames
Definition: EmDQM.h:165
EmDQM::makePSetForL1SeedFilter
edm::ParameterSet makePSetForL1SeedFilter(const std::string &)
Definition: EmDQM.cc:1226
EmDQM::histEtaOfHltObjMatchToGens
std::vector< std::vector< MonitorElement * > > histEtaOfHltObjMatchToGens
Definition: EmDQM.h:207
EmDQM::noIsolationPlots_
bool noIsolationPlots_
Definition: EmDQM.h:118
edm::ParameterSet
Definition: ParameterSet.h:47
EmDQM::gencutColl_fidTripleEle_token
edm::EDGetTokenT< edm::View< reco::Candidate > > gencutColl_fidTripleEle_token
Definition: EmDQM.h:230
EmDQM::nbins2D_
unsigned int nbins2D_
Definition: EmDQM.h:113
Event.h
EmDQM::countSubstring
int countSubstring(const std::string &, const std::string &)
Definition: EmDQM.cc:1118
EmDQM::eta2DMax_
double eta2DMax_
Definition: EmDQM.h:111
EmDQM::nCandCuts
std::vector< unsigned int > nCandCuts
Definition: EmDQM.h:167
EmDQM::OUTPUT_WARNINGS
static const unsigned OUTPUT_WARNINGS
Definition: EmDQM.h:247
EmDQM::gencutCollection_
edm::InputTag gencutCollection_
Definition: EmDQM.h:182
EmDQM::phihistmatchs
std::vector< std::vector< MonitorElement * > > phihistmatchs
Definition: EmDQM.h:204
createfilelist.int
int
Definition: createfilelist.py:10
EmDQM::totals
std::vector< MonitorElement * > totals
Definition: EmDQM.h:213
EmDQM::ptMin_
double ptMin_
Definition: EmDQM.h:107
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
EmDQM::pathIndex
unsigned int pathIndex
Definition: EmDQM.h:158
EmDQM::isData_
bool isData_
Definition: EmDQM.h:105
HistoFiller::~HistoFiller
~HistoFiller()
Definition: EmDQM.h:51
EmDQM::ethistmatchs
std::vector< std::vector< MonitorElement * > > ethistmatchs
Definition: EmDQM.h:205
L1EmParticle.h
HLTConfigProvider.h
EmDQM::TYPE_DOUBLE_ELE
static const unsigned TYPE_DOUBLE_ELE
Definition: EmDQM.h:239
EmDQM::plotPtMin
double plotPtMin
Definition: EmDQM.h:173
EmDQM::etaphihistmatchs
std::vector< std::vector< MonitorElement * > > etaphihistmatchs
Definition: EmDQM.h:210
reco::ElectronCollection
std::vector< Electron > ElectronCollection
collectin of Electron objects
Definition: ElectronFwd.h:9
InputTag.h
EmDQM::histEtOfHltObjMatchToGens
std::vector< std::vector< MonitorElement * > > histEtOfHltObjMatchToGens
Definition: EmDQM.h:206
EmDQM::gencutColl_fidDiGamma_token
edm::EDGetTokenT< edm::View< reco::Candidate > > gencutColl_fidDiGamma_token
Definition: EmDQM.h:232
EmDQM::nbins_
unsigned int nbins_
Definition: EmDQM.h:110
EmDQM::makePSetForEgammaDoubleEtDeltaPhiFilter
edm::ParameterSet makePSetForEgammaDoubleEtDeltaPhiFilter(const std::string &)
Definition: EmDQM.cc:1362
EmDQM::gencutColl_manualConf_token
edm::EDGetTokenT< edm::View< reco::Candidate > > gencutColl_manualConf_token
Definition: EmDQM.h:233
EmDQM::checkGeneratedParticlesRequirement
bool checkGeneratedParticlesRequirement(const edm::Event &event)
Definition: EmDQM.cc:606
EmDQM::pTComparator_
GreaterByPt< reco::Particle > pTComparator_
Definition: EmDQM.h:221
EmDQM::phigens
std::vector< MonitorElement * > phigens
Definition: EmDQM.h:218
Electron.h
HLTConfigProvider
Definition: HLTConfigProvider.h:29
EmDQM::useHumanReadableHistTitles_
bool useHumanReadableHistTitles_
Definition: EmDQM.h:115
EmDQM::genEtaAcc_
double genEtaAcc_
Definition: EmDQM.h:103
RecoEcalCandidate.h
EmDQM::triggerObject_token
edm::EDGetTokenT< trigger::TriggerEventWithRefs > triggerObject_token
Definition: EmDQM.h:226
EmDQM::reqNum
unsigned int reqNum
Definition: EmDQM.h:169
EmDQM::histoFillerClu
HistoFiller< reco::RecoEcalCandidateCollection > * histoFillerClu
Definition: EmDQM.h:91
Frameworkfwd.h
EmDQM::makePSetForEtFilter
edm::ParameterSet makePSetForEtFilter(const std::string &)
Definition: EmDQM.cc:1311
EmDQM::mcMatchedOnly_
bool mcMatchedOnly_
Definition: EmDQM.h:116
EmDQM
Definition: EmDQM.h:66
EmDQM::ethists
std::vector< std::vector< MonitorElement * > > ethists
Definition: EmDQM.h:202
EmDQM::plotiso
std::vector< bool > plotiso
Definition: EmDQM.h:164
Exception.h
funct::void
TEMPL(T2) struct Divides void
Definition: Factorize.h:24
EmDQM::paramSets
std::vector< edm::ParameterSet > paramSets
Definition: EmDQM.h:156
ztail.d
d
Definition: ztail.py:151
EmDQM::phi2DMax_
double phi2DMax_
Definition: EmDQM.h:112
EmDQM::genEtAcc_
double genEtAcc_
Definition: EmDQM.h:104
EmDQM::bookHistograms
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: EmDQM.cc:376
dqm
Definition: DQMStore.h:18
EmDQM::TYPE_TRIPLE_ELE
static const unsigned TYPE_TRIPLE_ELE
Definition: EmDQM.h:242
EmDQM::makePSetForPixelMatchFilter
edm::ParameterSet makePSetForPixelMatchFilter(const std::string &)
Definition: EmDQM.cc:1345
EmDQM::autoConfMode_
bool autoConfMode_
Definition: EmDQM.h:97
ParameterSet.h
HepMCProduct.h
EmDQM::etaMax_
double etaMax_
Definition: EmDQM.h:108
edm::Event
Definition: Event.h:73
EmDQM::theHLTCollectionHumanNames
std::vector< std::string > theHLTCollectionHumanNames
Definition: EmDQM.h:161
EmDQM::getPrimaryEtCut
double getPrimaryEtCut(const std::string &)
Definition: EmDQM.cc:1211
EmDQM::TYPE_SINGLE_ELE
static const unsigned TYPE_SINGLE_ELE
Definition: EmDQM.h:238
EmDQM::makePSetForL1SeedToSuperClusterMatchFilter
edm::ParameterSet makePSetForL1SeedToSuperClusterMatchFilter(const std::string &)
Definition: EmDQM.cc:1288
edm::InputTag
Definition: InputTag.h:15
EmDQM::ptMax_
double ptMax_
Definition: EmDQM.h:106
EmDQM::makePSetForEgammaGenericQuadraticFilter
edm::ParameterSet makePSetForEgammaGenericQuadraticFilter(const std::string &)
Definition: EmDQM.cc:1469
EmDQM::minEtForEtaEffPlot_
unsigned int minEtForEtaEffPlot_
Definition: EmDQM.h:114