ATLAS Offline Software
PixelClusterContainerCnv.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
8 
9 #include <memory>
10 
11 #include <iostream>
12 
14  : PixelClusterContainerCnvBase(svcloc, "PixelClusterContainerCnv"),
15  m_converter_p0(),
16  m_storeGate(nullptr)
17  {}
18 
19 
21  ATH_MSG_INFO("PixelClusterContainerCnv::initialize()");
22 
24  if (sc.isFailure()) {
25  ATH_MSG_FATAL("Cannot initialize cnv base !");
26  return StatusCode::FAILURE;
27  }
28 
29  // get StoreGate service. This is needed only for clients
30  // that register collections directly to the SG instead of adding
31  // them to the container.
32  sc = service("StoreGateSvc", m_storeGate);
33  if (sc.isFailure()) {
34  ATH_MSG_FATAL("StoreGate service not found !");
35  return StatusCode::FAILURE;
36  }
37 
38  // get DetectorStore service
39  StoreGateSvc *detStore(nullptr);
40  if (service("DetectorStore", detStore).isFailure()) {
41  ATH_MSG_FATAL("DetectorStore service not found !");
42  return StatusCode::FAILURE;
43  } else {
44  ATH_MSG_DEBUG("Found DetectorStore.");
45  }
46 
47  // Get the pixel helper from the detector store
48  const PixelID* idhelper(nullptr);
49  if (detStore->retrieve(idhelper, "PixelID").isFailure()) {
50  ATH_MSG_FATAL("Could not get PixelID helper !");
51  return StatusCode::FAILURE;
52  } else {
53  ATH_MSG_DEBUG("Found the PixelID helper.");
54  }
55 
56  if (m_converter_p0.initialize(msg()).isFailure())
57  {
58  ATH_MSG_FATAL("Could not initialize converter!");
59  return StatusCode::FAILURE;
60  }
61 
62  ATH_MSG_DEBUG("Converter initialized");
63 
64  return StatusCode::SUCCESS;
65 }
66 
67 
69  static const pool::Guid p0_guid("37B00A31-EA80-45DF-9A3F-2721EC0F0DA6"); // before t/p split
70  static const pool::Guid p1_guid("9DB54746-8C4E-4A56-8B4C-0E5D42905218"); // with PixelCluster_tlp1
71  static const pool::Guid p2_guid("DE48E26B-9E03-4EAD-86B9-351AD88D060E"); // with pixelCluster_p2
72  static const pool::Guid p3_guid("7BF0F163-B227-434C-86A6-16130E005E6C"); // with pixelCluster_p3
73  ATH_MSG_DEBUG("createTransient(): main converter");
74  InDet::PixelClusterContainer* p_collection(nullptr);
75  if( compareClassGuid(p3_guid) ) {
76  ATH_MSG_DEBUG("createTransient(): T/P version 3 detected");
77  std::unique_ptr< InDet::PixelClusterContainer_p3 > p_coll( poolReadObject< InDet::PixelClusterContainer_p3 >() );
78  p_collection = m_converter_p3.createTransient( p_coll.get(), msg() );
79  } else if( compareClassGuid(p2_guid) ) {
80  ATH_MSG_DEBUG("createTransient(): T/P version 2 detected");
81  std::unique_ptr< InDet::PixelClusterContainer_p2 > p_coll( poolReadObject< InDet::PixelClusterContainer_p2 >() );
82  p_collection = m_converter_p2.createTransient( p_coll.get(), msg() );
83  } else if( compareClassGuid(p1_guid) ) {
84  ATH_MSG_DEBUG("createTransient(): T/P version 1 detected");
85  std::unique_ptr< InDet::PixelClusterContainer_tlp1 > p_coll( poolReadObject< InDet::PixelClusterContainer_tlp1 >() );
86  p_collection = m_TPConverter.createTransient( p_coll.get(), msg() );
87  }
88  //----------------------------------------------------------------
89  else if( compareClassGuid(p0_guid) ) {
90  ATH_MSG_DEBUG("createTransient(): Old input file");
91 
92  std::unique_ptr< PixelClusterContainer_p0 > col_vect( poolReadObject< PixelClusterContainer_p0 >() );
93  p_collection = m_converter_p0.createTransient( col_vect.get(), msg() );
94  }
95  else {
96  throw std::runtime_error("Unsupported persistent version of PixelClusterContainer");
97 
98  }
99  return p_collection;
100 }
101 
102 
105  return pixdc_p;
106 }
107 
108 
PixelID.h
This is an Identifier helper class for the Pixel subdetector. This class is a factory for creating co...
PixelClusterContainerCnv::m_storeGate
StoreGateSvc * m_storeGate
Definition: PixelClusterContainerCnv.h:43
PixelClusterContainerCnv::createTransient
virtual InDet::PixelClusterContainer * createTransient()
Definition: PixelClusterContainerCnv.cxx:68
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
PixelClusterContainerCnv::m_TPConverter
PixelClusterContainerCnv_tlp1 m_TPConverter
Definition: PixelClusterContainerCnv.h:40
InDet::PixelClusterContainer
Trk::PrepRawDataContainer< PixelClusterCollection > PixelClusterContainer
Definition: InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/PixelClusterContainer.h:28
TPAbstractPolyCnvBase::createPersistent
virtual PERS * createPersistent(const TRANS *transObj, MsgStream &log)
Create persistent representation of a transient object.
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
PixelClusterContainerCnv_p0::createTransient
virtual InDet::PixelClusterContainer * createTransient(const PixelClusterContainer_p0 *, MsgStream &) override
Definition: PixelClusterContainerCnv_p0.h:32
PixelClusterContainerCnv.h
PixelClusterContainerCnv_p2::createTransient
virtual InDet::PixelClusterContainer * createTransient(const InDet::PixelClusterContainer_p2 *persObj, MsgStream &log)
Definition: PixelClusterContainerCnv_p2.cxx:168
PixelClusterContainerCnv_p0::initialize
StatusCode initialize(MsgStream &log)
Definition: PixelClusterContainerCnv_p0.cxx:33
pool::Guid
::Guid Guid
Definition: T_AthenaPoolCustCnv.h:19
StoreGateSvc
The Athena Transient Store API.
Definition: StoreGateSvc.h:128
PixelClusterContainerCnv::initialize
virtual StatusCode initialize()
Gaudi Service Interface method implementations:
Definition: PixelClusterContainerCnv.cxx:20
TopLevelTPConverter::createTransient
TRANS * createTransient(MsgStream &log)
Create transient representation of the persistent object known to this converter.
Definition: TopLevelTPConverter.h:62
PixelClusterContainerCnv::m_converter_p2
PixelClusterContainerCnv_p2 m_converter_p2
Definition: PixelClusterContainerCnv.h:38
T_AthenaPoolCustomCnv
Compatibility for old converter classes that don't get passed the key.
Definition: T_AthenaPoolCustomCnv.h:132
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
PixelClusterContainerCnv::m_converter_p0
PixelClusterContainerCnv_p0 m_converter_p0
Definition: PixelClusterContainerCnv.h:37
AthMessaging::msg
MsgStream & msg() const
The standard message stream.
Definition: AthMessaging.h:164
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
PixelClusterContainerCnv_p3::createTransient
virtual InDet::PixelClusterContainer * createTransient(const InDet::PixelClusterContainer_p3 *persObj, MsgStream &log)
Definition: PixelClusterContainerCnv_p3.cxx:187
PixelClusterContainerCnv::createPersistent
virtual PixelClusterContainer_PERS * createPersistent(InDet::PixelClusterContainer *transCont)
Definition: PixelClusterContainerCnv.cxx:103
PixelClusterContainerCnv::PixelClusterContainerCnv
PixelClusterContainerCnv(ISvcLocator *svcloc)
Definition: PixelClusterContainerCnv.cxx:13
T_AthenaPoolCustCnv::compareClassGuid
virtual bool compareClassGuid(const Guid &clid) const
Compare POOL class GUID with the one of the object being read.
PixelClusterContainerCnv::m_converter_p3
PixelClusterContainerCnv_p3 m_converter_p3
Definition: PixelClusterContainerCnv.h:39
InDet::PixelClusterContainer_p3
Definition: PixelClusterContainer_p3.h:21
T_AthenaPoolCustCnv::initialize
virtual StatusCode initialize()
Gaudi Service Interface method implementations:
PixelID
Definition: PixelID.h:67
StoreGateSvc.h