#include <PrescaleService.h>
Public Types | |
typedef std::map< std::string, std::vector< unsigned int > > | PrescaleTable_t |
typedef std::vector< std::string > | VString_t |
Public Member Functions | |
unsigned int | getLvl1IndexDefault () const |
const VString_t & | getLvl1Labels () const |
unsigned int | getPrescale (std::string const &prescaledPath) |
unsigned int | getPrescale (unsigned int lvl1Index, std::string const &prescaledPath) |
const PrescaleTable_t & | getPrescaleTable () const |
void | postBeginJob () |
void | postEndJob () |
void | postEventProcessing (Event const &, EventSetup const &) |
void | postModule (ModuleDescription const &) |
void | preEventProcessing (EventID const &, Timestamp const &) |
void | preModule (ModuleDescription const &) |
PrescaleService (ParameterSet const &, ActivityRegistry &) | |
void | reconfigure (ParameterSet const &ps) |
void | setIndex (unsigned int lvl1Index) |
~PrescaleService () | |
Static Public Member Functions | |
static void | fillDescriptions (edm::ConfigurationDescriptions &descriptions) |
static unsigned int | findDefaultIndex (std::string const &label, std::vector< std::string > const &labels) |
Private Member Functions | |
void | configure () |
Private Attributes | |
bool | configured_ |
bool | forceDefault_ |
unsigned int | iLvl1IndexDefault_ |
VString_t | lvl1Labels_ |
unsigned int | nLvl1Index_ |
PrescaleTable_t | prescaleTable_ |
std::vector< ParameterSet > | vpsetPrescales_ |
Definition at line 25 of file PrescaleService.h.
typedef std::map<std::string, std::vector<unsigned int> > edm::service::PrescaleService::PrescaleTable_t |
Definition at line 54 of file PrescaleService.h.
typedef std::vector<std::string> edm::service::PrescaleService::VString_t |
Definition at line 53 of file PrescaleService.h.
edm::service::PrescaleService::PrescaleService | ( | ParameterSet const & | iPS, |
ActivityRegistry & | iReg | ||
) |
Definition at line 29 of file PrescaleService.cc.
References postBeginJob(), postEndJob(), postEventProcessing(), postModule(), preEventProcessing(), preModule(), edm::ActivityRegistry::watchPostBeginJob(), edm::ActivityRegistry::watchPostEndJob(), edm::ActivityRegistry::watchPostModule(), edm::ActivityRegistry::watchPostProcessEvent(), edm::ActivityRegistry::watchPreModule(), and edm::ActivityRegistry::watchPreProcessEvent().
: configured_(false) , forceDefault_(iPS.getParameter<bool>("forceDefault")) , lvl1Labels_(iPS.getParameter<std::vector<std::string> >("lvl1Labels")) , nLvl1Index_(lvl1Labels_.size()) , iLvl1IndexDefault_(findDefaultIndex(iPS.getParameter<std::string>("lvl1DefaultLabel"), lvl1Labels_)) , vpsetPrescales_(iPS.getParameterSetVector("prescaleTable")) , prescaleTable_() { iReg.watchPostBeginJob(this, &PrescaleService::postBeginJob); iReg.watchPostEndJob(this, &PrescaleService::postEndJob); iReg.watchPreProcessEvent(this, &PrescaleService::preEventProcessing); iReg.watchPostProcessEvent(this, &PrescaleService::postEventProcessing); iReg.watchPreModule(this, &PrescaleService::preModule); iReg.watchPostModule(this, &PrescaleService::postModule); }
edm::service::PrescaleService::~PrescaleService | ( | ) |
Definition at line 49 of file PrescaleService.cc.
{ }
void edm::service::PrescaleService::configure | ( | ) | [private] |
Definition at line 73 of file PrescaleService.cc.
References configured_, Exception, edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterSet(), edm::getProcessParameterSet(), i, nLvl1Index_, EgammaValidation_cff::pathName, makeHLTPrescaleTable::prescales, prescaleTable_, AlCaHLTBitMon_QueryRunRegistry::string, and vpsetPrescales_.
Referenced by getPrescale(), postBeginJob(), and reconfigure().
{ configured_ = true; ParameterSet prcPS = getProcessParameterSet(); // find all HLTPrescaler modules std::set<std::string> prescalerModules; std::vector<std::string> allModules=prcPS.getParameter<std::vector<std::string> >("@all_modules"); for(unsigned int i = 0; i < allModules.size(); ++i) { ParameterSet const& pset = prcPS.getParameterSet(allModules[i]); std::string moduleLabel = pset.getParameter<std::string>("@module_label"); std::string moduleType = pset.getParameter<std::string>("@module_type"); if (moduleType == "HLTPrescaler") prescalerModules.insert(moduleLabel); } // find all paths with an HLTPrescaler and check for <=1 std::set<std::string> prescaledPathSet; std::vector<std::string> allPaths = prcPS.getParameter<std::vector<std::string> >("@paths"); for (unsigned int iP = 0; iP < allPaths.size(); ++iP) { std::string pathName = allPaths[iP]; std::vector<std::string> modules = prcPS.getParameter<std::vector<std::string> >(pathName); for (unsigned int iM = 0; iM < modules.size(); ++iM) { std::string moduleLabel = modules[iM]; if (prescalerModules.erase(moduleLabel)>0) { std::set<std::string>::const_iterator itPath=prescaledPathSet.find(pathName); if (itPath==prescaledPathSet.end()) { prescaledPathSet.insert(pathName); } else { throw cms::Exception("DuplicatePrescaler") <<"path '"<<pathName<<"' has more than one HLTPrescaler!"; } } } } std::vector<std::string> prescaledPaths; for (unsigned int iVPSet=0; iVPSet < vpsetPrescales_.size(); ++iVPSet) { ParameterSet psetPrescales = vpsetPrescales_[iVPSet]; std::string pathName = psetPrescales.getParameter<std::string>("pathName"); if (prescaledPathSet.erase(pathName) > 0) { std::vector<unsigned int> prescales = psetPrescales.getParameter<std::vector<unsigned int> >("prescales"); if (prescales.size()!=nLvl1Index_) { throw cms::Exception("PrescaleTableMismatch") << "path '" << pathName << "' has unexpected number of prescales"; } prescaleTable_[pathName] = prescales; } else { throw cms::Exception("PrescaleTableUnknownPath") <<"path '"<<pathName<<"' is invalid or does not " <<"contain any HLTPrescaler"; } } }
void edm::service::PrescaleService::fillDescriptions | ( | edm::ConfigurationDescriptions & | descriptions | ) | [static] |
Definition at line 168 of file PrescaleService.cc.
References edm::ParameterSetDescription::add(), edm::ConfigurationDescriptions::add(), edm::ParameterSet::addParameter(), edm::ParameterSetDescription::addVPSet(), and AlCaHLTBitMon_QueryRunRegistry::string.
{ edm::ParameterSetDescription desc; std::vector<std::string> defaultVector; defaultVector.push_back(std::string("default")); desc.add<std::vector<std::string> >("lvl1Labels", defaultVector); // This default vector<ParameterSet> will be used when // the configuration does not include this parameter and // it also gets written into the generated cfi file. std::vector<edm::ParameterSet> defaultVPSet; edm::ParameterSet pset0; pset0.addParameter<std::string>("pathName", std::string("HLTPath")); std::vector<unsigned> defaultVectorU; defaultVectorU.push_back(1u); pset0.addParameter<std::vector<unsigned> >("prescales", defaultVectorU); defaultVPSet.push_back(pset0); edm::ParameterSetDescription validator; validator.add<std::string>("pathName"); validator.add<std::vector<unsigned int> >("prescales"); desc.addVPSet("prescaleTable", validator, defaultVPSet); desc.add<std::string>("lvl1DefaultLabel", std::string("default")); desc.add<bool> ("forceDefault", false); descriptions.add("PrescaleService", desc); }
unsigned int edm::service::PrescaleService::findDefaultIndex | ( | std::string const & | label, |
std::vector< std::string > const & | labels | ||
) | [static] |
unsigned int edm::service::PrescaleService::getLvl1IndexDefault | ( | ) | const [inline] |
Definition at line 55 of file PrescaleService.h.
References iLvl1IndexDefault_.
Referenced by HLTPrescaleRecorder::beginLuminosityBlock(), and HLTPrescaleRecorder::beginRun().
{return iLvl1IndexDefault_;}
const VString_t& edm::service::PrescaleService::getLvl1Labels | ( | ) | const [inline] |
Definition at line 56 of file PrescaleService.h.
References lvl1Labels_.
Referenced by HLTPrescaleRecorder::beginLuminosityBlock(), and HLTPrescaleRecorder::beginRun().
{return lvl1Labels_;}
unsigned int edm::service::PrescaleService::getPrescale | ( | unsigned int | lvl1Index, |
std::string const & | prescaledPath | ||
) |
Definition at line 137 of file PrescaleService.cc.
References configure(), configured_, Exception, forceDefault_, iLvl1IndexDefault_, nLvl1Index_, and prescaleTable_.
Referenced by HLTPrescaler::filter(), getPrescale(), and evf::FWEPWrapper::taskWebPage().
{ if (forceDefault_) lvl1Index = iLvl1IndexDefault_; if (lvl1Index >= nLvl1Index_) { throw cms::Exception("InvalidLvl1Index") <<"lvl1Index '"<<lvl1Index<<"' exceeds number of prescale columns"; } if (!configured_) { configure(); } PrescaleTable_t::const_iterator it = prescaleTable_.find(prescaledPath); return (it == prescaleTable_.end()) ? 1 : it->second[lvl1Index]; }
unsigned int edm::service::PrescaleService::getPrescale | ( | std::string const & | prescaledPath | ) |
Definition at line 131 of file PrescaleService.cc.
References getPrescale(), and iLvl1IndexDefault_.
{ return getPrescale(iLvl1IndexDefault_, prescaledPath); }
const PrescaleTable_t& edm::service::PrescaleService::getPrescaleTable | ( | ) | const [inline] |
Definition at line 57 of file PrescaleService.h.
References prescaleTable_.
Referenced by HLTPrescaleRecorder::beginLuminosityBlock(), and HLTPrescaleRecorder::beginRun().
{return prescaleTable_;}
void edm::service::PrescaleService::postBeginJob | ( | ) |
Definition at line 66 of file PrescaleService.cc.
References configure(), and configured_.
Referenced by PrescaleService().
{ if (!configured_) { configure(); } }
void edm::service::PrescaleService::postEndJob | ( | ) | [inline] |
void edm::service::PrescaleService::postEventProcessing | ( | Event const & | , |
EventSetup const & | |||
) | [inline] |
void edm::service::PrescaleService::postModule | ( | ModuleDescription const & | ) | [inline] |
void edm::service::PrescaleService::preModule | ( | ModuleDescription const & | ) | [inline] |
void edm::service::PrescaleService::reconfigure | ( | ParameterSet const & | ps | ) |
Definition at line 56 of file PrescaleService.cc.
References configure(), findDefaultIndex(), edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterSetVector(), iLvl1IndexDefault_, lvl1Labels_, nLvl1Index_, prescaleTable_, AlCaHLTBitMon_QueryRunRegistry::string, and vpsetPrescales_.
Referenced by evf::FWEPWrapper::init().
{ vpsetPrescales_.clear(); prescaleTable_.clear(); lvl1Labels_ = iPS.getParameter<std::vector<std::string> >("lvl1Labels"); nLvl1Index_ = lvl1Labels_.size(); iLvl1IndexDefault_ = findDefaultIndex(iPS.getParameter<std::string>("lvl1DefaultLabel"), lvl1Labels_); vpsetPrescales_ = iPS.getParameterSetVector("prescaleTable"); configure(); }
void edm::service::PrescaleService::setIndex | ( | unsigned int | lvl1Index | ) | [inline] |
Definition at line 45 of file PrescaleService.h.
References iLvl1IndexDefault_.
Referenced by evf::FWEPWrapper::getTriggerReport().
{iLvl1IndexDefault_ = lvl1Index;}
bool edm::service::PrescaleService::configured_ [private] |
Definition at line 73 of file PrescaleService.h.
Referenced by configure(), getPrescale(), and postBeginJob().
bool edm::service::PrescaleService::forceDefault_ [private] |
Definition at line 74 of file PrescaleService.h.
Referenced by getPrescale().
unsigned int edm::service::PrescaleService::iLvl1IndexDefault_ [private] |
Definition at line 77 of file PrescaleService.h.
Referenced by getLvl1IndexDefault(), getPrescale(), reconfigure(), and setIndex().
Definition at line 75 of file PrescaleService.h.
Referenced by getLvl1Labels(), and reconfigure().
unsigned int edm::service::PrescaleService::nLvl1Index_ [private] |
Definition at line 76 of file PrescaleService.h.
Referenced by configure(), getPrescale(), and reconfigure().
Definition at line 79 of file PrescaleService.h.
Referenced by configure(), getPrescale(), getPrescaleTable(), and reconfigure().
std::vector<ParameterSet> edm::service::PrescaleService::vpsetPrescales_ [private] |
Definition at line 78 of file PrescaleService.h.
Referenced by configure(), and reconfigure().