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

#include <EmcTrackCnv.h>

+ Inheritance diagram for EmcTrackCnv:

Public Member Functions

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

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

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

◆ ~EmcTrackCnv() [1/2]

virtual EmcTrackCnv::~EmcTrackCnv ( )
inlinevirtual

◆ EmcTrackCnv() [1/2]

EmcTrackCnv::EmcTrackCnv ( ISvcLocator *  svc)
protected

Definition at line 30 of file EmcTrackCnv.cxx.

32{
33 // Here we associate this converter with the /Event path on the TDS.
34 MsgStream log(msgSvc(), "EmcTrackCnv");
35 // log << MSG::DEBUG << "Constructor called for " << objType() << endreq;
36 m_rootTreename ="Rec";
37 m_rootBranchname ="m_emcTrackCol";
38 //declareObject(EventModel::Dst::DstEmcShowerCol, objType(), m_rootTreename, m_rootBranchname);
39 m_adresses.push_back(&m_emcTrackCol);
40 m_emcTrackCol=0;
41
42}
std::string m_rootTreename
each converter knows it's treename
std::vector< void * > m_adresses
each converter knows the corresponding adresses
std::string m_rootBranchname
root branchname (may be concatenated of severals)

◆ ~EmcTrackCnv() [2/2]

virtual EmcTrackCnv::~EmcTrackCnv ( )
inlinevirtual

◆ EmcTrackCnv() [2/2]

EmcTrackCnv::EmcTrackCnv ( ISvcLocator *  svc)
protected

Member Function Documentation

◆ classID() [1/2]

static const CLID & EmcTrackCnv::classID ( )
inlinestatic

Definition at line 20 of file Event/RootCnvSvc/RootCnvSvc-02-01-13/RootCnvSvc/Dst/EmcTrackCnv.h.

21 {
23 }
const CLID & CLID_DstEmcShowerCol
Definition: EventModel.cxx:265

◆ classID() [2/2]

static const CLID & EmcTrackCnv::classID ( )
inlinestatic

◆ DataObjectToTObject() [1/2]

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

transformation to root

Implements RootEventBaseCnv.

Definition at line 125 of file EmcTrackCnv.cxx.

