ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
XDetectorConstruction.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file XDetectorConstruction.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 //
30 // 20141006 For MT compatibility, move SD handling to ConstructSDandField()
31 
32 #include "XDetectorConstruction.hh"
33 
34 #include "G4Material.hh"
35 #include "G4NistManager.hh"
36 #include "G4SDManager.hh"
37 
38 #include "G4Box.hh"
39 #include "G4Tubs.hh"
40 #include "G4Sphere.hh"
41 #include "G4LogicalVolume.hh"
42 #include "G4PVPlacement.hh"
43 #include "G4VisAttributes.hh"
44 #include "G4Colour.hh"
45 #include "G4SDManager.hh"
46 
48 #include "G4LatticePhysical.hh"
49 #include "G4LatticeLogical.hh"
50 #include "G4LatticeManager.hh"
51 
52 #include "G4UserLimits.hh"
53 #include "G4SystemOfUnits.hh"
54 #include "G4ios.hh"
55 
56 
57 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
58 
60  : fConstructed(false), fIfField(false) {
61  fLiquidHelium = NULL;
62  fGermanium = NULL;
63  fAluminum = NULL;
64  fTungsten = NULL;
65  fWorldPhys = NULL;
66 }
67 
68 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
69 
71 
72 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
73 
75 {
76  if(!fConstructed)
77  {
78  fConstructed = true;
80  SetupGeometry();
81  }
82  return fWorldPhys;
83 }
84 
85 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
86 
88 {
89  G4NistManager* nistManager = G4NistManager::Instance();
90 
91  fLiquidHelium = nistManager->FindOrBuildMaterial("G4_AIR"); // to be corrected
92  fGermanium = nistManager->FindOrBuildMaterial("G4_Ge");
93  fAluminum = nistManager->FindOrBuildMaterial("G4_Al");
94  fTungsten = nistManager->FindOrBuildMaterial("G4_W");
95 }
96 
97 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
98 
100 {
101  //
102  // World
103  //
104  G4VSolid* worldSolid = new G4Box("World",16.*cm,16.*cm,16.*cm);
105  G4LogicalVolume* worldLogical =
106  new G4LogicalVolume(worldSolid,fLiquidHelium,"World");
107  worldLogical->SetUserLimits(new G4UserLimits(10*mm, DBL_MAX, DBL_MAX, 0, 0));
108  fWorldPhys = new G4PVPlacement(0,G4ThreeVector(),worldLogical,"World",0,
109  false,0);
110 
111  //
112  // Germanium cylinder - this is the volume in which we will propagate phonons
113  //
114  G4VSolid* fGermaniumSolid = new G4Tubs("fGermaniumSolid",0.*cm,3.81*cm,
115  1.27*cm, 0.*deg, 360.*deg);
116  G4LogicalVolume* fGermaniumLogical =
117  new G4LogicalVolume(fGermaniumSolid,fGermanium,"fGermaniumLogical");
118  G4VPhysicalVolume* GePhys =
119  new G4PVPlacement(0,G4ThreeVector(),fGermaniumLogical,"fGermaniumPhysical",
120  worldLogical,false,0);
121 
122  //
123  //Germanium lattice information
124  //
125 
126  // G4LatticeManager gives physics processes access to lattices by volume
128  G4LatticeLogical* GeLogical = LM->LoadLattice(fGermanium, "Ge");
129 
130  // G4LatticePhysical assigns G4LatticeLogical a physical orientation
131  G4LatticePhysical* GePhysical =
132  new G4LatticePhysical(GeLogical, GePhys->GetFrameRotation());
133  LM->RegisterLattice(GePhys, GePhysical);
134 
135  // NOTE: Above registration can also be done in single step:
136  // G4LatticlePhysical* GePhysical = LM->LoadLattice(GePhys, "Ge");
137 
138  //
139  // Aluminum - crystal end caps. This is where phonon hits are registered
140  //
141  G4VSolid* fAluminumSolid = new G4Tubs("aluminiumSolid",0.*cm,3.81*cm,0.01*cm,
142  0.*deg, 360.*deg);
143 
144  G4LogicalVolume* fAluminumLogical =
145  new G4LogicalVolume(fAluminumSolid,fAluminum,"fAluminumLogical");
146  new G4PVPlacement(0,G4ThreeVector(0.,0.,1.28*cm),fAluminumLogical,
147  "fAluminumPhysical",worldLogical,false,0);
148  new G4PVPlacement(0,G4ThreeVector(0.,0.,-1.28*cm),fAluminumLogical,
149  "fAluminumPhysical",worldLogical,false,1);
150 
151  //
152  // Visualization attributes
153  //
155  G4VisAttributes* simpleBoxVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,1.0));
156  simpleBoxVisAtt->SetVisibility(true);
157  fGermaniumLogical->SetVisAttributes(simpleBoxVisAtt);
158  fAluminumLogical->SetVisAttributes(simpleBoxVisAtt);
159 }
160 
161 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
162 
164  //
165  // detector -- Note : Aluminum electrode sensitivity is attached to Germanium
166  //
167  XAluminumElectrodeSensitivity* electrodeSensitivity =
168  new XAluminumElectrodeSensitivity("XAluminumElectrode");
169  G4SDManager::GetSDMpointer()->AddNewDetector(electrodeSensitivity);
170  SetSensitiveDetector("fGermaniumLogical", electrodeSensitivity);
171 }
172 
173 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....