ATLAS Offline Software
Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
Trk::Mode3dFromFsmw1dFinder Class Referencefinal

#include <Mode3dFromFsmw1dFinder.h>

Inheritance diagram for Trk::Mode3dFromFsmw1dFinder:
Collaboration diagram for Trk::Mode3dFromFsmw1dFinder:

Classes

struct  Compare1dPosition
 
struct  CompareWeight
 
class  Mode3dFromFsmw1dInfo
 
struct  VecIndicesCompare
 

Public Member Functions

 Mode3dFromFsmw1dFinder (const std::string &t, const std::string &n, const IInterface *p)
 
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) More...
 
virtual Amg::Vector3D getMode (const double vx, const double vy, const std::vector< Trk::PositionAndWeight > &points, std::unique_ptr< IMode3dInfo > &info) const override final
 Obtain the 3d-mode (position) from a list of positions (distribution in space) More...
 
virtual Amg::Vector3D getMode (const double vx, const double vy, const std::vector< Amg::Vector3D > &points) const override final
 Obtain the 3d-mode (position) from a list of positions (distribution in space) More...
 
virtual Amg::Vector3D getMode (const double vx, const double vy, const std::vector< Amg::Vector3D > &points, std::unique_ptr< IMode3dInfo > &info) const override final
 Obtain the 3d-mode (position) from a list of positions (distribution in space) More...
 

Private Member Functions

Amg::Vector3D getMode (Mode3dFromFsmw1dInfo &info, const double vx, const double vy, const std::vector< Trk::PositionAndWeight > &VectorOfPoints) const
 
int doModeSearch (VeVecIndices *idxs, const std::vector< IndexedWeighted > &position, int expectMax) const
 
VeVecIndices CheckCorrelation (Mode3dFromFsmw1dInfo &info, const std::vector< Trk::PositionAndWeight > &vectorOfPoints, const VeVecIndices &, const VeVecIndices &, int zin=0) const
 
std::vector< std::pair< int, int > > getFsmw1dMode (std::vector< IndexedWeighted > &, int) 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
 
Amg::Vector3D Mode2Seed (Mode3dFromFsmw1dInfo &info, const std::vector< Trk::PositionAndWeight > &vectorOfPoints, const VeVecIndices &, const VeVecIndices &) const
 
Amg::Vector3D Mode2Seed (Mode3dFromFsmw1dInfo &info, const std::vector< Trk::PositionAndWeight > &vectorOfPoints, const VeVecIndices &, const VeVecIndices &, const VeVecIndices &) const
 

Private Attributes

int m_minModeDistPhi
 
int m_minModeDistR
 
int m_minModeDistZ
 
double m_minXYdist2Z
 
double m_fraction
 
double m_minXYbeam
 
bool m_broaden
 

Detailed Description

modified from Mode3dFinder by Giaci.nosp@m.nto..nosp@m.Piacq.nosp@m.uadi.nosp@m.o@phy.nosp@m.sik..nosp@m.uni-f.nosp@m.reib.nosp@m.urg.d.nosp@m.e

Algotool which combine three 1dimension mode into one 3dimension mode. In each one dimension, FractionalSampleModeWeighted is tried.

Definition at line 31 of file Mode3dFromFsmw1dFinder.h.

Constructor & Destructor Documentation

◆ Mode3dFromFsmw1dFinder()

Trk::Mode3dFromFsmw1dFinder::Mode3dFromFsmw1dFinder ( const std::string &  t,
const std::string &  n,
const IInterface *  p 
)

Definition at line 16 of file Mode3dFromFsmw1dFinder.cxx.

16  :
17  base_class(t,n,p),
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 }

Member Function Documentation

◆ CheckCorrelation()

VeVecIndices Trk::Mode3dFromFsmw1dFinder::CheckCorrelation ( Mode3dFromFsmw1dInfo info,
const std::vector< Trk::PositionAndWeight > &  vectorOfPoints,
const VeVecIndices ,
const VeVecIndices ,
int  zin = 0 
) const
private

Definition at line 497 of file Mode3dFromFsmw1dFinder.cxx.

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 }

◆ doModeSearch()

int Trk::Mode3dFromFsmw1dFinder::doModeSearch ( VeVecIndices idxs,
const std::vector< IndexedWeighted > &  position,
int  expectMax 
) const
private

Definition at line 395 of file Mode3dFromFsmw1dFinder.cxx.

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 }

◆ getClosestPair()

Amg::Vector3D Trk::Mode3dFromFsmw1dFinder::getClosestPair ( Mode3dFromFsmw1dInfo info,
const std::vector< Trk::PositionAndWeight > &  vectorOfPoints,
const double  vx,
const double  vy 
) const
private

Definition at line 796 of file Mode3dFromFsmw1dFinder.cxx.

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 }

◆ getFsmw1dMode()

std::vector< std::pair< int, int > > Trk::Mode3dFromFsmw1dFinder::getFsmw1dMode ( std::vector< IndexedWeighted > &  posidxwght,
int  minModeDiff 
) const
private

Definition at line 669 of file Mode3dFromFsmw1dFinder.cxx.

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 }

◆ getMode() [1/5]

Amg::Vector3D Trk::Mode3dFromFsmw1dFinder::getMode ( const double  vx,
const double  vy,
const std::vector< Amg::Vector3D > &  points 
) const
finaloverridevirtual

Obtain the 3d-mode (position) from a list of positions (distribution in space)

Parameters
vxPrimary vertex x-coordinate.
vyPrimary vertex y-coordinate.
pointsList of points — unweighted!

return Amg::Vector3D(m_mode1dfinder->getMode(allx), m_mode1dfinder->getMode(ally), m_mode1dfinder->getMode(allz));

Definition at line 71 of file Mode3dFromFsmw1dFinder.cxx.

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 }

◆ getMode() [2/5]

Amg::Vector3D Trk::Mode3dFromFsmw1dFinder::getMode ( const double  vx,
const double  vy,
const std::vector< Amg::Vector3D > &  points,
std::unique_ptr< IMode3dInfo > &  info 
) const
finaloverridevirtual

Obtain the 3d-mode (position) from a list of positions (distribution in space)

Parameters
vxPrimary vertex x-coordinate.
vyPrimary vertex y-coordinate.
pointsList of points — unweighted!
info[out]Optionally returns an object for retrieving additional information. May be left null if additional information is not available.

Definition at line 101 of file Mode3dFromFsmw1dFinder.cxx.

105 {
106  return getMode (vx, vy, VectorOfPoints);
107 }

◆ getMode() [3/5]

Amg::Vector3D Trk::Mode3dFromFsmw1dFinder::getMode ( const double  vx,
const double  vy,
const std::vector< Trk::PositionAndWeight > &  points 
) const
finaloverridevirtual

Obtain the 3d-mode (position) from a list of positions (distribution in space)

Parameters
vxPrimary vertex x-coordinate.
vyPrimary vertex y-coordinate.
pointsList of points with weights.

Definition at line 46 of file Mode3dFromFsmw1dFinder.cxx.

49 {
50  Mode3dFromFsmw1dInfo info;
51  return getMode (info, vx, vy, VectorOfPoints);
52 }

◆ getMode() [4/5]

Amg::Vector3D Trk::Mode3dFromFsmw1dFinder::getMode ( const double  vx,
const double  vy,
const std::vector< Trk::PositionAndWeight > &  points,
std::unique_ptr< IMode3dInfo > &  info 
) const
finaloverridevirtual

Obtain the 3d-mode (position) from a list of positions (distribution in space)

Parameters
vxPrimary vertex x-coordinate.
vyPrimary vertex y-coordinate.
pointsList of points with weights.
info[out]Optionally returns an object for retrieving additional information. May be left null if additional information is not available.

Definition at line 56 of file Mode3dFromFsmw1dFinder.cxx.

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 }

◆ getMode() [5/5]

Amg::Vector3D Trk::Mode3dFromFsmw1dFinder::getMode ( Mode3dFromFsmw1dInfo info,
const double  vx,
const double  vy,
const std::vector< Trk::PositionAndWeight > &  VectorOfPoints 
) const
private

Definition at line 111 of file Mode3dFromFsmw1dFinder.cxx.

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 }

◆ Mode2Seed() [1/3]

Amg::Vector3D Trk::Mode3dFromFsmw1dFinder::Mode2Seed ( Mode3dFromFsmw1dInfo info,
const std::vector< Trk::PositionAndWeight > &  vectorOfPoints,
const VeVecIndices phiradiZol 
) const
private

Definition at line 889 of file Mode3dFromFsmw1dFinder.cxx.

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 }

◆ Mode2Seed() [2/3]

Amg::Vector3D Trk::Mode3dFromFsmw1dFinder::Mode2Seed ( Mode3dFromFsmw1dInfo info,
const std::vector< Trk::PositionAndWeight > &  vectorOfPoints,
const VeVecIndices phiradi,
const VeVecIndices Z 
) const
private

Definition at line 931 of file Mode3dFromFsmw1dFinder.cxx.

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 }

◆ Mode2Seed() [3/3]

