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

#include <RecMucTrackCnv.h>

+ Inheritance diagram for RecMucTrackCnv:

Public Member Functions

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

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

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

Constructor & Destructor Documentation

◆ ~RecMucTrackCnv()

virtual RecMucTrackCnv::~RecMucTrackCnv ( )
inlinevirtual

Definition at line 25 of file RecMucTrackCnv.h.

25{ };

◆ RecMucTrackCnv()

RecMucTrackCnv::RecMucTrackCnv ( ISvcLocator * svc)
protected

Definition at line 34 of file RecMucTrackCnv.cxx.

36{
37
38 // Here we associate this converter with the /Event path on the TDS.
39 MsgStream log(msgSvc(), "RecMucTrackCnv");
40 //log << MSG::DEBUG << "Constructor called for " << objType() << endreq;
41 //m_rootTreename ="Rec";
42 //RecMucTrack *atrack = new RecMucTrack();
43 //RecMucTrackCol *atrackCol = new RecMucTrackCol;
44 //cout<<"in RecMucTrackCnv "<<atrack->clID()<<" "<<atrackCol->clID()<<" "<<CLID_ObjectVector<<endl;
45 m_rootBranchname ="m_recMucTrackCol";
46 //declareObject(EventModel::Recon::RecMucTrackCol, objType(), m_rootTreename, m_rootBranchname);
47 m_adresses.push_back(&m_recMucTrackCol);
48 m_recMucTrackCol=0;
49}
IMessageSvc * msgSvc()
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 & RecMucTrackCnv::classID ( )
inlinestatic

Definition at line 20 of file RecMucTrackCnv.h.

21 {
22 return CLID_RecMucTrackCol;
23 }
const CLID & CLID_RecMucTrackCol

◆ DataObjectToTObject()

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

transformation to root

Implements RootEventBaseCnv.

Definition at line 178 of file RecMucTrackCnv.cxx.

