CGEM BOSS 6.6.5.f
BESIII Offline Software System
Loading...
Searching...
No Matches
RecCgemTrackCnv Class Reference

#include <RecCgemTrackCnv.h>

+ Inheritance diagram for RecCgemTrackCnv:

Public Member Functions

virtual ~RecCgemTrackCnv ()
 
virtual ~RecCgemTrackCnv ()
 
virtual ~RecCgemTrackCnv ()
 
- 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
 
 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 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.
 
static const unsigned char storageType ()
 Storage type and class ID.
 

Protected Member Functions

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

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

◆ ~RecCgemTrackCnv() [1/3]

virtual RecCgemTrackCnv::~RecCgemTrackCnv ( )
inlinevirtual

◆ RecCgemTrackCnv() [1/3]

RecCgemTrackCnv::RecCgemTrackCnv ( ISvcLocator *  svc)
protected

Definition at line 33 of file bak_RootCnvSvc-04-01-14/src/Rec/RecCgemTrackCnv.cxx.

35{
36 // Here we associate this converter with the /Event path on the TDS.
37 MsgStream log(msgSvc(), "RecCgemTrackCnv");
38 //m_rootTreename ="Rec";
39 m_rootBranchname ="m_recCgemTrackCol";
40 //declareObject(EventModel::Recon::RecCgemTrackCol, objType(), m_rootTreename, m_rootBranchname);
41 m_adresses.push_back(&m_recCgemTrackCol);
42 m_recCgemTrackCol=0;
43}
std::vector< void * > m_adresses
each converter knows the corresponding adresses
std::string m_rootBranchname
root branchname (may be concatenated of severals)

◆ ~RecCgemTrackCnv() [2/3]

virtual RecCgemTrackCnv::~RecCgemTrackCnv ( )
inlinevirtual

◆ RecCgemTrackCnv() [2/3]

RecCgemTrackCnv::RecCgemTrackCnv ( ISvcLocator *  svc)
protected

◆ ~RecCgemTrackCnv() [3/3]

virtual RecCgemTrackCnv::~RecCgemTrackCnv ( )
inlinevirtual

◆ RecCgemTrackCnv() [3/3]

RecCgemTrackCnv::RecCgemTrackCnv ( ISvcLocator *  svc)
protected

Member Function Documentation

◆ classID() [1/3]

static const CLID & RecCgemTrackCnv::classID ( )
inlinestatic

Definition at line 20 of file Event/RootCnvSvc/bak_RootCnvSvc-04-01-14/RootCnvSvc/Rec/RecCgemTrackCnv.h.

21 {
23 }
const CLID & CLID_RecCgemTrackCol
Definition: EventModel.cxx:399

◆ classID() [2/3]

static const CLID & RecCgemTrackCnv::classID ( )
inlinestatic

◆ classID() [3/3]

static const CLID & RecCgemTrackCnv::classID ( )
inlinestatic

◆ DataObjectToTObject() [1/3]

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

transformation to root

Implements RootEventBaseCnv.

Definition at line 183 of file bak_RootCnvSvc-04-01-14/src/Rec/RecCgemTrackCnv.cxx.

