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