2#define MucTrackCnv_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/DstMucTrack.h"
14#include "RootEventData/TMucTrack.h"
15#include "RootEventData/TDstEvent.h"
17#include "RootCnvSvc/Dst/DstCnv.h"
18#include "RootCnvSvc/Dst/MucTrackCnv.h"
19#include "RootCnvSvc/RootAddress.h"
34 MsgStream log(
msgSvc(),
"MucTrackCnv");
36 m_rootBranchname =
"m_mucTrackCol";
38 m_adresses.push_back(&m_mucTrackCol);
45 MsgStream log(
msgSvc(),
"MucTrackCnv");
46 log << MSG::DEBUG <<
"MucTrackCnv::TObjectToDataObject" << endreq;
47 StatusCode sc=StatusCode::SUCCESS;
51 refpObject=mucTrackTdsCol;
55 if (!m_mucTrackCol)
return sc;
56 TIter mucTrackIter(m_mucTrackCol);
58 while ((mucTrackRoot = (
TMucTrack*)mucTrackIter.Next())) {
60 int trackId = mucTrackRoot->
trackId();
61 int id = mucTrackRoot-> id();
62 int st = mucTrackRoot->
status();
63 int type = mucTrackRoot->
type();
65 int startPart = mucTrackRoot->
startPart();
66 int endPart = mucTrackRoot->
endPart();
69 int numHits = mucTrackRoot->
numHits();
70 int numLayers = mucTrackRoot->
numLayers();
73 double depth = mucTrackRoot->
depth();
74 double chi2 = mucTrackRoot->
chi2();
75 int dof = mucTrackRoot->
dof();
76 double rms = mucTrackRoot->
rms();
78 double xPos = mucTrackRoot->
xPos() ;
79 double yPos = mucTrackRoot->
yPos() ;
80 double zPos = mucTrackRoot->
zPos() ;
82 double xPosSigma = mucTrackRoot->
xPosSigma() ;
83 double yPosSigma = mucTrackRoot->
yPosSigma() ;
84 double zPosSigma = mucTrackRoot->
zPosSigma() ;
86 double px = mucTrackRoot->
px() ;
87 double py = mucTrackRoot->
py() ;
88 double pz = mucTrackRoot->
pz() ;
90 double distance = mucTrackRoot->
distance();
91 double deltaphi = mucTrackRoot->
deltaPhi();
94 double krechi2 = mucTrackRoot->
kalRechi2();
95 int kdof = mucTrackRoot->
kaldof();
96 double kdepth = mucTrackRoot->
kaldepth();
105 mucTrackTds->
setId(
id );
119 mucTrackTds->
setDof( dof );
120 mucTrackTds->
setRms( rms );
130 mucTrackTds->
setPx( px );
131 mucTrackTds->
setPy( py );
132 mucTrackTds->
setPz( pz );
145 mucTrackTdsCol->push_back(mucTrackTds);
151 delete m_mucTrackCol;
153 return StatusCode::SUCCESS;
158 MsgStream log(
msgSvc(),
"MucTrackCnv");
159 log << MSG::DEBUG <<
"MucTrackCnv::DataObjectToTObject" << endreq;
160 StatusCode sc=StatusCode::SUCCESS;
163 if (!mucTrackColTds) {
164 log << MSG::ERROR <<
"Could not downcast to MucTrackCol" << endreq;
165 return StatusCode::FAILURE;
171 log << MSG::ERROR <<
"Could not get DstEvent in TDS " << endreq;
172 return StatusCode::FAILURE;
176 log << MSG::ERROR <<
"MucTrackCnv:Could not downcast to TDS DigiEvent" << endreq;
178 IOpaqueAddress *addr;
184 if (!m_mucTrackCol)
return sc;
186 DstMucTrackCol::const_iterator mucTrackTds;
188 for (mucTrackTds = mucTrackColTds->begin(); mucTrackTds != mucTrackColTds->end(); mucTrackTds++) {
189 Int_t trackId = (*mucTrackTds)->
trackId();
190 Int_t
id = (*mucTrackTds)-> id();
191 Int_t st = (*mucTrackTds)->status();
192 Int_t type = (*mucTrackTds)->type();
194 Int_t startPart = (*mucTrackTds)->startPart();
195 Int_t endPart = (*mucTrackTds)->endPart();
196 Int_t brLastLayer = (*mucTrackTds)->brLastLayer();
197 Int_t ecLastLayer = (*mucTrackTds)->ecLastLayer();
198 Int_t numHits = (*mucTrackTds)->numHits();
199 Int_t numLayers = (*mucTrackTds)->numLayers();
200 Int_t maxHitsInLayer = (*mucTrackTds)->maxHitsInLayer();
202 Double_t depth = (*mucTrackTds)->depth();
203 Double_t chi2 = (*mucTrackTds)->chi2();
204 Int_t dof = (*mucTrackTds)->dof();
205 Double_t rms = (*mucTrackTds)->rms();
207 Double_t xPos = (*mucTrackTds)->xPos() ;
208 Double_t yPos = (*mucTrackTds)->yPos() ;
209 Double_t zPos = (*mucTrackTds)->zPos() ;
211 Double_t xPosSigma = (*mucTrackTds)->xPosSigma() ;
212 Double_t yPosSigma = (*mucTrackTds)->yPosSigma() ;
213 Double_t zPosSigma = (*mucTrackTds)->zPosSigma() ;
215 Double_t px = (*mucTrackTds)->px() ;
216 Double_t py = (*mucTrackTds)->py() ;
217 Double_t pz = (*mucTrackTds)->pz() ;
219 Double_t distance = (*mucTrackTds)->distance();
220 Double_t deltaphi = (*mucTrackTds)->deltaPhi();
222 Double_t krechi2 = (*mucTrackTds)->kalRechi2();
223 Int_t kdof = (*mucTrackTds)->kaldof();
224 Double_t kdepth = (*mucTrackTds)->kaldepth();
225 Int_t kbrlay = (*mucTrackTds)->kalbrLastLayer();
226 Int_t keclay = (*mucTrackTds)->kalecLastLayer();
235 mucTrackRoot->
setId(
id );
249 mucTrackRoot->
setDof( dof );
250 mucTrackRoot->
setRms( rms );
260 mucTrackRoot->
setPx( px );
261 mucTrackRoot->
setPy( py );
262 mucTrackRoot->
setPz( pz );
278 return StatusCode::SUCCESS;
ObjectVector< DstMucTrack > DstMucTrackCol
static TDstEvent * getWriteObject()
returns object to be written (maintained here for all DIGI-converters)
void setDistance(double dist)
void setkalbrLastLayer(int br)
void setMaxHitsInLayer(int maxHits)
void setEcLastLayer(int layer)
void setBrLastLayer(int layer)
void setYPosSigma(double ysigma)
void setDepth(double depth)
void setZPosSigma(double zsigma)
void setTrackId(int trackId)
void setkalecLastLayer(int ec)
void setXPosSigma(double xsigma)
void setStartPart(int part)
void setDeltaPhi(double dphi)
void setNumLayers(int numLayers)
void setNumHits(int numHits)
void setChi2(double chi2)
void setkalRechi2(double ch)
void setkalDepth(double de)
void setEndPart(int part)
MucTrackCnv(ISvcLocator *svc)
virtual StatusCode TObjectToDataObject(DataObject *&obj)
transformation from root
virtual StatusCode DataObjectToTObject(DataObject *obj, RootAddress *addr)
transformation to root
Definition of a Root address, derived from IOpaqueAddress.
Base class for all Root Converters.
IDataProviderSvc * m_eds
pointer to eventdataservice
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)
Convert the transient object to the requested representation.
void clearMucTrackCol()
clear the whole array
void addMucTrack(TMucTrack *Track)
Add a MucTrack into the TOF Data collection.
const TObjArray * getMucTrackCol() const
retrieve the whole TObjArray of MucTrack Data
void setNumHits(Int_t numHits)
void setTrackId(Int_t trackId)
void setkalecLastLayer(Int_t ec)
void setEndPart(Int_t part)
void setBrLastLayer(Int_t layer)
void setDeltaPhi(double dphi)
Int_t kalbrLastLayer() const
Int_t brLastLayer() const
void setXPosSigma(Double_t x)
void setMaxHitsInLayer(Int_t maxHits)
Double_t deltaPhi() const
Double_t zPosSigma() const
void setkalRechi2(Double_t ch)
Int_t kalecLastLayer() const
Double_t kalRechi2() const
void setYPosSigma(Double_t y)
Double_t yPosSigma() const
void setkalDepth(Double_t de)
Double_t xPosSigma() const
void setDepth(Double_t depth)
void setStartPart(Int_t part)
void setChi2(Double_t chi2)
Double_t distance() const
void setkalbrLastLayer(Int_t br)
Int_t maxHitsInLayer() const
void setEcLastLayer(Int_t layer)
void setRms(Double_t rms)
void setDistance(double dist)
void setZPosSigma(Double_t z)
void setNumLayers(Int_t numLayers)
Int_t ecLastLayer() const
Double_t kaldepth() const
static std::map< const TObject *, const DstMucTrack * > m_rootMucTrackMap
_EXTERN_ std::string Event