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

#include <IndexedCrossDistancesSeedFinder.h>

Inheritance diagram for Trk::IndexedCrossDistancesSeedFinder:
Collaboration diagram for Trk::IndexedCrossDistancesSeedFinder:

Public Member Functions

 IndexedCrossDistancesSeedFinder (const std::string &t, const std::string &n, const IInterface *p)
 
virtual ~IndexedCrossDistancesSeedFinder ()
 
virtual StatusCode initialize () override
 
virtual Amg::Vector3D findSeed (const std::vector< const Trk::Track * > &vectorTrk, const xAOD::Vertex *constraint=0) const override final
 Finds a linearization point out of a vector of tracks and returns it as an Amg::Vector3D object. More...
 
virtual Amg::Vector3D findSeed (const std::vector< const Trk::TrackParameters * > &perigeeList, const xAOD::Vertex *constraint=0) const override final
 Finds a linearization point out of a vector of TrackParameters and returns it as an Amg::Vector3D object. More...
 
virtual Amg::Vector3D findSeed (const double vx, const double vy, const std::vector< const Trk::TrackParameters * > &perigeeList, const xAOD::Vertex *constraint=0) const override final
 Finds a linearization point out of a vector of TrackParameters and returns it as an Amg::Vector3D object. More...
 
virtual Amg::Vector3D findSeed (const double vx, const double vy, std::unique_ptr< Trk::IMode3dInfo > &info, const std::vector< const Trk::TrackParameters * > &perigeeList, const xAOD::Vertex *constraint=0) const override final
 Finds a linearization point out of a vector of TrackParameters and returns it as an Amg::Vector3D object. More...
 
virtual std::vector< Amg::Vector3DfindMultiSeeds (const std::vector< const Trk::Track * > &vectorTrk, const xAOD::Vertex *constraint=0) const override final
 Finds full vector of linearization points from a vector of tracks and returns it as an Amg::Vector3D object. More...
 
virtual std::vector< Amg::Vector3DfindMultiSeeds (const std::vector< const Trk::TrackParameters * > &perigeeList, const xAOD::Vertex *constraint=0) const override final
 Finds full vector of linearization points from a vector of TrackParameters and returns it as an Amg::Vector3D object. More...
 

Private Attributes

bool m_useweights
 
float m_trackdistcutoff
 
int m_trackdistexppower
 
float m_constraintcutoff
 
float m_constrainttemp
 
unsigned int m_maximumTracksNoCut
 
double m_maximumDistanceCut
 
ToolHandle< IMode3dFinderm_mode3dfinder
 
ToolHandle< ITrkDistanceFinderm_distancefinder
 

Detailed Description

Definition at line 35 of file IndexedCrossDistancesSeedFinder.h.

Constructor & Destructor Documentation

◆ IndexedCrossDistancesSeedFinder()

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

Definition at line 29 of file IndexedCrossDistancesSeedFinder.cxx.

36  {
37  declareProperty("useweights",m_useweights);
38  declareProperty("trackdistcutoff",m_trackdistcutoff);
39  declareProperty("trackdistexppower",m_trackdistexppower);
40  declareProperty("constrainttemp",m_constrainttemp);
41  declareProperty("constraintcutoff",m_constraintcutoff);
42  declareProperty("maximumTracksNoCut",m_maximumTracksNoCut);
43  declareProperty("maximumDistanceCut",m_maximumDistanceCut);
44  }
45 
46 

◆ ~IndexedCrossDistancesSeedFinder()

Trk::IndexedCrossDistancesSeedFinder::~IndexedCrossDistancesSeedFinder ( )
virtualdefault

Member Function Documentation

◆ findMultiSeeds() [1/2]

std::vector< Amg::Vector3D > Trk::IndexedCrossDistancesSeedFinder::findMultiSeeds ( const std::vector< const Trk::Track * > &  vectorTrk,
const xAOD::Vertex constraint = 0 
) const
finaloverridevirtual

Finds full vector of linearization points from a vector of tracks and returns it as an Amg::Vector3D object.

Intended for seed finders that produce all at once. If you want an additional constraint can be taken into account.

