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 (const 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 493 of file Mode3dFromFsmw1dFinder.cxx.

498 {
499  VeVecIndices corre ;
500 
501  ATH_MSG_DEBUG(" Enter to check correlations " );
502 
503 // the indices/contents should not repeat within each of aa or bb
504  for ( unsigned int i = 0 ; i < aa.size() ; i++ )
505  {
506  bool hit = false ;
507  std::vector<std::pair< int, int> > ax = aa[i] ;
508 
509  ATH_MSG_DEBUG( " " << i << " 'th mode to be matched " );
510 
511  std::vector<int > axidx ;
512  for ( unsigned int ia = 0 ; ia < ax.size() ; ia ++ )
513  {
514  axidx.push_back( ax[ia].first ) ;
515  ATH_MSG_DEBUG(" mode " << ax[ia].first << " at " << ia );
516  }
517 
518  std::vector< std::pair<int,int> > supp ; // merge crossings in both modes if correlated
519  std::vector< std::pair< int, int> > bx ;
520  for ( unsigned int j = 0 ; j < bb.size() ; j++ )
521  {
522  bx = bb[j] ;
523 
524  ATH_MSG_DEBUG( " " << j << " 'th mode to check : " );
525 
526  bool bhit = false ; // ax probably correlated more than one element from bb
527  for ( unsigned int k = 0 ; k < bx.size() ; k ++ )
528  {
529  std::vector<int>::iterator it = std::find( axidx.begin(), axidx.end(), bx[k].first ) ;
530  ATH_MSG_DEBUG( " " << k << " 'th crossing test : " << bx[k].first );
531  if ( it != axidx.end() )
532  {
533  ATH_MSG_DEBUG(" correlated crossing found : " << bx[k].first );
534  bhit = true ;
535  break ;
536  }
537  }
538 
539  if ( bhit )
540  {
541  // merging ...
542  for ( unsigned int k = 0 ; k < bx.size() ; k ++ )
543  {
544  std::vector<int>::iterator it = std::find( axidx.begin(), axidx.end(), bx[k].first ) ;
545  ATH_MSG_VERBOSE( " " << k << " 'th crossing test : " << bx[k].first );
546  if ( it == axidx.end() )
547  {
548  ATH_MSG_DEBUG(" extra indices supplemented : " << bx[k].first );
549  supp.emplace_back( bx[k].first, bx[k].second ) ;
550  }
551  }
552  hit = true ;
553  }
554  }
555 
556  if ( hit )
557  {
558  supp.insert( supp.end(), ax.begin(), ax.end() ) ;
559  corre.push_back( supp ) ;
560  }
561 
562  }
563 
564 #ifdef Mode3dFromFsmw1d_DEBUG
565  if ( corre.size() == 0 ) return corre ;
566 #else
567  if ( !corre.empty() ) return corre ;
568 #endif
569 
570  ATH_MSG_DEBUG(" Korrelation failed by indices match, now try 3D distance ... " );
571 
572  double mindistcut = 999999999.9 , mindist = 999999999.9 ;
573 
574  for (auto ax : aa)
575  {
576  double Awght = 0. ;
577  double aX = 0., aY = 0., aZ = 0. ;
578  std::vector<int > axidx ;
579  for (auto & ia : ax)
580  {
581  int idxA = ia.first ;
582  axidx.push_back( idxA ) ;
583 
584  std::vector<Trk::PositionAndWeight>::const_iterator Aposi = vectorOfPoints.begin() + idxA ;
585 
586  ATH_MSG_DEBUG(" Mode idx accepted with full phi-radius correlation : " << idxA );
587 
588  double wght = Aposi->second ;
589  aX += Aposi->first.x()*wght ;
590  aY += Aposi->first.y()*wght ;
591  aZ += Aposi->first.z()*wght ;
592  Awght += wght ;
593  }
594 
595  if ( Awght > 0 )
596  {
597  aX /= Awght ;
598  aY /= Awght ;
599  aZ /= Awght ;
600  } else
601  continue ;
602 
603  std::vector< std::pair<int,int> > supp ; // merge crossings in both modes if correlated
604  double bX = 0., bY = 0., bZ = 0., Bwght = 0. ;
605  for (const auto& bx : bb)
606  {
607  for (const auto & ib : bx)
608  {
609  int idxB = ib.first ;
610  std::vector<Trk::PositionAndWeight>::const_iterator Bposi = vectorOfPoints.begin() + idxB ;
611 
612  double wght = Bposi->second ;
613 
614  bX = Bposi->first.x()*wght ;
615  bY = Bposi->first.y()*wght ;
616  bZ = Bposi->first.z()*wght ;
617  Bwght += wght ;
618  }
619  if ( Bwght > 0 )
620  {
621  bX /= Bwght ;
622  bY /= Bwght ;
623  bZ /= Bwght ;
624  } else
625  continue ;
626 
627  bX -= aX ;
628  bY -= aY ;
629  bZ -= aZ ;
630 
631  double dist = ( bX*bX + bY*bY + bZ*bZ )/( Awght + Bwght ) ;
632 
633  if ( dist < mindist )
634  {
635  mindist = dist ;
636  mindistcut = sqrt( dist*( Awght + Bwght ) ) ;
637 
638  ATH_MSG_DEBUG(" Distance between modes for Korrelation : " << mindistcut );
639 
640  if ( mindistcut > ( zin == 0 ? m_minXYdist2Z : 10.*m_minXYdist2Z ) ) continue ;
641 
642 #ifdef Mode3dFromFsmw1d_DEBUG
643  info.setCorre (zin, mindistcut);
644 #endif
645 
646  supp.clear() ;
647  corre.clear() ;
648 
649  for (const auto & m : bx)
650  {
651  std::vector<int>::iterator it = std::find( axidx.begin(), axidx.end(), m.first ) ;
652  if ( it == axidx.end() ) supp.emplace_back( m.first, m.second ) ;
653  }
654  supp.insert( supp.end(), ax.begin(), ax.end() ) ;
655  corre.push_back( supp ) ;
656  }
657  }
658  }
659 
660  return corre ;
661 }

◆ 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  const std::vector< std::pair< int, int> >& idxplt =
424  ( splt == M ? (*idxs)[splt-1] : (*idxs)[splt] ) ;
425 
426  int sz = idxplt.size() - 1 ;
427 
428  std::vector<IndexedWeighted>::const_iterator origin = position.begin() ;
429  std::vector<IndexedWeighted>::const_iterator begin = origin ;
430  std::vector<IndexedWeighted>::const_iterator end = position.end() ;
431  int offset = 0 ;
432  if ( splt == 0 ) // in the smaller/left side of existing modes
433  {
434  offset = idxplt[0].second - 1 ;
435  ATH_MSG_VERBOSE( " offset = " << offset );
436  if ( offset > tot - 2 || offset <= 1 ) continue ;
437  end = origin + offset ;
438  } else if ( splt == M )
439  {
440  offset = idxplt[sz].second + 1 ;
441  ATH_MSG_VERBOSE(" offset = " << offset );
442  if ( offset > tot - 3 || offset < sz ) continue ;
443  begin = origin + offset ;
444  } else
445  {
446  const std::vector< std::pair< int, int> >& idxprevious = (*idxs)[splt-1] ;
447  offset = idxprevious.back().second ;
448  ATH_MSG_VERBOSE(" offset begin = " << offset );
449  if ( offset > tot - 3 || offset < sz + 1 ) continue ;
450  begin = origin + offset + 1 ;
451  offset = idxplt[0].second ;
452  if ( offset < 2 || offset >= tot - 2 ) continue ;
453  ATH_MSG_VERBOSE(" offset end = " << offset );
454  end = origin + offset - 1 ;
455  }
456 
457  if ( end < begin + 2 ) continue ;
458 
459  ATH_MSG_DEBUG(" new searching domain is defined in splitted region " << splt );
460  position_OR.emplace_back( begin, end ) ;
461  }
462  } else
463  position_OR.push_back( position ) ; // zero split
464 
465  for ( unsigned int splt = 0 ; splt < position_OR.size() ; splt ++ )
466  {
467  ATH_MSG_DEBUG(" In split " << splt <<" after overlap removal " );
468  const std::vector< IndexedWeighted >& spltposi = position_OR[splt] ;
469  int spltgot = 0, lastgot = 0 ;
470  do
471  {
472  std::vector< std::pair< int,int> > idx_tmp = getFsmw1dMode( spltposi, expectMax ) ;
473  if ( !idx_tmp.empty() )
474  {
475  idxs->push_back( idx_tmp ) ;
476  spltgot ++ ;
477  ATH_MSG_DEBUG(" Doing 1dMode Search : " << got );
478  }
479  if ( spltgot == lastgot ) break ; // failed search without mode found
480  lastgot = spltgot ;
481  if ( lastgot > 0 ) break ; // only one mode is expected in each search
482  } while ( spltgot < expectMax ) ;
483  got += lastgot ;
484  }
485 
486  ATH_MSG_DEBUG(" " << got << " One-dimension mode found " );
487 
488  return got ;
489 }

