9#include "Identifier/Identifier.h"
21#include "GaudiKernel/Bootstrap.h"
22#include "GaudiKernel/ISvcLocator.h"
23#include "GaudiKernel/MsgStream.h"
24#include "GaudiKernel/Service.h"
25#include "GaudiKernel/StatusCode.h"
44 using TRANS = InDet::PixelClusterContainer;
48 unsigned int idLast(0);
53 if (this->
initialize(log) != StatusCode::SUCCESS) {
54 log << MSG::FATAL <<
"Could not initialize PixelClusterContainerCnv_p3 " <<
endmsg;
59 TRANS::const_iterator it_Coll = transCont->begin();
60 TRANS::const_iterator it_CollEnd = transCont->end();
61 unsigned int collIndex;
62 unsigned int chanBegin = 0;
63 unsigned int chanEnd = 0;
64 persCont->
m_collections.resize(transCont->numberOfCollections());
66 for (collIndex = 0; it_Coll != it_CollEnd; ++collIndex, ++it_Coll) {
68 const InDet::PixelClusterCollection& collection = (**it_Coll);
70 chanEnd += collection.
size();
72 unsigned int deltaId = (collection.identifyHash()-idLast);
82 idLast=collection.identifyHash();
83 pcollection.
m_size = collection.size();
87 for (
unsigned int i = 0; i < collection.size(); ++i) {
117 elements = pixelDetEleHandle1.
cptr();
123 elements = pixelDetEleHandle2.
cptr();
125 log << MSG::FATAL <<
"No valid Pixel detector element collection keys available." <<
endmsg;
131 InDet::PixelClusterCollection* coll =
nullptr;
135 unsigned int collBegin(0);
138 unsigned int idLast(0);
140 for (
unsigned int icoll = 0; icoll < persCont->
m_collections.size(); ++icoll) {
149 coll =
new InDet::PixelClusterCollection(collIDHash);
151 unsigned int nchans = pcoll.
m_size;
152 coll->resize(nchans);
158 for (
unsigned int ichan = 0; ichan < nchans; ++ ichan) {
166 chan->setHashAndIndex(collIDHash, ichan);
167 (*coll)[ichan] = chan;
169 collBegin += pcoll.
m_size;
172 StatusCode
sc = transCont->addCollection(coll, collIDHash);
173 if (
sc.isFailure()) {
174 throw std::runtime_error(
"Failed to add collection to ID Container");
190 if (this->
initialize(log) != StatusCode::SUCCESS) {
191 log << MSG::FATAL <<
"Could not initialize PixelClusterContainerCnv_p3 " <<
endmsg;
195 log << MSG::FATAL <<
"nullptr for m_pixId in PixelClusterContainerCnv_p3::createTransient" <<
endmsg;
198 std::unique_ptr<InDet::PixelClusterContainer> trans(std::make_unique<InDet::PixelClusterContainer>(
m_pixId->wafer_hash_max()));
200 return(trans.release());
209 SmartIF<StoreGateSvc> detStore{Gaudi::svcLocator()->service(
"DetectorStore")};
210 CHECK( detStore.isValid() );
218 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
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< InDet::InDetPRD_Collection_p2 > m_collections
std::vector< InDet::PixelCluster_p3 > m_rawdata
InDet::PixelCluster createPixelCluster(const InDet::PixelCluster_p3 *persObj, const Identifier &waferId, const InDetDD::SiDetectorElement *delEl, MsgStream &log)
void transToPers(const InDet::PixelCluster *, InDet::PixelCluster_p3 *, MsgStream &)
virtual void transToPers(const InDet::PixelClusterContainer *transCont, InDet::PixelClusterContainer_p3 *persCont, MsgStream &log)
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection > m_pixelITkEleCollKey
void setUseDetectorElement(const bool useDetectorElement)
StatusCode initialize(MsgStream &log)
bool m_useDetectorElement
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection > m_pixelDetEleCollKey
virtual InDet::PixelClusterContainer * createTransient(const InDet::PixelClusterContainer_p3 *persObj, MsgStream &log)
virtual void persToTrans(const InDet::PixelClusterContainer_p3 *persCont, InDet::PixelClusterContainer *transCont, MsgStream &log)
Exception — Can't retrieve CondCont from ReadCondHandle.
const_pointer_type cptr()