BOSS 6.6.4.p03
BESIII Offline Software System
Loading...
Searching...
No Matches
ExtTrackCnv Class Reference

#include <ExtTrackCnv.h>

+ Inheritance diagram for ExtTrackCnv:

Public Member Functions

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

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

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 ExtTrackCnv.h.

Constructor & Destructor Documentation

◆ ~ExtTrackCnv()

virtual ExtTrackCnv::~ExtTrackCnv ( )
inlinevirtual

Definition at line 25 of file ExtTrackCnv.h.

25{ };

◆ ExtTrackCnv()

ExtTrackCnv::ExtTrackCnv ( ISvcLocator *  svc)
protected

Definition at line 38 of file ExtTrackCnv.cxx.

40{
41 // Here we associate this converter with the /Event path on the TDS.
42 MsgStream log(msgSvc(), "ExtTrackCnv");
43 // log << MSG::DEBUG << "Constructor called for " << objType() << endreq;
44 m_rootBranchname ="m_extTrackCol";
45 //declareObject(EventModel::Dst::DstExtTrackCol, objType(), m_rootTreename, m_rootBranchname);
46 m_adresses.push_back(&m_extTrackCol);
47 m_extTrackCol=0;
48}
IMessageSvc * msgSvc()
static const CLID & classID()
Definition: ExtTrackCnv.h:20
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 & ExtTrackCnv::classID ( )
inlinestatic

Definition at line 20 of file ExtTrackCnv.h.

21 {
22 return CLID_DstExtTrackCol;
23 }
const CLID & CLID_DstExtTrackCol
Definition: EventModel.cxx:267

◆ DataObjectToTObject()

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

transformation to root

Implements RootEventBaseCnv.

Definition at line 218 of file ExtTrackCnv.cxx.

