 |
ATLAS Offline Software
|
|
| std::vector< TrigCompositeUtils::TypelessLinkInfo > | typelessFeaturesImplimentation (const Trig::FeatureRequestDescriptor &frd, const CLID clid, const SG::ReadHandleKey< TrigCompositeUtils::DecisionContainer > &navRH, MsgStream &msg, const EventContext &ctx, const asg::EventStoreType *eventStore=nullptr, const bool printWarningMessages=true) |
| | Standalone implementation of feature retrieval, common between TrigDecisionTool and TrigDecisionToolLite This is a type erased implementation which accepts a CLID. More...
|
| |
| const std::vector< TrigCompositeUtils::TypelessLinkInfo > | typelessGetFeatures (const TrigCompositeUtils::NavGraph &navGraph, const Trig::FeatureRequestDescriptor &frd, const CLID clid, const TrigCompositeUtils::DecisionIDContainer chainIDs, const EventContext &ctx, const asg::EventStoreType *eventStore=nullptr) |
| | Extract features from the supplied navGraph (obtained through typelessGetFeaturesInternal). More...
|
| |
| void | typelessGetFeaturesInternal (std::vector< TrigCompositeUtils::TypelessLinkInfo > &features, std::set< const TrigCompositeUtils::NavGraphNode * > &fullyExploredFrom, const TrigCompositeUtils::NavGraphNode *navGraphNode, const Trig::FeatureRequestDescriptor &frd, const CLID clid, const TrigCompositeUtils::DecisionIDContainer chainIDs, const EventContext &ctx, const asg::EventStoreType *eventStore=nullptr) |
| | Internal implementation called by typelessGetFeatures, and by itself. More...
|
| |
| void | filterLinkVectorByContainerKey (const std::regex &expression, std::vector< sgkey_t > &keyVec, std::vector< CLID > &clidVec, std::vector< TrigCompositeUtils::Decision::index_type > &indexVec, [[maybe_unused]] const EventContext &ctx, [[maybe_unused]] const asg::EventStoreType *eventStore) |
| |
| template<class CONTAINER > |
| std::vector< TrigCompositeUtils::LinkInfo< CONTAINER > > | typedFeaturesWrapper (const std::vector< TrigCompositeUtils::TypelessLinkInfo > &typelessLinkInfos, const EventContext &ctx, const asg::EventStoreType *eventStore=nullptr) |
| | Wrapper function to convert between vector<TypelessLinkInfo> and vector<LinkInfo<T>>. More...
|
| |
| void | filterLinkVectorByContainerKey (const std::regex &expression, std::vector< sgkey_t > &keyVec, std::vector< CLID > &clidVec, std::vector< TrigCompositeUtils::Decision::index_type > &indexVec, const EventContext &ctx, const asg::EventStoreType *eventStore=nullptr) |
| | Removes type erased element links from the supplied vectors if they do not come from the specified collection (regex match). More...
|
| |
◆ sgkey_t
◆ filterLinkVectorByContainerKey() [1/2]
Definition at line 326 of file FeatureRequestHelpers.cxx.
337 std::vector<size_t> indicesToRemove;
338 for (
size_t i = 0;
i < keyVec.size(); ++
i) {
339 #ifdef XAOD_STANDALONE
340 const std::string keyStr = eventStore->event()->getName(keyVec[
i]);
341 const std::string* keyStrPtr = (keyStr.empty() ? nullptr : &keyStr);
348 if (not keyStrPtr or not std::regex_match(*keyStrPtr,
expression)) {
349 indicesToRemove.push_back(
i);
353 for (
auto it = indicesToRemove.rbegin();
it != indicesToRemove.rend(); ++
it) {
354 keyVec.erase(keyVec.begin() + *
it);
355 clidVec.erase(clidVec.begin() + *
it);
356 indexVec.erase(indexVec.begin() + *
it);
◆ filterLinkVectorByContainerKey() [2/2]
Removes type erased element links from the supplied vectors if they do not come from the specified collection (regex match).
- Parameters
-
| [in] | expression | Regex compiled StoreGate key of the collection to match against. Passing "" as the string wrapped in the expression performs no filtering. |
| [in,out] | keyVec | Mutable vector of element link keys on which to filter. |
| [in,out] | clidVec | Mutable vector of element link CLIDs on which to filter. |
| [in,out] | indexVec | Mutable vector of element link indices on which to filter. |
| [in] | ctx | Event context. |
| [in] | eventStore | Optional pointer to event store, only needed in AnalysisBase. |
◆ typedFeaturesWrapper()
template<class CONTAINER >
Wrapper function to convert between vector<TypelessLinkInfo> and vector<LinkInfo<T>>.
- Parameters
-
| [in] | typelessLinkInfos | Vector of type erased LinkInfo objects of which we will apply type wrapping. |
| [in] | ctx | Event context for Element Link construction. |
| [in] | eventStore | Pointer to event store, only used in AnalysisBase for Element Link construction. |
- Returns
- Vector of typed LinkInfo objects each containing an ElementLink to a feature and a pointer to the feature's Decision object in the navigation.
◆ typelessFeaturesImplimentation()
Standalone implementation of feature retrieval, common between TrigDecisionTool and TrigDecisionToolLite This is a type erased implementation which accepts a CLID.
Users are expected to use typed interfaces in the respective tools.
- Parameters
-
| [in] | frd | Feature request descriptor containing details of the feature request. |
| [in] | clid | The Class ID of the requested feature's container. Originates from typed caller template parameter. May be CLID of xAOD::IParticleContainer for generic four vector access. |
| [in] | navRH | Read handle key for the primary navigation container (containing the terminus node) |
| [in] | msg | Reference to message stream for printing |
| [in] | ctx | Event context for Read Handle construction and SG key hash resolution |
| [in] | eventStore | Pointer to event store, only used in AnalysisBase for SG key hash resolution |
| [in] | printWarningMessages | Flag if warnings should be printed regarding leg multiplicity checks |
- Returns
- Typed erased vector of TypelessLinkInfo. Each LinkInfo wraps the raw data needed to construct an ElementLink to a feature and a pointer to the feature's Decision object in the navigation.
Definition at line 16 of file FeatureRequestHelpers.cxx.
27 bool errState =
false;
28 if ( frd.
condition() != TrigDefs::Physics && frd.
condition() != TrigDefs::includeFailedDecisions ) {
29 msg << MSG::ERROR <<
"features may only be called with: "
30 "TrigDefs::Physics - features from the legs of the chain(s) which passed the trigger. "
31 "TrigDefs::includeFailedDecisions - all features from the chain(s) irrespective of pass/fail of each Step." <<
endmsg;
36 msg << MSG::ERROR <<
"featureCollectionMode may only be called with: "
37 "TrigDefs::lastFeatureOfType - stop exploring each route through the navigation once a feature matching all requirements is found. "
38 "TrigDefs::allFeaturesOfType - always fully explore each route through the navigation graph and collect all matching features." <<
endmsg;
44 msg << MSG::ERROR <<
"Unable to read trigger navigation from " << navRHKey.key() <<
". Cannot retrieve features." <<
endmsg;
52 if (terminusNode ==
nullptr) {
53 msg << MSG::ERROR <<
"Unable to locate HLTPassRaw element of " << navRHKey.key()
54 <<
", collection contains " << navigationRH->
size() <<
" nodes." <<
endmsg;
60 msg << MSG::ERROR <<
"Encountered one or more errors in FeatureRequestHelpers::typelessFeaturesImplimentation" <<
endmsg;
61 throw std::runtime_error(
"Encountered one or more errors in FeatureRequestHelpers::typelessFeaturesImplimentation");
69 chainIDs.insert( chainID.numeric() );
72 if (legMultiplicites.size() == 0) {
73 msg << MSG::ERROR <<
"chain " << chainID <<
" has invalid configuration, no parsed multiplicity data." <<
endmsg;
74 throw std::runtime_error(
"Encountered chain which could not be parsed in FeatureRequestHelpers::typelessFeaturesImplimentation");
75 }
else if (legMultiplicites.size() > 1) {
76 if (frd.
restrictRequestToLeg() >=
static_cast<int>(legMultiplicites.size()) && printWarningMessages) {
77 msg << MSG::WARNING <<
"Requested features from leg index " << frd.
restrictRequestToLeg() <<
" for chain " << chainID <<
78 " but this chain only has " << legMultiplicites.size() <<
" legs" <<
endmsg;
82 for (
size_t legNumeral = 0; legNumeral < legMultiplicites.size(); ++legNumeral) {
88 chainIDs.insert( legID.
numeric() );
91 if (
msg.level() <=
MSG::DEBUG)
msg <<
MSG::DEBUG <<
"Fetching navigation data for chain " << chainID <<
" with " << legMultiplicites.size() <<
" leg(s)." <<
endmsg;
103 msg <<
"Added all passed navigation data for chain " << chainID
104 <<
", total nodes:" << navGraph.
nodes() <<
" total edges:" << navGraph.
edges() <<
" final nodes:" << navGraph.
finalNodes().size() <<
endmsg;
111 if (frd.
condition() == TrigDefs::includeFailedDecisions) {
112 std::vector<const TrigCompositeUtils::Decision*> rejectedDecisionNodes =
116 msg <<
MSG::DEBUG <<
"Chain " << chainID <<
" has " << rejectedDecisionNodes.size()
117 <<
" dangling nodes in the graph from objects which were rejected." <<
endmsg;
126 msg <<
MSG::DEBUG <<
"Added all failed navigation data for chain " << chainID
127 <<
", total nodes:" << navGraph.
nodes() <<
" total edges:" << navGraph.
edges() <<
" final nodes:" << navGraph.
finalNodes().size() <<
endmsg;
133 <<
"Total nodes:" << navGraph.
nodes() <<
" total edges:" << navGraph.
edges() <<
" final nodes:" << navGraph.
finalNodes().size() <<
endmsg;
◆ typelessGetFeatures()
Extract features from the supplied navGraph (obtained through typelessGetFeaturesInternal).
This is a lower level function call than typelessFeaturesImplimentation, and its use implies that the requisite sub-graph to be explored and set of chain IDs of interest have already been obtained. The feature request descriptor is still passed down as some aspects of the request are only handled at the lower levels (such as store gate key filtering, and link name matching)
- Parameters
-
| [in] | frd | Feature request descriptor containing details of the feature request. |
| [in] | clid | The Class Identifier to use instead of the CONTAINER template type in this type erased function |
| [in] | navGraph | Sub-graph of the trigger navigation which is to be considered. |
| [in] | chainIDs | Set of Chain IDs which features are being requested for. Used to set the ActiveState of returned LinkInfo objects. Empty set denotes no chain filtering. |
| [in] | ctx | Event context. |
| [in] | eventStore | Optional pointer to event store, only needed in AnalysisBase. |
- Returns
- Typed erased vector of TypelessLinkInfo. Each LinkInfo wraps the raw data needed to construct an ElementLink to a feature and a pointer to the feature's Decision object in the navigation.
Definition at line 152 of file FeatureRequestHelpers.cxx.
160 std::vector<TrigCompositeUtils::TypelessLinkInfo> features;
161 std::set<const TrigCompositeUtils::NavGraphNode*> fullyExploredFrom;
◆ typelessGetFeaturesInternal()
Internal implementation called by typelessGetFeatures, and by itself.
- See also
- typelessGetFeatures
- Parameters
-
| [in,out] | features | The ultimate return vector. New links are to be appended. |
| [in,out] | fullyExploredFrom | Cache of graph nodes which have been fully explored, and hence don't need exploring again should they show up. |
| [in] | navGraphNode | The current node in the navGraph which is being explored. |
Definition at line 181 of file FeatureRequestHelpers.cxx.
196 std::vector<sgkey_t> featureKeys;
197 std::vector<CLID> featureClids;
198 std::vector<TrigCompositeUtils::Decision::index_type> featureIndices;
201 std::vector<std::string> availableLinkNames;
203 const std::vector<std::string> getSingleLinkNames = decisionObj->
getObjectNames(clid);
205 std::copy(getSingleLinkNames.begin(), getSingleLinkNames.end(), std::back_inserter(availableLinkNames));
206 std::copy(getCollectionLinkNames.begin(), getCollectionLinkNames.end(), std::back_inserter(availableLinkNames));
208 availableLinkNames.push_back( frd.
linkName() );
212 for (
const std::string& featureNameToGet : availableLinkNames) {
215 #ifndef XAOD_STANDALONE
220 std::vector<sgkey_t> keyVec;
221 std::vector<CLID> clidVec;
222 std::vector<TrigCompositeUtils::Decision::index_type> indexVec;
225 std::copy(keyVec.begin(), keyVec.end(), std::back_inserter(featureKeys));
226 std::copy(clidVec.begin(), clidVec.end(), std::back_inserter(featureClids));
227 std::copy(indexVec.begin(), indexVec.end(), std::back_inserter(featureIndices));
229 #ifndef XAOD_STANDALONE
243 std::vector<sgkey_t> keyVec = {fKey};
244 std::vector<CLID> clidVec = {fClid};
245 std::vector<TrigCompositeUtils::Decision::index_type> indexVec = {fIndex};
247 std::copy(keyVec.begin(), keyVec.end(), std::back_inserter(featureKeys));
248 std::copy(clidVec.begin(), clidVec.end(), std::back_inserter(featureClids));
249 std::copy(indexVec.begin(), indexVec.end(), std::back_inserter(featureIndices));
251 #ifndef XAOD_STANDALONE
260 if (chainIDs.size() > 0) {
282 for (
size_t i = 0;
i < featureKeys.size(); ++
i) {
284 std::find_if(features.begin(), features.end(), [&](
const auto& li) { return li.key == featureKeys[i] and li.clid == featureClids[i] and li.index == featureIndices[i]; } );
285 if (vecIt == features.end()) {
287 features.emplace_back( decisionObj, featureKeys[
i], featureClids[
i], featureIndices[
i], state );
295 vecIt->decisions->insert(
ids.begin(),
ids.end());
306 if (fullyExploredFrom.count(seedNavNode) == 1) {
323 fullyExploredFrom.insert( navGraphNode );
JetConstituentVector::iterator iterator
std::string printID(const xAOD::MuonSegment &seg)
Print the chamber ID of a segment, e.g.
ActiveState
Additional information returned by the TrigerDecisionTool's feature retrieval, contained within the L...
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.
TrigCompositeUtils::DecisionID numeric() const
numeric ID
bool typelessGetObjectLink(const std::string &name, sgkey_t &key, uint32_t &clid, index_type &index) const
Fetches a single link without type.
unsigned int featureCollectionMode() const
const std::vector< NavGraphNode * > & finalNodes() const
Get all final nodes.
const std::vector< TrigCompositeUtils::TypelessLinkInfo > typelessGetFeatures(const TrigCompositeUtils::NavGraph &navGraph, const Trig::FeatureRequestDescriptor &frd, const CLID clid, const TrigCompositeUtils::DecisionIDContainer chainIDs, const EventContext &ctx, const asg::EventStoreType *eventStore)
Extract features from the supplied navGraph (obtained through typelessGetFeaturesInternal).
const std::vector< NavGraphNode * > & seeds() const
Return a vector of const pointers to the Decision object nodes which this NavGraphNode seeds from.
bool hasObjectLink(const std::string &name, const CLID clid=CLID_NULL) const
Check if a link to an object with a given name and type exists. CLID_NULL to not check type.
const std::string & linkName() const
const std::string & comboHypoAlgNodeName()
void printAllPaths(MsgStream &log, MSG::Level msgLevel=MSG::VERBOSE) const
Helper function.
bool hasObjectCollectionLinks(const std::string &collectionName, const CLID clid=CLID_NULL) const
Check if links exist to a collection of objects with given name and type. CLID_NULL to not check type...
const std::vector< NavGraphNode * > & children() const
Return a vector of const pointers to the Decision object nodes which are the children of this NavGrap...
unsigned int condition() const
const ExtendedEventContext & getExtendedEventContext(const EventContext &ctx)
Retrieve an extended context from a context object.
const Decision * getTerminusNode(SG::ReadHandle< DecisionContainer > &container)
std::vector< std::string > getObjectNames() const
Look up all links stored to objects of (container) type CONTAINER.
const std::regex & SGKeyExpression() const
std::vector< std::string > getObjectCollectionNames() const
Look up all links stored to collections objects from (container) type CONTAINER.
Structure to hold a transient Directed Acyclic Graph (DAG) structure. NavGraph is populated from,...
const std::vector< TrigCompositeUtils::DecisionID > & decisions() const
Get positive HLT chain decisions associated with this TrigComposite. Navigation use.
Class used to describe composite objects in the HLT.
const std::string & chainGroup() const
uint32_t CLID
The Class ID type.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
void filterLinkVectorByContainerKey(const std::regex &expression, std::vector< sgkey_t > &keyVec, std::vector< CLID > &clidVec, std::vector< TrigCompositeUtils::Decision::index_type > &indexVec, [[maybe_unused]] const EventContext &ctx, [[maybe_unused]] const asg::EventStoreType *eventStore)
std::vector< int > multiplicities(const std::string &chain)
const Decision * node() const
Return a const pointer to the Decision object node which this NavGraphNode is shadowing.
uint32_t sgkey_t
Type used for hashed StoreGate key+CLID pairs.
Exception — Attempt to set DataLink / ElementLink with CLID <clid> to object with CLID <clid>.
HLT::Identifier createLegName(const HLT::Identifier &chainIdentifier, size_t counter)
Generate the HLT::Identifier which corresponds to a specific leg of a given chain.
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)
const std::string & name() const
Get a human-readable name for the object.
std::set< DecisionID > DecisionIDContainer
Transient utility class to represent a node in a graph (m_decisionObject), and a vector of edges (m_f...
void typelessGetFeaturesInternal(std::vector< TrigCompositeUtils::TypelessLinkInfo > &features, std::set< const TrigCompositeUtils::NavGraphNode * > &fullyExploredFrom, const TrigCompositeUtils::NavGraphNode *navGraphNode, const Trig::FeatureRequestDescriptor &frd, const CLID clid, const TrigCompositeUtils::DecisionIDContainer chainIDs, const EventContext &ctx, const asg::EventStoreType *eventStore)
Internal implementation called by typelessGetFeatures, and by itself.
void decisionIDs(const Decision *d, DecisionIDContainer &destination)
Extracts DecisionIDs stored in the Decision object.
int restrictRequestToLeg() const
size_type size() const noexcept
Returns the number of elements in the collection.
bool typelessGetObjectCollectionLinks(const std::string &name, std::vector< sgkey_t > &keyVec, std::vector< uint32_t > &clidVec, std::vector< index_type > &indexVec) const
Fetches a collection of links without type.
ElementLink< DecisionContainer > decisionToElementLink(const Decision *d, const EventContext &ctx)
Takes a raw pointer to a Decision and returns an ElementLink to the Decision.