125 {
126
127 MsgStream log(msgSvc(), "EmcTrackCnv");
128 log << MSG::DEBUG << "EmcTrackCnv::DataObjectToTObject" << endreq;
129 StatusCode sc=StatusCode::SUCCESS;
130
131 DstEmcShowerCol * emcTrackColTds=dynamic_cast<DstEmcShowerCol *> (obj);
132 if (!emcTrackColTds) {
133 log << MSG::ERROR << "Could not downcast to EmcTrackCol" << endreq;
134 return StatusCode::FAILURE;
135 }
136
137 DataObject *evt;
138 m_eds->findObject(EventModel::Dst::Event,evt);
139 if (evt==NULL) {
140 log << MSG::ERROR << "Could not get DstEvent in TDS " << endreq;
141 return StatusCode::FAILURE;
142 }
143 DstEvent * devtTds=dynamic_cast<DstEvent *> (evt);
144 if (!devtTds) {
145 log << MSG::ERROR << "EmcTrackCnv:Could not downcast to TDS DstEvent" << endreq;
146 }
147 IOpaqueAddress *addr;
148
149 m_cnvSvc->getDstCnv()->createRep(evt,addr);
151
152 const TObjArray *m_emcTrackCol = recEvt->getEmcTrackCol();
153 if (!m_emcTrackCol) return sc;
154 recEvt->clearEmcTrackCol(); //necessary in case there is I/O at the same time since array is static
155 DstEmcShowerCol::const_iterator emcTrackTds;
156
157 for (emcTrackTds = emcTrackColTds->begin(); emcTrackTds != emcTrackColTds->end(); emcTrackTds++) {
158 Int_t trackId = (*emcTrackTds)->trackId();
159 Int_t numHits = (*emcTrackTds)->numHits();
160 Int_t status =(*emcTrackTds)->status();
161 Int_t cellId =(*emcTrackTds)->cellId();
162 Int_t module =(*emcTrackTds)->module();
163 Double_t x = (*emcTrackTds)->x();
164 Double_t y = (*emcTrackTds)->y();
165 Double_t z = (*emcTrackTds)->z();
166 Double_t dtheta =(*emcTrackTds)->dtheta();
167 Double_t dphi =(*emcTrackTds)->dphi();
168 Double_t energy = (*emcTrackTds)->energy();
169 Double_t dE = (*emcTrackTds)->dE();
170 Double_t eSeed = (*emcTrackTds)->eSeed();
171 Double_t e3x3 = (*emcTrackTds)->e3x3();
172 Double_t e5x5 = (*emcTrackTds)->e5x5();
173 Double_t time = (*emcTrackTds)->time();
174 Double_t secondMoment = (*emcTrackTds)->secondMoment();
175 Double_t latMoment = (*emcTrackTds)->latMoment();
176 Double_t a20Moment = (*emcTrackTds)->a20Moment();
177 Double_t a42Moment = (*emcTrackTds)->a42Moment();
178
179 HepSymMatrix matrix = (*emcTrackTds)->errorMatrix();
180 Double_t err[6];
181 err[0] = matrix[0][0];
182 err[1] = matrix[1][1];
183 err[2] = matrix[2][2];
184 err[3] = matrix[0][1];
185 err[4] = matrix[0][2];
186 err[5] = matrix[1][2];
187
188 TEmcTrack *emcTrackRoot = new TEmcTrack();
189 //m_common.m_emcShowerMap[(*emcTrackTds)] = emcTrackRoot;
190
191 //emcTrackRoot->initialize(numHits ,status ,cellId ,module ,x ,dx,y ,dy,z ,dz,theta ,dtheta ,phi,dphi ,energy ,dE,cosx ,cosy ,cosz);
192 emcTrackRoot->setTrackId(trackId );
193 emcTrackRoot->setNumHits(numHits );
194 emcTrackRoot->setStatus(status );
195 emcTrackRoot->setCellId( cellId );
196 emcTrackRoot->setModule( module);
197 emcTrackRoot->setX( x );
198 emcTrackRoot->setY( y );
199 emcTrackRoot->setZ( z );
200 emcTrackRoot->setEnergy( energy );
201 emcTrackRoot->setDE( dE );
202 emcTrackRoot->setDtheta( dtheta );
203 emcTrackRoot->setDphi( dphi );
204 emcTrackRoot->setESeed( eSeed );
205 emcTrackRoot->setE3x3( e3x3 );
206 emcTrackRoot->setE5x5( e5x5 );
207 emcTrackRoot->setTime( time );
208 emcTrackRoot->setSecondMoment(secondMoment);
209 emcTrackRoot->setLatMoment(latMoment);
210 emcTrackRoot->setA20Moment(a20Moment);
211 emcTrackRoot->setA42Moment(a42Moment);
212 emcTrackRoot->setErr( err );
213
214 recEvt->addEmcTrack(emcTrackRoot);
215 }
216
217 return StatusCode::SUCCESS;
218}
Double_t x[10]
Double_t time
ObjectVector< DstEmcShower > DstEmcShowerCol
************Class m_ypar INTEGER m_KeyWgt INTEGER m_KeyIHVP INTEGER m_KeyGPS INTEGER m_IsBeamPolarized INTEGER m_EvtGenInterface DOUBLE PRECISION m_Emin DOUBLE PRECISION m_sphot DOUBLE PRECISION m_Xenph DOUBLE PRECISION m_q2 DOUBLE PRECISION m_PolBeam2 DOUBLE PRECISION m_xErrPb *COMMON c_KK2f $ !CMS energy average $ !Spin Polarization vector first beam $ !Spin Polarization vector second beam $ !Beam energy spread[GeV] $ !minimum hadronization energy[GeV] $ !input READ never touch them !$ !debug facility $ !maximum weight $ !inverse alfaQED $ !minimum real photon energy
Definition: KK2f.h:50
static TDstEvent * 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 addEmcTrack(TEmcTrack *Track)
Add a TkrTrack into the Emc data collection.
Definition: TDstEvent.cxx:130
const TObjArray * getEmcTrackCol() const
retrieve the whole TObjArray of EmcTrack Data
void clearEmcTrackCol()
clear the whole array (necessary because of the consts-s)
void setErr(const Double_t err[6])
Definition: TEmcTrack.cxx:20

◆ DataObjectToTObject() [2/2]

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

transformation to root

Implements RootEventBaseCnv.

◆ TObjectToDataObject() [1/2]

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

