CMS 3D CMS Logo

B2GDoubleLeptonHLTValidation.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: HLTriggerOffline/B2G
4 // Class: B2GDoubleLeptonHLTValidation
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
75  // Electrons
79  double ptElectrons_;
80  double etaElectrons_;
81  double isoElectrons_;
82  unsigned int minElectrons_;
83  // Muons
87  double ptMuons_;
88  double etaMuons_;
89  double isoMuons_;
90  unsigned int minMuons_;
91 
92  // leptons
93  unsigned int minLeptons_;
94 
95  // Trigger
98  std::vector<std::string> vsPaths_;
99  // Flags
100  bool isAll_ = false;
101  bool isSel_ = false;
102 };
103 
104 inline void B2GDoubleLeptonHLTValidation::triggerBinLabels(const std::vector<std::string> &labels) {
105  for (unsigned int idx = 0; idx < labels.size(); ++idx) {
106  hNumTriggerMon->setBinLabel(idx + 1, "[" + monitorPath(labels[idx]) + "]", 1);
107  hDenTriggerMon->setBinLabel(idx + 1, "[" + monitorPath(labels[idx]) + "]", 1);
108  }
109 }
110 
111 //
112 // constants, enums and typedefs
113 //
114 
115 //
116 // static data member definitions
117 //
118 
119 //
120 // constructors and destructor
121 //
123  : sDir_(iConfig.getUntrackedParameter<std::string>("sDir", "HLTValidation/B2G/Efficiencies/")),
124  sElectrons_(iConfig.getUntrackedParameter<std::string>("sElectrons", "gsfElectrons")),
125  ptElectrons_(iConfig.getUntrackedParameter<double>("ptElectrons", 0.)),
126  etaElectrons_(iConfig.getUntrackedParameter<double>("etaElectrons", 0.)),
127  isoElectrons_(iConfig.getUntrackedParameter<double>("isoElectrons", 0.)),
128  minElectrons_(iConfig.getUntrackedParameter<unsigned int>("minElectrons", 0)),
129  sMuons_(iConfig.getUntrackedParameter<std::string>("sMuons", "muons")),
130  ptMuons_(iConfig.getUntrackedParameter<double>("ptMuons", 0.)),
131  etaMuons_(iConfig.getUntrackedParameter<double>("etaMuons", 0.)),
132  isoMuons_(iConfig.getUntrackedParameter<double>("isoMuons", 0.)),
133  minMuons_(iConfig.getUntrackedParameter<unsigned int>("minMuons", 0)),
134  minLeptons_(iConfig.getUntrackedParameter<unsigned int>("minLeptons", 0)),
135  sTrigger_(iConfig.getUntrackedParameter<std::string>("sTrigger", "TriggerResults")),
136  vsPaths_(iConfig.getUntrackedParameter<std::vector<std::string>>("vsPaths"))
137 
138 {
139  // Electrons
140  tokElectrons_ = consumes<edm::View<reco::GsfElectron>>(edm::InputTag(sElectrons_));
141  // Muons
142  tokMuons_ = consumes<edm::View<reco::Muon>>(edm::InputTag(sMuons_));
143  // Trigger
144  tokTrigger_ = consumes<edm::TriggerResults>(edm::InputTag(sTrigger_, "", "HLT"));
145 }
146 
148  // do anything here that needs to be done at desctruction time
149  // (e.g. close files, deallocate resources etc.)
150 }
151 #endif
152 
153 // define this as a plug-in
void triggerBinLabels(const std::vector< std::string > &labels)
set configurable labels for trigger monitoring histograms
edm::EDGetTokenT< edm::TriggerResults > tokTrigger_
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::EDGetTokenT< edm::View< reco::Muon > > tokMuons_
edm::EDGetTokenT< edm::View< reco::GsfElectron > > tokElectrons_
char const * label
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::Ptr< reco::GsfElectron > elec_
B2GDoubleLeptonHLTValidation(const edm::ParameterSet &)
void analyze(const edm::Event &, const edm::EventSetup &) override
std::string monitorPath(const std::string &label) const
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: Run.h:45