CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EmDQM.h
Go to the documentation of this file.
1 #ifndef HLTriggerOffline_Egamma_EmDQM_H
2 #define HLTriggerOffline_Egamma_EmDQM_H
3 
4 
5 // Base Class Headers
29 #include "HepMC/GenParticle.h"
32 
33 #include <boost/regex.hpp>
34 #include <boost/lexical_cast.hpp>
35 #include <boost/foreach.hpp>
36 
37 #include "TDirectory.h"
38 #include "TFile.h"
39 #include "TH1F.h"
40 #include <memory>
41 #include <math.h>
42 #include <iostream>
43 #include <string>
44 #include <vector>
45 #include <Math/VectorUtil.h>
46 
47 class EmDQM;
48 
49 template <class T>
50 class HistoFiller {
51  public:
52  HistoFiller(EmDQM* d):dqm(d) {};
54 
55  void fillHistos(edm::Handle<trigger::TriggerEventWithRefs>& ,const edm::Event& ,unsigned int, unsigned int, std::vector<reco::Particle>&, bool & );
56  //std::vector<edm::EDGetTokenT<edm::AssociationMap<edm::OneToValue< T , float>>>> isoNameTokens_;
57 
58  private:
60 };
61 
62 class EmDQM : public edm::EDAnalyzer{
63 public:
64 
66  friend class HistoFiller<reco::RecoEcalCandidateCollection>;
67  friend class HistoFiller<l1extra::L1EmParticleCollection>;
68 
70  explicit EmDQM(const edm::ParameterSet& pset);
71 
73  ~EmDQM();
74 
75  // Operations
76 
77  void analyze(const edm::Event & event, const edm::EventSetup&);
78  void beginJob();
79  void endJob();
80 
81  void beginRun(edm::Run const&, edm::EventSetup const&);
82  void endRun(edm::Run const&, edm::EventSetup const&);
83 
84 private:
85  // 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  unsigned int minEtForEtaEffPlot_;
115 
122  bool checkGeneratedParticlesRequirement(const edm::Event &event);
123 
128  bool checkRecoParticlesRequirement(const edm::Event & event);
129 
132 
133  // routines to build validation configuration from HLTConfiguration
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&);
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;
154  std::vector<edm::InputTag> theHLTCollectionLabels;
155  unsigned int numOfHLTCollectionLabels; // Will be size of above vector
156  std::vector<std::string> theHLTCollectionHumanNames; // Human-readable names for the collections
158  std::vector<int> theHLTOutputTypes;
159  std::vector<bool> plotiso;
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;
165  int pdgGen;
166  // plotting parameters
167  double plotEtMin;
168  double plotPtMin ;
169  double plotPtMax ;
170 
178 
180  unsigned int gencut_;
181 
183  std::vector<std::set<std::string> > hltCollectionLabelsFoundPerPath;
184  std::set<std::string> hltCollectionLabelsFound;
185 
187  std::vector<std::set<std::string> > hltCollectionLabelsMissedPerPath;
188  std::set<std::string> hltCollectionLabelsMissed;
189 
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  // commented out because uses data not included in HTLDEBUG and uses getByLabel
205  // Isolation distributions
206  //std::vector<std::vector<MonitorElement*> > etahistisos;
207  //std::vector<std::vector<MonitorElement*> > phihistisos;
208  //std::vector<std::vector<MonitorElement*> > ethistisos;
209  //std::vector<std::vector<MonitorElement*> > etahistisomatchs;
210  //std::vector<std::vector<MonitorElement*> > phihistisomatchs;
211  //std::vector<std::vector<MonitorElement*> > ethistisomatchs;
212  //std::vector<std::vector<MonitorElement*> > histEtIsoOfHltObjMatchToGens;
213  //std::vector<std::vector<MonitorElement*> > histEtaIsoOfHltObjMatchToGens;
214  //std::vector<std::vector<MonitorElement*> > histPhiIsoOfHltObjMatchToGens;
215  // Plots of efficiency per step
216  std::vector<MonitorElement*> totals;
217  std::vector<MonitorElement*> totalmatchs;
218  //generator histograms
219  std::vector<MonitorElement*> etgens;
220  std::vector<MonitorElement*> etagens;
221  std::vector<MonitorElement*> phigens;
222 
223  GreaterByPt<reco::Particle> pTComparator_;
224  GreaterByPt<reco::GenParticle> pTGenComparator_;
225 
226  // tokens for data access
227  edm::EDGetTokenT<edm::View<reco::Candidate> > genParticles_token;
228  edm::EDGetTokenT<trigger::TriggerEventWithRefs> triggerObject_token;
229  edm::EDGetTokenT<edm::TriggerResults> hltResults_token;
230  edm::EDGetTokenT<edm::View<reco::Candidate> > gencutColl_fidWenu_token;
231  edm::EDGetTokenT<edm::View<reco::Candidate> > gencutColl_fidZee_token;
232  edm::EDGetTokenT<edm::View<reco::Candidate> > gencutColl_fidGammaJet_token;
233  edm::EDGetTokenT<edm::View<reco::Candidate> > gencutColl_fidDiGamma_token;
234  edm::EDGetTokenT<edm::View<reco::Candidate> > gencutColl_manualConf_token;
235 
236  // static variables
237  //
238  // trigger types considered
239  static const unsigned TYPE_SINGLE_ELE = 0;
240  static const unsigned TYPE_DOUBLE_ELE = 1;
241  static const unsigned TYPE_SINGLE_PHOTON = 2;
242  static const unsigned TYPE_DOUBLE_PHOTON = 3;
243  static const unsigned TYPE_TRIPLE_ELE = 4;
244 
245  // verbosity levels
246  static const unsigned OUTPUT_SILENT = 0;
247  static const unsigned OUTPUT_ERRORS = 1;
248  static const unsigned OUTPUT_WARNINGS = 2;
249  static const unsigned OUTPUT_ALL = 3;
250 };
251 #endif
edm::ParameterSet makePSetForEgammaGenericFilter(const std::string &)
Definition: EmDQM.cc:1363
double ptMax_
Definition: EmDQM.h:105
std::vector< MonitorElement * > totals
Definition: EmDQM.h:216
edm::ParameterSet makePSetForEgammaGenericQuadraticFilter(const std::string &)
Definition: EmDQM.cc:1437
edm::EDGetTokenT< edm::View< reco::Candidate > > gencutColl_fidZee_token
Definition: EmDQM.h:231
void fillHistos(edm::Handle< trigger::TriggerEventWithRefs > &, const edm::Event &, unsigned int, unsigned int, std::vector< reco::Particle > &, bool &)
Definition: EmDQM.cc:872
edm::EDGetTokenT< edm::View< reco::Candidate > > genParticles_token
Definition: EmDQM.h:227
void beginJob()
Definition: EmDQM.cc:69
std::vector< std::vector< MonitorElement * > > histEtOfHltObjMatchToGens
Definition: EmDQM.h:201
std::vector< std::vector< std::string > > findEgammaPaths()
Definition: EmDQM.cc:1137
bool checkRecoParticlesRequirement(const edm::Event &event)
Definition: EmDQM.cc:654
unsigned int numOfHLTCollectionLabels
Definition: EmDQM.h:155
std::vector< std::vector< MonitorElement * > > phihists
Definition: EmDQM.h:196
std::string dirname_
Definition: EmDQM.h:87
std::vector< std::set< std::string > > hltCollectionLabelsMissedPerPath
Definition: EmDQM.h:187
bool noPhiPlots_
Definition: EmDQM.h:113
static const unsigned OUTPUT_ALL
Definition: EmDQM.h:249
int pdgGen
Definition: EmDQM.h:165
std::set< std::string > hltCollectionLabelsFound
Definition: EmDQM.h:184
edm::InputTag theL1Seed
Definition: EmDQM.h:157
DQMStore * dbe
Definition: EmDQM.h:86
std::vector< std::vector< MonitorElement * > > histPhiOfHltObjMatchToGens
Definition: EmDQM.h:203
std::vector< std::set< std::string > > hltCollectionLabelsFoundPerPath
Definition: EmDQM.h:183
double phiMax_
Definition: EmDQM.h:108
HLTConfigProvider hltConfig_
The instance of the HLTConfigProvider as a data member.
Definition: EmDQM.h:131
HistoFiller(EmDQM *d)
Definition: EmDQM.h:52
edm::ParameterSet makePSetForOneOEMinusOneOPFilter(const std::string &)
Definition: EmDQM.cc:1312
static const unsigned TYPE_DOUBLE_PHOTON
Definition: EmDQM.h:242
edm::ParameterSet makePSetForElectronGenericFilter(const std::string &)
Definition: EmDQM.cc:1511
HistoFiller< reco::ElectronCollection > * histoFillerEle
Definition: EmDQM.h:89
double plotEtMin
Definition: EmDQM.h:167
Definition: EmDQM.h:62
std::vector< std::vector< MonitorElement * > > etahists
Definition: EmDQM.h:195
static const unsigned OUTPUT_ERRORS
Definition: EmDQM.h:247
edm::EDGetTokenT< edm::View< reco::Candidate > > gencutColl_fidWenu_token
Definition: EmDQM.h:230
EmDQM * dqm
Definition: EmDQM.h:59
GreaterByPt< reco::GenParticle > pTGenComparator_
Definition: EmDQM.h:224
std::vector< std::vector< edm::InputTag > > isoNames
Definition: EmDQM.h:160
edm::ParameterSet makePSetForL1SeedFilter(const std::string &)
Definition: EmDQM.cc:1243
std::vector< MonitorElement * > etagens
Definition: EmDQM.h:220
std::vector< std::vector< MonitorElement * > > ethists
Definition: EmDQM.h:197
std::vector< std::string > getFilterModules(const std::string &)
Definition: EmDQM.cc:1200
void beginRun(edm::Run const &, edm::EventSetup const &)
Definition: EmDQM.cc:75
static const unsigned OUTPUT_SILENT
Definition: EmDQM.h:246
std::vector< edm::InputTag > theHLTCollectionLabels
Definition: EmDQM.h:154
HistoFiller< l1extra::L1EmParticleCollection > * histoFillerL1Iso
Definition: EmDQM.h:93
HistoFiller< l1extra::L1EmParticleCollection > * histoFillerL1NonIso
Definition: EmDQM.h:91
std::vector< std::vector< MonitorElement * > > ethistmatchs
Definition: EmDQM.h:200
unsigned int gencut_
Definition: EmDQM.h:180
std::vector< unsigned int > nCandCuts
Definition: EmDQM.h:162
HistoFiller< reco::RecoEcalCandidateCollection > * histoFillerPho
Definition: EmDQM.h:92
edm::InputTag triggerObject_
Definition: EmDQM.h:100
void endRun(edm::Run const &, edm::EventSetup const &)
Definition: EmDQM.cc:1086
static const unsigned OUTPUT_WARNINGS
Definition: EmDQM.h:248
double plotPtMax
Definition: EmDQM.h:169
bool noIsolationPlots_
Definition: EmDQM.h:114
edm::EDGetTokenT< edm::View< reco::Candidate > > gencutColl_fidGammaJet_token
Definition: EmDQM.h:232
std::set< std::string > hltCollectionLabelsMissed
Definition: EmDQM.h:188
~HistoFiller()
Definition: EmDQM.h:53
std::vector< std::vector< MonitorElement * > > etahistmatchs
Definition: EmDQM.h:198
void SetVarsFromPSet(std::vector< edm::ParameterSet >::iterator)
Definition: EmDQM.cc:1577
const edm::ParameterSet & pset
Definition: EmDQM.h:98
double plotPtMin
Definition: EmDQM.h:168
edm::InputTag gencutCollection_
Definition: EmDQM.h:177
edm::ParameterSet makePSetForEgammaDoubleEtDeltaPhiFilter(const std::string &)
Definition: EmDQM.cc:1346
unsigned int nbins_
Definition: EmDQM.h:109
std::vector< std::vector< MonitorElement * > > phihistmatchs
Definition: EmDQM.h:199
std::vector< Electron > ElectronCollection
collectin of Electron objects
Definition: ElectronFwd.h:9
bool isData_
Definition: EmDQM.h:104
static const unsigned TYPE_SINGLE_PHOTON
Definition: EmDQM.h:241
edm::EDGetTokenT< edm::View< reco::Candidate > > gencutColl_fidDiGamma_token
Definition: EmDQM.h:233
double ptMin_
Definition: EmDQM.h:106
bool checkGeneratedParticlesRequirement(const edm::Event &event)
Definition: EmDQM.cc:597
std::vector< edm::ParameterSet > paramSets
Definition: EmDQM.h:151
std::vector< std::vector< MonitorElement * > > histEtaOfHltObjMatchToGens
Definition: EmDQM.h:202
void analyze(const edm::Event &event, const edm::EventSetup &)
Definition: EmDQM.cc:715
double genEtAcc_
Definition: EmDQM.h:103
string const
Definition: compareJSON.py:14
bool autoConfMode_
Definition: EmDQM.h:96
static const unsigned TYPE_SINGLE_ELE
Definition: EmDQM.h:239
double getPrimaryEtCut(const std::string &)
Definition: EmDQM.cc:1225
edm::ParameterSet makePSetForL1SeedToSuperClusterMatchFilter(const std::string &)
Definition: EmDQM.cc:1273
unsigned int pathIndex
Definition: EmDQM.h:153
bool useHumanReadableHistTitles_
Definition: EmDQM.h:111
edm::EDGetTokenT< trigger::TriggerEventWithRefs > triggerObject_token
Definition: EmDQM.h:228
std::vector< MonitorElement * > totalmatchs
Definition: EmDQM.h:217
static const unsigned TYPE_DOUBLE_ELE
Definition: EmDQM.h:240
HistoFiller< reco::RecoEcalCandidateCollection > * histoFillerClu
Definition: EmDQM.h:90
static const unsigned TYPE_TRIPLE_ELE
Definition: EmDQM.h:243
bool mcMatchedOnly_
Definition: EmDQM.h:112
std::vector< std::string > theHLTCollectionHumanNames
Definition: EmDQM.h:156
edm::EDGetTokenT< edm::View< reco::Candidate > > gencutColl_manualConf_token
Definition: EmDQM.h:234
GreaterByPt< reco::Particle > pTComparator_
Definition: EmDQM.h:223
std::vector< MonitorElement * > phigens
Definition: EmDQM.h:221
unsigned int verbosity_
Definition: EmDQM.h:101
double genEtaAcc_
Definition: EmDQM.h:102
void endJob()
Definition: EmDQM.cc:1129
std::vector< int > theHLTOutputTypes
Definition: EmDQM.h:158
unsigned int reqNum
Definition: EmDQM.h:164
edm::ParameterSet makePSetForEtFilter(const std::string &)
Definition: EmDQM.cc:1295
edm::ParameterSet makePSetForPixelMatchFilter(const std::string &)
Definition: EmDQM.cc:1329
unsigned int minEtForEtaEffPlot_
Definition: EmDQM.h:110
edm::EDGetTokenT< edm::TriggerResults > hltResults_token
Definition: EmDQM.h:229
double etaMax_
Definition: EmDQM.h:107
std::vector< std::pair< double, double > > plotBounds
Definition: EmDQM.h:161
std::vector< MonitorElement * > etgens
Definition: EmDQM.h:219
std::vector< bool > plotiso
Definition: EmDQM.h:159