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 
105  std::vector<std::string> elecMuPaths_;
107  std::vector<std::string> diMuonPaths_;
109  std::vector<std::string> diElecPaths_;
110 
128 
133 
145 
149  std::map<std::string,MonitorElement*> hists_;
150 
157  };
158 
159  inline void
161  {
162  // set axes titles for selected events
163  hists_[hist.c_str()]->getTH1()->SetOption("TEXT");
164  hists_[hist.c_str()]->setBinLabel( 1 , "Run" , 1);
165  hists_[hist.c_str()]->setBinLabel( 2 , "Block" , 1);
166  hists_[hist.c_str()]->setBinLabel( 3 , "Event" , 1);
167  hists_[hist.c_str()]->setBinLabel( 6 , "pt_{L2L3}(jet1)" , 1);
168  hists_[hist.c_str()]->setBinLabel( 7 , "pt_{L2L3}(jet2)" , 1);
169  hists_[hist.c_str()]->setBinLabel( 8 , "MET_{Calo}" , 1);
170  hists_[hist.c_str()]->setAxisTitle("logged evts" , 2);
171 
172  if(hist=="diMuonLogger_"){
173  hists_[hist.c_str()]->setBinLabel( 4 , "pt(muon)" , 1);
174  hists_[hist.c_str()]->setBinLabel( 5 , "pt(muon)" , 1);
175  }
176  if(hist=="diElecLogger_"){
177  hists_[hist.c_str()]->setBinLabel( 4 , "pt(elec)" , 1);
178  hists_[hist.c_str()]->setBinLabel( 5 , "pt(elec)" , 1);
179  }
180  if(hist=="elecMuLogger_"){
181  hists_[hist.c_str()]->setBinLabel( 4 , "pt(elec)" , 1);
182  hists_[hist.c_str()]->setBinLabel( 5 , "pt(muon)" , 1);
183  }
184  }
185 
186  inline void
187  MonitorDiLepton::triggerBinLabels(std::string channel, const std::vector<std::string>& labels)
188  {
189  for(unsigned int idx=0; idx<labels.size(); ++idx){
190  hists_[(channel+"Mon_").c_str()]->setBinLabel( idx+1, "["+monitorPath(labels[idx])+"]", 1);
191  }
192  }
193 
194  inline void
195  MonitorDiLepton::fill(const edm::Event& event, const edm::TriggerResults& triggerTable, std::string channel, const std::vector<std::string>& labels) const
196  {
197  for(unsigned int idx=0; idx<labels.size(); ++idx){
198  if( acceptHLT(event, triggerTable, monitorPath(labels[idx])) ){
199  fill((channel+"Mon_").c_str(), idx+0.5 );
200  }
201  }
202  }
203 
204 }
205 
206 #include <utility>
207 
212 
218 
219 
245 //using TopDiLeptonOffline::MonitorDiLepton;
247 
249  public:
254  if( beamspotSelect_ ) delete beamspotSelect_;
255  if( vertexSelect_ ) delete vertexSelect_;
256  }
257 
259  virtual void dqmBeginRun(const edm::Run& r, const edm::EventSetup& c);
260  virtual void analyze(const edm::Event& event, const edm::EventSetup& setup);
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_;
284 
286 
289  std::vector<std::string> selectionOrder_;
295  std::map<std::string, std::pair<edm::ParameterSet, HLTOfflineDQMTopDiLepton::MonitorDiLepton*> > selection_;
296 
297  std::map<std::string, SelectionStepHLTBase*> selectmap_;
298 };
299 
300 #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:259
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 > triggerEventWithRefsTag_
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
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:41
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
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