ATLAS Offline Software
FeatureRequestDescriptor.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 namespace Trig {
8 
9 
10  FeatureRequestDescriptor::FeatureRequestDescriptor(const std::string& chainGroupName,
11  const unsigned int condition,
12  const std::string& containerSGKey,
13  const unsigned int featureCollectionMode,
14  const std::string& navElementLinkKey,
15  const int restrictToLegIndex) {
16  setChainGroup(chainGroupName);
18  setRequireSGKey(containerSGKey);
20  setLinkName(navElementLinkKey);
21  setRestrictRequestToLeg(restrictToLegIndex);
22  }
23 
25  m_chainGroupName = "";
26  m_condition = TrigDefs::Physics;
27  m_containerSGKey = "";
28  m_featureCollectionMode = TrigDefs::lastFeatureOfType;
31  }
32 
33 
35  msg << level << "Feature Request Descriptor configuration:" << endmsg;
36  msg << level << "-- Chain Group name:'" << chainGroup() << "'." << endmsg;
37  if (chainGroup().empty()) {
38  msg << MSG::ERROR << "Empty chain group name " << endmsg;
39  }
41  if (condition() == TrigDefs::Physics) {
42  msg << level << "-- Condition: TrigDefs::Physics, only paths which accepted chains in the ChainGroup will be explored." << endmsg;
43  } else if (condition() == TrigDefs::includeFailedDecisions) {
44  msg << level << "-- Condition: TrigDefs::includeFailedDecisions, passed and failed paths for chains in the ChainGroup will be explored." << endmsg;
45  } else {
46  msg << MSG::ERROR << "-- Unknown condition: " << condition() << endmsg;
47  }
49  if (SGKey().empty()) {
50  msg << level << "-- No filtering on Container StoreGate Key" << endmsg;
51  } else {
52  msg << level << "-- Container StoreGate Key: ElementLinks must regex match the container name '" << SGKey() << "'." << endmsg;
53  }
55  if (featureCollectionMode() == TrigDefs::lastFeatureOfType) {
56  msg << level << "-- Feature Collection Mode: TrigDefs::lastFeatureOfType, only one (final) matching ElementLink will be returned on each path through the navigation." << endmsg;
57  } else if (featureCollectionMode() == TrigDefs::allFeaturesOfType) {
58  msg << level << "-- Condition: TrigDefs::includeFailedDecisions, all matching ElementLinks will be returned on each path through the navigation." << endmsg;
59  } else {
60  msg << MSG::ERROR << "-- Unknown feature collection mode: " << featureCollectionMode() << "." << endmsg;
61  }
63  msg << level << "-- Link Name: ElementLinks referenced by graph edges named '" << linkName() << "' will be returned." << endmsg;
65  if (restrictRequestToLeg() == -1) {
66  msg << level << "-- Restrict Request To Leg: ElementLinks will be collected from all legs of any multi-leg chains in the ChainGroup." << endmsg;
67  } else {
68  msg << level << "-- Restrict Request To Leg: ElementLinks will be collected only from leg #" << restrictRequestToLeg() << " of all chains in the ChainGroup." << endmsg;
69  }
70  }
71 
72 
74  m_chainGroupName = chainGroupName;
75  return *this;
76  }
77 
78 
80  if (condition != TrigDefs::Physics and condition != TrigDefs::includeFailedDecisions) {
81  throw std::runtime_error("Invalid option supplied to FeatureRequestDescriptor::setCondition. Must be Physics or includeFailedDecisions.");
82  }
84  return *this;
85  }
86 
87 
89  m_containerSGKey = containerSGKey;
90  return *this;
91  }
92 
93 
95  if (featureCollectionMode != TrigDefs::lastFeatureOfType and featureCollectionMode != TrigDefs::allFeaturesOfType) {
96  throw std::runtime_error("Invalid option supplied to FeatureRequestDescriptor::featureCollectionMode. Must be lastFeatureOfType or allFeaturesOfType.");
97  }
99  return *this;
100  }
101 
102 
103  FeatureRequestDescriptor& FeatureRequestDescriptor::setLinkName(const std::string& navElementLinkKey) {
104  m_navElementLinkKey = navElementLinkKey;
105  return *this;
106  }
107 
108 
110  m_restrictToLegIndex = restrictToLegIndex;
111  return *this;
112  }
113 
114 
115  const std::string& FeatureRequestDescriptor::chainGroup() const {
116  if (m_chainGroupName.empty()) {
117  throw std::runtime_error("FeatureRequestDescriptor::chainGroup() No chain group string was supplied to this FeatureRequestDescriptor.");
118  }
119  return m_chainGroupName;
120  }
121 
122 
123  unsigned int FeatureRequestDescriptor::condition() const {
124  return m_condition;
125  }
126 
127 
128  const std::string& FeatureRequestDescriptor::SGKey() const {
129  return m_containerSGKey;
130  }
131 
132 
135  }
136 
137 
138  const std::string& FeatureRequestDescriptor::linkName() const {
139  return m_navElementLinkKey;
140  }
141 
142 
144  return m_restrictToLegIndex;
145  }
146 
147 
148 }
Trig::FeatureRequestDescriptor::setCondition
FeatureRequestDescriptor & setCondition(const unsigned int condition)
Set the Condition: TrigDefs::Physics - (default), only returns features from paths through the naviga...
Definition: FeatureRequestDescriptor.cxx:79
TrigCompositeUtils::featureString
const std::string & featureString()
Definition: TrigCompositeUtils.h:420
Trig::FeatureRequestDescriptor
Definition: TrigAnalysisHelpers/TrigAnalysisHelpers/FeatureRequestDescriptor.h:32
Trig
The common trigger namespace for trigger analysis tools.
Definition: LArCellMonAlg.h:33
Trig::FeatureRequestDescriptor::featureCollectionMode
unsigned int featureCollectionMode() const
Definition: FeatureRequestDescriptor.cxx:133
Trig::FeatureRequestDescriptor::m_chainGroupName
std::string m_chainGroupName
Definition: TrigAnalysisHelpers/TrigAnalysisHelpers/FeatureRequestDescriptor.h:164
Trig::FeatureRequestDescriptor::setChainGroup
FeatureRequestDescriptor & setChainGroup(const std::string &chainGroupName)
Set the desired Chain or Chain Group.
Definition: FeatureRequestDescriptor.cxx:73
Trig::FeatureRequestDescriptor::print
void print(MsgStream &msg, const MSG::Level level=MSG::INFO)
Print the configuration of the FeatureRequestDescriptor to the supplied message stream.
Definition: FeatureRequestDescriptor.cxx:34
Trig::FeatureRequestDescriptor::linkName
const std::string & linkName() const
Definition: FeatureRequestDescriptor.cxx:138
LArG4GenerateShowerLib.condition
condition
Definition: LArG4GenerateShowerLib.py:19
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
Trig::FeatureRequestDescriptor::m_featureCollectionMode
int m_featureCollectionMode
Definition: TrigAnalysisHelpers/TrigAnalysisHelpers/FeatureRequestDescriptor.h:167
Trig::FeatureRequestDescriptor::condition
unsigned int condition() const
Definition: FeatureRequestDescriptor.cxx:123
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
Trig::FeatureRequestDescriptor::m_navElementLinkKey
std::string m_navElementLinkKey
Definition: TrigAnalysisHelpers/TrigAnalysisHelpers/FeatureRequestDescriptor.h:168
FeatureRequestDescriptor.h
Trig::FeatureRequestDescriptor::FeatureRequestDescriptor
FeatureRequestDescriptor(const std::string &chainGroupName="", const unsigned int condition=TrigDefs::Physics, const std::string &containerSGKey="", const unsigned int featureCollectionMode=TrigDefs::lastFeatureOfType, const std::string &navElementLinkKey=TrigCompositeUtils::featureString(), const int restrictToLegIndex=-1)
Default Constructor supplying all properties except for the chain group.
Definition: FeatureRequestDescriptor.cxx:10
Trig::FeatureRequestDescriptor::reset
void reset()
Reset the FeatureRequestDescriptor to its default configuration.
Definition: FeatureRequestDescriptor.cxx:24
Trig::FeatureRequestDescriptor::chainGroup
const std::string & chainGroup() const
Definition: FeatureRequestDescriptor.cxx:115
Trig::FeatureRequestDescriptor::setRestrictRequestToLeg
FeatureRequestDescriptor & setRestrictRequestToLeg(const int restrictToLegIndex)
Set to -1 by default, indicating that all legs of multi-leg chains are searched.
Definition: FeatureRequestDescriptor.cxx:109
Trig::FeatureRequestDescriptor::m_containerSGKey
std::string m_containerSGKey
Definition: TrigAnalysisHelpers/TrigAnalysisHelpers/FeatureRequestDescriptor.h:166
Trig::FeatureRequestDescriptor::setRequireSGKey
FeatureRequestDescriptor & setRequireSGKey(const std::string &containerSGKey)
Set the StoreGate key filter.
Definition: FeatureRequestDescriptor.cxx:88
Trig::FeatureRequestDescriptor::setLinkName
FeatureRequestDescriptor & setLinkName(const std::string &navElementLinkKey)
Set the Link Name Key.
Definition: FeatureRequestDescriptor.cxx:103
Trig::FeatureRequestDescriptor::SGKey
const std::string & SGKey() const
Definition: FeatureRequestDescriptor.cxx:128
Trig::FeatureRequestDescriptor::m_condition
int m_condition
Definition: TrigAnalysisHelpers/TrigAnalysisHelpers/FeatureRequestDescriptor.h:165
Trig::FeatureRequestDescriptor::restrictRequestToLeg
int restrictRequestToLeg() const
Definition: FeatureRequestDescriptor.cxx:143
Trig::FeatureRequestDescriptor::m_restrictToLegIndex
int m_restrictToLegIndex
Definition: TrigAnalysisHelpers/TrigAnalysisHelpers/FeatureRequestDescriptor.h:169
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
Trig::FeatureRequestDescriptor::setFeatureCollectionMode
FeatureRequestDescriptor & setFeatureCollectionMode(const unsigned int featureCollectionMode)
Set the Feature Collection Mode: TrigDefs::lastFeatureOfType - (default) stop exploring up each path ...
Definition: FeatureRequestDescriptor.cxx:94