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:
50  HistoFiller(EmDQM *d) : dqm(d){};
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 DQMEDAnalyzer {
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
88  std::string dirname_;
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
97  bool autoConfMode_;
98  // parameter set from config file
100  // global parameters
101  edm::InputTag triggerObject_;
102  unsigned int verbosity_;
103  double genEtaAcc_;
104  double genEtAcc_;
105  bool isData_;
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_;
114  unsigned int minEtForEtaEffPlot_;
115  bool useHumanReadableHistTitles_;
116  bool mcMatchedOnly_;
117  bool noPhiPlots_;
118  bool noIsolationPlots_;
119 
126  bool checkGeneratedParticlesRequirement(const edm::Event &event);
127 
132  bool checkRecoParticlesRequirement(const edm::Event &event);
133 
135  HLTConfigProvider hltConfig_;
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 &);
148  edm::ParameterSet makePSetForEgammaGenericQuadraticFilter(const std::string &);
150  edm::ParameterSet makePSetForEgammaDoubleEtDeltaPhiFilter(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;
159  std::vector<edm::InputTag> theHLTCollectionLabels;
160  unsigned int numOfHLTCollectionLabels; // Will be size of above vector
161  std::vector<std::string> theHLTCollectionHumanNames; // Human-readable names for the collections
162  edm::InputTag theL1Seed;
163  std::vector<int> theHLTOutputTypes;
164  std::vector<bool> plotiso;
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 
182  edm::InputTag gencutCollection_;
183 
186  unsigned int gencut_;
187 
189  std::vector<std::set<std::string>> hltCollectionLabelsFoundPerPath;
190  std::set<std::string> hltCollectionLabelsFound;
191 
193  std::vector<std::set<std::string>> hltCollectionLabelsMissedPerPath;
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
void fillHistos(edm::Handle< trigger::TriggerEventWithRefs > &, const edm::Event &, unsigned int, unsigned int, std::vector< reco::Particle > &, bool &)
Definition: EmDQM.cc:911
def makePSetForL1SeedToSuperClusterMatchFilter(self, moduleName)
def makePSetForEtFilter(self, moduleName)
HistoFiller(EmDQM *d)
Definition: EmDQM.h:50
Definition: EmDQM.h:66
example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
EmDQM * dqm
Definition: EmDQM.h:63
def makePSetForOneOEMinusOneOPFilter(self, moduleName)
~HistoFiller()
Definition: EmDQM.h:51
def makePSetForEgammaGenericFilter(self, module, moduleName)
std::vector< Electron > ElectronCollection
collectin of Electron objects
Definition: ElectronFwd.h:9
d
Definition: ztail.py:151
def makePSetForPixelMatchFilter(self, moduleName)
example_stream void bookHistograms(DQMStore::IBooker &,@example_stream edm::Run const &,@example_stream edm::EventSetup const &) override
fixed size matrix
def makePSetForElectronGenericFilter(self, module, moduleName)
def makePSetForL1SeedFilter(self, moduleName)
print >> sys.stderr,msgPrefix,"WARNING: unknown module type", module.type_(), " with name " + moduleN...