CMS 3D CMS Logo

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