BOSS 7.1.2
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtRecVeeVertexCnv Class Reference

#include <EvtRecVeeVertexCnv.h>

+ Inheritance diagram for EvtRecVeeVertexCnv:

Public Member Functions

virtual ~EvtRecVeeVertexCnv ()
 
- 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.
 
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

 EvtRecVeeVertexCnv (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< EvtRecVeeVertexCnv >
 

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 14 of file EvtRecVeeVertexCnv.h.

Constructor & Destructor Documentation

◆ ~EvtRecVeeVertexCnv()

virtual EvtRecVeeVertexCnv::~EvtRecVeeVertexCnv ( )
inlinevirtual

Definition at line 21 of file EvtRecVeeVertexCnv.h.

21{}

◆ EvtRecVeeVertexCnv()

EvtRecVeeVertexCnv::EvtRecVeeVertexCnv ( ISvcLocator * svc)
protected

Definition at line 20 of file EvtRecVeeVertexCnv.cxx.

22{
23 m_rootBranchname = "m_evtRecVeeVertexCol";
24 m_adresses.push_back(&m_evtRecVeeVertexCol);
25 m_evtRecVeeVertexCol = 0;
26}
static const CLID & classID()
std::vector< void * > m_adresses
each converter knows the corresponding adresses
std::string m_rootBranchname
root branchname (may be concatenated of severals)
RootEventBaseCnv(const CLID &clid, ISvcLocator *svc)

Member Function Documentation

◆ classID()

static const CLID & EvtRecVeeVertexCnv::classID ( )
inlinestatic

Definition at line 19 of file EvtRecVeeVertexCnv.h.

const CLID & CLID_EvtRecVeeVertexCol

◆ DataObjectToTObject()

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

transformation to root

Implements RootEventBaseCnv.

Definition at line 108 of file EvtRecVeeVertexCnv.cxx.

108 {
109 MsgStream log(msgSvc(), "EvtRecVeeVertexCnv");
110 log << MSG::DEBUG << "EvtRecVeeVertexCnv::DataObjectToTObject" << endreq;
111
112 EvtRecVeeVertexCol* evtRecVeeVertexCol = dynamic_cast<EvtRecVeeVertexCol*> (obj);
113 if ( ! evtRecVeeVertexCol ) {
114 log << MSG::ERROR << "Could not downcast to EvtRecVeeVertexCol" << endreq;
115 return StatusCode::FAILURE;
116 }
117
118 DataObject* evt;
119 m_eds->findObject(EventModel::EvtRec::Event, evt);
120 if ( evt == NULL ) {
121 log << MSG::ERROR << "Could not get EvtRecObject in TDS" << endreq;
122 return StatusCode::FAILURE;
123 }
124 EvtRecObject* devtTds = dynamic_cast<EvtRecObject*> (evt);
125 if ( ! devtTds ) {
126 log << MSG::ERROR << "EvtRecVeeVertexCnv: Could not downcast to TDS EvtRecObject" << endreq;
127 }
128
129 IOpaqueAddress *addr;
130 m_cnvSvc->getEvtRecCnv()->createRep(evt, addr);
132
133 const TObjArray* m_evtRecVeeVertexCol = recEvt->getEvtRecVeeVertexCol();
134 if ( ! m_evtRecVeeVertexCol ) return StatusCode::SUCCESS;
135
136 IDataProviderSvc* dataSvc = 0;
137 StatusCode sc = serviceLocator()->getService("EventDataSvc",
138 IDataProviderSvc::interfaceID(), (IInterface*&)dataSvc);
139 if ( sc.isFailure() ) {
140 log << MSG::FATAL << "Could not get EventDataSvc in EvtRecVeeVertexCnv" << endreq;
141 return sc;
142 }
143
144 EvtRecTrackCol::iterator evtRecTrackColbegin, evtRecTrackColend;
145
146 SmartDataPtr<EvtRecTrackCol> evtRecTrackCol(dataSvc, EventModel::EvtRec::EvtRecTrackCol);
147 if ( ! evtRecTrackCol) {
148 log << MSG::INFO << "Could not find EvtRecTrackCol" << endreq;
149 }
150 else {
151 evtRecTrackColbegin = evtRecTrackCol->begin();
152 evtRecTrackColend = evtRecTrackCol->end();
153 }
154
155 // convert
156 recEvt->clearEvtRecVeeVertexCol();
157 EvtRecVeeVertexCol::const_iterator evtRecVeeVertex = evtRecVeeVertexCol->begin();
158
159 for ( ; evtRecVeeVertex != evtRecVeeVertexCol->end(); evtRecVeeVertex++) {
160 EvtRecVeeVertex* ptr = *evtRecVeeVertex;
161 TEvtRecVeeVertex* evtRecVeeVertexRoot = new TEvtRecVeeVertex();
162 // set ...
163 evtRecVeeVertexRoot->setVertexId( ptr->vertexId() );
164 evtRecVeeVertexRoot->setVertexType( ptr->vertexType() );
165 evtRecVeeVertexRoot->setChi2( ptr->chi2() );
166 evtRecVeeVertexRoot->setNdof( ptr->ndof() );
167 evtRecVeeVertexRoot->setMass( ptr->mass() );
168
169 double wTrackParameter[7];
170 for (int i = 0; i < 7; i++) {
171 wTrackParameter[i] = ptr->w()[i];
172 }
173 evtRecVeeVertexRoot->setW( wTrackParameter );
174 double EwTrackParameter[28];
175 int i = 0;
176 for (int j = 0; j < 7; j++) {
177 for (int k = j; k < 7; k++) {
178 EwTrackParameter[i] = ptr->Ew()[j][k];
179 i++;
180 }
181 }
182 assert(i == 28);
183 evtRecVeeVertexRoot->setEw( EwTrackParameter );
184 int pairId[2];
185 pairId[0] = ptr->pair(0);
186 pairId[1] = ptr->pair(1);
187 evtRecVeeVertexRoot->setPair( pairId );
188 evtRecVeeVertexRoot->setNCharge( ptr->nCharge() );
189 evtRecVeeVertexRoot->setNTracks( ptr->nTracks() );
190
191 int daughterId[2];
192 if ( ptr->daughter(0).target() != NULL && ptr->daughter(1).target() != NULL ) {
193 assert(evtRecTrackColbegin != evtRecTrackColend);
194 EvtRecTrackCol::iterator it0 = find(evtRecTrackColbegin,
195 evtRecTrackColend, ptr->daughter(0).target());
196 EvtRecTrackCol::iterator it1 = find(evtRecTrackColbegin,
197 evtRecTrackColend, ptr->daughter(1).target());
198 assert(it0 != evtRecTrackColend);
199 assert(it1 != evtRecTrackColend);
200 daughterId[0] = it0 - evtRecTrackColbegin;
201 daughterId[1] = it1 - evtRecTrackColbegin;
202 evtRecVeeVertexRoot->setDaughter( daughterId );
203 }
204 recEvt->addEvtRecVeeVertex(evtRecVeeVertexRoot);
205 }
206
207 return StatusCode::SUCCESS;
208}
ObjectVector< EvtRecVeeVertex > EvtRecVeeVertexCol
IMessageSvc * msgSvc()
#define NULL
static TEvtRecObject * getWriteObject()
Definition EvtRecCnv.h:26
const std::pair< int, int > & pair() const
int vertexType() const
SmartRef< EvtRecTrack > & daughter(int i)
int vertexId() const
double mass() const
const HepVector & w() const
int nTracks() const
int nCharge() const
double chi2() const
const HepSymMatrix & Ew() const
EvtRecCnv * getEvtRecCnv()
Definition RootCnvSvc.h:159
RootCnvSvc * m_cnvSvc
IDataProviderSvc * m_eds
pointer to eventdataservice
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)
Convert the transient object to the requested representation.
void clearEvtRecVeeVertexCol()
void addEvtRecVeeVertex(TEvtRecVeeVertex *veeVertex)
const TObjArray * getEvtRecVeeVertexCol() const
void setDaughter(Int_t daughter[2])
void setW(Double_t w[7])
void setVertexId(Int_t vtxId)
void setPair(Int_t pair[2])
void setVertexType(Int_t vtxType)
void setEw(Double_t Ew[28])
void setChi2(Double_t chi2)
void setNTracks(Int_t nTracks)
void setNdof(Int_t ndof)
void setMass(Double_t mass)
void setNCharge(Int_t nCharge)
_EXTERN_ std::string Event
Definition EventModel.h:115
_EXTERN_ std::string EvtRecTrackCol
Definition EventModel.h:117

