5#ifndef PORTABLE_LAR_SHAPE
6 #include "GaudiKernel/MsgStream.h"
7 #include "GaudiKernel/ISvcLocator.h"
8 #include "GaudiKernel/Bootstrap.h"
13#include "CLHEP/Vector/ThreeVector.h"
20#include "GeoModelKernel/Units.h"
22using GeoModelKernelUnits::mm;
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");
45 MsgStream
msg(msgSvc,
"LArWheelCalculator_Impl::DistanceCalculatorSaggingOn");
47 PortableMsgStream
msg(
"LArWheelCalculator_Impl::DistanceCalculatorSaggingOn");
52 if(sagging_opt_value.substr(0, 4) ==
"file"){
53 std::string sag_file = sagging_opt_value.substr(5);
55 <<
"geting sagging parameters from file "
56 << sag_file <<
" ..." <<
endmsg;
57 FILE *
F = fopen(sag_file.c_str(),
"r");
60 <<
"cannot open EMEC sagging parameters file "
63 throw std::runtime_error(
"LArWheelCalculator: read sagging parameters from file");
66 double p0, p1, p2, p3, p4;
68 fscanf(
F,
"%80d %80d %80d %80d %80le %80le %80le %80le %80le",
69 &s, &w, &t, &n, &p0, &p1, &p2, &p3, &p4) == 9)
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))
82 <<
"sagging for " << s <<
" " << w <<
" " << t
83 <<
" " << n <<
": " << p0 <<
" " << p1 <<
" "
84 << p2 <<
" " << p3 <<
endmsg;
90 if(sscanf(sagging_opt_value.c_str(),
"%80le %80le %80le %80le", &
a, &b, &c, &d) != 4){
93 <<
" for EMEC sagging parameters: "
94 << sagging_opt_value <<
", defaults are used" <<
endmsg;
118 CLHEP::Hep3Vector sagging_corrected( p.x()+
get_sagging(p, fan_number), p.y(), p.z() );
123 CLHEP::Hep3Vector sagging_corrected( p.x()+
get_sagging(p, fan_number), p.y(), p.z() );
135 std::cout <<
"get_sagging: MFN = " << fan_number << std::endl;
147 double R =
P.r() / mm;
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,
virtual double DistanceToTheNeutralFibre(const CLHEP::Hep3Vector &p, int fan_number) const
virtual CLHEP::Hep3Vector NearestPointOnNeutralFibre(const CLHEP::Hep3Vector &p, int fan_number) const
const LArWheelCalculator * lwc() const
Return the calculator:
virtual double AmplitudeOfSurface(const CLHEP::Hep3Vector &P, int side, int fan_number) const
std::vector< std::vector< double > > m_sagging_parameter
DistanceCalculatorSaggingOn(const std::string &saggingOptions, LArWheelCalculator *lwc)
Constructor.
DistanceCalculatorSaggingOff parent
std::string m_saggingOptions
virtual double DistanceToTheNeutralFibre(const CLHEP::Hep3Vector &p, int fan_number) const
virtual CLHEP::Hep3Vector NearestPointOnNeutralFibre(const CLHEP::Hep3Vector &p, int fan_number) const
double get_sagging(const CLHEP::Hep3Vector &P, int fan_number) const
void init_sagging_parameters()
virtual double AmplitudeOfSurface(const CLHEP::Hep3Vector &P, int side, int fan_number) const
This class separates some of the geometry details of the LAr endcap.
double m_HalfWheelThickness