CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
TwoTrackMinimumDistanceHelixHelix Class Reference

#include <TwoTrackMinimumDistanceHelixHelix.h>

Public Member Functions

bool calculate (const GlobalTrajectoryParameters &, const GlobalTrajectoryParameters &, const float qual=.001)
 
double firstAngle () const
 
std::pair< double, double > pathLength () const
 
std::pair< GlobalPoint,
GlobalPoint
points () const
 
double secondAngle () const
 
 TwoTrackMinimumDistanceHelixHelix ()
 
 ~TwoTrackMinimumDistanceHelixHelix ()
 

Private Member Functions

void finalPoints () const
 
bool oneIteration (double &, double &) const
 
bool updateCoeffs (const GlobalPoint &, const GlobalPoint &)
 

Private Attributes

double pathG
 
double pathH
 
GlobalPoint pointG
 
GlobalPoint pointH
 
bool pointsUpdated
 
double thea
 
double theb
 
double thec1
 
double thec2
 
double thecospG
 
double thecospG0
 
double thecospH
 
double thecospH0
 
double thed1
 
double thed2
 
double thee1
 
double thee2
 
GlobalTrajectoryParameters const * theG
 
double theg
 
GlobalTrajectoryParameters const * theH
 
double theh
 
int themaxiter
 
double themaxjump
 
double thepG
 
double thepG0
 
double thepH
 
double thepH0
 
double thesingjacI
 
double thesinpG
 
double thesinpG0
 
double thesinpH
 
double thesinpH0
 
double thetanlambdaG
 
double thetanlambdaH
 

Detailed Description

This is a helper class for TwoTrackMinimumDistance. No user should need direct access to this class. It actually implements a Newton-Kantorowitsch method for finding the minimum distance between two tracks.

Definition at line 18 of file TwoTrackMinimumDistanceHelixHelix.h.

Constructor & Destructor Documentation

TwoTrackMinimumDistanceHelixHelix::TwoTrackMinimumDistanceHelixHelix ( )
TwoTrackMinimumDistanceHelixHelix::~TwoTrackMinimumDistanceHelixHelix ( )

Definition at line 38 of file TwoTrackMinimumDistanceHelixHelix.cc.

38 {}

Member Function Documentation

bool TwoTrackMinimumDistanceHelixHelix::calculate ( const GlobalTrajectoryParameters G,
const GlobalTrajectoryParameters H,
const float  qual = .001 
)

Definition at line 143 of file TwoTrackMinimumDistanceHelixHelix.cc.

References counter, callgraph::G, class-composition::H, edm::isNotFinite(), oneIteration(), pointsUpdated, GlobalTrajectoryParameters::position(), theG, theg, theH, theh, themaxiter, themaxjump, thepG, thepG0, thepH, thepH0, and updateCoeffs().

145  {
146  pointsUpdated = false;
147  theG= &G;
148  theH= &H;
149  bool retval=false;
150 
151  if ( updateCoeffs ( theG->position(), theH->position() ) ) return true;
152 
153  thepG = thepG0;
154  thepH = thepH0;
155 
156  int counter=0;
157  double pH=0; double pG=0;
158  do {
159  retval=oneIteration ( pG, pH );
160  if ( edm::isNotFinite(pG) || edm::isNotFinite(pH) ) retval=true;
161  if ( counter++>themaxiter ) retval=true;
162  } while ( (!retval) && ( fabs(pG) > qual || fabs(pH) > qual ));
163  if ( fabs ( theg * ( thepG - thepG0 ) ) > themaxjump ) retval=true;
164  if ( fabs ( theh * ( thepH - thepH0 ) ) > themaxjump ) retval=true;
165  return retval;
166 }
bool isNotFinite(T x)
Definition: isFinite.h:10
bool updateCoeffs(const GlobalPoint &, const GlobalPoint &)
tuple G
Definition: callgraph.py:12
static std::atomic< unsigned int > counter
void TwoTrackMinimumDistanceHelixHelix::finalPoints ( ) const
private

Definition at line 169 of file TwoTrackMinimumDistanceHelixHelix.cc.

References funct::cos(), pathG, pathH, pointG, pointH, pointsUpdated, GlobalTrajectoryParameters::position(), funct::sin(), mathSSE::sqrt(), thecospG0, thecospH0, theG, theg, theH, theh, thepG, thepG0, thepH, thepH0, thesinpG0, thesinpH0, thetanlambdaG, and thetanlambdaH.

Referenced by pathLength(), and points().