183 {
184
185 MsgStream log(msgSvc(), "RecCgemTrackCnv");
186 log << MSG::DEBUG << "RecCgemTrackCnv::DataObjectToTObject" << endreq;
187
188 RecCgemTrackCol * cgemTrackColTds=dynamic_cast<RecCgemTrackCol *> (obj);
189 if (!cgemTrackColTds) {
190 log << MSG::ERROR << "Could not downcast to CgemTrackCol" << endreq;
191 return StatusCode::FAILURE;
192 }
193 DataObject *evt;
194 StatusCode sc = m_eds->findObject(EventModel::Recon::Event,evt);
195 if (!sc.isSuccess()) {
196 log << MSG::ERROR << "Could not get ReconEvent in TDS " << endreq;
197 return StatusCode::FAILURE;
198 }
199 ReconEvent * devtTds=dynamic_cast<ReconEvent *> (evt);
200 if (!devtTds) {
201 log << MSG::ERROR << "RecCgemTrackCnv:Could not downcast to TDS ReconEvent" << endreq;
202 }
203
204 IOpaqueAddress *addr;
205
206 m_cnvSvc->getRecTrackCnv()->createRep(evt,addr);
208
209 const TObjArray *m_recCgemTrackCol = recEvt->getRecCgemTrackCol();
210 if (!m_recCgemTrackCol) return StatusCode::SUCCESS;
211 //necessary in case there is I/O at the same time since array is static
212 recEvt->clearRecCgemTrackCol();
213
214 RecCgemTrackCol::const_iterator recCgemTrack;
215 for (recCgemTrack = cgemTrackColTds->begin(); recCgemTrack != cgemTrackColTds->end(); recCgemTrack++) {
216 Int_t trackId =(*recCgemTrack)->trackId();
217 Double_t cgemHelix[5];
218 for(int i=0;i<5;i++){
219 log<<MSG::INFO<<" recCgemTrack.cgemHelix("<<i<<"): "<<(*recCgemTrack)->helix(i)<<endreq;
220 cgemHelix[i] = (*recCgemTrack)->helix(i);
221 }
222
223 Int_t stat = (*recCgemTrack)->stat();
224 Double_t chi = (*recCgemTrack)->chi2();
225 Int_t ndof = (*recCgemTrack)->ndof();
226
227 Double_t er[15];
228 for (Int_t i=0; i<15; i++){
229 er[i] = (*recCgemTrack)->err(i);
230 }
231 Int_t nh = (*recCgemTrack)->getNhits();
232 // vector<Int_t> vecHits = (*recCgemTrack)->vecHits();
233 Double_t vx0 = (*recCgemTrack)->getVX0();
234 Double_t vy0 = (*recCgemTrack)->getVY0();
235 Double_t vz0 = (*recCgemTrack)->getVZ0();
236 Double_t fiterm =(*recCgemTrack)->getFiTerm();
237
238 TRecCgemTrack *recCgemTrackRoot = new TRecCgemTrack();
239 //m_common.m_recCgemTrackMap[(*recCgemTrack)] = recCgemTrackRoot;
240
241 recCgemTrackRoot->setTrackId( trackId );
242 recCgemTrackRoot->setHelix(cgemHelix);
243 log<<MSG::INFO<<" test,recCgemTrackRoot.px: "<<recCgemTrackRoot->px()
244 <<" recCgemTrackRoot.py: "<<recCgemTrackRoot->py()
245 <<" recCgemTrackRoot.pz: "<<recCgemTrackRoot->pz()
246 <<endreq;
247
248 recCgemTrackRoot->setStat( stat );
249 recCgemTrackRoot->setChi2( chi );
250 recCgemTrackRoot->setNdof( ndof );
251 recCgemTrackRoot->setErr( er );
252 recCgemTrackRoot->setNhits( nh );
253 // recCgemTrackRoot->setVecHits(vecHits);
254 recCgemTrackRoot->setVX0( vx0 );
255 recCgemTrackRoot->setVY0( vy0 );
256 recCgemTrackRoot->setVZ0( vz0 );
257 recCgemTrackRoot->setFiTerm( fiterm );
258
259 recEvt->addRecCgemTrack(recCgemTrackRoot);
260 }
261
262
263 return StatusCode::SUCCESS;
264}
static TRecTrackEvent * getWriteObject()
returns object to be written (maintained here for all DIGI-converters)
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)
Convert the transient object to the requested representation.
void addRecCgemTrack(TRecCgemTrack *Track)
Add a TkrTrack into the Cgem data collection.
const TObjArray * getRecCgemTrackCol() const
retrieve the whole TObjArray of RecCgemTrack Data
void clearRecCgemTrackCol()
clear the whole array (necessary because of the consts-s)

◆ DataObjectToTObject() [2/3]

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

transformation to root

Implements RootEventBaseCnv.

◆ DataObjectToTObject() [3/3]

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

transformation to root

Implements RootEventBaseCnv.

◆ TObjectToDataObject() [1/3]

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

transformation from root

Implements RootEventBaseCnv.

Definition at line 45 of file bak_RootCnvSvc-04-01-14/src/Rec/RecCgemTrackCnv.cxx.

