13 return StatusCode::SUCCESS;
18 std::unique_ptr< InDetRawDataContainer_p2 > persObj( std::make_unique<InDetRawDataContainer_p2>() );
19 persObj->m_collections.reserve( transCont->size() );
20 unsigned int n_rdos=0;
25 for (PixelRawDataContainerProxy module_rdo_container_proxy : rdo_container_collection_proxy) {
26 if (!module_rdo_container_proxy.empty()) {
28 assert( n_rdos + module_rdo_container_proxy.size() < std::numeric_limits<unsigned int>::max());
29 persObj->m_collections.emplace_back();
30 persObj->m_collections.back().m_id =
m_idHelper->wafer_id(id_hash ).get_identifier32().get_compact();
31 persObj->m_collections.back().m_hashId = id_hash.
value();
32 persObj->m_collections.back().m_begin = n_rdos;
33 persObj->m_collections.back().m_end =
static_cast<unsigned int>(n_rdos+module_rdo_container_proxy.size());
35 n_rdos += module_rdo_container_proxy.size();
39 persObj->m_rawdata.reserve( n_rdos );
40 for (PixelRawDataContainerProxy module_rdo_container_proxy : rdo_container_collection_proxy) {
41 if (!module_rdo_container_proxy.empty()) {
44 assert( module_rdo_container_proxy.identifyHash() < persObj->m_collections.size());
45 assert( persObj->m_rawdata.size() == persObj->m_collections[ module_rdo_container_proxy.identifyHash() ].m_begin );
46 for (PixelRawDataProxy rdo_proxy : module_rdo_container_proxy) {
47 persObj->m_rawdata.emplace_back();
48 persObj->m_rawdata.back().m_rdoId =
m_idHelper->pixel_id(wafer_id,
49 rdo_proxy.coordinates()[0],
50 rdo_proxy.coordinates()[1]).get_compact();
51 persObj->m_rawdata.back().m_word = rdo_proxy.dataWord();
53 assert( persObj->m_rawdata.size() == persObj->m_collections[ module_rdo_container_proxy.identifyHash() ].m_end);
56 return persObj.release();
62 static const Guid TP2_guid(
"7138342E-0A80-4A32-A387-2842A01C2539");
65 std::unique_ptr<PhaseIIPixelRawDataContainer> transCont(std::make_unique<PhaseIIPixelRawDataContainer>(
m_idHelper->wafer_hash_max(),
68 unsigned int n_rdos_total=0u;
70 assert( a_collection.
m_hashId < transCont->size() );
72 unsigned int n_rdos = a_collection.
m_end - a_collection.
m_begin;
74 n_rdos_total += n_rdos;
76 assert( persCont->m_collections.size() <= transCont->size());
81 constexpr ContainerIndex_t container_i=0u;
85 rdo_container_dest.
reserve(n_rdos_total);
86 assert(persCont->m_rawdata.size() == n_rdos_total);
88 [[maybe_unused]]
unsigned int n_rejected_ranges=0u;
92 static_cast<RangeSize_t
>(0u) ,
95 for (
unsigned int rdo_i = a_collection.
m_begin; rdo_i < a_collection.
m_end; ++rdo_i) {
96 assert( rdo_i < persCont->m_rawdata.size() );
97 assert( rdo_i == rdo_container_dest.
size());
99 assert(
m_idHelper->phi_index(pixel_id) < std::numeric_limits<short int>::max());
100 assert(
m_idHelper->eta_index(pixel_id) < std::numeric_limits<short int>::max());
101 rdo_container_dest.
emplace_back( std::array<std::int16_t,2>{
static_cast<std::int16_t
>(
m_idHelper->phi_index(pixel_id)),
102 static_cast<std::int16_t
>(
m_idHelper->eta_index(pixel_id))},
103 persCont->m_rawdata[rdo_i].m_word);
108 assert( rdo_container_dest.
size() == a_collection.
m_end);
110 assert(
static_cast<std::size_t
>(rdo_container_dest.
size() - new_range.
beginIndex()) < std::numeric_limits<RangeSize_t>::max() );
112 std::size_t capped_size = rdo_container_dest.
size() - new_range.
beginIndex();
113 if (capped_size >= std::numeric_limits<PhaseII::DataRange::RangeSize_t>::max()) {
115 <<
" : " << capped_size <<
" !< " << std::numeric_limits<PhaseII::DataRange::RangeSize_t>::max()
116 <<
". Elements above maximum possible size will not be accessible.");
117 capped_size =std::numeric_limits<PhaseII::DataRange::RangeSize_t>::max();
119 new_range.
setSize(
static_cast<RangeSize_t
>( capped_size));
122 n_rejected_ranges += !(transCont->registerOrEraseNewData( a_collection.
m_hashId, new_range));
124 assert( n_rejected_ranges == 0u);
127 return transCont.release();
129 throw std::runtime_error(
"Unsupported persistent version in PhaseIIPixelRawDataContainerCnv");
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x,...)
InDetRawDataContainer_p2 PixelRDO_Container_PERS
PhaseII::PixelRawDataTypeTraits< PhaseII::AccessPolicy::Mutable >::ContainerCollection PhaseIIPixelRawDataContainer
This is an Identifier helper class for the Pixel subdetector.
const ServiceHandle< StoreGateSvc > & detStore() const
This class provides a encapsulation of a GUID/UUID/CLSID/IID data structure (128 bit number).
This is a "hash" representation of an Identifier.
constexpr value_type value() const
Identifier32::value_type m_id
IdentifierHash::value_type m_hashId
const PixelID * m_idHelper
virtual StatusCode initialize() override
Gaudi Service Interface method implementations:
virtual PixelRDO_Container_PERS * createPersistent(PhaseIIPixelRawDataContainer *transCont) override
virtual PhaseIIPixelRawDataContainer * createTransient(const Token *token) override
void emplace_back(std::array< std::int16_t, NDim > &&coordinates, std::uint32_t data_word)
Add a new RDO to the end of this container.
std::size_t size() const
total number of RDOs which are in this container.
void reserve(std::size_t new_capacity)
reserve space for a certain number of RDOs.
The container for pixel RDOs The base class is the InDetRawDataContainer with a coordinate dimension ...
virtual bool compareClassGuid(const Token *token, const Guid &clid) const
virtual StatusCode initialize()
P * poolReadObject(const Token *token)
This class provides a token that identifies in a unique way objects on the persistent storage.
auto makeRawDataCollectionProxy(const T_RawDataContainerCollection &collection)
Create the top level container proxy for an RDO container collection (read only).
Type describing a range of elements living in a one of N containers.
unsigned int beginIndex() const
std::uint16_t ContainerIndex_t
void setSize(RangeSize_t new_size)
std::uint32_t RangeBeginIndex_t
std::uint16_t RangeSize_t
typename RawData::details::traits< ContainerNonConst >::template RawDataProxy< accessPolicy > RawDataProxy
PhaseII::RawDataContainerProxy< typename Utils::ContainerAccessHelper< T_RawDataContainer, accessPolicy >::ContainerType, RawDataProxy > RawDataContainerProxy