22 triggerResultsTag_(
"TriggerResults::HLT"),
24 l1GtTriggerMenuLiteTag_(
"l1GtTriggerMenuLite"),
27 if (
config.exists(
"prescaleWeightVerbosityLevel"))
29 if (
config.exists(
"prescaleWeightTriggerResults"))
31 if (
config.exists(
"prescaleWeightL1GtTriggerMenuLite"))
33 if (
config.exists(
"prescaleWeightHltPaths"))
34 hltPaths_ =
config.getParameter<std::vector<std::string> >(
"prescaleWeightHltPaths");
40 edm::LogWarning(
"PrescaleWeightProvider") <<
"Process name not configured via TriggerResults InputTag";
44 edm::LogWarning(
"PrescaleWeightProvider") <<
"TriggerResults label not configured";
48 edm::LogWarning(
"PrescaleWeightProvider") <<
"L1GtTriggerMenuLite label not configured";
52 edm::LogError(
"PrescaleWeightProvider") <<
"HLT paths of interest not configured";
66 edm::LogWarning(
"PrescaleWeightProvider") <<
"Run initialisation failed due to failing configuration";
71 bool hltChanged(
false);
79 edm::LogError(
"PrescaleWeightProvider") <<
"HLT config size error";
81 }
else if (hltChanged) {
83 edm::LogInfo(
"PrescaleWeightProvider") <<
"HLT configuration changed";
116 const int SENTINEL(-1);
124 edm::LogError(
"PrescaleWeightProvider::prescaleWeight") <<
"HLT path \"" <<
hltPath <<
"\" does not exist";
130 const std::vector<std::pair<bool, std::string> >& level1Seeds =
hltConfig.hltL1GTSeeds(
hltPath);
131 if (level1Seeds.size() != 1) {
134 <<
"HLT path \"" <<
hltPath <<
"\" provides too many L1 seeds";
141 <<
"Failed to parse L1 seeds for HLT path \"" <<
hltPath <<
"\"";
145 int l1Prescale(SENTINEL);
147 int l1TempPrescale(SENTINEL);
149 if (level1Seeds.at(0).first) {
170 if (l1TempPrescale > 0) {
171 if (l1Prescale == SENTINEL || l1Prescale > l1TempPrescale)
172 l1Prescale = l1TempPrescale;
175 if (l1Prescale == SENTINEL) {
178 <<
"Unable to find the L1 prescale for HLT path \"" <<
hltPath <<
"\"";
184 if (hltPrescale * l1Prescale > 0) {
185 if (
weight == SENTINEL ||
weight > hltPrescale * l1Prescale) {
186 weight = hltPrescale * l1Prescale;
194 <<
"No valid weight for any requested HLT path, returning default weight of 1";
202 std::stringstream
ss(l1Seeds);
205 while (
ss.good() && !
ss.eof()) {
207 if (
buf[0] ==
'(' ||
buf[
buf.size() - 1] ==
')' ||
buf ==
"AND" ||
buf ==
"NOT") {
210 edm::LogWarning(
"PrescaleWeightProvider::parseL1Seeds") <<
"Only supported logical expression is OR";
212 }
else if (
buf ==
"OR")
EDGetTokenT< ProductType > mayConsume(edm::InputTag const &tag)
PrescaleWeightProvider(const edm::ParameterSet &config, edm::ConsumesCollector &&iC, T &module)
int prescaleWeight(const edm::Event &event, const edm::EventSetup &setup)
const int prescaleFactor(const edm::Event &iEvent, const std::string &nameAlgoTechTrig, int &errorCode) const
return prescale factor for a given algorithm or technical trigger
edm::Handle< L1GtTriggerMenuLite > triggerMenuLite_
edm::InputTag triggerResultsTag_
Log< level::Error, false > LogError
std::vector< std::string > l1SeedPaths_
std::vector< std::string > hltPaths_
std::unique_ptr< HLTPrescaleProvider > hltPrescaleProvider_
void initRun(const edm::Run &run, const edm::EventSetup &setup)
static std::string const triggerResults
edm::EDGetTokenT< L1GtTriggerMenuLite > l1GtTriggerMenuLiteToken_
Log< level::Info, false > LogInfo
const bool decision(const edm::Event &iEvent, const std::string &nameAlgoTechTrig, int &errorCode) const
edm::EDGetTokenT< edm::TriggerResults > triggerResultsToken_
Log< level::Warning, false > LogWarning
edm::InputTag l1GtTriggerMenuLiteTag_
void parseL1Seeds(const std::string &l1Seeds)