#include <HLTriggerOffline/BJet/interface/RatePlots.h>
Public Member Functions | |
std::pair< double, double > | confidence (unsigned int level, double conf=0.683) const |
double | efficiency (unsigned int level) const |
void | fill (unsigned int level) |
void | init (const std::string &name, const std::string &title, unsigned int levels) |
unsigned int | rate (unsigned int level) const |
RatePlots () | |
void | save (TDirectory &file) |
std::pair< double, double > | stepConfidence (unsigned int level, double conf=0.683) const |
double | stepEfficiency (unsigned int level) const |
Public Attributes | |
TH1 * | m_rates |
Definition at line 19 of file RatePlots.h.
RatePlots::RatePlots | ( | ) | [inline] |
std::pair<double, double> RatePlots::confidence | ( | unsigned int | level, | |
double | conf = 0.683 | |||
) | const [inline] |
Definition at line 115 of file RatePlots.h.
References dbtoconf::conf, confidence::confidence_binomial_jeffreys_modified(), m_rates, and t.
Referenced by HLTBtagLifetimeAnalyzer::endJob().
00116 { 00117 confidence::interval t; 00118 if (level == 0) 00119 t = std::make_pair(1., 1.); 00120 else if (level > (unsigned int) m_rates->GetNbinsX()) 00121 t = std::make_pair(NAN, NAN); 00122 else if (m_rates->GetBinContent( 1 ) == 0) 00123 t = std::make_pair(0., 1.); 00124 else 00125 t = confidence::confidence_binomial_jeffreys_modified((int) m_rates->GetBinContent( 1 ), (int) m_rates->GetBinContent( level+1 ), conf); 00126 return t; 00127 }
double RatePlots::efficiency | ( | unsigned int | level | ) | const [inline] |
Definition at line 97 of file RatePlots.h.
References m_rates, and value.
Referenced by HLTBtagLifetimeAnalyzer::endJob().
00098 { 00099 double value = 0.; 00100 if (level == 0) 00101 value = 1.; 00102 else if (level > (unsigned int) m_rates->GetNbinsX()) 00103 value = NAN; 00104 else if (m_rates->GetBinContent( 1 ) == 0) 00105 value = NAN; 00106 else 00107 value = (m_rates->GetBinContent( level+1 ) / m_rates->GetBinContent( 1 )); 00108 return value; 00109 }
Definition at line 42 of file RatePlots.h.
References m_rates.
Referenced by HLTBtagLifetimeAnalyzer::analyze().
void RatePlots::init | ( | const std::string & | name, | |
const std::string & | title, | |||
unsigned int | levels | |||
) | [inline] |
Definition at line 24 of file RatePlots.h.
References m_rates.
Referenced by HLTBtagLifetimeAnalyzer::beginJob().
00025 { 00026 // access the shared ROOT file via TFileService 00027 edm::Service<TFileService> fileservice; 00028 00029 // enable sum-of-squares for all plots 00030 bool sumw2 = TH1::GetDefaultSumw2(); 00031 TH1::SetDefaultSumw2(true); 00032 00033 // a path with N filters can have N+1 rates: initial, after the 1st, ... after the Nth filter 00034 m_rates = fileservice->make<TH1I>((name + "_rates").c_str(), (title + " rates").c_str(), (levels+1), 0, (levels+1)); 00035 00036 // reset sum-of-squares status 00037 TH1::SetDefaultSumw2(sumw2); 00038 }
Definition at line 49 of file RatePlots.h.
References m_rates, and value.
Referenced by HLTBtagLifetimeAnalyzer::endJob().
00050 { 00051 unsigned int value = 0; 00052 if (level > (unsigned int) m_rates->GetNbinsX()) 00053 value = 0; 00054 else 00055 // I *hate* the way ROOT handles bins - it's a capital offence by itself 00056 value = (unsigned int) m_rates->GetBinContent( level+1 ); 00057 return value; 00058 }
void RatePlots::save | ( | TDirectory & | file | ) | [inline] |
std::pair<double, double> RatePlots::stepConfidence | ( | unsigned int | level, | |
double | conf = 0.683 | |||
) | const [inline] |
Definition at line 80 of file RatePlots.h.
References dbtoconf::conf, confidence::confidence_binomial_jeffreys_modified(), m_rates, and t.
Referenced by HLTBtagLifetimeAnalyzer::endJob().
00081 { 00082 confidence::interval t; 00083 if (level == 0) 00084 t = std::make_pair(1., 1.); 00085 else if (level > (unsigned int) m_rates->GetNbinsX()) 00086 t = std::make_pair(NAN, NAN); 00087 else if (m_rates->GetBinContent( level ) == 0) 00088 t = std::make_pair(0., 1.); 00089 else 00090 t = confidence::confidence_binomial_jeffreys_modified((int) m_rates->GetBinContent( level ), (int) m_rates->GetBinContent( level+1 ), conf); 00091 return t; 00092 }
double RatePlots::stepEfficiency | ( | unsigned int | level | ) | const [inline] |
Definition at line 62 of file RatePlots.h.
References m_rates, and value.
Referenced by HLTBtagLifetimeAnalyzer::endJob().
00063 { 00064 double value = 0.; 00065 if (level == 0) 00066 value = 1.; 00067 else if (level > (unsigned int) m_rates->GetNbinsX()) 00068 value = NAN; 00069 else if (m_rates->GetBinContent( level ) == 0) 00070 value = NAN; 00071 else 00072 value = (m_rates->GetBinContent( level+1 ) / m_rates->GetBinContent( level )); 00073 return value; 00074 }
TH1* RatePlots::m_rates |
Definition at line 134 of file RatePlots.h.
Referenced by confidence(), efficiency(), fill(), init(), rate(), save(), stepConfidence(), and stepEfficiency().