BOSS 7.0.8
BESIII Offline Software System
Loading...
Searching...
No Matches
MucTrackCnv Class Reference

#include <MucTrackCnv.h>

+ Inheritance diagram for MucTrackCnv:

Public Member Functions

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

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

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

Constructor & Destructor Documentation

◆ ~MucTrackCnv()

virtual MucTrackCnv::~MucTrackCnv ( )
inlinevirtual

Definition at line 25 of file MucTrackCnv.h.

25{ };

◆ MucTrackCnv()

MucTrackCnv::MucTrackCnv ( ISvcLocator *  svc)
protected

Definition at line 30 of file MucTrackCnv.cxx.

32{
33 // Here we associate this converter with the /Event path on the TDS.
34 MsgStream log(msgSvc(), "MucTrackCnv");
35 //log << MSG::DEBUG << "Constructor called for " << objType() << endreq;
36 m_rootBranchname ="m_mucTrackCol";
37 //declareObject(EventModel::Dst::DstMucTrackCol, objType(), m_rootTreename, m_rootBranchname);
38 m_adresses.push_back(&m_mucTrackCol);
39 m_mucTrackCol=0;
40}
IMessageSvc * msgSvc()
static const CLID & classID()
Definition: MucTrackCnv.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 & MucTrackCnv::classID ( )
inlinestatic

Definition at line 20 of file MucTrackCnv.h.

21 {
22 return CLID_DstMucTrackCol;
23 }
const CLID & CLID_DstMucTrackCol
Definition: EventModel.cxx:268

◆ DataObjectToTObject()

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

transformation to root

Implements RootEventBaseCnv.

Definition at line 156 of file MucTrackCnv.cxx.

