ATLAS Offline Software
LArWheelCalculatorGeometry.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "CxxUtils/sincos.h"
6 //#include <cmath>
7 #include <climits>
8 #include <cassert>
9 #include <iostream>
10 
14 #include "GeoModelKernel/Units.h"
15 #ifdef HARDDEBUG
16 #include<stdio.h>
17 #endif
18 
19 using namespace GeoModelKernelUnits;
20 
21 void LArWheelCalculator::parameterized_sin(const double r, double &sin_a, double &cos_a) const
22 {
23  const double r2 = r*r;
24  const double r3 = r2*r;
25  const double r4 = r2*r2;
26 #if LARWC_SINCOS_POLY > 4
27  const double r5 = r4*r;
28 #endif
29  sin_a = m_sin_parametrization[0]
30  + m_sin_parametrization[1]*r
31  + m_sin_parametrization[2]*r2
32  + m_sin_parametrization[3]*r3
33  + m_sin_parametrization[4]*r4
34 #if LARWC_SINCOS_POLY > 4
35  + m_sin_parametrization[5]*r5
36 #endif
37  ;
38  cos_a = sqrt(1. - sin_a*sin_a);
39 }
40 
41 void LArWheelCalculator::parameterized_sincos(const double r, double &sin_a, double &cos_a) const
42 {
43  const double r2 = r*r;
44  const double r3 = r2*r;
45  const double r4 = r2*r2;
46 #if LARWC_SINCOS_POLY > 4
47  const double r5 = r4*r;
48 #endif
49  sin_a = m_sin_parametrization[0]
50  + m_sin_parametrization[1]*r
51  + m_sin_parametrization[2]*r2
52  + m_sin_parametrization[3]*r3
53  + m_sin_parametrization[4]*r4
54 #if LARWC_SINCOS_POLY > 4
55  + m_sin_parametrization[5]*r5
56 #endif
57  ;
58  cos_a = m_cos_parametrization[0]
59  + m_cos_parametrization[1]*r
60  + m_cos_parametrization[2]*r2
61  + m_cos_parametrization[3]*r3
62  + m_cos_parametrization[4]*r4
63 #if LARWC_SINCOS_POLY > 4
64  + m_cos_parametrization[5]*r5
65 #endif
66  ;
67 }
68 
69 // calculates wave slant angle using parametrization for current wheel
70 // for given distance from calorimeter axis
72 {
73  const double r2 = r*r;
74  const double r3 = r2*r;
75  const double r4 = r2*r2;
76  const double result = m_slant_parametrization[0] +
77  r*m_slant_parametrization[1] +
78  r2*m_slant_parametrization[2] +
79  r3*m_slant_parametrization[3] +
80  r4*m_slant_parametrization[4];
81  return result*deg;
82 }
83 
84 // Determines the nearest to the input point fan.
85 // Relays on the fact that each two fans have a fan of a different type between
86 // them.
87 // Returns distance to the nearest fan. Vector p is set to nearest fan coord.
88 // system.
89 // m_fan_number is set to nearest fan number
90 double LArWheelCalculator::DistanceToTheNearestFan(CLHEP::Hep3Vector &p, int & out_fan_number) const
91 {
92  return m_fanCalcImpl->DistanceToTheNearestFan(p, out_fan_number);
93 }
94 
95 // Relays on the fact that each two fans have a fan of a different type between
96 // them.
97 // Affects m_fan_number.
98 std::pair<int, int> LArWheelCalculator::GetPhiGapAndSide(const CLHEP::Hep3Vector &p) const
99 {
100  return m_fanCalcImpl->GetPhiGapAndSide(p);
101 }
102 
103 // Represents aproximate, probably underestimate, distance to the
104 // neutral fibre of the vertical fan. Sign of return value means
105 // side of the fan; negative - lower phi.
106 //
107 // Uses m_fan_number to compute sagging.
108 double LArWheelCalculator::DistanceToTheNeutralFibre(const CLHEP::Hep3Vector& P, int fan_number) const
109 {
110  return m_distanceCalcImpl->DistanceToTheNeutralFibre(P, fan_number);
111 }
112 
113 CLHEP::Hep3Vector LArWheelCalculator::NearestPointOnNeutralFibre(const CLHEP::Hep3Vector &P, int fan_number) const
114 {
115  return m_distanceCalcImpl->NearestPointOnNeutralFibre(P, fan_number);
116 }
117 
118 std::vector<double> LArWheelCalculator::NearestPointOnNeutralFibre_asVector(const CLHEP::Hep3Vector &p, int fan_number) const
119 {
120  CLHEP::Hep3Vector np = NearestPointOnNeutralFibre(p, fan_number);
121  return std::vector<double> { np.x(), np.y(), np.z() };
122 }
123 
124 /*
125 input is in local fan's coordinate system
126 side: < 0 - lower phi
127  > 0 - greater phi
128  = 0 - neutral fibre
129 */
130 double LArWheelCalculator::AmplitudeOfSurface(const CLHEP::Hep3Vector& P, int side, int fan_number) const
131 {
132  return m_distanceCalcImpl->AmplitudeOfSurface(P, side, fan_number);
133 }
beamspotman.r
def r
Definition: beamspotman.py:676
IDistanceCalculator.h
get_generator_info.result
result
Definition: get_generator_info.py:21
DMTest::P
P_v1 P
Definition: P.h:23
LArWheelCalculator::parameterized_slant_angle
double parameterized_slant_angle(double) const
Calculates wave slant angle using parametrization for current wheel for given distance from calorimet...
Definition: LArWheelCalculatorGeometry.cxx:71
sincos.h
Helper to simultaneously calculate sin and cos of the same angle.
deg
#define deg
Definition: SbPolyhedron.cxx:17
IFanCalculator.h
LArWheelCalculator::NearestPointOnNeutralFibre_asVector
std::vector< double > NearestPointOnNeutralFibre_asVector(const CLHEP::Hep3Vector &p, int fan_number) const
Definition: LArWheelCalculatorGeometry.cxx:118
PlotPulseshapeFromCool.np
np
Definition: PlotPulseshapeFromCool.py:64
LArWheelCalculator::parameterized_sincos
void parameterized_sincos(const double, double &, double &) const
Definition: LArWheelCalculatorGeometry.cxx:41
TRT::Hit::side
@ side
Definition: HitInfo.h:83
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
LArWheelCalculator::parameterized_sin
void parameterized_sin(const double, double &, double &) const
Definition: LArWheelCalculatorGeometry.cxx:21
LArWheelCalculator::GetPhiGapAndSide
std::pair< int, int > GetPhiGapAndSide(const CLHEP::Hep3Vector &p) const
Definition: LArWheelCalculatorGeometry.cxx:98
LArWheelCalculator::AmplitudeOfSurface
double AmplitudeOfSurface(const CLHEP::Hep3Vector &P, int side, int fan_number) const
Definition: LArWheelCalculatorGeometry.cxx:130
LArWheelCalculator::DistanceToTheNearestFan
double DistanceToTheNearestFan(CLHEP::Hep3Vector &p, int &out_fan_number) const
Determines the nearest to the input point fan.
Definition: LArWheelCalculatorGeometry.cxx:90
LArWheelCalculator::NearestPointOnNeutralFibre
CLHEP::Hep3Vector NearestPointOnNeutralFibre(const CLHEP::Hep3Vector &p, int fan_number) const
Definition: LArWheelCalculatorGeometry.cxx:113
LArWheelCalculator::DistanceToTheNeutralFibre
double DistanceToTheNeutralFibre(const CLHEP::Hep3Vector &p, int fan_number) const
Calculates aproximate, probably underestimate, distance to the neutral fibre of the vertical fan.
Definition: LArWheelCalculatorGeometry.cxx:108
LArWheelCalculator.h