CMS 3D CMS Logo

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

#include <HLTEfficiencyCalculator.h>

Public Member Functions

 EfficiencyHandler (std::string Name, std::vector< std::string > pathnames, int verb=0)
 
void Fill (const edm::Event &event, const edm::TriggerResults &triggerTable)
 
void WriteAll (TDirectory *d)
 
 ~EfficiencyHandler ()
 

Private Attributes

std::vector< TH1 * > denominator
 
TH1 * efficiencies
 
std::string name
 
std::vector< TH1 * > numerator
 
std::vector< std::string > pathNames
 
int verbosity
 

Detailed Description

Definition at line 60 of file HLTEfficiencyCalculator.h.

Constructor & Destructor Documentation

EfficiencyHandler::EfficiencyHandler ( std::string  Name,
std::vector< std::string >  pathnames,
int  verb = 0 
)
inline

Definition at line 62 of file HLTEfficiencyCalculator.h.

References denominator, efficiencies, i, name, numerator, pathNames, and alignCSCRings::s.

62  :name(Name),verbosity(verb){
63  int nPaths = (int)pathnames.size();
64  efficiencies= new TH1D(name.c_str(),"efficiencies per path",nPaths,-0.5,(double)nPaths-0.5);
65  std::stringstream s;
66  for(int i = 0; i < nPaths; i++){
67  pathNames.push_back(pathnames.at(i));
68  efficiencies->GetXaxis()->SetBinLabel(i+1,pathnames.at(i).c_str());
69  s.str("");
70  s<<"path_"<<i+1;
71  numerator.push_back(new TH1D((s.str()+"_num").c_str(),(s.str()+"_num").c_str(),1,-0.5,0.5));
72  denominator.push_back(new TH1D((s.str()+"_den").c_str(),(s.str()+"_den").c_str(),1,-0.5,0.5));
73  }
74  }
int i
Definition: DBlmapReader.cc:9
std::vector< TH1 * > denominator
std::vector< TH1 * > numerator
std::vector< std::string > pathNames
tuple pathnames
Definition: lumiPlot.py:411
EfficiencyHandler::~EfficiencyHandler ( )
inline

Definition at line 75 of file HLTEfficiencyCalculator.h.

75 {}

Member Function Documentation

void EfficiencyHandler::Fill ( const edm::Event event,
const edm::TriggerResults triggerTable 
)
inline

Definition at line 76 of file HLTEfficiencyCalculator.h.

References acceptHLT(), gather_cfg::cout, denominator, i, numerator, pathNames, and verbosity.

Referenced by HLTEffCalculator::analyze().

76  {
77  for(unsigned int i = 0; i< pathNames.size(); i++){
78  denominator.at(i)->Fill(0);
79  if(verbosity > 0)
80  std::cout<<pathNames.at(i)<<std::endl;
81  if(acceptHLT(event, triggerTable,pathNames.at(i)))
82  numerator.at(i)->Fill(0);
83  }
84  }
int i
Definition: DBlmapReader.cc:9
bool acceptHLT(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
std::vector< TH1 * > denominator
std::vector< TH1 * > numerator
std::vector< std::string > pathNames
tuple cout
Definition: gather_cfg.py:121
void EfficiencyHandler::WriteAll ( TDirectory *  d)
inline

Definition at line 85 of file HLTEfficiencyCalculator.h.

References gather_cfg::cout, denominator, interpolateCardsSimple::eff, efficiencies, name, NULL, numerator, pathNames, and alignCSCRings::s.

Referenced by HLTEffCalculator::endJob().

85  {
86  if(d == NULL){
87  std::cout<<"NULL directory! Cannot write!"<<std::endl;
88  return;
89  }
90  if((int)efficiencies->GetXaxis()->GetNbins() != (int)denominator.size()){
91  std::cout<<"HLT path numbers mismatch!"<<std::endl;
92  return;
93  }
94  for(unsigned int s = 0; s < pathNames.size(); s++){
95  double eff = (double)numerator.at(s)->GetEntries();
96  eff= eff/(double)denominator.at(s)->GetEntries();
97  efficiencies->SetBinContent(s+1, eff);
98  }
99  (d->mkdir(std::string(name+"_BareNumberHists").c_str()))->cd();
100  for(unsigned int s = 0; s < pathNames.size(); s++){
101  numerator.at(s)->Write();
102  denominator.at(s)->Write();
103  }
104  d->cd();
105  efficiencies->Write();
106  d->cd();
107  }
#define NULL
Definition: scimark2.h:8
std::vector< TH1 * > denominator
std::vector< TH1 * > numerator
std::vector< std::string > pathNames
tuple cout
Definition: gather_cfg.py:121

Member Data Documentation

std::vector<TH1*> EfficiencyHandler::denominator
private

Definition at line 111 of file HLTEfficiencyCalculator.h.

Referenced by EfficiencyHandler(), Fill(), and WriteAll().

TH1* EfficiencyHandler::efficiencies
private

Definition at line 109 of file HLTEfficiencyCalculator.h.

Referenced by EfficiencyHandler(), and WriteAll().

std::string EfficiencyHandler::name
private
std::vector<TH1*> EfficiencyHandler::numerator
private

Definition at line 110 of file HLTEfficiencyCalculator.h.

Referenced by EfficiencyHandler(), Fill(), and WriteAll().

std::vector<std::string> EfficiencyHandler::pathNames
private

Definition at line 113 of file HLTEfficiencyCalculator.h.

Referenced by EfficiencyHandler(), Fill(), and WriteAll().

int EfficiencyHandler::verbosity
private

Definition at line 114 of file HLTEfficiencyCalculator.h.

Referenced by Fill().