FDsimG4MirrorSegment.cc
Go to the documentation of this file.
2 #include "FDsimG4Colours.hh"
3 
4 #include "G4UnitsTable.hh"
5 #include "G4Trd.hh"
6 #include "G4IntersectionSolid.hh"
7 #include "G4UnionSolid.hh"
8 
9 #include "G4Material.hh"
10 #include "G4MaterialTable.hh"
11 #include "G4Box.hh"
12 #include "G4Sphere.hh"
13 #include "G4Polyhedra.hh"
14 #include "G4BREPSolidPolyhedra.hh"
15 #include "G4LogicalVolume.hh"
16 #include "G4PVPlacement.hh"
17 #include "G4ThreeVector.hh"
18 #include "G4VisAttributes.hh"
19 
20 /*
21 // Orientation of hexagonal mirrors w.r.t. azimuth and elevation
22 //
23 // side
24 // _______
25 // \
26 // \ Azimuth
27 // \ ^
28 // \ |
29 // / |
30 // / |
31 // / |
32 // ________ --------> Elevation
33 //
34 */
35 
36 
37 using namespace TelescopeSimulatorLX ;
38 
39 FDsimG4MirrorSegment::FDsimG4MirrorSegment(G4int type, G4double MirrorRadius, G4String materialName,G4double thick)
40 {
41  fMirrorType = type ;
42  fRadiusOfCurvature = MirrorRadius ;
43  fThickness = thick ;
44 
45  fMirrorMaterial = NULL;
46  fMirrorMaterial = G4Material::GetMaterial(materialName);
47 
48  fMirrorSegment_log = NULL;
49 
50  SetGeometry() ;
51  CheckParameters() ;
53 }
54 
55 
57 {
58  if (fxCorner) delete [] fxCorner ;
59  if (fyCorner) delete [] fyCorner ;
60 
61  fxCorner=NULL ;
62  fyCorner=NULL ;
63 }
64 
65 
67 {
68  if (!fMirrorMaterial)
69  {
70  G4Exception("Error in FDsimG4MirrorSegment constructor: G4Material of MirrorSegment not specified !!!");
71  }
72 }
73 
74 
76 {
77  G4cerr << " ================================================================ " << G4endl ;
78  G4cerr << " = MirrorSegment parameters " << G4endl ;
79  G4cerr << " = " << G4endl ;
80  G4cerr << " = Mirror type : " << fMirrorType << G4endl;
81  G4cerr << " = " << G4endl ;
82  G4cerr << " = Radius of curvature : " << fRadiusOfCurvature/mm << " (mm) " << G4endl ;
83  G4cerr << " = Thickness : " << fThickness/mm << " (mm) " << G4endl ;
84  G4cerr << " = " << G4endl ;
85  G4cerr << " = Mirror Material : " << fMirrorMaterial->GetName() << G4endl ;
86  G4cerr << " = " << G4endl ;
87  G4cerr << " ================================================================ " << G4endl ;
88 }
89 
90 
92 {
93  // Mirror Segment ref. syst. G4 ref. syst.
94 // y z
95 // /\ |
96 // / \ |
97 // / \ |
98 // | | |________
99 // | | x y
100 // \ /
101 // \ /
102 // \/
103 
104  const G4int NTRDMAX = 10 ;
105 
106  G4Trd *trd_solid[NTRDMAX] ;
107 
108  G4double dyTop[NTRDMAX] ;
109  G4double dyBot[NTRDMAX] ;
110  G4double dz[NTRDMAX] ;
111 
112  G4double dzTrap = 100.0*(fThickness) ;
113 
114  for (G4int iTrd = 0 ; iTrd < fNumTrapez ; iTrd++){
115  dyTop[iTrd] = fxCorner[iTrd] - fxCorner[fNumCorners-1-iTrd] ;
116  dyBot[iTrd] = fxCorner[iTrd+1] - fxCorner[fNumCorners-1-(iTrd+1)] ;
117  dz[iTrd] = fyCorner[iTrd] - fyCorner[iTrd+1] ;
118 
119  G4double dx = dzTrap;
120 
121  G4Trd *trdsolid =
122  new G4Trd("Trapezoid",dx/2.0,dx/2.0,dyBot[iTrd]/2.0,dyTop[iTrd]/2.0,dz[iTrd]/2.0) ;
123 
124  trd_solid[iTrd] = trdsolid ;
125  }
126 
127  G4UnionSolid * trd_union[10] ;
128 
129  G4int iTrdCenter = fNumTrapez - int(fNumTrapez/2.0) - 1 ;
130 
131  const G4double TOLERANCE = 0.05*mm;
132  G4ThreeVector translation(0.,0.,0.);
133 
134  G4double zTrans = -(dz[iTrdCenter] + dz[iTrdCenter+1])/2.0 ;
135  translation = translation + G4ThreeVector(0.,0.,zTrans+TOLERANCE) ;
136 
137  G4int nUnion = 0 ;
138  trd_union[nUnion] =
139  new G4UnionSolid("Union",trd_solid[iTrdCenter],trd_solid[iTrdCenter+1],0,translation) ;
140 
141  for (G4int iTrd = iTrdCenter + 2 ; iTrd < fNumTrapez ; iTrd++){
142  G4double zTrans = -(dz[iTrd-1] + dz[iTrd])/2.0 ;
143  translation = translation + G4ThreeVector(0.,0.,zTrans+TOLERANCE) ;
144 
145  nUnion++ ;
146  trd_union[nUnion] =
147  new G4UnionSolid("Union",trd_union[nUnion-1],trd_solid[iTrd],0,translation) ;
148  }
149 
150  translation = G4ThreeVector(0.,0.,0.) ;
151  for (G4int iTrd = iTrdCenter ; iTrd > 0 ; iTrd--) {
152  G4double zTrans = (dz[iTrd-1] + dz[iTrd])/2.0 ;
153  translation = translation + G4ThreeVector(0.,0.,zTrans+TOLERANCE) ;
154 
155  nUnion++ ;
156  trd_union[nUnion] =
157  new G4UnionSolid("Union",trd_union[nUnion-1],trd_solid[iTrd-1],0,translation) ;
158  }
159 
160 // Define sphere for intersecting with polyhedra
161 
162  G4double innerRadius = fRadiusOfCurvature-fThickness/2.0;
163  G4double outerRadius = fRadiusOfCurvature+fThickness/2.0;
164  G4Sphere *sphere =
165  new G4Sphere("sphere",innerRadius,outerRadius,0.0, 2.0*pi, 0., pi) ;
166 
167  G4ThreeVector xTranslation(-fRadiusOfCurvature,0.0,0.0);
168  G4IntersectionSolid *mirrorSegment_solid =
169  new G4IntersectionSolid("mirrorSegment_tmp",trd_union[nUnion],sphere,0,xTranslation) ;
170 
171 
173  new G4LogicalVolume(mirrorSegment_solid,fMirrorMaterial,"MirrorSegment",0,0,0);
174 
175  G4VisAttributes* VisAtt = new G4VisAttributes(gray);
176  VisAtt->SetForceWireframe(false) ;
177  fMirrorSegment_log->SetVisAttributes(VisAtt) ;
178 
179 }
180 
181 
183 {
184  G4double xCty1[] = { 5.9*mm, 264.6*mm, 268.80*mm, 270.45*mm, 264.6*mm, 5.9*mm,
185  -5.9*mm, -264.6*mm, -270.45*mm, -268.80*mm, -264.6*mm, -5.9*mm} ;
186  G4double yCty1[] = { 308.95*mm, 159.6*mm, 152.4*mm, -149.4*mm, -159.6*mm, -308.95*mm,
187  -308.95*mm, -159.6*mm, -149.4*mm, 152.4*mm, 159.6*mm, 308.95*mm} ;
188 
189  G4double xCty2[] = {5.9*mm, 261.8*mm, 267.0*mm, 5.75*mm,
190  -5.75*mm, -267.0*mm, -261.8*mm, -5.9*mm} ;
191  G4double yCty2[] = {308.95*mm, 161.2*mm, -154.2*mm, -308.95*mm,
192  -308.95*mm, -154.2*mm, 161.2*mm, 308.95*mm} ;
193 
194  G4double xCty3[] = {5.9*mm, 249.6*mm, 258.4*mm, 5.6*mm,
195  -5.6*mm, -258.4*mm, -249.6*mm, -5.9*mm} ;
196  G4double yCty3[] = {308.95*mm, 168.4*mm, -155.5*mm, -308.95*mm,
197  -308.95*mm, -155.5*mm, 168.4*mm, 308.95*mm} ;
198 
199  G4double xCty4[] = {5.9*mm, 232.0*mm, 244.8*mm, 5.45*mm,
200  -5.45*mm, -244.8*mm, -232.0*mm, -5.9*mm} ;
201  G4double yCty4[] = {308.95*mm, 178.5*mm, -160.3*mm, -308.95*mm,
202  -308.95*mm, -160.3*mm, 178.5*mm, 308.95*mm} ;
203 
204 //#warning Shape and dimensions of "squared" mirrors were estimated with a "very" educated guess using the talks at Liebenzel FD workshop.To be updated with the exact numbers.
205 
206  // Parameters for the "squared" mirrors
207  // Guessed dimensions from talks at Liebenzel workshop !!!
208  // to be updated as soon as right numbers are provided by H. Klages
209 
210  G4double xCty11[] = { 303.0*mm, 308.0*mm, 313.0*mm, 308.0*mm,
211  -308.0*mm,-313.0*mm,-308.0*mm,-303.0*mm} ;
212  G4double yCty11[] = { 313.0*mm, 308.0*mm,-308.0*mm,-313.0*mm,
213  -313.0*mm,-308.0*mm, 308.0*mm, 313.0*mm} ;
214 
215  G4double xCty12[] = { 287.0*mm, 292.0*mm, 308.0*mm, 303.0*mm,
216  -303.0*mm,-308.0*mm,-292.0*mm,-287.0*mm} ;
217  G4double yCty12[] = { 313.0*mm, 308.0*mm,-308.0*mm,-313.0*mm,
218  -313.0*mm,-308.0*mm, 308.0*mm, 313.0*mm} ;
219 
220  G4double xCty13[] = { 261.0*mm, 266.0*mm, 292.0*mm, 287.0*mm,
221  -287.0*mm,-292.0*mm,-266.0*mm,-261.0*mm} ;
222  G4double yCty13[] = { 313.0*mm, 308.0*mm,-308.0*mm,-313.0*mm,
223  -313.0*mm,-308.0*mm, 308.0*mm, 313.0*mm} ;
224 
225  switch (fMirrorType) {
226  case 1:
227  fNumCorners = 12 ;
228  fNumTrapez = 5 ;
229  fxCorner = new G4double[fNumCorners] ;
230  fyCorner = new G4double[fNumCorners] ;
231 
232  for (G4int iCorner = 0 ; iCorner < fNumCorners ; iCorner++){
233  fxCorner[iCorner] = xCty1[iCorner] ;
234  fyCorner[iCorner] = yCty1[iCorner] ;
235  }
236  break;
237  case 2:
238  fNumCorners = 8 ;
239  fNumTrapez = 3 ;
240  fxCorner = new G4double[fNumCorners] ;
241  fyCorner = new G4double[fNumCorners] ;
242 
243  for (G4int iCorner = 0 ; iCorner < fNumCorners ; iCorner++){
244  fxCorner[iCorner] = xCty2[iCorner] ;
245  fyCorner[iCorner] = yCty2[iCorner] ;
246  }
247  break;
248  case 3:
249  fNumCorners = 8 ;
250  fNumTrapez = 3 ;
251  fxCorner = new G4double[fNumCorners] ;
252  fyCorner = new G4double[fNumCorners] ;
253 
254  for (G4int iCorner = 0 ; iCorner < fNumCorners ; iCorner++){
255  fxCorner[iCorner] = xCty3[iCorner] ;
256  fyCorner[iCorner] = yCty3[iCorner] ;
257  }
258  break;
259  case 4:
260  fNumCorners = 8 ;
261  fNumTrapez = 3 ;
262  fxCorner = new G4double[fNumCorners] ;
263  fyCorner = new G4double[fNumCorners] ;
264 
265  for (G4int iCorner = 0 ; iCorner < fNumCorners ; iCorner++){
266  fxCorner[iCorner] = xCty4[iCorner] ;
267  fyCorner[iCorner] = yCty4[iCorner] ;
268  }
269  break;
270  // Now for the "squared" mirrors
271  case 11:
272  fNumCorners = 8 ;
273  fNumTrapez = 3 ;
274  fxCorner = new G4double[fNumCorners] ;
275  fyCorner = new G4double[fNumCorners] ;
276 
277  for (G4int iCorner = 0 ; iCorner < fNumCorners ; iCorner++){
278  fxCorner[iCorner] = xCty11[iCorner] ;
279  fyCorner[iCorner] = yCty11[iCorner] ;
280  }
281  break;
282  case 12:
283  fNumCorners = 8 ;
284  fNumTrapez = 3 ;
285  fxCorner = new G4double[fNumCorners] ;
286  fyCorner = new G4double[fNumCorners] ;
287 
288  for (G4int iCorner = 0 ; iCorner < fNumCorners ; iCorner++){
289  fxCorner[iCorner] = xCty12[iCorner] ;
290  fyCorner[iCorner] = yCty12[iCorner] ;
291  }
292  break;
293  case 13:
294  fNumCorners = 8 ;
295  fNumTrapez = 3 ;
296  fxCorner = new G4double[fNumCorners] ;
297  fyCorner = new G4double[fNumCorners] ;
298 
299  for (G4int iCorner = 0 ; iCorner < fNumCorners ; iCorner++){
300  fxCorner[iCorner] = xCty13[iCorner] ;
301  fyCorner[iCorner] = yCty13[iCorner] ;
302  }
303  break;
304  default:
305  G4Exception("Error in FDsimG4MirrorSegment::SetGeometry : Unknown mirror type" );
306  }
307 
308 }
constexpr double mm
Definition: AugerUnits.h:113
static const G4Colour gray(0.5, 0.5, 0.5)
FDsimG4MirrorSegment(G4int type, G4double radiusCurvature, G4String MirrorMat="MirrorPlastic", G4double thick=5.0 *mm)

, generated on Tue Sep 26 2023.