CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SingleTopTChannelLeptonDQM.h
Go to the documentation of this file.
1 #ifndef SINGLETOPTCHANNELLEPTONDQM
2 #define SINGLETOPTCHANNELLEPTONDQM
3 
4 #include <string>
5 #include <vector>
6 
10 
22 
40 namespace SingleTopTChannelLepton {
41 
43  public:
46 
47  public:
49  MonitorEnsemble(const char* label, const edm::ParameterSet& cfg, const edm::VParameterSet& vcfg, edm::ConsumesCollector && iC );
52 
56  void fill(const edm::Event& event, const edm::EventSetup& setup);
57 
58  private:
61  std::string monitorPath(const std::string& label) const { return label.substr(label.find(':')+1); };
64  std::string selectionPath(const std::string& label) const { return label.substr(0, label.find(':')); };
65 
67  void triggerBinLabels(std::string channel, const std::vector<std::string> labels);
69  void fill(const edm::Event& event, const edm::TriggerResults& triggerTable, std::string channel, const std::vector<std::string> labels) const;
70 
72  bool booked(const std::string histName) const { return hists_.find(histName.c_str())!=hists_.end(); };
74  void fill(const std::string histName, double value) const { if(booked(histName.c_str())) hists_.find(histName.c_str())->second->Fill(value); };
76  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); };
78  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); };
79 
80  private:
86  std::vector<edm::EDGetTokenT<edm::View<reco::MET> > > mets_;
87  // std::vector<edm::InputTag> mets_;
94 
95  // edm::InputTag elecs_, elecs_gsf_, muons_, muons_reco_, jets_, pvs_;
96 
98  // edm::InputTag triggerTable_;
100 
103  std::vector<std::string> triggerPaths_;
104 
106  // edm::InputTag electronId_;
108 
121  // StringCutObjectSelector<reco::GsfElectron>* elecIso_;
124  //StringCutObjectSelector<reco::GsfElectron>* elecSelect_;
126 
129 
131  //StringCutObjectSelector<reco::Muon>* muonIso_;
134  //StringCutObjectSelector<reco::Muon>* muonSelect_;
136 
140  // edm::InputTag jetIDLabel_;
142 
152  // edm::InputTag btagEff_, btagPur_, btagVtx_, btagCombVtx_;
154 
159 
161  int logged_;
165  std::map<std::string,MonitorElement*> hists_;
167  };
168 
169  inline void
170  MonitorEnsemble::triggerBinLabels(std::string channel, const std::vector<std::string> labels)
171  {
172  for(unsigned int idx=0; idx<labels.size(); ++idx){
173  hists_[(channel+"Mon_").c_str()]->setBinLabel( idx+1, "["+monitorPath(labels[idx])+"]", 1);
174  hists_[(channel+"Eff_").c_str()]->setBinLabel( idx+1, "["+selectionPath(labels[idx])+"]|["+monitorPath(labels[idx])+"]", 1);
175  }
176  }
177 
178  inline void
179  MonitorEnsemble::fill(const edm::Event& event, const edm::TriggerResults& triggerTable, std::string channel, const std::vector<std::string> labels) const
180  {
181  for(unsigned int idx=0; idx<labels.size(); ++idx){
182  if( accept(event, triggerTable, monitorPath(labels[idx])) ){
183  fill((channel+"Mon_").c_str(), idx+0.5 );
184  // take care to fill triggerMon_ before evts is being called
185  int evts = hists_.find((channel+"Mon_").c_str())->second->getBinContent(idx+1);
186  double value = hists_.find((channel+"Eff_").c_str())->second->getBinContent(idx+1);
187  fill((channel+"Eff_").c_str(), idx+0.5, 1./evts*(accept(event, triggerTable, selectionPath(labels[idx]))-value));
188  }
189  }
190  }
191 
192 }
193 
194 #include <utility>
195 
201 
206 
232 //using SingleTopTChannelLepton::MonitorEnsemble;
234 
236  public:
241  if( vertexSelect_ ) delete vertexSelect_;
242  if( beamspotSelect_ ) delete beamspotSelect_;
243  if( MuonStep) delete MuonStep;
244  if( PFMuonStep) delete PFMuonStep;
245  if( ElectronStep) delete ElectronStep;
246  if( PFElectronStep) delete PFElectronStep;
247  if( PvStep) delete PvStep;
248  for(unsigned int i = 0; i < JetSteps.size(); i++)
249  if( JetSteps[i]) delete JetSteps[i];
250  for(unsigned int i = 0; i < CaloJetSteps.size(); i++)
251  if( CaloJetSteps[i]) delete CaloJetSteps[i];
252  for(unsigned int i = 0; i < PFJetSteps.size(); i++)
253  if( PFJetSteps[i]) delete PFJetSteps[i];
254  if( METStep) delete METStep;
255 
256 
257 
258 
259  };
260 
261 
262 
264  virtual void analyze(const edm::Event& event, const edm::EventSetup& setup);
265 
266  private:
269  std::string objectType(const std::string& label) { return label.substr(0, label.find(':')); };
272  std::string selectionStep(const std::string& label) { return label.substr(label.find(':')+1); };
273 
274  private:
276  // edm::InputTag triggerTable_;
278 
280  std::vector<std::string> triggerPaths_;
286 
292 
295  std::vector<std::string> selectionOrder_;
301  std::map<std::string, std::pair<edm::ParameterSet, SingleTopTChannelLepton::MonitorEnsemble*> > selection_;
307  std::vector<SelectionStep<reco::Jet> * > JetSteps;
308  std::vector<SelectionStep<reco::CaloJet> * > CaloJetSteps;
309  std::vector<SelectionStep<reco::PFJet> * > PFJetSteps;
311 
312 
313 };
314 
315 #endif
std::vector< std::string > selectionOrder_
std::string objectType(const std::string &label)
int i
Definition: DBlmapReader.cc:9
~SingleTopTChannelLeptonDQM()
default destructor
edm::EDGetTokenT< reco::JetIDValueMap > jetIDLabel_
jetID as an extra selection type
std::vector< std::string > triggerPaths_
trigger paths
Level verbosity_
verbosity level for booking
SelectionStep< reco::MET > * METStep
std::vector< ParameterSet > VParameterSet
Definition: ParameterSet.h:33
int logged_
number of logged interesting events
define MonitorEnsembple to be used
bool booked(const std::string histName) const
check if histogram was booked
edm::EDGetTokenT< reco::JetTagCollection > btagCombVtx_
std::vector< SelectionStep< reco::CaloJet > * > CaloJetSteps
edm::EDGetTokenT< edm::TriggerResults > triggerTable__
trigger table
std::string muonIso_
extra isolation criterion on muon
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:26
std::string muonSelect_
extra selection on muons
edm::EDGetTokenT< edm::View< reco::PFCandidate > > muons_
std::map< std::string, std::pair< edm::ParameterSet, SingleTopTChannelLepton::MonitorEnsemble * > > selection_
SingleTopTChannelLeptonDQM(const edm::ParameterSet &cfg)
default constructor
StringCutObjectSelector< reco::Vertex > * pvSelect_
extra selection on primary vertices; meant to investigate the pile-up effect
U second(std::pair< T, U > const &p)
edm::InputTag vertex_
primary vertex
StringCutObjectSelector< reco::Vertex > * vertexSelect_
string cut selector
std::string elecSelect_
extra selection on electrons
double lowerEdge_
mass window upper and lower edge
void triggerBinLabels(std::string channel, const std::vector< std::string > labels)
set configurable labels for trigger monitoring histograms
SelectionStep< reco::Vertex > * PvStep
std::string monitorPath(const std::string &label) const
edm::EDGetTokenT< edm::View< reco::GsfElectron > > elecs_gsf_
SelectionStep< reco::GsfElectron > * ElectronStep
edm::EDGetTokenT< reco::JetTagCollection > btagPur_
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
edm::EDGetTokenT< reco::JetTagCollection > btagEff_
btag discriminator labels
std::string selectionPath(const std::string &label) const
std::map< std::string, MonitorElement * > hists_
histogram container
edm::EDGetTokenT< edm::TriggerResults > triggerTable_
trigger table
std::vector< SelectionStep< reco::Jet > * > JetSteps
edm::EDGetTokenT< edm::ValueMap< float > > electronId_
electronId label
std::string selectionStep(const std::string &label)
edm::EDGetTokenT< reco::JetTagCollection > btagVtx_
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
edm::EDGetTokenT< edm::View< reco::Vertex > > pvs_
edm::EDGetTokenT< edm::View< reco::PFCandidate > > elecs_
SelectionStep< reco::Muon > * MuonStep
std::vector< SelectionStep< reco::PFJet > * > PFJetSteps
std::vector< edm::EDGetTokenT< edm::View< reco::MET > > > mets_
considers a vector of METs
void fill(const edm::Event &event, const edm::EventSetup &setup)
fill monitor histograms with electronId and jetCorrections
SelectionStep< reco::PFCandidate > * PFMuonStep
edm::EDGetTokenT< edm::View< reco::Jet > > jets_
input sources for monitoring
virtual void analyze(const edm::Event &event, const edm::EventSetup &setup)
do this during the event loop
StringCutObjectSelector< reco::BeamSpot > * beamspotSelect_
string cut selector
edm::EDGetTokenT< reco::Vertex > vertex__
StringCutObjectSelector< reco::JetID > * jetIDSelect_
extra jetID selection on calo jets
MonitorEnsemble(const char *label, const edm::ParameterSet &cfg, const edm::VParameterSet &vcfg, edm::ConsumesCollector &&iC)
default contructor
edm::EDGetTokenT< reco::BeamSpot > beamspot__
SelectionStep< reco::PFCandidate > * PFElectronStep
void fill(const std::string histName, double value) const
fill histogram if it had been booked before
void fill(const std::string histName, double xValue, double yValue) const
fill histogram if it had been booked before (2-dim version)
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
void book(std::string directory)
book histograms in subdirectory directory
std::string elecIso_
extra isolation criterion on electron