CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
44 namespace HLTOfflineDQMTopDiLepton {
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);
264  virtual void analyze(const edm::Event& event, const edm::EventSetup& setup);
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
TopDiLeptonHLTOfflineDQM(const edm::ParameterSet &cfg)
default constructor
int i
Definition: DBlmapReader.cc:9
std::string monitorPath(const std::string &label) const
tuple cfg
Definition: looper.py:293
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
std::string selectionPath(const std::string &label) const
std::string selectionStep(const std::string &label)
void bookHistograms(DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override
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_
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
virtual void analyze(const edm::Event &event, const edm::EventSetup &setup)
void loggerBinLabels(std::string hist)
set labels for event logging histograms
std::vector< std::string > diElecPaths_
trigger paths for di electron channel
virtual void dqmBeginRun(const edm::Run &r, const edm::EventSetup &c)
do this during the event loop
edm::EDGetTokenT< trigger::TriggerEventWithRefs > triggerSummaryTokenAOD
edm::EDGetTokenT< edm::TriggerResults > triggerTable_
trigger table
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
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)
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
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: Run.h:43
StringCutObjectSelector< reco::JetID > * jetIDSelect_
extra jetID selection on calo jets
StringCutObjectSelector< reco::Vertex > * vertexSelect_
string cut selector