CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

EgHLTOfflineClient Class Reference

#include <EgHLTOfflineClient.h>

Inheritance diagram for EgHLTOfflineClient:
edm::EDAnalyzer

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 createLooseTightTrigEff (const std::vector< std::string > &tightLooseTrigNames, const std::string &region, const std::vector< std::string > &vsVarNames, const std::string &objName)
void createN1EffHists (const std::string &baseName, const std::string &region, const std::vector< std::string > &varNames)
void createSingleEffHists (const std::string &baseName, const std::string &region, const std::vector< std::string > &varNames)
void createTrigTagProbeEffHists (const std::string &filterName, const std::string &region, const std::vector< std::string > &vsVarNames, const std::string &objName)
 EgHLTOfflineClient (const edm::ParameterSet &)
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 *all)
MonitorElementmakeEffMonElemFromPassAndFail (const std::string &name, const MonitorElement *pass, const MonitorElement *fail)
virtual ~EgHLTOfflineClient ()

Private Member Functions

 EgHLTOfflineClient (const EgHLTOfflineClient &rhs)
EgHLTOfflineClientoperator= (const EgHLTOfflineClient &rhs)
void runClient_ ()

Private Attributes

DQMStoredbe_
std::string dirName_
std::vector< std::string > eleEffTags_
std::vector< std::string > eleHLTFilterNames_
std::vector< std::string > eleLooseTightTrigEffVsVars_
std::vector< std::string > eleN1EffVars_
std::vector< std::string > eleSingleEffVars_
std::vector< std::string > eleTightLooseTrigNames_
std::vector< std::string > eleTrigTPEffVsVars_
bool filterInactiveTriggers_
std::string hltTag_
bool isSetup_
std::vector< std::string > phoEffTags_
std::vector< std::string > phoHLTFilterNames_
std::vector< std::string > phoLooseTightTrigEffVsVars_
std::vector< std::string > phoN1EffVars_
std::vector< std::string > phoSingleEffVars_
std::vector< std::string > phoTightLooseTrigNames_
std::vector< std::string > phoTrigTPEffVsVars_
bool runClientEndJob_
bool runClientEndLumiBlock_
bool runClientEndRun_

Detailed Description

Definition at line 37 of file EgHLTOfflineClient.h.


Constructor & Destructor Documentation

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

Definition at line 72 of file EgHLTOfflineClient.h.

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

Definition at line 20 of file EgHLTOfflineClient.cc.

