Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // 26 // 27 /// \file GB05DetectorConstruction.cc 27 /// \file GB05DetectorConstruction.cc 28 /// \brief Implementation of the GB05DetectorC 28 /// \brief Implementation of the GB05DetectorConstruction class 29 29 30 #include "GB05DetectorConstruction.hh" 30 #include "GB05DetectorConstruction.hh" >> 31 #include "G4SystemOfUnits.hh" 31 32 32 #include "GB05BOptrSplitAndKillByCrossSection. << 33 #include "G4Material.hh" 33 #include "GB05SD.hh" << 34 #include "G4NistManager.hh" 34 35 35 #include "G4Box.hh" 36 #include "G4Box.hh" 36 #include "G4LogicalVolume.hh" 37 #include "G4LogicalVolume.hh" >> 38 #include "G4PVPlacement.hh" 37 #include "G4LogicalVolumeStore.hh" 39 #include "G4LogicalVolumeStore.hh" 38 #include "G4Material.hh" << 40 39 #include "G4NistManager.hh" 41 #include "G4NistManager.hh" 40 #include "G4PVPlacement.hh" << 42 >> 43 #include "GB05BOptrSplitAndKillByCrossSection.hh" >> 44 >> 45 #include "GB05SD.hh" 41 #include "G4SDManager.hh" 46 #include "G4SDManager.hh" 42 #include "G4SystemOfUnits.hh" << 47 43 48 44 //....oooOO0OOooo........oooOO0OOooo........oo 49 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 45 50 46 GB05DetectorConstruction::GB05DetectorConstruc << 51 GB05DetectorConstruction::GB05DetectorConstruction() >> 52 : G4VUserDetectorConstruction() >> 53 {} 47 54 48 //....oooOO0OOooo........oooOO0OOooo........oo 55 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 49 56 50 GB05DetectorConstruction::~GB05DetectorConstru << 57 GB05DetectorConstruction::~GB05DetectorConstruction() >> 58 {} 51 59 52 //....oooOO0OOooo........oooOO0OOooo........oo 60 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 53 61 54 G4VPhysicalVolume* GB05DetectorConstruction::C 62 G4VPhysicalVolume* GB05DetectorConstruction::Construct() 55 { 63 { 56 // -- Collect a few materials from NIST data 64 // -- Collect a few materials from NIST database: 57 auto nistManager = G4NistManager::Instance() 65 auto nistManager = G4NistManager::Instance(); 58 G4Material* worldMaterial = nistManager->Fin << 66 G4Material* worldMaterial = nistManager->FindOrBuildMaterial("G4_Galactic"); 59 G4Material* defaultMaterial = nistManager->F 67 G4Material* defaultMaterial = nistManager->FindOrBuildMaterial("G4_CONCRETE"); 60 68 61 G4VSolid* solidWorld = new G4Box("World", 10 << 62 << 63 G4LogicalVolume* logicWorld = new G4LogicalV << 64 << 65 << 66 << 67 G4PVPlacement* physiWorld = new G4PVPlacemen << 68 << 69 << 70 << 71 << 72 << 73 << 74 69 >> 70 G4VSolid* solidWorld = new G4Box("World", 10*m, 10*m, 10*m ); >> 71 >> 72 G4LogicalVolume* logicWorld = new G4LogicalVolume(solidWorld, // its solid >> 73 worldMaterial, // its material >> 74 "World"); // its name >> 75 >> 76 G4PVPlacement* physiWorld = new G4PVPlacement(0, // no rotation >> 77 G4ThreeVector(), // at (0,0,0) >> 78 logicWorld, // its logical volume >> 79 "World", // its name >> 80 0, // its mother volume >> 81 false, // no boolean operation >> 82 0); // copy number >> 83 75 // ----------------------------------- 84 // ----------------------------------- 76 // -- volume where biasing is applied: 85 // -- volume where biasing is applied: 77 // ----------------------------------- 86 // ----------------------------------- 78 G4double halfXY = 5.0 * m; << 87 G4double halfXY = 5.0*m; 79 G4double halfZ = 1.0 * m; << 88 G4double halfZ = 1.0*m; 80 G4VSolid* solidShield = new G4Box("shield.so << 89 G4VSolid* solidShield = new G4Box("shield.solid", halfXY, halfXY, halfZ ); 81 << 90 82 G4LogicalVolume* logicShield = new G4Logical << 91 G4LogicalVolume* logicShield = new G4LogicalVolume( solidShield, // its solid 83 << 92 defaultMaterial, // its material 84 << 93 "shield.logical"); // its name 85 << 94 86 new G4PVPlacement(0, // no rotation << 95 new G4PVPlacement(0, // no rotation 87 G4ThreeVector(0, 0, halfZ) << 96 G4ThreeVector(0,0, halfZ), // volume entrance at (0,0,0) 88 logicShield, // its logic << 97 logicShield, // its logical volume 89 "shield.phys", // its nam << 98 "shield.phys", // its name 90 logicWorld, // its mother << 99 logicWorld, // its mother volume 91 false, // no boolean oper << 100 false, // no boolean operation 92 0); // copy number << 101 0); // copy number 93 << 102 94 // ----------------------------------------- 103 // -------------------------------------------------------------------- 95 // -- dummy volume to print information on p 104 // -- dummy volume to print information on particle exiting the shield: 96 // ----------------------------------------- 105 // -------------------------------------------------------------------- 97 G4double halfz = 1 * cm; << 106 G4double halfz = 1*cm; 98 G4VSolid* solidMeasurement = new G4Box("meas << 107 G4VSolid* solidMeasurement = new G4Box("meas.solid", halfXY, halfXY, halfz ); 99 << 108 100 G4LogicalVolume* logicMeasurement = new G4Lo << 109 G4LogicalVolume* logicMeasurement = new G4LogicalVolume(solidMeasurement,// its solid 101 << 110 worldMaterial, // its material 102 << 111 "meas.logical"); // its name 103 << 112 104 new G4PVPlacement(0, // no rotation << 113 new G4PVPlacement(0, // no rotation 105 G4ThreeVector(0, 0, 2 * ha << 114 G4ThreeVector(0,0, 2*halfZ + halfz), // volume entrance at (0,0,0) 106 logicMeasurement, // its << 115 logicMeasurement, // its logical volume 107 "meas.phys", // its name << 116 "meas.phys", // its name 108 logicWorld, // its mother << 117 logicWorld, // its mother volume 109 false, // no boolean oper << 118 false, // no boolean operation 110 0); // copy number << 119 0); // copy number 111 << 120 >> 121 112 return physiWorld; 122 return physiWorld; 113 } 123 } 114 124 >> 125 115 void GB05DetectorConstruction::ConstructSDandF 126 void GB05DetectorConstruction::ConstructSDandField() 116 { 127 { 117 // -- Fetch volume for biasing: 128 // -- Fetch volume for biasing: 118 G4LogicalVolume* logicShield = G4LogicalVolu << 129 G4LogicalVolume* logicShield = 119 << 130 G4LogicalVolumeStore::GetInstance()->GetVolume("shield.logical"); >> 131 120 // ----------------------------------------- 132 // ------------------------------------------------------------- 121 // -- operator creation, configuration and a 133 // -- operator creation, configuration and attachment to volume: 122 // ----------------------------------------- 134 // ------------------------------------------------------------- 123 GB05BOptrSplitAndKillByCrossSection* biasing << 135 GB05BOptrSplitAndKillByCrossSection* biasingOperator = 124 new GB05BOptrSplitAndKillByCrossSection("n 136 new GB05BOptrSplitAndKillByCrossSection("neutron"); 125 // -- Now, we declare to our biasing operato 137 // -- Now, we declare to our biasing operator all the processes we 126 // -- their disapperance effect on neutrons 138 // -- their disapperance effect on neutrons to be counterbalanced 127 // -- by the splitting by cross-section : 139 // -- by the splitting by cross-section : 128 biasingOperator->AddProcessToEquipoise("Deca 140 biasingOperator->AddProcessToEquipoise("Decay"); 129 biasingOperator->AddProcessToEquipoise("nCap 141 biasingOperator->AddProcessToEquipoise("nCapture"); 130 biasingOperator->AddProcessToEquipoise("neut 142 biasingOperator->AddProcessToEquipoise("neutronInelastic"); 131 143 132 biasingOperator->AttachTo(logicShield); 144 biasingOperator->AttachTo(logicShield); 133 << 145 134 G4cout << " Attaching biasing operator " << << 146 G4cout << " Attaching biasing operator " << biasingOperator->GetName() 135 << biasingOperator->GetName() << G4en << 147 << " to logical volume " << biasingOperator->GetName() >> 148 << G4endl; 136 149 137 // ----------------------------------------- 150 // ------------------------------------------------------------------------------------ 138 // -- Attach a sensitive detector to print i 151 // -- Attach a sensitive detector to print information on particles exiting the shield: 139 // ----------------------------------------- 152 // ------------------------------------------------------------------------------------ 140 // -- create and register sensitive detector 153 // -- create and register sensitive detector code module: 141 G4SDManager* SDman = G4SDManager::GetSDMpoin 154 G4SDManager* SDman = G4SDManager::GetSDMpointer(); 142 G4VSensitiveDetector* sd = new GB05SD("Score 155 G4VSensitiveDetector* sd = new GB05SD("Scorer"); 143 SDman->AddNewDetector(sd); 156 SDman->AddNewDetector(sd); 144 // -- Fetch volume for sensitivity and attac 157 // -- Fetch volume for sensitivity and attach sensitive module to it: 145 G4LogicalVolume* logicSD = G4LogicalVolumeSt << 158 G4LogicalVolume* logicSD = >> 159 G4LogicalVolumeStore::GetInstance()->GetVolume("meas.logical"); 146 logicSD->SetSensitiveDetector(sd); 160 logicSD->SetSensitiveDetector(sd); >> 161 147 } 162 } 148 163