ATLAS Offline Software
FeatureRequestDescriptor.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 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 
24 
25  FeatureRequestDescriptor::FeatureRequestDescriptor(const std::string& chainGroupName) {
26  reset();
27  setChainGroup(chainGroupName);
28  }
29 
30 
32  m_chainGroupName = "HLT_.*";
33  m_condition = TrigDefs::Physics;
34  m_containerSGKey = "";
35  m_featureCollectionMode = TrigDefs::lastFeatureOfType;
38  }
39 
40 
42  msg << level << "Feature Request Descriptor configuration:" << endmsg;
43  msg << level << "-- Chain Group name:'" << chainGroup() << "'." << endmsg;
45  if (condition() == TrigDefs::Physics) {
46  msg << level << "-- Condition: TrigDefs::Physics, only paths which accepted chains in the ChainGroup will be explored." << endmsg;
47  } else if (condition() == TrigDefs::includeFailedDecisions) {
48  msg << level << "-- Condition: TrigDefs::includeFailedDecisions, passed and failed paths for chains in the ChainGroup will be explored." << endmsg;
49  } else {
50  msg << MSG::ERROR << "-- Unknown condition: " << condition() << endmsg;
51  }
53  if (SGKey().empty()) {
54  msg << level << "-- No filtering on Container StoreGate Key" << endmsg;
55  } else {
56  msg << level << "-- Container StoreGate Key: ElementLinks must regex match the container name '" << SGKey() << "'." << endmsg;
57  }
59  if (featureCollectionMode() == TrigDefs::lastFeatureOfType) {
60  msg << level << "-- Feature Collection Mode: TrigDefs::lastFeatureOfType, only one (final) matching ElementLink will be returned on each path through the navigation." << endmsg;
61  } else if (featureCollectionMode() == TrigDefs::allFeaturesOfType) {
62  msg << level << "-- Condition: TrigDefs::includeFailedDecisions, all matching ElementLinks will be returned on each path through the navigation." << endmsg;
63  } else {
64  msg << MSG::ERROR << "-- Unknown feature collection mode: " << featureCollectionMode() << "." << endmsg;
65  }
67  msg << level << "-- Link Name: ElementLinks referenced by graph edges named '" << linkName() << "' will be returned." << endmsg;
69  if (restrictRequestToLeg() == -1) {
70  msg << level << "-- Restrict Request To Leg: ElementLinks will be collected from all legs of any multi-leg chains in the ChainGroup." << endmsg;
71  } else {
72  msg << level << "-- Restrict Request To Leg: ElementLinks will be collected only from leg #" << restrictRequestToLeg() << " of all chains in the ChainGroup." << endmsg;
73  }
74  }
75 
76 
78  m_chainGroupName = chainGroupName;
79  return *this;
80  }
81 
82 
84  if (condition != TrigDefs::Physics and condition != TrigDefs::includeFailedDecisions) {
85  throw std::runtime_error("Invalid option supplied to FeatureRequestDescriptor::setCondition. Must be Physics or includeFailedDecisions.");
86  }
88  return *this;
89  }
90 
91 
93  m_containerSGKey = containerSGKey;
94  return *this;
95  }
96 
97 
99  if (featureCollectionMode != TrigDefs::lastFeatureOfType and featureCollectionMode != TrigDefs::allFeaturesOfType) {
100  throw std::runtime_error("Invalid option supplied to FeatureRequestDescriptor::featureCollectionMode. Must be lastFeatureOfType or allFeaturesOfType.");
101  }
103  return *this;
104  }
105 
106 
107  FeatureRequestDescriptor& FeatureRequestDescriptor::setLinkName(const std::string& navElementLinkKey) {
108  m_navElementLinkKey = navElementLinkKey;
109  return *this;
110  }
111 
112 
114  m_restrictToLegIndex = restrictToLegIndex;
115  return *this;
116  }
117 
118 
119  const std::string& FeatureRequestDescriptor::chainGroup() const {
120  return m_chainGroupName;
121  }
122 
123 
124  unsigned int FeatureRequestDescriptor::condition() const {
125  return m_condition;
126  }
127 
128 
129  const std::string& FeatureRequestDescriptor::SGKey() const {
130  return m_containerSGKey;
131  }
132 
133 
136  }
137 
138 
139  const std::string& FeatureRequestDescriptor::linkName() const {
140  return m_navElementLinkKey;
141  }
142 
143 
145  return m_restrictToLegIndex;
146  }
147 
148 
149 }
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:83
Trig::FeatureRequestDescriptor
Definition: FeatureRequestDescriptor.h:37
Trig
The common trigger namespace for trigger analysis tools.
Definition: LArCellMonAlg.h:33
Trig::FeatureRequestDescriptor::featureCollectionMode
unsigned int featureCollectionMode() const
Definition: FeatureRequestDescriptor.cxx:134
Trig::FeatureRequestDescriptor::m_chainGroupName
std::string m_chainGroupName
Definition: FeatureRequestDescriptor.h:173
Trig::FeatureRequestDescriptor::setChainGroup
FeatureRequestDescriptor & setChainGroup(const std::string &chainGroupName)
Set the desired Chain or Chain Group.
Definition: FeatureRequestDescriptor.cxx:77
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:41
Trig::FeatureRequestDescriptor::linkName
const std::string & linkName() const
Definition: FeatureRequestDescriptor.cxx:139
LArG4GenerateShowerLib.condition
condition
Definition: LArG4GenerateShowerLib.py:19
empty
bool empty(TH1 *h)
Definition: computils.cxx:295
Trig::FeatureRequestDescriptor::FeatureRequestDescriptor
FeatureRequestDescriptor(const std::string &chainGroupName="HLT_.*", 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.
Definition: FeatureRequestDescriptor.cxx:10
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
Trig::FeatureRequestDescriptor::m_featureCollectionMode
int m_featureCollectionMode
Definition: FeatureRequestDescriptor.h:176
Trig::FeatureRequestDescriptor::condition
unsigned int condition() const
Definition: FeatureRequestDescriptor.cxx:124
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: FeatureRequestDescriptor.h:177
Trig::FeatureRequestDescriptor::reset
void reset()
Reset the FeatureRequestDescriptor to its default configuration.
Definition: FeatureRequestDescriptor.cxx:31
Trig::FeatureRequestDescriptor::chainGroup
const std::string & chainGroup() const
Definition: FeatureRequestDescriptor.cxx:119
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:113
TrigCompositeUtils::featureString
const std::string & featureString()
Definition: TrigCompositeUtilsRoot.cxx:884
Trig::FeatureRequestDescriptor::m_containerSGKey
std::string m_containerSGKey
Definition: FeatureRequestDescriptor.h:175
Trig::FeatureRequestDescriptor::setRequireSGKey
FeatureRequestDescriptor & setRequireSGKey(const std::string &containerSGKey)
Set the StoreGate key filter.
Definition: FeatureRequestDescriptor.cxx:92
Trig::FeatureRequestDescriptor::setLinkName
FeatureRequestDescriptor & setLinkName(const std::string &navElementLinkKey)
Set the Link Name Key.
Definition: FeatureRequestDescriptor.cxx:107
Trig::FeatureRequestDescriptor::SGKey
const std::string & SGKey() const
Definition: FeatureRequestDescriptor.cxx:129
Trig::FeatureRequestDescriptor::m_condition
int m_condition
Definition: FeatureRequestDescriptor.h:174
Trig::FeatureRequestDescriptor::restrictRequestToLeg
int restrictRequestToLeg() const
Definition: FeatureRequestDescriptor.cxx:144
Trig::FeatureRequestDescriptor::m_restrictToLegIndex
int m_restrictToLegIndex
Definition: FeatureRequestDescriptor.h:178
FeatureRequestDescriptor.h
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:98