156 {
157
158 MsgStream log(msgSvc(), "MucTrackCnv");
159 log << MSG::DEBUG << "MucTrackCnv::DataObjectToTObject" << endreq;
160 StatusCode sc=StatusCode::SUCCESS;
161
162 DstMucTrackCol * mucTrackColTds=dynamic_cast<DstMucTrackCol *> (obj);
163 if (!mucTrackColTds) {
164 log << MSG::ERROR << "Could not downcast to MucTrackCol" << endreq;
165 return StatusCode::FAILURE;
166 }
167
168 DataObject *evt;
169 m_eds->findObject(EventModel::Dst::Event,evt);
170 if (evt==NULL) {
171 log << MSG::ERROR << "Could not get DstEvent in TDS " << endreq;
172 return StatusCode::FAILURE;
173 }
174 DstEvent * devtTds=dynamic_cast<DstEvent *> (evt);
175 if (!devtTds) {
176 log << MSG::ERROR << "MucTrackCnv:Could not downcast to TDS DigiEvent" << endreq;
177 }
178 IOpaqueAddress *addr;
179
180 m_cnvSvc->getDstCnv()->createRep(evt,addr);
182
183 const TObjArray *m_mucTrackCol = recEvt->getMucTrackCol();
184 if (!m_mucTrackCol) return sc;
185 recEvt->clearMucTrackCol(); //necessary in case there is I/O at the same time since array is static
186 DstMucTrackCol::const_iterator mucTrackTds;
187
188 for (mucTrackTds = mucTrackColTds->begin(); mucTrackTds != mucTrackColTds->end(); mucTrackTds++) {
189 Int_t trackId = (*mucTrackTds)->trackId();
190 Int_t id = (*mucTrackTds)-> id();
191 Int_t st = (*mucTrackTds)->status();
192 Int_t type = (*mucTrackTds)->type();
193
194 Int_t startPart = (*mucTrackTds)->startPart();
195 Int_t endPart = (*mucTrackTds)->endPart();
196 Int_t brLastLayer = (*mucTrackTds)->brLastLayer();
197 Int_t ecLastLayer = (*mucTrackTds)->ecLastLayer();
198 Int_t numHits = (*mucTrackTds)->numHits();
199 Int_t numLayers = (*mucTrackTds)->numLayers();
200 Int_t maxHitsInLayer = (*mucTrackTds)->maxHitsInLayer();
201
202 Double_t depth = (*mucTrackTds)->depth();
203 Double_t chi2 = (*mucTrackTds)->chi2();
204 Int_t dof = (*mucTrackTds)->dof();
205 Double_t rms = (*mucTrackTds)->rms();
206
207 Double_t xPos = (*mucTrackTds)->xPos() ;
208 Double_t yPos = (*mucTrackTds)->yPos() ;
209 Double_t zPos = (*mucTrackTds)->zPos() ;
210
211 Double_t xPosSigma = (*mucTrackTds)->xPosSigma() ;
212 Double_t yPosSigma = (*mucTrackTds)->yPosSigma() ;
213 Double_t zPosSigma = (*mucTrackTds)->zPosSigma() ;
214
215 Double_t px = (*mucTrackTds)->px() ;
216 Double_t py = (*mucTrackTds)->py() ;
217 Double_t pz = (*mucTrackTds)->pz() ;
218
219 Double_t distance = (*mucTrackTds)->distance();
220 Double_t deltaphi = (*mucTrackTds)->deltaPhi();
221 //added by LI Chunhua
222 Double_t krechi2 = (*mucTrackTds)->kalRechi2();
223 Int_t kdof = (*mucTrackTds)->kaldof();
224 Double_t kdepth = (*mucTrackTds)->kaldepth();
225 Int_t kbrlay = (*mucTrackTds)->kalbrLastLayer();
226 Int_t keclay = (*mucTrackTds)->kalecLastLayer();
227 //*********************
228
229 //vector<Int_t> vecHits = (*mucTrackTds)->vecHits();
230
231 TMucTrack *mucTrackRoot = new TMucTrack();
232 //m_common.m_mucTrackMap[(*mucTrackTds)] = mucTrackRoot;
233
234 mucTrackRoot->setTrackId( trackId );
235 mucTrackRoot->setId( id );
236 mucTrackRoot->setStatus( st );
237 mucTrackRoot->setType( type );
238
239 mucTrackRoot->setStartPart( startPart );
240 mucTrackRoot->setEndPart( endPart );
241 mucTrackRoot->setBrLastLayer( brLastLayer );
242 mucTrackRoot->setEcLastLayer( ecLastLayer );
243 mucTrackRoot->setNumHits( numHits );
244 mucTrackRoot->setNumLayers( numLayers );
245 mucTrackRoot->setMaxHitsInLayer( maxHitsInLayer );
246
247 mucTrackRoot->setDepth( depth );
248 mucTrackRoot->setChi2( chi2 );
249 mucTrackRoot->setDof( dof );
250 mucTrackRoot->setRms( rms );
251
252 mucTrackRoot->setXPos( xPos );
253 mucTrackRoot->setYPos( yPos );
254 mucTrackRoot->setZPos( zPos );
255
256 mucTrackRoot->setXPosSigma( xPosSigma );
257 mucTrackRoot->setYPosSigma( yPosSigma );
258 mucTrackRoot->setZPosSigma( zPosSigma );
259
260 mucTrackRoot->setPx( px );
261 mucTrackRoot->setPy( py );
262 mucTrackRoot->setPz( pz );
263
264 mucTrackRoot->setDistance(distance);
265 mucTrackRoot->setDeltaPhi(deltaphi);
266 //added by LI Chunhua 2013/02/01
267 mucTrackRoot->setkalRechi2(krechi2);
268 mucTrackRoot->setkalDof(kdof);
269 mucTrackRoot->setkalDepth(kdepth);
270 mucTrackRoot->setkalbrLastLayer(kbrlay);
271 mucTrackRoot->setkalecLastLayer(keclay);
272 //******************
273 //mucTrackRoot->setVecHits(vecHits);
274
275 recEvt->addMucTrack(mucTrackRoot);
276 }
277
278 return StatusCode::SUCCESS;
279}
ObjectVector< DstMucTrack > DstMucTrackCol
Definition: DstMucTrack.h:162
#define NULL
static TDstEvent * getWriteObject()
returns object to be written (maintained here for all DIGI-converters)
Definition: DstCnv.h:36
DstCnv * getDstCnv()
Definition: RootCnvSvc.h:155
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 clearMucTrackCol()
clear the whole array
Definition: TDstEvent.h:81
void addMucTrack(TMucTrack *Track)
Add a MucTrack into the TOF Data collection.
Definition: TDstEvent.cxx:152
const TObjArray * getMucTrackCol() const
retrieve the whole TObjArray of MucTrack Data
Definition: TDstEvent.h:72
void setNumHits(Int_t numHits)
Definition: TMucTrack.h:75
void setTrackId(Int_t trackId)
Definition: TMucTrack.h:66
void setkalDof(Int_t f)
Definition: TMucTrack.h:101
void setkalecLastLayer(Int_t ec)
Definition: TMucTrack.h:104
void setEndPart(Int_t part)
Definition: TMucTrack.h:72
void setBrLastLayer(Int_t layer)
Definition: TMucTrack.h:73
void setDeltaPhi(double dphi)
Definition: TMucTrack.h:97
void setXPosSigma(Double_t x)
Definition: TMucTrack.h:88
void setMaxHitsInLayer(Int_t maxHits)
Definition: TMucTrack.h:77
void setPy(Double_t py)
Definition: TMucTrack.h:93
void setPx(Double_t px)
Definition: TMucTrack.h:92
void setXPos(Double_t x)
Definition: TMucTrack.h:84
void setkalRechi2(Double_t ch)
Definition: TMucTrack.h:100
void setStatus(Int_t st)
Definition: TMucTrack.h:68
void setZPos(Double_t z)
Definition: TMucTrack.h:86
void setType(Int_t type)
Definition: TMucTrack.h:69
void setDof(Int_t dof)
Definition: TMucTrack.h:81
void setPz(Double_t pz)
Definition: TMucTrack.h:94
void setYPosSigma(Double_t y)
Definition: TMucTrack.h:89
void setYPos(Double_t y)
Definition: TMucTrack.h:85
void setkalDepth(Double_t de)
Definition: TMucTrack.h:102
void setDepth(Double_t depth)
Definition: TMucTrack.h:79
void setStartPart(Int_t part)
Definition: TMucTrack.h:71
void setChi2(Double_t chi2)
Definition: TMucTrack.h:80
void setkalbrLastLayer(Int_t br)
Definition: TMucTrack.h:103
void setEcLastLayer(Int_t layer)
Definition: TMucTrack.h:74
void setRms(Double_t rms)
Definition: TMucTrack.h:82
void setDistance(double dist)
Definition: TMucTrack.h:96
void setZPosSigma(Double_t z)
Definition: TMucTrack.h:90
void setId(Int_t id)
Definition: TMucTrack.h:67
void setNumLayers(Int_t numLayers)
Definition: TMucTrack.h:76
_EXTERN_ std::string Event
Definition: EventModel.h:128

