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 
38 
44 
45 //
46 // class declaration
47 //
48 
50 public:
53 
54  static void fillDescriptions(edm::ConfigurationDescriptions &descriptions);
55 
56 private:
57  void analyze(const edm::Event &, const edm::EventSetup &) override;
58  void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override;
61  std::string monitorPath(const std::string &label) const { return label.substr(label.find(':') + 1); };
63  void triggerBinLabels(const std::vector<std::string> &labels);
64 
65  // ----------member data ---------------------------
66  // DQM
78  // Electrons
82  double ptElectrons_;
83  double etaElectrons_;
84  double isoElectrons_;
85  unsigned int minElectrons_;
86  // Muons
90  double ptMuons_;
91  double etaMuons_;
92  double isoMuons_;
93  unsigned int minMuons_;
94  // Jets
98  double ptJets_;
99  double ptJets0_;
100  double ptJets1_;
101  double etaJets_;
102  unsigned int minJets_;
103  // Trigger
106  std::vector<std::string> vsPaths_;
107  // Flags
108  bool isAll_ = false;
109  bool isSel_ = false;
110 };
111 
112 inline void B2GSingleLeptonHLTValidation::triggerBinLabels(const std::vector<std::string> &labels) {
113  for (unsigned int idx = 0; idx < labels.size(); ++idx) {
114  hNumTriggerMon->setBinLabel(idx + 1, "[" + monitorPath(labels[idx]) + "]", 1);
115  hDenTriggerMon->setBinLabel(idx + 1, "[" + monitorPath(labels[idx]) + "]", 1);
116  }
117 }
118 
119 //
120 // constants, enums and typedefs
121 //
122 
123 //
124 // static data member definitions
125 //
126 
127 //
128 // constructors and destructor
129 //
131  : sDir_(iConfig.getUntrackedParameter<std::string>("sDir", "HLTValidation/B2G/Efficiencies/")),
132  sElectrons_(iConfig.getUntrackedParameter<std::string>("sElectrons", "gsfElectrons")),
133  ptElectrons_(iConfig.getUntrackedParameter<double>("ptElectrons", 0.)),
134  etaElectrons_(iConfig.getUntrackedParameter<double>("etaElectrons", 0.)),
135  isoElectrons_(iConfig.getUntrackedParameter<double>("isoElectrons", 0.)),
136  minElectrons_(iConfig.getUntrackedParameter<unsigned int>("minElectrons", 0)),
137  sMuons_(iConfig.getUntrackedParameter<std::string>("sMuons", "muons")),
138  ptMuons_(iConfig.getUntrackedParameter<double>("ptMuons", 0.)),
139  etaMuons_(iConfig.getUntrackedParameter<double>("etaMuons", 0.)),
140  isoMuons_(iConfig.getUntrackedParameter<double>("isoMuons", 0.)),
141  minMuons_(iConfig.getUntrackedParameter<unsigned int>("minMuons", 0)),
142  sJets_(iConfig.getUntrackedParameter<std::string>("sJets", "ak5PFJets")),
143  ptJets_(iConfig.getUntrackedParameter<double>("ptJets", 0.)),
144  ptJets0_(iConfig.getUntrackedParameter<double>("ptJets0", 0.)),
145  ptJets1_(iConfig.getUntrackedParameter<double>("ptJets1", 0.)),
146  etaJets_(iConfig.getUntrackedParameter<double>("etaJets", 0.)),
147  minJets_(iConfig.getUntrackedParameter<unsigned int>("minJets", 0)),
148  sTrigger_(iConfig.getUntrackedParameter<std::string>("sTrigger", "TriggerResults")),
149  vsPaths_(iConfig.getUntrackedParameter<std::vector<std::string>>("vsPaths"))
150 
151 {
152  // Electrons
153  tokElectrons_ = consumes<edm::View<reco::GsfElectron>>(edm::InputTag(sElectrons_));
154  // Muons
155  tokMuons_ = consumes<edm::View<reco::Muon>>(edm::InputTag(sMuons_));
156  // Jets
157  tokJets_ = consumes<edm::View<reco::Jet>>(edm::InputTag(sJets_));
158  // Trigger
159  tokTrigger_ = consumes<edm::TriggerResults>(edm::InputTag(sTrigger_, "", "HLT"));
160 }
161 
163  // do anything here that needs to be done at desctruction time
164  // (e.g. close files, deallocate resources etc.)
165 }
166 #endif
167 
168 // define this as a plug-in
B2GSingleLeptonHLTValidation(const edm::ParameterSet &)
edm::EDGetTokenT< edm::View< reco::Muon > > tokMuons_
edm::EDGetTokenT< edm::View< reco::Jet > > tokJets_
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::Ptr< reco::GsfElectron > elec_
char const * label
edm::EDGetTokenT< edm::TriggerResults > tokTrigger_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
virtual 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)
std::string monitorPath(const std::string &label) const
edm::EDGetTokenT< edm::View< reco::GsfElectron > > tokElectrons_
void analyze(const edm::Event &, const edm::EventSetup &) override
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