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

#include <RecMdcTrackCnv.h>

+ Inheritance diagram for RecMdcTrackCnv:

Public Member Functions

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

 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
 

Friends

class CnvFactory< RecMdcTrackCnv >
 

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

Constructor & Destructor Documentation

◆ ~RecMdcTrackCnv()

virtual RecMdcTrackCnv::~RecMdcTrackCnv ( )
inlinevirtual

Definition at line 25 of file RecMdcTrackCnv.h.

25{ };

◆ RecMdcTrackCnv()

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}
IMessageSvc * msgSvc()
static const CLID & classID()
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 & RecMdcTrackCnv::classID ( )
inlinestatic

Definition at line 20 of file RecMdcTrackCnv.h.

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

◆ DataObjectToTObject()

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
Definition: RecMdcTrack.h:79
static TRecTrackEvent * getWriteObject()
returns object to be written (maintained here for all DIGI-converters)
Definition: RecTrackCnv.h:36
RecTrackCnv * getRecTrackCnv()
Definition: RootCnvSvc.h:166
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 setVZ0(Double_t vz0)
Definition: TRecMdcTrack.h:65
const Double_t pz() const
void setStat(const Int_t stat)
Definition: TRecMdcTrack.h:50
void setVX0(Double_t vx0)
Definition: TRecMdcTrack.h:63
void setNdof(const Int_t ndof)
Definition: TRecMdcTrack.h:52
void setErr(const Double_t er[15])
Definition: TRecMdcTrack.h:54
void setHelix(const Double_t helix[5])
Definition: TRecMdcTrack.h:47
const Double_t px() const
void setNhits(const Int_t nh)
Definition: TRecMdcTrack.h:58
void setNster(const Int_t ns)
Definition: TRecMdcTrack.h:59
void setNlayer(const Int_t nlayer)
Definition: TRecMdcTrack.h:60
void setChi2(const Double_t chi)
Definition: TRecMdcTrack.h:51
void setTrackId(const Int_t trackId)
Definition: TRecMdcTrack.h:46
void setFiTerm(Double_t fiterm)
Definition: TRecMdcTrack.h:66
void setVY0(Double_t vy0)
Definition: TRecMdcTrack.h:64
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
_EXTERN_ std::string Event
Definition: EventModel.h:80
#define ns(x)
Definition: xmltok.c:1504

◆ TObjectToDataObject()

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
Definition: RecMdcTrack.h:22
void setPxy(const double pxy)
Definition: DstMdcTrack.h:84
void setTrackId(const int trackId)
Definition: DstMdcTrack.h:82
void setPy(const double py)
Definition: DstMdcTrack.h:86
void setZ(const double z)
Definition: DstMdcTrack.h:93
void setNster(const int ns)
Definition: DstMdcTrack.h:98
void setX(const double x)
Definition: DstMdcTrack.h:91
void setError(double err[15])
void setNdof(const int ndof)
Definition: DstMdcTrack.h:97
void setTheta(const double theta)
Definition: DstMdcTrack.h:89
void setStat(const int stat)
Definition: DstMdcTrack.h:95
void setNlayer(const int nlayer)
Definition: DstMdcTrack.h:101
void setP(const double p)
Definition: DstMdcTrack.h:88
void setHelix(double helix[5])
Definition: DstMdcTrack.cxx:98
void setR(const double r)
Definition: DstMdcTrack.h:94
void setCharge(const int charge)
Definition: DstMdcTrack.h:83
void setY(const double y)
Definition: DstMdcTrack.h:92
void setChi2(const double chi)
Definition: DstMdcTrack.h:96
void setPhi(const double phi)
Definition: DstMdcTrack.h:90
void setPz(const double pz)
Definition: DstMdcTrack.h:87
void setPx(const double px)
Definition: DstMdcTrack.h:85
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 HitRefVec getVecHits(void) const
Definition: RecMdcTrack.h:60
void setVZ0(double z0)
Definition: RecMdcTrack.h:65
void setVY0(double y0)
Definition: RecMdcTrack.h:64
void setVecHits(HitRefVec vechits)
Definition: RecMdcTrack.h:69
void setNhits(int nhits)
Definition: RecMdcTrack.h:67
void setFiTerm(double fiterm)
Definition: RecMdcTrack.h:66
void setVX0(double x0)
Definition: RecMdcTrack.h:63
const Double_t x() const
const Double_t phi() const
const Double_t z() const
const Int_t nster() const
Definition: TRecMdcTrack.h:36
const Double_t vz0(void) const
Definition: TRecMdcTrack.h:42
const Double_t p() const
const Int_t nhits() const
Definition: TRecMdcTrack.h:35
const Double_t chi2() const
Definition: TRecMdcTrack.h:32
const Int_t trackId() const
Definition: TRecMdcTrack.h:17
const Double_t y() const
const Int_t stat() const
Definition: TRecMdcTrack.h:31
const Double_t vy0(void) const
Definition: TRecMdcTrack.h:41
const Double_t fiTerm(void) const
Definition: TRecMdcTrack.h:43
const Double_t pxy() const
const Double_t err(Int_t i) const
Definition: TRecMdcTrack.h:34
const Int_t ndof() const
Definition: TRecMdcTrack.h:33
const Double_t theta() const
const Double_t r() const
const Int_t nlayer() const
Definition: TRecMdcTrack.h:37
const Int_t charge() const
const Double_t vx0(void) const
Definition: TRecMdcTrack.h:40
const Double_t helix(Int_t i) const
Definition: TRecMdcTrack.h:18
static std::map< const TObject *, const RecMdcTrack * > m_rootRecMdcTrackMap
Definition: commonData.h:202

Friends And Related Function Documentation

◆ CnvFactory< RecMdcTrackCnv >

friend class CnvFactory< RecMdcTrackCnv >
friend

Definition at line 9 of file RecMdcTrackCnv.h.


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