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 #include <memory>
7 
11 
20 
23 
25 
26 //*Originally from DQM/Physics by R. Wolf and J. Andrea*/
27 
46 
48  public:
54 
55  public:
59  ~MonitorDiLepton()= default;;
60 
62  void book(DQMStore::IBooker& store_);
64  void fill(const edm::Event& event, const edm::EventSetup& setup, const HLTConfigProvider& hltConfig, const std::vector<std::string>& triggerPaths);
65 
66  private:
69  std::string monitorPath(const std::string& label) const { return label.substr(label.find(':')+1); };
72  std::string selectionPath(const std::string& label) const { return label.substr(0, label.find(':')); };
73 
75  void loggerBinLabels(const std::string& hist);
77  void triggerBinLabels(const std::string& channel, const std::vector<std::string>& labels);
79  void fill(const edm::Event& event, const edm::TriggerResults& triggerTable, const std::string& channel, const std::vector<std::string>& labels) const;
80 
82  bool booked(const std::string& histName) const { return hists_.find(histName)!=hists_.end(); };
84  void fill(const std::string& histName, double value) const { if(booked(histName)) hists_.find(histName)->second->Fill(value); };
86  void fill(const std::string& histName, double xValue, double yValue) const { if(booked(histName)) hists_.find(histName)->second->Fill(xValue, yValue); };
88  void fill(const std::string& histName, double xValue, double yValue, double zValue) const { if(booked(histName)) hists_.find(histName)->second->Fill(xValue, yValue, zValue); };
89 
90  private:
99  std::vector< edm::EDGetTokenT< edm::View<reco::MET> > > mets_;
100 
103 // edm::EDGetTokenT< trigger::TriggerEventWithRefs > triggerEventWithRefsTag_;
107 
110  std::vector<std::string> elecMuPaths_;
112  std::vector<std::string> diMuonPaths_;
114  std::vector<std::string> diElecPaths_;
115 
130  std::unique_ptr<StringCutObjectSelector<reco::GsfElectron>> elecIso_;
132  std::unique_ptr<StringCutObjectSelector<reco::GsfElectron>> elecSelect_;
133 
135  std::unique_ptr<StringCutObjectSelector<reco::Muon>> muonIso_;
137  std::unique_ptr<StringCutObjectSelector<reco::Muon>> muonSelect_;
138 
144  std::unique_ptr<StringCutObjectSelector<reco::JetID>> jetIDSelect_;
150 
154  std::map<std::string,MonitorElement*> hists_;
155 
162  };
163 
164  inline void
166  {
167  // set axes titles for selected events
168  hists_[hist]->getTH1()->SetOption("TEXT");
169  hists_[hist]->setBinLabel( 1 , "Run" , 1);
170  hists_[hist]->setBinLabel( 2 , "Block" , 1);
171  hists_[hist]->setBinLabel( 3 , "Event" , 1);
172  hists_[hist]->setBinLabel( 6 , "pt_{L2L3}(jet1)" , 1);
173  hists_[hist]->setBinLabel( 7 , "pt_{L2L3}(jet2)" , 1);
174  hists_[hist]->setBinLabel( 8 , "MET_{Calo}" , 1);
175  hists_[hist]->setAxisTitle("logged evts" , 2);
176 
177  if(hist=="diMuonLogger_"){
178  hists_[hist]->setBinLabel( 4 , "pt(muon)" , 1);
179  hists_[hist]->setBinLabel( 5 , "pt(muon)" , 1);
180  }
181  if(hist=="diElecLogger_"){
182  hists_[hist]->setBinLabel( 4 , "pt(elec)" , 1);
183  hists_[hist]->setBinLabel( 5 , "pt(elec)" , 1);
184  }
185  if(hist=="elecMuLogger_"){
186  hists_[hist]->setBinLabel( 4 , "pt(elec)" , 1);
187  hists_[hist]->setBinLabel( 5 , "pt(muon)" , 1);
188  }
189  }
190 
191  inline void
192  MonitorDiLepton::triggerBinLabels(const std::string& channel, const std::vector<std::string>& labels)
193  {
194  for(unsigned int idx=0; idx<labels.size(); ++idx){
195  hists_[channel+"Mon_"]->setBinLabel( idx+1, "["+monitorPath(labels[idx])+"]", 1);
196  }
197  }
198 
199  inline void
200  MonitorDiLepton::fill(const edm::Event& event, const edm::TriggerResults& triggerTable, const std::string& channel, const std::vector<std::string>& labels) const
201  {
202  for(unsigned int idx=0; idx<labels.size(); ++idx){
203  if( acceptHLT(event, triggerTable, monitorPath(labels[idx])) ){
204  fill(channel+"Mon_", idx+0.5 );
205  }
206  }
207  }
208 
209 }
210 
211 #include <utility>
212 
217 
223 
224 
250 //using TopDiLeptonOffline::MonitorDiLepton;
252 
254  public:
257 
259  void dqmBeginRun(const edm::Run& r, const edm::EventSetup& c) override;
260  void analyze(const edm::Event& event, const edm::EventSetup& setup) override;
261  void bookHistograms(DQMStore::IBooker &i, edm::Run const&, edm::EventSetup const&) override;
262 
263  private:
266  std::string objectType(const std::string& label) { return label.substr(0, label.find(':')); };
269  std::string selectionStep(const std::string& label) { return label.substr(label.find(':')+1); };
270 
271  private:
275  std::vector<std::string> triggerPaths_;
279  std::unique_ptr<StringCutObjectSelector<reco::Vertex>> vertexSelect_;
283  std::unique_ptr<StringCutObjectSelector<reco::BeamSpot>> beamspotSelect_;
284 
286 
289  std::vector<std::string> selectionOrder_;
295  std::map<std::string, std::pair<edm::ParameterSet, std::unique_ptr<HLTOfflineDQMTopDiLepton::MonitorDiLepton>> > selection_;
296 
297  std::map<std::string, std::unique_ptr<SelectionStepHLTBase>> selectmap_;
298 };
299 
300 #endif
std::string monitorPath(const std::string &label) const
double lowerEdge_
mass window upper and lower edge
~MonitorDiLepton()=default
default destructor
edm::EDGetTokenT< reco::BeamSpot > beamspot_
beamspot
std::unique_ptr< StringCutObjectSelector< reco::GsfElectron > > elecSelect_
extra selection on electrons
std::string selectionPath(const std::string &label) const
std::unique_ptr< StringCutObjectSelector< reco::JetID > > jetIDSelect_
extra jetID selection on calo jets
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:2
virtual example_stream void bookHistograms(DQMStore::IBooker &,@example_stream edm::Run const &,@example_stream edm::EventSetup const &) override
int elecMuLogged_
number of logged interesting events
std::unique_ptr< StringCutObjectSelector< reco::BeamSpot > > beamspotSelect_
string cut selector
edm::EDGetTokenT< edm::View< reco::GsfElectron > > elecs_
input sources for monitoring
edm::EDGetTokenT< edm::View< reco::Jet > > jets_
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::vector< std::string > diMuonPaths_
trigger paths for di muon channel
void triggerBinLabels(const std::string &channel, const std::vector< std::string > &labels)
set configurable labels for trigger monitoring histograms
void loggerBinLabels(const std::string &hist)
set labels for event logging histograms
bool booked(const std::string &histName) const
check if histogram was booked
std::unique_ptr< StringCutObjectSelector< reco::Muon > > muonSelect_
extra selection on muons
std::vector< std::string > diElecPaths_
trigger paths for di electron channel
edm::EDGetTokenT< trigger::TriggerEventWithRefs > triggerSummaryTokenAOD
std::unique_ptr< StringCutObjectSelector< reco::GsfElectron > > elecIso_
extra isolation criterion on electron
Definition: value.py:1
edm::EDGetTokenT< edm::TriggerResults > triggerTable_
trigger table
std::map< std::string, MonitorElement * > hists_
histogram container
MonitorDiLepton(const char *label, const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)
default contructor
std::unique_ptr< StringCutObjectSelector< reco::Vertex > > vertexSelect_
string cut selector
std::map< std::string, std::pair< edm::ParameterSet, std::unique_ptr< HLTOfflineDQMTopDiLepton::MonitorDiLepton > > > selection_
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
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
edm::EDGetTokenT< edm::ValueMap< float > > electronId_
electronId label
define MonitorDiLepton to be used
edm::EDGetTokenT< trigger::TriggerEventWithRefs > triggerSummaryTokenRAW
std::vector< reco::ElectronRef > VRelectron
std::map< std::string, std::unique_ptr< SelectionStepHLTBase > > selectmap_
std::unique_ptr< StringCutObjectSelector< reco::Muon > > muonIso_
extra isolation criterion on muon
edm::EDGetTokenT< edm::View< reco::Muon > > muons_
edm::EDGetTokenT< std::vector< reco::Vertex > > vertex_
primary vertex
static std::string const triggerPaths
Definition: EdmProvDump.cc:43
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: LeafCandidate.h:23
edm::EDGetTokenT< edm::TriggerResults > triggerTable_
trigger table
std::vector< int > Vids
virtual example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: event.py:1
Definition: Run.h:44
reco::LeafCandidate::LorentzVector LorentzVector
void fill(const std::string &histName, double xValue, double yValue) const
fill histogram if it had been booked before (2-dim version)
void fill(const std::string &histName, double value) const
fill histogram if it had been booked before