transformation from root

Implements RootEventBaseCnv.

Definition at line 44 of file EmcTrackCnv.cxx.

44 {
45 // creation of TDS object from root object
46
47 MsgStream log(msgSvc(), "EmcTrackCnv");
48 log << MSG::DEBUG << "EmcTrackCnv::TObjectToDataObject" << endreq;
49 StatusCode sc=StatusCode::SUCCESS;
50
51 // create the TDS location for the EmcTrack Collection
52 DstEmcShowerCol* emcTrackTdsCol = new DstEmcShowerCol;
53 refpObject=emcTrackTdsCol;
54
55
56 // now convert
57 if (!m_emcTrackCol) return sc;
58 TIter emcTrackIter(m_emcTrackCol);
59 TEmcTrack *emcTrackRoot = 0;
60 while ((emcTrackRoot = (TEmcTrack*)emcTrackIter.Next())) {
61 int trackId = emcTrackRoot->trackId();
62 int numHits = emcTrackRoot->numHits();
63 int status = emcTrackRoot->status();
64 int cellId = emcTrackRoot->cellId();
65 int module = emcTrackRoot->module();
66 double x = emcTrackRoot->x();
67 double y = emcTrackRoot->y();
68 double z = emcTrackRoot->z();
69 double dtheta = emcTrackRoot->dtheta();
70 double dphi = emcTrackRoot->dphi();
71 double energy = emcTrackRoot->energy();
72 double dE = emcTrackRoot->dE();
73 double eSeed = emcTrackRoot->eSeed();
74 double e3x3 = emcTrackRoot->e3x3();
75 double e5x5 = emcTrackRoot->e5x5();
76 double time = emcTrackRoot->time();
77 double secondMoment = emcTrackRoot->secondMoment();
78 double latMoment = emcTrackRoot->latMoment();
79 double a20Moment = emcTrackRoot->a20Moment();
80 double a42Moment = emcTrackRoot->a42Moment();
81
82 HepSymMatrix matrix(3);
83 matrix[0][0]=emcTrackRoot->err(0);
84 matrix[1][1]=emcTrackRoot->err(1);
85 matrix[2][2]=emcTrackRoot->err(2);
86 matrix[0][1]=emcTrackRoot->err(3);
87 matrix[0][2]=emcTrackRoot->err(4);
88 matrix[1][2]=emcTrackRoot->err(5);
89
90 DstEmcShower *emcTrackTds = new DstEmcShower();
91 m_common.m_rootEmcShowerMap[emcTrackRoot] = emcTrackTds;
92
93 emcTrackTds->setTrackId(trackId );
94 emcTrackTds->setNumHits(numHits );
95 emcTrackTds->setStatus(status );
96 emcTrackTds->setCellId( cellId );
97 emcTrackTds->setModule( module);
98 HepPoint3D pos(x,y,z);
99 emcTrackTds->setPosition(pos);
100 emcTrackTds->setEnergy( energy );
101 emcTrackTds->setDE( dE );
102 emcTrackTds->setDtheta( dtheta );
103 emcTrackTds->setDphi( dphi );
104 emcTrackTds->setESeed(eSeed);
105 emcTrackTds->setE3x3(e3x3);
106 emcTrackTds->setE5x5(e5x5);
107 emcTrackTds->setTime(time);
108 emcTrackTds->setSecondMoment(secondMoment);
109 emcTrackTds->setLatMoment(latMoment);
110 emcTrackTds->setA20Moment(a20Moment);
111 emcTrackTds->setA42Moment(a42Moment);
112 emcTrackTds->setErrorMatrix( matrix );
113
114 emcTrackTdsCol->push_back(emcTrackTds);
115 // delete emcTrackTds;
116 // emcTrackTds = NULL;
117 }
118
119 //m_emcTrackCol->Delete(); // wensp add 2005/12/30
120 delete m_emcTrackCol;
121 m_emcTrackCol = 0;
122 return StatusCode::SUCCESS;
123}
void setErrorMatrix(const HepSymMatrix &error)
static std::map< const TObject *, const DstEmcShower * > m_rootEmcShowerMap

◆ TObjectToDataObject() [2/2]

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

transformation from root

Implements RootEventBaseCnv.

Friends And Related Function Documentation

◆ CnvFactory< EmcTrackCnv >


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