References dbe_, dirName_, eleEffTags_, eleHLTFilterNames_, eleLooseTightTrigEffVsVars_, eleN1EffVars_, eleSingleEffVars_, eleTightLooseTrigNames_, eleTrigTPEffVsVars_, filterInactiveTriggers_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), hltTag_, cmsCodeRules::cppFunctionSkipper::operator, phoEffTags_, phoHLTFilterNames_, phoLooseTightTrigEffVsVars_, phoN1EffVars_, phoSingleEffVars_, phoTightLooseTrigNames_, phoTrigTPEffVsVars_, runClientEndJob_, runClientEndLumiBlock_, runClientEndRun_, DQMStore::setCurrentFolder(), and DQMStore::setVerbose().

                                                                    :dbe_(NULL),isSetup_(false)
{
  dbe_ = edm::Service<DQMStore>().operator->(); //only one chance to get this, if we every have another shot, remember to check isSetup is okay
  if (!dbe_) {
    edm::LogError("EgHLTOfflineClient") << "unable to get DQMStore service, upshot is no client histograms will be made";
  }
  if(iConfig.getUntrackedParameter<bool>("DQMStore", false)) {
    if(dbe_) dbe_->setVerbose(0);
  }
 

  eleHLTFilterNames_ = iConfig.getParameter<std::vector<std::string> >("eleHLTFilterNames");
  eleTightLooseTrigNames_ = iConfig.getParameter<std::vector<std::string> >("eleTightLooseTrigNames");
  phoHLTFilterNames_ = iConfig.getParameter<std::vector<std::string> >("phoHLTFilterNames");
  phoTightLooseTrigNames_ = iConfig.getParameter<std::vector<std::string> >("phoTightLooseTrigNames");

  eleN1EffVars_=iConfig.getParameter<std::vector<std::string> >("eleN1EffVars");
  eleSingleEffVars_ = iConfig.getParameter<std::vector<std::string> >("eleSingleEffVars");
  eleEffTags_ = iConfig.getParameter<std::vector<std::string> >("eleEffTags");
  eleTrigTPEffVsVars_ = iConfig.getParameter<std::vector<std::string> >("eleTrigTPEffVsVars");
  eleLooseTightTrigEffVsVars_ =  iConfig.getParameter<std::vector<std::string> >("eleLooseTightTrigEffVsVars");

  phoN1EffVars_=iConfig.getParameter<std::vector<std::string> >("phoN1EffVars");
  phoSingleEffVars_ = iConfig.getParameter<std::vector<std::string> >("phoSingleEffVars");
  phoEffTags_ = iConfig.getParameter<std::vector<std::string> >("phoEffTags");
  phoTrigTPEffVsVars_ = iConfig.getParameter<std::vector<std::string> >("phoTrigTPEffVsVars");
  phoLooseTightTrigEffVsVars_ =  iConfig.getParameter<std::vector<std::string> >("phoLooseTightTrigEffVsVars");
  
  runClientEndLumiBlock_ = iConfig.getParameter<bool>("runClientEndLumiBlock");
  runClientEndRun_ = iConfig.getParameter<bool>("runClientEndRun");
  runClientEndJob_ = iConfig.getParameter<bool>("runClientEndJob");

  

  dirName_=iConfig.getParameter<std::string>("DQMDirName");
  if(dbe_) dbe_->setCurrentFolder(dirName_);
 

  filterInactiveTriggers_ =iConfig.getParameter<bool>("filterInactiveTriggers");
  hltTag_ = iConfig.getParameter<std::string>("hltTag");
 

}
EgHLTOfflineClient::~EgHLTOfflineClient ( ) [virtual]

Definition at line 65 of file EgHLTOfflineClient.cc.

{ 
  
}

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 108 of file EgHLTOfflineClient.cc.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 70 of file EgHLTOfflineClient.cc.

