124 {
125 MsgStream log(
msgSvc(),
"RecMdcDedxHitCnv");
126 log << MSG::DEBUG << "RecMdcDedxHitCnv::DataObjectToTObject" << endreq;
127 StatusCode sc=StatusCode::SUCCESS;
128
130 if (!recMdcDedxHitCol) {
131 log << MSG::ERROR << "Could not downcast to RecMdcDedxHitCol" << endreq;
132 return StatusCode::FAILURE;
133 }
134
135 DataObject *evt;
138 log << MSG::ERROR << "Could not get RecEvent in TDS " << endreq;
139 return StatusCode::FAILURE;
140 }
142 if (!devtTds) {
143 log << MSG::ERROR << "RecMdcDedxHitCnv:Could not downcast to TDS RecEvent" << endreq;
144 }
145 IOpaqueAddress *addr;
149 if (!m_recMdcDedxHitCol) return sc;
151
152
153
154 RecMdcHitCol::iterator recMdcHitColbegin, recMdcHitColend;
155 RecMdcKalHelixSegCol::iterator recMdcKalHelixSegColbegin, recMdcKalHelixSegColend;
156
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;
162 return sc;
163 }
164
165
167 if (!recMdcHitCol) {
168 log << MSG::ERROR << "Could not downcast to RecMdcHitCol" << endreq;
169 return StatusCode::FAILURE;
170 }
171 else {
172 recMdcHitColbegin = recMdcHitCol->begin();
173 recMdcHitColend = recMdcHitCol->end();
174 }
175
177 if (!recMdcKalHelixSegCol) {
178 log << MSG::ERROR << "Could not downcast to RecMdcKalHelixSegCol" << endreq;
179 return StatusCode::FAILURE;
180 }
181 else {
182 recMdcKalHelixSegColbegin = recMdcKalHelixSegCol->begin();
183 recMdcKalHelixSegColend = recMdcKalHelixSegCol->end();
184 }
185
186
187
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();
195
196 log << MSG::DEBUG<<"DataObjectToTObject: check Reconstrunction of dE/dx Hit::"<<" trackId: "<<trackId<<" flagLR: "<<flagLR<<" pathlength: "<<pathlength<<" dedx: "<<dedx<<endreq;
198
199 recMdcDedxHitRoot->
setTrkId(trackId);
201 recMdcDedxHitRoot->
setMdcId( mdcId );
203 recMdcDedxHitRoot->
setDedx(dedx);
204
205
206
207
208
209
210
211
212
213
214
215
216
217 if ( (*recMdcDedxHit)->isMdcHitValid() ) {
218 RecMdcHitCol::iterator it = find(recMdcHitColbegin, recMdcHitColend, (*recMdcDedxHit)->getMdcHit());
219 recMdcDedxHitRoot->
setMdcHitId( it - recMdcHitColbegin );
220 }
221 else{
223 }
224
225 if ( (*recMdcDedxHit)->isMdcKalHelixSegValid() ) {
226 RecMdcKalHelixSegCol::iterator it = find(recMdcKalHelixSegColbegin, recMdcKalHelixSegColend, (*recMdcDedxHit)->getMdcKalHelixSeg());
228 }
229 else{
231 }
232
233
235 }
236
237 return StatusCode::SUCCESS;
238}
ObjectVector< RecMdcDedxHit > RecMdcDedxHitCol
static TRecTrackEvent * getWriteObject()
returns object to be written (maintained here for all DIGI-converters)
RecTrackCnv * getRecTrackCnv()
IDataProviderSvc * m_eds
pointer to eventdataservice
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)
Convert the transient object to the requested representation.
void setDedx(double dedx)
void setMdcId(UInt_t mdcid)
void setMdcHitId(const int mdcHitId)
void setMdcKalHelixSegId(const int mdcKalHelixSegId)
void setTrkId(Int_t trkid)
void setPathLength(double pathlength)
const TObjArray * getRecMdcDedxHitCol() const
retrieve the whole TObjArray of Dedx Data
void clearRecMdcDedxHitCol()
clear the whole array
void addRecMdcDedxHit(TRecMdcDedxHit *Track)
Add a Dedx into the TOF Data collection.
_EXTERN_ std::string RecMdcKalHelixSegCol
_EXTERN_ std::string Event
_EXTERN_ std::string RecMdcHitCol