Small wrapper around hit collection map to facilitate accessing the hit collection.
More...
#include <HitCollectionMap.h>
|
| std::pair< StorageIterator, bool > | Insert (std::string const &hitCollectionName, std::unique_ptr< HitsVectorBase > hitCollection) |
| | Insert the hit collection for a given SDs.
|
| template<AthHitVec::isHitVectorBase HitCollectionT, class... CollectionArgs> |
| std::pair< StorageIterator, bool > | Emplace (std::string const &hitCollectionName, CollectionArgs &&... args) |
| | Insert a container in the map with in-place construction.
|
| template<AthHitVec::isHitVectorBase T> |
| T * | Find (std::string const &hitCollectionName) |
| | Get the hit collection for a given SDs.
|
| template<AthHitVec::isHitVectorBase T> |
| std::unique_ptr< T > | Extract (std::string const &hitCollectionName) |
| | Extract the hit collection for a given SDs downcasted to the template parameter.
|
| template<AthHitVec::isHitVectorBase T> |
| StatusCode | Record (std::string const &sgKey, std::string const &hitCollectionName, EventContext const &ctx) |
| | Record the hit collection hitCollectionName to the StoreGate sgKey.
|
| template<AthHitVec::isHitVectorBase T> |
| StatusCode | Record (std::string const &hitCollectionName) |
| | Overload for Record with the same name for the SG key and hit collection name.
|
| template<AthHitVec::isHitVectorBase T> |
| StatusCode | TransformAndRecord (std::string const &sgKey, std::string const &hitCollectionName, EventContext const &ctx, std::function< void(T &)> transform) |
| | Record the hit collection hitCollectionName to the StoreGate sgKey, applying a transformation function to the hit collection before recording it.
|
| template<AthHitVec::isHitVectorBase T> |
| StatusCode | TransformAndRecord (std::string const &hitCollectionName, std::function< void(T &)> transform) |
| | Overload for TransformAndRecord with the same name for the SG key and hit collection name.
|
Small wrapper around hit collection map to facilitate accessing the hit collection.
Definition at line 22 of file HitCollectionMap.h.
◆ Storage
◆ StorageIterator
◆ Emplace()
| std::pair< StorageIterator, bool > HitCollectionMap::Emplace |
( |
std::string const & | hitCollectionName, |
|
|
CollectionArgs &&... | args ) |
|
inline |
Insert a container in the map with in-place construction.
Definition at line 40 of file HitCollectionMap.h.
40 {
42 hitCollectionName, std::make_unique<HitCollectionT>(std::forward<CollectionArgs>(args)...));
43 }
Storage m_outputCollections
◆ Extract()
| std::unique_ptr< T > HitCollectionMap::Extract |
( |
std::string const & | hitCollectionName | ) |
|
|
inline |
Extract the hit collection for a given SDs downcasted to the template parameter.
Definition at line 62 of file HitCollectionMap.h.
62 {
65 return nullptr;
66 }
67
68 auto* baseCollection =
it->second.release();
69 auto* collection =
dynamic_cast<T*
>(baseCollection);
70 if (!collection) {
71 it->second.reset(baseCollection);
72 return nullptr;
73 }
74
76 return std::unique_ptr<T>{collection};
77 }
◆ Find()
| T * HitCollectionMap::Find |
( |
std::string const & | hitCollectionName | ) |
|
|
inline |
Get the hit collection for a given SDs.
Definition at line 49 of file HitCollectionMap.h.
49 {
52 return dynamic_cast<T*
>(
it->second.get());
53 }
54 return nullptr;
55 }
◆ Insert()
◆ Record() [1/2]
| StatusCode HitCollectionMap::Record |
( |
std::string const & | hitCollectionName | ) |
|
|
inline |
Overload for Record with the same name for the SG key and hit collection name.
Definition at line 92 of file HitCollectionMap.h.
92 {
94 return recordExtracted<T>(hitCollectionName, Gaudi::Hive::currentContext(), std::move(hitColl));
95 }
std::unique_ptr< T > Extract(std::string const &hitCollectionName)
Extract the hit collection for a given SDs downcasted to the template parameter.
StatusCode recordExtracted(std::string const &sgKey, EventContext const &ctx, std::unique_ptr< T > hitColl)
◆ Record() [2/2]
| StatusCode HitCollectionMap::Record |
( |
std::string const & | sgKey, |
|
|
std::string const & | hitCollectionName, |
|
|
EventContext const & | ctx ) |
|
inline |
Record the hit collection hitCollectionName to the StoreGate sgKey.
Definition at line 83 of file HitCollectionMap.h.
◆ recordExtracted()
| StatusCode HitCollectionMap::recordExtracted |
( |
std::string const & | sgKey, |
|
|
EventContext const & | ctx, |
|
|
std::unique_ptr< T > | hitColl ) |
|
inlineprivate |
Definition at line 125 of file HitCollectionMap.h.
125 {
126 if (!hitColl) {
127 return StatusCode::FAILURE;
128 }
129
130 if constexpr (AthHitVec::isAuxStoreHitCollection<T>) {
131 SG::WriteHandle<typename T::container_type>
handle{sgKey, ctx};
132 return handle.record(std::move(hitColl->container), std::move(hitColl->auxContainer));
133 } else {
134 SG::WriteHandle<T>
handle{sgKey, ctx};
135 return handle.record(std::move(hitColl));
136 }
137 }
virtual void handle(const Incident &inc)
Handle end of run incidents to save the metadata at that point.
◆ TransformAndRecord() [1/2]
| StatusCode HitCollectionMap::TransformAndRecord |
( |
std::string const & | hitCollectionName, |
|
|
std::function< void(T &)> | transform ) |
|
inline |
Overload for TransformAndRecord with the same name for the SG key and hit collection name.
Definition at line 119 of file HitCollectionMap.h.
119 {
120 return TransformAndRecord(hitCollectionName, hitCollectionName, Gaudi::Hive::currentContext(), std::move(transform));
121 }
StatusCode TransformAndRecord(std::string const &sgKey, std::string const &hitCollectionName, EventContext const &ctx, std::function< void(T &)> transform)
Record the hit collection hitCollectionName to the StoreGate sgKey, applying a transformation functio...
◆ TransformAndRecord() [2/2]
| StatusCode HitCollectionMap::TransformAndRecord |
( |
std::string const & | sgKey, |
|
|
std::string const & | hitCollectionName, |
|
|
EventContext const & | ctx, |
|
|
std::function< void(T &)> | transform ) |
|
inline |
Record the hit collection hitCollectionName to the StoreGate sgKey, applying a transformation function to the hit collection before recording it.
Definition at line 102 of file HitCollectionMap.h.
106 {
108 if (!hitColl) {
109 return StatusCode::FAILURE;
110 }
113 }
Amg::Vector3D transform(Amg::Vector3D &v, Amg::Transform3D &tr)
Transform a point from a Trasformation3D.
◆ m_outputCollections
| Storage HitCollectionMap::m_outputCollections |
|
private |
The documentation for this class was generated from the following file: