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 <math.h>
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();
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  unsigned int minEtForEtaEffPlot_;
112  bool useHumanReadableHistTitles_;
113  bool mcMatchedOnly_;
114  bool noPhiPlots_;
115  bool noIsolationPlots_;
116 
123  bool checkGeneratedParticlesRequirement(const edm::Event &event);
124 
129  bool checkRecoParticlesRequirement(const edm::Event & event);
130 
132  HLTConfigProvider hltConfig_;
133 
134  // routines to build validation configuration from HLTConfiguration
135  int countSubstring(const std::string&, const std::string&);
136  std::vector<std::vector<std::string> > findEgammaPaths();
137  std::vector<std::string> getFilterModules(const std::string&);
138  double getPrimaryEtCut(const std::string&);
139  edm::ParameterSet makePSetForL1SeedFilter(const std::string&);
141  edm::ParameterSet makePSetForEtFilter(const std::string&);
145  edm::ParameterSet makePSetForEgammaGenericQuadraticFilter(const std::string&);
147  edm::ParameterSet makePSetForEgammaDoubleEtDeltaPhiFilter(const std::string&);
148 
149  // set validation configuration parameters for a trigger path
150  void SetVarsFromPSet(std::vector<edm::ParameterSet>::iterator);
151 
152  // generated parameter set for trigger path
153  std::vector<edm::ParameterSet> paramSets;
154  // input from generated parameter set
155  unsigned int pathIndex;
156  std::vector<edm::InputTag> theHLTCollectionLabels;
157  unsigned int numOfHLTCollectionLabels; // Will be size of above vector
158  std::vector<std::string> theHLTCollectionHumanNames; // Human-readable names for the collections
159  edm::InputTag theL1Seed;
160  std::vector<int> theHLTOutputTypes;
161  std::vector<bool> plotiso;
162  std::vector<std::vector<edm::InputTag> > isoNames; // there has to be a better solution
163  std::vector<std::pair<double,double> > plotBounds;
164  std::vector<unsigned int> nCandCuts;
165  // paramters for generator study
166  unsigned int reqNum;
168  // plotting parameters
169  double plotEtMin;
170  double plotPtMin ;
171  double plotPtMax ;
172 
179  edm::InputTag gencutCollection_;
180 
182  unsigned int gencut_;
183 
185  std::vector<std::set<std::string> > hltCollectionLabelsFoundPerPath;
186  std::set<std::string> hltCollectionLabelsFound;
187 
189  std::vector<std::set<std::string> > hltCollectionLabelsMissedPerPath;
190  std::set<std::string> hltCollectionLabelsMissed;
191 
192 
194  // Create Histogram containers
196  // Et & eta distributions
197  std::vector<std::vector<MonitorElement*> > etahists;
198  std::vector<std::vector<MonitorElement*> > phihists;
199  std::vector<std::vector<MonitorElement*> > ethists;
200  std::vector<std::vector<MonitorElement*> > etahistmatchs;
201  std::vector<std::vector<MonitorElement*> > phihistmatchs;
202  std::vector<std::vector<MonitorElement*> > ethistmatchs;
203  std::vector<std::vector<MonitorElement*> > histEtOfHltObjMatchToGens;
204  std::vector<std::vector<MonitorElement*> > histEtaOfHltObjMatchToGens;
205  std::vector<std::vector<MonitorElement*> > histPhiOfHltObjMatchToGens;
206  // Plots of efficiency per step
207  std::vector<MonitorElement*> totals;
208  std::vector<MonitorElement*> totalmatchs;
209  //generator histograms
210  std::vector<MonitorElement*> etgens;
211  std::vector<MonitorElement*> etagens;
212  std::vector<MonitorElement*> phigens;
213 
214  GreaterByPt<reco::Particle> pTComparator_;
215  GreaterByPt<reco::GenParticle> pTGenComparator_;
216 
217  // tokens for data access
218  edm::EDGetTokenT<edm::View<reco::Candidate> > genParticles_token;
219  edm::EDGetTokenT<trigger::TriggerEventWithRefs> triggerObject_token;
220  edm::EDGetTokenT<edm::TriggerResults> hltResults_token;
221  edm::EDGetTokenT<edm::View<reco::Candidate> > gencutColl_fidWenu_token;
222  edm::EDGetTokenT<edm::View<reco::Candidate> > gencutColl_fidZee_token;
223  edm::EDGetTokenT<edm::View<reco::Candidate> > gencutColl_fidTripleEle_token;
224  edm::EDGetTokenT<edm::View<reco::Candidate> > gencutColl_fidGammaJet_token;
225  edm::EDGetTokenT<edm::View<reco::Candidate> > gencutColl_fidDiGamma_token;
226  edm::EDGetTokenT<edm::View<reco::Candidate> > gencutColl_manualConf_token;
227 
228  // static variables
229  //
230  // trigger types considered
231  static const unsigned TYPE_SINGLE_ELE = 0;
232  static const unsigned TYPE_DOUBLE_ELE = 1;
233  static const unsigned TYPE_SINGLE_PHOTON = 2;
234  static const unsigned TYPE_DOUBLE_PHOTON = 3;
235  static const unsigned TYPE_TRIPLE_ELE = 4;
236 
237  // verbosity levels
238  static const unsigned OUTPUT_SILENT = 0;
239  static const unsigned OUTPUT_ERRORS = 1;
240  static const unsigned OUTPUT_WARNINGS = 2;
241  static const unsigned OUTPUT_ALL = 3;
242 };
243 #endif
void fillHistos(edm::Handle< trigger::TriggerEventWithRefs > &, const edm::Event &, unsigned int, unsigned int, std::vector< reco::Particle > &, bool &)
Definition: EmDQM.cc:866
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...