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);
75 idLast=collection.identifyHash();
76 pcollection.
m_size = collection.size();
79 for (
unsigned int i = 0; i < collection.size(); ++i) {
108 elements = pixelDetEleHandle1.
cptr();
114 elements = pixelDetEleHandle2.
cptr();
116 log << MSG::FATAL <<
"No valid Pixel detector element collection keys available." <<
endmsg;
122 InDet::PixelClusterCollection* coll =
nullptr;
126 unsigned int collBegin(0);
129 unsigned int idLast(0);
131 for (
unsigned int icoll = 0; icoll < persCont->
m_collections.size(); ++icoll) {
140 coll =
new InDet::PixelClusterCollection(collIDHash);
142 unsigned int nchans = pcoll.
m_size;
143 coll->resize(nchans);
149 for (
unsigned int ichan = 0; ichan < nchans; ++ ichan) {
157 chan->setHashAndIndex(collIDHash, ichan);
158 (*coll)[ichan] = chan;
160 collBegin += pcoll.
m_size;
163 StatusCode
sc = transCont->addCollection(coll, collIDHash);
164 if (
sc.isFailure()) {
165 throw std::runtime_error(
"Failed to add collection to ID Container");
181 if (this->
initialize(log) != StatusCode::SUCCESS) {
182 log << MSG::FATAL <<
"Could not initialize PixelClusterContainerCnv_p3 " <<
endmsg;
186 log << MSG::FATAL <<
"nullptr for m_pixId in PixelClusterContainerCnv_p3::createTransient" <<
endmsg;
189 std::unique_ptr<InDet::PixelClusterContainer> trans(std::make_unique<InDet::PixelClusterContainer>(
m_pixId->wafer_hash_max()));
191 return(trans.release());
200 SmartIF<StoreGateSvc> detStore{Gaudi::svcLocator()->service(
"DetectorStore")};
201 CHECK( detStore.isValid() );
209 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()