23 {
24
25 MsgStream log(
msgSvc(),
"EvtRecTrackCnv");
26 log << MSG::DEBUG << "EvtRecTrackCnv::TObjectToDataObject" << endreq;
27
28
30 refpObject = evtRecTrackCol;
31
32 if ( ! m_evtRecTrackCol ) return StatusCode::SUCCESS;
33
34 IDataProviderSvc* dataSvc = 0;
35 StatusCode sc = serviceLocator()->getService("EventDataSvc",
36 IDataProviderSvc::interfaceID(), (IInterface*&)dataSvc);
37 if ( sc.isFailure() ) {
38 log << MSG::FATAL << "Could not get EventDataSvc in EvtRecTrackCnv" << endreq;
39 return sc;
40 }
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78 int trackID;
79
80
82 if(!mdcTrackCol)
83 {
84 log << MSG::INFO << "Could not find RecMdcTrackCol" << endreq;
85 SmartDataPtr<DstMdcTrackCol> dstMdcTrackCol(dataSvc,"/Event/Dst/DstMdcTrackCol");
86 if (!dstMdcTrackCol) {
87 log << MSG::INFO << "Could not find DstMdcTrackCol" << endreq;
88 }
89 else {
91 DstMdcTrackCol::iterator iter_mdc = dstMdcTrackCol->begin();
92 trackID = 0;
93 for (;iter_mdc != dstMdcTrackCol->end(); iter_mdc++, trackID++) {
95 *recMdcTrack = **iter_mdc;
96 (*mdcTrackCol).push_back(recMdcTrack);
97 log << MSG::INFO
98 << " Mdc Track ID = " << trackID
99 <<
" Mdc Track Nster = " << (*iter_mdc)->
nster()
100 << endreq;
101 }
103 }
104 }
105
106
108 if (!mdcKalTrackCol) {
109 log << MSG::INFO << "Could not find RecMdcKalTrackCol" << endreq;
110 SmartDataPtr<DstMdcKalTrackCol> dstMdcKalTrackCol(dataSvc,"/Event/Dst/DstMdcKalTrackCol");
111 if(!dstMdcKalTrackCol) {
112 log << MSG::INFO << "Could not find DstMdcKalTrackCol" << endreq;
113 }
114 else {
116 DstMdcKalTrackCol::iterator iter_mdc = dstMdcKalTrackCol->begin();
117 trackID = 0;
118 for (;iter_mdc != dstMdcKalTrackCol->end(); iter_mdc++, trackID++) {
120 *recMdcKalTrack = **iter_mdc;
121 (*mdcKalTrackCol).push_back(recMdcKalTrack);
122 log << MSG::INFO
123 << " MdcKalTrack ID = " << trackID
124 <<
" MdcKalTrack Nster = " << (*iter_mdc)->
nster()
125 << " MdcKalTrack poca = " << (*iter_mdc)->poca()
126 << endreq;
127 }
129 }
130 }
131
132
134 if (!mdcDedxCol) {
135 log <<MSG::INFO << "Could not find RecMdcDedxCol" << endreq;
136 SmartDataPtr<DstMdcDedxCol> dstMdcDedxCol(dataSvc,"/Event/Dst/DstMdcDedxCol");
137 if(!dstMdcDedxCol) {
138 log <<MSG::INFO << "Could not find DstMdcDedxCol" << endreq;
139 }
140 else {
142 DstMdcDedxCol::iterator iter_mdc = dstMdcDedxCol->begin();
143 trackID=0;
144 for (;iter_mdc != dstMdcDedxCol->end(); iter_mdc++, trackID++) {
146 *recMdcDedx= **iter_mdc;
147 (*mdcDedxCol).push_back(recMdcDedx);
148 log << MSG::INFO
149 << " MdcDedx ID = " << trackID
150 << " MdcDedx "
151 << endreq;
152 }
154 }
155 }
156
157
159 if (!extTrackCol) {
160 log <<MSG::INFO << "Could not find RecExtTrackCol" << endreq;
161 SmartDataPtr<DstExtTrackCol> dstExtTrackCol(dataSvc,"/Event/Dst/DstExtTrackCol");
162 if(!dstExtTrackCol) {
163 log <<MSG::INFO << "Could not find DstExtTrackCol" << endreq;
164 }
165 else {
167 DstExtTrackCol::iterator iter_ext = dstExtTrackCol->begin();
168 trackID=0;
169 for (;iter_ext != dstExtTrackCol->end(); iter_ext++, trackID++) {
171 *recExtTrack = **iter_ext;
172 (*extTrackCol).push_back(recExtTrack);
173 log << MSG::INFO
174 << " ExtTrack ID = " << trackID
175 << endreq;
176 }
178 }
179 }
180
181
183 if ( !tofTrackCol ) {
184 log << MSG::INFO << "Could not find TofTrackCol" << endreq;
185 SmartDataPtr<DstTofTrackCol> dstTofTrackCol(dataSvc,"/Event/Dst/DstTofTrackCol");
186 if(!dstTofTrackCol) {
187 log << MSG::INFO << "Could not find DstTofTrackCol" << endreq;
188 }
189 else {
191 DstTofTrackCol::iterator iter_tof = dstTofTrackCol->begin();
192 for (;iter_tof != dstTofTrackCol->end(); iter_tof++) {
194 *recTofTrack = **iter_tof;
195 (*tofTrackCol).push_back(recTofTrack);
196 log << MSG::INFO
197 <<
"Tof Track ID = " << (*iter_tof)->
tofTrackID()
198 << " Track ID = " << (*iter_tof)->trackID()
199 << " Tof Counter ID = "<<(*iter_tof)->tofID()
200 << " Quality = "<< (*iter_tof)->quality()
201 << endreq;
202 }
204 }
205 }
206
207
208
210 if (!emcShowerCol) {
211 log << MSG::INFO << "Could not find RecEmcShowerCol" << endreq;
212 SmartDataPtr<DstEmcShowerCol> dstEmcShowerCol(dataSvc,"/Event/Dst/DstEmcShowerCol");
213 if(!dstEmcShowerCol) {
214 log << MSG::INFO << "Could not find DstEmcShowerCol" << endreq;
215 }
216 else {
218 DstEmcShowerCol::iterator iter_emc = dstEmcShowerCol->begin();
219 trackID=0;
220 for (;iter_emc != dstEmcShowerCol->end(); iter_emc++, trackID++) {
222 *recEmcShower = **iter_emc;
223 (*emcShowerCol).push_back(recEmcShower);
224 log << MSG::INFO
225 << " EmcShower ID = " << trackID
226 <<
" EmcShower energy = " << (*iter_emc)->
energy()
227 << endreq;
228 }
230 }
231 }
232
233
235 if (!mucTrackCol) {
236 log <<MSG::INFO << "Could not find RecMucTrackCol" << endreq;
237 SmartDataPtr<DstMucTrackCol> dstMucTrackCol(dataSvc,"/Event/Dst/DstMucTrackCol");
238 if(!dstMucTrackCol) {
239 log <<MSG::INFO << "Could not find DstMucTrackCol" << endreq;
240 }
241 else {
243 DstMucTrackCol::iterator iter_muc = dstMucTrackCol->begin();
244 trackID=0;
245 for (;iter_muc != dstMucTrackCol->end(); iter_muc++, trackID++) {
247 *recMucTrack = **iter_muc;
248 (*mucTrackCol).push_back(recMucTrack);
249 log << MSG::INFO
250 << " MucTrack ID = "<< trackID
251 <<endreq;
252 }
254 }
255 }
256
257
258 TIter evtRecTrackIter(m_evtRecTrackCol);
260 while ( (evtRecTrackRoot = (
TEvtRecTrack*)evtRecTrackIter.Next() ) ) {
263
267
268 int mdcTrackId = evtRecTrackRoot->
mdcTrackId();
269 if ( mdcTrackId >= 0 ) {
271 dynamic_cast<RecMdcTrack*
>(mdcTrackCol->containedObject(mdcTrackId))
272 );
273 }
274
276 if ( mdcKalTrackId >= 0 ) {
278 dynamic_cast<RecMdcKalTrack*
>(mdcKalTrackCol->containedObject(mdcKalTrackId))
279 );
280 }
281
282 int mdcDedxId = evtRecTrackRoot->
mdcDedxId();
283 if ( mdcDedxId >= 0 ) {
285 dynamic_cast<RecMdcDedx*
>(mdcDedxCol->containedObject(mdcDedxId))
286 );
287 }
288
289 int extTrackId = evtRecTrackRoot->
extTrackId();
290 if ( extTrackId >= 0 ) {
292 dynamic_cast<RecExtTrack*
>(extTrackCol->containedObject(extTrackId))
293 );
294 }
295
296 const std::vector<int>& tofTrackIds = evtRecTrackRoot->
tofTrackIds();
297 for ( unsigned int i = 0; i < tofTrackIds.size(); i++) {
300 }
301
303 if ( emcShowerId >= 0 ) {
305 dynamic_cast<RecEmcShower*
>(emcShowerCol->containedObject(emcShowerId))
306 );
307 }
308
309 int mucTrackId = evtRecTrackRoot->
mucTrackId();
310 if ( mucTrackId >= 0 ) {
312 dynamic_cast<RecMucTrack*
>(mucTrackCol->containedObject(mucTrackId))
313 );
314 }
315
316 evtRecTrackCol->push_back(evtRecTrack);
317 }
318
319 delete m_evtRecTrackCol;
320 m_evtRecTrackCol = 0;
321 return StatusCode::SUCCESS;
322}
ObjectVector< RecEmcShower > RecEmcShowerCol
ObjectVector< RecExtTrack > RecExtTrackCol
ObjectVector< RecMdcDedx > RecMdcDedxCol
ObjectVector< RecMdcKalTrack > RecMdcKalTrackCol
ObjectVector< RecMdcTrack > RecMdcTrackCol
ObjectVector< RecMucTrack > RecMucTrackCol
ObjectVector< RecTofTrack > RecTofTrackCol
void setMucTrack(const RecMucTrack *trk)
void setQuality(const int quality)
void setPartId(const int partId)
void setMdcTrack(const RecMdcTrack *trk)
void setTrackId(const int trkId)
void setMdcKalTrack(const RecMdcKalTrack *trk)
void setMdcDedx(const RecMdcDedx *trk)
void setEmcShower(const RecEmcShower *shower)
void addTofTrack(const SmartRef< RecTofTrack > trk)
void setExtTrack(const RecExtTrack *trk)
Int_t emcShowerId() const
Int_t mdcKalTrackId() const
const std::vector< Int_t > & tofTrackIds() const
static std::map< const TObject *, const EvtRecTrack * > m_rootEvtRecTrackMap