ATLAS Offline Software
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.
32 class G4VGraphicsScene;
33 class G4VisExtent;
34 class G4Polyhedron;
35 class G4NURBS;
36 class G4VoxelLimits;
37 class G4AffineTransform;
38 class LArWheelCalculator;
39 class TF1;
40 class G4Polyhedra;
41 struct 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);
59  virtual ~LArWheelSliceSolid(){}
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 
101  pos_t m_Pos{};
102  type_t m_Type{};
103  const LArWheelCalculator *m_Calculator{};
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 
155 protected:
156 
157 #ifndef PORTABLE_LAR_SHAPE
158  TF1 *m_f_area, *m_f_vol, *m_f_area_on_pc, *m_f_length, *m_f_side_area;
159 #endif
160 
161  double m_test_index;
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
LArWheelSliceSolid::s_Tolerance
static const G4double s_Tolerance
Definition: LArWheelSliceSolid.h:95
beamspotman.r
def r
Definition: beamspotman.py:676
LArWheelSliceSolid_get_dl
double LArWheelSliceSolid_get_dl(double *x, double *par, G4int side)
Definition: LArWheelSliceSolidTests.cxx:568
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
LArWheelSliceSolid::GetCalculator
const LArWheelCalculator * GetCalculator(void) const
Definition: LArWheelSliceSolid.h:92
LArWheelSliceSolid::pos_t
pos_t
Definition: LArWheelSliceSolid.h:48
ATLAS_NOT_THREAD_SAFE
#define ATLAS_NOT_THREAD_SAFE
getNoisyStrip() Find noisy strips from hitmaps and write out into xml/db formats
Definition: checker_macros.h:212
LArWheelSliceSolid::StreamInfo
virtual std::ostream & StreamInfo(std::ostream &os) const
Definition: LArWheelSliceSolid.h:82
EMECData
Definition: EMECData.h:131
LArWheelSliceSolid::type_t
type_t
Definition: LArWheelSliceSolid.h:49
TrigInDetValidation_Base.test
test
Definition: TrigInDetValidation_Base.py:147
LArWheelSliceSolid::GetEntityType
G4GeometryType GetEntityType() const
Definition: LArWheelSliceSolid.h:78
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
LArWheelSliceSolid_fcn_vol
double LArWheelSliceSolid_fcn_vol(double *x, double *p)
Definition: LArWheelSliceSolidTests.cxx:540
ZDCMsg::Verbose
@ Verbose
Definition: ZDCMsg.h:18
LArWheelSliceSolid::~LArWheelSliceSolid
virtual ~LArWheelSliceSolid()
Definition: LArWheelSliceSolid.h:59
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
LArWheelSliceSolid::s_IterationsLimit
static const unsigned int s_IterationsLimit
Definition: LArWheelSliceSolid.h:99
perfmonmt-refit.slice
slice
Definition: perfmonmt-refit.py:52
lumiFormat.i
int i
Definition: lumiFormat.py:85
beamspotman.n
n
Definition: beamspotman.py:731
LArWheelSliceSolid_fcn_area
double LArWheelSliceSolid_fcn_area(double *x, double *p)
Definition: LArWheelSliceSolidTests.cxx:528
AthMessaging
Class to provide easy MsgStream access and capabilities.
Definition: AthMessaging.h:55
LArWheelCalculator
Definition: LArWheelCalculator.h:60
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
LArWheelSliceSolid::s_IterationPrecision2
static const G4double s_IterationPrecision2
Definition: LArWheelSliceSolid.h:98
LArWheelSliceSolid::GetBoundingShape
const G4VSolid * GetBoundingShape(void) const
Definition: LArWheelSliceSolid.h:91
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
python.PyAthena.v
v
Definition: PyAthena.py:154
Trk::inside
@ inside
Definition: PropDirection.h:29
LArWheelSliceSolid::s_AngularTolerance
static const G4double s_AngularTolerance
Definition: LArWheelSliceSolid.h:96
LArWheelSliceSolid::s_IterationPrecision
static const G4double s_IterationPrecision
Definition: LArWheelSliceSolid.h:97
LArWheelSliceSolid::m_test_index
double m_test_index
Definition: LArWheelSliceSolid.h:161
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
AthMessaging.h
LArWheelSliceSolid_fcn_area_on_pc
double LArWheelSliceSolid_fcn_area_on_pc(double *x, double *p)
Definition: LArWheelSliceSolidTests.cxx:548
LArWheelSliceSolid::m_f_vol
TF1 * m_f_vol
Definition: LArWheelSliceSolid.h:158
LArWheelSliceSolid
Definition: LArWheelSliceSolid.h:46
checker_macros.h
Define macros for attributes used to control the static checker.
beamspotnt.calc
calc
Definition: bin/beamspotnt.py:1252
Amg::distance
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
Definition: GeoPrimitivesHelpers.h:54
LArWheelSliceSolid_fcn_side_area
double LArWheelSliceSolid_fcn_side_area(double *x, double *p)
Definition: LArWheelSliceSolidTests.cxx:600