CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HLTMonSimpleBTag.h
Go to the documentation of this file.
1 #ifndef HLTMONSIMPLEBTAG_H
2 #define HLTMONSIMPLEBTAG_H
3 
4 // -*- C++ -*-
5 //
6 // Package: HLTMonSimpleBTag
7 // Class: HLTMonSimpleBTag
8 //
16 //
17 // Original Author: Freya Blekman (fblekman)
18 // Created: Fri Mar 11 13:20:18 CET 2011
19 // $Id: HLTMonSimpleBTag.h,v 1.3 2011/03/25 16:10:43 fblekman Exp $
20 //
21 //
22 
23 // system include files
24 #include <memory>
25 #include <unistd.h>
26 
27 
28 // user include files
31 
35 
41 #include <iostream>
42 #include <fstream>
43 #include <vector>
44 #include <string>
45 
46 //
47 // class decleration
48 //
49 
51 public:
52  explicit HLTMonSimpleBTag(const edm::ParameterSet&);
54 
55 
56 private:
57  virtual void beginJob() ;
58  virtual void analyze(const edm::Event&, const edm::EventSetup&);
59  virtual void endJob() ;
60 
61  // BeginRun
62  void beginRun(const edm::Run& run, const edm::EventSetup& c);
63 
64  // EndRun
65  void endRun(const edm::Run& run, const edm::EventSetup& c);
66 
67  // ---------- worker functions --------------------
68 
69  void calcEff(void);
70 
71  std::string makeEffName(std::string trig1, std::string trig2){std::string result="effRelative_"+trig1+"_passedanddivby_"+trig2; return result;}
72  std::string makeEffNumeratorName(std::string trig1, std::string trig2){std::string result="selected_"+trig1+"_passed_"+trig2; return result;}
73 
75  // ----------member data ---------------------------
76  int nev_;
79 
81 
82  bool resetMe_;
84 
85  unsigned int nBins_;
86  double ptMin_ ;
87  double ptMax_ ;
89 
90  std::string dirname_;
95 
96  // helper class to store the data
97  class PathInfo {
99  pathIndex_(-1), pathName_("unset")
100  {};
101  public:
102  void setHistos(MonitorElement* const et, MonitorElement* const eta,
103  MonitorElement* const phi,
104  MonitorElement* const etavsphi ) {
105  et_ = et;
106  eta_ = eta;
107  phi_ = phi;
108  etavsphi_ = etavsphi;
109  }
111  return et_;
112  }
114  return eta_;
115  }
117  return phi_;
118  }
120  return etavsphi_;
121  }
122  const std::string getName(void ) const {
123  return pathName_;
124  }
125  ~PathInfo() {};
126  PathInfo(std::string pathName, float ptmin,
127  float ptmax):
128  pathName_(pathName),
129  et_(0), eta_(0), phi_(0), etavsphi_(0),
130  ptmin_(ptmin), ptmax_(ptmax)
131  {
132  };
133  PathInfo(std::string pathName,
134  MonitorElement *et,
137  MonitorElement *etavsphi,
138  double ptmin, double ptmax
139  ):
140  pathName_(pathName),
141  et_(et), eta_(eta), phi_(phi), etavsphi_(etavsphi),
142  ptmin_(ptmin), ptmax_(ptmax)
143  {};
144  bool operator==(const std::string v)
145  {
146  return v==pathName_;
147  }
148  private:
150  std::string pathName_;
151 
152  // we don't own this data
154 
155  double ptmin_, ptmax_;
156 
157  const int index() {
158  return pathIndex_;
159  }
160 
161  public:
162  double getPtMin() const { return ptmin_; }
163  double getPtMax() const { return ptmax_; }
164  };
165 
166  // simple collection - just
167  class PathInfoCollection: public std::vector<PathInfo> {
168  public:
169  PathInfoCollection(): std::vector<PathInfo>()
170  {};
171  std::vector<PathInfo>::iterator find(std::string pathName) {
172  return std::find(begin(), end(), pathName);
173  }
174  };
177 
178  std::vector<std::pair<std::string,std::string> > triggerMap_; // maps multiple trigger objects in hltPaths_ to each other so they can be used as reference triggers (used by hltEfficiencies_ vector)
179 };
180 #endif
std::string dirname_
virtual void beginJob()
MonitorElement * total_
MonitorElement * getEtHisto()
const std::string getName(void) const
std::vector< PathInfo >::iterator find(std::string pathName)
std::vector< std::pair< std::string, std::string > > triggerMap_
bool operator==(const std::string v)
unsigned int nBins_
void beginRun(const edm::Run &run, const edm::EventSetup &c)
MonitorElement * getEtaVsPhiHisto()
T eta() const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
edm::InputTag triggerSummaryLabel_
PathInfoCollection hltEfficiencies_
PathInfo(std::string pathName, float ptmin, float ptmax)
virtual void analyze(const edm::Event &, const edm::EventSetup &)
void setHistos(MonitorElement *const et, MonitorElement *const eta, MonitorElement *const phi, MonitorElement *const etavsphi)
tuple result
Definition: query.py:137
#define end
Definition: vmac.h:38
virtual void endJob()
HLTMonSimpleBTag(const edm::ParameterSet &)
PathInfo(std::string pathName, MonitorElement *et, MonitorElement *eta, MonitorElement *phi, MonitorElement *etavsphi, double ptmin, double ptmax)
long long int num
Definition: procUtils.cc:71
std::string makeEffNumeratorName(std::string trig1, std::string trig2)
PathInfoCollection hltPaths_
double ptmin
Definition: HydjetWrapper.h:86
#define begin
Definition: vmac.h:31
MonitorElement * getPhiHisto()
void doEffCalc(MonitorElement *eff, MonitorElement *num, MonitorElement *denom)
void endRun(const edm::Run &run, const edm::EventSetup &c)
EndRun.
MonitorElement * getEtaHisto()
void calcEff(void)
calcEff: calculates efficiency using histograms booked in std::map&lt;std::string,std::string&gt; triggerMa...
edm::InputTag triggerResultLabel_
mathSSE::Vec4< T > v
std::string makeEffName(std::string trig1, std::string trig2)
Definition: Run.h:33
Definition: DDAxes.h:10