#include <HLTScalers.h>
Definition at line 74 of file HLTScalers.h.
HLTScalers::HLTScalers | ( | const edm::ParameterSet & | ps | ) |
Constructors.
Definition at line 88 of file HLTScalers.cc.
References dbe_, folderName_, LogDebug, cmsCodeRules::cppFunctionSkipper::operator, DQMStore::setCurrentFolder(), and DQMStore::setVerbose().
: folderName_(ps.getUntrackedParameter<std::string>("dqmFolder", "HLT/HLTScalers_EvF")), processname_(ps.getParameter<std::string>("processname")), pairPDPaths_(), trigResultsSource_(ps.getParameter<edm::InputTag>("triggerResults")), dbe_(0), scalersN_(0), scalersException_(0), hltCorrelations_(0), detailedScalers_(0), nProc_(0), nLumiBlock_(0), hltBx_(0), hltBxVsPath_(0), hltOverallScaler_(0), hltOverallScalerN_(0), diagnostic_(0), resetMe_(true), sentPaths_(false), monitorDaemon_(ps.getUntrackedParameter<bool>("MonitorDaemon", false)), nev_(0), nLumi_(0), currentRun_(-1) { LogDebug("HLTScalers") << "HLTScalers: constructor...." ; dbe_ = Service<DQMStore>().operator->(); if (dbe_ ) { dbe_->setVerbose(0); dbe_->setCurrentFolder(folderName_); } }
virtual HLTScalers::~HLTScalers | ( | ) | [inline, virtual] |
void HLTScalers::analyze | ( | const edm::Event & | e, |
const edm::EventSetup & | c | ||
) | [virtual] |
Implements edm::EDAnalyzer.
Definition at line 146 of file HLTScalers.cc.
References accept(), b, edm::EventBase::bunchCrossing(), dbe_, detailedScalers_, diagnostic_, Exception, MonitorElement::Fill(), first, folderName_, edm::Event::getByLabel(), MonitorElement::getTH1(), hltBx_, hltBxVsPath_, hltCorrelations_, hltOverallScaler_, hltOverallScalerN_, JetPDSkim_cfg::hltResults, i, edm::EventBase::id(), j, LogDebug, h::names, nev_, nProc_, pairPDPaths_, Pass, lumiQueryAPI::q, resetMe_, scalers_, scalersException_, scalersN_, scalersPD_, edm::second(), sentPaths_, MonitorElement::setBinContent(), edm::TriggerNames::triggerIndex(), edm::Event::triggerNames(), edm::TriggerNames::triggerNames(), trigNames, and trigResultsSource_.
{ nProc_->Fill(++nev_); diagnostic_->setBinContent(1,1); // this ME is never touched - // it just tells you how the merging is doing. edm::Handle<TriggerResults> hltResults; bool b = e.getByLabel(trigResultsSource_, hltResults); if ( !b ) { edm::LogInfo("HLTScalers") << "getByLabel for TriggerResults failed" << " with label " << trigResultsSource_; return; } int npath = hltResults->size(); unsigned int nPD = pairPDPaths_.size(); // on the first event of a new run we book new ME's if (resetMe_ ) { LogInfo("HLTScalers") << "analyze(): new run. dump path for this evt " << e.id() << ", \n" << *hltResults ; if (not dbe_) return; // need to get maxModules dynamically int maxModules = 200; std::string rawdir(folderName_ + "/raw"); dbe_->setCurrentFolder(rawdir); scalersPD_ = dbe_->book1D("pdScalers", "PD scalers (stream A)", nPD, -0.5, nPD-0.5); detailedScalers_ = dbe_->book2D("detailedHltScalers", "HLT Scalers", npath, -0.5, npath-0.5, maxModules, 0, maxModules-1); scalers_ = dbe_->book1D("hltScalers", "HLT scalers", npath, -0.5, npath-0.5); scalersN_ = dbe_->book1D("hltScalersN", "Reset HLT scalers", npath, -0.5, npath-0.5); scalersException_ = dbe_->book1D("hltExceptions", "HLT Exception scalers", npath, -0.5, npath-0.5); hltCorrelations_ = dbe_->book2D("hltCorrelations", "HLT Scalers", npath, -0.5, npath-0.5, npath, -0.5, npath-0.5); // these two belong in top-level dbe_->setCurrentFolder(folderName_); hltBxVsPath_ = dbe_->book2D("hltBxVsPath", "HLT Accept vs Bunch Number", 3600, -0.5, 3599.5, npath, -0.5, npath-0.5); hltBx_ = dbe_->book1D("hltBx", "Bx of HLT Accepted Events ", 3600, -0.5, 3599.5); resetMe_ = false; } // end resetMe_ - pseudo-end-run record const edm::TriggerNames & trigNames = e.triggerNames(*hltResults); // for some reason this doesn't appear to work on the first event sometimes if ( ! sentPaths_ ) { const edm::TriggerNames & names = e.triggerNames(*hltResults); // save path names in DQM-accessible format int q = 0; for ( TriggerNames::Strings::const_iterator j = names.triggerNames().begin(); j !=names.triggerNames().end(); ++j ) { LogDebug("HLTScalers") << q << ": " << *j ; ++q; scalers_->getTH1()->GetXaxis()->SetBinLabel(q, j->c_str()); } for (unsigned int i = 0; i < nPD; i++) { LogDebug("HLTScalers") << i << ": " << pairPDPaths_[i].first << std::endl ; scalersPD_->getTH1()->GetXaxis()->SetBinLabel(i+1, pairPDPaths_[i].first.c_str()); } sentPaths_ = true; } bool accept = false; int bx = e.bunchCrossing(); for ( int i = 0; i < npath; ++i ) { // state returns 0 on ready, 1 on accept, 2 on fail, 3 on exception. // these are defined in HLTEnums.h for ( unsigned int j = 0; j < hltResults->index(i); ++j ) { detailedScalers_->Fill(i,j); } if ( hltResults->state(i) == hlt::Pass) { scalers_->Fill(i); scalersN_->Fill(i); hltBxVsPath_->Fill(bx, i); accept = true; for ( int j = i + 1; j < npath; ++j ) { if ( hltResults->state(j) == hlt::Pass) { hltCorrelations_->Fill(i,j); // fill hltCorrelations_->Fill(j,i); } } } else if ( hltResults->state(i) == hlt::Exception) { scalersException_->Fill(i); } } if ( accept ) { hltOverallScaler_->Fill(1.0); hltOverallScalerN_->Fill(1.0); hltBx_->Fill(int(bx)); } bool anyGroupPassed = false; for (unsigned int mi = 0; mi < pairPDPaths_.size(); mi++) { bool groupPassed = false; for (unsigned int i = 0; i < pairPDPaths_[mi].second.size(); i++) { //string hltPathName = hist_2d->GetXaxis()->GetBinLabel(i); std::string hltPathName = pairPDPaths_[mi].second[i]; // check if this is hlt path name //unsigned int pathByIndex = triggerNames.triggerIndex(hltPathName); unsigned int pathByIndex = trigNames.triggerIndex(pairPDPaths_[mi].second[i]); if(pathByIndex >= hltResults->size() ) continue; // check if its L1 passed // comment out below but set groupL1Passed to true always //if(hasL1Passed(hltPathName,triggerNames)) groupL1Passed = true; //groupL1Passed = true; // Fill HLTPassed Matrix and HLTPassFail Matrix // -------------------------------------------------------- if(hltResults->accept(pathByIndex)) { groupPassed = true; break; } } if(groupPassed) { scalersPD_->Fill(mi); anyGroupPassed = true; } } if(anyGroupPassed) scalersPD_->Fill(pairPDPaths_.size()-1); }
void HLTScalers::beginJob | ( | void | ) | [virtual] |
BeginJob.
Reimplemented from edm::EDAnalyzer.
Definition at line 122 of file HLTScalers.cc.
References DQMStore::book1D(), DQMStore::bookInt(), dbe_, diagnostic_, folderName_, hltOverallScaler_, hltOverallScalerN_, LogDebug, nLumiBlock_, nProc_, and DQMStore::setCurrentFolder().
{ LogDebug("HLTScalers") << "HLTScalers::beginJob()..." << std::endl; if (dbe_) { std::string rawdir(folderName_ + "/raw"); dbe_->setCurrentFolder(rawdir); nProc_ = dbe_->bookInt("nProcessed"); nLumiBlock_ = dbe_->bookInt("nLumiBlock"); diagnostic_ = dbe_->book1D("hltMerge", "HLT merging diagnostic", 1, 0.5, 1.5); // fill for ever accepted event hltOverallScaler_ = dbe_->book1D("hltOverallScaler", "HLT Overall Scaler", 1, 0.5, 1.5); hltOverallScalerN_ = dbe_->book1D("hltOverallScalerN", "Reset HLT Overall Scaler", 1, 0.5, 1.5); // other ME's are now found on the first event of the new run, // when we know more about the HLT configuration. } }
void HLTScalers::beginLuminosityBlock | ( | const edm::LuminosityBlock & | lumiSeg, |
const edm::EventSetup & | c | ||
) | [virtual] |
Begin LumiBlock.
Reimplemented from edm::EDAnalyzer.
Definition at line 300 of file HLTScalers.cc.
References hltOverallScalerN_, LogDebug, MonitorElement::Reset(), and scalersN_.
{ LogDebug("HLTScalers") << "Start of luminosity block." ; // reset the N guys if ( scalersN_ ) scalersN_->Reset(); if ( hltOverallScalerN_ ) hltOverallScalerN_->Reset(); }
void HLTScalers::beginRun | ( | const edm::Run & | run, |
const edm::EventSetup & | c | ||
) | [virtual] |
BeginRun.
Reimplemented from edm::EDAnalyzer.
Definition at line 325 of file HLTScalers.cc.
References currentRun_, HLTConfigProvider::datasetContent(), hltConfig_, i, edm::RunBase::id(), HLTConfigProvider::init(), LogDebug, pairPDPaths_, processname_, resetMe_, edm::RunID::run(), HLTConfigProvider::streamContent(), HLTConfigProvider::streamIndex(), and HLTConfigProvider::streamNames().
{ LogDebug("HLTScalers") << "HLTScalers::beginRun, run " << run.id(); if ( currentRun_ != int(run.id().run()) ) { resetMe_ = true; currentRun_ = run.id().run(); } // HLT config does not change within runs! bool changed=false; // clear vector pairPDPaths_ pairPDPaths_.clear(); if (not hltConfig_.init(run, c, processname_, changed)) { edm::LogError("TrigXMonitor") << "HLTConfigProvider failed to initialize."; } else { // check if trigger name in (new) config // cout << "Available TriggerNames are: " << endl; // hltConfig_.dump("Triggers"); if (hltConfig_.streamIndex("A")<hltConfig_.streamNames().size()) { // get hold of PD names and constituent path names const std::vector<std::string> & PD = hltConfig_.streamContent("A") ; for (unsigned int i = 0; i < PD.size(); i++) { const std::vector<std::string> & datasetPaths = hltConfig_.datasetContent(PD[i]); pairPDPaths_.push_back(make_pair(PD[i], datasetPaths)); } // push stream A and its PDs pairPDPaths_.push_back(make_pair("A", PD)); } else { LogDebug("HLTScalers") << "HLTScalers::beginRun, steamm A not in the HLT menu "; } } }
void HLTScalers::endLuminosityBlock | ( | const edm::LuminosityBlock & | lumiSeg, |
const edm::EventSetup & | c | ||
) | [virtual] |
End LumiBlock DQM Client Diagnostic should be performed here
Reimplemented from edm::EDAnalyzer.
Definition at line 312 of file HLTScalers.cc.
References MonitorElement::Fill(), edm::LuminosityBlockBase::id(), LogDebug, edm::LuminosityBlockID::luminosityBlock(), and nLumiBlock_.
{ // put this in as a first-pass for figuring out the rate // each lumi block is 23 seconds in length nLumiBlock_->Fill(lumiSeg.id().luminosityBlock()); LogDebug("HLTScalers") << "End of luminosity block." ; }
void HLTScalers::endRun | ( | const edm::Run & | run, |
const edm::EventSetup & | c | ||
) | [virtual] |
EndRun.
Reimplemented from edm::EDAnalyzer.
Definition at line 373 of file HLTScalers.cc.
References currentRun_, edm::RunBase::id(), LogDebug, resetMe_, and edm::RunID::run().
{ LogDebug("HLTScalers") << "HLTScalers::endRun , run " << run.id(); if ( currentRun_ != int(run.id().run()) ) { resetMe_ = true; currentRun_ = run.id().run(); } }
int HLTScalers::currentRun_ [private] |
Definition at line 134 of file HLTScalers.h.
Referenced by beginRun(), and endRun().
DQMStore* HLTScalers::dbe_ [private] |
Definition at line 116 of file HLTScalers.h.
Referenced by analyze(), beginJob(), and HLTScalers().
MonitorElement* HLTScalers::detailedScalers_ [private] |
Definition at line 122 of file HLTScalers.h.
Referenced by analyze().
MonitorElement* HLTScalers::diagnostic_ [private] |
Definition at line 128 of file HLTScalers.h.
Referenced by analyze(), and beginJob().
std::string HLTScalers::folderName_ [private] |
Definition at line 111 of file HLTScalers.h.
Referenced by analyze(), beginJob(), and HLTScalers().
MonitorElement* HLTScalers::hltBx_ [private] |
Definition at line 125 of file HLTScalers.h.
Referenced by analyze().
MonitorElement * HLTScalers::hltBxVsPath_ [private] |
Definition at line 125 of file HLTScalers.h.
Referenced by analyze().
HLTConfigProvider HLTScalers::hltConfig_ [private] |
Definition at line 110 of file HLTScalers.h.
Referenced by beginRun().
MonitorElement* HLTScalers::hltCorrelations_ [private] |
Definition at line 121 of file HLTScalers.h.
Referenced by analyze().
MonitorElement* HLTScalers::hltOverallScaler_ [private] |
Definition at line 126 of file HLTScalers.h.
Referenced by analyze(), and beginJob().
MonitorElement* HLTScalers::hltOverallScalerN_ [private] |
Definition at line 127 of file HLTScalers.h.
Referenced by analyze(), beginJob(), and beginLuminosityBlock().
bool HLTScalers::monitorDaemon_ [private] |
Definition at line 130 of file HLTScalers.h.
int HLTScalers::nev_ [private] |
Definition at line 132 of file HLTScalers.h.
Referenced by analyze().
int HLTScalers::nLumi_ [private] |
Definition at line 133 of file HLTScalers.h.
MonitorElement* HLTScalers::nLumiBlock_ [private] |
Definition at line 124 of file HLTScalers.h.
Referenced by beginJob(), and endLuminosityBlock().
MonitorElement* HLTScalers::nProc_ [private] |
Definition at line 123 of file HLTScalers.h.
Referenced by analyze(), and beginJob().
std::vector<std::pair<std::string, std::vector<std::string> > > HLTScalers::pairPDPaths_ [private] |
Definition at line 113 of file HLTScalers.h.
Referenced by analyze(), and beginRun().
std::string HLTScalers::processname_ [private] |
Definition at line 112 of file HLTScalers.h.
Referenced by beginRun().
bool HLTScalers::resetMe_ [private] |
Definition at line 130 of file HLTScalers.h.
Referenced by analyze(), beginRun(), and endRun().
MonitorElement* HLTScalers::scalers_ [private] |
Definition at line 118 of file HLTScalers.h.
Referenced by analyze().
MonitorElement* HLTScalers::scalersException_ [private] |
Definition at line 120 of file HLTScalers.h.
Referenced by analyze().
MonitorElement* HLTScalers::scalersN_ [private] |
Definition at line 119 of file HLTScalers.h.
Referenced by analyze(), and beginLuminosityBlock().
MonitorElement* HLTScalers::scalersPD_ [private] |
Definition at line 117 of file HLTScalers.h.
Referenced by analyze().
bool HLTScalers::sentPaths_ [private] |
Definition at line 130 of file HLTScalers.h.
Referenced by analyze().
edm::InputTag HLTScalers::trigResultsSource_ [private] |
Definition at line 114 of file HLTScalers.h.
Referenced by analyze().