9 #include <vdt/vdtMath.h>
18 Stat(
const char *
in) :
name(in){};
20 std::cout <<
name <<
": atan0 calls tot/large/over1: " << natan <<
"/" << nlarge <<
"/" << over1 << std::endl;
26 if (
at>0.40
f) ++nlarge;
41 inline double tan15(
double x) {
42 return x * (1 + (x*
x) * (0.33331906795501708984375 + (x*x) * 0.135160386562347412109375));
48 float atan0(
float t) {
54 ((( 8.05374449538e-2
f * z2
55 - 1.38776856032E-1
f) * z2
56 + 1.99777106478E-1
f) * z2
57 - 3.33329491539E-1
f) * z2 * z
64 float atanClip(
float t) {
65 constexpr float tanPi8 = 0.4142135623730950;
66 constexpr float pio8 = 3.141592653589793238/8;
68 return std::copysign( (at< tanPi8 ) ? atan0(at) : pio8, t );
73 TkRadialStripTopology::TkRadialStripTopology(
int ns,
float aw,
float dh,
float r,
int yAx,
float yMid) :
74 theNumberOfStrips(ns), theAngularWidth(aw), theAWidthInverse(1.
f/aw),theTanAW(std::
tan(aw)),
75 theDetHeight(dh), theCentreToIntersection(r),
76 theYAxisOrientation(yAx), yCentre( yMid),
77 theRadialSigma(std::
pow(dh, 2.
f) * (1.
f/12.
f)) {
80 thePhiOfOneEdge = -(0.5*theNumberOfStrips) * theAngularWidth;
82 assert(
std::abs(thePhiOfOneEdge)<0.15);
84 LogTrace(
"TkRadialStripTopology") <<
"TkRadialStripTopology: constructed with"
86 <<
" width = " << aw <<
" rad "
87 <<
" det_height = " << dh
89 <<
" phi_edge = " << thePhiOfOneEdge <<
" rad "
90 <<
" y_ax_ori = " << theYAxisOrientation
91 <<
" y_det_centre = " << yCentre
95 int TkRadialStripTopology::channel(
const LocalPoint& lp)
const {
return std::min(
int( strip(lp) ), theNumberOfStrips-1 ) ;}
97 int TkRadialStripTopology::nearestStrip(
const LocalPoint & lp)
const {
return std::min( nstrips(), static_cast<int>(
std::max(
float(0), strip(lp)) ) + 1);}
99 float TkRadialStripTopology::yDistanceToIntersection(
float y )
const {
return yAxisOrientation()*y + originToIntersection() ;}
101 float TkRadialStripTopology::localStripLength(
const LocalPoint& lp)
const {
105 float TkRadialStripTopology::xOfStrip(
int strip,
float y)
const {
107 yAxisOrientation() * yDistanceToIntersection( y ) *
std::tan( stripAngle(static_cast<float>(strip) - 0.5 ) );
110 float TkRadialStripTopology::strip(
const LocalPoint& lp)
const {
112 const float phi = atanClip(lp.
x()/yDistanceToIntersection(lp.
y()));
113 const float aStrip = ( phi - phiOfOneEdge() )*theAWidthInverse;
117 float TkRadialStripTopology::coveredStrips(
const LocalPoint& lp1,
const LocalPoint& lp2)
const {
120 float t1 = lp1.
x()/yDistanceToIntersection( lp1.
y() );
121 float t2 = lp2.
x()/yDistanceToIntersection( lp2.
y() );
122 float t = (t1-
t2)/(1.+t1*t2);
130 return atanClip(t)*theAWidthInverse;
134 LocalPoint TkRadialStripTopology::localPosition(
float strip)
const {
135 return LocalPoint( yAxisOrientation() * originToIntersection() *
std::tan( stripAngle(strip) ), 0 );
140 y( mp.
y()*detHeight() + yCentreOfStripPlane() ),
141 x( yAxisOrientation() * yDistanceToIntersection( y ) *
std::tan ( stripAngle( mp.
x() ) ) );
148 float t = lp.
x()/yDistanceToIntersection(lp.
y());
152 const float phi = atanClip(t);
154 ( lp.
y() - yCentreOfStripPlane() ) / detHeight() );
158 LocalError TkRadialStripTopology::localError(
float strip,
float stripErr2)
const {
159 double phi = stripAngle(strip);
167 tt( stripErr2 *
std::pow( centreToIntersection()*angularWidth() ,2.
f) ),
182 T( angularWidth() * ( centreToIntersection() + yAxisOrientation()*mp.
y()*detHeight()) /
c1 ),
183 R( detHeight()/
c1 ),
197 yHitToInter(yDistanceToIntersection(p.
y())),
198 t(yAxisOrientation() * p.
x() / yHitToInter),
204 uu( ( c2*e.
xx() - 2*
cs*e.
xy() +
s2*e.
yy() ) * T2 ),
205 vv( (
s2*e.
xx() + 2*
cs*e.
xy() + c2*e.
yy() ) * R2 ),
213 float TkRadialStripTopology::localPitch(
const LocalPoint& lp)
const {
215 float y = yDistanceToIntersection( lp.
y() );
217 return y*(y*theTanAW+
x)/(y-theTanAW*x)-
x;
auto_ptr< ClusterSequence > cs
Sin< T >::type sin(const T &t)
void add(const std::vector< const T * > &source, std::vector< const T * > &dest)
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
const T & max(const T &a, const T &b)
auto const T2 &decltype(t1.eta()) t2
Cos< T >::type cos(const T &t)
Tan< T >::type tan(const T &t)
Abs< T >::type abs(const T &t)
Power< A, B >::type pow(const A &a, const B &b)