ATLAS Offline Software
SCT_ClusterContainerCnv.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 #include "MsgUtil.h"
8 
10 #include "StoreGate/StoreGateSvc.h"
11 
12 #include <iostream>
13 #include <memory>
14 
16  : SCT_ClusterContainerCnvBase(svcloc, "SCT_ClusterContainerCnv"),
17  m_converter_p0()
18  {}
19 
20 
22  ATH_MSG_INFO("SCT_ClusterContainerCnv::initialize()");
23 
25 
26  // Get the SCT helper from the detector store
27  const SCT_ID* idhelper(nullptr);
28  ATH_CHECK( detStore()->retrieve(idhelper, "SCT_ID") );
29 
31 
32  ATH_MSG_DEBUG("Converter initialized");
33 
34  return StatusCode::SUCCESS;
35 }
36 
37 
39  // MsgStream log(msgSvc(), "SCT_ClusterContainerCnv" );
40  static const pool::Guid p0_guid("A180F372-0D52-49C3-8AA0-0939CB0B8179"); // before t/p split
41  static const pool::Guid p1_guid("657F6546-F5CD-4166-9567-16AD9C96D286"); // with SCT_Cluster_tlp1
42  static const pool::Guid p2_guid("ECE7D831-0F31-4E6F-A6BE-2ADDE90083BA"); // with SCT_Cluster_p2
43  static const pool::Guid p3_guid("623F5836-369F-4A94-9DD4-DAD728E93C13"); // with SCT_Cluster_p3
44 
45  //ATH_MSG_DEBUG("createTransient(): main converter");
46  InDet::SCT_ClusterContainer* p_collection(nullptr);
47  if ( compareClassGuid(p3_guid) ) {
48  //ATH_MSG_DEBUG("createTransient(): T/P version 3 detected");
49  std::unique_ptr< SCT_ClusterContainer_PERS > p_coll( poolReadObject< SCT_ClusterContainer_PERS >() );
50  p_collection = m_TPConverter_p3.createTransient( p_coll.get(), msg() );
51 
52  } else if ( compareClassGuid(p1_guid) ) {
53  //ATH_MSG_DEBUG("createTransient(): T/P version 1 detected");
54  std::unique_ptr< InDet::SCT_ClusterContainer_tlp1 > p_coll( poolReadObject< InDet::SCT_ClusterContainer_tlp1 >() );
55  p_collection = m_TPConverter.createTransient( p_coll.get(), msg() );
56 
57  } else if ( compareClassGuid(p2_guid) ) {
58  //ATH_MSG_DEBUG("createTransient(): T/P version 2 detected");
59  std::unique_ptr< InDet::SCT_ClusterContainer_p2 > p_coll( poolReadObject< InDet::SCT_ClusterContainer_p2 >() );
60  p_collection = m_TPConverter_p2.createTransient( p_coll.get(), msg() );
61 
62  } else if ( compareClassGuid(p0_guid) ) {
63  //ATH_MSG_DEBUG("createTransient(): Old input file");
64  std::unique_ptr< SCT_ClusterContainer_p0 > col_vect( poolReadObject< SCT_ClusterContainer_p0 >() );
65  p_collection = m_converter_p0.createTransient( col_vect.get(), msg() );
66 
67  } else {
68  throw std::runtime_error("Unsupported persistent version of SCT_ClusterContainer");
69 
70  }
71  return p_collection;
72 }
73 
74 
77  return sctdc_p;
78 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
SCT_ClusterContainerCnv_p0::initialize
StatusCode initialize(MsgStream &log)
Definition: SCT_ClusterContainerCnv_p0.cxx:35
SCT_ID.h
This is an Identifier helper class for the SCT subdetector. This class is a factory for creating comp...
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
SCT_ClusterContainerCnv::m_TPConverter_p3
SCT_ClusterContainerCnv_p3 m_TPConverter_p3
Definition: SCT_ClusterContainerCnv.h:35
InDet::SCT_ClusterContainer
Trk::PrepRawDataContainer< SCT_ClusterCollection > SCT_ClusterContainer
Definition: SCT_ClusterContainer.h:27
SCT_ClusterContainerCnv.h
TPAbstractPolyCnvBase::createPersistent
virtual PERS * createPersistent(const TRANS *transObj, MsgStream &log)
Create persistent representation of a transient object.
SCT_ClusterContainerCnv::m_converter_p0
SCT_ClusterContainerCnv_p0 m_converter_p0
Definition: SCT_ClusterContainerCnv.h:33
SCT_ClusterContainerCnv::SCT_ClusterContainerCnv
SCT_ClusterContainerCnv(ISvcLocator *svcloc)
Definition: SCT_ClusterContainerCnv.cxx:15
pool::Guid
::Guid Guid
Definition: T_AthenaPoolCustCnv.h:19
SCT_ClusterContainerCnv::initialize
virtual StatusCode initialize() override
Gaudi Service Interface method implementations:
Definition: SCT_ClusterContainerCnv.cxx:21
TopLevelTPConverter::createTransient
TRANS * createTransient(MsgStream &log)
Create transient representation of the persistent object known to this converter.
Definition: TopLevelTPConverter.h:62
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
SCT_ClusterContainerCnv_p0::createTransient
virtual InDet::SCT_ClusterContainer * createTransient(const SCT_ClusterContainer_p0 *, MsgStream &) override
Definition: SCT_ClusterContainerCnv_p0.h:34
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
SCT_ClusterContainerCnv::createPersistent
virtual SCT_ClusterContainer_PERS * createPersistent(InDet::SCT_ClusterContainer *transCont) override
Definition: SCT_ClusterContainerCnv.cxx:75
SCT_ClusterContainerCnv::createTransient
virtual InDet::SCT_ClusterContainer * createTransient() override
Definition: SCT_ClusterContainerCnv.cxx:38
SCT_ClusterContainerCnv::m_TPConverter
SCT_ClusterContainerCnv_tlp1 m_TPConverter
Definition: SCT_ClusterContainerCnv.h:34
AthenaPoolConverter::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
Handle to DetectorStore.
Definition: AthenaPoolConverter.h:69
AthMessaging::msg
MsgStream & msg() const
The standard message stream.
Definition: AthMessaging.h:164
SCT_ClusterContainerCnv_p2::createTransient
virtual InDet::SCT_ClusterContainer * createTransient(const InDet::SCT_ClusterContainer_p2 *persObj, MsgStream &log)
Definition: SCT_ClusterContainerCnv_p2.cxx:195
SCT_ID
Definition: SCT_ID.h:68
InDet::SCT_ClusterContainer_p3
Definition: SCT_ClusterContainer_p3.h:23
T_AthenaPoolCustCnv::compareClassGuid
virtual bool compareClassGuid(const Guid &clid) const
Compare POOL class GUID with the one of the object being read.
T_AthenaPoolCustCnv::initialize
virtual StatusCode initialize()
Gaudi Service Interface method implementations:
SCT_ClusterContainerCnv::m_TPConverter_p2
SCT_ClusterContainerCnv_p2 m_TPConverter_p2
Definition: SCT_ClusterContainerCnv.h:36
SCT_ClusterContainerCnv_p3::createTransient
virtual InDet::SCT_ClusterContainer * createTransient(const InDet::SCT_ClusterContainer_p3 *persObj, MsgStream &log)
Definition: SCT_ClusterContainerCnv_p3.cxx:199
StoreGateSvc.h
MsgUtil.h