49 std::vector< std::string > v;
54 return *(
cgm().createChainGroup(v));
79 bool chainRESULT =
false;
80 if (chain.empty())
return chainRESULT;
82 if (fchain==
nullptr)
return chainRESULT;
101 if (PASSTHROUGH) {chainRESULT=
true;}
104 if (RAW && !PRESCALED) {chainRESULT=
true;}
106 if (RAW) {chainRESULT=
true;}
112 if ( (RAW && !PRESCALED) || PASSTHROUGH) {chainRESULT=
true;}
122 <<
" name = " << std::setw(35) << fchain->
getChainName()
123 <<
" result = " << chainRESULT);
131 if (item.empty())
return r;
132 if (item.find(
',')!=std::string::npos) {
134 if(
L1Result(thisItem,condition))
return true;
139 if (fitem==
nullptr) {
144 <<
" vetoed = " << fitem->
isVeto()
145 <<
" name = " << std::setw(35) << fitem->
name());
164 if (cchain==
nullptr){
165 ATH_MSG_WARNING(
" Lower chain name used by: " << name <<
" is not in the configuration ");
174 bool result =
HLTResult(chain.chain_name(),condition);
177 if (chain.has_l2() && chain.level()==
"EF") {
178 const std::string& nexttwo =
getLowerName(chain.chain_name());
179 result = result &&
HLTResult(nexttwo,condition);
182 }
else if (chain.level()==
"L2") {
185 }
else if (chain.level()==
"HLT" || chain.level()==
"EF"){
190 ATH_MSG_ERROR(
"Unknown chain level " << chain.level() <<
" cannot do 'enforceLogicalFlow'");
200 std::vector<bool> result;
204 result.push_back(
isPassed(*ch, condition) );
207 result.push_back(
L1Result(item->name(), condition) );
216 ATH_MSG_ERROR(
"Incorrect use of Express_passed bit. Please use isPassedBits() and test for TrigDefs::Express_passed in the returned bit-map.");
227 unsigned int chainRESULT = 0;
228 if (chain.empty())
return chainRESULT;
230 if (fchain==
nullptr)
return chainRESULT;
251 if (item.empty())
return r;
252 if (item.find(
',')!=std::string::npos) {
259 if (fitem==
nullptr)
return r;
271 if (navRHK && !navRHK->
empty()) {
275 if (expressTerminusNode) {
281 std::vector<unsigned int> all;
286 unsigned int RESULT =
HLTBits(ch->chain_name(), ch->level(), passExpress);
288 if (ch->has_l2() && ch->level()==
"EF") {
289 const std::string& nexttwo =
getLowerName(ch->chain_name());
290 RESULT = RESULT |
HLTBits(nexttwo,
"L2", passExpress);
293 }
else if (ch->level()==
"L2") {
296 }
else if (ch->level()==
"HLT" || ch->level()==
"EF") {
300 ATH_MSG_ERROR(
"Unknown chain level " << ch->level() <<
" cannot look at lower level results to compute isPassedBitsForEach");
303 all.push_back(RESULT);
307 all.push_back(
L1Bits(item->name()) );
316 unsigned int result = 0;
317 for (
unsigned int r : all) {
327 if (fchain==
nullptr)
continue;
329 errorCode = errorCode > ec ? errorCode : ec;
335 if (chain==
"")
return 0.;
339 ATH_MSG_WARNING(
"Configuration for the chain: " << chain <<
" not known");
340 return std::numeric_limits<float>::quiet_NaN();
342 float chainRESULT = fchain->
prescale();
352 if( (item ==
"L1_MU20,L1_MU21") || (item ==
"L1_MU21,L1_MU20") )
return true;
357 if( (item ==
"L1_MU20,L1_MU21") || (item ==
"L1_MU21,L1_MU20") ) {
359 auto l1mu20 =
cgm().config_item(
"L1_MU20");
360 if (l1mu20==
nullptr) {
362 return std::numeric_limits<float>::quiet_NaN();
364 float l1mu20ps =
cgm().item_prescale(l1mu20->ctpId());
366 auto l1mu21 =
cgm().config_item(
"L1_MU21");
367 if (l1mu21==
nullptr) {
369 return std::numeric_limits<float>::quiet_NaN();
371 float l1mu21ps =
cgm().item_prescale(l1mu21->ctpId());
373 if( (l1mu20ps < 1.0) && (l1mu21ps < 1.0) )
return 0.0;
374 if( (l1mu20ps < 1.0) )
return l1mu21ps;
375 if( (l1mu21ps < 1.0) )
return l1mu20ps;
376 if(l1mu20ps == 1.0)
return 1.0;
383 if (item.empty())
return 0;
385 if(item.find(
',')==std::string::npos) {
387 if (fitem==
nullptr) {
388 ATH_MSG_WARNING(
"Configuration for the item: " << item <<
" not known");
389 return std::numeric_limits<float>::quiet_NaN();
393 float itemprescale =
cgm().item_prescale(fitem->
ctpId());
394 if ( itemprescale < 1) itemprescale = 0;
403 if (fitem==
nullptr) {
404 ATH_MSG_WARNING(
"Configuration for the item: " << item <<
" not known");
405 return std::numeric_limits<float>::quiet_NaN();
407 float itemprescale =
cgm().item_prescale(fitem->
ctpId());
408 if ( itemprescale < 1) itemprescale = 0;
409 minprescale = (minprescale&&(minprescale<itemprescale)?minprescale:itemprescale);
427 const std::string& hltChainName = ch->chain_name();
428 float chainRESULT =
HLTPrescale(hltChainName,condition);
432 if (ch->has_l2() && ch->level()==
"EF") {
433 const std::string& hltChainNameL2 =
getLowerName(hltChainName);
434 const std::string& l1ItemName =
getLowerName(hltChainNameL2);
435 chainRESULT *=
HLTPrescale(hltChainNameL2,condition);
436 chainRESULT *=
L1Prescale(l1ItemName,condition);
437 if(l1ItemName.find(
',')!=std::string::npos) singleTrigger=
false;
439 }
else if (ch->level()==
"L2") {
440 const std::string& l1ItemName =
getLowerName(hltChainName);
441 chainRESULT *=
L1Prescale(l1ItemName,condition);
442 if(l1ItemName.find(
',')!=std::string::npos) singleTrigger=
false;
444 }
else if (ch->level()==
"HLT" || ch->level()==
"EF") {
445 const std::string& l1ItemName =
getLowerName(hltChainName);
446 chainRESULT *=
L1Prescale(l1ItemName,condition);
447 if(l1ItemName.find(
',')!=std::string::npos and !
isCorrelatedL1items(l1ItemName) ) singleTrigger=
false;
451 if (singleTrigger)
return chainRESULT;
453 const bool UNPRESCALED = (fabs(chainRESULT-1.0)<1e-5);
455 if (UNPRESCALED)
return 1.0;
460 const std::string& l1ItemName = item->name();
461 const float itemRESULT =
L1Prescale(l1ItemName, condition);
462 if(l1ItemName.find(
',')!=std::string::npos) singleTrigger=
false;
464 if (singleTrigger)
return itemRESULT;
466 const bool UNPRESCALED = (itemRESULT==1);
468 if (UNPRESCALED)
return 1.0;
481 std::set< std::string > streams;
484 streams.insert(s->stream());
487 return {streams.begin(), streams.end()};
500 v.assign( ch->groups().begin(), ch->groups().end() );
510 std::set< std::string > sig;
513 sig.insert(s->label());
516 return {sig.begin(), sig.end()};
528 std::stack<const TrigConf::TriggerItemNode*> nodes;
532 nodes.push( item->topNode() );
533 while (!nodes.empty()) {
534 node = nodes.top(); nodes.pop();
537 if (
node->isThreshold()) {
538 if (
node->triggerThreshold()) {
540 if (!
node->triggerThreshold()->
name().empty())
541 s.insert(
node->triggerThreshold()->
name());
542 }
else if (!
node->thresholdName().empty()) {
544 s.insert(
node->thresholdName());
548 nodes.push(childnode);
555 return {s.begin(), s.end()};
565 std::set< std::vector< std::string > > tes;
566 std::vector< std::string > t;
572 t.push_back( te->name());
577 return {tes.begin(), tes.end()};
587 std::set< std::vector< TrigConf::HLTTriggerElement* > > tes;
591 tes.insert(s->outputTEs());
594 return {tes.begin(), tes.end()};
608 if (!(confChains && confItems) )
return;
614 std::regex compiled(pat);
617 if ( std::regex_match(ch->chain_name().c_str(), compiled) ) {
623 if ( std::regex_match(item->name().c_str(), compiled) ) {
633 bool found_it =
false;
636 if (ch->chain_name() == what) {
648 if (item->name() == what) {
659 ATH_MSG_WARNING(
"Explicitly requested '" << what <<
"' be added to a ChainGroup"
660 <<
" but this item or chain could not be found in the menu");
678 using namespace Trig;
680 bool allActive(
const std::vector<TriggerElement*>& tes) {
682 if (te->getActiveState() ==
false)
699 if ( previous_sig && previous_sig->
outputTEs().size() != sig->outputTEs().size() )
703 std::vector<std::vector<HLT::TriggerElement*> > tes(sig->outputTEs().size());
714 while (combination.
isValid()) {
718 if (!
allActive(*combination) || last_step) {
732const Trig::FeatureContainer
746 std::vector< std::vector< HLT::TriggerElement*> > tes;
747 std::vector< std::vector< HLT::TriggerElement*> >::iterator tesit;
751 std::set< std::string > threshold_names;
752 std::stack<const TrigConf::TriggerItemNode*> nodes;
754 nodes.push( item->topNode() );
757 while (!nodes.empty()) {
762 if (
node->isThreshold()) {
763 if (
node->triggerThreshold()) {
765 if (!
node->triggerThreshold()->
name().empty())
766 threshold_names.insert(
node->triggerThreshold()->
name());
767 }
else if (!
node->thresholdName().empty()) {
769 threshold_names.insert(
node->thresholdName());
773 nodes.push(childnode);
779 tes.resize(threshold_names.size());
781 std::set< std::string >::iterator setstrit;
783 for (setstrit = threshold_names.begin(); setstrit != threshold_names.end(); ++setstrit, ++tesit) {
790 ATH_MSG_DEBUG(
"features: features container size: "<< f.getCombinations().size());
802 while (combination.
isValid()) {
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_ERROR(x,...)
#define ATH_MSG_WARNING(x,...)
#define ATH_MSG_VERBOSE(x,...)
size_t size() const
Number of registered mappings.
Helpers for treating a class enum as a bitmask.
This class represents one chain of signatures, i.e.
const TrigConf::HLTChain * getConfigChain() const
get underlying ConfigChain
HLT::ErrorCode getErrorCode() const
return this Chain's most severe error code (from execution)
unsigned int getChainCounter() const
return the unique identifier of this Chain (uint)
int getChainStep() const
return the current step of execution
bool isPassedThrough() const
is chain passed through ?
bool isPrescaled() const
is chain prescaled ?
const std::string & getChainName() const
return the Chain name (string)
bool isResurrected() const
is chain resurrected ?
bool chainPassedRaw() const
Iterator used to loop over multi-particle combinations.
bool isValid() const
Validity check for the iterator.
The definition of error codes in HLT.
TrigCompositeUtils::DecisionID numeric() const
numeric ID
void getAllOfType(const te_id_type id, std::vector< TriggerElement * > &output, const bool activeOnly=true) const
The query returning a collection of all TriggerElements if name is given.
TriggerElement is the basic ingreedient of the interface between HLT algorithms and the navigation It...
bool isPassedAfterPrescale() const
bool isPassedBeforePrescale() const
const std::string & name() const
bool isPassedAfterVeto() const
Property holding a SG store/key/clid from which a ReadHandle is made.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
bool empty() const
Test if the key is blank.
list of all HLT chains in a trigger menu
HLT chain configuration information.
const std::string & lower_chain_name() const
const std::string & level() const
HLT signature configuration information.
std::vector< HLTTriggerElement * > & outputTEs()
accessor to the list of trigger elements
HLT stream configuration information.
HLT trigger element configuration information.
static HLTHash string2hash(std::string_view, const std::string &category=s_defaultCategory)
hash function translating TE names into identifiers
bool assert_decision() const
checks if new event arrived with the decision Need to use before any call to CacheGlobalMemory.
const HLT::TrigNavStructure * navigation() const
float correlatedL1Prescale(const std::string &item) const
const std::vector< std::string > & patterns() const
std::vector< std::string > getListOfStreams() const
std::vector< std::string > getListOfThresholds() const
const Trig::CacheGlobalMemory & cgm() const
const FeatureContainer features(unsigned int condition=TrigDefs::Physics) const
returns all features related to given chain group of HLT chains or L1 items Note: This does not yet w...
std::vector< std::string > getListOfGroups() const
HLT::ErrorCode error() const
returns most severe error in the chains composing that chain group for L1 it is just OK If there is s...
unsigned int isPassedBits() const
returns bits (OR ed) of the chain group Meaning of the returned bits can be understood by using masks...
std::vector< bool > isPassedForEach(unsigned int condition=TrigDefs::Physics) const
return vector with isPassed decision for each chain
bool isCorrelatedL1items(const std::string &item) const
ChainGroup(const std::vector< std::string > &triggerNames, Trig::CacheGlobalMemory &parent)
void addAlias(const std::string &alias)
adds alias (sort understandabel name) to the group
std::vector< std::string > m_names
names of trigger derived from patterns & current configuration
void update(const TrigConf::HLTChainList *confChains, const TrigConf::ItemContainer *confItems, TrigDefs::Group prop=TrigDefs::Group::Default)
float HLTPrescale(const std::string &chain, unsigned int condition) const
float getPrescale(unsigned int condition=TrigDefs::Physics) const
returns prescale factor for chain group with single chain in returns real prescale factor for real ch...
const Trig::ChainGroup & operator+(const Trig::ChainGroup &rhs)
bool L1Result(const std::string &item, unsigned int condition) const
unsigned int L1Bits(const std::string &item) const
bool operator!=(const Trig::ChainGroup &rhs)
float calculatePrescale(unsigned int condition=TrigDefs::Physics)
std::vector< const TrigConf::HLTChain * > m_confChains
unsigned int HLTBits(const std::string &chain, const std::string &level, const TrigCompositeUtils::DecisionIDContainer &passExpress) const
const std::vector< std::string > & names() const
names of triggers within chain group
std::vector< std::vector< std::string > > getListOfTriggerElements() const
std::vector< std::string > m_patterns
patterns with which the CG was constructed
bool isPassed(unsigned int condition=TrigDefs::Physics) const
tells if chain group passed
Trig::CacheGlobalMemory & m_cgm
void appendFeatures(std::vector< std::vector< HLT::TriggerElement * > > &tes, FeatureContainer &fc) const
float L1Prescale(const std::string &item, unsigned int condition) const
std::vector< unsigned int > isPassedBitsForEach() const
return result of isPassedBits for each chain in the group
const Trig::CacheGlobalMemory & cgm_assert() const
bool operator==(const Trig::ChainGroup &rhs)
std::vector< std::string > getListOfSignatures() const
std::string getLowerName(const std::string &EFname) const
std::vector< std::vector< TrigConf::HLTTriggerElement * > > getHLTTriggerElements() const
bool HLTResult(const std::string &chain, unsigned int condition) const
std::vector< const TrigConf::TriggerItem * > m_confItems
std::vector< std::string > getListOfTriggers() const
is a connector between chains and object It store single combination of trigger elements.
void addWithChecking(const Combination &newComb)
add new combination to the container checking for overlap
static asg::AsgTool *s_logger ATLAS_THREAD_SAFE
void name(const std::string &n)
std::vector< std::string > patterns
void collectCombinations(const TrigConf::HLTChain *conf, const CacheGlobalMemory &cgm, FeatureContainer &fc, unsigned int condition)
bool allActive(const std::vector< TriggerElement * > &tes)
constexpr std::enable_if_t< is_bitmask_v< E >, bool > test(E lhs, E rhs)
Convenience function to test bits in a class enum bitmask.
It used to be useful piece of code for replacing actual SG with other store of similar functionality ...
static const ErrorCode OK(Action::CONTINUE)
xAOD::TrigComposite Decision
const Decision * getExpressTerminusNode(const DecisionContainer &container)
Returns the express-accept navigation node from a collection or nullptr if missing.
std::set< DecisionID > DecisionIDContainer
void decisionIDs(const Decision *d, DecisionIDContainer &destination)
Extracts DecisionIDs stored in the Decision object.
boost::multi_index::multi_index_container< TriggerItem *, boost::multi_index::indexed_by< boost::multi_index::random_access<>, boost::multi_index::ordered_unique< boost::multi_index::identity< TriggerItem > >, boost::multi_index::ordered_unique< boost::multi_index::tag< tag_ctpid >, boost::multi_index::const_mem_fun< TriggerItem, int, &TriggerItem::ctpId > >, boost::multi_index::hashed_unique< boost::multi_index::tag< tag_name_hash >, boost::multi_index::const_mem_fun< TrigConfData, const std::string &, &TrigConfData::name > > > > ItemContainer
static const unsigned int L1_isPassedBeforePrescale
static const unsigned int L1_isPassedAfterPrescale
static const unsigned int L2_passedRaw
static const unsigned int allowResurrectedDecision
static const unsigned int requireDecision
static const unsigned int L2_passThrough
static const unsigned int EF_prescaled
static const unsigned int L2_prescaled
Group
Properties of a chain group.
@ NoRegex
Do not use regular expressions.
static const unsigned int EF_passedRaw
static const unsigned int L1_isPassedAfterVeto
static const unsigned int Express_passed
static const unsigned int Physics
static const unsigned int enforceLogicalFlow
static const unsigned int EF_resurrected
static const unsigned int L2_resurrected
static const unsigned int EF_passThrough
static const unsigned int passedThrough
static const unsigned int eventAccepted
The common trigger namespace for trigger analysis tools.
std::vector< std::string > convertStringToVector(std::string_view triggerNames)
makes a split of list of chains into the vector of chains
std::vector< std::string > keyWrap(const std::vector< std::string > &triggerNames)
normalizes the list of triggers (patterns) by sorting and uniquing them