source: trunk/examples/novice/N01/src/ExN01DetectorConstruction.cc @ 807

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

update

File size: 5.7 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// $Id: ExN01DetectorConstruction.cc,v 1.9 2006/06/29 17:47:19 gunter Exp $
28// GEANT4 tag $Name:  $
29//
30
31#include "ExN01DetectorConstruction.hh"
32
33#include "G4Material.hh"
34#include "G4Box.hh"
35#include "G4Tubs.hh"
36#include "G4LogicalVolume.hh"
37#include "G4ThreeVector.hh"
38#include "G4PVPlacement.hh"
39#include "globals.hh"
40
41ExN01DetectorConstruction::ExN01DetectorConstruction()
42 :  experimentalHall_log(0), tracker_log(0),
43    calorimeterBlock_log(0), calorimeterLayer_log(0),
44    experimentalHall_phys(0), calorimeterLayer_phys(0),
45    calorimeterBlock_phys(0), tracker_phys(0)
46{;}
47
48ExN01DetectorConstruction::~ExN01DetectorConstruction()
49{
50}
51
52G4VPhysicalVolume* ExN01DetectorConstruction::Construct()
53{
54
55  //------------------------------------------------------ materials
56
57  G4double a;  // atomic mass
58  G4double z;  // atomic number
59  G4double density;
60
61  G4Material* Ar = 
62  new G4Material("ArgonGas", z= 18., a= 39.95*g/mole, density= 1.782*mg/cm3);
63
64  G4Material* Al = 
65  new G4Material("Aluminum", z= 13., a= 26.98*g/mole, density= 2.7*g/cm3);
66
67  G4Material* Pb = 
68  new G4Material("Lead", z= 82., a= 207.19*g/mole, density= 11.35*g/cm3);
69
70  //------------------------------------------------------ volumes
71
72  //------------------------------ experimental hall (world volume)
73  //------------------------------ beam line along x axis
74
75  G4double expHall_x = 3.0*m;
76  G4double expHall_y = 1.0*m;
77  G4double expHall_z = 1.0*m;
78  G4Box* experimentalHall_box
79    = new G4Box("expHall_box",expHall_x,expHall_y,expHall_z);
80  experimentalHall_log = new G4LogicalVolume(experimentalHall_box,
81                                             Ar,"expHall_log",0,0,0);
82  experimentalHall_phys = new G4PVPlacement(0,G4ThreeVector(),
83                                      experimentalHall_log,"expHall",0,false,0);
84
85  //------------------------------ a tracker tube
86
87  G4double innerRadiusOfTheTube = 0.*cm;
88  G4double outerRadiusOfTheTube = 60.*cm;
89  G4double hightOfTheTube = 50.*cm;
90  G4double startAngleOfTheTube = 0.*deg;
91  G4double spanningAngleOfTheTube = 360.*deg;
92  G4Tubs* tracker_tube = new G4Tubs("tracker_tube",innerRadiusOfTheTube,
93                                    outerRadiusOfTheTube,hightOfTheTube,
94                                    startAngleOfTheTube,spanningAngleOfTheTube);
95  tracker_log = new G4LogicalVolume(tracker_tube,Al,"tracker_log",0,0,0);
96  G4double trackerPos_x = -1.0*m;
97  G4double trackerPos_y = 0.*m;
98  G4double trackerPos_z = 0.*m;
99  tracker_phys = new G4PVPlacement(0,
100             G4ThreeVector(trackerPos_x,trackerPos_y,trackerPos_z),
101             tracker_log,"tracker",experimentalHall_log,false,0);
102
103  //------------------------------ a calorimeter block
104
105  G4double block_x = 1.0*m;
106  G4double block_y = 50.0*cm;
107  G4double block_z = 50.0*cm;
108  G4Box* calorimeterBlock_box = new G4Box("calBlock_box",block_x,
109                                          block_y,block_z);
110  calorimeterBlock_log = new G4LogicalVolume(calorimeterBlock_box,
111                                             Pb,"caloBlock_log",0,0,0);
112  G4double blockPos_x = 1.0*m;
113  G4double blockPos_y = 0.0*m;
114  G4double blockPos_z = 0.0*m;
115  calorimeterBlock_phys = new G4PVPlacement(0,
116             G4ThreeVector(blockPos_x,blockPos_y,blockPos_z),
117             calorimeterBlock_log,"caloBlock",experimentalHall_log,false,0);
118
119  //------------------------------ calorimeter layers
120
121  G4double calo_x = 1.*cm;
122  G4double calo_y = 40.*cm;
123  G4double calo_z = 40.*cm;
124  G4Box* calorimeterLayer_box = new G4Box("caloLayer_box",
125                                          calo_x,calo_y,calo_z);
126  calorimeterLayer_log = new G4LogicalVolume(calorimeterLayer_box,
127                                             Al,"caloLayer_log",0,0,0);
128  for(G4int i=0;i<19;i++) // loop for 19 layers
129  {
130    G4double caloPos_x = (i-9)*10.*cm;
131    G4double caloPos_y = 0.0*m;
132    G4double caloPos_z = 0.0*m;
133    calorimeterLayer_phys = new G4PVPlacement(0,
134               G4ThreeVector(caloPos_x,caloPos_y,caloPos_z),
135               calorimeterLayer_log,"caloLayer",calorimeterBlock_log,false,i);
136  }
137
138  //------------------------------------------------------------------
139
140  return experimentalHall_phys;
141}
142
Note: See TracBrowser for help on using the repository browser.