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_identifier32().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 pool::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");