24 : forceDefault_(iPS.getParameter<bool>(
"forceDefault")),
25 lvl1Labels_(iPS.getParameter<std::
vector<std::
string> >(
"lvl1Labels")),
26 lvl1Default_(findDefaultIndex(iPS.getParameter<std::
string>(
"lvl1DefaultLabel"), lvl1Labels_)),
27 vpsetPrescales_(iPS.getParameterSetVector(
"prescaleTable")),
39 for (
unsigned int iVPSet = 0; iVPSet <
vpsetPrescales_.size(); ++iVPSet) {
43 throw cms::Exception(
"PrescaleServiceConfigError") <<
" Path '" << pathName <<
"' found more than once!";
45 std::vector<unsigned int>
prescales = psetPrescales.
getParameter<std::vector<unsigned int> >(
"prescales");
48 <<
" Path '" << pathName <<
"' has " << prescales.size() <<
" prescales, instead of expected "
70 std::map<std::string, std::string> path2module;
72 std::map<std::string, std::string> module2path;
81 for (
unsigned int i = 0;
i < allModules.size(); ++
i) {
85 if (moduleType ==
"HLTPrescaler")
86 module2path[moduleLabel] =
"";
89 const std::vector<std::string> allPaths = prcPS.
getParameter<std::vector<std::string> >(
"@paths");
90 for (
unsigned int iP = 0; iP < allPaths.size(); ++iP) {
93 for (
unsigned int iM = 0; iM < modules.size(); ++iM) {
95 if (module2path.find(moduleLabel) != module2path.end()) {
96 if (path2module.find(pathName) == path2module.end()) {
100 <<
"Path '" << pathName <<
"' with (>1) HLTPrescalers: " << path2module[
pathName] <<
"+"
101 << moduleLabel <<
"!";
103 if (module2path[moduleLabel].
empty()) {
104 module2path[moduleLabel] =
pathName;
107 <<
" HLTPrescaler '" << moduleLabel <<
"' on (>1) Paths: " << module2path[moduleLabel] <<
"+"
114 for (std::map<std::string, std::string>::const_iterator it = module2path.begin(); it != module2path.end(); ++it) {
115 if (it->second.empty()) {
117 <<
" HLTPrescaler '" << it->first <<
"' not found on any path!";
125 if (path2module.find(it->first) == path2module.end()) {
127 <<
" Path '" << it->first <<
"' is unknown or does not contain any HLTPrescaler!";
144 <<
"lvl1Index '" << lvl1Index <<
"' exceeds number of prescale columns " <<
lvl1Labels_.size() <<
"!";
146 PrescaleTable_t::const_iterator it =
prescaleTable_.find(prescaledPath);
152 for (
unsigned int i = 0;
i < labels.size(); ++
i) {
153 if (labels[
i] == label) {
157 return labels.size();
164 std::vector<std::string> defaultVector;
166 desc.
add<std::vector<std::string> >(
"lvl1Labels", defaultVector);
171 std::vector<edm::ParameterSet> defaultVPSet;
174 std::vector<unsigned> defaultVectorU;
175 defaultVectorU.push_back(1u);
176 pset0.
addParameter<std::vector<unsigned> >(
"prescales", defaultVectorU);
177 defaultVPSet.push_back(pset0);
181 validator.
add<std::vector<unsigned int> >(
"prescales");
183 desc.
addVPSet(
"prescaleTable", validator, defaultVPSet);
186 desc.
add<
bool>(
"forceDefault",
false);
188 descriptions.
add(
"PrescaleService", desc);
void preBeginJob(PathsAndConsumesOfModulesBase const &, ProcessContext const &)
const unsigned int lvl1Default_
const VString_t lvl1Labels_
ParameterDescriptionBase * addVPSet(U const &iLabel, ParameterSetDescription const &validator, std::vector< ParameterSet > const &defaults)
ParameterSet const & getParameterSet(ParameterSetID const &id)
ParameterSetID const & parameterSetID() const
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
PrescaleTable_t prescaleTable_
void addParameter(std::string const &name, T const &value)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
PrescaleService(ParameterSet const &, ActivityRegistry &)
ParameterSet const & getParameterSet(std::string const &) const
unsigned int getPrescale(std::string const &prescaledPath) const
T getParameter(std::string const &) const
const std::vector< ParameterSet > vpsetPrescales_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void watchPreBeginJob(PreBeginJob::slot_type const &iSlot)
convenience function for attaching to signal
ParameterSetID processParameterSetID_
static unsigned int findDefaultIndex(std::string const &label, std::vector< std::string > const &labels)
void watchPostBeginJob(PostBeginJob::slot_type const &iSlot)
convenience function for attaching to signal