◆ 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 792 of file Mode3dFromFsmw1dFinder.cxx.

796 {
797  ATH_MSG_DEBUG(" enter getMode " );
798  //create a vector of double values from a vector of "Point" objects
799 
800  unsigned int sizeVP = vectorOfPoints.size() ;
801  if ( sizeVP == 0 ) return Amg::Vector3D( 0, 0, 0 ) ;
802  if ( sizeVP == 1 )
803  return Amg::Vector3D( vectorOfPoints.begin()->first.x(),
804  vectorOfPoints.begin()->first.y(),
805  vectorOfPoints.begin()->first.z() ) ;
806 
807  std::vector<Trk::PositionAndWeight> VP = vectorOfPoints ;
808  std::sort( VP.begin(), VP.end(), CompareWeight() ) ;
809 
810  unsigned int offset = 0 ;
811 
812  std::vector<Trk::PositionAndWeight>::const_iterator pwitr = VP.begin() ;
813 
814  for ( ; pwitr != VP.end() ; ++pwitr, ++offset)
815  {
816  double X = ( pwitr->first ).x() - vx ;
817  double Y = ( pwitr->first ).y() - vy ;
818  double XY = sqrt( X*X + Y*Y ) ;
819 
820  if ( XY > m_minXYbeam ) break ;
821  }
822 
823  if ( offset >= sizeVP ) return Amg::Vector3D( 0, 0, 0 ) ;
824 
825  pwitr = VP.begin() + offset ;
826 
827  for ( unsigned int mpw = 0 ; mpw < vectorOfPoints.size() ; mpw ++ )
828  {
829  Trk::PositionAndWeight tmp = vectorOfPoints[ mpw ] ;
830  if ( ( tmp.first ).x() == ( pwitr->first ).x()
831  && ( tmp.first ).y() == ( pwitr->first ).y()
832  && ( tmp.first ).z() == ( pwitr->first ).z()
833  )
834  {
835  info.pushIndex ( mpw ) ;
836  break ;
837  }
838  }
839 
840  double wght = pwitr->second ;
841  double inv_wght = 1. / wght ;
842  double seedX = ( pwitr->first ).x() ;
843  double seedY = ( pwitr->first ).y() ;
844  double seedZ = ( pwitr->first ).z() ;
845  double wt = 0. ;
846 
847  for (std::vector<PositionAndWeight>::const_iterator i = pwitr + 1 ; i!=VP.end(); ++i )
848  {
849  double sdX = ( i->first ).x() ;
850  double sdY = ( i->first ).y() ;
851  double sdZ = ( i->first ).z() ;
852 
853  sdX -= seedX ;
854  sdY -= seedY ;
855  sdZ -= seedZ ;
856 
857  double dist = sqrt( sdX*sdX + sdY*sdY + sdZ*sdZ ) ;
858 
859  if ( dist < 0.1 )
860  {
861  sdX += seedX ;
862  sdY += seedY ;
863  sdZ += seedZ ;
864  wt = i->second ;
865  seedX = seedX*wght + sdX*wt ;
866  seedY = seedY*wght + sdY*wt ;
867  seedZ = seedZ*wght + sdZ*wt ;
868  wght += wt ;
869  }
870 
871  }
872 
873  if ( wt != 0 )
874  {
875  seedX *= inv_wght ;
876  seedY *= inv_wght ;
877  seedZ *= inv_wght ;
878  }
879 
880  return Amg::Vector3D( seedX, seedY, seedZ);
881 }

