ATLAS Offline Software
Loading...
Searching...
No Matches
MuonRdoContainerTPCnv.icc
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3*/
4
5// Gaudi
6#include "GaudiKernel/MsgStream.h"
7#include <stdexcept>
8#include <memory>
9#include "Identifier/IdentifierHash.h"
10
11
12template <class T, class P, class CONV>
13MuonRdoContainerTPCnv<T,P, CONV >::MuonRdoContainerTPCnv(ISvcLocator* svcloc)
14 : T_AthenaPoolCustomCnv<T,P >(svcloc)
15{ }
16
17
18
19
20template <class T, class P, class CONV>
21P *
22MuonRdoContainerTPCnv<T,P, CONV >::createPersistent(T* rdoC)
23{
24 MsgStream log(this->msgSvc(), "MuonRdoContainerTPCnv" );
25
26 if (log.level() <= MSG::DEBUG) log << MSG::DEBUG << " **** Entered MuonRdoContainerTPCnv::createPersistent()" << endmsg;
27
28 P *persObj = m_TPconverter.createPersistent( rdoC, log );
29
30 if (log.level() <= MSG::DEBUG) log << MSG::DEBUG << "Write RDO vector, size " << persObj->size()
31 << endmsg;
32
33 return persObj;
34}
35
36
37// has to be inlined to prevent gcc3.2 problem/bug? of multiple definitons for specialized templates
38template <class T, class P, class CONV>
39inline
40T*
41MuonRdoContainerTPCnv<T,P, CONV >
42::createTransient()
43{
44 MsgStream log(this->msgSvc(), "MuonRdoContainerTPCnv" );
45 if (log.level() <= MSG::DEBUG) log << MSG::DEBUG << " **** Warning: using default createTransient() - (possibly missing specialized version of this method" << endmsg;
46 //std::cout << " **** Warning: using default createTransient() - (possibly missing specialized version of this method" << std::endl;
47
48 return createTransientFrom_p0( this->poolReadObject(), log );
49}
50
51template <class T, class P, class CONV>
52inline
53StatusCode
54MuonRdoContainerTPCnv<T,P, CONV >
55::initialize(){
56 return T_AthenaPoolCustomCnv<T,P>::initialize();
57}
58
59
60// invoked from persToTrans_impl to read old data from before TP separation
61template <class T, class P, class CONV>
62T*
63MuonRdoContainerTPCnv<T,P, CONV >
64::createTransientFrom_p0(COLL_vector* col_vect, MsgStream &log)
65{
66 if (log.level() <= MSG::DEBUG) log << MSG::DEBUG << "Using old RDO container converter" << endmsg;
67
68 std::unique_ptr<T> rdoC( new T(col_vect->size()) );
69 //COLL_vector *col_vect = (COLL_vector*) colV;
70 typename COLL_vector::const_iterator it_Coll = col_vect->begin();
71 typename COLL_vector::const_iterator it_CollE = col_vect->end();
72 for(; it_Coll != it_CollE; ++it_Coll) {
73 const COLLECTION_t *col = *it_Coll;
74
75 // register the rdo collection in IDC
76 //unsigned int id_hash = rdoC->idToHash((unsigned int)col->identify());
77 IdentifierHash id_hash = col->identifyHash();
78 if( rdoC->addCollection(col, id_hash).isFailure() ) {
79 throw std::runtime_error("Transient RDOs could not be created");
80 }
81 }
82 return rdoC.release();
83}
84
85
86
87
88
89
90
91