140{
141 MsgStream log(
msgSvc(), name());
142
143
144
145 SmartDataPtr<MdcMcHitCol> mdcMcHits(eventSvc(),"/Event/MC/MdcMcHitCol");
146 if( mdcMcHits )
147 {
148 log << MSG::DEBUG << "MdcMcHitsCol retrieved of size "<< mdcMcHits->size() << endreq;
149
150 if (mdcMcHits->size() != 0)
151 m_navigator->getMcMdcMcHitsIdx().clear();
152
153 for(MdcMcHitCol::const_iterator it = mdcMcHits->begin(); it != mdcMcHits->end(); it++)
154 {
155
156 m_navigator->getMcMdcMcHitsIdx().insert( pair<int,int>((*it)->identify().get_value(), (*it)->getTrackIndex()));
157
158
159 }
160 }
161 else
162 {
163 log << MSG::DEBUG << "Unable to retrieve MdcMcHitCol" << endreq;
164 }
165
166
167 SmartDataPtr<RecMdcHitCol> mdcRecHits(eventSvc(),"/Event/Recon/RecMdcHitCol");
168 if( mdcRecHits )
169 {
170 log << MSG::DEBUG << "MdcRecHitCol retrieved of size "<< mdcRecHits->size() << endreq;
171
172 if (mdcRecHits->size() != 0)
173 m_navigator->getMcMdcTracksIdx().clear();
174
175 IndexMap& mchits = m_navigator->getMcMdcMcHitsIdx();
176 for(RecMdcHitCol::iterator it=mdcRecHits->begin(); it!=mdcRecHits->end(); it++)
177 {
178 int mdcId = ((*it)->getMdcId()).get_value();
179
180
181 const pair<IndexMap::const_iterator, IndexMap::const_iterator> range = mchits.equal_range(mdcId);
182 for(IndexMap::const_iterator jt = range.first; jt != range.second; jt++)
183 {
184 m_navigator->getMcMdcTracksIdx().insert( pair<int,int>((*jt).second, (*it)->getTrkId()));
185 }
186 }
187 }
188 else
189 log << MSG::DEBUG << "Unable to retrieve RecMdcHitCol" << endreq;
190
191
192
193
194 SmartDataPtr<RecMdcTrackCol> mdcTracks(eventSvc(),"/Event/Recon/RecMdcTrackCol");
195 if( mdcTracks )
196 {
197 log << MSG::DEBUG << "MdcTrackCol retrieved of size "<< mdcTracks->size() << endreq;
198 for(RecMdcTrackCol::const_iterator it = mdcTracks->begin(); it != mdcTracks->end(); it++)
199 m_navigator->addIdLink( (*it)->trackId(), *it );
200 }
201 else
202 {
203 log << MSG::DEBUG << "Unable to retrieve RecMdcTrackCol" << endreq;
204 }
205
206
207 SmartDataPtr<RecMdcKalTrackCol> mdcKalTracks(eventSvc(),"/Event/Recon/RecMdcKalTrackCol");
208 if( mdcKalTracks )
209 {
210 log << MSG::DEBUG << "MdcKalTrackCol retrieved of size "<< mdcKalTracks->size() << endreq;
211 for(RecMdcKalTrackCol::const_iterator it = mdcKalTracks->begin(); it != mdcKalTracks->end(); it++)
212 m_navigator->addIdLink( (*it)->trackId(), *it );
213 }
214 else
215 {
216 log << MSG::DEBUG << "Unable to retrieve RecMdcTrackCol" << endreq;
217 }
218
219
220 IndexMap::const_iterator i;
221 IndexMap& index = m_navigator->getMcMdcTracksIdx();
222 for(i = index.begin(); i != index.end(); i++)
223 {
224
225 const McParticle* mcParticle = m_navigator->getMcParticle((*i).first);
226
227 if (mcParticle == 0)
228 continue;
229
230 const RecMdcTrack* mdcTrack = m_navigator->getMdcTrack((*i).second);
231
232 if( mdcTrack != 0 )
233 {
234 m_navigator->addLink(mcParticle, mdcTrack);
235 m_navigator->addLink(mdcTrack, mcParticle);
236 }
237
238 const RecMdcKalTrack* mdcKalTrack = m_navigator->getMdcKalTrack((*i).second);
239 if( mdcKalTrack != 0 )
240 {
241 m_navigator->addLink(mcParticle, mdcKalTrack);
242 m_navigator->addLink(mdcKalTrack, mcParticle);
243 }
244 }
245}