 |
ATLAS Offline Software
|
Go to the documentation of this file.
5 #ifndef TrigCompositeUtils_TrigCompositeUtils_h
6 #define TrigCompositeUtils_TrigCompositeUtils_h
12 #include "AthLinks/ElementLink.h"
22 #ifdef XAOD_STANDALONE
40 #define TRIGCOMPUTILS_ENABLE_EARLY_EXIT 1
353 const EventContext& ctx,
354 const std::string& summaryCollectionKey,
356 const std::set<std::string>& keysToIgnore = std::set<std::string>());
371 const bool enforceDecisionOnStartNode =
true);
383 std::set<const Decision*>& fullyExploredFrom,
385 const bool enforceDecisionOnNode);
396 const bool keepOnlyFinalFeatures,
397 const bool removeEmptySteps,
398 const std::vector<std::string>& nodesToDrop);
408 std::set<NavGraphNode*>& fullyExploredFrom,
409 const bool keepOnlyFinalFeatures,
410 const bool removeEmptySteps,
411 const std::vector<std::string>& nodesToDrop);
439 template<
class CONTAINER>
453 template<
class CONTAINER>
456 const std::string& containerSGKey =
"",
457 const unsigned int behaviour = TrigDefs::lastFeatureOfType,
468 template<
class CONTAINER>
471 std::set<const NavGraphNode*>& fullyExploredFrom,
473 const std::string& containerSGKey,
474 const unsigned int behaviour,
475 const std::string& navElementLinkKey,
489 const std::string& linkName,
490 const bool suppressMultipleLinksWarning =
false);
507 const std::string& linkName,
509 unsigned int behaviour = TrigDefs::allFeaturesOfType,
510 std::set<const xAOD::TrigComposite*>* fullyExploredFrom =
nullptr);
524 std::vector<LinkInfo<T>>
526 const std::string& linkName,
527 unsigned int behaviour = TrigDefs::allFeaturesOfType);
543 const std::string& linkName,
548 const bool suppressMultipleLinksWarning =
false);
555 const std::string& linkName,
560 const bool suppressMultipleLinksWarning =
false);
578 const std::string& linkName,
579 std::vector<sgkey_t>& keyVec,
580 std::vector<uint32_t>& clidVec,
581 std::vector<Decision::index_type>& indexVec,
582 std::vector<const Decision*>& sourceVec,
583 const unsigned int behaviour = TrigDefs::allFeaturesOfType,
584 std::set<const Decision*>* fullyExploredFrom =
nullptr);
590 const std::string& linkName,
591 std::vector<sgkey_t>&
key,
592 std::vector<uint32_t>& clid,
593 std::vector<Decision::index_type>&
index,
594 std::vector<const Decision*>& sourceVec,
595 const unsigned int behaviour = TrigDefs::allFeaturesOfType,
596 std::set<const Decision*>* fullyExploredFrom =
nullptr);
603 const std::string& linkName,
604 std::vector<sgkey_t>& keyVec,
605 std::vector<uint32_t>& clidVec,
606 std::vector<Decision::index_type>& indexVec,
607 std::vector<const Decision*>& sourceVec);
625 const std::vector<std::size_t>& legMultiplicities,
644 const std::vector<std::size_t>& legMultiplicities,
693 std::string
dump(
const Decision* tc,
const std::function< std::string(
const Decision* )>& printerFnc );
699 #endif // TrigCompositeUtils_TrigCompositeUtils_h
const std::string & featureString()
Combinations buildCombinations(const std::string &chainName, const std::vector< LinkInfo< xAOD::IParticleContainer >> &features, const std::vector< std::size_t > &legMultiplicities, const std::function< bool(const std::vector< LinkInfo< xAOD::IParticleContainer >> &)> &filter)
Produce the combinations for a set of features.
const Decision * find(const Decision *start, const std::function< bool(const Decision *)> &filter)
traverses Decision object links for another Decision object fulfilling the prerequisite specified by ...
SG::WriteHandle< CONT > createAndStoreWithAux(const SG::WriteHandleKey< CONT > &key, const EventContext &ctx)
Creates and right away records the Container CONT with the key.
Prerequisite object usable with.
bool passed(DecisionID id, const DecisionIDContainer &idSet)
checks if required decision ID is in the set of IDs in the container
void recursiveGetDecisions(const Decision *start, NavGraph &navGraph, const DecisionIDContainer &ids, const bool enforceDecisionOnStartNode)
Search back in time from "node" and locate all paths back through Decision objects for a given chain.
bool operator()(const Decision *) const
checks if the arg Decision object has link collection of name specified at construction
Decision * newDecisionIn(DecisionContainer *dc, const std::string &name)
Helper method to create a Decision object, place it in the container and return a pointer to it.
const std::string & summaryFilterNodeName()
@ UniqueObjects
Do not allow any repeated objects.
const std::string & summaryPassExpressNodeName()
void addDecisionID(DecisionID id, Decision *d)
Appends the decision (given as ID) to the decision object.
const std::string & summaryPassNodeName()
HasObject(const std::string &name)
constructor specifying the link name
static const std::string s_featureString
Constant used to identify a feature.
bool typelessFindLinksCommonLinkCollection(const Decision *start, const std::string &linkName, std::vector< sgkey_t > &keyVec, std::vector< uint32_t > &clidVec, std::vector< Decision::index_type > &indexVec, std::vector< const Decision * > &sourceVec)
Common functionality shared by both typelessFindLinks interfaces Returns true if at least one link wa...
void insertDecisionIDs(const Decision *src, Decision *dest)
Appends the decision IDs of src to the dest decision object.
DecisionIDContainer passedDecisionIDs(const Decision *d, const T &required)
return DecisionIDs in Decision object that match the required ones
void recursiveGetFeaturesOfTypeInternal(std::vector< LinkInfo< CONTAINER > > &features, std::set< const NavGraphNode * > &fullyExploredFrom, const NavGraphNode *navGraphNode, const std::string &containerSGKey, const unsigned int behaviour, const std::string &navElementLinkKey, const DecisionIDContainer &chainIDs)
Internal implimentation called by recursiveGetFeaturesOfType, and by itself.
void findLinks(const Decision *start, const std::string &linkName, std::vector< LinkInfo< T >> &links, unsigned int behaviour=TrigDefs::allFeaturesOfType, std::set< const xAOD::TrigComposite * > *fullyExploredFrom=nullptr)
search back the TC links for the object of type T linked to the one of TC (recursively) Populates pro...
const std::string & comboHypoAlgNodeName()
static const std::string s_seedString
Constant used to identify a seed (parent)
static const std::string s_initialRoIString
Constant used to identify an initial ROI from L1.
void recursiveFlagForThinningInternal(NavGraphNode *node, bool modeKeep, std::set< NavGraphNode * > &fullyExploredFrom, const bool keepOnlyFinalFeatures, const bool removeEmptySteps, const std::vector< std::string > &nodesToDrop)
Used by recursiveFlagForThinning.
bool const RAWDATA *ch2 const
HLT chain configuration information.
std::pair< std::string, int32_t > getNameAndIndexFromLeg(const std::string &name)
Extract the name and numeric index of a leg identifier.
SG::WriteHandle< DecisionContainer > createAndStore(const SG::WriteHandleKey< DecisionContainer > &key, const EventContext &ctx)
Creates and right away records the DecisionContainer with the key.
const std::string & roiString()
void filterLinkVectorByContainerKey(const std::string &containerSGKey, std::vector< ElementLink< CONTAINER >> &vector)
Removes ElementLinks from the supplied vector if they do not come from the specified collection (sub-...
static const std::string s_hypoAlgNodeNameString
Constant used to identify a navigation graph node as being from a Hypo Alg.
static const std::string s_summaryPassNodeNameString
Constant used to identify the single terminus graph node the end point of all chains which accept the...
const Decision * getTerminusNode(SG::ReadHandle< DecisionContainer > &container)
Prerequisite object usable with.
The Athena Transient Store API.
const std::string & filterNodeName()
const std::string & initialRecRoIString()
It used to be useful piece of code for replacing actual SG with other store of similar functionality ...
static const std::string s_comboHypoAlgNodeNameString
Constant used to identify a navigation graph node as being from a Combo Hypo Alg.
const std::vector< ElementLink< DecisionContainer > > getLinkToPrevious(const Decision *d)
returns links to previous decision object 'seed'
bool typelessFindLinks(const Decision *start, const std::string &linkName, std::vector< sgkey_t > &keyVec, std::vector< uint32_t > &clidVec, std::vector< Decision::index_type > &indexVec, std::vector< const Decision * > &sourceVec, const unsigned int behaviour, std::set< const Decision * > *fullyExploredFrom)
search back the TC links for the object of type T linked to the one of TC (recursively) Returns the l...
const Decision * getExpressTerminusNode(const DecisionContainer &container)
Returns the express-accept navigation node from a collection or nullptr if missing.
static const std::string s_filterNodeNameString
Constant used to identify a navigation graph node as being from a Filter.
bool copyLinks(const Decision *src, Decision *dest)
copy all links from src to dest TC objects
SG::WriteHandle< CONT > createAndStoreNoAux(const SG::WriteHandleKey< CONT > &key, const EventContext &ctx)
Creates and right away records the Container CONT with the key.
static const std::string s_summaryFilterNodeNameString
Constant used to identify a navigation graph node as being from a final Filter created by the Decisio...
Structure to hold a transient Directed Acyclic Graph (DAG) structure. NavGraph is populated from,...
Class used to describe composite objects in the HLT.
const std::string & initialRoIString()
const std::string & summaryPrescaledNodeName()
const std::string & hltSeedingNodeName()
static const std::string s_hltSeedingNodeNameString
Constant used to identify a navigation graph node as being from the HLTSeeding.
ElementLink implementation for ROOT usage.
const std::vector< LinkInfo< CONTAINER > > recursiveGetFeaturesOfType(const NavGraph &navGraph, const std::string &containerSGKey="", const unsigned int behaviour=TrigDefs::lastFeatureOfType, const std::string &navElementLinkKey=featureString(), const DecisionIDContainer &chainIDs=DecisionIDContainer())
Extract features from the supplied linkVector (obtained through recursiveGetDecisions).
bool isChainId(const HLT::Identifier &chainIdentifier)
Recognise whether the HLT identifier corresponds to a whole chain.
xAOD::TrigComposite Decision
static const std::string s_initialRecRoIString
Constant used to identify an initial HLT ROI derived from L1.
const std::string & viewString()
uint32_t sgkey_t
Type used for hashed StoreGate key+CLID pairs.
const std::string & seedString()
HLT::Identifier createLegName(const HLT::Identifier &chainIdentifier, size_t counter)
Generate the HLT::Identifier which corresponds to a specific leg of a given chain.
HasObjectCollection(const std::string &name)
constructor specifying the link name
bool hasLinkToPrevious(const Decision *d)
checks if there is at least one 'seed' link to previous object
std::vector< const Decision * > getRejectedDecisionNodes([[maybe_unused]] const asg::EventStoreType *eventStore, const EventContext &ctx, const std::string &summaryCollectionKey, const DecisionIDContainer &ids, const std::set< std::string > &keysToIgnore)
void linkToPrevious(Decision *d, const std::string &previousCollectionKey, size_t previousIndex)
Links to the previous object, location of previous 'seed' decision supplied by hand.
bool isLegId(const HLT::Identifier &legIdentifier)
Recognise whether the chain ID is a leg ID.
Helper to keep a Decision object, ElementLink and ActiveState (with respect to some requested ChainGr...
Define the type used for hashed StoreGate key+CLID pairs.
int32_t getIndexFromLeg(const HLT::Identifier &legIdentifier)
Extract the numeric index of a leg identifier.
std::set< DecisionID > DecisionIDContainer
Transient utility class to represent a node in a graph (m_decisionObject), and a vector of edges (m_f...
LinkInfo< T > findLink(const Decision *start, const std::string &linkName, const bool suppressMultipleLinksWarning=false)
Perform a recursive search for ElementLinks of type T and name 'linkName', starting from Decision obj...
const std::string & hypoAlgNodeName()
bool allFailed(const Decision *d)
return true if there is no positive decision stored
void decisionIDs(const Decision *d, DecisionIDContainer &destination)
Extracts DecisionIDs stored in the Decision object.
void recursiveFlagForThinning(NavGraph &graph, const bool keepOnlyFinalFeatures, const bool removeEmptySteps, const std::vector< std::string > &nodesToDrop)
Used by trigger navigation thinning.
std::string dump(const Decision *tc, const std::function< std::string(const Decision *)> &printerFnc)
Prints the Decision object including the linked seeds @warnign expensive call.
static const std::string s_viewString
Constant used to identify a view.
const Decision * getNodeByName(const DecisionContainer &container, const std::string &nodeName)
Returns the navigation node with a given name from a collection or nullptr if missing.
HLT::Identifier getIDFromLeg(const HLT::Identifier &legIdentifier)
Generate the HLT::Identifier which corresponds to the chain name from the leg name.
static const std::string s_inputMakerNodeNameString
Constant used to identify a navigation graph node as being from a Input Maker.
static const std::string s_summaryPrescaledNodeNameString
Constant used to identify the single prescaled graph node.
void uniqueDecisionIDs(Decision *dest)
Make unique list of decision IDs of dest Decision object.
static const std::string s_summaryPassExpressNodeNameString
Constant used to identify the single express-accept graph node.
decltype(auto) operator()(ObjectId< CI, CM > id) const noexcept
bool isAnyIDPassing(const Decision *d, const DecisionIDContainer &required)
Checks if any of the DecisionIDs passed in arg required is availble in Decision object.
const std::string & inputMakerNodeName()
Base class for elements of a container that can have aux data.
void recursiveGetDecisionsInternal(const Decision *node, const Decision *comingFrom, NavGraph &navGraph, std::set< const Decision * > &fullyExploredFrom, const DecisionIDContainer &ids, const bool enforceDecisionOnNode)
Used by recursiveGetDecisions.
static const std::string s_roiString
Constant used to identify an (explicitly) updated HLT ROI.
ElementLink< DecisionContainer > decisionToElementLink(const Decision *d, const EventContext &ctx)
Takes a raw pointer to a Decision and returns an ElementLink to the Decision.
bool typelessFindLink(const Decision *start, const std::string &linkName, sgkey_t &key, uint32_t &clid, Decision::index_type &index, const Decision *&source, const bool suppressMultipleLinksWarning)
Perform a recursive search for ElementLinks of any time and name 'linkName', starting from Decision o...