Code example

Here’s a simple example showing how to use the XRTG4 extension with your own geometrical model in Geant4.

#include “G4XraySpecularReflectingSurface.hh”
#include “ExXRTG4DetectorConstruction.hh”
#include “ExXRTG4PhysicsList.hh”
#include “ExXRTG4PrimaryGeneratorAction.hh”
#include “ExXRTG4SteppingAction.hh”
#include “ExXRTG4UserTrackingAction.hh”

G4RunManager* runManager = new G4RunManager;
// micro-roughness reduces the reflectivity;
const G4double micro_roughness = 1*nm;

// true sets the reflectivity to be 1 always: useful to debug the
// geometry, also in conjunction with a large angle.

// const G4bool force_unit_reflectivity = true;
// const G4double angle = 30*deg;

const G4bool force_unit_reflectivity = false;
const G4double angle = 0.5*deg;

// photon energy
const G4double energy = 1*keV;

G4XraySpecularReflectingSurface * xray_surface_property =┬ánew G4XraySpecularReflectingSurface(“TargetSiliconSurface”, micro_roughness, force_unit_reflectivity);
runManager->SetUserInitialization(new ExXRTG4DetectorConstruction(xray_surface_property));
runManager->SetUserInitialization(new ExXRTG4PhysicsList);
runManager->SetUserAction(new ExXRTG4PrimaryGeneratorAction(energy, angle));
runManager->SetUserAction(new ExXRTG4SteppingAction);
runManager->SetUserAction(new ExXRTG4UserTrackingAction);
runManager->Initialize();