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 // Base Class Headers
30 #include "HepMC/GenParticle.h"
32 
33 #include <boost/lexical_cast.hpp>
34 #include <boost/regex.hpp>
35 
36 #include "TDirectory.h"
37 #include "TFile.h"
38 #include "TH1F.h"
39 #include <Math/VectorUtil.h>
40 #include <cmath>
41 #include <iostream>
42 #include <memory>
43 #include <string>
44 #include <vector>
45 
46 class EmDQM;
47 
48 template <class T>
49 class HistoFiller {
50 public:
51  HistoFiller(EmDQM *d) : dqm(d){};
53 
55  const edm::Event &,
56  unsigned int,
57  unsigned int,
58  std::vector<reco::Particle> &,
59  bool &);
60  // std::vector<edm::EDGetTokenT<edm::AssociationMap<edm::OneToValue< T ,
61  // float>>>> isoNameTokens_;
62 
63 private:
65 };
66 
67 class EmDQM : public DQMEDAnalyzer {
68 public:
70  friend class HistoFiller<reco::RecoEcalCandidateCollection>;
71  friend class HistoFiller<l1extra::L1EmParticleCollection>;
72 
74  explicit EmDQM(const edm::ParameterSet &pset);
75 
77  ~EmDQM() override;
78 
79  // Operations
80 
81  void analyze(const edm::Event &event, const edm::EventSetup &) override;
82 
83  void dqmBeginRun(edm::Run const &, edm::EventSetup const &) override;
84  void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override;
85  void endRun(edm::Run const &, edm::EventSetup const &) override;
86 
87 private:
88  // interface to DQM framework
89  std::string dirname_;
90 
91  HistoFiller<reco::ElectronCollection> *histoFillerEle;
92  HistoFiller<reco::RecoEcalCandidateCollection> *histoFillerClu;
93  HistoFiller<l1extra::L1EmParticleCollection> *histoFillerL1NonIso;
94  HistoFiller<reco::RecoEcalCandidateCollection> *histoFillerPho;
95  HistoFiller<l1extra::L1EmParticleCollection> *histoFillerL1Iso;
96 
97  // run in automatic configuration generation mode
98  bool autoConfMode_;
99  // parameter set from config file
101  // global parameters
102  edm::InputTag triggerObject_;
103  unsigned int verbosity_;
104  double genEtaAcc_;
105  double genEtAcc_;
106  bool isData_;
107  double ptMax_;
108  double ptMin_;
109  double etaMax_;
110  double phiMax_;
111  unsigned int nbins_;
112  double eta2DMax_;
113  double phi2DMax_;
114  unsigned int nbins2D_;
115  unsigned int minEtForEtaEffPlot_;
116  bool useHumanReadableHistTitles_;
117  bool mcMatchedOnly_;
118  bool noPhiPlots_;
119  bool noIsolationPlots_;
120 
127  bool checkGeneratedParticlesRequirement(const edm::Event &event);
128 
133  bool checkRecoParticlesRequirement(const edm::Event &event);
134 
136  HLTConfigProvider hltConfig_;
137 
138  // routines to build validation configuration from HLTConfiguration
139  int countSubstring(const std::string &, const std::string &);
140  std::vector<std::vector<std::string>> findEgammaPaths();
141  std::vector<std::string> getFilterModules(const std::string &);
142  double getPrimaryEtCut(const std::string &);
143  edm::ParameterSet makePSetForL1SeedFilter(const std::string &);
145  edm::ParameterSet makePSetForEtFilter(const std::string &);
147  edm::ParameterSet makePSetForPixelMatchFilter(const std::string &);
149  edm::ParameterSet makePSetForEgammaGenericQuadraticFilter(const std::string &);
151  edm::ParameterSet makePSetForEgammaDoubleEtDeltaPhiFilter(const std::string &);
152 
153  // set validation configuration parameters for a trigger path
154  void SetVarsFromPSet(std::vector<edm::ParameterSet>::iterator);
155 
156  // generated parameter set for trigger path
157  std::vector<edm::ParameterSet> paramSets;
158  // input from generated parameter set
159  unsigned int pathIndex;
160  std::vector<edm::InputTag> theHLTCollectionLabels;
161  unsigned int numOfHLTCollectionLabels; // Will be size of above vector
162  std::vector<std::string> theHLTCollectionHumanNames; // Human-readable names for the collections
163  edm::InputTag theL1Seed;
164  std::vector<int> theHLTOutputTypes;
165  std::vector<bool> plotiso;
166  std::vector<std::vector<edm::InputTag>> isoNames; // there has to be a better solution
167  std::vector<std::pair<double, double>> plotBounds;
168  std::vector<unsigned int> nCandCuts;
169  // paramters for generator study
170  unsigned int reqNum;
172  // plotting parameters
173  double plotEtMin;
174  double plotPtMin;
175  double plotPtMax;
176 
183  edm::InputTag gencutCollection_;
184 
187  unsigned int gencut_;
188 
190  std::vector<std::set<std::string>> hltCollectionLabelsFoundPerPath;
191  std::set<std::string> hltCollectionLabelsFound;
192 
194  std::vector<std::set<std::string>> hltCollectionLabelsMissedPerPath;
195  std::set<std::string> hltCollectionLabelsMissed;
196 
198  // Create Histogram containers
200  // Et & eta distributions
201  std::vector<std::vector<MonitorElement *>> etahists;
202  std::vector<std::vector<MonitorElement *>> phihists;
203  std::vector<std::vector<MonitorElement *>> ethists;
204  std::vector<std::vector<MonitorElement *>> etahistmatchs;
205  std::vector<std::vector<MonitorElement *>> phihistmatchs;
206  std::vector<std::vector<MonitorElement *>> ethistmatchs;
207  std::vector<std::vector<MonitorElement *>> histEtOfHltObjMatchToGens;
208  std::vector<std::vector<MonitorElement *>> histEtaOfHltObjMatchToGens;
209  std::vector<std::vector<MonitorElement *>> histPhiOfHltObjMatchToGens;
210  std::vector<std::vector<MonitorElement *>> etaphihists;
211  std::vector<std::vector<MonitorElement *>> etaphihistmatchs;
212  std::vector<std::vector<MonitorElement *>> histEtaPhiOfHltObjMatchToGens;
213  // Plots of efficiency per step
214  std::vector<MonitorElement *> totals;
215  std::vector<MonitorElement *> totalmatchs;
216  // generator histograms
217  std::vector<MonitorElement *> etgens;
218  std::vector<MonitorElement *> etagens;
219  std::vector<MonitorElement *> phigens;
220  std::vector<MonitorElement *> etaphigens;
221 
222  GreaterByPt<reco::Particle> pTComparator_;
223  GreaterByPt<reco::GenParticle> pTGenComparator_;
224 
225  // tokens for data access
226  edm::EDGetTokenT<edm::View<reco::Candidate>> genParticles_token;
227  edm::EDGetTokenT<trigger::TriggerEventWithRefs> triggerObject_token;
228  edm::EDGetTokenT<edm::TriggerResults> hltResults_token;
229  edm::EDGetTokenT<edm::View<reco::Candidate>> gencutColl_fidWenu_token;
230  edm::EDGetTokenT<edm::View<reco::Candidate>> gencutColl_fidZee_token;
231  edm::EDGetTokenT<edm::View<reco::Candidate>> gencutColl_fidTripleEle_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
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:51
Definition: EmDQM.h:67
example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
EmDQM * dqm
Definition: EmDQM.h:64
def makePSetForOneOEMinusOneOPFilter(self, moduleName)
~HistoFiller()
Definition: EmDQM.h:52
def makePSetForEgammaGenericFilter(self, module, moduleName)
std::vector< Electron > ElectronCollection
collectin of Electron objects
Definition: ElectronFwd.h:9
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...