Neutrons from GPS produce gamma rays only when in world volume

I am running a modified version of the Geant4 B4a example. I have deleted the calorimeter/air gap detector and replaced it with a box target (normally filled with natural boron) and a cylindrical detector both embedded in a surrounding medium (normally air or vacuum). The source is an isotropic general particle source (GPS) emitting monoenergetic (2.5 MeV) neutrons. I am using the analysis manager to save gamma ray track information in a ROOT ntuple whenever a gamma ray intersects the detector volume. I am using the QGSP_BERT_HP physics list.

The problem that I am having is that the neutrons only seem to produce gamma rays (inelastic or capture) if there is an (n,gamma) emitter material (e.g., boron) in the world volume. The GPS position does not seem to matter. I can see this by filling the world volume with boron and putting the GPS at +z, -z or z=0 (lots of gammas). If I fill the “world” volume with air or vacuum and put boron in the “surround” volume or the “target” volume, there are no gammas emitted, even if the GPS is positioned in the middle of the surrounding volum or the target volume.

I am running Geant4 10.5 patch 01 on an i7 PC with 16GB RAM and 64bit Linux (Fedora 28).

I have attached a geometry diagram, but the upload feature will not let me upload the relevant code (B4DetectorConstruction.cc, B4aSteppingAction, B4PrimaryGeneratorAction) and the sample macro that I am using (run5)).

Thank you for any help.

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.73
kelvin, 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.0
m;

auto surroundSizeXY = 1.0 * worldSizeXY;
auto surroundSizeZ = 0.5 * worldSizeZ;
G4double surroundCtrXY = 0.0m;
auto surroundCtrZ = -0.5
surroundSizeZ;

G4double targetSizeXY = 0.30m;
G4double targetSizeZ = 0.10
m;
G4double targetCtrXY = 0.0*m;
G4double targetCtrZ = surroundSizeZ/2-targetSizeZ/2;

G4double detectorInnerDiameter = 0.0m;
G4double detectorOuterDiameter = 0.0762
m;
G4double detectorLength = 0.0762m;
G4double detectorStartAngle = 0.0
deg;
G4double detectorSpanningAngle = 360.0deg;
G4RotationMatrix detectorRotate;
detectorRotate.rotateX(90
deg);
detectorRotate.rotateY(0deg);
detectorRotate.rotateZ(0
deg);
G4double detectorCtrXY = 0.0m;
G4double distanceDetectorFacetoTargetFace = 0.20
m;
G4double detectorCtrZ = targetCtrZ-distanceDetectorFacetoTargetFace-targetSizeZ/2-detectorOuterDiameter/2;

G4double shieldSizeXY = 1.0m;
G4double shieldSizeZ = 1.0
m;
G4double shieldCtrXY = 1.0m;
G4double shieldCtrZ = 1.0
m;

// 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…

I ran example Hadr03 with following macro , from which we can see :
1- MeanFreePath (aka nuclear interaction length) for neutron (2.5 MeV) on Boron is ˜88 cm.
2- only ˜45% of reactions produce one or several photons.

What is the thickness of your target ?

/testhadr/det/setMat G4_B
/testhadr/setSize 100 m

/run/initialize

/gun/particle neutron
/gun/energy 2.5 MeV

/process/inactivate hadElastic

/run/printProgress 10000
/run/beamOn 100000

My target is 30cm x 30cm x 10cm (x y z) box. It sits in a 4m x 4m x 2m box(mother volume of target - see diagram in first post). Both are boron. No gammas are produced even if the neutron source is in the middle of the big box. The only way to produce gammas is to make the world volume (which is the mother volume of the big box) be made of boron and then it does not matter what the big box or target are made of. I have run up to 1000000 events per run.

Hi Michel,
As an example of last comment here is an image of a simulation with the world, surround (big box - portion between the pairs of double horizontal red lines) and target (small box shown in magenta) all made of boron. (Ignore the blue box.) Note that gammas are only generated in the world volume, not in the target or surround even though the neutron source is in the middle of the target.

I have found the problem and it is simple but embarrassing. In my B4DetectorConstruction.cc module, I changed the material for target and surround to vacuum for one of my tests and did not change it back. I must have looked at the changed lines a hundred times while trying to sort out the problem and did not see them.
Sorry for wasting people’s time. John

We assume, that the issue is solved.

VI