Definition at line 253 of file IndexedCrossDistancesSeedFinder.cxx.

253 {
254 
255  //implemented to satisfy inheritance but this algorithm only supports one seed at a time
256  ATH_MSG_WARNING("Multi-seeding requested but seed finder not able to operate in that mode, returning no seeds" );
257  return std::vector<Amg::Vector3D>(0);
258 }
259 
260 std::vector<Amg::Vector3D> IndexedCrossDistancesSeedFinder::findMultiSeeds(

◆ findMultiSeeds() [2/2]

std::vector< Amg::Vector3D > Trk::IndexedCrossDistancesSeedFinder::findMultiSeeds ( const std::vector< const Trk::TrackParameters * > &  perigeeList,
const xAOD::Vertex constraint = 0 
) const
finaloverridevirtual

Finds full vector of linearization points from a vector of TrackParameters and returns it as an Amg::Vector3D object.

Intended for seed finders that produce all at once. If you want an additional constraint can be taken into account.

Definition at line 262 of file IndexedCrossDistancesSeedFinder.cxx.

262 {
263 
264  //implemented to satisfy inheritance but this algorithm only supports one seed at a time
265  ATH_MSG_WARNING("Multi-seeding requested but seed finder not able to operate in that mode, returning no seeds" );
266  return std::vector<Amg::Vector3D>(0);
267 
268 }
269 
270 

◆ findSeed() [1/4]

Amg::Vector3D Trk::IndexedCrossDistancesSeedFinder::findSeed ( const double  vx,
const double  vy,
const std::vector< const Trk::TrackParameters * > &  perigeeList,
const xAOD::Vertex constraint = 0 
) const
finaloverridevirtual

Finds a linearization point out of a vector of TrackParameters and returns it as an Amg::Vector3D object.

If you want an additional constraint can be taken into account. Must specify the primary vertex position.

Definition at line 80 of file IndexedCrossDistancesSeedFinder.cxx.

82  {
83  std::unique_ptr<Trk::IMode3dInfo> info;
84  return findSeed (vx, vy, info, perigeeList, constraint);
85  }
86 
87 

◆ findSeed() [2/4]

Amg::Vector3D Trk::IndexedCrossDistancesSeedFinder::findSeed ( const double  vx,
const double  vy,
std::unique_ptr< Trk::IMode3dInfo > &  info,
const std::vector< const Trk::TrackParameters * > &  perigeeList,
const xAOD::Vertex constraint = 0 
) const
finaloverridevirtual

Finds a linearization point out of a vector of TrackParameters and returns it as an Amg::Vector3D object.

If you want an additional constraint can be taken into account. Must specify the primary vertex position. Allows returning additional diagnostic information.

Definition at line 91 of file IndexedCrossDistancesSeedFinder.cxx.

94  {
95  ATH_MSG_DEBUG( " Enter IndexedCrossDistancesSeedFinder " );
96 
97  bool useCutOnDistance=false;
98  if (perigeeList.size()>m_maximumTracksNoCut)
99  {
100  useCutOnDistance=true;
101  }
102 
103  //now implement the code you already had in the standalone code...
104 
105  //Calculate and cache the covariance matrix for the constraint
106  AmgSymMatrix(3) weightMatrixPositionConstraint;
107  weightMatrixPositionConstraint.setIdentity(); //very arbitrary
108  if (constraint != nullptr) {
109  weightMatrixPositionConstraint = constraint->covariancePosition().inverse();
110  }
111 
112  //Prepare the vector of points, on which the 3d mode has later to be calculated
113  std::vector<PositionAndWeight> CrossingPointsAndWeights;
114  std::vector<Amg::Vector3D> CrossingPoints;
115 
116  //Implement here SeedPointFinder algorithm, acting with the track vector....
117  const std::vector<const Trk::TrackParameters*>::const_iterator begin=perigeeList.begin();
118  const std::vector<const Trk::TrackParameters*>::const_iterator end=perigeeList.end();
119 
120  ATH_MSG_DEBUG( " Loop pairs of TrackParameters for modes " );
121 
122  std::vector< std::pair <int, int> > trkidx ;
123  int idx_i = 0 ;
124  for (std::vector<const Trk::TrackParameters*>::const_iterator i=begin;i!=end-1;++i)
125  {
126  idx_i ++ ;
127  const Trk::Perigee* MyI=dynamic_cast<const Trk::Perigee*>(*i);
128  if (MyI==nullptr) {
129  ATH_MSG_WARNING( "Neutrals not supported for seeding. Rejecting this track..." );
130  continue;
131  }
132 
133  int idx_j = idx_i ; // 1 has been added to idx_i
134  for (std::vector<const Trk::TrackParameters*>::const_iterator j=i+1;j!=end;++j++) {
135 
136  idx_j ++ ;
137  const Trk::Perigee* MyJ=dynamic_cast<const Trk::Perigee*>(*j);
138 
139  if (MyJ==nullptr) {
140  ATH_MSG_WARNING( "Neutrals not supported for seeding. Rejecting this track..." );
141  continue;
142  }
143 
144 
145  try {
146 
147  std::optional<ITrkDistanceFinder::TwoPoints> result
148  = m_distancefinder->CalculateMinimumDistance(*MyI,*MyJ);
149  if (!result) {ATH_MSG_DEBUG("Problem with distance finder: THIS POINT WILL BE SKIPPED!");
150  }
151  else
152  {
153  //Get the points which connect the minimum distance between the two tracks
154  double distance = Amg::distance (result->first, result->second);
155 #ifdef CROSSDISTANCESSEEDFINDER_DEBUG
156  ATH_MSG_DEBUG("Point 1 x: " << result->first.x() <<
157  " y: " << result->first.y() <<
158  " z: " << result->first.z() );
159  ATH_MSG_DEBUG("Point 2 x: " << result->second.x() <<
160  " y: " << result->second.y() <<
161  " z: " << result->second.z() );
162  ATH_MSG_DEBUG("distance is: " << distance );
163 #endif
164 
165  Amg::Vector3D thepoint((result->first+result->second)/2.);
166 
167  if (m_useweights)
168  {
169  PositionAndWeight thispoint(thepoint,
171 
173 
174  if (constraint!=nullptr) {
175 
176  Amg::Vector3D DeltaP(thepoint-constraint->position());
177  Amg::Vector3D DeltaPConv;
178  ATH_MSG_DEBUG("position x: " << DeltaP.x() << "position y: " << DeltaP.y() << "position z: " << DeltaP.z() );
179  DeltaPConv[0]=DeltaP.x();
180  DeltaPConv[1]=DeltaP.y();
181  DeltaPConv[2]=DeltaP.z();
182 
183 
184  double chi2=DeltaPConv.transpose()*weightMatrixPositionConstraint*DeltaPConv;
185 
186  ATH_MSG_DEBUG(" chi: " << chi2 <<
187  " beam weight " << 1./(1.+exp((chi2-m_constraintcutoff)/m_constrainttemp)) );
188 
189  thispoint.second=thispoint.second*1./(1.+exp((chi2-m_constraintcutoff)/m_constrainttemp));
190 
191  }
192 
193  if ((!useCutOnDistance || distance<m_maximumDistanceCut) && thispoint.second > 1e-10)
194  {
195  CrossingPointsAndWeights.push_back( thispoint );
196 
197  trkidx.emplace_back( idx_i - 1 , idx_j - 1 );
198 
199  ATH_MSG_VERBOSE( " crossing with track pair : " << idx_i - 1 <<" "
200  << MyI->parameters()[Trk::d0] <<" "<< idx_j - 1 <<" "
201  << MyJ->parameters()[Trk::d0] );
202 
203  }
204  }
205  else
206  {
207  const Amg::Vector3D& thispoint(thepoint);
208  if ( !useCutOnDistance || distance<m_maximumDistanceCut )
209  {
210  CrossingPoints.push_back( thispoint );
211  }
212  }
213  }
214  } catch (...) {
215  ATH_MSG_ERROR("Something wrong in distance calculation: please report..." );
216  }
217  }
218  //to be understood...
219  }
220 
221  //Now all points have been collected (N*(N-1)/2) and
222  //the mode has to be calculated
223 
224  if ( ( CrossingPoints.empty() && ! m_useweights )
225  || ( m_useweights && CrossingPointsAndWeights.empty() ) )
226  {
227  return Amg::Vector3D(0,0,0);
228  }
229 
230  ATH_MSG_DEBUG(" crossing points prepared : " << CrossingPointsAndWeights.size() );
231 
232  Amg::Vector3D myresult;
233 
234  if (m_useweights)
235  {
236  myresult=m_mode3dfinder->getMode(vx, vy, CrossingPointsAndWeights, info);
237  }
238  else
239  {
240  myresult=m_mode3dfinder->getMode(vx, vy, CrossingPoints, info);
241  }
242 
243  info->setTrkidx (std::move (trkidx));
244  ATH_MSG_DEBUG(" 3D modes found ! " );
245 
246  return myresult;
247 
248  }
249 
250 

◆ findSeed() [3/4]

Amg::Vector3D Trk::IndexedCrossDistancesSeedFinder::findSeed ( const std::vector< const Trk::Track * > &  vectorTrk,
const xAOD::Vertex constraint = 0 
) const
finaloverridevirtual

Finds a linearization point out of a vector of tracks and returns it as an Amg::Vector3D object.

If you want an additional constraint can be taken into account.

Definition at line 62 of file IndexedCrossDistancesSeedFinder.cxx.

62  {
63  ATH_MSG_ERROR ("Need to supply a primary vertex.");
64  return Amg::Vector3D(0.,0.,0.);
65  }
66 
67 

◆ findSeed() [4/4]

Amg::Vector3D Trk::IndexedCrossDistancesSeedFinder::findSeed ( const std::vector< const Trk::TrackParameters * > &  perigeeList,
const xAOD::Vertex constraint = 0 
) const
finaloverridevirtual

Finds a linearization point out of a vector of TrackParameters and returns it as an Amg::Vector3D object.

If you want an additional constraint can be taken into account.

Definition at line 71 of file IndexedCrossDistancesSeedFinder.cxx.

71  {
72  ATH_MSG_ERROR ("Need to supply a primary vertex.");
73  return Amg::Vector3D(0.,0.,0.);
74  }
75 
76 

◆ initialize()

StatusCode Trk::IndexedCrossDistancesSeedFinder::initialize ( )
overridevirtual

Definition at line 53 of file IndexedCrossDistancesSeedFinder.cxx.

Member Data Documentation

◆ m_constraintcutoff

float Trk::IndexedCrossDistancesSeedFinder::m_constraintcutoff
private

Definition at line 124 of file IndexedCrossDistancesSeedFinder.h.

◆ m_constrainttemp

float Trk::IndexedCrossDistancesSeedFinder::m_constrainttemp
private

Definition at line 125 of file IndexedCrossDistancesSeedFinder.h.

◆ m_distancefinder

ToolHandle<ITrkDistanceFinder> Trk::IndexedCrossDistancesSeedFinder::m_distancefinder
private
Initial value:
{
this,
"TrkDistanceFinder",
"Trk::SeedNewtonTrkDistanceFinder"
}

Definition at line 132 of file IndexedCrossDistancesSeedFinder.h.

◆ m_maximumDistanceCut

double Trk::IndexedCrossDistancesSeedFinder::m_maximumDistanceCut
private

Definition at line 127 of file IndexedCrossDistancesSeedFinder.h.

◆ m_maximumTracksNoCut

unsigned int Trk::IndexedCrossDistancesSeedFinder::m_maximumTracksNoCut
private

Definition at line 126 of file IndexedCrossDistancesSeedFinder.h.

◆ m_mode3dfinder

ToolHandle<IMode3dFinder> Trk::IndexedCrossDistancesSeedFinder::m_mode3dfinder
private
Initial value:
{ this,
"Mode3dFinder",
"Trk::Mode3dFromFsmw1dFinder" }

Definition at line 129 of file IndexedCrossDistancesSeedFinder.h.

◆ m_trackdistcutoff

float Trk::IndexedCrossDistancesSeedFinder::m_trackdistcutoff
private

Definition at line 122 of file IndexedCrossDistancesSeedFinder.h.

◆ m_trackdistexppower

int Trk::IndexedCrossDistancesSeedFinder::m_trackdistexppower
private

Definition at line 123 of file IndexedCrossDistancesSeedFinder.h.

◆ m_useweights

bool Trk::IndexedCrossDistancesSeedFinder::m_useweights
private

Definition at line 121 of file IndexedCrossDistancesSeedFinder.h.


The documentation for this class was generated from the following files:
grepfile.info
info
Definition: grepfile.py:38
Trk::IndexedCrossDistancesSeedFinder::m_mode3dfinder
ToolHandle< IMode3dFinder > m_mode3dfinder
Definition: IndexedCrossDistancesSeedFinder.h:129
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
get_generator_info.result
result
Definition: get_generator_info.py:21
Trk::IndexedCrossDistancesSeedFinder::m_maximumDistanceCut
double m_maximumDistanceCut
Definition: IndexedCrossDistancesSeedFinder.h:127
Trk::ParametersT
Dummy class used to allow special convertors to be called for surfaces owned by a detector element.
Definition: EMErrorDetail.h:25
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
xAOD::Vertex_v1::position
const Amg::Vector3D & position() const
Returns the 3-pos.
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
drawFromPickle.exp
exp
Definition: drawFromPickle.py:36
Trk::IndexedCrossDistancesSeedFinder::m_constrainttemp
float m_constrainttemp
Definition: IndexedCrossDistancesSeedFinder.h:125
Trk::IndexedCrossDistancesSeedFinder::m_distancefinder
ToolHandle< ITrkDistanceFinder > m_distancefinder
Definition: IndexedCrossDistancesSeedFinder.h:132
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
Trk::AmgSymMatrix
AmgSymMatrix(5) &GXFTrackState
Definition: GXFTrackState.h:156
Trk::PositionAndWeight
std::pair< Amg::Vector3D, double > PositionAndWeight
Definition: SeedFinderParamDefs.h:17
Trk::IndexedCrossDistancesSeedFinder::m_trackdistcutoff
float m_trackdistcutoff
Definition: IndexedCrossDistancesSeedFinder.h:122
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
lumiFormat.i
int i
Definition: lumiFormat.py:85
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
chi2
double chi2(TH1 *h0, TH1 *h1)
Definition: comparitor.cxx:523
Trk::IndexedCrossDistancesSeedFinder::findMultiSeeds
virtual std::vector< Amg::Vector3D > findMultiSeeds(const std::vector< const Trk::Track * > &vectorTrk, const xAOD::Vertex *constraint=0) const override final
Finds full vector of linearization points from a vector of tracks and returns it as an Amg::Vector3D ...
Definition: IndexedCrossDistancesSeedFinder.cxx:253
Trk::IndexedCrossDistancesSeedFinder::m_trackdistexppower
int m_trackdistexppower
Definition: IndexedCrossDistancesSeedFinder.h:123
Trk::d0
@ d0
Definition: ParamDefs.h:63
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
Trk::IndexedCrossDistancesSeedFinder::findSeed
virtual Amg::Vector3D findSeed(const std::vector< const Trk::Track * > &vectorTrk, const xAOD::Vertex *constraint=0) const override final
Finds a linearization point out of a vector of tracks and returns it as an Amg::Vector3D object.
Definition: IndexedCrossDistancesSeedFinder.cxx:62
Trk::IndexedCrossDistancesSeedFinder::m_constraintcutoff
float m_constraintcutoff
Definition: IndexedCrossDistancesSeedFinder.h:124
if
if(febId1==febId2)
Definition: LArRodBlockPhysicsV0.cxx:567
Trk::IndexedCrossDistancesSeedFinder::m_maximumTracksNoCut
unsigned int m_maximumTracksNoCut
Definition: IndexedCrossDistancesSeedFinder.h:126
Trk::IndexedCrossDistancesSeedFinder::m_useweights
bool m_useweights
Definition: IndexedCrossDistancesSeedFinder.h:121
pow
constexpr int pow(int base, int exp) noexcept
Definition: ap_fixedTest.cxx:15
Amg::distance
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
Definition: GeoPrimitivesHelpers.h:54