218 {
219
220 MsgStream log(msgSvc(), "ExtTrackCnv");
221 log << MSG::DEBUG << "ExtTrackCnv::DataObjectToTObject" << endreq;
222 StatusCode sc=StatusCode::SUCCESS;
223
224 DstExtTrackCol * extTrackColTds=dynamic_cast<DstExtTrackCol *> (obj);
225 if (!extTrackColTds) {
226 log << MSG::ERROR << "Could not downcast to DstExtTrackCol" << endreq;
227 return StatusCode::FAILURE;
228 }
229
230 DataObject *evt;
231 m_eds->findObject(EventModel::Dst::Event,evt);
232 if (evt==NULL) {
233 log << MSG::ERROR << "Could not get ReconEvent in TDS " << endreq;
234 return StatusCode::FAILURE;
235 }
236
237 DstEvent * devtTds=dynamic_cast<DstEvent *> (evt);
238 if (!devtTds) {
239 log << MSG::ERROR << "ExtTrackCnv:Could not downcast to TDS Dst Event" << endreq;
240 }
241 IOpaqueAddress *addr;
242
243 m_cnvSvc->getDstCnv()->createRep(evt,addr);
245
246 const TObjArray *m_extTrackCol = recEvt->getExtTrackCol();
247
248 if (!m_extTrackCol) return sc;
249
250 recEvt->clearExtTrackCol(); //necessary in case there is I/O at the same time since array is static
251 DstExtTrackCol::const_iterator extTrackTds;
252
253 for (extTrackTds = extTrackColTds->begin(); extTrackTds != extTrackColTds->end(); extTrackTds++) {
254 //Get Data from TDS
255 Int_t trackId = (*extTrackTds)->GetTrackId();
256 //Tof layer1
257 Double_t p1x = (*extTrackTds)->tof1Position().x();
258 Double_t p1y = (*extTrackTds)->tof1Position().y();
259 Double_t p1z = (*extTrackTds)->tof1Position().z();
260 Double_t m1x = (*extTrackTds)->tof1Momentum().x();
261 Double_t m1y = (*extTrackTds)->tof1Momentum().y();
262 Double_t m1z = (*extTrackTds)->tof1Momentum().z();
263
264 TString v1s = (*extTrackTds)->tof1VolumeName() ;
265 Int_t v1n = (*extTrackTds)->tof1VolumeNumber() ;
266 Double_t tof1= (*extTrackTds)->tof1();
267 Double_t tof1p = (*extTrackTds)->tof1Path();
268 Double_t z1 = (*extTrackTds)->tof1PosSigmaAlongZ();
269 Double_t t1 = (*extTrackTds)->tof1PosSigmaAlongT();
270 Double_t x1 = (*extTrackTds)->tof1PosSigmaAlongX();
271 Double_t y1 = (*extTrackTds)->tof1PosSigmaAlongY();
272 Double_t e1m[6][6];
273 HepSymMatrix e1mTds = (*extTrackTds)->tof1ErrorMatrix();
274 for (int i = 0;i<6 ;i++ )
275 for (int j= 0;j<6 ;j++ )
276 e1m[i][j] = e1mTds[i][j];
277
278 //Tof llayer2
279 Double_t p2x = (*extTrackTds)->tof2Position().x();
280 Double_t p2y = (*extTrackTds)->tof2Position().y();
281 Double_t p2z = (*extTrackTds)->tof2Position().z();
282 Double_t m2x = (*extTrackTds)->tof2Momentum().x();
283 Double_t m2y = (*extTrackTds)->tof2Momentum().y();
284 Double_t m2z = (*extTrackTds)->tof2Momentum().z();
285
286 TString v2s = (*extTrackTds)->tof2VolumeName() ;
287 Int_t v2n = (*extTrackTds)->tof2VolumeNumber() ;
288 Double_t tof2= (*extTrackTds)->tof2();
289 Double_t tof2p = (*extTrackTds)->tof2Path();
290 Double_t z2 = (*extTrackTds)->tof2PosSigmaAlongZ();
291 Double_t t2 = (*extTrackTds)->tof2PosSigmaAlongT();
292 Double_t x2 = (*extTrackTds)->tof2PosSigmaAlongX();
293 Double_t y2 = (*extTrackTds)->tof2PosSigmaAlongY();
294 Double_t e2m[6][6];
295 HepSymMatrix e2mTds = (*extTrackTds)->tof2ErrorMatrix();
296 for (int i = 0;i<6 ;i++ )
297 for (int j= 0;j<6 ;j++ )
298 e2m[i][j] = e2mTds[i][j];
299 //Emc
300 Double_t pEx = (*extTrackTds)->emcPosition().x();
301 Double_t pEy = (*extTrackTds)->emcPosition().y();
302 Double_t pEz = (*extTrackTds)->emcPosition().z();
303 Double_t mEx = (*extTrackTds)->emcMomentum().x();
304 Double_t mEy = (*extTrackTds)->emcMomentum().y();
305 Double_t mEz = (*extTrackTds)->emcMomentum().z();
306
307 TString vEs = (*extTrackTds)->emcVolumeName() ;
308 Int_t vEn = (*extTrackTds)->emcVolumeNumber() ;
309
310 Double_t theta = (*extTrackTds)->emcPosSigmaAlongTheta();
311 Double_t phi = (*extTrackTds)->emcPosSigmaAlongPhi();
312
313 Double_t eEm[6][6];
314 HepSymMatrix eEmTds = (*extTrackTds)->emcErrorMatrix();
315 for (int i = 0;i<6 ;i++ )
316 for (int j= 0;j<6 ;j++ )
317 eEm[i][j] = eEmTds[i][j];
318 Double_t emcPath=(*extTrackTds)->emcPath();
319
320 //Muc
321 Double_t pMx = (*extTrackTds)->mucPosition().x();
322 Double_t pMy = (*extTrackTds)->mucPosition().y();
323 Double_t pMz = (*extTrackTds)->mucPosition().z();
324 Double_t mMx = (*extTrackTds)->mucMomentum().x();
325 Double_t mMy = (*extTrackTds)->mucMomentum().y();
326 Double_t mMz = (*extTrackTds)->mucMomentum().z();
327
328 TString vMs = (*extTrackTds)->mucVolumeName() ;
329 Int_t vMn = (*extTrackTds)->mucVolumeNumber() ;
330
331 Double_t zM = (*extTrackTds)->mucPosSigmaAlongZ();
332 Double_t tM = (*extTrackTds)->mucPosSigmaAlongT();
333 Double_t xM = (*extTrackTds)->mucPosSigmaAlongX();
334 Double_t yM = (*extTrackTds)->mucPosSigmaAlongY();
335
336 Double_t eMm[6][6];
337 HepSymMatrix eMmTds = (*extTrackTds)->mucErrorMatrix();
338 for (int i = 0;i<6 ;i++ )
339 for (int j= 0;j<6 ;j++ )
340 eMm[i][j]= eMmTds[i][j];
341
342 //ExtMucHitVec
343 /*ExtMucHitVec vecHit = (*extTrackTds)->GetExtMucHitVec();
344 Int_t size = vecHit.size();*/
345
346 TExtTrack *extTrackRoot = new TExtTrack();
347 //m_common.m_extTrackMap[(*extTrackTds)] = extTrackRoot;
348
349 //Set to Root
350
351 //ExtMucHitVec
352 /*extTrackRoot->SetSize(size);
353 for(int i=0;i<size;i++){
354 Double_t px = vecHit[i].GetPosition().x();
355 Double_t py = vecHit[i].GetPosition().y();
356 Double_t pz = vecHit[i].GetPosition().z();
357 Double_t mx = vecHit[i].GetMomentum().x();
358 Double_t my = vecHit[i].GetMomentum().y();
359 Double_t mz = vecHit[i].GetMomentum().z();
360 TString vs = vecHit[i].GetVolumeName();
361 Int_t vn = vecHit[i].GetVolumeNumber();
362 Double_t z = vecHit[i].GetPosSigmaAlongZ();
363 Double_t t = vecHit[i].GetPosSigmaAlongT();
364 Double_t x = vecHit[i].GetPosSigmaAlongX();
365 Double_t y = vecHit[i].GetPosSigmaAlongY();
366 Double_t m[6][6];
367 HepSymMatrix mTds = vecHit[i].GetErrorMatrix();
368 for (int j = 0;j<6;j++)
369 for(int k=0;k<6;k++)
370 m[i][j] = mTds[i][j];
371 extTrackRoot->SetExtMucHit(px,py,pz,mx,my,mz,vs,vn,z,t,y,x,m);
372 }*/
373
374 //Set to Root
375 extTrackRoot->SetTrackId(trackId);
376 //Tof layer1
377 extTrackRoot->SetTof1PositionX(p1x);
378 extTrackRoot->SetTof1PositionY(p1y);
379 extTrackRoot->SetTof1PositionZ(p1z);
380 extTrackRoot->SetTof1MomentumX(m1x);
381 extTrackRoot->SetTof1MomentumY(m1y);
382 extTrackRoot->SetTof1MomentumZ(m1z);
383
384 extTrackRoot->SetTof1VolumeName(v1s);
385 extTrackRoot->SetTof1VolumeNumber(v1n);
386
387 extTrackRoot->SetTof1(tof1);
388 extTrackRoot->SetTof1Path(tof1p);
389
390 extTrackRoot->SetTof1PosSigmaAlongZ(z1);
391 extTrackRoot->SetTof1PosSigmaAlongT(t1);
392 extTrackRoot->SetTof1PosSigmaAlongX(x1);
393 extTrackRoot->SetTof1PosSigmaAlongY(y1);
394
395 extTrackRoot->SetTof1ErrorMatrix(e1m);
396 //Tof layer2
397 extTrackRoot->SetTof2PositionX(p2x);
398 extTrackRoot->SetTof2PositionY(p2y);
399 extTrackRoot->SetTof2PositionZ(p2z);
400 extTrackRoot->SetTof2MomentumX(m2x);
401 extTrackRoot->SetTof2MomentumY(m2y);
402 extTrackRoot->SetTof2MomentumZ(m2z);
403
404 extTrackRoot->SetTof2VolumeName(v2s);
405 extTrackRoot->SetTof2VolumeNumber(v2n);
406
407 extTrackRoot->SetTof2(tof2);
408 extTrackRoot->SetTof2Path(tof2p);
409
410 extTrackRoot->SetTof2PosSigmaAlongZ(z2);
411 extTrackRoot->SetTof2PosSigmaAlongT(t2);
412 extTrackRoot->SetTof2PosSigmaAlongX(x2);
413 extTrackRoot->SetTof2PosSigmaAlongY(y2);
414
415 extTrackRoot->SetTof2ErrorMatrix(e2m);
416 //Emc
417 extTrackRoot->SetEmcPositionX(pEx);
418 extTrackRoot->SetEmcPositionY(pEy);
419 extTrackRoot->SetEmcPositionZ(pEz);
420 extTrackRoot->SetEmcMomentumX(mEx);
421 extTrackRoot->SetEmcMomentumY(mEy);
422 extTrackRoot->SetEmcMomentumZ(mEz);
423
424 extTrackRoot->SetEmcVolumeName(vEs);
425 extTrackRoot->SetEmcVolumeNumber(vEn);
426
427 extTrackRoot->SetEmcPosSigmaAlongTheta(theta);
428 extTrackRoot->SetEmcPosSigmaAlongPhi(phi);
429
430 extTrackRoot->SetEmcErrorMatrix(eEm);
431 extTrackRoot->SetEmcPath(emcPath);
432 //Muc
433 extTrackRoot->SetMucPositionX(pMx);
434 extTrackRoot->SetMucPositionY(pMy);
435 extTrackRoot->SetMucPositionZ(pMz);
436 extTrackRoot->SetMucMomentumX(mMx);
437 extTrackRoot->SetMucMomentumY(mMy);
438 extTrackRoot->SetMucMomentumZ(mMz);
439
440 extTrackRoot->SetMucVolumeName(vMs);
441 extTrackRoot->SetMucVolumeNumber(vMn);
442
443 extTrackRoot->SetMucPosSigmaAlongZ(zM);
444 extTrackRoot->SetMucPosSigmaAlongT(tM);
445 extTrackRoot->SetMucPosSigmaAlongX(xM);
446 extTrackRoot->SetMucPosSigmaAlongY(yM);
447
448 extTrackRoot->SetMucErrorMatrix(eMm);
449
450 recEvt->addExtTrack(extTrackRoot);
451 }
452
453 return StatusCode::SUCCESS;
454}
ObjectVector< DstExtTrack > DstExtTrackCol
Definition: DstExtTrack.h:295
static TDstEvent * getWriteObject()
returns object to be written (maintained here for all DIGI-converters)
Definition: DstCnv.h:36
DstCnv * getDstCnv()
Definition: RootCnvSvc.h:148
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 addExtTrack(TExtTrack *Track)
Add a ExtTrack into the Ext Data collection.
Definition: TDstEvent.cxx:175
void clearExtTrackCol()
clear the whole array
Definition: TDstEvent.h:105
const TObjArray * getExtTrackCol() const
retrieve the whole TObjArray of Ext Data
Definition: TDstEvent.h:96
void SetTof2MomentumY(const Double_t Tof2MomentumY)
Definition: TExtTrack.h:44
void SetTof2(const Double_t Tof2)
Definition: TExtTrack.h:49
void SetTof1PosSigmaAlongZ(const Double_t Tof1PosSigmaAlongZ)
Definition: TExtTrack.h:31
void SetTof1PosSigmaAlongX(const Double_t Tof1PosSigmaAlongX)
Definition: TExtTrack.h:33
void SetTof2MomentumX(const Double_t Tof2MomentumX)
Definition: TExtTrack.h:43
void SetEmcMomentumY(const Double_t EmcMomentumY)
Definition: TExtTrack.h:64
void SetMucMomentumY(const Double_t MucMomentumY)
Definition: TExtTrack.h:84
void SetMucVolumeName(const TString MucVolumeName)
Definition: TExtTrack.h:87
void SetTof1MomentumX(const Double_t Tof1MomentumX)
Definition: TExtTrack.h:23
void SetEmcVolumeNumber(const Int_t EmcVolumeNumber)
Definition: TExtTrack.h:68
void SetTof1VolumeNumber(const Int_t Tof1VolumeNumber)
Definition: TExtTrack.h:28
void SetTof1PositionY(const Double_t Tof1PositionY)
Definition: TExtTrack.h:21
void SetTof1PosSigmaAlongY(const Double_t Tof1PosSigmaAlongY)
Definition: TExtTrack.h:34
void SetEmcErrorMatrix(const Double_t EmcErrorMatrix[6][6])
Definition: TExtTrack.h:73
void SetEmcPositionX(const Double_t EmcPositionX)
Definition: TExtTrack.h:60
void SetMucVolumeNumber(const Int_t MucVolumeNumber)
Definition: TExtTrack.h:88
void SetMucErrorMatrix(const Double_t MucErrorMatrix[6][6])
Definition: TExtTrack.h:95
void SetTof1PosSigmaAlongT(const Double_t Tof1PosSigmaAlongT)
Definition: TExtTrack.h:32
void SetMucPosSigmaAlongX(const Double_t MucPosSigmaAlongX)
Definition: TExtTrack.h:92
void SetEmcMomentumZ(const Double_t EmcMomentumZ)
Definition: TExtTrack.h:65
void SetTof1Path(const Double_t Tof1Path)
Definition: TExtTrack.h:30
void SetEmcMomentumX(const Double_t EmcMomentumX)
Definition: TExtTrack.h:63
void SetTof2VolumeName(const TString Tof2VolumeName)
Definition: TExtTrack.h:47
void SetTof1(const Double_t Tof1)
Definition: TExtTrack.h:29
void SetTof2PosSigmaAlongY(const Double_t Tof2PosSigmaAlongY)
Definition: TExtTrack.h:54
void SetMucPosSigmaAlongY(const Double_t MucPosSigmaAlongY)
Definition: TExtTrack.h:93
void SetTof2ErrorMatrix(const Double_t Tof2ErrorMatrix[6][6])
Definition: TExtTrack.h:55
void SetMucPositionX(const Double_t MucPositionX)
Definition: TExtTrack.h:80
void SetTof2Path(const Double_t Tof2Path)
Definition: TExtTrack.h:50
void SetTof2PosSigmaAlongZ(const Double_t Tof2PosSigmaAlongZ)
Definition: TExtTrack.h:51
void SetMucPosSigmaAlongT(const Double_t MucPosSigmaAlongT)
Definition: TExtTrack.h:91
void SetMucMomentumZ(const Double_t MucMomentumZ)
Definition: TExtTrack.h:85
void SetTof1PositionZ(const Double_t Tof1PositionZ)
Definition: TExtTrack.h:22
void SetMucPosSigmaAlongZ(const Double_t MucPosSigmaAlongZ)
Definition: TExtTrack.h:90
void SetTof2PosSigmaAlongX(const Double_t Tof2PosSigmaAlongX)
Definition: TExtTrack.h:53
void SetTrackId(const Int_t trackId)
Definition: TExtTrack.h:18
void SetEmcPositionZ(const Double_t EmcPositionZ)
Definition: TExtTrack.h:62
void SetTof2PositionZ(const Double_t Tof2PositionZ)
Definition: TExtTrack.h:42
void SetTof1PositionX(const Double_t Tof1PositionX)
Definition: TExtTrack.h:20
void SetTof2PosSigmaAlongT(const Double_t Tof2PosSigmaAlongT)
Definition: TExtTrack.h:52
void SetTof2VolumeNumber(const Int_t Tof2VolumeNumber)
Definition: TExtTrack.h:48
void SetEmcVolumeName(const TString EmcVolumeName)
Definition: TExtTrack.h:67
void SetTof1MomentumY(const Double_t Tof1MomentumY)
Definition: TExtTrack.h:24
void SetTof2PositionY(const Double_t Tof2PositionY)
Definition: TExtTrack.h:41
void SetMucMomentumX(const Double_t MucMomentumX)
Definition: TExtTrack.h:83
void SetMucPositionZ(const Double_t MucPositionZ)
Definition: TExtTrack.h:82
void SetEmcPath(Double_t path)
Definition: TExtTrack.h:77
void SetTof1ErrorMatrix(const Double_t Tof1ErrorMatrix[6][6])
Definition: TExtTrack.h:35
void SetTof2MomentumZ(const Double_t Tof2MomentumZ)
Definition: TExtTrack.h:45
void SetTof1MomentumZ(const Double_t Tof1MomentumZ)
Definition: TExtTrack.h:25
void SetEmcPosSigmaAlongTheta(const Double_t EmcPosSigmaAlongTheta)
Definition: TExtTrack.h:70
void SetTof2PositionX(const Double_t Tof2PositionX)
Definition: TExtTrack.h:40
void SetTof1VolumeName(const TString Tof1VolumeName)
Definition: TExtTrack.h:27
void SetEmcPositionY(const Double_t EmcPositionY)
Definition: TExtTrack.h:61
void SetMucPositionY(const Double_t MucPositionY)
Definition: TExtTrack.h:81
void SetEmcPosSigmaAlongPhi(const Double_t EmcPosSigmaAlongPhi)
Definition: TExtTrack.h:71
_EXTERN_ std::string Event
Definition: EventModel.h:123

