7#include "Identifier/Identifier.h"
20#include "GaudiKernel/ISvcLocator.h"
21#include "GaudiKernel/Bootstrap.h"
22#include "GaudiKernel/StatusCode.h"
23#include "GaudiKernel/Service.h"
24#include "GaudiKernel/MsgStream.h"
43 using TRANS = InDet::PixelClusterContainer;
47 unsigned int idLast(0);
51 TRANS::const_iterator it_Coll = transCont->begin();
52 TRANS::const_iterator it_CollEnd = transCont->end();
53 unsigned int collIndex;
54 unsigned int chanBegin = 0;
55 unsigned int chanEnd = 0;
56 persCont->
m_collections.resize(transCont->numberOfCollections());
58 for (collIndex = 0; it_Coll != it_CollEnd; ++collIndex, ++it_Coll) {
60 const InDet::PixelClusterCollection& collection = (**it_Coll);
62 chanEnd += collection.
size();
64 unsigned int deltaId = (collection.identifyHash()-idLast);
74 idLast=collection.identifyHash();
75 pcollection.
m_size = collection.size();
78 log << MSG::VERBOSE <<
"Reading collections with " << collection.size() <<
"PRDs " <<
endmsg;
79 for (
unsigned int i = 0; i < collection.size(); ++i) {
108 elements = *pixelDetEleHandle;
109 if (not pixelDetEleHandle.
isValid() or elements==
nullptr) {
115 InDet::PixelClusterCollection* coll =
nullptr;
118 unsigned int collBegin(0);
121 unsigned int idLast(0);
123 for (
unsigned int icoll = 0; icoll < persCont->
m_collections.size(); ++icoll) {
132 coll =
new InDet::PixelClusterCollection(collIDHash);
134 unsigned int nchans = pcoll.
m_size;
135 coll->resize(nchans);
141 for (
unsigned int ichan = 0; ichan < nchans; ++ ichan) {
145 chan->setDetectorElement(de);
147 chan->setHashAndIndex(collIDHash, ichan);
148 (*coll)[ichan] = chan;
150 collBegin += pcoll.
m_size;
153 StatusCode
sc = transCont->addCollection(coll, collIDHash);
154 if (
sc.isFailure()) {
155 throw std::runtime_error(
"Failed to add collection to ID Container");
170 if (this->
initialize(log) != StatusCode::SUCCESS) {
171 log << MSG::FATAL <<
"Could not initialize PixelClusterContainerCnv_p2 " <<
endmsg;
175 log << MSG::FATAL <<
"nullptr for m_pixId in PixelClusterContainerCnv_p2::createTransient" <<
endmsg;
178 std::unique_ptr<InDet::PixelClusterContainer> trans(std::make_unique<InDet::PixelClusterContainer>(
m_pixId->wafer_hash_max()));
180 return(trans.release());
189 SmartIF<StoreGateSvc> detStore{Gaudi::svcLocator()->service(
"DetectorStore")};
190 CHECK( detStore.isValid() );
197 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_p2 > m_rawdata
void transToPers(const InDet::PixelCluster *, InDet::PixelCluster_p2 *, MsgStream &)
void persToTrans(const InDet::PixelCluster_p2 *, InDet::PixelCluster *, MsgStream &)
virtual void persToTrans(const InDet::PixelClusterContainer_p2 *persCont, InDet::PixelClusterContainer *transCont, MsgStream &log)
virtual InDet::PixelClusterContainer * createTransient(const InDet::PixelClusterContainer_p2 *persObj, MsgStream &log)
virtual void transToPers(const InDet::PixelClusterContainer *transCont, InDet::PixelClusterContainer_p2 *persCont, MsgStream &log)
bool m_useDetectorElement
StatusCode initialize(MsgStream &log)
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection > m_pixelDetEleCollKey
void setUseDetectorElement(const bool useDetectorElement)