◆ TObjectToDataObject()

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

transformation from root

Implements RootEventBaseCnv.

Definition at line 42 of file MucTrackCnv.cxx.

42 {
43 // creation of TDS object from root object
44
45 MsgStream log(msgSvc(), "MucTrackCnv");
46 log << MSG::DEBUG << "MucTrackCnv::TObjectToDataObject" << endreq;
47 StatusCode sc=StatusCode::SUCCESS;
48
49 // create the TDS location for the MucTrack Collection
50 DstMucTrackCol* mucTrackTdsCol = new DstMucTrackCol;
51 refpObject=mucTrackTdsCol;
52
53
54 // now convert
55 if (!m_mucTrackCol) return sc;
56 TIter mucTrackIter(m_mucTrackCol);
57 TMucTrack *mucTrackRoot = 0;
58 while ((mucTrackRoot = (TMucTrack*)mucTrackIter.Next())) {
59
60 int trackId = mucTrackRoot->trackId();
61 int id = mucTrackRoot-> id();
62 int st = mucTrackRoot->status();
63 int type = mucTrackRoot->type();
64
65 int startPart = mucTrackRoot->startPart();
66 int endPart = mucTrackRoot->endPart();
67 int brLastLayer = mucTrackRoot->brLastLayer();
68 int ecLastLayer = mucTrackRoot->ecLastLayer();
69 int numHits = mucTrackRoot->numHits();
70 int numLayers = mucTrackRoot->numLayers();
71 int maxHitsInLayer = mucTrackRoot->maxHitsInLayer();
72
73 double depth = mucTrackRoot->depth();
74 double chi2 = mucTrackRoot->chi2();
75 int dof = mucTrackRoot->dof();
76 double rms = mucTrackRoot->rms();
77
78 double xPos = mucTrackRoot->xPos() ;
79 double yPos = mucTrackRoot->yPos() ;
80 double zPos = mucTrackRoot->zPos() ;
81
82 double xPosSigma = mucTrackRoot->xPosSigma() ;
83 double yPosSigma = mucTrackRoot->yPosSigma() ;
84 double zPosSigma = mucTrackRoot->zPosSigma() ;
85
86 double px = mucTrackRoot->px() ;
87 double py = mucTrackRoot->py() ;
88 double pz = mucTrackRoot->pz() ;
89
90 double distance = mucTrackRoot->distance();
91 double deltaphi = mucTrackRoot->deltaPhi();
92 //vector<int> vecHits = mucTrackRoot->vecHits();
93 //added by LI Chunhua
94 double krechi2 = mucTrackRoot->kalRechi2();
95 int kdof = mucTrackRoot->kaldof();
96 double kdepth = mucTrackRoot->kaldepth();
97 int kbrlay = mucTrackRoot->kalbrLastLayer();
98 int keclay = mucTrackRoot->kalecLastLayer();
99 //*********************
100
101 DstMucTrack *mucTrackTds = new DstMucTrack();
102 m_common.m_rootMucTrackMap[mucTrackRoot] = mucTrackTds;
103
104 mucTrackTds->setTrackId( trackId );
105 mucTrackTds->setId( id );
106 mucTrackTds->setStatus( st );
107 mucTrackTds->setType( type );
108
109 mucTrackTds->setStartPart( startPart );
110 mucTrackTds->setEndPart( endPart );
111 mucTrackTds->setBrLastLayer( brLastLayer );
112 mucTrackTds->setEcLastLayer( ecLastLayer );
113 mucTrackTds->setNumHits( numHits );
114 mucTrackTds->setNumLayers( numLayers );
115 mucTrackTds->setMaxHitsInLayer( maxHitsInLayer );
116
117 mucTrackTds->setDepth( depth );
118 mucTrackTds->setChi2( chi2 );
119 mucTrackTds->setDof( dof );
120 mucTrackTds->setRms( rms );
121
122 mucTrackTds->setXPos( xPos );
123 mucTrackTds->setYPos( yPos );
124 mucTrackTds->setZPos( zPos );
125
126 mucTrackTds->setXPosSigma( xPosSigma );
127 mucTrackTds->setYPosSigma( yPosSigma );
128 mucTrackTds->setZPosSigma( zPosSigma );
129
130 mucTrackTds->setPx( px );
131 mucTrackTds->setPy( py );
132 mucTrackTds->setPz( pz );
133
134 mucTrackTds->setDistance(distance);
135 mucTrackTds->setDeltaPhi(deltaphi);
136
137 //mucTrackTds->setVecHits(vecHits);
138 //added by LI Chunhua 2013/02/01
139 mucTrackTds->setkalRechi2(krechi2);
140 mucTrackTds->setkalDof(kdof);
141 mucTrackTds->setkalDepth(kdepth);
142 mucTrackTds->setkalbrLastLayer(kbrlay);
143 mucTrackTds->setkalecLastLayer(keclay);
144 //******************
145 mucTrackTdsCol->push_back(mucTrackTds);
146 //delete mucTrackTds; // wensp add 2005/12/31
147 // mucTrackTds = NULL;
148 }
149
150 // m_mucTrackCol->Delete(); // wensp add 2005/12/30
151 delete m_mucTrackCol;
152 m_mucTrackCol = 0;
153 return StatusCode::SUCCESS;
154}
void setDistance(double dist)
Definition: DstMucTrack.h:105
void setkalbrLastLayer(int br)
Definition: DstMucTrack.h:113
void setXPos(double x)
Definition: DstMucTrack.h:93
void setMaxHitsInLayer(int maxHits)
Definition: DstMucTrack.h:86
void setEcLastLayer(int layer)
Definition: DstMucTrack.h:83
void setPz(double pz)
Definition: DstMucTrack.h:103
void setRms(double rms)
Definition: DstMucTrack.h:91
void setStatus(int st)
Definition: DstMucTrack.h:77
void setYPos(double y)
Definition: DstMucTrack.h:94
void setDof(int dof)
Definition: DstMucTrack.h:90
void setZPos(double z)
Definition: DstMucTrack.h:95
void setBrLastLayer(int layer)
Definition: DstMucTrack.h:82
void setYPosSigma(double ysigma)
Definition: DstMucTrack.h:98
void setDepth(double depth)
Definition: DstMucTrack.h:88
void setPy(double py)
Definition: DstMucTrack.h:102
void setZPosSigma(double zsigma)
Definition: DstMucTrack.h:99
void setTrackId(int trackId)
Definition: DstMucTrack.h:75
void setId(int id)
Definition: DstMucTrack.h:76
void setkalecLastLayer(int ec)
Definition: DstMucTrack.h:114
void setXPosSigma(double xsigma)
Definition: DstMucTrack.h:97
void setkalDof(int f)
Definition: DstMucTrack.h:111
void setStartPart(int part)
Definition: DstMucTrack.h:80
void setDeltaPhi(double dphi)
Definition: DstMucTrack.h:106
void setNumLayers(int numLayers)
Definition: DstMucTrack.h:85
void setPx(double px)
Definition: DstMucTrack.h:101
void setType(int type)
Definition: DstMucTrack.h:78
void setNumHits(int numHits)
Definition: DstMucTrack.h:84
void setChi2(double chi2)
Definition: DstMucTrack.h:89
void setkalRechi2(double ch)
Definition: DstMucTrack.h:110
void setkalDepth(double de)
Definition: DstMucTrack.h:112
void setEndPart(int part)
Definition: DstMucTrack.h:81
Double_t zPos() const
Definition: TMucTrack.h:43
Int_t numHits() const
Definition: TMucTrack.h:32
Int_t kalbrLastLayer() const
Definition: TMucTrack.h:61
Int_t brLastLayer() const
Definition: TMucTrack.h:30
Double_t pz() const
Definition: TMucTrack.h:51
Double_t deltaPhi() const
Definition: TMucTrack.h:54
Int_t dof() const
Definition: TMucTrack.h:38
Int_t trackId() const
Definition: TMucTrack.h:23
Double_t zPosSigma() const
Definition: TMucTrack.h:47
Int_t kaldof() const
Definition: TMucTrack.h:59
Int_t kalecLastLayer() const
Definition: TMucTrack.h:62
Double_t px() const
Definition: TMucTrack.h:49
Double_t depth() const
Definition: TMucTrack.h:36
Double_t xPos() const
Definition: TMucTrack.h:41
Int_t numLayers() const
Definition: TMucTrack.h:33
Int_t status() const
Definition: TMucTrack.h:25
Double_t kalRechi2() const
Definition: TMucTrack.h:58
Double_t yPosSigma() const
Definition: TMucTrack.h:46
Double_t yPos() const
Definition: TMucTrack.h:42
Double_t xPosSigma() const
Definition: TMucTrack.h:45
Int_t type() const
Definition: TMucTrack.h:26
Double_t distance() const
Definition: TMucTrack.h:53
Int_t maxHitsInLayer() const
Definition: TMucTrack.h:34
Double_t rms() const
Definition: TMucTrack.h:39
Int_t startPart() const
Definition: TMucTrack.h:28
Int_t endPart() const
Definition: TMucTrack.h:29
Double_t py() const
Definition: TMucTrack.h:50
Int_t ecLastLayer() const
Definition: TMucTrack.h:31
Double_t chi2() const
Definition: TMucTrack.h:37
Double_t kaldepth() const
Definition: TMucTrack.h:60
static std::map< const TObject *, const DstMucTrack * > m_rootMucTrackMap
Definition: commonData.h:149

Friends And Related Function Documentation

◆ CnvFactory< MucTrackCnv >

friend class CnvFactory< MucTrackCnv >
friend

Definition at line 9 of file MucTrackCnv.h.


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