Geant4-11
QDetectorConstruction.cc
Go to the documentation of this file.
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// QDetectorConstruction.cc
28//
29// 2005 Q
30// ====================================================================
32
33#include "G4Material.hh"
34#include "G4Tubs.hh"
35#include "G4Box.hh"
36#include "G4LogicalVolume.hh"
37#include "G4PVPlacement.hh"
38#include "G4VisAttributes.hh"
39#include "G4SystemOfUnits.hh"
40
41// ====================================================================
42//
43// class description
44//
45// ====================================================================
46
47// constants (detector parameters)
48static const G4double DXYZ_AREA= 30.*cm;
49
53{
54}
55
59{
60}
61
65{
66 G4Material* mate;
68
69 // ==============================================================
70 // world volume
71 // ==============================================================
72 G4Box* areaSolid= new G4Box("AREA",
73 DXYZ_AREA/2., DXYZ_AREA/2., DXYZ_AREA/2.);
74
75 G4Material* vacuum= G4Material::GetMaterial("Vacuum");
76 G4LogicalVolume* areaLV= new G4LogicalVolume(areaSolid, vacuum, "AREA_LV");
77 G4PVPlacement* area= new G4PVPlacement(0, G4ThreeVector(), "AREA_PV",
78 areaLV, 0, false, 0);
79 // vis. attributes
80 va= new G4VisAttributes(G4Color(1.,1.,1.));
81 va-> SetForceWireframe(true);
82 areaLV-> SetVisAttributes(va);
83
84 // ==============================================================
85 // detectors
86 // ==============================================================
87 // voxel
88 const G4double dvoxel= 10.*mm;
89 const G4double dl= 10.*cm;
90
91 G4Box* svoxel= new G4Box("voxel", dvoxel, dl, dvoxel);
92 mate= G4Material::GetMaterial("Vacuum");
93 G4LogicalVolume* lvoxel= new G4LogicalVolume(svoxel, mate, "voxel");
94 va= new G4VisAttributes(G4Color(0.,0.8,0.8));
95 va-> SetVisibility(false);
96 lvoxel-> SetVisAttributes(va);
97
98 G4int ix, iz;
99 G4int index=0;
100 for (iz=0; iz<5; iz++) {
101 for (ix=-7; ix<=7; ix++) {
102 G4double x0= (2.*ix)*cm;
103 G4double z0= (-13.+2.*iz)*cm;
104 /*G4PVPlacement* pvoxel=*/ new G4PVPlacement(0, G4ThreeVector(x0, 0., z0),
105 lvoxel, "voxel", areaLV, false, index);
106 index++;
107 }
108 }
109
110 // tube
111 //G4Tubs* stube= new G4Tubs("tube", 15./2.*mm, 19./2.*mm, dl,
112 G4Tubs* stube= new G4Tubs("tube", 0.*mm, 19./2.*mm, dl,
113 0., 360.*deg);
114 mate= G4Material::GetMaterial("Al");
115 G4LogicalVolume* ltube= new G4LogicalVolume(stube, mate, "tube");
116 va= new G4VisAttributes(G4Color(0.,0.8,0.8));
117 ltube-> SetVisAttributes(va);
118
120 rmtube-> rotateX(-90.*deg);
121 /*G4PVPlacement* ptube=*/ new G4PVPlacement(rmtube, G4ThreeVector(),
122 ltube, "tube", lvoxel, false, 0);
123
124 // cal
125 const G4double dxycal= 25.*mm;
126 const G4double dzcal= 3.*cm;
127
128 G4Box* scal= new G4Box("cal", dxycal, dxycal, dzcal);
129 mate= G4Material::GetMaterial("CsI");
130 G4LogicalVolume* lcal= new G4LogicalVolume(scal, mate, "cal");
131 va= new G4VisAttributes(G4Color(0.5,0.5,0.));
132 lcal-> SetVisAttributes(va);
133
134 index= 0;
135 for (ix=-2; ix<=2; ix++) {
136 G4double x0= (5.*ix)*cm;
137 /*G4PVPlacement* pcal=*/ new G4PVPlacement(0, G4ThreeVector(x0, 0., 2.*cm),
138 lcal, "cal", areaLV, false, index);
139 index++;
140 }
141
142 return area;
143}
144
G4Colour G4Color
Definition: G4Color.hh:41
CLHEP::HepRotation G4RotationMatrix
static constexpr double mm
Definition: G4SIunits.hh:95
static constexpr double cm
Definition: G4SIunits.hh:99
static constexpr double deg
Definition: G4SIunits.hh:132
CLHEP::Hep3Vector G4ThreeVector
double G4double
Definition: G4Types.hh:83
int G4int
Definition: G4Types.hh:85
Definition: G4Box.hh:56
static G4Material * GetMaterial(const G4String &name, G4bool warning=true)
Definition: G4Material.cc:686
Definition: G4Tubs.hh:75
virtual G4VPhysicalVolume * Construct()
static const G4double DXYZ_AREA