Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#ifndef THYPE_H
#define THYPE_H
//*************************************************************************
//* ====================
//* THype Class
//* ====================
//*
//* (Description)
//* A class to implement a hyperboloidal surface object.
//* (Requires)
//* TVSurface
//* (Provides)
//* class THype
//* (Update Recored)
//* 2003/10/03 K.Fujii Original version.
//* 2005/02/23 K.Fujii Added GetSortingPolicy().
//*
//*************************************************************************
//
#include "TVSurface.h"
#include "TVector3.h"
#include "TMatrixD.h"
class TVTrack;
//_____________________________________________________________________
// -----------------------------------
// Hype Class
// -----------------------------------
class THype : public TVSurface {
public:
THype(Double_t r = 1., Double_t hlen = 1., Double_t tana = 0.,
Double_t xc = 0., Double_t yc = 0, Double_t zc = 0.)
: fR0(r), fHalfLen(hlen), fXc(xc,yc,zc), fTanA(tana) {}
virtual ~THype() {}
virtual Double_t CalcS (const TVector3 &xx) const;
virtual TMatrixD CalcDSDx(const TVector3 &xx) const;
inline virtual Bool_t IsOnSurface(const TVector3 &xx) const;
inline virtual Bool_t IsOutside (const TVector3 &xx) const;
inline virtual Double_t GetSortingPolicy() const;
inline virtual Double_t GetR0 () const { return fR0; }
inline virtual const TVector3 & GetXc () const { return fXc; }
inline virtual Double_t GetTanA () const { return fTanA; }
inline virtual Double_t GetLength () const;
inline virtual Double_t GetZmin () const;
inline virtual Double_t GetZmax () const;
private:
Double_t fR0; // radius at z = 0.
Double_t fHalfLen; // half length
TVector3 fXc; // center
Double_t fTanA; // tan(stereo angle)
#if __GNUC__ < 4 && !defined(__STRICT_ANSI__)
static const Double_t kTol = 1.e-5; // tolerance
#else
static const Double_t kTol; // tolerance
#endif
ClassDef(THype,1) // hype class
};
//=======================================================
// inline functions
//=======================================================
Double_t THype::GetLength () const
{
return 2*fHalfLen;
}
Double_t THype::GetZmin() const
{
return fXc.Z() - fHalfLen;
}
Double_t THype::GetZmax() const
{
return fXc.Z() + fHalfLen;
}
Bool_t THype::IsOnSurface(const TVector3 &xx) const
{
TVector3 xxc = xx - fXc;
Double_t r = xxc.Perp();
Double_t z = xxc.Z();
Double_t s = r*r - fTanA*fTanA*z*z - fR0*fR0;
return (TMath::Abs(s) < kTol && xx.Z() >= GetZmin() && xx.Z() <= GetZmax());
}
Bool_t THype::IsOutside(const TVector3 &xx) const
{
Double_t r = (xx-fXc).Perp();
Double_t z = xx.Z();
Double_t R2 = fR0*fR0 + fTanA*fTanA*z*z;
return (r*r > R2 || z < GetZmin() || z > GetZmax());
}
Double_t THype::GetSortingPolicy() const
{
return GetR0();
}
#endif