ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
DetectorDescription
GeoModel
GeoSpecialShapes
src
LArWheelCalculator_Impl
DistanceCalculatorSaggingOn.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#ifndef PORTABLE_LAR_SHAPE
6
#include "GaudiKernel/MsgStream.h"
7
#include "GaudiKernel/ISvcLocator.h"
8
#include "GaudiKernel/Bootstrap.h"
9
#else
10
#include "
PortableMsgStream/PortableMsgStream.h
"
11
#endif
12
#include "
DistanceCalculatorSaggingOn.h
"
13
#include "CLHEP/Vector/ThreeVector.h"
14
15
#include <vector>
16
#include <stdexcept>
17
18
#include "
GeoSpecialShapes/LArWheelCalculator.h
"
19
20
#include "GeoModelKernel/Units.h"
21
22
using
GeoModelKernelUnits::mm;
23
24
25
namespace
LArWheelCalculator_Impl
26
{
27
DistanceCalculatorSaggingOn::DistanceCalculatorSaggingOn
(
const
std::string& saggingOptions,
28
LArWheelCalculator
*
lwc
)
29
:
parent
(
lwc
),
30
m_saggingOptions
(saggingOptions)
31
32
{
33
init_sagging_parameters
();
34
}
35
36
void
DistanceCalculatorSaggingOn::init_sagging_parameters
()
37
{
38
39
// Get pointer to the message service
40
#ifndef PORTABLE_LAR_SHAPE
41
SmartIF<IMessageSvc> msgSvc{Gaudi::svcLocator()->service(
"MessageSvc"
)};
42
if
(!msgSvc.isValid()) {
43
throw
std::runtime_error(
"LArWheelCalculator constructor: cannot initialze message service"
);
44
}
45
MsgStream
msg
(msgSvc,
"LArWheelCalculator_Impl::DistanceCalculatorSaggingOn"
);
46
#else
47
PortableMsgStream
msg
(
"LArWheelCalculator_Impl::DistanceCalculatorSaggingOn"
);
48
#endif
49
std::string sagging_opt_value =
m_saggingOptions
;
50
m_sagging_parameter
.resize (
lwc
()->m_NumberOfFans, std::vector<double> (5, 0.));
51
// if(m_SaggingOn) {
52
if
(sagging_opt_value.substr(0, 4) ==
"file"
){
53
std::string sag_file = sagging_opt_value.substr(5);
54
msg
<< MSG::DEBUG
55
<<
"geting sagging parameters from file "
56
<< sag_file <<
" ..."
<<
endmsg
;
57
FILE *
F
= fopen(sag_file.c_str(),
"r"
);
58
if
(
F
== 0){
59
msg
<< MSG::FATAL
60
<<
"cannot open EMEC sagging parameters file "
61
<< sag_file
62
<<
endmsg
;
63
throw
std::runtime_error(
"LArWheelCalculator: read sagging parameters from file"
);
64
}
65
int
s, w, t, n;
66
double
p0, p1, p2, p3, p4;
67
while
(!feof(
F
) &&
68
fscanf(
F
,
"%80d %80d %80d %80d %80le %80le %80le %80le %80le"
,
69
&s, &w, &t, &n, &p0, &p1, &p2, &p3, &p4) == 9)
70
{
71
if
(s ==
lwc
()->m_AtlasZside &&
72
((w == 0 &&
lwc
()->m_isInner) || (w == 1 && !
lwc
()->m_isInner)) &&
73
((t == 0 && !
lwc
()->m_isElectrode) || (t == 1 &&
lwc
()->m_isElectrode)) &&
74
(n >= 0 && n <
lwc
()->m_NumberOfFans))
75
{
76
m_sagging_parameter
[n][0] = p0;
77
m_sagging_parameter
[n][1] = p1;
78
m_sagging_parameter
[n][2] = p2;
79
m_sagging_parameter
[n][3] = p3;
80
m_sagging_parameter
[n][4] = p4;
81
msg
<< MSG::VERBOSE
82
<<
"sagging for "
<< s <<
" "
<< w <<
" "
<< t
83
<<
" "
<< n <<
": "
<< p0 <<
" "
<< p1 <<
" "
84
<< p2 <<
" "
<< p3 <<
endmsg
;
85
}
86
}
87
fclose(
F
);
88
}
else
{
89
double
a
, b, c, d;
90
if
(sscanf(sagging_opt_value.c_str(),
"%80le %80le %80le %80le"
, &
a
, &b, &c, &d) != 4){
91
msg
<< MSG::ERROR
92
<<
"wrong value(s) "
93
<<
" for EMEC sagging parameters: "
94
<< sagging_opt_value <<
", defaults are used"
<<
endmsg
;
95
}
else
{
96
for
(
int
j = 0; j <
lwc
()->
m_NumberOfFans
; j ++){
97
if
(
lwc
()->m_isInner){
98
m_sagging_parameter
[j][1] =
a
;
99
m_sagging_parameter
[j][0] = b * mm;
100
}
else
{
101
m_sagging_parameter
[j][1] = c;
102
m_sagging_parameter
[j][0] = d * mm;
103
}
104
}
105
}
106
}
107
// }
108
msg
<< MSG::INFO <<
"Sagging parameters : "
<<
m_sagging_parameter
[0][0] <<
" "
<<
m_sagging_parameter
[0][1] <<
endmsg
109
<<
"Sagging parameters : "
<<
m_sagging_parameter
[1][0] <<
" "
<<
m_sagging_parameter
[1][1] <<
endmsg
;
110
}
111
112
// Represents aproximate, probably underestimate, distance to the
113
// neutral fibre of the vertical fan. Sign of return value means
114
// side of the fan; negative - lower phi.
115
//
116
// Uses m_fan_number to compute sagging.
117
double
DistanceCalculatorSaggingOn::DistanceToTheNeutralFibre
(
const
CLHEP::Hep3Vector &p,
int
fan_number)
const
{
118
CLHEP::Hep3Vector sagging_corrected( p.x()+
get_sagging
(p, fan_number), p.y(), p.z() );
119
return
parent::DistanceToTheNeutralFibre
(sagging_corrected, fan_number);
120
}
121
122
CLHEP::Hep3Vector
DistanceCalculatorSaggingOn::NearestPointOnNeutralFibre
(
const
CLHEP::Hep3Vector &p,
int
fan_number)
const
{
123
CLHEP::Hep3Vector sagging_corrected( p.x()+
get_sagging
(p, fan_number), p.y(), p.z() );
124
return
parent::NearestPointOnNeutralFibre
(sagging_corrected, fan_number);
125
}
126
127
double
DistanceCalculatorSaggingOn::AmplitudeOfSurface
(
const
CLHEP::Hep3Vector& p,
int
side,
int
fan_number)
const
{
128
return
parent::AmplitudeOfSurface
(p, side, fan_number) -
get_sagging
(p, fan_number);
129
}
130
131
132
// the function uses m_fan_number for phi-dependent sagging computation
133
double
DistanceCalculatorSaggingOn::get_sagging
(
const
CLHEP::Hep3Vector &
P
,
int
fan_number)
const
{
134
#ifdef HARDDEBUG
135
std::cout <<
"get_sagging: MFN = "
<< fan_number << std::endl;
136
#endif
137
double
dx =
P
.z() /
lwc
()->
m_HalfWheelThickness
- 1.;
138
dx *= dx;
139
dx = 1. - dx;
140
//dx *= SaggingAmplitude * sin(FanStepOnPhi * m_fan_number + ZeroFanPhi);
141
//int n = m_fan_number;
142
//if(n < 0) n += m_NumberOfFans;
143
//n += m_ZeroGapNumber;
144
//if(n >= m_NumberOfFans) n -= m_NumberOfFans;
145
//const std::vector<double>& sp = m_sagging_parameter[n];
146
const
std::vector<double>&
sp
=
m_sagging_parameter
[fan_number];
147
double
R =
P
.r() / mm;
148
double
r
= R;
149
double
result =
sp
[0];
150
result += R *
sp
[1];
151
R *=
r
;
152
result += R *
sp
[2];
153
R *=
r
;
154
result += R *
sp
[3];
155
R *=
r
;
156
result += R *
sp
[4];
157
158
#ifdef HARDDEBUG
159
/*printf("get_sagging: (%6.3f, %6.3f, %6.3f) %6.3f; MFN %4d;"
160
"n %3d; sp %6.4f %6.4f; dx %6.3f; %.6f\n", P.x()/mm, P.y()/mm, P.z()/mm,
161
r, m_fan_number, n, sp[0], sp[1], dx, result*dx);*/
162
printf(
"get_sagging: (%6.3f, %6.3f, %6.3f) %6.3f;"
163
" sp %6.4f %6.4f; dx %6.3f; %.6f\n"
,
P
.x()/mm,
P
.y()/mm,
P
.z()/mm,
164
r
,
sp
[0],
sp
[1], dx, result*dx);
165
#endif
//HARDDEBUG
166
167
return
result * dx;
168
}
169
170
}
endmsg
#define endmsg
Definition
AnalysisConfig_Ntuple.cxx:54
DistanceCalculatorSaggingOn.h
sp
static Double_t sp
Definition
LArPhysWaveHECTool.cxx:37
a
static Double_t a
Definition
LArPhysWaveHECTool.cxx:38
P
static Double_t P(Double_t *tt, Double_t *par)
Definition
LArPhysWaveHECTool.cxx:280
LArWheelCalculator.h
F
#define F(x, y, z)
Definition
MD5.cxx:112
PortableMsgStream.h
LArWheelCalculator_Impl::DistanceCalculatorSaggingOff::DistanceToTheNeutralFibre
virtual double DistanceToTheNeutralFibre(const CLHEP::Hep3Vector &p, int fan_number) const
Definition
DistanceCalculatorSaggingOff.cxx:139
LArWheelCalculator_Impl::DistanceCalculatorSaggingOff::NearestPointOnNeutralFibre
virtual CLHEP::Hep3Vector NearestPointOnNeutralFibre(const CLHEP::Hep3Vector &p, int fan_number) const
Definition
DistanceCalculatorSaggingOff.cxx:226
LArWheelCalculator_Impl::DistanceCalculatorSaggingOff::lwc
const LArWheelCalculator * lwc() const
Return the calculator:
Definition
DistanceCalculatorSaggingOff.h:38
LArWheelCalculator_Impl::DistanceCalculatorSaggingOff::AmplitudeOfSurface
virtual double AmplitudeOfSurface(const CLHEP::Hep3Vector &P, int side, int fan_number) const
Definition
DistanceCalculatorSaggingOff.cxx:407
LArWheelCalculator_Impl::DistanceCalculatorSaggingOn::m_sagging_parameter
std::vector< std::vector< double > > m_sagging_parameter
Definition
DistanceCalculatorSaggingOn.h:41
LArWheelCalculator_Impl::DistanceCalculatorSaggingOn::DistanceCalculatorSaggingOn
DistanceCalculatorSaggingOn(const std::string &saggingOptions, LArWheelCalculator *lwc)
Constructor.
Definition
DistanceCalculatorSaggingOn.cxx:27
LArWheelCalculator_Impl::DistanceCalculatorSaggingOn::parent
DistanceCalculatorSaggingOff parent
Definition
DistanceCalculatorSaggingOn.h:23
LArWheelCalculator_Impl::DistanceCalculatorSaggingOn::m_saggingOptions
std::string m_saggingOptions
Definition
DistanceCalculatorSaggingOn.h:42
LArWheelCalculator_Impl::DistanceCalculatorSaggingOn::DistanceToTheNeutralFibre
virtual double DistanceToTheNeutralFibre(const CLHEP::Hep3Vector &p, int fan_number) const
Definition
DistanceCalculatorSaggingOn.cxx:117
LArWheelCalculator_Impl::DistanceCalculatorSaggingOn::NearestPointOnNeutralFibre
virtual CLHEP::Hep3Vector NearestPointOnNeutralFibre(const CLHEP::Hep3Vector &p, int fan_number) const
Definition
DistanceCalculatorSaggingOn.cxx:122
LArWheelCalculator_Impl::DistanceCalculatorSaggingOn::get_sagging
double get_sagging(const CLHEP::Hep3Vector &P, int fan_number) const
Definition
DistanceCalculatorSaggingOn.cxx:133
LArWheelCalculator_Impl::DistanceCalculatorSaggingOn::init_sagging_parameters
void init_sagging_parameters()
Definition
DistanceCalculatorSaggingOn.cxx:36
LArWheelCalculator_Impl::DistanceCalculatorSaggingOn::AmplitudeOfSurface
virtual double AmplitudeOfSurface(const CLHEP::Hep3Vector &P, int side, int fan_number) const
Definition
DistanceCalculatorSaggingOn.cxx:127
LArWheelCalculator
This class separates some of the geometry details of the LAr endcap.
Definition
LArWheelCalculator.h:57
LArWheelCalculator::m_NumberOfFans
int m_NumberOfFans
Definition
LArWheelCalculator.h:177
LArWheelCalculator::m_HalfWheelThickness
double m_HalfWheelThickness
Definition
LArWheelCalculator.h:166
r
int r
Definition
globals.cxx:22
LArWheelCalculator_Impl
Definition
LArWheelCalculator.h:40
msg
MsgStream & msg
Definition
testRead.cxx:32
Generated on
for ATLAS Offline Software by
1.17.0