◆ getFsmw1dMode()

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

Definition at line 665 of file Mode3dFromFsmw1dFinder.cxx.

667 {
668  // the 1st is the absolute index from initial crossings
669  // the 2nd is the new index after sorting
670  std::vector< std::pair< int, int > > idx(0) ;
671 
672  //ok now begin to consider a certain number of elements according to the fraction
673  std::vector<IndexedWeighted>::const_iterator origin = posidxwght.begin();
674  std::vector<IndexedWeighted>::const_iterator begin= origin ;
675  std::vector<IndexedWeighted>::const_iterator end=posidxwght.end();
676 
677  double overallweight(0.);
678  std::vector<IndexedWeighted>::const_iterator best_begin=begin;
679  std::vector<IndexedWeighted>::const_iterator best_end=end;
680 
681  double last_value(1e100);
682 
683  bool isthelast=false;
684 
685  if ( posidxwght.size() == 1 )
686  {
687  std::vector<IndexedWeighted>::const_iterator mid = posidxwght.begin();
688  idx.emplace_back( mid->first.second.first, mid->first.second.second ) ;
689  return idx ;
690  }
691 
692  while ( ! isthelast )
693  {
694 
695 // the begin & end are dynamic/updatable during while loop.
696  int step = (int)std::floor( m_fraction * ( end - begin + 1 ) );
697  overallweight=0.;
698  // the total weights between begin and begin+step-1
699  if ( step < minModeDiff ) break ;
700 
701  std::vector<IndexedWeighted>::const_iterator j_end= begin+step-1;
702  for (std::vector<IndexedWeighted>::const_iterator j=begin;j!=j_end;++j)
703  overallweight+=j->second;
704 
705  step -- ; // since ( step - 1 ) will be frequently used in the following
706 
707 // begin => b , end => e , fraction => f , step => s = f*( e - b + 1 )
708 // b b+s-1 e-s+1 e
709 // |.....................|........................|.....................|
710 //
711 
712  std::vector<IndexedWeighted>::const_iterator i_last = begin+step;
713  for (std::vector<IndexedWeighted>::const_iterator i=begin;i!=(end-step);++i, ++i_last)
714  {
715 
716  //calculate the weight the interval should be divided into,
717  // between ( begin+step-1 ) and the end
718  overallweight+= i_last->second;
719 
720  double new_value = ( ( (i+step)->first ).first - ( i->first ).first )/overallweight;
721  ATH_MSG_VERBOSE(" new value found : " << new_value << " with step "
722  << step + 1 <<" at best "<< best_end - best_begin );
723 
724  if ( new_value < last_value )
725  {
726  last_value= new_value ;
727  best_begin=i;
728  best_end=i+step;
729  ATH_MSG_VERBOSE(" iteration take place : " );
730  }
731  overallweight -= i->second;
732  ATH_MSG_VERBOSE(" overallweight in total : " << overallweight );
733 
734  } // end_of_loop_between b and e-s+1
735 
736  //assign the new begin and end...
737  begin=best_begin ;
738  end=best_end ;
739  last_value = 1e100 ;
740 
741  //Now it should have returned the value with smallest (x2-x1)/weight
742 
743  if ( best_end - best_begin <= minModeDiff )
744  {
745  ATH_MSG_DEBUG(" closest = " << best_end - best_begin );
746  isthelast=true;
747  }
748  } // end_of_while
749 
750  if ( isthelast ) // otherwise above while-loop will sink dead
751  {
752 // at least four crossing points will be expected
753  std::vector<IndexedWeighted>::const_iterator mid = posidxwght.begin();
754 
755 // if ( m_broaden && ( best_end - best_begin ) == 1 && best_begin != mid )
756  if ( m_broaden && ( best_end - best_begin ) <= 2 && best_begin != mid )
757  {
758  mid = best_begin - 1 ;
759  idx.emplace_back( mid->first.second.first, mid->first.second.second ) ;
760  ATH_MSG_DEBUG(" found 1d mode " << ( mid->first ).first <<" "
761  << ( mid->first ).second.first <<" "<< mid->first.second.second );
762  }
763 
764 // at least two crossing points will be collected
765  for ( mid = best_begin ; mid != best_end ; ++mid )
766  {
767  // the indexed position
768  idx.emplace_back( mid->first.second.first, mid->first.second.second ) ;
769  ATH_MSG_DEBUG(" found 1d mode " << ( mid->first ).first <<" "
770  << ( mid->first ).second.first <<" "<< mid->first.second.second );
771  }
772 
773 // if ( m_broaden && ( best_end - best_begin ) == 1 )
774  if ( m_broaden && ( best_end - best_begin ) <= 2 )
775  {
776  mid = posidxwght.end();
777  if ( best_end != mid )
778  {
779  mid = best_end ;
780  idx.emplace_back( mid->first.second.first, mid->first.second.second ) ;
781  ATH_MSG_DEBUG(" found 1d mode " << ( mid->first ).first <<" "
782  << ( mid->first ).second.first <<" "<< mid->first.second.second );
783  }
784  }
785  }
786 
787  return idx ;
788 }

