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