ATLAS Offline Software
Loading...
Searching...
No Matches
LArWheelSliceSolid.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3*/
4
5#include "G4VGraphicsScene.hh"
6#include "G4VisExtent.hh"
7
10
11class G4NURBS;
12class G4VoxelLimits;
13class G4AffineTransform;
14
15EInside LArWheelSliceSolid::Inside(const G4ThreeVector &inputP) const
16{
17 LWSDBG(10, std::cout << std::setprecision(25));
18 LWSDBG(1, std::cout << TypeStr() << " Inside " << MSG_VECTOR(inputP) << std::endl);
19 const EInside inside_BS = m_BoundingShape->Inside(inputP);
20 if(inside_BS == kOutside){
21 LWSDBG(2, std::cout << "outside BS" << std::endl);
22 return kOutside;
23 }
24 G4ThreeVector p(inputP);
25 int p_fan = 0;
26 const G4double d = fabs(GetCalculator()->DistanceToTheNearestFan(p, p_fan));
27 if(d > m_FHTplusT){
28 LWSDBG(2, std::cout << "outside fan d=" << d << ", m_FHTplusT=" << m_FHTplusT << std::endl);
29 return kOutside;
30 }
31 if(d < m_FHTminusT){
32 LWSDBG(2, std::cout << "inside fan d=" << d << ", m_FHTminusT=" << m_FHTminusT << ", inside_BS=" << inside(inside_BS) << std::endl);
33 return inside_BS;
34 }
35 LWSDBG(2, std::cout << "surface" << std::endl);
36 return kSurface;
37}
38
39G4ThreeVector LArWheelSliceSolid::SurfaceNormal(const G4ThreeVector &inputP) const
40{
41 LWSDBG(1, std::cout << TypeStr() << " SurfaceNormal" << MSG_VECTOR(inputP) << std::endl);
42 EInside inside_BS = m_BoundingShape->Inside(inputP);
43 if(inside_BS != kInside){
44 LWSDBG(2, std::cout << "not inside BS" << std::endl);
45 return m_BoundingShape->SurfaceNormal(inputP);
46 }
47 G4ThreeVector p( inputP );
48 int p_fan = 0;
50 G4ThreeVector d = GetCalculator()->NearestPointOnNeutralFibre(p, p_fan);
51 d.rotateZ(inputP.phi() - p.phi()); // rotate back to initial position
52 LWSDBG(4, std::cout << "npnf" << MSG_VECTOR(d) << std::endl);
53 p = inputP - d;
54 LWSDBG(2, std::cout << "sn " << MSG_VECTOR(p.unit()) << std::endl);
55 return(p.unit());
56}
57
59 const EAxis a, const G4VoxelLimits &vl,
60 const G4AffineTransform &t, G4double &p,
61 G4double &q
62) const
63{
64 return m_BoundingShape->CalculateExtent(a, vl, t, p, q);
65}
66
67G4String LArWheelSliceSolid::TypeStr(void) const
68{
69 G4String ret("");
70 switch(m_Pos){
71 case Inner:
72 switch(m_Type){
73 case Absorber: ret = "LArInnerAbsorberWheel"; break;
74 case Electrode: ret = "LArInnerElectrodWheel"; break;
75 case Glue: ret = "LArInnerGlueWheel"; break;
76 case Lead: ret = "LArInnerLeadWheel"; break;
77 }
78 break;
79 case Outer:
80 switch(m_Type){
81 case Absorber: ret = "LArOuterAbsorberWheel"; break;
82 case Electrode: ret = "LArOuterElectrodWheel"; break;
83 case Glue: ret = "LArOuterGlueWheel"; break;
84 case Lead: ret = "LArOuterLeadWheel"; break;
85 }
86 break;
87 }
88 return ret;
89}
90
91void LArWheelSliceSolid::DescribeYourselfTo(G4VGraphicsScene &scene) const
92{
93 scene.AddSolid(*this);
94}
95
97{
98 return m_BoundingShape->GetExtent();
99}
100
102{
103 return m_BoundingShape->CreatePolyhedron();
104}
static Double_t a
#define LWSDBG(a, b)
CLHEP::Hep3Vector NearestPointOnNeutralFibre(const CLHEP::Hep3Vector &p, int fan_number) const
double DistanceToTheNearestFan(CLHEP::Hep3Vector &p, int &out_fan_number) const
Determines the nearest to the input point fan.
G4VisExtent GetExtent() const
G4ThreeVector SurfaceNormal(const G4ThreeVector &) const
G4bool CalculateExtent(const EAxis, const G4VoxelLimits &, const G4AffineTransform &, G4double &, G4double &) const
const LArWheelCalculator * GetCalculator(void) const
EInside Inside(const G4ThreeVector &) const
G4String TypeStr(void) const
void DescribeYourselfTo(G4VGraphicsScene &) const
G4Polyhedron * CreatePolyhedron() const