BOSS 7.0.4
BESIII Offline Software System
Loading...
Searching...
No Matches
RecMdcTrackCnv Class Reference

#include <RecMdcTrackCnv.h>

+ Inheritance diagram for RecMdcTrackCnv:

Public Member Functions

virtual ~RecMdcTrackCnv ()
 
virtual ~RecMdcTrackCnv ()
 
- 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
 
 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
 
destinationoperator (const source &) const
 

Static Public Member Functions

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

Protected Member Functions

 RecMdcTrackCnv (ISvcLocator *svc)
 
virtual StatusCode DataObjectToTObject (DataObject *obj, RootAddress *addr)
 transformation to root
 
virtual StatusCode TObjectToDataObject (DataObject *&obj)
 transformation from root
 
 RecMdcTrackCnv (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
 
virtual destinationconvert (const source &) const =0
 

Friends

class CnvFactory< RecMdcTrackCnv >
 

Additional Inherited Members

- Public Types inherited from Converter< Ty1, Ty2 >
typedef Ty1 source
 
typedef Ty2 destination
 
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

Constructor & Destructor Documentation

◆ ~RecMdcTrackCnv() [1/2]

virtual RecMdcTrackCnv::~RecMdcTrackCnv ( )
inlinevirtual

◆ RecMdcTrackCnv() [1/2]

RecMdcTrackCnv::RecMdcTrackCnv ( ISvcLocator *  svc)
protected

Definition at line 33 of file RecMdcTrackCnv.cxx.

35{
36 // Here we associate this converter with the /Event path on the TDS.
37 MsgStream log(msgSvc(), "RecMdcTrackCnv");
38 //m_rootTreename ="Rec";
39 m_rootBranchname ="m_recMdcTrackCol";
40 //declareObject(EventModel::Recon::RecMdcTrackCol, objType(), m_rootTreename, m_rootBranchname);
41 m_adresses.push_back(&m_recMdcTrackCol);
42 m_recMdcTrackCol=0;
43}
std::vector< void * > m_adresses
each converter knows the corresponding adresses
std::string m_rootBranchname
root branchname (may be concatenated of severals)

◆ ~RecMdcTrackCnv() [2/2]

virtual RecMdcTrackCnv::~RecMdcTrackCnv ( )
inlinevirtual

◆ RecMdcTrackCnv() [2/2]

RecMdcTrackCnv::RecMdcTrackCnv ( ISvcLocator *  svc)
protected

Member Function Documentation

◆ classID() [1/2]

static const CLID & RecMdcTrackCnv::classID ( )
inlinestatic

Definition at line 20 of file Event/RootCnvSvc/RootCnvSvc-02-01-13/RootCnvSvc/Rec/RecMdcTrackCnv.h.

21 {
22 return CLID_RecMdcTrackCol;
23 }
const CLID & CLID_RecMdcTrackCol
Definition: EventModel.cxx:296

◆ classID() [2/2]

static const CLID & RecMdcTrackCnv::classID ( )
inlinestatic

◆ DataObjectToTObject() [1/2]

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

transformation to root

Implements RootEventBaseCnv.

Definition at line 186 of file RecMdcTrackCnv.cxx.

186 {
187
188 MsgStream log(msgSvc(), "RecMdcTrackCnv");
189 log << MSG::DEBUG << "RecMdcTrackCnv::DataObjectToTObject" << endreq;
190
191 RecMdcTrackCol * mdcTrackColTds=dynamic_cast<RecMdcTrackCol *> (obj);
192 if (!mdcTrackColTds) {
193 log << MSG::ERROR << "Could not downcast to MdcTrackCol" << endreq;
194 return StatusCode::FAILURE;
195 }
196 DataObject *evt;
197 StatusCode sc = m_eds->findObject(EventModel::Recon::Event,evt);
198 if (!sc.isSuccess()) {
199 log << MSG::ERROR << "Could not get ReconEvent in TDS " << endreq;
200 return StatusCode::FAILURE;
201 }
202 ReconEvent * devtTds=dynamic_cast<ReconEvent *> (evt);
203 if (!devtTds) {
204 log << MSG::ERROR << "RecMdcTrackCnv:Could not downcast to TDS ReconEvent" << endreq;
205 }
206
207 IOpaqueAddress *addr;
208
209 m_cnvSvc->getRecTrackCnv()->createRep(evt,addr);
211
212 const TObjArray *m_recMdcTrackCol = recEvt->getRecMdcTrackCol();
213 if (!m_recMdcTrackCol) return StatusCode::SUCCESS;
214 //necessary in case there is I/O at the same time since array is static
215 recEvt->clearRecMdcTrackCol();
216
217 RecMdcTrackCol::const_iterator recMdcTrack;
218 for (recMdcTrack = mdcTrackColTds->begin(); recMdcTrack != mdcTrackColTds->end(); recMdcTrack++) {
219 Int_t trackId =(*recMdcTrack)->trackId();
220 Double_t helix[5];
221 for(int i=0;i<5;i++){
222 log<<MSG::INFO<<" recMdcTrack.helix("<<i<<"): "<<(*recMdcTrack)->helix(i)<<endreq;
223 helix[i] = (*recMdcTrack)->helix(i);
224 }
225
226 Int_t stat = (*recMdcTrack)->stat();
227 Double_t chi = (*recMdcTrack)->chi2();
228 Int_t ndof = (*recMdcTrack)->ndof();
229 Int_t ns = (*recMdcTrack)->nster();
230 Int_t nlayer =(*recMdcTrack)->nlayer();
231
232 Double_t er[15];
233 for (Int_t i=0; i<15; i++){
234 er[i] = (*recMdcTrack)->err(i);
235 }
236 Int_t nh = (*recMdcTrack)->getNhits();
237 // vector<Int_t> vecHits = (*recMdcTrack)->vecHits();
238 Double_t vx0 = (*recMdcTrack)->getVX0();
239 Double_t vy0 = (*recMdcTrack)->getVY0();
240 Double_t vz0 = (*recMdcTrack)->getVZ0();
241 Double_t fiterm =(*recMdcTrack)->getFiTerm();
242
243 TRecMdcTrack *recMdcTrackRoot = new TRecMdcTrack();
244 //m_common.m_recMdcTrackMap[(*recMdcTrack)] = recMdcTrackRoot;
245
246 recMdcTrackRoot->setTrackId( trackId );
247 recMdcTrackRoot->setHelix(helix);
248 log<<MSG::INFO<<" test,recMdcTrackRoot.px: "<<recMdcTrackRoot->px()
249 <<" recMdcTrackRoot.py: "<<recMdcTrackRoot->py()
250 <<" recMdcTrackRoot.pz: "<<recMdcTrackRoot->pz()
251 <<endreq;
252
253 recMdcTrackRoot->setStat( stat );
254 recMdcTrackRoot->setChi2( chi );
255 recMdcTrackRoot->setNdof( ndof );
256 recMdcTrackRoot->setNlayer( nlayer );
257 recMdcTrackRoot->setErr( er );
258 recMdcTrackRoot->setNhits( nh );
259 recMdcTrackRoot->setNster( ns );
260 // recMdcTrackRoot->setVecHits(vecHits);
261 recMdcTrackRoot->setVX0( vx0 );
262 recMdcTrackRoot->setVY0( vy0 );
263 recMdcTrackRoot->setVZ0( vz0 );
264 recMdcTrackRoot->setFiTerm( fiterm );
265
266 recEvt->addRecMdcTrack(recMdcTrackRoot);
267 }
268
269
270 return StatusCode::SUCCESS;
271}
ObjectVector< RecMdcTrack > RecMdcTrackCol
static TRecTrackEvent * getWriteObject()
returns object to be written (maintained here for all DIGI-converters)
IDataProviderSvc * m_eds
pointer to eventdataservice
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)
Convert the transient object to the requested representation.
const Double_t pz() const
const Double_t px() const
const Double_t py() const
void addRecMdcTrack(TRecMdcTrack *Track)
Add a TkrTrack into the Mdc data collection.
void clearRecMdcTrackCol()
clear the whole array (necessary because of the consts-s)
const TObjArray * getRecMdcTrackCol() const
retrieve the whole TObjArray of RecMdcTrack Data
#define ns(x)
Definition: xmltok.c:1504

