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  void beginJob();
80  void endJob();
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 endRun(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&);
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 
185  unsigned int gencut_;
186 
188  std::vector<std::set<std::string> > hltCollectionLabelsFoundPerPath;
189  std::set<std::string> hltCollectionLabelsFound;
190 
192  std::vector<std::set<std::string> > hltCollectionLabelsMissedPerPath;
193  std::set<std::string> hltCollectionLabelsMissed;
194 
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:895
def makePSetForL1SeedToSuperClusterMatchFilter(self, moduleName)
def makePSetForEtFilter(self, moduleName)
def analyze(function, filename, filter=None)
Definition: Profiling.py:11
HistoFiller(EmDQM *d)
Definition: EmDQM.h:53
Definition: EmDQM.h:63
void bookHistograms(fwlite::EventContainer &eventCont)
EmDQM * dqm
Definition: EmDQM.h:60
void beginJob()
Definition: Breakpoints.cc:15
def makePSetForOneOEMinusOneOPFilter(self, moduleName)
~HistoFiller()
Definition: EmDQM.h:54
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...