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

#include <RecMucTrackCnv.h>

+ Inheritance diagram for RecMucTrackCnv:

Public Member Functions

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

 RecMucTrackCnv (ISvcLocator *svc)
 
virtual StatusCode DataObjectToTObject (DataObject *obj, RootAddress *addr)
 transformation to root
 
virtual StatusCode TObjectToDataObject (DataObject *&obj)
 transformation from root
 
 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
 
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
 
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

◆ ~RecMucTrackCnv() [1/2]

virtual RecMucTrackCnv::~RecMucTrackCnv ( )
inlinevirtual

◆ RecMucTrackCnv() [1/2]

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}
std::vector< void * > m_adresses
each converter knows the corresponding adresses
std::string m_rootBranchname
root branchname (may be concatenated of severals)

◆ ~RecMucTrackCnv() [2/2]

virtual RecMucTrackCnv::~RecMucTrackCnv ( )
inlinevirtual

◆ RecMucTrackCnv() [2/2]

RecMucTrackCnv::RecMucTrackCnv ( ISvcLocator *  svc)
protected

Member Function Documentation

◆ classID() [1/2]

static const CLID & RecMucTrackCnv::classID ( )
inlinestatic

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

21 {
22 return CLID_RecMucTrackCol;
23 }
const CLID & CLID_RecMucTrackCol
Definition: EventModel.cxx:345

◆ classID() [2/2]

static const CLID & RecMucTrackCnv::classID ( )
inlinestatic

◆ DataObjectToTObject() [1/2]

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
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.
void addMucTrack(TRecMucTrack *Track)
Add a MucTrack into the TOF Data collection.
const TObjArray * getMucTrackCol() const
retrieve the whole TObjArray of MucTrack Data

◆ DataObjectToTObject() [2/2]

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

transformation to root

Implements RootEventBaseCnv.

◆ TObjectToDataObject() [1/2]

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 setExpHits(vector< MucRecHit * > &pHits)
void setTrackId(const int trackId)
set the index for this track.
void setVecHits(vector< MucRecHit * > &pHits)
reload setVecHits
static std::map< const TObject *, const RecMucTrack * > m_rootRecMucTrackMap

◆ TObjectToDataObject() [2/2]

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

transformation from root

Implements RootEventBaseCnv.

Friends And Related Function Documentation

◆ CnvFactory< RecMucTrackCnv >


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