ATLAS Offline Software
Loading...
Searching...
No Matches
MDTSimHitCollectionCnv.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(), "MDTSimHitCollectionCnv" );
31 ATH_MSG_DEBUG("createPersistent(): main converter");
32 MDTSimHitCollection_PERS *pixdc_p= m_TPConverter_p3.createPersistent( transCont, log );
33 return pixdc_p;
34}
35
37 MsgStream log(msgSvc(), "MDTSimHitCollectionCnv" );
38 static const pool::Guid p0_guid("D76D06CC-C15F-43E6-BBC3-480DE5DA065D"); // before t/p split
39 static const pool::Guid p1_guid("EA781971-65C5-4B30-9D22-EEFB764BA0B3");
40 static const pool::Guid p2_guid("92880B97-75BB-4C5D-8183-577338059FCC");
41 static const pool::Guid p3_guid("0E9EEEE2-304F-44B8-B1DF-E75297183A02");
42 static const pool::Guid p4_guid("018E2DAC-18EB-7BBC-92AF-EFE3F0E400C2");
43 ATH_MSG_DEBUG("createTransient(): main converter");
44 MDTSimHitCollection* p_collection(nullptr);
45 if( compareClassGuid(p4_guid) ) {
46 ATH_MSG_DEBUG("createTransient(): T/P version 4 detected");
47 std::unique_ptr< Muon::MDTSimHitCollection_p4 > col_vect( this->poolReadObject< Muon::MDTSimHitCollection_p4 >() );
48 p_collection = m_TPConverter_p4.createTransient( col_vect.get(), log );
49 } else if( compareClassGuid(p3_guid) ) {
50 ATH_MSG_DEBUG("createTransient(): T/P version 3 detected");
51 std::unique_ptr< Muon::MDTSimHitCollection_p3 > col_vect( this->poolReadObject< Muon::MDTSimHitCollection_p3 >() );
52 p_collection = m_TPConverter_p3.createTransient( col_vect.get(), log );
53 } else if( compareClassGuid(p2_guid) ) {
54 ATH_MSG_DEBUG("createTransient(): T/P version 2 detected");
55 std::unique_ptr< Muon::MDTSimHitCollection_p2 > col_vect( this->poolReadObject< Muon::MDTSimHitCollection_p2 >() );
56 p_collection = m_TPConverter_p2.createTransient( col_vect.get(), log );
57 } else if( compareClassGuid(p1_guid) ) {
58 ATH_MSG_DEBUG("createTransient(): T/P version 1 detected");
59 // poolReadObject< MDTSimHitCollection_PERS >( m_TPConverter );
60 // p_collection = m_TPConverter.createTransient( log );
61 std::unique_ptr< Muon::MDTSimHitCollection_p1 > col_vect( this->poolReadObject< Muon::MDTSimHitCollection_p1 >() );
62 p_collection = m_TPConverter_p1.createTransient( col_vect.get(), log );
63 }
64 //----------------------------------------------------------------
65 else if( compareClassGuid(p0_guid) ) {
66 if (log.level() <= MSG::DEBUG) log<<MSG::DEBUG<<"createTransient(): Old input file"<<std::endl;
68 size_t size = oldColl->size();
69 p_collection=new MDTSimHitCollection("DefaultCollectionName",size);
70 p_collection->reserve(size);
71 //do the copy
72 for (const MDTSimHit* hit : *oldColl) {
73 p_collection->push_back(*hit);
74 }
75 delete oldColl;
76 }
77 else {
78 throw std::runtime_error("Unsupported persistent version of MDTSimHitCollection");
79
80 }
81 return p_collection;
82}
#define ATH_MSG_DEBUG(x)
T_AthenaPoolCustomCnv< MDTSimHitCollection, MDTSimHitCollection_PERS > MDTSimHitCollectionCnvBase
Muon::MDTSimHitCollection_p3 MDTSimHitCollection_PERS
AtlasHitsVector< MDTSimHit > MDTSimHitCollection
size_type size() const
void push_back(const T &t)
void reserve(size_type n)
virtual ~MDTSimHitCollectionCnv()
virtual MDTSimHitCollection * createTransient()
MDTSimHitCollectionCnv(ISvcLocator *svcloc)
MDTSimHitCollectionCnv_p2 m_TPConverter_p2
MDTSimHitCollectionCnv_p1 m_TPConverter_p1
MDTSimHitCollectionCnv_p3 m_TPConverter_p3
MDTSimHitCollectionCnv_p4 m_TPConverter_p4
virtual MDTSimHitCollection_PERS * createPersistent(MDTSimHitCollection *transCont)