CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TopSingleLeptonDQM.h
Go to the documentation of this file.
1 #ifndef TOPSINGLELEPTONDQM
2 #define TOPSINGLELEPTONDQM
3 
4 #include <string>
5 #include <vector>
10 
39 namespace TopSingleLepton {
40 
42  public:
45 
46  public:
48  MonitorEnsemble(const char* label, const edm::ParameterSet& cfg, edm::ConsumesCollector && iC );
51 
55  void fill(const edm::Event& event, const edm::EventSetup& setup);
56 
57  private:
60  std::string monitorPath(const std::string& label) const { return label.substr(label.find(':')+1); };
63  std::string selectionPath(const std::string& label) const { return label.substr(0, label.find(':')); };
64 
66  void triggerBinLabels(std::string channel, const std::vector<std::string> labels);
68  void fill(const edm::Event& event, const edm::TriggerResults& triggerTable, std::string channel, const std::vector<std::string> labels) const;
69 
71  bool booked(const std::string histName) const { return hists_.find(histName.c_str())!=hists_.end(); };
73  void fill(const std::string histName, double value) const { if(booked(histName.c_str())) hists_.find(histName.c_str())->second->Fill(value); };
75  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); };
77  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); };
78 
79  private:
85  std::vector<edm::EDGetTokenT<edm::View<reco::MET> > > mets_;
95  std::vector<std::string> triggerPaths_;
96 
114 
117 
122 
141 
143  int logged_;
147  std::map<std::string,MonitorElement*> hists_;
149  };
150 
151  inline void
152  MonitorEnsemble::triggerBinLabels(std::string channel, const std::vector<std::string> labels)
153  {
154  for(unsigned int idx=0; idx<labels.size(); ++idx){
155  hists_[(channel+"Mon_").c_str()]->setBinLabel( idx+1, "["+monitorPath(labels[idx])+"]", 1);
156  hists_[(channel+"Eff_").c_str()]->setBinLabel( idx+1, "["+selectionPath(labels[idx])+"]|["+monitorPath(labels[idx])+"]", 1);
157  }
158  }
159 
160  inline void
161  MonitorEnsemble::fill(const edm::Event& event, const edm::TriggerResults& triggerTable, std::string channel, const std::vector<std::string> labels) const
162  {
163  for(unsigned int idx=0; idx<labels.size(); ++idx){
164  if( accept(event, triggerTable, monitorPath(labels[idx])) ){
165  fill((channel+"Mon_").c_str(), idx+0.5 );
166  // take care to fill triggerMon_ before evts is being called
167  int evts = hists_.find((channel+"Mon_").c_str())->second->getBinContent(idx+1);
168  double value = hists_.find((channel+"Eff_").c_str())->second->getBinContent(idx+1);
169  fill((channel+"Eff_").c_str(), idx+0.5, 1./evts*(accept(event, triggerTable, selectionPath(labels[idx]))-value));
170  }
171  }
172  }
173 
174 }
175 
176 #include <utility>
177 
183 
188 
214 //using TopSingleLepton::MonitorEnsemble;
216 
218  public:
223  if( vertexSelect_ ) delete vertexSelect_;
224  if( beamspotSelect_ ) delete beamspotSelect_;
225  if( MuonStep) delete MuonStep;
226  if( ElectronStep) delete ElectronStep;
227  if( PvStep) delete PvStep;
228  if( METStep) delete METStep;
229  for(unsigned int i = 0; i < JetSteps.size(); i++)
230  if( JetSteps[i]) delete JetSteps[i];
231  for(unsigned int i = 0; i < CaloJetSteps.size(); i++)
232  if( CaloJetSteps[i]) delete CaloJetSteps[i];
233  for(unsigned int i = 0; i < PFJetSteps.size(); i++)
234  if( PFJetSteps[i]) delete PFJetSteps[i];
235 
236 
237  };
238 
240  virtual void analyze(const edm::Event& event, const edm::EventSetup& setup);
241 
242  private:
245  std::string objectType(const std::string& label) { return label.substr(0, label.find(':')); };
248  std::string selectionStep(const std::string& label) { return label.substr(label.find(':')+1); };
249 
250  private:
254  std::vector<std::string> triggerPaths_;
256  //edm::InputTag vertex_;
259 
265 
268  std::vector<std::string> selectionOrder_;
274  std::map<std::string, std::pair<edm::ParameterSet, TopSingleLepton::MonitorEnsemble*> > selection_;
279  std::vector<SelectionStep<reco::Jet> * > JetSteps;
280  std::vector<SelectionStep<reco::CaloJet> * > CaloJetSteps;
281  std::vector<SelectionStep<reco::PFJet> * > PFJetSteps;
282 };
283 
284 #endif
285 
286 /* Local Variables: */
287 /* show-trailing-whitespace: t */
288 /* truncate-lines: t */
289 /* End: */
std::map< std::string, MonitorElement * > hists_
histogram container
std::string selectionPath(const std::string &label) const
int logged_
number of logged interesting events
edm::EDGetTokenT< reco::JetIDValueMap > jetIDLabel_
jetID as an extra selection type
int i
Definition: DBlmapReader.cc:9
double btagEffWP_
btag working points
MonitorEnsemble(const char *label, const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)
default contructor
void fill(const std::string histName, double xValue, double yValue) const
fill histogram if it had been booked before (2-dim version)
SelectionStep< reco::MET > * METStep
std::vector< std::string > triggerPaths_
edm::EDGetTokenT< edm::TriggerResults > triggerTable_
trigger table
define MonitorEnsembple to be used
StringCutObjectSelector< reco::BeamSpot > * beamspotSelect_
string cut selector
TopSingleLeptonDQM(const edm::ParameterSet &cfg)
default constructor
edm::EDGetTokenT< reco::BeamSpot > beamspot__
edm::EDGetTokenT< reco::JetTagCollection > btagCSV_
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:26
edm::EDGetTokenT< edm::View< reco::GsfElectron > > elecs_
std::vector< std::string > triggerPaths_
trigger paths
std::vector< std::string > selectionOrder_
std::vector< edm::EDGetTokenT< edm::View< reco::MET > > > mets_
considers a vector of METs
std::string selectionStep(const std::string &label)
edm::EDGetTokenT< edm::View< reco::Jet > > jets_
input sources for monitoring
Level verbosity_
verbosity level for booking
StringCutObjectSelector< reco::Vertex > * pvSelect_
extra selection on primary vertices; meant to investigate the pile-up effect
double lowerEdge_
mass window upper and lower edge
std::vector< SelectionStep< reco::Jet > * > JetSteps
U second(std::pair< T, U > const &p)
SelectionStep< reco::Muon > * MuonStep
std::map< std::string, std::pair< edm::ParameterSet, TopSingleLepton::MonitorEnsemble * > > selection_
edm::InputTag beamspot_
beamspot
StringCutObjectSelector< reco::Muon > * muonSelect_
extra selection on muons
void fill(const std::string histName, double value) const
fill histogram if it had been booked before
void book(std::string directory)
book histograms in subdirectory directory
~MonitorEnsemble()
default destructor
SelectionStep< reco::GsfElectron > * ElectronStep
edm::EDGetTokenT< edm::View< reco::Vertex > > pvs_
StringCutObjectSelector< reco::GsfElectron > * elecIso_
extra isolation criterion on electron
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< edm::TriggerResults > triggerTable__
trigger table
std::vector< SelectionStep< reco::PFJet > * > PFJetSteps
SelectionStep< reco::Vertex > * PvStep
std::string label_
instance label
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
edm::EDGetTokenT< reco::JetTagCollection > btagVtx_
edm::EDGetTokenT< edm::View< reco::Muon > > muons_
StringCutObjectSelector< reco::GsfElectron > * elecSelect_
extra selection on electrons
Level
different verbosity levels
std::vector< SelectionStep< reco::CaloJet > * > CaloJetSteps
std::string objectType(const std::string &label)
StringCutObjectSelector< reco::Muon > * muonIso_
extra isolation criterion on muon
void fill(const edm::Event &event, const edm::EventSetup &setup)
fill monitor histograms with electronId and jetCorrections
edm::EDGetTokenT< reco::JetTagCollection > btagEff_
btag discriminator labels
void triggerBinLabels(std::string channel, const std::vector< std::string > labels)
set configurable labels for trigger monitoring histograms
std::string jetCorrector_
jetCorrector
edm::EDGetTokenT< edm::ValueMap< float > > electronId_
electronId label
~TopSingleLeptonDQM()
default destructor
std::string monitorPath(const std::string &label) const
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
StringCutObjectSelector< reco::JetID > * jetIDSelect_
extra jetID selection on calo jets
virtual void analyze(const edm::Event &event, const edm::EventSetup &setup)
do this during the event loop
edm::EDGetTokenT< reco::JetTagCollection > btagPur_
StringCutObjectSelector< reco::Vertex > * vertexSelect_
primary vertex
bool booked(const std::string histName) const
check if histogram was booked
DQMStore * store_
storage manager