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