Geant4  10.03.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GB05DetectorConstruction.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 // $Id$
27 //
30 
32 #include "G4SystemOfUnits.hh"
33 
34 #include "G4Material.hh"
35 #include "G4NistManager.hh"
36 
37 #include "G4Box.hh"
38 #include "G4LogicalVolume.hh"
39 #include "G4PVPlacement.hh"
40 #include "G4LogicalVolumeStore.hh"
41 
42 #include "G4NistManager.hh"
43 
45 
46 #include "GB05SD.hh"
47 #include "G4SDManager.hh"
48 
49 
50 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
51 
54 {}
55 
56 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
57 
59 {}
60 
61 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
62 
64 {
65  // -- Collect a few materials from NIST database:
66  auto nistManager = G4NistManager::Instance();
67  G4Material* worldMaterial = nistManager->FindOrBuildMaterial("G4_Galactic");
68  G4Material* defaultMaterial = nistManager->FindOrBuildMaterial("G4_CONCRETE");
69 
70 
71  G4VSolid* solidWorld = new G4Box("World", 10*m, 10*m, 10*m );
72 
73  G4LogicalVolume* logicWorld = new G4LogicalVolume(solidWorld, // its solid
74  worldMaterial, // its material
75  "World"); // its name
76 
77  G4PVPlacement* physiWorld = new G4PVPlacement(0, // no rotation
78  G4ThreeVector(), // at (0,0,0)
79  logicWorld, // its logical volume
80  "World", // its name
81  0, // its mother volume
82  false, // no boolean operation
83  0); // copy number
84 
85  // -----------------------------------
86  // -- volume where biasing is applied:
87  // -----------------------------------
88  G4double halfXY = 5.0*m;
89  G4double halfZ = 1.0*m;
90  G4VSolid* solidShield = new G4Box("shield.solid", halfXY, halfXY, halfZ );
91 
92  G4LogicalVolume* logicShield = new G4LogicalVolume( solidShield, // its solid
93  defaultMaterial, // its material
94  "shield.logical"); // its name
95 
96  new G4PVPlacement(0, // no rotation
97  G4ThreeVector(0,0, halfZ), // volume entrance at (0,0,0)
98  logicShield, // its logical volume
99  "shield.phys", // its name
100  logicWorld, // its mother volume
101  false, // no boolean operation
102  0); // copy number
103 
104  // --------------------------------------------------------------------
105  // -- dummy volume to print information on particle exiting the shield:
106  // --------------------------------------------------------------------
107  G4double halfz = 1*cm;
108  G4VSolid* solidMeasurement = new G4Box("meas.solid", halfXY, halfXY, halfz );
109 
110  G4LogicalVolume* logicMeasurement = new G4LogicalVolume(solidMeasurement,// its solid
111  worldMaterial, // its material
112  "meas.logical"); // its name
113 
114  new G4PVPlacement(0, // no rotation
115  G4ThreeVector(0,0, 2*halfZ + halfz), // volume entrance at (0,0,0)
116  logicMeasurement, // its logical volume
117  "meas.phys", // its name
118  logicWorld, // its mother volume
119  false, // no boolean operation
120  0); // copy number
121 
122 
123  return physiWorld;
124 }
125 
126 
128 {
129  // -- Fetch volume for biasing:
130  G4LogicalVolume* logicShield =
131  G4LogicalVolumeStore::GetInstance()->GetVolume("shield.logical");
132 
133  // -------------------------------------------------------------
134  // -- operator creation, configuration and attachment to volume:
135  // -------------------------------------------------------------
136  GB05BOptrSplitAndKillByCrossSection* biasingOperator =
138  // -- Now, we declare to our biasing operator all the processes we
139  // -- their disapperance effect on neutrons to be counterbalanced
140  // -- by the splitting by cross-section :
141  biasingOperator->AddProcessToEquipoise("Decay");
142  biasingOperator->AddProcessToEquipoise("nCapture");
143  biasingOperator->AddProcessToEquipoise("neutronInelastic");
144 
145  biasingOperator->AttachTo(logicShield);
146 
147  G4cout << " Attaching biasing operator " << biasingOperator->GetName()
148  << " to logical volume " << biasingOperator->GetName()
149  << G4endl;
150 
151  // ------------------------------------------------------------------------------------
152  // -- Attach a sensitive detector to print information on particles exiting the shield:
153  // ------------------------------------------------------------------------------------
154  // -- create and register sensitive detector code module:
156  G4VSensitiveDetector* sd = new GB05SD("Scorer");
157  SDman->AddNewDetector(sd);
158  // -- Fetch volume for sensitivity and attach sensitive module to it:
159  G4LogicalVolume* logicSD =
160  G4LogicalVolumeStore::GetInstance()->GetVolume("meas.logical");
161  logicSD->SetSensitiveDetector(sd);
162 
163 }
CLHEP::Hep3Vector G4ThreeVector
Definition: G4Box.hh:64
Definition of the GB05DetectorConstruction class.
static G4NistManager * Instance()
G4LogicalVolume * GetVolume(const G4String &name, G4bool verbose=true) const
Definition of the GB05SD class.
G4GLOB_DLL std::ostream G4cout
virtual G4VPhysicalVolume * Construct()
Definition: GB05SD.hh:36
static constexpr double m
Definition: G4SIunits.hh:129
static constexpr double cm
Definition: G4SIunits.hh:119
static G4LogicalVolumeStore * GetInstance()
void AttachTo(const G4LogicalVolume *)
void AddNewDetector(G4VSensitiveDetector *aSD)
Definition: G4SDManager.cc:71
static G4SDManager * GetSDMpointer()
Definition: G4SDManager.cc:40
Definition of the GB05BOptrSplitAndKillByCrossSection class.
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
void SetSensitiveDetector(G4VSensitiveDetector *pSDetector)
const G4String GetName() const