Warning, file /geant4/examples/extended/biasing/GB01/src/GB01DetectorConstruction.cc was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029 #include "GB01DetectorConstruction.hh"
0030
0031 #include "GB01BOptrMultiParticleChangeCrossSection.hh"
0032
0033 #include "G4Box.hh"
0034 #include "G4Colour.hh"
0035 #include "G4LogicalVolume.hh"
0036 #include "G4LogicalVolumeStore.hh"
0037 #include "G4Material.hh"
0038 #include "G4NistManager.hh"
0039 #include "G4PVPlacement.hh"
0040 #include "G4SystemOfUnits.hh"
0041 #include "G4UniformMagField.hh"
0042 #include "G4VisAttributes.hh"
0043
0044
0045
0046 GB01DetectorConstruction::GB01DetectorConstruction(G4bool bf) : fBiasingFlag(bf) {}
0047
0048
0049
0050 GB01DetectorConstruction::~GB01DetectorConstruction() = default;
0051
0052
0053
0054 G4VPhysicalVolume* GB01DetectorConstruction::Construct()
0055 {
0056 G4Material* worldMaterial = G4NistManager::Instance()->FindOrBuildMaterial("G4_Galactic");
0057 G4Material* defaultMaterial = G4NistManager::Instance()->FindOrBuildMaterial("G4_lN2");
0058
0059 G4VSolid* solidWorld = new G4Box("World", 10 * m, 10 * m, 10 * m);
0060
0061 auto logicWorld = new G4LogicalVolume(solidWorld,
0062 worldMaterial,
0063 "World");
0064
0065 auto physiWorld = new G4PVPlacement(nullptr,
0066 G4ThreeVector(),
0067 logicWorld,
0068 "World",
0069 nullptr,
0070 false,
0071 0);
0072
0073
0074
0075
0076 G4double halfZ = 10 * cm;
0077 G4VSolid* solidTest = new G4Box("test.solid", 1 * m, 1 * m, halfZ);
0078
0079 auto logicTest = new G4LogicalVolume(solidTest,
0080 defaultMaterial,
0081 "test.logical");
0082
0083 new G4PVPlacement(nullptr,
0084 G4ThreeVector(0, 0, halfZ),
0085 logicTest,
0086 "test.phys",
0087 logicWorld,
0088 false,
0089 0);
0090
0091 return physiWorld;
0092 }
0093
0094 void GB01DetectorConstruction::ConstructSDandField()
0095 {
0096 if (fBiasingFlag) {
0097
0098 G4LogicalVolume* logicTest = G4LogicalVolumeStore::GetInstance()->GetVolume("test.logical");
0099
0100
0101
0102
0103 auto testMany = new GB01BOptrMultiParticleChangeCrossSection();
0104 testMany->AddParticle("gamma");
0105 testMany->AddParticle("neutron");
0106 testMany->AttachTo(logicTest);
0107 G4cout << " Attaching biasing operator " << testMany->GetName() << " to logical volume "
0108 << logicTest->GetName() << G4endl;
0109 }
0110 }