12 #include "GaudiKernel/ISvcLocator.h"
13 #include "GaudiKernel/MsgStream.h"
14 #include "GaudiKernel/StatusCode.h"
19 #include "Identifier/Identifier.h"
29 ISvcLocator* svcLocator = Gaudi::svcLocator();
32 SmartIF<StoreGateSvc>
detStore{svcLocator->service(
"DetectorStore")};
38 return StatusCode::SUCCESS;
42 const Trans_t* transient_container,
Pers_t* persistent_container,
46 if (this->
initialize(log) != StatusCode::SUCCESS) {
47 log <<
MSG::FATAL <<
"Could not initialize HGTD_RDO_ContainerCnv_p1 "
53 size_t n_collections = transient_container->numberOfCollections();
54 Trans_t::const_iterator container_itr = transient_container->begin();
58 size_t collection_separator_index_begin = 0;
59 size_t total_n_clusters = 0;
61 for (
size_t coll_i = 0; coll_i < n_collections; coll_i++, ++container_itr) {
64 size_t collection_size = collection.
size();
73 total_n_clusters += collection_size;
74 persistent_container->
m_rdo_list.resize(total_n_clusters);
78 << collection_size <<
endmsg;
81 for (
size_t rdo_i = 0; rdo_i < collection_size; rdo_i++) {
85 .at(rdo_i + collection_separator_index_begin));
88 dynamic_cast<const HGTD_RDO*
>(collection.
at(rdo_i));
93 collection_separator_index_begin += collection.
size();
98 <<
"Writing HGTD_ClusterContainer to HGTD_ClusterContainer_p1 done"
107 const Pers_t* persistent_container,
Trans_t* transient_container,
111 if (this->
initialize(log) != StatusCode::SUCCESS) {
112 log <<
MSG::FATAL <<
"Could not initialize HGTD_RDO_ContainerCnv_p1 "
117 std::unique_ptr<HGTD_RDO_Collection> collection =
nullptr;
120 size_t collection_separator_index_begin = 0;
122 for (
size_t coll_i = 0;
130 collection = std::make_unique<HGTD_RDO_Collection>(coll_idhash);
133 unsigned short n_clusters = rdo_coll.
m_size;
134 collection->
resize(n_clusters);
135 for (
unsigned short rdo_i = 0; rdo_i < n_clusters; ++rdo_i) {
138 .at(rdo_i + collection_separator_index_begin));
143 (*collection).at(rdo_i) = trans_rdo;
145 collection_separator_index_begin += n_clusters;
148 transient_container->addCollection(collection.release(), coll_idhash);
149 if (
sc.isFailure()) {
150 throw std::runtime_error(
"Failed to add collection to ID Container");
157 const Pers_t* persistent_container, MsgStream&
log) {
160 if (this->
initialize(log) != StatusCode::SUCCESS) {
161 log <<
MSG::FATAL <<
"Could not initialize HGTD_RDO_ContainerCnv_p1 "
166 std::unique_ptr<Trans_t> transient_container =
169 persToTrans(persistent_container, transient_container.get(),
log);
171 return (transient_container.release());