BOSS 6.6.4.p01
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtRecPrimaryVertexCnv Class Reference

#include <EvtRecPrimaryVertexCnv.h>

+ Inheritance diagram for EvtRecPrimaryVertexCnv:

Public Member Functions

virtual ~EvtRecPrimaryVertexCnv ()
 
- Public Member Functions inherited from RootEventBaseCnv
 RootEventBaseCnv (const CLID &clid, ISvcLocator *svc)
 
virtual ~RootEventBaseCnv ()
 
virtual long repSvcType () const
 
virtual StatusCode initialize ()
 
virtual StatusCode finalize ()
 
void declareObject (const std::string &fullPath, const CLID &clid, const std::string &treename, const std::string &branchname)
 Store TDS path to link a particular converter to an object on the TDS.
 
virtual StatusCode createObj (IOpaqueAddress *addr, DataObject *&dat)
 Convert the persistent object to transient.
 
virtual StatusCode createRep (DataObject *pObject, IOpaqueAddress *&refpAddress)
 Convert the transient object to the requested representation.
 
virtual StatusCode fillRepRefs (IOpaqueAddress *pAddress, DataObject *pObject)
 Resolve the references of the converted object.
 
virtual StatusCode fillObjRefs (IOpaqueAddress *pAddress, DataObject *pObject)
 Resolve the references of the converted object.
 
virtual StatusCode DataObjectToTObject (DataObject *dat, RootAddress *addr)=0
 Do the concrete conversion from TDS to ROOT.
 
virtual StatusCode TObjectToDataObject (DataObject *&dat)=0
 Do the concrete conversion from ROOT to TDS.
 
TObject * getReadObject () const
 get the object to be read
 
- Public Member Functions inherited from Converter< Ty1, Ty2 >
destinationoperator (const source &) const
 

Static Public Member Functions

static const CLID & classID ()
 
- Static Public Member Functions inherited from RootEventBaseCnv
static const unsigned char storageType ()
 Storage type and class ID.
 

Protected Member Functions

 EvtRecPrimaryVertexCnv (ISvcLocator *svc)
 
virtual StatusCode DataObjectToTObject (DataObject *obj, RootAddress *addr)
 transformation to root
 
virtual StatusCode TObjectToDataObject (DataObject *&obj)
 transformation from root
 
- Protected Member Functions inherited from Converter< Ty1, Ty2 >
virtual destinationconvert (const source &) const =0
 

Friends

class CnvFactory< EvtRecPrimaryVertexCnv >
 

Additional Inherited Members

- Public Types inherited from Converter< Ty1, Ty2 >
typedef Ty1 source
 
typedef Ty2 destination
 
- Protected Attributes inherited from RootEventBaseCnv
RootCnvSvcm_cnvSvc
 
std::vector< RootCnvSvc::Leafm_leaves
 
RootInterfacem_rootInterface
 pointer to the RootInterface
 
IDataProviderSvc * m_eds
 pointer to eventdataservice
 
int m_branchNr
 the branchNr of this converter for writing
 
int m_branchNrDst
 
int m_branchNrMc
 
int m_branchNrRecon
 
int m_branchNrEvtRec
 
int m_branchNrEvtHeader
 
int m_branchNrEvtNavigator
 
TObject * m_objRead
 the object that was read
 
CLID CLID_top
 the CLID of the upper converter if any
 
TArrayS * m_branchNumbers
 array with number of branches for reading
 
std::string m_rootBranchname
 root branchname (may be concatenated of severals)
 
std::string m_rootTreename
 each converter knows it's treename
 
std::string m_currentFileName
 
std::vector< void * > m_adresses
 each converter knows the corresponding adresses
 
RootEvtSelectorm_evtsel
 

Detailed Description

Definition at line 15 of file EvtRecPrimaryVertexCnv.h.

Constructor & Destructor Documentation

◆ ~EvtRecPrimaryVertexCnv()

virtual EvtRecPrimaryVertexCnv::~EvtRecPrimaryVertexCnv ( )
inlinevirtual

Definition at line 22 of file EvtRecPrimaryVertexCnv.h.

22{}

◆ EvtRecPrimaryVertexCnv()

EvtRecPrimaryVertexCnv::EvtRecPrimaryVertexCnv ( ISvcLocator *  svc)
protected

Definition at line 19 of file EvtRecPrimaryVertexCnv.cxx.

21{
22 m_rootBranchname = "m_evtRecPrimaryVertex";
23 m_adresses.push_back(&m_evtRecPrimaryVertex);
24 m_evtRecPrimaryVertex = 0;
25}
static const CLID & classID()
Base class for all Root Converters.
std::vector< void * > m_adresses
each converter knows the corresponding adresses
std::string m_rootBranchname
root branchname (may be concatenated of severals)

Member Function Documentation

◆ classID()

static const CLID & EvtRecPrimaryVertexCnv::classID ( )
inlinestatic

Definition at line 20 of file EvtRecPrimaryVertexCnv.h.

const CLID & CLID_EvtRecPrimaryVertex
Definition: EventModel.cxx:363

◆ DataObjectToTObject()

StatusCode EvtRecPrimaryVertexCnv::DataObjectToTObject ( DataObject *  obj,
RootAddress addr 
)
protectedvirtual

