ATLAS Offline Software
Loading...
Searching...
No Matches
RPCSimHitCollectionCnv.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
19#include "HitManagement/AthenaHitsVector.h" //for back-compatibility
20
21
26
28
30 MsgStream log(msgSvc(), "RPCSimHitCollectionCnv" );
31 if (log.level() <= MSG::DEBUG) log<<MSG::DEBUG<<"createPersistent(): main converter"<<endmsg;
32 RPCSimHitCollection_PERS *pixdc_p= m_TPConverter_p3.createPersistent( transCont, log );
33 return pixdc_p;
34}
35
37 MsgStream log(msgSvc(), "RPCSimHitCollectionCnv" );
38 static const pool::Guid p0_guid("45EB013E-FC8E-4612-88B7-6E0CAF718F79"); // before t/p split
39 static const pool::Guid p1_guid("C4C57487-41DC-4706-9604-721D76F0AA52");
40 static const pool::Guid p2_guid("1B611C70-CC6F-42AE-9F6D-7DA6A9A22546");
41 static const pool::Guid p3_guid("B48E5E17-FB26-4BC0-A0E2-5324925EAE2F");
42 static const pool::Guid p4_guid("018E2DAC-18EB-714B-B9BD-F9354E30CB51");
43 if (log.level() <= MSG::DEBUG) log<<MSG::DEBUG<<"createTransient(): main converter"<<endmsg;
44 RPCSimHitCollection* p_collection(nullptr);
45 if( compareClassGuid(p4_guid) ) {
46 if (log.level() <= MSG::DEBUG) log<<MSG::DEBUG<<"createTransient(): T/P version 4 detected"<<endmsg;
47 std::unique_ptr< Muon::RPCSimHitCollection_p4 > col_vect( this->poolReadObject< Muon::RPCSimHitCollection_p4 >() );
48 p_collection = m_TPConverter_p4.createTransient( col_vect.get(), log );
49 }
50 else if( compareClassGuid(p3_guid) ) {
51 if (log.level() <= MSG::DEBUG) log<<MSG::DEBUG<<"createTransient(): T/P version 3 detected"<<endmsg;
52 std::unique_ptr< Muon::RPCSimHitCollection_p3 > col_vect( this->poolReadObject< Muon::RPCSimHitCollection_p3 >() );
53 p_collection = m_TPConverter_p3.createTransient( col_vect.get(), log );
54 }
55 else if( compareClassGuid(p2_guid) ) {
56 if (log.level() <= MSG::DEBUG) log<<MSG::DEBUG<<"createTransient(): T/P version 2 detected"<<endmsg;
57 std::unique_ptr< Muon::RPCSimHitCollection_p2 > col_vect( this->poolReadObject< Muon::RPCSimHitCollection_p2 >() );
58 p_collection = m_TPConverter_p2.createTransient( col_vect.get(), log );
59 }
60 else if( compareClassGuid(p1_guid) ) {
61 if (log.level() <= MSG::DEBUG) log<<MSG::DEBUG<<"createTransient(): T/P version 1 detected"<<endmsg;
62 std::unique_ptr< Muon::RPCSimHitCollection_p1 > col_vect( this->poolReadObject< Muon::RPCSimHitCollection_p1 >() );
63 p_collection = m_TPConverter.createTransient( col_vect.get(), log );
64 }
65 //----------------------------------------------------------------
66 else if( compareClassGuid(p0_guid) ) {
67 if (log.level() <= MSG::DEBUG) log<<MSG::DEBUG<<"createTransient(): Old input file"<<std::endl;
69 size_t size = oldColl->size();
70 p_collection=new RPCSimHitCollection("DefaultCollectionName",size);
71 p_collection->reserve(size);
72 //do the copy
73 for (const RPCSimHit* hit : *oldColl) {
74 p_collection->push_back(*hit);
75 }
76 delete oldColl;
77 }
78 else {
79 throw std::runtime_error("Unsupported persistent version of RPCSimHitCollection");
80
81 }
82 return p_collection;
83}
#define endmsg
Muon::RPCSimHitCollection_p3 RPCSimHitCollection_PERS
T_AthenaPoolCustomCnv< RPCSimHitCollection, RPCSimHitCollection_PERS > RPCSimHitCollectionCnvBase
AtlasHitsVector< RPCSimHit > RPCSimHitCollection
size_type size() const
void push_back(const T &t)
void reserve(size_type n)
virtual RPCSimHitCollection_PERS * createPersistent(RPCSimHitCollection *transCont)
RPCSimHitCollectionCnv_p2 m_TPConverter_p2
RPCSimHitCollectionCnv_p1 m_TPConverter
RPCSimHitCollectionCnv(ISvcLocator *svcloc)
virtual RPCSimHitCollection * createTransient()
RPCSimHitCollectionCnv_p3 m_TPConverter_p3
virtual ~RPCSimHitCollectionCnv()
RPCSimHitCollectionCnv_p4 m_TPConverter_p4