LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
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 // ====================================================================
31 #include "QDetectorConstruction.hh"
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)
48 static const G4double DXYZ_AREA= 30.*cm;
49 static const G4double DW= 10.*cm;
50 
54 {
55 }
56 
60 {
61 }
62 
66 {
67  G4Material* mate;
68  G4VisAttributes* va;
69 
70  // ==============================================================
71  // world volume
72  // ==============================================================
73  G4Box* areaSolid= new G4Box("AREA",
74  DXYZ_AREA/2., DXYZ_AREA/2., DXYZ_AREA/2.);
75 
76  G4Material* vacuum= G4Material::GetMaterial("Vacuum");
77  G4LogicalVolume* areaLV= new G4LogicalVolume(areaSolid, vacuum, "AREA_LV");
78  G4PVPlacement* area= new G4PVPlacement(0, G4ThreeVector(), "AREA_PV",
79  areaLV, 0, false, 0);
80  // vis. attributes
81  va= new G4VisAttributes(G4Color(1.,1.,1.));
82  va-> SetForceWireframe(true);
83  areaLV-> SetVisAttributes(va);
84 
85  // ==============================================================
86  // detectors
87  // ==============================================================
88  // voxel
89  const G4double dvoxel= 10.*mm;
90  const G4double dl= 10.*cm;
91 
92  G4Box* svoxel= new G4Box("voxel", dvoxel, dl, dvoxel);
93  mate= G4Material::GetMaterial("Vacuum");
94  G4LogicalVolume* lvoxel= new G4LogicalVolume(svoxel, mate, "voxel");
95  va= new G4VisAttributes(G4Color(0.,0.8,0.8));
96  va-> SetVisibility(false);
97  lvoxel-> SetVisAttributes(va);
98 
99  G4int ix, iz;
100  G4int index=0;
101  for (iz=0; iz<5; iz++) {
102  for (ix=-7; ix<=7; ix++) {
103  G4double x0= (2.*ix)*cm;
104  G4double z0= (-13.+2.*iz)*cm;
105  G4PVPlacement* pvoxel= new
106  G4PVPlacement(0, G4ThreeVector(x0, 0., z0),
107  lvoxel, "voxel", areaLV, false, index);
108  index++;
109  }
110  }
111 
112  // tube
113  //G4Tubs* stube= new G4Tubs("tube", 15./2.*mm, 19./2.*mm, dl,
114  G4Tubs* stube= new G4Tubs("tube", 0.*mm, 19./2.*mm, dl,
115  0., 360.*deg);
116  mate= G4Material::GetMaterial("Al");
117  G4LogicalVolume* ltube= new G4LogicalVolume(stube, mate, "tube");
118  va= new G4VisAttributes(G4Color(0.,0.8,0.8));
119  ltube-> SetVisAttributes(va);
120 
121  G4RotationMatrix* rmtube= new G4RotationMatrix;
122  rmtube-> rotateX(-90.*deg);
123  G4PVPlacement* ptube= new
124  G4PVPlacement(rmtube, G4ThreeVector(),
125  ltube, "tube", lvoxel, false, 0);
126 
127  // cal
128  const G4double dxycal= 25.*mm;
129  const G4double dzcal= 3.*cm;
130 
131  G4Box* scal= new G4Box("cal", dxycal, dxycal, dzcal);
132  mate= G4Material::GetMaterial("CsI");
133  G4LogicalVolume* lcal= new G4LogicalVolume(scal, mate, "cal");
134  va= new G4VisAttributes(G4Color(0.5,0.5,0.));
135  lcal-> SetVisAttributes(va);
136 
137  index= 0;
138  for (ix=-2; ix<=2; ix++) {
139  G4double x0= (5.*ix)*cm;
140  G4PVPlacement* pcal= new
141  G4PVPlacement(0, G4ThreeVector(x0, 0., 2.*cm),
142  lcal, "cal", areaLV, false, index);
143  index++;
144  }
145 
146  return area;
147 }
148 
static const G4double DXYZ_AREA
virtual G4VPhysicalVolume * Construct()
static const G4double DW