◆ 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 885 of file Mode3dFromFsmw1dFinder.cxx.

888 {
889  double seedX = 0., seedY = 0., seedZ = 0. ;
890  double maxWght = -99.9 ;
891  for (const auto& modes : phiradiZol)
892  {
893  double totwght = 0. ;
894  double seedX0 = 0., seedY0 = 0., seedZ0 = 0. ;
895  for (const auto & mode : modes)
896  {
897 
898  int idx = mode.first ;
899  ATH_MSG_DEBUG(" Mode idx accepted with full phi-radius-Z correlation : " << idx );
900 
901  std::vector<Trk::PositionAndWeight>::const_iterator posi = vectorOfPoints.begin() + idx ;
902  double wght = posi->second ;
903  seedX0 += posi->first.x()*wght ;
904  seedY0 += posi->first.y()*wght ;
905  seedZ0 += posi->first.z()*wght ;
906  totwght += wght ;
907  }
908 
909  // one will use the correlated crossings where largest weights reside.
910  if ( totwght > maxWght )
911  {
912  maxWght = totwght ;
913  seedX = seedX0/totwght ;
914  seedY = seedY0/totwght ;
915  seedZ = seedZ0/totwght ;
916 
917  info.pushIndices (modes);
918  }
919  }
920 
921  return Amg::Vector3D( seedX, seedY, seedZ);
922  // check the overlap/consitence among dimensions
923 }

