ATLAS Offline Software
Loading...
Searching...
No Matches
LArWheelCalculator_Impl::ModuleFanCalculator Class Reference

This is an interface of distance calculation to parts of the LAr endcap. More...

#include <ModuleFanCalculator.h>

Inheritance diagram for LArWheelCalculator_Impl::ModuleFanCalculator:
Collaboration diagram for LArWheelCalculator_Impl::ModuleFanCalculator:

Public Member Functions

 ModuleFanCalculator (LArWheelCalculator *lwc)
virtual double DistanceToTheNearestFan (CLHEP::Hep3Vector &p, int &out_fan_number) const
virtual int PhiGapNumberForWheel (int i) const
virtual std::pair< int, int > GetPhiGapAndSide (const CLHEP::Hep3Vector &p) const
const LArWheelCalculatorlwc () const

Private Attributes

LArWheelCalculatorm_lwc

Detailed Description

This is an interface of distance calculation to parts of the LAr endcap.

Definition at line 16 of file ModuleFanCalculator.h.

Constructor & Destructor Documentation

◆ ModuleFanCalculator()

LArWheelCalculator_Impl::ModuleFanCalculator::ModuleFanCalculator ( LArWheelCalculator * lwc)

Definition at line 18 of file ModuleFanCalculator.cxx.

19 : m_lwc(lwc)
20 {
21 }
const LArWheelCalculator * lwc() const

Member Function Documentation

◆ DistanceToTheNearestFan()

double LArWheelCalculator_Impl::ModuleFanCalculator::DistanceToTheNearestFan ( CLHEP::Hep3Vector & p,
int & out_fan_number ) const
virtual

Implements LArWheelCalculator_Impl::IFanCalculator.

Definition at line 23 of file ModuleFanCalculator.cxx.

24 {
25 static const double halfpi=M_PI/2.0;
26 int fan_number = int((p.phi() - halfpi - lwc()->m_ZeroFanPhi_ForDetNeaFan) / lwc()->m_FanStepOnPhi);
27 double angle = lwc()->m_FanStepOnPhi * fan_number + lwc()->m_ZeroFanPhi_ForDetNeaFan;
28#ifdef HARDDEBUG
29 printf("DistanceToTheNearestFan: initial FN %4d\n", fan_number);
30#endif
31 p.rotateZ(-angle);
32 // determine search direction
33 double d0 = lwc()->DistanceToTheNeutralFibre(p, lwc()->adjust_fan_number(fan_number));
34 double d1 = d0;
35 int delta = 1;
36 if(d0 < 0.) delta = -1; // search direction has been determined
37 angle = - lwc()->m_FanStepOnPhi * delta;
38 do { // search:
39 p.rotateZ(angle);
40 fan_number += delta;
41 d1 = lwc()->DistanceToTheNeutralFibre(p, lwc()->adjust_fan_number(fan_number));
42 } while(d0 * d1 > 0.);
43 // if signs of d1 and d0 are different, the point is between current pair
44 if(delta > 0) fan_number --;
45
46 int adj_fan_number = fan_number;
47 if(adj_fan_number < lwc()->m_FirstFan) {
48 p.rotateZ((adj_fan_number - lwc()->m_FirstFan) * lwc()->m_FanStepOnPhi);
49 adj_fan_number = lwc()->m_FirstFan;
50 } else if(adj_fan_number >= lwc()->m_LastFan) {
51 p.rotateZ((adj_fan_number - lwc()->m_LastFan + 1) * lwc()->m_FanStepOnPhi);
52 adj_fan_number = lwc()->m_LastFan - 1;
53 }
54
55 p.rotateZ(-0.5 * angle);
56 out_fan_number = adj_fan_number;
57 return lwc()->DistanceToTheNeutralFibre(p, adj_fan_number);
58 }
#define M_PI
double angle(const GeoTrf::Vector2D &a, const GeoTrf::Vector2D &b)
double DistanceToTheNeutralFibre(const CLHEP::Hep3Vector &p, int fan_number) const
Calculates aproximate, probably underestimate, distance to the neutral fibre of the vertical fan.

◆ GetPhiGapAndSide()

std::pair< int, int > LArWheelCalculator_Impl::ModuleFanCalculator::GetPhiGapAndSide ( const CLHEP::Hep3Vector & p) const
virtual

Implements LArWheelCalculator_Impl::IFanCalculator.

Definition at line 68 of file ModuleFanCalculator.cxx.

69 {
70 // Note: this object was changed from static to local for thread-safety.
71 // If this is found to be too costly we can re-evaluate.
72 CLHEP::Hep3Vector p1 = p;
73 static const double halfpi=M_PI/2.0;
74 int fan_number = int((p.phi() - halfpi - lwc()->m_ZeroFanPhi) / lwc()->m_FanStepOnPhi);
75
76 double angle = lwc()->m_FanStepOnPhi * fan_number + lwc()->m_ZeroFanPhi;
77 p1.rotateZ(-angle);
78
79 double d0 = lwc()->DistanceToTheNeutralFibre(p1, lwc()->adjust_fan_number(fan_number));
80 double d1 = d0;
81
82 int delta = 1;
83 if(d0 < 0.) delta = -1;
84 angle = - lwc()->m_FanStepOnPhi * delta;
85 do {
86 p1.rotateZ(angle);
87 fan_number += delta;
88 d1 = lwc()->DistanceToTheNeutralFibre(p1, lwc()->adjust_fan_number(fan_number));
89 } while(d0 * d1 > 0.);
90 if(delta > 0) fan_number --;
91 if(!lwc()->m_isElectrode) fan_number ++;
92
93 int adj_fan_number = fan_number;
94 if(adj_fan_number < lwc()->m_FirstFan) adj_fan_number = lwc()->m_FirstFan - 1;
95 else if(adj_fan_number > lwc()->m_LastFan) adj_fan_number = lwc()->m_LastFan;
96
97 p1.rotateZ(-0.5 * angle);
98 double dd = lwc()->DistanceToTheNeutralFibre(p1, adj_fan_number);
99 int side = dd < 0.? -1: 1;
100#ifdef HARDDEBUG
101 printf("GetPhiGapAndSide: MFN %4d\n", adj_fan_number);
102#endif
103 return std::pair<int, int>(adj_fan_number, side);
104 }

◆ lwc()

const LArWheelCalculator * LArWheelCalculator_Impl::ModuleFanCalculator::lwc ( ) const
inline

Definition at line 26 of file ModuleFanCalculator.h.

26{ return m_lwc; };

◆ PhiGapNumberForWheel()

int LArWheelCalculator_Impl::ModuleFanCalculator::PhiGapNumberForWheel ( int i) const
virtual

Implements LArWheelCalculator_Impl::IFanCalculator.

Definition at line 60 of file ModuleFanCalculator.cxx.

60 {
61 i += lwc()->m_ZeroGapNumber;
62 i -= lwc()->m_LastFan / 2;
63 if(i < 0) i += lwc()->m_NumberOfFans;
64 if(i >= lwc()->m_NumberOfFans) i -= lwc()->m_NumberOfFans;
65 return i;
66 }

Member Data Documentation

◆ m_lwc

LArWheelCalculator* LArWheelCalculator_Impl::ModuleFanCalculator::m_lwc
private

Definition at line 29 of file ModuleFanCalculator.h.


The documentation for this class was generated from the following files: