CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

TopElectronHLTOfflineClient Class Reference

#include <TopElectronHLTOfflineClient.h>

Inheritance diagram for TopElectronHLTOfflineClient:
edm::EDAnalyzer edm::EDConsumerBase

List of all members.

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
virtual void beginJob ()
virtual void beginLuminosityBlock (const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &context)
virtual void beginRun (const edm::Run &run, const edm::EventSetup &c)
void createSingleEffHists (const std::string &, const std::string &, const std::string &)
virtual void endJob ()
virtual void endLuminosityBlock (const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c)
virtual void endRun (const edm::Run &run, const edm::EventSetup &c)
MonitorElementmakeEffMonElemFromPassAndAll (const std::string &name, const MonitorElement *pass, const MonitorElement *fail)
 TopElectronHLTOfflineClient (const edm::ParameterSet &)
virtual ~TopElectronHLTOfflineClient ()

Private Member Functions

TopElectronHLTOfflineClientoperator= (const TopElectronHLTOfflineClient &rhs)
void runClient_ ()
 TopElectronHLTOfflineClient (const TopElectronHLTOfflineClient &rhs)

Private Attributes

bool addExtraId_
DQMStoredbe_
std::string dirName_
std::vector< std::string > electronIdNames_
std::vector< std::string > electronTriggerNames_
std::vector< std::string > eleMeNames_
std::string hltTag_
bool runClientEndJob_
bool runClientEndLumiBlock_
bool runClientEndRun_
std::vector< std::string > superMeNames_
std::vector< std::string > superTriggerNames_

Detailed Description

Definition at line 37 of file TopElectronHLTOfflineClient.h.


Constructor & Destructor Documentation

TopElectronHLTOfflineClient::TopElectronHLTOfflineClient ( const TopElectronHLTOfflineClient rhs) [inline, private]

Definition at line 60 of file TopElectronHLTOfflineClient.h.

{}
TopElectronHLTOfflineClient::TopElectronHLTOfflineClient ( const edm::ParameterSet iConfig) [explicit]

Definition at line 15 of file TopElectronHLTOfflineClient.cc.

References addExtraId_, dbe_, dirName_, electronIdNames_, electronTriggerNames_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), hltTag_, cppFunctionSkipper::operator, runClientEndJob_, runClientEndLumiBlock_, runClientEndRun_, DQMStore::setCurrentFolder(), DQMStore::setVerbose(), AlCaHLTBitMon_QueryRunRegistry::string, and superTriggerNames_.

                                                                                       : dbe_(NULL)
{
        dbe_ = edm::Service<DQMStore>().operator->();
        
        if (!dbe_) 
        {
                edm::LogError("TopElectronHLTOfflineClient") << "unable to get DQMStore service, upshot is no client histograms will be made";
        }
        
        if(iConfig.getUntrackedParameter<bool>("DQMStore", false)) 
        {
                if (dbe_) dbe_->setVerbose(0);
        }
        
        dirName_=iConfig.getParameter<std::string>("DQMDirName");
        
        if (dbe_)
                dbe_->setCurrentFolder(dirName_);

        hltTag_ = iConfig.getParameter<std::string>("hltTag");
        
        electronIdNames_ = iConfig.getParameter<std::vector<std::string> >("electronIdNames");
        superTriggerNames_ = iConfig.getParameter<std::vector<std::string> >("superTriggerNames");
        electronTriggerNames_ = iConfig.getParameter<std::vector<std::string> >("electronTriggerNames");
        addExtraId_ = iConfig.getParameter<bool>("addExtraId");

        runClientEndLumiBlock_ = iConfig.getParameter<bool>("runClientEndLumiBlock");
        runClientEndRun_ = iConfig.getParameter<bool>("runClientEndRun");
        runClientEndJob_ = iConfig.getParameter<bool>("runClientEndJob");

}
TopElectronHLTOfflineClient::~TopElectronHLTOfflineClient ( ) [virtual]

Definition at line 48 of file TopElectronHLTOfflineClient.cc.

{ 
}

Member Function Documentation

void TopElectronHLTOfflineClient::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
) [virtual]