◆ 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 927 of file Mode3dFromFsmw1dFinder.cxx.

931 {
932  double mindistcut = 999999999.9 , mindist = 999999999.9 ;
933  double seedX = 0., seedY = 0., seedZ = 0. ;
934 
935  for (const auto& xymodes : phiradi)
936  {
937  double xywght = 0. ;
938  double xyX = 0., xyY = 0., xyZ = 0. ;
939  for (const auto & xymode : xymodes)
940  {
941  int idxXY = xymode.first ;
942  std::vector<Trk::PositionAndWeight>::const_iterator posi = vectorOfPoints.begin() + idxXY ;
943 
944  ATH_MSG_DEBUG( " Mode idx accepted with full phi-radius correlation : " << idxXY );
945 
946  double wght = posi->second ;
947  xyX += posi->first.x()*wght ;
948  xyY += posi->first.y()*wght ;
949  xyZ += posi->first.z()*wght ;
950  xywght += wght ;
951  }
952 
953  if ( xywght > 0 )
954  {
955  xyX /= xywght ;
956  xyY /= xywght ;
957  xyZ /= xywght ;
958  } else
959  continue ;
960 
961  double zX = 0., zY = 0., zZ = 0., zwght = 0. ;
962  for (const auto& zmodes : Z)
963  {
964  for (const auto & zmode : zmodes)
965  {
966  int idxZ = zmode.first ;
967  std::vector<Trk::PositionAndWeight>::const_iterator zposi = vectorOfPoints.begin() + idxZ ;
968 
969  double wghtZ = zposi->second ;
970 
971  zX = zposi->first.x()*wghtZ ;
972  zY = zposi->first.y()*wghtZ ;
973  zZ = zposi->first.z()*wghtZ ;
974  zwght += wghtZ ;
975  }
976 
977  if ( zwght > 0 )
978  {
979  zX /= zwght ;
980  zY /= zwght ;
981  zZ /= zwght ;
982  } else
983  continue ;
984 
985  zX -= xyX ;
986  zY -= xyY ;
987  zZ -= xyZ ;
988 
989  double dist = ( zX*zX + zY*zY + zZ*zZ )/( xywght + zwght ) ;
990 
991  if ( dist < mindist )
992  {
993  mindist = dist ;
994  mindistcut = sqrt( dist*( xywght + zwght ) ) ;
995 
996  if ( mindistcut > 10.*m_minXYdist2Z ) continue ;
997 
998  double totwght = xywght + zwght ;
999  zX += xyX ;
1000  zY += xyY ;
1001  zZ += xyZ ;
1002  seedX = ( xyX*xywght + zX*zwght )/totwght ;
1003  seedY = ( xyY*xywght + zY*zwght )/totwght ;
1004  seedZ = ( xyZ*xywght + zZ*zwght )/totwght ;
1005 
1006  info.pushIndices (xymodes);
1007  info.pushIndices (zmodes);
1008  }
1009  }
1010  }
1011 
1012  return Amg::Vector3D( seedX, seedY, seedZ ) ;
1013 }

