ATLAS Offline Software
Loading...
Searching...
No Matches
CSCSimHitCollectionCnv.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(), "CSCSimHitCollectionCnv" );
31 if (log.level() <= MSG::DEBUG) log<<MSG::DEBUG<<"createPersistent(): main converter"<<endmsg;
32 CSCSimHitCollection_PERS *pixdc_p= m_TPConverter_p3.createPersistent( transCont, log );
33 return pixdc_p;
34}
35
37 MsgStream log(msgSvc(), "CSCSimHitCollectionCnv" );
38 static const pool::Guid p0_guid("DC744F9B-078A-4C61-B03F-D035D885B559"); // before t/p split
39 static const pool::Guid p1_guid("E45CD293-4599-41BE-8B65-945A18F41AB7");
40 static const pool::Guid p2_guid("7E5A120C-E64F-4519-A24B-B485A58724BF");
41 static const pool::Guid p3_guid("6BFFE81C-C99E-43D9-B06F-1A998C3B3E40");
42 static const pool::Guid p4_guid("018E2DAC-18EB-71D2-A246-66F818B3681B");
43 if (log.level() <= MSG::DEBUG) log<<MSG::DEBUG<<"createTransient(): main converter"<<endmsg;
44 CSCSimHitCollection* 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::CSCSimHitCollection_p4 > col_vect( this->poolReadObject< Muon::CSCSimHitCollection_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::CSCSimHitCollection_p3 > col_vect( this->poolReadObject< Muon::CSCSimHitCollection_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::CSCSimHitCollection_p2 > col_vect( this->poolReadObject< Muon::CSCSimHitCollection_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::CSCSimHitCollection_p1 > col_vect( this->poolReadObject< Muon::CSCSimHitCollection_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 CSCSimHitCollection("DefaultCollectionName",size);
71 p_collection->reserve(size);
72 //do the copy
73 for (const CSCSimHit* hit : *oldColl) {
74 p_collection->push_back(*hit);
75 }
76 delete oldColl;
77 }
78 else {
79 throw std::runtime_error("Unsupported persistent version of CSCSimHitCollection");
80 }
81 return p_collection;
82}
#define endmsg
Muon::CSCSimHitCollection_p3 CSCSimHitCollection_PERS
T_AthenaPoolCustomCnv< CSCSimHitCollection, CSCSimHitCollection_PERS > CSCSimHitCollectionCnvBase
AtlasHitsVector< CSCSimHit > CSCSimHitCollection
size_type size() const
void push_back(const T &t)
void reserve(size_type n)
virtual CSCSimHitCollection_PERS * createPersistent(CSCSimHitCollection *transCont)
CSCSimHitCollectionCnv_p2 m_TPConverter_p2
virtual CSCSimHitCollection * createTransient()
CSCSimHitCollectionCnv(ISvcLocator *svcloc)
virtual ~CSCSimHitCollectionCnv()
CSCSimHitCollectionCnv_p1 m_TPConverter
CSCSimHitCollectionCnv_p3 m_TPConverter_p3
CSCSimHitCollectionCnv_p4 m_TPConverter_p4