CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Member Functions | Private Attributes
EfficiencyPlotter Class Reference

#include <EfficiencyPlotter.h>

Inheritance diagram for EfficiencyPlotter:
edm::EDAnalyzer

Public Member Functions

 EfficiencyPlotter (const edm::ParameterSet &ps)
 Constructor. More...
 
virtual ~EfficiencyPlotter ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c)
 Analyze. More...
 
void beginJob (void)
 BeginJob. More...
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &context)
 
void beginRun (edm::Run const &run, edm::EventSetup const &eSetup)
 
void endJob ()
 Endjob. More...
 
void endLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &c)
 DQM Client Diagnostic. More...
 
void endRun (edm::Run const &run, edm::EventSetup const &eSetup)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Private Attributes

int etaBin
 
double etaMax
 
double etaMin
 
MonitorElementh_eff_eta_TightMu
 
MonitorElementh_eff_hp_eta_TightMu
 
MonitorElementh_eff_phi_TightMu
 
MonitorElementh_eff_pt_barrel_TightMu
 
MonitorElementh_eff_pt_endcap_TightMu
 
MonitorElementh_eff_pt_TightMu
 
std::string metname
 
int nevents
 
unsigned int nLumiSegs
 
edm::ParameterSet parameters
 
int phiBin
 
double phiMax
 
double phiMin
 
int prescaleFactor
 
int ptBin
 
double ptMax
 
double ptMin
 
int run
 
DQMStoretheDbe
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 

Detailed Description

Definition at line 26 of file EfficiencyPlotter.h.

Constructor & Destructor Documentation

EfficiencyPlotter::EfficiencyPlotter ( const edm::ParameterSet ps)

Constructor.

Definition at line 29 of file EfficiencyPlotter.cc.

References cppFunctionSkipper::operator, and Parameters::parameters.

EfficiencyPlotter::~EfficiencyPlotter ( )
virtual

Destructor.

Definition at line 33 of file EfficiencyPlotter.cc.

33 {}

Member Function Documentation

void EfficiencyPlotter::analyze ( const edm::Event e,
const edm::EventSetup c 
)
protectedvirtual

Analyze.

Implements edm::EDAnalyzer.

Definition at line 81 of file EfficiencyPlotter.cc.

References LogTrace, metname, and nevents.

81  {
82  nevents++;
83  LogTrace(metname)<< "[EfficiencyPlotter]: "<<nevents<<" events";
84 }
#define LogTrace(id)
void EfficiencyPlotter::beginJob ( void  )
protectedvirtual

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 35 of file EfficiencyPlotter.cc.

References jptDQMConfig_cff::etaMax, jptDQMConfig_cff::etaMin, LogTrace, metname, Parameters::parameters, jptDQMConfig_cff::phiMax, jptDQMConfig_cff::phiMin, jptDQMConfig_cff::ptMax, and PtMinSelector_cfg::ptMin.

