ATLAS Offline Software
V0ContainerCnv.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 //-----------------------------------------------------------------------------
6 //
7 // file: V0ContainerCnv.cxx
8 // author: Kirill Prokofiev <Kirill.Prokofiev@cern.ch>
9 //
10 //-----------------------------------------------------------------------------
11 
12 
14 #include "V0ContainerCnv.h"
15 
18 
19 V0ContainerCnv::V0ContainerCnv( ISvcLocator *svcloc ):
20  V0ContainerCnvBase(svcloc),
21  m_msgSvc( msgSvc() ),
22  m_log( m_msgSvc, "V0ContainerCnv" )
23  {}
24 
25 //-----------------------------------------------------------------------------
26 // Initializer
27 //-----------------------------------------------------------------------------
29 {
31  if( sc.isFailure() )
32  {
33  m_log << MSG::FATAL << "Could not initialize V0ContainerCnvBase" << endmsg;
34  return sc;
35  }
36 //-------------------------------------------------------------------------
37 // Set up the message stream
38 //-------------------------------------------------------------------------
39  m_log.setLevel( m_msgSvc->outputLevel() );
40  m_log << MSG::INFO << "V0ContainerCnv::initialize()" << endmsg;
41 
42  return StatusCode::SUCCESS;
43 
44 }//end of initialize method
45 
46 
48 {
49  m_log.setLevel( m_msgSvc->outputLevel() );
50  updateLog(); // Make m_log indicate the current key
51  V0Container_PERS * pVxCont = m_TPConverter.createPersistent( transCont, m_log );
52 
53  // std::cout<<" WRITING: Dumping the contents of the V0Container "<<std::endl;
54 
55 /*
56  std::cout<<"WRITING: Dumping the contents of the V0Container "<<std::endl;
57  std::cout<<"------------------------------VxVertex related "<<std::endl;
58  std::cout<<" m_v0Containers size: "<< pVxCont->m_v0Containers.size()<<std::endl;
59  std::cout<<" m_v0Candidates size: "<< pVxCont->m_v0Candidates.size() <<std::endl;
60  std::cout<<" m_v0Hypothesises size: "<< pVxCont->m_v0Hypothesises.size()<<std::endl;
61  std::cout<<" m_extendedVxCandidate size: "<< pVxCont->m_extendedVxCandidates.size()<<std::endl;
62  std::cout<<" m_vxCandidate size: "<< pVxCont->m_vxCandidates.size()<<std::endl;
63  std::cout<<" m_vxTrackAtVertices size: "<< pVxCont->m_vxTracksAtVertex.size()<<std::endl;
64  std::cout<<" m_recVertices size: "<< pVxCont->m_recVertices.size()<<std::endl;
65  std::cout<<" m_vertices size: "<< pVxCont->m_vertices.size()<<std::endl;
66 
67  std::cout<<"------------------------------TrkTrack related "<<std::endl;
68  std::cout<<" m_tracks size: "<< pVxCont->m_tracks.size()<<std::endl;
69  std::cout<<"------------------------------TrkTrackParameters related "<<std::endl;
70  std::cout<<" m_trackParameters size: "<< pVxCont->m_trackParameters.size()<<std::endl;
71  std::cout<<" m_perigees size: "<< pVxCont->m_perigees.size()<<std::endl;
72  std::cout<<" m_measPerigees size: "<< pVxCont->m_measPerigees.size()<<std::endl;
73  std::cout<<" m_surfaces size: "<< pVxCont->m_surfaces.size()<<std::endl;
74  std::cout<<" m_fitQualities size: "<< pVxCont->m_fitQualities.size()<<std::endl;
75  std::cout<<" m_hepSymMatrices size: "<< pVxCont->m_hepSymMatrices.size()<<std::endl;
76 */
77 
78  return pVxCont;
79 
80 }//end of create persistent method
81 
83 {
84  static const pool::Guid p2_guid( "9BC2B917-940A-4121-8E8B-8C99E178D8C1" );
85  static const pool::Guid p1_guid( "402A9BD1-4476-4E97-A5E4-EB4D742FBB38" );
86  static const pool::Guid p0_guid( "0C363A21-1B86-4B39-8A84-A62161B13C7B" );
87 
88  V0Container *p_collection = nullptr;
89  if( compareClassGuid( p2_guid ) )
90  {
91  // std::cout << "V0ContainerCnv::createTransient: do new TP p2" << std::endl;
92  /*
93  usingTPCnvForReading( m_TPConverter );
94  std::unique_ptr< V0Container_PERS > p_coll( poolReadObject< V0Container_PERS >() );
95  */
96 
97  /*
98  std::cout<<"READING: Dumping the contents of the V0Container "<<std::endl;
99  std::cout<<"------------------------------VxVertex related "<<std::endl;
100  std::cout<<" m_v0Containers size: "<< p_coll->m_v0Containers.size()<<std::endl;
101  std::cout<<" m_v0Candidates size: "<< p_coll->m_v0Candidates.size() <<std::endl;
102  std::cout<<" m_v0Hypothesises size: "<< p_coll->m_v0Hypothesises.size()<<std::endl;
103  std::cout<<" m_extendedVxCandidate size: "<< p_coll->m_extendedVxCandidates.size()<<std::endl;
104  std::cout<<" m_vxCandidate size: "<< p_coll->m_vxCandidates.size()<<std::endl;
105  std::cout<<" m_vxTrackAtVertices size: "<< p_coll->m_vxTracksAtVertex.size()<<std::endl;
106  std::cout<<" m_recVertices size: "<< p_coll->m_recVertices.size()<<std::endl;
107  std::cout<<" m_vertices size: "<< p_coll->m_vertices.size()<<std::endl;
108 
109  std::cout<<"------------------------------TrkTrack related "<<std::endl;
110  std::cout<<" m_tracks size: "<< p_coll->m_tracks.size()<<std::endl;
111  std::cout<<"------------------------------TrkTrackParameters related "<<std::endl;
112  std::cout<<" m_trackParameters size: "<< p_coll->m_trackParameters.size()<<std::endl;
113  std::cout<<" m_perigees size: "<< p_coll->m_perigees.size()<<std::endl;
114  std::cout<<" m_measPerigees size: "<< p_coll->m_measPerigees.size()<<std::endl;
115  std::cout<<" m_surfaces size: "<< p_coll->m_surfaces.size()<<std::endl;
116  std::cout<<" m_fitQualities size: "<< p_coll->m_fitQualities.size()<<std::endl;
117  std::cout<<" m_hepSymMatrices size: "<< p_coll->m_hepSymMatrices.size()<<std::endl;
118  */
119  poolReadObject< Trk::V0Container_tlp2 >(m_TPConverter);
120  p_collection = m_TPConverter.createTransient( m_log );
121 
122  }else if( compareClassGuid( p1_guid ) )
123  {
124  // std::cout << "V0ContainerCnv::createTransient: do TP p1" << std::endl;
125  /*
126  usingTPCnvForReading( m_TPConverter );
127  std::unique_ptr< V0Container_PERS > p_coll( poolReadObject< V0Container_PERS >() );
128  */
129 
130 /*
131  std::cout<<"READING: Dumping the contents of the V0Container "<<std::endl;
132  std::cout<<"------------------------------VxVertex related "<<std::endl;
133  std::cout<<" m_v0Containers size: "<< p_coll->m_v0Containers.size()<<std::endl;
134  std::cout<<" m_v0Candidates size: "<< p_coll->m_v0Candidates.size() <<std::endl;
135  std::cout<<" m_v0Hypothesises size: "<< p_coll->m_v0Hypothesises.size()<<std::endl;
136  std::cout<<" m_extendedVxCandidate size: "<< p_coll->m_extendedVxCandidates.size()<<std::endl;
137  std::cout<<" m_vxCandidate size: "<< p_coll->m_vxCandidates.size()<<std::endl;
138  std::cout<<" m_vxTrackAtVertices size: "<< p_coll->m_vxTracksAtVertex.size()<<std::endl;
139  std::cout<<" m_recVertices size: "<< p_coll->m_recVertices.size()<<std::endl;
140  std::cout<<" m_vertices size: "<< p_coll->m_vertices.size()<<std::endl;
141 
142  std::cout<<"------------------------------TrkTrack related "<<std::endl;
143  std::cout<<" m_tracks size: "<< p_coll->m_tracks.size()<<std::endl;
144  std::cout<<"------------------------------TrkTrackParameters related "<<std::endl;
145  std::cout<<" m_trackParameters size: "<< p_coll->m_trackParameters.size()<<std::endl;
146  std::cout<<" m_perigees size: "<< p_coll->m_perigees.size()<<std::endl;
147  std::cout<<" m_measPerigees size: "<< p_coll->m_measPerigees.size()<<std::endl;
148  std::cout<<" m_surfaces size: "<< p_coll->m_surfaces.size()<<std::endl;
149  std::cout<<" m_fitQualities size: "<< p_coll->m_fitQualities.size()<<std::endl;
150  std::cout<<" m_hepSymMatrices size: "<< p_coll->m_hepSymMatrices.size()<<std::endl;
151 */
152  V0ContainerCnv_tlp1 tpCnv;
153  poolReadObject< Trk::V0Container_tlp1 >(tpCnv);
154  p_collection = tpCnv.createTransient( m_log );
155 
156  }else if( compareClassGuid( p0_guid ) ){
157  // std::cout << "V0ContainerCnv::createTransient: use old converter" << std::endl;
158  p_collection = poolReadObject< V0Container >();
159 
160  }else throw std::runtime_error( "Unsupported persistent version of V0Container" );
161 
162  return p_collection;
163 
164 }//end of create transient method
165 
167  //const DataObject* dObj = getDataObject();
168  //if (dObj==0) return; // Can't do much if this fails.
169  //const std::string key = (dObj->name());
170 
171  //m_log.m_source="V0ContainerCnv: "+key; // A hack - relies on getting access to private data of MsgStream via #define trick. EJWM.
172 }
173 
174 
V0ContainerCnv::createTransient
virtual V0Container * createTransient() override
Definition: V0ContainerCnv.cxx:82
python.Constants.FATAL
int FATAL
Definition: Control/AthenaCommon/python/Constants.py:19
V0ContainerCnv::updateLog
void updateLog()
This method modifies m_log to indicate the current key being converted.
Definition: V0ContainerCnv.cxx:166
TrackParticleBase.h
V0ContainerCnv::V0ContainerCnv
V0ContainerCnv(ISvcLocator *svcloc)
Definition: V0ContainerCnv.cxx:19
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
Trk::V0Container_tlp2
Definition: V0Container_tlp2.h:54
V0ContainerCnv_tlp2.h
pool::Guid
::Guid Guid
Definition: T_AthenaPoolCustCnv.h:19
V0Container
Definition: V0Container.h:22
TopLevelTPConverter::createTransient
TRANS * createTransient(MsgStream &log)
Create transient representation of the persistent object known to this converter.
Definition: TopLevelTPConverter.h:62
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
V0ContainerCnv::m_TPConverter
V0ContainerCnv_tlp2 m_TPConverter
Definition: V0ContainerCnv.h:62
T_AthenaPoolCustomCnv
Compatibility for old converter classes that don't get passed the key.
Definition: T_AthenaPoolCustomCnv.h:132
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
V0ContainerCnv::createPersistent
virtual V0Container_PERS * createPersistent(V0Container *transCont) override
Definition: V0ContainerCnv.cxx:47
V0ContainerCnv::m_log
MsgStream m_log
Definition: V0ContainerCnv.h:60
V0ContainerCnv.h
V0ContainerCnv_tlp1.h
V0ContainerCnv_tlp1
Definition: V0ContainerCnv_tlp1.h:51
V0ContainerCnv::m_msgSvc
IMessageSvc * m_msgSvc
Definition: V0ContainerCnv.h:59
TopLevelTPConverter::createPersistent
virtual TL_PERS * createPersistent(const TRANS *transObj, MsgStream &log)
Create persistent representation of transObj.
Definition: TopLevelTPConverter.h:110
T_AthenaPoolCustCnv::compareClassGuid
virtual bool compareClassGuid(const Guid &clid) const
Compare POOL class GUID with the one of the object being read.
V0ContainerCnv::initialize
virtual StatusCode initialize() override
Gaudi Service Interface method implementations:
Definition: V0ContainerCnv.cxx:28
T_AthenaPoolCustCnv::initialize
virtual StatusCode initialize()
Gaudi Service Interface method implementations: