25 MsgStream log(
msgSvc(),
"EvtRecTrackCnv");
26 log << MSG::DEBUG <<
"EvtRecTrackCnv::TObjectToDataObject" << endreq;
30 refpObject = evtRecTrackCol;
32 if ( ! m_evtRecTrackCol )
return StatusCode::SUCCESS;
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;
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;
91 DstMdcTrackCol::iterator iter_mdc = dstMdcTrackCol->begin();
93 for (;iter_mdc != dstMdcTrackCol->end(); iter_mdc++, trackID++) {
95 *recMdcTrack = **iter_mdc;
96 (*mdcTrackCol).push_back(recMdcTrack);
98 <<
" Mdc Track ID = " << trackID
99 <<
" Mdc Track Nster = " << (*iter_mdc)->
nster()
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;
116 DstMdcKalTrackCol::iterator iter_mdc = dstMdcKalTrackCol->begin();
118 for (;iter_mdc != dstMdcKalTrackCol->end(); iter_mdc++, trackID++) {
120 *recMdcKalTrack = **iter_mdc;
121 (*mdcKalTrackCol).push_back(recMdcKalTrack);
123 <<
" MdcKalTrack ID = " << trackID
124 <<
" MdcKalTrack Nster = " << (*iter_mdc)->
nster()
125 <<
" MdcKalTrack poca = " << (*iter_mdc)->poca()
135 log <<MSG::INFO <<
"Could not find RecMdcDedxCol" << endreq;
136 SmartDataPtr<DstMdcDedxCol> dstMdcDedxCol(dataSvc,
"/Event/Dst/DstMdcDedxCol");
138 log <<MSG::INFO <<
"Could not find DstMdcDedxCol" << endreq;
142 DstMdcDedxCol::iterator iter_mdc = dstMdcDedxCol->begin();
144 for (;iter_mdc != dstMdcDedxCol->end(); iter_mdc++, trackID++) {
146 *recMdcDedx= **iter_mdc;
147 (*mdcDedxCol).push_back(recMdcDedx);
149 <<
" MdcDedx ID = " << trackID
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;
167 DstExtTrackCol::iterator iter_ext = dstExtTrackCol->begin();
169 for (;iter_ext != dstExtTrackCol->end(); iter_ext++, trackID++) {
171 *recExtTrack = **iter_ext;
172 (*extTrackCol).push_back(recExtTrack);
174 <<
" ExtTrack ID = " << trackID
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;
191 DstTofTrackCol::iterator iter_tof = dstTofTrackCol->begin();
192 for (;iter_tof != dstTofTrackCol->end(); iter_tof++) {
194 *recTofTrack = **iter_tof;
195 (*tofTrackCol).push_back(recTofTrack);
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()
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;
218 DstEmcShowerCol::iterator iter_emc = dstEmcShowerCol->begin();
220 for (;iter_emc != dstEmcShowerCol->end(); iter_emc++, trackID++) {
222 *recEmcShower = **iter_emc;
223 (*emcShowerCol).push_back(recEmcShower);
225 <<
" EmcShower ID = " << trackID
226 <<
" EmcShower energy = " << (*iter_emc)->
energy()
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;
243 DstMucTrackCol::iterator iter_muc = dstMucTrackCol->begin();
245 for (;iter_muc != dstMucTrackCol->end(); iter_muc++, trackID++) {
247 *recMucTrack = **iter_muc;
248 (*mucTrackCol).push_back(recMucTrack);
250 <<
" MucTrack ID = "<< trackID
258 TIter evtRecTrackIter(m_evtRecTrackCol);
260 while ( (evtRecTrackRoot = (
TEvtRecTrack*)evtRecTrackIter.Next() ) ) {
268 int mdcTrackId = evtRecTrackRoot->
mdcTrackId();
269 if ( mdcTrackId >= 0 ) {
271 dynamic_cast<RecMdcTrack*
>(mdcTrackCol->containedObject(mdcTrackId))
276 if ( mdcKalTrackId >= 0 ) {
278 dynamic_cast<RecMdcKalTrack*
>(mdcKalTrackCol->containedObject(mdcKalTrackId))
282 int mdcDedxId = evtRecTrackRoot->
mdcDedxId();
283 if ( mdcDedxId >= 0 ) {
285 dynamic_cast<RecMdcDedx*
>(mdcDedxCol->containedObject(mdcDedxId))
289 int extTrackId = evtRecTrackRoot->
extTrackId();
290 if ( extTrackId >= 0 ) {
292 dynamic_cast<RecExtTrack*
>(extTrackCol->containedObject(extTrackId))
296 const std::vector<int>& tofTrackIds = evtRecTrackRoot->
tofTrackIds();
297 for (
unsigned int i = 0; i < tofTrackIds.size(); i++) {
303 if ( emcShowerId >= 0 ) {
305 dynamic_cast<RecEmcShower*
>(emcShowerCol->containedObject(emcShowerId))
309 int mucTrackId = evtRecTrackRoot->
mucTrackId();
310 if ( mucTrackId >= 0 ) {
312 dynamic_cast<RecMucTrack*
>(mucTrackCol->containedObject(mucTrackId))
316 evtRecTrackCol->push_back(evtRecTrack);
319 delete m_evtRecTrackCol;
320 m_evtRecTrackCol = 0;
321 return StatusCode::SUCCESS;
325 MsgStream log(
msgSvc(),
"EvtRecTrackCnv");
326 log << MSG::DEBUG <<
"EvtRecTrackCnv::DataObjectToTObject" << endreq;
329 if ( ! evtRecTrackCol ) {
330 log << MSG::ERROR <<
"Could not downcast to EvtRecTrackCol" << endreq;
331 return StatusCode::FAILURE;
334 DataObject* evt =
NULL;
336 if ( sc.isFailure() ) {
337 log << MSG::ERROR <<
"Could not get EvtRecObject in TDS" << endreq;
338 return StatusCode::FAILURE;
342 log << MSG::ERROR <<
"EvtRecTrackCnv: Could not downcast to TDS EvtRecObject" << endreq;
345 IOpaqueAddress *addr;
350 if ( ! m_evtRecTrackCol )
return StatusCode::SUCCESS;
352 IDataProviderSvc* dataSvc = 0;
353 sc = serviceLocator()->getService(
"EventDataSvc",
354 IDataProviderSvc::interfaceID(), (IInterface*&)dataSvc);
355 if ( sc.isFailure() ) {
356 log << MSG::FATAL <<
"Could not get EventDataSvc in EvtRecTrackCnv" << endreq;
360 RecMdcTrackCol::iterator mdcTrackColbegin, mdcTrackColend;
361 RecMdcKalTrackCol::iterator mdcKalTrackColbegin, mdcKalTrackColend;
362 RecMdcDedxCol::iterator mdcDedxColbegin, mdcDedxColend;
363 RecExtTrackCol::iterator extTrackColbegin, extTrackColend;
364 RecTofTrackCol::iterator tofTrackColbegin, tofTrackColend;
365 RecEmcShowerCol::iterator emcShowerColbegin, emcShowerColend;
366 RecMucTrackCol::iterator mucTrackColbegin, mucTrackColend;
369 if ( ! mdcTrackCol ) {
370 log << MSG::INFO <<
"Could not find RecMdcTrackCol" << endreq;
373 mdcTrackColbegin = mdcTrackCol->begin();
374 mdcTrackColend = mdcTrackCol->end();
378 if ( ! mdcKalTrackCol ) {
379 log << MSG::INFO <<
"Could not find RecMdcKalTrackCol" << endreq;
382 mdcKalTrackColbegin = mdcKalTrackCol->begin();
383 mdcKalTrackColend = mdcKalTrackCol->end();
387 if ( ! mdcDedxCol ) {
388 log << MSG::INFO <<
"Could not find RecMdcDedxCol" << endreq;
391 mdcDedxColbegin = mdcDedxCol->begin();
392 mdcDedxColend = mdcDedxCol->end();
396 if ( ! extTrackCol ) {
397 log << MSG::INFO <<
"Could not find RecExtTrackCol" << endreq;
400 extTrackColbegin = extTrackCol->begin();
401 extTrackColend = extTrackCol->end();
405 if ( ! tofTrackCol ) {
406 log << MSG::INFO <<
"Could not find RecTofTrackCol" << endreq;
409 tofTrackColbegin = tofTrackCol->begin();
410 tofTrackColend = tofTrackCol->end();
414 if ( ! emcShowerCol ) {
415 log << MSG::INFO <<
"Could not find RecEmcShowerCol" << endreq;
418 emcShowerColbegin = emcShowerCol->begin();
419 emcShowerColend = emcShowerCol->end();
423 if ( ! mucTrackCol ) {
424 log << MSG::INFO <<
"Could not find RecMucTrackCol" << endreq;
427 mucTrackColbegin = mucTrackCol->begin();
428 mucTrackColend = mucTrackCol->end();
433 EvtRecTrackCol::const_iterator evtRecTrack = evtRecTrackCol->begin();
435 for ( ; evtRecTrack != evtRecTrackCol->end(); evtRecTrack++) {
444 RecMdcTrackCol::iterator it = find(mdcTrackColbegin, mdcTrackColend, ptr->
mdcTrack());
448 RecMdcKalTrackCol::iterator it = find(mdcKalTrackColbegin, mdcKalTrackColend, ptr->
mdcKalTrack());
452 RecMdcDedxCol::iterator it = find(mdcDedxColbegin, mdcDedxColend, ptr->
mdcDedx());
456 RecExtTrackCol::iterator it = find(extTrackColbegin, extTrackColend, ptr->
extTrack());
460 SmartRefVector<RecTofTrack> tofTrackVec = ptr->
tofTrack();
461 for (
unsigned int i = 0; i < tofTrackVec.size(); i++ ) {
462 RecTofTrackCol::iterator it = find(tofTrackColbegin, tofTrackColend, tofTrackVec[i]);
467 RecEmcShowerCol::iterator it = find(emcShowerColbegin, emcShowerColend, ptr->
emcShower());
471 RecMucTrackCol::iterator it = find(mucTrackColbegin, mucTrackColend, ptr->
mucTrack());
478 return StatusCode::SUCCESS;