ATLAS Offline Software
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 
9 #include "LArWheelSliceSolid.h"
10 
11 class G4NURBS;
12 class G4VoxelLimits;
13 class G4AffineTransform;
14 
15 EInside 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 
39 G4ThreeVector 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 
67 G4String 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 
91 void LArWheelSliceSolid::DescribeYourselfTo(G4VGraphicsScene &scene) const
92 {
93  scene.AddSolid(*this);
94 }
95 
96 G4VisExtent LArWheelSliceSolid::GetExtent() const
97 {
98  return m_BoundingShape->GetExtent();
99 }
100 
102 {
103  return m_BoundingShape->CreatePolyhedron();
104 }
LArWheelSliceSolid::Inner
@ Inner
Definition: LArWheelSliceSolid.h:48
LArWheelSliceSolid::DescribeYourselfTo
void DescribeYourselfTo(G4VGraphicsScene &) const
Definition: LArWheelSliceSolid.cxx:91
LArWheelSliceSolid::Lead
@ Lead
Definition: LArWheelSliceSolid.h:49
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
LArWheelSliceSolid::GetCalculator
const LArWheelCalculator * GetCalculator(void) const
Definition: LArWheelSliceSolid.h:92
LArWheelSliceSolid::Electrode
@ Electrode
Definition: LArWheelSliceSolid.h:49
LArWheelSliceSolid.h
hist_file_dump.d
d
Definition: hist_file_dump.py:137
LArWheelSliceSolid::TypeStr
G4String TypeStr(void) const
Definition: LArWheelSliceSolid.cxx:67
LArWheelSliceSolid::Outer
@ Outer
Definition: LArWheelSliceSolid.h:48
LArWheelSliceSolid::m_Pos
pos_t m_Pos
Definition: LArWheelSliceSolid.h:101
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
LArWheelSliceSolid::Glue
@ Glue
Definition: LArWheelSliceSolid.h:49
LArWheelSliceSolid::CreatePolyhedron
G4Polyhedron * CreatePolyhedron() const
Definition: LArWheelSliceSolid.cxx:101
LWSDBG
#define LWSDBG(a, b)
Definition: LArWheelSliceSolid.h:28
LArWheelSliceSolid::GetExtent
G4VisExtent GetExtent() const
Definition: LArWheelSliceSolid.cxx:96
ret
T ret(T t)
Definition: rootspy.cxx:260
LArWheelSliceSolid::SurfaceNormal
G4ThreeVector SurfaceNormal(const G4ThreeVector &) const
Definition: LArWheelSliceSolid.cxx:39
LArWheelSliceSolid::m_BoundingShape
G4VSolid * m_BoundingShape
Definition: LArWheelSliceSolid.h:104
LArWheelCalculator::DistanceToTheNearestFan
double DistanceToTheNearestFan(CLHEP::Hep3Vector &p, int &out_fan_number) const
Determines the nearest to the input point fan.
Definition: LArWheelCalculatorGeometry.cxx:90
Trk::inside
@ inside
Definition: PropDirection.h:29
LArWheelSliceSolid::m_FHTplusT
G4double m_FHTplusT
Definition: LArWheelSliceSolid.h:106
a
TList * a
Definition: liststreamerinfos.cxx:10
LArWheelCalculator::NearestPointOnNeutralFibre
CLHEP::Hep3Vector NearestPointOnNeutralFibre(const CLHEP::Hep3Vector &p, int fan_number) const
Definition: LArWheelCalculatorGeometry.cxx:113
LArWheelSliceSolid::m_Type
type_t m_Type
Definition: LArWheelSliceSolid.h:102
extractSporadic.q
list q
Definition: extractSporadic.py:98
LArWheelSliceSolid::CalculateExtent
G4bool CalculateExtent(const EAxis, const G4VoxelLimits &, const G4AffineTransform &, G4double &, G4double &) const
Definition: LArWheelSliceSolid.cxx:58
LArWheelSliceSolid::m_FHTminusT
G4double m_FHTminusT
Definition: LArWheelSliceSolid.h:106
LArWheelSliceSolid::Absorber
@ Absorber
Definition: LArWheelSliceSolid.h:49
LArWheelSliceSolid::Inside
EInside Inside(const G4ThreeVector &) const
Definition: LArWheelSliceSolid.cxx:15
LArWheelCalculator.h