19 static const unsigned char countMax(2);
40 }
else if (l1tType == 2) {
44 edm::LogError(
"HLTPrescaleProvider") <<
" Unknown L1T Type " << l1tType <<
" - prescales will not be avaiable!";
62 throw cms::Exception(
"LogicError") <<
"HLTPrescaleProvider::prescaleSet,\n"
63 "HLTPrescaleProvider::init was not called at beginRun\n";
75 assert(psfsiTech == psfsiPhys);
76 if ((errorTech == 0) && (errorPhys == 0) && (psfsiTech >= 0) && (psfsiPhys >= 0) && (psfsiTech == psfsiPhys)) {
84 <<
" Error in determining HLT prescale set index from L1 data using L1GtUtils:"
85 <<
" Tech/Phys error = " << errorTech <<
"/" << errorPhys <<
" Tech/Phys psfsi = " << psfsiTech <<
"/"
90 }
else if (l1tType == 2) {
99 <<
" Unknown L1T Type " << l1tType <<
" - can not determine prescale set index!";
107 int numer =
static_cast<int>(
val * kL1PrescaleDenominator_ + 0.5);
108 static constexpr
double kL1RoundingEpsilon = 0.001;
109 if (
std::abs(numer -
val * kL1PrescaleDenominator_) > kL1RoundingEpsilon) {
111 <<
"does not appear to precisely expressable as int / " << kL1PrescaleDenominator_
112 <<
", using a FractionalPrescale is a loss of precision";
115 return {numer, kL1PrescaleDenominator_};
130 if (nL1GTSeedModules == 0) {
133 }
else if (nL1GTSeedModules == 1) {
137 result =
l1GtUtils_->prescaleFactor(iEvent, l1tname, l1error);
142 <<
" Error in determining L1T prescale for HLT path: '" << trigger <<
"' with L1T seed: '" << l1tname
143 <<
"' using L1GtUtils: error code = " << l1error <<
"." << std::endl
144 <<
" Note: for this method ('prescaleValues'), only a single L1T name (and not a bit number) is allowed "
147 <<
" For seeds being complex logical expressions, try the new method 'prescaleValuesInDetail'."
157 for (
unsigned int i = 1;
i != nL1GTSeedModules; ++
i) {
161 <<
" Error in determining L1T prescale for HLT path: '" << trigger <<
"' has multiple L1GTSeed modules, "
162 << nL1GTSeedModules <<
", with L1 seeds: " <<
dump
163 <<
". (Note: at most one L1GTSeed module is allowed for a proper determination of the L1T prescale!)";
167 }
else if (l1tType == 2) {
170 if (nL1TSeedModules == 0) {
173 }
else if (nL1TSeedModules == 1) {
176 bool l1error(!
l1tGlobalUtil_->getPrescaleByName(l1tname, result));
181 <<
" Error in determining L1T prescale for HLT path: '" << trigger <<
"' with L1T seed: '" << l1tname
182 <<
"' using L1TGlobalUtil: error cond = " << l1error <<
"." << std::endl
183 <<
" Note: for this method ('prescaleValues'), only a single L1T name (and not a bit number) is allowed "
186 <<
" For seeds being complex logical expressions, try the new method 'prescaleValuesInDetail'."
196 for (
unsigned int i = 1;
i != nL1TSeedModules; ++
i) {
200 <<
" Error in determining L1T prescale for HLT path: '" << trigger <<
"' has multiple L1TSeed modules, "
201 << nL1TSeedModules <<
", with L1T seeds: " <<
dump
202 <<
". (Note: at most one L1TSeed module is allowed for a proper determination of the L1T prescale!)";
209 edm::LogError(
"HLTPrescaleProvider") <<
" Unknown L1T Type " << l1tType <<
" - can not determine L1T prescale! ";
219 std::vector<std::pair<std::string, double> >
result;
226 if (nL1GTSeedModules == 0) {
229 }
else if (nL1GTSeedModules == 1) {
233 l1Logical.logicalExpressionRunUpdate(iEvent.
getRun(), iSetup, l1tname);
234 const std::vector<std::pair<std::string, int> >& errorCodes(l1Logical.errorCodes(iEvent));
235 auto resultInt = l1Logical.prescaleFactors();
237 for (
const auto&
entry : resultInt) {
238 result.push_back(
entry);
241 int l1error(l1Logical.isValid() ? 0 : 1);
242 for (
auto const& errorCode : errorCodes) {
243 l1error +=
std::abs(errorCode.second);
248 std::ostringstream message;
249 message <<
" Error in determining L1T prescales for HLT path: '" << trigger <<
"' with complex L1T seed: '"
250 << l1tname <<
"' using L1GtUtils: " << std::endl
251 <<
" isValid=" << l1Logical.isValid() <<
" l1tname/error/prescale " << errorCodes.size() << std::endl;
252 for (
unsigned int i = 0;
i < errorCodes.size(); ++
i) {
253 message <<
" " <<
i <<
":" << errorCodes[
i].first <<
"/" << errorCodes[
i].second <<
"/" << result[
i].second;
265 for (
unsigned int i = 1;
i != nL1GTSeedModules; ++
i) {
269 <<
" Error in determining L1T prescale for HLT path: '" << trigger <<
"' has multiple L1GTSeed modules, "
270 << nL1GTSeedModules <<
", with L1 seeds: " <<
dump
271 <<
". (Note: at most one L1GTSeed module is allowed for a proper determination of the L1T prescale!)";
275 }
else if (l1tType == 2) {
278 if (nL1TSeedModules == 0) {
281 }
else if (nL1TSeedModules == 1) {
285 const std::vector<GlobalLogicParser::OperandToken> l1tSeeds = l1tGlobalLogicParser.expressionSeedsOperandList();
287 double l1tPrescale(-1);
288 for (
auto const&
i : l1tSeeds) {
289 const string& l1tSeed =
i.tokenName;
293 result.push_back(std::pair<std::string, double>(l1tSeed, l1tPrescale));
298 string l1name = l1tname;
299 std::ostringstream message;
300 message <<
" Error in determining L1T prescales for HLT path: '" << trigger <<
"' with complex L1T seed: '"
301 << l1tname <<
"' using L1TGlobalUtil: " << std::endl
302 <<
" isValid=" << l1tGlobalLogicParser.checkLogicalExpression(l1name) <<
" l1tname/error/prescale "
303 << l1tSeeds.size() << std::endl;
304 for (
unsigned int i = 0;
i < l1tSeeds.size(); ++
i) {
305 const string& l1tSeed = l1tSeeds[
i].tokenName;
306 message <<
" " <<
i <<
":" << l1tSeed <<
"/" <<
l1tGlobalUtil_->getPrescaleByName(l1tSeed, l1tPrescale)
307 <<
"/" << result[
i].second;
319 for (
unsigned int i = 1;
i != nL1TSeedModules; ++
i) {
323 <<
" Error in determining L1T prescale for HLT path: '" << trigger <<
"' has multiple L1TSeed modules, "
324 << nL1TSeedModules <<
", with L1T seeds: " <<
dump
325 <<
". (Note: at most one L1TSeed module is allowed for a proper determination of the L1T prescale!)";
332 edm::LogError(
"HLTPrescaleProvider") <<
" Unknown L1T Type " << l1tType <<
" - can not determine L1T prescale! ";
346 throw cms::Exception(
"Configuration") <<
"HLTPrescaleProvider::checkL1GtUtils(),\n"
347 "Attempt to use L1GtUtils object when none was constructed.\n"
348 "Possibly the proper era is not configured or\n"
349 "the module configuration does not use the era properly\n"
350 "or input is from mixed eras";
356 throw cms::Exception(
"Configuration") <<
"HLTPrescaleProvider:::checkL1TGlobalUtil(),\n"
357 "Attempt to use L1TGlobalUtil object when none was constructed.\n"
358 "Possibly the proper era is not configured or\n"
359 "the module configuration does not use the era properly\n"
360 "or input is from mixed eras";
368 const int set(prescaleSet(
iEvent, iSetup));
369 return set < 0 ? 1 : hltConfigProvider_.prescaleValue<
unsigned int>(
static_cast<unsigned int>(set), trigger);
HLTConfigProvider hltConfigProvider_
const std::string moduleType(const std::string &module) const
C++ class name of module.
unsigned int l1tType() const
L1T type (0=unknown, 1=legacy/stage-1 or 2=stage-2)
const std::vector< std::vector< std::string > > & hltL1TSeeds() const
std::unique_ptr< L1GtUtils > l1GtUtils_
Run const & getRun() const
Log< level::Error, false > LogError
double getL1PrescaleValue(const edm::Event &iEvent, const edm::EventSetup &iSetup, const std::string &trigger)
const std::string & moduleLabel(unsigned int trigger, unsigned int module) const
void checkL1GtUtils() const
static const unsigned char countMax(2)
boost::rational< int > FractionalPrescale
static const bool useL1GtTriggerMenuLite(false)
unsigned int index(const unsigned int i) const
Get index (slot position) of module giving the decision of the ith path.
Abs< T >::type abs(const T &t)
static std::string const triggerResults
void checkL1TGlobalUtil() const
bool rejectedByHLTPrescaler(const edm::TriggerResults &triggerResults, unsigned int i) const
const std::string & processName() const
process name
int prescaleSet(const edm::Event &iEvent, const edm::EventSetup &iSetup)
const std::vector< std::vector< std::pair< bool, std::string > > > & hltL1GTSeeds() const
l1t::L1TGlobalUtil const & l1tGlobalUtil() const
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)
Log< level::Warning, false > LogWarning
L1GtUtils const & l1GtUtils() const
static const bool useL1EventSetup(true)
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
tuple dump
OutputFilePath = cms.string('/tmp/zhokin/'), OutputFileExt = cms.string(''),.