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

#include <EmcTrackCnv.h>

+ Inheritance diagram for EmcTrackCnv:

Public Member Functions

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

 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
 

Friends

class CnvFactory< EmcTrackCnv >
 

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

Constructor & Destructor Documentation

◆ ~EmcTrackCnv()

virtual EmcTrackCnv::~EmcTrackCnv ( )
inlinevirtual

Definition at line 25 of file EmcTrackCnv.h.

25{ };

◆ EmcTrackCnv()

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}
IMessageSvc * msgSvc()
static const CLID & classID()
Definition: EmcTrackCnv.h:20
Base class for all Root Converters.
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)

Member Function Documentation

◆ classID()

static const CLID & EmcTrackCnv::classID ( )
inlinestatic

Definition at line 20 of file EmcTrackCnv.h.

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

◆ DataObjectToTObject()

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
Definition: DstEmcShower.h:102
************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
#define NULL
static TDstEvent * getWriteObject()
returns object to be written (maintained here for all DIGI-converters)
Definition: DstCnv.h:36
DstCnv * getDstCnv()
Definition: RootCnvSvc.h:155
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 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
Definition: TDstEvent.h:48
void clearEmcTrackCol()
clear the whole array (necessary because of the consts-s)
Definition: TDstEvent.h:57
void setTrackId(const Int_t trackId)
Definition: TEmcTrack.h:50
void setA20Moment(const Double_t a20Moment)
Definition: TEmcTrack.h:68
void setEnergy(const Double_t e)
Definition: TEmcTrack.h:58
void setESeed(const Double_t eSeed)
Definition: TEmcTrack.h:62
void setNumHits(const Int_t hit)
Definition: TEmcTrack.h:51
void setDtheta(const Double_t dt)
Definition: TEmcTrack.h:60
void setX(const Double_t x)
Definition: TEmcTrack.h:55
void setErr(const Double_t err[6])
Definition: TEmcTrack.cxx:20
void setModule(const Int_t mod)
Definition: TEmcTrack.h:54
void setSecondMoment(const Double_t secondMoment)
Definition: TEmcTrack.h:66
void setDE(const Double_t de)
Definition: TEmcTrack.h:59
void setY(const Double_t y)
Definition: TEmcTrack.h:56
void setA42Moment(const Double_t a42Moment)
Definition: TEmcTrack.h:69
void setZ(const Double_t z)
Definition: TEmcTrack.h:57
void setTime(const Double_t time)
Definition: TEmcTrack.h:65
void setCellId(const Int_t id)
Definition: TEmcTrack.h:53
void setE3x3(const Double_t e3x3)
Definition: TEmcTrack.h:63
void setE5x5(const Double_t e5x5)
Definition: TEmcTrack.h:64
void setStatus(const Int_t st)
Definition: TEmcTrack.h:52
void setLatMoment(const Double_t latMoment)
Definition: TEmcTrack.h:67
void setDphi(const Double_t dpi)
Definition: TEmcTrack.h:61
double y[1000]
_EXTERN_ std::string Event
Definition: EventModel.h:128

◆ TObjectToDataObject()

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 setDphi(double dpi)
Definition: DstEmcShower.h:66
void setE3x3(double e3x3)
Definition: DstEmcShower.h:68
void setDtheta(double dt)
Definition: DstEmcShower.h:65
void setStatus(int st)
Definition: DstEmcShower.h:59
void setNumHits(int hit)
Definition: DstEmcShower.h:58
void setSecondMoment(double secondMoment)
Definition: DstEmcShower.h:71
void setA20Moment(double a20Moment)
Definition: DstEmcShower.h:73
void setPosition(const HepPoint3D &pos)
Definition: DstEmcShower.h:62
void setDE(double de)
Definition: DstEmcShower.h:64
void setA42Moment(double a42Moment)
Definition: DstEmcShower.h:74
void setESeed(double eSeed)
Definition: DstEmcShower.h:67
void setTime(double time)
Definition: DstEmcShower.h:70
void setModule(int mod)
Definition: DstEmcShower.h:61
void setCellId(int id)
Definition: DstEmcShower.h:60
void setLatMoment(double latMoment)
Definition: DstEmcShower.h:72
void setErrorMatrix(const HepSymMatrix &error)
Definition: DstEmcShower.h:75
void setTrackId(int trackId)
Definition: DstEmcShower.h:57
void setEnergy(double e)
Definition: DstEmcShower.h:63
void setE5x5(double e5x5)
Definition: DstEmcShower.h:69
Double_t time() const
Definition: TEmcTrack.h:42
Double_t a42Moment() const
Definition: TEmcTrack.h:46
Int_t trackId() const
Definition: TEmcTrack.h:19
Double_t eSeed() const
Definition: TEmcTrack.h:39
Double_t err(Int_t i) const
Definition: TEmcTrack.h:47
Int_t status() const
Definition: TEmcTrack.h:21
Double_t energy() const
Definition: TEmcTrack.h:37
Double_t y() const
Definition: TEmcTrack.h:25
Double_t dtheta() const
Definition: TEmcTrack.h:35
Double_t e3x3() const
Definition: TEmcTrack.h:40
Double_t secondMoment() const
Definition: TEmcTrack.h:43
Int_t module() const
Definition: TEmcTrack.h:23
Double_t x() const
Definition: TEmcTrack.h:24
Double_t a20Moment() const
Definition: TEmcTrack.h:45
Double_t z() const
Definition: TEmcTrack.h:26
Double_t dE() const
Definition: TEmcTrack.h:38
Int_t cellId() const
Definition: TEmcTrack.h:22
Int_t numHits() const
Definition: TEmcTrack.h:20
Double_t e5x5() const
Definition: TEmcTrack.h:41
Double_t dphi() const
Definition: TEmcTrack.h:36
Double_t latMoment() const
Definition: TEmcTrack.h:44
static std::map< const TObject *, const DstEmcShower * > m_rootEmcShowerMap
Definition: commonData.h:143

Friends And Related Function Documentation

◆ CnvFactory< EmcTrackCnv >

friend class CnvFactory< EmcTrackCnv >
friend

Definition at line 9 of file EmcTrackCnv.h.


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