Amg::Vector3D Trk::Mode3dFromFsmw1dFinder::Mode2Seed ( Mode3dFromFsmw1dInfo info,
const std::vector< Trk::PositionAndWeight > &  vectorOfPoints,
const VeVecIndices phi,
const VeVecIndices radi,
const VeVecIndices Z 
) const
private

Definition at line 1021 of file Mode3dFromFsmw1dFinder.cxx.

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 }

Member Data Documentation

◆ m_broaden

bool Trk::Mode3dFromFsmw1dFinder::m_broaden
private

Definition at line 186 of file Mode3dFromFsmw1dFinder.h.

◆ m_fraction

double Trk::Mode3dFromFsmw1dFinder::m_fraction
private

Definition at line 184 of file Mode3dFromFsmw1dFinder.h.

◆ m_minModeDistPhi

int Trk::Mode3dFromFsmw1dFinder::m_minModeDistPhi
private

Definition at line 179 of file Mode3dFromFsmw1dFinder.h.

◆ m_minModeDistR

int Trk::Mode3dFromFsmw1dFinder::m_minModeDistR
private

Definition at line 180 of file Mode3dFromFsmw1dFinder.h.

◆ m_minModeDistZ

int Trk::Mode3dFromFsmw1dFinder::m_minModeDistZ
private

Definition at line 181 of file Mode3dFromFsmw1dFinder.h.

◆ m_minXYbeam

double Trk::Mode3dFromFsmw1dFinder::m_minXYbeam
private

Definition at line 185 of file Mode3dFromFsmw1dFinder.h.

◆ m_minXYdist2Z

double Trk::Mode3dFromFsmw1dFinder::m_minXYdist2Z
private

Definition at line 182 of file Mode3dFromFsmw1dFinder.h.


The documentation for this class was generated from the following files:
grepfile.info
info
Definition: grepfile.py:38
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
Trk::y
@ y
Definition: ParamDefs.h:56
beamspotman.r
def r
Definition: beamspotman.py:676
python.SystemOfUnits.second
int second
Definition: SystemOfUnits.py:120
Trk::py
@ py
Definition: ParamDefs.h:60
Trk::Mode3dFromFsmw1dFinder::m_minXYdist2Z
double m_minXYdist2Z
Definition: Mode3dFromFsmw1dFinder.h:182
fitman.sz
sz
Definition: fitman.py:527
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
Trk::z
@ z
global position (cartesian)
Definition: ParamDefs.h:57
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
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
skel.it
it
Definition: skel.GENtoEVGEN.py:396
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::Mode2Seed
Amg::Vector3D Mode2Seed(Mode3dFromFsmw1dInfo &info, const std::vector< Trk::PositionAndWeight > &vectorOfPoints, const VeVecIndices &) const
Definition: Mode3dFromFsmw1dFinder.cxx:889
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
Monitored::X
@ X
Definition: HistogramFillerUtils.h:24
Trk::PositionAndWeight
std::pair< Amg::Vector3D, double > PositionAndWeight
Definition: SeedFinderParamDefs.h:17
Trk::Mode3dFromFsmw1dFinder::m_broaden
bool m_broaden
Definition: Mode3dFromFsmw1dFinder.h:186
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
lumiFormat.i
int i
Definition: lumiFormat.py:85
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:59
Trk::Mode3dFromFsmw1dFinder::m_minModeDistPhi
int m_minModeDistPhi
Definition: Mode3dFromFsmw1dFinder.h:179
Preparation.mode
mode
Definition: Preparation.py:94
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::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
Monitored::Y
@ Y
Definition: HistogramFillerUtils.h:24
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
Trk::Mode3dFromFsmw1dFinder::m_minModeDistR
int m_minModeDistR
Definition: Mode3dFromFsmw1dFinder.h:180
std::sort
void sort(typename std::reverse_iterator< DataModel_detail::iterator< DVL > > beg, typename std::reverse_iterator< DataModel_detail::iterator< DVL > > end, const Compare &comp)
Specialization of sort for DataVector/List.
Definition: DVL_algorithms.h:623
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
DeMoScan.first
bool first
Definition: DeMoScan.py:536
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
Trk::phi
@ phi
Definition: ParamDefs.h:75
VeVecIndices
std::vector< VecIndices > VeVecIndices
Definition: Mode3dFromFsmw1dFinder.h:16
Trk::x
@ x
Definition: ParamDefs.h:55
test_AnalysisBaseEventLoopJob.aa
aa
Definition: test_AnalysisBaseEventLoopJob.py:37
fitman.k
k
Definition: fitman.py:528