CMS 3D CMS Logo

Classes | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes

EgHLTOfflineSummaryClient Class Reference

#include <EgHLTOfflineSummaryClient.h>

Inheritance diagram for EgHLTOfflineSummaryClient:
edm::EDAnalyzer

List of all members.

Classes

struct  SumHistBinData

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)
 EgHLTOfflineSummaryClient (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)
virtual ~EgHLTOfflineSummaryClient ()

Private Member Functions

 EgHLTOfflineSummaryClient (const EgHLTOfflineSummaryClient &rhs)
void getEgHLTFiltersToMon_ (std::vector< std::string > &filterNames) const
MonitorElementgetEgHLTSumHist_ ()
int getQTestBinData_ (const edm::ParameterSet &)
int getQTestResults_ (const std::string &filterName, const std::vector< std::string > &pattern) const
EgHLTOfflineSummaryClientoperator= (const EgHLTOfflineSummaryClient &rhs)
void runClient_ ()
void splitStringsToPairs_ (const std::vector< std::string > &stringsToSplit, std::vector< std::pair< std::string, std::string > > &splitStrings)

Static Private Member Functions

static void fillQTestData_ (const edm::ParameterSet &iConfig, std::vector< SumHistBinData > &qTests, const std::string &label)

Private Attributes

DQMStoredbe_
std::string dirName_
std::vector< std::string > egHLTFiltersToMon_
std::vector< std::string > egHLTFiltersToMonPaths_
std::string egHLTSumHistName_
std::vector< SumHistBinDataegHLTSumHistXBins_
std::vector< std::string > eleHLTFilterNames_
std::vector< std::string > eleHLTFilterNamesForSumBit_
std::vector< SumHistBinDataeleQTestsForSumBit_
bool filterInactiveTriggers_
std::string hltTag_
bool isSetup_
std::vector< std::string > phoHLTFilterNames_
std::vector< std::string > phoHLTFilterNamesForSumBit_
std::vector< SumHistBinDataphoQTestsForSumBit_
bool runClientEndJob_
bool runClientEndLumiBlock_
bool runClientEndRun_
bool usePathNames_

Detailed Description

Definition at line 33 of file EgHLTOfflineSummaryClient.h.


Constructor & Destructor Documentation

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

Definition at line 72 of file EgHLTOfflineSummaryClient.h.

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

Definition at line 18 of file EgHLTOfflineSummaryClient.cc.

References dbe_, dirName_, egHLTSumHistXBins_, eleHLTFilterNames_, eleHLTFilterNamesForSumBit_, eleQTestsForSumBit_, fillQTestData_(), filterInactiveTriggers_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), hltTag_, cppFunctionSkipper::operator, phoHLTFilterNames_, phoHLTFilterNamesForSumBit_, phoQTestsForSumBit_, runClientEndJob_, runClientEndLumiBlock_, runClientEndRun_, and usePathNames_.

                                                                                  :
  egHLTSumHistName_("egHLTTrigSum"),isSetup_(false)
{  
  dirName_=iConfig.getParameter<std::string>("DQMDirName"); //only one chance to get this, if we every have another shot, remember to check isSetup is okay
  dbe_ = edm::Service<DQMStore>().operator->();
  if (!dbe_) {
    edm::LogError("EgHLTOfflineSummaryClient") << "unable to get DQMStore service, no summary histograms will be produced";
  }else{
    if(iConfig.getUntrackedParameter<bool>("DQMStore", false)) {
      dbe_->setVerbose(0);
    } 
    dbe_->setCurrentFolder(dirName_);
  }
 
  eleHLTFilterNames_ = iConfig.getParameter<std::vector<std::string> >("eleHLTFilterNames"); 
  phoHLTFilterNames_ = iConfig.getParameter<std::vector<std::string> >("phoHLTFilterNames");
  eleHLTFilterNamesForSumBit_ = iConfig.getParameter<std::vector<std::string> >("eleHLTFilterNamesForSumBit"); 
  phoHLTFilterNamesForSumBit_ = iConfig.getParameter<std::vector<std::string> >("phoHLTFilterNamesForSumBit");
  

  filterInactiveTriggers_ =iConfig.getParameter<bool>("filterInactiveTriggers"); 
  hltTag_ = iConfig.getParameter<std::string>("hltTag");
 
  usePathNames_ = iConfig.getParameter<bool>("usePathNames");
 
  
  //std::vector<std::string> egHLTSumQTests = iConfig.getParameter<std::vector<std::string> >("egHLTSumQTests");
  // splitStringsToPairs_(egHLTSumQTests,egHLTSumHistXBins_);

  fillQTestData_(iConfig,egHLTSumHistXBins_,"egHLTSumQTests");
  fillQTestData_(iConfig,eleQTestsForSumBit_,"egHLTEleQTestsForSumBit");
  fillQTestData_(iConfig,phoQTestsForSumBit_,"egHLTPhoQTestsForSumBit");

 

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


  //egHLTSumHistXBins_.push_back(std::make_pair("Ele Rel Trig Eff",&EgHLTOfflineSummaryClient::eleTrigRelEffQTestResult_));
  //egHLTSumHistXBins_.push_back(std::make_pair("Pho Rel Trig Eff",&EgHLTOfflineSummaryClient::phoTrigRelEffQTestResult_));
  //egHLTSumHistXBins_.push_back(std::make_pair("Ele T&P Trig Eff",&EgHLTOfflineSummaryClient::eleTrigTPEffQTestResult_));
  //egHLTSumHistXBins_.push_back(std::make_pair("Triggered Ele",&EgHLTOfflineSummaryClient::trigEleQTestResult_));
  //egHLTSumHistXBins_.push_back(std::make_pair("Triggered Pho",&EgHLTOfflineSummaryClient::trigPhoQTestResult_)); 
}
EgHLTOfflineSummaryClient::~EgHLTOfflineSummaryClient ( ) [virtual]