178 {
179
180 MsgStream log(msgSvc(), "RecMucTrackCnv");
181 log << MSG::DEBUG << "RecMucTrackCnv::DataObjectToTObject" << endreq;
182 StatusCode sc=StatusCode::SUCCESS;
183
184 RecMucTrackCol * mucTrackColTds=dynamic_cast<RecMucTrackCol *> (obj);
185 if (!mucTrackColTds) {
186 log << MSG::ERROR << "Could not downcast to RecMucTrackCol" << endreq;
187 return StatusCode::FAILURE;
188 }
189
190 DataObject *evt;
191 m_eds->findObject(EventModel::Recon::Event,evt);
192 if (evt==NULL) {
193 log << MSG::ERROR << "Could not get RecEvent in TDS " << endreq;
194 return StatusCode::FAILURE;
195 }
196 ReconEvent * devtTds=dynamic_cast<ReconEvent *> (evt);
197 if (!devtTds) {
198 log << MSG::ERROR << "RecMucTrackCnv:Could not downcast to TDS DigiEvent" << endreq;
199 }
200 IOpaqueAddress *addr;
201
202 m_cnvSvc->getRecTrackCnv()->createRep(evt,addr);
204
205 const TObjArray *m_recMucTrackCol = recEvt->getMucTrackCol();
206 if (!m_recMucTrackCol) return sc;
207 recEvt->clearMucTrackCol(); //necessary in case there is I/O at the same time since array is static
208 RecMucTrackCol::const_iterator mucTrackTds;
209
210 for (mucTrackTds = mucTrackColTds->begin(); mucTrackTds != mucTrackColTds->end(); mucTrackTds++) {
211 Int_t trackId = (*mucTrackTds)->trackId();
212 Int_t id = (*mucTrackTds)-> id();
213 Int_t st = (*mucTrackTds)->status();
214 Int_t type = (*mucTrackTds)->type();
215
216 Int_t startPart = (*mucTrackTds)->startPart();
217 Int_t endPart = (*mucTrackTds)->endPart();
218 Int_t brLastLayer = (*mucTrackTds)->brLastLayer();
219 Int_t ecLastLayer = (*mucTrackTds)->ecLastLayer();
220 Int_t numHits = (*mucTrackTds)->numHits();
221 Int_t numLayers = (*mucTrackTds)->numLayers();
222 Int_t maxHitsInLayer = (*mucTrackTds)->maxHitsInLayer();
223
224 Double_t depth = (*mucTrackTds)->depth();
225 Double_t chi2 = (*mucTrackTds)->chi2();
226 Int_t dof = (*mucTrackTds)->dof();
227 Double_t rms = (*mucTrackTds)->rms();
228
229 Double_t xPos = (*mucTrackTds)->xPos() ;
230 Double_t yPos = (*mucTrackTds)->yPos() ;
231 Double_t zPos = (*mucTrackTds)->zPos() ;
232
233 Double_t xPosSigma = (*mucTrackTds)->xPosSigma() ;
234 Double_t yPosSigma = (*mucTrackTds)->yPosSigma() ;
235 Double_t zPosSigma = (*mucTrackTds)->zPosSigma() ;
236
237 Double_t distance = (*mucTrackTds)->distance();
238 Double_t deltaphi = (*mucTrackTds)->deltaPhi();
239
240 Double_t px = (*mucTrackTds)->px() ;
241 Double_t py = (*mucTrackTds)->py() ;
242 Double_t pz = (*mucTrackTds)->pz() ;
243
244
245 vector<Int_t> vecHits = (*mucTrackTds)->getVecHits();
246 vector<Int_t> expHits = (*mucTrackTds)->getExpHits();
247 vector<Float_t> distHits = (*mucTrackTds)->getDistHits();
248 //added by LI Chunhua
249 Double_t krechi2 = (*mucTrackTds)->kalRechi2();
250 Int_t kdof = (*mucTrackTds)->kaldof();
251 Double_t kdepth = (*mucTrackTds)->kaldepth();
252 Int_t kbrlay = (*mucTrackTds)->kalbrLastLayer();
253 Int_t keclay = (*mucTrackTds)->kalecLastLayer();
254 //*********************
255
256 /*
257 cout<<"in RecMucTrackCnv "<<vecHits.size()<<endl;
258 for(int i = 0; i < vecHits.size(); i++){
259 cout<<" vec i = "<<i<<" "<<vecHits[i]<<endl;
260 }
261
262 for(int i = 0; i < expHits.size(); i++){
263 cout<<" exp i = "<<i<<" "<<expHits[i]<<endl;
264 }
265
266 for(int i = 0; i < distHits.size(); i++){
267 cout<<" dist i = "<<i<<" "<<distHits[i]<<endl;
268 }
269 */
270
271 TRecMucTrack *mucTrackRoot = new TRecMucTrack(); //liangyt
272 //m_common.m_RecMucTrackMap[(*mucTrackTds)] = mucTrackRoot;
273
274 mucTrackRoot->setTrackId( trackId );
275 mucTrackRoot->setId( id );
276 mucTrackRoot->setStatus( st );
277 mucTrackRoot->setType( type );
278
279 mucTrackRoot->setStartPart( startPart );
280 mucTrackRoot->setEndPart( endPart );
281 mucTrackRoot->setBrLastLayer( brLastLayer );
282 mucTrackRoot->setEcLastLayer( ecLastLayer );
283 mucTrackRoot->setNumHits( numHits );
284 mucTrackRoot->setNumLayers( numLayers );
285 mucTrackRoot->setMaxHitsInLayer( maxHitsInLayer );
286
287 mucTrackRoot->setDepth( depth );
288 mucTrackRoot->setChi2( chi2 );
289 mucTrackRoot->setDof( dof );
290 mucTrackRoot->setRms( rms );
291
292 mucTrackRoot->setXPos( xPos );
293 mucTrackRoot->setYPos( yPos );
294 mucTrackRoot->setZPos( zPos );
295
296 mucTrackRoot->setXPosSigma( xPosSigma );
297 mucTrackRoot->setYPosSigma( yPosSigma );
298 mucTrackRoot->setZPosSigma( zPosSigma );
299
300 mucTrackRoot->setDistance(distance);
301 mucTrackRoot->setDeltaPhi(deltaphi);
302
303 //cout<<"in RecMucTrackCnv xyz = "<<xPos<<" "<<yPos<<" "<<zPos<<" depth= "<<depth<<" "<<maxHitsInLayer<<" "<<deltaphi<<endl;
304
305 mucTrackRoot->setPx( px );
306 mucTrackRoot->setPy( py );
307 mucTrackRoot->setPz( pz );
308
309 mucTrackRoot->setVecHits(vecHits);
310 mucTrackRoot->setExpHits(expHits);
311 mucTrackRoot->setDistHits(distHits);
312
313 //added by LI Chunhua 2013/02/01
314 mucTrackRoot->setkalRechi2(krechi2);
315 mucTrackRoot->setkalDof(kdof);
316 mucTrackRoot->setkalDepth(kdepth);
317 mucTrackRoot->setkalbrLastLayer(kbrlay);
318 mucTrackRoot->setkalecLastLayer(keclay);
319 //******************
320 recEvt->addMucTrack(mucTrackRoot);
321 }
322
323 return StatusCode::SUCCESS;
324}
ObjectVector< RecMucTrack > RecMucTrackCol
#define NULL
static TRecTrackEvent * getWriteObject()
returns object to be written (maintained here for all DIGI-converters)
Definition RecTrackCnv.h:36
RecTrackCnv * getRecTrackCnv()
Definition RootCnvSvc.h:173
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 setRms(Double_t rms)
void setMaxHitsInLayer(Int_t maxHits)
void setkalbrLastLayer(Int_t br)
void setZPos(Double_t z)
void setXPos(Double_t x)
void setEcLastLayer(Int_t layer)
void setDistHits(vector< Float_t > &distHits)
void setExpHits(vector< Int_t > &expHits)
void setVecHits(vector< Int_t > &vecHits)
void setYPosSigma(Double_t y)
void setkalDof(Int_t f)
void setPz(Double_t pz)
void setkalecLastLayer(Int_t ec)
void setStartPart(Int_t part)
void setNumHits(Int_t numHits)
void setBrLastLayer(Int_t layer)
void setPy(Double_t py)
void setStatus(Int_t st)
void setDeltaPhi(Double_t dphi)
void setEndPart(Int_t part)
void setTrackId(Int_t trackId)
void setkalRechi2(Double_t ch)
void setYPos(Double_t y)
void setNumLayers(Int_t numLayers)
void setId(Int_t id)
void setDepth(Double_t depth)
void setXPosSigma(Double_t x)
void setPx(Double_t px)
void setChi2(Double_t chi2)
void setDof(Int_t dof)
void setZPosSigma(Double_t z)
void setkalDepth(Double_t de)
void setType(Int_t type)
void setDistance(Double_t dist)
void addMucTrack(TRecMucTrack *Track)
Add a MucTrack into the TOF Data collection.
void clearMucTrackCol()
clear the whole array
const TObjArray * getMucTrackCol() const
retrieve the whole TObjArray of MucTrack Data
_EXTERN_ std::string Event
Definition EventModel.h:84

