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 = "";
29  m_featureCollectionMode = TrigDefs::lastFeatureOfType;
32  }
33 
34 
36  msg << level << "Feature Request Descriptor configuration:" << endmsg;
37  msg << level << "-- Chain Group name:'" << chainGroup() << "'." << endmsg;
38  if (chainGroup().empty()) {
39  msg << MSG::ERROR << "Empty chain group name " << endmsg;
40  }
42  if (condition() == TrigDefs::Physics) {
43  msg << level << "-- Condition: TrigDefs::Physics, only paths which accepted chains in the ChainGroup will be explored." << endmsg;
44  } else if (condition() == TrigDefs::includeFailedDecisions) {
45  msg << level << "-- Condition: TrigDefs::includeFailedDecisions, passed and failed paths for chains in the ChainGroup will be explored." << endmsg;
46  } else {
47  msg << MSG::ERROR << "-- Unknown condition: " << condition() << endmsg;
48  }
50  if (SGKey().empty()) {
51  msg << level << "-- No filtering on Container StoreGate Key" << endmsg;
52  } else {
53  msg << level << "-- Container StoreGate Key: ElementLinks must regex match the container name '" << SGKey() << "'." << endmsg;
54  }
56  if (featureCollectionMode() == TrigDefs::lastFeatureOfType) {
57  msg << level << "-- Feature Collection Mode: TrigDefs::lastFeatureOfType, only one (final) matching ElementLink will be returned on each path through the navigation." << endmsg;
58  } else if (featureCollectionMode() == TrigDefs::allFeaturesOfType) {
59  msg << level << "-- Condition: TrigDefs::includeFailedDecisions, all matching ElementLinks will be returned on each path through the navigation." << endmsg;
60  } else {
61  msg << MSG::ERROR << "-- Unknown feature collection mode: " << featureCollectionMode() << "." << endmsg;
62  }
64  msg << level << "-- Link Name: ElementLinks referenced by graph edges named '" << linkName() << "' will be returned." << endmsg;
66  if (restrictRequestToLeg() == -1) {
67  msg << level << "-- Restrict Request To Leg: ElementLinks will be collected from all legs of any multi-leg chains in the ChainGroup." << endmsg;
68  } else {
69  msg << level << "-- Restrict Request To Leg: ElementLinks will be collected only from leg #" << restrictRequestToLeg() << " of all chains in the ChainGroup." << endmsg;
70  }
71  }
72 
73 
75  m_chainGroupName = chainGroupName;
76  return *this;
77  }
78 
79 
81  if (condition != TrigDefs::Physics and condition != TrigDefs::includeFailedDecisions) {
82  throw std::runtime_error("Invalid option supplied to FeatureRequestDescriptor::setCondition. Must be Physics or includeFailedDecisions.");
83  }
85  return *this;
86  }
87 
88 
90  m_containerSGKey = containerSGKey;
91  m_containerSGKeyExpression = std::regex(containerSGKey);
92  return *this;
93  }
94 
95 
97  if (featureCollectionMode != TrigDefs::lastFeatureOfType and featureCollectionMode != TrigDefs::allFeaturesOfType) {
98  throw std::runtime_error("Invalid option supplied to FeatureRequestDescriptor::featureCollectionMode. Must be lastFeatureOfType or allFeaturesOfType.");
99  }
101  return *this;
102  }
103 
104 
105  FeatureRequestDescriptor& FeatureRequestDescriptor::setLinkName(const std::string& navElementLinkKey) {
106  m_navElementLinkKey = navElementLinkKey;
107  return *this;
108  }
109 
110 
112  m_restrictToLegIndex = restrictToLegIndex;
113  return *this;
114  }
115 
116 
117  const std::string& FeatureRequestDescriptor::chainGroup() const {
118  if (m_chainGroupName.empty()) {
119  throw std::runtime_error("FeatureRequestDescriptor::chainGroup() No chain group string was supplied to this FeatureRequestDescriptor.");
120  }
121  return m_chainGroupName;
122  }
123 
124 
125  unsigned int FeatureRequestDescriptor::condition() const {
126  return m_condition;
127  }
128 
129 
130  const std::string& FeatureRequestDescriptor::SGKey() const {
131  return m_containerSGKey;
132  }
133 
134 
137  }
138 
139 
142  }
143 
144 
145  const std::string& FeatureRequestDescriptor::linkName() const {
146  return m_navElementLinkKey;
147  }
148 
149 
151  return m_restrictToLegIndex;
152  }
153 
154 
155 }
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:80
TrigCompositeUtils::featureString
const std::string & featureString()
Definition: TrigCompositeUtils.h:421
Trig::FeatureRequestDescriptor
Definition: TrigAnalysisHelpers/TrigAnalysisHelpers/FeatureRequestDescriptor.h:33
Trig
The common trigger namespace for trigger analysis tools.
Definition: LArCellMonAlg.h:33
Trig::FeatureRequestDescriptor::featureCollectionMode
unsigned int featureCollectionMode() const
Definition: FeatureRequestDescriptor.cxx:140
Trig::FeatureRequestDescriptor::m_chainGroupName
std::string m_chainGroupName
Definition: TrigAnalysisHelpers/TrigAnalysisHelpers/FeatureRequestDescriptor.h:170
Trig::FeatureRequestDescriptor::setChainGroup
FeatureRequestDescriptor & setChainGroup(const std::string &chainGroupName)
Set the desired Chain or Chain Group.
Definition: FeatureRequestDescriptor.cxx:74
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:35
Trig::FeatureRequestDescriptor::linkName
const std::string & linkName() const
Definition: FeatureRequestDescriptor.cxx:145
LArG4GenerateShowerLib.condition
condition
Definition: LArG4GenerateShowerLib.py:19
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
PrepareReferenceFile.regex
regex
Definition: PrepareReferenceFile.py:43
Trig::FeatureRequestDescriptor::m_featureCollectionMode
int m_featureCollectionMode
Definition: TrigAnalysisHelpers/TrigAnalysisHelpers/FeatureRequestDescriptor.h:174
Trig::FeatureRequestDescriptor::condition
unsigned int condition() const
Definition: FeatureRequestDescriptor.cxx:125
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
Trig::FeatureRequestDescriptor::SGKeyExpression
const std::regex & SGKeyExpression() const
Definition: FeatureRequestDescriptor.cxx:135
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
Trig::FeatureRequestDescriptor::m_navElementLinkKey
std::string m_navElementLinkKey
Definition: TrigAnalysisHelpers/TrigAnalysisHelpers/FeatureRequestDescriptor.h:175
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:117
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:111
Trig::FeatureRequestDescriptor::m_containerSGKey
std::string m_containerSGKey
Definition: TrigAnalysisHelpers/TrigAnalysisHelpers/FeatureRequestDescriptor.h:172
Trig::FeatureRequestDescriptor::setRequireSGKey
FeatureRequestDescriptor & setRequireSGKey(const std::string &containerSGKey)
Set the StoreGate key filter.
Definition: FeatureRequestDescriptor.cxx:89
Trig::FeatureRequestDescriptor::m_containerSGKeyExpression
std::regex m_containerSGKeyExpression
Definition: TrigAnalysisHelpers/TrigAnalysisHelpers/FeatureRequestDescriptor.h:173
Trig::FeatureRequestDescriptor::setLinkName
FeatureRequestDescriptor & setLinkName(const std::string &navElementLinkKey)
Set the Link Name Key.
Definition: FeatureRequestDescriptor.cxx:105
Trig::FeatureRequestDescriptor::SGKey
const std::string & SGKey() const
Definition: FeatureRequestDescriptor.cxx:130
Trig::FeatureRequestDescriptor::m_condition
int m_condition
Definition: TrigAnalysisHelpers/TrigAnalysisHelpers/FeatureRequestDescriptor.h:171
Trig::FeatureRequestDescriptor::restrictRequestToLeg
int restrictRequestToLeg() const
Definition: FeatureRequestDescriptor.cxx:150
Trig::FeatureRequestDescriptor::m_restrictToLegIndex
int m_restrictToLegIndex
Definition: TrigAnalysisHelpers/TrigAnalysisHelpers/FeatureRequestDescriptor.h:176
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:96