ATLAS Offline Software
Loading...
Searching...
No Matches
LArWheelSliceSolid.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef GEO2G4_LARWHEELSLICESOLID_H
6#define GEO2G4_LARWHEELSLICESOLID_H
7#ifndef PORTABLE_LAR_SHAPE
10#endif
11#include "G4VSolid.hh"
12
13// set this to allow debug output in LArWheelSliceSolid methods
14// disabled by default to avoid any performance degradation
15//#define DEBUG_LARWHEELSLICESOLID
16
17// set this to check in dti and dto functions if particle direction
18// pointing inside or outside of volume to return zero fast when it is required by spec.
19// currently at development stage, requires accurate surface normal calculations
20//#define CHECK_DIRTONORM_ANGLE_ON_SURFACE
21
22#ifdef DEBUG_LARWHEELSLICESOLID
23#define LWSDBG(a, b) if(Verbose >= a) b
24#define MSG_VECTOR(v) "(" << v.x() << ", " << v.y() << ", " << v.z() << ")"
25//#define LWS_HARD_TEST_DTI
26//#define LWS_HARD_TEST_DTO
27#else
28#define LWSDBG(a, b)
29#endif
30
31// Forward declarations.
32class G4VGraphicsScene;
33class G4VisExtent;
34class G4Polyhedron;
35class G4NURBS;
36class G4VoxelLimits;
37class G4AffineTransform;
39class TF1;
40class G4Polyhedra;
41struct EMECData;
43#ifndef PORTABLE_LAR_SHAPE
44 , public AthMessaging
45#endif
46{
47 public:
48 typedef enum { Inner, Outer } pos_t;
49 typedef enum { Absorber, Electrode, Glue, Lead } type_t;
50
52 const G4String& name,
53 pos_t pos, type_t type, size_t slice,
54 G4int zside = 1,
55 const LArWheelCalculator *calc = 0,
56 const EMECData * emecData=0
57 );
58 LArWheelSliceSolid(const G4String& name, const EMECData *emecData);
60
61 // Mandatory for custom solid Geant4 functions
62 EInside Inside(const G4ThreeVector&) const;
63 G4double DistanceToIn(const G4ThreeVector&,
64 const G4ThreeVector&) const;
65 G4double DistanceToIn(const G4ThreeVector&) const;
66 G4double DistanceToOut(const G4ThreeVector&,
67 const G4ThreeVector&,
68 const G4bool calcNorm = false,
69 G4bool* validNorm = 0,
70 G4ThreeVector* n = 0) const;
71 G4double DistanceToOut(const G4ThreeVector&) const;
72 G4ThreeVector SurfaceNormal (const G4ThreeVector&) const;
73 G4bool CalculateExtent(const EAxis,
74 const G4VoxelLimits&,
75 const G4AffineTransform&,
76 G4double&,
77 G4double&) const;
78 G4GeometryType GetEntityType() const { return TypeStr(); }
79 void DescribeYourselfTo(G4VGraphicsScene&) const;
80 G4VisExtent GetExtent() const;
81 G4Polyhedron* CreatePolyhedron() const;
82 virtual std::ostream& StreamInfo(std::ostream& os) const { return os; }
83
84#ifndef PORTABLE_LAR_SHAPE
85 G4ThreeVector GetPointOnSurface(void) const;
86 G4double GetCubicVolume(void);
87 G4double GetSurfaceArea(void);
88#endif
89 //
90
91 const G4VSolid *GetBoundingShape(void) const { return m_BoundingShape; }
92 const LArWheelCalculator *GetCalculator(void) const { return m_Calculator; }
93
94 private:
95 static const G4double s_Tolerance;
96 static const G4double s_AngularTolerance;
97 static const G4double s_IterationPrecision;
98 static const G4double s_IterationPrecision2;
99 static const unsigned int s_IterationsLimit;
100
104 G4VSolid* m_BoundingShape{};
105
106 G4double m_FanHalfThickness{}, m_FHTplusT{}, m_FHTminusT{};
107
108 // limits used in DTI
109 G4double m_Xmin{}, m_Xmax{};
110
111 // Special limit, used in dto
112 G4double m_Ymin{};
113
114 // limits for use in service functions
115 G4double m_Zmin{}, m_Zmax{}, m_Rmin{}, m_Rmax{};
116
117 void inner_solid_init(const G4String &, size_t slice);
118 void outer_solid_init(const G4String &, size_t slice);
119 void fill_zsect(std::vector<G4double> &, G4double zMid = 0.) const;
120
121 virtual G4double distance_to_in(G4ThreeVector &, const G4ThreeVector &, int) const;
122 G4double in_iteration_process(const G4ThreeVector &,
123 G4double, G4ThreeVector &, int) const;
124 G4double search_for_nearest_point(
125 const G4ThreeVector &, const G4double,
126 const G4ThreeVector &, int
127 ) const;
128 G4bool search_for_most_remoted_point(
129 const G4ThreeVector &, const G4ThreeVector &,
130 G4ThreeVector &, const int
131 ) const;
132 G4double out_iteration_process(
133 const G4ThreeVector &, G4ThreeVector &, const int
134 ) const;
135
136#ifndef PORTABLE_LAR_SHAPE
137 EInside Inside_accordion(const G4ThreeVector&) const;
138 void get_point_on_accordion_surface(G4ThreeVector &) const;
139 void get_point_on_polycone_surface(G4ThreeVector &) const;
140 void get_point_on_flat_surface(G4ThreeVector &) const;
141 void set_failover_point(G4ThreeVector &p, const char *m = 0) const;
142
143 G4double get_area_on_polycone(void) const;
144 G4double get_area_on_face(void) const;
145 G4double get_area_on_side(void) const;
146
147 G4double get_area_at_r(G4double r) const;
148 G4double get_length_at_r(G4double r) const;
149
150 void test(void);
151 void clean_tests(void);
152 void init_tests(void);
153#endif
154
155protected:
156
157#ifndef PORTABLE_LAR_SHAPE
159#endif
160
162 friend double LArWheelSliceSolid_fcn_area(double *, double *);
163 friend double LArWheelSliceSolid_fcn_vol(double *, double *);
164 friend double LArWheelSliceSolid_fcn_area_on_pc(double *, double *);
165 friend double LArWheelSliceSolid_get_dl(double *, double *, G4int);
166 friend double LArWheelSliceSolid_fcn_side_area(double *, double *);
167
168#ifdef DEBUG_LARWHEELSLICESOLID
169 static const char* inside(EInside i)
170 {
171 switch(i){
172 case kInside: return "inside"; break;
173 case kSurface: return "surface"; break;
174 case kOutside: return "outside"; break;
175 }
176 return "unknown";
177 }
178
179 public:
180 static G4int Verbose;
181 void SetVerbose(G4int v){ Verbose = v; }
182 G4bool test_dti(const G4ThreeVector &p,
183 const G4ThreeVector &v, const G4double distance) const;
184 G4bool test_dto(const G4ThreeVector &p,
185 const G4ThreeVector &v, const G4double distance) const;
186#endif
187 private:
188 G4String TypeStr(void) const;
189
190 void createSolid(const G4String& name, G4int zside, size_t slice, const EMECData *emecData);
191 inline void check_slice(size_t size, size_t slice) const;
192};
193
194#endif // GEO2G4_LARWHEELSLICESOLID_H
double LArWheelSliceSolid_fcn_vol(double *x, double *p)
double LArWheelSliceSolid_fcn_area_on_pc(double *x, double *p)
double LArWheelSliceSolid_fcn_side_area(double *x, double *p)
double LArWheelSliceSolid_fcn_area(double *x, double *p)
double LArWheelSliceSolid_get_dl(double *x, double *par, G4int side)
Define macros for attributes used to control the static checker.
#define ATLAS_NOT_THREAD_SAFE
getNoisyStrip() Find noisy strips from hitmaps and write out into xml/db formats
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
This class separates some of the geometry details of the LAr endcap.
const G4VSolid * GetBoundingShape(void) const
static const G4double s_IterationPrecision
const LArWheelCalculator * m_Calculator
static const unsigned int s_IterationsLimit
G4GeometryType GetEntityType() const
LArWheelSliceSolid(const G4String &name, pos_t pos, type_t type, size_t slice, G4int zside=1, const LArWheelCalculator *calc=0, const EMECData *emecData=0)
const LArWheelCalculator * GetCalculator(void) const
static const G4double s_Tolerance
virtual std::ostream & StreamInfo(std::ostream &os) const
static const G4double s_IterationPrecision2
G4String TypeStr(void) const
static const G4double s_AngularTolerance
int r
Definition globals.cxx:22
@ Verbose
Definition ZDCMsg.h:18