35  {
36  //metname = "muonRecoTest";
37 
38  metname = "EfficiencyAnalyzer";
39  theDbe->setCurrentFolder("Muons/EfficiencyAnalyzer");
40 
41  LogTrace(metname)<<"[EfficiencyPlotter] beginJob: Parameters initialization";
42 
43  // efficiency plot
44  etaBin = parameters.getParameter<int>("etaBin");
45  etaMin = parameters.getParameter<double>("etaMin");
46  etaMax = parameters.getParameter<double>("etaMax");
47  h_eff_eta_TightMu = theDbe->book1D("Eff_eta_TightMu", "TightMu Efficiency vs #eta", etaBin, etaMin, etaMax);
48  h_eff_hp_eta_TightMu = theDbe->book1D("Eff_hp_eta_TightMu", "High Pt TightMu Efficiency vs #eta", etaBin, etaMin, etaMax);
49 
50  phiBin = parameters.getParameter<int>("phiBin");
51  phiMin = parameters.getParameter<double>("phiMin");
52  phiMax = parameters.getParameter<double>("phiMax");
53  h_eff_phi_TightMu = theDbe->book1D("Eff_phi_TightMu", "TightMu Efficiency vs #phi", phiBin, phiMin, phiMax);
54 
55  ptBin = parameters.getParameter<int>("ptBin");
56  ptMin = parameters.getParameter<double>("ptMin");
57  ptMax = parameters.getParameter<double>("ptMax");
58  h_eff_pt_TightMu = theDbe->book1D("Eff_pt_TightMu", "TightMu Efficiency vs Pt", ptBin, ptMin, ptMax);
59  h_eff_pt_barrel_TightMu = theDbe->book1D("Eff_pt_barrel_TightMu", "Barrel: TightMu Efficiency vs Pt", ptBin, ptMin, ptMax);
60  h_eff_pt_endcap_TightMu = theDbe->book1D("Eff_pt_endcap_TightMu", "Endcap: TightMu Efficiency vs Pt", ptBin, ptMin, ptMax);
61 
62 
63  h_eff_eta_TightMu->setEfficiencyFlag();
65  h_eff_phi_TightMu->setEfficiencyFlag();
66  h_eff_pt_TightMu->setEfficiencyFlag();
69 
70 }
T getParameter(std::string const &) const
MonitorElement * h_eff_eta_TightMu
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:717
MonitorElement * h_eff_pt_TightMu
#define LogTrace(id)
MonitorElement * h_eff_pt_endcap_TightMu
edm::ParameterSet parameters
MonitorElement * h_eff_hp_eta_TightMu
MonitorElement * h_eff_phi_TightMu
void setEfficiencyFlag(void)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
MonitorElement * h_eff_pt_barrel_TightMu
void EfficiencyPlotter::beginLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  context 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 76 of file EfficiencyPlotter.cc.

References LogTrace, metname, edm::LuminosityBlockBase::run(), and DTTTrigCorrFirst::run.

76  {
77  LogTrace(metname)<<"[EfficiencyPlotter]: beginLuminosityBlock";
78  // Get the run number
79  run = lumiSeg.run();
80 }
#define LogTrace(id)
void EfficiencyPlotter::beginRun ( edm::Run const &  run,
edm::EventSetup const &  eSetup 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 73 of file EfficiencyPlotter.cc.

References LogTrace, and metname.

73  {
74  LogTrace(metname)<<"[EfficiencyPlotter]: beginRun";
75 }
#define LogTrace(id)
void EfficiencyPlotter::endJob ( void  )
protectedvirtual

Endjob.

Reimplemented from edm::EDAnalyzer.

Definition at line 266 of file EfficiencyPlotter.cc.

References LogTrace, and metname.

266  {
267  LogTrace(metname)<< "[EfficiencyPlotter] endJob called!";
268  theDbe->rmdir("Muons/EfficiencyAnalyzer");
269 }
void rmdir(const std::string &fullpath)
Definition: DQMStore.cc:2530
#define LogTrace(id)
void EfficiencyPlotter::endLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  c 
)
protectedvirtual

DQM Client Diagnostic.

Reimplemented from edm::EDAnalyzer.

Definition at line 85 of file EfficiencyPlotter.cc.

References edm::LuminosityBlockBase::id(), and edm::LuminosityBlockID::luminosityBlock().