Implements edm::EDAnalyzer.

Definition at line 119 of file TopElectronHLTOfflineClient.cc.

{
}
void TopElectronHLTOfflineClient::beginJob ( void  ) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 52 of file TopElectronHLTOfflineClient.cc.

References addExtraId_, electronIdNames_, electronTriggerNames_, eleMeNames_, i, j, gen::k, prof2calltree::l, m, superMeNames_, and superTriggerNames_.

{
        //compose the ME names we need
        
        // Eta regions
        std::vector<std::string> regions;
        regions.push_back("EB");
        regions.push_back("EE");
        
        // Electron IDs, including own extra ID
        std::vector<std::string> eleIdNames;
        for (size_t i = 0; i < electronIdNames_.size(); ++i)
        {
                eleIdNames.push_back(electronIdNames_[i]);
                if (addExtraId_)
                        eleIdNames.push_back(electronIdNames_[i]+"extraId");
        }
        
        std::vector<std::string> vars;
        vars.push_back("_et");
        vars.push_back("_eta");
        vars.push_back("_phi");
        vars.push_back("_isolEm");
        vars.push_back("_isolHad");
        vars.push_back("_minDeltaR");
        vars.push_back("_global_n30jets");
        vars.push_back("_global_sumEt");
        vars.push_back("_gsftrack_etaError");
        vars.push_back("_gsftrack_phiError");
        vars.push_back("_gsftrack_numberOfValidHits");
        vars.push_back("_gsftrack_dzPV");
        
        
        for (size_t i = 0; i < eleIdNames.size(); ++i)
                for (size_t j = 0; j < regions.size(); ++j)
                        for (size_t k = 0; k < vars.size(); ++k)
                                for (size_t l = 0; l < superTriggerNames_.size(); ++l)
                                {
                                        superMeNames_.push_back("ele_"+superTriggerNames_[l]+"_"+regions[j]+"_"+eleIdNames[i]+vars[k] );
                                        for (size_t m = 0; m < electronTriggerNames_.size(); ++m)
                                        {
                                                eleMeNames_.push_back("ele_"+superTriggerNames_[l]+"_"+electronTriggerNames_[m] +"_"+regions[j]+"_"+eleIdNames[i]+vars[k]);
                                        }
                                }

        

}
virtual void TopElectronHLTOfflineClient::beginLuminosityBlock ( const edm::LuminosityBlock lumiSeg,
const edm::EventSetup context 
) [inline, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 74 of file TopElectronHLTOfflineClient.h.

{}
void TopElectronHLTOfflineClient::beginRun ( const edm::Run run,
const edm::EventSetup c 
) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 107 of file TopElectronHLTOfflineClient.cc.

{
}
void TopElectronHLTOfflineClient::createSingleEffHists ( const std::string &  denomName,
const std::string &  nomName,
const std::string &  effName 
)

Definition at line 151 of file TopElectronHLTOfflineClient.cc.

References dbe_, dirName_, DQMStore::get(), makeEffMonElemFromPassAndAll(), and NULL.

Referenced by runClient_().

{ 
        MonitorElement* denom = dbe_->get(dirName_+"/"+denomName);
        
        MonitorElement* nom = dbe_->get(dirName_+"/"+nomName);
        if(nom!=NULL && denom!=NULL)
        {

                makeEffMonElemFromPassAndAll(effName, nom, denom);       
        }
}
void TopElectronHLTOfflineClient::endJob ( void  ) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 101 of file TopElectronHLTOfflineClient.cc.

References runClient_(), and runClientEndJob_.

void TopElectronHLTOfflineClient::endLuminosityBlock ( const edm::LuminosityBlock lumiSeg,
const edm::EventSetup c 
) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 123 of file TopElectronHLTOfflineClient.cc.

References runClient_(), and runClientEndLumiBlock_.

void TopElectronHLTOfflineClient::endRun ( const edm::Run run,
const edm::EventSetup c 
) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 112 of file TopElectronHLTOfflineClient.cc.

References runClient_(), and runClientEndRun_.

MonitorElement * TopElectronHLTOfflineClient::makeEffMonElemFromPassAndAll ( const std::string &  name,
const MonitorElement pass,
const MonitorElement fail 
)

Definition at line 164 of file TopElectronHLTOfflineClient.cc.

References DQMStore::book1D(), dbe_, dirName_, DQMStore::get(), MonitorElement::getTH1F(), and NULL.

Referenced by createSingleEffHists().

{
        TH1F* passHist = pass->getTH1F();
        if(passHist->GetSumw2N()==0) 
                passHist->Sumw2();
        TH1F* allHist = all->getTH1F();
        if(allHist->GetSumw2N()==0)
                allHist->Sumw2();
        
        TH1F* effHist = (TH1F*) passHist->Clone(name.c_str());
        effHist->Divide(passHist,allHist,1,1,"B");

        MonitorElement* eff = dbe_->get(dirName_+"/"+name);
        if(eff==NULL)
        {
                eff= dbe_->book1D(name,effHist);
        }
        else
        { //I was having problems with collating the histograms, hence why I'm just reseting the histogram value
                *eff->getTH1F()=*effHist; 
                delete effHist;
        }
        return eff;
}
TopElectronHLTOfflineClient& TopElectronHLTOfflineClient::operator= ( const TopElectronHLTOfflineClient rhs) [inline, private]

Definition at line 61 of file TopElectronHLTOfflineClient.h.

{return *this;}
void TopElectronHLTOfflineClient::runClient_ ( ) [private]

Definition at line 129 of file TopElectronHLTOfflineClient.cc.

References createSingleEffHists(), dbe_, dirName_, electronTriggerNames_, eleMeNames_, i, j, gen::k, DQMStore::setCurrentFolder(), superMeNames_, and superTriggerNames_.

Referenced by endJob(), endLuminosityBlock(), and endRun().

{
        if (!dbe_) return; //we dont have the DQMStore so we cant do anything
        dbe_->setCurrentFolder(dirName_);
        
        size_t k = 0;
        for (size_t i = 0; i < superMeNames_.size(); ++i)
        {
                for (size_t j = 0; j < electronTriggerNames_.size(); ++j)
                {
                        if (k >= eleMeNames_.size())
                                continue;
                        createSingleEffHists(superMeNames_[i], eleMeNames_[k], eleMeNames_[k]+"_eff");
                        ++k;
                }
        }
        superTriggerNames_.size();
        electronTriggerNames_.size();


}

Member Data Documentation

Definition at line 52 of file TopElectronHLTOfflineClient.h.

Referenced by beginJob(), and TopElectronHLTOfflineClient().

std::vector<std::string> TopElectronHLTOfflineClient::electronIdNames_ [private]

Definition at line 48 of file TopElectronHLTOfflineClient.h.

Referenced by beginJob(), and TopElectronHLTOfflineClient().

std::vector<std::string> TopElectronHLTOfflineClient::electronTriggerNames_ [private]

Definition at line 50 of file TopElectronHLTOfflineClient.h.

Referenced by beginJob(), runClient_(), and TopElectronHLTOfflineClient().

std::vector<std::string> TopElectronHLTOfflineClient::eleMeNames_ [private]

Definition at line 46 of file TopElectronHLTOfflineClient.h.

Referenced by beginJob(), and runClient_().

std::string TopElectronHLTOfflineClient::hltTag_ [private]

Definition at line 43 of file TopElectronHLTOfflineClient.h.

Referenced by TopElectronHLTOfflineClient().

Definition at line 56 of file TopElectronHLTOfflineClient.h.

Referenced by endJob(), and TopElectronHLTOfflineClient().

Definition at line 55 of file TopElectronHLTOfflineClient.h.

Referenced by endRun(), and TopElectronHLTOfflineClient().

std::vector<std::string> TopElectronHLTOfflineClient::superMeNames_ [private]

Definition at line 45 of file TopElectronHLTOfflineClient.h.

Referenced by beginJob(), and runClient_().

std::vector<std::string> TopElectronHLTOfflineClient::superTriggerNames_ [private]

Definition at line 49 of file TopElectronHLTOfflineClient.h.

Referenced by beginJob(), runClient_(), and TopElectronHLTOfflineClient().