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