65 {
66
67 MsgStream log(
msgSvc(),
"EvtRecPrimaryVertexCnv");
68 log << MSG::DEBUG << "EvtRecPrimaryVertexCnv::DataObjectToTObject" << endreq;
69
71 if ( ! evtRecPrimaryVertex ) {
72 log << MSG::ERROR << "Could not downcast to EvtRecPrimaryVertex" << endreq;
73 return StatusCode::FAILURE;
74 }
75
76 DataObject* evt =
NULL;
78 if ( sc.isFailure() ) {
79 log << MSG::ERROR << "Could not get EvtRecObject in TDS" << endreq;
80 return StatusCode::FAILURE;
81 }
82
83 EvtRecObject* devtTds = dynamic_cast<EvtRecObject*> (evt);
84 if ( ! devtTds ) {
85 log << MSG::ERROR << "EvtRecPrimaryVertexCnv: Could not downcast to TDS EvtRecObject" << endreq;
86 }
87
88 IOpaqueAddress* addr;
89 m_cnvSvc->getEvtRecCnv()->createRep(evt, addr);
90 TEvtRecObject* recEvt =
m_cnvSvc->getEvtRecCnv()->getWriteObject();
91
92
93
94 TEvtRecPrimaryVertex* m_evtRecPrimaryVertex =
const_cast<TEvtRecPrimaryVertex*
>( recEvt->
getEvtRecPrimaryVertex() );
95
96 m_evtRecPrimaryVertex->setIsValid (evtRecPrimaryVertex->
isValid() );
97 m_evtRecPrimaryVertex->setNTracks (evtRecPrimaryVertex->
nTracks() );
98 m_evtRecPrimaryVertex->setTrackIdList (evtRecPrimaryVertex->
trackIdList() );
99 m_evtRecPrimaryVertex->setChi2 (evtRecPrimaryVertex->
chi2() );
100 m_evtRecPrimaryVertex->setNdof (evtRecPrimaryVertex->
ndof() );
101 m_evtRecPrimaryVertex->setFitMethod (evtRecPrimaryVertex->
fitMethod() );
102
103 Double_t vtx[3];
104 for (Int_t i = 0; i < 3; i++) {
105 vtx[i] = evtRecPrimaryVertex->
vertex()[i];
106 }
107 Double_t Evtx[6];
108 Evtx[0] = evtRecPrimaryVertex->
errorVertex()[0][0];
109 Evtx[1] = evtRecPrimaryVertex->
errorVertex()[0][1];
110 Evtx[2] = evtRecPrimaryVertex->
errorVertex()[0][2];
111 Evtx[3] = evtRecPrimaryVertex->
errorVertex()[1][1];
112 Evtx[4] = evtRecPrimaryVertex->
errorVertex()[1][2];
113 Evtx[5] = evtRecPrimaryVertex->
errorVertex()[2][2];
114 m_evtRecPrimaryVertex->setVertex (vtx);
115 m_evtRecPrimaryVertex->setErrorVertex (Evtx);
116
117 return StatusCode::SUCCESS;
118}
const HepVector & vertex() const
const std::vector< int > & trackIdList() const
const HepSymMatrix & errorVertex() const
IDataProviderSvc * m_eds
pointer to eventdataservice
const TEvtRecPrimaryVertex * getEvtRecPrimaryVertex() const
_EXTERN_ std::string Event
_EXTERN_ std::string EvtRecPrimaryVertex