{
  

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

Reimplemented from edm::EDAnalyzer.

Definition at line 87 of file EgHLTOfflineClient.h.

{}
void EgHLTOfflineClient::beginRun ( const edm::Run run,
const edm::EventSetup c 
) [virtual]
void EgHLTOfflineClient::createLooseTightTrigEff ( const std::vector< std::string > &  tightLooseTrigNames,
const std::string &  region,
const std::vector< std::string > &  vsVarNames,
const std::string &  objName 
)

Definition at line 205 of file EgHLTOfflineClient.cc.

References dbe_, dirName_, cmsPerfPublish::fail(), DQMStore::get(), makeEffMonElemFromPassAndFail(), NULL, split, and splitString().

Referenced by runClient_().

{
  for(size_t varNr=0;varNr<vsVarNames.size();varNr++){
    for(size_t trigNr=0;trigNr<tightLooseTrigNames.size();trigNr++){
      std::vector<std::string> splitString;
      boost::split(splitString,tightLooseTrigNames[trigNr],boost::is_any_of(std::string(":")));
      if(splitString.size()!=2) continue; //format incorrect
      const std::string& tightTrig = splitString[0];
      const std::string& looseTrig = splitString[1];
      MonitorElement* fail = dbe_->get(dirName_+"/"+tightTrig+"_"+looseTrig+"_"+objName+"_failTrig_"+vsVarNames[varNr]+"_"+region); 
      if(fail==NULL){
        //edm::LogInfo("EgHLTOfflineClient") <<" couldnt get hist "<<dirName_+"/"+tightTrig+"_"+looseTrig+"_"+objName+"_failTrig_"+vsVarNames[varNr]+"_"+region;

        continue;
      }

      MonitorElement* pass = dbe_->get(dirName_+"/"+tightTrig+"_"+looseTrig+"_"+objName+"_passTrig_"+vsVarNames[varNr]+"_"+region); 
      if(pass==NULL){

        //edm::LogInfo("EgHLTOfflineClient") <<" couldnt get hist "<<dirName_+"/"+tightTrig+"_"+looseTrig+"_"+objName+"_passTrig_"+vsVarNames[varNr]+"_"+region;
        continue;
      } 
      const std::string newHistName(tightTrig+"_trigEffTo_"+looseTrig+"_"+objName+"_vs_"+vsVarNames[varNr]+"_"+region);
      makeEffMonElemFromPassAndFail(newHistName,pass,fail);
    }//end loop over trigger pairs
  } //end loop over vsVarNames
  
}
void EgHLTOfflineClient::createN1EffHists ( const std::string &  baseName,
const std::string &  region,
const std::vector< std::string > &  varNames 
)

Definition at line 157 of file EgHLTOfflineClient.cc.

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

Referenced by runClient_().

{ 
  MonitorElement* numer = dbe_->get(dirName_+"/"+baseName+"_allCuts_"+region);
  
  for(size_t varNr=0;varNr<varNames.size();varNr++){
    MonitorElement* denom = dbe_->get(dirName_+"/"+baseName+"_n1_"+varNames[varNr]+"_"+region);
    if(numer!=NULL && denom!=NULL){
      std::string effHistName(baseName+"_n1Eff_"+varNames[varNr]+"_"+region);
      makeEffMonElemFromPassAndAll(effHistName,numer,denom);   
    }
  }//end loop over varNames 
}
void EgHLTOfflineClient::createSingleEffHists ( const std::string &  baseName,
const std::string &  region,
const std::vector< std::string > &  varNames 
)

Definition at line 170 of file EgHLTOfflineClient.cc.

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

Referenced by runClient_().

{ 
  MonitorElement* denom = dbe_->get(dirName_+"/"+baseName+"_noCuts_"+region);
  
  for(size_t varNr=0;varNr<varNames.size();varNr++){
    MonitorElement* numer = dbe_->get(dirName_+"/"+baseName+"_single_"+varNames[varNr]+"_"+region);
    if(numer!=NULL && denom!=NULL){
      std::string effHistName(baseName+"_singleEff_"+varNames[varNr]+"_"+region);
      makeEffMonElemFromPassAndAll(effHistName,numer,denom);   
    }
  }//end loop over varNames 
}
void EgHLTOfflineClient::createTrigTagProbeEffHists ( const std::string &  filterName,
const std::string &  region,
const std::vector< std::string > &  vsVarNames,
const std::string &  objName 
)

Definition at line 183 of file EgHLTOfflineClient.cc.

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

Referenced by runClient_().

{
  for(size_t varNr=0;varNr<vsVarNames.size();varNr++){
    std::string allName(dirName_+"/"+filterName+"_trigTagProbe_"+objName+"_all_"+vsVarNames[varNr]+"_"+region);
    MonitorElement* all = dbe_->get(allName); 
    if(all==NULL){
      //edm::LogInfo("EgHLTOfflineClient") <<" couldnt get hist "<<allName;
      continue;
    }
    std::string passName(dirName_+"/"+filterName+"_trigTagProbe_"+objName+"_pass_"+vsVarNames[varNr]+"_"+region);
    MonitorElement* pass = dbe_->get(passName); 
    if(pass==NULL){
      //edm::LogInfo("EgHLTOfflineClient") <<" couldnt get hist "<<passName;
      continue;
    }
    
    makeEffMonElemFromPassAndAll(filterName+"_trigTagProbeEff_"+objName+"_vs_"+vsVarNames[varNr]+"_"+region,pass,all);
  }//end loop over vsVarNames
}
void EgHLTOfflineClient::endJob ( void  ) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 76 of file EgHLTOfflineClient.cc.

References runClient_(), and runClientEndJob_.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 113 of file EgHLTOfflineClient.cc.

References runClient_(), and runClientEndLumiBlock_.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 102 of file EgHLTOfflineClient.cc.

References runClient_(), and runClientEndRun_.

MonitorElement * EgHLTOfflineClient::makeEffMonElemFromPassAndAll ( const std::string &  name,
const MonitorElement pass,
const MonitorElement all 
)

Definition at line 234 of file EgHLTOfflineClient.cc.

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

Referenced by createN1EffHists(), createSingleEffHists(), and createTrigTagProbeEffHists().

{
  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;
}
MonitorElement * EgHLTOfflineClient::makeEffMonElemFromPassAndFail ( const std::string &  name,
const MonitorElement pass,
const MonitorElement fail 
)

Definition at line 252 of file EgHLTOfflineClient.cc.

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

Referenced by createLooseTightTrigEff().

{
  TH1F* failHist = fail->getTH1F();   
  if(failHist->GetSumw2N()==0) failHist->Sumw2();
  TH1F* passHist = pass->getTH1F();
  if(passHist->GetSumw2N()==0) passHist->Sumw2();
  
  TH1F* effHist = (TH1F*) passHist->Clone(name.c_str());
  effHist->Add(failHist);
  effHist->Divide(passHist,effHist,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;
}
EgHLTOfflineClient& EgHLTOfflineClient::operator= ( const EgHLTOfflineClient rhs) [inline, private]

Definition at line 73 of file EgHLTOfflineClient.h.

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

Definition at line 118 of file EgHLTOfflineClient.cc.

References createLooseTightTrigEff(), createN1EffHists(), createSingleEffHists(), createTrigTagProbeEffHists(), dbe_, dirName_, eleEffTags_, eleHLTFilterNames_, eleLooseTightTrigEffVsVars_, eleN1EffVars_, eleSingleEffVars_, eleTightLooseTrigNames_, eleTrigTPEffVsVars_, phoEffTags_, phoHLTFilterNames_, phoLooseTightTrigEffVsVars_, phoN1EffVars_, phoSingleEffVars_, phoTightLooseTrigNames_, and DQMStore::setCurrentFolder().

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

{
  if(!dbe_) return; //we dont have the DQMStore so we cant do anything
  dbe_->setCurrentFolder(dirName_);
 

  std::vector<std::string> regions;
  regions.push_back("eb");
  regions.push_back("ee");

  
  for(size_t filterNr=0;filterNr<eleHLTFilterNames_.size();filterNr++){
    for(size_t regionNr=0;regionNr<regions.size();regionNr++){
      for(size_t effNr=0;effNr<eleEffTags_.size();effNr++){
        createN1EffHists(eleHLTFilterNames_[filterNr]+"_gsfEle_"+eleEffTags_[effNr],regions[regionNr],eleN1EffVars_);
        createSingleEffHists(eleHLTFilterNames_[filterNr]+"_gsfEle_"+eleEffTags_[effNr],regions[regionNr],eleSingleEffVars_);
        createTrigTagProbeEffHists(eleHLTFilterNames_[filterNr],regions[regionNr],eleTrigTPEffVsVars_,"gsfEle");
      }
    }
  }
  
  
  for(size_t filterNr=0;filterNr<phoHLTFilterNames_.size();filterNr++){
    for(size_t regionNr=0;regionNr<regions.size();regionNr++){
      for(size_t effNr=0;effNr<phoEffTags_.size();effNr++){
        createN1EffHists(eleHLTFilterNames_[filterNr]+"_pho_"+phoEffTags_[effNr],regions[regionNr],phoN1EffVars_);
        createSingleEffHists(eleHLTFilterNames_[filterNr]+"_gsfEle_"+phoEffTags_[effNr],regions[regionNr],phoSingleEffVars_);
      }
    }
  }

  for(size_t regionNr=0;regionNr<regions.size();regionNr++){
    createLooseTightTrigEff(eleTightLooseTrigNames_,regions[regionNr],eleLooseTightTrigEffVsVars_,"gsfEle");   
    createLooseTightTrigEff(eleTightLooseTrigNames_,regions[regionNr],eleLooseTightTrigEffVsVars_,"gsfEle_trigCuts");
    createLooseTightTrigEff(phoTightLooseTrigNames_,regions[regionNr],phoLooseTightTrigEffVsVars_,"pho"); 
    createLooseTightTrigEff(phoTightLooseTrigNames_,regions[regionNr],phoLooseTightTrigEffVsVars_,"pho_trigCuts");
  }
}

Member Data Documentation

std::string EgHLTOfflineClient::dirName_ [private]
std::vector<std::string> EgHLTOfflineClient::eleEffTags_ [private]

Definition at line 51 of file EgHLTOfflineClient.h.

Referenced by EgHLTOfflineClient(), and runClient_().

std::vector<std::string> EgHLTOfflineClient::eleHLTFilterNames_ [private]

Definition at line 43 of file EgHLTOfflineClient.h.

Referenced by beginRun(), EgHLTOfflineClient(), and runClient_().

std::vector<std::string> EgHLTOfflineClient::eleLooseTightTrigEffVsVars_ [private]

Definition at line 59 of file EgHLTOfflineClient.h.

Referenced by EgHLTOfflineClient(), and runClient_().

std::vector<std::string> EgHLTOfflineClient::eleN1EffVars_ [private]

Definition at line 49 of file EgHLTOfflineClient.h.

Referenced by EgHLTOfflineClient(), and runClient_().

std::vector<std::string> EgHLTOfflineClient::eleSingleEffVars_ [private]

Definition at line 50 of file EgHLTOfflineClient.h.

Referenced by EgHLTOfflineClient(), and runClient_().

std::vector<std::string> EgHLTOfflineClient::eleTightLooseTrigNames_ [private]

Definition at line 44 of file EgHLTOfflineClient.h.

Referenced by beginRun(), EgHLTOfflineClient(), and runClient_().

std::vector<std::string> EgHLTOfflineClient::eleTrigTPEffVsVars_ [private]

Definition at line 57 of file EgHLTOfflineClient.h.

Referenced by EgHLTOfflineClient(), and runClient_().

Definition at line 66 of file EgHLTOfflineClient.h.

Referenced by beginRun(), and EgHLTOfflineClient().

std::string EgHLTOfflineClient::hltTag_ [private]

Definition at line 68 of file EgHLTOfflineClient.h.

Referenced by beginRun(), and EgHLTOfflineClient().

Definition at line 67 of file EgHLTOfflineClient.h.

Referenced by beginRun().

std::vector<std::string> EgHLTOfflineClient::phoEffTags_ [private]

Definition at line 55 of file EgHLTOfflineClient.h.

Referenced by EgHLTOfflineClient(), and runClient_().

std::vector<std::string> EgHLTOfflineClient::phoHLTFilterNames_ [private]

Definition at line 45 of file EgHLTOfflineClient.h.

Referenced by beginRun(), EgHLTOfflineClient(), and runClient_().

std::vector<std::string> EgHLTOfflineClient::phoLooseTightTrigEffVsVars_ [private]

Definition at line 60 of file EgHLTOfflineClient.h.

Referenced by EgHLTOfflineClient(), and runClient_().

std::vector<std::string> EgHLTOfflineClient::phoN1EffVars_ [private]

Definition at line 53 of file EgHLTOfflineClient.h.

Referenced by EgHLTOfflineClient(), and runClient_().

std::vector<std::string> EgHLTOfflineClient::phoSingleEffVars_ [private]

Definition at line 54 of file EgHLTOfflineClient.h.

Referenced by EgHLTOfflineClient(), and runClient_().

std::vector<std::string> EgHLTOfflineClient::phoTightLooseTrigNames_ [private]

Definition at line 46 of file EgHLTOfflineClient.h.

Referenced by beginRun(), EgHLTOfflineClient(), and runClient_().

std::vector<std::string> EgHLTOfflineClient::phoTrigTPEffVsVars_ [private]

Definition at line 58 of file EgHLTOfflineClient.h.

Referenced by EgHLTOfflineClient().

Definition at line 64 of file EgHLTOfflineClient.h.

Referenced by EgHLTOfflineClient(), and endJob().

Definition at line 62 of file EgHLTOfflineClient.h.

Referenced by EgHLTOfflineClient(), and endLuminosityBlock().

Definition at line 63 of file EgHLTOfflineClient.h.

Referenced by EgHLTOfflineClient(), and endRun().