12#include "GaudiKernel/ISvcLocator.h"
13#include "GaudiKernel/MsgStream.h"
14#include "GaudiKernel/StatusCode.h"
23#include "Identifier/Identifier.h"
32 ISvcLocator* svcLocator = Gaudi::svcLocator();
35 SmartIF<StoreGateSvc> detStore{svcLocator->service(
"DetectorStore")};
36 CHECK( detStore.isValid() );
41 return StatusCode::SUCCESS;
45 const Trans_t* transient_container,
Pers_t* persistent_container,
64 if (this->
initialize(log) != StatusCode::SUCCESS) {
65 log << MSG::FATAL <<
"Could not initialize HGTD_ClusterContainerCnv_p1 "
76 size_t collection_separator_index_begin = 0;
77 size_t total_n_clusters = 0;
79 for (
size_t coll_i = 0; coll_i < n_collections; coll_i++, ++container_itr) {
82 size_t collection_size = collection.
size();
91 total_n_clusters += collection_size;
94 if (log.level() <= MSG::VERBOSE) {
95 log << MSG::VERBOSE <<
"Reading collections with " << collection_size
99 for (
size_t clus_i = 0; clus_i < collection_size; clus_i++) {
103 .at(clus_i + collection_separator_index_begin));
108 cluster_converter.
transToPers(trans_clus, pers_clus, log);
111 collection_separator_index_begin += collection.
size();
114 if (log.level() <= MSG::DEBUG) {
116 <<
"Writing HGTD_ClusterContainer to HGTD_ClusterContainer_p1 done"
125 const Pers_t* persistent_container,
Trans_t* transient_container,
132 size_t collection_separator_index_begin = 0;
134 for (
size_t coll_i = 0;
147 unsigned short n_clusters = prd_coll.
m_size;
148 collection->
resize(n_clusters);
150 for (
unsigned short clus_i = 0; clus_i < n_clusters; ++clus_i) {
153 .at(clus_i + collection_separator_index_begin));
160 (*collection).at(clus_i) = trans_cluster;
162 collection_separator_index_begin += n_clusters;
164 StatusCode
sc = transient_container->
addCollection(collection, coll_idhash);
165 if (
sc.isFailure()) {
166 throw std::runtime_error(
"Failed to add collection to ID Container");
175 const Pers_t* persistent_container, MsgStream& log) {
178 if (this->
initialize(log) != StatusCode::SUCCESS) {
179 log << MSG::FATAL <<
"Could not initialize HGTD_ClusterContainerCnv_p1 "
184 std::unique_ptr<Trans_t> transient_container =
187 persToTrans(persistent_container, transient_container.get(), log);
189 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-2021 CERN for the benefit of the ATLAS collaboration.
Trk::PrepRawDataCollection< HGTD_Cluster > HGTD_ClusterCollection
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration.
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration.
Trk::PrepRawDataContainer< HGTD_ClusterCollection > HGTD_ClusterContainer
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration.
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration.
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration.
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration.
void resize(size_type sz)
const PrepRawDataT * at(size_type n) const
size_type size() const noexcept
HGTD_Cluster createHGTDCluster(const HGTD_Cluster_p1 *pers_obj, const InDetDD::SolidStateDetectorElementBase *delEl, MsgStream &log)
void transToPers(const HGTD_Cluster *, HGTD_Cluster_p1 *, MsgStream &)
HGTD_ClusterContainer Trans_t
virtual void persToTrans(const Pers_t *persistent_container, Trans_t *transient_container, MsgStream &log)
HGTD_ClusterContainer_p1 Pers_t
virtual void transToPers(const Trans_t *transient_container, Pers_t *persistent_container, MsgStream &log)
const HGTD_ID * m_hgtd_idhelper
virtual Trans_t * createTransient(const Pers_t *persistent_container, MsgStream &log)
StatusCode initialize(MsgStream &log)
std::vector< HGTD_Cluster_p1 > m_cluster_list
std::vector< HGTD_PRD_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.
virtual IdentifierHash identifyHash() const override final
void setIdentifier(Identifier id)
void setHashAndIndex(unsigned short collHash, unsigned short objIndex)
TEMP for testing: might make some classes friends later ...