Geant4  10.02.p01
DetectorConstruction.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 // This example is provided by the Geant4-DNA collaboration
27 // Any report or published results obtained using the Geant4-DNA software
28 // shall cite the following Geant4-DNA collaboration publication:
29 // Med. Phys. 37 (2010) 4692-4708
30 // The Geant4-DNA web site is available at http://geant4-dna.org
31 //
32 // $Id: DetectorConstruction.cc 87359 2014-12-01 16:04:27Z gcosmo $
33 //
36 
37 #include "DetectorConstruction.hh"
38 #include "TrackerSD.hh"
39 
40 #include "G4Material.hh"
41 #include "G4NistManager.hh"
42 
43 #include "G4Box.hh"
44 #include "G4PVPlacement.hh"
45 
46 #include "G4GeometryTolerance.hh"
47 #include "G4GeometryManager.hh"
48 
49 #include "G4SystemOfUnits.hh"
50 
51 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
52 
55 {
56 }
57 
58 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
59 
61 {
62 }
63 
64 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
65 
67 {
68  // Define materials
70 
71  // Define volumes
72  return DefineVolumes();
73 }
74 
75 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
76 
78 {
79  // Water is defined from NIST material database
81 
82  G4Material * H2O = man->FindOrBuildMaterial("G4_WATER");
83 
84  fpWaterMaterial = H2O;
85 
86  // Print materials
88 }
89 
90 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
91 
93 {
94  G4double worldLength = 200*um;
95 
96  // World
97 
99 
100  G4cout << "Computed tolerance = "
102  << " nm" << G4endl;
103 
104  G4Box* worldS
105  = new G4Box("world", //its name
106  worldLength/2,worldLength/2,worldLength/2); //its size
107 
108  G4LogicalVolume* worldLV
109  = new G4LogicalVolume(
110  worldS, //its solid
111  fpWaterMaterial, //its material
112  "World_LV"); //its name
113 
114  G4VPhysicalVolume* worldPV
115  = new G4PVPlacement(
116  0, // no rotation
117  G4ThreeVector(), // at (0,0,0)
118  worldLV, // its logical volume
119  "World", // its name
120  0, // its mother volume
121  false, // no boolean operations
122  0, // copy number
123  false); // checking overlaps
124 
125  return worldPV;
126 }
127 
128 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
129 
131 {
132  // Sensitive detectors
133 
134  G4String trackerChamberSDname = "TrackerChamberSD";
135 
136  TrackerSD* aTrackerSD = new TrackerSD(trackerChamberSDname,
137  "TrackerHitsCollection");
138 
139  // Setting aTrackerSD to all logical volumes with the same name
140  // of "Chamber_LV".
141  SetSensitiveDetector("World_LV", aTrackerSD, true);
142 
143 }
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)
Definition of the TrackerSD class.
CLHEP::Hep3Vector G4ThreeVector
Definition: G4Box.hh:64
G4VPhysicalVolume * Construct()
G4double GetSurfaceTolerance() const
static G4MaterialTable * GetMaterialTable()
Definition: G4Material.cc:589
void SetWorldMaximumExtent(G4double worldExtent)
static G4NistManager * Instance()
virtual void ConstructSDandField()
G4GLOB_DLL std::ostream G4cout
static const double nm
Definition: G4SIunits.hh:111
Tracker sensitive detector class.
Definition: TrackerSD.hh:52
static G4GeometryManager * GetInstance()
void SetSensitiveDetector(const G4String &logVolName, G4VSensitiveDetector *aSD, G4bool multi=false)
static const double um
Definition: G4SIunits.hh:112
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
G4VPhysicalVolume * DefineVolumes()
static G4GeometryTolerance * GetInstance()