1#include "GaudiKernel/MsgStream.h"
3#include "EventModel/EventModel.h"
4#include "EvtRecEvent/EvtRecObject.h"
5#include "EvtRecEvent/EvtRecPrimaryVertex.h"
7#include "RootEventData/TEvtRecObject.h"
8#include "RootEventData/TEvtRecPrimaryVertex.h"
10#include "RootCnvSvc/RootAddress.h"
11#include "RootCnvSvc/EvtRec/EvtRecCnv.h"
12#include "RootCnvSvc/EvtRec/EvtRecPrimaryVertexCnv.h"
14#include "CLHEP/Matrix/Vector.h"
15#include "CLHEP/Matrix/SymMatrix.h"
16using CLHEP::HepVector;
17using CLHEP::HepSymMatrix;
24 m_evtRecPrimaryVertex = 0;
28 MsgStream log(
msgSvc(),
"EvtRecPrimaryVertexCnv");
29 log << MSG::DEBUG <<
"EvtRecPrimaryVertexCnv::TObjectToDataObject" << endreq;
33 refpObject = evtRecPrimaryVertex;
35 if ( ! m_evtRecPrimaryVertex )
return StatusCode::SUCCESS;
40 evtRecPrimaryVertex->
setChi2 (m_evtRecPrimaryVertex->
chi2() );
41 evtRecPrimaryVertex->
setNdof (m_evtRecPrimaryVertex->
ndof() );
45 for (Int_t i = 0; i < 3; i++) {
46 vtx[i] = m_evtRecPrimaryVertex->
vertex(i);
49 HepSymMatrix Evtx(3, 0);
51 Evtx[0][1] = Evtx[1][0] = m_evtRecPrimaryVertex->
errorVertex(1);
52 Evtx[0][2] = Evtx[2][0] = m_evtRecPrimaryVertex->
errorVertex(2);
54 Evtx[1][2] = Evtx[2][1] = m_evtRecPrimaryVertex->
errorVertex(4);
60 delete m_evtRecPrimaryVertex;
61 m_evtRecPrimaryVertex = 0;
62 return StatusCode::SUCCESS;
67 MsgStream log(
msgSvc(),
"EvtRecPrimaryVertexCnv");
68 log << MSG::DEBUG <<
"EvtRecPrimaryVertexCnv::DataObjectToTObject" << endreq;
71 if ( ! evtRecPrimaryVertex ) {
72 log << MSG::ERROR <<
"Could not downcast to EvtRecPrimaryVertex" << endreq;
73 return StatusCode::FAILURE;
76 DataObject* evt = NULL;
78 if ( sc.isFailure() ) {
79 log << MSG::ERROR <<
"Could not get EvtRecObject in TDS" << endreq;
80 return StatusCode::FAILURE;
85 log << MSG::ERROR <<
"EvtRecPrimaryVertexCnv: Could not downcast to TDS EvtRecObject" << endreq;
99 m_evtRecPrimaryVertex->
setChi2 (evtRecPrimaryVertex->
chi2() );
100 m_evtRecPrimaryVertex->
setNdof (evtRecPrimaryVertex->
ndof() );
104 for (Int_t i = 0; i < 3; i++) {
105 vtx[i] = evtRecPrimaryVertex->
vertex()[i];
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];
117 return StatusCode::SUCCESS;
static TEvtRecObject * getWriteObject()
virtual StatusCode TObjectToDataObject(DataObject *&obj)
transformation from root
virtual StatusCode DataObjectToTObject(DataObject *obj, RootAddress *addr)
transformation to root
EvtRecPrimaryVertexCnv(ISvcLocator *svc)
void setTrackIdList(const std::vector< int > &trackIdList)
void setVertex(const HepVector &vtx)
const HepVector & vertex() const
void setFitMethod(int fitMethod)
const std::vector< int > & trackIdList() const
void setErrorVertex(const HepSymMatrix &Evtx)
void setChi2(double chi2)
const HepSymMatrix & errorVertex() const
void setNTracks(int nTracks)
void setIsValid(bool isValid)
Definition of a Root address, derived from IOpaqueAddress.
EvtRecCnv * getEvtRecCnv()
Base class for all Root Converters.
IDataProviderSvc * m_eds
pointer to eventdataservice
std::vector< void * > m_adresses
each converter knows the corresponding adresses
std::string m_rootBranchname
root branchname (may be concatenated of severals)
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)
Convert the transient object to the requested representation.
const TEvtRecPrimaryVertex * getEvtRecPrimaryVertex() const
Double_t errorVertex(Int_t i) const
void setChi2(Double_t chi2)
void setTrackIdList(const std::vector< Int_t > &trackIdList)
Double_t vertex(Int_t i) const
const std::vector< Int_t > & trackIdList() const
void setErrorVertex(Double_t Evtx[6])
void setIsValid(Bool_t isValid)
void setFitMethod(Int_t fitMethod)
void setVertex(Double_t vtx[3])
void setNTracks(Int_t nTracks)
_EXTERN_ std::string Event