20 static const unsigned char countMax(2);
41 }
else if (l1tType == 2) {
45 edm::LogError(
"HLTPrescaleProvider") <<
" Unknown L1T Type " << l1tType <<
" - prescales will not be avaiable!";
63 throw cms::Exception(
"LogicError") <<
"HLTPrescaleProvider::prescaleSet,\n" 64 "HLTPrescaleProvider::init was not called at beginRun\n";
76 assert(psfsiTech == psfsiPhys);
77 if ((errorTech == 0) && (errorPhys == 0) && (psfsiTech >= 0) && (psfsiPhys >= 0) && (psfsiTech == psfsiPhys)) {
85 <<
" Error in determining HLT prescale set index from L1 data using L1GtUtils:" 86 <<
" Tech/Phys error = " << errorTech <<
"/" << errorPhys <<
" Tech/Phys psfsi = " << psfsiTech <<
"/" 91 }
else if (l1tType == 2) {
100 <<
" Unknown L1T Type " << l1tType <<
" - can not determine prescale set index!";
109 static constexpr
double kL1RoundingEpsilon = 0.001;
113 <<
", using a FractionalPrescale is a loss of precision";
131 if (nL1GTSeedModules == 0) {
134 }
else if (nL1GTSeedModules == 1) {
138 LogDebug(
"HLTPrescaleProvider") <<
"Undefined L1T prescale for HLT path: '" <<
trigger <<
"' with L1T seed '" 148 <<
" Error in determining L1T prescale for HLT path: '" <<
trigger <<
"' with L1T seed: '" << l1tname
149 <<
"' using L1GtUtils: error code = " << l1error <<
"." << std::endl
150 <<
" Note: for this method ('prescaleValues'), only a single L1T name (and not a bit number)" 151 <<
" is allowed as seed!" << std::endl
152 <<
" For seeds being complex logical expressions, try the new method 'prescaleValuesInDetail'." 163 for (
unsigned int i = 1;
i != nL1GTSeedModules; ++
i) {
167 <<
" Error in determining L1T prescale for HLT path: '" <<
trigger <<
"' has multiple L1GTSeed modules, " 168 << nL1GTSeedModules <<
", with L1 seeds: " <<
dump 169 <<
". (Note: at most one L1GTSeed module is allowed for a proper determination of the L1T prescale!)";
173 }
else if (l1tType == 2) {
176 if (nL1TSeedModules == 0) {
179 }
else if (nL1TSeedModules == 1) {
183 LogDebug(
"HLTPrescaleProvider") <<
"Undefined L1T prescale for HLT path: '" <<
trigger <<
"' with L1T seed '" 192 <<
" Error in determining L1T prescale for HLT path: '" <<
trigger <<
"' with L1T seed: '" << l1tname
193 <<
"' using L1TGlobalUtil: error cond = " << l1error <<
"." << std::endl
194 <<
" Note: for this method ('prescaleValues'), only a single L1T name (and not a bit number)" 195 <<
" is allowed as seed!" << std::endl
196 <<
" For seeds being complex logical expressions, try the new method 'prescaleValuesInDetail'." 207 for (
unsigned int i = 1;
i != nL1TSeedModules; ++
i) {
211 <<
" Error in determining L1T prescale for HLT path: '" <<
trigger <<
"' has multiple L1TSeed modules, " 212 << nL1TSeedModules <<
", with L1T seeds: " <<
dump 213 <<
". (Note: at most one L1TSeed module is allowed for a proper determination of the L1T prescale!)";
220 edm::LogError(
"HLTPrescaleProvider") <<
" Unknown L1T Type " << l1tType <<
" - can not determine L1T prescale! ";
230 std::vector<std::pair<std::string, double>>
result;
237 if (nL1GTSeedModules == 0) {
240 }
else if (nL1GTSeedModules == 1) {
244 LogDebug(
"HLTPrescaleProvider") <<
"Undefined L1T prescales for HLT path: '" <<
trigger <<
"' with L1T seed '" 250 const std::vector<std::pair<std::string, int>>& errorCodes(l1Logical.
errorCodes(
iEvent));
253 result.reserve(resultInt.size());
254 for (
const auto&
entry : resultInt) {
257 int l1error(l1Logical.
isValid() ? 0 : 1);
258 for (
auto const& errorCode : errorCodes) {
259 l1error +=
std::abs(errorCode.second);
264 std::ostringstream message;
265 message <<
" Error in determining L1T prescales for HLT path: '" <<
trigger <<
"' with complex L1T seed: '" 266 << l1tname <<
"' using L1GtUtils: " << std::endl
267 <<
" isValid=" << l1Logical.
isValid() <<
" l1tname/error/prescale " << errorCodes.size()
269 for (
unsigned int i = 0;
i < errorCodes.size(); ++
i) {
270 message <<
" " <<
i <<
":" << errorCodes[
i].first <<
"/" << errorCodes[
i].second <<
"/" 284 for (
unsigned int i = 1;
i != nL1GTSeedModules; ++
i) {
288 <<
" Error in determining L1T prescale for HLT path: '" <<
trigger <<
"' has multiple L1GTSeed modules, " 289 << nL1GTSeedModules <<
", with L1 seeds: " <<
dump 290 <<
". (Note: at most one L1GTSeed module is allowed for a proper determination of the L1T prescale!)";
294 }
else if (l1tType == 2) {
297 if (nL1TSeedModules == 0) {
300 }
else if (nL1TSeedModules == 1) {
303 LogDebug(
"HLTPrescaleProvider") <<
"Undefined L1T prescales for HLT path: '" <<
trigger <<
"' with L1T seed '" 310 double l1tPrescale(-1);
312 result.reserve(l1tSeeds.size());
313 for (
auto const&
i : l1tSeeds) {
314 const string& l1tSeed =
i.tokenName;
318 result.push_back(std::pair<std::string, double>(l1tSeed, l1tPrescale));
323 string l1name = l1tname;
324 std::ostringstream message;
325 message <<
" Error in determining L1T prescales for HLT path: '" <<
trigger <<
"' with complex L1T seed: '" 326 << l1tname <<
"' using L1TGlobalUtil: " << std::endl
328 << l1tSeeds.size() << std::endl;
329 for (
unsigned int i = 0;
i < l1tSeeds.size(); ++
i) {
330 const string& l1tSeed = l1tSeeds[
i].tokenName;
331 message <<
" " <<
i <<
":" << l1tSeed <<
"/" <<
l1tGlobalUtil_->getPrescaleByName(l1tSeed, l1tPrescale)
345 for (
unsigned int i = 1;
i != nL1TSeedModules; ++
i) {
349 <<
" Error in determining L1T prescale for HLT path: '" <<
trigger <<
"' has multiple L1TSeed modules, " 350 << nL1TSeedModules <<
", with L1T seeds: " <<
dump 351 <<
". (Note: at most one L1TSeed module is allowed for a proper determination of the L1T prescale!)";
358 edm::LogError(
"HLTPrescaleProvider") <<
" Unknown L1T Type " << l1tType <<
" - can not determine L1T prescale! ";
372 throw cms::Exception(
"Configuration") <<
"HLTPrescaleProvider::checkL1GtUtils(),\n" 373 "Attempt to use L1GtUtils object when none was constructed.\n" 374 "Possibly the proper era is not configured or\n" 375 "the module configuration does not use the era properly\n" 376 "or input is from mixed eras";
382 throw cms::Exception(
"Configuration") <<
"HLTPrescaleProvider:::checkL1TGlobalUtil(),\n" 383 "Attempt to use L1TGlobalUtil object when none was constructed.\n" 384 "Possibly the proper era is not configured or\n" 385 "the module configuration does not use the era properly\n" 386 "or input is from mixed eras";
394 bool readPrescalesFromFile) {
HLTConfigProvider hltConfigProvider_
static void fillPSetDescription(edm::ParameterSetDescription &desc, unsigned int stageL1Trigger, edm::InputTag const &l1tAlgBlkInputTag, edm::InputTag const &l1tExtBlkInputTag, bool readPrescalesFromFile)
const int logicalExpressionRunUpdate(const edm::Run &, const edm::EventSetup &, const std::string &)
std::unique_ptr< L1GtUtils > l1GtUtils_
const std::vector< std::vector< std::string > > & hltL1TSeeds() const
void checkL1GtUtils() const
const std::vector< std::pair< std::string, int > > & prescaleFactors()
const std::string moduleType(const std::string &module) const
C++ class name of module.
void checkL1TGlobalUtil() const
Log< level::Error, false > LogError
l1t::L1TGlobalUtil const & l1tGlobalUtil() const
double getL1PrescaleValue(const edm::Event &iEvent, const edm::EventSetup &iSetup, const std::string &trigger)
std::vector< GlobalLogicParser::OperandToken > expressionSeedsOperandList()
static const unsigned char countMax(2)
unsigned int l1tType() const
L1T type (0=unknown, 1=legacy/stage-1 or 2=stage-2)
boost::rational< int > FractionalPrescale
const std::string & moduleLabel(unsigned int trigger, unsigned int module) const
const std::vector< std::vector< std::pair< bool, std::string > > > & hltL1GTSeeds() const
static const bool useL1GtTriggerMenuLite(false)
static constexpr const char * l1tGlobalDecisionKeyword_
Abs< T >::type abs(const T &t)
static std::string const triggerResults
static void fillDescription(edm::ParameterSetDescription &desc, edm::InputTag const &iAlg, edm::InputTag const &iExt, bool readPrescalesFromFile)
int prescaleSet(const edm::Event &iEvent, const edm::EventSetup &iSetup)
bool checkLogicalExpression(std::string &)
check a logical expression for correctness - add/remove spaces if needed
bool rejectedByHLTPrescaler(const edm::TriggerResults &triggerResults, unsigned int i) const
static void fillDescription(edm::ParameterSetDescription &desc)
const std::string & processName() const
process name
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d'tor
std::unique_ptr< l1t::L1TGlobalUtil > l1tGlobalUtil_
std::vector< std::pair< std::string, double > > getL1PrescaleValueInDetail(const edm::Event &iEvent, const edm::EventSetup &iSetup, const std::string &trigger)
L1GtUtils const & l1GtUtils() const
Log< level::Warning, false > LogWarning
T convertL1PS(double val) const
static const bool useL1EventSetup(true)
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
static constexpr int kL1PrescaleDenominator_
bool isValid()
return true if the logical expression is syntactically correct
const std::vector< std::pair< std::string, int > > & errorCodes(const edm::Event &)