ATLAS Offline Software
TrigComposite_v1.h
Go to the documentation of this file.
1 // Dear emacs, this is -*- c++ -*-
2 
3 /*
4  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 #ifndef XAODTRIGGER_VERSIONS_TRIGCOMPOSITE_V1_H
8 #define XAODTRIGGER_VERSIONS_TRIGCOMPOSITE_V1_H
9 
10 // System include(s):
11 extern "C" {
12 # include <stdint.h>
13 }
14 #include <string>
15 #include <vector>
16 #include <set>
17 
18 // EDM include(s):
20 #include "AthLinks/ElementLink.h"
22 #include "CxxUtils/sgkey_t.h"
23 
25 
26 namespace TrigCompositeUtils{
27  typedef unsigned int DecisionID;
28  typedef std::set<DecisionID> DecisionIDContainer;
29 }
30 
31 namespace xAOD {
32 
34  : public std::runtime_error
35  {
36  public:
37  ExcNotIParticleContainer (const std::string& msg);
38  };
39 
53 
54  public:
56 
59 
62 
65 
68 
70  const std::string& name() const;
72  void setName( const std::string& name );
73 
75  const std::vector<TrigCompositeUtils::DecisionID>& decisions() const;
77  void setDecisions( const std::vector<TrigCompositeUtils::DecisionID>& decisions );
78 
80 
83 
85  template< typename TYPE >
86  bool hasDetail( const std::string& name ) const;
87 
89  template< typename TYPE >
90  bool setDetail( const std::string& name, const TYPE& value );
91 
93  template< typename TYPE >
94  bool getDetail( const std::string& name, TYPE& value ) const;
95 
97  template<typename TYPE>
98  TYPE getDetail( const std::string& name ) const;
99 
101 
104 
106  template< class CONTAINER >
107  bool setObjectLink( const std::string& name,
108  const ElementLink< CONTAINER >& link );
110  bool hasObjectLink( const std::string& name, const CLID clid = CLID_NULL ) const;
112  template< class CONTAINER >
114  objectLink( const std::string& name ) const;
116  template< class OBJECT >
117  const OBJECT* object( const std::string& name ) const;
118 
120  template< class CONTAINER >
121  bool addObjectCollectionLink( const std::string& collectionName,
122  const ElementLink< CONTAINER >& link );
124  template< class CONTAINER >
125  bool addObjectCollectionLinks( const std::string& collectionName,
126  const std::vector<ElementLink< CONTAINER >>& links );
128  bool hasObjectCollectionLinks( const std::string& collectionName, const CLID clid = CLID_NULL) const;
130  template< class CONTAINER >
131  std::vector<ElementLink< CONTAINER >>
132  objectCollectionLinks( const std::string& collectionName ) const;
133 
135  void typelessSetObjectLink( const std::string& name,
136  const sgkey_t key,
137  const uint32_t clid,
138  const uint16_t beginIndex,
139  const uint16_t endIndex = 0 );
140 
147  bool typelessGetObjectLink( const std::string& name,
148  sgkey_t& key,
149  uint32_t& clid,
150  uint16_t& index) const;
151 
158  bool typelessGetObjectCollectionLinks( const std::string& name,
159  std::vector<sgkey_t>& keyVec,
160  std::vector<uint32_t>& clidVec,
161  std::vector<uint16_t>& indexVec) const;
162 
163 
166  template< class CONTAINER >
167  std::vector<std::string> getObjectNames() const;
168 
171  template< class CONTAINER >
172  std::vector<std::string> getObjectCollectionNames() const;
173 
177  bool removeObjectLink(const std::string& name);
178 
182  bool removeObjectCollectionLinks(const std::string& name);
183 
185 
188 
195  bool copyLinkFrom(const xAOD::TrigComposite_v1& other, const std::string& name, std::string newName = "");
196  bool copyLinkFrom(const xAOD::TrigComposite_v1* other, const std::string& name, std::string newName = "");
197 
204  bool copyLinkCollectionFrom(const xAOD::TrigComposite_v1& other, const std::string& name, std::string newName = "");
205  bool copyLinkCollectionFrom(const xAOD::TrigComposite_v1* other, const std::string& name, std::string newName = "");
206 
213 
214 
216 
219 
221  const std::vector< std::string >& linkColNames() const;
223  const std::vector< sgkey_t >& linkColKeys() const;
225  const std::vector< uint16_t >& linkColIndices() const;
227  const std::vector< uint32_t >& linkColClids() const;
228 
232  bool isRemapped() const;
233 
235  const std::vector< sgkey_t >& linkColKeysRemap() const;
237  const std::vector< uint16_t >& linkColIndicesRemap() const;
238 
240 
242  static bool s_throwOnCopyError ATLAS_THREAD_SAFE;
243 
245  static const std::string s_initialRoIString;
247  static const std::string s_initialRecRoIString;
249  static const std::string s_roiString;
251  static const std::string s_viewString;
253  static const std::string s_featureString;
255  static const std::string s_seedString;
256 
258  static const std::string s_hltSeedingNodeNameString;
260  static const std::string s_filterNodeNameString;
262  static const std::string s_inputMakerNodeNameString;
264  static const std::string s_hypoAlgNodeNameString;
266  static const std::string s_comboHypoAlgNodeNameString;
269  static const std::string s_summaryFilterNodeNameString;
272  static const std::string s_summaryPassNodeNameString;
275  static const std::string s_summaryPassExpressNodeNameString;
278  static const std::string s_summaryPrescaledNodeNameString;
279 
280  private:
282  std::vector< std::string >& linkColNamesNC();
284  std::vector< sgkey_t >& linkColKeysNC();
286  std::vector< uint16_t >& linkColIndicesNC();
288  std::vector< uint32_t >& linkColClidsNC();
289 
290  // Helper function, check for exact link match
291  bool hasObjectLinkExact(const std::string& name, const sgkey_t key, const uint16_t index, const uint32_t clid) const;
292 
294  void copyLinkInternal(const xAOD::TrigComposite_v1& other, const size_t index, const std::string& newName);
295 
297  bool derivesFromIParticle(const CLID clid) const;
298 
300  template< class CONTAINER >
301  void checkTypes(const CLID storedCLID, const std::string& name) const;
302 
303 
304  static const std::string s_collectionSuffix;
305 
306  }; // class TrigComposite_v1
307 
311 std::ostream& operator<<(std::ostream& os, const xAOD::TrigComposite_v1& tc);
312 
313 
314 } // namespace xAOD
315 
316 // Include the template implementation:
317 #include "TrigComposite_v1.icc"
318 
319 #endif // XAODTRIGGER_VERSIONS_TRIGCOMPOSITE_V1_H
xAOD::TrigComposite_v1::linkColKeysRemap
const std::vector< sgkey_t > & linkColKeysRemap() const
Raw access to the persistent link labels. Will attempt to access remapped link data.
Definition: TrigComposite_v1.cxx:302
xAOD::TrigComposite_v1::addObjectCollectionLinks
bool addObjectCollectionLinks(const std::string &collectionName, const std::vector< ElementLink< CONTAINER >> &links)
Add links to multiple objects within a collection. Performs de-duplication.
xAOD::ExcNotIParticleContainer::ExcNotIParticleContainer
ExcNotIParticleContainer(const std::string &msg)
Definition: TrigComposite_v1.cxx:27
xAOD::TrigComposite_v1::setDetail
bool setDetail(const std::string &name, const TYPE &value)
Set an TYPE detail on the object.
xAOD::TrigComposite_v1::s_collectionSuffix
static const std::string s_collectionSuffix
Definition: TrigComposite_v1.h:304
TrigCompositeUtils::DecisionID
unsigned int DecisionID
Definition: TrigComposite_v1.h:27
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
xAOD::TrigComposite_v1::objectLink
ElementLink< CONTAINER > objectLink(const std::string &name) const
Get the link with the requested name.
index
Definition: index.py:1
SG::AuxElement
Base class for elements of a container that can have aux data.
Definition: AuxElement.h:446
xAOD::TrigComposite_v1::hasObjectLink
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.
Definition: TrigComposite_v1.cxx:226
xAOD::TrigComposite_v1::typelessGetObjectCollectionLinks
bool typelessGetObjectCollectionLinks(const std::string &name, std::vector< sgkey_t > &keyVec, std::vector< uint32_t > &clidVec, std::vector< uint16_t > &indexVec) const
Fetches a collection of links without type.
Definition: TrigComposite_v1.cxx:426
xAOD::TrigComposite_v1::object
const OBJECT * object(const std::string &name) const
Get a bare pointer with the requested name.
xAOD::TrigComposite_v1::s_featureString
static const std::string s_featureString
Constant used to identify a feature.
Definition: TrigComposite_v1.h:253
xAOD::other
@ other
Definition: TrackingPrimitives.h:509
athena.value
value
Definition: athena.py:122
xAOD::TrigComposite_v1::hasDetail
bool hasDetail(const std::string &name) const
Check if a given type of detail is available.
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition: ICaloAffectedTool.h:24
xAOD::TrigComposite_v1::setDecisions
void setDecisions(const std::vector< TrigCompositeUtils::DecisionID > &decisions)
Set positive HLT chain decisions associated with this TrigComposite. Navigation use.
xAOD::TrigComposite_v1::s_seedString
static const std::string s_seedString
Constant used to identify a seed (parent)
Definition: TrigComposite_v1.h:255
xAOD::TrigComposite_v1::hasObjectCollectionLinks
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...
Definition: TrigComposite_v1.cxx:257
xAOD::TrigComposite_v1::s_initialRoIString
static const std::string s_initialRoIString
Constant used to identify an initial ROI from L1.
Definition: TrigComposite_v1.h:245
xAOD::TrigComposite_v1::sgkey_t
SG::sgkey_t sgkey_t
Definition: TrigComposite_v1.h:55
xAOD::TrigComposite_v1::linkColNamesNC
std::vector< std::string > & linkColNamesNC()
Raw access to the persistent link names (non-const)
Definition: TrigComposite_v1.cxx:314
xAOD::TrigComposite_v1::objectCollectionLinks
std::vector< ElementLink< CONTAINER > > objectCollectionLinks(const std::string &collectionName) const
Get a vector of all element links from the collection.
xAOD::TrigComposite_v1::linkColIndicesRemap
const std::vector< uint16_t > & linkColIndicesRemap() const
Raw access to the persistent link indices. Will attempt to access remapped link data.
Definition: TrigComposite_v1.cxx:307
xAOD::TrigComposite_v1::linkColClids
const std::vector< uint32_t > & linkColClids() const
Raw access to the persistent link CLIDs.
xAOD::TrigComposite_v1::s_hypoAlgNodeNameString
static const std::string s_hypoAlgNodeNameString
Constant used to identify a navigation graph node as being from a Hypo Alg.
Definition: TrigComposite_v1.h:264
xAOD::TrigComposite_v1::s_summaryPassNodeNameString
static const std::string s_summaryPassNodeNameString
Constant used to identify the single terminus graph node the end point of all chains which accept the...
Definition: TrigComposite_v1.h:272
xAOD::TrigComposite_v1::hasObjectLinkExact
bool hasObjectLinkExact(const std::string &name, const sgkey_t key, const uint16_t index, const uint32_t clid) const
Definition: TrigComposite_v1.cxx:263
xAOD::TrigComposite_v1::getObjectNames
std::vector< std::string > getObjectNames() const
Look up all links stored to objects of (container) type CONTAINER.
xAOD::TrigComposite_v1::addObjectCollectionLink
bool addObjectCollectionLink(const std::string &collectionName, const ElementLink< CONTAINER > &link)
Add a link to a single object within a collection. Performs de-duplication.
xAOD::TrigComposite_v1::ATLAS_THREAD_SAFE
static bool s_throwOnCopyError ATLAS_THREAD_SAFE
For use in validation, when copying element links from one object to another.
Definition: TrigComposite_v1.h:242
xAOD::TrigComposite_v1::copyLinkCollectionFrom
bool copyLinkCollectionFrom(const xAOD::TrigComposite_v1 &other, const std::string &name, std::string newName="")
Copy one named link collection from another object.
Definition: TrigComposite_v1.cxx:128
xAOD::TrigComposite_v1::typelessSetObjectLink
void typelessSetObjectLink(const std::string &name, const sgkey_t key, const uint32_t clid, const uint16_t beginIndex, const uint16_t endIndex=0)
Add a link without type.
Definition: TrigComposite_v1.cxx:338
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:88
xAOD::TrigComposite_v1::s_comboHypoAlgNodeNameString
static const std::string s_comboHypoAlgNodeNameString
Constant used to identify a navigation graph node as being from a Combo Hypo Alg.
Definition: TrigComposite_v1.h:266
xAOD::TrigComposite_v1::setObjectLink
bool setObjectLink(const std::string &name, const ElementLink< CONTAINER > &link)
Set the link to an object.
xAOD::ExcNotIParticleContainer
Definition: TrigComposite_v1.h:35
xAOD::TrigComposite_v1::getDetail
TYPE getDetail(const std::string &name) const
Get a detail by name, missing detail will result on std::runtime_error exception.
DMTest::links
links
Definition: CLinks_v1.cxx:22
xAOD::TrigComposite_v1::s_filterNodeNameString
static const std::string s_filterNodeNameString
Constant used to identify a navigation graph node as being from a Filter.
Definition: TrigComposite_v1.h:260
IParticleContainer.h
xAOD::TrigComposite_v1::copyLinkFrom
bool copyLinkFrom(const xAOD::TrigComposite_v1 &other, const std::string &name, std::string newName="")
Copy one named link from another object.
Definition: TrigComposite_v1.cxx:103
xAOD::TrigComposite_v1::operator=
TrigComposite_v1 & operator=(const TrigComposite_v1 &rhs)
Assignment operator.
Definition: TrigComposite_v1.cxx:61
xAOD::TrigComposite_v1::getObjectCollectionNames
std::vector< std::string > getObjectCollectionNames() const
Look up all links stored to collections objects from (container) type CONTAINER.
xAOD::TrigComposite_v1::copyAllLinksFrom
bool copyAllLinksFrom(const xAOD::TrigComposite_v1 &other)
Copy all single links and collections of links from another object.
Definition: TrigComposite_v1.cxx:157
xAOD::TrigComposite_v1::linkColKeysNC
std::vector< sgkey_t > & linkColKeysNC()
Raw access to the persistent link labels (non-const)
Definition: TrigComposite_v1.cxx:320
xAOD::TrigComposite_v1::typelessGetObjectLink
bool typelessGetObjectLink(const std::string &name, sgkey_t &key, uint32_t &clid, uint16_t &index) const
Fetches a single link without type.
Definition: TrigComposite_v1.cxx:407
xAOD::TrigComposite_v1::linkColIndicesNC
std::vector< uint16_t > & linkColIndicesNC()
Raw access to the persistent link indices (non-const)
Definition: TrigComposite_v1.cxx:326
test_pyathena.parent
parent
Definition: test_pyathena.py:15
xAOD::TrigComposite_v1::setName
void setName(const std::string &name)
Set a human-readable name for the object.
xAOD::TrigComposite_v1::s_summaryFilterNodeNameString
static const std::string s_summaryFilterNodeNameString
Constant used to identify a navigation graph node as being from a final Filter created by the Decisio...
Definition: TrigComposite_v1.h:269
xAOD::TrigComposite_v1::decisions
const std::vector< TrigCompositeUtils::DecisionID > & decisions() const
Get positive HLT chain decisions associated with this TrigComposite. Navigation use.
xAOD::TrigComposite_v1
Class used to describe composite objects in the HLT.
Definition: TrigComposite_v1.h:52
CLID
uint32_t CLID
The Class ID type.
Definition: Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
xAOD::TrigComposite_v1::s_hltSeedingNodeNameString
static const std::string s_hltSeedingNodeNameString
Constant used to identify a navigation graph node as being from the HLTSeeding.
Definition: TrigComposite_v1.h:258
TYPE
#define TYPE(CODE, TYP, IOTYP)
MakeNewFileFromOldAndSubstitution.newName
dictionary newName
Definition: ICHEP2016/MakeNewFileFromOldAndSubstitution.py:95
xAOD::TrigComposite_v1::s_initialRecRoIString
static const std::string s_initialRecRoIString
Constant used to identify an initial HLT ROI derived from L1.
Definition: TrigComposite_v1.h:247
xAOD::TrigComposite_v1::copyLinkInternal
void copyLinkInternal(const xAOD::TrigComposite_v1 &other, const size_t index, const std::string &newName)
Helper function, copy one link into this object.
Definition: TrigComposite_v1.cxx:91
SG::sgkey_t
uint32_t sgkey_t
Type used for hashed StoreGate key+CLID pairs.
Definition: CxxUtils/CxxUtils/sgkey_t.h:32
xAOD::TrigComposite_v1::removeObjectCollectionLinks
bool removeObjectCollectionLinks(const std::string &name)
Delete any stored collection of element links with the given name.
Definition: TrigComposite_v1.cxx:207
xAOD::TrigComposite_v1::linkColNames
const std::vector< std::string > & linkColNames() const
Raw access to the persistent link names.
xAOD::TrigComposite_v1::name
const std::string & name() const
Get a human-readable name for the object.
xAOD::TrigComposite_v1::TrigComposite_v1
TrigComposite_v1()
Default constructor.
Definition: TrigComposite_v1.cxx:54
sgkey_t.h
Define the type used for hashed StoreGate key+CLID pairs.
xAOD::TrigComposite_v1::linkColKeys
const std::vector< sgkey_t > & linkColKeys() const
Raw access to the persistent link labels.
Definition: TrigComposite_v1.cxx:292
TrigCompositeUtils::DecisionIDContainer
std::set< DecisionID > DecisionIDContainer
Definition: TrigComposite_v1.h:28
xAOD::TrigComposite_v1::isRemapped
bool isRemapped() const
Information on if linkColKeys() and linkColIndices() are able to access remapped link data Remapping ...
Definition: TrigComposite_v1.cxx:450
xAOD::TrigComposite_v1::checkTypes
void checkTypes(const CLID storedCLID, const std::string &name) const
Helper function. Contains type logic check for use during actual link retrieval. Throws on error.
TrigCompositeUtils
Definition: Event/xAOD/xAODTrigger/xAODTrigger/TrigComposite.h:19
xAOD::TrigComposite_v1::s_viewString
static const std::string s_viewString
Constant used to identify a view.
Definition: TrigComposite_v1.h:251
xAOD::TrigComposite_v1::removeObjectLink
bool removeObjectLink(const std::string &name)
Delete any stored element link with the given name.
Definition: TrigComposite_v1.cxx:190
python.test_cfgItemList.msg
msg
Definition: test_cfgItemList.py:7
xAOD::TrigComposite_v1::s_inputMakerNodeNameString
static const std::string s_inputMakerNodeNameString
Constant used to identify a navigation graph node as being from a Input Maker.
Definition: TrigComposite_v1.h:262
xAOD::TrigComposite_v1::s_summaryPrescaledNodeNameString
static const std::string s_summaryPrescaledNodeNameString
Constant used to identify the single prescaled graph node.
Definition: TrigComposite_v1.h:278
xAOD::TrigComposite_v1::getDetail
bool getDetail(const std::string &name, TYPE &value) const
Get an TYPE detail from the object.
xAOD::TrigComposite_v1::s_summaryPassExpressNodeNameString
static const std::string s_summaryPassExpressNodeNameString
Constant used to identify the single express-accept graph node.
Definition: TrigComposite_v1.h:275
checker_macros.h
Define macros for attributes used to control the static checker.
xAOD::TrigComposite_v1::linkColIndices
const std::vector< uint16_t > & linkColIndices() const
Raw access to the persistent link indices.
Definition: TrigComposite_v1.cxx:297
TrigComposite_v1.icc
xAOD::TrigComposite_v1::derivesFromIParticle
bool derivesFromIParticle(const CLID clid) const
Helper function. Check if the requested type can be down cast to an IParticle transient interface.
Definition: TrigComposite_v1.cxx:274
AuxElement.h
Base class for elements of a container that can have aux data.
xAOD::operator<<
std::ostream & operator<<(std::ostream &out, const std::pair< FIRST, SECOND > &pair)
Helper print operator.
Definition: RDataSource.cxx:53
xAOD::TrigComposite_v1::s_roiString
static const std::string s_roiString
Constant used to identify an (explicitly) updated HLT ROI.
Definition: TrigComposite_v1.h:249
xAOD::TrigComposite_v1::linkColClidsNC
std::vector< uint32_t > & linkColClidsNC()
Raw access to the persistent link CLIDs (non-const)
Definition: TrigComposite_v1.cxx:332
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37