ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DetectorConstruction.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file DetectorConstruction.cc
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 //
28 //
29 //
31 //
32 // DetectorConstruction
33 //
34 // Created: 20.06.2008 V.Ivanchenko
35 //
36 // Modified:
37 //
39 //
40 
41 #include "DetectorConstruction.hh"
42 #include "DetectorMessenger.hh"
43 
44 #include "G4Tubs.hh"
45 #include "G4LogicalVolume.hh"
46 #include "G4PVPlacement.hh"
47 
48 #include "G4RunManager.hh"
49 
50 #include "G4GeometryManager.hh"
51 #include "G4PhysicalVolumeStore.hh"
52 #include "G4LogicalVolumeStore.hh"
53 #include "G4SolidStore.hh"
54 
55 #include "G4VisAttributes.hh"
56 #include "G4Colour.hh"
57 
58 #include "G4UnitsTable.hh"
59 #include "G4ios.hh"
60 
61 #include "G4NistManager.hh"
62 
63 #include "G4PhysicalConstants.hh"
64 #include "G4SystemOfUnits.hh"
65 
66 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
67 
70  fTargetMaterial(nullptr), fWorldMaterial(nullptr),
71  fSolidW(nullptr), fSolidA(nullptr),
72  fLogicTarget(nullptr), fLogicWorld(nullptr),
73  fPhysWorld(nullptr), fPhysList(nullptr)
74 {
76 
77  fRadius = 5.*cm;
78  fLength = 10.*cm;
79 
83 
85 }
86 
87 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
88 
90 {
91  delete fDetectorMessenger;
92 }
93 
95 {
96  // Sizes
99  if(fPhysWorld) {
104  }
105 }
106 
108 {
109  if(fPhysWorld) { return fPhysWorld; }
111 
112  //
113  // World
114  //
115  fSolidW = new G4Tubs("World", 0., fWorldR, 0.5*fWorldZ, 0., twopi);
117  fPhysWorld = new G4PVPlacement(nullptr, G4ThreeVector(0.,0.,0.),
118  fLogicWorld, "World",
119  nullptr, false, 0);
120 
121  //
122  // Target volume
123  //
124  fSolidA = new G4Tubs("Target", 0., fRadius, 0.5*fLength, 0.,twopi);
126  new G4PVPlacement(nullptr, G4ThreeVector(), fLogicTarget, "Target",
127  fLogicWorld, false, 0);
128 
129  G4cout << "### Target consist of "
130  << fTargetMaterial->GetName()
131  << " disks with R(mm)= " << fRadius/mm
132  << " fLength(mm)= " << fLength/mm
133  << " ###" << G4endl;
134 
135  // colors
137 
138  G4VisAttributes* regCcolor = new G4VisAttributes(G4Colour(0., 0.3, 0.7));
139  fLogicTarget->SetVisAttributes(regCcolor);
140 
141  G4cout << *(G4Material::GetMaterialTable()) << G4endl;
142 
143  return fPhysWorld;
144 }
145 
146 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
147 
149 {
150  // search the material by its name
152 
153  if (material && material != fTargetMaterial) {
157  }
158 }
159 
160 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
161 
163 {
164  // search the material by its name
166 
167  if (material && material != fWorldMaterial) {
171  }
172 }
173 
175 {
176  if(val > 0.0 && val != fRadius) {
177  fRadius = val;
179  }
180 }
181 
182 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
183 
185 {
186  if(val > 0.0 && val != fLength) {
187  fLength = val;
189  }
190 }
191 
192 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......