transformation to root

Implements RootEventBaseCnv.

Definition at line 65 of file EvtRecPrimaryVertexCnv.cxx.

65 {
66
67 MsgStream log(msgSvc(), "EvtRecPrimaryVertexCnv");
68 log << MSG::DEBUG << "EvtRecPrimaryVertexCnv::DataObjectToTObject" << endreq;
69
70 EvtRecPrimaryVertex* evtRecPrimaryVertex = dynamic_cast<EvtRecPrimaryVertex*> (obj);
71 if ( ! evtRecPrimaryVertex ) {
72 log << MSG::ERROR << "Could not downcast to EvtRecPrimaryVertex" << endreq;
73 return StatusCode::FAILURE;
74 }
75
76 DataObject* evt = NULL;
77 StatusCode sc = m_eds->findObject(EventModel::EvtRec::Event, evt);
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);
91
92 //recEvt->clearEvtRecPrimaryVertex();
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}
IMessageSvc * msgSvc()
static TEvtRecObject * getWriteObject()
Definition: EvtRecCnv.h:26
const HepVector & vertex() const
const std::vector< int > & trackIdList() const
const HepSymMatrix & errorVertex() const
EvtRecCnv * getEvtRecCnv()
Definition: RootCnvSvc.h:152
RootCnvSvc * m_cnvSvc
IDataProviderSvc * m_eds
pointer to eventdataservice
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)
Convert the transient object to the requested representation.
const TEvtRecPrimaryVertex * getEvtRecPrimaryVertex() const
Definition: TEvtRecObject.h:39
void setChi2(Double_t chi2)
void setTrackIdList(const std::vector< Int_t > &trackIdList)
void setNdof(Int_t ndof)
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
Definition: EventModel.h:110

◆ TObjectToDataObject()

StatusCode EvtRecPrimaryVertexCnv::TObjectToDataObject ( DataObject *&  obj)
protectedvirtual

transformation from root

Implements RootEventBaseCnv.

Definition at line 27 of file EvtRecPrimaryVertexCnv.cxx.

27 {
28 MsgStream log(msgSvc(), "EvtRecPrimaryVertexCnv");
29 log << MSG::DEBUG << "EvtRecPrimaryVertexCnv::TObjectToDataObject" << endreq;
30
31 // create the TDS location for the EvtRecPrimaryVertex
32 EvtRecPrimaryVertex* evtRecPrimaryVertex = new EvtRecPrimaryVertex;
33 refpObject = evtRecPrimaryVertex;
34
35 if ( ! m_evtRecPrimaryVertex ) return StatusCode::SUCCESS;
36 // convert
37 evtRecPrimaryVertex->setIsValid (m_evtRecPrimaryVertex->isValid() );
38 evtRecPrimaryVertex->setNTracks (m_evtRecPrimaryVertex->nTracks() );
39 evtRecPrimaryVertex->setTrackIdList (m_evtRecPrimaryVertex->trackIdList() );
40 evtRecPrimaryVertex->setChi2 (m_evtRecPrimaryVertex->chi2() );
41 evtRecPrimaryVertex->setNdof (m_evtRecPrimaryVertex->ndof() );
42 evtRecPrimaryVertex->setFitMethod (m_evtRecPrimaryVertex->fitMethod() );
43
44 HepVector vtx(3, 0);
45 for (Int_t i = 0; i < 3; i++) {
46 vtx[i] = m_evtRecPrimaryVertex->vertex(i);
47 }
48
49 HepSymMatrix Evtx(3, 0);
50 Evtx[0][0] = m_evtRecPrimaryVertex->errorVertex(0);
51 Evtx[0][1] = Evtx[1][0] = m_evtRecPrimaryVertex->errorVertex(1);
52 Evtx[0][2] = Evtx[2][0] = m_evtRecPrimaryVertex->errorVertex(2);
53 Evtx[1][1] = m_evtRecPrimaryVertex->errorVertex(3);
54 Evtx[1][2] = Evtx[2][1] = m_evtRecPrimaryVertex->errorVertex(4);
55 Evtx[2][2] = m_evtRecPrimaryVertex->errorVertex(5);
56
57 evtRecPrimaryVertex->setVertex (vtx);
58 evtRecPrimaryVertex->setErrorVertex (Evtx);
59
60 delete m_evtRecPrimaryVertex;
61 m_evtRecPrimaryVertex = 0;
62 return StatusCode::SUCCESS;
63}
void setTrackIdList(const std::vector< int > &trackIdList)
void setVertex(const HepVector &vtx)
void setFitMethod(int fitMethod)
void setErrorVertex(const HepSymMatrix &Evtx)
void setChi2(double chi2)
void setNTracks(int nTracks)
void setIsValid(bool isValid)
Double_t errorVertex(Int_t i) const
Double_t vertex(Int_t i) const
const std::vector< Int_t > & trackIdList() const

Friends And Related Function Documentation

◆ CnvFactory< EvtRecPrimaryVertexCnv >

friend class CnvFactory< EvtRecPrimaryVertexCnv >
friend

Definition at line 10 of file EvtRecPrimaryVertexCnv.h.


The documentation for this class was generated from the following files: