CMS 3D CMS Logo

TopSingleLeptonHLTOfflineDQM.h
Go to the documentation of this file.
1 #ifndef TOPSINGLELEPTONHLTOFFLINEDQM
2 #define TOPSINGLELEPTONHLTOFFLINEDQM
3 
4 #include <string>
5 #include <vector>
6 #include <memory>
7 
11 
20 
23 
25 
26 /*Originally from DQM/Physics by R. Wolf and J. Andrea*/
27 
46 
48  public:
49 
50  public:
54  ~MonitorSingleLepton()= default;;
55 
57  void book(DQMStore::IBooker& store_);
59  void fill(const edm::Event& event, const edm::EventSetup& setup, const HLTConfigProvider& hltConfig, const std::vector<std::string>& triggerPaths);
60 
61  private:
64  std::string monitorPath(const std::string& label) const { return label.substr(label.find(':')+1); };
67  std::string selectionPath(const std::string& label) const { return label.substr(0, label.find(':')); };
68 
70  void triggerBinLabels(const std::string& channel, const std::vector<std::string>& labels);
72  void fill(const edm::Event& event, const edm::TriggerResults& triggerTable, const std::string& channel, const std::vector<std::string>& labels) const;
73 
75  bool booked(const std::string& histName) const { return hists_.find(histName)!=hists_.end(); };
77  void fill(const std::string& histName, double value) const { if(booked(histName)) hists_.find(histName)->second->Fill(value); };
79  void fill(const std::string& histName, double xValue, double yValue) const { if(booked(histName)) hists_.find(histName)->second->Fill(xValue, yValue); };
81  void fill(const std::string& histName, double xValue, double yValue, double zValue) const { if(booked(histName)) hists_.find(histName)->second->Fill(xValue, yValue, zValue); };
82 
83  private:
88  std::vector< edm::EDGetTokenT< edm::View<reco::MET> > > mets_;
94 
97 // edm::EDGetTokenT< trigger::TriggerEventWithRefs > triggerEventWithRefsTag_;
101 
102 
105  std::vector<std::string> triggerPaths_;
106 
121  std::unique_ptr<StringCutObjectSelector<reco::GsfElectron>> elecIso_;
123  std::unique_ptr<StringCutObjectSelector<reco::GsfElectron>> elecSelect_;
124 
126  std::unique_ptr<StringCutObjectSelector<reco::Vertex>> pvSelect_;
127 
129  std::unique_ptr<StringCutObjectSelector<reco::Muon>> muonIso_;
131  std::unique_ptr<StringCutObjectSelector<reco::Muon>> muonSelect_;
132 
138  std::unique_ptr<StringCutObjectSelector<reco::JetID>> jetIDSelect_;
153 
155  int logged_;
157  std::map<std::string,MonitorElement*> hists_;
158 
167  };
168 
169  inline void
170  MonitorSingleLepton::triggerBinLabels(const std::string& channel, const std::vector<std::string>& labels)
171  {
172  for(unsigned int idx=0; idx<labels.size(); ++idx){
173  hists_[channel+"Mon_"]->setBinLabel( idx+1, "["+monitorPath(labels[idx])+"]", 1);
174  }
175  }
176 
177  inline void
178  MonitorSingleLepton::fill(const edm::Event& event, const edm::TriggerResults& triggerTable, const std::string& channel, const std::vector<std::string>& labels) const
179  {
180  for(unsigned int idx=0; idx<labels.size(); ++idx){
181  if( acceptHLT(event, triggerTable, monitorPath(labels[idx])) ){
182  fill(channel+"Mon_", idx+0.5 );
183  }
184  }
185  }
186 
187 }
188 
189 #include <utility>
190 
196 
202 
228 //using HLTOfflineDQMTopSingleLepton::MonitorSingleLepton;
230 
232  public:
235 
237  void dqmBeginRun(const edm::Run& r, const edm::EventSetup& c) override;
238  void analyze(const edm::Event& event, const edm::EventSetup& setup) override;
239  void bookHistograms(DQMStore::IBooker &i, edm::Run const&, edm::EventSetup const&) override;
240 
241  private:
244  std::string objectType(const std::string& label) { return label.substr(0, label.find(':')); };
247  std::string selectionStep(const std::string& label) { return label.substr(label.find(':')+1); };
248 
249  private:
253  std::vector<std::string> triggerPaths_;
257  std::unique_ptr<StringCutObjectSelector<reco::Vertex>> vertexSelect_;
258 
262  std::unique_ptr<StringCutObjectSelector<reco::BeamSpot>> beamspotSelect_;
263 
265 
266 
267 
270  std::vector<std::string> selectionOrder_;
276  std::map<std::string, std::pair<edm::ParameterSet, std::unique_ptr<HLTOfflineDQMTopSingleLepton::MonitorSingleLepton>> > selection_;
277 
278  std::map<std::string, std::unique_ptr<SelectionStepHLTBase>> selectmap_;
279 };
280 
281 #endif
edm::EDGetTokenT< trigger::TriggerEventWithRefs > triggerSummaryTokenAOD
std::unique_ptr< StringCutObjectSelector< reco::GsfElectron > > elecSelect_
extra selection on electrons
define MonitorSingleLepton to be used
std::string monitorPath(const std::string &label) const
def analyze(function, filename, filter=None)
Definition: Profiling.py:11
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
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:1
std::map< std::string, MonitorElement * > hists_
histogram container
edm::EDGetTokenT< reco::JetTagCollection > btagPur_
edm::EDGetTokenT< edm::View< reco::GsfElectron > > elecs_
input sources for monitoring
std::unique_ptr< StringCutObjectSelector< reco::BeamSpot > > beamspotSelect_
string cut selector
edm::EDGetTokenT< reco::JetIDValueMap > jetIDLabel_
jetID as an extra selection type
std::vector< edm::EDGetTokenT< edm::View< reco::MET > > > mets_
considers a vector of METs
void book(DQMStore::IBooker &store_)
book histograms in subdirectory directory
std::vector< std::string > selectionOrder_
void bookHistograms(fwlite::EventContainer &eventCont)
std::unique_ptr< StringCutObjectSelector< reco::Muon > > muonIso_
extra isolation criterion on muon
MonitorSingleLepton(const char *label, const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)
default contructor
edm::EDGetTokenT< edm::TriggerResults > triggerTable_
trigger table
void triggerBinLabels(const std::string &channel, const std::vector< std::string > &labels)
set configurable labels for trigger monitoring histograms
edm::EDGetTokenT< std::vector< reco::Vertex > > vertex_
primary vertex
edm::EDGetTokenT< edm::View< reco::Muon > > muons_
void fill(const std::string &histName, double value) const
fill histogram if it had been booked before
edm::EDGetTokenT< reco::JetTagCollection > btagEff_
btag discriminator labels
Definition: value.py:1
edm::EDGetTokenT< trigger::TriggerEventWithRefs > triggerSummaryTokenRAW
edm::EDGetTokenT< edm::View< reco::Vertex > > pvs_
std::unique_ptr< StringCutObjectSelector< reco::JetID > > jetIDSelect_
extra jetID selection on calo jets
std::vector< std::string > triggerPaths_
trigger paths
edm::EDGetTokenT< reco::BeamSpot > beamspot_
beamspot
bool acceptHLT(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
std::vector< reco::PFJetRef > VRpfjet
edm::EDGetTokenT< edm::View< reco::Jet > > jets_
bool booked(const std::string &histName) const
check if histogram was booked
std::string selectionPath(const std::string &label) const
std::vector< reco::RecoChargedCandidateRef > VRmuon
std::map< std::string, std::pair< edm::ParameterSet, std::unique_ptr< HLTOfflineDQMTopSingleLepton::MonitorSingleLepton > > > selection_
std::string objectType(const std::string &label)
std::unique_ptr< StringCutObjectSelector< reco::Muon > > muonSelect_
extra selection on muons
std::map< std::string, std::unique_ptr< SelectionStepHLTBase > > selectmap_
edm::EDGetTokenT< edm::TriggerResults > triggerTable_
trigger table
std::unique_ptr< StringCutObjectSelector< reco::Vertex > > pvSelect_
extra selection on primary vertices; meant to investigate the pile-up effect
~MonitorSingleLepton()=default
default destructor
std::vector< reco::ElectronRef > VRelectron
std::unique_ptr< StringCutObjectSelector< reco::GsfElectron > > elecIso_
extra isolation criterion on electron
edm::EDGetTokenT< reco::JetTagCollection > btagVtx_
edm::EDGetTokenT< edm::ValueMap< float > > electronId_
electronId label
static std::string const triggerPaths
Definition: EdmProvDump.cc:42
std::vector< int > Vids
Definition: event.py:1
std::unique_ptr< StringCutObjectSelector< reco::Vertex > > vertexSelect_
string cut selector
Definition: Run.h:43
void fill(const std::string &histName, double xValue, double yValue) const
fill histogram if it had been booked before (2-dim version)