115{
116
118
119
120 std::vector<Trk::PositionAndWeight>::const_iterator
begin = VectorOfPoints.begin();
121 std::vector<Trk::PositionAndWeight>::const_iterator
end = VectorOfPoints.end();
122
124
125 if ( VectorOfPoints.empty() ) return tmpseed ;
126 if ( VectorOfPoints.size() == 1 )
128
129
130 std::vector< Amg::Vector3D > tmpphi;
131 std::vector< Amg::Vector3D > tmpradi;
132 std::vector< Amg::Vector3D > tmpz;
133
134
136 std::vector<Trk::PositionAndWeight> vectorOfPoints ;
137
138 for (std::vector<PositionAndWeight>::const_iterator i = begin;
i!=
end; ++
i) {
139 double wght =
i->second ;
140 double px =
i->first.x() ;
if (
px == 0 )
px += 0.000001 ;
141 double py =
i->first.y() ;
142 double phi = atan2 (
py,
px ) ;
144
145
146 tmpphi.emplace_back(
phi, wght, 1.0*idx ) ;
147 tmpradi.emplace_back(
r, wght, 1.0*idx ) ;
148 tmpz.emplace_back(
i->first.z(), wght, 1.0*idx ) ;
149
150 info.pushPoint (
phi,
r,
i->first.z(), wght);
151 vectorOfPoints.push_back( *i ) ;
152
154 }
155
156
160
161 std::vector< std::pair< std::pair <double, std::pair<int,int> >, double > > allphi;
162 std::vector< std::pair< std::pair <double, std::pair<int,int> >, double > > allradi;
163 std::vector< std::pair< std::pair <double, std::pair<int,int> >, double > > allz;
164
166 for (
unsigned i = 0 ;
i < tmpphi.size() ;
i++ )
167 {
168 std::pair<int,int> xidphi( (
int)( tmpphi[i].
z()), idx ) ;
169 std::pair<int,int> xidradi( (
int)( tmpradi[i].
z() ), idx ) ;
170 std::pair<int,int> xidz( (
int)( tmpz[i].
z() ), idx ) ;
171
172 std::pair <double, std::pair<int,int> >
phi( tmpphi[i].
x(), xidphi ) ;
173 std::pair <double, std::pair<int,int> > radi( tmpradi[i].
x(), xidradi ) ;
174 std::pair <double, std::pair<int,int> > zz( tmpz[i].
x(), xidz ) ;
175
176 std::pair< std::pair <double, std::pair<int,int> >,
double > wghtphi(
phi, tmpphi[i].
y() ) ;
177 allphi.push_back( wghtphi ) ;
178 std::pair< std::pair <double, std::pair<int,int> >,
double > wghtradi( radi, tmpradi[i].
y() ) ;
179 allradi.push_back( wghtradi ) ;
180 std::pair< std::pair <double, std::pair<int,int> >,
double > wghtz( zz, tmpz[i].
y() ) ;
181 allz.push_back( wghtz ) ;
182
184 }
185
187
188
189
190 bool phibroader = false ;
192
193 if ( phisz == 0 )
194 {
197 phibroader = true ;
198 if ( phisz == 0 )
199 {
201 return tmpseed ;
202 }
203 }
205
206 bool radiusbroader = false ;
208 if ( radisz == 0 )
209 {
210 ATH_MSG_DEBUG(
" One more searching for a mode in radius !" );
212 radiusbroader = true ;
213 if ( radisz == 0 )
214 {
216 return tmpseed ;
217 }
218 }
219 ATH_MSG_DEBUG(
" " << radisz <<
" modes found along radius " );
220
221
223 if ( Zsz == 0 )
224 {
227 if ( Zsz == 0 )
228 {
230 return tmpseed ;
231 }
232 }
234
236
237 double tmpsdX = 0., tmpsdY = 0., tmpsdXY = 0. ;
238
239
241
242
243 if ( olphiradi.empty() )
244 {
245 if ( phisz > 1 && radisz > 1 )
246 {
249 }
250
251 ATH_MSG_DEBUG(
" One more searching for a mode in phi or/and radius !" );
252
255 ATH_MSG_DEBUG(
" " <<
" more modes found : " << phisz <<
" "<< radisz );
257
258 if ( olphiradi.empty() )
259 {
260
261 if ( phibroader && radiusbroader )
262 {
265
266 if ( olphiZ.empty() && olradiZ.empty() )
268 else if ( !olphiZ.empty() && olradiZ.empty() )
269 tmpseed =
Mode2Seed( info, vectorOfPoints, olphiZ,
info.m_idxradi ) ;
270 else if ( olphiZ.empty() && !olradiZ.empty() )
271 tmpseed =
Mode2Seed( info, vectorOfPoints, olradiZ,
info.m_idxphi ) ;
272 else
273 {
275 if ( ol_phi_radi_Z.empty() )
276 {
279 }
280 }
281 if ( tmpseed.z() == 0. )
return getClosestPair(info, vectorOfPoints, vx, vy) ;
282 tmpsdX = tmpseed.x() - vx ;
283 tmpsdY = tmpseed.y() - vy ;
284 tmpsdXY = sqrt( tmpsdX*tmpsdX + tmpsdY*tmpsdY ) ;
286 return tmpseed ;
287 }
288
290
291 }
292
293
294 ATH_MSG_DEBUG(
" One more searching for WIDER mode in phi or/and radius !" );
295 if ( ! phibroader )
296 {
297
299 }
300
301 if ( ! radiusbroader )
302 {
303
305 }
306
308
309 if ( olphiradi.empty() )
310 {
313
314 if ( olphiZ.empty() && olradiZ.empty() )
316 else if ( !olphiZ.empty() && olradiZ.empty() )
317 tmpseed =
Mode2Seed( info, vectorOfPoints, olphiZ,
info.m_idxradi ) ;
318 else if ( olphiZ.empty() && !olradiZ.empty() )
319 tmpseed =
Mode2Seed( info, vectorOfPoints, olradiZ,
info.m_idxphi ) ;
320 else
321 {
323 if ( ol_phi_radi_Z.empty() )
324 {
327 }
328 }
329 if ( tmpseed.z() == 0. )
return getClosestPair(info, vectorOfPoints, vx, vy) ;
330 tmpsdX = tmpseed.x() - vx ;
331 tmpsdY = tmpseed.y() - vy ;
332 tmpsdXY = sqrt( tmpsdX*tmpsdX + tmpsdY*tmpsdY ) ;
334 return tmpseed ;
335 }
336
338 }
339
340 }
341 }
342 ATH_MSG_DEBUG(
" " << olphiradi.size() <<
" modes found with phi-radius correlated " );
343
345 if ( ol_phi_radi_Z.empty() )
346 {
347 if ( Zsz < 2 )
348 {
349 ATH_MSG_DEBUG(
" One more searching for a mode in Z after CheckCorrelation !" );
352
353 if ( ol_phi_radi_Z.empty() )
354 {
357
358 if ( ol_phi_radi_Z.empty() )
359 {
360 tmpseed =
Mode2Seed( info, vectorOfPoints, olphiradi,
info.m_idxZ ) ;
361 if ( tmpseed.z() == 0. )
return getClosestPair(info, vectorOfPoints, vx, vy) ;
362 tmpsdX = tmpseed.x() - vx ;
363 tmpsdY = tmpseed.y() - vy ;
364 tmpsdXY = sqrt( tmpsdX*tmpsdX + tmpsdY*tmpsdY ) ;
366 return tmpseed;
367 }
368
370
371
372
373 }
374 }
375 }
376 }
378 << " modes found with phi-radius-Z fully correlated " );
379
380
381
382 tmpseed =
Mode2Seed( info, vectorOfPoints, ol_phi_radi_Z ) ;
383 if ( tmpseed.z() == 0. )
return getClosestPair(info, vectorOfPoints, vx, vy) ;
384 tmpsdX = tmpseed.x() - vx ;
385 tmpsdY = tmpseed.y() - vy ;
386 tmpsdXY = sqrt( tmpsdX*tmpsdX + tmpsdY*tmpsdY ) ;
388 return tmpseed ;
389 }
390
392}
VeVecIndices CheckCorrelation(Mode3dFromFsmw1dInfo &info, const std::vector< Trk::PositionAndWeight > &vectorOfPoints, const VeVecIndices &, const VeVecIndices &, int zin=0) const
int doModeSearch(VeVecIndices *idxs, const std::vector< IndexedWeighted > &position, int expectMax) const
Amg::Vector3D getClosestPair(Mode3dFromFsmw1dInfo &info, const std::vector< Trk::PositionAndWeight > &vectorOfPoints, const double vx, const double vy) const
Amg::Vector3D Mode2Seed(Mode3dFromFsmw1dInfo &info, const std::vector< Trk::PositionAndWeight > &vectorOfPoints, const VeVecIndices &) const