CMS 3D CMS Logo

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