source: trunk/source/visualization/test/src/BuildGeom_Example2.cc @ 954

Last change on this file since 954 was 954, checked in by garnier, 15 years ago

remise a jour

File size: 7.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// $Id: BuildGeom_Example2.cc,v 1.6 2006/06/29 21:34:14 gunter Exp $
28// GEANT4 tag $Name:  $
29//
30//
31// Makoto Asai - based on Long Baseline Neutrino Observatory experiment.
32// Embryo detector with rotated volumes
33
34#include "BuildGeom_Example2.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 "G4Box.hh"
47#include "G4Tubs.hh"
48#include "G4Trd.hh"
49
50
51G4PVPlacement* calUnitPhys; 
52G4PVPlacement* calRowPhys;
53G4PVPlacement* calCellPhys;
54
55G4VPhysicalVolume* BuildGeom_Example2()
56{
57
58//--------- Material definition ---------
59
60  G4double a, iz, density;
61  G4String name, symbol;
62  G4int nel;
63
64  a = 1.01*g/mole;
65  G4Element* elH = new G4Element(name="Hydrogen", symbol="H", iz=1., a);
66  a = 14.01*g/mole;
67  G4Element* elN = new G4Element(name="Nitrogen", symbol="N", iz=7., a);
68  a = 16.00*g/mole;
69  G4Element* elO = new G4Element(name="Oxigen", symbol="O", iz=8., a);
70  a = 28.09*g/mole;
71  G4Element* elSi = new G4Element(name="Silicon", symbol="Si", iz=14., a);
72  a = 207.19*g/mole;
73  G4Element* elPb = new G4Element(name="Lead", symbol="Pb", iz=82., a);
74
75  //a = 26.98*g/mole;
76  //density = 2.7*g/cm3;
77  //G4Material* Al = new G4Material(name="Aluminium", z=13., a, density);
78  //a = 55.85*g/mole;
79  //density = 7.87*g/cm3;
80  //G4Material* Fe = new G4Material(name="Iron", z=26., a, density);
81  //a = 207.19*g/mole;
82  //density = 11.35*g/cm3;
83  //G4Material* Pb = new G4Material(name="Lead", z=82., a, density);
84  density = 1.29e-03*g/cm3;
85  G4Material* Air = new G4Material(name="Air", density, nel=2);
86  Air->AddElement(elN, .7);
87  Air->AddElement(elO, .3);
88  density = 5.2*g/cm3;
89  G4Material* LeadGlass = new G4Material(name="LeadGlass", density, nel=3);
90  LeadGlass->AddElement(elO, .199);
91  LeadGlass->AddElement(elSi, .127);
92  LeadGlass->AddElement(elPb, .674);
93  density = 1.0*g/cm3;
94  G4Material* Water = new G4Material(name="water",density,nel=2);
95  Water->AddElement(elH, (G4int)2);
96  Water->AddElement(elO, (G4int)1);
97
98
99// Experimental hall (world volume)
100
101  G4Box *myWorldBox= new G4Box("WBox",750*cm,1000*cm,1200*cm);
102  G4LogicalVolume *myWorldLog=new G4LogicalVolume(myWorldBox,Air,
103                                                    "WLog", 0, 0, 0);
104  G4PVPlacement *myWorldPhys=new G4PVPlacement(0,G4ThreeVector(),
105                                                 "WPhys",
106                                                 myWorldLog,
107                                                 0,false,0);
108
109  G4double waterCherenkovZpos = 100.*cm;
110
111
112// LeadGlass unit
113
114  G4Tubs* calUnitTubs
115    = new G4Tubs("CUTubs",170*cm,240*cm,30.5*cm,-22.5*deg,45.0*deg);
116  G4LogicalVolume* calUnitLog
117    = new G4LogicalVolume(calUnitTubs,Air,"CUlog",0,0,0);
118
119  G4RotationMatrix* calUnitRotR = new G4RotationMatrix();
120  calUnitRotR->rotateX(-90.0*deg);
121  calUnitRotR->rotateY(-112.5*deg);
122  G4RotationMatrix* calUnitRotL = new G4RotationMatrix();
123  calUnitRotL->rotateX(-90.0*deg);
124  calUnitRotL->rotateY(-67.5*deg);
125
126  G4int calUnitCopyNo = 0;
127  //G4PVPlacement *calUnitPhys;
128  //for(int iCalUnit=2; iCalUnit>=-2; iCalUnit--)
129  for(int iCalUnit=2; iCalUnit>=2; iCalUnit--)
130  {
131    G4double yCalRow = iCalUnit*61.0*cm;
132    //calUnitPhys = new G4PVPlacement(calUnitRotL,
133    //           G4ThreeVector(0.*cm,yCalRow,waterCherenkovZpos),
134    //           "calUnitPhys",calUnitLog,myWorldPhys,false,calUnitCopyNo++);
135    calUnitPhys = new G4PVPlacement(calUnitRotR,
136               G4ThreeVector(0.*cm,yCalRow,waterCherenkovZpos),
137               "calUnitPhys",calUnitLog,myWorldPhys,false,calUnitCopyNo++);
138  }
139
140
141// LeadGlass row
142
143  G4Tubs* calRowTubs
144    = new G4Tubs("CRTubs",170*cm,212.9*cm,6.1*cm,-22.5*deg,45.0*deg);
145  G4LogicalVolume* calRowLog
146    = new G4LogicalVolume(calRowTubs,Air,"CRlog",0,0,0);
147
148  G4int calRowCopyNo = 0;
149  //G4PVPlacement *calRowPhys;
150  //for(int iCalRow=-2; iCalRow<=2; iCalRow++)
151  for(int iCalRow=-2; iCalRow<=-2; iCalRow++)
152  {
153    G4double zCalRow = iCalRow*12.2*cm;
154    calRowPhys = new G4PVPlacement(0,
155               G4ThreeVector(0.*cm,0.*cm,zCalRow),
156               "calRowPhys",calRowLog,calUnitPhys,false,calRowCopyNo++);
157  }
158
159
160// LeadGlass cell
161
162  G4Trd* calCellTrd 
163    = new G4Trd("CCtrd",5.65*cm,6.75*cm,6.1*cm,6.1*cm,17.0*cm);
164  G4LogicalVolume* calCellLog
165    = new G4LogicalVolume(calCellTrd,LeadGlass,"CCtrd",0,0,0);
166
167  G4double calCellOpeningAngle = 3.702*deg;
168  G4double calCellZpos = 191.636*cm;
169  //G4PVPlacement* calCellPhys;
170  for(int iCalCell=0; iCalCell<=11; iCalCell++)
171  {
172    G4RotationMatrix* calCellRot = new G4RotationMatrix();
173    calCellRot->rotateX(90.0*deg);
174    G4double cellRotAngle = (5.5-iCalCell)*calCellOpeningAngle;
175    calCellRot->rotateZ(cellRotAngle+90.0*deg);
176/*
177    G4cout << calCellRot << G4endl;
178    G4cout << calCellRot->xx() << " "
179         << calCellRot->xy() << " "
180         << calCellRot->xz() << " " << G4endl;
181    G4cout << calCellRot->yx() << " "
182         << calCellRot->yy() << " "
183         << calCellRot->yz() << " " << G4endl;
184    G4cout << calCellRot->zx() << " "
185         << calCellRot->zy() << " "
186         << calCellRot->zz() << " " << G4endl;
187*/
188    G4double calCellX = calCellZpos * std::cos(cellRotAngle/rad);
189    G4double calCellY = calCellZpos * std::sin(cellRotAngle/rad);
190    calCellPhys = new G4PVPlacement(calCellRot,
191               G4ThreeVector(calCellX,calCellY,0.*cm),
192               "calRowPhys",calCellLog,calRowPhys,false,iCalCell);
193/*
194    G4RotationMatrix* tmpRot = calCellPhys->GetRotation();
195    G4cout << "saved : " << tmpRot << G4endl;
196    G4cout << tmpRot->xx() << " "
197         << tmpRot->xy() << " "
198         << tmpRot->xz() << " " << G4endl;
199    G4cout << tmpRot->yx() << " "
200         << tmpRot->yy() << " "
201         << tmpRot->yz() << " " << G4endl;
202    G4cout << tmpRot->zx() << " "
203         << tmpRot->zy() << " "
204         << tmpRot->zz() << " " << G4endl;
205*/
206  }
207
208  return myWorldPhys;
209}
210
Note: See TracBrowser for help on using the repository browser.