CMS 3D CMS Logo

TopDiLeptonHLTOfflineDQM.h
Go to the documentation of this file.
1 #ifndef TOPDILEPTONHLTOFFLINEDQM
2 #define TOPDILEPTONHLTOFFLINEDQM
3 
4 #include <string>
5 #include <vector>
6 
10 
19 
22 
24 
25 //*Originally from DQM/Physics by R. Wolf and J. Andrea*/
26 
45 
47  public:
53 
54  public:
59 
61  void book(DQMStore::IBooker& store_);
63  void fill(const edm::Event& event, const edm::EventSetup& setup, const HLTConfigProvider& hltConfig, const std::vector<std::string> triggerPaths);
64 
65  private:
68  std::string monitorPath(const std::string& label) const { return label.substr(label.find(':')+1); };
71  std::string selectionPath(const std::string& label) const { return label.substr(0, label.find(':')); };
72 
76  void triggerBinLabels(std::string channel, const std::vector<std::string>& labels);
78  void fill(const edm::Event& event, const edm::TriggerResults& triggerTable, std::string channel, const std::vector<std::string>& labels) const;
79 
81  bool booked(const std::string histName) const { return hists_.find(histName.c_str())!=hists_.end(); };
83  void fill(const std::string histName, double value) const { if(booked(histName.c_str())) hists_.find(histName.c_str())->second->Fill(value); };
85  void fill(const std::string histName, double xValue, double yValue) const { if(booked(histName.c_str())) hists_.find(histName.c_str())->second->Fill(xValue, yValue); };
87  void fill(const std::string histName, double xValue, double yValue, double zValue) const { if(booked(histName.c_str())) hists_.find(histName.c_str())->second->Fill(xValue, yValue, zValue); };
88 
89  private:
98  std::vector< edm::EDGetTokenT< edm::View<reco::MET> > > mets_;
99 
102 // edm::EDGetTokenT< trigger::TriggerEventWithRefs > triggerEventWithRefsTag_;
106 
109  std::vector<std::string> elecMuPaths_;
111  std::vector<std::string> diMuonPaths_;
113  std::vector<std::string> diElecPaths_;
114 
132 
137 
149 
153  std::map<std::string,MonitorElement*> hists_;
154 
161  };
162 
163  inline void
165  {
166  // set axes titles for selected events
167  hists_[hist.c_str()]->getTH1()->SetOption("TEXT");
168  hists_[hist.c_str()]->setBinLabel( 1 , "Run" , 1);
169  hists_[hist.c_str()]->setBinLabel( 2 , "Block" , 1);
170  hists_[hist.c_str()]->setBinLabel( 3 , "Event" , 1);
171  hists_[hist.c_str()]->setBinLabel( 6 , "pt_{L2L3}(jet1)" , 1);
172  hists_[hist.c_str()]->setBinLabel( 7 , "pt_{L2L3}(jet2)" , 1);
173  hists_[hist.c_str()]->setBinLabel( 8 , "MET_{Calo}" , 1);
174  hists_[hist.c_str()]->setAxisTitle("logged evts" , 2);
175 
176  if(hist=="diMuonLogger_"){
177  hists_[hist.c_str()]->setBinLabel( 4 , "pt(muon)" , 1);
178  hists_[hist.c_str()]->setBinLabel( 5 , "pt(muon)" , 1);
179  }
180  if(hist=="diElecLogger_"){
181  hists_[hist.c_str()]->setBinLabel( 4 , "pt(elec)" , 1);
182  hists_[hist.c_str()]->setBinLabel( 5 , "pt(elec)" , 1);
183  }
184  if(hist=="elecMuLogger_"){
185  hists_[hist.c_str()]->setBinLabel( 4 , "pt(elec)" , 1);
186  hists_[hist.c_str()]->setBinLabel( 5 , "pt(muon)" , 1);
187  }
188  }
189 
190  inline void
191  MonitorDiLepton::triggerBinLabels(std::string channel, const std::vector<std::string>& labels)
192  {
193  for(unsigned int idx=0; idx<labels.size(); ++idx){
194  hists_[(channel+"Mon_").c_str()]->setBinLabel( idx+1, "["+monitorPath(labels[idx])+"]", 1);
195  }
196  }
197 
198  inline void
199  MonitorDiLepton::fill(const edm::Event& event, const edm::TriggerResults& triggerTable, std::string channel, const std::vector<std::string>& labels) const
200  {
201  for(unsigned int idx=0; idx<labels.size(); ++idx){
202  if( acceptHLT(event, triggerTable, monitorPath(labels[idx])) ){
203  fill((channel+"Mon_").c_str(), idx+0.5 );
204  }
205  }
206  }
207 
208 }
209 
210 #include <utility>
211 
216 
222 
223 
249 //using TopDiLeptonOffline::MonitorDiLepton;
251 
253  public:
258  if( beamspotSelect_ ) delete beamspotSelect_;
259  if( vertexSelect_ ) delete vertexSelect_;
260  }
261 
263  virtual void dqmBeginRun(const edm::Run& r, const edm::EventSetup& c) override;
264  virtual void analyze(const edm::Event& event, const edm::EventSetup& setup) override;
265  void bookHistograms(DQMStore::IBooker &i, edm::Run const&, edm::EventSetup const&) override;
266 
267  private:
270  std::string objectType(const std::string& label) { return label.substr(0, label.find(':')); };
273  std::string selectionStep(const std::string& label) { return label.substr(label.find(':')+1); };
274 
275  private:
279  std::vector<std::string> triggerPaths_;
288 
290 
293  std::vector<std::string> selectionOrder_;
299  std::map<std::string, std::pair<edm::ParameterSet, HLTOfflineDQMTopDiLepton::MonitorDiLepton*> > selection_;
300 
301  std::map<std::string, SelectionStepHLTBase*> selectmap_;
302 };
303 
304 #endif
std::string monitorPath(const std::string &label) const
double lowerEdge_
mass window upper and lower edge
StringCutObjectSelector< reco::Muon > * muonSelect_
extra selection on muons
edm::EDGetTokenT< reco::BeamSpot > beamspot_
beamspot
StringCutObjectSelector< reco::GsfElectron > * elecSelect_
extra selection on electrons
def analyze(function, filename, filter=None)
Definition: Profiling.py:11
std::string selectionPath(const std::string &label) const
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:1
int elecMuLogged_
number of logged interesting events
edm::EDGetTokenT< edm::View< reco::GsfElectron > > elecs_
input sources for monitoring
bool booked(const std::string histName) const
check if histogram was booked
StringCutObjectSelector< reco::GsfElectron > * elecIso_
extra isolation criterion on electron
edm::EDGetTokenT< edm::View< reco::Jet > > jets_
void bookHistograms(fwlite::EventContainer &eventCont)
edm::EDGetTokenT< reco::JetIDValueMap > jetIDLabel_
jetID as an extra selection type
std::vector< std::string > triggerPaths_
trigger paths
std::vector< edm::EDGetTokenT< edm::View< reco::MET > > > mets_
considers a vector of METs
std::map< std::string, SelectionStepHLTBase * > selectmap_
std::vector< std::string > diMuonPaths_
trigger paths for di muon channel
U second(std::pair< T, U > const &p)
void fill(const std::string histName, double value) const
fill histogram if it had been booked before
reco::LeafCandidate::LorentzVector LorentzVector
StringCutObjectSelector< reco::BeamSpot > * beamspotSelect_
string cut selector
void loggerBinLabels(std::string hist)
set labels for event logging histograms
std::vector< std::string > diElecPaths_
trigger paths for di electron channel
edm::EDGetTokenT< trigger::TriggerEventWithRefs > triggerSummaryTokenAOD
Definition: value.py:1
edm::EDGetTokenT< edm::TriggerResults > triggerTable_
trigger table
std::map< std::string, MonitorElement * > hists_
histogram container
void fill(const edm::Event &event, const edm::EventSetup &setup, const HLTConfigProvider &hltConfig, const std::vector< std::string > triggerPaths)
fill monitor histograms with electronId and jetCorrections
MonitorDiLepton(const char *label, const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)
default contructor
void triggerBinLabels(std::string channel, const std::vector< std::string > &labels)
set configurable labels for trigger monitoring histograms
std::map< std::string, std::pair< edm::ParameterSet, HLTOfflineDQMTopDiLepton::MonitorDiLepton * > > selection_
~TopDiLeptonHLTOfflineDQM()
default destructor
bool acceptHLT(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
std::vector< std::string > selectionOrder_
void book(DQMStore::IBooker &store_)
book histograms in subdirectory directory
std::string objectType(const std::string &label)
std::vector< reco::RecoChargedCandidateRef > VRmuon
void fill(const std::string histName, double xValue, double yValue) const
fill histogram if it had been booked before (2-dim version)
edm::EDGetTokenT< edm::ValueMap< float > > electronId_
electronId label
define MonitorDiLepton to be used
edm::EDGetTokenT< trigger::TriggerEventWithRefs > triggerSummaryTokenRAW
std::vector< reco::ElectronRef > VRelectron
edm::EDGetTokenT< edm::View< reco::Muon > > muons_
edm::EDGetTokenT< std::vector< reco::Vertex > > vertex_
primary vertex
static std::string const triggerPaths
Definition: EdmProvDump.cc:42
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: LeafCandidate.h:23
edm::EDGetTokenT< edm::TriggerResults > triggerTable_
trigger table
std::vector< int > Vids
StringCutObjectSelector< reco::Muon > * muonIso_
extra isolation criterion on muon
Definition: event.py:1
Definition: Run.h:42
StringCutObjectSelector< reco::JetID > * jetIDSelect_
extra jetID selection on calo jets
StringCutObjectSelector< reco::Vertex > * vertexSelect_
string cut selector