CMS 3D CMS Logo

B2GSingleLeptonHLTValidation.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: HLTriggerOffline/B2G
4 // Class: B2GSingleLeptonHLTValidation
5 //
15 //
16 // Original Author: Elvire Bouvier
17 // Created: Thu, 16 Jan 2014 16:27:35 GMT
18 //
19 //
20 #ifndef B2GSINGLELEPTONHLTVALIDATION
21 #define B2GSINGLELEPTONHLTVALIDATION
22 
23 // system include files
24 #include <memory>
25 
26 // user include files
29 
32 
36 
39 
45 
46 //
47 // class declaration
48 //
49 
51 public:
54 
55  static void fillDescriptions(edm::ConfigurationDescriptions &descriptions);
56 
57 private:
58  void analyze(const edm::Event &, const edm::EventSetup &) override;
59  void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override;
62  std::string monitorPath(const std::string &label) const { return label.substr(label.find(':') + 1); };
64  void triggerBinLabels(const std::vector<std::string> &labels);
65 
66  // ----------member data ---------------------------
67  // DQM
79  // Electrons
83  double ptElectrons_;
84  double etaElectrons_;
85  double isoElectrons_;
86  unsigned int minElectrons_;
87  // Muons
91  double ptMuons_;
92  double etaMuons_;
93  double isoMuons_;
94  unsigned int minMuons_;
95  // Jets
99  double ptJets_;
100  double ptJets0_;
101  double ptJets1_;
102  double etaJets_;
103  unsigned int minJets_;
104  // Trigger
107  std::vector<std::string> vsPaths_;
108  // Flags
109  bool isAll_ = false;
110  bool isSel_ = false;
111 };
112 
113 inline void B2GSingleLeptonHLTValidation::triggerBinLabels(const std::vector<std::string> &labels) {
114  for (unsigned int idx = 0; idx < labels.size(); ++idx) {
115  hNumTriggerMon->setBinLabel(idx + 1, "[" + monitorPath(labels[idx]) + "]", 1);
116  hDenTriggerMon->setBinLabel(idx + 1, "[" + monitorPath(labels[idx]) + "]", 1);
117  }
118 }
119 
120 //
121 // constants, enums and typedefs
122 //
123 
124 //
125 // static data member definitions
126 //
127 
128 //
129 // constructors and destructor
130 //
132  : sDir_(iConfig.getUntrackedParameter<std::string>("sDir", "HLTValidation/B2G/Efficiencies/")),
133  sElectrons_(iConfig.getUntrackedParameter<std::string>("sElectrons", "gsfElectrons")),
134  ptElectrons_(iConfig.getUntrackedParameter<double>("ptElectrons", 0.)),
135  etaElectrons_(iConfig.getUntrackedParameter<double>("etaElectrons", 0.)),
136  isoElectrons_(iConfig.getUntrackedParameter<double>("isoElectrons", 0.)),
137  minElectrons_(iConfig.getUntrackedParameter<unsigned int>("minElectrons", 0)),
138  sMuons_(iConfig.getUntrackedParameter<std::string>("sMuons", "muons")),
139  ptMuons_(iConfig.getUntrackedParameter<double>("ptMuons", 0.)),
140  etaMuons_(iConfig.getUntrackedParameter<double>("etaMuons", 0.)),
141  isoMuons_(iConfig.getUntrackedParameter<double>("isoMuons", 0.)),
142  minMuons_(iConfig.getUntrackedParameter<unsigned int>("minMuons", 0)),
143  sJets_(iConfig.getUntrackedParameter<std::string>("sJets", "ak5PFJets")),
144  ptJets_(iConfig.getUntrackedParameter<double>("ptJets", 0.)),
145  ptJets0_(iConfig.getUntrackedParameter<double>("ptJets0", 0.)),
146  ptJets1_(iConfig.getUntrackedParameter<double>("ptJets1", 0.)),
147  etaJets_(iConfig.getUntrackedParameter<double>("etaJets", 0.)),
148  minJets_(iConfig.getUntrackedParameter<unsigned int>("minJets", 0)),
149  sTrigger_(iConfig.getUntrackedParameter<std::string>("sTrigger", "TriggerResults")),
150  vsPaths_(iConfig.getUntrackedParameter<std::vector<std::string>>("vsPaths"))
151 
152 {
153  // Electrons
154  tokElectrons_ = consumes<edm::View<reco::GsfElectron>>(edm::InputTag(sElectrons_));
155  // Muons
156  tokMuons_ = consumes<edm::View<reco::Muon>>(edm::InputTag(sMuons_));
157  // Jets
158  tokJets_ = consumes<edm::View<reco::Jet>>(edm::InputTag(sJets_));
159  // Trigger
160  tokTrigger_ = consumes<edm::TriggerResults>(edm::InputTag(sTrigger_, "", "HLT"));
161 }
162 
164  // do anything here that needs to be done at desctruction time
165  // (e.g. close files, deallocate resources etc.)
166 }
167 #endif
168 
169 // define this as a plug-in
B2GSingleLeptonHLTValidation(const edm::ParameterSet &)
edm::EDGetTokenT< edm::View< reco::Muon > > tokMuons_
edm::EDGetTokenT< edm::View< reco::Jet > > tokJets_
void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
edm::Ptr< reco::GsfElectron > elec_
char const * label
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::EDGetTokenT< edm::TriggerResults > tokTrigger_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
edm::EDGetTokenT< edm::View< reco::GsfElectron > > tokElectrons_
void analyze(const edm::Event &, const edm::EventSetup &) override
std::string monitorPath(const std::string &label) const
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
void triggerBinLabels(const std::vector< std::string > &labels)
set configurable labels for trigger monitoring histograms
Definition: Run.h:45