CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TopHLTDiLeptonOfflineDQM.h
Go to the documentation of this file.
1 #ifndef TOPDILEPTONOFFLINEDQM
2 #define TOPDILEPTONOFFLINEDQM
3 
4 #include <string>
5 #include <vector>
6 
10 
19 
20 
23 
24 /*Originally from DQM/Physics by R. Wolf and J. Andrea*/
25 
43 namespace TopDiLeptonOffline {
44 
45  class MonitorEnsemble {
46  public:
54 
55  public:
57  MonitorEnsemble(const char* label, const edm::ParameterSet& cfg);
60 
64  //void fill(const edm::Event& event, const edm::EventSetup& setup);
66 
67  private:
70  std::string monitorPath(const std::string& label) const { return label.substr(label.find(':')+1); };
73  std::string selectionPath(const std::string& label) const { return label.substr(0, label.find(':')); };
75  DecayChannel decayChannel(const std::vector<const reco::Muon*>& muons, const std::vector<const reco::GsfElectron*>& elecs) const;
76 
80  void triggerBinLabels(std::string channel, const std::vector<std::string>& labels);
82  void fill(const edm::Event& event, const edm::TriggerResults& triggerTable, std::string channel, const std::vector<std::string>& labels) const;
83 
85  bool booked(const std::string histName) const { return hists_.find(histName.c_str())!=hists_.end(); };
87  void fill(const std::string histName, double value) const { if(booked(histName.c_str())) hists_.find(histName.c_str())->second->Fill(value); };
89  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); };
91  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); };
92 
93  private:
100 
102  std::vector<edm::InputTag> mets_;
103 
108  std::vector<std::string> elecMuPaths_;
110  std::vector<std::string> diMuonPaths_;
111 
124  int eidPattern_;
129 
134 
145  double lowerEdge_, upperEdge_;
146 
150  DQMStore* store_;
152  std::map<std::string,MonitorElement*> hists_;
153  };
154 
155  inline void
157  {
158  // set axes titles for selected events
159  hists_[hist.c_str()]->getTH1()->SetOption("TEXT");
160  hists_[hist.c_str()]->setBinLabel( 1 , "Run" , 1);
161  hists_[hist.c_str()]->setBinLabel( 2 , "Block" , 1);
162  hists_[hist.c_str()]->setBinLabel( 3 , "Event" , 1);
163  hists_[hist.c_str()]->setBinLabel( 6 , "pt_{L2L3}(jet1)" , 1);
164  hists_[hist.c_str()]->setBinLabel( 7 , "pt_{L2L3}(jet2)" , 1);
165  hists_[hist.c_str()]->setBinLabel( 8 , "MET_{Calo}" , 1);
166  hists_[hist.c_str()]->setAxisTitle("logged evts" , 2);
167 
168  if(hist=="diMuonLogger_"){
169  hists_[hist.c_str()]->setBinLabel( 4 , "pt(muon)" , 1);
170  hists_[hist.c_str()]->setBinLabel( 5 , "pt(muon)" , 1);
171  }
172  if(hist=="diElecLogger_"){
173  hists_[hist.c_str()]->setBinLabel( 4 , "pt(elec)" , 1);
174  hists_[hist.c_str()]->setBinLabel( 5 , "pt(elec)" , 1);
175  }
176  if(hist=="elecMuLogger_"){
177  hists_[hist.c_str()]->setBinLabel( 4 , "pt(elec)" , 1);
178  hists_[hist.c_str()]->setBinLabel( 5 , "pt(muon)" , 1);
179  }
180  }
181 
182  inline void
183  MonitorEnsemble::triggerBinLabels(std::string channel, const std::vector<std::string>& labels)
184  {
185  for(unsigned int idx=0; idx<labels.size(); ++idx){
186  hists_[(channel+"Mon_").c_str()]->setBinLabel( idx+1, "["+monitorPath(labels[idx])+"]", 1);
187  hists_[(channel+"Eff_").c_str()]->setBinLabel( idx+1, "["+selectionPath(labels[idx])+"]|["+monitorPath(labels[idx])+"]", 1);
188  }
189  }
190 
191  inline void
192  MonitorEnsemble::fill(const edm::Event& event, const edm::TriggerResults& triggerTable, std::string channel, const std::vector<std::string>& labels) const
193  {
194  for(unsigned int idx=0; idx<labels.size(); ++idx){
195  if( acceptHLT(event, triggerTable, monitorPath(labels[idx])) ){
196  fill((channel+"Mon_").c_str(), idx+0.5 );
197  // take care to fill triggerMon_ before evts is being called
198  int evts = hists_.find((channel+"Mon_").c_str())->second->getBinContent(idx+1);
199  double value = hists_.find((channel+"Eff_").c_str())->second->getBinContent(idx+1);
200  fill((channel+"Eff_").c_str(), idx+0.5, 1./evts*(acceptHLT(event, triggerTable, selectionPath(labels[idx]))-value));
201  }
202  }
203  }
204 
206  MonitorEnsemble::decayChannel(const std::vector<const reco::Muon*>& muons, const std::vector<const reco::GsfElectron*>& elecs) const
207  {
209  if( muons.size()>1 ){ type=DIMUON; } else if( elecs.size()>1 ){ type=DIELEC; } else if( !elecs.empty() && !muons.empty() ){ type=ELECMU; }
210  return type;
211  }
212 
213 }
214 
215 #include <utility>
216 
221 
226 
252 //using TopDiLeptonOffline::MonitorEnsemble;
254 
256  public:
261  if( beamspotSelect_ ) delete beamspotSelect_;
262  if( vertexSelect_ ) delete vertexSelect_;
263  }
264 
266  virtual void analyze(const edm::Event& event, const edm::EventSetup& setup);
267 
268  private:
271  std::string objectType(const std::string& label) { return label.substr(0, label.find(':')); };
274  std::string selectionStep(const std::string& label) { return label.substr(label.find(':')+1); };
275 
276  private:
280  std::vector<std::string> triggerPaths_;
289 
292  std::vector<std::string> selectionOrder_;
298  std::map<std::string, std::pair<edm::ParameterSet, TopDiLeptonOffline::MonitorEnsemble*> > selection_;
299 
300  std::vector<edm::InputTag> metsTemp_;
301 
305 
308 
312 
313  std::vector< edm::EDGetTokenT< edm::View<reco::MET> > > metsTokens_;
314 };
315 
316 #endif
type
Definition: HCALResponse.h:21
std::string selectionPath(const std::string &label) const
StringCutObjectSelector< reco::JetID > * jetIDSelect_
extra jetID selection on calo jets
edm::EDGetTokenT< edm::View< reco::Muon > > muonsToken_
StringCutObjectSelector< reco::BeamSpot > * beamspotSelect_
string cut selector
void fill(const std::string histName, double value) const
fill histogram if it had been booked before
virtual void analyze(const edm::Event &event, const edm::EventSetup &setup)
do this during the event loop
edm::EDGetTokenT< reco::JetIDValueMap > jetIDToken_
bool acceptHLT(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
StringCutObjectSelector< reco::GsfElectron > * elecIso_
extra isolation criterion on electron
edm::EDGetTokenT< edm::View< reco::Jet > > jetsToken_
edm::InputTag electronId_
electronId label
MonitorEnsemble(const char *label, const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)
default contructor
std::vector< edm::InputTag > metsTemp_
DecayChannel decayChannel(const std::vector< const reco::Muon * > &muons, const std::vector< const reco::GsfElectron * > &elecs) const
determine dileptonic decay channel
void loggerBinLabels(std::string hist)
set labels for event logging histograms
std::string monitorPath(const std::string &label) const
int elecMuLogged_
number of logged interesting events
std::string selectionStep(const std::string &label)
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 edm::Event &event, const edm::EventSetup &setup)
fill monitor histograms with electronId and jetCorrections
std::vector< std::string > selectionOrder_
edm::EDGetTokenT< edm::View< reco::GsfElectron > > elecs_
bool booked(const std::string histName) const
check if histogram was booked
edm::InputTag triggerTable_
trigger table
std::vector< std::string > triggerPaths_
trigger paths
edm::EDGetTokenT< edm::View< reco::Jet > > jets_
input sources for monitoring
StringCutObjectSelector< reco::Vertex > * vertexSelect_
string cut selector
U second(std::pair< T, U > const &p)
edm::EDGetTokenT< reco::BeamSpot > beamspotToken_
StringCutObjectSelector< reco::Muon > * muonIso_
extra isolation criterion on muon
edm::EDGetTokenT< std::vector< reco::Vertex > > vertexToken_
std::map< std::string, std::pair< edm::ParameterSet, TopDiLeptonOffline::MonitorEnsemble * > > selection_
vector< PseudoJet > jets
StringCutObjectSelector< reco::Muon > * muonSelect_
extra selection on muons
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::vector< edm::InputTag > mets_
considers a vector of METs
edm::InputTag jetIDLabel_
jetID as an extra selection type
TopHLTDiLeptonOfflineDQM(const edm::ParameterSet &cfg)
default constructor
void book(std::string directory)
book histograms in subdirectory directory
std::vector< std::string > diMuonPaths_
trigger paths for di muon channel
edm::InputTag beamspot_
beamspot
reco::LeafCandidate::LorentzVector LorentzVector
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
double lowerEdge_
mass window upper and lower edge
define MonitorEnsembple to be used
Level verbosity_
verbosity level for booking
edm::EDGetTokenT< edm::TriggerResults > triggerTableToken_
std::string objectType(const std::string &label)
std::map< std::string, MonitorElement * > hists_
histogram container
Helper class to define histograms for monitoring of muon/electron/jet/met quantities.
StringCutObjectSelector< reco::GsfElectron > * elecSelect_
extra selection on electrons
tuple muons
Definition: patZpeak.py:38
edm::InputTag vertex_
primary vertex
std::vector< std::string > elecMuPaths_
edm::EDGetTokenT< edm::View< reco::GsfElectron > > elecsToken_
~TopHLTDiLeptonOfflineDQM()
default destructor
std::vector< edm::EDGetTokenT< edm::View< reco::MET > > > metsTokens_
void fill(const std::string histName, double xValue, double yValue, double zValue) const
fill histogram if it had been booked before (2-dim version)
edm::EDGetTokenT< edm::ValueMap< float > > electronIdToken_
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: LeafCandidate.h:26
void triggerBinLabels(std::string channel, const std::vector< std::string > labels)
set configurable labels for trigger monitoring histograms