19#include "GaudiKernel/Bootstrap.h"
20#include "GaudiKernel/ISvcLocator.h"
21#include "GaudiKernel/MsgStream.h"
22#include "GaudiKernel/Service.h"
23#include "GaudiKernel/StatusCode.h"
43 using TRANS = InDet::SCT_ClusterContainer;
47 TRANS::const_iterator it_Coll = transCont->begin();
48 TRANS::const_iterator it_CollEnd = transCont->end();
49 unsigned int collIndex;
50 unsigned int chanBegin = 0;
51 unsigned int chanEnd = 0;
52 persCont->
m_collections.resize(transCont->numberOfCollections());
55 for (collIndex = 0; it_Coll != it_CollEnd; ++collIndex, ++it_Coll) {
58 const InDet::SCT_ClusterCollection& collection = (**it_Coll);
60 chanEnd += collection.
size();
62 pcollection.
m_id = collection.identify().get_compact();
63 pcollection.
m_hashId = (
unsigned int) collection.identifyHash();
64 pcollection.
m_begin = chanBegin;
65 pcollection.
m_end = chanEnd;
67 persCont->
m_PRD.resize(chanEnd);
68 for (
unsigned int i = 0; i < collection.size(); ++i) {
96 elements = *sctDetEleHandle;
97 if (not sctDetEleHandle.
isValid() or elements==
nullptr) {
103 InDet::SCT_ClusterCollection* coll =
nullptr;
109 for (
unsigned int icoll = 0; icoll < persCont->
m_collections.size(); ++icoll) {
116 coll =
new InDet::SCT_ClusterCollection(collIDHash);
119 coll->resize(nchans);
122 for (
unsigned int ichan = 0; ichan < nchans; ++ ichan) {
127 (*coll)[ichan] = chan;
132 StatusCode
sc = transCont->addCollection(coll, collIDHash);
133 if (
sc.isFailure()) {
134 throw std::runtime_error(
"Failed to add collection to ID Container");
151 if (this->
initialize(log) != StatusCode::SUCCESS) {
152 log << MSG::FATAL <<
"Could not initialize SCT_ClusterContainerCnv_p1 " <<
endmsg;
155 std::unique_ptr<InDet::SCT_ClusterContainer> trans(std::make_unique<InDet::SCT_ClusterContainer>(
m_sctId->wafer_hash_max()));
157 return(trans.release());
167 SmartIF<StoreGateSvc> detStore{Gaudi::svcLocator()->service(
"DetectorStore")};
168 CHECK( detStore.isValid() );
175 return StatusCode::SUCCESS;
Helpers for checking error return status codes and reporting errors.
#define CHECK(...)
Evaluate an expression and check for errors.
This is an Identifier helper class for the SCT subdetector.
size_type size() const noexcept
Common base class for all TP converters, specialized for a given transient type.
CNV::Trans_t * createTransFromPStore(CNV **cnv, const TPObjRef &ref, MsgStream &log) const
TPObjRef toPersistent(CNV **cnv, const typename CNV::TransBase_t *transObj, MsgStream &log) const
This is a "hash" representation of an Identifier.
Class to hold the SiDetectorElement objects to be put in the detector store.
const SiDetectorElement * getDetectorElement(const IdentifierHash &hash) const
Class to hold geometrical description of a silicon detector element.
std::vector< TPObjRef > m_PRD
std::vector< InDet::InDetPRD_Collection_p1 > m_collections
StatusCode initialize(MsgStream &log)
bool m_useDetectorElement
virtual void persToTrans(const PERS *persCont, TRANS *transCont, MsgStream &log)
ServiceHandle< StoreGateSvc > m_storeGate
virtual InDet::SCT_ClusterContainer * createTransient(const InDet::InDetPRD_Container_p1 *persObj, MsgStream &log)
virtual void transToPers(const TRANS *transCont, PERS *persCont, MsgStream &log)
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection > m_SCTDetEleCollKey
void setUseDetectorElement(const bool useDetectorElement)
InDet::SCT_ClusterContainer TRANS
This class is an object reference used in Athena persistent data model.