|
|
|||
File indexing completed on 2026-09-12 08:29:15
0001 // 0002 // ******************************************************************** 0003 // * License and Disclaimer * 0004 // * * 0005 // * The Geant4 software is copyright of the Copyright Holders of * 0006 // * the Geant4 Collaboration. It is provided under the terms and * 0007 // * conditions of the Geant4 Software License, included in the file * 0008 // * LICENSE and available at http://cern.ch/geant4/license . These * 0009 // * include a list of copyright holders. * 0010 // * * 0011 // * Neither the authors of this software system, nor their employing * 0012 // * institutes,nor the agencies providing financial support for this * 0013 // * work make any representation or warranty, express or implied, * 0014 // * regarding this software system or assume any liability for its * 0015 // * use. Please see the license in the file LICENSE and URL above * 0016 // * for the full disclaimer and the limitation of liability. * 0017 // * * 0018 // * This code implementation is the result of the scientific and * 0019 // * technical work of the GEANT4 collaboration. * 0020 // * By using, copying, modifying or distributing the software (or * 0021 // * any work based on the software) you agree to acknowledge its * 0022 // * use in resulting scientific publications, and indicate your * 0023 // * acceptance of all terms of the Geant4 Software license. * 0024 // ******************************************************************** 0025 // 0026 /// \file GB05DetectorConstruction.cc 0027 /// \brief Implementation of the GB05DetectorConstruction class 0028 0029 #include "GB05DetectorConstruction.hh" 0030 0031 #include "GB05BOptrSplitAndKillByCrossSection.hh" 0032 #include "GB05SD.hh" 0033 0034 #include "G4Box.hh" 0035 #include "G4LogicalVolume.hh" 0036 #include "G4LogicalVolumeStore.hh" 0037 #include "G4Material.hh" 0038 #include "G4NistManager.hh" 0039 #include "G4PVPlacement.hh" 0040 #include "G4SDManager.hh" 0041 #include "G4SystemOfUnits.hh" 0042 0043 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0044 0045 GB05DetectorConstruction::GB05DetectorConstruction(G4bool bf) : fBiasingFlag(bf) {} 0046 0047 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0048 0049 GB05DetectorConstruction::~GB05DetectorConstruction() = default; 0050 0051 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0052 0053 G4VPhysicalVolume* GB05DetectorConstruction::Construct() 0054 { 0055 // -- Collect a few materials from NIST database: 0056 auto nistManager = G4NistManager::Instance(); 0057 G4Material* worldMaterial = nistManager->FindOrBuildMaterial("G4_Galactic"); 0058 G4Material* defaultMaterial = nistManager->FindOrBuildMaterial("G4_CONCRETE"); 0059 0060 G4VSolid* solidWorld = new G4Box("World", 10 * m, 10 * m, 10 * m); 0061 0062 auto logicWorld = new G4LogicalVolume(solidWorld, // its solid 0063 worldMaterial, // its material 0064 "World"); // its name 0065 0066 auto physiWorld = new G4PVPlacement(nullptr, // no rotation 0067 G4ThreeVector(), // at (0,0,0) 0068 logicWorld, // its logical volume 0069 "World", // its name 0070 nullptr, // its mother volume 0071 false, // no boolean operation 0072 0); // copy number 0073 0074 // ----------------------------------- 0075 // -- volume where biasing is applied: 0076 // ----------------------------------- 0077 G4double halfXY = 5.0 * m; 0078 G4double halfZ = 1.0 * m; 0079 G4VSolid* solidShield = new G4Box("shield.solid", halfXY, halfXY, halfZ); 0080 0081 auto logicShield = new G4LogicalVolume(solidShield, // its solid 0082 defaultMaterial, // its material 0083 "shield.logical"); // its name 0084 0085 new G4PVPlacement(nullptr, // no rotation 0086 G4ThreeVector(0, 0, halfZ), // volume entrance at (0,0,0) 0087 logicShield, // its logical volume 0088 "shield.phys", // its name 0089 logicWorld, // its mother volume 0090 false, // no boolean operation 0091 0); // copy number 0092 0093 // -------------------------------------------------------------------- 0094 // -- dummy volume to print information on particle exiting the shield: 0095 // -------------------------------------------------------------------- 0096 G4double halfz = 1 * cm; 0097 G4VSolid* solidMeasurement = new G4Box("meas.solid", halfXY, halfXY, halfz); 0098 0099 auto logicMeasurement = new G4LogicalVolume(solidMeasurement, // its solid 0100 worldMaterial, // its material 0101 "meas.logical"); // its name 0102 0103 new G4PVPlacement(nullptr, // no rotation 0104 G4ThreeVector(0, 0, 2 * halfZ + halfz), // volume entrance at (0,0,0) 0105 logicMeasurement, // its logical volume 0106 "meas.phys", // its name 0107 logicWorld, // its mother volume 0108 false, // no boolean operation 0109 0); // copy number 0110 0111 return physiWorld; 0112 } 0113 0114 void GB05DetectorConstruction::ConstructSDandField() 0115 { 0116 if (fBiasingFlag) { 0117 // -- Fetch volume for biasing: 0118 G4LogicalVolume* logicShield = G4LogicalVolumeStore::GetInstance()->GetVolume("shield.logical"); 0119 0120 // ------------------------------------------------------------- 0121 // -- operator creation, configuration and attachment to volume: 0122 // ------------------------------------------------------------- 0123 auto biasingOperator = new GB05BOptrSplitAndKillByCrossSection("neutron"); 0124 // -- Now, we declare to our biasing operator all the processes we 0125 // -- their disapperance effect on neutrons to be counterbalanced 0126 // -- by the splitting by cross-section : 0127 biasingOperator->AddProcessToEquipoise("Decay"); 0128 biasingOperator->AddProcessToEquipoise("nCapture"); 0129 biasingOperator->AddProcessToEquipoise("neutronInelastic"); 0130 0131 biasingOperator->AttachTo(logicShield); 0132 0133 G4cout << " Attaching biasing operator " << biasingOperator->GetName() << " to logical volume " 0134 << biasingOperator->GetName() << G4endl; 0135 } 0136 // ------------------------------------------------------------------------------------ 0137 // -- Attach a sensitive detector to print information on particles exiting the shield: 0138 // ------------------------------------------------------------------------------------ 0139 // -- create and register sensitive detector code module: 0140 G4SDManager* SDman = G4SDManager::GetSDMpointer(); 0141 G4VSensitiveDetector* sd = new GB05SD("Scorer"); 0142 SDman->AddNewDetector(sd); 0143 // -- Fetch volume for sensitivity and attach sensitive module to it: 0144 G4LogicalVolume* logicSD = G4LogicalVolumeStore::GetInstance()->GetVolume("meas.logical"); 0145 logicSD->SetSensitiveDetector(sd); 0146 }
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|