source: trunk/examples/advanced/xray_telescope/src/XrayTelDetectorConstruction.cc @ 1309

Last change on this file since 1309 was 807, checked in by garnier, 16 years ago

update

File size: 15.3 KB
Line 
1//
2// ********************************************************************
3// * License and Disclaimer                                           *
4// *                                                                  *
5// * The  Geant4 software  is  copyright of the Copyright Holders  of *
6// * the Geant4 Collaboration.  It is provided  under  the terms  and *
7// * conditions of the Geant4 Software License,  included in the file *
8// * LICENSE and available at  http://cern.ch/geant4/license .  These *
9// * include a list of copyright holders.                             *
10// *                                                                  *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work  make  any representation or  warranty, express or implied, *
14// * regarding  this  software system or assume any liability for its *
15// * use.  Please see the license in the file  LICENSE  and URL above *
16// * for the full disclaimer and the limitation of liability.         *
17// *                                                                  *
18// * This  code  implementation is the result of  the  scientific and *
19// * technical work of the GEANT4 collaboration.                      *
20// * By using,  copying,  modifying or  distributing the software (or *
21// * any work based  on the software)  you  agree  to acknowledge its *
22// * use  in  resulting  scientific  publications,  and indicate your *
23// * acceptance of all terms of the Geant4 Software license.          *
24// ********************************************************************
25//
26//
27// **********************************************************************
28// *                                                                    *
29// *                    GEANT 4 xray_telescope advanced example         *
30// *                                                                    *
31// * MODULE:            XrayTelDetectorConstruction.cc                  *     
32// * -------                                                            *
33// *                                                                    *
34// * Version:           0.4                                             *
35// * Date:              06/11/00                                        *
36// * Author:            R Nartallo                                      *
37// * Organisation:      ESA/ESTEC, Noordwijk, THe Netherlands           *
38// *                                                                    *
39// **********************************************************************
40//
41// CHANGE HISTORY
42// --------------
43//
44// 06.11.2000 R.Nartallo
45// - First implementation of xray_telescope geometry
46// - Based on Chandra and XMM models by R Nartallo, P Truscott, F Lei
47//   and P Arce
48//
49//
50// **********************************************************************
51
52#include "G4UnitsTable.hh"
53#include "G4VUserDetectorConstruction.hh"
54#include "G4Material.hh"
55#include "G4MaterialTable.hh"
56#include "G4Element.hh"
57#include "G4ElementTable.hh"
58#include "G4Box.hh"
59#include "G4Cons.hh"
60#include "G4Tubs.hh"
61#include "G4LogicalVolume.hh"
62#include "G4ThreeVector.hh"
63#include "G4PVPlacement.hh"
64#include "G4PVReplica.hh"
65#include "G4SDManager.hh"
66#include "G4VisAttributes.hh"
67#include "G4Colour.hh"
68
69#include "globals.hh"
70
71#include "XrayTelDetectorConstruction.hh"
72
73XrayTelDetectorConstruction::XrayTelDetectorConstruction()
74{
75  world_x = 2500.*cm;
76  world_y = 2500.*cm;
77  world_z = 2500.*cm;
78}
79
80XrayTelDetectorConstruction::~XrayTelDetectorConstruction()
81{;}
82
83G4VPhysicalVolume* XrayTelDetectorConstruction::Construct( )
84{
85
86  // Material: Vacuum
87  G4Material* Vacuum = new G4Material("Vacuum",
88                                      1.0 , 1.01*g/mole, 1.0E-25*g/cm3,
89                                      kStateGas, 2.73*kelvin, 3.0E-18*pascal );
90
91  // Visualization attributes
92  G4VisAttributes* VisAttWorld= new G4VisAttributes( G4Colour(204/255.,255/255.,255/255.));
93
94  // World
95  G4Box * solidWorld = new G4Box( "world_S", world_x, world_y, world_z );
96  G4LogicalVolume * logicalWorld = new G4LogicalVolume( solidWorld, // solid
97                                                        Vacuum,                          // material
98                                                        "world_L",                       // name
99                                                        0,0,0);
100
101  logicalWorld -> SetVisAttributes(VisAttWorld);
102
103  // Physical volume
104  physicalWorld= new G4PVPlacement( 0,
105                                    G4ThreeVector(),
106                                    "world_P",        // name (2nd constructor)
107                                    logicalWorld,     // logical volume
108                                    NULL,             // mother volume
109                                    false,            // no boolean operation
110                                    0);               // copy number
111
112  // Make Invisible
113  logicalWorld -> SetVisAttributes(G4VisAttributes::Invisible);
114
115  // Construct geometry
116  ConstructTelescope();
117  ConstructFocalPlane();
118
119  return physicalWorld;
120}
121
122//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
123
124// Construct Telescope
125
126void XrayTelDetectorConstruction::ConstructTelescope()
127{
128  // Construct Mirror
129  // Single shell mirror made of Nickel with thin Gold coating
130  // Mirror made up of two cones approximating the parabolic section and
131  // two cones approximating the hyperbolic section
132  // The centre of the mirror is filled wiith a solid aluminium rod shaped as the
133  // mirrors, so as to leave a constant BaffleGap distance from the mirror surface
134
135  // Build materials
136  G4Material* Ni = new G4Material("Nickel", 28., 58.6934*g/mole, 8.902*g/cm3);
137  G4Material* Au = new G4Material("Gold", 79., 196.96654*g/mole, 19.300*g/cm3);
138  G4Material* Al = new G4Material("Aluminium", 13., 26.98*g/mole, 2.700*g/cm3);
139
140  // Visualization attributes
141  G4VisAttributes* VisAttMirror = new G4VisAttributes(
142                                                      G4Colour(0/255., 0/255.,255/255.));
143  G4VisAttributes* VisAttAuCoating = new G4VisAttributes(
144                                                         G4Colour(255/255., 255/255., 0/255.));
145  G4VisAttributes* VisAttBaffle = new G4VisAttributes(
146                                                      G4Colour(128/255., 128/255., 128/255.));
147
148  // Rotation Matrix
149  G4RotationMatrix *rotateMatrix = new G4RotationMatrix();
150  rotateMatrix -> rotateY(90.*deg);
151
152  // Construct cones to make  Mirror sections
153  G4int i;
154  G4double MirrorEnd[5] = { 34.9995975*cm, 34.8277209*cm, 34.6549918*cm,
155                            34.1347834*cm, 33.6137753*cm };
156  G4double MirrorPosition[4] = { 772.5*cm, 757.5*cm, 742.5*cm, 727.5*cm };
157  G4double MirrorSectionLength = 15.0*cm;
158  G4double MirrorNiThickness = 1.07*mm;
159  G4double MirrorAuCoating = 50.0e-6*mm;
160  G4double BaffleGap = 4.0*mm;
161
162  G4Cons* MirrorSolid[4];
163  G4Cons* MirrorAuCoatingSolid[4];
164  G4Cons* BaffleSolid[4];
165
166  G4LogicalVolume* MirrorLogicalVolume[4];
167  G4LogicalVolume* MirrorAuCoatingLogicalVolume[4];
168  G4LogicalVolume* BaffleLogicalVolume[4];
169
170  for ( i=0; i<4; i++ ) {
171
172    // Mirror Nickel base
173    MirrorSolid[i] = new G4Cons( "Mirror_S",
174                                 MirrorEnd[i], MirrorEnd[i] + MirrorNiThickness,
175                                 MirrorEnd[i+1], MirrorEnd[i+1] + MirrorNiThickness,
176                                 MirrorSectionLength/2, 0*deg, 360.*deg);
177    MirrorLogicalVolume[i] = new G4LogicalVolume(
178                                                 MirrorSolid[i], Ni, "Mirror_L", 0, 0, 0 );
179    MirrorLogicalVolume[i]->SetVisAttributes(VisAttMirror);
180
181    // Gold coating on mirror
182    MirrorAuCoatingSolid[i] = new G4Cons( 
183                                         "MirrorAuCoating_S",
184                                         MirrorEnd[i] - MirrorAuCoating, MirrorEnd[i],
185                                         MirrorEnd[i+1] - MirrorAuCoating, MirrorEnd[i+1], 
186                                         MirrorSectionLength/2, 0*deg, 360.*deg);
187    MirrorAuCoatingLogicalVolume[i] = new G4LogicalVolume(
188                                                          MirrorAuCoatingSolid[i],
189                                                          Au,
190                                                          "MirrorAuCoating_L",
191                                                          0, 0, 0 );
192    MirrorAuCoatingLogicalVolume[i]->SetVisAttributes(VisAttAuCoating);
193
194    // Aluminium baffle inside mirror
195    BaffleSolid[i] = new G4Cons( "Baffle_S",
196                                 0, MirrorEnd[i] - BaffleGap,
197                                 0, MirrorEnd[i+1] - BaffleGap,
198                                 MirrorSectionLength/2, 0*deg, 360.*deg);
199    BaffleLogicalVolume[i] = new G4LogicalVolume(
200                                                 BaffleSolid[i], Al, "Baffle_L", 0, 0, 0 );
201    BaffleLogicalVolume[i]-> SetVisAttributes(VisAttBaffle);
202  }
203
204  // Physical volume
205  G4VPhysicalVolume* MirrorPhysicalVolume[4];
206  G4VPhysicalVolume* MirrorAuCoatingPhysicalVolume[4];
207  G4VPhysicalVolume* BafflePhysicalVolume[4];
208
209  for ( i=0; i<4; i++ ) {
210    MirrorPhysicalVolume[i] = new G4PVPlacement(
211                                                rotateMatrix,
212                                                G4ThreeVector( MirrorPosition[i], 0.0*cm, 0.0*cm ),
213                                                "Mirror_P",
214                                                MirrorLogicalVolume[i],
215                                                physicalWorld, false, 0 );
216    MirrorAuCoatingPhysicalVolume[i] = new G4PVPlacement(
217                                                         rotateMatrix,
218                                                         G4ThreeVector( MirrorPosition[i], 0.0*cm, 0.0*cm ),
219                                                         "MirrorAuCoating_P",
220                                                         MirrorAuCoatingLogicalVolume[i],
221                                                         physicalWorld, false, 0 );
222    BafflePhysicalVolume[i] = new G4PVPlacement(
223                                                rotateMatrix,
224                                                G4ThreeVector( MirrorPosition[i], 0.0*cm, 0.0*cm ),
225                                                "Baffle_P",
226                                                BaffleLogicalVolume[i],
227                                                physicalWorld, false, 0 );
228  }
229
230  // Make Mirror Invisible
231
232  for ( i=0; i<4; i++ ) {
233    //   MirrorLogicalVolume[i] -> SetVisAttributes(G4VisAttributes::Invisible);
234    //   MirrorAuCoatingLogicalVolume[i] -> SetVisAttributes(G4VisAttributes::Invisible);
235    BaffleLogicalVolume[i] -> SetVisAttributes(G4VisAttributes::Invisible);
236  }
237
238
239  // Construct Optical Bench
240  // Main Telescope carbon fibre tube and two aluminium end caps
241
242  G4int nel;
243  G4String symbol;
244
245  // Elements
246  G4Element* C = new G4Element("Carbon", symbol="C", 6., 12.011*g/mole);
247  G4Element* H = new G4Element("Hydrogen",symbol="H", 1., 1.00794*g/mole);
248
249  // Materials from Combination
250  G4Material* Cf = new G4Material("Carbon Fibre", 2.0*g/cm3, nel=2);
251  Cf->AddElement(C,1);
252  Cf->AddElement(H,2);
253
254  // Visualization attributes
255  G4VisAttributes* VisAttBench = new G4VisAttributes(
256                                                     G4Colour(0/255., 200/255., 0/255.));
257
258  // Construct Optical bench
259  G4double BenchThickness = 1.0*cm;
260  G4double BenchFrontEndMinRadiusOut = MirrorEnd[4] + 
261    ( MirrorEnd[3] - MirrorEnd[4] )*7.5/15
262    + MirrorNiThickness;
263  G4double BenchFrontEndMinRadiusIn  = MirrorEnd[4] + 
264    ( MirrorEnd[3] - MirrorEnd[4] )*7.4/15
265    + MirrorNiThickness;
266  G4double BenchFrontEndMaxRadius = MirrorEnd[4] + MirrorNiThickness + 25.*cm;
267  G4double BenchBackEndMinRadius = 0.0*cm;
268  G4double BenchBackEndMaxRadius =  MirrorEnd[4] + MirrorNiThickness + 5.*cm;
269  G4double BenchMainLength;
270
271  BenchMainLength = MirrorPosition[3] - BenchThickness;
272
273  G4Cons* BenchFrontEndSolid;
274  G4Tubs* BenchBackEndSolid;
275  G4Cons* BenchMainSolid;
276
277  G4LogicalVolume* BenchFrontEndLogicalVolume;
278  G4LogicalVolume* BenchBackEndLogicalVolume;
279  G4LogicalVolume* BenchMainLogicalVolume;
280
281  BenchFrontEndSolid = new G4Cons( "BenchFrontEnd_S",
282                                   BenchFrontEndMinRadiusOut, BenchFrontEndMaxRadius,
283                                   BenchFrontEndMinRadiusIn, BenchFrontEndMaxRadius,
284                                   BenchThickness/2, 0*deg, 360.*deg );
285  BenchFrontEndLogicalVolume = new G4LogicalVolume(
286                                                   BenchFrontEndSolid, Al, "BenchFrontEnd_L", 0, 0, 0 );
287  BenchFrontEndLogicalVolume->SetVisAttributes(VisAttBench);
288
289  BenchBackEndSolid  = new G4Tubs( "BenchBackEnd_S",
290                                   BenchBackEndMinRadius, BenchBackEndMaxRadius,
291                                   BenchThickness/2, 0*deg, 360.*deg );
292  BenchBackEndLogicalVolume = new G4LogicalVolume(
293                                                  BenchBackEndSolid, Al, "BenchBackEnd_L", 0, 0, 0 );
294  BenchBackEndLogicalVolume->SetVisAttributes(VisAttBench);
295
296  BenchMainSolid     = new G4Cons( "BenchMain_S",
297                                   BenchFrontEndMaxRadius - BenchThickness,
298                                   BenchFrontEndMaxRadius,
299                                   BenchBackEndMaxRadius - BenchThickness,
300                                   BenchBackEndMaxRadius,
301                                   BenchMainLength/2, 0*deg, 360.*deg);
302  BenchMainLogicalVolume = new G4LogicalVolume(
303                                               BenchMainSolid, Cf, "BenchMain_L", 0, 0, 0 );
304  BenchMainLogicalVolume -> SetVisAttributes(VisAttBench);
305
306  // Physical volume
307  G4VPhysicalVolume* BenchFrontEndPhysicalVolume;
308  G4VPhysicalVolume* BenchBackEndPhysicalVolume;
309  G4VPhysicalVolume* BenchMainPhysicalVolume;
310
311  BenchFrontEndPhysicalVolume = new G4PVPlacement(
312                                                  rotateMatrix,
313                                                  G4ThreeVector( MirrorPosition[3] - BenchThickness/2,
314                                                                 0.0*cm, 0.0*cm ),
315                                                  "BenchFrontEnd_P",
316                                                  BenchFrontEndLogicalVolume,
317                                                  physicalWorld, false, 0 );
318
319  BenchBackEndPhysicalVolume = new G4PVPlacement(
320                                                 rotateMatrix,
321                                                 G4ThreeVector(0.0*cm - BenchThickness/2, 0.0*cm, 0.0*cm ),
322                                                 "BenchBackEnd_P",
323                                                 BenchBackEndLogicalVolume,
324                                                 physicalWorld, false, 0 );
325
326  BenchMainPhysicalVolume = new G4PVPlacement(
327                                              rotateMatrix,
328                                              G4ThreeVector( BenchMainLength/2, 0.0*cm, 0.0*cm ),
329                                              "BenchMain_P",
330                                              BenchMainLogicalVolume,
331                                              physicalWorld, false, 0 );
332
333  //--- Make Bench Invisible
334
335  // BenchFrontEndLogicalVolume -> SetVisAttributes(G4VisAttributes::Invisible);
336  // BenchBackEndLogicalVolume -> SetVisAttributes(G4VisAttributes::Invisible);
337  BenchMainLogicalVolume -> SetVisAttributes(G4VisAttributes::Invisible);
338
339  return;
340}
341
342// Construct Focal Plane
343// Conical Titanium baffle and silicon detector
344
345void XrayTelDetectorConstruction::ConstructFocalPlane()
346{
347
348  // Elements
349  G4Material* Ti = new G4Material("Titanium", 22., 47.867*g/mole, 4.54*g/cm3);
350  G4Material* Si = new G4Material("Silicon", 14., 28.090*g/mole, 2.33*g/cm3);
351
352  // Visualization attributes
353  G4VisAttributes* VisDetectorBaffle = new G4VisAttributes(
354                                                           G4Colour(190/255., 255/255., 0/255.) );
355  G4VisAttributes* VisDetector = new G4VisAttributes(
356                                                     G4Colour(255/255., 0/255., 0/255.) );
357
358  // Rotation Matrix
359  G4RotationMatrix *rotateMatrix = new G4RotationMatrix();
360  rotateMatrix -> rotateY(90.*deg);
361
362  // Construct Detector Baffle
363  G4double DetectorBaffleLength = 57.2*cm;
364  G4double DetectorBaffleOuterRadiusIn = 7.1*cm;
365  G4double DetectorBaffleOuterRadiusOut = 7.35*cm;
366  G4double DetectorBaffleInnerRadiusIn = 4.55*cm;
367  G4double DetectorBaffleInnerRadiusOut = 5.75*cm;
368
369  G4Cons* DetectorBaffleSolid;
370
371  G4LogicalVolume* DetectorBaffleLogicalVolume;
372
373  DetectorBaffleSolid = new G4Cons( "DetectorBaffle_S",             
374                                    DetectorBaffleOuterRadiusIn,
375                                    DetectorBaffleOuterRadiusOut,
376                                    DetectorBaffleInnerRadiusIn,
377                                    DetectorBaffleInnerRadiusOut,
378                                    DetectorBaffleLength/2, 0*deg, 360.*deg); 
379  DetectorBaffleLogicalVolume = new G4LogicalVolume( 
380                                                    DetectorBaffleSolid, Ti, "DetectorBaffle_L", 0, 0, 0 );
381  DetectorBaffleLogicalVolume -> SetVisAttributes( VisDetectorBaffle );
382
383  // Physical volume
384  G4VPhysicalVolume* DetectorBafflePhysicalVolume;
385
386  DetectorBafflePhysicalVolume = new G4PVPlacement(
387                                                   rotateMatrix,
388                                                   G4ThreeVector( DetectorBaffleLength/2, 0.0*cm, 0.0*cm),
389                                                   "DetectorBaffle_P",
390                                                   DetectorBaffleLogicalVolume,
391                                                   physicalWorld, false, 0 );
392
393  //--- Make Invisible
394
395  // DetectorBaffleLogicalVolume -> SetVisAttributes( G4VisAttributes::Invisible );
396
397  // Construct Detector
398
399  G4double DetectorRadius = 32.5*mm;
400  G4double DetectorThickness = 50e-6*m;
401
402  G4Tubs* DetectorSolid;
403
404  G4LogicalVolume* DetectorLogicalVolume;
405
406  DetectorSolid = new G4Tubs( "Detector_S",                       
407                              0, DetectorRadius,
408                              DetectorThickness/2, 0*deg, 360.*deg); 
409  DetectorLogicalVolume = new G4LogicalVolume( 
410                                              DetectorSolid, Si, "Detector_L", 0, 0, 0 );
411  DetectorLogicalVolume -> SetVisAttributes( VisDetector );
412
413  // Physical volume
414  G4VPhysicalVolume* DetectorPhysicalVolume;
415
416  DetectorPhysicalVolume = new G4PVPlacement( 
417                                             rotateMatrix,
418                                             G4ThreeVector( DetectorThickness/2, 0.0*cm, 0.0*cm),
419                                             "Detector_P",
420                                             DetectorLogicalVolume,
421                                             physicalWorld, false, 0 );
422
423  //--- Make Invisible
424  // DetectorLogicalVolume -> SetVisAttributes( G4VisAttributes::Invisible );
425
426  return;
427}
Note: See TracBrowser for help on using the repository browser.