◆ TObjectToDataObject()

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

transformation from root

Implements RootEventBaseCnv.

Definition at line 50 of file ExtTrackCnv.cxx.

50 {
51 // creation of TDS object from root object
52
53 MsgStream log(msgSvc(), "ExtTrackCnv");
54 log << MSG::DEBUG << "ExtTrackCnv::TObjectToDataObject" << endreq;
55 StatusCode sc=StatusCode::SUCCESS;
56
57 // create the TDS location for the ExtTrack Collection
58 DstExtTrackCol* extTrackTdsCol = new DstExtTrackCol;
59 refpObject=extTrackTdsCol;
60
61
62 // now convert
63 if (!m_extTrackCol) return sc;
64 TIter extTrackIter(m_extTrackCol);
65 TExtTrack *extTrackRoot = 0;
66 while ((extTrackRoot = (TExtTrack*)extTrackIter.Next())) {
67
68 int trackId = extTrackRoot->GetTrackId();
69 //Tof layer1:
70 double p1x = extTrackRoot->GetTof1PositionX();
71 double p1y = extTrackRoot->GetTof1PositionY();
72 double p1z = extTrackRoot->GetTof1PositionZ();
73 double m1x = extTrackRoot->GetTof1MomentumX();
74 double m1y = extTrackRoot->GetTof1MomentumY();
75 double m1z = extTrackRoot->GetTof1MomentumZ();
76 Hep3Vector tof1p(p1x,p1y,p1z);
77 Hep3Vector tof1m(m1x,m1y,m1z);
78
79 // char * pTof1 = extTrackRoot->GetTof1VolumeName().Data();
80 string v1s = extTrackRoot->GetTof1VolumeName().Data();
81 int v1n = extTrackRoot->GetTof1VolumeNumber() ;
82 double tof1= extTrackRoot->GetTof1();
83 double tof1path= extTrackRoot->GetTof1Path();
84 double z1 = extTrackRoot->GetTof1PosSigmaAlongZ();
85 double t1 = extTrackRoot->GetTof1PosSigmaAlongT();
86 double x1 = extTrackRoot->GetTof1PosSigmaAlongX();
87 double y1 = extTrackRoot->GetTof1PosSigmaAlongY();
88 HepSymMatrix e1m(6) ;
89 for (int i = 0;i<6 ;i++ )
90 for (int j= 0;j<6 ;j++ )
91 e1m[i][j]= extTrackRoot->GetTof1ErrorMatrix(i , j) ;
92
93 //Tof layer2:
94 double p2x = extTrackRoot->GetTof2PositionX() ;
95 double p2y = extTrackRoot->GetTof2PositionY() ;
96 double p2z = extTrackRoot->GetTof2PositionZ() ;
97 double m2x = extTrackRoot->GetTof2MomentumX() ;
98 double m2y = extTrackRoot->GetTof2MomentumY() ;
99 double m2z = extTrackRoot->GetTof2MomentumZ();
100 Hep3Vector tof2p(p2x,p2y,p2z);
101 Hep3Vector tof2m(m2x,m2y,m2z);
102
103 string v2s = extTrackRoot->GetTof2VolumeName().Data();
104 int v2n = extTrackRoot->GetTof2VolumeNumber() ;
105 double tof2= extTrackRoot->GetTof2();
106 double tof2path = extTrackRoot->GetTof2Path();
107 double z2 = extTrackRoot->GetTof2PosSigmaAlongZ() ;
108 double t2 = extTrackRoot->GetTof2PosSigmaAlongT();
109 double x2 = extTrackRoot->GetTof2PosSigmaAlongX();
110 double y2 = extTrackRoot->GetTof2PosSigmaAlongY();
111 HepSymMatrix e2m(6) ;
112 for (int i = 0;i<6 ;i++ )
113 for (int j= 0;j<6 ;j++ )
114 e2m[i][j]= extTrackRoot->GetTof2ErrorMatrix(i,j) ;
115
116 //Emc
117 double pEx = extTrackRoot->GetEmcPositionX();
118 double pEy = extTrackRoot->GetEmcPositionY();
119 double pEz = extTrackRoot->GetEmcPositionZ();
120 double mEx = extTrackRoot->GetEmcMomentumX();
121 double mEy = extTrackRoot->GetEmcMomentumY();
122 double mEz = extTrackRoot->GetEmcMomentumZ();
123 Hep3Vector Ep(pEx,pEy,pEz);
124 Hep3Vector Em(mEx,mEy,mEz);
125
126 string vEs = extTrackRoot->GetEmcVolumeName().Data();
127 int vEn = extTrackRoot->GetEmcVolumeNumber();
128 double theta = extTrackRoot->GetEmcPosSigmaAlongTheta();
129 double phi = extTrackRoot->GetEmcPosSigmaAlongPhi();
130 HepSymMatrix eEm(6) ;
131 for(int i=0;i<6 ;i++ )
132 for(int j= 0;j<6 ;j++ )
133 eEm[i][j]= extTrackRoot->GetEmcErrorMatrix(i,j);
134 double emcPath=extTrackRoot->emcPath();
135
136 //Muc
137 double pMx = extTrackRoot->GetMucPositionX() ;
138 double pMy = extTrackRoot->GetMucPositionY() ;
139 double pMz = extTrackRoot->GetMucPositionZ() ;
140 double mMx = extTrackRoot->GetMucMomentumX() ;
141 double mMy = extTrackRoot->GetMucMomentumY() ;
142 double mMz = extTrackRoot->GetMucMomentumZ();
143 Hep3Vector Mp(pMx,pMy,pMz);
144 Hep3Vector Mm(mMx,mMy,mMz);
145
146 string vMs = extTrackRoot->GetMucVolumeName().Data();
147 int vMn = extTrackRoot->GetMucVolumeNumber() ;
148
149 double zM = extTrackRoot->GetMucPosSigmaAlongZ() ;
150 double tM = extTrackRoot->GetMucPosSigmaAlongT();
151 double xM = extTrackRoot->GetMucPosSigmaAlongX();
152 double yM = extTrackRoot->GetMucPosSigmaAlongY();
153 HepSymMatrix eMm(6) ;
154 for (int i = 0;i<6 ;i++ )
155 for (int j= 0;j<6 ;j++ )
156 eMm[i][j]= extTrackRoot->GetMucErrorMatrix(i,j) ;
157
158 DstExtTrack *extTrackTds = new DstExtTrack();
159 m_common.m_rootExtTrackMap[extTrackRoot] = extTrackTds;
160
161 //ExtMucHitVec
162 /*int size = extTrackRoot->GetSize();
163 ExtMucHit aExtMucHit;
164 // Hep3Vector p(0,0,0);
165 // Hep3Vector m(0,0,0);
166 string vs;
167 int vn;
168 double z;
169 double t;
170 double x;
171 double y;
172 HepSymMatrix matrix(6);
173 for(int i =0;i<size;i++){
174 double px = extTrackRoot->GetPositionX(i) ;
175 double py = extTrackRoot->GetPositionY(i) ;
176 double pz = extTrackRoot->GetPositionZ(i) ;
177 Hep3Vector p(px,py,pz);
178 double mx = extTrackRoot->GetMomentumX(i) ;
179 double my = extTrackRoot->GetMomentumY(i) ;
180 double mz = extTrackRoot->GetMomentumZ(i);
181 Hep3Vector m(mx,my,mz);
182 vs = extTrackRoot->GetVolumeName(i).Data();
183 vn = extTrackRoot->GetVolumeNumber(i) ;
184 z = extTrackRoot->GetPosSigmaAlongZ(i) ;
185 t = extTrackRoot->GetPosSigmaAlongT(i);
186 x = extTrackRoot->GetPosSigmaAlongX(i);
187 y = extTrackRoot->GetPosSigmaAlongY(i);
188 std::vector<double> vecError = extTrackRoot->GetErrorMatrix(i);
189 for(int k =0;i<6;k++){
190 for(int j =0; j<6;j++){
191 matrix[k][j] = vecError[k*6+j];
192 }
193 }
194 aExtMucHit.SetExtMucHit(p,m,vs,vn,matrix,z,t,x,y);
195 extTrackTds->AddExtMucHit(aExtMucHit);
196 }*/
197
198 // DstExtTrack *extTrackTds = new DstExtTrack();
199 extTrackTds->SetTrackId(trackId);
200 extTrackTds->SetTof1Data( tof1p, tof1m, v1s, v1n , tof1, tof1path, e1m, z1, t1, x1, y1 );
201 extTrackTds->SetTof2Data( tof2p, tof2m, v2s, v2n , tof2, tof2path, e2m, z2, t2, x2, y2 );
202 extTrackTds->SetEmcData( Ep, Em, vEs, vEn , theta, phi , eEm);
203 extTrackTds->SetEmcPath(emcPath);
204 extTrackTds->SetMucData( Mp, Mm, vMs, vMn , eMm, zM, tM, xM, yM );
205
206 extTrackTdsCol->push_back(extTrackTds);
207
208
209 //delete extTrackTds; // wensp add 2005/12/31
210 // extTrackTds = NULL;
211 }
212 //m_extTrackCol->Delete(); // wensp add 2005/12/30
213 delete m_extTrackCol;
214 m_extTrackCol = 0;
215 return StatusCode::SUCCESS;
216}
void SetTof1Data(Hep3Vector aPosition, Hep3Vector aMomentum, string aVolumeName, int aVolumeNumber, double aTof, double aPath, HepSymMatrix aErrorMatrix, double aZSigma=0., double aTSigma=0., double aXSigma=0., double aYSigma=0.)
void SetTrackId(int trackId)
Definition: DstExtTrack.h:193
void SetEmcData(Hep3Vector aPosition, Hep3Vector aMomentum, string aVolumeName, int aVolumeNumber, double aThetaSigma, double aPhiSigma, HepSymMatrix aErrorMatrix)
void SetTof2Data(Hep3Vector aPosition, Hep3Vector aMomentum, string aVolumeName, int aVolumeNumber, double aTof, double aPath, HepSymMatrix aErrorMatrix, double aZSigma=0., double aTSigma=0., double aXSigma=0., double aYSigma=0.)
void SetMucData(Hep3Vector aPosition, Hep3Vector aMomentum, string aVolumeName, int aVolumeNumber, HepSymMatrix aErrorMatrix, double aZSigma=0., double aTSigma=0., double aXSigma=0., double aYSigma=0.)
void SetEmcPath(double path)
Definition: DstExtTrack.h:214
Double_t GetTof1PosSigmaAlongZ() const
Definition: TExtTrack.h:135
Double_t GetMucPositionX() const
Definition: TExtTrack.h:178
Double_t GetMucPosSigmaAlongT() const
Definition: TExtTrack.h:188
Double_t GetMucPositionY() const
Definition: TExtTrack.h:179
Double_t GetTof2() const
Definition: TExtTrack.h:152
Double_t emcPath() const
Definition: TExtTrack.h:175
Double_t GetTof1Path() const
Definition: TExtTrack.h:134
Double_t GetTof1PosSigmaAlongY() const
Definition: TExtTrack.h:138
Double_t GetEmcPositionX() const
Definition: TExtTrack.h:162
Double_t GetEmcPositionZ() const
Definition: TExtTrack.h:164
Double_t GetMucPosSigmaAlongZ() const
Definition: TExtTrack.h:187
Int_t GetTof1VolumeNumber() const
Definition: TExtTrack.h:132
Int_t GetMucVolumeNumber() const
Definition: TExtTrack.h:186
Int_t GetEmcVolumeNumber() const
Definition: TExtTrack.h:170
Double_t GetTof2PositionZ() const
Definition: TExtTrack.h:145
Double_t GetEmcMomentumX() const
Definition: TExtTrack.h:165
Double_t GetTof2MomentumY() const
Definition: TExtTrack.h:147
Double_t GetTof2PosSigmaAlongT() const
Definition: TExtTrack.h:155
Double_t GetMucMomentumZ() const
Definition: TExtTrack.h:183
Double_t GetTof2PosSigmaAlongZ() const
Definition: TExtTrack.h:154
Int_t GetTof2VolumeNumber() const
Definition: TExtTrack.h:151
Int_t GetTrackId() const
Definition: TExtTrack.h:122
Double_t GetTof1PositionY() const
Definition: TExtTrack.h:125
Double_t GetEmcMomentumY() const
Definition: TExtTrack.h:166
Double_t GetTof1MomentumX() const
Definition: TExtTrack.h:127
Double_t GetTof2Path() const
Definition: TExtTrack.h:153
Double_t GetEmcPositionY() const
Definition: TExtTrack.h:163
Double_t GetEmcPosSigmaAlongPhi() const
Definition: TExtTrack.h:172
TString GetTof1VolumeName() const
Definition: TExtTrack.h:131
Double_t GetMucMomentumX() const
Definition: TExtTrack.h:181
Double_t GetEmcErrorMatrix(Int_t i, Int_t j) const
Definition: TExtTrack.h:173
Double_t GetTof1ErrorMatrix(Int_t i, Int_t j) const
Definition: TExtTrack.h:139
Double_t GetTof2PosSigmaAlongX() const
Definition: TExtTrack.h:156
Double_t GetEmcMomentumZ() const
Definition: TExtTrack.h:167
Double_t GetTof2MomentumX() const
Definition: TExtTrack.h:146
Double_t GetEmcPosSigmaAlongTheta() const
Definition: TExtTrack.h:171
Double_t GetTof2PositionY() const
Definition: TExtTrack.h:144
TString GetTof2VolumeName() const
Definition: TExtTrack.h:150
Double_t GetTof1PosSigmaAlongX() const
Definition: TExtTrack.h:137
Double_t GetMucPosSigmaAlongX() const
Definition: TExtTrack.h:189
Double_t GetMucMomentumY() const
Definition: TExtTrack.h:182
Double_t GetTof2MomentumZ() const
Definition: TExtTrack.h:148
TString GetEmcVolumeName() const
Definition: TExtTrack.h:169
Double_t GetTof2ErrorMatrix(Int_t i, Int_t j) const
Definition: TExtTrack.h:158
Double_t GetMucErrorMatrix(Int_t i, Int_t j) const
Definition: TExtTrack.h:191
TString GetMucVolumeName() const
Definition: TExtTrack.h:185
Double_t GetTof1MomentumZ() const
Definition: TExtTrack.h:129
Double_t GetTof2PositionX() const
Definition: TExtTrack.h:143
Double_t GetTof1PosSigmaAlongT() const
Definition: TExtTrack.h:136
Double_t GetTof1MomentumY() const
Definition: TExtTrack.h:128
Double_t GetMucPosSigmaAlongY() const
Definition: TExtTrack.h:190
Double_t GetTof1() const
Definition: TExtTrack.h:133
Double_t GetTof1PositionX() const
Definition: TExtTrack.h:124
Double_t GetTof1PositionZ() const
Definition: TExtTrack.h:126
Double_t GetTof2PosSigmaAlongY() const
Definition: TExtTrack.h:157
Double_t GetMucPositionZ() const
Definition: TExtTrack.h:180
static std::map< const TObject *, const DstExtTrack * > m_rootExtTrackMap
Definition: commonData.h:157

Friends And Related Function Documentation

◆ CnvFactory< ExtTrackCnv >

friend class CnvFactory< ExtTrackCnv >
friend

Definition at line 9 of file ExtTrackCnv.h.


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