85  {
86  // LogTrace(metname)<<"[EfficiencyPlotter]: endLuminosityBlock, performing the DQM LS client operation";
87  // counts number of lumiSegs
88  nLumiSegs = lumiSeg.id().luminosityBlock();
89 }
unsigned int nLumiSegs
void EfficiencyPlotter::endRun ( edm::Run const &  run,
edm::EventSetup const &  eSetup 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 90 of file EfficiencyPlotter.cc.

References MonitorElement::getTH1F(), LogTrace, and metname.

90  {
91  LogTrace(metname)<<"[EfficiencyPlotter]: endRun, performing the DQM end of run client operation";
92 
93 
94 
95  string numpath_pt = "Muons/EfficiencyAnalyzer/passProbes_TightMu_pt";
96  string denpath_pt = "Muons/EfficiencyAnalyzer/allProbes_pt";
97 
98  MonitorElement *Numerator_pt = theDbe->get(numpath_pt);
99  MonitorElement *Denominator_pt = theDbe->get(denpath_pt);
100 
101  if (Numerator_pt && Denominator_pt){
102 
103  TH1F *h_numerator_pt = Numerator_pt->getTH1F();
104  TH1F *h_denominator_pt = Denominator_pt->getTH1F();
105 
106  TH1F *h_eff_pt = h_eff_pt_TightMu->getTH1F();
107 
108  if (h_eff_pt->GetSumw2N() == 0) h_eff_pt->Sumw2();
109 
110 
111  h_eff_pt->Divide(h_numerator_pt, h_denominator_pt, 1., 1., "B");
112 
113  }
114 
115  string numpath_barrel_pt = "Muons/EfficiencyAnalyzer/passProbes_TightMu_barrel_pt";
116  string denpath_barrel_pt = "Muons/EfficiencyAnalyzer/allProbes_barrel_pt";
117 
118  MonitorElement *Numerator_barrel_pt = theDbe->get(numpath_barrel_pt);
119  MonitorElement *Denominator_barrel_pt = theDbe->get(denpath_barrel_pt);
120 
121  if (Numerator_barrel_pt && Denominator_barrel_pt){
122 
123  TH1F *h_numerator_barrel_pt = Numerator_barrel_pt->getTH1F();
124  TH1F *h_denominator_barrel_pt = Denominator_barrel_pt->getTH1F();
125 
126  TH1F *h_eff_barrel_pt = h_eff_pt_barrel_TightMu->getTH1F();
127 
128  if (h_eff_barrel_pt->GetSumw2N() == 0) h_eff_barrel_pt->Sumw2();
129 
130  h_eff_barrel_pt->Divide(h_numerator_barrel_pt, h_denominator_barrel_pt, 1., 1., "B");
131 
132  }
133 
134  string numpath_endcap_pt = "Muons/EfficiencyAnalyzer/passProbes_TightMu_endcap_pt";
135  string denpath_endcap_pt = "Muons/EfficiencyAnalyzer/allProbes_endcap_pt";
136 
137  MonitorElement *Numerator_endcap_pt = theDbe->get(numpath_endcap_pt);
138  MonitorElement *Denominator_endcap_pt = theDbe->get(denpath_endcap_pt);
139 
140  if (Numerator_endcap_pt && Denominator_endcap_pt){
141 
142  TH1F *h_numerator_endcap_pt = Numerator_endcap_pt->getTH1F();
143  TH1F *h_denominator_endcap_pt = Denominator_endcap_pt->getTH1F();
144 
145  TH1F *h_eff_endcap_pt = h_eff_pt_endcap_TightMu->getTH1F();
146 
147  if (h_eff_endcap_pt->GetSumw2N() == 0) h_eff_endcap_pt->Sumw2();
148 
149  h_eff_endcap_pt->Divide(h_numerator_endcap_pt, h_denominator_endcap_pt, 1., 1., "B");
150 
151  }
152 
153  string numpath_eta = "Muons/EfficiencyAnalyzer/passProbes_TightMu_eta";
154  string denpath_eta = "Muons/EfficiencyAnalyzer/allProbes_eta";
155 
156  MonitorElement *Numerator_eta = theDbe->get(numpath_eta);
157  MonitorElement *Denominator_eta = theDbe->get(denpath_eta);
158 
159  if (Numerator_eta && Denominator_eta){
160 
161  TH1F *h_numerator_eta = Numerator_eta->getTH1F();
162  TH1F *h_denominator_eta = Denominator_eta->getTH1F();
163 
164  TH1F *h_eff_eta = h_eff_eta_TightMu->getTH1F();
165 
166  if (h_eff_eta->GetSumw2N() == 0) h_eff_eta->Sumw2();
167 
168  h_eff_eta->Divide(h_numerator_eta, h_denominator_eta, 1., 1., "B");
169 
170  }
171 
172  string numpath_hp_eta = "Muons/EfficiencyAnalyzer/passProbes_TightMu_hp_eta";
173  string denpath_hp_eta = "Muons/EfficiencyAnalyzer/allProbes_hp_eta";
174 
175  MonitorElement *Numerator_hp_eta = theDbe->get(numpath_hp_eta);
176  MonitorElement *Denominator_hp_eta = theDbe->get(denpath_hp_eta);
177 
178  if (Numerator_hp_eta && Denominator_hp_eta){
179 
180  TH1F *h_numerator_hp_eta = Numerator_hp_eta->getTH1F();
181  TH1F *h_denominator_hp_eta = Denominator_hp_eta->getTH1F();
182 
183  TH1F *h_eff_hp_eta = h_eff_hp_eta_TightMu->getTH1F();
184 
185  if (h_eff_hp_eta->GetSumw2N() == 0) h_eff_hp_eta->Sumw2();
186 
187  h_eff_hp_eta->Divide(h_numerator_hp_eta, h_denominator_hp_eta, 1., 1., "B");
188 
189  }
190 
191 
192 string numpath_phi = "Muons/EfficiencyAnalyzer/passProbes_TightMu_phi";
193  string denpath_phi = "Muons/EfficiencyAnalyzer/allProbes_phi";
194 
195  MonitorElement *Numerator_phi = theDbe->get(numpath_phi);
196  MonitorElement *Denominator_phi = theDbe->get(denpath_phi);
197 
198  if (Numerator_phi && Denominator_phi){
199 
200  TH1F *h_numerator_phi = Numerator_phi->getTH1F();
201  TH1F *h_denominator_phi = Denominator_phi->getTH1F();
202 
203  TH1F *h_eff_phi = h_eff_phi_TightMu->getTH1F();
204 
205  if (h_eff_phi->GetSumw2N() == 0) h_eff_phi->Sumw2();
206 
207  h_eff_phi->Divide(h_numerator_phi, h_denominator_phi, 1., 1., "B");
208 
209  }
210 
211 
212 
213 
214 
215  /* for(int i=1; i<=ptBin; i++){
216  if (h_denominator->GetBinContent(i) == 0) efficiency = 0;
217  else efficiency = double(h_numerator->GetBinContent(i))/double(h_denominator->GetBinContent(i));
218  ptEfficiency->setBinContent(i,efficiency);
219  }
220  }*/
221 
222 
223  /*
224  numpath = "Muons/EfficiencyAnalyzer/Numerator_eta";
225  denpath = "Muons/EfficiencyAnalyzer/Denominator_eta";
226  Numerator = theDbe->get(numpath);
227  Denominator = theDbe->get(numpath);
228  if (Numerator && Denominator){
229  TH1F *h_numerator = Numerator->getTH1F();
230  TH1F *h_denominator = Denominator->getTH1F();
231 
232  for(int i=1; i<=etaBin; i++){
233  if (h_denominator->GetBinContent(i) == 0) efficiency = 0;
234  else efficiency = double(h_numerator->GetBinContent(i))/double(h_denominator->GetBinContent(i));
235  etaEfficiency->setBinContent(i,efficiency);
236  }
237  }
238 
239  numpath = "Muons/EfficiencyAnalyzer/Numerator_phi";
240  denpath = "Muons/EfficiencyAnalyzer/Denominator_phi";
241  Numerator = theDbe->get(numpath);
242  Denominator = theDbe->get(numpath);
243 
244  if (Numerator && Denominator){
245  TH1F *h_numerator = Numerator->getTH1F();
246  TH1F *h_denominator = Denominator->getTH1F();
247 
248  // h_numerator->Divide(h_denominator);
249  if(h_numerator->GetXaxis()->GetNbins()!=ptBin ||
250  h_numerator->GetXaxis()->GetXmax()!=ptBin ||
251  h_numerator->GetXaxis()->GetXmin()!=ptBin){
252  LogTrace(metname)<<"[EfficiencyPlotter] wrong histo binning on eta histograms";
253  return;
254  }
255 
256  for(int i=1; i<=phiBin; i++){
257  if (h_denominator->GetBinContent(i) == 0) efficiency = 0;
258  else efficiency = double(h_numerator->GetBinContent(i))/double(h_denominator->GetBinContent(i));
259  phiEfficiency->setBinContent(i,efficiency);
260  }
261 
262  }*/
263 }
MonitorElement * h_eff_eta_TightMu
MonitorElement * h_eff_pt_TightMu
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1468
#define LogTrace(id)
MonitorElement * h_eff_pt_endcap_TightMu
MonitorElement * h_eff_hp_eta_TightMu
TH1F * getTH1F(void) const
MonitorElement * h_eff_phi_TightMu
MonitorElement * h_eff_pt_barrel_TightMu

Member Data Documentation

int EfficiencyPlotter::etaBin
private

Definition at line 69 of file EfficiencyPlotter.h.

double EfficiencyPlotter::etaMax
private

Definition at line 71 of file EfficiencyPlotter.h.

double EfficiencyPlotter::etaMin
private

Definition at line 70 of file EfficiencyPlotter.h.

MonitorElement* EfficiencyPlotter::h_eff_eta_TightMu
private

Definition at line 85 of file EfficiencyPlotter.h.

MonitorElement* EfficiencyPlotter::h_eff_hp_eta_TightMu
private

Definition at line 86 of file EfficiencyPlotter.h.

MonitorElement* EfficiencyPlotter::h_eff_phi_TightMu
private

Definition at line 87 of file EfficiencyPlotter.h.

MonitorElement* EfficiencyPlotter::h_eff_pt_barrel_TightMu
private

Definition at line 83 of file EfficiencyPlotter.h.

MonitorElement* EfficiencyPlotter::h_eff_pt_endcap_TightMu
private

Definition at line 84 of file EfficiencyPlotter.h.

MonitorElement* EfficiencyPlotter::h_eff_pt_TightMu
private

Definition at line 82 of file EfficiencyPlotter.h.

std::string EfficiencyPlotter::metname
private

Definition at line 63 of file EfficiencyPlotter.h.

int EfficiencyPlotter::nevents
private

Definition at line 58 of file EfficiencyPlotter.h.

unsigned int EfficiencyPlotter::nLumiSegs
private

Definition at line 59 of file EfficiencyPlotter.h.

edm::ParameterSet EfficiencyPlotter::parameters
private
int EfficiencyPlotter::phiBin
private

Definition at line 77 of file EfficiencyPlotter.h.

double EfficiencyPlotter::phiMax
private

Definition at line 79 of file EfficiencyPlotter.h.

double EfficiencyPlotter::phiMin
private

Definition at line 78 of file EfficiencyPlotter.h.

int EfficiencyPlotter::prescaleFactor
private

Definition at line 60 of file EfficiencyPlotter.h.

int EfficiencyPlotter::ptBin
private

Definition at line 73 of file EfficiencyPlotter.h.

double EfficiencyPlotter::ptMax
private

Definition at line 75 of file EfficiencyPlotter.h.

double EfficiencyPlotter::ptMin
private

Definition at line 74 of file EfficiencyPlotter.h.

int EfficiencyPlotter::run
private
DQMStore* EfficiencyPlotter::theDbe
private

Definition at line 65 of file EfficiencyPlotter.h.