Geant4  10.03.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 // J. Comput. Phys. 274 (2014) 841-882
31 // The Geant4-DNA web site is available at http://geant4-dna.org
32 //
33 // $Id$
36 
37 #include "DetectorConstruction.hh"
38 
39 #include "G4NistManager.hh"
40 #include "G4Box.hh"
41 #include "G4LogicalVolume.hh"
42 #include "G4PVPlacement.hh"
43 
44 #include "G4VisAttributes.hh"
45 #include "G4PhysicalConstants.hh"
46 #include "G4SystemOfUnits.hh"
47 
48 #include "G4SDManager.hh"
50 #include "G4VPrimitiveScorer.hh"
51 #include "G4PSEnergyDeposit.hh"
52 #include "ScoreSpecies.hh"
53 #include "G4PSDoseDeposit.hh"
54 #include "PrimaryKiller.hh"
55 
56 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
57 
60 {}
61 
62 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
63 
65 {}
66 
67 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
68 
70 {
71  // Water is defined from NIST material database
73  G4Material* water = man->FindOrBuildMaterial("G4_WATER");
74 
75  //
76  // World
77  //
78  double world_sizeXYZ = 1. * kilometer;
79 
80  G4Box* solidWorld =
81  new G4Box("World",
82  0.5*world_sizeXYZ,
83  0.5*world_sizeXYZ,
84  0.5*world_sizeXYZ);
85 
86  G4LogicalVolume* logicWorld =
87  new G4LogicalVolume(solidWorld,
88  water,
89  "World");
90 
91  G4VPhysicalVolume* physWorld =
92  new G4PVPlacement(0, //no rotation
93  G4ThreeVector(), //its position at (0,0,0)
94  logicWorld, //its logical volume
95  "World", //its name
96  0, //its mother volume
97  false, //no boolean operation
98  0, //copy number
99  true); //checking overlaps
100 
101  // Visualization attributes
102  G4VisAttributes* worldVisAtt = new G4VisAttributes(G4Colour(.5, 1.0, .5));
103  worldVisAtt->SetVisibility(true);
104  logicWorld->SetVisAttributes(worldVisAtt);
105 
106  //always return the physical World
107  return physWorld;
108 }
109 
110 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
111 
113 {
115 
116  // declare World as a MultiFunctionalDetector scorer
117  //
118  G4MultiFunctionalDetector* mfDetector =
119  new G4MultiFunctionalDetector("mfDetector");
120 
121  //--
122  // Kill primary track after a chosen energy loss OR under a chosen
123  // kinetic energy
124  PrimaryKiller* primaryKiller = new PrimaryKiller("PrimaryKiller");
125  primaryKiller->SetMinLossEnergyLimit(500.*eV); // default value
126  primaryKiller->SetMaxLossEnergyLimit(1.*eV); // default value
127  mfDetector->RegisterPrimitive(primaryKiller);
128 
129  //--
130  // Record Species scorer:
131  // - scores number of species over time
132  // - score the total energy deposition
133  // - compute the radiochemical yields (G values)
134  G4VPrimitiveScorer* primitivSpecies = new ScoreSpecies("Species");
135  mfDetector->RegisterPrimitive(primitivSpecies);
137  SetSensitiveDetector("World", mfDetector);
138 }
G4bool RegisterPrimitive(G4VPrimitiveScorer *)
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)
CLHEP::Hep3Vector G4ThreeVector
Definition: G4Box.hh:64
void SetVerboseLevel(G4int vl)
Definition: G4SDManager.hh:90
G4VPhysicalVolume * Construct()
static G4NistManager * Instance()
void SetMaxLossEnergyLimit(double energy)
virtual void ConstructSDandField()
void SetVisibility(G4bool=true)
static constexpr double eV
Definition: G4SIunits.hh:215
void SetSensitiveDetector(const G4String &logVolName, G4VSensitiveDetector *aSD, G4bool multi=false)
void AddNewDetector(G4VSensitiveDetector *aSD)
Definition: G4SDManager.cc:71
void SetMinLossEnergyLimit(double energy)
static G4SDManager * GetSDMpointer()
Definition: G4SDManager.cc:40
static constexpr double kilometer
Definition: G4SIunits.hh:94
void SetVisAttributes(const G4VisAttributes *pVA)