I have attached an example from interactive runs to illustrate the problem. The world volume is filled with vacuum and the remainder (surround, target volumes) are filled with boron (neutrons are yellow, gammas are green). There are no gammas produced even with the source in the middle of the surround volume.
I’ve also done the world volume filled with boron, remainder also with boron (not shown - forum limits me to one upload image). Gammas are only produced by neutrons in the world volume, never in remainder. I’ve done it with source in target, surround and world volumes. The result is the same.
This just does not make any sense! I’ve copied my modified detector construction module B4DetectorConstruction.cc below (sorry, I do not know if there is a better way):
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file B4DetectorConstruction.cc
/// \brief Implementation of the B4DetectorConstruction class
#include “B4DetectorConstruction.hh”
#include “G4Material.hh”
#include “G4NistManager.hh”
#include “G4Box.hh”
#include “G4Tubs.hh”
#include “G4RotationMatrix.hh”
#include “G4LogicalVolume.hh”
#include “G4PVPlacement.hh”
#include “G4PVReplica.hh”
#include “G4GlobalMagFieldMessenger.hh”
#include “G4AutoDelete.hh”
#include “G4GeometryManager.hh”
#include “G4PhysicalVolumeStore.hh”
#include “G4LogicalVolumeStore.hh”
#include “G4SolidStore.hh”
#include “G4VisAttributes.hh”
#include “G4Colour.hh”
#include “G4PhysicalConstants.hh”
#include “G4SystemOfUnits.hh”
//…oooOO0OOooo…oooOO0OOooo…oooOO0OOooo…oooOO0OOooo…
G4ThreadLocal
G4GlobalMagFieldMessenger* B4DetectorConstruction::fMagFieldMessenger = nullptr;
//…oooOO0OOooo…oooOO0OOooo…oooOO0OOooo…oooOO0OOooo…
B4DetectorConstruction::B4DetectorConstruction()
: G4VUserDetectorConstruction(),
worldPV(nullptr),
fSurroundPV(nullptr),
fTargetPV(nullptr),
fDetectorPV(nullptr),
fShieldPV(nullptr),
fCheckOverlaps(true)
{
}
//…oooOO0OOooo…oooOO0OOooo…oooOO0OOooo…oooOO0OOooo…
B4DetectorConstruction::~B4DetectorConstruction()
{
}
//…oooOO0OOooo…oooOO0OOooo…oooOO0OOooo…oooOO0OOooo…
G4VPhysicalVolume* B4DetectorConstruction::Construct()
{
// Define materials
DefineMaterials();
// Define volumes
return DefineVolumes();
}
//…oooOO0OOooo…oooOO0OOooo…oooOO0OOooo…oooOO0OOooo…
void B4DetectorConstruction::DefineMaterials()
{
// Lead material defined using NIST Manager
auto nistManager = G4NistManager::Instance();
nistManager->FindOrBuildMaterial(“G4_Pb”);
nistManager->FindOrBuildMaterial(“G4_B”); //density is 2.37 g/cc
nistManager->FindOrBuildMaterial(“G4_Li”); //density is 0.534 g/cc
nistManager->FindOrBuildMaterial(“G4_AIR”);
nistManager->FindOrBuildMaterial(“G4_Galactic”);
G4double a; // mass of a mole;
G4double z; // z=mean number of protons;
G4double density;
G4double abundance;
G4String symbol;
G4int iz;
G4int ia;
G4int ncomponents;
G4int natoms;
// Liquid argon material
new G4Material(“liquidArgon”, z=18., a= 39.95g/mole, density= 1.390g/cm3);
// The argon by NIST Manager is a gas with a different density
// My Vacuum
new G4Material(“Galactic”, z=1., a=1.01g/mole,density= universe_mean_density,
kStateGas, 2.73kelvin, 3.e-18*pascal);
//Boron 10 isotope
G4Isotope* iso_B10 = new G4Isotope(“B10”, iz=5, ia=10, a=10.012937g/mole);
G4Element ele_B10 = new G4Element(“B10”, symbol=“B10”, ncomponents=1);
ele_B10->AddIsotope(iso_B10, abundance= 100.perCent);
G4Material mat_B10 = new G4Material(“B10”, density=2.37*g/cm3, ncomponents=1, kStateSolid);
mat_B10->AddElement(ele_B10, natoms=1);
//Boron 11 isotope
G4Isotope* iso_B11 = new G4Isotope(“B11”, iz=5, ia=11, a=11.009305g/mole);
G4Element ele_B11 = new G4Element(“B11”, symbol=“B11”, ncomponents=1);
ele_B11->AddIsotope(iso_B11, abundance= 100.perCent);
G4Material mat_B11 = new G4Material(“B11”, density=2.37*g/cm3, ncomponents=1, kStateSolid);
mat_B11->AddElement(ele_B11, natoms=1);
// Print materials
G4cout << *(G4Material::GetMaterialTable()) << G4endl;
}
//…oooOO0OOooo…oooOO0OOooo…oooOO0OOooo…oooOO0OOooo…
G4VPhysicalVolume* B4DetectorConstruction::DefineVolumes()
{
// Geometry parameters
G4double worldSizeXY = 4.0m;
G4double worldSizeZ = 4.0m;
auto surroundSizeXY = 1.0 * worldSizeXY;
auto surroundSizeZ = 0.5 * worldSizeZ;
G4double surroundCtrXY = 0.0m;
auto surroundCtrZ = -0.5surroundSizeZ;
G4double targetSizeXY = 0.30m;
G4double targetSizeZ = 0.10m;
G4double targetCtrXY = 0.0*m;
G4double targetCtrZ = surroundSizeZ/2-targetSizeZ/2;
G4double detectorInnerDiameter = 0.0m;
G4double detectorOuterDiameter = 0.0762m;
G4double detectorLength = 0.0762m;
G4double detectorStartAngle = 0.0deg;
G4double detectorSpanningAngle = 360.0deg;
G4RotationMatrix detectorRotate;
detectorRotate.rotateX(90deg);
detectorRotate.rotateY(0deg);
detectorRotate.rotateZ(0deg);
G4double detectorCtrXY = 0.0m;
G4double distanceDetectorFacetoTargetFace = 0.20m;
G4double detectorCtrZ = targetCtrZ-distanceDetectorFacetoTargetFace-targetSizeZ/2-detectorOuterDiameter/2;
G4double shieldSizeXY = 1.0m;
G4double shieldSizeZ = 1.0m;
G4double shieldCtrXY = 1.0m;
G4double shieldCtrZ = 1.0m;
// Get materials
//auto defaultMaterial = G4Material::GetMaterial(“Galactic”);
auto defaultMaterial = G4Material::GetMaterial(“G4_Galactic”);
//auto worldMaterial = G4Material::GetMaterial(“G4_AIR”);
auto worldMaterial = G4Material::GetMaterial(“G4_Galactic”);
//auto worldMaterial = G4Material::GetMaterial(“G4_B”);
//auto surroundMaterial = G4Material::GetMaterial(“G4_AIR”);
auto surroundMaterial = G4Material::GetMaterial(“G4_B”);
//auto surroundMaterial = G4Material::GetMaterial(“G4_Galactic”);
//auto targetMaterial = G4Material::GetMaterial(“G4_Galactic”);
auto targetMaterial = G4Material::GetMaterial(“G4_B”);
//auto targetMaterial = G4Material::GetMaterial(“B10”);
//auto targetMaterial = G4Material::GetMaterial(“B11”);
//auto targetMaterial = G4Material::GetMaterial(“G4_AIR”);
//auto detectorMaterial = G4Material::GetMaterial(“Galactic”);
//auto shieldMaterial = G4Material::GetMaterial(“Galactic”);
//auto detectorMaterial = G4Material::GetMaterial(“G4_AIR”);
auto detectorMaterial = G4Material::GetMaterial(“G4_Galactic”);
//auto shieldMaterial = G4Material::GetMaterial(“G4_AIR”);
auto shieldMaterial = G4Material::GetMaterial(“G4_Galactic”);
if ( ! defaultMaterial || ! worldMaterial || ! surroundMaterial || ! targetMaterial || ! detectorMaterial || ! shieldMaterial ) {
G4ExceptionDescription msg;
msg << “Cannot retrieve materials already defined.”;
G4Exception(“B4DetectorConstruction::DefineVolumes()”,
“MyCode0001”, FatalException, msg);
}
//
// World
//
auto worldS
= new G4Box(“World”, // its name
worldSizeXY/2, worldSizeXY/2, worldSizeZ/2); // its size
auto worldLV
= new G4LogicalVolume(
worldS, // its solid
worldMaterial, // its material
“World”); // its name
worldPV
= new G4PVPlacement(
0, // no rotation
G4ThreeVector(), // at (0,0,0)
worldLV, // its logical volume
“World”, // its name
0, // its mother volume
false, // no boolean operation
0, // copy number
fCheckOverlaps); // checking overlaps
//
// Medium Surrounding the target
//
auto surroundS
= new G4Box(“Surround”, // its name
surroundSizeXY/2, surroundSizeXY/2, surroundSizeZ/2); // its size
auto surroundLV
= new G4LogicalVolume(
surroundS, // its solid
defaultMaterial, // its material
“Surround”); // its name
fSurroundPV
= new G4PVPlacement(
0, // no rotation
G4ThreeVector(surroundCtrXY,surroundCtrXY,surroundCtrZ), // its posn in mother volume
surroundLV, // its logical volume
“Surround”, // its name
worldLV, // its mother volume
false, // no boolean operation
0, // copy number
fCheckOverlaps); // checking overlaps
//
// Target
//
auto targetS
= new G4Box(“Target”, // its name
targetSizeXY/2, targetSizeXY/2, targetSizeZ/2); // its size
auto targetLV
= new G4LogicalVolume(
targetS, // its solid
defaultMaterial, // its material
“Target”); // its name
fTargetPV
= new G4PVPlacement(
0, // no rotation
G4ThreeVector(targetCtrXY,targetCtrXY,targetCtrZ), // its posn in mother volume
targetLV, // its logical volume
“Target”, // its name
surroundLV, // its mother volume
false, // no boolean operation
0, // copy number
fCheckOverlaps); // checking overlaps
//
// Detector
//
auto detectorS
= new G4Tubs(“Detector”, // its name
detectorInnerDiameter/2, detectorOuterDiameter/2, detectorLength/2, detectorStartAngle, detectorSpanningAngle); // its size
auto detectorLV
= new G4LogicalVolume(
detectorS, // its solid
detectorMaterial, // its material
“Detector”); // its name
fDetectorPV
= new G4PVPlacement(
G4Transform3D(detectorRotate, G4ThreeVector(detectorCtrXY,detectorCtrXY,detectorCtrZ)), // its rotation and its posn in mother volume
detectorLV, // its logical volume
“Detector”, // its name
surroundLV, // its mother volume
false, // no boolean operation
0, // copy number
fCheckOverlaps); // checking overlaps
//
// Shield
//
auto shieldS
= new G4Box(“Shield”, // its name
shieldSizeXY/2, shieldSizeXY/2, shieldSizeZ/2); // its size
auto shieldLV
= new G4LogicalVolume(
shieldS, // its solid
shieldMaterial, // its material
“Shield”); // its name
fShieldPV
= new G4PVPlacement(
0, // no rotation
G4ThreeVector(shieldCtrXY,shieldCtrXY,shieldCtrZ), // its posn in mother volume
shieldLV, // its logical volume
“Shield”, // its name
worldLV, // its mother volume
false, // no boolean operation
0, // copy number
fCheckOverlaps); // checking overlaps
//
// print parameters
//
G4cout
<< G4endl
<< “-----------------------------------------------------------------------------------------------------” << G4endl
<< "—> The target is " << targetSizeZ/cm
<< "cm thick " << targetMaterial->GetName() << " embedded in "
<< surroundMaterial->GetName() << " with a target/detector separation of "
<< distanceDetectorFacetoTargetFace/cm << "cm " << G4endl
<< “-----------------------------------------------------------------------------------------------------” << G4endl;
//
// Visualization attributes
//
worldLV->SetVisAttributes (G4VisAttributes::GetInvisible());
auto simpleBoxVisAtt= new G4VisAttributes(G4Colour(1.0,0.0,1.0)); //magenta
simpleBoxVisAtt->SetVisibility(true);
targetLV->SetVisAttributes(simpleBoxVisAtt);
auto simpleBox1VisAtt= new G4VisAttributes(G4Colour(1.0,0.0,0.0)); //red
simpleBox1VisAtt->SetVisibility(true);
surroundLV->SetVisAttributes(simpleBox1VisAtt);
auto simpleCylinderVisAtt= new G4VisAttributes(G4Colour(0.0,1.0,1.0)); //cyan
simpleCylinderVisAtt->SetVisibility(true);
detectorLV->SetVisAttributes(simpleCylinderVisAtt);
auto simpleBox2VisAtt= new G4VisAttributes(G4Colour(0.0,0.0,1.0)); //blue
simpleBox2VisAtt->SetVisibility(true);
shieldLV->SetVisAttributes(simpleBox2VisAtt);
//
// Always return the physical World
//
return worldPV;
}
//…oooOO0OOooo…oooOO0OOooo…oooOO0OOooo…oooOO0OOooo…
void B4DetectorConstruction::ConstructSDandField()
{
// Create global magnetic field messenger.
// Uniform magnetic field is then created automatically if
// the field value is not zero.
G4ThreeVector fieldValue;
fMagFieldMessenger = new G4GlobalMagFieldMessenger(fieldValue);
fMagFieldMessenger->SetVerboseLevel(1);
// Register the field messenger for deleting
G4AutoDelete::Register(fMagFieldMessenger);
}
//…oooOO0OOooo…oooOO0OOooo…oooOO0OOooo…oooOO0OOooo…