CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TopDiLeptonOfflineDQM.h
Go to the documentation of this file.
1 #ifndef TOPDILEPTONOFFLINEDQM
2 #define TOPDILEPTONOFFLINEDQM
3 
4 #include <string>
5 #include <vector>
6 
10 
19 
37 namespace TopDiLeptonOffline {
38 
40  public:
48 
49  public:
51  MonitorEnsemble(const char* label, const edm::ParameterSet& cfg);
54 
56  void book(std::string directory);
58  void fill(const edm::Event& event, const edm::EventSetup& setup);
59 
60  private:
63  std::string monitorPath(const std::string& label) const { return label.substr(label.find(':')+1); };
66  std::string selectionPath(const std::string& label) const { return label.substr(0, label.find(':')); };
68  DecayChannel decayChannel(const std::vector<const reco::Muon*>& muons, const std::vector<const reco::GsfElectron*>& elecs) const;
69 
71  void loggerBinLabels(std::string hist);
73  void triggerBinLabels(std::string channel, const std::vector<std::string> labels);
75  void fill(const edm::Event& event, const edm::TriggerResults& triggerTable, std::string channel, const std::vector<std::string> labels) const;
76 
78  bool booked(const std::string histName) const { return hists_.find(histName.c_str())!=hists_.end(); };
80  void fill(const std::string histName, double value) const { if(booked(histName.c_str())) hists_.find(histName.c_str())->second->Fill(value); };
82  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); };
84  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); };
85 
86  private:
90  std::string label_;
94  std::vector<edm::InputTag> mets_;
95 
100  std::vector<std::string> elecMuPaths_;
102  std::vector<std::string> diMuonPaths_;
103 
110 
115 
117  std::string jetCorrector_;
124  std::string jetSelect_;
127 
133  std::map<std::string,MonitorElement*> hists_;
134  };
135 
136  inline void
138  {
139  // set axes titles for selected events
140  hists_[hist.c_str()]->getTH1()->SetOption("TEXT");
141  hists_[hist.c_str()]->setBinLabel( 1 , "Run" , 1);
142  hists_[hist.c_str()]->setBinLabel( 2 , "Block" , 1);
143  hists_[hist.c_str()]->setBinLabel( 3 , "Event" , 1);
144  hists_[hist.c_str()]->setBinLabel( 6 , "pt_{L2L3}(jet1)" , 1);
145  hists_[hist.c_str()]->setBinLabel( 7 , "pt_{L2L3}(jet2)" , 1);
146  hists_[hist.c_str()]->setBinLabel( 8 , "MET_{Calo}" , 1);
147  hists_[hist.c_str()]->setAxisTitle("logged evts" , 2);
148 
149  if(hist=="diMuonLogger_"){
150  hists_[hist.c_str()]->setBinLabel( 4 , "pt(muon)" , 1);
151  hists_[hist.c_str()]->setBinLabel( 5 , "pt(muon)" , 1);
152  }
153  if(hist=="diElecLogger_"){
154  hists_[hist.c_str()]->setBinLabel( 4 , "pt(elec)" , 1);
155  hists_[hist.c_str()]->setBinLabel( 5 , "pt(elec)" , 1);
156  }
157  if(hist=="elecMuLogger_"){
158  hists_[hist.c_str()]->setBinLabel( 4 , "pt(elec)" , 1);
159  hists_[hist.c_str()]->setBinLabel( 5 , "pt(muon)" , 1);
160  }
161  }
162 
163  inline void
164  MonitorEnsemble::triggerBinLabels(std::string channel, const std::vector<std::string> labels)
165  {
166  for(unsigned int idx=0; idx<labels.size(); ++idx){
167  hists_[(channel+"Mon_").c_str()]->setBinLabel( idx+1, "["+monitorPath(labels[idx])+"]", 1);
168  hists_[(channel+"Eff_").c_str()]->setBinLabel( idx+1, "["+selectionPath(labels[idx])+"]|["+monitorPath(labels[idx])+"]", 1);
169  }
170  }
171 
172  inline void
173  MonitorEnsemble::fill(const edm::Event& event, const edm::TriggerResults& triggerTable, std::string channel, const std::vector<std::string> labels) const
174  {
175  for(unsigned int idx=0; idx<labels.size(); ++idx){
176  if( accept(event, triggerTable, monitorPath(labels[idx])) ){
177  fill((channel+"Mon_").c_str(), idx+0.5 );
178  // take care to fill triggerMon_ before evts is being called
179  int evts = hists_.find((channel+"Mon_").c_str())->second->getBinContent(idx+1);
180  double value = hists_.find((channel+"Eff_").c_str())->second->getBinContent(idx+1);
181  fill((channel+"Eff_").c_str(), idx+0.5, 1./evts*(accept(event, triggerTable, selectionPath(labels[idx]))-value));
182  }
183  }
184  }
185 
187  MonitorEnsemble::decayChannel(const std::vector<const reco::Muon*>& muons, const std::vector<const reco::GsfElectron*>& elecs) const
188  {
190  if( muons.size()>1 ){ type=DIMUON; } else if( elecs.size()>1 ){ type=DIELEC; } else if( !elecs.empty() && !muons.empty() ){ type=ELECMU; }
191  return type;
192  }
193 
194 }
195 
196 #include <utility>
197 
202 
207 
233 //using TopDiLeptonOffline::MonitorEnsemble;
235 
237  public:
242 
244  virtual void analyze(const edm::Event& event, const edm::EventSetup& setup);
245 
246  private:
249  std::string objectType(const std::string& label) { return label.substr(0, label.find(':')); };
252  std::string selectionStep(const std::string& label) { return label.substr(label.find(':')+1); };
253 
254  private:
258  std::vector<std::string> triggerPaths_;
267 
270  std::vector<std::string> selectionOrder_;
276  std::map<std::string, std::pair<edm::ParameterSet, TopDiLeptonOffline::MonitorEnsemble*> > selection_;
277 };
278 
279 #endif
type
Definition: HCALResponse.h:22
StringCutObjectSelector< reco::Vertex > * vertexSelect_
string cut selector
std::string selectionPath(const std::string &label) const
std::string selectionStep(const std::string &label)
std::vector< std::string > selectionOrder_
~TopDiLeptonOfflineDQM()
default destructor
void fill(const std::string histName, double value) const
fill histogram if it had been booked before
std::map< std::string, std::pair< edm::ParameterSet, TopDiLeptonOffline::MonitorEnsemble * > > selection_
const std::string & label
Definition: MVAComputer.cc:186
Level verbosity_
verbosity level for booking
define MonitorEnsembple to be used
edm::InputTag elecs_
input sources for monitoring
virtual void analyze(const edm::Event &event, const edm::EventSetup &setup)
do this during the event loop
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
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:21
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
bool booked(const std::string histName) const
check if histogram was booked
U second(std::pair< T, U > const &p)
edm::InputTag triggerTable_
trigger table
std::map< std::string, MonitorElement * > hists_
histogram container
edm::InputTag vertex_
primary vertex
edm::InputTag beamspot_
beamspot
StringCutObjectSelector< reco::Muon > * muonSelect_
extra selection on muons
double lowerEdge_
mass window upper and lower edge
edm::InputTag triggerTable_
trigger table
std::vector< std::string > elecMuPaths_
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
StringCutObjectSelector< reco::BeamSpot > * beamspotSelect_
string cut selector
TopDiLeptonOfflineDQM(const edm::ParameterSet &cfg)
default constructor
edm::InputTag jetIDLabel_
jetID as an extra selection type
void book(std::string directory)
book histograms in subdirectory directory
StringCutObjectSelector< reco::Muon > * muonIso_
extra isolation criterion on muon
tuple labels
Definition: L1TDQM_cfg.py:62
int elecMuLogged_
number of logged interesting events
std::vector< std::string > diMuonPaths_
trigger paths for di muon channel
reco::LeafCandidate::LorentzVector LorentzVector
std::vector< std::string > triggerPaths_
trigger paths
MonitorEnsemble(const char *label, const edm::ParameterSet &cfg)
default contructor
std::string objectType(const std::string &label)
StringCutObjectSelector< reco::JetID > * jetIDSelect_
extra jetID selection on calo jets
StringCutObjectSelector< reco::GsfElectron > * elecSelect_
extra selection on electrons
StringCutObjectSelector< reco::GsfElectron > * elecIso_
extra isolation criterion on electron
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: LeafCandidate.h:25
void triggerBinLabels(std::string channel, const std::vector< std::string > labels)
set configurable labels for trigger monitoring histograms