source: trunk/source/visualization/test/src/BuildGeom_Example1.cc @ 1347

Last change on this file since 1347 was 1347, checked in by garnier, 13 years ago

geant4 tag 9.4

File size: 8.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: BuildGeom_Example1.cc,v 1.6 2006/06/29 21:34:12 gunter Exp $
28// GEANT4 tag $Name: geant4-09-04-ref-00 $
29//
30//
31// Makoto Asai - based on Long Baseline Neutrino Observatory experiment.
32// "Complete" detector but no rotated volumes.
33
34#include "BuildGeom_Example1.hh"
35
36#include <cmath>
37
38#include "globals.hh"
39#include "G4ThreeVector.hh"
40#include "G4Navigator.hh"
41#include "G4GeometryManager.hh"
42#include "G4Element.hh"
43#include "G4Material.hh"
44#include "G4PVPlacement.hh"
45#include "G4LogicalVolume.hh"
46#include "G4VisAttributes.hh"
47#include "G4Box.hh"
48#include "G4Tubs.hh"
49#include "G4Trd.hh"
50
51
52G4VPhysicalVolume* BuildGeom_Example1()
53{
54
55//--------- Material definition ---------
56
57  G4double a, iz, z, density;
58  G4String name, symbol;
59  G4int nel;
60
61  a = 1.01*g/mole;
62  G4Element* elH = new G4Element(name="Hydrogen", symbol="H", iz=1., a);
63  a = 12.01*g/mole;
64  G4Element* elC = new G4Element(name="Carbon", symbol="C", iz=6., a);
65  a = 14.01*g/mole;
66  G4Element* elN = new G4Element(name="Nitrogen", symbol="N", iz=7., a);
67  a = 16.00*g/mole;
68  G4Element* elO = new G4Element(name="Oxigen", symbol="O", iz=8., a);
69  a = 28.09*g/mole;
70  G4Element* elSi = new G4Element(name="Silicon", symbol="Si", iz=14., a);
71  a = 207.19*g/mole;
72  G4Element* elPb = new G4Element(name="Lead", symbol="Pb", iz=82., a);
73
74  a = 26.98*g/mole;
75  density = 2.7*g/cm3;
76  G4Material* Al = new G4Material(name="Aluminium", z=13., a, density);
77  a = 55.85*g/mole;
78  density = 7.87*g/cm3;
79  G4Material* Fe = new G4Material(name="Iron", z=26., a, density);
80  a = 207.19*g/mole;
81  density = 11.35*g/cm3;
82  //G4Material* Pb = new G4Material(name="Lead", z=82., a, density);
83  density = 1.29e-03*g/cm3;
84  G4Material* Air = new G4Material(name="Air", density, nel=2);
85  Air->AddElement(elN, .7);
86  Air->AddElement(elO, .3);
87  density = 5.2*g/cm3;
88  G4Material* LeadGlass = new G4Material(name="LeadGlass", density, nel=3);
89  LeadGlass->AddElement(elO, .199);
90  LeadGlass->AddElement(elSi, .127);
91  LeadGlass->AddElement(elPb, .674);
92  density = 1.0*g/cm3;
93  G4Material* Water = new G4Material(name="water",density,nel=2);
94  Water->AddElement(elH, (G4int)2);
95  Water->AddElement(elO, (G4int)1);
96  density = 1.032*g/cm3;
97  G4Material* Scinti = new G4Material(name="Scinti",density,nel=2);
98  Scinti->AddElement(elH, (G4int)1);
99  Scinti->AddElement(elC, (G4int)1);
100
101
102// Experimental hall (world volume)
103
104  G4Box *myWorldBox= new G4Box("WBox",600.*cm,1200.*cm,1000.*cm);
105  G4LogicalVolume *myWorldLog=new G4LogicalVolume(myWorldBox,Air,
106                                                    "WLog", 0, 0, 0);
107  myWorldLog -> SetVisAttributes (&G4VisAttributes::Invisible);
108  G4PVPlacement *myWorldPhys=new G4PVPlacement(0,G4ThreeVector(),
109                                                 "WPhys",
110                                                 myWorldLog,
111                                                 0,false,0);
112
113
114  G4double waterSciFiYpos = 100.*cm;
115
116  G4VisAttributes* red   = new G4VisAttributes (G4Colour (1,0,0));
117  G4VisAttributes* green = new G4VisAttributes (G4Colour (0,1,0));
118  G4VisAttributes* blue  = new G4VisAttributes (G4Colour (0,0,1));
119
120// WaterSciFi overall
121
122  G4Box* watSFBox = new G4Box("WSBox",160.*cm,65.*cm,160.*cm);
123  G4LogicalVolume* watSFLog = new G4LogicalVolume(watSFBox,Al,"WSLog",0,0,0);
124  watSFLog -> SetVisAttributes (red);
125  G4PVPlacement* watSFPhys = new G4PVPlacement(0,
126    G4ThreeVector(0.*cm,waterSciFiYpos,0.*cm),
127    "watSFPhys",watSFLog,myWorldPhys,false,0);
128
129// WaterSciFi water box
130
131  G4Box* watSFWBox = new G4Box("WSWBox",159.*cm,64.*cm,159.*cm);
132  G4LogicalVolume* watSFWLog = 
133    new G4LogicalVolume(watSFWBox,Water,"WSWLog",0,0,0);
134  watSFWLog -> SetVisAttributes (green);
135  G4PVPlacement* watSFWPhys = new G4PVPlacement(0,
136          G4ThreeVector(0.*cm,0.*cm,0.*cm),
137          "watSFWPhys",watSFWLog,watSFPhys,false,0);
138
139// Scinti plate (XXYY are merged into one plane)
140
141  G4Box* watSFSBox = new G4Box("WSSBox",159.*cm,0.1*cm,159.*cm);
142  G4LogicalVolume* watSFSLog = new G4LogicalVolume(watSFSBox,Scinti,"WSSLog",0,0,0);
143  watSFSLog -> SetVisAttributes (blue);
144  G4PVPlacement* watSFSPhys;
145  for(int iSFS=-10; iSFS<=10; iSFS++)
146  {
147    G4double SFSypos = iSFS*6.0*cm;
148    watSFSPhys = new G4PVPlacement(0,
149        G4ThreeVector(0.*cm,SFSypos,0.*cm),
150        "watSFSPhys",watSFSLog,watSFWPhys,false,iSFS+10);
151  }
152
153// LeadGlass support unit
154
155  G4Tubs* calUnitTubsR
156    = new G4Tubs("CUTubsR",174.636*cm,213.9*cm,30.5*cm,45.0*deg,45.0*deg);
157  G4LogicalVolume* calUnitLogR
158    = new G4LogicalVolume(calUnitTubsR,Fe,"CUlogR",0,0,0);
159  G4Tubs* calUnitTubsL
160    = new G4Tubs("CUTubsL",174.636*cm,213.9*cm,30.5*cm,90.0*deg,45.0*deg);
161  G4LogicalVolume* calUnitLogL
162    = new G4LogicalVolume(calUnitTubsL,Fe,"CUlogL",0,0,0);
163
164  G4PVPlacement* calUnitPhysR;
165  G4PVPlacement* calUnitPhysL;
166  for(int iCalUnit=-2; iCalUnit<=2; iCalUnit++)
167  {
168    G4double zCalRow = iCalUnit*61.0*cm;
169    calUnitPhysR = new G4PVPlacement(0,
170               G4ThreeVector(0.*cm,waterSciFiYpos,zCalRow),
171               "calUnitPhysR",calUnitLogR,myWorldPhys,false,iCalUnit+2);
172    calUnitPhysL = new G4PVPlacement(0,
173               G4ThreeVector(0.*cm,waterSciFiYpos,zCalRow),
174               "calUnitPhysL",calUnitLogL,myWorldPhys,false,iCalUnit+2);
175  }
176
177// LeadGlass body
178
179  G4Tubs* calRowTubsR
180    = new G4Tubs("CRTubsR",174.636*cm,212.9*cm,30.5*cm,45.0*deg,45.0*deg);
181  G4LogicalVolume* calRowLogR
182    = new G4LogicalVolume(calRowTubsR,LeadGlass,"CRlogR",0,0,0);
183  new G4PVPlacement(0,
184                    G4ThreeVector(0.*cm,0.*cm,0.*cm),
185                    "calRowPhysR",calRowLogR,calUnitPhysR,false,0);
186  G4Tubs* calRowTubsL
187    = new G4Tubs("CRTubsL",174.636*cm,212.9*cm,30.5*cm,90.0*deg,45.0*deg);
188  G4LogicalVolume* calRowLogL
189    = new G4LogicalVolume(calRowTubsL,LeadGlass,"CRlogL",0,0,0);
190  new G4PVPlacement(0,
191                    G4ThreeVector(0.*cm,0.*cm,0.*cm),
192                    "calRowPhysL",calRowLogL,calUnitPhysL,false,0);
193
194// Muon filter Iron
195
196  G4Box* muFeBox = new G4Box("muFe",400.*cm,5.0*cm,400.*cm);
197  G4LogicalVolume* muFeLog = new G4LogicalVolume(muFeBox,Fe,"MFLog",0,0,0);
198  G4Box* muChBox = new G4Box("muCh",400.*cm,10.0*cm,400.*cm);
199  G4LogicalVolume* muChLog = new G4LogicalVolume(muChBox,Air,"MCLog",0,0,0);
200
201  G4double muonChamberYPos = 300.*cm+waterSciFiYpos;
202
203  G4int muFeNo = 0;
204  G4int muChNo = 0;
205  G4PVPlacement* muFePhys;
206  G4PVPlacement* muChPhys;
207
208  for(G4int iMC1=0; iMC1<4; iMC1++)
209  {
210    muonChamberYPos += 10.*cm;
211    muChPhys = new G4PVPlacement(0,
212     G4ThreeVector(0.*cm,muonChamberYPos,0.*cm),
213     "muChPhys",muChLog,myWorldPhys,false,muChNo++);
214    muonChamberYPos += 10.*cm;
215
216    muonChamberYPos += 5.*cm;
217    muFePhys = new G4PVPlacement(0,
218     G4ThreeVector(0.*cm,muonChamberYPos,0.*cm),
219     "muFePhys",muFeLog,myWorldPhys,false,muFeNo++);
220    muonChamberYPos += 5.*cm;
221  }
222
223  for(G4int iMC2=0; iMC2<8; iMC2++)
224  {
225    muonChamberYPos += 10.*cm;
226    muChPhys = new G4PVPlacement(0,
227     G4ThreeVector(0.*cm,muonChamberYPos,0.*cm),
228     "muChPhys",muChLog,myWorldPhys,false,muChNo++);
229    muonChamberYPos += 10.*cm;
230
231    muonChamberYPos += 5.*cm;
232    muFePhys = new G4PVPlacement(0,
233     G4ThreeVector(0.*cm,muonChamberYPos,0.*cm),
234     "muFePhys",muFeLog,myWorldPhys,false,muFeNo++);
235    muonChamberYPos += 5.*cm;
236
237    muonChamberYPos += 5.*cm;
238    muFePhys = new G4PVPlacement(0,
239     G4ThreeVector(0.*cm,muonChamberYPos,0.*cm),
240     "muFePhys",muFeLog,myWorldPhys,false,muFeNo++);
241    muonChamberYPos += 5.*cm;
242  }
243
244  return myWorldPhys;
245}
246
Note: See TracBrowser for help on using the repository browser.