ATLAS Offline Software
Loading...
Searching...
No Matches
TGCSimHitCollectionCnv.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// Gaudi
8#include "GaudiKernel/StatusCode.h"
9#include "GaudiKernel/MsgStream.h"
10
11// Athena
13
20#include "HitManagement/AthenaHitsVector.h" //for back-compatibility
21
22
27
29
31 MsgStream log(msgSvc(), "TGCSimHitCollectionCnv" );
32 log<<MSG::DEBUG<<"createPersistent(): main converter"<<endmsg;
33 TGCSimHitCollection_PERS *pixdc_p= m_TPConverter_p4.createPersistent( transCont, log );
34 return pixdc_p;
35}
36
38 MsgStream log(msgSvc(), "TGCSimHitCollectionCnv" );
39 static const pool::Guid p0_guid("D7C91818-4730-4717-A650-107F52C0221E"); // before t/p split
40 static const pool::Guid p1_guid("BD569381-2489-4402-BBD3-91EE8C009F26");
41 static const pool::Guid p2_guid("710241EE-D5F7-4CB6-A1D7-6E80D040E637");
42 static const pool::Guid p3_guid("BACD19A8-4737-4857-A22D-B9DF833A0A80");
43 static const pool::Guid p4_guid("F8F77562-BBD9-45DB-A276-6A21018EA7FA");
44 static const pool::Guid p5_guid("018E2DAC-18EB-7E5B-9F18-CC2E36343F17");
45 log<<MSG::DEBUG<<"createTransient(): main converter"<<endmsg;
46 TGCSimHitCollection* p_collection(nullptr);
47 if(compareClassGuid(p5_guid) ) {
48 log<<MSG::DEBUG<<"createTransient(): T/P version 5 detected"<<endmsg;
49 std::unique_ptr< Muon::TGCSimHitCollection_p5 > col_vect( this->poolReadObject< Muon::TGCSimHitCollection_p5 >() );
50 p_collection = m_TPConverter_p5.createTransient( col_vect.get(), log );
51 }
52 //----------------------------------------------------------------
53 else if(compareClassGuid(p4_guid) ) {
54 log<<MSG::DEBUG<<"createTransient(): T/P version 4 detected"<<endmsg;
55 std::unique_ptr< Muon::TGCSimHitCollection_p4 > col_vect( this->poolReadObject< Muon::TGCSimHitCollection_p4 >() );
56 p_collection = m_TPConverter_p4.createTransient( col_vect.get(), log );
57 }
58 //----------------------------------------------------------------
59 else if(compareClassGuid(p3_guid) ) {
60 log<<MSG::DEBUG<<"createTransient(): T/P version 3 detected"<<endmsg;
61 std::unique_ptr< Muon::TGCSimHitCollection_p3 > col_vect( this->poolReadObject< Muon::TGCSimHitCollection_p3 >() );
62 p_collection = m_TPConverter_p3.createTransient( col_vect.get(), log );
63 }
64 //----------------------------------------------------------------
65 else if( compareClassGuid(p2_guid) ) {
66 log<<MSG::DEBUG<<"createTransient(): T/P version 2 detected"<<endmsg;
67 std::unique_ptr< Muon::TGCSimHitCollection_p2 > col_vect( this->poolReadObject< Muon::TGCSimHitCollection_p2 >() );
68 p_collection = m_TPConverter_p2.createTransient( col_vect.get(), log );
69 }
70 //----------------------------------------------------------------
71 else if( compareClassGuid(p1_guid) ) {
72 log<<MSG::DEBUG<<"createTransient(): T/P version 1 detected"<<endmsg;
73 std::unique_ptr< Muon::TGCSimHitCollection_p1 > col_vect( this->poolReadObject< Muon::TGCSimHitCollection_p1 >() );
74 p_collection = m_TPConverter_p1.createTransient( col_vect.get(), log );
75 }
76 //----------------------------------------------------------------
77 else if( compareClassGuid(p0_guid) ) {
78 log<<MSG::DEBUG<<"createTransient(): Old input file"<<std::endl;
80 size_t size = oldColl->size();
81 p_collection=new TGCSimHitCollection("DefaultCollectionName",size);
82 p_collection->reserve(size);
83 //do the copy
84 for (const TGCSimHit* hit : *oldColl) {
85 p_collection->push_back(*hit);
86 }
87 delete oldColl;
88 }
89 else {
90 throw std::runtime_error("Unsupported persistent version of TGCSimHitCollection");
91
92 }
93 return p_collection;
94}
#define endmsg
T_AthenaPoolCustomCnv< TGCSimHitCollection, TGCSimHitCollection_PERS > TGCSimHitCollectionCnvBase
Muon::TGCSimHitCollection_p4 TGCSimHitCollection_PERS
AtlasHitsVector< TGCSimHit > TGCSimHitCollection
size_type size() const
void push_back(const T &t)
void reserve(size_type n)
TGCSimHitCollectionCnv_p5 m_TPConverter_p5
TGCSimHitCollectionCnv(ISvcLocator *svcloc)
TGCSimHitCollectionCnv_p2 m_TPConverter_p2
virtual TGCSimHitCollection * createTransient()
TGCSimHitCollectionCnv_p3 m_TPConverter_p3
virtual ~TGCSimHitCollectionCnv()
TGCSimHitCollectionCnv_p1 m_TPConverter_p1
virtual TGCSimHitCollection_PERS * createPersistent(TGCSimHitCollection *transCont)
TGCSimHitCollectionCnv_p4 m_TPConverter_p4