Definition at line 66 of file EgHLTOfflineSummaryClient.cc.

{ 
 
}

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 117 of file EgHLTOfflineSummaryClient.cc.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 71 of file EgHLTOfflineSummaryClient.cc.

{
 

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

Reimplemented from edm::EDAnalyzer.

Definition at line 87 of file EgHLTOfflineSummaryClient.h.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 82 of file EgHLTOfflineSummaryClient.cc.

References egHLTFiltersToMon_, egHLTFiltersToMonPaths_, eleHLTFilterNames_, eleHLTFilterNamesForSumBit_, egHLT::trigTools::filterInactiveTriggers(), filterInactiveTriggers_, egHLT::trigTools::getActiveFilters(), getEgHLTFiltersToMon_(), HltComparatorCreateWorkflow::hltConfig, hltTag_, HLTConfigProvider::init(), isSetup_, phoHLTFilterNames_, phoHLTFilterNamesForSumBit_, egHLT::trigTools::translateFiltersToPathNames(), and usePathNames_.

{
  if(!isSetup_){
    bool changed;
    HLTConfigProvider hltConfig;
    hltConfig.init(run,c,hltTag_,changed);
    if(filterInactiveTriggers_){
      std::vector<std::string> activeFilters;
      std::vector<std::string> activeEleFilters;
      std::vector<std::string> activeEle2LegFilters;
      std::vector<std::string> activePhoFilters;
      std::vector<std::string> activePho2LegFilters;
      
      egHLT::trigTools::getActiveFilters(hltConfig,activeFilters,activeEleFilters,activeEle2LegFilters,activePhoFilters,activePho2LegFilters);     
      
      egHLT::trigTools::filterInactiveTriggers(eleHLTFilterNames_,activeFilters);
      egHLT::trigTools::filterInactiveTriggers(phoHLTFilterNames_,activePhoFilters);
      egHLT::trigTools::filterInactiveTriggers(eleHLTFilterNamesForSumBit_,activeEleFilters);
      egHLT::trigTools::filterInactiveTriggers(phoHLTFilterNamesForSumBit_,activePhoFilters); 
      
    }
    getEgHLTFiltersToMon_(egHLTFiltersToMon_);
     
    if(usePathNames_) egHLT::trigTools::translateFiltersToPathNames(hltConfig,egHLTFiltersToMon_,egHLTFiltersToMonPaths_);
    isSetup_=true;
  }
}
void EgHLTOfflineSummaryClient::endJob ( void  ) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 77 of file EgHLTOfflineSummaryClient.cc.

References runClient_(), and runClientEndJob_.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 122 of file EgHLTOfflineSummaryClient.cc.

References runClient_(), and runClientEndLumiBlock_.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 111 of file EgHLTOfflineSummaryClient.cc.

References runClient_(), and runClientEndRun_.

void EgHLTOfflineSummaryClient::fillQTestData_ ( const edm::ParameterSet iConfig,
std::vector< SumHistBinData > &  qTests,
const std::string &  label 
) [static, private]

Definition at line 257 of file EgHLTOfflineSummaryClient.cc.

References edm::ParameterSet::getParameter(), and label.

Referenced by EgHLTOfflineSummaryClient().

{
  std::vector<edm::ParameterSet> qTestPara = iConfig.getParameter<std::vector<edm::ParameterSet> >(label);
  qTests.resize(qTestPara.size());
  for(size_t testNr=0;testNr<qTestPara.size();testNr++){
    qTests[testNr].name = qTestPara[testNr].getParameter<std::string>("name");
    qTests[testNr].qTestPatterns = qTestPara[testNr].getParameter<std::vector<std::string> >("qTestsToCheck"); 
  }
}
void EgHLTOfflineSummaryClient::getEgHLTFiltersToMon_ ( std::vector< std::string > &  filterNames) const [private]

Definition at line 223 of file EgHLTOfflineSummaryClient.cc.

References eleHLTFilterNames_, i, phoHLTFilterNames_, and swap().

Referenced by beginRun().

{ 
  std::set<std::string> filterNameSet;
  for(size_t i=0;i<eleHLTFilterNames_.size();i++) filterNameSet.insert(eleHLTFilterNames_[i]);
  for(size_t i=0;i<phoHLTFilterNames_.size();i++) filterNameSet.insert(phoHLTFilterNames_[i]);
 
  //right all the triggers are inserted once and only once in the set, convert to vector
  //very lazy, create a new vector so can use the constructor and then use swap to transfer
  std::vector<std::string>(filterNameSet.begin(),filterNameSet.end()).swap(filterNames);
}
MonitorElement * EgHLTOfflineSummaryClient::getEgHLTSumHist_ ( ) [private]

Definition at line 185 of file EgHLTOfflineSummaryClient.cc.

References DQMStore::book2D(), dbe_, dirName_, egHLTFiltersToMon_, egHLTFiltersToMonPaths_, egHLTSumHistName_, egHLTSumHistXBins_, DQMStore::get(), estimatePileup::hist, mergeVDriftHistosByStation::name, NULL, DQMStore::setCurrentFolder(), and usePathNames_.

Referenced by runClient_().

{
  MonitorElement* egHLTSumHist = dbe_->get(dirName_+"/"+egHLTSumHistName_);
  if(egHLTSumHist==NULL){
    TH2F* hist = new TH2F(egHLTSumHistName_.c_str(),"E/g HLT Offline Summary",egHLTSumHistXBins_.size(),0.,1.,egHLTFiltersToMon_.size(),0.,1.);
    for(size_t xBinNr=0;xBinNr<egHLTSumHistXBins_.size();xBinNr++){
      hist->GetXaxis()->SetBinLabel(xBinNr+1,egHLTSumHistXBins_[xBinNr].name.c_str());
    }
    
    for(size_t yBinNr=0;yBinNr<egHLTFiltersToMon_.size();yBinNr++){
      if(usePathNames_ && egHLTFiltersToMonPaths_.size()==egHLTFiltersToMon_.size()){
        hist->GetYaxis()->SetBinLabel(yBinNr+1,egHLTFiltersToMonPaths_[yBinNr].c_str());
      }else{
        hist->GetYaxis()->SetBinLabel(yBinNr+1,egHLTFiltersToMon_[yBinNr].c_str());
      }
    }
    for(size_t xBinNr=0;xBinNr<egHLTSumHistXBins_.size();xBinNr++){
      for(size_t yBinNr=0;yBinNr<egHLTFiltersToMon_.size();yBinNr++){
        hist->SetBinContent(xBinNr+1,yBinNr+1,-2);
      }
    }
 
    dbe_->setCurrentFolder(dirName_);
    egHLTSumHist = dbe_->book2D(egHLTSumHistName_,hist);
  }
  return egHLTSumHist;

}
int EgHLTOfflineSummaryClient::getQTestBinData_ ( const edm::ParameterSet ) [private]
int EgHLTOfflineSummaryClient::getQTestResults_ ( const std::string &  filterName,
const std::vector< std::string > &  pattern 
) const [private]

Definition at line 236 of file EgHLTOfflineSummaryClient.cc.

References dbe_, dirName_, and DQMStore::getMatchingContents().

Referenced by runClient_().

{
  int nrFail =0;
  int nrQTests=0;
  for(size_t patternNr=0;patternNr<patterns.size();patternNr++){
    std::vector<MonitorElement*> monElems = dbe_->getMatchingContents(dirName_+"/"+filterName+patterns[patternNr]);
    // std::cout <<"mon elem "<<dirName_+"/"+filterName+patterns[patternNr]<<"nr monElems "<<monElems.size()<<std::endl;
    for(size_t monElemNr=0;monElemNr<monElems.size();monElemNr++){
     
      std::vector<QReport*> qTests = monElems[monElemNr]->getQReports();
      nrQTests+=qTests.size();
      //  std::cout <<monElems[monElemNr]->getName()<<" "<<monElems[monElemNr]->hasError()<<" nr test "<<qTests.size()<<std::endl;
      if(monElems[monElemNr]->hasError()) nrFail++;
    }
  }
  if(nrQTests==0) return -1;
  else if(nrFail==0) return 1;
  else return 0;
}
EgHLTOfflineSummaryClient& EgHLTOfflineSummaryClient::operator= ( const EgHLTOfflineSummaryClient rhs) [inline, private]

Definition at line 73 of file EgHLTOfflineSummaryClient.h.

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

Definition at line 128 of file EgHLTOfflineSummaryClient.cc.

References DQMStore::bookFloat(), dbe_, egHLTFiltersToMon_, egHLTSumHistXBins_, eleHLTFilterNamesForSumBit_, eleQTestsForSumBit_, MonitorElement::Fill(), DQMStore::get(), getEgHLTSumHist_(), getQTestResults_(), NULL, phoHLTFilterNamesForSumBit_, phoQTestsForSumBit_, MonitorElement::setBinContent(), and DQMStore::setCurrentFolder().

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

{
 
  MonitorElement* egHLTSumME = getEgHLTSumHist_();

  for(size_t filterNr=0;filterNr<egHLTFiltersToMon_.size();filterNr++){
    for(size_t xBinNr=0;xBinNr<egHLTSumHistXBins_.size();xBinNr++){
      //egHLTSumHist->setBinContent(xBinNr+1,filterNr+1,(*egHLTSumHistXBins_[xBinNr].second)(egHLTFiltersToMon_[filterNr].c_str()));
      egHLTSumME->setBinContent(xBinNr+1,filterNr+1,
                                getQTestResults_(egHLTFiltersToMon_[filterNr],egHLTSumHistXBins_[xBinNr].qTestPatterns)); 
    }
  }

  MonitorElement* hltEleSumBit = dbe_->get("HLT/EventInfo/reportSummaryContents/HLT_Electron");
  MonitorElement* hltPhoSumBit = dbe_->get("HLT/EventInfo/reportSummaryContents/HLT_Photon");
  dbe_->setCurrentFolder("HLT/EventInfo/reportSummaryContents/");
  if(hltEleSumBit==NULL) hltEleSumBit = dbe_->bookFloat("HLT_Electron");
  if(hltPhoSumBit==NULL) hltPhoSumBit = dbe_->bookFloat("HLT_Photon");

  
  float eleSumBit=1.;
  for(size_t filterNr=0;filterNr<eleHLTFilterNamesForSumBit_.size() && eleSumBit==1;filterNr++){ //breaks as soon as a test fails
    for(size_t testNr=0;testNr<eleQTestsForSumBit_.size() && eleSumBit==1;testNr++){
      if(getQTestResults_(eleHLTFilterNamesForSumBit_[filterNr],eleQTestsForSumBit_[testNr].qTestPatterns)==0) eleSumBit=0;
      
    }
  }
  hltEleSumBit->Fill(eleSumBit);
  
  float phoSumBit=1.;
  for(size_t filterNr=0;filterNr<phoHLTFilterNamesForSumBit_.size() && phoSumBit==1;filterNr++){ //breaks as soon as a test fails
    for(size_t testNr=0;testNr<phoQTestsForSumBit_.size() && phoSumBit==1;testNr++){
      if(getQTestResults_(phoHLTFilterNamesForSumBit_[filterNr],phoQTestsForSumBit_[testNr].qTestPatterns)==0) phoSumBit=0;
    }
  }
  hltPhoSumBit->Fill(phoSumBit);
  
  
   
}
void EgHLTOfflineSummaryClient::splitStringsToPairs_ ( const std::vector< std::string > &  stringsToSplit,
std::vector< std::pair< std::string, std::string > > &  splitStrings 
) [private]

Definition at line 168 of file EgHLTOfflineSummaryClient.cc.

References split.

{
  splitStrings.clear();
  splitStrings.reserve(stringsToSplit.size());
  for(size_t stringNr=0;stringNr<stringsToSplit.size();stringNr++){
    std::vector<std::string> tempSplitStrings;
    boost::split(tempSplitStrings,stringsToSplit[stringNr],boost::is_any_of(std::string(":")));
    if(tempSplitStrings.size()==2){
      splitStrings.push_back(std::make_pair(tempSplitStrings[0],tempSplitStrings[1]));
    }else{
      edm::LogWarning("EgHLTOfflineSummaryClient") <<" Error : entry "<<stringsToSplit[stringNr]<<" is not of form A:B, ignoring (ie this quailty test isnt being included in the sumamry hist) ";
    }
  }
}

Member Data Documentation

std::string EgHLTOfflineSummaryClient::dirName_ [private]
std::vector<std::string> EgHLTOfflineSummaryClient::egHLTFiltersToMon_ [private]

Definition at line 48 of file EgHLTOfflineSummaryClient.h.

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

std::vector<std::string> EgHLTOfflineSummaryClient::egHLTFiltersToMonPaths_ [private]

Definition at line 63 of file EgHLTOfflineSummaryClient.h.

Referenced by beginRun(), and getEgHLTSumHist_().

Definition at line 44 of file EgHLTOfflineSummaryClient.h.

Referenced by getEgHLTSumHist_().

std::vector<std::string> EgHLTOfflineSummaryClient::eleHLTFilterNames_ [private]
std::vector<std::string> EgHLTOfflineSummaryClient::eleHLTFilterNamesForSumBit_ [private]

Definition at line 50 of file EgHLTOfflineSummaryClient.h.

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

Definition at line 56 of file EgHLTOfflineSummaryClient.h.

Referenced by EgHLTOfflineSummaryClient(), and runClient_().

Definition at line 66 of file EgHLTOfflineSummaryClient.h.

Referenced by beginRun(), and EgHLTOfflineSummaryClient().

std::string EgHLTOfflineSummaryClient::hltTag_ [private]

Definition at line 68 of file EgHLTOfflineSummaryClient.h.

Referenced by beginRun(), and EgHLTOfflineSummaryClient().

Definition at line 67 of file EgHLTOfflineSummaryClient.h.

Referenced by beginRun().

std::vector<std::string> EgHLTOfflineSummaryClient::phoHLTFilterNames_ [private]
std::vector<std::string> EgHLTOfflineSummaryClient::phoHLTFilterNamesForSumBit_ [private]

Definition at line 51 of file EgHLTOfflineSummaryClient.h.

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

Definition at line 57 of file EgHLTOfflineSummaryClient.h.

Referenced by EgHLTOfflineSummaryClient(), and runClient_().

Definition at line 61 of file EgHLTOfflineSummaryClient.h.

Referenced by EgHLTOfflineSummaryClient(), and endJob().

Definition at line 59 of file EgHLTOfflineSummaryClient.h.

Referenced by EgHLTOfflineSummaryClient(), and endLuminosityBlock().

Definition at line 60 of file EgHLTOfflineSummaryClient.h.

Referenced by EgHLTOfflineSummaryClient(), and endRun().