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")};
33 CHECK( detStore.isValid() );
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 "
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);
76 if (log.level() <= MSG::VERBOSE) {
77 log << MSG::VERBOSE <<
"Reading RDO collections size of "
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));
92 rdo_converter.
transToPers(trans_rdo, pers_rdo, log);
95 collection_separator_index_begin += collection.
size();
98 if (log.level() <= MSG::DEBUG) {
100 <<
"Writing HGTD_ClusterContainer to HGTD_ClusterContainer_p1 done"
109 const Pers_t* persistent_container,
Trans_t* transient_container,
113 if (this->
initialize(log) != StatusCode::SUCCESS) {
114 log << MSG::FATAL <<
"Could not initialize HGTD_RDO_ContainerCnv_p1 "
119 std::unique_ptr<HGTD_RDO_Collection> collection =
nullptr;
122 size_t collection_separator_index_begin = 0;
124 for (
size_t coll_i = 0;
132 collection = std::make_unique<HGTD_RDO_Collection>(coll_idhash);
133 collection->setIdentifier(coll_id);
135 unsigned short n_clusters = rdo_coll.
m_size;
136 collection->resize(n_clusters);
137 for (
unsigned short rdo_i = 0; rdo_i < n_clusters; ++rdo_i) {
140 .at(rdo_i + collection_separator_index_begin));
144 rdo_converter.
persToTrans(pers_rdo, trans_rdo, log);
145 (*collection).at(rdo_i) = trans_rdo;
147 collection_separator_index_begin += n_clusters;
150 transient_container->
addCollection(collection.release(), coll_idhash);
151 if (
sc.isFailure()) {
152 throw std::runtime_error(
"Failed to add collection to ID Container");
159 const Pers_t* persistent_container, MsgStream& log) {
162 if (this->
initialize(log) != StatusCode::SUCCESS) {
163 log << MSG::FATAL <<
"Could not initialize HGTD_RDO_ContainerCnv_p1 "
168 std::unique_ptr<Trans_t> transient_container =
171 persToTrans(persistent_container, transient_container.get(), log);
173 return (transient_container.release());
Helpers for checking error return status codes and reporting errors.
#define CHECK(...)
Evaluate an expression and check for errors.
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration.
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration.
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration.
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration.
const T * at(size_type n) const
Access an element, as an rvalue.
size_type size() const noexcept
Returns the number of elements in the collection.
void transToPers(const HGTD_RDO *trans_obj, HGTD_RDO_p1 *pers_obj, MsgStream &log)
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration.
void persToTrans(const HGTD_RDO_p1 *pers_obj, HGTD_RDO *trans_obj, MsgStream &log)
const IdentifierHash & identifierHash() const
HGTD_RDO_Container_p1 Pers_t
virtual void transToPers(const Trans_t *transient_container, Pers_t *persistent_container, MsgStream &log)
virtual Trans_t * createTransient(const Pers_t *persistent_container, MsgStream &log)
StatusCode initialize(MsgStream &log)
HGTD_RDO_Container Trans_t
const HGTD_ID * m_hgtd_idhelper
virtual void persToTrans(const Pers_t *persistent_container, Trans_t *transient_container, MsgStream &log)
std::vector< HGTD_RDO_p1 > m_rdo_list
std::vector< HGTD_RDO_Collection_p1 > m_collection_separator
virtual size_t numberOfCollections() const override final
return number of collections
virtual StatusCode addCollection(const T *coll, IdentifierHash hashId) override final
insert collection into container with id hash if IDC should not take ownership of collection,...
const_iterator begin() const
return const_iterator for first entry
This is a "hash" representation of an Identifier.