45 {
46 // creation of TDS object from root object
47 MsgStream log(msgSvc(), "RecCgemTrackCnv");
48 log << MSG::DEBUG << "RecCgemTrackCnv::TObjectToDataObject" << endreq;
49
50 // create the TDS location for the RecCgemTrack Collection
51 RecCgemTrackCol* recCgemTrackCol = new RecCgemTrackCol;
52 refpObject = recCgemTrackCol;
53 // now convert
54 if (!m_recCgemTrackCol) return StatusCode::SUCCESS;
55 TIter cgemTrackIter(m_recCgemTrackCol);
56
57 //----------get hit smartRefVector--------
58 //HitRefVec *hitRefVec;
59 //int nTk=0;
60 //while (cgemTrackIter.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 RecCgemTrackCnv" << endreq;
68 return( StatusCode::FAILURE);
69 }
70 SmartDataPtr<RecCgemHitCol> recCgemHitCol(dataSvc,"/Event/Recon/RecCgemHitCol");
71 if (!recCgemHitCol) {
72 log << MSG::FATAL << "Could not find RecCgemHitCol" << endreq;
73 return( StatusCode::FAILURE);
74 }
75 //RecCgemHitCol::iterator iter = recCgemHitCol->begin();
76 //for (;iter != recCgemHitCol->end(); iter++ ) {
77 // int tkId = (*iter)->getTrkId();
78 // hitRefVec[tkId].push_back(*iter);
79 //}
80
81 //---------------------------------------
82 cgemTrackIter = m_recCgemTrackCol;
83 TRecCgemTrack *recCgemTrackRoot = 0;
84 while ((recCgemTrackRoot = (TRecCgemTrack*)cgemTrackIter.Next())) {
85 int trackId = recCgemTrackRoot->trackId();
86 int charge = recCgemTrackRoot->charge();
87 double cgemHelix[5];
88 for(int i=0;i<5; i++){
89 cgemHelix[i] = recCgemTrackRoot->helix(i);
90 }
91 double pxy = recCgemTrackRoot->pxy();
92 double px = recCgemTrackRoot->px();
93 double py = recCgemTrackRoot->py();
94 double pz = recCgemTrackRoot->pz();
95 double p = recCgemTrackRoot->p();
96 double theta = recCgemTrackRoot->theta();
97 double phi = recCgemTrackRoot->phi();
98 double x = recCgemTrackRoot->x();
99 double y = recCgemTrackRoot->y();
100 double z = recCgemTrackRoot->z();
101 double r = recCgemTrackRoot->r();
102 int stat = recCgemTrackRoot->stat();
103 double chi = recCgemTrackRoot->chi2();
104 int ndof = recCgemTrackRoot->ndof();
105 double err[15];
106 for (int i=0; i<15; i++){
107 err[i] = recCgemTrackRoot->err(i);
108 }
109 int nh = recCgemTrackRoot->nhits();
110 // vector<int> vecHits = recCgemTrackRoot->vecHits();
111 double vx0 = recCgemTrackRoot->vx0();
112 double vy0 = recCgemTrackRoot->vy0();
113 double vz0 = recCgemTrackRoot->vz0();
114 double fiterm = recCgemTrackRoot->fiTerm();
115 RecCgemTrack *recCgemTrack = new RecCgemTrack();
116 m_common.m_rootRecCgemTrackMap[recCgemTrackRoot] = recCgemTrack;
117
118 recCgemTrack->setTrackId( trackId );
119 recCgemTrack->setCharge( charge );
120 recCgemTrack->setHelix( cgemHelix );
121 recCgemTrack->setPxy( pxy );
122 recCgemTrack->setPx( px );
123 recCgemTrack->setPy( py );
124 recCgemTrack->setPz( pz );
125 recCgemTrack->setP( p );
126 recCgemTrack->setTheta( theta );
127 recCgemTrack->setPhi( phi );
128 recCgemTrack->setX( x );
129 recCgemTrack->setY( y );
130 recCgemTrack->setZ( z );
131 recCgemTrack->setR( r );
132 recCgemTrack->setStat( stat );
133 recCgemTrack->setChi2( chi );
134 recCgemTrack->setNdof( ndof );
135 recCgemTrack->setError( err );
136 recCgemTrack->setNhits( nh );
137 // recCgemTrack->setVecHits( vecHits );
138 //rec
139 recCgemTrack->setVX0( vx0 );
140 recCgemTrack->setVY0( vy0 );
141 recCgemTrack->setVZ0( vz0 );
142 recCgemTrack->setFiTerm( fiterm );
143
144 RecCgemHitRefVec theHitRefVec;
145
146 RecCgemHitCol::iterator iter = recCgemHitCol->begin();
147 for (;iter != recCgemHitCol->end(); iter++){
148
149 //cout<<" (*iter)->getTrkId(): "<<(*iter)->getTrkId()<<endl;
150 if((*iter)->getTrkId() == trackId){
151 SmartRef<RecCgemHit> refhit(*iter);
152 theHitRefVec.push_back(refhit);
153 }
154 }
155
156 recCgemTrack->setVecHits(theHitRefVec);
157
158 int nhits = recCgemTrack->getVecHits().size();
159
160 //std::cout<<" cgem hits: "<<nhits<< std::endl;
161
162 for(int ii=0; ii <nhits ; ii++){
163
164 //cout<<"ddl: "<<(recCgemTrack->getVecHits()[ii])->getDriftDistLeft()<<endl;
165 //cout<<"erddl: "<<(recCgemTrack->getVecHits()[ii])->getErrDriftDistLeft()<<endl;
166 Identifier id(recCgemTrack->getVecHits()[ii]->getCgemId());
167 int layer = CgemID::layer(id);
168 int sheet = CgemID::sheet(id);
169 int strip = CgemID::strip(id);
170 //cout<<"layer: "<<layer<<" wire: "<<wire<<endl;
171 }
172 recCgemTrackCol->push_back(recCgemTrack);
173 }
174
175 delete m_recCgemTrackCol;
176 m_recCgemTrackCol = 0;
177 return StatusCode::SUCCESS;
178}
Double_t x[10]
EvtStreamInputIterator< typename Generator::result_type > iter(Generator gen, int N=0)
static int strip(const Identifier &id)
static int sheet(const Identifier &id)
static int layer(const Identifier &id)
void setHelix(double helix[5])
void setError(double err[15])
static std::map< const TObject *, const RecCgemTrack * > m_rootRecCgemTrackMap

◆ TObjectToDataObject() [2/3]

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

transformation from root

Implements RootEventBaseCnv.

◆ TObjectToDataObject() [3/3]

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

transformation from root

Implements RootEventBaseCnv.

Friends And Related Function Documentation

◆ CnvFactory< RecCgemTrackCnv >


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