ATLAS Offline Software
LArWheelSolid.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "G4VGraphicsScene.hh"
6 #include "G4VisExtent.hh"
7 
9 #include "LArWheelSolid.h"
10 
11 class G4NURBS;
12 class G4VoxelLimits;
13 class G4AffineTransform;
14 
15 EInside LArWheelSolid::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 LArWheelSolid::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 
58 G4bool LArWheelSolid::CalculateExtent(const EAxis a, const G4VoxelLimits &vl,
59  const G4AffineTransform &t, G4double &p,
60  G4double &q) const
61 {
62  return m_BoundingShape->CalculateExtent(a, vl, t, p, q);
63 }
64 
65 G4GeometryType LArWheelSolid::GetEntityType() const
66 {
67  switch(m_Type){
68  case InnerAbsorberWheel:
69  return G4String("LArInnerAbsorberWheel");
70  break;
71  case OuterAbsorberWheel:
72  return G4String("LArOuterAbsorberWheel");
73  break;
74  case InnerElectrodWheel:
75  return G4String("LArInnerElecrodWheel");
76  break;
77  case OuterElectrodWheel:
78  return G4String("LArOuterElecrodWheel");
79  break;
81  return G4String("LArInnerAbsorberModule");
82  break;
84  return G4String("LArOuterAbsorberModule");
85  break;
87  return G4String("LArInnerElecrodModule");
88  break;
90  return G4String("LArOuterElecrodModule");
91  break;
92  case InnerGlueWheel:
93  return G4String("LArInnerGlueWheel");
94  break;
95  case OuterGlueWheel:
96  return G4String("LArOuterGlueWheel");
97  break;
98  case InnerLeadWheel:
99  return G4String("LArInnerLeadWheel");
100  break;
101  case OuterLeadWheel:
102  return G4String("LArOuterLeadWheel");
103  break;
104  case InnerAbsorberCone:
105  return G4String("LArInnerAbsorberCone");
106  break;
107  case InnerElectrodCone:
108  return G4String("LArInnerElectrodCone");
109  break;
110  case InnerGlueCone:
111  return G4String("LArInnerGlueCone");
112  break;
113  case InnerLeadCone:
114  return G4String("LArInnerLeadCone");
115  break;
117  return G4String("LArOuterAbsorberFrontCone");
118  break;
120  return G4String("LArOuterElectrodFrontCone");
121  break;
122  case OuterGlueFrontCone:
123  return G4String("LArOuterGlueFrontCone");
124  break;
125  case OuterLeadFrontCone:
126  return G4String("LArOuterLeadFrontCone");
127  break;
129  return G4String("LArOuterAbsorberBackCone");
130  break;
132  return G4String("LArOuterElectrodBackCone");
133  break;
134  case OuterGlueBackCone:
135  return G4String("LArOuterGlueBackCone");
136  break;
137  case OuterLeadBackCone:
138  return G4String("LArOuterLeadBackCone");
139  break;
140  default:
141  G4Exception("LArWheelSolid", "UnknownSolidType", FatalException,"GetEntityType: Unknown LArWheelType.");
142  }
143  return G4String("");
144 }
145 
146 void LArWheelSolid::DescribeYourselfTo(G4VGraphicsScene &scene) const
147 {
148  scene.AddSolid(*this);
149 }
150 
151 G4VisExtent LArWheelSolid::GetExtent() const
152 {
153  return m_BoundingShape->GetExtent();
154 }
155 
156 G4Polyhedron* LArWheelSolid::CreatePolyhedron() const
157 {
158  return m_BoundingShape->CreatePolyhedron();
159 }
160 
161 /*
162  * returns the number of lower z boundary of z-section containing Z
163  */
164 G4int LArWheelSolid::select_section(const G4double &Z) const
165 {
166  for(G4int i = m_Zsect_start_search; i > 0; -- i){
167  if(Z > m_Zsect[i]) return i;
168  }
169  return 0;
170 }
InnerElectrodCone
@ InnerElectrodCone
Definition: LArWheelSolid_type.h:26
InnerGlueWheel
@ InnerGlueWheel
Definition: LArWheelSolid_type.h:21
LArWheelSolid::GetEntityType
G4GeometryType GetEntityType() const
Definition: LArWheelSolid.cxx:65
LArWheelSolid::m_FHTminusT
G4double m_FHTminusT
Definition: LArWheelSolid.h:149
OuterLeadFrontCone
@ OuterLeadFrontCone
Definition: LArWheelSolid_type.h:32
OuterAbsorberBackCone
@ OuterAbsorberBackCone
Definition: LArWheelSolid_type.h:33
OuterLeadBackCone
@ OuterLeadBackCone
Definition: LArWheelSolid_type.h:36
OuterGlueWheel
@ OuterGlueWheel
Definition: LArWheelSolid_type.h:22
Monitored::Z
@ Z
Definition: HistogramFillerUtils.h:24
hist_file_dump.d
d
Definition: hist_file_dump.py:137
LArWheelSolid::GetExtent
G4VisExtent GetExtent() const
Definition: LArWheelSolid.cxx:151
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
LArWheelSolid::m_FHTplusT
G4double m_FHTplusT
Definition: LArWheelSolid.h:149
InnerElectrodModule
@ InnerElectrodModule
Definition: LArWheelSolid_type.h:19
InnerElectrodWheel
@ InnerElectrodWheel
Definition: LArWheelSolid_type.h:15
InnerGlueCone
@ InnerGlueCone
Definition: LArWheelSolid_type.h:27
OuterElectrodModule
@ OuterElectrodModule
Definition: LArWheelSolid_type.h:20
OuterGlueFrontCone
@ OuterGlueFrontCone
Definition: LArWheelSolid_type.h:31
OuterAbsorberModule
@ OuterAbsorberModule
Definition: LArWheelSolid_type.h:18
LArWheelSolid.h
LArWheelSolid::GetCalculator
const LArWheelCalculator * GetCalculator(void) const
Definition: LArWheelSolid.h:130
InnerLeadWheel
@ InnerLeadWheel
Definition: LArWheelSolid_type.h:23
OuterElectrodFrontCone
@ OuterElectrodFrontCone
Definition: LArWheelSolid_type.h:30
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
LWSDBG
#define LWSDBG(a, b)
Definition: LArWheelSliceSolid.h:28
lumiFormat.i
int i
Definition: lumiFormat.py:85
InnerAbsorberWheel
@ InnerAbsorberWheel
Definition: LArWheelSolid_type.h:13
OuterLeadWheel
@ OuterLeadWheel
Definition: LArWheelSolid_type.h:24
OuterElectrodBackCone
@ OuterElectrodBackCone
Definition: LArWheelSolid_type.h:34
OuterGlueBackCone
@ OuterGlueBackCone
Definition: LArWheelSolid_type.h:35
LArWheelSolid::CalculateExtent
G4bool CalculateExtent(const EAxis, const G4VoxelLimits &, const G4AffineTransform &, G4double &, G4double &) const
Definition: LArWheelSolid.cxx:58
InnerLeadCone
@ InnerLeadCone
Definition: LArWheelSolid_type.h:28
LArWheelSolid::m_Zsect
std::vector< G4double > m_Zsect
Definition: LArWheelSolid.h:159
LArWheelSolid::Inside
EInside Inside(const G4ThreeVector &) const
Definition: LArWheelSolid.cxx:15
InnerAbsorberModule
@ InnerAbsorberModule
Definition: LArWheelSolid_type.h:17
LArWheelSolid::m_Zsect_start_search
G4int m_Zsect_start_search
Definition: LArWheelSolid.h:160
OuterElectrodWheel
@ OuterElectrodWheel
Definition: LArWheelSolid_type.h:16
LArWheelSolid::select_section
G4int select_section(const G4double &Z) const
Definition: LArWheelSolid.cxx:164
OuterAbsorberFrontCone
@ OuterAbsorberFrontCone
Definition: LArWheelSolid_type.h:29
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
a
TList * a
Definition: liststreamerinfos.cxx:10
LArWheelCalculator::NearestPointOnNeutralFibre
CLHEP::Hep3Vector NearestPointOnNeutralFibre(const CLHEP::Hep3Vector &p, int fan_number) const
Definition: LArWheelCalculatorGeometry.cxx:113
LArWheelSolid::CreatePolyhedron
G4Polyhedron * CreatePolyhedron() const
Definition: LArWheelSolid.cxx:156
LArWheelSolid::m_Type
const LArWheelSolid_t m_Type
Definition: LArWheelSolid.h:147
extractSporadic.q
list q
Definition: extractSporadic.py:98
InnerAbsorberCone
@ InnerAbsorberCone
Definition: LArWheelSolid_type.h:25
LArWheelSolid::DescribeYourselfTo
void DescribeYourselfTo(G4VGraphicsScene &) const
Definition: LArWheelSolid.cxx:146
LArWheelSolid::SurfaceNormal
G4ThreeVector SurfaceNormal(const G4ThreeVector &) const
Definition: LArWheelSolid.cxx:39
LArWheelSolid::m_BoundingShape
G4VSolid * m_BoundingShape
Definition: LArWheelSolid.h:154
OuterAbsorberWheel
@ OuterAbsorberWheel
Definition: LArWheelSolid_type.h:14
LArWheelCalculator.h