CMS 3D CMS Logo

Public Member Functions | Private Attributes

EfficiencyHandler Class Reference

#include <HLTEfficiencyCalculator.h>

List of all members.

Public Member Functions

 EfficiencyHandler (std::string Name, const 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,
const 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.

                                                                                              :name(Name),verbosity(verb){
                int nPaths = (int)pathnames.size();
                efficiencies= new TH1D(name.c_str(),"efficiencies per path",nPaths,-0.5,(double)nPaths-0.5);
                std::stringstream s;
                for(int i = 0; i < nPaths; i++){
                        pathNames.push_back(pathnames.at(i));
                        efficiencies->GetXaxis()->SetBinLabel(i+1,pathnames.at(i).c_str());
                        s.str("");
                        s<<"path_"<<i+1;
                        numerator.push_back(new TH1D((s.str()+"_num").c_str(),(s.str()+"_num").c_str(),1,-0.5,0.5));
                        denominator.push_back(new TH1D((s.str()+"_den").c_str(),(s.str()+"_den").c_str(),1,-0.5,0.5));
                }
        }
EfficiencyHandler::~EfficiencyHandler ( ) [inline]

Definition at line 75 of file HLTEfficiencyCalculator.h.

{}

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().

                                                                               {
                for(unsigned int i = 0; i< pathNames.size(); i++){
                        denominator.at(i)->Fill(0);
                        if(verbosity > 0)
                                std::cout<<pathNames.at(i)<<std::endl;                          
                        if(acceptHLT(event, triggerTable,pathNames.at(i)))
                                numerator.at(i)->Fill(0);
                }
        }
void EfficiencyHandler::WriteAll ( TDirectory *  d) [inline]

Definition at line 85 of file HLTEfficiencyCalculator.h.

References gather_cfg::cout, denominator, efficiencies, name, NULL, numerator, pathNames, alignCSCRings::s, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by HLTEffCalculator::endJob().

                                     {
                if(d == NULL){
                        std::cout<<"NULL directory! Cannot write!"<<std::endl;
                        return;
                }
                if((int)efficiencies->GetXaxis()->GetNbins() != (int)denominator.size()){
                        std::cout<<"HLT path numbers mismatch!"<<std::endl;
                        return;
                }
                for(unsigned int s = 0; s < pathNames.size(); s++){
                        double eff = (double)numerator.at(s)->GetEntries();
                        eff= eff/(double)denominator.at(s)->GetEntries();
                        efficiencies->SetBinContent(s+1, eff);
                }
                (d->mkdir(std::string(name+"_BareNumberHists").c_str()))->cd();
                for(unsigned int s = 0; s < pathNames.size(); s++){
                        numerator.at(s)->Write();
                        denominator.at(s)->Write();
                }
                d->cd();
                efficiencies->Write();
                d->cd();
        }

Member Data Documentation

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

Definition at line 111 of file HLTEfficiencyCalculator.h.

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

Definition at line 109 of file HLTEfficiencyCalculator.h.

Referenced by EfficiencyHandler(), and WriteAll().

std::string EfficiencyHandler::name [private]

Definition at line 112 of file HLTEfficiencyCalculator.h.

Referenced by EfficiencyHandler(), and WriteAll().

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().

Definition at line 114 of file HLTEfficiencyCalculator.h.

Referenced by Fill().