169  {
170  GlobalVector tmpG( sin(thepG) - thesinpG0,
171  - cos(thepG) + thecospG0,
172  thetanlambdaG * ( thepG- thepG0 )
173  );
174  pointG = theG->position() + theg * tmpG;
176 
177  GlobalVector tmpH( sin(thepH) - thesinpH0,
178  - cos(thepH) + thecospH0,
179  thetanlambdaH * ( thepH- thepH0 )
180  );
181  pointH = theH->position() + theh * tmpH;
183 
184  pointsUpdated = true;
185 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
T sqrt(T t)
Definition: SSEVec.h:18
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
double TwoTrackMinimumDistanceHelixHelix::firstAngle ( ) const
inline

Definition at line 40 of file TwoTrackMinimumDistanceHelixHelix.h.

References thepG.

bool TwoTrackMinimumDistanceHelixHelix::oneIteration ( double &  dH,
double &  dG 
) const
private

Definition at line 102 of file TwoTrackMinimumDistanceHelixHelix.cc.

References funct::cos(), funct::sin(), thea, theb, thec1, thec2, thecospG, thecospH, thed1, thed2, thee1, thee2, theg, theh, thepG, thepH, thesingjacI, thesinpG, and thesinpH.

Referenced by calculate().

102  {
103  thesinpH=sin(thepH);
104  thecospH=cos(thepH);
105  thesinpG=sin(thepG);
106  thecospG=cos(thepG);
107 
108  const double A11= theh * ( - thesinpH * ( thea - theg * thesinpG ) +
109  thecospH * ( theb + theg * thecospG ) + thec1);
110  if (A11 < 0) { return true; };
111  const double A22= -theg * (- thesinpG * ( thea + theh * thesinpH ) +
112  thecospG*( theb - theh * thecospH ) + thec2);
113  if (A22 < 0) { return true; };
114  const double A12= theh * (-theg * thecospG * thecospH -
115  theg * thesinpH * thesinpG + thed1);
116  const double A21= -theg * (theh * thecospG * thecospH +
117  theh * thesinpH * thesinpG + thed2);
118  const double detaI = 1./(A11 * A22 - A12 * A21);
119  const double z1=theh * ( thecospH * ( thea - theg * thesinpG ) + thesinpH *
120  ( theb + theg*thecospG ) + thec1 * thepH + thed1 * thepG + thee1);
121  const double z2=-theg * (thecospG * ( thea + theh * thesinpH ) + thesinpG *
122  ( theb - theh*thecospH ) + thec2 * thepG + thed2 * thepH + thee2);
123 
124  dH=( z1 * A22 - z2 * A12 ) * detaI;
125  dG=( z2 * A11 - z1 * A21 ) * detaI;
126  if ( fabs(detaI) > thesingjacI ) { return true; };
127 
128  thepH -= dH;
129  thepG -= dG;
130  return false;
131 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
std::pair<double, double> TwoTrackMinimumDistanceHelixHelix::pathLength ( ) const
inline
std::pair<GlobalPoint, GlobalPoint> TwoTrackMinimumDistanceHelixHelix::points ( ) const
inline
double TwoTrackMinimumDistanceHelixHelix::secondAngle ( ) const
inline

Definition at line 41 of file TwoTrackMinimumDistanceHelixHelix.h.

References thepH.

bool TwoTrackMinimumDistanceHelixHelix::updateCoeffs ( const GlobalPoint gpH,
const GlobalPoint gpG 
)
private

Definition at line 40 of file TwoTrackMinimumDistanceHelixHelix.cc.

References GlobalTrajectoryParameters::charge(), MagneticField::inInverseGeV(), GlobalTrajectoryParameters::magneticField(), GlobalTrajectoryParameters::momentum(), PV3DBase< T, PVType, FrameType >::perp(), GlobalTrajectoryParameters::position(), thea, theb, thec1, thec2, thecospG0, thecospH0, thed1, thed2, thee1, thee2, theG, theg, theH, theh, thepG0, thepH0, thesinpG0, thesinpH0, thetanlambdaG, thetanlambdaH, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by calculate().

41  {
42 
43  const double Bc2kH = theH->magneticField().inInverseGeV(gpH).z();
44  const double Bc2kG = theG->magneticField().inInverseGeV(gpG).z();
45  const double Ht= theH->momentum().perp();
46  const double Gt= theG->momentum().perp();
47  // thelambdaH=asin ( theH->momentum().z() / Hn );
48 
49  if ( Ht == 0. || Gt == 0. ) {
50  edm::LogWarning ("TwoTrackMinimumDistanceHelixHelix")
51  << "transverse momentum of input trajectory is zero.";
52  return true;
53  };
54 
55  if ( theH->charge() == 0. || theG->charge() == 0. ) {
56  edm::LogWarning ("TwoTrackMinimumDistanceHelixHelix")
57  << "charge of input track is zero.";
58  return true;
59  };
60 
61  if ( Bc2kG == 0.) {
62  edm::LogWarning ("TwoTrackMinimumDistanceHelixHelix")
63  << "magnetic field at point " << gpG << " is zero.";
64  return true;
65  };
66 
67  if ( Bc2kH == 0. ) {
68  edm::LogWarning ("TwoTrackMinimumDistanceHelixHelix")
69  << "magnetic field at point " << gpH << " is zero.";
70  return true;
71  };
72 
73  theh= Ht / (theH->charge() * Bc2kH );
74  thesinpH0= - theH->momentum().y() / ( Ht );
75  thecospH0= - theH->momentum().x() / ( Ht );
76  thetanlambdaH = - theH->momentum().z() / ( Ht);
77  thepH0 = atan2 ( thesinpH0 , thecospH0 );
78 
79  // thelambdaG=asin ( theG->momentum().z()/( Gn ) );
80 
81  theg= Gt / (theG->charge() * Bc2kG );
82  thesinpG0= - theG->momentum().y() / ( Gt);
83  thecospG0= - theG->momentum().x() / (Gt);
84  thetanlambdaG = - theG->momentum().z() / ( Gt);
85  thepG0 = atan2 ( thesinpG0 , thecospG0 );
86 
87  thea=theH->position().x() - theG->position().x() + theg * thesinpG0 -
88  theh * thesinpH0;
89  theb=theH->position().y() - theG->position().y() - theg * thecospG0 +
90  theh * thecospH0;
93  thed1= -theg * thetanlambdaG * thetanlambdaH;
94  thed2= theh * thetanlambdaG * thetanlambdaH;
95  thee1= thetanlambdaH * ( theH->position().z() - theG->position().z() -
96  theh * thepH0 * thetanlambdaH + theg * thepG0 * thetanlambdaG );
97  thee2= thetanlambdaG * ( theH->position().z() - theG->position().z() -
98  theh * thepH0 * thetanlambdaH + theg * thepG0 * thetanlambdaG );
99  return false;
100 }
T perp() const
Definition: PV3DBase.h:72
T y() const
Definition: PV3DBase.h:63
GlobalVector inInverseGeV(const GlobalPoint &gp) const
Field value ad specified global point, in 1/Gev.
Definition: MagneticField.h:39
T z() const
Definition: PV3DBase.h:64
const MagneticField & magneticField() const
T x() const
Definition: PV3DBase.h:62

Member Data Documentation

double TwoTrackMinimumDistanceHelixHelix::pathG
mutableprivate

Definition at line 66 of file TwoTrackMinimumDistanceHelixHelix.h.

Referenced by finalPoints(), and pathLength().

double TwoTrackMinimumDistanceHelixHelix::pathH
mutableprivate

Definition at line 66 of file TwoTrackMinimumDistanceHelixHelix.h.

Referenced by finalPoints(), and pathLength().

GlobalPoint TwoTrackMinimumDistanceHelixHelix::pointG
mutableprivate

Definition at line 65 of file TwoTrackMinimumDistanceHelixHelix.h.

Referenced by finalPoints(), and points().

GlobalPoint TwoTrackMinimumDistanceHelixHelix::pointH
mutableprivate

Definition at line 65 of file TwoTrackMinimumDistanceHelixHelix.h.

Referenced by finalPoints(), and points().

bool TwoTrackMinimumDistanceHelixHelix::pointsUpdated
mutableprivate

Definition at line 67 of file TwoTrackMinimumDistanceHelixHelix.h.

Referenced by calculate(), finalPoints(), pathLength(), and points().

double TwoTrackMinimumDistanceHelixHelix::thea
private

Definition at line 53 of file TwoTrackMinimumDistanceHelixHelix.h.

Referenced by oneIteration(), and updateCoeffs().

double TwoTrackMinimumDistanceHelixHelix::theb
private

Definition at line 53 of file TwoTrackMinimumDistanceHelixHelix.h.

Referenced by oneIteration(), and updateCoeffs().

double TwoTrackMinimumDistanceHelixHelix::thec1
private

Definition at line 53 of file TwoTrackMinimumDistanceHelixHelix.h.

Referenced by oneIteration(), and updateCoeffs().

double TwoTrackMinimumDistanceHelixHelix::thec2
private

Definition at line 53 of file TwoTrackMinimumDistanceHelixHelix.h.

Referenced by oneIteration(), and updateCoeffs().

double TwoTrackMinimumDistanceHelixHelix::thecospG
mutableprivate

Definition at line 64 of file TwoTrackMinimumDistanceHelixHelix.h.

Referenced by oneIteration().

double TwoTrackMinimumDistanceHelixHelix::thecospG0
private

Definition at line 56 of file TwoTrackMinimumDistanceHelixHelix.h.

Referenced by finalPoints(), and updateCoeffs().

double TwoTrackMinimumDistanceHelixHelix::thecospH
mutableprivate

Definition at line 64 of file TwoTrackMinimumDistanceHelixHelix.h.

Referenced by oneIteration().

double TwoTrackMinimumDistanceHelixHelix::thecospH0
private

Definition at line 57 of file TwoTrackMinimumDistanceHelixHelix.h.

Referenced by finalPoints(), and updateCoeffs().

double TwoTrackMinimumDistanceHelixHelix::thed1
private

Definition at line 53 of file TwoTrackMinimumDistanceHelixHelix.h.

Referenced by oneIteration(), and updateCoeffs().

double TwoTrackMinimumDistanceHelixHelix::thed2
private

Definition at line 53 of file TwoTrackMinimumDistanceHelixHelix.h.

Referenced by oneIteration(), and updateCoeffs().

double TwoTrackMinimumDistanceHelixHelix::thee1
private

Definition at line 53 of file TwoTrackMinimumDistanceHelixHelix.h.

Referenced by oneIteration(), and updateCoeffs().

double TwoTrackMinimumDistanceHelixHelix::thee2
private

Definition at line 53 of file TwoTrackMinimumDistanceHelixHelix.h.

Referenced by oneIteration(), and updateCoeffs().

GlobalTrajectoryParameters const * TwoTrackMinimumDistanceHelixHelix::theG
private

Definition at line 51 of file TwoTrackMinimumDistanceHelixHelix.h.

Referenced by calculate(), finalPoints(), and updateCoeffs().

double TwoTrackMinimumDistanceHelixHelix::theg
private
GlobalTrajectoryParameters const* TwoTrackMinimumDistanceHelixHelix::theH
private

Definition at line 51 of file TwoTrackMinimumDistanceHelixHelix.h.

Referenced by calculate(), finalPoints(), and updateCoeffs().

double TwoTrackMinimumDistanceHelixHelix::theh
private
int TwoTrackMinimumDistanceHelixHelix::themaxiter
private

Definition at line 70 of file TwoTrackMinimumDistanceHelixHelix.h.

Referenced by calculate().

double TwoTrackMinimumDistanceHelixHelix::themaxjump
private

Definition at line 69 of file TwoTrackMinimumDistanceHelixHelix.h.

Referenced by calculate().

double TwoTrackMinimumDistanceHelixHelix::thepG
mutableprivate
double TwoTrackMinimumDistanceHelixHelix::thepG0
private

Definition at line 58 of file TwoTrackMinimumDistanceHelixHelix.h.

Referenced by calculate(), finalPoints(), and updateCoeffs().

double TwoTrackMinimumDistanceHelixHelix::thepH
mutableprivate
double TwoTrackMinimumDistanceHelixHelix::thepH0
private

Definition at line 58 of file TwoTrackMinimumDistanceHelixHelix.h.

Referenced by calculate(), finalPoints(), and updateCoeffs().

double TwoTrackMinimumDistanceHelixHelix::thesingjacI
private

Definition at line 69 of file TwoTrackMinimumDistanceHelixHelix.h.

Referenced by oneIteration().

double TwoTrackMinimumDistanceHelixHelix::thesinpG
mutableprivate

Definition at line 63 of file TwoTrackMinimumDistanceHelixHelix.h.

Referenced by oneIteration().

double TwoTrackMinimumDistanceHelixHelix::thesinpG0
private

Definition at line 56 of file TwoTrackMinimumDistanceHelixHelix.h.

Referenced by finalPoints(), and updateCoeffs().

double TwoTrackMinimumDistanceHelixHelix::thesinpH
mutableprivate

Definition at line 63 of file TwoTrackMinimumDistanceHelixHelix.h.

Referenced by oneIteration().

double TwoTrackMinimumDistanceHelixHelix::thesinpH0
private

Definition at line 57 of file TwoTrackMinimumDistanceHelixHelix.h.

Referenced by finalPoints(), and updateCoeffs().

double TwoTrackMinimumDistanceHelixHelix::thetanlambdaG
private

Definition at line 55 of file TwoTrackMinimumDistanceHelixHelix.h.

Referenced by finalPoints(), and updateCoeffs().

double TwoTrackMinimumDistanceHelixHelix::thetanlambdaH
private

Definition at line 55 of file TwoTrackMinimumDistanceHelixHelix.h.

Referenced by finalPoints(), and updateCoeffs().