ATLAS Offline Software
Mode3dFromFsmw1dFinder.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 //Author: Lianyou Shan <lianyou.shan@cern.ch>
5 //#define Mode3dFromFsmw1d_DEBUG
6 
10 #include <cmath>
11 
12 namespace Trk
13 {
14 
15 
16 Mode3dFromFsmw1dFinder::Mode3dFromFsmw1dFinder(const std::string& t, const std::string& n, const IInterface* p) :
17  base_class(t,n,p),
18  m_minModeDistPhi(2),
19  m_minModeDistR(2),
20  m_minModeDistZ(2),
21  m_minXYdist2Z( 0.03 ),
22  m_fraction(0.5),
23  m_minXYbeam( 1.5 ),
24  m_broaden(true)
25 {
26  declareProperty("Fraction", m_fraction );
27  declareProperty("MinimalModeDistancePhi", m_minModeDistPhi ) ;
28  declareProperty("MinimalModeDistanceRadius", m_minModeDistR ) ;
29  declareProperty("MinimalModeDistanceZ", m_minModeDistZ ) ;
30  declareProperty("MinimalDistanceFromZtoXY", m_minXYdist2Z ) ;
31  declareProperty("MinimalRadiusFromBeam", m_minXYbeam ) ;
32  declareProperty("UseBroadenModes", m_broaden );
33 }
34 
35 // DimensionsCorrelations :
36 // 0 : single one from phi OR radius mode
37 // 1 : phi mode with random Radius mode
38 // 2 : phi mode with coincided radius mode => could terminate with (0,0,0)
39 // 3 : 1 + random Z mode
40 // 4 :
41 // 5 :
42 // 6 : phi mode with coincided radius mode then coincide with Z mode
43 
44 
47  const double vy,
48  const std::vector<Trk::PositionAndWeight> & VectorOfPoints) const
49 {
51  return getMode (info, vx, vy, VectorOfPoints);
52 }
53 
54 
57  const double vy,
58  const std::vector<Trk::PositionAndWeight> & VectorOfPoints,
59  std::unique_ptr<IMode3dInfo>& info) const
60 
61 {
62  auto myinfo_p = std::make_unique<Mode3dFromFsmw1dInfo>();
63  Mode3dFromFsmw1dInfo& myinfo = *myinfo_p;
64  info = std::move (myinfo_p);
65  return getMode (myinfo, vx, vy, VectorOfPoints);
66 }
67 
68 
69 //obtain the 3d-mode (position) from a list of positions (distribution in space) - NO WEIGHTS
71 Mode3dFromFsmw1dFinder::getMode(const double /*vx*/,
72  const double /*vy*/,
73  const std::vector<Amg::Vector3D> & VectorOfPoints) const
74 {
75  //create a vector of double values from a vector of "Point" objects
76 
77  std::vector<Amg::Vector3D>::const_iterator begin = VectorOfPoints.begin();
78  std::vector<Amg::Vector3D>::const_iterator end = VectorOfPoints.end();
79 
80  std::vector<double> allx;
81  std::vector<double> ally;
82  std::vector<double> allz;
83 
84  for (std::vector<Amg::Vector3D>::const_iterator i = begin; i!=end; ++i) {
85  allx.push_back((*i).x());
86  ally.push_back((*i).y());
87  allz.push_back((*i).z());
88  }
89 
90  // now find the mode separately for the distributions in x, y and z
96  return Amg::Vector3D( 0., 0., 0. ) ;
97 }
98 
99 
102  const double vy,
103  const std::vector<Amg::Vector3D> & VectorOfPoints,
104  std::unique_ptr<IMode3dInfo>& /*info*/) const
105 {
106  return getMode (vx, vy, VectorOfPoints);
107 }
108 
109 
112  const double vx,
113  const double vy,
114  const std::vector<Trk::PositionAndWeight> & VectorOfPoints) const
115 {
116 
117  ATH_MSG_DEBUG(" enter getMode " );
118  //create a vector of double values from a vector of "Point" objects
119 
120  std::vector<Trk::PositionAndWeight>::const_iterator begin = VectorOfPoints.begin();
121  std::vector<Trk::PositionAndWeight>::const_iterator end = VectorOfPoints.end();
122 
123  Amg::Vector3D tmpseed( 0., 0., 0. ) ;
124 
125  if ( VectorOfPoints.empty() ) return tmpseed ;
126  if ( VectorOfPoints.size() == 1 )
127  return Amg::Vector3D( begin->first.x(), begin->first.y(), begin->first.z() ) ;
128 
129 
130  std::vector< Amg::Vector3D > tmpphi;
131  std::vector< Amg::Vector3D > tmpradi;
132  std::vector< Amg::Vector3D > tmpz;
133  // re-organize/combine the value, index and weight of a point
134 
135  int idx = 0 ; // the idx is unique among the three dimensions
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 ) ; // please speed up
143  double r = sqrt( px*px + py*py ) ;
144 
145  // this Vector3D has no physics meaning of xyz position, just borrowing its form in tri-element
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 
153  idx ++ ;
154  }
155 
156  // sort then the indices will be scattered independently
157  std::sort( tmpphi.begin(), tmpphi.end(), Compare1dPosition() ) ;
158  std::sort( tmpradi.begin(), tmpradi.end(), Compare1dPosition() ) ;
159  std::sort( tmpz.begin(), tmpz.end(), Compare1dPosition() ) ;
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 
165  idx = 0 ;
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 
183  idx ++ ;
184  }
185 
186  ATH_MSG_DEBUG( " Refilled and sorted " );
187  // now find the mode separately for the distributions in phi, R and Z
188  // the indices returned by FsmwMode1dFinder
189 
190  bool phibroader = false ;
191  int phisz = doModeSearch( &info.m_idxphi, allphi, m_minModeDistPhi ) ;
192 
193  if ( phisz == 0 )
194  {
195  ATH_MSG_DEBUG(" One more searching for a mode in phi !" );
196  phisz = doModeSearch( &info.m_idxphi, allphi, m_minModeDistPhi + 1 ) ;
197  phibroader = true ;
198  if ( phisz == 0 )
199  {
200  ATH_MSG_WARNING(" Failed to find a mode in phi !" );
201  return tmpseed ;
202  }
203  }
204  ATH_MSG_DEBUG( " " << phisz << " modes found along phi " );
205 
206  bool radiusbroader = false ;
207  int radisz = doModeSearch( &info.m_idxradi, allradi, m_minModeDistR ) ;
208  if ( radisz == 0 )
209  {
210  ATH_MSG_DEBUG(" One more searching for a mode in radius !" );
211  radisz = doModeSearch( &info.m_idxradi, allradi, m_minModeDistR + 1 ) ;
212  radiusbroader = true ;
213  if ( radisz == 0 )
214  {
215  ATH_MSG_WARNING(" Failed to find a mode in radius !" );
216  return tmpseed ;
217  }
218  }
219  ATH_MSG_DEBUG( " " << radisz << " modes found along radius " );
220 
221 
222  int Zsz = doModeSearch( &info.m_idxZ, allz, m_minModeDistZ ) ;
223  if ( Zsz == 0 )
224  {
225  ATH_MSG_DEBUG(" One more searching for a mode in Z !" );
226  Zsz = doModeSearch( &info.m_idxZ, allz, m_minModeDistZ + 1 ) ;
227  if ( Zsz == 0 )
228  {
229  ATH_MSG_WARNING(" Failed to find a mode in Z !" );
230  return tmpseed ;
231  }
232  }
233  ATH_MSG_DEBUG( " " << Zsz << " modes found along Z " );
234 
235  VeVecIndices olphiZ, olradiZ, ol_phi_radi_Z ;
236 
237  double tmpsdX = 0., tmpsdY = 0., tmpsdXY = 0. ;
238 
239  // check the correlation firstly in phi-Radius and return the most broad
240  VeVecIndices olphiradi = CheckCorrelation( info, vectorOfPoints, info.m_idxphi, info.m_idxradi ) ;
241 
242  // some efforts to patch phi-Radius correlation
243  if ( olphiradi.empty() )
244  {
245  if ( phisz > 1 && radisz > 1 )
246  {
247  ATH_MSG_WARNING(" Nothing more than direct distance correlation !" );
248  return getClosestPair(info, vectorOfPoints, vx, vy) ;
249  }
250 
251  ATH_MSG_DEBUG(" One more searching for a mode in phi or/and radius !" );
252 
253  if ( phisz < 2 ) phisz += doModeSearch( &info.m_idxphi, allphi, m_minModeDistPhi ) ;
254  if ( radisz < 2 ) radisz += doModeSearch( &info.m_idxradi, allradi, m_minModeDistR ) ;
255  ATH_MSG_DEBUG( " " << " more modes found : " << phisz <<" "<< radisz );
256  olphiradi = CheckCorrelation( info, vectorOfPoints, info.m_idxphi, info.m_idxradi ) ;
257 
258  if ( olphiradi.empty() )
259  {
260  // shall we clear phi-Radius modes and retry with larger MinimalModeDistance ?
261  if ( phibroader && radiusbroader )
262  {
263  olphiZ = CheckCorrelation( info, vectorOfPoints, info.m_idxphi, info.m_idxZ, 1 ) ;
264  olradiZ = CheckCorrelation( info, vectorOfPoints, info.m_idxradi, info.m_idxZ, 1 ) ;
265 
266  if ( olphiZ.empty() && olradiZ.empty() )
267  tmpseed = Mode2Seed( info, vectorOfPoints, info.m_idxphi, info.m_idxradi, info.m_idxZ ) ;
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  {
274  ol_phi_radi_Z = CheckCorrelation( info, vectorOfPoints, info.m_idxphi, olradiZ, 1 ) ;
275  if ( ol_phi_radi_Z.empty() )
276  {
277  ATH_MSG_WARNING(" strange arrival at NON-correlation !" );
278  tmpseed = Mode2Seed( info, vectorOfPoints, info.m_idxphi, info.m_idxradi, info.m_idxZ ) ;
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 ) ;
285  if (tmpsdXY > m_minXYbeam){
286  return tmpseed ;
287  }
288 
289  return getClosestPair(info, vectorOfPoints, vx, vy);
290 
291  } // end of Z mode preCorrelation search
292 
293 
294  ATH_MSG_DEBUG(" One more searching for WIDER mode in phi or/and radius !" );
295  if ( ! phibroader )
296  {
297  // info.m_idxphi.clear() ;
298  phisz = doModeSearch( &info.m_idxphi, allphi, m_minModeDistPhi + 1 ) ;
299  }
300 
301  if ( ! radiusbroader )
302  {
303  // info.m_idxradi.clear() ;
304  radisz = doModeSearch( &info.m_idxradi, allradi, m_minModeDistR + 1 ) ;
305  }
306 
307  olphiradi = CheckCorrelation( info, vectorOfPoints, info.m_idxphi, info.m_idxradi ) ;
308 
309  if ( olphiradi.empty() )
310  {
311  olphiZ = CheckCorrelation( info, vectorOfPoints, info.m_idxphi, info.m_idxZ, 1 ) ;
312  olradiZ = CheckCorrelation( info, vectorOfPoints, info.m_idxradi, info.m_idxZ, 1 ) ;
313 
314  if ( olphiZ.empty() && olradiZ.empty() )
315  tmpseed = Mode2Seed( info, vectorOfPoints, info.m_idxphi, info.m_idxradi, info.m_idxZ ) ;
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  {
322  ol_phi_radi_Z = CheckCorrelation( info, vectorOfPoints, info.m_idxphi, olradiZ, 1 ) ;
323  if ( ol_phi_radi_Z.empty() )
324  {
325  ATH_MSG_WARNING(" strange arrival at NON-correlation !" );
326  tmpseed = Mode2Seed( info, vectorOfPoints, info.m_idxphi, info.m_idxradi, info.m_idxZ ) ;
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 ) ;
333  if ( tmpsdXY > m_minXYbeam ){
334  return tmpseed ;
335  }
336 
337  return getClosestPair(info, vectorOfPoints, vx, vy);
338  }
339  // end of one more seach for BROADER modes
340  } // end of one more mode seach
341  }
342  ATH_MSG_DEBUG( " " << olphiradi.size() << " modes found with phi-radius correlated " );
343 
344  ol_phi_radi_Z = CheckCorrelation( info, vectorOfPoints, olphiradi, info.m_idxZ, 1 ) ;
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 !" );
350  Zsz += doModeSearch( &info.m_idxZ, allz, m_minModeDistZ ) ;
351  ol_phi_radi_Z = CheckCorrelation( info, vectorOfPoints, olphiradi, info.m_idxZ, 1 ) ;
352 
353  if ( ol_phi_radi_Z.empty() )
354  {
355  Zsz += doModeSearch( &info.m_idxZ, allz, m_minModeDistZ + 1 ) ;
356  ol_phi_radi_Z = CheckCorrelation( info, vectorOfPoints, olphiradi, info.m_idxZ, 1 ) ;
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 ) ;
365  if (tmpsdXY > m_minXYbeam) {
366  return tmpseed;
367  }
368 
369  return getClosestPair(info, vectorOfPoints, vx, vy);
370  // for ( unsigned int xy = 0 ; xy < olphiradi.size() ;
371  // xy ++ )
372  // ol_phi_radi_Z.push_back( olphiradi[xy] ) ;
373  }
374  }
375  }
376  }
377  ATH_MSG_DEBUG( " " << ol_phi_radi_Z.size()
378  << " modes found with phi-radius-Z fully correlated " );
379 
380  // finaly we found the indices with phi-radius-Z correlated
381  // unfortunately it is the broadest rather than the narrowest
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 ) ;
387  if ( tmpsdXY > m_minXYbeam ){
388  return tmpseed ;
389  }
390 
391  return getClosestPair(info, vectorOfPoints, vx, vy);
392 }
393 
394 
396  const std::vector< IndexedWeighted > & position,
397  int expectMax ) const
398 {
399  int got = 0 ;
400 
401  int tot = position.size() ;
402  ATH_MSG_DEBUG(" total IndexedWeighted positions : " << tot );
403 
404  unsigned int M = idxs->size() ;
405  ATH_MSG_DEBUG(" Number of found modes for split : " << M );
406 
407  if ( M > 3 )
408  {
409  ATH_MSG_WARNING(" No necessary to search so many ( > 3 ) modes, skip " );
410  return got ;
411  }
412 
413  std::vector< std::vector< IndexedWeighted > > position_OR ; // overlap removed
414  if ( M >= 1 )
415  {
416 
417  if ( M >= 2 ) std::sort( idxs->begin(), idxs->end(), VecIndicesCompare() ) ;
418  // the overall region is splitted into M+1 intervals
419 
420  for ( unsigned int splt = 0 ; splt < M + 1 ; splt ++ )
421  {
422  // below lines are tooo dirty ...
423  std::vector< IndexedWeighted > tmpor ;
424 
425  std::vector< std::pair< int, int> > idxplt =
426  ( splt == M ? (*idxs)[splt-1] : (*idxs)[splt] ) ;
427 
428  int sz = idxplt.size() - 1 ;
429 
430  std::vector<IndexedWeighted>::const_iterator origin = position.begin() ;
431  std::vector<IndexedWeighted>::const_iterator begin = origin ;
432  std::vector<IndexedWeighted>::const_iterator end = position.end() ;
433  int offset = 0 ;
434  if ( splt == 0 ) // in the smaller/left side of existing modes
435  {
436  offset = idxplt[0].second - 1 ;
437  ATH_MSG_VERBOSE( " offset = " << offset );
438  if ( offset > tot - 2 || offset <= 1 ) continue ;
439  end = origin + offset ;
440  } else if ( splt == M )
441  {
442  offset = idxplt[sz].second + 1 ;
443  ATH_MSG_VERBOSE(" offset = " << offset );
444  if ( offset > tot - 3 || offset < sz ) continue ;
445  begin = origin + offset ;
446  } else
447  {
448  std::vector< std::pair< int, int> > idxprevious = (*idxs)[splt-1] ;
449  offset = idxprevious[sz].second ;
450  ATH_MSG_VERBOSE(" offset begin = " << offset );
451  if ( offset > tot - 3 || offset < sz + 1 ) continue ;
452  begin = origin + offset + 1 ;
453  offset = idxplt[0].second ;
454  if ( offset < 2 || offset >= tot - 2 ) continue ;
455  ATH_MSG_VERBOSE(" offset end = " << offset );
456  end = origin + offset - 1 ;
457  }
458 
459  if ( end < begin + 2 ) continue ;
460 
461  ATH_MSG_DEBUG(" new searching domain is defined in splitted region " << splt );
462  tmpor.insert( tmpor.end(), begin, end ) ;
463 
464  position_OR.push_back( tmpor ) ;
465  }
466  } else
467  position_OR.push_back( position ) ; // zero split
468 
469  for ( unsigned int splt = 0 ; splt < position_OR.size() ; splt ++ )
470  {
471  ATH_MSG_DEBUG(" In split " << splt <<" after overlap removal " );
472  std::vector< IndexedWeighted > spltposi = position_OR[splt] ;
473  int spltgot = 0, lastgot = 0 ;
474  do
475  {
476  std::vector< std::pair< int,int> > idx_tmp = getFsmw1dMode( spltposi, expectMax ) ;
477  if ( !idx_tmp.empty() )
478  {
479  idxs->push_back( idx_tmp ) ;
480  spltgot ++ ;
481  ATH_MSG_DEBUG(" Doing 1dMode Search : " << got );
482  }
483  if ( spltgot == lastgot ) break ; // failed search without mode found
484  lastgot = spltgot ;
485  if ( lastgot > 0 ) break ; // only one mode is expected in each search
486  } while ( spltgot < expectMax ) ;
487  got += lastgot ;
488  }
489 
490  ATH_MSG_DEBUG(" " << got << " One-dimension mode found " );
491 
492  return got ;
493 }
494 
495 
498  const std::vector<Trk::PositionAndWeight>& vectorOfPoints,
499  const VeVecIndices &aa,
500  const VeVecIndices &bb,
501  int zin ) const
502 {
503  VeVecIndices corre ;
504 
505  ATH_MSG_DEBUG(" Enter to check correlations " );
506 
507 // the indices/contents should not repeat within each of aa or bb
508  for ( unsigned int i = 0 ; i < aa.size() ; i++ )
509  {
510  bool hit = false ;
511  std::vector<std::pair< int, int> > ax = aa[i] ;
512 
513  ATH_MSG_DEBUG( " " << i << " 'th mode to be matched " );
514 
515  std::vector<int > axidx ;
516  for ( unsigned int ia = 0 ; ia < ax.size() ; ia ++ )
517  {
518  axidx.push_back( ax[ia].first ) ;
519  ATH_MSG_DEBUG(" mode " << ax[ia].first << " at " << ia );
520  }
521 
522  std::vector< std::pair<int,int> > supp ; // merge crossings in both modes if correlated
523  std::vector< std::pair< int, int> > bx ;
524  for ( unsigned int j = 0 ; j < bb.size() ; j++ )
525  {
526  bx = bb[j] ;
527 
528  ATH_MSG_DEBUG( " " << j << " 'th mode to check : " );
529 
530  bool bhit = false ; // ax probably correlated more than one element from bb
531  for ( unsigned int k = 0 ; k < bx.size() ; k ++ )
532  {
533  std::vector<int>::iterator it = std::find( axidx.begin(), axidx.end(), bx[k].first ) ;
534  ATH_MSG_DEBUG( " " << k << " 'th crossing test : " << bx[k].first );
535  if ( it != axidx.end() )
536  {
537  ATH_MSG_DEBUG(" correlated crossing found : " << bx[k].first );
538  bhit = true ;
539  break ;
540  }
541  }
542 
543  if ( bhit )
544  {
545  // merging ...
546  for ( unsigned int k = 0 ; k < bx.size() ; k ++ )
547  {
548  std::vector<int>::iterator it = std::find( axidx.begin(), axidx.end(), bx[k].first ) ;
549  ATH_MSG_VERBOSE( " " << k << " 'th crossing test : " << bx[k].first );
550  if ( it == axidx.end() )
551  {
552  ATH_MSG_DEBUG(" extra indices supplemented : " << bx[k].first );
553  supp.emplace_back( bx[k].first, bx[k].second ) ;
554  }
555  }
556  hit = true ;
557  }
558  }
559 
560  if ( hit )
561  {
562  supp.insert( supp.end(), ax.begin(), ax.end() ) ;
563  corre.push_back( supp ) ;
564  }
565 
566  }
567 
568 #ifdef Mode3dFromFsmw1d_DEBUG
569  if ( corre.size() == 0 ) return corre ;
570 #else
571  if ( !corre.empty() ) return corre ;
572 #endif
573 
574  ATH_MSG_DEBUG(" Korrelation failed by indices match, now try 3D distance ... " );
575 
576  double mindistcut = 999999999.9 , mindist = 999999999.9 ;
577 
578  for (auto ax : aa)
579  {
580  double Awght = 0. ;
581  double aX = 0., aY = 0., aZ = 0. ;
582  std::vector<int > axidx ;
583  for (auto & ia : ax)
584  {
585  int idxA = ia.first ;
586  axidx.push_back( idxA ) ;
587 
588  std::vector<Trk::PositionAndWeight>::const_iterator Aposi = vectorOfPoints.begin() + idxA ;
589 
590  ATH_MSG_DEBUG(" Mode idx accepted with full phi-radius correlation : " << idxA );
591 
592  double wght = Aposi->second ;
593  aX += Aposi->first.x()*wght ;
594  aY += Aposi->first.y()*wght ;
595  aZ += Aposi->first.z()*wght ;
596  Awght += wght ;
597  }
598 
599  if ( Awght > 0 )
600  {
601  aX /= Awght ;
602  aY /= Awght ;
603  aZ /= Awght ;
604  } else
605  continue ;
606 
607  std::vector< std::pair<int,int> > supp ; // merge crossings in both modes if correlated
608  double bX = 0., bY = 0., bZ = 0., Bwght = 0. ;
609  for (const auto& bx : bb)
610  {
611  for (const auto & ib : bx)
612  {
613  int idxB = ib.first ;
614  std::vector<Trk::PositionAndWeight>::const_iterator Bposi = vectorOfPoints.begin() + idxB ;
615 
616  double wght = Bposi->second ;
617 
618  bX = Bposi->first.x()*wght ;
619  bY = Bposi->first.y()*wght ;
620  bZ = Bposi->first.z()*wght ;
621  Bwght += wght ;
622  }
623  if ( Bwght > 0 )
624  {
625  bX /= Bwght ;
626  bY /= Bwght ;
627  bZ /= Bwght ;
628  } else
629  continue ;
630 
631  bX -= aX ;
632  bY -= aY ;
633  bZ -= aZ ;
634 
635  double dist = ( bX*bX + bY*bY + bZ*bZ )/( Awght + Bwght ) ;
636 
637  if ( dist < mindist )
638  {
639  mindist = dist ;
640  mindistcut = sqrt( dist*( Awght + Bwght ) ) ;
641 
642  ATH_MSG_DEBUG(" Distance between modes for Korrelation : " << mindistcut );
643 
644  if ( mindistcut > ( zin == 0 ? m_minXYdist2Z : 10.*m_minXYdist2Z ) ) continue ;
645 
646 #ifdef Mode3dFromFsmw1d_DEBUG
647  info.setCorre (zin, mindistcut);
648 #endif
649 
650  supp.clear() ;
651  corre.clear() ;
652 
653  for (const auto & m : bx)
654  {
655  std::vector<int>::iterator it = std::find( axidx.begin(), axidx.end(), m.first ) ;
656  if ( it == axidx.end() ) supp.emplace_back( m.first, m.second ) ;
657  }
658  supp.insert( supp.end(), ax.begin(), ax.end() ) ;
659  corre.push_back( supp ) ;
660  }
661  }
662  }
663 
664  return corre ;
665 }
666 
667 
668 std::vector< std::pair< int, int > >
669 Mode3dFromFsmw1dFinder::getFsmw1dMode( std::vector< IndexedWeighted > & posidxwght,
670  int minModeDiff) const
671 {
672  // the 1st is the absolute index from initial crossings
673  // the 2nd is the new index after sorting
674  std::vector< std::pair< int, int > > idx(0) ;
675 
676  //ok now begin to consider a certain number of elements according to the fraction
677  std::vector<IndexedWeighted>::const_iterator origin = posidxwght.begin();
678  std::vector<IndexedWeighted>::const_iterator begin= origin ;
679  std::vector<IndexedWeighted>::const_iterator end=posidxwght.end();
680 
681  double overallweight(0.);
682  std::vector<IndexedWeighted>::const_iterator best_begin=begin;
683  std::vector<IndexedWeighted>::const_iterator best_end=end;
684 
685  double last_value(1e100);
686 
687  bool isthelast=false;
688 
689  if ( posidxwght.size() == 1 )
690  {
691  std::vector<IndexedWeighted>::const_iterator mid = posidxwght.begin();
692  idx.emplace_back( mid->first.second.first, mid->first.second.second ) ;
693  return idx ;
694  }
695 
696  while ( ! isthelast )
697  {
698 
699 // the begin & end are dynamic/updatable during while loop.
700  int step = (int)std::floor( m_fraction * ( end - begin + 1 ) );
701  overallweight=0.;
702  // the total weights between begin and begin+step-1
703  if ( step < minModeDiff ) break ;
704 
705  std::vector<IndexedWeighted>::const_iterator j_end= begin+step-1;
706  for (std::vector<IndexedWeighted>::const_iterator j=begin;j!=j_end;++j)
707  overallweight+=j->second;
708 
709  step -- ; // since ( step - 1 ) will be frequently used in the following
710 
711 // begin => b , end => e , fraction => f , step => s = f*( e - b + 1 )
712 // b b+s-1 e-s+1 e
713 // |.....................|........................|.....................|
714 //
715 
716  std::vector<IndexedWeighted>::const_iterator i_last = begin+step;
717  for (std::vector<IndexedWeighted>::const_iterator i=begin;i!=(end-step);++i, ++i_last)
718  {
719 
720  //calculate the weight the interval should be divided into,
721  // between ( begin+step-1 ) and the end
722  overallweight+= i_last->second;
723 
724  double new_value = ( ( (i+step)->first ).first - ( i->first ).first )/overallweight;
725  ATH_MSG_VERBOSE(" new value found : " << new_value << " with step "
726  << step + 1 <<" at best "<< best_end - best_begin );
727 
728  if ( new_value < last_value )
729  {
730  last_value= new_value ;
731  best_begin=i;
732  best_end=i+step;
733  ATH_MSG_VERBOSE(" iteration take place : " );
734  }
735  overallweight -= i->second;
736  ATH_MSG_VERBOSE(" overallweight in total : " << overallweight );
737 
738  } // end_of_loop_between b and e-s+1
739 
740  //assign the new begin and end...
741  begin=best_begin ;
742  end=best_end ;
743  last_value = 1e100 ;
744 
745  //Now it should have returned the value with smallest (x2-x1)/weight
746 
747  if ( best_end - best_begin <= minModeDiff )
748  {
749  ATH_MSG_DEBUG(" closest = " << best_end - best_begin );
750  isthelast=true;
751  }
752  } // end_of_while
753 
754  if ( isthelast ) // otherwise above while-loop will sink dead
755  {
756 // at least four crossing points will be expected
757  std::vector<IndexedWeighted>::const_iterator mid = posidxwght.begin();
758 
759 // if ( m_broaden && ( best_end - best_begin ) == 1 && best_begin != mid )
760  if ( m_broaden && ( best_end - best_begin ) <= 2 && best_begin != mid )
761  {
762  mid = best_begin - 1 ;
763  idx.emplace_back( mid->first.second.first, mid->first.second.second ) ;
764  ATH_MSG_DEBUG(" found 1d mode " << ( mid->first ).first <<" "
765  << ( mid->first ).second.first <<" "<< mid->first.second.second );
766  }
767 
768 // at least two crossing points will be collected
769  for ( mid = best_begin ; mid != best_end ; ++mid )
770  {
771  // the indexed position
772  idx.emplace_back( mid->first.second.first, mid->first.second.second ) ;
773  ATH_MSG_DEBUG(" found 1d mode " << ( mid->first ).first <<" "
774  << ( mid->first ).second.first <<" "<< mid->first.second.second );
775  }
776 
777 // if ( m_broaden && ( best_end - best_begin ) == 1 )
778  if ( m_broaden && ( best_end - best_begin ) <= 2 )
779  {
780  mid = posidxwght.end();
781  if ( best_end != mid )
782  {
783  mid = best_end ;
784  idx.emplace_back( mid->first.second.first, mid->first.second.second ) ;
785  ATH_MSG_DEBUG(" found 1d mode " << ( mid->first ).first <<" "
786  << ( mid->first ).second.first <<" "<< mid->first.second.second );
787  }
788  }
789  }
790 
791  return idx ;
792 }
793 
794 
797  const std::vector<Trk::PositionAndWeight>& vectorOfPoints,
798  const double vx,
799  const double vy) const
800 {
801  ATH_MSG_DEBUG(" enter getMode " );
802  //create a vector of double values from a vector of "Point" objects
803 
804  unsigned int sizeVP = vectorOfPoints.size() ;
805  if ( sizeVP == 0 ) return Amg::Vector3D( 0, 0, 0 ) ;
806  if ( sizeVP == 1 )
807  return Amg::Vector3D( vectorOfPoints.begin()->first.x(),
808  vectorOfPoints.begin()->first.y(),
809  vectorOfPoints.begin()->first.z() ) ;
810 
811  std::vector<Trk::PositionAndWeight> VP = vectorOfPoints ;
812  std::sort( VP.begin(), VP.end(), CompareWeight() ) ;
813 
814  unsigned int offset = 0 ;
815 
816  std::vector<Trk::PositionAndWeight>::const_iterator pwitr = VP.begin() ;
817 
818  for ( ; pwitr != VP.end() ; ++pwitr, ++offset)
819  {
820  double X = ( pwitr->first ).x() - vx ;
821  double Y = ( pwitr->first ).y() - vy ;
822  double XY = sqrt( X*X + Y*Y ) ;
823 
824  if ( XY > m_minXYbeam ) break ;
825  }
826 
827  if ( offset >= sizeVP ) return Amg::Vector3D( 0, 0, 0 ) ;
828 
829  pwitr = VP.begin() + offset ;
830 
831  for ( unsigned int mpw = 0 ; mpw < vectorOfPoints.size() ; mpw ++ )
832  {
833  Trk::PositionAndWeight tmp = vectorOfPoints[ mpw ] ;
834  if ( ( tmp.first ).x() == ( pwitr->first ).x()
835  && ( tmp.first ).y() == ( pwitr->first ).y()
836  && ( tmp.first ).z() == ( pwitr->first ).z()
837  )
838  {
839  info.pushIndex ( mpw ) ;
840  break ;
841  }
842  }
843 
844  double wght = pwitr->second ;
845  double inv_wght = 1. / wght ;
846  double seedX = ( pwitr->first ).x() ;
847  double seedY = ( pwitr->first ).y() ;
848  double seedZ = ( pwitr->first ).z() ;
849  double wt = 0. ;
850 
851  for (std::vector<PositionAndWeight>::const_iterator i = pwitr + 1 ; i!=VP.end(); ++i )
852  {
853  double sdX = ( i->first ).x() ;
854  double sdY = ( i->first ).y() ;
855  double sdZ = ( i->first ).z() ;
856 
857  sdX -= seedX ;
858  sdY -= seedY ;
859  sdZ -= seedZ ;
860 
861  double dist = sqrt( sdX*sdX + sdY*sdY + sdZ*sdZ ) ;
862 
863  if ( dist < 0.1 )
864  {
865  sdX += seedX ;
866  sdY += seedY ;
867  sdZ += seedZ ;
868  wt = i->second ;
869  seedX = seedX*wght + sdX*wt ;
870  seedY = seedY*wght + sdY*wt ;
871  seedZ = seedZ*wght + sdZ*wt ;
872  wght += wt ;
873  }
874 
875  }
876 
877  if ( wt != 0 )
878  {
879  seedX *= inv_wght ;
880  seedY *= inv_wght ;
881  seedZ *= inv_wght ;
882  }
883 
884  return Amg::Vector3D( seedX, seedY, seedZ);
885 }
886 
887 
890  const std::vector<Trk::PositionAndWeight>& vectorOfPoints,
891  const VeVecIndices & phiradiZol ) const
892 {
893  double seedX = 0., seedY = 0., seedZ = 0. ;
894  double maxWght = -99.9 ;
895  for (const auto& modes : phiradiZol)
896  {
897  double totwght = 0. ;
898  double seedX0 = 0., seedY0 = 0., seedZ0 = 0. ;
899  for (const auto & mode : modes)
900  {
901 
902  int idx = mode.first ;
903  ATH_MSG_DEBUG(" Mode idx accepted with full phi-radius-Z correlation : " << idx );
904 
905  std::vector<Trk::PositionAndWeight>::const_iterator posi = vectorOfPoints.begin() + idx ;
906  double wght = posi->second ;
907  seedX0 += posi->first.x()*wght ;
908  seedY0 += posi->first.y()*wght ;
909  seedZ0 += posi->first.z()*wght ;
910  totwght += wght ;
911  }
912 
913  // one will use the correlated crossings where largest weights reside.
914  if ( totwght > maxWght )
915  {
916  maxWght = totwght ;
917  seedX = seedX0/totwght ;
918  seedY = seedY0/totwght ;
919  seedZ = seedZ0/totwght ;
920 
921  info.pushIndices (modes);
922  }
923  }
924 
925  return Amg::Vector3D( seedX, seedY, seedZ);
926  // check the overlap/consitence among dimensions
927 }
928 
929 
932  const std::vector<Trk::PositionAndWeight>& vectorOfPoints,
933  const VeVecIndices & phiradi,
934  const VeVecIndices & Z ) const
935 {
936  double mindistcut = 999999999.9 , mindist = 999999999.9 ;
937  double seedX = 0., seedY = 0., seedZ = 0. ;
938 
939  for (const auto& xymodes : phiradi)
940  {
941  double xywght = 0. ;
942  double xyX = 0., xyY = 0., xyZ = 0. ;
943  for (const auto & xymode : xymodes)
944  {
945  int idxXY = xymode.first ;
946  std::vector<Trk::PositionAndWeight>::const_iterator posi = vectorOfPoints.begin() + idxXY ;
947 
948  ATH_MSG_DEBUG( " Mode idx accepted with full phi-radius correlation : " << idxXY );
949 
950  double wght = posi->second ;
951  xyX += posi->first.x()*wght ;
952  xyY += posi->first.y()*wght ;
953  xyZ += posi->first.z()*wght ;
954  xywght += wght ;
955  }
956 
957  if ( xywght > 0 )
958  {
959  xyX /= xywght ;
960  xyY /= xywght ;
961  xyZ /= xywght ;
962  } else
963  continue ;
964 
965  double zX = 0., zY = 0., zZ = 0., zwght = 0. ;
966  for (const auto& zmodes : Z)
967  {
968  for (const auto & zmode : zmodes)
969  {
970  int idxZ = zmode.first ;
971  std::vector<Trk::PositionAndWeight>::const_iterator zposi = vectorOfPoints.begin() + idxZ ;
972 
973  double wghtZ = zposi->second ;
974 
975  zX = zposi->first.x()*wghtZ ;
976  zY = zposi->first.y()*wghtZ ;
977  zZ = zposi->first.z()*wghtZ ;
978  zwght += wghtZ ;
979  }
980 
981  if ( zwght > 0 )
982  {
983  zX /= zwght ;
984  zY /= zwght ;
985  zZ /= zwght ;
986  } else
987  continue ;
988 
989  zX -= xyX ;
990  zY -= xyY ;
991  zZ -= xyZ ;
992 
993  double dist = ( zX*zX + zY*zY + zZ*zZ )/( xywght + zwght ) ;
994 
995  if ( dist < mindist )
996  {
997  mindist = dist ;
998  mindistcut = sqrt( dist*( xywght + zwght ) ) ;
999 
1000  if ( mindistcut > 10.*m_minXYdist2Z ) continue ;
1001 
1002  double totwght = xywght + zwght ;
1003  zX += xyX ;
1004  zY += xyY ;
1005  zZ += xyZ ;
1006  seedX = ( xyX*xywght + zX*zwght )/totwght ;
1007  seedY = ( xyY*xywght + zY*zwght )/totwght ;
1008  seedZ = ( xyZ*xywght + zZ*zwght )/totwght ;
1009 
1010  info.pushIndices (xymodes);
1011  info.pushIndices (zmodes);
1012  }
1013  }
1014  }
1015 
1016  return Amg::Vector3D( seedX, seedY, seedZ ) ;
1017 }
1018 
1019 
1022  const std::vector<Trk::PositionAndWeight>& vectorOfPoints,
1023  const VeVecIndices & phi,
1024  const VeVecIndices & radi,
1025  const VeVecIndices & Z ) const
1026 {
1027  double mindistcut = 999999999.9 , mindist = 999999999.9 ;
1028  double seedX = 0., seedY = 0., seedZ = 0. ;
1029 
1030  for (const auto& pmodes : phi)
1031  {
1032  double pwght = 0. ;
1033  double pX = 0., pY = 0., pZ = 0. ;
1034 
1035  for (const auto & pmode : pmodes)
1036  {
1037  int idxp = pmode.first ;
1038  std::vector<Trk::PositionAndWeight>::const_iterator pposi = vectorOfPoints.begin() + idxp ;
1039  double xw = pposi->second ;
1040  pX += pposi->first.x()*xw ;
1041  pY += pposi->first.y()*xw ;
1042  pZ += pposi->first.z()*xw ;
1043  pwght += xw ;
1044  }
1045 
1046  if ( pwght > 0 )
1047  {
1048  pX /= pwght ;
1049  pY /= pwght ;
1050  pZ /= pwght ;
1051  } else
1052  continue ;
1053 
1054  for (const auto& rmodes : radi)
1055  {
1056  double rwght = 0. ;
1057  double rX = 0., rY = 0., rZ = 0. ;
1058 
1059  for (const auto & rmode : rmodes)
1060  {
1061  int idxr = rmode.first ;
1062  std::vector<Trk::PositionAndWeight>::const_iterator rposi = vectorOfPoints.begin() + idxr ;
1063  double xw = rposi->second ;
1064  rX += rposi->first.x()*xw ;
1065  rY += rposi->first.y()*xw ;
1066  rZ += rposi->first.z()*xw ;
1067  rwght += xw ;
1068  }
1069 
1070  if ( rwght > 0 )
1071  {
1072  rX /= rwght ;
1073  rY /= rwght ;
1074  rZ /= rwght ;
1075  } else
1076  continue ;
1077 
1078  double Dxy = ( ( pX - rX )*( pX - rX ) + ( pY - rY )*( pY - rY )
1079  + ( pZ - rZ )*( pZ - rZ ) )/( pwght + rwght ) ;
1080 
1081  for (const auto& zmodes : Z)
1082  {
1083  double zwght = 0. ;
1084  double zX = 0., zY = 0., zZ = 0. ;
1085 
1086  for (const auto & zmode : zmodes)
1087  {
1088  int idxz = zmode.first ;
1089  std::vector<Trk::PositionAndWeight>::const_iterator zposi = vectorOfPoints.begin() + idxz ;
1090  double xw = zposi->second ;
1091  zX += zposi->first.x()*xw ;
1092  zY += zposi->first.y()*xw ;
1093  zZ += zposi->first.z()*xw ;
1094  zwght += xw ;
1095  }
1096 
1097  if ( zwght > 0 )
1098  {
1099  zX /= zwght ;
1100  zY /= zwght ;
1101  zZ /= zwght ;
1102  } else
1103  continue ;
1104 
1105  double distpz = ( pX - zX )*( pX - zX ) + ( pY - zY )*( pY - zY )
1106  + ( pZ - zZ )*( pZ - zZ ) ;
1107  double distrz = ( rX - zX )*( rX - zX ) + ( rY - zY )*( rY - zY )
1108  + ( rZ - zZ )*( rZ - zZ ) ;
1109  double dist = distpz/( pwght + zwght ) + distrz/( rwght + zwght ) + Dxy ;
1110 
1111 
1112  if ( dist < mindist )
1113  {
1114  mindist = dist ;
1115 
1116  mindistcut = 0.3333*( sqrt( distpz ) + sqrt( distrz ) + sqrt( Dxy*( pwght + rwght ) ) ) ;
1117 
1118  if ( mindistcut > 10.*m_minXYdist2Z ) continue ;
1119 
1120  double totwght = pwght + rwght + zwght ;
1121  seedX = ( pX*pwght + rX*rwght + zX*zwght )/totwght ;
1122  seedY = ( pY*pwght + rY*rwght + zY*zwght )/totwght ;
1123  seedX = ( pZ*pwght + rZ*rwght + zZ*zwght )/totwght ;
1124 
1125  info.pushIndices (pmodes);
1126  info.pushIndices (rmodes);
1127  info.pushIndices (zmodes);
1128  }
1129  }
1130  }
1131  }
1132 
1133  return Amg::Vector3D( seedX, seedY, seedZ ) ;
1134 }
1135 
1136 
1137 
1138 unsigned int
1140  ( std::vector<float> & phi,
1141  std::vector<float> & radi,
1142  std::vector<float> & z,
1143  std::vector<float> & wght ) const
1144 {
1145  std::vector<int> allidx ;
1146 
1147  for (const VecIndices& tmp : m_idxphi) {
1148  for (const std::pair<int, int >& p : tmp) {
1149  allidx.push_back( p.first ) ;
1150  }
1151  }
1152 
1153  for (const VecIndices& tmp : m_idxradi) {
1154  for (const std::pair<int, int >& p : tmp) {
1155  if (std::find( allidx.begin(), allidx.end(), p.first ) == allidx.end()) {
1156  allidx.push_back( p.first ) ;
1157  }
1158  }
1159  }
1160 
1161  for (const VecIndices& tmp : m_idxZ) {
1162  for (const std::pair<int, int >& p : tmp) {
1163  if (std::find( allidx.begin(), allidx.end(), p.first ) == allidx.end()) {
1164  allidx.push_back( p.first ) ;
1165  }
1166  }
1167  }
1168 
1169  unsigned int min = allidx.size() ;
1170  phi.reserve (min);
1171  radi.reserve (min);
1172  z.reserve (min);
1173  wght.reserve (min);
1174 
1175  for (int idx : allidx) {
1176  phi.push_back( m_phi_stk[idx] ) ;
1177  radi.push_back( m_radi_stk[idx] ) ;
1178  z.push_back( m_z_stk[idx] ) ;
1179  wght.push_back( m_wght_stk[idx] ) ;
1180  }
1181 
1182  return min ;
1183 }
1184 
1185 
1186 const std::vector<int>&
1188 {
1189  return m_UsedCrossingPointsIndices;
1190 }
1191 
1192 
1193 void
1195  ( double &cXY, double &cZ ) const
1196 {
1197  cXY = m_correXY;
1198  cZ = m_correZ;
1199 }
1200 
1201 
1202 int
1204  (std::vector<const Trk::TrackParameters*>& perigees ,
1205  const std::vector<const Trk::TrackParameters*> & perigeeList) const
1206 {
1207  perigees.clear() ;
1208  std::vector<int> trklist(0) ;
1209 
1210  for (int ndx : m_UsedCrossingPointsIndices) {
1211  std::pair<int,int> trk = m_trkidx.at( ndx ) ;
1212 
1213  if ( std::find( trklist.begin(), trklist.end(), trk.first ) == trklist.end() )
1214  trklist.push_back( trk.first ) ;
1215  if ( std::find( trklist.begin(), trklist.end(), trk.second ) == trklist.end() )
1216  trklist.push_back( trk.second ) ;
1217  }
1218 
1219  std::sort( trklist.begin(), trklist.end() ) ;
1220 
1221  for (int t : trklist)
1222  {
1223  perigees.push_back( perigeeList[t] ) ;
1224  }
1225 
1226  return perigees.size() ;
1227 }
1228 
1229 
1230 void
1232 {
1233  m_UsedCrossingPointsIndices.push_back( idx ) ;
1234 }
1235 
1236 
1237 void
1239  (std::vector< std::pair <int, int> >&& trkidx)
1240 {
1241  m_trkidx = std::move (trkidx);
1242 }
1243 
1244 
1245 void
1247  (const std::vector< std::pair<int,int> >& modes)
1248 {
1249  for (const std::pair<int,int>& p : modes) {
1250  m_UsedCrossingPointsIndices.push_back( p.first ) ;
1251  }
1252 }
1253 
1254 
1255 void
1257  (float phi, float r, float z, float w)
1258 {
1259  m_phi_stk.push_back (phi);
1260  m_radi_stk.push_back (r);
1261  m_z_stk.push_back (z);
1262  m_wght_stk.push_back (w);
1263 }
1264 
1265 
1266 void
1268 {
1269  if ( zin == 0 )
1270  m_correXY = corre;
1271  else
1272  m_correZ = corre;
1273 }
1274 
1275 
1276 } // namespace Trk
1277 
grepfile.info
info
Definition: grepfile.py:38
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
Trk::Mode3dFromFsmw1dFinder::Mode3dFromFsmw1dInfo::AcceptedCrossingPointsIndices
virtual const std::vector< int > & AcceptedCrossingPointsIndices() const override
Definition: Mode3dFromFsmw1dFinder.cxx:1187
Trk::Mode3dFromFsmw1dFinder::Mode3dFromFsmw1dInfo::perigeesAtSeed
virtual int perigeesAtSeed(std::vector< const Trk::TrackParameters * > &perigees, const std::vector< const Trk::TrackParameters * > &perigeeList) const override final
Definition: Mode3dFromFsmw1dFinder.cxx:1204
Trk::y
@ y
Definition: ParamDefs.h:62
beamspotman.r
def r
Definition: beamspotman.py:676
python.SystemOfUnits.second
int second
Definition: SystemOfUnits.py:120
Trk::py
@ py
Definition: ParamDefs.h:66
Trk::Mode3dFromFsmw1dFinder::Mode3dFromFsmw1dInfo::m_idxphi
VeVecIndices m_idxphi
Definition: Mode3dFromFsmw1dFinder.h:219
Trk::Mode3dFromFsmw1dFinder::m_minXYdist2Z
double m_minXYdist2Z
Definition: Mode3dFromFsmw1dFinder.h:182
Trk::Mode3dFromFsmw1dFinder::Mode3dFromFsmw1dInfo::m_z_stk
std::vector< float > m_z_stk
Definition: Mode3dFromFsmw1dFinder.h:232
fitman.sz
sz
Definition: fitman.py:527
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
TrackParameters.h
Trk::z
@ z
global position (cartesian)
Definition: ParamDefs.h:63
fitman.ax
ax
Definition: fitman.py:522
Trk::Mode3dFromFsmw1dFinder::m_minXYbeam
double m_minXYbeam
Definition: Mode3dFromFsmw1dFinder.h:185
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
Trk::Mode3dFromFsmw1dFinder::doModeSearch
int doModeSearch(VeVecIndices *idxs, const std::vector< IndexedWeighted > &position, int expectMax) const
Definition: Mode3dFromFsmw1dFinder.cxx:395
Trk::Mode3dFromFsmw1dFinder::Mode3dFromFsmw1dInfo::pushPoint
void pushPoint(float phi, float r, float z, float w)
Definition: Mode3dFromFsmw1dFinder.cxx:1257
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
skel.it
it
Definition: skel.GENtoEVGEN.py:423
Trk::Mode3dFromFsmw1dFinder::VecIndicesCompare
Definition: Mode3dFromFsmw1dFinder.h:134
PlotCalibFromCool.ib
ib
Definition: PlotCalibFromCool.py:419
Trk::Mode3dFromFsmw1dFinder::getMode
virtual Amg::Vector3D getMode(const double vx, const double vy, const std::vector< Trk::PositionAndWeight > &points) const override final
Obtain the 3d-mode (position) from a list of positions (distribution in space)
Definition: Mode3dFromFsmw1dFinder.cxx:46
Trk::Mode3dFromFsmw1dFinder::m_minModeDistZ
int m_minModeDistZ
Definition: Mode3dFromFsmw1dFinder.h:181
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
Trk::Mode3dFromFsmw1dFinder::Mode3dFromFsmw1dInfo
Definition: Mode3dFromFsmw1dFinder.h:189
Trk::Mode3dFromFsmw1dFinder::Mode2Seed
Amg::Vector3D Mode2Seed(Mode3dFromFsmw1dInfo &info, const std::vector< Trk::PositionAndWeight > &vectorOfPoints, const VeVecIndices &) const
Definition: Mode3dFromFsmw1dFinder.cxx:889
Trk::Mode3dFromFsmw1dFinder::Mode3dFromFsmw1dInfo::Modes1d
virtual unsigned int Modes1d(std::vector< float > &, std::vector< float > &, std::vector< float > &, std::vector< float > &) const override final
Definition: Mode3dFromFsmw1dFinder.cxx:1140
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
Trk::Mode3dFromFsmw1dFinder::Mode3dFromFsmw1dInfo::pushIndex
void pushIndex(int idx)
Definition: Mode3dFromFsmw1dFinder.cxx:1231
Monitored::X
@ X
Definition: HistogramFillerUtils.h:24
Trk::Mode3dFromFsmw1dFinder::Mode3dFromFsmw1dInfo::m_phi_stk
std::vector< float > m_phi_stk
Definition: Mode3dFromFsmw1dFinder.h:230
Trk::Mode3dFromFsmw1dFinder::Mode3dFromFsmw1dInfo::m_idxZ
VeVecIndices m_idxZ
Definition: Mode3dFromFsmw1dFinder.h:221
Trk::PositionAndWeight
std::pair< Amg::Vector3D, double > PositionAndWeight
Definition: SeedFinderParamDefs.h:17
Trk::Mode3dFromFsmw1dFinder::Mode3dFromFsmw1dInfo::getCorrelationDistance
virtual void getCorrelationDistance(double &cXY, double &cZ) const override
Definition: Mode3dFromFsmw1dFinder.cxx:1195
Trk::Mode3dFromFsmw1dFinder::m_broaden
bool m_broaden
Definition: Mode3dFromFsmw1dFinder.h:186
Trk::Mode3dFromFsmw1dFinder::CompareWeight
Definition: Mode3dFromFsmw1dFinder.h:143
Trk::Mode3dFromFsmw1dFinder::Mode3dFromFsmw1dInfo::m_wght_stk
std::vector< float > m_wght_stk
Definition: Mode3dFromFsmw1dFinder.h:233
lumiFormat.i
int i
Definition: lumiFormat.py:92
Trk::Mode3dFromFsmw1dFinder::m_fraction
double m_fraction
Definition: Mode3dFromFsmw1dFinder.h:184
beamspotman.n
n
Definition: beamspotman.py:731
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
fitman.bx
bx
Definition: fitman.py:410
Trk::px
@ px
Definition: ParamDefs.h:65
Trk::Mode3dFromFsmw1dFinder::m_minModeDistPhi
int m_minModeDistPhi
Definition: Mode3dFromFsmw1dFinder.h:179
Preparation.mode
mode
Definition: Preparation.py:95
Trk::Mode3dFromFsmw1dFinder::CheckCorrelation
VeVecIndices CheckCorrelation(Mode3dFromFsmw1dInfo &info, const std::vector< Trk::PositionAndWeight > &vectorOfPoints, const VeVecIndices &, const VeVecIndices &, int zin=0) const
Definition: Mode3dFromFsmw1dFinder.cxx:497
Trk::Mode3dFromFsmw1dFinder::Mode3dFromFsmw1dInfo::m_radi_stk
std::vector< float > m_radi_stk
Definition: Mode3dFromFsmw1dFinder.h:231
VecIndices
std::vector< std::pair< int, int > > VecIndices
Definition: Mode3dFromFsmw1dFinder.h:15
Trk::Mode3dFromFsmw1dFinder::getClosestPair
Amg::Vector3D getClosestPair(Mode3dFromFsmw1dInfo &info, const std::vector< Trk::PositionAndWeight > &vectorOfPoints, const double vx, const double vy) const
Definition: Mode3dFromFsmw1dFinder.cxx:796
DeMoUpdate.tmp
string tmp
Definition: DeMoUpdate.py:1167
LB_AnalMapSplitter.tot
tot
Definition: LB_AnalMapSplitter.py:46
min
#define min(a, b)
Definition: cfImp.cxx:40
Monitored::Y
@ Y
Definition: HistogramFillerUtils.h:24
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
Trk::Mode3dFromFsmw1dFinder::Mode3dFromFsmw1dInfo::pushIndices
void pushIndices(const std::vector< std::pair< int, int >> &modes)
Definition: Mode3dFromFsmw1dFinder.cxx:1247
SeedFinderParamDefs.h
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
Trk::Mode3dFromFsmw1dFinder::Mode3dFromFsmw1dInfo::setCorre
void setCorre(int zin, double corre)
Definition: Mode3dFromFsmw1dFinder.cxx:1267
Mode3dFromFsmw1dFinder.h
Trk::Mode3dFromFsmw1dFinder::Mode3dFromFsmw1dFinder
Mode3dFromFsmw1dFinder(const std::string &t, const std::string &n, const IInterface *p)
Definition: Mode3dFromFsmw1dFinder.cxx:16
Trk::Mode3dFromFsmw1dFinder::m_minModeDistR
int m_minModeDistR
Definition: Mode3dFromFsmw1dFinder.h:180
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
Trk::Mode3dFromFsmw1dFinder::getFsmw1dMode
std::vector< std::pair< int, int > > getFsmw1dMode(std::vector< IndexedWeighted > &, int) const
Definition: Mode3dFromFsmw1dFinder.cxx:669
Trk::Mode3dFromFsmw1dFinder::Compare1dPosition
Definition: Mode3dFromFsmw1dFinder.h:126
DeMoScan.first
bool first
Definition: DeMoScan.py:534
convertTimingResiduals.offset
offset
Definition: convertTimingResiduals.py:71
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
LArCellBinning.step
step
Definition: LArCellBinning.py:158
PowhegPythia8EvtGen_jetjet.supp
dictionary supp
Definition: PowhegPythia8EvtGen_jetjet.py:8
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
Trk::Mode3dFromFsmw1dFinder::Mode3dFromFsmw1dInfo::m_idxradi
VeVecIndices m_idxradi
Definition: Mode3dFromFsmw1dFinder.h:220
Trk::phi
@ phi
Definition: ParamDefs.h:81
VeVecIndices
std::vector< VecIndices > VeVecIndices
Definition: Mode3dFromFsmw1dFinder.h:16
python.IoTestsLib.w
def w
Definition: IoTestsLib.py:200
Trk::x
@ x
Definition: ParamDefs.h:61
Trk::Mode3dFromFsmw1dFinder::Mode3dFromFsmw1dInfo::setTrkidx
virtual void setTrkidx(std::vector< std::pair< int, int > > &&trkidx) override final
Definition: Mode3dFromFsmw1dFinder.cxx:1239
test_AnalysisBaseEventLoopJob.aa
aa
Definition: test_AnalysisBaseEventLoopJob.py:37
fitman.k
k
Definition: fitman.py:528