2#define EmcTrackCnv_CXX 1
4#include "GaudiKernel/MsgStream.h"
5#include "GaudiKernel/DataObject.h"
6#include "GaudiKernel/ObjectVector.h"
8#include "TClonesArray.h"
10#include "EventModel/EventModel.h"
12#include "DstEvent/DstEvent.h"
13#include "DstEvent/DstEmcShower.h"
14#include "RootEventData/TEmcTrack.h"
15#include "RootEventData/TDstEvent.h"
17#include "RootCnvSvc/Dst/DstCnv.h"
18#include "RootCnvSvc/Dst/EmcTrackCnv.h"
19#include "RootCnvSvc/RootAddress.h"
34 MsgStream log(
msgSvc(),
"EmcTrackCnv");
47 MsgStream log(
msgSvc(),
"EmcTrackCnv");
48 log << MSG::DEBUG <<
"EmcTrackCnv::TObjectToDataObject" << endreq;
49 StatusCode sc=StatusCode::SUCCESS;
53 refpObject=emcTrackTdsCol;
57 if (!m_emcTrackCol)
return sc;
58 TIter emcTrackIter(m_emcTrackCol);
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();
72 double dE = emcTrackRoot->
dE();
73 double eSeed = emcTrackRoot->
eSeed();
74 double e3x3 = emcTrackRoot->
e3x3();
75 double e5x5 = emcTrackRoot->
e5x5();
78 double latMoment = emcTrackRoot->
latMoment();
79 double a20Moment = emcTrackRoot->
a20Moment();
80 double a42Moment = emcTrackRoot->
a42Moment();
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);
101 emcTrackTds->
setDE( dE );
114 emcTrackTdsCol->push_back(emcTrackTds);
120 delete m_emcTrackCol;
122 return StatusCode::SUCCESS;
127 MsgStream log(
msgSvc(),
"EmcTrackCnv");
128 log << MSG::DEBUG <<
"EmcTrackCnv::DataObjectToTObject" << endreq;
129 StatusCode sc=StatusCode::SUCCESS;
132 if (!emcTrackColTds) {
133 log << MSG::ERROR <<
"Could not downcast to EmcTrackCol" << endreq;
134 return StatusCode::FAILURE;
140 log << MSG::ERROR <<
"Could not get DstEvent in TDS " << endreq;
141 return StatusCode::FAILURE;
145 log << MSG::ERROR <<
"EmcTrackCnv:Could not downcast to TDS DstEvent" << endreq;
147 IOpaqueAddress *addr;
153 if (!m_emcTrackCol)
return sc;
155 DstEmcShowerCol::const_iterator emcTrackTds;
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();
179 HepSymMatrix matrix = (*emcTrackTds)->errorMatrix();
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];
197 emcTrackRoot->
setX(
x );
198 emcTrackRoot->
setY( y );
199 emcTrackRoot->
setZ( z );
201 emcTrackRoot->
setDE( dE );
212 emcTrackRoot->
setErr( err );
217 return StatusCode::SUCCESS;
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
static TDstEvent * getWriteObject()
returns object to be written (maintained here for all DIGI-converters)
void setE3x3(double e3x3)
void setDtheta(double dt)
void setSecondMoment(double secondMoment)
void setA20Moment(double a20Moment)
void setPosition(const HepPoint3D &pos)
void setA42Moment(double a42Moment)
void setESeed(double eSeed)
void setTime(double time)
void setLatMoment(double latMoment)
void setErrorMatrix(const HepSymMatrix &error)
void setTrackId(int trackId)
void setE5x5(double e5x5)
EmcTrackCnv(ISvcLocator *svc)
virtual StatusCode DataObjectToTObject(DataObject *obj, RootAddress *addr)
transformation to root
virtual StatusCode TObjectToDataObject(DataObject *&obj)
transformation from root
Definition of a Root address, derived from IOpaqueAddress.
Base class for all Root Converters.
std::string m_rootTreename
each converter knows it's treename
IDataProviderSvc * m_eds
pointer to eventdataservice
std::vector< void * > m_adresses
each converter knows the corresponding adresses
std::string m_rootBranchname
root branchname (may be concatenated of severals)
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.
const TObjArray * getEmcTrackCol() const
retrieve the whole TObjArray of EmcTrack Data
void clearEmcTrackCol()
clear the whole array (necessary because of the consts-s)
void setTrackId(const Int_t trackId)
void setA20Moment(const Double_t a20Moment)
Double_t a42Moment() const
void setEnergy(const Double_t e)
void setESeed(const Double_t eSeed)
void setNumHits(const Int_t hit)
void setDtheta(const Double_t dt)
void setX(const Double_t x)
void setErr(const Double_t err[6])
Double_t err(Int_t i) const
void setModule(const Int_t mod)
void setSecondMoment(const Double_t secondMoment)
void setDE(const Double_t de)
void setY(const Double_t y)
void setA42Moment(const Double_t a42Moment)
Double_t secondMoment() const
void setZ(const Double_t z)
Double_t a20Moment() const
void setTime(const Double_t time)
void setCellId(const Int_t id)
void setE3x3(const Double_t e3x3)
void setE5x5(const Double_t e5x5)
void setStatus(const Int_t st)
void setLatMoment(const Double_t latMoment)
Double_t latMoment() const
void setDphi(const Double_t dpi)
static std::map< const TObject *, const DstEmcShower * > m_rootEmcShowerMap
_EXTERN_ std::string Event