16 Stat(
const char *
in) :
name(in){};
18 std::cout <<
name <<
": atan0 calls tot/large/over1: " << natan <<
"/" << nlarge <<
"/" << over1 << std::endl;
24 if (
at>0.40
f) ++nlarge;
40 float atan0(
float t) {
46 ((( 8.05374449538e-2
f * z2
47 - 1.38776856032E-1
f) * z2
48 + 1.99777106478E-1
f) * z2
49 - 3.33329491539E-1
f) * z2 * z
56 float atanClip(
float t) {
57 constexpr float tanPi8 = 0.4142135623730950;
58 constexpr float pio8 = 3.141592653589793238/8;
60 return std::copysign( (at< tanPi8 ) ? atan0(at) : pio8, t );
65 TkRadialStripTopology::TkRadialStripTopology(
int ns,
float aw,
float dh,
float r,
int yAx,
float yMid) :
66 theNumberOfStrips(ns), theAngularWidth(aw), theAWidthInverse(1.
f/aw),theTanAW(std::
tan(aw)),
67 theDetHeight(dh), theCentreToIntersection(r),
68 theYAxisOrientation(yAx), yCentre( yMid) {
71 thePhiOfOneEdge = -(0.5*theNumberOfStrips) * theAngularWidth;
73 assert(
std::abs(thePhiOfOneEdge)<0.35);
75 LogTrace(
"TkRadialStripTopology") <<
"TkRadialStripTopology: constructed with"
77 <<
" width = " << aw <<
" rad "
78 <<
" det_height = " << dh
80 <<
" phi_edge = " << thePhiOfOneEdge <<
" rad "
81 <<
" y_ax_ori = " << theYAxisOrientation
82 <<
" y_det_centre = " << yCentre
86 int TkRadialStripTopology::channel(
const LocalPoint& lp)
const {
return std::min(
int( strip(lp) ), theNumberOfStrips-1 ) ;}
88 int TkRadialStripTopology::nearestStrip(
const LocalPoint & lp)
const {
return std::min( nstrips(), static_cast<int>(
std::max(
float(0), strip(lp)) ) + 1);}
90 float TkRadialStripTopology::stripAngle(
float strip)
const {
return yAxisOrientation() * (phiOfOneEdge() + strip * angularWidth()) ;}
92 float TkRadialStripTopology::yDistanceToIntersection(
float y )
const {
return yAxisOrientation()*y + originToIntersection() ;}
94 float TkRadialStripTopology::localStripLength(
const LocalPoint& lp)
const {
98 float TkRadialStripTopology::xOfStrip(
int strip,
float y)
const {
100 yAxisOrientation() * yDistanceToIntersection( y ) *
std::tan( stripAngle(static_cast<float>(strip) - 0.5 ) );
103 float TkRadialStripTopology::strip(
const LocalPoint& lp)
const {
105 const float phi = atanClip(lp.
x()/yDistanceToIntersection(lp.
y()));
106 const float aStrip = ( phi - phiOfOneEdge() )*theAWidthInverse;
110 float TkRadialStripTopology::coveredStrips(
const LocalPoint& lp1,
const LocalPoint& lp2)
const {
113 float t1 = lp1.
x()/yDistanceToIntersection( lp1.
y() );
114 float t2 = lp2.
x()/yDistanceToIntersection( lp2.
y() );
115 float t = (t1-
t2)/(1.+t1*t2);
123 return atanClip(t)*theAWidthInverse;
127 LocalPoint TkRadialStripTopology::localPosition(
float strip)
const {
128 return LocalPoint( yAxisOrientation() * originToIntersection() *
std::tan( stripAngle(strip) ), 0 );
133 y( mp.
y()*detHeight() + yCentreOfStripPlane() ),
134 x( yAxisOrientation() * yDistanceToIntersection( y ) *
std::tan ( stripAngle( mp.
x() ) ) );
141 float t = lp.
x()/yDistanceToIntersection(lp.
y());
145 const float phi = atanClip(t);
147 ( lp.
y() - yCentreOfStripPlane() ) / detHeight() );
150 LocalError TkRadialStripTopology::localError(
float strip,
float stripErr2)
const {
156 tt( stripErr2 *
std::pow( centreToIntersection()*angularWidth() ,2.
f) ),
171 T( angularWidth() * ( centreToIntersection() + yAxisOrientation()*mp.
y()*detHeight()) /
c1 ),
172 R( detHeight()/
c1 ),
186 yHitToInter(yDistanceToIntersection(p.
y())),
187 t(yAxisOrientation() * p.
x() / yHitToInter),
193 uu( ( c2*e.
xx() - 2*
cs*e.
xy() +
s2*e.
yy() ) * T2 ),
194 vv( (
s2*e.
xx() + 2*
cs*e.
xy() + c2*e.
yy() ) * R2 ),
202 float TkRadialStripTopology::localPitch(
const LocalPoint& lp)
const {
204 float y = yDistanceToIntersection( lp.
y() );
206 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)