ATLAS Offline Software
Loading...
Searching...
No Matches
SCT_ClusterContainerCnv_p0.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7#include "MsgUtil.h"
8
9// Athena
14
15// Gaudi
16#include "GaudiKernel/Bootstrap.h"
17#include "GaudiKernel/ISvcLocator.h"
18#include "GaudiKernel/Service.h"
19
20#include <string>
21
22//================================================================
23
24
26 m_sctId{nullptr},
27 m_SCTDetEleCollKey{"SCT_DetectorElementCollection"}
28{
29}
30
31StatusCode SCT_ClusterContainerCnv_p0::initialize(MsgStream& log ) {
32
33 log << MSG::INFO << "SCT_ClusterContainerCnv::initialize()" << endmsg;
34
35 SmartIF<StoreGateSvc> detStore{Gaudi::svcLocator()->service("DetectorStore")};
36 CHECK( detStore.isValid() );
37
38 CHECK( detStore->retrieve(m_sctId, "SCT_ID") );
39 CHECK( m_SCTDetEleCollKey.initialize() );
40 MSG_DEBUG(log,"Converter initialized.");
41
42 return StatusCode::SUCCESS;
43}
44
45InDet::SCT_ClusterContainer* SCT_ClusterContainerCnv_p0::createTransient(SCT_ClusterContainer_p0* persObj, MsgStream& log) {
46
47 auto trans = std::make_unique<InDet::SCT_ClusterContainer>(m_sctId->wafer_hash_max());
48 // MSG_DEBUG(log,"Read PRD vector, size " << persObj->size());
49
51 const InDetDD::SiDetectorElementCollection* elements(*sctDetEleHandle);
52 if (not sctDetEleHandle.isValid() or elements==nullptr) {
53 log << MSG::FATAL << m_SCTDetEleCollKey.fullKey() << " is not available." << endmsg;
54 return trans.release();
55 }
56
57 for (InDet::SCT_ClusterCollection* dcColl : *persObj) {
58 // Add detElem to each drift circle
59 IdentifierHash collHash = dcColl->identifyHash();
60 const InDetDD::SiDetectorElement * de = elements->getDetectorElement(collHash);
61
62 InDet::SCT_ClusterCollection::iterator itColl = dcColl->begin();
63 InDet::SCT_ClusterCollection::iterator lastColl = dcColl->end();
64 for (; itColl != lastColl; ++itColl) {
65 (*itColl)->m_detEl = de;
66 }
67
68 StatusCode sc= trans->addCollection(dcColl, collHash);
69 if (sc.isSuccess()){
70 } else {
71 log << MSG::ERROR << "Failed to add SCT_ClusterContainer to container" << endmsg;
72 return nullptr;
73 }
74 }
75 return trans.release();
76}
#define endmsg
Helpers for checking error return status codes and reporting errors.
#define CHECK(...)
Evaluate an expression and check for errors.
static Double_t sc
#define MSG_DEBUG(log, x)
Definition MsgUtil.h:16
DataVector< Trk::PrepRawDataCollection< InDet::SCT_Cluster > > SCT_ClusterContainer_p0
This is an Identifier helper class for the SCT subdetector.
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.
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection > m_SCTDetEleCollKey
virtual InDet::SCT_ClusterContainer * createTransient(const SCT_ClusterContainer_p0 *, MsgStream &) override
StatusCode initialize(MsgStream &log)