44 MsgStream log(
msgSvc(),
"RecMdcDedxHitCnv");
45 log << MSG::DEBUG <<
"RecMdcDedxHitCnv::TObjectToDataObject" << endreq;
46 StatusCode sc=StatusCode::SUCCESS;
49 refpObject=recMdcDedxHitCol;
52 IDataProviderSvc* dataSvc = 0;
53 sc = serviceLocator()->getService(
"EventDataSvc",
54 IDataProviderSvc::interfaceID(), (IInterface*&)dataSvc);
55 if ( sc.isFailure() ) {
56 log << MSG::FATAL <<
"Could not get EventDataSvc in RecMdcDedxHitCnv" << endreq;
64 log << MSG::INFO <<
"Could not find RecMdcHitCol" << endreq;
69 if (!mdcKalHelixSegCol) {
70 log << MSG::INFO <<
"Could not find RecMdcKalHelixSegCol" << endreq;
76 if (!m_recMdcDedxHitCol)
return sc;
77 TIter dedxIter(m_recMdcDedxHitCol);
80 int trackId = recMdcDedxHitRoot->
trkId();
82 int flagLR = recMdcDedxHitRoot->
flagLR();
84 long int mdcId(recMdcDedxHitRoot->
mdcId());
86 double pathlength = recMdcDedxHitRoot->
pathLength();
88 double dedx = recMdcDedxHitRoot->
getDedx();
91 log << MSG::DEBUG<<
"TObjectToDataObject: check Reconstrunction of dE/dx Hit root::"<<
" trackId: "<<trackId<<
" flagLR: "<<flagLR<<
" pathlength: "<<pathlength<<
" dedx: "<<dedx<<endreq;
101 int mdcHitId = recMdcDedxHitRoot->
mdcHitId();
103 if ( mdcHitId >= 0 ) {
104 recMdcDedxHit->
setMdcHit(
dynamic_cast<RecMdcHit*
>(mdcHitCol->containedObject(mdcHitId)));
108 if ( mdcKalHelixSegId >= 0 ) {
112 recMdcDedxHitCol->push_back(recMdcDedxHit);
117 delete m_recMdcDedxHitCol;
118 m_recMdcDedxHitCol = 0;
120 return StatusCode::SUCCESS;
125 MsgStream log(
msgSvc(),
"RecMdcDedxHitCnv");
126 log << MSG::DEBUG <<
"RecMdcDedxHitCnv::DataObjectToTObject" << endreq;
127 StatusCode sc=StatusCode::SUCCESS;
130 if (!recMdcDedxHitCol) {
131 log << MSG::ERROR <<
"Could not downcast to RecMdcDedxHitCol" << endreq;
132 return StatusCode::FAILURE;
138 log << MSG::ERROR <<
"Could not get RecEvent in TDS " << endreq;
139 return StatusCode::FAILURE;
143 log << MSG::ERROR <<
"RecMdcDedxHitCnv:Could not downcast to TDS RecEvent" << endreq;
145 IOpaqueAddress *addr;
149 if (!m_recMdcDedxHitCol)
return sc;
154 RecMdcHitCol::iterator recMdcHitColbegin, recMdcHitColend;
155 RecMdcKalHelixSegCol::iterator recMdcKalHelixSegColbegin, recMdcKalHelixSegColend;
157 IDataProviderSvc* dataSvc = 0;
158 sc = serviceLocator()->getService(
"EventDataSvc",
159 IDataProviderSvc::interfaceID(), (IInterface*&)dataSvc);
160 if ( sc.isFailure() ) {
161 log << MSG::FATAL <<
"Could not get EventDataSvc in RecMdcDedxHitCnv" << endreq;
168 log << MSG::ERROR <<
"Could not downcast to RecMdcHitCol" << endreq;
169 return StatusCode::FAILURE;
172 recMdcHitColbegin = recMdcHitCol->begin();
173 recMdcHitColend = recMdcHitCol->end();
177 if (!recMdcKalHelixSegCol) {
178 log << MSG::ERROR <<
"Could not downcast to RecMdcKalHelixSegCol" << endreq;
179 return StatusCode::FAILURE;
182 recMdcKalHelixSegColbegin = recMdcKalHelixSegCol->begin();
183 recMdcKalHelixSegColend = recMdcKalHelixSegCol->end();
188 RecMdcDedxHitCol::const_iterator recMdcDedxHit;
189 for (recMdcDedxHit = recMdcDedxHitCol->begin(); recMdcDedxHit != recMdcDedxHitCol->end(); recMdcDedxHit++) {
190 int trackId = (*recMdcDedxHit)->getTrkId();
191 int flagLR = (*recMdcDedxHit)->getFlagLR();
192 UInt_t mdcId =(*recMdcDedxHit)->getMdcId().get_value();
193 double pathlength = (*recMdcDedxHit)->getPathLength();
194 double dedx = (*recMdcDedxHit)->getDedx();
196 log << MSG::DEBUG<<
"DataObjectToTObject: check Reconstrunction of dE/dx Hit::"<<
" trackId: "<<trackId<<
" flagLR: "<<flagLR<<
" pathlength: "<<pathlength<<
" dedx: "<<dedx<<endreq;
199 recMdcDedxHitRoot->
setTrkId(trackId);
201 recMdcDedxHitRoot->
setMdcId( mdcId );
203 recMdcDedxHitRoot->
setDedx(dedx);
217 if ( (*recMdcDedxHit)->isMdcHitValid() ) {
218 RecMdcHitCol::iterator it = find(recMdcHitColbegin, recMdcHitColend, (*recMdcDedxHit)->getMdcHit());
219 recMdcDedxHitRoot->
setMdcHitId( it - recMdcHitColbegin );
225 if ( (*recMdcDedxHit)->isMdcKalHelixSegValid() ) {
226 RecMdcKalHelixSegCol::iterator it = find(recMdcKalHelixSegColbegin, recMdcKalHelixSegColend, (*recMdcDedxHit)->getMdcKalHelixSeg());
237 return StatusCode::SUCCESS;