9#ifndef PORTABLE_LAR_SHAPE
20#include "GaudiKernel/Bootstrap.h"
21#include "GaudiKernel/ISvcLocator.h"
22#include "GaudiKernel/IMessageSvc.h"
26#include "CLHEP/Units/PhysicalConstants.h"
27#ifndef PORTABLE_LAR_SHAPE
30#include "G4GeometryTolerance.hh"
36#ifdef DEBUG_LARWHEELSLICESOLID
37G4int LArWheelSliceSolid::Verbose = 0;
54#ifndef PORTABLE_LAR_SHAPE
64#ifndef PORTABLE_LAR_SHAPE
69 if(name.find(
"::Inner") != G4String::npos)
m_Pos =
Inner;
70 else if(name.find(
"::Outer") != G4String::npos)
m_Pos =
Outer;
72 "LArWheelSliceSolid",
"NoPos", FatalException,
73 (std::string(
"Constructor: can't get Inner/Outer from ") + name).c_str()
78 else if(name.find(
"::Glue") != G4String::npos)
m_Type =
Glue;
79 else if(name.find(
"::Lead") != G4String::npos)
m_Type =
Lead;
81 "LArWheelSliceSolid",
"NoType", FatalException,
82 (std::string(
"Constructor: can't get Type from ") + name).c_str()
85 size_t s = name.find(
"Slice");
87 if(G4String::npos != s){
88 slice = (size_t) atoi(name.substr(s + 5, 2).c_str());
90 "LArWheelSliceSolid",
"NoSlice", FatalException,
91 (std::string(
"Constructor: can't get Slice from ") + name).c_str()
95 if(name.find(
"::Pos::") != G4String::npos) zside = 1;
96 else if(name.find(
"::Neg::") != G4String::npos) zside = -1;
98 "LArWheelSliceSolid",
"NoSide", FatalException,
99 (std::string(
"Constructor: can't get zSide from ") + name).c_str()
106#ifndef PORTABLE_LAR_SHAPE
135 "LArWheelSliceSolid",
"WrongCalculatorType", FatalException,
136 "Constructor: external LArWheelCalculator of wrong type provided"
140 const G4String bs_name = name +
"-Bounding";
142#ifdef DEBUG_LARWHEELSLICESOLID
143 const char *venv = getenv(
"LARWHEELSLICESOLID_VERBOSE");
144 if(venv) Verbose = atoi(venv);
145 static bool first =
true;
147 std::cout <<
"The LArWheelSliceSolid build "
148 << __DATE__ <<
" " << __TIME__ << std::endl
149 <<
"LArWheelSliceSolid verbosity level is "
150 << Verbose << std::endl;
163#ifndef PORTABLE_LAR_SHAPE
171 <<
" " << slice <<
" initialized" <<
endmsg);
175 #ifdef DEBUG_LARWHEELSLICESOLID
177 <<
"): slice " << slice <<
", Zmin = " <<
m_Zmin
178 <<
", Zmax = " <<
m_Zmax << std::endl
179 << GetName() << std::endl;
185 if(size <= slice + 1){
187 "LArWheelSliceSolid",
"WrongSlice", FatalException,
188 std::string(
"Constructor: Slice number too big: " + GetName()).c_str()
195 std::array<G4double,2> zPlane{}, rInner{}, rOuter{};
200 std::vector<G4double> zsect;
206 const G4double ainn = (rInner[1] - rInner[0]) / (zPlane[1] - zPlane[0]);
207 const G4double aout = (rOuter[1] - rOuter[0]) / (zPlane[1] - zPlane[0]);
208 const G4double R1inn = ainn * (
m_Zmin - zPlane[0]) + rInner[0];
209 const G4double R1out = aout * (
m_Zmin - zPlane[0]) + rOuter[0];
210 const G4double R2inn = ainn * (
m_Zmax - zPlane[0]) + rInner[0];
211 const G4double R2out = aout * (
m_Zmax - zPlane[0]) + rOuter[0];
214 bs_name +
"Cone",
m_Zmin,
m_Zmax, R1inn, R1out, R2inn, R2out
217 const G4double FanPhiAmplitude = 0.065;
218 const G4double phi_min = CLHEP::halfpi
221 m_Xmax = rOuter[1]*cos(phi_min);
229 std::array<G4double,3> zPlane{}, rInner{}, rOuter{};
234 std::vector<G4double> zsect;
240 const size_t i =
m_Zmax > zPlane[1]? 1: 0;
241 const G4double dz = zPlane[i + 1] - zPlane[i];
242 const G4double ainn = (rInner[i + 1] - rInner[i]) / dz;
243 const G4double aout = (rOuter[i + 1] - rOuter[i]) / dz;
244 const G4double R1inn = ainn * (
m_Zmin - zPlane[i]) + rInner[i];
245 const G4double R1out = aout * (
m_Zmin - zPlane[i]) + rOuter[i];
246 const G4double R2inn = ainn * (
m_Zmax - zPlane[i]) + rInner[i];
247 const G4double R2out = aout * (
m_Zmax - zPlane[i]) + rOuter[i];
250 bs_name +
"Cone",
m_Zmin,
m_Zmax, R1inn, R1out, R2inn, R2out
253 const G4double FanPhiAmplitude = 0.02;
254 const G4double phi_min = CLHEP::halfpi
257 m_Xmax = rOuter[1]*cos(phi_min);
271 zsect.push_back(sss + half_wave_length * 0.25);
272 for(G4int i = 2; i < num_fs; i ++){
273 const G4double zi = half_wave_length * (i - 1) + sss;
274 if(
m_Pos ==
Outer && zsect.back() < zMid && zi > zMid){
275 zsect.push_back(zMid);
279 zsect.push_back(wheel_thickness - sss - half_wave_length * 0.25);
280 zsect.push_back(wheel_thickness);
Definition of the abstract IRDBAccessSvc interface.
Definition of the abstract IRDBRecord interface.
Definition of the abstract IRDBRecordset interface.
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
This class separates some of the geometry details of the LAr endcap.
double GetFanStepOnPhi() const
int GetNumberOfHalfWaves() const
double GetFanHalfThickness(LArG4::LArWheelCalculator_t) const
double GetHalfWaveLength() const
double GetStraightStartSection() const
double GetWheelThickness() const
double GetWheelInnerRadius(std::array< double, 2 > &rInner) const
void GetWheelOuterRadius(std::array< double, 2 > &rOuter) const
static const G4double s_IterationPrecision
const LArWheelCalculator * m_Calculator
void check_slice(size_t size, size_t slice) const
void fill_zsect(std::vector< G4double > &, G4double zMid=0.) const
static const unsigned int s_IterationsLimit
LArWheelSliceSolid(const G4String &name, pos_t pos, type_t type, size_t slice, G4int zside=1, const LArWheelCalculator *calc=0, const EMECData *emecData=0)
void inner_solid_init(const G4String &, size_t slice)
const LArWheelCalculator * GetCalculator(void) const
static const G4double s_Tolerance
G4double m_FanHalfThickness
static const G4double s_IterationPrecision2
void createSolid(const G4String &name, G4int zside, size_t slice, const EMECData *emecData)
static const G4double s_AngularTolerance
G4VSolid * m_BoundingShape
void outer_solid_init(const G4String &, size_t slice)