LCFIVertex  0.7.2
gausstube.cpp
1 #include "../include/gausstube.h"
2 #include "../../inc/trackstate.h"
3 #include "../../inc/track.h"
4 #include <math.h>
5 
6 namespace vertex_lcfi { namespace ZVTOP
7 {
9  {
10  //We make a trackstate to be used by the tube, with the appropriate swimmer
11  _TrackState = new TrackState(Track);
12  }
13 
14  double GaussTube::valueAt(const Vector3 & Point) const
15  {
16  //Calculate value of UNNORMALISED gaussian at point from covarience matrix
17  boost::numeric::ublas::bounded_vector<double,2> Residual;
18  //XY Dist in 2D
19  _TrackState->swimToStateNearestXY(Point);
20  Residual(0) = _TrackState->xyDistanceTo(Point);
21  //Z in 3D
22  _TrackState->swimToStateNearest(Point);
23  //The 3Ddist , 2Ddist and distance on z plane form a right triangle, convert to zaxis by dividing by sin theta
24  //Check hypotenuse longest
25  if (_TrackState->distanceTo(Point) < Residual(0))
26  Residual(1) = 0 ;
27  else
28  Residual(1) = sqrt(_TrackState->distanceTo2(Point)-pow(Residual(0),2))*sqrt(pow(_TrackState->parentTrack()->helixRep().tanLambda(),2)+1.0);
29 
30  // Value of tube = -0.5exp(res.inv(V).res) - Lyons pp 60
31  boost::numeric::ublas::bounded_vector<double,2> temp = prec_prod(_TrackState->inversePositionCovarMatrix(), Residual);
32  //std::cout << exp(-0.5 * prec_inner_prod(Residual,temp)) << std::endl;
33  return exp(-0.5 * prec_inner_prod(Residual,temp));
34 
35  }
36 
38  {
39  if (_TrackState)
40  {
41  delete _TrackState;
42  _TrackState=0;
43  }
44  }
45 
46 }}
47 
Track * parentTrack() const
The Track that this TrackState belongs to, (if any)
void swimToStateNearestXY(const Vector3 &Point)
Swim to the point of closest approach in the XY plane to Point.
Definition: trackstate.cpp:280
GaussTube(Track *Track)
Construct from a Track, makes a trackstate for its own use.
Definition: gausstube.cpp:8
double distanceTo(const Vector3 &Point) const
Distance from the TrackStates current position to Point.
const SymMatrix2x2 & inversePositionCovarMatrix() const
Current inverse position covariance matrix of the trackstate (d0,z0)
Definition: trackstate.cpp:636
~GaussTube()
Delete tube and trackstate used.
Definition: gausstube.cpp:37
double xyDistanceTo(const Vector3 &Point) const
Distance in the XY plane from the TrackStates current position to Point.
double distanceTo2(const Vector3 &Point) const
Distance squared from the TrackStates current position to Point.
double valueAt(const Vector3 &Point) const
Calculate the value of the tube at point.
Definition: gausstube.cpp:14
Unique Track representation.
const HelixRep & helixRep() const
Helix represenation of this track.
Definition: track.cpp:35
void swimToStateNearest(const Vector3 &Point)
Swim to the point of closest approach to Point.
Definition: trackstate.cpp:46