ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DetectorConstruction.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file DetectorConstruction.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 //
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 //
35 
36 #include "DetectorConstruction.hh"
37 
38 #include "G4NistManager.hh"
39 #include "G4Box.hh"
40 #include "G4LogicalVolume.hh"
41 #include "G4PVPlacement.hh"
42 
43 #include "G4VisAttributes.hh"
44 #include "G4PhysicalConstants.hh"
45 #include "G4SystemOfUnits.hh"
46 
47 #include "G4SDManager.hh"
49 #include "G4VPrimitiveScorer.hh"
50 #include "G4PSEnergyDeposit.hh"
51 #include "ScoreSpecies.hh"
52 #include "G4PSDoseDeposit.hh"
53 #include "PrimaryKiller.hh"
54 
55 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
56 
59 {}
60 
61 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
62 
64 {}
65 
66 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
67 
69 {
70  // Water is defined from NIST material database
72  G4Material* water = man->FindOrBuildMaterial("G4_WATER");
73 
74  //
75  // World
76  //
77  double world_sizeXYZ = 1. * kilometer;
78 
79  G4Box* solidWorld =
80  new G4Box("World",
81  0.5*world_sizeXYZ,
82  0.5*world_sizeXYZ,
83  0.5*world_sizeXYZ);
84 
85  G4LogicalVolume* logicWorld =
86  new G4LogicalVolume(solidWorld,
87  water,
88  "World");
89 
91  new G4PVPlacement(0, //no rotation
92  G4ThreeVector(), //its position at (0,0,0)
93  logicWorld, //its logical volume
94  "World", //its name
95  0, //its mother volume
96  false, //no boolean operation
97  0, //copy number
98  true); //checking overlaps
99 
100  // Visualization attributes
101  G4VisAttributes* worldVisAtt = new G4VisAttributes(G4Colour(.5, 1.0, .5));
102  worldVisAtt->SetVisibility(true);
103  logicWorld->SetVisAttributes(worldVisAtt);
104 
105  //always return the physical World
106  return physWorld;
107 }
108 
109 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
110 
112 {
114 
115  // declare World as a MultiFunctionalDetector scorer
116  //
117  G4MultiFunctionalDetector* mfDetector =
118  new G4MultiFunctionalDetector("mfDetector");
119 
120  //--
121  // Kill primary track after a chosen energy loss OR under a chosen
122  // kinetic energy
123  PrimaryKiller* primaryKiller = new PrimaryKiller("PrimaryKiller");
124  primaryKiller->SetMinLossEnergyLimit(500.*eV); // default value
125  primaryKiller->SetMaxLossEnergyLimit(1.*eV); // default value
126  mfDetector->RegisterPrimitive(primaryKiller);
127 
128  //--
129  // Record Species scorer:
130  // - scores number of species over time
131  // - score the total energy deposition
132  // - compute the radiochemical yields (G values)
133  G4VPrimitiveScorer* primitivSpecies = new ScoreSpecies("Species");
134  mfDetector->RegisterPrimitive(primitivSpecies);
136  SetSensitiveDetector("World", mfDetector);
137 }