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  // parameter set from config file
97  // global parameters
99  unsigned int verbosity_;
100  double genEtaAcc_;
101  double genEtAcc_;
103  double ptMax_;
104  double ptMin_;
105  double etaMax_;
106  double phiMax_;
107  unsigned int nbins_;
108  double eta2DMax_;
109  double phi2DMax_;
110  unsigned int nbins2D_;
116 
123  bool checkGeneratedParticlesRequirement(const edm::Event &event);
124 
129  bool checkRecoParticlesRequirement(const edm::Event &event);
130 
133 
134  // routines to build validation configuration from HLTConfiguration
135  int countSubstring(const std::string &, const std::string &);
136  std::vector<std::vector<std::string>> findEgammaPaths();
137  std::vector<std::string> getFilterModules(const std::string &);
138  double getPrimaryEtCut(const std::string &);
139  edm::ParameterSet makePSetForL1SeedFilter(const std::string &);
141  edm::ParameterSet makePSetForEtFilter(const std::string &);
143  edm::ParameterSet makePSetForPixelMatchFilter(const std::string &);
148 
149  // set validation configuration parameters for a trigger path
150  void SetVarsFromPSet(std::vector<edm::ParameterSet>::iterator);
151 
152  // generated parameter set for trigger path
153  std::vector<edm::ParameterSet> paramSets;
154  // input from generated parameter set
155  unsigned int pathIndex;
157  unsigned int numOfHLTCollectionLabels; // Will be size of above vector
158  std::vector<std::string> theHLTCollectionHumanNames; // Human-readable names for the collections
162  std::vector<std::vector<edm::InputTag>> isoNames; // there has to be a better solution
163  std::vector<std::pair<double, double>> plotBounds;
164  std::vector<unsigned int> nCandCuts;
165  // paramters for generator study
166  unsigned int reqNum;
168  // plotting parameters
169  double plotEtMin;
170  double plotPtMin;
171  double plotPtMax;
172 
180 
183  unsigned int gencut_;
184 
187  std::set<std::string> hltCollectionLabelsFound;
188 
191  std::set<std::string> hltCollectionLabelsMissed;
192 
194  // Create Histogram containers
196  // Et & eta distributions
197  std::vector<std::vector<MonitorElement *>> etahists;
198  std::vector<std::vector<MonitorElement *>> phihists;
199  std::vector<std::vector<MonitorElement *>> ethists;
200  std::vector<std::vector<MonitorElement *>> etahistmatchs;
201  std::vector<std::vector<MonitorElement *>> phihistmatchs;
202  std::vector<std::vector<MonitorElement *>> ethistmatchs;
203  std::vector<std::vector<MonitorElement *>> histEtOfHltObjMatchToGens;
204  std::vector<std::vector<MonitorElement *>> histEtaOfHltObjMatchToGens;
205  std::vector<std::vector<MonitorElement *>> histPhiOfHltObjMatchToGens;
206  std::vector<std::vector<MonitorElement *>> etaphihists;
207  std::vector<std::vector<MonitorElement *>> etaphihistmatchs;
208  std::vector<std::vector<MonitorElement *>> histEtaPhiOfHltObjMatchToGens;
209  // Plots of efficiency per step
210  std::vector<MonitorElement *> totals;
211  std::vector<MonitorElement *> totalmatchs;
212  // generator histograms
213  std::vector<MonitorElement *> etgens;
214  std::vector<MonitorElement *> etagens;
215  std::vector<MonitorElement *> phigens;
216  std::vector<MonitorElement *> etaphigens;
217 
218  GreaterByPt<reco::Particle> pTComparator_;
219  GreaterByPt<reco::GenParticle> pTGenComparator_;
220 
221  // tokens for data access
222  edm::EDGetTokenT<edm::View<reco::Candidate>> genParticles_token;
223  edm::EDGetTokenT<trigger::TriggerEventWithRefs> triggerObject_token;
224  edm::EDGetTokenT<edm::TriggerResults> hltResults_token;
225  edm::EDGetTokenT<edm::View<reco::Candidate>> gencutColl_fidWenu_token;
226  edm::EDGetTokenT<edm::View<reco::Candidate>> gencutColl_fidZee_token;
227  edm::EDGetTokenT<edm::View<reco::Candidate>> gencutColl_fidTripleEle_token;
228  edm::EDGetTokenT<edm::View<reco::Candidate>> gencutColl_fidGammaJet_token;
229  edm::EDGetTokenT<edm::View<reco::Candidate>> gencutColl_fidDiGamma_token;
230  edm::EDGetTokenT<edm::View<reco::Candidate>> gencutColl_manualConf_token;
231 
232  // static variables
233  //
234  // trigger types considered
235  static const unsigned TYPE_SINGLE_ELE = 0;
236  static const unsigned TYPE_DOUBLE_ELE = 1;
237  static const unsigned TYPE_SINGLE_PHOTON = 2;
238  static const unsigned TYPE_DOUBLE_PHOTON = 3;
239  static const unsigned TYPE_TRIPLE_ELE = 4;
240 
241  // verbosity levels
242  static const unsigned OUTPUT_SILENT = 0;
243  static const unsigned OUTPUT_ERRORS = 1;
244  static const unsigned OUTPUT_WARNINGS = 2;
245  static const unsigned OUTPUT_ALL = 3;
246 };
247 #endif
edm::ParameterSet makePSetForEgammaGenericFilter(const std::string &)
Definition: EmDQM.cc:1379
double ptMax_
Definition: EmDQM.h:103
std::vector< std::vector< MonitorElement * > > etaphihists
Definition: EmDQM.h:206
edm::ParameterSet makePSetForEgammaGenericQuadraticFilter(const std::string &)
Definition: EmDQM.cc:1464
edm::EDGetTokenT< edm::View< reco::Candidate > > gencutColl_fidZee_token
Definition: EmDQM.h:226
std::vector< MonitorElement * > etgens
Definition: EmDQM.h:213
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:222
std::vector< MonitorElement * > totalmatchs
Definition: EmDQM.h:211
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:157
std::string dirname_
Definition: EmDQM.h:85
std::vector< std::pair< double, double > > plotBounds
Definition: EmDQM.h:163
std::vector< std::set< std::string > > hltCollectionLabelsMissedPerPath
Definition: EmDQM.h:190
bool noPhiPlots_
Definition: EmDQM.h:114
static const unsigned OUTPUT_ALL
Definition: EmDQM.h:245
std::vector< std::vector< MonitorElement * > > etahistmatchs
Definition: EmDQM.h:200
int pdgGen
Definition: EmDQM.h:167
std::vector< std::vector< MonitorElement * > > histEtaPhiOfHltObjMatchToGens
Definition: EmDQM.h:208
std::set< std::string > hltCollectionLabelsFound
Definition: EmDQM.h:187
edm::InputTag theL1Seed
Definition: EmDQM.h:159
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:186
double phiMax_
Definition: EmDQM.h:106
std::vector< MonitorElement * > etagens
Definition: EmDQM.h:214
std::vector< MonitorElement * > etaphigens
Definition: EmDQM.h:216
HLTConfigProvider hltConfig_
The instance of the HLTConfigProvider as a data member.
Definition: EmDQM.h:132
std::vector< std::vector< MonitorElement * > > histPhiOfHltObjMatchToGens
Definition: EmDQM.h:205
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:238
edm::ParameterSet makePSetForElectronGenericFilter(const std::string &)
Definition: EmDQM.cc:1547
HistoFiller< reco::ElectronCollection > * histoFillerEle
Definition: EmDQM.h:87
double plotEtMin
Definition: EmDQM.h:169
Definition: EmDQM.h:63
std::vector< std::vector< MonitorElement * > > phihists
Definition: EmDQM.h:198
static const unsigned OUTPUT_ERRORS
Definition: EmDQM.h:243
edm::EDGetTokenT< edm::View< reco::Candidate > > gencutColl_fidWenu_token
Definition: EmDQM.h:225
TEMPL(T2) struct Divides void
Definition: Factorize.h:24
EmDQM * dqm
Definition: EmDQM.h:60
GreaterByPt< reco::GenParticle > pTGenComparator_
Definition: EmDQM.h:219
std::vector< std::vector< edm::InputTag > > isoNames
Definition: EmDQM.h:162
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:242
std::vector< edm::InputTag > theHLTCollectionLabels
Definition: EmDQM.h:156
HistoFiller< l1extra::L1EmParticleCollection > * histoFillerL1Iso
Definition: EmDQM.h:91
HistoFiller< l1extra::L1EmParticleCollection > * histoFillerL1NonIso
Definition: EmDQM.h:89
unsigned int gencut_
Definition: EmDQM.h:183
std::vector< unsigned int > nCandCuts
Definition: EmDQM.h:164
HistoFiller< reco::RecoEcalCandidateCollection > * histoFillerPho
Definition: EmDQM.h:90
edm::InputTag triggerObject_
Definition: EmDQM.h:98
static const unsigned OUTPUT_WARNINGS
Definition: EmDQM.h:244
std::vector< MonitorElement * > totals
Definition: EmDQM.h:210
double plotPtMax
Definition: EmDQM.h:171
bool noIsolationPlots_
Definition: EmDQM.h:115
edm::EDGetTokenT< edm::View< reco::Candidate > > gencutColl_fidGammaJet_token
Definition: EmDQM.h:228
std::set< std::string > hltCollectionLabelsMissed
Definition: EmDQM.h:191
~HistoFiller()
Definition: EmDQM.h:48
void SetVarsFromPSet(std::vector< edm::ParameterSet >::iterator)
Definition: EmDQM.cc:1621
const edm::ParameterSet & pset
Definition: EmDQM.h:96
double plotPtMin
Definition: EmDQM.h:170
edm::InputTag gencutCollection_
Definition: EmDQM.h:179
edm::ParameterSet makePSetForEgammaDoubleEtDeltaPhiFilter(const std::string &)
Definition: EmDQM.cc:1362
unsigned int nbins_
Definition: EmDQM.h:107
std::vector< Electron > ElectronCollection
collectin of Electron objects
Definition: ElectronFwd.h:9
d
Definition: ztail.py:151
bool isData_
Definition: EmDQM.h:102
std::vector< std::vector< MonitorElement * > > ethistmatchs
Definition: EmDQM.h:202
double eta2DMax_
Definition: EmDQM.h:108
static const unsigned TYPE_SINGLE_PHOTON
Definition: EmDQM.h:237
std::vector< std::vector< MonitorElement * > > etaphihistmatchs
Definition: EmDQM.h:207
edm::EDGetTokenT< edm::View< reco::Candidate > > gencutColl_fidDiGamma_token
Definition: EmDQM.h:229
std::vector< std::vector< MonitorElement * > > histEtaOfHltObjMatchToGens
Definition: EmDQM.h:204
std::vector< std::vector< MonitorElement * > > phihistmatchs
Definition: EmDQM.h:201
double ptMin_
Definition: EmDQM.h:104
bool checkGeneratedParticlesRequirement(const edm::Event &event)
Definition: EmDQM.cc:606
std::vector< MonitorElement * > phigens
Definition: EmDQM.h:215
std::vector< edm::ParameterSet > paramSets
Definition: EmDQM.h:153
edm::EDGetTokenT< edm::View< reco::Candidate > > gencutColl_fidTripleEle_token
Definition: EmDQM.h:227
unsigned int nbins2D_
Definition: EmDQM.h:110
int countSubstring(const std::string &, const std::string &)
Definition: EmDQM.cc:1118
double genEtAcc_
Definition: EmDQM.h:101
bool autoConfMode_
Definition: EmDQM.h:94
static const unsigned TYPE_SINGLE_ELE
Definition: EmDQM.h:235
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:155
bool useHumanReadableHistTitles_
Definition: EmDQM.h:112
edm::EDGetTokenT< trigger::TriggerEventWithRefs > triggerObject_token
Definition: EmDQM.h:223
static const unsigned TYPE_DOUBLE_ELE
Definition: EmDQM.h:236
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:239
bool mcMatchedOnly_
Definition: EmDQM.h:113
std::vector< std::vector< MonitorElement * > > histEtOfHltObjMatchToGens
Definition: EmDQM.h:203
std::vector< std::string > theHLTCollectionHumanNames
Definition: EmDQM.h:158
edm::EDGetTokenT< edm::View< reco::Candidate > > gencutColl_manualConf_token
Definition: EmDQM.h:230
GreaterByPt< reco::Particle > pTComparator_
Definition: EmDQM.h:218
unsigned int verbosity_
Definition: EmDQM.h:99
double genEtaAcc_
Definition: EmDQM.h:100
Definition: DQMStore.h:18
std::vector< int > theHLTOutputTypes
Definition: EmDQM.h:160
double phi2DMax_
Definition: EmDQM.h:109
unsigned int reqNum
Definition: EmDQM.h:166
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:111
std::vector< std::vector< MonitorElement * > > etahists
Definition: EmDQM.h:197
edm::EDGetTokenT< edm::TriggerResults > hltResults_token
Definition: EmDQM.h:224
double etaMax_
Definition: EmDQM.h:105
std::vector< std::vector< MonitorElement * > > ethists
Definition: EmDQM.h:199
std::vector< bool > plotiso
Definition: EmDQM.h:161