29 {
34
35#ifdef LWC_PARAM_ANGLE
37
38
39 CxxUtils::sincos scalpha(alpha);
40 const double cos_a = scalpha.cs, sin_a = scalpha.sn;
41#else
42 double cos_a, sin_a;
43 lwc()->m_vsincos_par.eval(
P.y(), sin_a, cos_a);
44#endif
45
46 int nqwave = (
z < 0.) ? 0 :
int(
z /
lwc()->m_QuarterWaveLength);
47
48
49
50 bool begin_qw = false;
51 if((nqwave % 2) != 0){
52 nqwave ++;
53 begin_qw = true;
54 }
55
56 nqwave /= 2;
57
58
59
60
61
62 if(nqwave != 0 && nqwave !=
lwc()->m_NumberOfHalfWaves){
64
65 if((nqwave % 2) == 0)
x = -
x;
66 if(begin_qw){
69 }
70
71
72 const double z_prime =
z * cos_a +
x * sin_a;
73 const double x_prime =
x * cos_a -
z * sin_a;
75 if(z_prime > straight_part){
76 const double dz = straight_part - z_prime;
79 } else if(z_prime > -straight_part){
81 } else {
82 const double dz = straight_part + z_prime;
85 }
86
89
90 } else {
91 if(nqwave == 0) {
93 } else {
95 }
96
97 const double tan_beta = sin_a/(1.0 + cos_a);
99 if(
z < - local_straight_section &&
100 (
x <
lwc()->m_FanFoldRadius ||
101 x < -
lwc()->m_StraightStartSection *
z / local_straight_section / tan_beta ) )
102 {
104 }
105 else {
106 const double z_prime =
z * cos_a +
x * sin_a;
107 const double x_prime =
x * cos_a -
z * sin_a;
108 if (z_prime < local_straight_section) {
109 const double dz = local_straight_section - z_prime;
112 } else {
114 if (z_prime <= straight_part) {
116 } else {
117 const double dz = straight_part - z_prime;
120 }
121 }
122 }
123
125 }
126#ifdef HARDDEBUG
128 if(fabs(dd - distance) > 0.000001){
129
130 std::cout <<
"DTNF MISMATCH " <<
this <<
" " <<
P <<
" "
131 << dd <<
" vs " <<
distance << std::endl;
132
133
134 }
135#endif
137 }
virtual double DistanceToTheNeutralFibre_ref(const CLHEP::Hep3Vector &p, int fan_number) const
double m_StraightStartSection
double m_QuarterWaveLength
double parameterized_slant_angle(double) const
Calculates wave slant angle using parametrization for current wheel for given distance from calorimet...
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space