◆ 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 1017 of file Mode3dFromFsmw1dFinder.cxx.

1022 {
1023  double mindistcut = 999999999.9 , mindist = 999999999.9 ;
1024  double seedX = 0., seedY = 0., seedZ = 0. ;
1025 
1026  for (const auto& pmodes : phi)
1027  {
1028  double pwght = 0. ;
1029  double pX = 0., pY = 0., pZ = 0. ;
1030 
1031  for (const auto & pmode : pmodes)
1032  {
1033  int idxp = pmode.first ;
1034  std::vector<Trk::PositionAndWeight>::const_iterator pposi = vectorOfPoints.begin() + idxp ;
1035  double xw = pposi->second ;
1036  pX += pposi->first.x()*xw ;
1037  pY += pposi->first.y()*xw ;
1038  pZ += pposi->first.z()*xw ;
1039  pwght += xw ;
1040  }
1041 
1042  if ( pwght > 0 )
1043  {
1044  pX /= pwght ;
1045  pY /= pwght ;
1046  pZ /= pwght ;
1047  } else
1048  continue ;
1049 
1050  for (const auto& rmodes : radi)
1051  {
1052  double rwght = 0. ;
1053  double rX = 0., rY = 0., rZ = 0. ;
1054 
1055  for (const auto & rmode : rmodes)
1056  {
1057  int idxr = rmode.first ;
1058  std::vector<Trk::PositionAndWeight>::const_iterator rposi = vectorOfPoints.begin() + idxr ;
1059  double xw = rposi->second ;
1060  rX += rposi->first.x()*xw ;
1061  rY += rposi->first.y()*xw ;
1062  rZ += rposi->first.z()*xw ;
1063  rwght += xw ;
1064  }
1065 
1066  if ( rwght > 0 )
1067  {
1068  rX /= rwght ;
1069  rY /= rwght ;
1070  rZ /= rwght ;
1071  } else
1072  continue ;
1073 
1074  double Dxy = ( ( pX - rX )*( pX - rX ) + ( pY - rY )*( pY - rY )
1075  + ( pZ - rZ )*( pZ - rZ ) )/( pwght + rwght ) ;
1076 
1077  for (const auto& zmodes : Z)
1078  {
1079  double zwght = 0. ;
1080  double zX = 0., zY = 0., zZ = 0. ;
1081 
1082  for (const auto & zmode : zmodes)
1083  {
1084  int idxz = zmode.first ;
1085  std::vector<Trk::PositionAndWeight>::const_iterator zposi = vectorOfPoints.begin() + idxz ;
1086  double xw = zposi->second ;
1087  zX += zposi->first.x()*xw ;
1088  zY += zposi->first.y()*xw ;
1089  zZ += zposi->first.z()*xw ;
1090  zwght += xw ;
1091  }
1092 
1093  if ( zwght > 0 )
1094  {
1095  zX /= zwght ;
1096  zY /= zwght ;
1097  zZ /= zwght ;
1098  } else
1099  continue ;
1100 
1101  double distpz = ( pX - zX )*( pX - zX ) + ( pY - zY )*( pY - zY )
1102  + ( pZ - zZ )*( pZ - zZ ) ;
1103  double distrz = ( rX - zX )*( rX - zX ) + ( rY - zY )*( rY - zY )
1104  + ( rZ - zZ )*( rZ - zZ ) ;
1105  double dist = distpz/( pwght + zwght ) + distrz/( rwght + zwght ) + Dxy ;
1106 
1107 
1108  if ( dist < mindist )
1109  {
1110  mindist = dist ;
1111 
1112  mindistcut = 0.3333*( sqrt( distpz ) + sqrt( distrz ) + sqrt( Dxy*( pwght + rwght ) ) ) ;
1113 
1114  if ( mindistcut > 10.*m_minXYdist2Z ) continue ;
1115 
1116  double totwght = pwght + rwght + zwght ;
1117  seedX = ( pX*pwght + rX*rwght + zX*zwght )/totwght ;
1118  seedY = ( pY*pwght + rY*rwght + zY*zwght )/totwght ;
1119  seedX = ( pZ*pwght + rZ*rwght + zZ*zwght )/totwght ;
1120 
1121  info.pushIndices (pmodes);
1122  info.pushIndices (rmodes);
1123  info.pushIndices (zmodes);
1124  }
1125  }
1126  }
1127  }
1128 
1129  return Amg::Vector3D( seedX, seedY, seedZ ) ;
1130 }

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
Trk::Mode3dFromFsmw1dFinder::getFsmw1dMode
std::vector< std::pair< int, int > > getFsmw1dMode(const std::vector< IndexedWeighted > &, int) const
Definition: Mode3dFromFsmw1dFinder.cxx:665
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:885
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:493
Trk::Mode3dFromFsmw1dFinder::getClosestPair
Amg::Vector3D getClosestPair(Mode3dFromFsmw1dInfo &info, const std::vector< Trk::PositionAndWeight > &vectorOfPoints, const double vx, const double vy) const
Definition: Mode3dFromFsmw1dFinder.cxx:792
DeMoUpdate.tmp
string tmp
Definition: DeMoUpdate.py:1167
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
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