◆ TObjectToDataObject()

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

transformation from root

Implements RootEventBaseCnv.

Definition at line 51 of file RecMucTrackCnv.cxx.

51 {
52 // creation of TDS object from root object
53
54 MsgStream log(msgSvc(), "RecMucTrackCnv");
55 log << MSG::DEBUG << "RecMucTrackCnv::TObjectToDataObject" << endreq;
56 StatusCode sc=StatusCode::SUCCESS;
57
58 // create the TDS location for the MucTrack Collection
59 RecMucTrackCol* mucTrackTdsCol = new RecMucTrackCol;
60 refpObject=mucTrackTdsCol;
61
62
63 // now convert
64 if (!m_recMucTrackCol) return sc;
65 TIter mucTrackIter(m_recMucTrackCol);
66 TRecMucTrack *mucTrackRoot = 0;
67 while ((mucTrackRoot = (TRecMucTrack*)mucTrackIter.Next())) {
68
69 int trackId = mucTrackRoot->trackId();
70 int id = mucTrackRoot-> id();
71 int st = mucTrackRoot->status();
72 int type = mucTrackRoot->type();
73
74 int startPart = mucTrackRoot->startPart();
75 int endPart = mucTrackRoot->endPart();
76 int brLastLayer = mucTrackRoot->brLastLayer();
77 int ecLastLayer = mucTrackRoot->ecLastLayer();
78 int numHits = mucTrackRoot->numHits();
79 int numLayers = mucTrackRoot->numLayers();
80 int maxHitsInLayer = mucTrackRoot->maxHitsInLayer();
81
82 double depth = mucTrackRoot->depth();
83 double chi2 = mucTrackRoot->chi2();
84 int dof = mucTrackRoot->dof();
85 double rms = mucTrackRoot->rms();
86
87
88
89 double xPos = mucTrackRoot->xPos() ;
90 double yPos = mucTrackRoot->yPos() ;
91 double zPos = mucTrackRoot->zPos() ;
92
93 double xPosSigma = mucTrackRoot->xPosSigma() ;
94 double yPosSigma = mucTrackRoot->yPosSigma() ;
95 double zPosSigma = mucTrackRoot->zPosSigma() ;
96
97 double px = mucTrackRoot->px() ;
98 double py = mucTrackRoot->py() ;
99 double pz = mucTrackRoot->pz() ;
100
101 double distance = mucTrackRoot->distance();
102 double deltaphi = mucTrackRoot->deltaPhi();
103 //cout<<"in RecMucTrackCnv distance = "<<distance<<" xpos= "<<xPos<<endl;
104
105 vector<int> vecHits = mucTrackRoot->vecHits();
106 vector<int> expHits = mucTrackRoot->expHits();
107 vector<float> distHits = mucTrackRoot->distHits();
108
109 //added by LI Chunhua
110 double krechi2 = mucTrackRoot->kalRechi2();
111 int kdof = mucTrackRoot->kaldof();
112 double kdepth = mucTrackRoot->kaldepth();
113 int kbrlay = mucTrackRoot->kalbrLastLayer();
114 int keclay = mucTrackRoot->kalecLastLayer();
115 //*********************
116 //cout<<"in RecMucTrackCnv size = "<<vecHits.size()<<" "<<expHits.size()<<" "<<distHits.size()<<endl;
117
118 RecMucTrack *mucTrackTds = new RecMucTrack();
119 m_common.m_rootRecMucTrackMap[mucTrackRoot] = mucTrackTds;
120
121 mucTrackTds->setTrackId( trackId );
122 mucTrackTds->setId( id );
123 mucTrackTds->setStatus( st );
124 mucTrackTds->setType( type );
125
126 mucTrackTds->setStartPart( startPart );
127 mucTrackTds->setEndPart( endPart );
128 mucTrackTds->setBrLastLayer( brLastLayer );
129 mucTrackTds->setEcLastLayer( ecLastLayer );
130 mucTrackTds->setNumHits( numHits );
131 mucTrackTds->setNumLayers( numLayers );
132 mucTrackTds->setMaxHitsInLayer( maxHitsInLayer );
133
134 mucTrackTds->setDepth( depth );
135 mucTrackTds->setChi2( chi2 );
136 mucTrackTds->setDof( dof );
137 mucTrackTds->setRms( rms );
138
139 mucTrackTds->setXPos( xPos );
140 mucTrackTds->setYPos( yPos );
141 mucTrackTds->setZPos( zPos );
142
143 mucTrackTds->setXPosSigma( xPosSigma );
144 mucTrackTds->setYPosSigma( yPosSigma );
145 mucTrackTds->setZPosSigma( zPosSigma );
146
147 mucTrackTds->setPx( px );
148 mucTrackTds->setPy( py );
149 mucTrackTds->setPz( pz );
150
151 mucTrackTds->setDistance(distance);
152 mucTrackTds->setDeltaPhi(deltaphi);
153 mucTrackTds->setVecHits(vecHits); //need fix
154 mucTrackTds->setExpHits(expHits);
155 mucTrackTds->setDistHits(distHits);
156
157 //added by LI Chunhua 2013/02/01
158 mucTrackTds->setkalRechi2(krechi2);
159 mucTrackTds->setkalDof(kdof);
160 mucTrackTds->setkalDepth(kdepth);
161 mucTrackTds->setkalbrLastLayer(kbrlay);
162 mucTrackTds->setkalecLastLayer(keclay);
163 //******************
164
165 //cout<<"in RecMucTrackCnv::T->D set mucpos"<<endl;
166
167 mucTrackTdsCol->push_back(mucTrackTds);
168 //delete mucTrackTds; // wensp add 2005/12/31
169 // mucTrackTds = NULL;
170 }
171
172 // m_mucTrackCol->Delete(); // wensp add 2005/12/30
173 delete m_recMucTrackCol;
174 m_recMucTrackCol = 0;
175 return StatusCode::SUCCESS;
176}
void setDistance(double dist)
void setkalbrLastLayer(int br)
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)
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)
void setZPosSigma(double zsigma)
Definition DstMucTrack.h:99
void setId(int id)
Definition DstMucTrack.h:76
void setkalecLastLayer(int ec)
void setXPosSigma(double xsigma)
Definition DstMucTrack.h:97
void setkalDof(int f)
void setStartPart(int part)
Definition DstMucTrack.h:80
void setDeltaPhi(double dphi)
void setNumLayers(int numLayers)
Definition DstMucTrack.h:85
void setPx(double px)
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)
void setkalDepth(double de)
void setEndPart(int part)
Definition DstMucTrack.h:81
void setDistHits(vector< float > &disthits)
void setExpHits(vector< MucRecHit * > &pHits)
void setTrackId(const int trackId)
set the index for this track.
void setVecHits(vector< MucRecHit * > &pHits)
reload setVecHits
Double_t zPosSigma() const
Int_t startPart() const
Int_t brLastLayer() const
Double_t yPos() const
Double_t zPos() const
Int_t trackId() const
Int_t endPart() const
Int_t numLayers() const
Double_t kalRechi2() const
Double_t distance() const
vector< Int_t > vecHits() const
Double_t chi2() const
Double_t xPos() const
Int_t type() const
Double_t rms() const
vector< Int_t > expHits() const
Int_t numHits() const
Int_t maxHitsInLayer() const
Double_t xPosSigma() const
vector< Float_t > distHits() const
Double_t depth() const
Int_t ecLastLayer() const
Int_t status() const
Double_t pz() const
Double_t deltaPhi() const
Int_t kalecLastLayer() const
Int_t dof() const
Int_t kalbrLastLayer() const
Double_t kaldepth() const
Double_t px() const
Double_t py() const
Int_t kaldof() const
Double_t yPosSigma() const
static std::map< const TObject *, const RecMucTrack * > m_rootRecMucTrackMap
Definition commonData.h:225

Friends And Related Symbol Documentation

◆ CnvFactory< RecMucTrackCnv >

friend class CnvFactory< RecMucTrackCnv >
friend

Definition at line 9 of file RecMucTrackCnv.h.


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