18#include "GaudiKernel/ISvcLocator.h"
19#include "GaudiKernel/Bootstrap.h"
20#include "GaudiKernel/StatusCode.h"
21#include "GaudiKernel/Service.h"
22#include "GaudiKernel/MsgStream.h"
42 using TRANS = InDet::PixelClusterContainer;
46 TRANS::const_iterator it_Coll = transCont->begin();
47 TRANS::const_iterator it_CollEnd = transCont->end();
48 unsigned int collIndex;
49 unsigned int chanBegin = 0;
50 unsigned int chanEnd = 0;
51 persCont->
m_collections.resize(transCont->numberOfCollections());
53 for (collIndex = 0; it_Coll != it_CollEnd; ++collIndex, ++it_Coll) {
55 const InDet::PixelClusterCollection& collection = (**it_Coll);
57 chanEnd += collection.
size();
59 pcollection.
m_id = collection.identify().get_compact();
60 pcollection.
m_hashId = (
unsigned int) collection.identifyHash();
61 pcollection.
m_begin = chanBegin;
62 pcollection.
m_end = chanEnd;
64 persCont->
m_PRD.resize(chanEnd);
65 for (
unsigned int i = 0; i < collection.size(); ++i) {
94 if (not pixelDetEleHandle.
isValid() or theseElements==
nullptr) {
100 InDet::PixelClusterCollection* coll =
nullptr;
105 for (
unsigned int icoll = 0; icoll < persCont->
m_collections.size(); ++icoll) {
111 coll =
new InDet::PixelClusterCollection(collIDHash);
114 coll->resize(nchans);
117 for (
unsigned int ichan = 0; ichan < nchans; ++ ichan) {
122 (*coll)[ichan] = chan;
124 log << MSG::WARNING <<
"Cast to InDet::PixelCluster* failed in PixelClusterContainerCnv_p1" <<
endmsg;
129 StatusCode
sc = transCont->addCollection(coll, collIDHash);
130 if (
sc.isFailure()) {
131 throw std::runtime_error(
"Failed to add collection to ID Container");
144 if (this->
initialize(log) != StatusCode::SUCCESS) {
145 log << MSG::FATAL <<
"Could not initialize PixelClusterContainerCnv_p1 " <<
endmsg;
150 log << MSG::FATAL <<
"PixelID helper is null in PixelClusterContainerCnv_p1::createTransient" <<
endmsg;
153 std::unique_ptr<InDet::PixelClusterContainer> trans(std::make_unique<InDet::PixelClusterContainer>(
m_pixId->wafer_hash_max()));
155 return(trans.release());
166 SmartIF<StoreGateSvc> detStore{Gaudi::svcLocator()->service(
"DetectorStore")};
167 CHECK( detStore.isValid() );
174 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 Pixel 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.
Class to hold geometrical description of a silicon detector element.
std::vector< TPObjRef > m_PRD
std::vector< InDet::InDetPRD_Collection_p1 > m_collections
virtual void transToPers(const TRANS *transCont, PERS *persCont, MsgStream &log)
virtual InDet::PixelClusterContainer * createTransient(const InDet::InDetPRD_Container_p1 *persObj, MsgStream &log)
InDet::PixelClusterContainer TRANS
ServiceHandle< StoreGateSvc > m_storeGate
void setUseDetectorElement(const bool useDetectorElement)
StatusCode initialize(MsgStream &log)
bool m_useDetectorElement
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection > m_pixelDetEleCollKey
virtual void persToTrans(const PERS *persCont, TRANS *transCont, MsgStream &log)
This class is an object reference used in Athena persistent data model.