◆ TObjectToDataObject()

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

transformation from root

Implements RootEventBaseCnv.

Definition at line 28 of file EvtRecVeeVertexCnv.cxx.

28 {
29 // creation of TDS object from root object
30 MsgStream log(msgSvc(), "EvtRecVeeVertexCnv");
31 log << MSG::DEBUG << "EvtRecVeeVertexCnv::TObjectToDataObject" << endreq;
32
33 // create the TDS location for the EvtRecVeeVertex Collection
34 EvtRecVeeVertexCol* evtRecVeeVertexCol = new EvtRecVeeVertexCol;
35 refpObject = evtRecVeeVertexCol;
36
37 if ( ! m_evtRecVeeVertexCol ) return StatusCode::SUCCESS;
38
39 IDataProviderSvc* dataSvc = 0;
40 StatusCode sc = serviceLocator()->getService("EventDataSvc",
41 IDataProviderSvc::interfaceID(), (IInterface*&)dataSvc);
42 if ( sc.isFailure() ) {
43 log << MSG::FATAL << "Could not get EventDataSvc in EvtRecVeeVertexCnv" << endreq;
44 return sc;
45 }
46
47 SmartDataPtr<EvtRecTrackCol> evtRecTrackCol(dataSvc, EventModel::EvtRec::EvtRecTrackCol);
48 if ( ! evtRecTrackCol) {
49 log << MSG::INFO << "Could not find EvtRecTrackCol" << endreq;
50 }
51
52 // convert
53 TIter evtRecVeeVertexIter(m_evtRecVeeVertexCol);
54 TEvtRecVeeVertex* evtRecVeeVertexRoot = 0;
55 while ( (evtRecVeeVertexRoot = (TEvtRecVeeVertex*)evtRecVeeVertexIter.Next() ) ) {
56 EvtRecVeeVertex* evtRecVeeVertex = new EvtRecVeeVertex();
57 m_common.m_rootEvtRecVeeVertexMap[evtRecVeeVertexRoot] = evtRecVeeVertex;
58 // set ....
59 evtRecVeeVertex->setVertexId( evtRecVeeVertexRoot->vertexId() );
60 evtRecVeeVertex->setVertexType( evtRecVeeVertexRoot->vertexType() );
61 evtRecVeeVertex->setChi2( evtRecVeeVertexRoot->chi2() );
62 evtRecVeeVertex->setNdof( evtRecVeeVertexRoot->ndof() );
63 evtRecVeeVertex->setMass( evtRecVeeVertexRoot->mass() );
64
65 HepVector wTrackParameter(7, 0);
66 for (int i = 0; i < 7; i++) {
67 wTrackParameter[i] = evtRecVeeVertexRoot->w(i);
68 }
69 evtRecVeeVertex->setW( wTrackParameter );
70
71 HepSymMatrix EwTrackParameter(7, 0);
72 int i = 0;
73 for (int j = 0; j < 7; j++) {
74 for (int k = j; k < 7; k++) {
75 EwTrackParameter[j][k] = EwTrackParameter[k][j] = evtRecVeeVertexRoot->Ew(i);
76 i++;
77 }
78 }
79 evtRecVeeVertex->setEw( EwTrackParameter );
80
81 std::pair<int, int> pairId;
82 pairId.first = evtRecVeeVertexRoot->pair(0);
83 pairId.second = evtRecVeeVertexRoot->pair(1);
84 evtRecVeeVertex->setPair( pairId );
85 evtRecVeeVertex->setNCharge( evtRecVeeVertexRoot->nCharge() );
86 evtRecVeeVertex->setNTracks( evtRecVeeVertexRoot->nTracks() );
87 int evtRecTrackId0 = evtRecVeeVertexRoot->daughter(0);
88 if ( evtRecTrackId0 >= 0) {
89 evtRecVeeVertex->addDaughter(
90 dynamic_cast<EvtRecTrack*>(evtRecTrackCol->containedObject(evtRecTrackId0)), 0
91 );
92 }
93 int evtRecTrackId1 = evtRecVeeVertexRoot->daughter(1);
94 if ( evtRecTrackId1 >= 0) {
95 evtRecVeeVertex->addDaughter(
96 dynamic_cast<EvtRecTrack*>(evtRecTrackCol->containedObject(evtRecTrackId1)), 1
97 );
98 }
99
100 evtRecVeeVertexCol->push_back(evtRecVeeVertex);
101 }
102
103 delete m_evtRecVeeVertexCol;
104 m_evtRecVeeVertexCol = 0;
105 return StatusCode::SUCCESS;
106}
void setVertexType(int vtxType)
void setChi2(double chi2)
void addDaughter(const SmartRef< EvtRecTrack > &track, int i)
void setEw(const HepSymMatrix &Ew)
void setMass(double mass)
void setNdof(int ndof)
void setNTracks(int nTracks)
void setVertexId(int vtxId)
void setPair(const std::pair< int, int > &pair)
void setW(const HepVector &w)
void setNCharge(int nCharge)
Double_t chi2() const
Int_t nTracks() const
Int_t pair(Int_t i) const
Double_t w(Int_t i) const
Int_t vertexType() const
Int_t nCharge() const
Int_t daughter(Int_t i) const
Int_t ndof() const
Double_t mass() const
Double_t Ew(Int_t i) const
Int_t vertexId() const
static std::map< const TObject *, const EvtRecVeeVertex * > m_rootEvtRecVeeVertexMap
Definition commonData.h:254

Friends And Related Symbol Documentation

◆ CnvFactory< EvtRecVeeVertexCnv >

friend class CnvFactory< EvtRecVeeVertexCnv >
friend

Definition at line 9 of file EvtRecVeeVertexCnv.h.


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