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 
39 namespace TopDiLeptonOffline {
40 
42  public:
50 
51  public:
53 // MonitorEnsemble(const char* label, const edm::ParameterSet& cfg);
54  MonitorEnsemble(const char* label, const edm::ParameterSet& cfg, edm::ConsumesCollector && iC );
57 
61  void fill(const edm::Event& event, const edm::EventSetup& setup);
62 
63  private:
66  std::string monitorPath(const std::string& label) const { return label.substr(label.find(':')+1); };
69  std::string selectionPath(const std::string& label) const { return label.substr(0, label.find(':')); };
71  DecayChannel decayChannel(const std::vector<const reco::Muon*>& muons, const std::vector<const reco::GsfElectron*>& elecs) const;
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:
95  //edm::InputTag elecs_, muons_, jets_;
99 
101  //std::vector<edm::InputTag> mets_;
102  std::vector<edm::EDGetTokenT<edm::View<reco::MET> > > mets_;
103 
105  //edm::InputTag triggerTable_;
109  std::vector<std::string> elecMuPaths_;
111  std::vector<std::string> diMuonPaths_;
112 
114  //edm::InputTag electronId_;
131 
136 
140  //edm::InputTag jetIDLabel_;
149 
155  std::map<std::string,MonitorElement*> hists_;
156  };
157 
158  inline void
160  {
161  // set axes titles for selected events
162  hists_[hist.c_str()]->getTH1()->SetOption("TEXT");
163  hists_[hist.c_str()]->setBinLabel( 1 , "Run" , 1);
164  hists_[hist.c_str()]->setBinLabel( 2 , "Block" , 1);
165  hists_[hist.c_str()]->setBinLabel( 3 , "Event" , 1);
166  hists_[hist.c_str()]->setBinLabel( 6 , "pt_{L2L3}(jet1)" , 1);
167  hists_[hist.c_str()]->setBinLabel( 7 , "pt_{L2L3}(jet2)" , 1);
168  hists_[hist.c_str()]->setBinLabel( 8 , "MET_{Calo}" , 1);
169  hists_[hist.c_str()]->setAxisTitle("logged evts" , 2);
170 
171  if(hist=="diMuonLogger_"){
172  hists_[hist.c_str()]->setBinLabel( 4 , "pt(muon)" , 1);
173  hists_[hist.c_str()]->setBinLabel( 5 , "pt(muon)" , 1);
174  }
175  if(hist=="diElecLogger_"){
176  hists_[hist.c_str()]->setBinLabel( 4 , "pt(elec)" , 1);
177  hists_[hist.c_str()]->setBinLabel( 5 , "pt(elec)" , 1);
178  }
179  if(hist=="elecMuLogger_"){
180  hists_[hist.c_str()]->setBinLabel( 4 , "pt(elec)" , 1);
181  hists_[hist.c_str()]->setBinLabel( 5 , "pt(muon)" , 1);
182  }
183  }
184 
185  inline void
186  MonitorEnsemble::triggerBinLabels(std::string channel, const std::vector<std::string> labels)
187  {
188  for(unsigned int idx=0; idx<labels.size(); ++idx){
189  hists_[(channel+"Mon_").c_str()]->setBinLabel( idx+1, "["+monitorPath(labels[idx])+"]", 1);
190  hists_[(channel+"Eff_").c_str()]->setBinLabel( idx+1, "["+selectionPath(labels[idx])+"]|["+monitorPath(labels[idx])+"]", 1);
191  }
192  }
193 
194  inline void
195  MonitorEnsemble::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( accept(event, triggerTable, monitorPath(labels[idx])) ){
199  fill((channel+"Mon_").c_str(), idx+0.5 );
200  // take care to fill triggerMon_ before evts is being called
201  int evts = hists_.find((channel+"Mon_").c_str())->second->getBinContent(idx+1);
202  double value = hists_.find((channel+"Eff_").c_str())->second->getBinContent(idx+1);
203  fill((channel+"Eff_").c_str(), idx+0.5, 1./evts*(accept(event, triggerTable, selectionPath(labels[idx]))-value));
204  }
205  }
206  }
207 
209  MonitorEnsemble::decayChannel(const std::vector<const reco::Muon*>& muons, const std::vector<const reco::GsfElectron*>& elecs) const
210  {
212  if( muons.size()>1 ){ type=DIMUON; } else if( elecs.size()>1 ){ type=DIELEC; } else if( !elecs.empty() && !muons.empty() ){ type=ELECMU; }
213  return type;
214  }
215 
216 }
217 
218 #include <utility>
219 
224 
229 
255 //using TopDiLeptonOffline::MonitorEnsemble;
257 
259  public:
264  if( beamspotSelect_ ) delete beamspotSelect_;
265  if( vertexSelect_ ) delete vertexSelect_;
266 
267  if( MuonStep) delete MuonStep;
268 
269  if( ElectronStep) delete ElectronStep;
270 
271  if( PvStep) delete PvStep;
272 
273  if( METStep) delete METStep;
274 
275  for(unsigned int i = 0; i < JetSteps.size(); i++)
276 
277  if( JetSteps[i]) delete JetSteps[i];
278 
279  for(unsigned int i = 0; i < CaloJetSteps.size(); i++)
280 
281  if( CaloJetSteps[i]) delete CaloJetSteps[i];
282 
283  for(unsigned int i = 0; i < PFJetSteps.size(); i++)
284 
285  if( PFJetSteps[i]) delete PFJetSteps[i];
286  }
287 
289  virtual void analyze(const edm::Event& event, const edm::EventSetup& setup);
290 
291  private:
294  std::string objectType(const std::string& label) { return label.substr(0, label.find(':')); };
297  std::string selectionStep(const std::string& label) { return label.substr(label.find(':')+1); };
298 
299  private:
301  //edm::InputTag triggerTable_;
304  std::vector<std::string> triggerPaths_;
306  //edm::InputTag vertex_;
311  //edm::InputTag beamspot_;
315 
318  std::vector<std::string> selectionOrder_;
324  std::map<std::string, std::pair<edm::ParameterSet, TopDiLeptonOffline::MonitorEnsemble*> > selection_;
329  std::vector<SelectionStep<reco::Jet> * > JetSteps;
330  std::vector<SelectionStep<reco::CaloJet> * > CaloJetSteps;
331  std::vector<SelectionStep<reco::PFJet> * > PFJetSteps;
332 };
333 
334 #endif
type
Definition: HCALResponse.h:21
StringCutObjectSelector< reco::Vertex > * vertexSelect_
string cut selector
std::string selectionPath(const std::string &label) const
std::string selectionStep(const std::string &label)
int i
Definition: DBlmapReader.cc:9
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_
Level verbosity_
verbosity level for booking
edm::EDGetTokenT< reco::JetIDValueMap > jetIDLabel_
jetID as an extra selection type
SelectionStep< reco::Muon > * MuonStep
define MonitorEnsembple to be used
SelectionStep< reco::MET > * METStep
edm::EDGetTokenT< edm::View< reco::Muon > > muons_
edm::EDGetTokenT< std::vector< reco::Vertex > > vertex_
primary vertex
MonitorEnsemble(const char *label, const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)
default contructor
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
SelectionStep< reco::Vertex > * PvStep
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:26
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
edm::EDGetTokenT< edm::View< reco::GsfElectron > > elecs_
bool booked(const std::string histName) const
check if histogram was booked
edm::EDGetTokenT< edm::View< reco::Jet > > jets_
input sources for monitoring
U second(std::pair< T, U > const &p)
std::map< std::string, MonitorElement * > hists_
histogram container
SelectionStep< reco::GsfElectron > * ElectronStep
StringCutObjectSelector< reco::Muon > * muonSelect_
extra selection on muons
double lowerEdge_
mass window upper and lower edge
std::vector< edm::EDGetTokenT< edm::View< reco::MET > > > mets_
considers a vector of METs
std::vector< std::string > elecMuPaths_
std::vector< SelectionStep< reco::PFJet > * > PFJetSteps
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< SelectionStep< reco::Jet > * > JetSteps
StringCutObjectSelector< reco::BeamSpot > * beamspotSelect_
string cut selector
TopDiLeptonOfflineDQM(const edm::ParameterSet &cfg)
default constructor
void book(std::string directory)
book histograms in subdirectory directory
StringCutObjectSelector< reco::Muon > * muonIso_
extra isolation criterion on muon
int elecMuLogged_
number of logged interesting events
std::vector< std::string > diMuonPaths_
trigger paths for di muon channel
reco::LeafCandidate::LorentzVector LorentzVector
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
edm::EDGetTokenT< edm::TriggerResults > triggerTable_
trigger table
tuple muons
Definition: patZpeak.py:38
edm::EDGetTokenT< edm::TriggerResults > triggerTable_
trigger table
std::vector< std::string > triggerPaths_
trigger paths
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
std::vector< SelectionStep< reco::CaloJet > * > CaloJetSteps
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
edm::EDGetTokenT< reco::BeamSpot > beamspot_
beamspot
edm::EDGetTokenT< edm::ValueMap< float > > electronId_
electronId label
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: LeafCandidate.h:28
void triggerBinLabels(std::string channel, const std::vector< std::string > labels)
set configurable labels for trigger monitoring histograms