◆ DataObjectToTObject() [2/2]

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

transformation to root

Implements RootEventBaseCnv.

◆ TObjectToDataObject() [1/2]

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

transformation from root

Implements RootEventBaseCnv.

Definition at line 45 of file RecMdcTrackCnv.cxx.

45 {
46 // creation of TDS object from root object
47 MsgStream log(msgSvc(), "RecMdcTrackCnv");
48 log << MSG::DEBUG << "RecMdcTrackCnv::TObjectToDataObject" << endreq;
49
50 // create the TDS location for the RecMdcTrack Collection
51 RecMdcTrackCol* recMdcTrackCol = new RecMdcTrackCol;
52 refpObject = recMdcTrackCol;
53 // now convert
54 if (!m_recMdcTrackCol) return StatusCode::SUCCESS;
55 TIter mdcTrackIter(m_recMdcTrackCol);
56
57 //----------get hit smartRefVector--------
58 //HitRefVec *hitRefVec;
59 //int nTk=0;
60 //while (mdcTrackIter.Next()){ nTk++; }
61 //hitRefVec = new HitRefVec[nTk];
62
63 IDataProviderSvc* dataSvc = 0;
64 StatusCode sc = serviceLocator()->getService ("EventDataSvc",
65 IDataProviderSvc::interfaceID(), (IInterface*&)dataSvc);
66 if (!sc.isSuccess()) {
67 log << MSG::FATAL << "Could not get EventDataSvc in RecMdcTrackCnv" << endreq;
68 return( StatusCode::FAILURE);
69 }
70 SmartDataPtr<RecMdcHitCol> recMdcHitCol(dataSvc,"/Event/Recon/RecMdcHitCol");
71 if (!recMdcHitCol) {
72 log << MSG::FATAL << "Could not find RecMdcHitCol" << endreq;
73 return( StatusCode::FAILURE);
74 }
75 //RecMdcHitCol::iterator iter = recMdcHitCol->begin();
76 //for (;iter != recMdcHitCol->end(); iter++ ) {
77 // int tkId = (*iter)->getTrkId();
78 // hitRefVec[tkId].push_back(*iter);
79 //}
80
81 //---------------------------------------
82 mdcTrackIter = m_recMdcTrackCol;
83 TRecMdcTrack *recMdcTrackRoot = 0;
84 while ((recMdcTrackRoot = (TRecMdcTrack*)mdcTrackIter.Next())) {
85 int trackId = recMdcTrackRoot->trackId();
86 int charge = recMdcTrackRoot->charge();
87 double helix[5];
88 for(int i=0;i<5; i++){
89 helix[i] = recMdcTrackRoot->helix(i);
90 }
91 double pxy = recMdcTrackRoot->pxy();
92 double px = recMdcTrackRoot->px();
93 double py = recMdcTrackRoot->py();
94 double pz = recMdcTrackRoot->pz();
95 double p = recMdcTrackRoot->p();
96 double theta = recMdcTrackRoot->theta();
97 double phi = recMdcTrackRoot->phi();
98 double x = recMdcTrackRoot->x();
99 double y = recMdcTrackRoot->y();
100 double z = recMdcTrackRoot->z();
101 double r = recMdcTrackRoot->r();
102 int stat = recMdcTrackRoot->stat();
103 double chi = recMdcTrackRoot->chi2();
104 int ndof = recMdcTrackRoot->ndof();
105 int nlayer= recMdcTrackRoot->nlayer();
106 double err[15];
107 for (int i=0; i<15; i++){
108 err[i] = recMdcTrackRoot->err(i);
109 }
110 int nh = recMdcTrackRoot->nhits();
111 int ns = recMdcTrackRoot->nster();
112 // vector<int> vecHits = recMdcTrackRoot->vecHits();
113 double vx0 = recMdcTrackRoot->vx0();
114 double vy0 = recMdcTrackRoot->vy0();
115 double vz0 = recMdcTrackRoot->vz0();
116 double fiterm = recMdcTrackRoot->fiTerm();
117 RecMdcTrack *recMdcTrack = new RecMdcTrack();
118 m_common.m_rootRecMdcTrackMap[recMdcTrackRoot] = recMdcTrack;
119
120 recMdcTrack->setTrackId( trackId );
121 recMdcTrack->setCharge( charge );
122 recMdcTrack->setHelix( helix );
123 recMdcTrack->setPxy( pxy );
124 recMdcTrack->setPx( px );
125 recMdcTrack->setPy( py );
126 recMdcTrack->setPz( pz );
127 recMdcTrack->setP( p );
128 recMdcTrack->setTheta( theta );
129 recMdcTrack->setPhi( phi );
130 recMdcTrack->setX( x );
131 recMdcTrack->setY( y );
132 recMdcTrack->setZ( z );
133 recMdcTrack->setR( r );
134 recMdcTrack->setStat( stat );
135 recMdcTrack->setChi2( chi );
136 recMdcTrack->setNdof( ndof );
137 recMdcTrack->setError( err );
138 recMdcTrack->setNhits( nh );
139 recMdcTrack->setNster( ns );
140 recMdcTrack->setNlayer( nlayer );
141 // recMdcTrack->setVecHits( vecHits );
142 //rec
143 recMdcTrack->setVX0( vx0 );
144 recMdcTrack->setVY0( vy0 );
145 recMdcTrack->setVZ0( vz0 );
146 recMdcTrack->setFiTerm( fiterm );
147
148 HitRefVec theHitRefVec;
149
150 RecMdcHitCol::iterator iter = recMdcHitCol->begin();
151 for (;iter != recMdcHitCol->end(); iter++){
152
153 //cout<<" (*iter)->getTrkId(): "<<(*iter)->getTrkId()<<endl;
154 if((*iter)->getTrkId() == trackId){
155 SmartRef<RecMdcHit> refhit(*iter);
156 theHitRefVec.push_back(refhit);
157 }
158 }
159
160 recMdcTrack->setVecHits(theHitRefVec);
161
162 int nhits = recMdcTrack->getVecHits().size();
163
164 //std::cout<<" mdc hits: "<<nhits<< std::endl;
165
166 for(int ii=0; ii <nhits ; ii++){
167
168 //cout<<"ddl: "<<(recMdcTrack->getVecHits()[ii])->getDriftDistLeft()<<endl;
169 //cout<<"erddl: "<<(recMdcTrack->getVecHits()[ii])->getErrDriftDistLeft()<<endl;
170 Identifier id(recMdcTrack->getVecHits()[ii]->getMdcId());
171 int layer = MdcID::layer(id);
172 int wire = MdcID::wire(id);
173 //cout<<"layer: "<<layer<<" wire: "<<wire<<endl;
174 }
175 recMdcTrackCol->push_back(recMdcTrack);
176 }
177
178 delete m_recMdcTrackCol;
179 m_recMdcTrackCol = 0;
180 return StatusCode::SUCCESS;
181}
Double_t x[10]
EvtStreamInputIterator< typename Generator::result_type > iter(Generator gen, int N=0)
SmartRefVector< RecMdcHit > HitRefVec
void setError(double err[15])
void setHelix(double helix[5])
Definition: DstMdcTrack.cxx:98
static int layer(const Identifier &id)
Values of different levels (failure returns 0)
Definition: MdcID.cxx:49
static int wire(const Identifier &id)
Definition: MdcID.cxx:54
const Double_t x() const
const Double_t phi() const
const Double_t z() const
const Double_t p() const
const Double_t y() const
const Double_t pxy() const
const Double_t theta() const
const Double_t r() const
const Int_t charge() const
static std::map< const TObject *, const RecMdcTrack * > m_rootRecMdcTrackMap

◆ TObjectToDataObject() [2/2]

virtual StatusCode RecMdcTrackCnv::TObjectToDataObject ( DataObject *&  obj)
protectedvirtual

transformation from root

Implements RootEventBaseCnv.

Friends And Related Function Documentation

◆ CnvFactory< RecMdcTrackCnv >


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