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
158 if(!cgemTrackCol)
159 {
160 log << MSG::INFO << "Could not find RecCgemTrackCol" << endreq;
161 SmartDataPtr<DstCgemTrackCol> dstCgemTrackCol(dataSvc,"/Event/Dst/DstCgemTrackCol");
162 if (!dstCgemTrackCol) {
163 log << MSG::INFO << "Could not find DstCgemTrackCol" << endreq;
164 }
165 else {
167 DstCgemTrackCol::iterator iter_cgem = dstCgemTrackCol->begin();
168 trackID = 0;
169 for (;iter_cgem != dstCgemTrackCol->end(); iter_cgem++, trackID++) {
171 *recCgemTrack = **iter_cgem;
172 (*cgemTrackCol).push_back(recCgemTrack);
173 log << MSG::INFO
174 << " Cgem Track ID = " << trackID
175 << endreq;
176 }
178 }
179 }
180
181
183 if(!cgemSegmentCol)
184 {
185 log << MSG::INFO << "Could not find RecCgemSegmentCol" << endreq;
186 SmartDataPtr<DstCgemSegmentCol> dstCgemSegmentCol(dataSvc,"/Event/Dst/DstCgemSegmentCol");
187 if (!dstCgemSegmentCol) {
188 log << MSG::INFO << "Could not find DstCgemSegmentCol" << endreq;
189 }
190 else {
192 DstCgemSegmentCol::iterator iter_cgem = dstCgemSegmentCol->begin();
193 trackID = 0;
194 for (;iter_cgem != dstCgemSegmentCol->end(); iter_cgem++, trackID++) {
196 *recCgemSegment = **iter_cgem;
197 (*cgemSegmentCol).push_back(recCgemSegment);
198 log << MSG::INFO
199 << " Cgem Track ID = " << trackID
200 << endreq;
201 }
203 }
204 }
205
206
208 if (!cgemKalTrackCol) {
209 log << MSG::INFO << "Could not find RecCgemKalTrackCol" << endreq;
210 SmartDataPtr<DstCgemKalTrackCol> dstCgemKalTrackCol(dataSvc,"/Event/Dst/DstCgemKalTrackCol");
211 if(!dstCgemKalTrackCol) {
212 log << MSG::INFO << "Could not find DstCgemKalTrackCol" << endreq;
213 }
214 else {
216 DstCgemKalTrackCol::iterator iter_cgem = dstCgemKalTrackCol->begin();
217 trackID = 0;
218 for (;iter_cgem != dstCgemKalTrackCol->end(); iter_cgem++, trackID++) {
220 *recCgemKalTrack = **iter_cgem;
221 (*cgemKalTrackCol).push_back(recCgemKalTrack);
222 log << MSG::INFO
223 << " CgemKalTrack ID = " << trackID
224 <<
" CgemKalTrack poca = " << (*iter_cgem)->
poca()
225 << endreq;
226 }
228 }
229 }
230
231
233 if (!cgemDedxCol) {
234 log <<MSG::INFO << "Could not find RecCgemDedxCol" << endreq;
235 SmartDataPtr<DstCgemDedxCol> dstCgemDedxCol(dataSvc,"/Event/Dst/DstCgemDedxCol");
236 if(!dstCgemDedxCol) {
237 log <<MSG::INFO << "Could not find DstCgemDedxCol" << endreq;
238 }
239 else {
241 DstCgemDedxCol::iterator iter_cgem = dstCgemDedxCol->begin();
242 trackID=0;
243 for (;iter_cgem != dstCgemDedxCol->end(); iter_cgem++, trackID++) {
245 *recCgemDedx= **iter_cgem;
246 (*cgemDedxCol).push_back(recCgemDedx);
247 log << MSG::INFO
248 << " CgemDedx ID = " << trackID
249 << " CgemDedx "
250 << endreq;
251 }
253 }
254 }
255
256
258 if (!extTrackCol) {
259 log <<MSG::INFO << "Could not find RecExtTrackCol" << endreq;
260 SmartDataPtr<DstExtTrackCol> dstExtTrackCol(dataSvc,"/Event/Dst/DstExtTrackCol");
261 if(!dstExtTrackCol) {
262 log <<MSG::INFO << "Could not find DstExtTrackCol" << endreq;
263 }
264 else {
266 DstExtTrackCol::iterator iter_ext = dstExtTrackCol->begin();
267 trackID=0;
268 for (;iter_ext != dstExtTrackCol->end(); iter_ext++, trackID++) {
270 *recExtTrack = **iter_ext;
271 (*extTrackCol).push_back(recExtTrack);
272 log << MSG::INFO
273 << " ExtTrack ID = " << trackID
274 << endreq;
275 }
277 }
278 }
279
280
282 if ( !tofTrackCol ) {
283 log << MSG::INFO << "Could not find TofTrackCol" << endreq;
284 SmartDataPtr<DstTofTrackCol> dstTofTrackCol(dataSvc,"/Event/Dst/DstTofTrackCol");
285 if(!dstTofTrackCol) {
286 log << MSG::INFO << "Could not find DstTofTrackCol" << endreq;
287 }
288 else {
290 DstTofTrackCol::iterator iter_tof = dstTofTrackCol->begin();
291 for (;iter_tof != dstTofTrackCol->end(); iter_tof++) {
293 *recTofTrack = **iter_tof;
294 (*tofTrackCol).push_back(recTofTrack);
295 log << MSG::INFO
296 <<
"Tof Track ID = " << (*iter_tof)->
tofTrackID()
297 << " Track ID = " << (*iter_tof)->trackID()
298 << " Tof Counter ID = "<<(*iter_tof)->tofID()
299 << " Quality = "<< (*iter_tof)->quality()
300 << endreq;
301 }
303 }
304 }
305
306
307
309 if (!emcShowerCol) {
310 log << MSG::INFO << "Could not find RecEmcShowerCol" << endreq;
311 SmartDataPtr<DstEmcShowerCol> dstEmcShowerCol(dataSvc,"/Event/Dst/DstEmcShowerCol");
312 if(!dstEmcShowerCol) {
313 log << MSG::INFO << "Could not find DstEmcShowerCol" << endreq;
314 }
315 else {
317 DstEmcShowerCol::iterator iter_emc = dstEmcShowerCol->begin();
318 trackID=0;
319 for (;iter_emc != dstEmcShowerCol->end(); iter_emc++, trackID++) {
321 *recEmcShower = **iter_emc;
322 (*emcShowerCol).push_back(recEmcShower);
323 log << MSG::INFO
324 << " EmcShower ID = " << trackID
325 <<
" EmcShower energy = " << (*iter_emc)->
energy()
326 << endreq;
327 }
329 }
330 }
331
332
334 if (!mucTrackCol) {
335 log <<MSG::INFO << "Could not find RecMucTrackCol" << endreq;
336 SmartDataPtr<DstMucTrackCol> dstMucTrackCol(dataSvc,"/Event/Dst/DstMucTrackCol");
337 if(!dstMucTrackCol) {
338 log <<MSG::INFO << "Could not find DstMucTrackCol" << endreq;
339 }
340 else {
342 DstMucTrackCol::iterator iter_muc = dstMucTrackCol->begin();
343 trackID=0;
344 for (;iter_muc != dstMucTrackCol->end(); iter_muc++, trackID++) {
346 *recMucTrack = **iter_muc;
347 (*mucTrackCol).push_back(recMucTrack);
348 log << MSG::INFO
349 << " MucTrack ID = "<< trackID
350 <<endreq;
351 }
353 }
354 }
355
356
357 TIter evtRecTrackIter(m_evtRecTrackCol);
359 while ( (evtRecTrackRoot = (
TEvtRecTrack*)evtRecTrackIter.Next() ) ) {
362
366
367 int mdcTrackId = evtRecTrackRoot->
mdcTrackId();
368 if ( mdcTrackId >= 0 ) {
370 dynamic_cast<RecMdcTrack*
>(mdcTrackCol->containedObject(mdcTrackId))
371 );
372 }
373
375 if ( mdcKalTrackId >= 0 ) {
377 dynamic_cast<RecMdcKalTrack*
>(mdcKalTrackCol->containedObject(mdcKalTrackId))
378 );
379 }
380
381 int mdcDedxId = evtRecTrackRoot->
mdcDedxId();
382 if ( mdcDedxId >= 0 ) {
384 dynamic_cast<RecMdcDedx*
>(mdcDedxCol->containedObject(mdcDedxId))
385 );
386 }
387
389 if ( cgemSegmentId >= 0 ) {
391 dynamic_cast<RecCgemSegment*
>(cgemSegmentCol->containedObject(cgemSegmentId))
392 );
393 }
394
396 if ( cgemTrackId >= 0 ) {
398 dynamic_cast<RecCgemTrack*
>(cgemTrackCol->containedObject(cgemTrackId))
399 );
400 }
401
403 if ( cgemKalTrackId >= 0 ) {
405 dynamic_cast<RecCgemKalTrack*
>(cgemKalTrackCol->containedObject(cgemKalTrackId))
406 );
407 }
408
409 int cgemDedxId = evtRecTrackRoot->
cgemDedxId();
410 if ( cgemDedxId >= 0 ) {
412 dynamic_cast<RecCgemDedx*
>(cgemDedxCol->containedObject(cgemDedxId))
413 );
414 }
415
416 int extTrackId = evtRecTrackRoot->
extTrackId();
417 if ( extTrackId >= 0 ) {
419 dynamic_cast<RecExtTrack*
>(extTrackCol->containedObject(extTrackId))
420 );
421 }
422
423 const std::vector<int>& tofTrackIds = evtRecTrackRoot->
tofTrackIds();
424 for ( unsigned int i = 0; i < tofTrackIds.size(); i++) {
427 }
428
430 if ( emcShowerId >= 0 ) {
432 dynamic_cast<RecEmcShower*
>(emcShowerCol->containedObject(emcShowerId))
433 );
434 }
435
436 int mucTrackId = evtRecTrackRoot->
mucTrackId();
437 if ( mucTrackId >= 0 ) {
439 dynamic_cast<RecMucTrack*
>(mucTrackCol->containedObject(mucTrackId))
440 );
441 }
442
443 evtRecTrackCol->push_back(evtRecTrack);
444 }
445
446 delete m_evtRecTrackCol;
447 m_evtRecTrackCol = 0;
448 return StatusCode::SUCCESS;
449}
ObjectVector< RecCgemDedx > RecCgemDedxCol
ObjectVector< RecCgemKalTrack > RecCgemKalTrackCol
ObjectVector< RecCgemSegment > RecCgemSegmentCol
ObjectVector< RecCgemTrack > RecCgemTrackCol
ObjectVector< RecEmcShower > RecEmcShowerCol
ObjectVector< RecExtTrack > RecExtTrackCol
ObjectVector< RecMdcDedx > RecMdcDedxCol
ObjectVector< RecMdcKalTrack > RecMdcKalTrackCol
ObjectVector< RecMdcTrack > RecMdcTrackCol
ObjectVector< RecMucTrack > RecMucTrackCol
ObjectVector< RecTofTrack > RecTofTrackCol
const HepPoint3D poca() const
void setCgemTrack(const RecCgemTrack *trk)
void setCgemDedx(const RecCgemDedx *trk)
void setMucTrack(const RecMucTrack *trk)
void setQuality(const int quality)
void setPartId(const int partId)
void setMdcTrack(const RecMdcTrack *trk)
void setCgemSegment(const RecCgemSegment *trk)
void setTrackId(const int trkId)
void setMdcKalTrack(const RecMdcKalTrack *trk)
void setCgemKalTrack(const RecCgemKalTrack *trk)
void setMdcDedx(const RecMdcDedx *trk)
void setEmcShower(const RecEmcShower *shower)
void addTofTrack(const SmartRef< RecTofTrack > trk)
void setExtTrack(const RecExtTrack *trk)
Int_t cgemTrackId() const
Int_t cgemSegmentId() const
Int_t emcShowerId() const
Int_t mdcKalTrackId() const
const std::vector< Int_t > & tofTrackIds() const
Int_t cgemKalTrackId() const
static std::map< const TObject *, const EvtRecTrack * > m_rootEvtRecTrackMap