1 |
loizides |
1.1 |
//--------------------------------------------------------------------------------------------------
|
2 |
|
|
// $Id: HelixIntersector.h,v 1.3 2008/09/04 13:55:30 loizides Exp $
|
3 |
|
|
//
|
4 |
|
|
// Class HelixIntersector
|
5 |
|
|
//
|
6 |
|
|
// Finds the intersection of two tracks, it they do not intersect it finds the point of closest
|
7 |
|
|
// approach.
|
8 |
|
|
//
|
9 |
|
|
// Author List: C.Paus (stolen from CDF implementation of E. Lipeles)
|
10 |
|
|
//--------------------------------------------------------------------------------------------------
|
11 |
|
|
|
12 |
|
|
#ifndef MITCOMMON_MATHTOOLS_HELIXINTERSECTOR_H
|
13 |
|
|
#define MITCOMMON_MATHTOOLS_HELIXINTERSECTOR_H
|
14 |
|
|
|
15 |
|
|
#include <iostream>
|
16 |
|
|
|
17 |
|
|
#include "MitCommon/MathTools/interface/Helix.h"
|
18 |
|
|
|
19 |
|
|
namespace mithep
|
20 |
|
|
{
|
21 |
|
|
class HelixIntersector {
|
22 |
|
|
|
23 |
|
|
public:
|
24 |
|
|
//--------------------------------------------------------------------------------------------
|
25 |
|
|
// Class for track properties at intersection
|
26 |
|
|
//--------------------------------------------------------------------------------------------
|
27 |
|
|
class Intersection;
|
28 |
|
|
class TrackParams : public Helix
|
29 |
|
|
{
|
30 |
|
|
friend class HelixIntersector;
|
31 |
|
|
friend class HelixIntersector::Intersection;
|
32 |
|
|
|
33 |
|
|
public:
|
34 |
|
|
// Sets the track and calculates center
|
35 |
|
|
TrackParams(const TVectorD *params, const TVector3 *momentum);
|
36 |
|
|
|
37 |
|
|
const TVector3& Momentum () const { return fMomentum; }
|
38 |
|
|
const TVector3& Center () const { return fCenter; }
|
39 |
|
|
double ArcLengthToInterection() const { return fArcLen; }
|
40 |
|
|
double ZAtIntersection () const { return fZAtISec; }
|
41 |
|
|
|
42 |
|
|
private:
|
43 |
|
|
// Make it illegal to copy or assign
|
44 |
|
|
TrackParams(const TrackParams &);
|
45 |
|
|
TrackParams & operator = (const TrackParams &);
|
46 |
|
|
|
47 |
|
|
// Calculates the location dependent quantities at the specified location
|
48 |
|
|
void SetLocation (TVector3 &location);
|
49 |
|
|
|
50 |
|
|
// Data
|
51 |
|
|
TVector3 fMomentum;
|
52 |
|
|
TVector3 fCenter;
|
53 |
|
|
double fArcLen;
|
54 |
|
|
double fZAtISec;
|
55 |
|
|
TVector3 fTrkMom;
|
56 |
|
|
};
|
57 |
|
|
|
58 |
|
|
//--------------------------------------------------------------------------------------------
|
59 |
|
|
// Class for Intesection results
|
60 |
|
|
//--------------------------------------------------------------------------------------------
|
61 |
|
|
class Intersection
|
62 |
|
|
{
|
63 |
|
|
friend class HelixIntersector;
|
64 |
|
|
|
65 |
|
|
public:
|
66 |
|
|
// Properties of the vertex
|
67 |
|
|
const TVector3 &Location() const { return fLocation; }
|
68 |
|
|
double DeltaZ () const { return fDeltaZ; }
|
69 |
|
|
|
70 |
|
|
// Combined momenta of the two tracks
|
71 |
|
|
const TVector3 &Momentum() const { return fMomentum; }
|
72 |
|
|
|
73 |
|
|
// Properties of the vertex daughters
|
74 |
|
|
// i = 0 or 1 for the two daughters
|
75 |
|
|
const TrackParams &TrackParamsI(int i) const { return *(fTrks[i]); }
|
76 |
|
|
|
77 |
|
|
private:
|
78 |
|
|
Intersection(const TVectorD *tr1, const TVector3 *momentum1,
|
79 |
|
|
const TVectorD *tr2, const TVector3 *momentum2);
|
80 |
|
|
|
81 |
|
|
void SetLocation(TVector3 &loc1, TVector3 &loc2);
|
82 |
|
|
|
83 |
|
|
double fDeltaZ;
|
84 |
|
|
TVector3 fLocation;
|
85 |
|
|
TVector3 fMomentum;
|
86 |
|
|
TrackParams *fTrks[2];
|
87 |
|
|
TrackParams fTrk0;
|
88 |
|
|
TrackParams fTrk1;
|
89 |
|
|
};
|
90 |
|
|
|
91 |
|
|
//--------------------------------------------------------------------------------------------
|
92 |
|
|
// HelixIntersector methods
|
93 |
|
|
//--------------------------------------------------------------------------------------------
|
94 |
|
|
// Constructors, does intersection work
|
95 |
|
|
HelixIntersector(const TVectorD *tr1, const TVector3 *momentum1,
|
96 |
|
|
const TVectorD *tr2, const TVector3 *momentum2);
|
97 |
|
|
|
98 |
|
|
// Destructor
|
99 |
|
|
~HelixIntersector();
|
100 |
|
|
|
101 |
|
|
// Intersections or points of closest approach
|
102 |
|
|
// i = 0 or 1 (1 only if there are real intersections)
|
103 |
|
|
// ordered by deltaZ (so in general you only want i=0);
|
104 |
|
|
const Intersection& IntersectionI(int i) const { return *(fISecs[i]); }
|
105 |
|
|
|
106 |
|
|
// Has intersections
|
107 |
|
|
bool HasIntersections() const { return fHasIntersections; }
|
108 |
|
|
|
109 |
|
|
private:
|
110 |
|
|
// Make it illegal to copy or assign
|
111 |
|
|
HelixIntersector(const HelixIntersector &);
|
112 |
|
|
HelixIntersector &operator = (const HelixIntersector &);
|
113 |
|
|
|
114 |
|
|
bool fHasIntersections;
|
115 |
|
|
Intersection *fISecs[2];
|
116 |
|
|
Intersection fISec0;
|
117 |
|
|
Intersection fISec1;
|
118 |
|
|
};
|
119 |
|
|
}
|
120 |
|
|
#endif
|