ATLAS Offline Software
Loading...
Searching...
No Matches
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
19using namespace GeoModelKernelUnits;
20
21void 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]
34#if LARWC_SINCOS_POLY > 4
36#endif
37 ;
38 cos_a = sqrt(1. - sin_a*sin_a);
39}
40
41void 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]
54#if LARWC_SINCOS_POLY > 4
56#endif
57 ;
58 cos_a = m_cos_parametrization[0]
63#if LARWC_SINCOS_POLY > 4
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] +
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
90double 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.
98std::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.
108double LArWheelCalculator::DistanceToTheNeutralFibre(const CLHEP::Hep3Vector& P, int fan_number) const
109{
110 return m_distanceCalcImpl->DistanceToTheNeutralFibre(P, fan_number);
111}
112
113CLHEP::Hep3Vector LArWheelCalculator::NearestPointOnNeutralFibre(const CLHEP::Hep3Vector &P, int fan_number) const
114{
115 return m_distanceCalcImpl->NearestPointOnNeutralFibre(P, fan_number);
116}
117
118std::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/*
125input is in local fan's coordinate system
126side: < 0 - lower phi
127 > 0 - greater phi
128 = 0 - neutral fibre
129*/
130double LArWheelCalculator::AmplitudeOfSurface(const CLHEP::Hep3Vector& P, int side, int fan_number) const
131{
132 return m_distanceCalcImpl->AmplitudeOfSurface(P, side, fan_number);
133}
static Double_t P(Double_t *tt, Double_t *par)
#define deg
CLHEP::Hep3Vector NearestPointOnNeutralFibre(const CLHEP::Hep3Vector &p, int fan_number) const
std::array< double, LARWC_SINCOS_POLY+1 > m_cos_parametrization
std::pair< int, int > GetPhiGapAndSide(const CLHEP::Hep3Vector &p) const
double AmplitudeOfSurface(const CLHEP::Hep3Vector &P, int side, int fan_number) const
double DistanceToTheNeutralFibre(const CLHEP::Hep3Vector &p, int fan_number) const
Calculates aproximate, probably underestimate, distance to the neutral fibre of the vertical fan.
std::array< double, 5 > m_slant_parametrization
double DistanceToTheNearestFan(CLHEP::Hep3Vector &p, int &out_fan_number) const
Determines the nearest to the input point fan.
void parameterized_sin(const double, double &, double &) const
LArWheelCalculator_Impl::IFanCalculator * m_fanCalcImpl
void parameterized_sincos(const double, double &, double &) const
double parameterized_slant_angle(double) const
Calculates wave slant angle using parametrization for current wheel for given distance from calorimet...
std::array< double, LARWC_SINCOS_POLY+1 > m_sin_parametrization
LArWheelCalculator_Impl::IDistanceCalculator * m_distanceCalcImpl
std::vector< double > NearestPointOnNeutralFibre_asVector(const CLHEP::Hep3Vector &p, int fan_number) const
int r
Definition globals.cxx:22
Helper to simultaneously calculate sin and cos of the same angle.