Import Geant4 9.5.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 16:46:55 +02:00
parent 89a9605df1
commit b1eb5424d2
10957 changed files with 888481 additions and 160139 deletions
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,102 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// This is the *BASIC* version of IORT, a Geant4-based application
//
// Main Authors: G.Russo(a,b), C.Casarino*(c), G.C. Candiano(c), G.A.P. Cirrone(d), F.Romano(d)
// Contributor Authors: S.Guatelli(e)
// Past Authors: G.Arnetta(c), S.E.Mazzaglia(d)
//
// (a) Fondazione Istituto San Raffaele G.Giglio, Cefalù, Italy
// (b) IBFM-CNR , Segrate (Milano), Italy
// (c) LATO (Laboratorio di Tecnologie Oncologiche), Cefalù, Italy
// (d) Laboratori Nazionali del Sud of the INFN, Catania, Italy
// (e) University of Wallongong, Australia
//
// *Corresponding author, email to carlo.casarino@polooncologicocefalu.it
//////////////////////////////////////////////////////////////////////////////////////////////
#include "Collimator100BeamLineMessenger.hh"
#include "Collimator100BeamLine.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithAString.hh"
Collimator100BeamLineMessenger::Collimator100BeamLineMessenger(Collimator100BeamLine* beamLine)
:collimator100(beamLine)
{
beamLineDir = new G4UIdirectory("/beamLine/");
beamLineDir -> SetGuidance("set specification of range shifter");
FinalCollimatorIORTDir = new G4UIdirectory("/beamLine/FinalCollimatorIORT/");
FinalCollimatorIORTDir -> SetGuidance("set specification of final collimator");
innerRadiusFinalCollimatorIORTCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/FinalCollimatorIORT/halfInnerRad",this);
innerRadiusFinalCollimatorIORTCmd -> SetGuidance("Set size of inner radius ( max 21.5 mm)");
innerRadiusFinalCollimatorIORTCmd -> SetParameterName("Size",false);
innerRadiusFinalCollimatorIORTCmd -> SetDefaultUnit("mm");
innerRadiusFinalCollimatorIORTCmd -> SetUnitCandidates("mm cm m");
innerRadiusFinalCollimatorIORTCmd -> AvailableForStates(G4State_Idle);
OuterRadiusFinalCollimatorIORTCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/FinalCollimatorIORT/halfOuterRad",this);
OuterRadiusFinalCollimatorIORTCmd -> SetGuidance("Set size of outer radius ( max 21.5 mm)");
OuterRadiusFinalCollimatorIORTCmd -> SetParameterName("Size",false);
OuterRadiusFinalCollimatorIORTCmd -> SetDefaultUnit("mm");
OuterRadiusFinalCollimatorIORTCmd -> SetUnitCandidates("mm cm m");
OuterRadiusFinalCollimatorIORTCmd -> AvailableForStates(G4State_Idle);
}
Collimator100BeamLineMessenger::~Collimator100BeamLineMessenger()
{
delete OuterRadiusFinalCollimatorIORTCmd;
delete innerRadiusFinalCollimatorIORTCmd;
delete FinalCollimatorIORTDir;
delete beamLineDir;
}
void Collimator100BeamLineMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
{
if( command == innerRadiusFinalCollimatorIORTCmd )
{ collimator100 -> SetInnerRadiusFinalCollimatorIORT
(innerRadiusFinalCollimatorIORTCmd -> GetNewDoubleValue(newValue));}
else if( command == OuterRadiusFinalCollimatorIORTCmd )
{ collimator100 -> SetOuterRadiusFinalCollimatorIORT
(OuterRadiusFinalCollimatorIORTCmd -> GetNewDoubleValue(newValue));}
}
+985
View File
@@ -0,0 +1,985 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// This is the *BASIC* version of IORT, a Geant4-based application
//
// Main Authors: G.Russo(a,b), C.Casarino*(c), G.C. Candiano(c), G.A.P. Cirrone(d), F.Romano(d)
// Contributor Authors: S.Guatelli(e)
// Past Authors: G.Arnetta(c), S.E.Mazzaglia(d)
//
// (a) Fondazione Istituto San Raffaele G.Giglio, Cefalù, Italy
// (b) IBFM-CNR , Segrate (Milano), Italy
// (c) LATO (Laboratorio di Tecnologie Oncologiche), Cefalù, Italy
// (d) Laboratori Nazionali del Sud of the INFN, Catania, Italy
// (e) University of Wallongong, Australia
//
// *Corresponding author, email to carlo.casarino@polooncologicocefalu.it
//////////////////////////////////////////////////////////////////////////////////////////////
#include "G4Box.hh"
#include "G4Tubs.hh"
#include "G4Cons.hh"
#include "G4VisAttributes.hh"
#include "G4Colour.hh"
#include "globals.hh"
#include "G4RunManager.hh"
#include "G4LogicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4RotationMatrix.hh"
#include "G4NistManager.hh"
#include "G4NistElementBuilder.hh"
#include "G4SubtractionSolid.hh"
#include "IORTDetectorConstruction.hh"
#include "Collimator40BeamLine.hh"
#include "Collimator40BeamLineMessenger.hh"
Collimator40BeamLine::Collimator40BeamLine():
physicalTreatmentRoom(0),iortDetectorConstruction(0),
solidFinalCollimatorIORT(0),
logicFinalCollimatorIORT(0),
physiFinalCollimatorIORT(0),
solidGiunz1FinalCollIORT(0),
logicGiunz1FinalCollIORT(0),
physiGiunz1FinalCollIORT(0),
solidGiunz2FinalCollIORT(0),
logicGiunz2FinalCollIORT(0),
physiGiunz2FinalCollIORT(0),
solidGiunz3FinalCollIORT(0),
logicGiunz3FinalCollIORT(0),
physiGiunz3FinalCollIORT(0),
solidGiunz3FinalCollIntIORT(0),
logicGiunz3FinalCollIntIORT(0),
physiGiunz3FinalCollIntIORT(0),
solidGiunz4FinalCollIORT(0),
logicGiunz4FinalCollIORT(0),
physiGiunz4FinalCollIORT(0),
solidGiunz5FinalCollIORT(0),
logicGiunz5FinalCollIORT(0),
physiGiunz5FinalCollIORT(0),
solidBlocco1IORT(0),
logicBlocco1IORT(0),
physiBlocco1IORT(0),
solidBlocco2IORT(0),
logicBlocco2IORT(0),
physiBlocco2IORT(0),
solidBlocco3IORT(0),
logicBlocco3IORT(0),
physiBlocco3IORT(0),
solidBlocco20mmIORT(0),
logicBlocco20mmIORT(0),
physiBlocco20mmIORT(0),
solidCM1_1_2IORT(0),
logicCM1_1_2IORT(0),
physiCM1_1_2IORT(0),
solidCM1_2_2IORT(0),
logicCM1_2_2IORT(0),
physiCM1_2_2IORT(0),
solidCM2_1_2IORT(0),
logicCM2_1_2IORT(0),
physiCM2_1_2IORT(0),
solidCM2_2_2IORT(0),
logicCM2_2_2IORT(0),
physiCM2_2_2IORT(0),
solidCCMIORT(0),
logicCCMIORT(0),
physiCCMIORT(0),
solidPFS1IORT(0),
logicPFS1IORT(0),
physiPFS1IORT(0),
solidPFS2IORT(0),
logicPFS2IORT(0),
physiPFS2IORT(0),
solidPFS3IORT(0),
logicPFS3IORT(0),
physiPFS3IORT(0),
solidFTIORT(0),
logicFTIORT(0),
physiFTIORT(0)
{
// Messenger to change parameters of the collimator40BeamLine geometry
collimatorMessenger = new Collimator40BeamLineMessenger(this);
}
/////////////////////////////////////////////////////////////////////////////
Collimator40BeamLine::~Collimator40BeamLine()
{
delete collimatorMessenger;
delete iortDetectorConstruction;
}
/////////////////////////////////////////////////////////////////////////////
G4VPhysicalVolume* Collimator40BeamLine::Construct()
{
// Sets default geometry and materials
SetDefaultDimensions();
// Construct the whole Collimator Beam Line
ConstructCollimator40BeamLine();
// IORTDetectorConstruction builds ONLY the phantom and the detector with its associated ROGeometry
iortDetectorConstruction = new IORTDetectorConstruction(physicalTreatmentRoom);
return physicalTreatmentRoom;
}
// In the following method the DEFAULTS used in the geometry of
// collimator beam line are provided
// HERE THE USER CAN CHANGE THE GEOMETRY CHARACTERISTICS OF BEAM
// LINE ELEMENTS, ALTERNATIVELY HE/SHE CAN USE THE MACRO FILE (IF A
// MESSENGER IS PROVIDED)
//
// DEFAULT MATERIAL ARE ALSO PROVIDED
// and COLOURS ARE ALSO DEFINED
// ----------------------------------------------------------
/////////////////////////////////////////////////////////////////////////////
void Collimator40BeamLine::SetDefaultDimensions()
{
// Set of coulors that can be used
white = new G4VisAttributes( G4Colour());
white -> SetVisibility(true);
//white -> SetForceSolid(true);
blue = new G4VisAttributes(G4Colour(0. ,0. ,1.));
blue -> SetVisibility(true);
//blue -> SetForceSolid(true);
gray = new G4VisAttributes( G4Colour(0.5, 0.5, 0.5 ));
gray-> SetVisibility(true);
//gray-> SetForceSolid(true);
red = new G4VisAttributes(G4Colour(1. ,0. ,0.));
red-> SetVisibility(true);
//red-> SetForceSolid(true);
yellow = new G4VisAttributes(G4Colour(1., 1., 0. ));
yellow-> SetVisibility(true);
//yellow-> SetForceSolid(true);
green = new G4VisAttributes( G4Colour(25/255. , 255/255. , 25/255. ));
green -> SetVisibility(true);
//green -> SetForceSolid(true);
darkGreen = new G4VisAttributes( G4Colour(0/255. , 100/255. , 0/255. ));
darkGreen -> SetVisibility(true);
//darkGreen -> SetForceSolid(true);
darkOrange3 = new G4VisAttributes( G4Colour(205/255. , 102/255. , 000/255. ));
darkOrange3 -> SetVisibility(true);
//darkOrange3 -> SetForceSolid(true);
skyBlue = new G4VisAttributes( G4Colour(135/255. , 206/255. , 235/255. ));
skyBlue -> SetVisibility(true);
//skyBlue -> SetForceSolid(true);
// Geometry FINAL COLLIMATOR DEFAULTS
G4double defaultOuterRadiusFinalCollimatorIORT = 25. *mm;
OuterRadiusFinalCollimatorIORT = defaultOuterRadiusFinalCollimatorIORT;
G4double defaultinnerRadiusFinalCollimatorIORT = 20. *mm;
innerRadiusFinalCollimatorIORT = defaultinnerRadiusFinalCollimatorIORT;
// DEFAULT DEFINITION OF THE MATERIALS
// All elements and compound definition follows the NIST database
// ELEMENTS
G4bool isotopes = false;
G4Material* aluminumNist = G4NistManager::Instance()->FindOrBuildMaterial("G4_Al", isotopes);
//G4Material* tantalumNist = G4NistManager::Instance()->FindOrBuildMaterial("G4_Ta", isotopes);
//G4Material* copperNistAsMaterial = G4NistManager::Instance()->FindOrBuildMaterial("G4_Cu", isotopes);
G4Element* zincNist = G4NistManager::Instance()->FindOrBuildElement("Zn");
G4Element* copperNist = G4NistManager::Instance()->FindOrBuildElement("Cu");
// COMPOUND
G4Material* airNist = G4NistManager::Instance()->FindOrBuildMaterial("G4_AIR", isotopes);
//G4Material* kaptonNist = G4NistManager::Instance()->FindOrBuildMaterial("G4_KAPTON", isotopes);
G4Material* galacticNist = G4NistManager::Instance()->FindOrBuildMaterial("G4_Galactic", isotopes);
G4Material* PMMANist = G4NistManager::Instance()->FindOrBuildMaterial("G4_PLEXIGLASS", isotopes);
//G4Material* mylarNist = G4NistManager::Instance()->FindOrBuildMaterial("G4_MYLAR", isotopes);
G4Material* titanioNist = G4NistManager::Instance()->FindOrBuildMaterial("G4_Ti", isotopes);
G4double d; // Density
G4int nComponents;// Number of components
G4double fractionmass; // Fraction in mass of an element in a material
d = 8.40*g/cm3; // brass
nComponents = 2;
G4Material* brass = new G4Material("Brass", d, nComponents);
brass -> AddElement(zincNist, fractionmass = 30 *perCent);
brass -> AddElement(copperNist, fractionmass = 70 *perCent);
// MATERIAL ASSIGNMENT
// Material of the FINAL COLLIMATOR IORT
finalCollimatorMaterialIORT = PMMANist;
// Junction 1 FINAL COLLIMATOR IORT
Giunz1FinalCollMaterialIORT = PMMANist;
// Junction 2 FINAL COLLIMATOR IORT
Giunz2FinalCollMaterialIORT = PMMANist;
// Junction 3 FINAL COLLIMATOR IORT
Giunz3FinalCollMaterialIORT = PMMANist;
// Junction 3 FINAL COLLIMATOR Int IORT
Giunz3FinalCollMaterialIntIORT = airNist;
// Junction 4 FINAL COLLIMATOR IORT
Giunz4FinalCollMaterialIORT = PMMANist;
// Junction 5 FINAL COLLIMATOR IORT
Giunz5FinalCollMaterialIORT = PMMANist;
// Block 1 Diameter 30 mm
Blocco1IORTMaterialIORT = PMMANist;
// Block 2 Diameter 30 mm
Blocco2IORTMaterialIORT = PMMANist;
// Block 3 Diameter 30 mm
Blocco3IORTMaterialIORT = PMMANist;
// Block Diameter 20 mm
Blocco20mmIORTMaterialIORT = PMMANist;
// First Monitor Chamber Lamina Al 1 of 2
CM1_1_2IORTMaterialIORT = aluminumNist;
// First Monitor Chamber Lamina Al 2 of 2
CM1_2_2IORTMaterialIORT = aluminumNist;
// Second Monitor Chamber Lamina Al 1 of 2
CM2_1_2IORTMaterialIORT = aluminumNist;
// Second Monitor Chamber Lamina Al 2 of 2
CM2_2_2IORTMaterialIORT = aluminumNist;
// Monitor Chamber Cylinder
CCMIORTMaterialIORT = PMMANist;
// Superior Final Part Monitor Chambers
PFS1IORTMaterialIORT = PMMANist;
// Superior Final Part Monitor Chambers
PFS2IORTMaterialIORT = PMMANist;
// Superior Final Part Monitor Chambers
PFS3IORTMaterialIORT = PMMANist;
// Superior Final Part Monitor Chambers Material
FTIORTMaterialIORT = titanioNist;
// Vacuum Source
VSIORTMaterialIORT = galacticNist;
}
/////////////////////////////////////////////////////////////////////////////
void Collimator40BeamLine::ConstructCollimator40BeamLine()
{
// -----------------------------
// Treatment room - World volume
//------------------------------
// Treatment room sizes
const G4double worldX = 400.0 *cm;
const G4double worldY = 400.0 *cm;
const G4double worldZ = 400.0 *cm;
G4bool isotopes = false;
G4Material* airNist = G4NistManager::Instance()->FindOrBuildMaterial("G4_AIR", isotopes);
G4Box* treatmentRoom = new G4Box("TreatmentRoom",worldX,worldY,worldZ);
G4LogicalVolume* logicTreatmentRoom = new G4LogicalVolume(treatmentRoom,
airNist,
"logicTreatmentRoom",
0,0,0);
physicalTreatmentRoom = new G4PVPlacement(0,
G4ThreeVector(),
"physicalTreatmentRoom",
logicTreatmentRoom,
0,false,0);
// The treatment room is invisible in the Visualisation
logicTreatmentRoom -> SetVisAttributes (G4VisAttributes::Invisible);
// Components of the Collimator Beam Line
IortBeamLineVacuumSource();
IortBeamLineTitaniumWindows();
IortBeamLineMonitorChambers();
IortBeamLineBlocks() ;
IortBeamLineJunctions();
IortBeamLineFinalCollimator();
}
void Collimator40BeamLine::IortBeamLineVacuumSource()
{
// ---------------------------------------------------------------//
// Vacuum Source //
// ---------------------------------------------------------------//
G4double phi1 = 90. *deg;
G4RotationMatrix rm1;
rm1.rotateY(phi1);
const G4double OuterRadiusVSIORT = 44.75 *mm;
const G4double innerRadiusVSIORT = 0.*mm;
const G4double hightVSIORT = 1. *mm;
const G4double startAngleVSIORT = 0.*deg;
const G4double spanningAngleVSIORT = 360.*deg;
const G4double XPositionVSIORT = -862.797 *mm;
solidVSIORT = new G4Tubs("VSIORT", innerRadiusVSIORT,
OuterRadiusVSIORT,
hightVSIORT,
startAngleVSIORT,
spanningAngleVSIORT);
G4LogicalVolume* logicVSIORT = new G4LogicalVolume(solidVSIORT,
VSIORTMaterialIORT, "VSIORT", 0, 0, 0);
physiVSIORT = new G4PVPlacement(G4Transform3D(rm1, G4ThreeVector((XPositionVSIORT),0.,0.)),
"VSIORT", logicVSIORT, physicalTreatmentRoom, false, 0);
logicVSIORT -> SetVisAttributes(green);
}
void Collimator40BeamLine::IortBeamLineTitaniumWindows()
{
// ---------------------------------------------------------------//
// Titanium Window //
// ---------------------------------------------------------------//
G4double phi2 = 90. *deg;
G4RotationMatrix rm2;
rm2.rotateY(phi2);
const G4double OuterRadiusFTIORT = 44.75 *mm;
const G4double innerRadiusFTIORT = 8.5 *mm;
const G4double hightFTIORT = 0.006 *mm;
const G4double startAngleFTIORT = 0.*deg;
const G4double spanningAngleFTIORT = 360.*deg;
const G4double XPositionFTIORT = -861.791 *mm;
solidFTIORT = new G4Tubs("FTIORT", innerRadiusFTIORT,
OuterRadiusFTIORT,
hightFTIORT,
startAngleFTIORT,
spanningAngleFTIORT);
G4LogicalVolume* logicFTIORT = new G4LogicalVolume(solidFTIORT,
FTIORTMaterialIORT, "FTIORT", 0, 0, 0);
physiFTIORT = new G4PVPlacement(G4Transform3D(rm2, G4ThreeVector((XPositionFTIORT),0.,0.)),
"FTIORT", logicFTIORT, physicalTreatmentRoom, false, 0);
logicFTIORT -> SetVisAttributes(yellow);
}
void Collimator40BeamLine::IortBeamLineMonitorChambers()
{
G4double phi3 = 90. *deg;
G4RotationMatrix rm3;
rm3.rotateY(phi3);
///////////////////////////////////////////////////////////////////////////////
// Monitor Chamber System
///////////////////////////////////////////////////////////////////////////////
// ---------------------------------------------------------------//
// Superior Final Part Monitor Chambers 3 //
// ---------------------------------------------------------------//
const G4double OuterRadiusPFS3IORT = 44.75 *mm;
const G4double innerRadiusPFS3IORT = 17.5 *mm;
const G4double hightPFS3IORT = 3.03 *mm;
const G4double startAnglePFS3IORT = 0.*deg;
const G4double spanningAnglePFS3IORT = 360.*deg;
const G4double XPositionPFS3IORT = -848.755 *mm;
solidPFS3IORT = new G4Tubs("PFS3IORT", innerRadiusPFS3IORT,
OuterRadiusPFS3IORT,
hightPFS3IORT,
startAnglePFS3IORT,
spanningAnglePFS3IORT);
G4LogicalVolume* logicPFS3IORT = new G4LogicalVolume(solidPFS3IORT,
PFS3IORTMaterialIORT, "PFS3IORT", 0, 0, 0);
physiPFS3IORT = new G4PVPlacement(G4Transform3D(rm3, G4ThreeVector((XPositionPFS3IORT),0.,0.)),
"PFS3IORT", logicPFS3IORT, physicalTreatmentRoom, false, 0);
logicPFS3IORT -> SetVisAttributes(white);
// ---------------------------------------------------------------//
// Superior Final Part Monitor Chambers 2 //
// ---------------------------------------------------------------//
const G4double OuterRadiusPFS2IORT = 44.75 *mm;
const G4double innerRadiusPFS2IORT = 10. *mm;
const G4double hightPFS2IORT = 1.47 *mm;
const G4double startAnglePFS2IORT = 0.*deg;
const G4double spanningAnglePFS2IORT = 360.*deg;
const G4double XPositionPFS2IORT = -844.255 *mm;
solidPFS2IORT = new G4Tubs("PFS2IORT", innerRadiusPFS2IORT,
OuterRadiusPFS2IORT,
hightPFS2IORT,
startAnglePFS2IORT,
spanningAnglePFS2IORT);
G4LogicalVolume* logicPFS2IORT = new G4LogicalVolume(solidPFS2IORT,
PFS2IORTMaterialIORT, "PFS2IORT", 0, 0, 0);
physiPFS2IORT = new G4PVPlacement(G4Transform3D(rm3, G4ThreeVector((XPositionPFS2IORT),0.,0.)),
"PFS2IORT", logicPFS2IORT, physicalTreatmentRoom, false, 0);
logicPFS2IORT -> SetVisAttributes(green);
// ---------------------------------------------------------------//
// Superior Final Part Monitor Chambers 1 //
// ---------------------------------------------------------------//
const G4double OuterRadiusPFS1IORT = 35. *mm;
const G4double innerRadiusPFS1IORT = 10. *mm;
const G4double hightPFS1IORT = 0.88 *mm;
const G4double startAnglePFS1IORT = 0.*deg;
const G4double spanningAnglePFS1IORT = 360.*deg;
const G4double XPositionPFS1IORT = -841.905 *mm;
solidPFS1IORT = new G4Tubs("PFS1IORT", innerRadiusPFS1IORT,
OuterRadiusPFS1IORT,
hightPFS1IORT,
startAnglePFS1IORT,
spanningAnglePFS1IORT);
G4LogicalVolume* logicPFS1IORT = new G4LogicalVolume(solidPFS1IORT,
PFS1IORTMaterialIORT, "PFS1IORT", 0, 0, 0);
physiPFS1IORT = new G4PVPlacement(G4Transform3D(rm3, G4ThreeVector((XPositionPFS1IORT),0.,0.)),
"PFS1IORT", logicPFS1IORT, physicalTreatmentRoom, false, 0);
logicPFS1IORT -> SetVisAttributes(green);
// ------------------------------------------------//
// Monitor Chambers Cylinder //
// ------------------------------------------------//
const G4double OuterRadiusCCMIORT = 35. *mm;
const G4double innerRadiusCCMIORT = 10. *mm;
const G4double hightCCMIORT = 4.0125 *mm;
const G4double startAngleCCMIORT = 0.*deg;
const G4double spanningAngleCCMIORT = 360.*deg;
const G4double XPositionCCMIORT = -837.0125 *mm;
solidCCMIORT = new G4Tubs("CCMIORT", innerRadiusCCMIORT,
OuterRadiusCCMIORT,
hightCCMIORT,
startAngleCCMIORT,
spanningAngleCCMIORT);
G4LogicalVolume* logicCCMIORT = new G4LogicalVolume(solidCCMIORT,
CCMIORTMaterialIORT, "CCMIORT", 0, 0, 0);
physiCCMIORT = new G4PVPlacement(G4Transform3D(rm3, G4ThreeVector((XPositionCCMIORT),0.,0.)),
"CCMIORT", logicCCMIORT, physicalTreatmentRoom, false, 0);
logicCCMIORT -> SetVisAttributes(green);
// ------------------------------------------------//
// Second Monitor Chamber Lamina Al 2 of 2 //
// ------------------------------------------------//
const G4double OuterRadiusCM2_2_2IORT = 20. *mm;
const G4double innerRadiusCM2_2_2IORT = 0. *mm;
const G4double hightCM2_2_2IORT = 0.025 *mm;
const G4double startAngleCM2_2_2IORT = 0.*deg;
const G4double spanningAngleCM2_2_2IORT = 360.*deg;
const G4double XPositionCM2_2_2IORT = -841. *mm;
solidCM2_2_2IORT = new G4Tubs("CM2_2_2IORT", innerRadiusCM2_2_2IORT,
OuterRadiusCM2_2_2IORT,
hightCM2_2_2IORT,
startAngleCM2_2_2IORT,
spanningAngleCM2_2_2IORT);
G4LogicalVolume* logicCM2_2_2IORT = new G4LogicalVolume(solidCM2_2_2IORT,
CM2_2_2IORTMaterialIORT, "CM2_2_2IORT", 0, 0, 0);
physiCM2_2_2IORT = new G4PVPlacement(G4Transform3D(rm3, G4ThreeVector((XPositionCM2_2_2IORT),0.,0.)),
"CM2_2_2ORT", logicCM2_2_2IORT, physicalTreatmentRoom, false, 0);
logicCM2_2_2IORT -> SetVisAttributes(green);
// ------------------------------------------------//
// Second Monitor Chamber Lamina Al 1 of 2 //
// ------------------------------------------------//
const G4double OuterRadiusCM2_1_2IORT = 20. *mm;
const G4double innerRadiusCM2_1_2IORT = 0. *mm;
const G4double hightCM2_1_2IORT = 0.025 *mm;
const G4double startAngleCM2_1_2IORT = 0.*deg;
const G4double spanningAngleCM2_1_2IORT = 360.*deg;
const G4double XPositionCM2_1_2IORT = -839. *mm;
solidCM2_1_2IORT = new G4Tubs("CM2_1_2IORT", innerRadiusCM2_1_2IORT,
OuterRadiusCM2_1_2IORT,
hightCM2_1_2IORT,
startAngleCM2_1_2IORT,
spanningAngleCM2_1_2IORT);
G4LogicalVolume* logicCM2_1_2IORT = new G4LogicalVolume(solidCM2_1_2IORT,
CM2_1_2IORTMaterialIORT, "CM2_1_2IORT", 0, 0, 0);
physiCM2_1_2IORT = new G4PVPlacement(G4Transform3D(rm3, G4ThreeVector((XPositionCM2_1_2IORT),0.,0.)),
"CM2_1_2ORT", logicCM2_1_2IORT, physicalTreatmentRoom, false, 0);
logicCM2_1_2IORT -> SetVisAttributes(yellow);
// ------------------------------------------------//
// First Monitor Chamber Lamina Al 2 of 2 //
// ------------------------------------------------//
const G4double OuterRadiusCM1_2_2IORT = 20. *mm;
const G4double innerRadiusCM1_2_2IORT = 0. *mm;
const G4double hightCM1_2_2IORT = 0.025 *mm;
const G4double startAngleCM1_2_2IORT = 0.*deg;
const G4double spanningAngleCM1_2_2IORT = 360.*deg;
const G4double XPositionCM1_2_2IORT = -837. *mm;
solidCM1_2_2IORT = new G4Tubs("CM1_2_2IORT", innerRadiusCM1_2_2IORT,
OuterRadiusCM1_2_2IORT,
hightCM1_2_2IORT,
startAngleCM1_2_2IORT,
spanningAngleCM1_2_2IORT);
G4LogicalVolume* logicCM1_2_2IORT = new G4LogicalVolume(solidCM1_2_2IORT,
CM1_2_2IORTMaterialIORT, "CM1_2_2IORT", 0, 0, 0);
physiCM1_2_2IORT = new G4PVPlacement(G4Transform3D(rm3, G4ThreeVector((XPositionCM1_2_2IORT),0.,0.)),
"CM1_2_2ORT", logicCM1_2_2IORT, physicalTreatmentRoom, false, 0);
logicCM1_2_2IORT -> SetVisAttributes(yellow);
// ------------------------------------------------//
// First Monitor Chamber Lamina Al 1 of 2 //
// ------------------------------------------------//
const G4double OuterRadiusCM1_1_2IORT = 20. *mm;
const G4double innerRadiusCM1_1_2IORT = 0. *mm;
const G4double hightCM1_1_2IORT = 0.025 *mm;
const G4double startAngleCM1_1_2IORT = 0.*deg;
const G4double spanningAngleCM1_1_2IORT = 360.*deg;
const G4double XPositionCM1_1_2IORT = -835. *mm;
solidCM1_1_2IORT = new G4Tubs("CM1_1_2IORT", innerRadiusCM1_1_2IORT,
OuterRadiusCM1_1_2IORT,
hightCM1_1_2IORT,
startAngleCM1_1_2IORT,
spanningAngleCM1_1_2IORT);
G4LogicalVolume* logicCM1_1_2IORT = new G4LogicalVolume(solidCM1_1_2IORT,
CM1_1_2IORTMaterialIORT, "CM1_1_2IORT", 0, 0, 0);
physiCM1_1_2IORT = new G4PVPlacement(G4Transform3D(rm3, G4ThreeVector((XPositionCM1_1_2IORT),0.,0.)),
"CM1_1_2ORT", logicCM1_1_2IORT, physicalTreatmentRoom, false, 0);
logicCM1_1_2IORT -> SetVisAttributes(yellow);
}
void Collimator40BeamLine::IortBeamLineBlocks()
{
G4double phi4 = 90. *deg;
G4RotationMatrix rm4;
rm4.rotateY(phi4);
///////////////////////////////////////////////////////////////////////////////
// IORT BEAM LINE BLOCKS
///////////////////////////////////////////////////////////////////////////////
// ------------------------------------------------//
// Block 4 //
// ------------------------------------------------//
const G4double OuterRadiusBlocco20mmIORT = 36.5 *mm;
const G4double innerRadiusBlocco20mmIORT = 10. *mm;
const G4double hightBlocco20mmIORT = 3. *mm;
const G4double startAngleBlocco20mmIORT = 0.*deg;
const G4double spanningAngleBlocco20mmIORT = 360.*deg;
const G4double XPositionBlocco20mmIORT = -830. *mm;
solidBlocco20mmIORT = new G4Tubs("Blocco20mmIORT", innerRadiusBlocco20mmIORT,
OuterRadiusBlocco20mmIORT,
hightBlocco20mmIORT,
startAngleBlocco20mmIORT,
spanningAngleBlocco20mmIORT);
G4LogicalVolume* logicBlocco20mmIORT = new G4LogicalVolume(solidBlocco20mmIORT,
Blocco20mmIORTMaterialIORT, "Blocco20mmIORT", 0, 0, 0);
physiBlocco20mmIORT = new G4PVPlacement(G4Transform3D(rm4, G4ThreeVector((XPositionBlocco20mmIORT),0.,0.)),
"Blocco20mmORT", logicBlocco20mmIORT, physicalTreatmentRoom, false, 0);
logicBlocco20mmIORT -> SetVisAttributes(green);
// -----------------------//
// Block 3 //
// -----------------------//
const G4double OuterRadiusBlocco3IORT = 36.5 *mm;
const G4double innerRadiusBlocco3IORT = 15. *mm;
const G4double hightBlocco3IORT = 3.5 *mm;
const G4double startAngleBlocco3IORT = 0.*deg;
const G4double spanningAngleBlocco3IORT = 360.*deg;
const G4double XPositionBlocco3IORT = -823.5 *mm;
solidBlocco3IORT = new G4Tubs("Blocco3IORT", innerRadiusBlocco3IORT,
OuterRadiusBlocco3IORT,
hightBlocco3IORT,
startAngleBlocco3IORT,
spanningAngleBlocco3IORT);
G4LogicalVolume* logicBlocco3IORT = new G4LogicalVolume(solidBlocco3IORT,
Blocco3IORTMaterialIORT, "Blocco3IORT", 0, 0, 0);
physiBlocco3IORT = new G4PVPlacement(G4Transform3D(rm4, G4ThreeVector((XPositionBlocco3IORT),0.,0.)),
"Blocco3ORT", logicBlocco3IORT, physicalTreatmentRoom, false, 0);
logicBlocco3IORT -> SetVisAttributes(yellow);
// -----------------------//
// Block 2 //
// -----------------------//
const G4double OuterRadiusBlocco2IORT = 41.5 *mm;
const G4double innerRadiusBlocco2IORT = 15. *mm;
const G4double hightBlocco2IORT = 8. *mm;
const G4double startAngleBlocco2IORT = 0.*deg;
const G4double spanningAngleBlocco2IORT = 360.*deg;
const G4double XPositionBlocco2IORT = -812. *mm;
solidBlocco2IORT = new G4Tubs("Blocco2IORT", innerRadiusBlocco2IORT,
OuterRadiusBlocco2IORT,
hightBlocco2IORT,
startAngleBlocco2IORT,
spanningAngleBlocco2IORT);
G4LogicalVolume* logicBlocco2IORT = new G4LogicalVolume(solidBlocco2IORT,
Blocco2IORTMaterialIORT, "Blocco2IORT", 0, 0, 0);
physiBlocco2IORT = new G4PVPlacement(G4Transform3D(rm4, G4ThreeVector((XPositionBlocco2IORT),0.,0.)),
"Blocco2IORT", logicBlocco2IORT, physicalTreatmentRoom, false, 0);
logicBlocco2IORT -> SetVisAttributes(red);
// ----------------------- //
// Block 1 //
// ----------------------- //
const G4double OuterRadiusBlocco1IORT = 52.0 *mm;
const G4double innerRadiusBlocco1IORT = 15. *mm;
const G4double hightBlocco1IORT = 8.5 *mm;
const G4double startAngleBlocco1IORT = 0.*deg;
const G4double spanningAngleBlocco1IORT = 360.*deg;
const G4double XPositionBlocco1IORT = -795.5*mm;
solidBlocco1IORT = new G4Tubs("Blocco1IORT", innerRadiusBlocco1IORT,
OuterRadiusBlocco1IORT,
hightBlocco1IORT,
startAngleBlocco1IORT,
spanningAngleBlocco1IORT);
G4LogicalVolume* logicBlocco1IORT = new G4LogicalVolume(solidBlocco1IORT,
Blocco1IORTMaterialIORT, "Blocco1IORT", 0, 0, 0);
physiBlocco1IORT = new G4PVPlacement(G4Transform3D(rm4, G4ThreeVector((XPositionBlocco1IORT),0.,0.)),
"Blocco1IORT", logicBlocco1IORT, physicalTreatmentRoom, false, 0);
logicBlocco1IORT -> SetVisAttributes(white);
}
void Collimator40BeamLine::IortBeamLineJunctions()
{
G4double phi5 = 90. *deg;
G4RotationMatrix rm5;
rm5.rotateY(phi5);
// --------------------------------- //
// Junction 5 FINAL COLLIMATOR IORT //
// --------------------------------- //
const G4double OuterRadiusGiunz5FinalCollIORT = 48.25 *mm;
const G4double innerRadiusGiunz5FinalCollIORT = 13.75 *mm;
const G4double hightGiunz5FinalCollIORT = 3.5 *mm;
const G4double startAngleGiunz5FinalCollIORT = 0.*deg;
const G4double spanningAngleGiunz5FinalCollIORT = 360.*deg;
const G4double Giunz5FinalCollXPositionIORT = -783.5 *mm;
solidGiunz5FinalCollIORT = new G4Tubs("Giunz5FinalCollIORT", innerRadiusGiunz5FinalCollIORT,
OuterRadiusGiunz5FinalCollIORT,
hightGiunz5FinalCollIORT,
startAngleGiunz5FinalCollIORT,
spanningAngleGiunz5FinalCollIORT);
G4LogicalVolume* logicGiunz5FinalCollIORT = new G4LogicalVolume(solidGiunz5FinalCollIORT,
Giunz5FinalCollMaterialIORT, "Giunz5FinalCollIORT", 0, 0, 0);
physiGiunz5FinalCollIORT = new G4PVPlacement(G4Transform3D(rm5, G4ThreeVector((Giunz5FinalCollXPositionIORT),0.,0.)),
"Giunz5FinalCollIORT", logicGiunz5FinalCollIORT, physicalTreatmentRoom, false, 0);
logicGiunz5FinalCollIORT -> SetVisAttributes(yellow);
// --------------------------------- //
// Junction 4 FINAL COLLIMATOR IORT //
// --------------------------------- //
const G4double OuterRadiusGiunz4FinalCollIORT = 42. *mm;
const G4double innerRadiusGiunz4FinalCollIORT = 13.75 *mm;
const G4double hightGiunz4FinalCollIORT = 8.5 *mm;
const G4double startAngleGiunz4FinalCollIORT = 0.*deg;
const G4double spanningAngleGiunz4FinalCollIORT = 360.*deg;
const G4double Giunz4FinalCollXPositionIORT = -771.5 *mm;
solidGiunz4FinalCollIORT = new G4Tubs("Giunz4FinalCollIORT", innerRadiusGiunz4FinalCollIORT,
OuterRadiusGiunz4FinalCollIORT,
hightGiunz4FinalCollIORT,
startAngleGiunz4FinalCollIORT,
spanningAngleGiunz4FinalCollIORT);
G4LogicalVolume* logicGiunz4FinalCollIORT = new G4LogicalVolume(solidGiunz4FinalCollIORT,
Giunz4FinalCollMaterialIORT, "Giunz4FinalCollIORT", 0, 0, 0);
physiGiunz4FinalCollIORT = new G4PVPlacement(G4Transform3D(rm5, G4ThreeVector((Giunz4FinalCollXPositionIORT),0.,0.)),
"Giunz4FinalCollIORT", logicGiunz4FinalCollIORT, physicalTreatmentRoom, false, 0);
logicGiunz4FinalCollIORT -> SetVisAttributes(blue);
// --------------------------------- //
// Junction 3 FINAL COLLIMATOR IORT //
// --------------------------------- //
const G4double OuterRadiusGiunz3FinalCollIORT = 42. *mm;
const G4double innerRadiusGiunz3FinalCollIORT = 0. *mm;
const G4double hightGiunz3FinalCollIORT = 4.25 *mm;
const G4double startAngleGiunz3FinalCollIORT = 0.*deg;
const G4double spanningAngleGiunz3FinalCollIORT = 360.*deg;
const G4double Giunz3FinalCollXPositionIORT = -758.75 *mm;
solidGiunz3FinalCollIORT = new G4Tubs("Giunz3FinalCollIORT", innerRadiusGiunz3FinalCollIORT,
OuterRadiusGiunz3FinalCollIORT,
hightGiunz3FinalCollIORT,
startAngleGiunz3FinalCollIORT,
spanningAngleGiunz3FinalCollIORT);
G4LogicalVolume* logicsolidGiunz3FinalCollIORT = new G4LogicalVolume(solidGiunz3FinalCollIORT,
Giunz3FinalCollMaterialIORT, "Giunz3FinalCollIORT", 0, 0, 0);
physiGiunz3FinalCollIORT = new G4PVPlacement(G4Transform3D(rm5, G4ThreeVector((Giunz3FinalCollXPositionIORT),0.,0.)),
"Giunz3FinalCollIORT", logicsolidGiunz3FinalCollIORT, physicalTreatmentRoom, false, 0);
logicsolidGiunz3FinalCollIORT -> SetVisAttributes(yellow);
// logicsolidGiunz3FinalCollIORT -> SetVisAttributes (G4VisAttributes::Invisible);
// --------------------------------- //
// Junction 3 FINAL COLLIMATOR IORT internal //
// --------------------------------- //
solidGiunz3FinalCollIntIORT = new G4Cons("Giunz3FinalCollIntIORT",0.*mm,13.75*mm,0.*mm,20.0*mm,4.25*mm,0.*deg,360.*deg);
G4LogicalVolume* logicsolidGiunz3FinalCollIntIORT = new G4LogicalVolume(solidGiunz3FinalCollIntIORT,
Giunz3FinalCollMaterialIntIORT, "Giunz3FinalCollIntIORT", 0, 0, 0);
physiGiunz3FinalCollIntIORT = new G4PVPlacement(0, G4ThreeVector(0.,0.,0.),"Giunz3FinalCollIntIORT", logicsolidGiunz3FinalCollIntIORT,physiGiunz3FinalCollIORT, false, 0);
logicsolidGiunz3FinalCollIntIORT -> SetVisAttributes(yellow);
}
void Collimator40BeamLine::IortBeamLineFinalCollimator()
{
// -----------------------//
// FINAL COLLIMATOR IORT //
//------------------------//
// const G4double OuterRadiusFinalCollimatorIORT = 35. *mm;
// const G4double innerRadiusFinalCollimatorIORT = 30. *mm;
const G4double hightFinalCollimatorIORT = 349.75 *mm;
const G4double startAngleFinalCollimatorIORT = 0.*deg;
const G4double spanningAngleFinalCollimatorIORT = 360.*deg;
const G4double finalCollimatorXPositionIORT = -404.75 *mm;
G4double phi6 = 90. *deg;
G4RotationMatrix rm6;
rm6.rotateY(phi6);
solidFinalCollimatorIORT = new G4Tubs("FinalCollimatorIORT", innerRadiusFinalCollimatorIORT,
OuterRadiusFinalCollimatorIORT,
hightFinalCollimatorIORT,
startAngleFinalCollimatorIORT,
spanningAngleFinalCollimatorIORT);
G4LogicalVolume* logicFinalCollimatorIORT = new G4LogicalVolume(solidFinalCollimatorIORT,
finalCollimatorMaterialIORT, "FinalCollimatorIORT", 0, 0, 0);
physiFinalCollimatorIORT = new G4PVPlacement(G4Transform3D(rm6, G4ThreeVector((finalCollimatorXPositionIORT),0.,0.)),
"FinalCollimatorIORT", logicFinalCollimatorIORT, physicalTreatmentRoom, false, 0);
// logicFinalCollimatorIORT -> SetVisAttributes(G4VisAttributes::Invisible);
logicFinalCollimatorIORT -> SetVisAttributes(green);
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////// MESSENGER ///////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void Collimator40BeamLine::SetInnerRadiusFinalCollimatorIORT(G4double value)
{
solidFinalCollimatorIORT -> SetInnerRadius(value);
G4RunManager::GetRunManager() -> GeometryHasBeenModified();
G4cout<<"Inner Radius of the final collimator IORT is (mm):"
<< solidFinalCollimatorIORT -> GetInnerRadius()/mm
<< G4endl;
}
/////////////////////////////////////////////////////////////////////////
void Collimator40BeamLine::SetOuterRadiusFinalCollimatorIORT(G4double value)
{
solidFinalCollimatorIORT -> SetOuterRadius(value);
G4RunManager::GetRunManager() -> GeometryHasBeenModified();
G4cout<<"Outer Radius of the final collimator IORT is (mm):"
<< solidFinalCollimatorIORT -> GetOuterRadius()/mm
<< G4endl;
}
/////////////////////////////////////////////////////////////////////////////
@@ -0,0 +1,102 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// This is the *BASIC* version of IORT, a Geant4-based application
//
// Main Authors: G.Russo(a,b), C.Casarino*(c), G.C. Candiano(c), G.A.P. Cirrone(d), F.Romano(d)
// Contributor Authors: S.Guatelli(e)
// Past Authors: G.Arnetta(c), S.E.Mazzaglia(d)
//
// (a) Fondazione Istituto San Raffaele G.Giglio, Cefalù, Italy
// (b) IBFM-CNR , Segrate (Milano), Italy
// (c) LATO (Laboratorio di Tecnologie Oncologiche), Cefalù, Italy
// (d) Laboratori Nazionali del Sud of the INFN, Catania, Italy
// (e) University of Wallongong, Australia
//
// *Corresponding author, email to carlo.casarino@polooncologicocefalu.it
//////////////////////////////////////////////////////////////////////////////////////////////
#include "Collimator40BeamLineMessenger.hh"
#include "Collimator40BeamLine.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithAString.hh"
Collimator40BeamLineMessenger::Collimator40BeamLineMessenger(Collimator40BeamLine* beamLine)
:collimator40(beamLine)
{
beamLineDir = new G4UIdirectory("/beamLine/");
beamLineDir -> SetGuidance("set specification of range shifter");
FinalCollimatorIORTDir = new G4UIdirectory("/beamLine/FinalCollimatorIORT/");
FinalCollimatorIORTDir -> SetGuidance("set specification of final collimator");
innerRadiusFinalCollimatorIORTCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/FinalCollimatorIORT/halfInnerRad",this);
innerRadiusFinalCollimatorIORTCmd -> SetGuidance("Set size of inner radius ( max 21.5 mm)");
innerRadiusFinalCollimatorIORTCmd -> SetParameterName("Size",false);
innerRadiusFinalCollimatorIORTCmd -> SetDefaultUnit("mm");
innerRadiusFinalCollimatorIORTCmd -> SetUnitCandidates("mm cm m");
innerRadiusFinalCollimatorIORTCmd -> AvailableForStates(G4State_Idle);
OuterRadiusFinalCollimatorIORTCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/FinalCollimatorIORT/halfOuterRad",this);
OuterRadiusFinalCollimatorIORTCmd -> SetGuidance("Set size of outer radius ( max 21.5 mm)");
OuterRadiusFinalCollimatorIORTCmd -> SetParameterName("Size",false);
OuterRadiusFinalCollimatorIORTCmd -> SetDefaultUnit("mm");
OuterRadiusFinalCollimatorIORTCmd -> SetUnitCandidates("mm cm m");
OuterRadiusFinalCollimatorIORTCmd -> AvailableForStates(G4State_Idle);
}
Collimator40BeamLineMessenger::~Collimator40BeamLineMessenger()
{
delete OuterRadiusFinalCollimatorIORTCmd;
delete innerRadiusFinalCollimatorIORTCmd;
delete FinalCollimatorIORTDir;
delete beamLineDir;
}
void Collimator40BeamLineMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
{
if( command == innerRadiusFinalCollimatorIORTCmd )
{ collimator40 -> SetInnerRadiusFinalCollimatorIORT
(innerRadiusFinalCollimatorIORTCmd -> GetNewDoubleValue(newValue));}
else if( command == OuterRadiusFinalCollimatorIORTCmd )
{ collimator40 -> SetOuterRadiusFinalCollimatorIORT
(OuterRadiusFinalCollimatorIORTCmd -> GetNewDoubleValue(newValue));}
}
+988
View File
@@ -0,0 +1,988 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// This is the *BASIC* version of IORT, a Geant4-based application
//
// Main Authors: G.Russo(a,b), C.Casarino*(c), G.C. Candiano(c), G.A.P. Cirrone(d), F.Romano(d)
// Contributor Authors: S.Guatelli(e)
// Past Authors: G.Arnetta(c), S.E.Mazzaglia(d)
//
// (a) Fondazione Istituto San Raffaele G.Giglio, Cefalù, Italy
// (b) IBFM-CNR , Segrate (Milano), Italy
// (c) LATO (Laboratorio di Tecnologie Oncologiche), Cefalù, Italy
// (d) Laboratori Nazionali del Sud of the INFN, Catania, Italy
// (e) University of Wallongong, Australia
//
// *Corresponding author, email to carlo.casarino@polooncologicocefalu.it
//////////////////////////////////////////////////////////////////////////////////////////////
#include "G4Box.hh"
#include "G4Tubs.hh"
#include "G4Cons.hh"
#include "G4VisAttributes.hh"
#include "G4Colour.hh"
#include "globals.hh"
#include "G4RunManager.hh"
#include "G4LogicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4RotationMatrix.hh"
#include "G4NistManager.hh"
#include "G4NistElementBuilder.hh"
#include "G4SubtractionSolid.hh"
#include "IORTDetectorConstruction.hh"
#include "Collimator50BeamLine.hh"
#include "Collimator50BeamLineMessenger.hh"
Collimator50BeamLine::Collimator50BeamLine():
physicalTreatmentRoom(0),iortDetectorConstruction(0),
solidFinalCollimatorIORT(0),
logicFinalCollimatorIORT(0),
physiFinalCollimatorIORT(0),
solidGiunz1FinalCollIORT(0),
logicGiunz1FinalCollIORT(0),
physiGiunz1FinalCollIORT(0),
solidGiunz2FinalCollIORT(0),
logicGiunz2FinalCollIORT(0),
physiGiunz2FinalCollIORT(0),
solidGiunz3FinalCollIORT(0),
logicGiunz3FinalCollIORT(0),
physiGiunz3FinalCollIORT(0),
solidGiunz3FinalCollIntIORT(0),
logicGiunz3FinalCollIntIORT(0),
physiGiunz3FinalCollIntIORT(0),
solidGiunz4FinalCollIORT(0),
logicGiunz4FinalCollIORT(0),
physiGiunz4FinalCollIORT(0),
solidGiunz5FinalCollIORT(0),
logicGiunz5FinalCollIORT(0),
physiGiunz5FinalCollIORT(0),
solidBlocco1IORT(0),
logicBlocco1IORT(0),
physiBlocco1IORT(0),
solidBlocco2IORT(0),
logicBlocco2IORT(0),
physiBlocco2IORT(0),
solidBlocco3IORT(0),
logicBlocco3IORT(0),
physiBlocco3IORT(0),
solidBlocco20mmIORT(0),
logicBlocco20mmIORT(0),
physiBlocco20mmIORT(0),
solidCM1_1_2IORT(0),
logicCM1_1_2IORT(0),
physiCM1_1_2IORT(0),
solidCM1_2_2IORT(0),
logicCM1_2_2IORT(0),
physiCM1_2_2IORT(0),
solidCM2_1_2IORT(0),
logicCM2_1_2IORT(0),
physiCM2_1_2IORT(0),
solidCM2_2_2IORT(0),
logicCM2_2_2IORT(0),
physiCM2_2_2IORT(0),
solidCCMIORT(0),
logicCCMIORT(0),
physiCCMIORT(0),
solidPFS1IORT(0),
logicPFS1IORT(0),
physiPFS1IORT(0),
solidPFS2IORT(0),
logicPFS2IORT(0),
physiPFS2IORT(0),
solidPFS3IORT(0),
logicPFS3IORT(0),
physiPFS3IORT(0),
solidFTIORT(0),
logicFTIORT(0),
physiFTIORT(0)
{
// Messenger to change parameters of the collimator50BeamLine geometry
collimatorMessenger = new Collimator50BeamLineMessenger(this);
}
/////////////////////////////////////////////////////////////////////////////
Collimator50BeamLine::~Collimator50BeamLine()
{
delete collimatorMessenger;
delete iortDetectorConstruction;
}
/////////////////////////////////////////////////////////////////////////////
G4VPhysicalVolume* Collimator50BeamLine::Construct()
{
// Sets default geometry and materials
SetDefaultDimensions();
// Construct the whole Collimator Beam Line
ConstructCollimator50BeamLine();
// IORTDetectorConstruction builds ONLY the phantom and the detector with its associated ROGeometry
iortDetectorConstruction = new IORTDetectorConstruction(physicalTreatmentRoom);
return physicalTreatmentRoom;
}
// In the following method the DEFAULTS used in the geometry of
// collimator beam line are provided
// HERE THE USER CAN CHANGE THE GEOMETRY CHARACTERISTICS OF BEAM
// LINE ELEMENTS, ALTERNATIVELY HE/SHE CAN USE THE MACRO FILE (IF A
// MESSENGER IS PROVIDED)
//
// DEFAULT MATERIAL ARE ALSO PROVIDED
// and COLOURS ARE ALSO DEFINED
// ----------------------------------------------------------
/////////////////////////////////////////////////////////////////////////////
void Collimator50BeamLine::SetDefaultDimensions()
{
// Set of coulors that can be used
white = new G4VisAttributes( G4Colour());
white -> SetVisibility(true);
//white -> SetForceSolid(true);
blue = new G4VisAttributes(G4Colour(0. ,0. ,1.));
blue -> SetVisibility(true);
//blue -> SetForceSolid(true);
gray = new G4VisAttributes( G4Colour(0.5, 0.5, 0.5 ));
gray-> SetVisibility(true);
//gray-> SetForceSolid(true);
red = new G4VisAttributes(G4Colour(1. ,0. ,0.));
red-> SetVisibility(true);
//red-> SetForceSolid(true);
yellow = new G4VisAttributes(G4Colour(1., 1., 0. ));
yellow-> SetVisibility(true);
//yellow-> SetForceSolid(true);
green = new G4VisAttributes( G4Colour(25/255. , 255/255. , 25/255. ));
green -> SetVisibility(true);
//green -> SetForceSolid(true);
darkGreen = new G4VisAttributes( G4Colour(0/255. , 100/255. , 0/255. ));
darkGreen -> SetVisibility(true);
//darkGreen -> SetForceSolid(true);
darkOrange3 = new G4VisAttributes( G4Colour(205/255. , 102/255. , 000/255. ));
darkOrange3 -> SetVisibility(true);
//darkOrange3 -> SetForceSolid(true);
skyBlue = new G4VisAttributes( G4Colour(135/255. , 206/255. , 235/255. ));
skyBlue -> SetVisibility(true);
//skyBlue -> SetForceSolid(true);
// Geometry FINAL COLLIMATOR DEFAULTS
G4double defaultOuterRadiusFinalCollimatorIORT = 30. *mm;
OuterRadiusFinalCollimatorIORT = defaultOuterRadiusFinalCollimatorIORT;
G4double defaultinnerRadiusFinalCollimatorIORT = 25. *mm;
innerRadiusFinalCollimatorIORT = defaultinnerRadiusFinalCollimatorIORT;
// DEFAULT DEFINITION OF THE MATERIALS
// All elements and compound definition follows the NIST database
// ELEMENTS
G4bool isotopes = false;
G4Material* aluminumNist = G4NistManager::Instance()->FindOrBuildMaterial("G4_Al", isotopes);
//G4Material* tantalumNist = G4NistManager::Instance()->FindOrBuildMaterial("G4_Ta", isotopes);
//G4Material* copperNistAsMaterial = G4NistManager::Instance()->FindOrBuildMaterial("G4_Cu", isotopes);
G4Element* zincNist = G4NistManager::Instance()->FindOrBuildElement("Zn");
G4Element* copperNist = G4NistManager::Instance()->FindOrBuildElement("Cu");
// COMPOUND
G4Material* airNist = G4NistManager::Instance()->FindOrBuildMaterial("G4_AIR", isotopes);
//G4Material* kaptonNist = G4NistManager::Instance()->FindOrBuildMaterial("G4_KAPTON", isotopes);
G4Material* galacticNist = G4NistManager::Instance()->FindOrBuildMaterial("G4_Galactic", isotopes);
G4Material* PMMANist = G4NistManager::Instance()->FindOrBuildMaterial("G4_PLEXIGLASS", isotopes);
//G4Material* mylarNist = G4NistManager::Instance()->FindOrBuildMaterial("G4_MYLAR", isotopes);
G4Material* titanioNist = G4NistManager::Instance()->FindOrBuildMaterial("G4_Ti", isotopes);
G4double d; // Density
G4int nComponents;// Number of components
G4double fractionmass; // Fraction in mass of an element in a material
d = 8.40*g/cm3; // brass
nComponents = 2;
G4Material* brass = new G4Material("Brass", d, nComponents);
brass -> AddElement(zincNist, fractionmass = 30 *perCent);
brass -> AddElement(copperNist, fractionmass = 70 *perCent);
// MATERIAL ASSIGNMENT
// Material of the FINAL COLLIMATOR IORT
finalCollimatorMaterialIORT = PMMANist;
// Junction 1 FINAL COLLIMATOR IORT
Giunz1FinalCollMaterialIORT = PMMANist;
// Junction 2 FINAL COLLIMATOR IORT
Giunz2FinalCollMaterialIORT = PMMANist;
// Junction 3 FINAL COLLIMATOR IORT
Giunz3FinalCollMaterialIORT = PMMANist;
// Junction 3 FINAL COLLIMATOR Int IORT
Giunz3FinalCollMaterialIntIORT = airNist;
// Junction 4 FINAL COLLIMATOR IORT
Giunz4FinalCollMaterialIORT = PMMANist;
// Junction 5 FINAL COLLIMATOR IORT
Giunz5FinalCollMaterialIORT = PMMANist;
// Block 1 Diameter 30 mm
Blocco1IORTMaterialIORT = PMMANist;
// Block 2 Diameter 30 mm
Blocco2IORTMaterialIORT = PMMANist;
// Block 3 Diameter 30 mm
Blocco3IORTMaterialIORT = PMMANist;
// Block Diameter 20 mm
Blocco20mmIORTMaterialIORT = PMMANist;
// First Monitor Chamber Lamina Al 1 of 2
CM1_1_2IORTMaterialIORT = aluminumNist;
// First Monitor Chamber Lamina Al 2 of 2
CM1_2_2IORTMaterialIORT = aluminumNist;
// Second Monitor Chamber Lamina Al 1 of 2
CM2_1_2IORTMaterialIORT = aluminumNist;
// Second Monitor Chamber Lamina Al 2 of 2
CM2_2_2IORTMaterialIORT = aluminumNist;
// Monitor Chamber Cylinder
CCMIORTMaterialIORT = PMMANist;
// Superior Final Part Monitor Chambers
PFS1IORTMaterialIORT = PMMANist;
// Superior Final Part Monitor Chambers
PFS2IORTMaterialIORT = PMMANist;
// Superior Final Part Monitor Chambers
PFS3IORTMaterialIORT = PMMANist;
// Superior Final Part Monitor Chambers Material
FTIORTMaterialIORT = titanioNist;
// Vacuum Source
VSIORTMaterialIORT = galacticNist;
}
/////////////////////////////////////////////////////////////////////////////
void Collimator50BeamLine::ConstructCollimator50BeamLine()
{
// -----------------------------
// Treatment room - World volume
//------------------------------
// Treatment room sizes
const G4double worldX = 400.0 *cm;
const G4double worldY = 400.0 *cm;
const G4double worldZ = 400.0 *cm;
G4bool isotopes = false;
G4Material* airNist = G4NistManager::Instance()->FindOrBuildMaterial("G4_AIR", isotopes);
G4Box* treatmentRoom = new G4Box("TreatmentRoom",worldX,worldY,worldZ);
G4LogicalVolume* logicTreatmentRoom = new G4LogicalVolume(treatmentRoom,
airNist,
"logicTreatmentRoom",
0,0,0);
physicalTreatmentRoom = new G4PVPlacement(0,
G4ThreeVector(),
"physicalTreatmentRoom",
logicTreatmentRoom,
0,false,0);
// The treatment room is invisible in the Visualisation
logicTreatmentRoom -> SetVisAttributes (G4VisAttributes::Invisible);
// Components of the Collimator Beam Line
IortBeamLineVacuumSource();
IortBeamLineTitaniumWindows();
IortBeamLineMonitorChambers();
IortBeamLineBlocks() ;
IortBeamLineJunctions();
IortBeamLineFinalCollimator();
}
void Collimator50BeamLine::IortBeamLineVacuumSource()
{
// ---------------------------------------------------------------//
// Vacuum Source //
// ---------------------------------------------------------------//
G4double phi1 = 90. *deg;
G4RotationMatrix rm1;
rm1.rotateY(phi1);
const G4double OuterRadiusVSIORT = 44.75 *mm;
const G4double innerRadiusVSIORT = 0.*mm;
const G4double hightVSIORT = 1. *mm;
const G4double startAngleVSIORT = 0.*deg;
const G4double spanningAngleVSIORT = 360.*deg;
const G4double XPositionVSIORT = -862.797 *mm;
solidVSIORT = new G4Tubs("VSIORT", innerRadiusVSIORT,
OuterRadiusVSIORT,
hightVSIORT,
startAngleVSIORT,
spanningAngleVSIORT);
G4LogicalVolume* logicVSIORT = new G4LogicalVolume(solidVSIORT,
VSIORTMaterialIORT, "VSIORT", 0, 0, 0);
physiVSIORT = new G4PVPlacement(G4Transform3D(rm1, G4ThreeVector((XPositionVSIORT),0.,0.)),
"VSIORT", logicVSIORT, physicalTreatmentRoom, false, 0);
logicVSIORT -> SetVisAttributes(green);
}
void Collimator50BeamLine::IortBeamLineTitaniumWindows()
{
// ---------------------------------------------------------------//
// Titanium Window //
// ---------------------------------------------------------------//
G4double phi2 = 90. *deg;
G4RotationMatrix rm2;
rm2.rotateY(phi2);
const G4double OuterRadiusFTIORT = 44.75 *mm;
const G4double innerRadiusFTIORT = 8.5 *mm;
const G4double hightFTIORT = 0.006 *mm;
const G4double startAngleFTIORT = 0.*deg;
const G4double spanningAngleFTIORT = 360.*deg;
const G4double XPositionFTIORT = -861.791 *mm;
solidFTIORT = new G4Tubs("FTIORT", innerRadiusFTIORT,
OuterRadiusFTIORT,
hightFTIORT,
startAngleFTIORT,
spanningAngleFTIORT);
G4LogicalVolume* logicFTIORT = new G4LogicalVolume(solidFTIORT,
FTIORTMaterialIORT, "FTIORT", 0, 0, 0);
physiFTIORT = new G4PVPlacement(G4Transform3D(rm2, G4ThreeVector((XPositionFTIORT),0.,0.)),
"FTIORT", logicFTIORT, physicalTreatmentRoom, false, 0);
logicFTIORT -> SetVisAttributes(yellow);
}
void Collimator50BeamLine::IortBeamLineMonitorChambers()
{
G4double phi3 = 90. *deg;
G4RotationMatrix rm3;
rm3.rotateY(phi3);
///////////////////////////////////////////////////////////////////////////////
// Monitor Chambers System
///////////////////////////////////////////////////////////////////////////////
// ---------------------------------------------------------------//
// Superior Final Part Monitor Chambers 3 //
// ---------------------------------------------------------------//
const G4double OuterRadiusPFS3IORT = 44.75 *mm;
const G4double innerRadiusPFS3IORT = 17.5 *mm;
const G4double hightPFS3IORT = 3.03 *mm;
const G4double startAnglePFS3IORT = 0.*deg;
const G4double spanningAnglePFS3IORT = 360.*deg;
const G4double XPositionPFS3IORT = -848.755 *mm;
solidPFS3IORT = new G4Tubs("PFS3IORT", innerRadiusPFS3IORT,
OuterRadiusPFS3IORT,
hightPFS3IORT,
startAnglePFS3IORT,
spanningAnglePFS3IORT);
G4LogicalVolume* logicPFS3IORT = new G4LogicalVolume(solidPFS3IORT,
PFS3IORTMaterialIORT, "PFS3IORT", 0, 0, 0);
physiPFS3IORT = new G4PVPlacement(G4Transform3D(rm3, G4ThreeVector((XPositionPFS3IORT),0.,0.)),
"PFS3IORT", logicPFS3IORT, physicalTreatmentRoom, false, 0);
logicPFS3IORT -> SetVisAttributes(white);
// ---------------------------------------------------------------//
// Superior Final Part Monitor Chambers 2 //
// ---------------------------------------------------------------//
const G4double OuterRadiusPFS2IORT = 44.75 *mm;
const G4double innerRadiusPFS2IORT = 10. *mm;
const G4double hightPFS2IORT = 1.47 *mm;
const G4double startAnglePFS2IORT = 0.*deg;
const G4double spanningAnglePFS2IORT = 360.*deg;
const G4double XPositionPFS2IORT = -844.255 *mm;
solidPFS2IORT = new G4Tubs("PFS2IORT", innerRadiusPFS2IORT,
OuterRadiusPFS2IORT,
hightPFS2IORT,
startAnglePFS2IORT,
spanningAnglePFS2IORT);
G4LogicalVolume* logicPFS2IORT = new G4LogicalVolume(solidPFS2IORT,
PFS2IORTMaterialIORT, "PFS2IORT", 0, 0, 0);
physiPFS2IORT = new G4PVPlacement(G4Transform3D(rm3, G4ThreeVector((XPositionPFS2IORT),0.,0.)),
"PFS2IORT", logicPFS2IORT, physicalTreatmentRoom, false, 0);
logicPFS2IORT -> SetVisAttributes(green);
// ---------------------------------------------------------------//
// Superior Final Part Monitor Chambers 1 //
// ---------------------------------------------------------------//
const G4double OuterRadiusPFS1IORT = 35. *mm;
const G4double innerRadiusPFS1IORT = 10. *mm;
const G4double hightPFS1IORT = 0.88 *mm;
const G4double startAnglePFS1IORT = 0.*deg;
const G4double spanningAnglePFS1IORT = 360.*deg;
const G4double XPositionPFS1IORT = -841.905 *mm;
solidPFS1IORT = new G4Tubs("PFS1IORT", innerRadiusPFS1IORT,
OuterRadiusPFS1IORT,
hightPFS1IORT,
startAnglePFS1IORT,
spanningAnglePFS1IORT);
G4LogicalVolume* logicPFS1IORT = new G4LogicalVolume(solidPFS1IORT,
PFS1IORTMaterialIORT, "PFS1IORT", 0, 0, 0);
physiPFS1IORT = new G4PVPlacement(G4Transform3D(rm3, G4ThreeVector((XPositionPFS1IORT),0.,0.)),
"PFS1IORT", logicPFS1IORT, physicalTreatmentRoom, false, 0);
logicPFS1IORT -> SetVisAttributes(green);
// ------------------------------------------------//
// Monitor Chambers Cylinder //
// ------------------------------------------------//
const G4double OuterRadiusCCMIORT = 35. *mm;
const G4double innerRadiusCCMIORT = 10. *mm;
const G4double hightCCMIORT = 4.0125 *mm;
const G4double startAngleCCMIORT = 0.*deg;
const G4double spanningAngleCCMIORT = 360.*deg;
const G4double XPositionCCMIORT = -837.0125 *mm;
solidCCMIORT = new G4Tubs("CCMIORT", innerRadiusCCMIORT,
OuterRadiusCCMIORT,
hightCCMIORT,
startAngleCCMIORT,
spanningAngleCCMIORT);
G4LogicalVolume* logicCCMIORT = new G4LogicalVolume(solidCCMIORT,
CCMIORTMaterialIORT, "CCMIORT", 0, 0, 0);
physiCCMIORT = new G4PVPlacement(G4Transform3D(rm3, G4ThreeVector((XPositionCCMIORT),0.,0.)),
"CCMIORT", logicCCMIORT, physicalTreatmentRoom, false, 0);
logicCCMIORT -> SetVisAttributes(green);
// ------------------------------------------------//
// Second Monitor Chamber Lamina Al 2 of 2 //
// ------------------------------------------------//
const G4double OuterRadiusCM2_2_2IORT = 20. *mm;
const G4double innerRadiusCM2_2_2IORT = 0. *mm;
const G4double hightCM2_2_2IORT = 0.025 *mm;
const G4double startAngleCM2_2_2IORT = 0.*deg;
const G4double spanningAngleCM2_2_2IORT = 360.*deg;
const G4double XPositionCM2_2_2IORT = -841. *mm;
solidCM2_2_2IORT = new G4Tubs("CM2_2_2IORT", innerRadiusCM2_2_2IORT,
OuterRadiusCM2_2_2IORT,
hightCM2_2_2IORT,
startAngleCM2_2_2IORT,
spanningAngleCM2_2_2IORT);
G4LogicalVolume* logicCM2_2_2IORT = new G4LogicalVolume(solidCM2_2_2IORT,
CM2_2_2IORTMaterialIORT, "CM2_2_2IORT", 0, 0, 0);
physiCM2_2_2IORT = new G4PVPlacement(G4Transform3D(rm3, G4ThreeVector((XPositionCM2_2_2IORT),0.,0.)),
"CM2_2_2ORT", logicCM2_2_2IORT, physicalTreatmentRoom, false, 0);
logicCM2_2_2IORT -> SetVisAttributes(green);
// ------------------------------------------------//
// Second Monitor Chamber Lamina Al 1 of 2 //
// ------------------------------------------------//
const G4double OuterRadiusCM2_1_2IORT = 20. *mm;
const G4double innerRadiusCM2_1_2IORT = 0. *mm;
const G4double hightCM2_1_2IORT = 0.025 *mm;
const G4double startAngleCM2_1_2IORT = 0.*deg;
const G4double spanningAngleCM2_1_2IORT = 360.*deg;
const G4double XPositionCM2_1_2IORT = -839. *mm;
solidCM2_1_2IORT = new G4Tubs("CM2_1_2IORT", innerRadiusCM2_1_2IORT,
OuterRadiusCM2_1_2IORT,
hightCM2_1_2IORT,
startAngleCM2_1_2IORT,
spanningAngleCM2_1_2IORT);
G4LogicalVolume* logicCM2_1_2IORT = new G4LogicalVolume(solidCM2_1_2IORT,
CM2_1_2IORTMaterialIORT, "CM2_1_2IORT", 0, 0, 0);
physiCM2_1_2IORT = new G4PVPlacement(G4Transform3D(rm3, G4ThreeVector((XPositionCM2_1_2IORT),0.,0.)),
"CM2_1_2ORT", logicCM2_1_2IORT, physicalTreatmentRoom, false, 0);
logicCM2_1_2IORT -> SetVisAttributes(yellow);
// ------------------------------------------------//
// First Monitor Chamber Lamina Al 2 of 2 //
// ------------------------------------------------//
const G4double OuterRadiusCM1_2_2IORT = 20. *mm;
const G4double innerRadiusCM1_2_2IORT = 0. *mm;
const G4double hightCM1_2_2IORT = 0.025 *mm;
const G4double startAngleCM1_2_2IORT = 0.*deg;
const G4double spanningAngleCM1_2_2IORT = 360.*deg;
const G4double XPositionCM1_2_2IORT = -837. *mm;
solidCM1_2_2IORT = new G4Tubs("CM1_2_2IORT", innerRadiusCM1_2_2IORT,
OuterRadiusCM1_2_2IORT,
hightCM1_2_2IORT,
startAngleCM1_2_2IORT,
spanningAngleCM1_2_2IORT);
G4LogicalVolume* logicCM1_2_2IORT = new G4LogicalVolume(solidCM1_2_2IORT,
CM1_2_2IORTMaterialIORT, "CM1_2_2IORT", 0, 0, 0);
physiCM1_2_2IORT = new G4PVPlacement(G4Transform3D(rm3, G4ThreeVector((XPositionCM1_2_2IORT),0.,0.)),
"CM1_2_2ORT", logicCM1_2_2IORT, physicalTreatmentRoom, false, 0);
logicCM1_2_2IORT -> SetVisAttributes(yellow);
// ------------------------------------------------//
// First Monitor Chamber Lamina Al 1 of 2 //
// ------------------------------------------------//
const G4double OuterRadiusCM1_1_2IORT = 20. *mm;
const G4double innerRadiusCM1_1_2IORT = 0. *mm;
const G4double hightCM1_1_2IORT = 0.025 *mm;
const G4double startAngleCM1_1_2IORT = 0.*deg;
const G4double spanningAngleCM1_1_2IORT = 360.*deg;
const G4double XPositionCM1_1_2IORT = -835. *mm;
solidCM1_1_2IORT = new G4Tubs("CM1_1_2IORT", innerRadiusCM1_1_2IORT,
OuterRadiusCM1_1_2IORT,
hightCM1_1_2IORT,
startAngleCM1_1_2IORT,
spanningAngleCM1_1_2IORT);
G4LogicalVolume* logicCM1_1_2IORT = new G4LogicalVolume(solidCM1_1_2IORT,
CM1_1_2IORTMaterialIORT, "CM1_1_2IORT", 0, 0, 0);
physiCM1_1_2IORT = new G4PVPlacement(G4Transform3D(rm3, G4ThreeVector((XPositionCM1_1_2IORT),0.,0.)),
"CM1_1_2ORT", logicCM1_1_2IORT, physicalTreatmentRoom, false, 0);
logicCM1_1_2IORT -> SetVisAttributes(yellow);
}
void Collimator50BeamLine::IortBeamLineBlocks()
{
G4double phi4 = 90. *deg;
G4RotationMatrix rm4;
rm4.rotateY(phi4);
///////////////////////////////////////////////////////////////////////////////
// IORT BEAM LINE BLOCKS
///////////////////////////////////////////////////////////////////////////////
// ------------------------------------------------//
// Block 4 //
// ------------------------------------------------//
const G4double OuterRadiusBlocco20mmIORT = 36.5 *mm;
const G4double innerRadiusBlocco20mmIORT = 10. *mm;
const G4double hightBlocco20mmIORT = 3. *mm;
const G4double startAngleBlocco20mmIORT = 0.*deg;
const G4double spanningAngleBlocco20mmIORT = 360.*deg;
const G4double XPositionBlocco20mmIORT = -830. *mm;
solidBlocco20mmIORT = new G4Tubs("Blocco20mmIORT", innerRadiusBlocco20mmIORT,
OuterRadiusBlocco20mmIORT,
hightBlocco20mmIORT,
startAngleBlocco20mmIORT,
spanningAngleBlocco20mmIORT);
G4LogicalVolume* logicBlocco20mmIORT = new G4LogicalVolume(solidBlocco20mmIORT,
Blocco20mmIORTMaterialIORT, "Blocco20mmIORT", 0, 0, 0);
physiBlocco20mmIORT = new G4PVPlacement(G4Transform3D(rm4, G4ThreeVector((XPositionBlocco20mmIORT),0.,0.)),
"Blocco20mmORT", logicBlocco20mmIORT, physicalTreatmentRoom, false, 0);
logicBlocco20mmIORT -> SetVisAttributes(green);
// -----------------------//
// Block 3 //
// -----------------------//
const G4double OuterRadiusBlocco3IORT = 36.5 *mm;
const G4double innerRadiusBlocco3IORT = 15. *mm;
const G4double hightBlocco3IORT = 3.5 *mm;
const G4double startAngleBlocco3IORT = 0.*deg;
const G4double spanningAngleBlocco3IORT = 360.*deg;
const G4double XPositionBlocco3IORT = -823.5 *mm;
solidBlocco3IORT = new G4Tubs("Blocco3IORT", innerRadiusBlocco3IORT,
OuterRadiusBlocco3IORT,
hightBlocco3IORT,
startAngleBlocco3IORT,
spanningAngleBlocco3IORT);
G4LogicalVolume* logicBlocco3IORT = new G4LogicalVolume(solidBlocco3IORT,
Blocco3IORTMaterialIORT, "Blocco3IORT", 0, 0, 0);
physiBlocco3IORT = new G4PVPlacement(G4Transform3D(rm4, G4ThreeVector((XPositionBlocco3IORT),0.,0.)),
"Blocco3ORT", logicBlocco3IORT, physicalTreatmentRoom, false, 0);
logicBlocco3IORT -> SetVisAttributes(yellow);
// -----------------------//
// Block 2 //
// -----------------------//
const G4double OuterRadiusBlocco2IORT = 41.5 *mm;
const G4double innerRadiusBlocco2IORT = 15. *mm;
const G4double hightBlocco2IORT = 8. *mm;
const G4double startAngleBlocco2IORT = 0.*deg;
const G4double spanningAngleBlocco2IORT = 360.*deg;
const G4double XPositionBlocco2IORT = -812. *mm;
solidBlocco2IORT = new G4Tubs("Blocco2IORT", innerRadiusBlocco2IORT,
OuterRadiusBlocco2IORT,
hightBlocco2IORT,
startAngleBlocco2IORT,
spanningAngleBlocco2IORT);
G4LogicalVolume* logicBlocco2IORT = new G4LogicalVolume(solidBlocco2IORT,
Blocco2IORTMaterialIORT, "Blocco2IORT", 0, 0, 0);
physiBlocco2IORT = new G4PVPlacement(G4Transform3D(rm4, G4ThreeVector((XPositionBlocco2IORT),0.,0.)),
"Blocco2IORT", logicBlocco2IORT, physicalTreatmentRoom, false, 0);
logicBlocco2IORT -> SetVisAttributes(red);
// ----------------------- //
// Block 1 //
// ----------------------- //
const G4double OuterRadiusBlocco1IORT = 52.0 *mm;
const G4double innerRadiusBlocco1IORT = 15. *mm;
const G4double hightBlocco1IORT = 8.5 *mm;
const G4double startAngleBlocco1IORT = 0.*deg;
const G4double spanningAngleBlocco1IORT = 360.*deg;
const G4double XPositionBlocco1IORT = -795.5*mm;
solidBlocco1IORT = new G4Tubs("Blocco1IORT", innerRadiusBlocco1IORT,
OuterRadiusBlocco1IORT,
hightBlocco1IORT,
startAngleBlocco1IORT,
spanningAngleBlocco1IORT);
G4LogicalVolume* logicBlocco1IORT = new G4LogicalVolume(solidBlocco1IORT,
Blocco1IORTMaterialIORT, "Blocco1IORT", 0, 0, 0);
physiBlocco1IORT = new G4PVPlacement(G4Transform3D(rm4, G4ThreeVector((XPositionBlocco1IORT),0.,0.)),
"Blocco1IORT", logicBlocco1IORT, physicalTreatmentRoom, false, 0);
logicBlocco1IORT -> SetVisAttributes(white);
}
void Collimator50BeamLine::IortBeamLineJunctions()
{
G4double phi5 = 90. *deg;
G4RotationMatrix rm5;
rm5.rotateY(phi5);
// --------------------------------- //
// Junction 5 FINAL COLLIMATOR IORT //
// --------------------------------- //
const G4double OuterRadiusGiunz5FinalCollIORT = 48.25 *mm;
const G4double innerRadiusGiunz5FinalCollIORT = 13.75 *mm;
const G4double hightGiunz5FinalCollIORT = 3.5 *mm;
const G4double startAngleGiunz5FinalCollIORT = 0.*deg;
const G4double spanningAngleGiunz5FinalCollIORT = 360.*deg;
const G4double Giunz5FinalCollXPositionIORT = -783.5 *mm;
solidGiunz5FinalCollIORT = new G4Tubs("Giunz5FinalCollIORT", innerRadiusGiunz5FinalCollIORT,
OuterRadiusGiunz5FinalCollIORT,
hightGiunz5FinalCollIORT,
startAngleGiunz5FinalCollIORT,
spanningAngleGiunz5FinalCollIORT);
G4LogicalVolume* logicGiunz5FinalCollIORT = new G4LogicalVolume(solidGiunz5FinalCollIORT,
Giunz5FinalCollMaterialIORT, "Giunz5FinalCollIORT", 0, 0, 0);
physiGiunz5FinalCollIORT = new G4PVPlacement(G4Transform3D(rm5, G4ThreeVector((Giunz5FinalCollXPositionIORT),0.,0.)),
"Giunz5FinalCollIORT", logicGiunz5FinalCollIORT, physicalTreatmentRoom, false, 0);
logicGiunz5FinalCollIORT -> SetVisAttributes(yellow);
// --------------------------------- //
// Junction 4 FINAL COLLIMATOR IORT //
// --------------------------------- //
const G4double OuterRadiusGiunz4FinalCollIORT = 42. *mm;
const G4double innerRadiusGiunz4FinalCollIORT = 13.75 *mm;
const G4double hightGiunz4FinalCollIORT = 8.5 *mm;
const G4double startAngleGiunz4FinalCollIORT = 0.*deg;
const G4double spanningAngleGiunz4FinalCollIORT = 360.*deg;
const G4double Giunz4FinalCollXPositionIORT = -771.5 *mm;
solidGiunz4FinalCollIORT = new G4Tubs("Giunz4FinalCollIORT", innerRadiusGiunz4FinalCollIORT,
OuterRadiusGiunz4FinalCollIORT,
hightGiunz4FinalCollIORT,
startAngleGiunz4FinalCollIORT,
spanningAngleGiunz4FinalCollIORT);
G4LogicalVolume* logicGiunz4FinalCollIORT = new G4LogicalVolume(solidGiunz4FinalCollIORT,
Giunz4FinalCollMaterialIORT, "Giunz4FinalCollIORT", 0, 0, 0);
physiGiunz4FinalCollIORT = new G4PVPlacement(G4Transform3D(rm5, G4ThreeVector((Giunz4FinalCollXPositionIORT),0.,0.)),
"Giunz4FinalCollIORT", logicGiunz4FinalCollIORT, physicalTreatmentRoom, false, 0);
logicGiunz4FinalCollIORT -> SetVisAttributes(blue);
// --------------------------------- //
// Junction 3 FINAL COLLIMATOR IORT //
// --------------------------------- //
const G4double OuterRadiusGiunz3FinalCollIORT = 42. *mm;
const G4double innerRadiusGiunz3FinalCollIORT = 0. *mm;
const G4double hightGiunz3FinalCollIORT = 4.25 *mm;
const G4double startAngleGiunz3FinalCollIORT = 0.*deg;
const G4double spanningAngleGiunz3FinalCollIORT = 360.*deg;
const G4double Giunz3FinalCollXPositionIORT = -758.75 *mm;
solidGiunz3FinalCollIORT = new G4Tubs("Giunz3FinalCollIORT", innerRadiusGiunz3FinalCollIORT,
OuterRadiusGiunz3FinalCollIORT,
hightGiunz3FinalCollIORT,
startAngleGiunz3FinalCollIORT,
spanningAngleGiunz3FinalCollIORT);
G4LogicalVolume* logicsolidGiunz3FinalCollIORT = new G4LogicalVolume(solidGiunz3FinalCollIORT,
Giunz3FinalCollMaterialIORT, "Giunz3FinalCollIORT", 0, 0, 0);
physiGiunz3FinalCollIORT = new G4PVPlacement(G4Transform3D(rm5, G4ThreeVector((Giunz3FinalCollXPositionIORT),0.,0.)),
"Giunz3FinalCollIORT", logicsolidGiunz3FinalCollIORT, physicalTreatmentRoom, false, 0);
logicsolidGiunz3FinalCollIORT -> SetVisAttributes(yellow);
// logicsolidGiunz3FinalCollIORT -> SetVisAttributes (G4VisAttributes::Invisible);
// --------------------------------- //
// Junction 3 FINAL COLLIMATOR IORT internal //
// --------------------------------- //
solidGiunz3FinalCollIntIORT = new G4Cons("Giunz3FinalCollIntIORT",0.*mm,13.75*mm,0.*mm,20.0*mm,4.25*mm,0.*deg,360.*deg);
G4LogicalVolume* logicsolidGiunz3FinalCollIntIORT = new G4LogicalVolume(solidGiunz3FinalCollIntIORT,
Giunz3FinalCollMaterialIntIORT, "Giunz3FinalCollIntIORT", 0, 0, 0);
physiGiunz3FinalCollIntIORT = new G4PVPlacement(0, G4ThreeVector(0.,0.,0.),"Giunz3FinalCollIntIORT", logicsolidGiunz3FinalCollIntIORT,physiGiunz3FinalCollIORT, false, 0);
logicsolidGiunz3FinalCollIntIORT -> SetVisAttributes(yellow);
}
void Collimator50BeamLine::IortBeamLineFinalCollimator()
{
// -----------------------//
// FINAL COLLIMATOR IORT //
//------------------------//
// const G4double OuterRadiusFinalCollimatorIORT = 35. *mm;
// const G4double innerRadiusFinalCollimatorIORT = 30. *mm;
const G4double hightFinalCollimatorIORT = 349.75 *mm;
const G4double startAngleFinalCollimatorIORT = 0.*deg;
const G4double spanningAngleFinalCollimatorIORT = 360.*deg;
const G4double finalCollimatorXPositionIORT = -404.75 *mm;
G4double phi6 = 90. *deg;
G4RotationMatrix rm6;
rm6.rotateY(phi6);
solidFinalCollimatorIORT = new G4Tubs("FinalCollimatorIORT", innerRadiusFinalCollimatorIORT,
OuterRadiusFinalCollimatorIORT,
hightFinalCollimatorIORT,
startAngleFinalCollimatorIORT,
spanningAngleFinalCollimatorIORT);
G4LogicalVolume* logicFinalCollimatorIORT = new G4LogicalVolume(solidFinalCollimatorIORT,
finalCollimatorMaterialIORT, "FinalCollimatorIORT", 0, 0, 0);
physiFinalCollimatorIORT = new G4PVPlacement(G4Transform3D(rm6, G4ThreeVector((finalCollimatorXPositionIORT),0.,0.)),
"FinalCollimatorIORT", logicFinalCollimatorIORT, physicalTreatmentRoom, false, 0);
// logicFinalCollimatorIORT -> SetVisAttributes(G4VisAttributes::Invisible);
logicFinalCollimatorIORT -> SetVisAttributes(gray);
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////// MESSENGER ///////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void Collimator50BeamLine::SetInnerRadiusFinalCollimatorIORT(G4double value)
{
solidFinalCollimatorIORT -> SetInnerRadius(value);
G4RunManager::GetRunManager() -> GeometryHasBeenModified();
G4cout<<"Inner Radius of the final collimator IORT is (mm):"
<< solidFinalCollimatorIORT -> GetInnerRadius()/mm
<< G4endl;
}
/////////////////////////////////////////////////////////////////////////
void Collimator50BeamLine::SetOuterRadiusFinalCollimatorIORT(G4double value)
{
solidFinalCollimatorIORT -> SetOuterRadius(value);
G4RunManager::GetRunManager() -> GeometryHasBeenModified();
G4cout<<"Outer Radius of the final collimator IORT is (mm):"
<< solidFinalCollimatorIORT -> GetOuterRadius()/mm
<< G4endl;
}
/////////////////////////////////////////////////////////////////////////////
@@ -0,0 +1,103 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// This is the *BASIC* version of IORT, a Geant4-based application
//
// Main Authors: G.Russo(a,b), C.Casarino*(c), G.C. Candiano(c), G.A.P. Cirrone(d), F.Romano(d)
// Contributor Authors: S.Guatelli(e)
// Past Authors: G.Arnetta(c), S.E.Mazzaglia(d)
//
// (a) Fondazione Istituto San Raffaele G.Giglio, Cefalù, Italy
// (b) IBFM-CNR , Segrate (Milano), Italy
// (c) LATO (Laboratorio di Tecnologie Oncologiche), Cefalù, Italy
// (d) Laboratori Nazionali del Sud of the INFN, Catania, Italy
// (e) University of Wallongong, Australia
//
// *Corresponding author, email to carlo.casarino@polooncologicocefalu.it
//////////////////////////////////////////////////////////////////////////////////////////////
#include "Collimator50BeamLineMessenger.hh"
#include "Collimator50BeamLine.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithAString.hh"
Collimator50BeamLineMessenger::Collimator50BeamLineMessenger(Collimator50BeamLine* beamLine)
:collimator50(beamLine)
{
beamLineDir = new G4UIdirectory("/beamLine/");
beamLineDir -> SetGuidance("set specification of range shifter");
FinalCollimatorIORTDir = new G4UIdirectory("/beamLine/FinalCollimatorIORT/");
FinalCollimatorIORTDir -> SetGuidance("set specification of final collimator");
innerRadiusFinalCollimatorIORTCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/FinalCollimatorIORT/halfInnerRad",this);
innerRadiusFinalCollimatorIORTCmd -> SetGuidance("Set size of inner radius ( max 21.5 mm)");
innerRadiusFinalCollimatorIORTCmd -> SetParameterName("Size",false);
innerRadiusFinalCollimatorIORTCmd -> SetDefaultUnit("mm");
innerRadiusFinalCollimatorIORTCmd -> SetUnitCandidates("mm cm m");
innerRadiusFinalCollimatorIORTCmd -> AvailableForStates(G4State_Idle);
OuterRadiusFinalCollimatorIORTCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/FinalCollimatorIORT/halfOuterRad",this);
OuterRadiusFinalCollimatorIORTCmd -> SetGuidance("Set size of outer radius ( max 21.5 mm)");
OuterRadiusFinalCollimatorIORTCmd -> SetParameterName("Size",false);
OuterRadiusFinalCollimatorIORTCmd -> SetDefaultUnit("mm");
OuterRadiusFinalCollimatorIORTCmd -> SetUnitCandidates("mm cm m");
OuterRadiusFinalCollimatorIORTCmd -> AvailableForStates(G4State_Idle);
}
Collimator50BeamLineMessenger::~Collimator50BeamLineMessenger()
{
delete OuterRadiusFinalCollimatorIORTCmd;
delete innerRadiusFinalCollimatorIORTCmd;
delete FinalCollimatorIORTDir;
delete beamLineDir;
}
void Collimator50BeamLineMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
{
if( command == innerRadiusFinalCollimatorIORTCmd )
{ collimator50 -> SetInnerRadiusFinalCollimatorIORT
(innerRadiusFinalCollimatorIORTCmd -> GetNewDoubleValue(newValue));}
else if( command == OuterRadiusFinalCollimatorIORTCmd )
{ collimator50 -> SetOuterRadiusFinalCollimatorIORT
(OuterRadiusFinalCollimatorIORTCmd -> GetNewDoubleValue(newValue));}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,103 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// This is the *BASIC* version of IORT, a Geant4-based application
//
// Main Authors: G.Russo(a,b), C.Casarino*(c), G.C. Candiano(c), G.A.P. Cirrone(d), F.Romano(d)
// Contributor Authors: S.Guatelli(e)
// Past Authors: G.Arnetta(c), S.E.Mazzaglia(d)
//
// (a) Fondazione Istituto San Raffaele G.Giglio, Cefalù, Italy
// (b) IBFM-CNR , Segrate (Milano), Italy
// (c) LATO (Laboratorio di Tecnologie Oncologiche), Cefalù, Italy
// (d) Laboratori Nazionali del Sud of the INFN, Catania, Italy
// (e) University of Wallongong, Australia
//
// *Corresponding author, email to carlo.casarino@polooncologicocefalu.it
//////////////////////////////////////////////////////////////////////////////////////////////
#include "Collimator60BeamLineMessenger.hh"
#include "Collimator60BeamLine.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithAString.hh"
Collimator60BeamLineMessenger::Collimator60BeamLineMessenger(Collimator60BeamLine* beamLine)
:collimator60(beamLine)
{
beamLineDir = new G4UIdirectory("/beamLine/");
beamLineDir -> SetGuidance("set specification of range shifter");
FinalCollimatorIORTDir = new G4UIdirectory("/beamLine/FinalCollimatorIORT/");
FinalCollimatorIORTDir -> SetGuidance("set specification of final collimator");
innerRadiusFinalCollimatorIORTCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/FinalCollimatorIORT/halfInnerRad",this);
innerRadiusFinalCollimatorIORTCmd -> SetGuidance("Set size of inner radius ( max 21.5 mm)");
innerRadiusFinalCollimatorIORTCmd -> SetParameterName("Size",false);
innerRadiusFinalCollimatorIORTCmd -> SetDefaultUnit("mm");
innerRadiusFinalCollimatorIORTCmd -> SetUnitCandidates("mm cm m");
innerRadiusFinalCollimatorIORTCmd -> AvailableForStates(G4State_Idle);
OuterRadiusFinalCollimatorIORTCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/FinalCollimatorIORT/halfOuterRad",this);
OuterRadiusFinalCollimatorIORTCmd -> SetGuidance("Set size of outer radius ( max 21.5 mm)");
OuterRadiusFinalCollimatorIORTCmd -> SetParameterName("Size",false);
OuterRadiusFinalCollimatorIORTCmd -> SetDefaultUnit("mm");
OuterRadiusFinalCollimatorIORTCmd -> SetUnitCandidates("mm cm m");
OuterRadiusFinalCollimatorIORTCmd -> AvailableForStates(G4State_Idle);
}
Collimator60BeamLineMessenger::~Collimator60BeamLineMessenger()
{
delete OuterRadiusFinalCollimatorIORTCmd;
delete innerRadiusFinalCollimatorIORTCmd;
delete FinalCollimatorIORTDir;
delete beamLineDir;
}
void Collimator60BeamLineMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
{
if( command == innerRadiusFinalCollimatorIORTCmd )
{ collimator60 -> SetInnerRadiusFinalCollimatorIORT
(innerRadiusFinalCollimatorIORTCmd -> GetNewDoubleValue(newValue));}
else if( command == OuterRadiusFinalCollimatorIORTCmd )
{ collimator60 -> SetOuterRadiusFinalCollimatorIORT
(OuterRadiusFinalCollimatorIORTCmd -> GetNewDoubleValue(newValue));}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,103 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// This is the *BASIC* version of IORT, a Geant4-based application
//
// Main Authors: G.Russo(a,b), C.Casarino*(c), G.C. Candiano(c), G.A.P. Cirrone(d), F.Romano(d)
// Contributor Authors: S.Guatelli(e)
// Past Authors: G.Arnetta(c), S.E.Mazzaglia(d)
//
// (a) Fondazione Istituto San Raffaele G.Giglio, Cefalù, Italy
// (b) IBFM-CNR , Segrate (Milano), Italy
// (c) LATO (Laboratorio di Tecnologie Oncologiche), Cefalù, Italy
// (d) Laboratori Nazionali del Sud of the INFN, Catania, Italy
// (e) University of Wallongong, Australia
//
// *Corresponding author, email to carlo.casarino@polooncologicocefalu.it
//////////////////////////////////////////////////////////////////////////////////////////////
#include "Collimator70BeamLineMessenger.hh"
#include "Collimator70BeamLine.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithAString.hh"
Collimator70BeamLineMessenger::Collimator70BeamLineMessenger(Collimator70BeamLine* beamLine)
:collimator70(beamLine)
{
beamLineDir = new G4UIdirectory("/beamLine/");
beamLineDir -> SetGuidance("set specification of range shifter");
FinalCollimatorIORTDir = new G4UIdirectory("/beamLine/FinalCollimatorIORT/");
FinalCollimatorIORTDir -> SetGuidance("set specification of final collimator");
innerRadiusFinalCollimatorIORTCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/FinalCollimatorIORT/halfInnerRad",this);
innerRadiusFinalCollimatorIORTCmd -> SetGuidance("Set size of inner radius ( max 21.5 mm)");
innerRadiusFinalCollimatorIORTCmd -> SetParameterName("Size",false);
innerRadiusFinalCollimatorIORTCmd -> SetDefaultUnit("mm");
innerRadiusFinalCollimatorIORTCmd -> SetUnitCandidates("mm cm m");
innerRadiusFinalCollimatorIORTCmd -> AvailableForStates(G4State_Idle);
OuterRadiusFinalCollimatorIORTCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/FinalCollimatorIORT/halfOuterRad",this);
OuterRadiusFinalCollimatorIORTCmd -> SetGuidance("Set size of outer radius ( max 21.5 mm)");
OuterRadiusFinalCollimatorIORTCmd -> SetParameterName("Size",false);
OuterRadiusFinalCollimatorIORTCmd -> SetDefaultUnit("mm");
OuterRadiusFinalCollimatorIORTCmd -> SetUnitCandidates("mm cm m");
OuterRadiusFinalCollimatorIORTCmd -> AvailableForStates(G4State_Idle);
}
Collimator70BeamLineMessenger::~Collimator70BeamLineMessenger()
{
delete OuterRadiusFinalCollimatorIORTCmd;
delete innerRadiusFinalCollimatorIORTCmd;
delete FinalCollimatorIORTDir;
delete beamLineDir;
}
void Collimator70BeamLineMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
{
if( command == innerRadiusFinalCollimatorIORTCmd )
{ collimator70 -> SetInnerRadiusFinalCollimatorIORT
(innerRadiusFinalCollimatorIORTCmd -> GetNewDoubleValue(newValue));}
else if( command == OuterRadiusFinalCollimatorIORTCmd )
{ collimator70 -> SetOuterRadiusFinalCollimatorIORT
(OuterRadiusFinalCollimatorIORTCmd -> GetNewDoubleValue(newValue));}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,102 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// This is the *BASIC* version of IORT, a Geant4-based application
//
// Main Authors: G.Russo(a,b), C.Casarino*(c), G.C. Candiano(c), G.A.P. Cirrone(d), F.Romano(d)
// Contributor Authors: S.Guatelli(e)
// Past Authors: G.Arnetta(c), S.E.Mazzaglia(d)
//
// (a) Fondazione Istituto San Raffaele G.Giglio, Cefalù, Italy
// (b) IBFM-CNR , Segrate (Milano), Italy
// (c) LATO (Laboratorio di Tecnologie Oncologiche), Cefalù, Italy
// (d) Laboratori Nazionali del Sud of the INFN, Catania, Italy
// (e) University of Wallongong, Australia
//
// *Corresponding author, email to carlo.casarino@polooncologicocefalu.it
//////////////////////////////////////////////////////////////////////////////////////////////
#include "Collimator80BeamLineMessenger.hh"
#include "Collimator80BeamLine.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithAString.hh"
Collimator80BeamLineMessenger::Collimator80BeamLineMessenger(Collimator80BeamLine* beamLine)
:collimator80(beamLine)
{
beamLineDir = new G4UIdirectory("/beamLine/");
beamLineDir -> SetGuidance("set specification of range shifter");
FinalCollimatorIORTDir = new G4UIdirectory("/beamLine/FinalCollimatorIORT/");
FinalCollimatorIORTDir -> SetGuidance("set specification of final collimator");
innerRadiusFinalCollimatorIORTCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/FinalCollimatorIORT/halfInnerRad",this);
innerRadiusFinalCollimatorIORTCmd -> SetGuidance("Set size of inner radius ( max 21.5 mm)");
innerRadiusFinalCollimatorIORTCmd -> SetParameterName("Size",false);
innerRadiusFinalCollimatorIORTCmd -> SetDefaultUnit("mm");
innerRadiusFinalCollimatorIORTCmd -> SetUnitCandidates("mm cm m");
innerRadiusFinalCollimatorIORTCmd -> AvailableForStates(G4State_Idle);
OuterRadiusFinalCollimatorIORTCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/FinalCollimatorIORT/halfOuterRad",this);
OuterRadiusFinalCollimatorIORTCmd -> SetGuidance("Set size of outer radius ( max 21.5 mm)");
OuterRadiusFinalCollimatorIORTCmd -> SetParameterName("Size",false);
OuterRadiusFinalCollimatorIORTCmd -> SetDefaultUnit("mm");
OuterRadiusFinalCollimatorIORTCmd -> SetUnitCandidates("mm cm m");
OuterRadiusFinalCollimatorIORTCmd -> AvailableForStates(G4State_Idle);
}
Collimator80BeamLineMessenger::~Collimator80BeamLineMessenger()
{
delete OuterRadiusFinalCollimatorIORTCmd;
delete innerRadiusFinalCollimatorIORTCmd;
delete FinalCollimatorIORTDir;
delete beamLineDir;
}
void Collimator80BeamLineMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
{
if( command == innerRadiusFinalCollimatorIORTCmd )
{ collimator80 -> SetInnerRadiusFinalCollimatorIORT
(innerRadiusFinalCollimatorIORTCmd -> GetNewDoubleValue(newValue));}
else if( command == OuterRadiusFinalCollimatorIORTCmd )
{ collimator80 -> SetOuterRadiusFinalCollimatorIORT
(OuterRadiusFinalCollimatorIORTCmd -> GetNewDoubleValue(newValue));}
}
@@ -0,0 +1,119 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// This is the *BASIC* version of IORT, a Geant4-based application
//
// Main Authors: G.Russo(a,b), C.Casarino*(c), G.C. Candiano(c), G.A.P. Cirrone(d), F.Romano(d)
// Contributor Authors: S.Guatelli(e)
// Past Authors: G.Arnetta(c), S.E.Mazzaglia(d)
//
// (a) Fondazione Istituto San Raffaele G.Giglio, Cefalù, Italy
// (b) IBFM-CNR , Segrate (Milano), Italy
// (c) LATO (Laboratorio di Tecnologie Oncologiche), Cefalù, Italy
// (d) Laboratori Nazionali del Sud of the INFN, Catania, Italy
// (e) University of Wallongong, Australia
//
// *Corresponding author, email to carlo.casarino@polooncologicocefalu.it
//////////////////////////////////////////////////////////////////////////////////////////////
#include "IORTAnalysisFileMessenger.hh"
#include "IORTAnalysisManager.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithABool.hh"
#include "G4UIdirectory.hh"
#include "IORTMatrix.hh"
/////////////////////////////////////////////////////////////////////////////
IORTAnalysisFileMessenger::IORTAnalysisFileMessenger(IORTAnalysisManager* amgr)
:AnalysisManager(amgr)
{
secondaryCmd = new G4UIcmdWithABool("/analysis/secondary",this);
secondaryCmd -> SetParameterName("secondary", true);
secondaryCmd -> SetDefaultValue("true");
secondaryCmd -> SetGuidance("Set if dose/fluence for the secondary particles will be written"
"\n[usage]: /analysis/secondary [true/false]");
secondaryCmd -> AvailableForStates(G4State_Idle, G4State_PreInit);
DoseMatrixCmd = new G4UIcmdWithAString("/analysis/writeDoseFile",this);
DoseMatrixCmd->SetGuidance("Write the dose/fluence to an ASCII file");
DoseMatrixCmd->SetDefaultValue("Dose.out");
DoseMatrixCmd->SetParameterName("choice",true);
// With this messenger you can:
// give a name to the generated .root file
// One can use this messenger to define a different .root file name other then the default one
#ifdef G4ANALYSIS_USE_ROOT
FileNameCmd = new G4UIcmdWithAString("/analysis/setAnalysisFile",this);
FileNameCmd->SetGuidance("Set the .root filename for the root-output");
FileNameCmd->SetDefaultValue("default.root");
FileNameCmd->SetParameterName("choice",true); ///<doc did not say what second boolean really does
FileNameCmd->AvailableForStates(G4State_Idle,G4State_PreInit);
#endif
}
/////////////////////////////////////////////////////////////////////////////
IORTAnalysisFileMessenger::~IORTAnalysisFileMessenger()
{
delete secondaryCmd;
delete DoseMatrixCmd;
#ifdef G4ANALYSIS_USE_ROOT
delete FileNameCmd;
#endif
}
/////////////////////////////////////////////////////////////////////////////
void IORTAnalysisFileMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
{
if (command == secondaryCmd)
{
if (IORTMatrix::GetInstance())
{
IORTMatrix::GetInstance() -> secondary = secondaryCmd -> GetNewBoolValue(newValue);
}
}
else if (command == DoseMatrixCmd) // Filename can be passed here TODO
{
if ( IORTMatrix * pMatrix = IORTMatrix::GetInstance() )
{
pMatrix -> TotalEnergyDeposit();
pMatrix -> StoreDoseFluenceAscii(newValue);
#ifdef G4ANALYSIS_USE_ROOT
pMatrix -> StoreDoseFluenceRoot();
IORTAnalysisManager::GetInstance() -> flush(); // Finalize & write the root file
#endif
}
}
#ifdef G4ANALYSIS_USE_ROOT
else if (command == FileNameCmd)
{
AnalysisManager->SetAnalysisFileName(newValue);
IORTAnalysisManager::GetInstance() -> book(); // Book for a new ROOT TFile
}
#endif
}
@@ -0,0 +1,413 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// This is the *BASIC* version of IORT, a Geant4-based application
//
// Main Authors: G.Russo(a,b), C.Casarino*(c), G.C. Candiano(c), G.A.P. Cirrone(d), F.Romano(d)
// Contributor Authors: S.Guatelli(e)
// Past Authors: G.Arnetta(c), S.E.Mazzaglia(d)
//
// (a) Fondazione Istituto San Raffaele G.Giglio, Cefalù, Italy
// (b) IBFM-CNR , Segrate (Milano), Italy
// (c) LATO (Laboratorio di Tecnologie Oncologiche), Cefalù, Italy
// (d) Laboratori Nazionali del Sud of the INFN, Catania, Italy
// (e) University of Wallongong, Australia
//
// *Corresponding author, email to carlo.casarino@polooncologicocefalu.it
//////////////////////////////////////////////////////////////////////////////////////////////
#include "IORTAnalysisManager.hh"
#include "IORTMatrix.hh"
#include "IORTAnalysisFileMessenger.hh"
#include <time.h>
IORTAnalysisManager* IORTAnalysisManager::instance = 0;
IORTAnalysisManager::IORTAnalysisManager()
#ifdef G4ANALYSIS_USE_ROOT
:
analysisFileName("DoseDistribution.root"),theTFile(0), histo1(0), histo2(0), histo3(0),
histo4(0), histo5(0), histo6(0), histo7(0), histo8(0), histo9(0), histo10(0), histo11(0), histo12(0), histo13(0), histo14(0), histo15(0), histo16(0),
kinFragNtuple(0),
kineticEnergyPrimaryNtuple(0),
doseFragNtuple(0),
fluenceFragNtuple(0),
letFragNtuple(0),
theROOTNtuple(0),
theROOTIonTuple(0),
fragmentNtuple(0),
metaData(0),
eventCounter(0)
#endif
{
fMess = new IORTAnalysisFileMessenger(this);
}
/////////////////////////////////////////////////////////////////////////////
IORTAnalysisManager::~IORTAnalysisManager()
{
delete fMess;
#ifdef G4ANALYSIS_USE_ROOT
Clear();
#endif
}
IORTAnalysisManager* IORTAnalysisManager::GetInstance()
{
if (instance == 0) instance = new IORTAnalysisManager;
return instance;
}
#ifdef G4ANALYSIS_USE_ROOT
void IORTAnalysisManager::Clear()
{
if (theTFile)
{
delete metaData;
metaData = 0;
delete fragmentNtuple;
fragmentNtuple = 0;
delete theROOTIonTuple;
theROOTIonTuple = 0;
delete theROOTNtuple;
theROOTNtuple = 0;
delete histo16;
histo16 = 0;
delete histo15;
histo15 = 0;
delete histo14;
histo14 = 0;
delete histo13;
histo13 = 0;
delete histo12;
histo12 = 0;
delete histo11;
histo11 = 0;
delete histo10;
histo10 = 0;
delete histo9;
histo9 = 0;
delete histo8;
histo8 = 0;
delete histo7;
histo7 = 0;
delete histo6;
histo6 = 0;
delete histo5;
histo5 = 0;
delete histo4;
histo4 = 0;
delete histo3;
histo3 = 0;
delete histo2;
histo2 = 0;
delete histo1;
histo1 = 0;
}
}
/////////////////////////////////////////////////////////////////////////////
void IORTAnalysisManager::SetAnalysisFileName(G4String aFileName)
{
this->analysisFileName = aFileName;
}
/////////////////////////////////////////////////////////////////////////////
G4bool IORTAnalysisManager::IsTheTFile()
{
return (theTFile) ? true:false;
}
void IORTAnalysisManager::book()
{
delete theTFile; // this is similar to theTFile->Close() => delete all associated variables created via new, moreover it delete itself.
theTFile = new TFile(analysisFileName, "RECREATE");
// Create the histograms with the energy deposit along the X axis
histo1 = createHistogram1D("braggPeak","slice, energy", 400, 0., 80); //<different waterthicknesses are accoutned for in ROOT-analysis stage
histo2 = createHistogram1D("h20","Secondary protons - slice, energy", 400, 0., 400.);
histo3 = createHistogram1D("h30","Secondary neutrons - slice, energy", 400, 0., 400.);
histo4 = createHistogram1D("h40","Secondary alpha - slice, energy", 400, 0., 400.);
histo5 = createHistogram1D("h50","Secondary gamma - slice, energy", 400, 0., 400.);
histo6 = createHistogram1D("h60","Secondary electron - slice, energy", 400, 0., 400.);
histo7 = createHistogram1D("h70","Secondary triton - slice, energy", 400, 0., 400.);
histo8 = createHistogram1D("h80","Secondary deuteron - slice, energy", 400, 0., 400.);
histo9 = createHistogram1D("h90","Secondary pion - slice, energy", 400, 0., 400.);
histo10 = createHistogram1D("h100","Energy distribution of secondary electrons", 70, 0., 70.);
histo11 = createHistogram1D("h110","Energy distribution of secondary photons", 70, 0., 70.);
histo12 = createHistogram1D("h120","Energy distribution of secondary deuterons", 70, 0., 70.);
histo13 = createHistogram1D("h130","Energy distribution of secondary tritons", 70, 0., 70.);
histo14 = createHistogram1D("h140","Energy distribution of secondary alpha particles", 70, 0., 70.);
histo15 = createHistogram1D("heliumEnergyAfterPhantom","Energy distribution of secondary helium fragments after the phantom",
70, 0., 500.);
histo16 = createHistogram1D("hydrogenEnergyAfterPhantom","Energy distribution of secondary helium fragments after the phantom",
70, 0., 500.);
kinFragNtuple = new TNtuple("kinFragNtuple",
"Kinetic energy by voxel & fragment",
"i:j:k:A:Z:kineticEnergy");
kineticEnergyPrimaryNtuple= new TNtuple("kineticEnergyPrimaryNtuple",
"Kinetic energy by voxel of primary",
"i:j:k:kineticEnergy");
doseFragNtuple = new TNtuple("doseFragNtuple",
"Energy deposit by voxel & fragment",
"i:j:k:A:Z:energy");
fluenceFragNtuple = new TNtuple("fluenceFragNtuple",
"Fluence by voxel & fragment",
"i:j:k:A:Z:fluence");
letFragNtuple = new TNtuple("letFragNtuple",
"Let by voxel & fragment",
"i:j:k:A:Z:letT:letD");
theROOTNtuple = new TNtuple("theROOTNtuple",
"Energy deposit by slice",
"i:j:k:energy");
theROOTIonTuple = new TNtuple("theROOTIonTuple",
"Generic ion information",
"a:z:occupancy:energy");
fragmentNtuple = new TNtuple("fragmentNtuple",
"Fragments",
"A:Z:energy:posX:posY:posZ");
metaData = new TNtuple("metaData",
"Metadata",
"events:detectorDistance:waterThickness:beamEnergy:energyError:phantomCenterDistance");
}
/////////////////////////////////////////////////////////////////////////////
void IORTAnalysisManager::FillEnergyDeposit(G4int i,
G4int j,
G4int k,
G4double energy)
{
if (theROOTNtuple)
{
theROOTNtuple->Fill(i, j, k, energy);
}
}
/////////////////////////////////////////////////////////////////////////////
void IORTAnalysisManager::BraggPeak(G4int slice, G4double energy)
{
histo1->SetBinContent(slice, energy); //This uses setbincontent instead of fill to get labels correct
}
/////////////////////////////////////////////////////////////////////////////
void IORTAnalysisManager::SecondaryProtonEnergyDeposit(G4int slice, G4double energy)
{
histo2->Fill(slice, energy);
}
/////////////////////////////////////////////////////////////////////////////
void IORTAnalysisManager::SecondaryNeutronEnergyDeposit(G4int slice, G4double energy)
{
histo3->Fill(slice, energy);
}
/////////////////////////////////////////////////////////////////////////////
void IORTAnalysisManager::SecondaryAlphaEnergyDeposit(G4int slice, G4double energy)
{
histo4->Fill(slice, energy);
}
/////////////////////////////////////////////////////////////////////////////
void IORTAnalysisManager::SecondaryGammaEnergyDeposit(G4int slice, G4double energy)
{
histo5->Fill(slice, energy);
}
/////////////////////////////////////////////////////////////////////////////
void IORTAnalysisManager::SecondaryElectronEnergyDeposit(G4int slice, G4double energy)
{
histo6->Fill(slice, energy);
}
/////////////////////////////////////////////////////////////////////////////
void IORTAnalysisManager::SecondaryTritonEnergyDeposit(G4int slice, G4double energy)
{
histo7->Fill(slice, energy);
}
/////////////////////////////////////////////////////////////////////////////
void IORTAnalysisManager::SecondaryDeuteronEnergyDeposit(G4int slice, G4double energy)
{
histo8->Fill(slice, energy);
}
/////////////////////////////////////////////////////////////////////////////
void IORTAnalysisManager::SecondaryPionEnergyDeposit(G4int slice, G4double energy)
{
histo9->Fill(slice, energy);
}
/////////////////////////////////////////////////////////////////////////////
void IORTAnalysisManager::electronEnergyDistribution(G4double energy)
{
histo10->Fill(energy);
}
/////////////////////////////////////////////////////////////////////////////
void IORTAnalysisManager::gammaEnergyDistribution(G4double energy)
{
histo11->Fill(energy);
}
/////////////////////////////////////////////////////////////////////////////
void IORTAnalysisManager::deuteronEnergyDistribution(G4double energy)
{
histo12->Fill(energy);
}
/////////////////////////////////////////////////////////////////////////////
void IORTAnalysisManager::tritonEnergyDistribution(G4double energy)
{
histo13->Fill(energy);
}
/////////////////////////////////////////////////////////////////////////////
void IORTAnalysisManager::alphaEnergyDistribution(G4double energy)
{
histo14->Fill(energy);
}
/////////////////////////////////////////////////////////////////////////////
void IORTAnalysisManager::heliumEnergy(G4double secondaryParticleKineticEnergy)
{
histo15->Fill(secondaryParticleKineticEnergy);
}
/////////////////////////////////////////////////////////////////////////////
void IORTAnalysisManager::hydrogenEnergy(G4double secondaryParticleKineticEnergy)
{
histo16->Fill(secondaryParticleKineticEnergy);
}
/////////////////////////////////////////////////////////////////////////////
// FillKineticFragmentTuple create an ntuple where the voxel indexs, the atomic number and mass and the kinetic
// energy of all the particles interacting with the phantom, are stored
void IORTAnalysisManager::FillKineticFragmentTuple(G4int i, G4int j, G4int k, G4int A, G4double Z, G4double kinEnergy)
{
kinFragNtuple -> Fill(i, j, k, A, Z, kinEnergy);
}
/////////////////////////////////////////////////////////////////////////////
// FillKineticEnergyPrimaryNTuple creates a ntuple where the voxel indexs and the kinetic
// energies of ONLY primary particles interacting with the phantom, are stored
void IORTAnalysisManager::FillKineticEnergyPrimaryNTuple(G4int i, G4int j, G4int k, G4double kinEnergy)
{
kineticEnergyPrimaryNtuple -> Fill(i, j, k, kinEnergy);
}
/////////////////////////////////////////////////////////////////////////////
// This function is called only if ROOT is activated.
// It is called by the IORTMatric.cc class file and it is used to create two ntuples containing
// the total energy deposited and the fluence values, in each voxel and per any particle (primary
// and secondary particles beam)
void IORTAnalysisManager::FillVoxelFragmentTuple(G4int i, G4int j, G4int k, G4int A, G4double Z, G4double energy, G4double fluence)
{
// Fill the ntuple containing the voxel, mass and atomic number and the energy deposited
doseFragNtuple -> Fill( i, j, k, A, Z, energy );
// Fill the ntuple containing the voxel, mass and atomic number and the fluence
if (i==1 && Z==1) {
fluenceFragNtuple -> Fill( i, j, k, A, Z, fluence );
}
}
void IORTAnalysisManager::FillLetFragmentTuple(G4int i, G4int j, G4int k, G4int A, G4double Z, G4double letT, G4double letD)
{
letFragNtuple -> Fill( i, j, k, A, Z, letT, letD);
}
/////////////////////////////////////////////////////////////////////////////
void IORTAnalysisManager::FillFragmentTuple(G4int A, G4double Z, G4double energy, G4double posX, G4double posY, G4double posZ)
{
fragmentNtuple->Fill(A, Z, energy, posX, posY, posZ);
}
/////////////////////////////////////////////////////////////////////////////
void IORTAnalysisManager::genericIonInformation(G4int a,
G4double z,
G4int electronOccupancy,
G4double energy)
{
if (theROOTIonTuple) {
theROOTIonTuple->Fill(a, z, electronOccupancy, energy);
}
}
/////////////////////////////////////////////////////////////////////////////
void IORTAnalysisManager::startNewEvent()
{
eventCounter++;
}
/////////////////////////////////////////////////////////////////////////////
void IORTAnalysisManager::setGeometryMetaData(G4double endDetectorPosition, G4double waterThickness, G4double phantomCenter)
{
this->detectorDistance = endDetectorPosition;
this->phantomDepth = waterThickness;
this->phantomCenterDistance = phantomCenter;
}
void IORTAnalysisManager::setBeamMetaData(G4double meanKineticEnergy,G4double sigmaEnergy)
{
this->beamEnergy = meanKineticEnergy;
this->energyError = sigmaEnergy;
}
/////////////////////////////////////////////////////////////////////////////
// Flush data & close the file
void IORTAnalysisManager::flush()
{
if (theTFile)
{
theTFile -> Write();
theTFile -> Close();
}
theTFile = 0;
eventCounter = 0;
}
#endif
@@ -0,0 +1,693 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// This is the *BASIC* version of IORT, a Geant4-based application
//
// Main Authors: G.Russo(a,b), C.Casarino*(c), G.C. Candiano(c), G.A.P. Cirrone(d), F.Romano(d)
// Contributor Authors: S.Guatelli(e)
// Past Authors: G.Arnetta(c), S.E.Mazzaglia(d)
//
// (a) Fondazione Istituto San Raffaele G.Giglio, Cefalù, Italy
// (b) IBFM-CNR , Segrate (Milano), Italy
// (c) LATO (Laboratorio di Tecnologie Oncologiche), Cefalù, Italy
// (d) Laboratori Nazionali del Sud of the INFN, Catania, Italy
// (e) University of Wallongong, Australia
//
// *Corresponding author, email to carlo.casarino@polooncologicocefalu.it
//////////////////////////////////////////////////////////////////////////////////////////////
#include "G4SDManager.hh"
#include "G4RunManager.hh"
#include "G4GeometryManager.hh"
#include "G4SolidStore.hh"
#include "G4PhysicalVolumeStore.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4Box.hh"
#include "G4LogicalVolume.hh"
#include "G4ThreeVector.hh"
#include "G4PVPlacement.hh"
#include "globals.hh"
#include "G4Transform3D.hh"
#include "G4RotationMatrix.hh"
#include "G4Colour.hh"
#include "G4UserLimits.hh"
#include "G4UnitsTable.hh"
#include "G4VisAttributes.hh"
#include "G4NistManager.hh"
#include "IORTDetectorConstruction.hh"
#include "IORTDetectorROGeometry.hh"
#include "IORTDetectorMessenger.hh"
#include "IORTDetectorSD.hh"
#include "IORTMatrix.hh"
#include "IORTAnalysisManager.hh"
#include <cmath>
#include "G4Tubs.hh"
/////////////////////////////////////////////////////////////////////////////
IORTDetectorConstruction::IORTDetectorConstruction(G4VPhysicalVolume* physicalTreatmentRoom)
: motherPhys(physicalTreatmentRoom), // pointer to WORLD volume
detectorSD(0), detectorROGeometry(0), matrix(0),
phantom(0), detector(0),
phantomLogicalVolume(0), detectorLogicalVolume(0),
phantomPhysicalVolume(0), detectorPhysicalVolume(0),
aRegion(0),
solidDiscoIORT(0),
logicDiscoIORT(0),
physiDiscoIORT(0),
solidDiscoIORT1(0),
logicDiscoIORT1(0),
physiDiscoIORT1(0)
{
IORTAnalysisManager::GetInstance();
/* NOTE! that the IORTDetectorConstruction class
* does NOT inherit from G4VUserDetectorConstruction G4 class
* So the Construct() mandatory virtual method is inside another geometric class
* like the collimatorXXBeamLIne, ...
*/
// Messenger to change parameters of the phantom/detector geometry
detectorMessenger = new IORTDetectorMessenger(this);
// Default detector voxels size
// 200 slabs along the beam direction (X)
sizeOfVoxelAlongX = 0.5 *mm; //
sizeOfVoxelAlongY = 0.5 *mm; //
sizeOfVoxelAlongZ = 0.5 *mm; //
// Define here the material of the water phantom and of the detector
SetPhantomMaterial("G4_WATER");
// Construct geometry (messenger commands)
SetDetectorSize(7.*cm, 15.*cm, 15.*cm);
SetPhantomSize(20. *cm, 20. *cm, 20. *cm);
SetPhantomPosition(G4ThreeVector(4.5 *cm, 0. *cm, 0. *cm));
SetDetectorToPhantomPosition(G4ThreeVector(0. *cm, 2.5 *cm, 2.5 *cm));
// Default protection disc geometry and materials
SetOuterRadiusDiscoIORT (40. *mm);
SetinnerRadiusDiscoIORT (0.*mm);
SetheightDiscoIORT (2.0*mm);
SetDiscoXPositionIORT (-11.0*mm);
SetDiscoMaterialIORT("G4_WATER");
SetOuterRadiusDiscoIORT1 (40. *mm);
SetinnerRadiusDiscoIORT1 (0.*mm);
SetheightDiscoIORT1 (1.0*mm);
SetDiscoXPositionIORT1 (-8.0*mm);
SetDiscoMaterialIORT1("G4_WATER");
// Write virtual parameters to the real ones and check for consistency
UpdateGeometry();
}
/////////////////////////////////////////////////////////////////////////////
IORTDetectorConstruction::~IORTDetectorConstruction()
{
delete detectorROGeometry;
delete matrix;
delete detectorMessenger;
}
/////////////////////////////////////////////////////////////////////////////
// ConstructPhantom() is the method that reconstuct a water box (called phantom
// (or water phantom) in the usual Medical physicists slang).
// A water phantom can be considered a good
// approximation of a an human body.
void IORTDetectorConstruction::ConstructPhantom()
{
// Definition of the solid volume of the Phantom
phantom = new G4Box("Phantom",
phantomSizeX/2,
phantomSizeY/2,
phantomSizeZ/2);
// Definition of the logical volume of the Phantom
phantomLogicalVolume = new G4LogicalVolume(phantom,
phantomMaterial,
"phantomLog", 0, 0, 0);
// Definition of the physics volume of the Phantom
phantomPhysicalVolume = new G4PVPlacement(0,
phantomPosition,
"phantomPhys",
phantomLogicalVolume,
motherPhys,
false,
0);
// Visualisation attributes of the phantom
red = new G4VisAttributes(G4Colour(255/255., 0/255. ,0/255.));
red -> SetVisibility(true);
//red -> SetForceSolid(true);
//red -> SetForceWireframe(true);
phantomLogicalVolume -> SetVisAttributes(red);
// phantomLogicalVolume -> SetVisAttributes(G4VisAttributes::Invisible);
}
/////////////////////////////////////////////////////////////////////////////
// ConstructDetector() it the method the reconstruct a detector region
// inside the water phantom. It is a volume, located inside the water phantom
// and with two coincident faces:
//
// **************************
// * water phantom *
// * *
// * *
// *--------------- *
// Beam * - *
// -----> * detector - *
// * - *
// *--------------- *
// * *
// * *
// * *
// **************************
//
// The detector is the volume that can be dived in slices or voxelized
// and in it we can collect a number of usefull information:
// dose distribution, fluence distribution, LET and so on
void IORTDetectorConstruction::ConstructDetector()
{
// Definition of the solid volume of the Detector
detector = new G4Box("Detector",
detectorSizeX/2,
detectorSizeY/2,
detectorSizeZ/2);
// Definition of the logic volume of the Phantom
detectorLogicalVolume = new G4LogicalVolume(detector,
detectorMaterial,
"DetectorLog",
0,0,0);
// Definition of the physical volume of the Phantom
detectorPhysicalVolume = new G4PVPlacement(0,
detectorPosition, // Setted by displacement
"DetectorPhys",
detectorLogicalVolume,
phantomPhysicalVolume,
false,0);
// Visualisation attributes of the detector
//skyBlue = new G4VisAttributes( G4Colour(135/255. , 206/255. , 235/255. ));
G4VisAttributes * skyBlue1 = new G4VisAttributes( G4Colour(135/255. , 206/255. , 235/255. ));
//skyBlue1 -> SetForceWireframe(true);
//skyBlue1 -> SetForceSolid(true);
//skyBlue -> SetVisibility(true);
//skyBlue -> SetForceSolid(true);
//skyBlue -> SetForceWireframe(false);
//detectorLogicalVolume -> SetVisAttributes(skyBlue);
detectorLogicalVolume -> SetVisAttributes(skyBlue1);
// detectorLogicalVolume -> SetVisAttributes(G4VisAttributes::Invisible);
// **************
// Cut per Region
// **************
// A smaller cut is fixed in the phantom to calculate the energy deposit with the
// required accuracy
if (!aRegion)
{
aRegion = new G4Region("DetectorLog");
detectorLogicalVolume -> SetRegion(aRegion);
aRegion -> AddRootLogicalVolume(detectorLogicalVolume);
}
}
void IORTDetectorConstruction::ConstructDisc()
{
// ---------------------------------------------------------------//
// 4.0 mm Aluminium Protection Disc //
// ---------------------------------------------------------------//
//G4bool isotopes = false;
// G4Material* leadNist = G4NistManager::Instance()->FindOrBuildMaterial("G4_Pb", isotopes);
// DiscoMaterialIORT = leadNist; // messenger
gray = new G4VisAttributes( G4Colour(0.5, 0.5, 0.5 ));
gray-> SetVisibility(true);
//gray-> SetForceSolid(true);
gray1 = new G4VisAttributes( G4Colour(0.7, 0.7, 0.7 ));
gray1-> SetVisibility(true);
// gray1-> SetForceSolid(true);
// const G4double OuterRadiusDiscoIORT = 35. *mm; // messenger
// const G4double innerRadiusDiscoIORT = 0.*mm; // messenger
// const G4double heightDiscoIORT = 3.0*mm; // messenger
const G4double startAngleDiscoIORT = 0.*deg;
const G4double spanningAngleDiscoIORT = 360.*deg;
// const G4double DiscoXPositionIORT = -14.0*mm; // messenger
//G4Material* DiscoMaterialIORT = G4NistManager::Instance()->FindOrBuildMaterial("G4_PLEXIGLASS", isotopes);// messenger
G4double phi = 90. *deg;
// Matrix definition for a 90 deg rotation. Also used for other volumes
G4RotationMatrix rm;
rm.rotateY(phi);
solidDiscoIORT = new G4Tubs("DiscoIORT", innerRadiusDiscoIORT,
OuterRadiusDiscoIORT,
heightDiscoIORT,
startAngleDiscoIORT,
spanningAngleDiscoIORT);
G4LogicalVolume* logicDiscoIORT = new G4LogicalVolume(solidDiscoIORT,
DiscoMaterialIORT, "DiscoIORTLog", 0, 0, 0);
physiDiscoIORT = new G4PVPlacement(G4Transform3D(rm, G4ThreeVector(DiscoXPositionIORT,0.,0.)),
"DiscoIORTPhys", logicDiscoIORT, detectorPhysicalVolume, false, 0);
white = new G4VisAttributes( G4Colour());
white -> SetVisibility(true);
white -> SetForceSolid(true);
logicDiscoIORT -> SetVisAttributes(gray1);
// ---------------------------------------------------------------//
// 2.0 mm Lead Protection Disc //
// ---------------------------------------------------------------//
// const G4double OuterRadiusDiscoIORT1 = 35. *mm;
// const G4double innerRadiusDiscoIORT1 = 0.*mm;
// const G4double heightDiscoIORT1 = 0.5*mm;
const G4double startAngleDiscoIORT1 = 0.*deg;
const G4double spanningAngleDiscoIORT1 = 360.*deg;
// const G4double DiscoXPositionIORT1 = -10.5*mm; messenger
// G4Material* DiscoMaterialIORT1 = G4NistManager::Instance()->FindOrBuildMaterial("G4_Cu", isotopes);// messenger
solidDiscoIORT1 = new G4Tubs("DiscoIORT1", innerRadiusDiscoIORT1,
OuterRadiusDiscoIORT1,
heightDiscoIORT1,
startAngleDiscoIORT1,
spanningAngleDiscoIORT1);
G4LogicalVolume* logicDiscoIORT1 = new G4LogicalVolume(solidDiscoIORT1,
DiscoMaterialIORT1, "DiscoIORTLog1", 0, 0, 0);
physiDiscoIORT1 = new G4PVPlacement(G4Transform3D(rm, G4ThreeVector(DiscoXPositionIORT1,0.,0.)),
"DiscoIORTPhys1", logicDiscoIORT1, detectorPhysicalVolume, false, 0);
white = new G4VisAttributes( G4Colour());
white -> SetVisibility(true);
white -> SetForceSolid(true);
logicDiscoIORT1 -> SetVisAttributes(gray);
}
/////////////////////////////////////////////////////////////////////////////
void IORTDetectorConstruction::ConstructSensitiveDetector(G4ThreeVector detectorToWorldPosition)
{
// Install new Sensitive Detector and ROGeometry
delete detectorROGeometry; // this should be safe in C++ also if we have a NULL pointer
//if (detectorSD) detectorSD->PrintAll();
//delete detectorSD;
// Sensitive Detector and ReadOut geometry definition
G4SDManager* sensitiveDetectorManager = G4SDManager::GetSDMpointer();
static G4String sensitiveDetectorName = "Detector";
if (!detectorSD)
{
// The sensitive detector is instantiated
detectorSD = new IORTDetectorSD(sensitiveDetectorName);
}
// The Read Out Geometry is instantiated
static G4String ROGeometryName = "DetectorROGeometry";
detectorROGeometry = new IORTDetectorROGeometry(ROGeometryName,
detectorToWorldPosition,
detectorSizeX/2, // controllare che sia necessario /2
detectorSizeY/2, // CONFERMATO!!! ci vuole!!!
detectorSizeZ/2,
numberOfVoxelsAlongX,
numberOfVoxelsAlongY,
numberOfVoxelsAlongZ);
G4cout << "Instantiating new Read Out Geometry \"" << ROGeometryName << "\""<< G4endl;
// This will invoke Build() IORTDetectorROGeometry virtual method
detectorROGeometry -> BuildROGeometry();
// Attach ROGeometry to SDetector
detectorSD -> SetROgeometry(detectorROGeometry);
//sensitiveDetectorManager -> Activate(sensitiveDetectorName, true);
if (!sensitiveDetectorManager -> FindSensitiveDetector(sensitiveDetectorName, false))
{
G4cout << "Registering new DetectorSD \"" << sensitiveDetectorName << "\""<< G4endl;
// Register user SD
sensitiveDetectorManager -> AddNewDetector(detectorSD);
// Attach SD to detector logical volume
detectorLogicalVolume -> SetSensitiveDetector(detectorSD);
}
}
void IORTDetectorConstruction::ParametersCheck()
{
// Check phantom/detector sizes & relative position
if (!IsInside(detectorSizeX,
detectorSizeY,
detectorSizeZ,
phantomSizeX,
phantomSizeY,
phantomSizeZ,
detectorToPhantomPosition
))
G4Exception("IORTDetectorConstruction::ParametersCheck()", "IORT0001", FatalException, "Error: Detector is not fully inside Phantom!");
// Check Detector sizes respect to the voxel ones
if ( detectorSizeX < sizeOfVoxelAlongX) {
G4Exception("IORTDetectorConstruction::ParametersCheck()", "IORT0002", FatalException, "Error: Detector X size must be bigger or equal than that of Voxel X");
}
if ( detectorSizeY < sizeOfVoxelAlongY) {
G4Exception("IORTDetectorConstruction::ParametersCheck()", "IORT0003", FatalException, "Error: Detector X size must be bigger or equal than that of Voxel Y");
}
if ( detectorSizeZ < sizeOfVoxelAlongZ) {
G4Exception("IORTDetectorConstruction::ParametersCheck()", "IORT0004", FatalException, "Error: Detector X size must be bigger or equal than that of Voxel Z");
}
}
/////////////////
// MESSENGERS //
////////////////
G4bool IORTDetectorConstruction::SetPhantomMaterial(G4String material)
{
if (G4Material* pMat = G4NistManager::Instance()->FindOrBuildMaterial(material, false) )
{
phantomMaterial = pMat;
detectorMaterial = pMat;
if (detectorLogicalVolume && phantomLogicalVolume)
{
detectorLogicalVolume -> SetMaterial(pMat);
phantomLogicalVolume -> SetMaterial(pMat);
G4RunManager::GetRunManager() -> PhysicsHasBeenModified();
G4RunManager::GetRunManager() -> GeometryHasBeenModified();
G4cout << "The material of Phantom/Detector has been changed to " << material << G4endl;
}
}
else
{
G4cout << "WARNING: material \"" << material << "\" doesn't exist in NIST elements/materials"
" table [located in $G4INSTALL/source/materials/src/G4NistMaterialBuilder.cc]" << G4endl;
G4cout << "Use command \"/parameter/nist\" to see full materials list!" << G4endl;
return false;
}
return true;
}
G4bool IORTDetectorConstruction::SetDiscoMaterialIORT(G4String material)
{
if (G4Material* dMat = G4NistManager::Instance()->FindOrBuildMaterial(material, false) )
{
DiscoMaterialIORT = dMat;
if (logicDiscoIORT)
{
logicDiscoIORT -> SetMaterial(dMat);
G4RunManager::GetRunManager() -> PhysicsHasBeenModified();
G4RunManager::GetRunManager() -> GeometryHasBeenModified();
G4cout << "The material of Protection disc 1 has been changed to " << material << G4endl;
}
}
else
{
G4cout << "WARNING: material \"" << material << "\" doesn't exist in NIST elements/materials"
" table [located in $G4INSTALL/source/materials/src/G4NistMaterialBuilder.cc]" << G4endl;
G4cout << "Use command \"/parameter/nist\" to see full materials list!" << G4endl;
return false;
}
return true;
}
G4bool IORTDetectorConstruction::SetDiscoMaterialIORT1(G4String material)
{
if (G4Material* d1Mat = G4NistManager::Instance()->FindOrBuildMaterial(material, false) )
{
DiscoMaterialIORT1 = d1Mat;
if (logicDiscoIORT1)
{
logicDiscoIORT1 -> SetMaterial(d1Mat);
G4RunManager::GetRunManager() -> PhysicsHasBeenModified();
G4RunManager::GetRunManager() -> GeometryHasBeenModified();
G4cout << "The material of Protection disc 2 has been changed to " << material << G4endl;
}
}
else
{
G4cout << "WARNING: material \"" << material << "\" doesn't exist in NIST elements/materials"
" table [located in $G4INSTALL/source/materials/src/G4NistMaterialBuilder.cc]" << G4endl;
G4cout << "Use command \"/parameter/nist\" to see full materials list!" << G4endl;
return false;
}
return true;
}
/////////////////////////////////////////////////////////////////////////////
void IORTDetectorConstruction::SetPhantomSize(G4double sizeX, G4double sizeY, G4double sizeZ)
{
if (sizeX > 0.) phantomSizeX = sizeX;
if (sizeY > 0.) phantomSizeY = sizeY;
if (sizeZ > 0.) phantomSizeZ = sizeZ;
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void IORTDetectorConstruction::SetDetectorSize(G4double sizeX, G4double sizeY, G4double sizeZ)
{
if (sizeX > 0.) {detectorSizeX = sizeX;}
if (sizeY > 0.) {detectorSizeY = sizeY;}
if (sizeZ > 0.) {detectorSizeZ = sizeZ;}
SetVoxelSize(sizeOfVoxelAlongX, sizeOfVoxelAlongY, sizeOfVoxelAlongZ);
}
/////////////////////////////////////////////////////////////////////////////
void IORTDetectorConstruction::SetVoxelSize(G4double sizeX, G4double sizeY, G4double sizeZ)
{
if (sizeX > 0.) {sizeOfVoxelAlongX = sizeX;}
if (sizeY > 0.) {sizeOfVoxelAlongY = sizeY;}
if (sizeZ > 0.) {sizeOfVoxelAlongZ = sizeZ;}
}
void IORTDetectorConstruction::SetPhantomPosition(G4ThreeVector pos)
{
phantomPosition = pos;
}
/////////////////////////////////////////////////////////////////////////////
void IORTDetectorConstruction::SetDetectorToPhantomPosition(G4ThreeVector displ)
{
detectorToPhantomPosition = displ;
}
/////////////////////////////////protection disc///////////////////////////
void IORTDetectorConstruction::SetOuterRadiusDiscoIORT(G4double outerr)
{
if (outerr > 0.) {OuterRadiusDiscoIORT = outerr;}
}
void IORTDetectorConstruction::SetinnerRadiusDiscoIORT(G4double innerr)
{
if (innerr > 0.) {innerRadiusDiscoIORT = innerr;}
}
void IORTDetectorConstruction::SetheightDiscoIORT(G4double height)
{
if (height > 0.) {heightDiscoIORT = height;}
}
void IORTDetectorConstruction::SetDiscoXPositionIORT(G4double xpos)
{
DiscoXPositionIORT = xpos;
}
void IORTDetectorConstruction::SetOuterRadiusDiscoIORT1(G4double outerr)
{
if (outerr > 0.) {OuterRadiusDiscoIORT1 = outerr;}
}
void IORTDetectorConstruction::SetinnerRadiusDiscoIORT1(G4double innerr)
{
if (innerr > 0.) {innerRadiusDiscoIORT1 = innerr;}
}
void IORTDetectorConstruction::SetheightDiscoIORT1(G4double height)
{
if (height > 0.) {heightDiscoIORT1 = height;}
}
void IORTDetectorConstruction::SetDiscoXPositionIORT1(G4double xpos)
{
DiscoXPositionIORT1 = xpos;
}
/////////////////////////////////protection disc///////////end///////////
////////////////////////////////////////////////////////////////////////////////
void IORTDetectorConstruction::UpdateGeometry()
{
/*
* Check parameters consistency
*/
ParametersCheck();
G4GeometryManager::GetInstance() -> OpenGeometry();
if (phantom)
{
phantom -> SetXHalfLength(phantomSizeX/2);
phantom -> SetYHalfLength(phantomSizeY/2);
phantom -> SetZHalfLength(phantomSizeZ/2);
phantomPhysicalVolume -> SetTranslation(phantomPosition);
}
else ConstructPhantom();
// Get the center of the detector
SetDetectorPosition();
if (detector)
{
detector -> SetXHalfLength(detectorSizeX/2);
detector -> SetYHalfLength(detectorSizeY/2);
detector -> SetZHalfLength(detectorSizeZ/2);
detectorPhysicalVolume -> SetTranslation(detectorPosition);
}
else ConstructDetector();
// update disc function
delete solidDiscoIORT;
delete logicDiscoIORT;
delete physiDiscoIORT;
delete solidDiscoIORT1;
delete logicDiscoIORT1;
delete physiDiscoIORT1;
ConstructDisc();
// Round to nearest integer number of voxel
numberOfVoxelsAlongX = G4lrint(detectorSizeX / sizeOfVoxelAlongX);
sizeOfVoxelAlongX = ( detectorSizeX / numberOfVoxelsAlongX );
numberOfVoxelsAlongY = G4lrint(detectorSizeY / sizeOfVoxelAlongY);
sizeOfVoxelAlongY = ( detectorSizeY / numberOfVoxelsAlongY );
numberOfVoxelsAlongZ = G4lrint(detectorSizeZ / sizeOfVoxelAlongZ);
sizeOfVoxelAlongZ = ( detectorSizeZ / numberOfVoxelsAlongZ );
//G4cout << "*************** DetectorToWorldPosition " << GetDetectorToWorldPosition()/cm << "\n";
ConstructSensitiveDetector(GetDetectorToWorldPosition());
volumeOfVoxel = sizeOfVoxelAlongX * sizeOfVoxelAlongY * sizeOfVoxelAlongZ;
massOfVoxel = detectorMaterial -> GetDensity() * volumeOfVoxel;
// This will clear the existing matrix (together with all data inside it)!
matrix = IORTMatrix::GetInstance(numberOfVoxelsAlongX,
numberOfVoxelsAlongY,
numberOfVoxelsAlongZ,
massOfVoxel);
// Initialize analysis
/*
IORTAnalysisManager* analysis = IORTAnalysisManager::GetInstance();
#ifdef G4ANALYSIS_USE_ROOT
analysis -> flush(); // Finalize the root file
analysis -> book();
#endif
*/
// Inform the kernel about the new geometry
G4RunManager::GetRunManager() -> GeometryHasBeenModified();
G4RunManager::GetRunManager() -> PhysicsHasBeenModified();
PrintParameters();
}
void IORTDetectorConstruction::DeleteDisc()
{
delete solidDiscoIORT;
delete logicDiscoIORT;
delete physiDiscoIORT;
delete solidDiscoIORT1;
delete logicDiscoIORT1;
delete physiDiscoIORT1;
G4RunManager::GetRunManager() -> GeometryHasBeenModified();
G4RunManager::GetRunManager() -> PhysicsHasBeenModified();
}
void IORTDetectorConstruction::PrintParameters()
{
G4cout << "The (X,Y,Z) dimensions of the phantom are : (" <<
G4BestUnit( phantom -> GetXHalfLength()*2., "Length") << ',' <<
G4BestUnit( phantom -> GetYHalfLength()*2., "Length") << ',' <<
G4BestUnit( phantom -> GetZHalfLength()*2., "Length") << ')' << G4endl;
G4cout << "The (X,Y,Z) dimensions of the detector are : (" <<
G4BestUnit( detector -> GetXHalfLength()*2., "Length") << ',' <<
G4BestUnit( detector -> GetYHalfLength()*2., "Length") << ',' <<
G4BestUnit( detector -> GetZHalfLength()*2., "Length") << ')' << G4endl;
G4cout << "Displacement between Phantom and World is: ";
G4cout << "DX= "<< G4BestUnit(phantomPosition.getX(),"Length") <<
"DY= "<< G4BestUnit(phantomPosition.getY(),"Length") <<
"DZ= "<< G4BestUnit(phantomPosition.getZ(),"Length") << G4endl;
G4cout << "The (X,Y,Z) sizes of the Voxels are: (" <<
G4BestUnit(sizeOfVoxelAlongX, "Length") << ',' <<
G4BestUnit(sizeOfVoxelAlongY, "Length") << ',' <<
G4BestUnit(sizeOfVoxelAlongZ, "Length") << ')' << G4endl;
G4cout << "The number of Voxels along (X,Y,Z) is: (" <<
numberOfVoxelsAlongX << ',' <<
numberOfVoxelsAlongY <<',' <<
numberOfVoxelsAlongZ << ')' << G4endl;
}
@@ -0,0 +1,77 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// This is the *BASIC* version of IORT, a Geant4-based application
//
// Main Authors: G.Russo(a,b), C.Casarino*(c), G.C. Candiano(c), G.A.P. Cirrone(d), F.Romano(d)
// Contributor Authors: S.Guatelli(e)
// Past Authors: G.Arnetta(c), S.E.Mazzaglia(d)
//
// (a) Fondazione Istituto San Raffaele G.Giglio, Cefalù, Italy
// (b) IBFM-CNR , Segrate (Milano), Italy
// (c) LATO (Laboratorio di Tecnologie Oncologiche), Cefalù, Italy
// (d) Laboratori Nazionali del Sud of the INFN, Catania, Italy
// (e) University of Wallongong, Australia
//
// *Corresponding author, email to carlo.casarino@polooncologicocefalu.it
//////////////////////////////////////////////////////////////////////////////////////////////
#include "IORTDetectorHit.hh"
G4Allocator<IORTDetectorHit> IORTDetectorHitAllocator;
IORTDetectorHit::IORTDetectorHit()
{
energyDeposit = 0;
}
IORTDetectorHit::~IORTDetectorHit()
{
}
IORTDetectorHit::IORTDetectorHit(const IORTDetectorHit &right)
: G4VHit()
{
xHitID = right.xHitID;
zHitID = right.zHitID;
yHitID = right.yHitID;
energyDeposit = right.energyDeposit;
}
const IORTDetectorHit& IORTDetectorHit::operator=(const IORTDetectorHit &right)
{
xHitID = right.xHitID;
zHitID = right.zHitID;
yHitID = right.yHitID;
energyDeposit = right.energyDeposit;
return *this;
}
int IORTDetectorHit::operator==(const IORTDetectorHit &right) const
{
return((xHitID==right.xHitID)&&(zHitID==right.zHitID)&&(yHitID==right.yHitID));
}
@@ -0,0 +1,352 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// This is the *BASIC* version of IORT, a Geant4-based application
//
// Main Authors: G.Russo(a,b), C.Casarino*(c), G.C. Candiano(c), G.A.P. Cirrone(d), F.Romano(d)
// Contributor Authors: S.Guatelli(e)
// Past Authors: G.Arnetta(c), S.E.Mazzaglia(d)
//
// (a) Fondazione Istituto San Raffaele G.Giglio, Cefalù, Italy
// (b) IBFM-CNR , Segrate (Milano), Italy
// (c) LATO (Laboratorio di Tecnologie Oncologiche), Cefalù, Italy
// (d) Laboratori Nazionali del Sud of the INFN, Catania, Italy
// (e) University of Wallongong, Australia
//
// *Corresponding author, email to carlo.casarino@polooncologicocefalu.it
//////////////////////////////////////////////////////////////////////////////////////////////
#include "IORTDetectorMessenger.hh"
#include "IORTDetectorConstruction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWith3VectorAndUnit.hh"
#include "G4UIcmdWithoutParameter.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithADoubleAndUnit.hh" // aggiunto
/////////////////////////////////////////////////////////////////////////////
IORTDetectorMessenger::IORTDetectorMessenger(IORTDetectorConstruction* detector)
:iortDetector(detector)
{
// Change Phantom size
changeThePhantomDir = new G4UIdirectory("/changePhantom/");
changeThePhantomDir -> SetGuidance("Command to change the Phantom Size/position");
changeThePhantomSizeCmd = new G4UIcmdWith3VectorAndUnit("/changePhantom/size", this);
changeThePhantomSizeCmd -> SetGuidance("Insert sizes X Y and Z"
"\n 0 or negative values mean <<Don't change it!>>");
changeThePhantomSizeCmd -> SetParameterName("PhantomSizeAlongX",
"PhantomSizeAlongY",
"PhantomSizeAlongZ", false);
changeThePhantomSizeCmd -> SetDefaultUnit("mm");
changeThePhantomSizeCmd -> SetUnitCandidates("nm um mm cm");
changeThePhantomSizeCmd -> AvailableForStates(G4State_Idle);
// Change Phantom material
changeThePhantomMaterialCmd = new G4UIcmdWithAString("/changePhantom/material", this);
changeThePhantomMaterialCmd -> SetGuidance("Change the Phantom and the detector material");
changeThePhantomMaterialCmd -> SetParameterName("PhantomMaterial", false);
changeThePhantomMaterialCmd -> SetDefaultValue("G4_WATER");
changeThePhantomMaterialCmd -> AvailableForStates(G4State_Idle);
// Change Phantom position
changeThePhantomPositionCmd = new G4UIcmdWith3VectorAndUnit("/changePhantom/position", this);
changeThePhantomPositionCmd -> SetGuidance("Insert X Y and Z dimensions for the position of the center of the Phantom"
" respect to that of the \"World\"");
changeThePhantomPositionCmd -> SetParameterName("PositionAlongX",
"PositionAlongY",
"PositionAlongZ", false);
changeThePhantomPositionCmd -> SetDefaultUnit("mm");
changeThePhantomPositionCmd -> SetUnitCandidates("um mm cm m");
changeThePhantomPositionCmd -> AvailableForStates(G4State_Idle);
updateCmd = new G4UIcmdWithoutParameter("/changePhantom/update",this);
updateCmd->SetGuidance("Update Phantom/Detector geometry.");
updateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
updateCmd->SetGuidance("if you changed geometrical value(s).");
updateCmd->AvailableForStates(G4State_Idle);
// Change detector size
changeTheDetectorDir = new G4UIdirectory("/changeDetector/");
changeTheDetectorDir -> SetGuidance("Command to change the Detector's Size/position/Voxels");
changeTheDetectorSizeCmd = new G4UIcmdWith3VectorAndUnit("/changeDetector/size",this);
changeTheDetectorSizeCmd -> SetGuidance("Insert sizes for X Y and Z dimensions of the Detector"
"\n 0 or negative values mean <<Don't change it>>");
changeTheDetectorSizeCmd -> SetParameterName("DetectorSizeAlongX", "DetectorSizeAlongY", "DetectorSizeAlongZ", false);
changeTheDetectorSizeCmd -> SetDefaultUnit("mm");
changeTheDetectorSizeCmd -> SetUnitCandidates("nm um mm cm");
changeTheDetectorSizeCmd -> AvailableForStates(G4State_Idle);
// Change the detector to phantom displacement
changeTheDetectorToPhantomPositionCmd = new G4UIcmdWith3VectorAndUnit("/changeDetector/displacement",this);
changeTheDetectorToPhantomPositionCmd -> SetGuidance("Insert X Y and Z displacements between Detector and Phantom"
"\nNegative values mean <<Don't change it!>>");
changeTheDetectorToPhantomPositionCmd -> SetParameterName("DisplacementAlongX",
"DisplacementAlongY",
"DisplacementAlongZ", false);
changeTheDetectorToPhantomPositionCmd -> SetDefaultUnit("mm");
changeTheDetectorToPhantomPositionCmd -> SetUnitCandidates("nm um mm cm");
changeTheDetectorToPhantomPositionCmd -> AvailableForStates(G4State_Idle);
// Change voxels by its size
changeTheDetectorVoxelCmd = new G4UIcmdWith3VectorAndUnit("/changeDetector/voxelSize",this);
changeTheDetectorVoxelCmd -> SetGuidance("Insert Voxel sizes for X Y and Z dimensions"
"\n 0 or negative values mean <<Don't change it!>>");
changeTheDetectorVoxelCmd -> SetParameterName("VoxelSizeAlongX", "VoxelSizeAlongY", "VoxelSizeAlongZ", false);
changeTheDetectorVoxelCmd -> SetDefaultUnit("mm");
changeTheDetectorVoxelCmd -> SetUnitCandidates("nm um mm cm");
changeTheDetectorVoxelCmd -> AvailableForStates(G4State_Idle);
// Change disc1
changeTheDisc1Dir = new G4UIdirectory("/ProtectionDisc1/");
changeTheDisc1Dir -> SetGuidance("Command to change the Disc1");
changeOuterRadiusDiscoIORTCmd = new G4UIcmdWithADoubleAndUnit("/ProtectionDisc1/OuterRadiusDisc1",this);
changeOuterRadiusDiscoIORTCmd -> SetGuidance("Set size of outer radius");
changeOuterRadiusDiscoIORTCmd -> SetParameterName("Size",false);
changeOuterRadiusDiscoIORTCmd -> SetDefaultUnit("mm");
changeOuterRadiusDiscoIORTCmd -> SetUnitCandidates("mm cm m");
changeOuterRadiusDiscoIORTCmd -> AvailableForStates(G4State_Idle);
changeinnerRadiusDiscoIORTCmd = new G4UIcmdWithADoubleAndUnit("/ProtectionDisc1/InnerRadiusDisc1",this);
changeinnerRadiusDiscoIORTCmd -> SetGuidance("Set size of inner radius");
changeinnerRadiusDiscoIORTCmd -> SetParameterName("Size",false);
changeinnerRadiusDiscoIORTCmd -> SetDefaultUnit("mm");
changeinnerRadiusDiscoIORTCmd -> SetUnitCandidates("mm cm m");
changeinnerRadiusDiscoIORTCmd -> AvailableForStates(G4State_Idle);
changeheightDiscoIORTCmd = new G4UIcmdWithADoubleAndUnit("/ProtectionDisc1/HeightDisc1",this);
changeheightDiscoIORTCmd -> SetGuidance("Set size of higth");
changeheightDiscoIORTCmd -> SetParameterName("Size",false);
changeheightDiscoIORTCmd -> SetDefaultUnit("mm");
changeheightDiscoIORTCmd -> SetUnitCandidates("mm cm m");
changeheightDiscoIORTCmd -> AvailableForStates(G4State_Idle);
changeDiscoXPositionIORTCmd = new G4UIcmdWithADoubleAndUnit("/ProtectionDisc1/XPositionDisc1",this);
changeDiscoXPositionIORTCmd -> SetGuidance("Set the X position");
changeDiscoXPositionIORTCmd -> SetParameterName("Size",false);
changeDiscoXPositionIORTCmd -> SetDefaultUnit("mm");
changeDiscoXPositionIORTCmd -> SetUnitCandidates("mm cm m");
changeDiscoXPositionIORTCmd -> AvailableForStates(G4State_Idle);
changeTheDisc1MaterialCmd = new G4UIcmdWithAString("/ProtectionDisc1/material", this);
changeTheDisc1MaterialCmd -> SetGuidance("Change the Disc1 material");
changeTheDisc1MaterialCmd -> SetParameterName("Disc1Material", false);
changeTheDisc1MaterialCmd -> SetDefaultValue("G4_WATER");
changeTheDisc1MaterialCmd -> AvailableForStates(G4State_Idle);
// Change disc2
changeTheDisc2Dir = new G4UIdirectory("/ProtectionDisc2/");
changeTheDisc2Dir -> SetGuidance("Command to change the Disc2");
changeOuterRadiusDisco1IORTCmd = new G4UIcmdWithADoubleAndUnit("/ProtectionDisc2/OuterRadiusDisc2",this);
changeOuterRadiusDisco1IORTCmd -> SetGuidance("Set size of outer radius");
changeOuterRadiusDisco1IORTCmd -> SetParameterName("Size",false);
changeOuterRadiusDisco1IORTCmd -> SetDefaultUnit("mm");
changeOuterRadiusDisco1IORTCmd -> SetUnitCandidates("mm cm m");
changeOuterRadiusDisco1IORTCmd -> AvailableForStates(G4State_Idle);
changeinnerRadiusDisco1IORTCmd = new G4UIcmdWithADoubleAndUnit("/ProtectionDisc2/InnerRadiusDisc2",this);
changeinnerRadiusDisco1IORTCmd -> SetGuidance("Set size of inner radius");
changeinnerRadiusDisco1IORTCmd -> SetParameterName("Size",false);
changeinnerRadiusDisco1IORTCmd -> SetDefaultUnit("mm");
changeinnerRadiusDisco1IORTCmd -> SetUnitCandidates("mm cm m");
changeinnerRadiusDisco1IORTCmd -> AvailableForStates(G4State_Idle);
changeheightDisco1IORTCmd = new G4UIcmdWithADoubleAndUnit("/ProtectionDisc2/HeightDisc2",this);
changeheightDisco1IORTCmd -> SetGuidance("Set size of higth");
changeheightDisco1IORTCmd -> SetParameterName("Size",false);
changeheightDisco1IORTCmd -> SetDefaultUnit("mm");
changeheightDisco1IORTCmd -> SetUnitCandidates("mm cm m");
changeheightDisco1IORTCmd -> AvailableForStates(G4State_Idle);
changeDisco1XPositionIORTCmd = new G4UIcmdWithADoubleAndUnit("/ProtectionDisc2/XPositionDisc2",this);
changeDisco1XPositionIORTCmd -> SetGuidance("Set the X position");
changeDisco1XPositionIORTCmd -> SetParameterName("Size",false);
changeDisco1XPositionIORTCmd -> SetDefaultUnit("mm");
changeDisco1XPositionIORTCmd -> SetUnitCandidates("mm cm m");
changeDisco1XPositionIORTCmd -> AvailableForStates(G4State_Idle);
changeTheDisc2MaterialCmd = new G4UIcmdWithAString("/ProtectionDisc2/material", this);
changeTheDisc2MaterialCmd -> SetGuidance("Change the Disc2 material");
changeTheDisc2MaterialCmd -> SetParameterName("Disc1Material", false);
changeTheDisc2MaterialCmd -> SetDefaultValue("G4_WATER");
changeTheDisc2MaterialCmd -> AvailableForStates(G4State_Idle);
// Delete disc 1-2
deleteTheDiscDir = new G4UIdirectory("/DeleteProtectionDisc/");
deleteTheDiscDir -> SetGuidance("Command to delete the 1-2 Discs ");
deletediscCmd = new G4UIcmdWithoutParameter("/DeleteProtectionDisc/delete",this);
deletediscCmd->SetGuidance("Delete the 1-2 Discs geometry.");
deletediscCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
deletediscCmd->AvailableForStates(G4State_Idle);
// Insert disc 1-2
insertTheDiscDir = new G4UIdirectory("/InsertProtectionDisc/");
insertTheDiscDir -> SetGuidance("Command to insert the 1-2 Discs ");
insertdiscCmd = new G4UIcmdWithoutParameter("/InsertProtectionDisc/insert",this);
insertdiscCmd->SetGuidance("Insert the 1-2 Discs geometry.");
insertdiscCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
insertdiscCmd->SetGuidance("After this command MUST be applied update command \"beamOn\" ");
insertdiscCmd->AvailableForStates(G4State_Idle);
}
/////////////////////////////////////////////////////////////////////////////
IORTDetectorMessenger::~IORTDetectorMessenger()
{
delete changeThePhantomDir;
delete changeThePhantomSizeCmd;
delete changeThePhantomPositionCmd;
delete changeThePhantomMaterialCmd;
delete updateCmd;
delete changeTheDetectorDir;
delete changeTheDetectorSizeCmd;
delete changeTheDetectorToPhantomPositionCmd;
delete changeTheDetectorVoxelCmd;
delete changeTheDisc1Dir;
delete changeOuterRadiusDiscoIORTCmd;
delete changeinnerRadiusDiscoIORTCmd;
delete changeheightDiscoIORTCmd;
delete changeDiscoXPositionIORTCmd;
delete changeTheDisc1MaterialCmd;
delete changeTheDisc2Dir;
delete changeOuterRadiusDisco1IORTCmd;
delete changeinnerRadiusDisco1IORTCmd;
delete changeheightDisco1IORTCmd;
delete changeDisco1XPositionIORTCmd;
delete changeTheDisc2MaterialCmd;
delete deletediscCmd;
delete insertdiscCmd;
}
/////////////////////////////////////////////////////////////////////////////
void IORTDetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
{
if( command == changeThePhantomSizeCmd)
{
G4ThreeVector size = changeThePhantomSizeCmd -> GetNew3VectorValue(newValue);
iortDetector -> SetPhantomSize(size.getX(),size.getY(),size.getZ());
}
else if (command == changeThePhantomPositionCmd )
{
G4ThreeVector size = changeThePhantomPositionCmd -> GetNew3VectorValue(newValue);
iortDetector -> SetPhantomPosition(size);
}
else if (command == changeThePhantomMaterialCmd)
{
iortDetector -> SetPhantomMaterial(newValue);
}
else if (command == changeTheDetectorSizeCmd)
{
G4ThreeVector size = changeTheDetectorSizeCmd -> GetNew3VectorValue(newValue);
iortDetector -> SetDetectorSize(size.getX(),size.getY(),size.getZ());
}
else if (command == changeTheDetectorToPhantomPositionCmd)
{
G4ThreeVector size = changeTheDetectorToPhantomPositionCmd-> GetNew3VectorValue(newValue);
iortDetector -> SetDetectorToPhantomPosition(size);
}
else if (command == changeTheDetectorVoxelCmd)
{
G4ThreeVector size = changeTheDetectorVoxelCmd -> GetNew3VectorValue(newValue);
iortDetector -> SetVoxelSize(size.getX(),size.getY(),size.getZ());
}
/////////////////////disc/////////////////////////////////
else if( command == changeOuterRadiusDiscoIORTCmd )
{
iortDetector -> SetOuterRadiusDiscoIORT
(changeOuterRadiusDiscoIORTCmd -> GetNewDoubleValue(newValue));
}
else if( command == changeinnerRadiusDiscoIORTCmd )
{ iortDetector -> SetinnerRadiusDiscoIORT
(changeinnerRadiusDiscoIORTCmd -> GetNewDoubleValue(newValue));
}
else if( command == changeheightDiscoIORTCmd )
{ iortDetector -> SetheightDiscoIORT
(changeheightDiscoIORTCmd -> GetNewDoubleValue(newValue));
}
else if( command == changeDiscoXPositionIORTCmd )
{ iortDetector -> SetDiscoXPositionIORT
(changeDiscoXPositionIORTCmd -> GetNewDoubleValue(newValue));
}
else if (command == changeTheDisc1MaterialCmd)
{
iortDetector -> SetDiscoMaterialIORT(newValue);
}
else if( command == changeOuterRadiusDisco1IORTCmd )
{ iortDetector -> SetOuterRadiusDiscoIORT1
(changeOuterRadiusDisco1IORTCmd -> GetNewDoubleValue(newValue));
}
else if( command == changeinnerRadiusDisco1IORTCmd )
{ iortDetector -> SetinnerRadiusDiscoIORT1
(changeinnerRadiusDisco1IORTCmd -> GetNewDoubleValue(newValue));
}
else if( command == changeheightDisco1IORTCmd )
{ iortDetector -> SetheightDiscoIORT1
(changeheightDisco1IORTCmd -> GetNewDoubleValue(newValue));
}
else if( command == changeDisco1XPositionIORTCmd )
{ iortDetector -> SetDiscoXPositionIORT1
(changeDisco1XPositionIORTCmd -> GetNewDoubleValue(newValue));
}
else if (command == changeTheDisc2MaterialCmd)
{
iortDetector -> SetDiscoMaterialIORT1(newValue);
}
else if (command == updateCmd)
{
iortDetector -> UpdateGeometry();
}
else if (command == deletediscCmd)
{
iortDetector -> DeleteDisc();
}
else if (command == insertdiscCmd)
{
iortDetector -> ConstructDisc();
}
}
@@ -0,0 +1,206 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// This is the *BASIC* version of IORT, a Geant4-based application
//
// Main Authors: G.Russo(a,b), C.Casarino*(c), G.C. Candiano(c), G.A.P. Cirrone(d), F.Romano(d)
// Contributor Authors: S.Guatelli(e)
// Past Authors: G.Arnetta(c), S.E.Mazzaglia(d)
//
// (a) Fondazione Istituto San Raffaele G.Giglio, Cefalù, Italy
// (b) IBFM-CNR , Segrate (Milano), Italy
// (c) LATO (Laboratorio di Tecnologie Oncologiche), Cefalù, Italy
// (d) Laboratori Nazionali del Sud of the INFN, Catania, Italy
// (e) University of Wallongong, Australia
//
// *Corresponding author, email to carlo.casarino@polooncologicocefalu.it
//////////////////////////////////////////////////////////////////////////////////////////////
#include "IORTDetectorROGeometry.hh"
#include "IORTDummySD.hh"
#include "G4LogicalVolume.hh"
#include "G4VPhysicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4PVReplica.hh"
#include "G4Box.hh"
#include "G4ThreeVector.hh"
#include "G4Material.hh"
/////////////////////////////////////////////////////////////////////////////
IORTDetectorROGeometry::IORTDetectorROGeometry(G4String aString,
G4ThreeVector detectorToWorldPosition,
G4double detectorDimX,
G4double detectorDimY,
G4double detectorDimZ,
G4int numberOfVoxelsX,
G4int numberOfVoxelsY,
G4int numberOfVoxelsZ):
G4VReadOutGeometry(aString),
detectorToWorldPosition(detectorToWorldPosition),
detectorSizeX(detectorDimX),
detectorSizeY(detectorDimY),
detectorSizeZ(detectorDimZ),
numberOfVoxelsAlongX(numberOfVoxelsX),
numberOfVoxelsAlongY(numberOfVoxelsY),
numberOfVoxelsAlongZ(numberOfVoxelsZ)
{
}
/////////////////////////////////////////////////////////////////////////////
IORTDetectorROGeometry::~IORTDetectorROGeometry()
{
}
/////////////////////////////////////////////////////////////////////////////
G4VPhysicalVolume* IORTDetectorROGeometry::Build()
{
// A dummy material is used to fill the volumes of the readout geometry.
// (It will be allowed to set a NULL pointer in volumes of such virtual
// division in future, since this material is irrelevant for tracking.)
G4Material* dummyMat = new G4Material(name="dummyMat", 1., 1.*g/mole, 1.*g/cm3);
G4double worldSizeX = 400.0 *cm; // 200.0 *cm;
G4double worldSizeY = 400.0 *cm; // 200.0 *cm;
G4double worldSizeZ = 400.0 *cm; // 200.0 *cm;
G4double halfDetectorSizeX = detectorSizeX;
G4double halfDetectorSizeY = detectorSizeY;
G4double halfDetectorSizeZ = detectorSizeZ;
// World volume of ROGeometry ...
G4Box* ROWorld = new G4Box("ROWorld",
worldSizeX,
worldSizeY,
worldSizeZ);
G4LogicalVolume* ROWorldLog = new G4LogicalVolume(ROWorld, dummyMat,
"ROWorldLog", 0,0,0);
G4VPhysicalVolume* ROWorldPhys = new G4PVPlacement(0,G4ThreeVector(),
"ROWorldPhys",
ROWorldLog,
0,false,0);
// Detector ROGeometry
G4Box *RODetector = new G4Box("RODetector",
halfDetectorSizeX,
halfDetectorSizeY,
halfDetectorSizeZ);
G4LogicalVolume *RODetectorLog = new G4LogicalVolume(RODetector,
dummyMat,
"RODetectorLog",
0,0,0);
G4VPhysicalVolume *RODetectorPhys = new G4PVPlacement(0,
detectorToWorldPosition,
"DetectorPhys",
RODetectorLog,
ROWorldPhys,
false,0);
// Division along X axis: the detector is divided in slices along the X axis
G4double halfXVoxelSizeX = halfDetectorSizeX/numberOfVoxelsAlongX;
G4double halfXVoxelSizeY = halfDetectorSizeY;
G4double halfXVoxelSizeZ = halfDetectorSizeZ;
G4double voxelXThickness = 2*halfXVoxelSizeX;
G4Box *RODetectorXDivision = new G4Box("RODetectorXDivision",
halfXVoxelSizeX,
halfXVoxelSizeY,
halfXVoxelSizeZ);
G4LogicalVolume *RODetectorXDivisionLog = new G4LogicalVolume(RODetectorXDivision,
dummyMat,
"RODetectorXDivisionLog",
0,0,0);
G4VPhysicalVolume *RODetectorXDivisionPhys = new G4PVReplica("RODetectorXDivisionPhys",
RODetectorXDivisionLog,
RODetectorPhys,
kXAxis,
numberOfVoxelsAlongX,
voxelXThickness);
// Division along Y axis: the slices along the X axis are divided along the Y axis
G4double halfYVoxelSizeX = halfXVoxelSizeX;
G4double halfYVoxelSizeY = halfDetectorSizeY/numberOfVoxelsAlongY;
G4double halfYVoxelSizeZ = halfDetectorSizeZ;
G4double voxelYThickness = 2*halfYVoxelSizeY;
G4Box *RODetectorYDivision = new G4Box("RODetectorYDivision",
halfYVoxelSizeX,
halfYVoxelSizeY,
halfYVoxelSizeZ);
G4LogicalVolume *RODetectorYDivisionLog = new G4LogicalVolume(RODetectorYDivision,
dummyMat,
"RODetectorYDivisionLog",
0,0,0);
G4VPhysicalVolume *RODetectorYDivisionPhys = new G4PVReplica("RODetectorYDivisionPhys",
RODetectorYDivisionLog,
RODetectorXDivisionPhys,
kYAxis,
numberOfVoxelsAlongY,
voxelYThickness);
// Division along Z axis: the slices along the Y axis are divided along the Z axis
G4double halfZVoxelSizeX = halfXVoxelSizeX;
G4double halfZVoxelSizeY = halfYVoxelSizeY;
G4double halfZVoxelSizeZ = halfDetectorSizeZ/numberOfVoxelsAlongZ;
G4double voxelZThickness = 2*halfZVoxelSizeZ;
G4Box *RODetectorZDivision = new G4Box("RODetectorZDivision",
halfZVoxelSizeX,
halfZVoxelSizeY,
halfZVoxelSizeZ);
G4LogicalVolume *RODetectorZDivisionLog = new G4LogicalVolume(RODetectorZDivision,
dummyMat,
"RODetectorZDivisionLog",
0,0,0);
RODetectorZDivisionPhys = new G4PVReplica("RODetectorZDivisionPhys",
RODetectorZDivisionLog,
RODetectorYDivisionPhys,
kZAxis,
numberOfVoxelsAlongZ,
voxelZThickness);
IORTDummySD *dummySD = new IORTDummySD;
RODetectorZDivisionLog -> SetSensitiveDetector(dummySD);
return ROWorldPhys;
}
@@ -0,0 +1,209 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// This is the *BASIC* version of IORT, a Geant4-based application
//
// Main Authors: G.Russo(a,b), C.Casarino*(c), G.C. Candiano(c), G.A.P. Cirrone(d), F.Romano(d)
// Contributor Authors: S.Guatelli(e)
// Past Authors: G.Arnetta(c), S.E.Mazzaglia(d)
//
// (a) Fondazione Istituto San Raffaele G.Giglio, Cefalù, Italy
// (b) IBFM-CNR , Segrate (Milano), Italy
// (c) LATO (Laboratorio di Tecnologie Oncologiche), Cefalù, Italy
// (d) Laboratori Nazionali del Sud of the INFN, Catania, Italy
// (e) University of Wallongong, Australia
//
// *Corresponding author, email to carlo.casarino@polooncologicocefalu.it
//////////////////////////////////////////////////////////////////////////////////////////////
#include "IORTDetectorSD.hh"
#include "IORTAnalysisManager.hh"
#include "IORTDetectorHit.hh"
#include "G4Step.hh"
#include "G4VTouchable.hh"
#include "G4TouchableHistory.hh"
#include "G4SDManager.hh"
#include "IORTMatrix.hh"
/////////////////////////////////////////////////////////////////////////////
IORTDetectorSD::IORTDetectorSD(G4String name):
G4VSensitiveDetector(name)
{
G4String HCname;
collectionName.insert(HCname="IORTDetectorHitsCollection");
HitsCollection = NULL;
G4String sensitiveDetectorName = name;
}
/////////////////////////////////////////////////////////////////////////////
IORTDetectorSD::~IORTDetectorSD()
{
}
/////////////////////////////////////////////////////////////////////////////
void IORTDetectorSD::Initialize(G4HCofThisEvent*)
{
HitsCollection = new IORTDetectorHitsCollection(sensitiveDetectorName,
collectionName[0]);
}
/////////////////////////////////////////////////////////////////////////////
G4bool IORTDetectorSD::ProcessHits(G4Step* aStep, G4TouchableHistory* ROhist)
{
//The code doesn't seem to get here if we use the IAEA geometry. FIXME
if(!ROhist)
return false;
if (aStep -> GetPreStepPoint() -> GetPhysicalVolume() -> GetName() != "DetectorPhys")
return false;
// Get kinetic energy
G4Track * theTrack = aStep -> GetTrack();
//G4double kineticEnergy = theTrack -> GetKineticEnergy();
G4ParticleDefinition *particleDef = theTrack -> GetDefinition();
//Get particle name
G4String particleName = particleDef -> GetParticleName();
// G4cout << particleDef -> GetParticleType() << '\n';
// Get unique track_id (in an event)
G4int trackID = theTrack -> GetTrackID();
G4double energyDeposit = aStep -> GetTotalEnergyDeposit();
G4int Z = particleDef-> GetAtomicNumber();
//G4int A = particleDef-> GetAtomicMass();
// Read voxel indexes: i is the x index, k is the z index
G4int k = ROhist -> GetReplicaNumber(0);
G4int i = ROhist -> GetReplicaNumber(2);
G4int j = ROhist -> GetReplicaNumber(1);
#ifdef G4ANALYSIS_USE_ROOT
IORTAnalysisManager* analysis = IORTAnalysisManager::GetInstance();
#endif
IORTMatrix* matrix = IORTMatrix::GetInstance();
if (matrix)
{
// Increment Fluences & accumulate energy spectra
// Hit voxels are marked with track_id throught hitTrack matrix
G4int* hitTrack = matrix -> GetHitTrack(i,j,k); // hitTrack MUST BE cleared at every eventAction!
if ( *hitTrack != trackID )
{
*hitTrack = trackID;
/*
* Fill FLUENCE data for every single nuclide
* Exclude e-, neutrons, gamma, ...
*/
if ( Z >= 1)
matrix -> Fill(trackID, particleDef, i, j, k, 0, true);
#ifdef G4ANALYSIS_USE_ROOT
/*
// Fragments kinetic energy (ntuple)
if (trackID !=1 && Z>=1)
{
// First step kinetic energy for every fragment
analysis -> FillKineticFragmentTuple(i, j, k, A, Z, kineticEnergy/MeV);
}
// Kinetic energy spectra for primary particles
if ( trackID == 1 && i == 0)
{
// First step kinetic energy for primaries only
analysis -> FillKineticEnergyPrimaryNTuple(i, j, k, kineticEnergy/MeV);
}
*/
#endif
}
if(energyDeposit != 0)
{
/*
* This method will fill a dose matrix for every single nuclide.
* A method of the IORTMatrix class (StoreDoseFluenceAscii())
* is called automatically at the end of main (or via the macro command /analysis/writeDoseFile.
* It permits to store all dose/fluence data into a single plane ASCII file.
*/
// if (A==1 && Z==1) // primary and sec. protons
if ( Z>=1 ) // exclude e-, neutrons, gamma, ...
matrix -> Fill(trackID, particleDef, i, j, k, energyDeposit);
/*
* Create a hit with the information of position is in the detector
*/
IORTDetectorHit* detectorHit = new IORTDetectorHit();
detectorHit -> SetEdepAndPosition(i, j, k, energyDeposit);
HitsCollection -> insert(detectorHit);
}
}
#ifdef G4ANALYSIS_USE_ROOT
if(energyDeposit != 0)
{
if(trackID != 1)
{
if (particleName == "proton")
analysis -> SecondaryProtonEnergyDeposit(i, energyDeposit/MeV);
else if (particleName == "neutron")
analysis -> SecondaryNeutronEnergyDeposit(i, energyDeposit/MeV);
else if (particleName == "alpha")
analysis -> SecondaryAlphaEnergyDeposit(i, energyDeposit/MeV);
else if (particleName == "gamma")
analysis -> SecondaryGammaEnergyDeposit(i, energyDeposit/MeV);
else if (particleName == "e-")
analysis -> SecondaryElectronEnergyDeposit(i, energyDeposit/MeV);
else if (particleName == "triton")
analysis -> SecondaryTritonEnergyDeposit(i, energyDeposit/MeV);
else if (particleName == "deuteron")
analysis -> SecondaryDeuteronEnergyDeposit(i, energyDeposit/MeV);
else if (particleName == "pi+" || particleName == "pi-" || particleName == "pi0")
analysis -> SecondaryPionEnergyDeposit(i, energyDeposit/MeV);
}
}
#endif
return true;
}
/////////////////////////////////////////////////////////////////////////////
void IORTDetectorSD::EndOfEvent(G4HCofThisEvent* HCE)
{
static G4int HCID = -1;
if(HCID < 0)
{
HCID = GetCollectionID(0);
}
HCE -> AddHitsCollection(HCID,HitsCollection);
}
@@ -0,0 +1,118 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// This is the *BASIC* version of IORT, a Geant4-based application
//
// Main Authors: G.Russo(a,b), C.Casarino*(c), G.C. Candiano(c), G.A.P. Cirrone(d), F.Romano(d)
// Contributor Authors: S.Guatelli(e)
// Past Authors: G.Arnetta(c), S.E.Mazzaglia(d)
//
// (a) Fondazione Istituto San Raffaele G.Giglio, Cefalù, Italy
// (b) IBFM-CNR , Segrate (Milano), Italy
// (c) LATO (Laboratorio di Tecnologie Oncologiche), Cefalù, Italy
// (d) Laboratori Nazionali del Sud of the INFN, Catania, Italy
// (e) University of Wallongong, Australia
//
// *Corresponding author, email to carlo.casarino@polooncologicocefalu.it
//////////////////////////////////////////////////////////////////////////////////////////////
#include "G4Event.hh"
#include "G4EventManager.hh"
#include "G4HCofThisEvent.hh"
#include "G4VHitsCollection.hh"
#include "G4SDManager.hh"
#include "G4VVisManager.hh"
#include "IORTEventAction.hh"
#include "IORTDetectorHit.hh"
#include "IORTDetectorSD.hh"
#include "IORTDetectorConstruction.hh"
#include "IORTMatrix.hh"
#include "IORTEventActionMessenger.hh"
/////////////////////////////////////////////////////////////////////////////
IORTEventAction::IORTEventAction() :
drawFlag("all" ),printModulo(1000), pointerEventMessenger(0)
{
hitsCollectionID = -1;
pointerEventMessenger = new IORTEventActionMessenger(this);
}
/////////////////////////////////////////////////////////////////////////////
IORTEventAction::~IORTEventAction()
{
delete pointerEventMessenger;
}
/////////////////////////////////////////////////////////////////////////////
void IORTEventAction::BeginOfEventAction(const G4Event* evt)
{
G4int evtNb = evt->GetEventID();
//printing survey
if (evtNb%printModulo == 0)
G4cout << "\n---> Begin of Event: " << evtNb << G4endl;
G4SDManager* pSDManager = G4SDManager::GetSDMpointer();
if(hitsCollectionID == -1)
hitsCollectionID = pSDManager -> GetCollectionID("IORTDetectorHitsCollection");
}
/////////////////////////////////////////////////////////////////////////////
void IORTEventAction::EndOfEventAction(const G4Event* evt)
{
if(hitsCollectionID < 0)
return;
G4HCofThisEvent* HCE = evt -> GetHCofThisEvent();
// Clear voxels hit list
IORTMatrix* matrix = IORTMatrix::GetInstance();
if (matrix) matrix -> ClearHitTrack();
if(HCE)
{
IORTDetectorHitsCollection* CHC = (IORTDetectorHitsCollection*)(HCE -> GetHC(hitsCollectionID));
if(CHC)
{
if(matrix)
{
// Fill the matrix with the information: voxel and associated energy deposit
// in the detector at the end of the event
G4int HitCount = CHC -> entries();
for (G4int h=0; h<HitCount; h++)
{
G4int i = ((*CHC)[h]) -> GetXID();
G4int j = ((*CHC)[h]) -> GetYID();
G4int k = ((*CHC)[h]) -> GetZID();
G4double energyDeposit = ((*CHC)[h]) -> GetEdep();
matrix -> Fill(i, j, k, energyDeposit/MeV);
}
}
}
}
}
@@ -0,0 +1,87 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// This is the *BASIC* version of IORT, a Geant4-based application
//
// Main Authors: G.Russo(a,b), C.Casarino*(c), G.C. Candiano(c), G.A.P. Cirrone(d), F.Romano(d)
// Contributor Authors: S.Guatelli(e)
// Past Authors: G.Arnetta(c), S.E.Mazzaglia(d)
//
// (a) Fondazione Istituto San Raffaele G.Giglio, Cefalù, Italy
// (b) IBFM-CNR , Segrate (Milano), Italy
// (c) LATO (Laboratorio di Tecnologie Oncologiche), Cefalù, Italy
// (d) Laboratori Nazionali del Sud of the INFN, Catania, Italy
// (e) University of Wallongong, Australia
//
// *Corresponding author, email to carlo.casarino@polooncologicocefalu.it
//////////////////////////////////////////////////////////////////////////////////////////////
#include "IORTEventActionMessenger.hh"
#include "IORTEventAction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithAnInteger.hh"
/////////////////////////////////////////////////////////////////////////////
IORTEventActionMessenger::IORTEventActionMessenger(IORTEventAction* EvAct)
:eventAction(EvAct)
{
eventDir = new G4UIdirectory("/event/");
eventDir->SetGuidance("Permits controls on simulation events");
DrawCmd = new G4UIcmdWithAString("/event/drawTracks",this);
DrawCmd->SetGuidance("Draw the tracks in the event");
DrawCmd->SetGuidance(" Choice : none,charged, all, neutral");
DrawCmd->SetParameterName("choice",true);
DrawCmd->SetDefaultValue("all");
DrawCmd->SetCandidates("none charged all neutral");
DrawCmd->AvailableForStates(G4State_Idle);
PrintCmd = new G4UIcmdWithAnInteger("/event/printEventNumber",this);
PrintCmd->SetGuidance("Print the event number of modulo n");
PrintCmd->SetParameterName("EventNb",false);
PrintCmd->SetRange("EventNb>0");
PrintCmd->AvailableForStates(G4State_Idle);
}
/////////////////////////////////////////////////////////////////////////////
IORTEventActionMessenger::~IORTEventActionMessenger()
{
delete DrawCmd;
delete PrintCmd;
delete eventDir;
}
/////////////////////////////////////////////////////////////////////////////
void IORTEventActionMessenger::SetNewValue(G4UIcommand* command,
G4String newValue)
{
if(command == DrawCmd)
{eventAction->SetDrawFlag(newValue);}
if(command == PrintCmd)
{eventAction->SetPrintModulo(PrintCmd->GetNewIntValue(newValue));}
}
@@ -0,0 +1,124 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// This is the *BASIC* version of IORT, a Geant4-based application
//
// Main Authors: G.Russo(a,b), C.Casarino*(c), G.C. Candiano(c), G.A.P. Cirrone(d), F.Romano(d)
// Contributor Authors: S.Guatelli(e)
// Past Authors: G.Arnetta(c), S.E.Mazzaglia(d)
//
// (a) Fondazione Istituto San Raffaele G.Giglio, Cefalù, Italy
// (b) IBFM-CNR , Segrate (Milano), Italy
// (c) LATO (Laboratorio di Tecnologie Oncologiche), Cefalù, Italy
// (d) Laboratori Nazionali del Sud of the INFN, Catania, Italy
// (e) University of Wallongong, Australia
//
// *Corresponding author, email to carlo.casarino@polooncologicocefalu.it
//////////////////////////////////////////////////////////////////////////////////////////////
#include "IORTGeometryController.hh"
#include "IORTDetectorConstruction.hh"
#include "IORTInteractionParameters.hh"
#include "Collimator40BeamLine.hh"
#include "Collimator50BeamLine.hh"
#include "Collimator60BeamLine.hh"
#include "Collimator70BeamLine.hh"
#include "Collimator80BeamLine.hh"
#include "Collimator100BeamLine.hh"
#include "G4RunManager.hh"
#include "IORTGeometryMessenger.hh"
/////////////////////////////////////////////////////////////////////////////
IORTGeometryController::IORTGeometryController()
{}
/////////////////////////////////////////////////////////////////////////////
IORTGeometryController::~IORTGeometryController()
{}
/////////////////////////////////////////////////////////////////////////////
void IORTGeometryController::SetGeometry(G4String name)
{
if (name == "coll100")
{
registerGeometry(new Collimator100BeamLine());
G4cout <<"Collimator 100 geometry activated" << G4endl;
}
else if (name == "coll80")
{
registerGeometry(new Collimator80BeamLine());
G4cout <<"Collimator 80 geometry activated" << G4endl;
}
else if (name == "coll70")
{
registerGeometry(new Collimator70BeamLine());
G4cout <<"Collimator 70 geometry activated" << G4endl;
}
else if (name == "coll50")
{
registerGeometry(new Collimator50BeamLine());
G4cout <<"Collimator 50 geometry activated" << G4endl;
}
else if (name == "coll40")
{
registerGeometry(new Collimator40BeamLine());
G4cout <<"Collimator 40 geometry activated" << G4endl;
}
else if(name == "default")
{
registerGeometry(new Collimator60BeamLine());
}
else
{
G4cout <<"Unknown geometry: " << name << ". Geometry not changed." << G4endl;
}
}
/////////////////////////////////////////////////////////////////////////////
void IORTGeometryController::registerGeometry(G4VUserDetectorConstruction *detector)
{
G4RunManager *runManager = G4RunManager::GetRunManager();
runManager->SetUserInitialization(detector);
runManager->GeometryHasBeenModified();
}
/////////////////////////////////////////////////////////////////////////////
void IORTGeometryController::UpdateGeometry()
{
G4RunManager::GetRunManager() -> GeometryHasBeenModified();
}
@@ -0,0 +1,87 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// This is the *BASIC* version of Collimator60, a Geant4-based application
//
// Main Authors: G.Russo(a,b), C.Casarino*(c), G.C. Candiano(c), G.A.P. Cirrone(d), F.Romano(d)
// Contributor Authors: S.Guatelli(e)
// Past Authors: G.Arnetta(c), S.E.Mazzaglia(d)
//
// (a) Fondazione Istituto San Raffaele G.Giglio, Cefalù, Italy
// (b) IBFM-CNR , Segrate (Milano), Italy
// (c) LATO (Laboratorio di Tecnologie Oncologiche), Cefalù, Italy
// (d) Laboratori Nazionali del Sud of the INFN, Catania, Italy
// (e) University of Wallongong, Australia
//
// *Corresponding author, email to carlo.casarino@polooncologicocefalu.it
//////////////////////////////////////////////////////////////////////////////////////////////
#include "IORTGeometryMessenger.hh"
#include "IORTGeometryController.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithoutParameter.hh"
IORTGeometryMessenger::IORTGeometryMessenger(IORTGeometryController* controller)
:iortGeometryController(controller)
{
changeTheGeometryDir = new G4UIdirectory("/geometrySetup/");
changeTheGeometryDir -> SetGuidance("Geometry setup");
changeTheGeometryCmd = new G4UIcmdWithAString("/geometrySetup/selectGeometry",this);
changeTheGeometryCmd -> SetGuidance("Select the geometry you wish to use");
changeTheGeometryCmd -> SetParameterName("Geometry",false);
// changeTheGeometryCmd -> AvailableForStates(G4State_PreInit);
changeTheGeometryCmd -> AvailableForStates(G4State_PreInit,G4State_Idle,G4State_GeomClosed,G4State_EventProc);
updateCmd = new G4UIcmdWithoutParameter("/geometrySetup/update",this);
updateCmd->SetGuidance("Update collimator geometry.");
updateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
updateCmd->SetGuidance("if you changed geometrical value(s).");
updateCmd->AvailableForStates(G4State_PreInit,G4State_Idle,G4State_GeomClosed,G4State_EventProc);
}
IORTGeometryMessenger::~IORTGeometryMessenger()
{
delete changeTheGeometryDir;
delete changeTheGeometryCmd;
delete updateCmd;
}
void IORTGeometryMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
{
if( command == changeTheGeometryCmd )
{ iortGeometryController -> SetGeometry (newValue);}
// { iortGeometryController -> registerGeometry(G4VUserDetectorConstruction* detector);}
else if (command == updateCmd)
{
iortGeometryController -> UpdateGeometry();
}
}
@@ -0,0 +1,297 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// This is the *BASIC* version of IORT, a Geant4-based application
//
// Main Authors: G.Russo(a,b), C.Casarino*(c), G.C. Candiano(c), G.A.P. Cirrone(d), F.Romano(d)
// Contributor Authors: S.Guatelli(e)
// Past Authors: G.Arnetta(c), S.E.Mazzaglia(d)
//
// (a) Fondazione Istituto San Raffaele G.Giglio, Cefalù, Italy
// (b) IBFM-CNR , Segrate (Milano), Italy
// (c) LATO (Laboratorio di Tecnologie Oncologiche), Cefalù, Italy
// (d) Laboratori Nazionali del Sud of the INFN, Catania, Italy
// (e) University of Wallongong, Australia
//
// *Corresponding author, email to carlo.casarino@polooncologicocefalu.it
//////////////////////////////////////////////////////////////////////////////////////////////
#include "IORTInteractionParameters.hh"
#include "IORTParameterMessenger.hh"
#include "IORTDetectorConstruction.hh"
#include "G4UnitsTable.hh"
#include "G4UImanager.hh"
#include "G4RunManager.hh"
#include "G4LossTableManager.hh"
#include "G4Material.hh"
#include "G4MaterialCutsCouple.hh"
#include "G4ParticleDefinition.hh"
#include "G4ParticleTable.hh"
#include "G4NistManager.hh"
#include "G4Element.hh"
#include "G4StateManager.hh"
#include "globals.hh"
#include <fstream>
#include <iostream>
#include <sstream>
#include <math.h>
#include <unistd.h>
#include <vector>
IORTInteractionParameters::IORTInteractionParameters(G4bool wantMessenger):
nistEle(new G4NistElementBuilder(0)),
nistMat(new G4NistMaterialBuilder(nistEle, 0)),
data(G4cout.rdbuf()),
pMessenger(0),
beamFlag(false)
#ifdef G4ANALYSIS_USE_ROOT
,theRootCanvas(0),
theRootGraph(0)
#endif
{
if (wantMessenger) pMessenger = new IORTParameterMessenger(this);
}
IORTInteractionParameters::~IORTInteractionParameters()
{
if (pMessenger) delete pMessenger;
delete nistMat;
delete nistEle;
}
G4double IORTInteractionParameters::GetStopping (G4double energy,
const G4ParticleDefinition* pDef,
const G4Material* pMat,
G4double density)
{
if (density) return ComputeTotalDEDX(energy, pDef, pMat)/density;
return ComputeTotalDEDX(energy, pDef, pMat);
}
bool IORTInteractionParameters::GetStoppingTable(const G4String& vararg)
{
// Check arguments
if ( !ParseArg(vararg)) return false;
// Clear previous energy & mass sp vectors
energy.clear();
massDedx.clear();
// log scale
if (kinEmin != kinEmax && npoints >1)
{
G4double logmin = std::log10(kinEmin);
G4double logmax = std::log10(kinEmax);
G4double en;
// uniform log space
for (G4double c = 0.; c < npoints; c++)
{
en = std::pow(10., logmin + ( c*(logmax-logmin) / (npoints - 1.)) );
energy.push_back(en/MeV);
dedxtot = ComputeTotalDEDX (en, particle, material);
massDedx.push_back ( (dedxtot / density)/(MeV*cm2/g) );
}
}
else // one point only
{
energy.push_back(kinEmin/MeV);
dedxtot = ComputeTotalDEDX (kinEmin, particle, material);
massDedx.push_back ( (dedxtot / density)/(MeV*cm2/g) );
}
G4cout.precision(6);
data << "MeV " << "MeV*cm2/g " << particle << " (into " <<
material << ", density = " << G4BestUnit(density,"Volumic Mass") << ")" << G4endl;
data << G4endl;
data << std::left << std::setfill(' ');
for (size_t i=0; i<energy.size(); i++){
data << std::setw(16) << energy[i] << massDedx[i] << G4endl;
}
outfile.close();
// This will plot
#ifdef G4ANALYSIS_USE_ROOT
PlotStopping("pdf");
#endif
// Info to user
G4String ofName = (filename == "") ? "User terminal": filename;
G4cout << "User choice:\n";
G4cout << "Kinetic energy lower limit= "<< G4BestUnit(kinEmin,"Energy") <<
", Kinetic energy upper limit= " << G4BestUnit(kinEmax,"Energy") <<
", npoints= "<< npoints << ", particle= \"" << particle <<
"\", material= \"" << material << "\", filename= \""<<
ofName << "\"" << G4endl;
return true;
}
///////////////////////////////////////////////////////////////////////////////////
// Save Plot
#ifdef G4ANALYSIS_USE_ROOT
void IORTInteractionParameters::PlotStopping(const G4String& filetype)
{
if (!theRootCanvas)
{
gROOT->Reset();
gROOT->SetStyle("Plain");
theRootCanvas = new TCanvas("theRootCanvas","Interaction Parameters",200, 10, 600,400);
theRootCanvas -> SetFillColor(20);
theRootCanvas -> SetBorderMode(1);
theRootCanvas -> SetBorderSize(1);
theRootCanvas -> SetFrameBorderMode(0);
theRootCanvas -> SetGrid();
// Use global pad: root manual pgg 109,...
}
if (theRootGraph) delete theRootGraph;
theRootGraph = new TGraph(energy.size(), &energy[0], &massDedx[0]);
//theRootGraph = new TGraph();
axisX = theRootGraph -> GetXaxis(),
axisY = theRootGraph -> GetYaxis();
axisX -> SetTitle("MeV");
axisY -> SetTitle("Stopping Power (MeV cm2/g)");
//axisX -> SetNdivisions(500,kTRUE);
//axisX -> SetTickLength(0.03);
//axisX -> SetLabelOffset(2.005);
axisX -> SetAxisColor(2);
axisY -> SetAxisColor(2);
gPad -> SetLogx(1);
gPad -> SetLogy(1);
theRootGraph -> SetMarkerColor(4);
theRootGraph -> SetMarkerStyle(20);// circle
theRootGraph -> SetMarkerSize(.5);
G4String gName = particle.substr(0, particle.find("[") ); // cut excitation energy
gName = gName + "_" + material;
G4String fName = "./referenceData/interaction/" + gName + "." + filetype;
theRootGraph -> SetTitle(gName);
theRootGraph -> Draw("AP");
//theRootCanvas -> Update();
//theRootCanvas -> Draw();
theRootCanvas -> SaveAs(fName);
}
#endif
// Search for user material choice inside G4NistManager database
G4Material* IORTInteractionParameters::GetNistMaterial(G4String material)
{
Pmaterial = G4NistManager::Instance()->FindOrBuildMaterial(material);
if (Pmaterial) density = Pmaterial -> GetDensity();
return Pmaterial;
}
// Parse arguments line
bool IORTInteractionParameters::ParseArg(const G4String& vararg)
{
kinEmin = kinEmax = npoints = 0.;
particle = material = filename = "";
// set internal variables
std::istringstream strParam(vararg);
// TODO here check for number and parameters consistency
strParam >> std::skipws >> material >> kinEmin >> kinEmax >> npoints >> particle >> filename;
// npoints must be an integer!
npoints = std::floor(npoints);
// Check that kinEmax >= kinEmin > 0 && npoints >= 1
// TODO NIST points and linear scale
if (kinEmax == 0. && kinEmin > 0. ) kinEmax = kinEmin;
if (kinEmax == 0. && kinEmin == 0. ) kinEmax = kinEmin = 1.*MeV;
if (kinEmax < kinEmin)
{
G4cout << "WARNING: kinEmin must not exceed kinEmax!" << G4endl;
G4cout << "Usage: /parameter/command material kinetic Emin kinetic Emax nPoints [particle] [output filename]" << G4endl;
return false;
}
if (npoints < 1) npoints = 1;
// check if element/material is into database
if (!GetNistMaterial(material) )
{
G4cout << "WARNING: material \"" << material << "\" doesn't exist in NIST elements/materials"
" table [$G4INSTALL/source/materials/src/G4NistMaterialBuilder.cc]" << G4endl;
G4cout << "Use command \"/parameter/nist\" to see full materials list" << G4endl;
return false;
}
// Check for particle
if (particle == "") particle = "proton"; // default to "proton"
else if ( !FindParticle(particle) )
{
G4cout << "WARNING: Particle \"" << particle << "\" isn't supported." << G4endl;
G4cout << "Try the command \"/particle/list\" to get full supported particles list." << G4endl;
G4cout << "If you are interested in an ion that isn't in this list you must give it to the particle gun."
"\nTry the commands:\n/gun/particle ion"
"\n/gun/ion <atomic number> <mass number> <[charge]>" << G4endl << G4endl;
return false;
}
// start physics by forcing a G4RunManager::BeamOn():
BeamOn();
// Set output file
if( filename != "" )
{
outfile.open(filename,std::ios_base::trunc); // overwrite existing file
data.rdbuf(outfile.rdbuf());
}
else data.rdbuf(G4cout.rdbuf()); // output is G4cout!
return true;
}
// Force physics tables build
void IORTInteractionParameters::BeamOn()
{
// first check if RunManager is above G4State_Idle
G4StateManager* mState = G4StateManager::GetStateManager();
G4ApplicationState aState = mState -> GetCurrentState();
if ( aState <= G4State_Idle && beamFlag == false)
{
G4cout << "Issuing a G4RunManager::beamOn()... ";
G4cout << "Current Run State is " << mState -> GetStateString( aState ) << G4endl;
G4RunManager::GetRunManager() -> BeamOn(0);
beamFlag = true;
}
}
// print a list of Nist elements and materials
void IORTInteractionParameters::ListOfNistMaterials(const G4String& vararg)
{
/*
$G4INSTALL/source/materials/src/G4NistElementBuilder.cc
You can also construct a new material by the ConstructNewMaterial method:
see $G4INSTALL/source/materials/src/G4NistMaterialBuilder.cc
*/
// Get simplest full list
if (vararg =="list")
{
const std::vector<G4String>& vec = nistMat -> GetMaterialNames();
for (size_t i=0; i<vec.size(); i++)
{
G4cout << std::setw(12) << std::left << i+1 << vec[i] << G4endl;
}
G4cout << G4endl;
}
else if (vararg =="all" || vararg =="simple" || vararg =="compound" || vararg =="hep" )
{
nistMat -> ListMaterials(vararg);
}
}
@@ -0,0 +1,469 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// This is the *BASIC* version of IORT, a Geant4-based application
//
// Main Authors: G.Russo(a,b), C.Casarino*(c), G.C. Candiano(c), G.A.P. Cirrone(d), F.Romano(d)
// Contributor Authors: S.Guatelli(e)
// Past Authors: G.Arnetta(c), S.E.Mazzaglia(d)
//
// (a) Fondazione Istituto San Raffaele G.Giglio, Cefalù, Italy
// (b) IBFM-CNR , Segrate (Milano), Italy
// (c) LATO (Laboratorio di Tecnologie Oncologiche), Cefalù, Italy
// (d) Laboratori Nazionali del Sud of the INFN, Catania, Italy
// (e) University of Wallongong, Australia
//
// *Corresponding author, email to carlo.casarino@polooncologicocefalu.it
//////////////////////////////////////////////////////////////////////////////////////////////
#include "IORTMatrix.hh"
#include "IORTAnalysisManager.hh"
#include "G4RunManager.hh"
#include "IORTPrimaryGeneratorAction.hh"
#include "G4ParticleGun.hh"
#include <fstream>
#include <unistd.h>
#include <iostream>
#include <sstream>
#include <iomanip>
#include "globals.hh"
// Units definition: CLHEP/Units/SystemOfUnits.h
//
IORTMatrix* IORTMatrix::instance = NULL;
G4bool IORTMatrix::secondary = false;
// Only return a pointer to matrix
IORTMatrix* IORTMatrix::GetInstance()
{
return instance;
}
// This STATIC method delete (!) the old matrix and rewrite a new object returning a pointer to it
// TODO A check on the parameters is required!
IORTMatrix* IORTMatrix::GetInstance(G4int voxelX, G4int voxelY, G4int voxelZ, G4double mass)
{
if (instance) delete instance;
instance = new IORTMatrix(voxelX, voxelY, voxelZ, mass);
instance -> Initialize();
return instance;
}
IORTMatrix::IORTMatrix(G4int voxelX, G4int voxelY, G4int voxelZ, G4double mass):
stdFile("Dose.out"),
doseUnit(MeV/g)
{
// Number of the voxels of the phantom
// For Y = Z = 1 the phantom is divided in slices (and not in voxels)
// orthogonal to the beam axis
numberOfVoxelAlongX = voxelX;
numberOfVoxelAlongY = voxelY;
numberOfVoxelAlongZ = voxelZ;
massOfVoxel = mass;
// Create the dose matrix
matrix = new G4double[numberOfVoxelAlongX*numberOfVoxelAlongY*numberOfVoxelAlongZ];
if (matrix)
{
G4cout << "IORTMatrix: Memory space to store physical dose into " <<
numberOfVoxelAlongX*numberOfVoxelAlongY*numberOfVoxelAlongZ <<
" voxels has been allocated " << G4endl;
}
else G4Exception("IORTMatrix::IORTMatrix()", "IORT0005", FatalException, "Error: can't allocate memory to store physical dose!");
// Hit voxel (TrackID) marker
// This array mark the status of voxel, if a hit occur, with the trackID of the particle
// Must be initialized
hitTrack = new G4int[numberOfVoxelAlongX*numberOfVoxelAlongY*numberOfVoxelAlongZ];
ClearHitTrack();
}
/////////////////////////////////////////////////////////////////////////////
IORTMatrix::~IORTMatrix()
{
delete[] matrix;
delete[] hitTrack;
// free fluences/dose data memory
Clear();
}
/////////////////////////////////////////////////////////////////////////////
void IORTMatrix::Clear()
{
for (size_t i=0; i<ionStore.size(); i++)
{
delete[] ionStore[i].dose;
delete[] ionStore[i].fluence;
}
ionStore.clear();
}
/////////////////////////////////////////////////////////////////////////////
// Initialise the elements of the matrix to zero
void IORTMatrix::Initialize()
{
// Clear ions store
Clear();
// Clear dose
for(int i=0;i<numberOfVoxelAlongX*numberOfVoxelAlongY*numberOfVoxelAlongZ;i++)
{
matrix[i] = 0;
}
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// Print generated nuclides list
void IORTMatrix::PrintNuclides()
{
for (size_t i=0; i<ionStore.size(); i++)
{
G4cout << ionStore[i].name << G4endl;
}
}
/////////////////////////////////////////////////////////////////////////////
// Clear Hit voxel (TrackID) markers
void IORTMatrix::ClearHitTrack()
{
for(G4int i=0; i<numberOfVoxelAlongX*numberOfVoxelAlongY*numberOfVoxelAlongZ; i++) hitTrack[i] = 0;
}
// Return Hit status
G4int* IORTMatrix::GetHitTrack(G4int i, G4int j, G4int k)
{
return &(hitTrack[Index(i,j,k)]);
}
/////////////////////////////////////////////////////////////////////////////
// Dose methods...
// Fill DOSE/fluence matrix for secondary particles:
// If fluence parameter is true (default value is FALSE) then fluence at voxel (i, j, k) is increased.
// The energyDeposit parameter fill the dose matrix for voxel (i,j,k)
/////////////////////////////////////////////////////////////////////////////
G4bool IORTMatrix::Fill(G4int trackID,
G4ParticleDefinition* particleDef,
G4int i, G4int j, G4int k,
G4double energyDeposit,
G4bool fluence)
{
if ( (energyDeposit <=0. && !fluence) || !secondary) return false;
// Get Particle Data Group particle ID
G4int PDGencoding = particleDef -> GetPDGEncoding();
PDGencoding -= PDGencoding%10;
// Search for already allocated data...
for (size_t l=0; l < ionStore.size(); l++)
{
if (ionStore[l].PDGencoding == PDGencoding )
{ // Is it a primary or a secondary particle?
if ( ((trackID == 1) && (ionStore[l].isPrimary)) || ((trackID !=1) && (!ionStore[l].isPrimary)))
{
if (energyDeposit > 0.) ionStore[l].dose[Index(i, j, k)] += energyDeposit/massOfVoxel;
// Fill a matrix per each ion with the fluence
if (fluence) ionStore[l].fluence[Index(i, j, k)]++;
return true;
}
}
}
G4int Z = particleDef-> GetAtomicNumber();
G4int A = particleDef-> GetAtomicMass();
G4String fullName = particleDef -> GetParticleName();
G4String name = fullName.substr (0, fullName.find("[") ); // cut excitation energy
// Let's put a new particle in our store...
ion newIon =
{
(trackID == 1) ? true:false,
PDGencoding,
name,
name.length(),
Z,
A,
new G4double[numberOfVoxelAlongX * numberOfVoxelAlongY * numberOfVoxelAlongZ],
new unsigned int[numberOfVoxelAlongX * numberOfVoxelAlongY * numberOfVoxelAlongZ]
};
// Initialize data
if (newIon.dose && newIon.fluence)
{
for(G4int m=0; m<numberOfVoxelAlongX*numberOfVoxelAlongY*numberOfVoxelAlongZ; m++)
{
newIon.dose[m] = 0.;
newIon.fluence[m] = 0;
}
if (energyDeposit > 0.) newIon.dose[Index(i, j, k)] += energyDeposit/massOfVoxel;
if (fluence) newIon.fluence[Index(i, j, k)]++;
ionStore.push_back(newIon);
// TODO Put some verbosity check
/*
G4cout << "Memory space to store the DOSE/FLUENCE into " <<
numberOfVoxelAlongX*numberOfVoxelAlongY*numberOfVoxelAlongZ <<
" voxels has been allocated for the nuclide " << newIon.name <<
" (Z = " << Z << ", A = " << A << ")" << G4endl ;
*/
return true;
}
else // XXX Out of memory! XXX
{
return false;
}
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// Methods to store data to filenames...
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
//
// General method to store matrix data to filename
void IORTMatrix::StoreMatrix(G4String file, void* data, size_t psize)
{
if (data)
{
ofs.open(file, std::ios::out);
if (ofs.is_open())
{
for(G4int i = 0; i < numberOfVoxelAlongX; i++)
for(G4int j = 0; j < numberOfVoxelAlongY; j++)
for(G4int k = 0; k < numberOfVoxelAlongZ; k++)
{
G4int n = Index(i, j, k);
// Check for data type: u_int, G4double, XXX
if (psize == sizeof(unsigned int))
{
unsigned int* pdata = (unsigned int*)data;
if (pdata[n]) ofs << i << '\t' << j << '\t' <<
k << '\t' << pdata[n] << G4endl;
}
else if (psize == sizeof(G4double))
{
G4double* pdata = (G4double*)data;
if (pdata[n]) ofs << i << '\t' << j << '\t' <<
k << '\t' << pdata[n] << G4endl;
}
}
ofs.close();
}
}
}
// Store fluence per single ion in multiple files
void IORTMatrix::StoreFluenceData()
{
for (size_t i=0; i < ionStore.size(); i++){
StoreMatrix(ionStore[i].name + "_Fluence.out", ionStore[i].fluence, sizeof(unsigned int));
}
}
// Store dose per single ion in multiple files
void IORTMatrix::StoreDoseData()
{
for (size_t i=0; i < ionStore.size(); i++){
StoreMatrix(ionStore[i].name + "_Dose.out", ionStore[i].dose, sizeof(G4double));
}
}
/////////////////////////////////////////////////////////////////////////
// Store dose for all ions into a single file and into ntuples.
// Please note that this function is called via messenger commands
// defined in the IORTAnalysisFileMessenger.cc class file
void IORTMatrix::StoreDoseFluenceAscii(G4String file)
{
#define width 15L
filename = (file=="") ? stdFile:file;
// Sort like periodic table
std::sort(ionStore.begin(), ionStore.end());
G4cout << "Dose is being written to " << filename << G4endl;
ofs.open(filename, std::ios::out);
if (ofs.is_open())
{
// Write the voxels index and the list of particles/ions
ofs << std::setprecision(6) << std::left <<
"i\tj\tk\t";
// Total dose
ofs << std::setw(width) << "Dose(MeV/g)";
if (secondary)
{
for (size_t l=0; l < ionStore.size(); l++)
{
G4String a = (ionStore[l].isPrimary) ? "_1":""; // is it a primary?
ofs << std::setw(width) << ionStore[l].name + a <<
std::setw(width) << ionStore[l].name + a;
}
ofs << G4endl;
/*
* PDGencondig
*/
/*
ofs << std::setprecision(6) << std::left <<
"0\t0\t0\t";
// Total dose
ofs << std::setw(width) << '0';
for (size_t l=0; l < ionStore.size(); l++)
{
ofs << std::setw(width) << ionStore[l].PDGencoding <<
std::setw(width) << ionStore[l].PDGencoding;
}
ofs << G4endl;
*/
}
// Write data
for(G4int i = 0; i < numberOfVoxelAlongX; i++)
for(G4int j = 0; j < numberOfVoxelAlongY; j++)
for(G4int k = 0; k < numberOfVoxelAlongZ; k++)
{
G4int n = Index(i, j, k);
// Write only not identically null data lines
if (matrix[n])
{
ofs << G4endl;
ofs << i << '\t' << j << '\t' << k << '\t';
// Total dose
ofs << std::setw(width) << matrix[n]/massOfVoxel/doseUnit;
if (secondary)
{
for (size_t l=0; l < ionStore.size(); l++)
{
// Fill ASCII file rows
ofs << std::setw(width) << ionStore[l].dose[n]/massOfVoxel/doseUnit <<
std::setw(width) << ionStore[l].fluence[n];
}
}
}
}
ofs.close();
}
}
/////////////////////////////////////////////////////////////////////////////
#ifdef G4ANALYSIS_USE_ROOT
void IORTMatrix::StoreDoseFluenceRoot()
{
IORTAnalysisManager* analysis = IORTAnalysisManager::GetInstance();
if (analysis -> IsTheTFile())
{
for(G4int i = 0; i < numberOfVoxelAlongX; i++)
for(G4int j = 0; j < numberOfVoxelAlongY; j++)
for(G4int k = 0; k < numberOfVoxelAlongZ; k++)
{
G4int n = Index(i, j, k);
for (size_t l=0; l < ionStore.size(); l++)
{
// Do the same work for .root file: fill dose/fluence ntuple
analysis -> FillVoxelFragmentTuple( i, j, k,
ionStore[l].A,
ionStore[l].Z,
ionStore[l].dose[n]/massOfVoxel/doseUnit,
ionStore[l].fluence[n] );
}
}
}
}
#endif
void IORTMatrix::Fill(G4int i, G4int j, G4int k,
G4double energyDeposit)
{
if (matrix)
matrix[Index(i,j,k)] += energyDeposit;
// Store the energy deposit in the matrix element corresponding
// to the phantom voxel
}
void IORTMatrix::TotalEnergyDeposit()
{
// Store the information of the matrix in a ntuple and in
// a 1D Histogram
/*
/////////////////////////////////// imported from eliot_geant4.9.3p01_version /////////////////////////////
G4int k;
G4int j;
G4int i;
if (matrix)
{ // AGGIUNTO
std::ofstream ofs; // AGGIUNTO
ofs.open("PDD9.9Mev_coll60_0gradi_s500_Sp1_6gradi_step0.01_setcuts0.01.out"); // AGGIUNTO
for(G4int l = 0; l < numberOfVoxelAlongZ; l++) // was "numberVoxelZ" and so in the other directions
{
k = l;
for(G4int m = 0; m < numberOfVoxelAlongY; m++)
{
j = m * numberOfVoxelAlongZ + k;
for(G4int n = 0; n < numberOfVoxelAlongX; n++)
{
i = n* numberOfVoxelAlongZ * numberOfVoxelAlongY + j;
if(matrix[i] != 0)
{
ofs<< n <<'\t'<< m <<'\t'<< // AGGIUNTO
k<<'\t'<<matrix[i]<<G4endl; // AGGIUNTO
}
}
}
}
ofs.close(); // AGGIUNTO
}
/////////////////////////////////// imported from eliot_geant4.9.3p01_version /////////////////////////////
*/
// Convert energy deposited to dose.
// Store the information of the matrix in a ntuple and in
// a 1D Histogram
/*
IORTAnalysisManager* analysis = IORTAnalysisManager::GetInstance();
if (matrix)
{
for(G4int i = 0; i < numberOfVoxelAlongX; i++)
for(G4int j = 0; j < numberOfVoxelAlongY; j++)
for(G4int k = 0; k < numberOfVoxelAlongZ; k++)
{
G4int n = Index(i,j,k);
#ifdef G4ANALYSIS_USE_ROOT
if (analysis -> IsTheTFile() )
{
analysis -> FillEnergyDeposit(i, j, k, matrix[n]/massOfVoxel/doseUnit);
analysis -> BraggPeak(i, matrix[n]/massOfVoxel/doseUnit);
}
#endif
}
}
*/
}
@@ -0,0 +1,97 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// This is the *BASIC* version of IORT, a Geant4-based application
//
// Main Authors: G.Russo(a,b), C.Casarino*(c), G.C. Candiano(c), G.A.P. Cirrone(d), F.Romano(d)
// Contributor Authors: S.Guatelli(e)
// Past Authors: G.Arnetta(c), S.E.Mazzaglia(d)
//
// (a) Fondazione Istituto San Raffaele G.Giglio, Cefalù, Italy
// (b) IBFM-CNR , Segrate (Milano), Italy
// (c) LATO (Laboratorio di Tecnologie Oncologiche), Cefalù, Italy
// (d) Laboratori Nazionali del Sud of the INFN, Catania, Italy
// (e) University of Wallongong, Australia
//
// *Corresponding author, email to carlo.casarino@polooncologicocefalu.it
//////////////////////////////////////////////////////////////////////////////////////////////
#include "IORTParameterMessenger.hh"
#include "IORTInteractionParameters.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAString.hh"
IORTParameterMessenger::IORTParameterMessenger(IORTInteractionParameters* param)
:pParam(param)
{
paramDir = new G4UIdirectory("/parameter/");
paramDir -> SetGuidance("Commands to generate stopping power and range");
dedxCmd = new G4UIcmdWithAString("/parameter/getstopping",this);
dedxCmd->SetGuidance("Get mass stopping powers"
"\n[usage]: /parameter/getstopping Material [Emin] [Emax] [N] [Particle] [File]"
"\n Material:(string) Material name, like G4_H, G4_WATER,..., look at /parameter/nist"
"\n Emin Emax:(double) minimum and maximum kinetic energy (MeV)"
"\n N:(double) [number of points]"
"\n Particle:(string) Particle name, look at /particle/list"
"\n File:(string) Name for the output file."
"\nDefault values for parameters inside [] are respectively:"
"\n \"1 MeV\", \"Emin\", \"1\", \"proton\", \"stdout\"");
dedxCmd->SetParameterName("inputData",false);
dedxCmd->AvailableForStates(G4State_Idle);
listCmd = new G4UIcmdWithAString("/parameter/nist",this);
listCmd -> SetGuidance("Print NIST elements/materials.\nParameters:"
"\n\t all: will print elements and compounds"
"\n\t simple: will print elements only"
"\n\t compound: will print compounds only"
"\n\t hep: will print hep compounds"
"\n\t list: will print a simple full list of all elements and compounds");
listCmd -> SetParameterName("String",true);
listCmd -> SetDefaultValue("list");
listCmd -> SetCandidates("all simple compound hep list");
listCmd ->AvailableForStates(G4State_Idle);
//Available G4 States (G4State_PreInit, G4State_Init, G4State_Idle,G4State_GeomClosed, G4State_EventProc);
}
IORTParameterMessenger::~IORTParameterMessenger()
{
delete paramDir;
delete dedxCmd;
delete listCmd;
}
void IORTParameterMessenger::SetNewValue(G4UIcommand* command, G4String vararg)
{
if (command == dedxCmd)
{
pParam -> GetStoppingTable(vararg);
}
else if (command == listCmd)
{
pParam -> ListOfNistMaterials(vararg);
}
}
@@ -0,0 +1,82 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// This is the *BASIC* version of IORT, a Geant4-based application
//
// Main Authors: G.Russo(a,b), C.Casarino*(c), G.C. Candiano(c), G.A.P. Cirrone(d), F.Romano(d)
// Contributor Authors: S.Guatelli(e)
// Past Authors: G.Arnetta(c), S.E.Mazzaglia(d)
//
// (a) Fondazione Istituto San Raffaele G.Giglio, Cefalù, Italy
// (b) IBFM-CNR , Segrate (Milano), Italy
// (c) LATO (Laboratorio di Tecnologie Oncologiche), Cefalù, Italy
// (d) Laboratori Nazionali del Sud of the INFN, Catania, Italy
// (e) University of Wallongong, Australia
//
// *Corresponding author, email to carlo.casarino@polooncologicocefalu.it
//////////////////////////////////////////////////////////////////////////////////////////////
#include "IORTParticles.hh"
#include "G4ParticleDefinition.hh"
#include "G4ParticleTypes.hh"
#include "G4ParticleTable.hh"
#include "G4LeptonConstructor.hh"
#include "G4BosonConstructor.hh"
#include "G4MesonConstructor.hh"
#include "G4BaryonConstructor.hh"
#include "G4ShortLivedConstructor.hh"
#include "G4IonConstructor.hh"
IORTParticles::IORTParticles(const G4String& name)
: G4VPhysicsConstructor(name)
{ }
IORTParticles::~IORTParticles()
{}
void IORTParticles::ConstructParticle()
{
//
// Define all the particles involved in the experimental set-up
//
G4LeptonConstructor lepton;
lepton.ConstructParticle();
G4BosonConstructor boson;
boson.ConstructParticle();
G4MesonConstructor meson;
meson.ConstructParticle();
G4BaryonConstructor baryon;
baryon.ConstructParticle();
G4ShortLivedConstructor shortLived;
shortLived.ConstructParticle();
G4IonConstructor ion;
ion.ConstructParticle();
}
@@ -0,0 +1,405 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// This is the *BASIC* version of IORT, a Geant4-based application
//
// Main Authors: G.Russo(a,b), C.Casarino*(c), G.C. Candiano(c), G.A.P. Cirrone(d), F.Romano(d)
// Contributor Authors: S.Guatelli(e)
// Past Authors: G.Arnetta(c), S.E.Mazzaglia(d)
//
// (a) Fondazione Istituto San Raffaele G.Giglio, Cefalù, Italy
// (b) IBFM-CNR , Segrate (Milano), Italy
// (c) LATO (Laboratorio di Tecnologie Oncologiche), Cefalù, Italy
// (d) Laboratori Nazionali del Sud of the INFN, Catania, Italy
// (e) University of Wallongong, Australia
//
// *Corresponding author, email to carlo.casarino@polooncologicocefalu.it
//////////////////////////////////////////////////////////////////////////////////////////////
//
// Physics models in IORT, following the Geant4 organisation, can be definided using three different approaches:
// 1. Activating one of the 'Reference Physics Lists' that are already prepared by
// the Geant4 Collaboration and are contained in the $G4INSTALL/source/physics_lists/lists folder
// The 'Reference Physics Lists' can be activated setting a specific enviroment variable to the name
// of the physics. For example if the QGSP_BIC Reference Physics Lists must be activated the User
// must set export PHYSLIST=QGSP_BIC (or setenv PHYSLIST QGSP_BIC).
// A 'Reference Physics Lists' contains all the physics process necessary to a particle transport
// If the User set the PHYSLIST variable IORT will start with the defaultMacroWithReferencePhysicsList.mac
// macro. See this macro file for more details
//
// 2. Activating the 'Builders' already prepared by
// the Geant4 Collaboration and contained in the $G4INSTALL/source/physics_lists/builder folder.
// Each builder is specific of a given model. There are builders for the electromagnetic processes, for the
// hadronic one, etc.
// If the PHYSLIST variable is not defined IORT starts with the defaultMacro.mac where the single builders
// are activated for the various processes of interest.
// Each builder is activated with the /Physics/addPhysics <nome builder> command
//
// ****** SUGGESTED PHYSICS *********
//
// AT MOMENT, IF ACCURATE RESULTS ARE NEDED, WE STRONGLY RECOMMEND:
// 1. The use of the emstandard_opt3, or
// 2. the QGSP_BIC_EMY Reference Physics Lists (define the PHYSLIST eviroment variable):
// export PHYSLIST=QGSP_BIC_EMY
#include "G4RunManager.hh"
#include "G4Region.hh"
#include "G4RegionStore.hh"
#include "IORTPhysicsList.hh"
#include "IORTPhysicsListMessenger.hh"
#include "IORTStepMax.hh"
#include "G4PhysListFactory.hh"
#include "G4VPhysicsConstructor.hh"
// Local physic directly implemented in the Hadronthrapy directory
//#include "LocalIonIonInelasticPhysic.hh" // Physic dedicated to the ion-ion inelastic processes
//#include "LocalINCLIonIonInelasticPhysic.hh" // Physic dedicated to the ion-ion inelastic processes using ////INCL/ABLA
// #include "LocalStandardICRU73EmPhysic.hh" // This permits the use of the ICRU73 tables for stopping powers of ions. AGGIUNTO da eliot_geant4.9.3p01_version
// Physic lists (contained inside the Geant4 source code, in the 'physicslists folder')
#include "G4EmStandardPhysics_option3.hh"
#include "G4EmLivermorePhysics.hh"
#include "G4EmPenelopePhysics.hh"
#include "G4EmExtraPhysics.hh"
#include "G4QStoppingPhysics.hh"
#include "G4DecayPhysics.hh"
#include "G4HadronElasticPhysics.hh"
#include "G4HadronElasticPhysicsHP.hh"
#include "G4HadronDElasticPhysics.hh"
#include "G4HadronHElasticPhysics.hh"
#include "G4HadronQElasticPhysics.hh"
#include "G4HadronInelasticQBBC.hh"
#include "G4IonBinaryCascadePhysics.hh"
#include "G4Decay.hh"
#include "G4DecayPhysics.hh"
#include "G4NeutronTrackingCut.hh"
#include "G4LossTableManager.hh"
#include "G4UnitsTable.hh"
#include "G4ProcessManager.hh"
#include "HadronPhysicsQGSP_BIC.hh"
#include "G4IonFluctuations.hh"
#include "G4IonParametrisedLossModel.hh"
#include "G4EmProcessOptions.hh"
#include "G4RadioactiveDecayPhysics.hh"
/////////////////////////////////////////////////////////////////////////////
IORTPhysicsList::IORTPhysicsList() : G4VModularPhysicsList()
{
G4LossTableManager::Instance();
defaultCutValue = 0.01 *mm; //1.*mm;
cutForGamma = defaultCutValue;
cutForElectron = defaultCutValue;
cutForPositron = defaultCutValue;
helIsRegistered = false;
bicIsRegistered = false;
biciIsRegistered = false;
locIonIonInelasticIsRegistered = false;
radioactiveDecayIsRegistered = false;
stepMaxProcess = 0;
pMessenger = new IORTPhysicsListMessenger(this);
SetVerboseLevel(1);
// EM physics
emPhysicsList = new G4EmStandardPhysics_option3(1);
emName = G4String("emstandard_opt3");
// Decay physics and all particles
decPhysicsList = new G4DecayPhysics();
}
/////////////////////////////////////////////////////////////////////////////
IORTPhysicsList::~IORTPhysicsList()
{
delete pMessenger;
delete emPhysicsList;
delete decPhysicsList;
for(size_t i=0; i<hadronPhys.size(); i++) {delete hadronPhys[i];}
}
/////////////////////////////////////////////////////////////////////////////
void IORTPhysicsList::ConstructParticle()
{
decPhysicsList->ConstructParticle();
}
/////////////////////////////////////////////////////////////////////////////
void IORTPhysicsList::ConstructProcess()
{
// transportation
AddTransportation();
// electromagnetic physics list
emPhysicsList->ConstructProcess();
em_config.AddModels();
// decay physics list
decPhysicsList->ConstructProcess();
// hadronic physics lists
for(size_t i=0; i<hadronPhys.size(); i++) {
hadronPhys[i] -> ConstructProcess();
}
// step limitation (as a full process)
//
AddStepMax();
}
/////////////////////////////////////////////////////////////////////////////
void IORTPhysicsList::AddPhysicsList(const G4String& name)
{
if (verboseLevel>1) {
G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
}
if (name == emName) return;
/////////////////////////////////////////////////////////////////////////////
// ELECTROMAGNETIC MODELS
/////////////////////////////////////////////////////////////////////////////
if (name == "standard_opt3") {
emName = name;
delete emPhysicsList;
emPhysicsList = new G4EmStandardPhysics_option3();
G4RunManager::GetRunManager() -> PhysicsHasBeenModified();
G4cout << "THE FOLLOWING ELECTROMAGNETIC PHYSICS LIST HAS BEEN ACTIVATED: G4EmStandardPhysics_option3" << G4endl;
} else if (name == "LowE_Livermore") {
emName = name;
delete emPhysicsList;
emPhysicsList = new G4EmLivermorePhysics();
G4RunManager::GetRunManager()-> PhysicsHasBeenModified();
G4cout << "THE FOLLOWING ELECTROMAGNETIC PHYSICS LIST HAS BEEN ACTIVATED: G4EmLivermorePhysics" << G4endl;
} else if (name == "LowE_Penelope") {
emName = name;
delete emPhysicsList;
emPhysicsList = new G4EmPenelopePhysics();
G4RunManager::GetRunManager()-> PhysicsHasBeenModified();
G4cout << "THE FOLLOWING ELECTROMAGNETIC PHYSICS LIST HAS BEEN ACTIVATED: G4EmLivermorePhysics" << G4endl;
/////////////////////////////////////////////////////////////////////////////
// HADRONIC MODELS
/////////////////////////////////////////////////////////////////////////////
} else if (name == "Elastic")
{
if(!helIsRegistered)
{
G4cout << "THE FOLLOWING HADRONIC ELASTIC PHYSICS LIST HAS BEEN ACTIVATED: G4HadronElasticPhysics()" << G4endl;
hadronPhys.push_back( new G4HadronElasticPhysics());
helIsRegistered = true;
}
else G4cout << "AN ELASTIC PHYSICS HAS BEEN ALREADY ACTIVATED!" << G4endl;
}
else if (name == "DElastic")
{
if(!helIsRegistered)
{
hadronPhys.push_back( new G4HadronDElasticPhysics());
helIsRegistered = true;
}
else G4cout << "AN ELASTIC PHYSICS HAS BEEN ALREADY ACTIVATED!" << G4endl;
}
else if (name == "HElastic")
{
if(!helIsRegistered)
{
hadronPhys.push_back( new G4HadronHElasticPhysics());
helIsRegistered = true;
}
else G4cout << "AN ELASTIC PHYSICS HAS BEEN ALREADY ACTIVATED!" << G4endl;
}
else if (name == "QElastic")
{
if(!helIsRegistered)
{
hadronPhys.push_back( new G4HadronQElasticPhysics());
helIsRegistered = true;
}
else G4cout << "AN ELASTIC PHYSICS HAS BEEN ALREADY ACTIVATED!" << G4endl;
}
else if (name == "Em_extra_physics")
{
hadronPhys.push_back( new G4EmExtraPhysics());
}
else if (name == "Stopping_physics")
{
hadronPhys.push_back( new G4QStoppingPhysics());
}
else if (name == "Neutron_tracking_cut")
{
hadronPhys.push_back( new G4NeutronTrackingCut());
}
else if (name == "Hadron_QGSP_BIC")
{
hadronPhys.push_back( new HadronPhysicsQGSP_BIC());
// helIsRegistered = true;
}
else if (name == "Hadron_QBBC")
{
hadronPhys.push_back(new G4HadronInelasticQBBC());
//bicIsRegistered = true;
G4cout << "THE FOLLOWING HADRONIC INELASTIC PHYSICS LIST HAS BEEN ACTIVATED: G4HadronInelasticQBBC()" << G4endl;
}
else if (name == "binary")
{
hadronPhys.push_back(new G4HadronInelasticQBBC());
//bicIsRegisted = true;
G4cout << "THE FOLLOWING HADRONIC INELASTIC PHYSICS LIST HAS BEEN ACTIVATED: G4HadronInelasticQBBC()" << G4endl;
}
else if (name == "binary_ion")
{
hadronPhys.push_back(new G4IonBinaryCascadePhysics());
//biciIsRegistered = true;
}
/*
else if (name == "local_ion_ion_inelastic")
{
hadronPhys.push_back(new LocalIonIonInelasticPhysic());
locIonIonInelasticIsRegistered = true;
}
else if (name == "local_incl_ion_ion_inelastic")
{
hadronPhys.push_back(new LocalINCLIonIonInelasticPhysic());
locIonIonInelasticIsRegistered = true;
}
*/
else if (name == "decay")
{
hadronPhys.push_back(new G4DecayPhysics());
//radioactiveDecayIsRegistered = true;
}
else if (name == "radioactive_decay" && !radioactiveDecayIsRegistered )
{
hadronPhys.push_back(new G4RadioactiveDecayPhysics());
radioactiveDecayIsRegistered = true;
// The following is the construction of the QGSP_BIC_EMY Reference physics list
// reconstructed here like a builder: it should be identical to the
// one contained inside the $G4INSTALL/physics_lists/lists folder
}
else if (name == "QGSP_BIC_EMY")
{
AddPhysicsList("emstandard_opt3");
hadronPhys.push_back( new G4EmExtraPhysics());
hadronPhys.push_back( new G4HadronElasticPhysics());
hadronPhys.push_back( new G4QStoppingPhysics());
hadronPhys.push_back( new G4IonBinaryCascadePhysics());
hadronPhys.push_back( new G4NeutronTrackingCut());
hadronPhys.push_back( new HadronPhysicsQGSP_BIC());
hadronPhys.push_back( new G4DecayPhysics());
}
else {
G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
<< " is not defined"
<< G4endl;
}
}
/////////////////////////////////////////////////////////////////////////////
void IORTPhysicsList::AddStepMax()
{
// Step limitation seen as a process
stepMaxProcess = new IORTStepMax();
theParticleIterator->reset();
while ((*theParticleIterator)()){
G4ParticleDefinition* particle = theParticleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
if (stepMaxProcess->IsApplicable(*particle) && pmanager)
{
pmanager ->AddDiscreteProcess(stepMaxProcess);
}
}
}
/////////////////////////////////////////////////////////////////////////////
void IORTPhysicsList::SetCuts()
{
if (verboseLevel >0){
G4cout << "PhysicsList::SetCuts:";
G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl;
}
// set cut values for gamma at first and for e- second and next for e+,
// because some processes for e+/e- need cut values for gamma
SetCutValue(cutForGamma, "gamma");
SetCutValue(cutForElectron, "e-");
SetCutValue(cutForPositron, "e+");
// Set cuts for detector
SetDetectorCut(defaultCutValue);
if (verboseLevel>0) DumpCutValuesTable();
}
/////////////////////////////////////////////////////////////////////////////
void IORTPhysicsList::SetCutForGamma(G4double cut)
{
cutForGamma = cut;
SetParticleCuts(cutForGamma, G4Gamma::Gamma());
}
/////////////////////////////////////////////////////////////////////////////
void IORTPhysicsList::SetCutForElectron(G4double cut)
{
cutForElectron = cut;
SetParticleCuts(cutForElectron, G4Electron::Electron());
}
/////////////////////////////////////////////////////////////////////////////
void IORTPhysicsList::SetCutForPositron(G4double cut)
{
cutForPositron = cut;
SetParticleCuts(cutForPositron, G4Positron::Positron());
}
void IORTPhysicsList::SetDetectorCut(G4double cut)
{
G4String regionName = "DetectorLog";
G4Region* region = G4RegionStore::GetInstance()->GetRegion(regionName);
G4ProductionCuts* cuts = new G4ProductionCuts ;
cuts -> SetProductionCut(cut,G4ProductionCuts::GetIndex("gamma"));
cuts -> SetProductionCut(cut,G4ProductionCuts::GetIndex("e-"));
cuts -> SetProductionCut(cut,G4ProductionCuts::GetIndex("e+"));
region -> SetProductionCuts(cuts);
}
@@ -0,0 +1,135 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// This is the *BASIC* version of IORT, a Geant4-based application
//
// Main Authors: G.Russo(a,b), C.Casarino*(c), G.C. Candiano(c), G.A.P. Cirrone(d), F.Romano(d)
// Contributor Authors: S.Guatelli(e)
// Past Authors: G.Arnetta(c), S.E.Mazzaglia(d)
//
// (a) Fondazione Istituto San Raffaele G.Giglio, Cefalù, Italy
// (b) IBFM-CNR , Segrate (Milano), Italy
// (c) LATO (Laboratorio di Tecnologie Oncologiche), Cefalù, Italy
// (d) Laboratori Nazionali del Sud of the INFN, Catania, Italy
// (e) University of Wallongong, Australia
//
// *Corresponding author, email to carlo.casarino@polooncologicocefalu.it
//////////////////////////////////////////////////////////////////////////////////////////////
#include "IORTPhysicsListMessenger.hh"
#include "IORTPhysicsList.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithAString.hh"
/////////////////////////////////////////////////////////////////////////////
IORTPhysicsListMessenger::IORTPhysicsListMessenger(IORTPhysicsList* pPhys)
:pPhysicsList(pPhys)
{
physDir = new G4UIdirectory("/Physics/");
physDir->SetGuidance("Commands to activate physics models and set cuts");
gammaCutCmd = new G4UIcmdWithADoubleAndUnit("/Physics/setGCut",this);
gammaCutCmd->SetGuidance("Set gamma cut.");
gammaCutCmd->SetParameterName("Gcut",false);
gammaCutCmd->SetUnitCategory("Length");
gammaCutCmd->SetRange("Gcut>0.0");
gammaCutCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
electCutCmd = new G4UIcmdWithADoubleAndUnit("/Physics/setECut",this);
electCutCmd->SetGuidance("Set electron cut.");
electCutCmd->SetParameterName("Ecut",false);
electCutCmd->SetUnitCategory("Length");
electCutCmd->SetRange("Ecut>0.0");
electCutCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
protoCutCmd = new G4UIcmdWithADoubleAndUnit("/Physics/setPCut",this);
protoCutCmd->SetGuidance("Set positron cut.");
protoCutCmd->SetParameterName("Pcut",false);
protoCutCmd->SetUnitCategory("Length");
protoCutCmd->SetRange("Pcut>0.0");
protoCutCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
allCutCmd = new G4UIcmdWithADoubleAndUnit("/Physics/setCuts",this);
allCutCmd->SetGuidance("Set cut for all.");
allCutCmd->SetParameterName("cut",false);
allCutCmd->SetUnitCategory("Length");
allCutCmd->SetRange("cut>0.0");
allCutCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
allDetectorCmd = new G4UIcmdWithADoubleAndUnit("/Physics/setDetectorCuts",this);
allDetectorCmd->SetGuidance("Set cut for all. into Detector");
allDetectorCmd->SetParameterName("cut",false);
allDetectorCmd->SetUnitCategory("Length");
allDetectorCmd->SetRange("cut>0.0");
allDetectorCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
pListCmd = new G4UIcmdWithAString("/Physics/addPhysics",this);
pListCmd->SetGuidance("Add physics list.");
pListCmd->SetParameterName("PList",false);
pListCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
}
/////////////////////////////////////////////////////////////////////////////
IORTPhysicsListMessenger::~IORTPhysicsListMessenger()
{
delete gammaCutCmd;
delete electCutCmd;
delete protoCutCmd;
delete allCutCmd;
delete allDetectorCmd;
delete pListCmd;
delete physDir;
}
/////////////////////////////////////////////////////////////////////////////
void IORTPhysicsListMessenger::SetNewValue(G4UIcommand* command,
G4String newValue)
{
if( command == gammaCutCmd )
{ pPhysicsList->SetCutForGamma(gammaCutCmd->GetNewDoubleValue(newValue));}
else if( command == electCutCmd )
{ pPhysicsList->SetCutForElectron(electCutCmd->GetNewDoubleValue(newValue));}
else if( command == protoCutCmd )
{ pPhysicsList->SetCutForPositron(protoCutCmd->GetNewDoubleValue(newValue));}
else if( command == allCutCmd )
{
G4double cut = allCutCmd->GetNewDoubleValue(newValue);
pPhysicsList->SetCutForGamma(cut);
pPhysicsList->SetCutForElectron(cut);
pPhysicsList->SetCutForPositron(cut);
}
else if( command == allDetectorCmd)
{
G4double cut = allDetectorCmd -> GetNewDoubleValue(newValue);
pPhysicsList -> SetDetectorCut(cut);
}
else if( command == pListCmd )
{ pPhysicsList->AddPhysicsList(newValue);}
}
@@ -0,0 +1,267 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// This is the *BASIC* version of IORT, a Geant4-based application
//
// Main Authors: G.Russo(a,b), C.Casarino*(c), G.C. Candiano(c), G.A.P. Cirrone(d), F.Romano(d)
// Contributor Authors: S.Guatelli(e)
// Past Authors: G.Arnetta(c), S.E.Mazzaglia(d)
//
// (a) Fondazione Istituto San Raffaele G.Giglio, Cefalù, Italy
// (b) IBFM-CNR , Segrate (Milano), Italy
// (c) LATO (Laboratorio di Tecnologie Oncologiche), Cefalù, Italy
// (d) Laboratori Nazionali del Sud of the INFN, Catania, Italy
// (e) University of Wallongong, Australia
//
// *Corresponding author, email to carlo.casarino@polooncologicocefalu.it
//////////////////////////////////////////////////////////////////////////////////////////////
#include "IORTPrimaryGeneratorAction.hh"
#include "IORTPrimaryGeneratorMessenger.hh"
#include "G4Event.hh"
#include "G4ParticleGun.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "Randomize.hh"
#include "IORTAnalysisManager.hh"
IORTPrimaryGeneratorAction::IORTPrimaryGeneratorAction()
{
// Define the messenger
gunMessenger = new IORTPrimaryGeneratorMessenger(this);
particleGun = new G4ParticleGun();
SetDefaultPrimaryParticle();
}
IORTPrimaryGeneratorAction::~IORTPrimaryGeneratorAction()
{
delete particleGun;
delete gunMessenger;
}
void IORTPrimaryGeneratorAction::SetDefaultPrimaryParticle()
{
// ****************************
// Default primary particle
// ****************************
// Define primary particles: electrons // protons
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
G4ParticleDefinition* particle = particleTable -> FindParticle("e-"); // ("proton")
particleGun -> SetParticleDefinition(particle);
// Define the energy of primary particles:
// gaussian distribution with mean energy = 10.0 *MeV
// and sigma = 400.0 *keV
G4double defaultMeanKineticEnergy = 10.0 *MeV;
meanKineticEnergy = defaultMeanKineticEnergy;
G4double defaultsigmaEnergy = 100.0 *keV;
sigmaEnergy = defaultsigmaEnergy;
#ifdef G4ANALYSIS_USE_ROOT
// Write these values into the analysis if needed. Have to be written separately on change.
IORTAnalysisManager::GetInstance()->setBeamMetaData(meanKineticEnergy, sigmaEnergy);
#endif
// Define the parameters of the initial position:
// the y, z coordinates have a gaussian distribution
G4double defaultX0 = -862.817 *mm;
X0 = defaultX0;
G4double defaultY0 = 0.0 *mm;
Y0 = defaultY0;
G4double defaultZ0 = 0.0 *mm;
Z0 = defaultZ0;
G4double defaultsigmaY = 1. *mm;
sigmaY = defaultsigmaY;
G4double defaultsigmaZ = 1. *mm;
sigmaZ = defaultsigmaZ;
// Define the parameters of the momentum of primary particles:
// The momentum along the y and z axis has a gaussian distribution
/*
G4double defaultsigmaMomentumY = 0.0;
sigmaMomentumY = defaultsigmaMomentumY;
G4double defaultsigmaMomentumZ = 0.0;
sigmaMomentumZ = defaultsigmaMomentumZ;
*/
G4double defaultTheta = 6.0 *deg;
Theta = defaultTheta;
}
void IORTPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
#ifdef G4ANALYSIS_USE_ROOT
// Increment the event counter
IORTAnalysisManager::GetInstance()->startNewEvent();
#endif
// ****************************************
// Set the beam angular apread
// and spot size
// beam spot size
// ****************************************
// Set the position of the primary particles
G4double x = X0;
G4double y = Y0;
G4double z = Z0;
if ( sigmaY > 0.0 )
{
y += G4RandGauss::shoot( Y0, sigmaY );
}
if ( sigmaZ > 0.0 )
{
z += G4RandGauss::shoot( Z0, sigmaZ );
}
particleGun -> SetParticlePosition(G4ThreeVector( x , y , z ) );
// ********************************************
// Set the beam energy and energy spread
// ********************************************
G4double kineticEnergy = G4RandGauss::shoot( meanKineticEnergy, sigmaEnergy );
particleGun -> SetParticleEnergy ( kineticEnergy );
// Set the direction of the primary particles
/*
G4double momentumX = 1.0;
G4double momentumY = 0.0;
G4double momentumZ = 0.0;
if ( sigmaMomentumY > 0.0 )
{
momentumY += G4RandGauss::shoot( 0., sigmaMomentumY );
}
if ( sigmaMomentumZ > 0.0 )
{
momentumZ += G4RandGauss::shoot( 0., sigmaMomentumZ );
}
particleGun -> SetParticleMomentumDirection( G4ThreeVector(momentumX,momentumY,momentumZ) );
*/
G4double Mx;
G4double My;
G4double Mz;
G4double condizione;
while (true) {
Mx = CLHEP::RandFlat::shoot(0.9,1);
My = CLHEP::RandFlat::shoot(-0.1,0.1);
Mz = CLHEP::RandFlat::shoot(-0.1,0.1);
condizione = sqrt(Mx*Mx + My*My + Mz*Mz);
if (condizione < 1) {
Mx = Mx/condizione;
My = My/condizione;
Mz = Mz/condizione;
if (Mx > cos(Theta)) {
break;
}
}
}
particleGun -> SetParticleMomentumDirection( G4ThreeVector(Mx,My,Mz) );
// Generate a primary particle
particleGun -> GeneratePrimaryVertex( anEvent );
}
void IORTPrimaryGeneratorAction::SetmeanKineticEnergy (G4double val )
{
meanKineticEnergy = val;
#ifdef G4ANALYSIS_USE_ROOT
// Update the beam-data in the analysis manager
IORTAnalysisManager::GetInstance()->setBeamMetaData(meanKineticEnergy, sigmaEnergy);
#endif
}
void IORTPrimaryGeneratorAction::SetsigmaEnergy (G4double val )
{
sigmaEnergy = val;
#ifdef G4ANALYSIS_USE_ROOT
// Update the sigmaenergy in the metadata.
IORTAnalysisManager::GetInstance()->setBeamMetaData(meanKineticEnergy, sigmaEnergy);
#endif
}
void IORTPrimaryGeneratorAction::SetXposition (G4double val )
{ X0 = val;}
void IORTPrimaryGeneratorAction::SetYposition (G4double val )
{ Y0 = val;}
void IORTPrimaryGeneratorAction::SetZposition (G4double val )
{ Z0 = val;}
void IORTPrimaryGeneratorAction::SetsigmaY (G4double val )
{ sigmaY = val;}
void IORTPrimaryGeneratorAction::SetsigmaZ (G4double val )
{ sigmaZ = val;}
/*
void IORTPrimaryGeneratorAction::SetsigmaMomentumY (G4double val )
{ sigmaMomentumY = val;}
void IORTPrimaryGeneratorAction::SetsigmaMomentumZ (G4double val )
{ sigmaMomentumZ = val;}
*/
void IORTPrimaryGeneratorAction::SetTheta (G4double val )
{ Theta = val;}
G4double IORTPrimaryGeneratorAction::GetmeanKineticEnergy(void)
{ return meanKineticEnergy;}
@@ -0,0 +1,200 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// This is the *BASIC* version of IORT, a Geant4-based application
//
// Main Authors: G.Russo(a,b), C.Casarino*(c), G.C. Candiano(c), G.A.P. Cirrone(d), F.Romano(d)
// Contributor Authors: S.Guatelli(e)
// Past Authors: G.Arnetta(c), S.E.Mazzaglia(d)
//
// (a) Fondazione Istituto San Raffaele G.Giglio, Cefalù, Italy
// (b) IBFM-CNR , Segrate (Milano), Italy
// (c) LATO (Laboratorio di Tecnologie Oncologiche), Cefalù, Italy
// (d) Laboratori Nazionali del Sud of the INFN, Catania, Italy
// (e) University of Wallongong, Australia
//
// *Corresponding author, email to carlo.casarino@polooncologicocefalu.it
//////////////////////////////////////////////////////////////////////////////////////////////
#include "IORTPrimaryGeneratorMessenger.hh"
#include "IORTPrimaryGeneratorAction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithADouble.hh"
IORTPrimaryGeneratorMessenger::IORTPrimaryGeneratorMessenger(
IORTPrimaryGeneratorAction* IORTGun)
:IORTAction(IORTGun)
{
//
// Definition of the interactive commands to modify the parameters of the
// generation of primary particles
//
beamParametersDir = new G4UIdirectory("/beam/");
beamParametersDir -> SetGuidance("set parameters of beam");
EnergyDir = new G4UIdirectory("/beam/energy/");
EnergyDir -> SetGuidance ("set energy of beam");
particlePositionDir = new G4UIdirectory("/beam/position/");
particlePositionDir -> SetGuidance ("set position of particle");
MomentumDir = new G4UIdirectory("/beam/momentum/");
MomentumDir -> SetGuidance ("set momentum of particle ");
ThetaCmd = new G4UIcmdWithADoubleAndUnit("/beam/momentum/Theta",this);
ThetaCmd -> SetGuidance("set Theta");
ThetaCmd -> SetParameterName("Theta",false);
ThetaCmd -> SetDefaultUnit("deg");
ThetaCmd -> SetUnitCandidates("deg rad");
ThetaCmd -> AvailableForStates(G4State_PreInit,G4State_Idle);
/*
sigmaMomentumYCmd = new G4UIcmdWithADouble("/beam/momentum/sigmaY",this);
sigmaMomentumYCmd -> SetGuidance("set sigma momentum y");
sigmaMomentumYCmd -> SetParameterName("momentum",false);
sigmaMomentumYCmd -> AvailableForStates(G4State_PreInit,G4State_Idle);
sigmaMomentumZCmd = new G4UIcmdWithADouble("/beam/momentum/sigmaZ",this);
sigmaMomentumZCmd -> SetGuidance("set sigma momentum z");
sigmaMomentumZCmd -> SetParameterName("momentum",false);
sigmaMomentumZCmd -> AvailableForStates(G4State_PreInit,G4State_Idle);
*/
meanKineticEnergyCmd = new G4UIcmdWithADoubleAndUnit("/beam/energy/meanEnergy",this);
meanKineticEnergyCmd -> SetGuidance("set mean Kinetic energy");
meanKineticEnergyCmd -> SetParameterName("Energy",false);
meanKineticEnergyCmd -> SetDefaultUnit("MeV");
meanKineticEnergyCmd -> SetUnitCandidates("eV keV MeV GeV TeV");
meanKineticEnergyCmd -> AvailableForStates(G4State_PreInit,G4State_Idle);
sigmaEnergyCmd = new G4UIcmdWithADoubleAndUnit("/beam/energy/sigmaEnergy",this);
sigmaEnergyCmd -> SetGuidance("set sigma energy");
sigmaEnergyCmd -> SetParameterName("Energy",false);
sigmaEnergyCmd -> SetDefaultUnit("keV");
sigmaEnergyCmd -> SetUnitCandidates("eV keV MeV GeV TeV");
sigmaEnergyCmd -> AvailableForStates(G4State_PreInit,G4State_Idle);
XpositionCmd = new G4UIcmdWithADoubleAndUnit("/beam/position/Xposition",this);
XpositionCmd -> SetGuidance("set x coordinate of particle");
XpositionCmd -> SetParameterName("position",false);
XpositionCmd -> SetDefaultUnit("mm");
XpositionCmd -> SetUnitCandidates("mm cm m");
XpositionCmd -> AvailableForStates(G4State_PreInit,G4State_Idle);
YpositionCmd = new G4UIcmdWithADoubleAndUnit("/beam/position/Yposition",this);
YpositionCmd -> SetGuidance("set y coordinate of particle");
YpositionCmd -> SetParameterName("position",false);
YpositionCmd -> SetDefaultUnit("mm");
YpositionCmd -> SetUnitCandidates("mm cm m");
YpositionCmd -> AvailableForStates(G4State_PreInit,G4State_Idle);
sigmaYCmd = new G4UIcmdWithADoubleAndUnit("/beam/position/Yposition/sigmaY",this);
sigmaYCmd -> SetGuidance("set sigma y");
sigmaYCmd -> SetParameterName("position",false);
sigmaYCmd -> SetDefaultUnit("mm");
sigmaYCmd -> SetUnitCandidates("mm cm m");
sigmaYCmd -> AvailableForStates(G4State_PreInit,G4State_Idle);
ZpositionCmd = new G4UIcmdWithADoubleAndUnit("/beam/position/Zposition",this);
ZpositionCmd -> SetGuidance("set z coordinate of particle");
ZpositionCmd -> SetParameterName("position",false);
ZpositionCmd -> SetDefaultUnit("mm");
ZpositionCmd -> SetUnitCandidates("mm cm m");
ZpositionCmd -> AvailableForStates(G4State_PreInit,G4State_Idle);
sigmaZCmd = new G4UIcmdWithADoubleAndUnit("/beam/position/Zposition/sigmaZ",this);
sigmaZCmd -> SetGuidance("set sigma z");
sigmaZCmd -> SetParameterName("position",false);
sigmaZCmd -> SetDefaultUnit("mm");
sigmaZCmd -> SetUnitCandidates("mm cm m");
sigmaZCmd -> AvailableForStates(G4State_PreInit,G4State_Idle);
}
IORTPrimaryGeneratorMessenger::~IORTPrimaryGeneratorMessenger()
{
delete beamParametersDir;
delete EnergyDir;
delete meanKineticEnergyCmd;
delete sigmaEnergyCmd;
delete particlePositionDir;
delete MomentumDir;
delete XpositionCmd;
delete YpositionCmd;
delete ZpositionCmd;
delete sigmaYCmd;
delete sigmaZCmd;
delete ThetaCmd;
// delete sigmaMomentumYCmd;
// delete sigmaMomentumZCmd;
}
void IORTPrimaryGeneratorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
{
if ( command == meanKineticEnergyCmd )
{ IORTAction -> SetmeanKineticEnergy(meanKineticEnergyCmd
-> GetNewDoubleValue(newValue));}
if ( command == sigmaEnergyCmd )
{ IORTAction -> SetsigmaEnergy(sigmaEnergyCmd
-> GetNewDoubleValue(newValue));}
if ( command == XpositionCmd )
{ IORTAction -> SetXposition(XpositionCmd
-> GetNewDoubleValue(newValue));}
if ( command == YpositionCmd )
{ IORTAction -> SetYposition(YpositionCmd
-> GetNewDoubleValue(newValue));}
if ( command == ZpositionCmd )
{ IORTAction -> SetZposition(ZpositionCmd
-> GetNewDoubleValue(newValue));}
if ( command == sigmaYCmd )
{ IORTAction -> SetsigmaY(sigmaYCmd
-> GetNewDoubleValue(newValue));}
if ( command == sigmaZCmd )
{ IORTAction -> SetsigmaZ(sigmaZCmd
-> GetNewDoubleValue(newValue));}
if ( command == ThetaCmd )
{ IORTAction -> SetTheta(ThetaCmd
-> GetNewDoubleValue(newValue));}
/*
if ( command == sigmaMomentumYCmd )
{ IORTAction -> SetsigmaMomentumY(sigmaMomentumYCmd
-> GetNewDoubleValue(newValue));}
if ( command == sigmaMomentumZCmd )
{ IORTAction -> SetsigmaMomentumZ(sigmaMomentumZCmd
-> GetNewDoubleValue(newValue));}
*/
}
@@ -0,0 +1,89 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// This is the *BASIC* version of IORT, a Geant4-based application
//
// Main Authors: G.Russo(a,b), C.Casarino*(c), G.C. Candiano(c), G.A.P. Cirrone(d), F.Romano(d)
// Contributor Authors: S.Guatelli(e)
// Past Authors: G.Arnetta(c), S.E.Mazzaglia(d)
//
// (a) Fondazione Istituto San Raffaele G.Giglio, Cefalù, Italy
// (b) IBFM-CNR , Segrate (Milano), Italy
// (c) LATO (Laboratorio di Tecnologie Oncologiche), Cefalù, Italy
// (d) Laboratori Nazionali del Sud of the INFN, Catania, Italy
// (e) University of Wallongong, Australia
//
// *Corresponding author, email to carlo.casarino@polooncologicocefalu.it
//////////////////////////////////////////////////////////////////////////////////////////////
#include "IORTRunAction.hh"
#include "IORTEventAction.hh"
#include "G4Run.hh"
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "G4ios.hh"
#include "IORTDetectorConstruction.hh"
#include "G4SDManager.hh"
#include "G4Timer.hh"
#include "IORTRunAction.hh"
#include "IORTAnalysisManager.hh"
#include "IORTMatrix.hh"
IORTRunAction::IORTRunAction()
{
}
IORTRunAction::~IORTRunAction()
{
}
void IORTRunAction::BeginOfRunAction(const G4Run* aRun)
{
G4RunManager::GetRunManager()-> SetRandomNumberStore(true);
G4cout << "Run " << aRun -> GetRunID() << " starts ..." << G4endl;
electromagnetic = 0;
hadronic = 0;
}
void IORTRunAction::EndOfRunAction(const G4Run*)
{
//G4cout << " Summary of Run " << aRun -> GetRunID() <<" :"<< G4endl;
//G4cout << "Number of electromagnetic processes of primary particles in the phantom:"
// << electromagnetic << G4endl;
//G4cout << "Number of hadronic processes of primary particles in the phantom:"
// << hadronic << G4endl;
}
void IORTRunAction::AddEMProcess()
{
electromagnetic += 1;
}
void IORTRunAction::AddHadronicProcess()
{
hadronic += 1;
}
@@ -0,0 +1,98 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// This is the *BASIC* version of IORT, a Geant4-based application
//
// Main Authors: G.Russo(a,b), C.Casarino*(c), G.C. Candiano(c), G.A.P. Cirrone(d), F.Romano(d)
// Contributor Authors: S.Guatelli(e)
// Past Authors: G.Arnetta(c), S.E.Mazzaglia(d)
//
// (a) Fondazione Istituto San Raffaele G.Giglio, Cefalù, Italy
// (b) IBFM-CNR , Segrate (Milano), Italy
// (c) LATO (Laboratorio di Tecnologie Oncologiche), Cefalù, Italy
// (d) Laboratori Nazionali del Sud of the INFN, Catania, Italy
// (e) University of Wallongong, Australia
//
// *Corresponding author, email to carlo.casarino@polooncologicocefalu.it
//////////////////////////////////////////////////////////////////////////////////////////////
#include "IORTStepMax.hh"
#include "IORTStepMaxMessenger.hh"
/////////////////////////////////////////////////////////////////////////////
IORTStepMax::IORTStepMax(const G4String& processName)
: G4VDiscreteProcess(processName),MaxChargedStep(DBL_MAX)
{
pMess = new IORTStepMaxMessenger(this);
}
/////////////////////////////////////////////////////////////////////////////
IORTStepMax::~IORTStepMax() { delete pMess; }
/////////////////////////////////////////////////////////////////////////////
G4bool IORTStepMax::IsApplicable(const G4ParticleDefinition& particle)
{
return (particle.GetPDGCharge() != 0.);
}
/////////////////////////////////////////////////////////////////////////////
void IORTStepMax::SetMaxStep(G4double step) {MaxChargedStep = step;}
/////////////////////////////////////////////////////////////////////////////
G4double IORTStepMax::PostStepGetPhysicalInteractionLength(const G4Track& aTrack,
G4double,
G4ForceCondition* condition )
{
// condition is set to "Not Forced"
*condition = NotForced;
G4double ProposedStep = DBL_MAX;
if((MaxChargedStep > 0.) &&
(aTrack.GetVolume() != 0) &&
(aTrack.GetVolume()->GetName() == "DetectorPhys"))
ProposedStep = MaxChargedStep;
/* IMPORTED FROM eliot_geant4.9.3p01_version
if((MaxChargedStep > 0.) && // ATTENZIONE 1) CI POSSONO ESSERE + DI 2 DISCHI
(aTrack.GetVolume() != 0) && // ATTENZIONE 2) ANCORA NON HO INSERITO I DISCHI CHE ANDREBBERO NEL PASSPROTONBL
(aTrack.GetVolume()->GetName() == "DiscoIORTPhys"))
ProposedStep = MaxChargedStep;
if((MaxChargedStep > 0.) &&
(aTrack.GetVolume() != 0) &&
(aTrack.GetVolume()->GetName() == "DiscoIORTPhys1"))
ProposedStep = MaxChargedStep;
*/
return ProposedStep;
}
/////////////////////////////////////////////////////////////////////////////
G4VParticleChange* IORTStepMax::PostStepDoIt(const G4Track& aTrack, const G4Step&)
{
// do nothing
aParticleChange.Initialize(aTrack);
return &aParticleChange;
}
@@ -0,0 +1,68 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// This is the *BASIC* version of IORT, a Geant4-based application
//
// Main Authors: G.Russo(a,b), C.Casarino*(c), G.C. Candiano(c), G.A.P. Cirrone(d), F.Romano(d)
// Contributor Authors: S.Guatelli(e)
// Past Authors: G.Arnetta(c), S.E.Mazzaglia(d)
//
// (a) Fondazione Istituto San Raffaele G.Giglio, Cefalù, Italy
// (b) IBFM-CNR , Segrate (Milano), Italy
// (c) LATO (Laboratorio di Tecnologie Oncologiche), Cefalù, Italy
// (d) Laboratori Nazionali del Sud of the INFN, Catania, Italy
// (e) University of Wallongong, Australia
//
// *Corresponding author, email to carlo.casarino@polooncologicocefalu.it
//////////////////////////////////////////////////////////////////////////////////////////////
#include "IORTStepMaxMessenger.hh"
#include "IORTStepMax.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
/////////////////////////////////////////////////////////////////////////////
IORTStepMaxMessenger::IORTStepMaxMessenger(IORTStepMax* stepM)
:stepMax(stepM)
{
StepMaxCmd = new G4UIcmdWithADoubleAndUnit("/Step/waterPhantomStepMax",this);
StepMaxCmd->SetGuidance("Set max allowed step length");
StepMaxCmd->SetParameterName("mxStep",false);
StepMaxCmd->SetRange("mxStep>0.");
StepMaxCmd->SetUnitCategory("Length");
}
/////////////////////////////////////////////////////////////////////////////
IORTStepMaxMessenger::~IORTStepMaxMessenger()
{
delete StepMaxCmd;
}
/////////////////////////////////////////////////////////////////////////////
void IORTStepMaxMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
{
if (command == StepMaxCmd)
{ stepMax->SetMaxStep(StepMaxCmd->GetNewDoubleValue(newValue));}
}
@@ -0,0 +1,218 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// This is the *BASIC* version of IORT, a Geant4-based application
//
// Main Authors: G.Russo(a,b), C.Casarino*(c), G.C. Candiano(c), G.A.P. Cirrone(d), F.Romano(d)
// Contributor Authors: S.Guatelli(e)
// Past Authors: G.Arnetta(c), S.E.Mazzaglia(d)
//
// (a) Fondazione Istituto San Raffaele G.Giglio, Cefalù, Italy
// (b) IBFM-CNR , Segrate (Milano), Italy
// (c) LATO (Laboratorio di Tecnologie Oncologiche), Cefalù, Italy
// (d) Laboratori Nazionali del Sud of the INFN, Catania, Italy
// (e) University of Wallongong, Australia
//
// *Corresponding author, email to carlo.casarino@polooncologicocefalu.it
//////////////////////////////////////////////////////////////////////////////////////////////
#include "G4SteppingManager.hh"
#include "G4TrackVector.hh"
#include "IORTSteppingAction.hh"
#include "G4ios.hh"
#include "G4SteppingManager.hh"
#include "G4Track.hh"
#include "G4Step.hh"
#include "G4StepPoint.hh"
#include "G4TrackStatus.hh"
#include "G4TrackVector.hh"
#include "G4ParticleDefinition.hh"
#include "G4ParticleTypes.hh"
#include "G4UserEventAction.hh" // NOT INCLUDED IN geant4.9.3p01_version
#include "IORTAnalysisManager.hh"
#include "IORTRunAction.hh"
/////////////////////////////////////////////////////////////////////////////
IORTSteppingAction::IORTSteppingAction( IORTRunAction *run)
{
runAction = run;
}
/////////////////////////////////////////////////////////////////////////////
IORTSteppingAction::~IORTSteppingAction()
{
}
/////////////////////////////////////////////////////////////////////////////
void IORTSteppingAction::UserSteppingAction(const G4Step* aStep)
{
/*
// USEFULL METHODS TO RETRIEVE INFORMATION DURING THE STEPS
if( (aStep->GetTrack()->GetVolume()->GetName() == "DetectorPhys")
&& aStep->GetTrack()->GetDefinition()->GetParticleName() == "proton")
//G4int evtNb = G4RunManager::GetRunManager()->GetCurrentEvent() -> GetEventID();
{
G4cout << "ENERGIA: " << aStep->GetTrack()->GetKineticEnergy()
<< " VOLUME " << aStep->GetTrack()->GetVolume()->GetName()
<< " MATERIALE " << aStep -> GetTrack() -> GetMaterial() -> GetName()
<< " EVENTO " << G4RunManager::GetRunManager()->GetCurrentEvent() -> GetEventID()
<< " POS " << aStep->GetTrack()->GetPosition().x()
<< G4endl;
}
*/
if( aStep->GetTrack()->GetVolume()->GetName() == "NewDetectorPhys"){
#ifdef G4ANALYSIS_USE_ROOT
G4ParticleDefinition *def = aStep->GetTrack()->GetDefinition();
G4double secondaryParticleKineticEnergy = aStep->GetTrack()->GetKineticEnergy();
G4String particleType = def->GetParticleType(); // particle type = nucleus for d, t, He3, alpha, and heavier nuclei
G4String particleName = def->GetParticleName(); // e.g. for alpha: the name = "alpha" and type = "nucleus"
if(particleType == "nucleus") {
G4int A = def->GetBaryonNumber();
G4double Z = def->GetPDGCharge();
G4double posX = aStep->GetTrack()->GetPosition().x() / cm;
G4double posY = aStep->GetTrack()->GetPosition().y() / cm;
G4double posZ = aStep->GetTrack()->GetPosition().z() / cm;
G4double energy = secondaryParticleKineticEnergy / A / MeV;
IORTAnalysisManager* analysisMgr = IORTAnalysisManager::GetInstance();
analysisMgr->FillFragmentTuple(A, Z, energy, posX, posY, posZ);
} else if(particleName == "proton") { // proton (hydrogen-1) is a special case
G4double posX = aStep->GetTrack()->GetPosition().x() / cm ;
G4double posY = aStep->GetTrack()->GetPosition().y() / cm ;
G4double posZ = aStep->GetTrack()->GetPosition().z() / cm ;
G4double energy = secondaryParticleKineticEnergy * MeV; // Hydrogen-1: A = 1, Z = 1
IORTAnalysisManager::GetInstance()->FillFragmentTuple(1, 1.0, energy, posX, posY, posZ);
}
G4String secondaryParticleName = def -> GetParticleName();
//G4cout <<"Particle: " << secondaryParticleName << G4endl;
//G4cout <<"Energy: " << secondaryParticleKineticEnergy << G4endl;
IORTAnalysisManager* analysis = IORTAnalysisManager::GetInstance();
//There is a bunch of stuff recorded with the energy 0, something should perhaps be done about this.
if(secondaryParticleName == "proton") {
analysis->hydrogenEnergy(secondaryParticleKineticEnergy / MeV);
}
if(secondaryParticleName == "deuteron") {
analysis->hydrogenEnergy((secondaryParticleKineticEnergy/2) / MeV);
}
if(secondaryParticleName == "triton") {
analysis->hydrogenEnergy((secondaryParticleKineticEnergy/3) / MeV);
}
if(secondaryParticleName == "alpha") {
analysis->heliumEnergy((secondaryParticleKineticEnergy/4) / MeV);
}
if(secondaryParticleName == "He3"){
analysis->heliumEnergy((secondaryParticleKineticEnergy/3) / MeV);
}
#endif
aStep->GetTrack()->SetTrackStatus(fKillTrackAndSecondaries);
}
// Electromagnetic and hadronic processes of primary particles in the phantom
//setting phantomPhys correctly will break something here fixme
if ((aStep -> GetTrack() -> GetTrackID() == 1) &&
(aStep -> GetTrack() -> GetVolume() -> GetName() == "PhantomPhys") &&
(aStep -> GetPostStepPoint() -> GetProcessDefinedStep() != NULL))
{
G4String process = aStep -> GetPostStepPoint() ->
GetProcessDefinedStep() -> GetProcessName();
if ((process == "Transportation") || (process == "StepLimiter")) {;}
else
{
if ((process == "msc") || (process == "hLowEIoni") || (process == "hIoni"))
{
runAction -> AddEMProcess();
}
else
{
runAction -> AddHadronicProcess();
if ( (process != "LElastic") && (process != "ProtonInelastic") && (process != "hElastic") )
G4cout << "Warning! Unknown proton process: "<< process << G4endl;
}
}
}
// Retrieve information about the secondary particles originated in the phantom
G4SteppingManager* steppingManager = fpSteppingManager;
// check if it is alive
//if(theTrack-> GetTrackStatus() == fAlive) { return; }
// Retrieve the secondary particles
G4TrackVector* fSecondary = steppingManager -> GetfSecondary();
for(size_t lp1=0;lp1<(*fSecondary).size(); lp1++)
{
G4String volumeName = (*fSecondary)[lp1] -> GetVolume() -> GetName();
if (volumeName == "phantomPhys")
{
#ifdef G4ANALYSIS_USE_ROOT
G4String secondaryParticleName = (*fSecondary)[lp1]->GetDefinition() -> GetParticleName();
G4double secondaryParticleKineticEnergy = (*fSecondary)[lp1] -> GetKineticEnergy();
IORTAnalysisManager* analysis = IORTAnalysisManager::GetInstance();
if (secondaryParticleName == "e-")
analysis -> electronEnergyDistribution(secondaryParticleKineticEnergy/MeV);
if (secondaryParticleName == "gamma")
analysis -> gammaEnergyDistribution(secondaryParticleKineticEnergy/MeV);
if (secondaryParticleName == "deuteron")
analysis -> deuteronEnergyDistribution(secondaryParticleKineticEnergy/MeV);
if (secondaryParticleName == "triton")
analysis -> tritonEnergyDistribution(secondaryParticleKineticEnergy/MeV);
if (secondaryParticleName == "alpha")
analysis -> alphaEnergyDistribution(secondaryParticleKineticEnergy/MeV);
G4double z = (*fSecondary)[lp1]-> GetDynamicParticle() -> GetDefinition() -> GetPDGCharge();
if (z > 0.)
{
G4int a = (*fSecondary)[lp1]-> GetDynamicParticle() -> GetDefinition() -> GetBaryonNumber();
G4int electronOccupancy = (*fSecondary)[lp1] -> GetDynamicParticle() -> GetTotalOccupancy();
// If a generic ion is originated in the detector, its baryonic number, PDG charge,
// total number of electrons in the orbitals are stored in a ntuple
analysis -> genericIonInformation(a, z, electronOccupancy, secondaryParticleKineticEnergy/MeV);
}
#endif
}
}
}