1#ifndef RecMucTrackCnv_CXX
2#define RecMucTrackCnv_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 "ReconEvent/ReconEvent.h"
13#include "MucRecEvent/RecMucTrack.h"
16#include "RootEventData/TRecMucTrack.h"
18#include "RootEventData/TRecTrackEvent.h"
20#include "RootCnvSvc/Rec/RecTrackCnv.h"
21#include "RootCnvSvc/Rec/RecMucTrackCnv.h"
22#include "RootCnvSvc/RootAddress.h"
39 MsgStream log(
msgSvc(),
"RecMucTrackCnv");
54 MsgStream log(
msgSvc(),
"RecMucTrackCnv");
55 log << MSG::DEBUG <<
"RecMucTrackCnv::TObjectToDataObject" << endreq;
56 StatusCode sc=StatusCode::SUCCESS;
60 refpObject=mucTrackTdsCol;
64 if (!m_recMucTrackCol)
return sc;
65 TIter mucTrackIter(m_recMucTrackCol);
67 while ((mucTrackRoot = (
TRecMucTrack*)mucTrackIter.Next())) {
69 int trackId = mucTrackRoot->
trackId();
70 int id = mucTrackRoot-> id();
71 int st = mucTrackRoot->
status();
72 int type = mucTrackRoot->
type();
74 int startPart = mucTrackRoot->
startPart();
75 int endPart = mucTrackRoot->
endPart();
78 int numHits = mucTrackRoot->
numHits();
79 int numLayers = mucTrackRoot->
numLayers();
82 double depth = mucTrackRoot->
depth();
83 double chi2 = mucTrackRoot->
chi2();
84 int dof = mucTrackRoot->
dof();
85 double rms = mucTrackRoot->
rms();
89 double xPos = mucTrackRoot->
xPos() ;
90 double yPos = mucTrackRoot->
yPos() ;
91 double zPos = mucTrackRoot->
zPos() ;
93 double xPosSigma = mucTrackRoot->
xPosSigma() ;
94 double yPosSigma = mucTrackRoot->
yPosSigma() ;
95 double zPosSigma = mucTrackRoot->
zPosSigma() ;
97 double px = mucTrackRoot->
px() ;
98 double py = mucTrackRoot->
py() ;
99 double pz = mucTrackRoot->
pz() ;
101 double distance = mucTrackRoot->
distance();
102 double deltaphi = mucTrackRoot->
deltaPhi();
105 vector<int> vecHits = mucTrackRoot->
vecHits();
106 vector<int> expHits = mucTrackRoot->
expHits();
107 vector<float> distHits = mucTrackRoot->
distHits();
110 double krechi2 = mucTrackRoot->
kalRechi2();
111 int kdof = mucTrackRoot->
kaldof();
112 double kdepth = mucTrackRoot->
kaldepth();
122 mucTrackTds->
setId(
id );
136 mucTrackTds->
setDof( dof );
137 mucTrackTds->
setRms( rms );
147 mucTrackTds->
setPx( px );
148 mucTrackTds->
setPy( py );
149 mucTrackTds->
setPz( pz );
167 mucTrackTdsCol->push_back(mucTrackTds);
173 delete m_recMucTrackCol;
174 m_recMucTrackCol = 0;
175 return StatusCode::SUCCESS;
180 MsgStream log(
msgSvc(),
"RecMucTrackCnv");
181 log << MSG::DEBUG <<
"RecMucTrackCnv::DataObjectToTObject" << endreq;
182 StatusCode sc=StatusCode::SUCCESS;
185 if (!mucTrackColTds) {
186 log << MSG::ERROR <<
"Could not downcast to RecMucTrackCol" << endreq;
187 return StatusCode::FAILURE;
193 log << MSG::ERROR <<
"Could not get RecEvent in TDS " << endreq;
194 return StatusCode::FAILURE;
198 log << MSG::ERROR <<
"RecMucTrackCnv:Could not downcast to TDS DigiEvent" << endreq;
200 IOpaqueAddress *addr;
206 if (!m_recMucTrackCol)
return sc;
208 RecMucTrackCol::const_iterator mucTrackTds;
210 for (mucTrackTds = mucTrackColTds->begin(); mucTrackTds != mucTrackColTds->end(); mucTrackTds++) {
211 Int_t trackId = (*mucTrackTds)->trackId();
212 Int_t
id = (*mucTrackTds)-> id();
213 Int_t st = (*mucTrackTds)->status();
214 Int_t type = (*mucTrackTds)->type();
216 Int_t startPart = (*mucTrackTds)->startPart();
217 Int_t endPart = (*mucTrackTds)->endPart();
218 Int_t brLastLayer = (*mucTrackTds)->brLastLayer();
219 Int_t ecLastLayer = (*mucTrackTds)->ecLastLayer();
220 Int_t numHits = (*mucTrackTds)->numHits();
221 Int_t numLayers = (*mucTrackTds)->numLayers();
222 Int_t maxHitsInLayer = (*mucTrackTds)->maxHitsInLayer();
224 Double_t depth = (*mucTrackTds)->depth();
225 Double_t chi2 = (*mucTrackTds)->chi2();
226 Int_t dof = (*mucTrackTds)->dof();
227 Double_t rms = (*mucTrackTds)->rms();
229 Double_t xPos = (*mucTrackTds)->xPos() ;
230 Double_t yPos = (*mucTrackTds)->yPos() ;
231 Double_t zPos = (*mucTrackTds)->zPos() ;
233 Double_t xPosSigma = (*mucTrackTds)->xPosSigma() ;
234 Double_t yPosSigma = (*mucTrackTds)->yPosSigma() ;
235 Double_t zPosSigma = (*mucTrackTds)->zPosSigma() ;
237 Double_t distance = (*mucTrackTds)->distance();
238 Double_t deltaphi = (*mucTrackTds)->deltaPhi();
240 Double_t px = (*mucTrackTds)->px() ;
241 Double_t py = (*mucTrackTds)->py() ;
242 Double_t pz = (*mucTrackTds)->pz() ;
245 vector<Int_t> vecHits = (*mucTrackTds)->getVecHits();
246 vector<Int_t> expHits = (*mucTrackTds)->getExpHits();
247 vector<Float_t> distHits = (*mucTrackTds)->getDistHits();
249 Double_t krechi2 = (*mucTrackTds)->kalRechi2();
250 Int_t kdof = (*mucTrackTds)->kaldof();
251 Double_t kdepth = (*mucTrackTds)->kaldepth();
252 Int_t kbrlay = (*mucTrackTds)->kalbrLastLayer();
253 Int_t keclay = (*mucTrackTds)->kalecLastLayer();
275 mucTrackRoot->
setId(
id );
289 mucTrackRoot->
setDof( dof );
290 mucTrackRoot->
setRms( rms );
305 mucTrackRoot->
setPx( px );
306 mucTrackRoot->
setPy( py );
307 mucTrackRoot->
setPz( pz );
323 return StatusCode::SUCCESS;
ObjectVector< RecMucTrack > RecMucTrackCol
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 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)
RecMucTrackCnv(ISvcLocator *svc)
virtual StatusCode TObjectToDataObject(DataObject *&obj)
transformation from root
virtual StatusCode DataObjectToTObject(DataObject *obj, RootAddress *addr)
transformation to root
void setDistHits(vector< float > &disthits)
void setExpHits(vector< MucRecHit * > &pHits)
void setTrackId(const int trackId)
set the index for this track.
void setVecHits(vector< MucRecHit * > &pHits)
reload setVecHits
static TRecTrackEvent * getWriteObject()
returns object to be written (maintained here for all DIGI-converters)
Definition of a Root address, derived from IOpaqueAddress.
RecTrackCnv * getRecTrackCnv()
Base class for all Root Converters.
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.
Double_t zPosSigma() const
Int_t brLastLayer() const
void setRms(Double_t rms)
void setMaxHitsInLayer(Int_t maxHits)
void setkalbrLastLayer(Int_t br)
void setEcLastLayer(Int_t layer)
void setDistHits(vector< Float_t > &distHits)
Double_t kalRechi2() const
void setExpHits(vector< Int_t > &expHits)
Double_t distance() const
void setVecHits(vector< Int_t > &vecHits)
void setYPosSigma(Double_t y)
vector< Int_t > vecHits() const
void setkalecLastLayer(Int_t ec)
vector< Int_t > expHits() const
Int_t maxHitsInLayer() const
void setStartPart(Int_t part)
Double_t xPosSigma() const
void setNumHits(Int_t numHits)
void setBrLastLayer(Int_t layer)
vector< Float_t > distHits() const
void setDeltaPhi(Double_t dphi)
void setEndPart(Int_t part)
void setTrackId(Int_t trackId)
Int_t ecLastLayer() const
void setkalRechi2(Double_t ch)
void setNumLayers(Int_t numLayers)
Double_t deltaPhi() const
void setDepth(Double_t depth)
void setXPosSigma(Double_t x)
Int_t kalecLastLayer() const
void setChi2(Double_t chi2)
Int_t kalbrLastLayer() const
Double_t kaldepth() const
void setZPosSigma(Double_t z)
void setkalDepth(Double_t de)
Double_t yPosSigma() const
void setDistance(Double_t dist)
void addMucTrack(TRecMucTrack *Track)
Add a MucTrack into the TOF Data collection.
void clearMucTrackCol()
clear the whole array
const TObjArray * getMucTrackCol() const
retrieve the whole TObjArray of MucTrack Data
static std::map< const TObject *, const RecMucTrack * > m_rootRecMucTrackMap
_EXTERN_ std::string Event