11#ifndef AthenaHitsVector_H
12#define AthenaHitsVector_H
22#include "boost/iterator/transform_iterator.hpp"
28#include "GaudiKernel/IMessageSvc.h"
29#include "GaudiKernel/ISvcLocator.h"
30#include "GaudiKernel/MsgStream.h"
49 template <
typename Cont_t>
concept isHitVectorBase = std::is_base_of_v<HitsVectorBase, Cont_t>;
55 template <
class ContainerT,
class AuxContainerT>
64 std::unique_ptr<ContainerT>
container{std::make_unique<ContainerT>()};
65 std::unique_ptr<AuxContainerT>
auxContainer{std::make_unique<AuxContainerT>()};
70 template <
typename Cont_t>
73 requires(Cont_t& collection) {
74 typename Cont_t::container_type;
75 typename Cont_t::aux_container_type;
76 { collection.container } ->
77 std::same_as<std::unique_ptr<typename Cont_t::container_type>&>;
78 { collection.auxContainer } ->
79 std::same_as<std::unique_ptr<typename Cont_t::aux_container_type>&>;
92 using CONT = std::vector<T*>;
106 boost::transform_iterator<make_const, typename CONT::const_iterator>;
114 :
m_name (collectionName),
118 MsgStream log(msgSvc,
"AthenaHitsVector");
119 log << MSG::DEBUG <<
" initialized " << collectionName
127 for (
unsigned int i = 0; i <
m_hitvector.size(); i++)
136 for (
unsigned int i = 0; i <
m_hitvector.size(); i++)
153 m_hitvector.push_back((
nullptr != *i) ?
new T(**i) :
nullptr);
168 m_hitvector.push_back((
nullptr != *i) ?
new T(**i) :
nullptr);
224 for (
unsigned int i = 0; i <
m_hitvector.size(); i++)
243 static const std::type_info*
const s_info;
void dvl_makecontainer(size_t nreserve, AthenaHitsVector< T > *&cont)
Construct a new container.
Holder to implement conversion copies for DataVector/DataList.
Header file for AthHistogramAlgorithm.
const SiHit *const & const_reference
std::vector< SiHit * > m_hitvector
const_iterator end() const
void reserve(size_type n)
void Clear(AthHitVec::OwnershipPolicy ownPolicy)
typename CONT::reference reference
const std::vector< T * > & getVector()
void setName(const std::string &name)
typename CONT::value_type value_type
AthenaHitsVector(const AthenaHitsVector< T > &rhs)
copy constructor makes deep copy of elements, as by default the container is AthHitVec::OWN_ELEMENTS
AthenaHitsVector(const std::string &collectionName="DefaultCollectionName", AthHitVec::OwnershipPolicy ownPolicy=AthHitVec::OWN_ELEMENTS)
const SiHit *const * const_pointer
typename CONT::difference_type difference_type
void push_back(std::unique_ptr< T > t)
typename CONT::iterator iterator
const T * At(unsigned int pos) const
AthenaHitsVector< T > & operator=(const AthenaHitsVector< T > &rhs)
assignment deletes old elements and copies the new ones deep copy if AthHitVec::OWN_ELEMENTS shallow ...
typename CONT::pointer pointer
const_iterator begin() const
const T * operator[](size_type n) const
const std::string & Name() const
boost::transform_iterator< make_const, typename CONT::const_iterator > const_iterator
static const std::type_info *const s_info
static const std::type_info * initHelper()
AthHitVec::OwnershipPolicy m_ownPolicy
typename CONT::size_type size_type
std::vector< SiHit * > CONT
~AthenaHitsVector() override
void resize(size_type sz)
Define the concept for hit-collection carriers owning an xAOD container and its auxiliary store.
Define the concept that the struct needs to inherit from the HitsVectorBase.
singleton-like access to IMessageSvc via open function and helper
@ OWN_ELEMENTS
this data object owns its elements
@ VIEW_ELEMENTS
this data object is a view, does not own its elmts
IMessageSvc * getMessageSvc(bool quiet=false)
std::unique_ptr< xAOD::MuonSimHitAuxContainer > auxContainer
xAOD::MuonSimHitContainer container_type
std::unique_ptr< xAOD::MuonSimHitContainer > container
xAOD::MuonSimHitAuxContainer aux_container_type
const T * operator()(const T *x) const
virtual ~HitsVectorBase()=default