Import Geant4 9.3.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 16:15:05 +02:00
parent b79225fb37
commit 74cad5e589
3877 changed files with 234205 additions and 167127 deletions
@@ -1,86 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// $Id: HadrontherapyElectronEEDL.cc; Last by G.A.P.Cirrone September 2008
// ----------------------------------------------------------------------------
// GEANT 4 - Hadrontherapy example
// ----------------------------------------------------------------------------
// Code developed by:
//
// G.A.P. Cirrone(a)*, G. Candiano, F. Di Rosa(a), S. Guatelli(b), G. Russo(a)
//
// (a) Laboratori Nazionali del Sud
// of the National Institute for Nuclear Physics, Catania, Italy
// (b) National Institute for Nuclear Physics Section of Genova, genova, Italy
//
// * cirrone@lns.infn.it
// --------------------------------------------------------------
#include "EMElectronEEDL.hh"
#include "G4ProcessManager.hh"
#include "G4ParticleDefinition.hh"
#include "G4MultipleScattering.hh"
#include "G4LowEnergyIonisation.hh"
#include "G4LowEnergyBremsstrahlung.hh"
#include "G4StepLimiter.hh"
EMElectronEEDL::EMElectronEEDL(const G4String& name):
G4VPhysicsConstructor(name)
{
G4cout<< "ELECTROMAGNETIC PROCESS(ES): G4MultipleScattering (electron)"
<< G4endl
<< " G4LowEnergyIonisation (electron)"
<< G4endl
<< " G4LowEnergyBremsstrahlung (electron)"
<< G4endl
<< "APPLIED MODEL(S): -"
<< G4endl;
}
EMElectronEEDL::~EMElectronEEDL()
{ }
void EMElectronEEDL::ConstructProcess()
{
// ****************
// *** Electron ***
// ****************
G4MultipleScattering* electronMultipScatProcess = new G4MultipleScattering();
G4LowEnergyIonisation* electronIonisationProcess = new G4LowEnergyIonisation();
G4LowEnergyBremsstrahlung* electronBremsstrProcess = new G4LowEnergyBremsstrahlung();
G4StepLimiter* electronStepLimiter = new G4StepLimiter();
G4ParticleDefinition* particle = G4Electron::Electron();
G4ProcessManager* processManager = particle -> GetProcessManager();
processManager -> AddProcess(electronMultipScatProcess, -1, 1, 1);
processManager -> AddProcess(electronIonisationProcess, -1, 2, 2);
processManager -> AddProcess(electronBremsstrProcess, -1, -1, 3);
processManager -> AddProcess(electronStepLimiter, -1, -1, 3);
}
@@ -1,86 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// $Id: HadrontherapyElectronPenelope.cc; May 2005
// ----------------------------------------------------------------------------
// GEANT 4 - Hadrontherapy example
// ----------------------------------------------------------------------------
// Code developed by:
//
// G.A.P. Cirrone(a)*, G. Candiano, F. Di Rosa(a), S. Guatelli(b), G. Russo(a)
//
// (a) Laboratori Nazionali del Sud
// of the National Institute for Nuclear Physics, Catania, Italy
// (b) National Institute for Nuclear Physics Section of Genova, genova, Italy
//
// * cirrone@lns.infn.it
// --------------------------------------------------------------
#include "EMElectronPenelope.hh"
#include "G4ProcessManager.hh"
#include "G4ParticleDefinition.hh"
#include "G4MultipleScattering.hh"
#include "G4PenelopeIonisation.hh"
#include "G4PenelopeBremsstrahlung.hh"
#include "G4StepLimiter.hh"
EMElectronPenelope::EMElectronPenelope(const G4String& name):
G4VPhysicsConstructor(name)
{
G4cout<< "ELECTROMAGNETIC PROCESS(ES): G4MultipleScattering (electron)"
<< G4endl
<< " G4PenelopeIonisation (electron)"
<< G4endl
<< " G4PenelopeBremsstrahlung (electron)"
<< G4endl
<< "APPLIED MODEL(S): -"
<< G4endl;
}
EMElectronPenelope::~EMElectronPenelope()
{ }
void EMElectronPenelope::ConstructProcess()
{
// ****************
// *** Electron ***
// ****************
G4MultipleScattering* electronMultipScatProcess = new G4MultipleScattering();
G4PenelopeIonisation* electronIonisationProcess = new G4PenelopeIonisation();
G4PenelopeBremsstrahlung* electronBremsstrProcess = new G4PenelopeBremsstrahlung();
G4StepLimiter* electronStepLimiter = new G4StepLimiter();
G4ParticleDefinition* particle = G4Electron::Electron();
G4ProcessManager* processManager = particle -> GetProcessManager();
processManager -> AddProcess(electronMultipScatProcess, -1, 1, 1);
processManager -> AddProcess(electronIonisationProcess, -1, 2, 2);
processManager -> AddProcess(electronBremsstrProcess, -1, -1, 3);
processManager -> AddProcess(electronStepLimiter, -1, -1, 3);
}
@@ -1,89 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
// $Id: EMElectronStandard.cc; Last by G.A.P.Cirrone September 2008
// ----------------------------------------------------------------------------
// GEANT 4 - Hadrontherapy example
// ----------------------------------------------------------------------------
// Code developed by:
//
// G.A.P. Cirrone(a)*, G. Candiano, F. Di Rosa(a), S. Guatelli(b), G. Russo(a)
//
// (a) Laboratori Nazionali del Sud
// of the National Institute for Nuclear Physics, Catania, Italy
// (b) National Institute for Nuclear Physics Section of Genova, genova, Italy
//
// * cirrone@lns.infn.it
//
// This class manages the electromagnetic processes for electrons
// using the Standard Models of Geant4
// --------------------------------------------------------------
#include "EMElectronStandard.hh"
#include "G4ProcessManager.hh"
#include "G4ParticleDefinition.hh"
#include "G4MultipleScattering.hh"
#include "G4eIonisation.hh"
#include "G4eBremsstrahlung.hh"
#include "G4StepLimiter.hh"
EMElectronStandard::EMElectronStandard(const G4String& name):
G4VPhysicsConstructor(name)
{
G4cout<< "ELECTROMAGNETIC PROCESS(ES): G4MultipleScattering (electron)"
<< G4endl
<< " G4eIonisation (electron)"
<< G4endl
<< " G4eBremsstrahlung (electron)"
<< G4endl
<< "APPLIED MODEL(S): -"
<< G4endl;
}
EMElectronStandard::~EMElectronStandard()
{ }
void EMElectronStandard::ConstructProcess()
{
// ****************
// *** Electron ***
// ****************
G4MultipleScattering* electronMultipScatProcess = new G4MultipleScattering();
G4eIonisation* electronIonisationProcess = new G4eIonisation();
G4eBremsstrahlung* electronBremsstrProcess = new G4eBremsstrahlung();
G4ParticleDefinition* particle = G4Electron::Electron();
G4ProcessManager* processManager = particle -> GetProcessManager();
processManager -> AddProcess(electronMultipScatProcess, -1, 1, 1);
processManager -> AddProcess(electronIonisationProcess, -1, 2, 2);
processManager -> AddProcess(electronBremsstrProcess, -1, 3, 3);
}
@@ -1,114 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// $Id: EMHadronIonLowEICRU49.cc;
// Last modified: A.Lechner (anton.lechner@cern.ch), August 2008;
//
// See more at: http://geant4infn.wikispaces.com
//
// ----------------------------------------------------------------------------
// GEANT 4 - Hadrontherapy example
// ----------------------------------------------------------------------------
// Code developed by:
//
// G.A.P. Cirrone(a)*, F. Di Rosa(a), S. Guatelli(b), G. Russo(a)
//
// (a) Laboratori Nazionali del Sud
// of the INFN, Catania, Italy
// (b) INFN Section of Genova, Genova, Italy
//
// * cirrone@lns.infn.it
// ----------------------------------------------------------------------------
#include "G4SDManager.hh"
#include "EMHadronIonLowEICRU49.hh"
#include "G4ProcessManager.hh"
#include "G4ParticleDefinition.hh"
#include "G4MultipleScattering.hh"
#include "G4hLowEnergyIonisation.hh"
#include "G4StepLimiter.hh"
EMHadronIonLowEICRU49::EMHadronIonLowEICRU49(const G4String& name):
G4VPhysicsConstructor(name)
{
G4cout<< "ELECTROMAGNETIC PROCESS(ES): G4MultipleScattering (ions and charged hadrons)"
<< G4endl
<< " G4hLowEnergyIonisation (ions and charged hadrons)"
<< G4endl
<< " (applying ICRU49 stopping power parametrisations)"
<< G4endl
<< "APPLIED MODEL(S): -"
<< G4endl;
}
EMHadronIonLowEICRU49::~EMHadronIonLowEICRU49()
{ }
void EMHadronIonLowEICRU49::ConstructProcess()
{
G4ParticleDefinition* particle = 0;
G4ProcessManager* processManager = 0;
// ********************************
// *** Charged Hadrons and Ions ***
// ********************************
theParticleIterator -> reset();
while( (*theParticleIterator)() )
{
particle = theParticleIterator -> value();
processManager = particle -> GetProcessManager();
G4String particleName = particle -> GetParticleName();
G4double charge = particle -> GetPDGCharge();
if (charge != 0.0 &&
particleName != "e+" &&
particleName != "mu+" &&
particleName != "e-" &&
particleName != "mu-")
{
if((!particle -> IsShortLived()) &&
(particle -> GetParticleName() != "chargedgeantino"))
{
G4MultipleScattering* hadronIonMultipleScatProcess = new G4MultipleScattering();
G4hLowEnergyIonisation* hadronIonIonisationProcess = new G4hLowEnergyIonisation();
hadronIonIonisationProcess -> SetNuclearStoppingOn();
G4StepLimiter* hadronIonStepLimiter = new G4StepLimiter();
processManager -> AddProcess(hadronIonMultipleScatProcess, -1, 1, 1);
processManager -> AddProcess(hadronIonIonisationProcess, -1, 2, 2);
processManager -> AddProcess(hadronIonStepLimiter, -1, -1, 3);
}
}
}
}
@@ -1,115 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// $Id: EMHadronIonLowEZiegler1977.cc
// Last modified: A.Lechner (anton.lechner@cern.ch), August 2008;
//
// See more at: http://geant4infn.wikispaces.com
//
// ----------------------------------------------------------------------------
// GEANT 4 - Hadrontherapy example
// ----------------------------------------------------------------------------
// Code developed by:
//
// G.A.P. Cirrone(a)*, F. Di Rosa(a), S. Guatelli(b), G. Russo(a)
//
// (a) Laboratori Nazionali del Sud
// of the INFN, Catania, Italy
// (b) INFN Section of Genova, Genova, Italy
//
// * cirrone@lns.infn.it
// ---------------------------------------------------
#include "EMHadronIonLowEZiegler1977.hh"
#include "G4ProcessManager.hh"
#include "G4ParticleDefinition.hh"
#include "G4MultipleScattering.hh"
#include "G4hLowEnergyIonisation.hh"
#include "G4StepLimiter.hh"
#include "G4hZiegler1977p.hh"
EMHadronIonLowEZiegler1977::EMHadronIonLowEZiegler1977(const G4String& name):
G4VPhysicsConstructor(name)
{
G4cout<< "ELECTROMAGNETIC PROCESS(ES): G4MultipleScattering (ions and charged hadrons)"
<< G4endl
<< " G4hLowEnergyIonisation (ions and charged hadrons)"
<< G4endl
<< " (applying Ziegler77 stopping power parametrisations)"
<< G4endl
<< "APPLIED MODEL(S): -"
<< G4endl;
}
EMHadronIonLowEZiegler1977::~EMHadronIonLowEZiegler1977()
{ }
void EMHadronIonLowEZiegler1977::ConstructProcess()
{
G4ParticleDefinition* particle = 0;
G4ProcessManager* processManager = 0;
// ********************************
// *** Charged Hadrons and Ions ***
// ********************************
theParticleIterator -> reset();
while( (*theParticleIterator)() )
{
particle = theParticleIterator -> value();
processManager = particle -> GetProcessManager();
G4String particleName = particle -> GetParticleName();
G4double charge = particle -> GetPDGCharge();
if (charge != 0.0 &&
particleName != "e+" &&
particleName != "mu+" &&
particleName != "e-" &&
particleName != "mu-")
{
if((!particle -> IsShortLived()) &&
(particle -> GetParticleName() != "chargedgeantino"))
{
G4MultipleScattering* hadronIonMultipleScatProcess = new G4MultipleScattering();
G4hLowEnergyIonisation* hadronIonIonisationProcess = new G4hLowEnergyIonisation();
hadronIonIonisationProcess -> SetElectronicStoppingPowerModel(particle, "Ziegler1977p");
hadronIonIonisationProcess -> SetNuclearStoppingPowerModel("Ziegler1977");
hadronIonIonisationProcess -> SetNuclearStoppingOn();
G4StepLimiter* hadronIonStepLimiter = new G4StepLimiter();
processManager -> AddProcess(hadronIonMultipleScatProcess, -1, 1, 1);
processManager -> AddProcess(hadronIonIonisationProcess, -1, 2, 2);
processManager -> AddProcess(hadronIonStepLimiter, -1, -1, 3);
}
}
}
}
@@ -1,116 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
// $Id: EMHadronIonLowEZiegler1985.cc;
// Last modified: A.Lechner (anton.lechner@cern.ch), August 2008;
//
// See more at: http://geant4infn.wikispaces.com
//
// ----------------------------------------------------------------------------
// GEANT 4 - Hadrontherapy example
// ----------------------------------------------------------------------------
// Code developed by:
//
// G.A.P. Cirrone(a)*, F. Di Rosa(a), S. Guatelli(b), G. Russo(a)
//
// (a) Laboratori Nazionali del Sud
// of the INFN, Catania, Italy
// (b) INFN Section of Genova, Genova, Italy
//
// * cirrone@lns.infn.it
// ----------------------------------------------------------------------------
#include "EMHadronIonLowEZiegler1985.hh"
#include "G4ProcessManager.hh"
#include "G4ParticleDefinition.hh"
#include "G4MultipleScattering.hh"
#include "G4hLowEnergyIonisation.hh"
#include "G4hIonisation.hh"
#include "G4StepLimiter.hh"
#include "G4hZiegler1985p.hh"
EMHadronIonLowEZiegler1985::EMHadronIonLowEZiegler1985(const G4String& name):
G4VPhysicsConstructor(name)
{
G4cout<< "ELECTROMAGNETIC PROCESS(ES): G4MultipleScattering (ions and charged hadrons)"
<< G4endl
<< " G4hLowEnergyIonisation (ions and charged hadrons)"
<< G4endl
<< " (applying Ziegler85 stopping power parametrisations)"
<< G4endl
<< "APPLIED MODEL(S): -"
<< G4endl;
}
EMHadronIonLowEZiegler1985::~EMHadronIonLowEZiegler1985()
{ }
void EMHadronIonLowEZiegler1985::ConstructProcess()
{
G4ParticleDefinition* particle = 0;
G4ProcessManager* processManager = 0;
// ********************************
// *** Charged Hadrons and Ions ***
// ********************************
theParticleIterator -> reset();
while( (*theParticleIterator)() )
{
particle = theParticleIterator -> value();
processManager = particle -> GetProcessManager();
G4String particleName = particle -> GetParticleName();
G4double charge = particle -> GetPDGCharge();
if (charge != 0.0 &&
particleName != "e+" &&
particleName != "mu+" &&
particleName != "e-" &&
particleName != "mu-")
{
if((!particle -> IsShortLived()) &&
(particle -> GetParticleName() != "chargedgeantino"))
{
G4MultipleScattering* hadronIonMultipleScatProcess = new G4MultipleScattering();
G4hLowEnergyIonisation* hadronIonIonisationProcess = new G4hLowEnergyIonisation();
hadronIonIonisationProcess -> SetElectronicStoppingPowerModel(particle, "Ziegler1985p");
hadronIonIonisationProcess -> SetNuclearStoppingPowerModel("Ziegler1985");
hadronIonIonisationProcess -> SetNuclearStoppingOn();
G4StepLimiter* hadronIonStepLimiter = new G4StepLimiter();
processManager -> AddProcess(hadronIonMultipleScatProcess, -1, 1, 1);
processManager -> AddProcess(hadronIonIonisationProcess, -1, 2, 2);
processManager -> AddProcess(hadronIonStepLimiter, -1, -1, 3);
}
}
}
}
@@ -1,107 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// $Id: EMIonStandard.cc; November 2008
// ----------------------------------------------------------------------------
// GEANT 4 - Hadrontherapy example
// ----------------------------------------------------------------------------
// Code developed by:
//
// G.A.P. Cirrone(a)*, F. Di Rosa(a), S. Guatelli(b), G. Russo(a)
//
// (a) Laboratori Nazionali del Sud
// of the National Institute for Nuclear Physics, Catania, Italy
// (b) National Institute for Nuclear Physics Section of Genova, genova, Italy
//
// * cirrone@lns.infn.it
//
// This class manages the electromagnetic processes for charged hadrons and ions
// using the Standard Models of Geant4
// ----------------------------------------------------------------------------
#include "EMHadronIonStandard.hh"
#include "G4ProcessManager.hh"
#include "G4ParticleDefinition.hh"
#include "G4hMultipleScattering.hh"
#include "G4hIonisation.hh"
#include "G4ionIonisation.hh"
#include "G4MultipleScattering.hh"
#include "G4StepLimiter.hh"
#include "G4EmProcessOptions.hh"
#include "G4MuIonisation.hh"
EMHadronIonStandard::EMHadronIonStandard(const G4String& name):
G4VPhysicsConstructor(name)
{ }
EMHadronIonStandard::~EMHadronIonStandard()
{ }
void EMHadronIonStandard::ConstructProcess()
{
G4ParticleDefinition* particle = 0;
G4ProcessManager* processManager = 0;
// ********************************
// *** Charged Hadrons and Ions ***
// ********************************
theParticleIterator -> reset();
while( (*theParticleIterator)() )
{
particle = theParticleIterator -> value();
processManager = particle -> GetProcessManager();
G4String particleName = particle -> GetParticleName();
G4double charge = particle -> GetPDGCharge();
if (particleName == "GenericIon"||
particleName == "alpha" ||
particleName == "He3")
{
processManager -> AddProcess(new G4hMultipleScattering, -1, 1, 1);
processManager -> AddProcess(new G4hIonisation ,-1, 2, 2);
}
else
{
if (charge != 0.0 &&
particleName != "e+" &&
particleName != "mu+" &&
particleName != "e-" &&
particleName != "mu-")
{
if((!particle -> IsShortLived()) &&
(particle -> GetParticleName() != "chargedgeantino"))
{
processManager -> AddProcess(new G4hMultipleScattering, -1, 1, 1);
processManager -> AddProcess(new G4hIonisation, -1, 2, 2);
}
}
}
}
}
@@ -1,134 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// $Id: EMMuonStandard.cc;
// Last modified: A.Lechner (anton.lechner@cern.ch), August 2008;
//
// See more at: http://geant4infn.wikispaces.com
//
// ----------------------------------------------------------------------------
// GEANT 4 - Hadrontherapy example
// ----------------------------------------------------------------------------
// Code developed by:
//
// G.A.P. Cirrone(a)*, F. Di Rosa(a), S. Guatelli(b), G. Russo(a)
//
// (a) Laboratori Nazionali del Sud
// of the INFN, Catania, Italy
// (b) INFN Section of Genova, Genova, Italy
//
// * cirrone@lns.infn.it
// ----------------------------------------------------------------------------
#include "EMMuonStandard.hh"
#include "G4ParticleDefinition.hh"
#include "G4MuonPlus.hh"
#include "G4MuonMinus.hh"
#include "G4ProcessManager.hh"
#include "G4MultipleScattering.hh"
#include "G4MuIonisation.hh"
#include "G4MuBremsstrahlung.hh"
#include "G4MuPairProduction.hh"
#include "G4StepLimiter.hh"
#include "G4EmProcessOptions.hh"
EMMuonStandard::EMMuonStandard(const G4String& name):
G4VPhysicsConstructor(name)
{
G4cout<< "ELECTROMAGNETIC PROCESS(ES): G4MultipleScattering (muon+/-)"
<< G4endl
<< " G4MuIonisation (muon+/-)"
<< G4endl
<< " G4MuBremsstrahlung (muon+/-)"
<< G4endl
<< " G4MuPairProduction (muon+/-)"
<< G4endl
<< "APPLIED MODEL(S): -"
<< G4endl;
}
EMMuonStandard::~EMMuonStandard()
{ }
void EMMuonStandard::ConstructProcess()
{
G4ParticleDefinition* particle = 0;
G4ProcessManager* processManager = 0;
// *************
// *** Muon+ ***
// *************
G4MultipleScattering* muonPlusMultipleScatteringProcess = new G4MultipleScattering();
G4MuIonisation* muonPlusIonisationProcess = new G4MuIonisation();
G4MuBremsstrahlung* muonPlusBremsstrahlungProcess = new G4MuBremsstrahlung();
G4MuPairProduction* muonPlusPairProductionProcess = new G4MuPairProduction();
particle = G4MuonPlus::MuonPlus();
processManager = particle -> GetProcessManager();
processManager -> AddProcess(muonPlusMultipleScatteringProcess);
processManager -> AddProcess(muonPlusIonisationProcess);
processManager -> AddProcess(muonPlusBremsstrahlungProcess);
processManager -> AddProcess(muonPlusPairProductionProcess);
processManager -> SetProcessOrdering(muonPlusMultipleScatteringProcess, idxAlongStep,1);
processManager -> SetProcessOrdering(muonPlusIonisationProcess, idxAlongStep,2);
processManager -> SetProcessOrdering(muonPlusBremsstrahlungProcess, idxAlongStep,3);
processManager -> SetProcessOrdering(muonPlusPairProductionProcess, idxAlongStep,4);
processManager -> SetProcessOrdering(muonPlusMultipleScatteringProcess, idxPostStep,1);
processManager -> SetProcessOrdering(muonPlusIonisationProcess, idxPostStep,2);
processManager -> SetProcessOrdering(muonPlusBremsstrahlungProcess, idxPostStep,3);
processManager -> SetProcessOrdering(muonPlusPairProductionProcess, idxPostStep,4);
// *************
// *** Muon- ***
// *************
G4MultipleScattering* muonMinusMultipleScatteringProcess = new G4MultipleScattering();
G4MuIonisation* muonMinusIonisationProcess = new G4MuIonisation();
G4MuBremsstrahlung* muonMinusBremsstrahlungProcess = new G4MuBremsstrahlung();
G4MuPairProduction* muonMinusPairProductionProcess = new G4MuPairProduction();
particle = G4MuonMinus::MuonMinus();
processManager = particle -> GetProcessManager();
processManager -> AddProcess(muonMinusMultipleScatteringProcess);
processManager -> AddProcess(muonMinusIonisationProcess);
processManager -> AddProcess(muonMinusBremsstrahlungProcess);
processManager -> AddProcess(muonMinusPairProductionProcess);
processManager -> SetProcessOrdering(muonMinusMultipleScatteringProcess, idxAlongStep,1);
processManager -> SetProcessOrdering(muonMinusIonisationProcess, idxAlongStep,2);
processManager -> SetProcessOrdering(muonMinusBremsstrahlungProcess, idxAlongStep,3);
processManager -> SetProcessOrdering(muonMinusPairProductionProcess, idxAlongStep,4);
processManager -> SetProcessOrdering(muonMinusMultipleScatteringProcess, idxPostStep,1);
processManager -> SetProcessOrdering(muonMinusIonisationProcess, idxPostStep,2);
processManager -> SetProcessOrdering(muonMinusBremsstrahlungProcess, idxPostStep,3);
processManager -> SetProcessOrdering(muonMinusPairProductionProcess, idxPostStep,4);
}
@@ -1,92 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// $Id: HadrontherapyPhotonEPDL.cc; May 2005
// ----------------------------------------------------------------------------
// GEANT 4 - Hadrontherapy example
// ----------------------------------------------------------------------------
// Code developed by:
//
// G.A.P. Cirrone(a)*, F. Di Rosa(a), S. Guatelli(b), G. Russo(a)
//
// (a) Laboratori Nazionali del Sud
// of the National Institute for Nuclear Physics, Catania, Italy
// (b) National Institute for Nuclear Physics Section of Genova, genova, Italy
//
// * cirrone@lns.infn.it
// ----------------------------------------------------------------------------
#include "EMPhotonEPDL.hh"
#include "G4ProcessManager.hh"
#include "G4ParticleDefinition.hh"
#include "G4Gamma.hh"
#include "G4LowEnergyCompton.hh"
#include "G4LowEnergyGammaConversion.hh"
#include "G4LowEnergyPhotoElectric.hh"
#include "G4LowEnergyRayleigh.hh"
#include "G4StepLimiter.hh"
EMPhotonEPDL::EMPhotonEPDL(const G4String& name):
G4VPhysicsConstructor(name)
{
G4cout<< "ELECTROMAGNETIC PROCESS(ES): G4LowEnergyPhotoElectric (photon)"
<< G4endl
<< " G4LowEnergyCompton (photon)"
<< G4endl
<< " G4LowEnergyGammaConversion (photon)"
<< G4endl
<< " G4LowEnergyRayleigh (photon)"
<< G4endl
<< "APPLIED MODEL(S): -"
<< G4endl;
}
EMPhotonEPDL::~EMPhotonEPDL()
{ }
void EMPhotonEPDL::ConstructProcess()
{
// **************
// *** Photon ***
// **************
G4LowEnergyPhotoElectric* photonPhotoElectricProcess = new G4LowEnergyPhotoElectric();
G4LowEnergyCompton* photonComptonProcess = new G4LowEnergyCompton;
G4LowEnergyGammaConversion* photonGammaConvProcess = new G4LowEnergyGammaConversion;
G4LowEnergyRayleigh* photonRayleighProcess = new G4LowEnergyRayleigh;
G4StepLimiter* photonStepLimiter = new G4StepLimiter();
G4ParticleDefinition* particle = G4Gamma::Gamma();
G4ProcessManager* processManager = particle -> GetProcessManager();
processManager -> AddDiscreteProcess(photonPhotoElectricProcess);
processManager -> AddDiscreteProcess(photonComptonProcess);
processManager -> AddDiscreteProcess(photonGammaConvProcess);
processManager -> AddDiscreteProcess(photonRayleighProcess);
processManager -> AddProcess(photonStepLimiter, -1, -1, 3);
}
@@ -1,94 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// $Id: HadrontherapyPhotonPenelope.cc; Version 4.0 May 2005
// ----------------------------------------------------------------------------
// GEANT 4 - Hadrontherapy example
// ----------------------------------------------------------------------------
// Code developed by:
//
// G.A.P. Cirrone(a)*, F. Di Rosa(a), S. Guatelli(b), G. Russo(a)
//
// (a) Laboratori Nazionali del Sud
// of the National Institute for Nuclear Physics, Catania, Italy
// (b) National Institute for Nuclear Physics Section of Genova, genova, Italy
//
// * cirrone@lns.infn.it
// ----------------------------------------------------------------------------
#include "EMPhotonPenelope.hh"
#include "G4ProcessManager.hh"
#include "G4ParticleDefinition.hh"
#include "G4Gamma.hh"
#include "G4PenelopeCompton.hh"
#include "G4PenelopeGammaConversion.hh"
#include "G4PenelopePhotoElectric.hh"
#include "G4PenelopeRayleigh.hh"
#include "G4StepLimiter.hh"
EMPhotonPenelope::EMPhotonPenelope(const G4String& name):
G4VPhysicsConstructor(name)
{
G4cout<< "ELECTROMAGNETIC PROCESS(ES): G4PenelopePhotoElectric (photon)"
<< G4endl
<< " G4PenelopeCompton (photon)"
<< G4endl
<< " G4PenelopeGammaConversion (photon)"
<< G4endl
<< " G4PenelopeRayleigh (photon)"
<< G4endl
<< "APPLIED MODEL(S): -"
<< G4endl;
}
EMPhotonPenelope::~EMPhotonPenelope()
{ }
void EMPhotonPenelope::ConstructProcess()
{
// **************
// *** Photon ***
// **************
G4PenelopePhotoElectric* photonPhotoElectricProcess = new G4PenelopePhotoElectric();
G4PenelopeCompton* photonComptonProcess = new G4PenelopeCompton;
G4PenelopeGammaConversion* photonGammaConvProcess = new G4PenelopeGammaConversion;
G4PenelopeRayleigh* photonRayleighProcess = new G4PenelopeRayleigh;
G4StepLimiter* photonStepLimiter = new G4StepLimiter();
G4ParticleDefinition* particle = G4Gamma::Gamma();
G4ProcessManager* processManager = particle -> GetProcessManager();
processManager -> AddDiscreteProcess(photonPhotoElectricProcess);
processManager -> AddDiscreteProcess(photonComptonProcess);
processManager -> AddDiscreteProcess(photonGammaConvProcess);
processManager -> AddDiscreteProcess(photonRayleighProcess);
processManager -> AddProcess(photonStepLimiter, -1, -1, 3);
}
@@ -1,87 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// $Id: EMPhotonStandard.cc; September 2008
// ----------------------------------------------------------------------------
// GEANT 4 - Hadrontherapy example
// ----------------------------------------------------------------------------
// Code developed by:
//
// G.A.P. Cirrone(a)*, F. Di Rosa(a), S. Guatelli(b), G. Russo(a)
//
// (a) Laboratori Nazionali del Sud
// of the National Institute for Nuclear Physics, Catania, Italy
// (b) National Institute for Nuclear Physics Section of Genova, genova, Italy
//
// * cirrone@lns.infn.it
//
// This class manages the electromagnetic processes for photons
// using the Standard Electromagnetic Models of Geant4
// ----------------------------------------------------------------------------
#include "EMPhotonStandard.hh"
#include "G4ProcessManager.hh"
#include "G4ParticleDefinition.hh"
#include "G4Gamma.hh"
#include "G4ComptonScattering.hh"
#include "G4GammaConversion.hh"
#include "G4PhotoElectricEffect.hh"
#include "G4StepLimiter.hh"
EMPhotonStandard::EMPhotonStandard(const G4String& name):
G4VPhysicsConstructor(name)
{
G4cout<< "ELECTROMAGNETIC PROCESS(ES): G4PhotoElectricEffect (photon)"
<< G4endl
<< " G4ComptonScattering (photon)"
<< G4endl
<< " G4GammaConversion (photon)"
<< G4endl
<< "APPLIED MODEL(S): -"
<< G4endl;
}
EMPhotonStandard::~EMPhotonStandard()
{ }
void EMPhotonStandard::ConstructProcess()
{
// **************
// *** Photon ***
// **************
G4PhotoElectricEffect* photonPhotoElectricProcess = new G4PhotoElectricEffect();
G4ComptonScattering* photonComptonProcess = new G4ComptonScattering;
G4GammaConversion* photonGammaConvProcess = new G4GammaConversion;
G4ParticleDefinition* particle = G4Gamma::Gamma();
G4ProcessManager* processManager = particle -> GetProcessManager();
processManager -> AddDiscreteProcess(photonPhotoElectricProcess);
processManager -> AddDiscreteProcess(photonComptonProcess);
processManager -> AddDiscreteProcess(photonGammaConvProcess);
}
@@ -1,91 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// $Id: HadrontherapyPositronPenelope.cc; May 2005
// ----------------------------------------------------------------------------
// GEANT 4 - Hadrontherapy example
// ----------------------------------------------------------------------------
// Code developed by:
//
// G.A.P. Cirrone(a)*, F. Di Rosa(a), S. Guatelli(b), G. Russo(a)
//
// (a) Laboratori Nazionali del Sud
// of the National Institute for Nuclear Physics, Catania, Italy
// (b) National Institute for Nuclear Physics Section of Genova, genova, Italy
//
// * cirrone@lns.infn.it
// ----------------------------------------------------------------------------
#include "EMPositronPenelope.hh"
#include "G4ProcessManager.hh"
#include "G4ParticleDefinition.hh"
#include "G4MultipleScattering.hh"
#include "G4PenelopeIonisation.hh"
#include "G4PenelopeBremsstrahlung.hh"
#include "G4PenelopeAnnihilation.hh"
#include "G4StepLimiter.hh"
EMPositronPenelope::EMPositronPenelope(const G4String& name):
G4VPhysicsConstructor(name)
{
G4cout<< "ELECTROMAGNETIC PROCESS(ES): G4MultipleScattering (positron)"
<< G4endl
<< " G4PenelopeIonisation (positron)"
<< G4endl
<< " G4PenelopeBremsstrahlung (positron)"
<< G4endl
<< " G4PenelopeAnnihilation (positron)"
<< G4endl
<< "APPLIED MODEL(S): -"
<< G4endl;
}
EMPositronPenelope::~EMPositronPenelope()
{ }
void EMPositronPenelope::ConstructProcess()
{
// ****************
// *** Positron ***
// ****************
G4MultipleScattering* positronMultipScatProcess = new G4MultipleScattering();
G4PenelopeIonisation* positronIonisationProcess = new G4PenelopeIonisation();
G4PenelopeBremsstrahlung* positronBremsstrProcess = new G4PenelopeBremsstrahlung();
G4PenelopeAnnihilation* positronAnnihilationProcess = new G4PenelopeAnnihilation();
G4StepLimiter* positronStepLimiter = new G4StepLimiter();
G4ParticleDefinition* particle = G4Positron::Positron();
G4ProcessManager* processManager = particle -> GetProcessManager();
processManager -> AddProcess(positronMultipScatProcess, -1, 1, 1);
processManager -> AddProcess(positronIonisationProcess, -1, 2, 2);
processManager -> AddProcess(positronBremsstrProcess, -1, -1, 3);
processManager -> AddProcess(positronAnnihilationProcess, 0, -1, 4);
processManager -> AddProcess(positronStepLimiter, -1, -1, 3);
}
@@ -1,102 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// EMPositronStandard.cc February 2008
// ----------------------------------------------------------------------------
// GEANT 4 - Hadrontherapy example
// ----------------------------------------------------------------------------
// Code developed by:
//
// G.A.P. Cirrone(a)*, F. Di Rosa(a), S. Guatelli(b), G. Russo(a)
//
// (a) Laboratori Nazionali del Sud
// of the National Institute for Nuclear Physics, Catania, Italy
// (b) National Institute for Nuclear Physics Section of Genova, genova, Italy
//
// * cirrone@lns.infn.it
//
// This class manages the electromagnetic processes for positrons
// using the Standard Electromagnetic Models of Geant4
// ----------------------------------------------------------------------------
#include "EMPositronStandard.hh"
#include "G4ProcessManager.hh"
#include "G4ParticleDefinition.hh"
#include "G4MultipleScattering.hh"
#include "G4eIonisation.hh"
#include "G4eBremsstrahlung.hh"
#include "G4eplusAnnihilation.hh"
#include "G4StepLimiter.hh"
#include "G4EmProcessOptions.hh"
EMPositronStandard::EMPositronStandard(const G4String& name):
G4VPhysicsConstructor(name)
{
G4cout<< "ELECTROMAGNETIC PROCESS(ES): G4MultipleScattering (positron)"
<< G4endl
<< " G4eIonisation (positron)"
<< G4endl
<< " G4eBremsstrahlung (positron)"
<< G4endl
<< " G4eplusAnnihilation (positron)"
<< G4endl
<< "APPLIED MODEL(S): -"
<< G4endl;
}
EMPositronStandard::~EMPositronStandard()
{ }
void EMPositronStandard::ConstructProcess()
{
// ****************
// *** Positron ***
// ****************
G4MultipleScattering* positronMultipScatProcess = new G4MultipleScattering();
G4eIonisation* positronIonisationProcess = new G4eIonisation();
G4eBremsstrahlung* positronBremsstrProcess = new G4eBremsstrahlung();
G4eplusAnnihilation* positronAnnihilationProcess = new G4eplusAnnihilation();
G4ParticleDefinition* particle = G4Positron::Positron();
G4ProcessManager* processManager = particle -> GetProcessManager();
processManager -> AddProcess(positronMultipScatProcess, -1, 1, 1);
processManager -> AddProcess(positronIonisationProcess, -1, 2, 2);
processManager -> AddProcess(positronBremsstrProcess, -1, -1, 3);
processManager -> AddProcess(positronAnnihilationProcess, 0, -1, 4);
// Options activated to improve accuracy;
// Usefull for a medical application
G4EmProcessOptions opt;
opt.SetStepFunction(0.2, 10*um);
opt.SetMinEnergy(0.1*keV);
opt.SetMaxEnergy(100.*GeV);
opt.SetDEDXBinning(360);
opt.SetLambdaBinning(360);
opt.SetLinearLossLimit(1.e-6);
}
@@ -1,118 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// $Id: HadrontherapyHadronBertiniElastic.cc; May 2005
// ----------------------------------------------------------------------------
// GEANT 4 - Hadrontherapy example
// ----------------------------------------------------------------------------
// Code developed by:
//
// G.A.P. Cirrone(a)*, F. Di Rosa(a), S. Guatelli(b), G. Russo(a)
//
// (a) Laboratori Nazionali del Sud
// of the INFN, Catania, Italy
// (b) INFN Section of Genova, Genova, Italy
//
// * cirrone@lns.infn.it
// ----------------------------------------------------------------------------
#include "HEHadronIonBertiniElastic.hh"
#include "G4ParticleDefinition.hh"
#include "G4ProcessManager.hh"
#include "G4LElastic.hh"
#include "G4HadronElasticProcess.hh"
#include "G4CascadeElasticInterface.hh"
HEHadronIonBertiniElastic::HEHadronIonBertiniElastic(const G4String& name):
G4VPhysicsConstructor(name)
{
G4cout<< "HADRONIC ELASTIC PROCESS(ES): G4HadronElasticProcess (all considere hadrons and ions)"
<< G4endl
<< "APPLIED MODEL(S): G4CascadeElasticInterface (hadrons)"
<< G4endl
<< " G4LElastic (ions)"
<< G4endl;
}
HEHadronIonBertiniElastic::~HEHadronIonBertiniElastic()
{}
/////////////////////////////////////////////////////////////////////////////
void HEHadronIonBertiniElastic::ConstructProcess()
{
G4ParticleDefinition* particle = 0;
G4ProcessManager* processManager = 0;
// **********************************************
// *** Proton, Neutron, Pion plus, Pion minus ***
// **********************************************
G4HadronElasticProcess* hadronElasticProcess = new G4HadronElasticProcess();
G4CascadeElasticInterface* hadronBertiniElasticModel = new G4CascadeElasticInterface;
hadronElasticProcess -> RegisterMe(hadronBertiniElasticModel);
particle = G4Proton::Proton();
processManager = particle -> GetProcessManager();
processManager -> AddDiscreteProcess(hadronElasticProcess);
particle = G4Neutron::Neutron();
processManager = particle -> GetProcessManager();
processManager -> AddDiscreteProcess(hadronElasticProcess);
particle = G4PionPlus::PionPlus();
processManager = particle -> GetProcessManager();
processManager -> AddDiscreteProcess(hadronElasticProcess);
particle = G4PionMinus::PionMinus();
processManager = particle -> GetProcessManager();
processManager -> AddDiscreteProcess(hadronElasticProcess);
// *******************************
// *** Deuteron, Triton, Alpha ***
// *******************************
G4HadronElasticProcess* ionElasticProcess = new G4HadronElasticProcess();
G4LElastic* ionLElasticModel = new G4LElastic();
ionElasticProcess -> RegisterMe(ionLElasticModel);
particle = G4Deuteron::Deuteron();
processManager = particle -> GetProcessManager();
processManager -> AddDiscreteProcess(ionElasticProcess);
particle = G4Triton::Triton();
processManager = particle -> GetProcessManager();
processManager -> AddDiscreteProcess(ionElasticProcess);
particle = G4Alpha::Alpha();
processManager = particle -> GetProcessManager();
processManager -> AddDiscreteProcess(ionElasticProcess);
// particle = G4He3::He3();
// processManager = particle -> GetProcessManager();
// processManager -> AddDiscreteProcess(ionElasticProcess);
}
@@ -1,110 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// $Id: HadrontherapyHadronElastic.cc; May 2005
// ----------------------------------------------------------------------------
// GEANT 4 - Hadrontherapy example
// ----------------------------------------------------------------------------
// Code developed by:
//
// G.A.P. Cirrone(a)*, F. Di Rosa(a), S. Guatelli(b), G. Russo(a)
//
// (a) Laboratori Nazionali del Sud
// of the INFN, Catania, Italy
// (b) INFN Section of Genova, Genova, Italy
//
// * cirrone@lns.infn.it
// ----------------------------------------------------------------------------
#include "HEHadronIonLElastic.hh"
#include "G4ParticleDefinition.hh"
#include "G4ProcessManager.hh"
#include "G4LElastic.hh"
#include "G4HadronElasticProcess.hh"
HEHadronIonLElastic::HEHadronIonLElastic(const G4String& name):
G4VPhysicsConstructor(name)
{
G4cout<< "HADRONIC ELASTIC PROCESS(ES): G4HadronElasticProcess (all considered hadrons and ions)"
<< G4endl
<< "APPLIED MODEL(S): G4LElastic"
<< G4endl;
}
HEHadronIonLElastic::~HEHadronIonLElastic()
{}
void HEHadronIonLElastic::ConstructProcess()
{
G4ParticleDefinition* particle = 0;
G4ProcessManager* processManager = 0;
// **********************************************
// *** Proton, Neutron, Pion plus, Pion minus ***
// *** Deuteron, Triton, Alpha ***
// **********************************************
G4HadronElasticProcess* hadronIonElasticProcess = new G4HadronElasticProcess();
G4LElastic* hadronIonLElasticModel = new G4LElastic();
hadronIonElasticProcess -> RegisterMe(hadronIonLElasticModel);
particle = G4Proton::Proton();
processManager = particle -> GetProcessManager();
processManager -> AddDiscreteProcess(hadronIonElasticProcess);
particle = G4Neutron::Neutron();
processManager = particle -> GetProcessManager();
processManager -> AddDiscreteProcess(hadronIonElasticProcess);
particle = G4PionPlus::PionPlus();
processManager = particle -> GetProcessManager();
processManager -> AddDiscreteProcess(hadronIonElasticProcess);
particle = G4PionMinus::PionMinus();
processManager = particle -> GetProcessManager();
processManager -> AddDiscreteProcess(hadronIonElasticProcess);
particle = G4Deuteron::Deuteron();
processManager = particle -> GetProcessManager();
processManager -> AddDiscreteProcess(hadronIonElasticProcess);
particle = G4Triton::Triton();
processManager = particle -> GetProcessManager();
processManager -> AddDiscreteProcess(hadronIonElasticProcess);
particle = G4Alpha::Alpha();
processManager = particle -> GetProcessManager();
processManager -> AddDiscreteProcess(hadronIonElasticProcess);
// particle = G4He3::He3();
// processManager = particle -> GetProcessManager();
// processManager -> AddDiscreteProcess(hadronIonElasticProcess);
}
@@ -1,118 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// $Id: HadrontherapyHadronCHIPSElastic.cc; May 2005
// ----------------------------------------------------------------------------
// GEANT 4 - Hadrontherapy example
// ----------------------------------------------------------------------------
// Code developed by:
//
// G.A.P. Cirrone(a)*, F. Di Rosa(a), S. Guatelli(b), G. Russo(a)
//
// (a) Laboratori Nazionali del Sud
// of the INFN, Catania, Italy
// (b) INFN Section of Genova, Genova, Italy
//
// * cirrone@lns.infn.it
// ----------------------------------------------------------------------------
#include "HEHadronIonQElastic.hh"
#include "G4ParticleDefinition.hh"
#include "G4ProcessManager.hh"
#include "G4LElastic.hh"
#include "G4HadronElasticProcess.hh"
#include "G4QElastic.hh"
HEHadronIonQElastic::HEHadronIonQElastic(const G4String& name):
G4VPhysicsConstructor(name)
{
G4cout<< "HADRONIC ELASTIC PROCESS(ES): G4QElastic (protons, neutrons)"
<< G4endl
<< " G4HadronElasticProcess (pions, considered ions)"
<< "APPLIED MODEL(S): G4LElastic (pions, considered ions)"
<< G4endl;
}
HEHadronIonQElastic::~HEHadronIonQElastic()
{}
void HEHadronIonQElastic::ConstructProcess()
{
G4ParticleDefinition* particle = 0;
G4ProcessManager* processManager = 0;
// ***********************
// *** Proton, Neutron ***
// ***********************
G4QElastic* protonNeutronElasticProcess = new G4QElastic();
particle = G4Proton::Proton();
processManager = particle -> GetProcessManager();
processManager -> AddDiscreteProcess(protonNeutronElasticProcess);
particle = G4Neutron::Neutron();
processManager = particle -> GetProcessManager();
processManager -> AddDiscreteProcess(protonNeutronElasticProcess);
// ***************************************
// *** Pion plus, Pion minus, Deuteron ***
// *** Triton, Alpha ***
// ***************************************
G4HadronElasticProcess* pionIonElasticProcess = new G4HadronElasticProcess();
G4LElastic* pionIonLElasticModel = new G4LElastic();
pionIonElasticProcess -> RegisterMe(pionIonLElasticModel);
particle = G4PionPlus::PionPlus();
processManager = particle -> GetProcessManager();
processManager -> AddDiscreteProcess(pionIonElasticProcess);
particle = G4PionMinus::PionMinus();
processManager = particle -> GetProcessManager();
processManager -> AddDiscreteProcess(pionIonElasticProcess);
particle = G4Deuteron::Deuteron();
processManager = particle -> GetProcessManager();
processManager -> AddDiscreteProcess(pionIonElasticProcess);
particle = G4Triton::Triton();
processManager = particle -> GetProcessManager();
processManager -> AddDiscreteProcess(pionIonElasticProcess);
particle = G4Alpha::Alpha();
processManager = particle -> GetProcessManager();
processManager -> AddDiscreteProcess(pionIonElasticProcess);
// particle = G4He3::He3();
// processManager = particle -> GetProcessManager();
// processManager -> AddDiscreteProcess(pionIonElasticProcess);
}
@@ -1,113 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// $Id: HadrontherapyHadronUElastic.cc; May 2005
// ----------------------------------------------------------------------------
// GEANT 4 - Hadrontherapy example
// ----------------------------------------------------------------------------
// Code developed by:
//
// G.A.P. Cirrone(a)*, F. Di Rosa(a), S. Guatelli(b), G. Russo(a)
//
// (a) Laboratori Nazionali del Sud
// of the INFN, Catania, Italy
// (b) INFN Section of Genova, Genova, Italy
//
// * cirrone@lns.infn.it
// ----------------------------------------------------------------------------
#include "HEHadronIonUElastic.hh"
#include "G4ParticleDefinition.hh"
#include "G4ProcessManager.hh"
#include "G4UHadronElasticProcess.hh"
#include "G4HadronElastic.hh"
#include "G4VQCrossSection.hh"
HEHadronIonUElastic::HEHadronIonUElastic(const G4String& name):
G4VPhysicsConstructor(name)
{
G4cout<< "HADRONIC ELASTIC PROCESS(ES): G4UHadronElasticProcess (all considered hadrons and ions)"
<< G4endl
<< "APPLIED MODEL(S): G4HadronElastic"
<< G4endl;
model = 0;
}
HEHadronIonUElastic::~HEHadronIonUElastic()
{
delete model;
}
void HEHadronIonUElastic::ConstructProcess()
{
G4ParticleDefinition* particle = 0;
G4ProcessManager* processManager = 0;
// **********************************************
// *** Proton, Neutron, Pion plus, Pion minus ***
// *** Deuteron, Triton, Alpha ***
// **********************************************
G4UHadronElasticProcess* hadronIonElasticProcess = new G4UHadronElasticProcess("elasticProcess", false);
G4double hadronIonElasticMinEnergy = 0. * keV;
G4double hadronIonElasticMaxEnergy = 100. * TeV;
G4HadronElastic* hadronIonElasticModel = new G4HadronElastic();
hadronIonElasticModel -> SetMinEnergy(hadronIonElasticMinEnergy);
hadronIonElasticModel -> SetMaxEnergy(hadronIonElasticMaxEnergy);
G4VQCrossSection* hadronIonElasticCrossSection = hadronIonElasticModel->GetCS();
hadronIonElasticProcess -> SetQElasticCrossSection(hadronIonElasticCrossSection);
hadronIonElasticProcess -> RegisterMe(hadronIonElasticModel);
theParticleIterator -> reset();
while( (*theParticleIterator)() )
{
particle = theParticleIterator -> value();
G4String particleName = particle -> GetParticleName();
if(particleName == "neutron" ||
particleName == "pi-" ||
particleName == "pi+" ||
particleName == "proton" ||
particleName == "alpha" ||
particleName == "deuteron" ||
particleName == "triton")
{
processManager = particle -> GetProcessManager();
processManager -> AddDiscreteProcess(hadronIonElasticProcess);
}
}
}
@@ -1,135 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// $Id: HadrontherapyProtonPrecompound.cc; November 2008
// ----------------------------------------------------------------------------
// GEANT 4 - Hadrontherapy example
// ----------------------------------------------------------------------------
// Code developed by:
//
// G.A.P. Cirrone(a)*, F. Di Rosa(a), S. Guatelli(b), G. Russo(a)
//
// (a) Laboratori Nazionali del Sud
// of the INFN, Catania, Italy
// (b) INFN Section of Genova, Genova, Italy
//
// * cirrone@lns.infn.it
// ----------------------------------------------------------------------------
#include "HIIonLEP.hh"
#include "G4ParticleDefinition.hh"
#include "G4ProcessManager.hh"
#include "G4TripathiCrossSection.hh"
#include "G4IonsShenCrossSection.hh"
#include "G4DeuteronInelasticProcess.hh"
#include "G4TritonInelasticProcess.hh"
#include "G4AlphaInelasticProcess.hh"
#include "G4LEDeuteronInelastic.hh"
#include "G4LETritonInelastic.hh"
#include "G4LEAlphaInelastic.hh"
HIIonLEP::HIIonLEP(const G4String& name):
G4VPhysicsConstructor(name)
{
G4cout<< "HADRONIC INELASTIC PROCESS(ES): G4XXXInelasticProcess (all ions)"
<< G4endl
<< "APPLIED MODEL(S): G4LEXXXInelastic"
<< G4endl;
}
HIIonLEP::~HIIonLEP()
{}
void HIIonLEP::ConstructProcess()
{
G4ParticleDefinition* particle = 0;
G4ProcessManager* processManager = 0;
// ***************************************************
// *** Deuteron, Triton, Alpha: Common Definitions ***
// ***************************************************
G4TripathiCrossSection* ionTripathiCrossSection = new G4TripathiCrossSection;
G4IonsShenCrossSection* ionShenCrossSection = new G4IonsShenCrossSection;
G4double ionLEPMaxEnergy = 100. * MeV;
// ****************
// *** Deuteron ***
// ****************
G4DeuteronInelasticProcess* deuteronInelasticProcess = new G4DeuteronInelasticProcess;
G4LEDeuteronInelastic* deuteronLEPModel = new G4LEDeuteronInelastic;
deuteronLEPModel -> SetMaxEnergy(ionLEPMaxEnergy);
deuteronInelasticProcess -> AddDataSet(ionTripathiCrossSection);
deuteronInelasticProcess -> RegisterMe(deuteronLEPModel);
particle = G4Deuteron::Deuteron();
processManager = particle -> GetProcessManager();
processManager -> AddDiscreteProcess(deuteronInelasticProcess);
// **************
// *** Triton ***
// **************
G4TritonInelasticProcess* tritonInelasticProcess = new G4TritonInelasticProcess;
G4LETritonInelastic* tritonLEPModel = new G4LETritonInelastic;
tritonLEPModel -> SetMaxEnergy(ionLEPMaxEnergy);
tritonInelasticProcess -> AddDataSet(ionTripathiCrossSection);
tritonInelasticProcess -> RegisterMe(tritonLEPModel);
particle = G4Triton::Triton();
processManager = particle -> GetProcessManager();
processManager -> AddDiscreteProcess(tritonInelasticProcess);
// *************
// *** Alpha ***
// *************
G4AlphaInelasticProcess* alphaInelasticProcess = new G4AlphaInelasticProcess;
G4LEAlphaInelastic* alphaLEPModel = new G4LEAlphaInelastic;
alphaLEPModel -> SetMaxEnergy(ionLEPMaxEnergy);
alphaInelasticProcess -> AddDataSet(ionTripathiCrossSection);
alphaInelasticProcess -> RegisterMe(alphaLEPModel);
particle = G4Alpha::Alpha();
processManager = particle -> GetProcessManager();
processManager -> AddDiscreteProcess(alphaInelasticProcess);
}
@@ -1,112 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// $Id: HadrontherapyProtonLEP.cc; May 2005
// ----------------------------------------------------------------------------
// GEANT 4 - Hadrontherapy example
// ----------------------------------------------------------------------------
// Code developed by:
//
// G.A.P. Cirrone(a)*, F. Di Rosa(a), S. Guatelli(b), G. Russo(a)
//
// (a) Laboratori Nazionali del Sud
// of the INFN, Catania, Italy
// (b) INFN Section of Genova, Genova, Italy
//
// * cirrone@lns.infn.it
// ----------------------------------------------------------------------------
#include "HIPionBertini.hh"
#include "G4ParticleDefinition.hh"
#include "G4ProcessManager.hh"
#include "G4PionPlusInelasticProcess.hh"
#include "G4PionMinusInelasticProcess.hh"
#include "G4CascadeInterface.hh"
#include "G4PiNuclearCrossSection.hh"
HIPionBertini::HIPionBertini(const G4String& name):
G4VPhysicsConstructor(name)
{
G4cout<< "HADRONIC INELASTIC PROCESS(ES): G4PionXXXInelasticProcess (pions+/-)"
<< G4endl
<< "APPLIED MODEL(S): G4CascadeInterface"
<< G4endl;
}
HIPionBertini::~HIPionBertini()
{}
void HIPionBertini::ConstructProcess()
{
G4ParticleDefinition* particle = 0;
G4ProcessManager* processManager = 0;
// ***********************************
// *** Pion+/-: Common Definitions ***
// ***********************************
G4PiNuclearCrossSection* pionNuclearCrossSection = new G4PiNuclearCrossSection();
G4double pionBertiniMinEnergy = 0. * MeV;
G4double pionBertiniMaxEnergy = 100. * MeV;
G4CascadeInterface* pionBertiniElasticModel = new G4CascadeInterface;
pionBertiniElasticModel -> SetMinEnergy(pionBertiniMinEnergy);
pionBertiniElasticModel -> SetMaxEnergy(pionBertiniMaxEnergy);
// *************
// *** Pion+ ***
// *************
G4PionPlusInelasticProcess* pionPlusInelasticProcess = new G4PionPlusInelasticProcess("inelastic");
pionPlusInelasticProcess -> AddDataSet(pionNuclearCrossSection);
pionPlusInelasticProcess -> RegisterMe(pionBertiniElasticModel);
particle = G4PionPlus::PionPlus();
processManager = particle -> GetProcessManager();
processManager -> AddDiscreteProcess(pionPlusInelasticProcess);
// **************
// *** Pion- ***
// **************
G4PionMinusInelasticProcess* pionMinusInelasticProcess = new G4PionMinusInelasticProcess("inelastic");
pionMinusInelasticProcess -> AddDataSet(pionNuclearCrossSection);
pionMinusInelasticProcess -> RegisterMe(pionBertiniElasticModel);
particle = G4PionMinus::PionMinus();
processManager = particle -> GetProcessManager();
processManager -> AddDiscreteProcess(pionMinusInelasticProcess);
}
@@ -1,119 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// $Id: HadrontherapyProtonLEP.cc; May 2005
// ----------------------------------------------------------------------------
// GEANT 4 - Hadrontherapy example
// ----------------------------------------------------------------------------
// Code developed by:
//
// G.A.P. Cirrone(a)*, F. Di Rosa(a), S. Guatelli(b), G. Russo(a)
//
// (a) Laboratori Nazionali del Sud
// of the INFN, Catania, Italy
// (b) INFN Section of Genova, Genova, Italy
//
// * cirrone@lns.infn.it
// ----------------------------------------------------------------------------
#include "HIPionLEP.hh"
#include "G4ParticleDefinition.hh"
#include "G4ProcessManager.hh"
#include "G4PionPlusInelasticProcess.hh"
#include "G4PionMinusInelasticProcess.hh"
#include "G4LEPionPlusInelastic.hh"
#include "G4LEPionMinusInelastic.hh"
#include "G4PiMinusAbsorptionAtRest.hh"
#include "G4PiNuclearCrossSection.hh"
HIPionLEP::HIPionLEP(const G4String& name):
G4VPhysicsConstructor(name)
{
G4cout<< "HADRONIC INELASTIC PROCESS(ES): G4PionXXXInelasticProcess (pions+/-)"
<< G4endl
<< "APPLIED MODEL(S): G4LEPionXXXInelastic"
<< G4endl;
}
HIPionLEP::~HIPionLEP()
{}
void HIPionLEP::ConstructProcess()
{
G4ParticleDefinition* particle = 0;
G4ProcessManager* processManager = 0;
// ***********************************
// *** Pion+/-: Common Definitions ***
// ***********************************
G4double pionLEPMinEnergy = 0. * MeV;
G4double pionLEPMaxEnergy = 100. * MeV;
G4PiNuclearCrossSection* pionNuclearCrossSection = new G4PiNuclearCrossSection();
// *************
// *** Pion+ ***
// *************
G4PionPlusInelasticProcess* pionPlusInelasticProcess = new G4PionPlusInelasticProcess("inelastic");
G4LEPionPlusInelastic* pionPlusLEPModel = new G4LEPionPlusInelastic();
pionPlusLEPModel -> SetMinEnergy(pionLEPMinEnergy);
pionPlusLEPModel -> SetMaxEnergy(pionLEPMaxEnergy);
pionPlusInelasticProcess -> AddDataSet(pionNuclearCrossSection);
pionPlusInelasticProcess -> RegisterMe(pionPlusLEPModel);
particle = G4PionPlus::PionPlus();
processManager = particle -> GetProcessManager();
processManager -> AddDiscreteProcess(pionPlusInelasticProcess);
// **************
// *** Pion- ***
// **************
G4PionMinusInelasticProcess* pionMinusInelasticProcess = new G4PionMinusInelasticProcess("inelastic");
G4PiMinusAbsorptionAtRest* pionMinusAbsAtRestProcess = new G4PiMinusAbsorptionAtRest();
G4LEPionMinusInelastic* pionMinusLEPModel = new G4LEPionMinusInelastic();
pionMinusLEPModel -> SetMinEnergy(pionLEPMinEnergy);
pionMinusLEPModel -> SetMaxEnergy(pionLEPMaxEnergy);
pionMinusInelasticProcess -> AddDataSet(pionNuclearCrossSection);
pionMinusInelasticProcess -> RegisterMe(pionMinusLEPModel);
particle = G4PionMinus::PionMinus();
processManager = particle -> GetProcessManager();
processManager -> AddDiscreteProcess(pionMinusInelasticProcess);
processManager -> AddRestProcess(pionMinusAbsAtRestProcess);
}
@@ -1,134 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// $Id: HadrontherapyProtonBertini.cc; November 2008
// ----------------------------------------------------------------------------
// GEANT 4 - Hadrontherapy example
// ----------------------------------------------------------------------------
// Code developed by:
//
// G.A.P. Cirrone(a)*, F. Di Rosa(a), S. Guatelli(b), G. Russo(a)
//
// (a) Laboratori Nazionali del Sud
// of the National Institute for Nuclear Physics, Catania, Italy
// (b) National Institute for Nuclear Physics Section of Genova, genova, Italy
//
// * cirrone@lns.infn.it
// Code review by M.G. Pia, 2 November 2006
// Further code review is needed
// ----------------------------------------------------------------------------
#include "HIProtonNeutronBertini.hh"
#include "G4ParticleDefinition.hh"
#include "G4ProcessManager.hh"
#include "G4ProtonInelasticProcess.hh"
#include "G4NeutronInelasticProcess.hh"
#include "G4HadronFissionProcess.hh"
#include "G4HadronCaptureProcess.hh"
#include "G4ProtonInelasticCrossSection.hh"
#include "G4NeutronInelasticCrossSection.hh"
#include "G4CascadeInterface.hh"
#include "G4LFission.hh"
#include "G4LCapture.hh"
HIProtonNeutronBertini::HIProtonNeutronBertini(const G4String& name):
G4VPhysicsConstructor(name)
{
G4cout<< "HADRONIC INELASTIC PROCESS(ES): G4XXXInelasticProcess (protons, neutrons)"
<< G4endl
<< "APPLIED MODEL(S): G4CascadeInterface"
<< G4endl;
}
HIProtonNeutronBertini::~HIProtonNeutronBertini()
{}
void HIProtonNeutronBertini::ConstructProcess()
{
G4ParticleDefinition* particle = 0;
G4ProcessManager* processManager = 0;
// *******************************************
// *** Proton, Neutron: Common Definitions ***
// *******************************************
G4double protonNeutronBertiniMinEnergy = 0. * MeV;
G4double protonNeutronBertiniMaxEnergy = 100. * MeV;
G4CascadeInterface* protonNeutronBertiniCascadeModel = new G4CascadeInterface;
protonNeutronBertiniCascadeModel -> SetMinEnergy(protonNeutronBertiniMinEnergy);
protonNeutronBertiniCascadeModel -> SetMaxEnergy(protonNeutronBertiniMaxEnergy);
// **************
// *** Proton ***
// **************
G4ProtonInelasticProcess* protonInelasticProcess = new G4ProtonInelasticProcess();
G4ProtonInelasticCrossSection* protonInelasticCrossSection = new G4ProtonInelasticCrossSection();
protonInelasticProcess -> RegisterMe(protonNeutronBertiniCascadeModel);
protonInelasticProcess -> AddDataSet(protonInelasticCrossSection);
particle = G4Proton::Proton();
processManager = particle -> GetProcessManager();
processManager -> AddDiscreteProcess(protonInelasticProcess);
// ***************
// *** Neutron ***
// ***************
G4NeutronInelasticProcess* neutronInelasticProcess = new G4NeutronInelasticProcess;
G4NeutronInelasticCrossSection* neutronInelasticCrossSection = new G4NeutronInelasticCrossSection;
G4HadronCaptureProcess* neutronCaptureProcess = new G4HadronCaptureProcess();
G4HadronFissionProcess* neutronFissionProcess = new G4HadronFissionProcess();
G4double neutronCaptureFissionMinEnergy = 0. * TeV;
G4double neutronCaptureFissionMaxEnergy = 100. * TeV;
G4LCapture* neutronCaptureModel = new G4LCapture();
neutronCaptureModel -> SetMinEnergy(neutronCaptureFissionMinEnergy);
neutronCaptureModel -> SetMaxEnergy(neutronCaptureFissionMaxEnergy);
G4LFission* neutronFissionModel = new G4LFission();
neutronFissionModel -> SetMinEnergy(neutronCaptureFissionMinEnergy);
neutronFissionModel -> SetMaxEnergy(neutronCaptureFissionMaxEnergy);
neutronInelasticProcess -> RegisterMe(protonNeutronBertiniCascadeModel);
neutronInelasticProcess -> AddDataSet(neutronInelasticCrossSection);
neutronCaptureProcess -> RegisterMe(neutronCaptureModel);
neutronFissionProcess -> RegisterMe(neutronFissionModel);
particle = G4Neutron::Neutron();
processManager = particle -> GetProcessManager();
processManager -> AddDiscreteProcess(neutronInelasticProcess);
processManager -> AddDiscreteProcess(neutronCaptureProcess);
processManager -> AddDiscreteProcess(neutronFissionProcess);
}
@@ -1,134 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// $Id: HadrontherapyProtonPrecompound.cc; May 2005
// ----------------------------------------------------------------------------
// GEANT 4 - Hadrontherapy example
// ----------------------------------------------------------------------------
// Code developed by:
//
// G.A.P. Cirrone(a)*, F. Di Rosa(a), S. Guatelli(b), G. Russo(a)
//
// (a) Laboratori Nazionali del Sud
// of the INFN, Catania, Italy
// (b) INFN Section of Genova, Genova, Italy
//
// * cirrone@lns.infn.it
// ----------------------------------------------------------------------------
#include "HIProtonNeutronBinary.hh"
#include "G4ParticleDefinition.hh"
#include "G4ProcessManager.hh"
#include "G4ProtonInelasticProcess.hh"
#include "G4NeutronInelasticProcess.hh"
#include "G4HadronCaptureProcess.hh"
#include "G4HadronFissionProcess.hh"
#include "G4ProtonInelasticCrossSection.hh"
#include "G4NeutronInelasticCrossSection.hh"
#include "G4BinaryCascade.hh"
#include "G4LFission.hh"
#include "G4LCapture.hh"
HIProtonNeutronBinary::HIProtonNeutronBinary(const G4String& name):
G4VPhysicsConstructor(name)
{
G4cout<< "HADRONIC INELASTIC PROCESS(ES): G4XXXInelasticProcess (protons, neutrons)"
<< G4endl
<< "APPLIED MODEL(S): G4BinaryCascade"
<< G4endl;
}
HIProtonNeutronBinary::~HIProtonNeutronBinary()
{}
void HIProtonNeutronBinary::ConstructProcess()
{
G4ParticleDefinition* particle = 0;
G4ProcessManager* processManager = 0;
// *********************************************
// *** Protons, Neutrons: Common Definitions ***
// *********************************************
G4double protonNeutronBinaryMinEnergy = 0. * MeV;
G4double protonNeutronBinaryMaxEnergy = 100. * MeV;
G4BinaryCascade* protonNeutronBinaryCascadeModel = new G4BinaryCascade();
protonNeutronBinaryCascadeModel -> SetMinEnergy(protonNeutronBinaryMinEnergy);
protonNeutronBinaryCascadeModel -> SetMaxEnergy(protonNeutronBinaryMaxEnergy);
// **************
// *** Proton ***
// **************
G4ProtonInelasticProcess* protonInelasticProcess = new G4ProtonInelasticProcess();
G4ProtonInelasticCrossSection* protonInelasticCrossSection = new G4ProtonInelasticCrossSection();
protonInelasticProcess -> RegisterMe(protonNeutronBinaryCascadeModel);
protonInelasticProcess -> AddDataSet(protonInelasticCrossSection);
particle = G4Proton::Proton();
processManager = particle -> GetProcessManager();
processManager -> AddDiscreteProcess(protonInelasticProcess);
// ***************
// *** Neutron ***
// ***************
G4NeutronInelasticProcess* neutronInelasticProcess = new G4NeutronInelasticProcess;
G4NeutronInelasticCrossSection* neutronInelasticCrossSection = new G4NeutronInelasticCrossSection;
G4HadronCaptureProcess* neutronCaptureProcess = new G4HadronCaptureProcess();
G4HadronFissionProcess* neutronFissionProcess = new G4HadronFissionProcess();
G4double neutronCaptureFissionMinEnergy = 0. * TeV;
G4double neutronCaptureFissionMaxEnergy = 100. * TeV;
G4LCapture* neutronCaptureModel = new G4LCapture();
neutronCaptureModel -> SetMinEnergy(neutronCaptureFissionMinEnergy);
neutronCaptureModel -> SetMaxEnergy(neutronCaptureFissionMaxEnergy);
G4LFission* neutronFissionModel = new G4LFission();
neutronFissionModel -> SetMinEnergy(neutronCaptureFissionMinEnergy);
neutronFissionModel -> SetMaxEnergy(neutronCaptureFissionMaxEnergy);
neutronInelasticProcess -> RegisterMe(protonNeutronBinaryCascadeModel);
neutronInelasticProcess -> AddDataSet(neutronInelasticCrossSection);
neutronCaptureProcess -> RegisterMe(neutronCaptureModel);
neutronFissionProcess -> RegisterMe(neutronFissionModel);
particle = G4Neutron::Neutron();
processManager = particle -> GetProcessManager();
processManager -> AddDiscreteProcess(neutronInelasticProcess);
processManager -> AddDiscreteProcess(neutronCaptureProcess);
processManager -> AddDiscreteProcess(neutronFissionProcess);
}
@@ -1,138 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// $Id: HadrontherapyProtonLEP.cc; May 2005
// ----------------------------------------------------------------------------
// GEANT 4 - Hadrontherapy example
// ----------------------------------------------------------------------------
// Code developed by:
//
// G.A.P. Cirrone(a)*, F. Di Rosa(a), S. Guatelli(b), G. Russo(a)
//
// (a) Laboratori Nazionali del Sud
// of the INFN, Catania, Italy
// (b) INFN Section of Genova, Genova, Italy
//
// * cirrone@lns.infn.it
// ----------------------------------------------------------------------------
#include "HIProtonNeutronLEP.hh"
#include "G4ParticleDefinition.hh"
#include "G4ProcessManager.hh"
#include "G4ProtonInelasticProcess.hh"
#include "G4NeutronInelasticProcess.hh"
#include "G4HadronCaptureProcess.hh"
#include "G4HadronFissionProcess.hh"
#include "G4ProtonInelasticCrossSection.hh"
#include "G4NeutronInelasticCrossSection.hh"
#include "G4LEProtonInelastic.hh"
#include "G4LENeutronInelastic.hh"
#include "G4LFission.hh"
#include "G4LCapture.hh"
HIProtonNeutronLEP::HIProtonNeutronLEP(const G4String& name):
G4VPhysicsConstructor(name)
{
G4cout<< "HADRONIC INELASTIC PROCESS(ES): G4XXXInelasticProcess (protons, neutrons)"
<< G4endl
<< "APPLIED MODEL(S): G4LEXXXInelastic"
<< G4endl;
}
HIProtonNeutronLEP::~HIProtonNeutronLEP()
{}
void HIProtonNeutronLEP::ConstructProcess()
{
G4ParticleDefinition* particle = 0;
G4ProcessManager* processManager = 0;
// ******************************************
// *** Proton,Neutron: Common Definitions ***
// ******************************************
G4double protonNeutronLEPMinEnergy = 0. * MeV;
G4double protonNeutronLEPMaxEnergy = 100. * MeV;
// **************
// *** Proton ***
// **************
G4ProtonInelasticProcess* protonInelasticProcess = new G4ProtonInelasticProcess();
G4ProtonInelasticCrossSection* protonInelasticCrossSection = new G4ProtonInelasticCrossSection();
G4LEProtonInelastic* protonLEPModel = new G4LEProtonInelastic();
protonLEPModel -> SetMinEnergy(protonNeutronLEPMinEnergy);
protonLEPModel -> SetMaxEnergy(protonNeutronLEPMaxEnergy);
protonInelasticProcess -> RegisterMe(protonLEPModel);
protonInelasticProcess -> AddDataSet(protonInelasticCrossSection);
particle = G4Proton::Proton();
processManager = particle -> GetProcessManager();
processManager -> AddDiscreteProcess(protonInelasticProcess);
// ***************
// *** Neutron ***
// ***************
G4NeutronInelasticProcess* neutronInelasticProcess = new G4NeutronInelasticProcess;
G4NeutronInelasticCrossSection* neutronInelasticCrossSection = new G4NeutronInelasticCrossSection;
G4HadronCaptureProcess* neutronCaptureProcess = new G4HadronCaptureProcess();
G4HadronFissionProcess* neutronFissionProcess = new G4HadronFissionProcess();
G4LENeutronInelastic* neutronLEPModel = new G4LENeutronInelastic();
neutronLEPModel -> SetMinEnergy(protonNeutronLEPMinEnergy);
neutronLEPModel -> SetMaxEnergy(protonNeutronLEPMaxEnergy);
G4double neutronCaptureFissionMinEnergy = 0. * TeV;
G4double neutronCaptureFissionMaxEnergy = 100. * TeV;
G4LCapture* neutronCaptureModel = new G4LCapture();
neutronCaptureModel -> SetMinEnergy(neutronCaptureFissionMinEnergy);
neutronCaptureModel -> SetMaxEnergy(neutronCaptureFissionMaxEnergy);
G4LFission* neutronFissionModel = new G4LFission();
neutronFissionModel -> SetMinEnergy(neutronCaptureFissionMinEnergy);
neutronFissionModel -> SetMaxEnergy(neutronCaptureFissionMaxEnergy);
neutronInelasticProcess -> RegisterMe(neutronLEPModel);
neutronInelasticProcess -> AddDataSet(neutronInelasticCrossSection);
neutronCaptureProcess -> RegisterMe(neutronCaptureModel);
neutronFissionProcess -> RegisterMe(neutronFissionModel);
particle = G4Neutron::Neutron();
processManager = particle -> GetProcessManager();
processManager -> AddDiscreteProcess(neutronInelasticProcess);
processManager -> AddDiscreteProcess(neutronCaptureProcess);
processManager -> AddDiscreteProcess(neutronFissionProcess);
}
@@ -1,140 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// $Id: HadrontherapyProtonPrecompound.cc; May 2005
// ----------------------------------------------------------------------------
// GEANT 4 - Hadrontherapy example
// ----------------------------------------------------------------------------
// Code developed by:
//
// G.A.P. Cirrone(a)*, F. Di Rosa(a), S. Guatelli(b), G. Russo(a)
//
// (a) Laboratori Nazionali del Sud
// of the INFN, Catania, Italy
// (b) INFN Section of Genova, Genova, Italy
//
// * cirrone@lns.infn.it
// ----------------------------------------------------------------------------
#include "HIProtonNeutronPrecompound.hh"
#include "G4ParticleDefinition.hh"
#include "G4ProcessManager.hh"
#include "G4ProtonInelasticProcess.hh"
#include "G4NeutronInelasticProcess.hh"
#include "G4HadronCaptureProcess.hh"
#include "G4HadronFissionProcess.hh"
#include "G4ProtonInelasticCrossSection.hh"
#include "G4NeutronInelasticCrossSection.hh"
#include "G4PreCompoundModel.hh"
#include "G4LFission.hh"
#include "G4LCapture.hh"
#include "G4ExcitationHandler.hh"
HIProtonNeutronPrecompound::HIProtonNeutronPrecompound(const G4String& name):
G4VPhysicsConstructor(name)
{
G4cout<< "HADRONIC INELASTIC PROCESS(ES): G4XXXInelasticProcess (protons, neutrons)"
<< G4endl
<< "APPLIED MODEL(S): G4PreCompound"
<< G4endl
<< " combined with Default Evaporation"
<< G4endl;
}
HIProtonNeutronPrecompound::~HIProtonNeutronPrecompound()
{}
void HIProtonNeutronPrecompound::ConstructProcess()
{
G4ParticleDefinition* particle = 0;
G4ProcessManager* processManager = 0;
// *********************************************
// *** Protons, Neutrons: Common Definitions ***
// *********************************************
G4ExcitationHandler* excitationHandler = new G4ExcitationHandler();
G4double protonNeutronPrecompoundMinEnergy = 0. * MeV;
G4double protonNeutronPrecompoundMaxEnergy = 100. * MeV;
G4PreCompoundModel* protonNeutronPreCompoundModel = new G4PreCompoundModel(excitationHandler);
protonNeutronPreCompoundModel -> SetMinEnergy(protonNeutronPrecompoundMinEnergy);
protonNeutronPreCompoundModel -> SetMaxEnergy(protonNeutronPrecompoundMaxEnergy);
// **************
// *** Proton ***
// **************
G4ProtonInelasticProcess* protonInelasticProcess = new G4ProtonInelasticProcess();
G4ProtonInelasticCrossSection* protonInelasticCrossSection = new G4ProtonInelasticCrossSection();
protonInelasticProcess -> RegisterMe(protonNeutronPreCompoundModel);
protonInelasticProcess -> AddDataSet(protonInelasticCrossSection);
particle = G4Proton::Proton();
processManager = particle -> GetProcessManager();
processManager -> AddDiscreteProcess(protonInelasticProcess);
// ***************
// *** Neutron ***
// ***************
G4NeutronInelasticProcess* neutronInelasticProcess = new G4NeutronInelasticProcess;
G4NeutronInelasticCrossSection* neutronInelasticCrossSection = new G4NeutronInelasticCrossSection;
G4HadronCaptureProcess* neutronCaptureProcess = new G4HadronCaptureProcess();
G4HadronFissionProcess* neutronFissionProcess = new G4HadronFissionProcess();
G4double neutronCaptureFissionMinEnergy = 0. * TeV;
G4double neutronCaptureFissionMaxEnergy = 100. * TeV;
G4LCapture* neutronCaptureModel = new G4LCapture();
neutronCaptureModel -> SetMinEnergy(neutronCaptureFissionMinEnergy);
neutronCaptureModel -> SetMaxEnergy(neutronCaptureFissionMaxEnergy);
G4LFission* neutronFissionModel = new G4LFission();
neutronFissionModel -> SetMinEnergy(neutronCaptureFissionMinEnergy);
neutronFissionModel -> SetMaxEnergy(neutronCaptureFissionMaxEnergy);
neutronInelasticProcess -> RegisterMe(protonNeutronPreCompoundModel);
neutronInelasticProcess -> AddDataSet(neutronInelasticCrossSection);
neutronCaptureProcess -> RegisterMe(neutronCaptureModel);
neutronFissionProcess -> RegisterMe(neutronFissionModel);
particle = G4Neutron::Neutron();
processManager = particle -> GetProcessManager();
processManager -> AddDiscreteProcess(neutronInelasticProcess);
processManager -> AddDiscreteProcess(neutronCaptureProcess);
processManager -> AddDiscreteProcess(neutronFissionProcess);
}
@@ -1,150 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// $Id: HadrontherapyProtonPrecompoundFermi.cc; May 2005
// ----------------------------------------------------------------------------
// GEANT 4 - Hadrontherapy example
// ----------------------------------------------------------------------------
// Code developed by:
//
// G.A.P. Cirrone(a)*, F. Di Rosa(a), S. Guatelli(b), G. Russo(a)
//
// (a) Laboratori Nazionali del Sud
// of the INFN, Catania, Italy
// (b) INFN Section of Genova, Genova, Italy
//
// * cirrone@lns.infn.it
// ----------------------------------------------------------------------------
#include "HIProtonNeutronPrecompoundFermi.hh"
#include "G4ParticleDefinition.hh"
#include "G4ProcessManager.hh"
#include "G4ProtonInelasticProcess.hh"
#include "G4NeutronInelasticProcess.hh"
#include "G4HadronCaptureProcess.hh"
#include "G4HadronFissionProcess.hh"
#include "G4ProtonInelasticCrossSection.hh"
#include "G4NeutronInelasticCrossSection.hh"
#include "G4PreCompoundModel.hh"
#include "G4LFission.hh"
#include "G4LCapture.hh"
#include "G4Evaporation.hh"
#include "G4FermiBreakUp.hh"
#include "G4ExcitationHandler.hh"
HIProtonNeutronPrecompoundFermi::HIProtonNeutronPrecompoundFermi(const G4String& name):
G4VPhysicsConstructor(name)
{
G4cout<< "HADRONIC INELASTIC PROCESS(ES): G4XXXInelasticProcess (protons, neutrons)"
<< G4endl
<< "APPLIED MODEL(S): G4PreCompound"
<< G4endl
<< " combined with GEM Evaporation model"
<< G4endl
<< " and Fermi Break-up model"
<< G4endl;
}
HIProtonNeutronPrecompoundFermi::~HIProtonNeutronPrecompoundFermi()
{}
void HIProtonNeutronPrecompoundFermi::ConstructProcess()
{
G4ParticleDefinition* particle = 0;
G4ProcessManager* processManager = 0;
// ********************************
// *** Hadrons: Inelastic Model ***
// ********************************
G4ExcitationHandler* excitationHandler = new G4ExcitationHandler();
G4int targetZ = 1;
G4int targetA = 2 * targetZ;
G4FermiBreakUp* hadronFermiBreakUpModel = new G4FermiBreakUp();
excitationHandler -> SetFermiModel(hadronFermiBreakUpModel);
excitationHandler -> SetMaxAandZForFermiBreakUp(targetA,targetZ);
G4double protonNeutronPrecompoundMinEnergy = 0. * MeV;
G4double protonNeutronPrecompoundMaxEnergy = 100. * MeV;
G4PreCompoundModel* hadronPreCompoundModel = new G4PreCompoundModel(excitationHandler);
hadronPreCompoundModel -> SetMinEnergy(protonNeutronPrecompoundMinEnergy);
hadronPreCompoundModel -> SetMaxEnergy(protonNeutronPrecompoundMaxEnergy);
// **************
// *** Proton ***
// **************
G4ProtonInelasticProcess* protonInelasticProcess = new G4ProtonInelasticProcess();
G4ProtonInelasticCrossSection* protonInelasticCrossSection = new G4ProtonInelasticCrossSection();
protonInelasticProcess -> RegisterMe(hadronPreCompoundModel);
protonInelasticProcess -> AddDataSet(protonInelasticCrossSection);
particle = G4Proton::Proton();
processManager = particle -> GetProcessManager();
processManager -> AddDiscreteProcess(protonInelasticProcess);
// ***************
// *** Neutron ***
// ***************
G4NeutronInelasticProcess* neutronInelasticProcess = new G4NeutronInelasticProcess;
G4NeutronInelasticCrossSection* neutronInelasticCrossSection = new G4NeutronInelasticCrossSection;
G4HadronCaptureProcess* neutronCaptureProcess = new G4HadronCaptureProcess();
G4HadronFissionProcess* neutronFissionProcess = new G4HadronFissionProcess();
G4double neutronCaptureFissionMinEnergy = 0. * TeV;
G4double neutronCaptureFissionMaxEnergy = 100. * TeV;
G4LCapture* neutronCaptureModel = new G4LCapture();
neutronCaptureModel -> SetMinEnergy(neutronCaptureFissionMinEnergy);
neutronCaptureModel -> SetMaxEnergy(neutronCaptureFissionMaxEnergy);
G4LFission* neutronFissionModel = new G4LFission();
neutronFissionModel -> SetMinEnergy(neutronCaptureFissionMinEnergy);
neutronFissionModel -> SetMaxEnergy(neutronCaptureFissionMaxEnergy);
neutronInelasticProcess -> RegisterMe(hadronPreCompoundModel);
neutronInelasticProcess -> AddDataSet(neutronInelasticCrossSection);
neutronCaptureProcess -> RegisterMe(neutronCaptureModel);
neutronFissionProcess -> RegisterMe(neutronFissionModel);
particle = G4Neutron::Neutron();
processManager = particle -> GetProcessManager();
processManager -> AddDiscreteProcess(neutronInelasticProcess);
processManager -> AddDiscreteProcess(neutronCaptureProcess);
processManager -> AddDiscreteProcess(neutronFissionProcess);
}
@@ -1,144 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// $Id: HadrontherapyProtonPrecompound.cc; May 2005
// ----------------------------------------------------------------------------
// GEANT 4 - Hadrontherapy example
// ----------------------------------------------------------------------------
// Code developed by:
//
// G.A.P. Cirrone(a)*, F. Di Rosa(a), S. Guatelli(b), G. Russo(a)
//
// (a) Laboratori Nazionali del Sud
// of the INFN, Catania, Italy
// (b) INFN Section of Genova, Genova, Italy
//
// * cirrone@lns.infn.it
// ----------------------------------------------------------------------------
#include "HIProtonNeutronPrecompoundGEM.hh"
#include "G4ParticleDefinition.hh"
#include "G4ProcessManager.hh"
#include "G4ProtonInelasticProcess.hh"
#include "G4NeutronInelasticProcess.hh"
#include "G4HadronCaptureProcess.hh"
#include "G4HadronFissionProcess.hh"
#include "G4ProtonInelasticCrossSection.hh"
#include "G4NeutronInelasticCrossSection.hh"
#include "G4PreCompoundModel.hh"
#include "G4LFission.hh"
#include "G4LCapture.hh"
#include "G4Evaporation.hh"
#include "G4ExcitationHandler.hh"
HIProtonNeutronPrecompoundGEM::HIProtonNeutronPrecompoundGEM(const G4String& name):
G4VPhysicsConstructor(name)
{
G4cout<< "HADRONIC INELASTIC PROCESS(ES): G4XXXInelasticProcess (protons, neutrons)"
<< G4endl
<< "APPLIED MODEL(S): G4PreCompound"
<< G4endl
<< " combined with GEM Evaporation model"
<< G4endl;
}
HIProtonNeutronPrecompoundGEM::~HIProtonNeutronPrecompoundGEM()
{}
void HIProtonNeutronPrecompoundGEM::ConstructProcess()
{
G4ParticleDefinition* particle = 0;
G4ProcessManager* processManager = 0;
// ********************************
// *** Hadrons: Inelastic Model ***
// ********************************
G4ExcitationHandler* excitationHandler = new G4ExcitationHandler();
G4Evaporation* evaporation = new G4Evaporation();
evaporation -> SetGEMChannel();
excitationHandler -> SetEvaporation(evaporation);
G4double protonNeutronPrecompoundMinEnergy = 0. * MeV;
G4double protonNeutronPrecompoundMaxEnergy = 100. * MeV;
G4PreCompoundModel* hadronPreCompoundModel = new G4PreCompoundModel(excitationHandler);
hadronPreCompoundModel -> SetMinEnergy(protonNeutronPrecompoundMinEnergy);
hadronPreCompoundModel -> SetMaxEnergy(protonNeutronPrecompoundMaxEnergy);
// **************
// *** Proton ***
// **************
G4ProtonInelasticProcess* protonInelasticProcess = new G4ProtonInelasticProcess();
G4ProtonInelasticCrossSection* protonInelasticCrossSection = new G4ProtonInelasticCrossSection();
protonInelasticProcess -> RegisterMe(hadronPreCompoundModel);
protonInelasticProcess -> AddDataSet(protonInelasticCrossSection);
particle = G4Proton::Proton();
processManager = particle -> GetProcessManager();
processManager -> AddDiscreteProcess(protonInelasticProcess);
// ***************
// *** Neutron ***
// ***************
G4NeutronInelasticProcess* neutronInelasticProcess = new G4NeutronInelasticProcess;
G4NeutronInelasticCrossSection* neutronInelasticCrossSection = new G4NeutronInelasticCrossSection;
G4HadronCaptureProcess* neutronCaptureProcess = new G4HadronCaptureProcess();
G4HadronFissionProcess* neutronFissionProcess = new G4HadronFissionProcess();
G4double neutronCaptureFissionMinEnergy = 0. * TeV;
G4double neutronCaptureFissionMaxEnergy = 100. * TeV;
G4LCapture* neutronCaptureModel = new G4LCapture();
neutronCaptureModel -> SetMinEnergy(neutronCaptureFissionMinEnergy);
neutronCaptureModel -> SetMaxEnergy(neutronCaptureFissionMaxEnergy);
G4LFission* neutronFissionModel = new G4LFission();
neutronFissionModel -> SetMinEnergy(neutronCaptureFissionMinEnergy);
neutronFissionModel -> SetMaxEnergy(neutronCaptureFissionMaxEnergy);
neutronInelasticProcess -> RegisterMe(hadronPreCompoundModel);
neutronInelasticProcess -> AddDataSet(neutronInelasticCrossSection);
neutronCaptureProcess -> RegisterMe(neutronCaptureModel);
neutronFissionProcess -> RegisterMe(neutronFissionModel);
particle = G4Neutron::Neutron();
processManager = particle -> GetProcessManager();
processManager -> AddDiscreteProcess(neutronInelasticProcess);
processManager -> AddDiscreteProcess(neutronCaptureProcess);
processManager -> AddDiscreteProcess(neutronFissionProcess);
}
@@ -1,152 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// $Id: HadrontherapyProtonPrecompoundGEMFermi.cc; May 2005
// ----------------------------------------------------------------------------
// GEANT 4 - Hadrontherapy example
// ----------------------------------------------------------------------------
// Code developed by:
//
// G.A.P. Cirrone(a)*, F. Di Rosa(a), S. Guatelli(b), G. Russo(a)
//
// (a) Laboratori Nazionali del Sud
// of the INFN, Catania, Italy
// (b) INFN Section of Genova, Genova, Italy
//
// * cirrone@lns.infn.it
// ----------------------------------------------------------------------------
#include "HIProtonNeutronPrecompoundGEMFermi.hh"
#include "G4ParticleDefinition.hh"
#include "G4ProcessManager.hh"
#include "G4ProtonInelasticProcess.hh"
#include "G4NeutronInelasticProcess.hh"
#include "G4HadronCaptureProcess.hh"
#include "G4HadronFissionProcess.hh"
#include "G4ProtonInelasticCrossSection.hh"
#include "G4NeutronInelasticCrossSection.hh"
#include "G4PreCompoundModel.hh"
#include "G4LFission.hh"
#include "G4LCapture.hh"
#include "G4Evaporation.hh"
#include "G4ExcitationHandler.hh"
#include "G4FermiBreakUp.hh"
HIProtonNeutronPrecompoundGEMFermi::HIProtonNeutronPrecompoundGEMFermi(const G4String& name):
G4VPhysicsConstructor(name)
{
G4cout<< "HADRONIC INELASTIC PROCESS(ES): G4XXXInelasticProcess (protons, neutrons)"
<< G4endl
<< "APPLIED MODEL(S): G4PreCompound"
<< G4endl
<< " combined with GEM Evaporation model and Fermi Break-up model"
<< G4endl;
}
HIProtonNeutronPrecompoundGEMFermi::~HIProtonNeutronPrecompoundGEMFermi()
{}
void HIProtonNeutronPrecompoundGEMFermi::ConstructProcess()
{
G4ParticleDefinition* particle = 0;
G4ProcessManager* processManager = 0;
// ********************************
// *** Hadrons: Inelastic Model ***
// ********************************
G4ExcitationHandler* excitationHandler = new G4ExcitationHandler();
G4Evaporation* evaporation = new G4Evaporation();
evaporation -> SetGEMChannel();
excitationHandler -> SetEvaporation(evaporation);
G4int targetZ = 1;
G4int targetA = 2 * targetZ;
G4FermiBreakUp* hadronFermiBreakUpModel = new G4FermiBreakUp();
excitationHandler -> SetFermiModel(hadronFermiBreakUpModel);
excitationHandler -> SetMaxAandZForFermiBreakUp(targetA,targetZ);
G4double protonNeutronPrecompoundMinEnergy = 0. * MeV;
G4double protonNeutronPrecompoundMaxEnergy = 100. * MeV;
G4PreCompoundModel* hadronPreCompoundModel = new G4PreCompoundModel(excitationHandler);
hadronPreCompoundModel -> SetMinEnergy(protonNeutronPrecompoundMinEnergy);
hadronPreCompoundModel -> SetMaxEnergy(protonNeutronPrecompoundMaxEnergy);
// **************
// *** Proton ***
// **************
G4ProtonInelasticProcess* protonInelasticProcess = new G4ProtonInelasticProcess();
G4ProtonInelasticCrossSection* protonInelasticCrossSection = new G4ProtonInelasticCrossSection();
protonInelasticProcess -> RegisterMe(hadronPreCompoundModel);
protonInelasticProcess -> AddDataSet(protonInelasticCrossSection);
particle = G4Proton::Proton();
processManager = particle -> GetProcessManager();
processManager -> AddDiscreteProcess(protonInelasticProcess);
// ***************
// *** Neutron ***
// ***************
G4NeutronInelasticProcess* neutronInelasticProcess = new G4NeutronInelasticProcess;
G4NeutronInelasticCrossSection* neutronInelasticCrossSection = new G4NeutronInelasticCrossSection;
G4HadronCaptureProcess* neutronCaptureProcess = new G4HadronCaptureProcess();
G4HadronFissionProcess* neutronFissionProcess = new G4HadronFissionProcess();
G4double neutronCaptureFissionMinEnergy = 0. * TeV;
G4double neutronCaptureFissionMaxEnergy = 100. * TeV;
G4LCapture* neutronCaptureModel = new G4LCapture();
neutronCaptureModel -> SetMinEnergy(neutronCaptureFissionMinEnergy);
neutronCaptureModel -> SetMaxEnergy(neutronCaptureFissionMaxEnergy);
G4LFission* neutronFissionModel = new G4LFission();
neutronFissionModel -> SetMinEnergy(neutronCaptureFissionMinEnergy);
neutronFissionModel -> SetMaxEnergy(neutronCaptureFissionMaxEnergy);
neutronInelasticProcess -> RegisterMe(hadronPreCompoundModel);
neutronInelasticProcess -> AddDataSet(neutronInelasticCrossSection);
neutronCaptureProcess -> RegisterMe(neutronCaptureModel);
neutronFissionProcess -> RegisterMe(neutronFissionModel);
particle = G4Neutron::Neutron();
processManager = particle -> GetProcessManager();
processManager -> AddDiscreteProcess(neutronInelasticProcess);
processManager -> AddDiscreteProcess(neutronCaptureProcess);
processManager -> AddDiscreteProcess(neutronFissionProcess);
}
@@ -23,50 +23,43 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: HadrontherapyMuonStandard.cc; May 2005
// ----------------------------------------------------------------------------
// GEANT 4 - Hadrontherapy example
// ----------------------------------------------------------------------------
// Code developed by:
// HadrontherapyAnalysisFileMessenger.cc
//
// G.A.P. Cirrone(a)*, F. Di Rosa(a), S. Guatelli(b), G. Russo(a)
//
// (a) Laboratori Nazionali del Sud
// of the National Institute for Nuclear Physics, Catania, Italy
// (b) National Institute for Nuclear Physics Section of Genova, genova, Italy
//
// * cirrone@lns.infn.it
// ----------------------------------------------------------------------------
// See more at: http://g4advancedexamples.lngs.infn.it/Examples/hadrontherapy
//
#include "HadrontherapyAnalysisFileMessenger.hh"
#include "HadrontherapyAnalysisManager.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIdirectory.hh"
#include "HRMuonMinusCapture.hh"
#include "G4ParticleDefinition.hh"
#include "G4ProcessManager.hh"
#include "G4MuonMinusCaptureAtRest.hh"
HRMuonMinusCapture::HRMuonMinusCapture(const G4String& name):
G4VPhysicsConstructor(name)
#ifdef ANALYSIS_USE
//
/////////////////////////////////////////////////////////////////////////////
HadrontherapyAnalysisFileMessenger::HadrontherapyAnalysisFileMessenger(HadrontherapyAnalysisManager* amgr)
:AnalysisManager(amgr)
{
G4cout<< "HADRONIC PROCESS(ES): G4MuonMinusCaptureAtRest (muon-)"
<< G4endl
<< "APPLIED MODEL(S): -"
<< G4endl;
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);
}
HRMuonMinusCapture::~HRMuonMinusCapture()
{ }
void HRMuonMinusCapture::ConstructProcess()
/////////////////////////////////////////////////////////////////////////////
HadrontherapyAnalysisFileMessenger::~HadrontherapyAnalysisFileMessenger()
{
// *************
// *** Muon- ***
// *************
G4MuonMinusCaptureAtRest* muonMinusCaptureProcess= new G4MuonMinusCaptureAtRest();
G4ParticleDefinition* particle = G4MuonMinus::MuonMinus();
G4ProcessManager* processManager = particle -> GetProcessManager();
processManager -> AddProcess(muonMinusCaptureProcess, 0, -1, -1);
delete FileNameCmd;
}
/////////////////////////////////////////////////////////////////////////////
void HadrontherapyAnalysisFileMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
{
if (command == FileNameCmd)
{
AnalysisManager->SetAnalysisFileName(newValue);
AnalysisManager->flush(); //< fills matrix, writes it into file and books a new file and histograms etc.
AnalysisManager->book();
}
}
#endif
@@ -23,41 +23,66 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: HadrontherapyAnalisysManager.cc; Last modified: G.A.P.Cirrone, February 2008;
// ----------------------------------------------------------------------------
// GEANT 4 - Hadrontherapy example
// ----------------------------------------------------------------------------
// Code developed by:
//
// G.A.P. Cirrone(a)*, F. Di Rosa(a), S. Guatelli(b), G. Russo(a)
//
// (a) Laboratori Nazionali del Sud
// of the INFN, Catania, Italy
// (b) INFN Section of Genova, Genova, Italy
//
// * cirrone@lns.infn.it
// ----------------------------------------------------------------------------
// $Id: HadrontherapyAnalisysManager.cc;
// See more at: http://g4advancedexamples.lngs.infn.it/Examples/hadrontherapy
#ifdef G4ANALYSIS_USE
#include "HadrontherapyAnalysisManager.hh"
#include "HadrontherapyMatrix.hh"
#include "HadrontherapyAnalysisFileMessenger.hh"
#include <time.h>
#ifdef ANALYSIS_USE
HadrontherapyAnalysisManager* HadrontherapyAnalysisManager::instance = 0;
HadrontherapyAnalysisManager::HadrontherapyAnalysisManager() :
aFact(0), theTree(0), histFact(0), tupFact(0), h1(0), h2(0), h3(0),
h4(0), h5(0), h6(0), h7(0), h8(0), h9(0), h10(0), h11(0), h12(0), h13(0), h14(0), ntuple(0),
ionTuple(0)
{
}
#ifdef G4ANALYSIS_USE_ROOT
#undef G4ANALYSIS_USE
#endif
/////////////////////////////////////////////////////////////////////////////
#ifdef G4ANALYSIS_USE
HadrontherapyAnalysisManager::HadrontherapyAnalysisManager() :
analysisFileName("DoseDistribution.root"), aFact(0), theTree(0), histFact(0), tupFact(0), h1(0), h2(0), h3(0),
h4(0), h5(0), h6(0), h7(0), h8(0), h9(0), h10(0), h11(0), h12(0), h13(0), h14(0), h15(0), h16(0), ntuple(0),
ionTuple(0),
fragmentTuple(0),
eventCounter(0)
{
fMess = new HadrontherapyAnalysisFileMessenger(this);
}
#endif
#ifdef G4ANALYSIS_USE_ROOT
HadrontherapyAnalysisManager::HadrontherapyAnalysisManager() :
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),
theROOTNtuple(0),
theROOTIonTuple(0),
fragmentNtuple(0),
metaData(0),
eventCounter(0)
{
fMess = new HadrontherapyAnalysisFileMessenger(this);
}
#endif
/////////////////////////////////////////////////////////////////////////////
HadrontherapyAnalysisManager::~HadrontherapyAnalysisManager()
{
delete(fMess); //kill the messenger
#ifdef G4ANALYSIS_USE
delete fragmentTuple;
fragmentTuple = 0;
HadrontherapyAnalysisManager::~HadrontherapyAnalysisManager()
{
delete ionTuple;
ionTuple = 0;
delete ntuple;
ntuple = 0;
delete h16;
h16 = 0;
delete h15;
h15 = 0;
delete h14;
h14 = 0;
@@ -99,7 +124,7 @@ HadrontherapyAnalysisManager::~HadrontherapyAnalysisManager()
delete h1;
h1 = 0;
delete tupFact;
tupFact = 0;
@@ -111,28 +136,97 @@ HadrontherapyAnalysisManager::~HadrontherapyAnalysisManager()
delete aFact;
aFact = 0;
}
#endif
#ifdef G4ANALYSIS_USE_ROOT
delete metaData;
metaData = 0;
delete fragmentNtuple;
fragmentNtuple = 0;
delete theROOTIonTuple;
theROOTIonTuple = 0;
delete theROOTNtuple;
theROOTNtuple = 0;
delete histo16;
histo14 = 0;
delete histo15;
histo14 = 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;
#endif
}
/////////////////////////////////////////////////////////////////////////////
HadrontherapyAnalysisManager* HadrontherapyAnalysisManager::getInstance()
{
if (instance == 0) instance = new HadrontherapyAnalysisManager;
return instance;
}
void HadrontherapyAnalysisManager::book()
/////////////////////////////////////////////////////////////////////////////
void HadrontherapyAnalysisManager::SetAnalysisFileName(G4String aFileName)
{
this->analysisFileName = aFileName;
}
/////////////////////////////////////////////////////////////////////////////
void HadrontherapyAnalysisManager::book()
{
#ifdef G4ANALYSIS_USE
// Build up the analysis factory
aFact = AIDA_createAnalysisFactory();
AIDA::ITreeFactory* treeFact = aFact -> createTreeFactory();
// Create the .hbk or the .root file
G4String fileName = "hadrontherapyOutput.hbk";
G4String rootFileName = "hadrontherapyOutput.root";
G4String fileName = "DoseDistribution.hbk";
std::string opts = "export=root";
theTree = treeFact -> create(fileName,"hbook",false,true);
theTree = treeFact -> create(rootFileName,"ROOT",false,true,opts);
theTree = treeFact -> create(analysisFileName,"ROOT",false,true,opts);
// Factories are not "managed" by an AIDA analysis system.
// They must be deleted by the AIDA user code.
@@ -146,7 +240,7 @@ void HadrontherapyAnalysisManager::book()
h1 = histFact -> createHistogram1D("10","slice, energy", 400, 0., 400. );
h2 = histFact -> createHistogram1D("20","Secondary protons - slice, energy", 400, 0., 400. );
h3 = histFact -> createHistogram1D("30","Secondary neutrons - slice, energy", 400, 0., 400. );
h4 = histFact -> createHistogram1D("40","Secondary alpha - slice, energy", 400, 0., 400. );
@@ -160,17 +254,21 @@ void HadrontherapyAnalysisManager::book()
h8 = histFact -> createHistogram1D("80","Secondary deuteron - slice, energy", 400, 0., 400. );
h9 = histFact -> createHistogram1D("90","Secondary pion - slice, energy", 400, 0., 400. );
h10 = histFact -> createHistogram1D("100","Energy distribution of secondary electrons", 70, 0., 70. );
h11 = histFact -> createHistogram1D("110","Energy distribution of secondary photons", 70, 0., 70. );
h12 = histFact -> createHistogram1D("120","Energy distribution of secondary deuterons", 70, 0., 70. );
h13 = histFact -> createHistogram1D("130","Energy distribution of secondary tritons", 70, 0., 70. );
h14 = histFact -> createHistogram1D("140","Energy distribution of secondary alpha particles", 70, 0., 70. );
h15 = histFact -> createHistogram1D("150","Energy distribution of helium fragments after the phantom", 70, 0., 500.);
h16 = histFact -> createHistogram1D("160","Energy distribution of hydrogen fragments after the phantom", 70, 0., 500.);
// Create the ntuple
G4String columnNames = "int i; int j; int k; double energy;";
G4String options = "";
@@ -180,124 +278,361 @@ void HadrontherapyAnalysisManager::book()
G4String columnNames2 = "int a; double z; int occupancy; double energy;";
G4String options2 = "";
if (tupFact) ionTuple = tupFact -> create("2","2", columnNames2, options2);
// Create the fragment ntuple
G4String columnNames3 = "int a; double z; double energy; double posX; double posY; double posZ;";
G4String options3 = "";
if (tupFact) fragmentTuple = tupFact -> create("3","3", columnNames3, options3);
#endif
#ifdef G4ANALYSIS_USE_ROOT
// Use ROOT
theTFile = new TFile(analysisFileName, "RECREATE");
// Create the histograms with the energy deposit along the X axis
histo1 = createHistogram1D("braggPeak","slice, energy", 400, 0., 27.9); //<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.);
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");
#endif
}
void HadrontherapyAnalysisManager::FillEnergyDeposit(G4int i,
G4int j,
/////////////////////////////////////////////////////////////////////////////
void HadrontherapyAnalysisManager::FillEnergyDeposit(G4int i,
G4int j,
G4int k,
G4double energy)
{
#ifdef G4ANALYSIS_USE
if (ntuple) {
G4int iSlice = ntuple -> findColumn("i");
G4int jSlice = ntuple -> findColumn("j");
G4int kSlice = ntuple -> findColumn("k");
G4int iEnergy = ntuple -> findColumn("energy");
ntuple -> fill(iSlice,i);
ntuple -> fill(jSlice,j);
ntuple -> fill(jSlice,j);
ntuple -> fill(kSlice,k);
ntuple -> fill(iEnergy, energy); }
ntuple -> addRow();
ntuple -> addRow();
#endif
#ifdef G4ANALYSIS_USE_ROOT
if (theROOTNtuple) {
theROOTNtuple->Fill(i, j, k, energy);
}
#endif
}
/////////////////////////////////////////////////////////////////////////////
void HadrontherapyAnalysisManager::BraggPeak(G4int slice, G4double energy)
{
#ifdef G4ANALYSIS_USE
h1 -> fill(slice,energy);
#endif
#ifdef G4ANALYSIS_USE_ROOT
histo1->SetBinContent(slice, energy); //This uses setbincontent instead of fill to get labels correct
#endif
}
/////////////////////////////////////////////////////////////////////////////
void HadrontherapyAnalysisManager::SecondaryProtonEnergyDeposit(G4int slice, G4double energy)
{
#ifdef G4ANALYSIS_USE
h2 -> fill(slice,energy);
#endif
#ifdef G4ANALYSIS_USE_ROOT
histo2->Fill(slice, energy);
#endif
}
/////////////////////////////////////////////////////////////////////////////
void HadrontherapyAnalysisManager::SecondaryNeutronEnergyDeposit(G4int slice, G4double energy)
{
#ifdef G4ANALYSIS_USE
h3 -> fill(slice,energy);
#endif
#ifdef G4ANALYSIS_USE_ROOT
histo3->Fill(slice, energy);
#endif
}
/////////////////////////////////////////////////////////////////////////////
void HadrontherapyAnalysisManager::SecondaryAlphaEnergyDeposit(G4int slice, G4double energy)
{
#ifdef G4ANALYSIS_USE
h4 -> fill(slice,energy);
#endif
#ifdef G4ANALYSIS_USE_ROOT
histo4->Fill(slice, energy);
#endif
}
/////////////////////////////////////////////////////////////////////////////
void HadrontherapyAnalysisManager::SecondaryGammaEnergyDeposit(G4int slice, G4double energy)
{
#ifdef G4ANALYSIS_USE
h5 -> fill(slice,energy);
#endif
#ifdef G4ANALYSIS_USE_ROOT
histo5->Fill(slice, energy);
#endif
}
/////////////////////////////////////////////////////////////////////////////
void HadrontherapyAnalysisManager::SecondaryElectronEnergyDeposit(G4int slice, G4double energy)
{
#ifdef G4ANALYSIS_USE
h6 -> fill(slice,energy);
#endif
#ifdef G4ANALYSIS_USE_ROOT
histo6->Fill(slice, energy);
#endif
}
/////////////////////////////////////////////////////////////////////////////
void HadrontherapyAnalysisManager::SecondaryTritonEnergyDeposit(G4int slice, G4double energy)
{
#ifdef G4ANALYSIS_USE
h7 -> fill(slice,energy);
#endif
#ifdef G4ANALYSIS_USE_ROOT
histo7->Fill(slice, energy);
#endif
}
/////////////////////////////////////////////////////////////////////////////
void HadrontherapyAnalysisManager::SecondaryDeuteronEnergyDeposit(G4int slice, G4double energy)
{
#ifdef G4ANALYSIS_USE
h8 -> fill(slice,energy);
#endif
#ifdef G4ANALYSIS_USE_ROOT
histo8->Fill(slice, energy);
#endif
}
/////////////////////////////////////////////////////////////////////////////
void HadrontherapyAnalysisManager::SecondaryPionEnergyDeposit(G4int slice, G4double energy)
{
#ifdef G4ANALYSIS_USE
h9 -> fill(slice,energy);
#endif
#ifdef G4ANALYSIS_USE_ROOT
histo9->Fill(slice, energy);
#endif
}
/////////////////////////////////////////////////////////////////////////////
void HadrontherapyAnalysisManager::electronEnergyDistribution(G4double energy)
{
#ifdef G4ANALYSIS_USE
h10 -> fill(energy);
#endif
#ifdef G4ANALYSIS_USE_ROOT
histo10->Fill(energy);
#endif
}
/////////////////////////////////////////////////////////////////////////////
void HadrontherapyAnalysisManager::gammaEnergyDistribution(G4double energy)
{
#ifdef G4ANALYSIS_USE
h11 -> fill(energy);
#endif
#ifdef G4ANALYSIS_USE_ROOT
histo11->Fill(energy);
#endif
}
/////////////////////////////////////////////////////////////////////////////
void HadrontherapyAnalysisManager::deuteronEnergyDistribution(G4double energy)
{
#ifdef G4ANALYSIS_USE
h12 -> fill(energy);
#endif
#ifdef G4ANALYSIS_USE_ROOT
histo12->Fill(energy);
#endif
}
/////////////////////////////////////////////////////////////////////////////
void HadrontherapyAnalysisManager::tritonEnergyDistribution(G4double energy)
{
#ifdef G4ANALYSIS_USE
h13 -> fill(energy);
#endif
#ifdef G4ANALYSIS_USE_ROOT
histo13->Fill(energy);
#endif
}
/////////////////////////////////////////////////////////////////////////////
void HadrontherapyAnalysisManager::alphaEnergyDistribution(G4double energy)
{
#ifdef G4ANALYSIS_USE
h14 -> fill(energy);
#endif
#ifdef G4ANALYSIS_USE_ROOT
histo14->Fill(energy);
#endif
}
/////////////////////////////////////////////////////////////////////////////
void HadrontherapyAnalysisManager::heliumEnergy(G4double secondaryParticleKineticEnergy)
{
#ifdef G4ANALYSIS_USE
h15->fill(secondaryParticleKineticEnergy);
#endif
#ifdef G4ANALYSIS_USE_ROOT
histo15->Fill(secondaryParticleKineticEnergy);
#endif
}
void HadrontherapyAnalysisManager::genericIonInformation(G4int a,
G4double z,
G4int electronOccupancy,
G4double energy)
/////////////////////////////////////////////////////////////////////////////
void HadrontherapyAnalysisManager::hydrogenEnergy(G4double secondaryParticleKineticEnergy)
{
#ifdef G4ANALYSIS_USE
h16->fill(secondaryParticleKineticEnergy);
#endif
#ifdef G4ANALYSIS_USE_ROOT
histo16->Fill(secondaryParticleKineticEnergy);
#endif
}
void HadrontherapyAnalysisManager::fillFragmentTuple(G4int A, G4double Z, G4double energy, G4double posX, G4double posY, G4double posZ)
{
#ifdef G4ANALYSIS_USE
if (fragmentTuple) {
G4int aIndex = fragmentTuple -> findColumn("a");
G4int zIndex = fragmentTuple -> findColumn("z");
G4int energyIndex = fragmentTuple -> findColumn("energy");
G4int posXIndex = fragmentTuple -> findColumn("posX");
G4int posYIndex = fragmentTuple -> findColumn("posY");
G4int posZIndex = fragmentTuple -> findColumn("posZ");
fragmentTuple -> fill(aIndex,A);
fragmentTuple -> fill(zIndex,Z);
fragmentTuple -> fill(energyIndex, energy);
fragmentTuple -> fill(posXIndex, posX);
fragmentTuple -> fill(posYIndex, posY);
fragmentTuple -> fill(posZIndex, posZ);
fragmentTuple -> addRow();
}
#endif
#ifdef G4ANALYSIS_USE_ROOT
//G4cout <<" A = " << A << " Z = " << Z << " energy = " << energy << G4endl;
fragmentNtuple->Fill(A, Z, energy, posX, posY, posZ);
#endif
}
/////////////////////////////////////////////////////////////////////////////
void HadrontherapyAnalysisManager::genericIonInformation(G4int a,
G4double z,
G4int electronOccupancy,
G4double energy)
{
#ifdef G4ANALYSIS_USE
if (ionTuple) {
G4int aIndex = ionTuple -> findColumn("a");
G4int zIndex = ionTuple -> findColumn("z");
G4int electronIndex = ionTuple -> findColumn("occupancy");
G4int electronIndex = ionTuple -> findColumn("occupancy");
G4int energyIndex = ionTuple -> findColumn("energy");
ionTuple -> fill(aIndex,a);
ionTuple -> fill(zIndex,z);
ionTuple -> fill(electronIndex, electronOccupancy);
ionTuple -> fill(zIndex,z);
ionTuple -> fill(electronIndex, electronOccupancy);
ionTuple -> fill(energyIndex, energy);
}
ionTuple -> addRow();
ionTuple -> addRow();
#endif
#ifdef G4ANALYSIS_USE_ROOT
if (theROOTIonTuple) {
theROOTIonTuple->Fill(a, z, electronOccupancy, energy);
}
#endif
}
void HadrontherapyAnalysisManager::finish()
{
/////////////////////////////////////////////////////////////////////////////
void HadrontherapyAnalysisManager::startNewEvent()
{
eventCounter++;
}
/////////////////////////////////////////////////////////////////////////////
void HadrontherapyAnalysisManager::setGeometryMetaData(G4double endDetectorPosition, G4double waterThickness, G4double phantomCenter)
{
this->detectorDistance = endDetectorPosition;
this->phantomDepth = waterThickness;
this->phantomCenterDistance = phantomCenter;
}
void HadrontherapyAnalysisManager::setBeamMetaData(G4double meanKineticEnergy,G4double sigmaEnergy)
{
this->beamEnergy = meanKineticEnergy;
this->energyError = sigmaEnergy;
}
/////////////////////////////////////////////////////////////////////////////
void HadrontherapyAnalysisManager::flush()
{
HadrontherapyMatrix* matrix = HadrontherapyMatrix::getInstance();
matrix->TotalEnergyDeposit();
#ifdef G4ANALYSIS_USE
theTree -> commit();
theTree ->close();
#endif
#ifdef G4ANALYSIS_USE_ROOT
metaData->Fill((Float_t) eventCounter,(Float_t) detectorDistance, (Float_t) phantomDepth, (Float_t) beamEnergy,(Float_t) energyError, (Float_t) phantomCenterDistance);
metaData->Write();
theROOTNtuple->Write();
theROOTIonTuple->Write();
fragmentNtuple->Write();
theTFile->Write();
// theTFile->Clear();
theTFile->Close();
#endif
eventCounter = 0;
matrix->flush();
}
/////////////////////////////////////////////////////////////////////////////
void HadrontherapyAnalysisManager::finish()
{
#ifdef G4ANALYSIS_USE
// Write all histograms to file
theTree -> commit();
// Close (will again commit)
theTree ->close();
#endif
#ifdef G4ANALYSIS_USE_ROOT
metaData->Fill((Float_t) eventCounter,(Float_t) detectorDistance, (Float_t) phantomDepth, (Float_t) beamEnergy,(Float_t) energyError, (Float_t) phantomCenterDistance);
metaData->Write();
theROOTNtuple->Write();
theROOTIonTuple->Write();
fragmentNtuple->Write();
theTFile->Write();
theTFile->Close();
#endif
eventCounter = 0;
}
#endif
@@ -308,5 +643,3 @@ void HadrontherapyAnalysisManager::finish()
@@ -23,25 +23,9 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// HadrontherapyDetectorConstruction.cc
//
// $Id: HadrontherapyDetectorConstruction.cc;
// Last modified: G.A.P.Cirrone, April 2008;
//
// See more at: http://geant4infn.wikispaces.com
//
// ----------------------------------------------------------------------------
// GEANT 4 - Hadrontherapy example
// ----------------------------------------------------------------------------
// Code developed by:
//
// G.A.P. Cirrone(a)*, F. Di Rosa(a), S. Guatelli(b), G. Russo(a)
//
// (a) Laboratori Nazionali del Sud
// of the INFN, Catania, Italy
// (b) INFN Section of Genova, Genova, Italy
//
// * cirrone@lns.infn.it
// ----------------------------------------------------------------------------
// See more at: http://g4advancedexamples.lngs.infn.it/Examples/hadrontherapy
#include "G4SDManager.hh"
#include "G4RunManager.hh"
@@ -54,252 +38,364 @@
#include "G4RotationMatrix.hh"
#include "G4Colour.hh"
#include "G4UserLimits.hh"
#include "G4UnitsTable.hh"
#include "G4VisAttributes.hh"
#include "G4NistManager.hh"
#include "HadrontherapyDetectorROGeometry.hh"
#include "HadrontherapyDetectorMessenger.hh"
#include "HadrontherapyDetectorSD.hh"
#include "HadrontherapyDetectorConstruction.hh"
#include "HadrontherapyMaterial.hh"
#include "HadrontherapyBeamLine.hh"
#include "HadrontherapyModulator.hh"
#include "HadrontherapyMatrix.hh"
/////////////////////////////////////////////////////////////////////////////
HadrontherapyDetectorConstruction::HadrontherapyDetectorConstruction()
: detectorSD(0), detectorROGeometry(0), beamLine(0), modulator(0),
physicalTreatmentRoom(0),
patientPhysicalVolume(0),
detectorLogicalVolume(0),
detectorPhysicalVolume(0)
HadrontherapyDetectorConstruction::HadrontherapyDetectorConstruction(G4VPhysicalVolume* physicalTreatmentRoom)
: motherPhys(physicalTreatmentRoom),
detectorSD(0), detectorROGeometry(0), matrix(0),
phantomPhysicalVolume(0),
detectorLogicalVolume(0), detectorPhysicalVolume(0),
phantomSizeX(20.*cm), phantomSizeY(20.*cm), phantomSizeZ(20.*cm), // Default half dimensions
detectorSizeX(2.*cm), detectorSizeY(2.*cm), detectorSizeZ(2.*cm),
phantomPosition(20.*cm, 0.*cm, 0.*cm),
detectorToPhantomPosition(0.*cm,18.*cm,18.*cm)// Default displacement of the detector respect to the phantom
{
// Messenger to change parameters of the geometry
// NOTE! that the HadrontherapyDetectorConstruction class
// does NOT inherit from G4VUserDetectorConstruction G4 class
// So the Construct() mandatory virtual method is inside another geometric class
// (like the passiveProtonBeamLIne, ...)
// Messenger to change parameters of the phantom/detector geometry
detectorMessenger = new HadrontherapyDetectorMessenger(this);
material = new HadrontherapyMaterial();
// Default detector voxels size
// 200 slabs along the beam direction (X)
sizeOfVoxelAlongX = 200 *um;
sizeOfVoxelAlongY = 2 * detectorSizeY;
sizeOfVoxelAlongZ = 2 * detectorSizeZ;
// Detector sizes
detectorSizeX = 20.*mm;
detectorSizeY = 20.*mm;
detectorSizeZ = 20.*mm;
// Calculate (and eventually set) detector position by displacement, phantom size and detector size
SetDetectorPosition();
// Number of the detector voxels
numberOfVoxelsAlongX = 400;
numberOfVoxelsAlongY = 1;
numberOfVoxelsAlongZ = 1;
// Build phantom and associated detector
ConstructPhantom();
ConstructDetector();
// Set number of the detector voxels along X Y and Z directions.
// This will construct also the sensitive detector, the ROGeometry
// and the matrix where the energy deposited is collected!
SetNumberOfVoxelBySize(sizeOfVoxelAlongX, sizeOfVoxelAlongY, sizeOfVoxelAlongZ);
}
/////////////////////////////////////////////////////////////////////////////
HadrontherapyDetectorConstruction::~HadrontherapyDetectorConstruction()
{
delete material;
if (detectorROGeometry) delete detectorROGeometry;
delete detectorMessenger;
delete detectorROGeometry;// This should be safe in C++ even if the argument is a NULL pointer
delete matrix;
delete detectorMessenger;
}
G4VPhysicalVolume* HadrontherapyDetectorConstruction::Construct()
{
// Define the materials of the experimental set-up
material -> DefineMaterials();
// Define the geometry components
ConstructBeamLine();
ConstructDetector();
// Set the sensitive detector where the energy deposit is collected
ConstructSensitiveDetector();
return physicalTreatmentRoom;
}
/////////////////////////////////////////////////////////////////////////////
void HadrontherapyDetectorConstruction::ConstructBeamLine()
{
G4Material* air = material -> GetMat("Air") ;
G4Material* water = material -> GetMat("G4_WATER");
// -----------------------------
// 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;
G4Box* treatmentRoom = new G4Box("TreatmentRoom",worldX,worldY,worldZ);
G4LogicalVolume* logicTreatmentRoom = new G4LogicalVolume(treatmentRoom,
air,
"logicTreatmentRoom",
0,0,0);
physicalTreatmentRoom = new G4PVPlacement(0,
G4ThreeVector(),
"physicalTreatmentRoom",
logicTreatmentRoom,
0,false,0);
G4double maxStepTreatmentRoom = 0.1 *mm;
logicTreatmentRoom -> SetUserLimits(new G4UserLimits(maxStepTreatmentRoom));
// The treatment room is invisible in the Visualisation
logicTreatmentRoom -> SetVisAttributes (G4VisAttributes::Invisible);
beamLine = new HadrontherapyBeamLine(physicalTreatmentRoom);
beamLine -> HadrontherapyBeamLineSupport();
beamLine -> HadrontherapyBeamScatteringFoils();
beamLine -> HadrontherapyRangeShifter();
beamLine -> HadrontherapyBeamCollimators();
beamLine -> HadrontherapyBeamMonitoring();
beamLine -> HadrontherapyMOPIDetector();
beamLine -> HadrontherapyBeamNozzle();
beamLine -> HadrontherapyBeamFinalCollimator();
modulator = new HadrontherapyModulator();
modulator -> BuildModulator(physicalTreatmentRoom);
void HadrontherapyDetectorConstruction::ConstructPhantom()
{
//----------------------------------------
// Patient:
// a water box used to approximate tissues
// Phantom:
// A box used to approximate tissues
//----------------------------------------
G4Box* patient = new G4Box("patient",20 *cm, 20 *cm, 20 *cm);
G4bool isotopes = false;
G4Material* waterNist = G4NistManager::Instance()->FindOrBuildMaterial("G4_WATER", isotopes);
phantom = new G4Box("Phantom",phantomSizeX, phantomSizeY, phantomSizeZ);
phantomLogicalVolume = new G4LogicalVolume(phantom,
waterNist,
"phantomLog", 0, 0, 0);
G4LogicalVolume* patientLogicalVolume = new G4LogicalVolume(patient,
water,
"patientLog", 0, 0, 0);
patientPhysicalVolume = new G4PVPlacement(0,G4ThreeVector(200.*mm, 0.*mm, 0.*mm),
"patientPhys",
patientLogicalVolume,
physicalTreatmentRoom,
false,0);
// Visualisation attributes of the patient
G4VisAttributes * redWire = new G4VisAttributes(G4Colour(1. ,0. ,0.));
redWire -> SetVisibility(true);
redWire -> SetForceWireframe(true);
patientLogicalVolume -> SetVisAttributes(redWire);
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);
}
/////////////////////////////////////////////////////////////////////////////
void HadrontherapyDetectorConstruction::ConstructDetector()
{
G4Colour lightBlue (0.0, 0.0, .75);
G4Material* water = material -> GetMat("G4_WATER");
//-----------
// Detector
// Detector
//-----------
G4Box* detector = new G4Box("Detector",detectorSizeX,detectorSizeY,detectorSizeZ);
detectorLogicalVolume = new G4LogicalVolume(detector,
water,
"DetectorLog",
0,0,0);
// Fixing the max step allowed in the detector
G4double maxStep = 0.01 *mm;
detectorLogicalVolume -> SetUserLimits(new G4UserLimits(maxStep));
G4double detectorXtranslation = -180.*mm;
detectorPhysicalVolume = new G4PVPlacement(0,
G4ThreeVector(detectorXtranslation, 0.0 *mm, 0.0 *mm),
"DetectorPhys",
G4bool isotopes = false;
G4Material* waterNist = G4NistManager::Instance()->FindOrBuildMaterial("G4_WATER", isotopes);
detector = new G4Box("Detector",detectorSizeX,detectorSizeY,detectorSizeZ);
detectorLogicalVolume = new G4LogicalVolume(detector,
waterNist,
"DetectorLog",
0,0,0);
// Detector is attached by default to the phantom face directly exposed to the beam
detectorPhysicalVolume = new G4PVPlacement(0,
detectorPosition, // Setted by displacement
"DetectorPhys",
detectorLogicalVolume,
patientPhysicalVolume,
phantomPhysicalVolume,
false,0);
// Visualisation attributes of the phantom
G4VisAttributes* simpleBoxVisAttributes = new G4VisAttributes(lightBlue);
simpleBoxVisAttributes -> SetVisibility(true);
simpleBoxVisAttributes -> SetForceSolid(true);
detectorLogicalVolume -> SetVisAttributes(simpleBoxVisAttributes);
// Visualisation attributes of the detector
skyBlue = new G4VisAttributes( G4Colour(135/255. , 206/255. , 235/255. ));
skyBlue -> SetVisibility(true);
skyBlue -> SetForceSolid(true);
//skyBlue -> SetForceWireframe(true);
detectorLogicalVolume -> SetVisAttributes(skyBlue);
// **************
// Cut per Region
// **************
// A smaller cut is fixed in the phantom to calculate the energy deposit with the
// required accuracy
G4Region* aRegion = new G4Region("DetectorLog");
detectorLogicalVolume -> SetRegion(aRegion);
aRegion -> AddRootLogicalVolume(detectorLogicalVolume);
}
/////////////////////////////////////////////////////////////////////////////
void HadrontherapyDetectorConstruction::ConstructSensitiveDetector(G4ThreeVector detectorToWorldPosition)
{
// Install new Sensitive Detector and ROGeometry
delete detectorROGeometry; // this should be safe in C++ also if we have a NULL pointer
// Sensitive Detector and ReadOut geometry definition
G4SDManager* sensitiveDetectorManager = G4SDManager::GetSDMpointer();
G4String sensitiveDetectorName = "Detector";
if (!detectorSD)
{
// The sensitive detector is instantiated
detectorSD = new HadrontherapyDetectorSD(sensitiveDetectorName);
}
// The Read Out Geometry is instantiated
G4String ROGeometryName = "DetectorROGeometry";
detectorROGeometry = new HadrontherapyDetectorROGeometry(ROGeometryName,
detectorToWorldPosition,
detectorSizeX,
detectorSizeY,
detectorSizeZ,
numberOfVoxelsAlongX,
numberOfVoxelsAlongY,
numberOfVoxelsAlongZ);
G4cout << "Instantiating new Read Out Geometry \"" << ROGeometryName << "\""<< G4endl;
// This will invoke Build() HadrontherapyDetectorROGeometry 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 HadrontherapyDetectorConstruction::ConstructSensitiveDetector()
{
// Sensitive Detector and ReadOut geometry definition
G4SDManager* sensitiveDetectorManager = G4SDManager::GetSDMpointer();
/////////////////
// MESSENGERS //
////////////////
G4bool HadrontherapyDetectorConstruction::SetNumberOfVoxelBySize(G4double sizeX, G4double sizeY, G4double sizeZ)
{
// Only change positive dimensions
// XXX numberOfVoxels must be an integer, warn the user
G4String sensitiveDetectorName = "Detector";
if(!detectorSD)
if (sizeX > 0)
{
// The sensitive detector is instantiated
detectorSD = new HadrontherapyDetectorSD(sensitiveDetectorName);
// The Read Out Geometry is instantiated
G4String ROGeometryName = "DetectorROGeometry";
detectorROGeometry = new HadrontherapyDetectorROGeometry(ROGeometryName,
detectorSizeX,
detectorSizeY,
detectorSizeZ,
numberOfVoxelsAlongX,
numberOfVoxelsAlongY,
numberOfVoxelsAlongZ);
detectorROGeometry -> BuildROGeometry();
detectorSD -> SetROgeometry(detectorROGeometry);
sensitiveDetectorManager -> AddNewDetector(detectorSD);
detectorLogicalVolume -> SetSensitiveDetector(detectorSD);
if (sizeX > 2*detectorSizeX)
{
G4cout << "WARNING: Voxel X size must be smaller or equal than that of detector X" << G4endl;
return false;
}
// Round to the nearest integer
numberOfVoxelsAlongX = lrint(2 * detectorSizeX / sizeX);
sizeOfVoxelAlongX = (2 * detectorSizeX / numberOfVoxelsAlongX );
if(sizeOfVoxelAlongX!=sizeX) G4cout << "Rounding " <<
G4BestUnit(sizeX, "Length") << " to " <<
G4BestUnit(sizeOfVoxelAlongX, "Length") << G4endl;
}
}
void HadrontherapyDetectorConstruction::SetModulatorAngle(G4double value)
{
modulator -> SetModulatorAngle(value);
G4RunManager::GetRunManager() -> GeometryHasBeenModified();
}
if (sizeY > 0)
{
if (sizeY > 2*detectorSizeY)
{
G4cout << "WARNING: Voxel Y size must be smaller or equal than that of detector Y" << G4endl;
return false;
}
numberOfVoxelsAlongY = lrint(2 * detectorSizeY / sizeY);
sizeOfVoxelAlongY = (2 * detectorSizeY / numberOfVoxelsAlongY );
if(sizeOfVoxelAlongY!=sizeY) G4cout << "Rounding " <<
G4BestUnit(sizeY, "Length") << " to " <<
G4BestUnit(sizeOfVoxelAlongY, "Length") << G4endl;
}
if (sizeZ > 0)
{
if (sizeZ > 2*detectorSizeZ)
{
G4cout << "WARNING: Voxel Z size must be smaller or equal than that of detector Z" << G4endl;
return false;
}
numberOfVoxelsAlongZ = lrint(2 * detectorSizeZ / sizeZ);
sizeOfVoxelAlongZ = (2 * detectorSizeZ / numberOfVoxelsAlongZ );
if(sizeOfVoxelAlongZ!=sizeZ) G4cout << "Rounding " <<
G4BestUnit(sizeZ, "Length") << " to " <<
G4BestUnit(sizeOfVoxelAlongZ, "Length") << G4endl;
}
void HadrontherapyDetectorConstruction::SetRangeShifterXPosition(G4double value)
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;
// This will clear the existing matrix (together with data inside it)!
matrix = HadrontherapyMatrix::getInstance(numberOfVoxelsAlongX,
numberOfVoxelsAlongY,
numberOfVoxelsAlongZ);
// Here construct the Sensitive Detector and Read Out Geometry
ConstructSensitiveDetector(GetDetectorToWorldPosition());
G4RunManager::GetRunManager() -> GeometryHasBeenModified();
return true;
}
/////////////////////////////////////////////////////////////////////////////
G4bool HadrontherapyDetectorConstruction::SetDetectorSize(G4double sizeX, G4double sizeY, G4double sizeZ)
{
beamLine -> SetRangeShifterXPosition(value);
G4RunManager::GetRunManager() -> GeometryHasBeenModified();
// Check that the detector stay inside the phantom
if (sizeX > 0 && sizeX < sizeOfVoxelAlongX) {G4cout << "WARNING: Detector X size must be bigger than that of Voxel X" << G4endl; return false;}
if (sizeY > 0 && sizeY < sizeOfVoxelAlongY) {G4cout << "WARNING: Detector Y size must be bigger than that of Voxel Y" << G4endl; return false;}
if (sizeZ > 0 && sizeZ < sizeOfVoxelAlongZ) {G4cout << "WARNING: Detector Z size must be bigger than that of Voxel Z" << G4endl; return false;}
if (!IsInside(sizeX/2,
sizeY/2,
sizeZ/2,
phantomSizeX,
phantomSizeY,
phantomSizeZ,
detectorToPhantomPosition))
{return false;}
// Negative or null values mean don't change it!
if (sizeX > 0) {
detectorSizeX = sizeX/2;
detector -> SetXHalfLength(detectorSizeX);
}
if (sizeY > 0) {
detectorSizeY = sizeY/2;
detector -> SetYHalfLength(detectorSizeY);
}
if (sizeZ > 0) {
detectorSizeZ = sizeZ/2;
detector -> SetZHalfLength(detectorSizeZ);
}
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;
// Adjust detector position
SetDetectorPosition();
// Adjust voxels number accordingly to new detector geometry
// Matrix will be re-instantiated!
// Voxels and ROGeometry must follow the detector!
SetNumberOfVoxelBySize(sizeOfVoxelAlongX, sizeOfVoxelAlongY, sizeOfVoxelAlongZ);
G4RunManager::GetRunManager() -> GeometryHasBeenModified();
return true;
}
void HadrontherapyDetectorConstruction::SetRangeShifterXSize(G4double value)
/////////////////////////////////////////////////////////////////////////////
G4bool HadrontherapyDetectorConstruction::SetPhantomSize(G4double sizeX, G4double sizeY, G4double sizeZ)
{
beamLine -> SetRangeShifterXSize(value);
G4RunManager::GetRunManager() -> GeometryHasBeenModified();
}
void HadrontherapyDetectorConstruction::SetFirstScatteringFoilSize(G4double value)
if (!IsInside(detectorSizeX,
detectorSizeY,
detectorSizeZ,
sizeX/2,//method parameters
sizeY/2,
sizeZ/2,
detectorToPhantomPosition
))
return false;
// Only change positive dimensions
if (sizeX > 0) {
phantomSizeX = sizeX/2;
phantom -> SetXHalfLength(phantomSizeX);
}
if (sizeY > 0) {
phantomSizeY = sizeY/2;
phantom -> SetYHalfLength(phantomSizeY);
}
if (sizeZ > 0) {
phantomSizeZ = sizeZ/2;
phantom -> SetZHalfLength(phantomSizeZ);
}
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 << '\n' << "Coordinate volume: " << phantomPhysicalVolume -> GetTranslation() << G4endl;
// Adjust detector position inside phantom
SetDetectorPosition();
ConstructSensitiveDetector(GetDetectorToWorldPosition());
G4RunManager::GetRunManager() -> GeometryHasBeenModified();
return true;
}
/////////////////////////////////////////////////////////////////////////////
G4bool HadrontherapyDetectorConstruction::SetPhantomPosition(G4ThreeVector displacement)
{
beamLine -> SetFirstScatteringFoilXSize(value);
G4RunManager::GetRunManager() -> GeometryHasBeenModified();
// Set Phantom position respect to the World
// TODO check for overlap!
phantomPosition = displacement;
if (phantomPhysicalVolume)
{
phantomPhysicalVolume -> SetTranslation(phantomPosition);
G4cout << "Displacement between Phantom and World is: ";
G4cout << "DX= "<< G4BestUnit(phantomPosition.getX(),"Length") << ", " <<
"DY= "<< G4BestUnit(phantomPosition.getY(),"Length") << ", " <<
"DZ= "<< G4BestUnit(phantomPosition.getZ(),"Length") << G4endl;
// Redraw ROGeometry!
ConstructSensitiveDetector(GetDetectorToWorldPosition());
G4RunManager::GetRunManager() -> GeometryHasBeenModified();
}
return true;
}
void HadrontherapyDetectorConstruction::SetSecondScatteringFoilSize(G4double value)
/////////////////////////////////////////////////////////////////////////////
G4bool HadrontherapyDetectorConstruction::SetDetectorToPhantomPosition(G4ThreeVector displacement)
{
beamLine -> SetSecondScatteringFoilXSize(value);
G4RunManager::GetRunManager() -> GeometryHasBeenModified();
// Ignore negative values
if (displacement[0] < 0.) displacement[0] = detectorToPhantomPosition[0];
if (displacement[1] < 0.) displacement[1] = detectorToPhantomPosition[1];
if (displacement[2] < 0.) displacement[2] = detectorToPhantomPosition[2];
if (!IsInside(detectorSizeX,
detectorSizeY,
detectorSizeZ,
phantomSizeX,
phantomSizeY,
phantomSizeZ,
displacement // method parameter!
))
{return false;}
detectorToPhantomPosition = displacement;
// Adjust detector position inside phantom
SetDetectorPosition();
ConstructSensitiveDetector(GetDetectorToWorldPosition());
G4RunManager::GetRunManager() -> GeometryHasBeenModified();
return true;
}
void HadrontherapyDetectorConstruction::SetOuterRadiusStopper(G4double value)
{
beamLine -> SetOuterRadiusStopper(value);
G4RunManager::GetRunManager() -> GeometryHasBeenModified();
}
void HadrontherapyDetectorConstruction::SetInnerRadiusFinalCollimator(G4double value)
{
beamLine -> SetInnerRadiusFinalCollimator(value);
G4RunManager::GetRunManager() -> GeometryHasBeenModified();
}
void HadrontherapyDetectorConstruction::SetRSMaterial(G4String materialChoice)
{
beamLine -> SetRSMaterial(materialChoice);
}
@@ -24,24 +24,7 @@
// ********************************************************************
//
// $Id: HadrontherapyDetectorHit.cc;
// Last modified: G.A.P.Cirrone March 2008;
//
// See more at: http://geant4infn.wikispaces.com/HadrontherapyExample
//
//
// ----------------------------------------------------------------------------
// GEANT 4 - Hadrontherapy example
// ----------------------------------------------------------------------------
// Code developed by:
//
// G.A.P. Cirrone(a)*, F. Di Rosa(a), S. Guatelli(b), G. Russo(a)
//
// (a) Laboratori Nazionali del Sud
// of the National Institute for Nuclear Physics, Catania, Italy
// (b) National Institute for Nuclear Physics Section of Genova, genova, Italy
//
// * cirrone@lns.infn.it
// ----------------------------------------------------------------------------
// See more at: http://g4advancedexamples.lngs.infn.it/Examples/hadrontherapy
#include "HadrontherapyDetectorHit.hh"
@@ -23,156 +23,119 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: HadrontherapyDetectorMessenger.cc; May 2005
// ----------------------------------------------------------------------------
// GEANT 4 - Hadrontherapy example
// ----------------------------------------------------------------------------
// Code developed by:
//
// G.A.P. Cirrone(a)*, F. Di Rosa(a), S. Guatelli(b), G. Russo(a)
//
// (a) Laboratori Nazionali del Sud
// of the INFN, Catania, Italy
// (b) INFN Section of Genova, Genova, Italy
//
// * cirrone@lns.infn.it
// ----------------------------------------------------------------------------
// $Id: HadrontherapyDetectorMessenger.cc;
// See more at: http://g4advancedexamples.lngs.infn.it/Examples/hadrontherapy
#include "HadrontherapyDetectorMessenger.hh"
#include "HadrontherapyDetectorConstruction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWith3VectorAndUnit.hh"
HadrontherapyDetectorMessenger::HadrontherapyDetectorMessenger(
HadrontherapyDetectorConstruction* detector)
/////////////////////////////////////////////////////////////////////////////
HadrontherapyDetectorMessenger::HadrontherapyDetectorMessenger(HadrontherapyDetectorConstruction* detector)
:hadrontherapyDetector(detector)
{
modulatorDir = new G4UIdirectory("/modulator/");
modulatorDir -> SetGuidance("Command to rotate the modulator wheel");
beamLineDir = new G4UIdirectory("/beamLine/");
beamLineDir -> SetGuidance("set specification of range shifter");
{
// 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("um mm cm");
changeThePhantomSizeCmd -> AvailableForStates(G4State_Idle);
rangeShifterDir = new G4UIdirectory("/beamLine/RangeShifter/");
rangeShifterDir -> SetGuidance("set specification of range shifter");
firstScatteringFoilDir = new G4UIdirectory("/beamLine/ScatteringFoil1/");
firstScatteringFoilDir -> SetGuidance("set specification of first scattering foil");
secondScatteringFoilDir = new G4UIdirectory("/beamLine/ScatteringFoil2/");
secondScatteringFoilDir -> SetGuidance("set specification of second scattering foil");
rangeStopperDir = new G4UIdirectory("/beamLine/Stopper/");
rangeStopperDir -> SetGuidance("set specification of stopper");
// 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("mm cm m");
changeThePhantomPositionCmd -> AvailableForStates(G4State_Idle);
finalCollimatorDir = new G4UIdirectory("/beamLine/FinalCollimator/");
finalCollimatorDir -> SetGuidance("set specification of final collimator");
modulatorAngleCmd = new G4UIcmdWithADoubleAndUnit("/modulator/angle",this);
modulatorAngleCmd -> SetGuidance("Set Modulator Angle");
modulatorAngleCmd -> SetParameterName("Size",false);
modulatorAngleCmd -> SetRange("Size>=0.");
modulatorAngleCmd -> SetUnitCategory("Angle");
modulatorAngleCmd -> AvailableForStates(G4State_Idle);
rangeShifterMatCmd = new G4UIcmdWithAString("/beamLine/RangeShifter/RSMat",this);
rangeShifterMatCmd -> SetGuidance("Set material of range shifter");
rangeShifterMatCmd -> SetParameterName("choice",false);
rangeShifterMatCmd -> AvailableForStates(G4State_Idle);
rangeShifterXSizeCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/RangeShifter/thickness",this);
rangeShifterXSizeCmd -> SetGuidance("Set half of the thickness of range shifter along X axis");
rangeShifterXSizeCmd -> SetParameterName("Size",false);
rangeShifterXSizeCmd -> SetDefaultUnit("mm");
rangeShifterXSizeCmd -> SetUnitCandidates("mm cm m");
rangeShifterXSizeCmd -> AvailableForStates(G4State_Idle);
rangeShifterXPositionCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/RangeShifter/position",this);
rangeShifterXPositionCmd -> SetGuidance("Set position of range shifter");
rangeShifterXPositionCmd -> SetParameterName("Size",false);
rangeShifterXPositionCmd -> SetDefaultUnit("mm");
rangeShifterXPositionCmd -> SetUnitCandidates("mm cm m");
rangeShifterXPositionCmd -> AvailableForStates(G4State_Idle);
firstScatteringFoilXSizeCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/ScatteringFoil1/thickness",this);
firstScatteringFoilXSizeCmd -> SetGuidance("Set hlaf thickness of first scattering foil");
firstScatteringFoilXSizeCmd -> SetParameterName("Size",false);
firstScatteringFoilXSizeCmd -> SetDefaultUnit("mm");
firstScatteringFoilXSizeCmd -> SetUnitCandidates("mm cm m");
firstScatteringFoilXSizeCmd -> AvailableForStates(G4State_Idle);
secondScatteringFoilXSizeCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/ScatteringFoil2/thickness",this);
secondScatteringFoilXSizeCmd -> SetGuidance("Set half thickness of second scattering foil");
secondScatteringFoilXSizeCmd -> SetParameterName("Size",false);
secondScatteringFoilXSizeCmd -> SetDefaultUnit("mm");
secondScatteringFoilXSizeCmd -> SetUnitCandidates("mm cm m");
secondScatteringFoilXSizeCmd -> AvailableForStates(G4State_Idle);
outerRadiusStopperCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/Stopper/outRadius",this);
outerRadiusStopperCmd -> SetGuidance("Set size of outer radius");
outerRadiusStopperCmd -> SetParameterName("Size",false);
outerRadiusStopperCmd -> SetDefaultUnit("mm");
outerRadiusStopperCmd -> SetUnitCandidates("mm cm m");
outerRadiusStopperCmd -> AvailableForStates(G4State_Idle);
innerRadiusFinalCollimatorCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/FinalCollimator/halfInnerRad",this);
innerRadiusFinalCollimatorCmd -> SetGuidance("Set size of inner radius ( max 21.5 mm)");
innerRadiusFinalCollimatorCmd -> SetParameterName("Size",false);
innerRadiusFinalCollimatorCmd -> SetDefaultUnit("mm");
innerRadiusFinalCollimatorCmd -> SetUnitCandidates("mm cm m");
innerRadiusFinalCollimatorCmd -> 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("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("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("um mm cm");
changeTheDetectorVoxelCmd -> AvailableForStates(G4State_Idle);
}
/////////////////////////////////////////////////////////////////////////////
HadrontherapyDetectorMessenger::~HadrontherapyDetectorMessenger()
{
delete innerRadiusFinalCollimatorCmd;
delete outerRadiusStopperCmd;
delete secondScatteringFoilXSizeCmd;
delete firstScatteringFoilXSizeCmd;
delete rangeShifterXPositionCmd;
delete rangeShifterXSizeCmd;
delete rangeShifterMatCmd;
delete modulatorAngleCmd;
delete finalCollimatorDir;
delete rangeStopperDir;
delete secondScatteringFoilDir;
delete firstScatteringFoilDir;
delete rangeShifterDir;
delete beamLineDir;
delete modulatorDir;
{
delete changeThePhantomDir;
delete changeThePhantomSizeCmd;
delete changeThePhantomPositionCmd;
delete changeTheDetectorDir;
delete changeTheDetectorSizeCmd;
delete changeTheDetectorToPhantomPositionCmd;
delete changeTheDetectorVoxelCmd;
}
/////////////////////////////////////////////////////////////////////////////
void HadrontherapyDetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
{
if( command == modulatorAngleCmd )
{ hadrontherapyDetector -> SetModulatorAngle
(modulatorAngleCmd -> GetNewDoubleValue(newValue));}
if( command == rangeShifterMatCmd )
{ hadrontherapyDetector -> SetRSMaterial(newValue);}
if( command == rangeShifterXSizeCmd )
{ hadrontherapyDetector -> SetRangeShifterXSize
(rangeShifterXSizeCmd -> GetNewDoubleValue(newValue));}
if( command == rangeShifterXPositionCmd )
{ hadrontherapyDetector -> SetRangeShifterXPosition
(rangeShifterXPositionCmd -> GetNewDoubleValue(newValue));}
if( command == firstScatteringFoilXSizeCmd )
{ hadrontherapyDetector -> SetFirstScatteringFoilSize
(firstScatteringFoilXSizeCmd -> GetNewDoubleValue(newValue));}
if( command == secondScatteringFoilXSizeCmd )
{ hadrontherapyDetector -> SetSecondScatteringFoilSize
(secondScatteringFoilXSizeCmd -> GetNewDoubleValue(newValue));}
if( command == outerRadiusStopperCmd )
{ hadrontherapyDetector -> SetOuterRadiusStopper(
outerRadiusStopperCmd -> GetNewDoubleValue(newValue));}
if( command == innerRadiusFinalCollimatorCmd )
{ hadrontherapyDetector -> SetInnerRadiusFinalCollimator
(innerRadiusFinalCollimatorCmd -> GetNewDoubleValue(newValue));}
{
if( command == changeThePhantomSizeCmd)
{
G4ThreeVector size = changeThePhantomSizeCmd -> GetNew3VectorValue(newValue);
hadrontherapyDetector -> SetPhantomSize(size.getX(),size.getY(),size.getZ());
}
else if (command == changeThePhantomPositionCmd )
{
G4ThreeVector size = changeThePhantomPositionCmd -> GetNew3VectorValue(newValue);
hadrontherapyDetector -> SetPhantomPosition(size);
}
else if (command == changeTheDetectorSizeCmd)
{
G4ThreeVector size = changeTheDetectorSizeCmd -> GetNew3VectorValue(newValue);
hadrontherapyDetector -> SetDetectorSize(size.getX(),size.getY(),size.getZ());
}
else if (command == changeTheDetectorToPhantomPositionCmd)
{
G4ThreeVector size = changeTheDetectorToPhantomPositionCmd-> GetNew3VectorValue(newValue);
hadrontherapyDetector -> SetDetectorToPhantomPosition(size);
}
else if (command == changeTheDetectorVoxelCmd)
{
G4ThreeVector size = changeTheDetectorVoxelCmd -> GetNew3VectorValue(newValue);
hadrontherapyDetector -> SetNumberOfVoxelBySize(size.getX(),size.getY(),size.getZ());
}
}
@@ -24,23 +24,7 @@
// ********************************************************************
//
// $Id: HadrontherapyDetectorROGeometry.cc;
// Last modified: G.A.P.Cirrone April 2008;
//
// See more at: http://geant4infn.wikispaces.com/HadrontherapyExample
//
// ----------------------------------------------------------------------------
// GEANT 4 - Hadrontherapy example
// ----------------------------------------------------------------------------
// Code developed by:
//
// G.A.P. Cirrone(a)*, F. Di Rosa(a), S. Guatelli(b), G. Russo(a)
//
// (a) Laboratori Nazionali del Sud
// of the National Institute for Nuclear Physics, Catania, Italy
// (b) National Institute for Nuclear Physics Section of Genova, genova, Italy
//
// * cirrone@lns.infn.it
// ----------------------------------------------------------------------------
// See more at: http://g4advancedexamples.lngs.infn.it/Examples/hadrontherapy
#include "HadrontherapyDetectorROGeometry.hh"
#include "HadrontherapyDummySD.hh"
@@ -54,19 +38,22 @@
/////////////////////////////////////////////////////////////////////////////
HadrontherapyDetectorROGeometry::HadrontherapyDetectorROGeometry(G4String aString,
G4double detectorDimX,
G4double detectorDimY,
G4double detectorDimZ,
G4int numberOfVoxelsX,
G4int numberOfVoxelsY,
G4int numberOfVoxelsZ):
G4VReadOutGeometry(aString),
detectorSizeX(detectorDimX),
detectorSizeY(detectorDimY),
detectorSizeZ(detectorDimZ),
numberOfVoxelsAlongX(numberOfVoxelsX),
numberOfVoxelsAlongY(numberOfVoxelsY),
numberOfVoxelsAlongZ(numberOfVoxelsZ)
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)
{
}
@@ -118,16 +105,14 @@ G4VPhysicalVolume* HadrontherapyDetectorROGeometry::Build()
0,0,0);
G4VPhysicalVolume *RODetectorPhys = new G4PVPlacement(0,
G4ThreeVector(20.0 *mm,
0.0 *mm,
0.0 *mm),
detectorToWorldPosition,
"DetectorPhys",
RODetectorLog,
ROWorldPhys,
false,0);
// Division along X axis: the detector is devided in slices along the X axis
// Division along X axis: the detector is divided in slices along the X axis
G4double halfXVoxelSizeX = halfDetectorSizeX/numberOfVoxelsAlongX;
G4double halfXVoxelSizeY = halfDetectorSizeY;
@@ -151,9 +136,9 @@ G4VPhysicalVolume* HadrontherapyDetectorROGeometry::Build()
numberOfVoxelsAlongX,
voxelXThickness);
// Division along Y axis: the slices along the X axis are devided along the Y axis
// Division along Y axis: the slices along the X axis are divided along the Y axis
G4double halfYVoxelSizeX = halfXVoxelSizeX;
G4double halfYVoxelSizeX = halfXVoxelSizeX;
G4double halfYVoxelSizeY = halfDetectorSizeY/numberOfVoxelsAlongY;
G4double halfYVoxelSizeZ = halfDetectorSizeZ;
G4double voxelYThickness = 2*halfYVoxelSizeY;
@@ -175,7 +160,7 @@ G4VPhysicalVolume* HadrontherapyDetectorROGeometry::Build()
numberOfVoxelsAlongY,
voxelYThickness);
// Division along Z axis: the slices along the Y axis are devided along the Z axis
// Division along Z axis: the slices along the Y axis are divided along the Z axis
G4double halfZVoxelSizeX = halfXVoxelSizeX;
G4double halfZVoxelSizeY = halfYVoxelSizeY;
@@ -24,23 +24,7 @@
// ********************************************************************
//
// $Id: HadrontherapyDetectorSD.cc;
// Last modified: G.A.P.Cirrone March 2008;
//
// See more at: http://geant4infn.wikispaces.com/HadrontherapyExample
//
// ----------------------------------------------------------------------------
// GEANT 4 - Hadrontherapy example
// ----------------------------------------------------------------------------
// Code developed by:
//
// G.A.P. Cirrone(a)*, F. Di Rosa(a), S. Guatelli(b), G. Russo(a)
//
// (a) Laboratori Nazionali del Sud
// of the National Institute for Nuclear Physics, Catania, Italy
// (b) National Institute for Nuclear Physics Section of Genova, genova, Italy
//
// * cirrone@lns.infn.it
// ----------------------------------------------------------------------------
// See more at: http://g4advancedexamples.lngs.infn.it/Examples/hadrontherapy
#include "HadrontherapyDetectorSD.hh"
#include "HadrontherapyAnalysisManager.hh"
@@ -64,14 +48,14 @@ HadrontherapyDetectorSD::~HadrontherapyDetectorSD()
}
void HadrontherapyDetectorSD::Initialize(G4HCofThisEvent*)
{
{
HitsCollection = new HadrontherapyDetectorHitsCollection(sensitiveDetectorName,
collectionName[0]);
}
G4bool HadrontherapyDetectorSD::ProcessHits(G4Step* aStep, G4TouchableHistory* ROhist)
{
//The code doesn't seem to get here if we use the IAEA geometry. FIXME
if(!ROhist)
return false;
@@ -91,23 +75,17 @@ G4bool HadrontherapyDetectorSD::ProcessHits(G4Step* aStep, G4TouchableHistory* R
G4String particleName = aStep -> GetTrack() -> GetDynamicParticle() ->
GetDefinition() -> GetParticleName();
if(energyDeposit != 0)
{
// Create a hit with the information of position is in the detector
HadrontherapyDetectorHit* detectorHit = new HadrontherapyDetectorHit();
detectorHit -> SetEdepAndPosition(i, j, k, energyDeposit);
HitsCollection -> insert(detectorHit);
}
// Create a hit with the information of position is in the detector
HadrontherapyDetectorHit* detectorHit = new HadrontherapyDetectorHit();
detectorHit -> SetEdepAndPosition(i, j, k, energyDeposit);
HitsCollection -> insert(detectorHit);
// Energy deposit of secondary particles along X (integrated on Y and Z)
#ifdef G4ANALYSIS_USE
#ifdef ANALYSIS_USE
HadrontherapyAnalysisManager* analysis =
HadrontherapyAnalysisManager::getInstance();
if(energyDeposit != 0)
{
if(aStep -> GetTrack() -> GetTrackID()!= 1)
{
if (particleName == "proton")
@@ -134,7 +112,6 @@ G4bool HadrontherapyDetectorSD::ProcessHits(G4Step* aStep, G4TouchableHistory* R
if (particleName == "pi+" || particleName == "pi-" || particleName == "pi0")
analysis -> SecondaryPionEnergyDeposit(i, energyDeposit/MeV);
}
}
#endif
return true;
@@ -23,24 +23,9 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: HadrontherapyEventAction.cc;
// Last modified: G.A.P.Cirrone March 2008;
//
// See more at: http://geant4infn.wikispaces.com/HadrontherapyExample
//
// ----------------------------------------------------------------------------
// GEANT 4 - Hadrontherapy example
// ----------------------------------------------------------------------------
// Code developed by:
//
// G.A.P. Cirrone(a)*, G. Candiano, F. Di Rosa(a), S. Guatelli(b), G. Russo(a)
//
// (a) Laboratori Nazionali del Sud
// of the National Institute for Nuclear Physics, Catania, Italy
// (b) National Institute for Nuclear Physics Section of Genova, genova, Italy
//
// * cirrone@lns.infn.it
// --------------------------------------------------------------
// $Id: HadrontherapyEventAction.cc;
// See more at: http://g4advancedexamples.lngs.infn.it/Examples/hadrontherapy
#include "G4Event.hh"
#include "G4EventManager.hh"
#include "G4HCofThisEvent.hh"
@@ -55,48 +40,52 @@
#include "HadrontherapyDetectorSD.hh"
#include "HadrontherapyDetectorConstruction.hh"
#include "HadrontherapyMatrix.hh"
#include "HadrontherapyEventActionMessenger.hh"
HadrontherapyEventAction::HadrontherapyEventAction(HadrontherapyMatrix* matrixPointer) :
drawFlag("all" ),printModulo(10000)
/////////////////////////////////////////////////////////////////////////////
HadrontherapyEventAction::HadrontherapyEventAction() :
drawFlag("all" ),printModulo(1000), pointerEventMessenger(0)
{
hitsCollectionID = -1;
matrix = matrixPointer;
pointerEventMessenger = new HadrontherapyEventActionMessenger(this);
}
/////////////////////////////////////////////////////////////////////////////
HadrontherapyEventAction::~HadrontherapyEventAction()
{
delete pointerEventMessenger;
}
/////////////////////////////////////////////////////////////////////////////
void HadrontherapyEventAction::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("HadrontherapyDetectorHitsCollection");
}
/////////////////////////////////////////////////////////////////////////////
void HadrontherapyEventAction::EndOfEventAction(const G4Event* evt)
{
if(hitsCollectionID < 0)
return;
return;
G4HCofThisEvent* HCE = evt -> GetHCofThisEvent();
HadrontherapyDetectorHitsCollection* CHC = NULL;
if(HCE)
CHC = (HadrontherapyDetectorHitsCollection*)(HCE -> GetHC(hitsCollectionID));
if(CHC)
{
if(matrix)
{
// Fill the matrix with the information: voxel and associated energy deposit
{
HadrontherapyDetectorHitsCollection* CHC = (HadrontherapyDetectorHitsCollection*)(HCE -> GetHC(hitsCollectionID));
if(CHC)
{
matrix = HadrontherapyMatrix::getInstance();
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();
@@ -108,9 +97,9 @@ void HadrontherapyEventAction::EndOfEventAction(const G4Event* evt)
G4double energyDeposit = ((*CHC)[h]) -> GetEdep();
matrix -> Fill(i, j, k, energyDeposit/MeV);
}
}
}
}
}
// Extract the trajectories and draw them in the visualisation
if (G4VVisManager::GetConcreteInstance())
@@ -0,0 +1,76 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// $Id: HadrontherapyDetectorHit.cc;
//
// See more at: http://g4advancedexamples.lngs.infn.it/Examples/hadrontherapy
#include "HadrontherapyEventActionMessenger.hh"
#include "HadrontherapyEventAction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithAnInteger.hh"
/////////////////////////////////////////////////////////////////////////////
HadrontherapyEventActionMessenger::HadrontherapyEventActionMessenger(HadrontherapyEventAction* 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);
}
/////////////////////////////////////////////////////////////////////////////
HadrontherapyEventActionMessenger::~HadrontherapyEventActionMessenger()
{
delete DrawCmd;
delete PrintCmd;
delete eventDir;
}
/////////////////////////////////////////////////////////////////////////////
void HadrontherapyEventActionMessenger::SetNewValue(G4UIcommand* command,
G4String newValue)
{
if(command == DrawCmd)
{eventAction->SetDrawFlag(newValue);}
if(command == PrintCmd)
{eventAction->SetPrintModulo(PrintCmd->GetNewIntValue(newValue));}
}
@@ -0,0 +1,66 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// $Id: HadrontherapyGeometryController.cc;
// See more at: http://g4advancedexamples.lngs.infn.it/Examples/hadrontherapy
#include "HadrontherapyGeometryController.hh"
#include "HadrontherapyDetectorConstruction.hh"
#include "HadrontherapyInteractionParameters.hh"
#include "IAEADetectorConstruction.hh"
#include "PassiveProtonBeamLine.hh"
#include "G4RunManager.hh"
HadrontherapyGeometryController::HadrontherapyGeometryController()
{
}
HadrontherapyGeometryController::~HadrontherapyGeometryController()
{
}
void HadrontherapyGeometryController::SetGeometry(G4String name)
{
G4cout <<"Activating geometry " << name << G4endl;
if(name == "IAEA") {
registerGeometry(new IAEADetectorConstruction());
G4cout <<"IAEA geometry activated" << G4endl;
} else if(name == "default") {
registerGeometry(new PassiveProtonBeamLine());
} else {
G4cout <<"Unknown geometry: " << name << ". Geometry not changed." << G4endl;
}
}
void HadrontherapyGeometryController::registerGeometry(G4VUserDetectorConstruction *detector)
{
G4RunManager *runManager = G4RunManager::GetRunManager();
runManager->SetUserInitialization(detector);
runManager->GeometryHasBeenModified();
}
@@ -23,54 +23,36 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: HadrontherapyDetectorDecay.cc; May 2005
// ----------------------------------------------------------------------------
// GEANT 4 - Hadrontherapy example
// ----------------------------------------------------------------------------
// Code developed by:
//
// G.A.P. Cirrone(a)*, F. Di Rosa(a), S. Guatelli(b), G. Russo(a)
//
// (a) Laboratori Nazionali del Sud
// of the INFN, Catania, Italy
// (b) INFN Section of Genova, Genova, Italy
//
// * cirrone@lns.infn.it
// ----------------------------------------------------------------------------
#include "Decay.hh"
#include "G4ParticleDefinition.hh"
#include "G4ProcessManager.hh"
#include "G4Decay.hh"
// $Id: HadrontherapyGeometrymessenger.cc;
// See more at: http://g4advancedexamples.lngs.infn.it/Examples/hadrontherapy
#include "HadrontherapyGeometryMessenger.hh"
#include "HadrontherapyGeometryController.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithAString.hh"
Decay::Decay(const G4String& name):
G4VPhysicsConstructor(name)
{
G4cout<< "DECAY PROCESS: G4Decay (unstable particles)"
<< G4endl;
}
HadrontherapyGeometryMessenger::HadrontherapyGeometryMessenger(HadrontherapyGeometryController* controller)
:hadrontherapyGeometryController(controller)
Decay::~Decay()
{}
void Decay::ConstructProcess()
{
G4Decay* decayProcess = new G4Decay();
theParticleIterator -> reset();
changeTheGeometryDir = new G4UIdirectory("/geometrySetup/");
changeTheGeometryDir -> SetGuidance("Geometry setup");
while( (*theParticleIterator)() )
{
G4ParticleDefinition* particle = theParticleIterator -> value();
G4ProcessManager* processManager = particle -> GetProcessManager();
if ( decayProcess -> IsApplicable(*particle) &&
!particle -> IsShortLived() )
{
G4String name = particle -> GetParticleName();
processManager -> AddProcess(decayProcess);
processManager -> SetProcessOrdering(decayProcess, idxPostStep);
processManager -> SetProcessOrdering(decayProcess, idxAtRest);
}
}
changeTheGeometryCmd = new G4UIcmdWithAString("/geometrySetup/selectGeometry",this);
changeTheGeometryCmd -> SetGuidance("Select the geometry you wish to use");
changeTheGeometryCmd -> SetParameterName("Geometry",false);
changeTheGeometryCmd -> AvailableForStates(G4State_PreInit);
}
HadrontherapyGeometryMessenger::~HadrontherapyGeometryMessenger()
{
delete changeTheGeometryDir;
delete changeTheGeometryCmd;
}
void HadrontherapyGeometryMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
{
if( command == changeTheGeometryCmd )
{ hadrontherapyGeometryController -> SetGeometry (newValue);}
}
@@ -0,0 +1,222 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// $Id: HadrontherapyInteractionParameters.cc;
// See more at: http://g4advancedexamples.lngs.infn.it/Examples/hadrontherapy
#include "HadrontherapyInteractionParameters.hh"
#include "HadrontherapyParameterMessenger.hh"
#include "HadrontherapyDetectorConstruction.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>
HadrontherapyInteractionParameters::HadrontherapyInteractionParameters():
nistEle(new G4NistElementBuilder(0)),
nistMat(new G4NistMaterialBuilder(nistEle, 0)),
data(std::cout.rdbuf()), emCal(new G4EmCalculator),
pMessenger(new HadrontherapyParameterMessenger(this)),
beamFlag(false)
{
}
HadrontherapyInteractionParameters::~HadrontherapyInteractionParameters()
{
delete pMessenger;
delete emCal;
delete nistMat;
delete nistEle;
}
bool HadrontherapyInteractionParameters::GetStoppingTable(const G4String& vararg)
{
// Check arguments
if ( !ParseArg(vararg)) return false;
std::vector<G4double> energy;
std::vector<G4double> massDedx;
G4double dedxtot;
// 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);
dedxtot = emCal -> ComputeTotalDEDX (en, particle, material);
massDedx.push_back ( dedxtot / density );
}
}
else // one point only
{
energy.push_back(kinEmin);
dedxtot = emCal -> ComputeTotalDEDX (kinEmin, particle, material);
massDedx.push_back ( dedxtot / density );
}
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]/MeV << massDedx[i]/(MeV*cm2/g) << G4endl;
}
outfile.close();
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;
}
// Search for user material choice inside G4NistManager database
G4Material* HadrontherapyInteractionParameters::GetNistMaterial(G4String material)
{
Pmaterial = G4NistManager::Instance()->FindOrBuildMaterial(material);
if (Pmaterial)
{
density = Pmaterial -> GetDensity();
}
return Pmaterial;
}
// Parse arguments line
bool HadrontherapyInteractionParameters::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 ( !emCal->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;
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(std::cout.rdbuf()); // output is G4cout
return true;
}
// Force physics tables build
void HadrontherapyInteractionParameters::BeamOn()
{
// first check if RunManager is above G4State_Idle
G4StateManager* mState = G4StateManager::GetStateManager();
G4ApplicationState aState = mState -> GetCurrentState();
if ( aState <= G4State_Idle && beamFlag == false)
{
// G4cout << "Run State " << mState -> GetStateString( aState ) << G4endl;
G4RunManager::GetRunManager() -> BeamOn(0);
beamFlag = true;
}
}
// print a list of Nist elements and materials
void HadrontherapyInteractionParameters::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);
}
}
@@ -1,301 +0,0 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// $Id: HadrontherapyMaterial.cc; Last modified: G.A.P.Cirrone, March 2008;
// ----------------------------------------------------------------------------
// GEANT 4 - Hadrontherapy example
// ----------------------------------------------------------------------------
// Code developed by:
//
// G.A.P. Cirrone(a)*, F. Di Rosa(a), S. Guatelli(b), G. Russo(a)
//
// (a) Laboratori Nazionali del Sud
// of the National Institute for Nuclear Physics, Catania, Italy
// (b) National Institute for Nuclear Physics Section of Genova, genova, Italy
//
// * cirrone@lns.infn.it
// ----------------------------------------------------------------------------
#include "globals.hh"
#include "G4Material.hh"
#include "G4MaterialTable.hh"
#include "G4Element.hh"
#include "G4ElementTable.hh"
#include "HadrontherapyMaterial.hh"
#include "G4NistManager.hh"
HadrontherapyMaterial::HadrontherapyMaterial():
matW(0), matAl(0), matSi(0), matTa(0), matCu(0),
vacuum(0), matplexiglass(0), brass(0),
kapton(0), matPb(0), titanium(0), matAir(0),
matH2O(0), soft(0), gold(0), bone(0), muscle(0)
{;}
HadrontherapyMaterial::~HadrontherapyMaterial()
{
delete muscle;
delete bone;
delete gold;
delete soft;
delete matH2O;
delete matAir;
delete titanium;
delete matPb;
delete kapton;
delete brass;
delete matplexiglass;
delete vacuum;
delete matCu;
delete matTa;
delete matSi;
delete matAl;
delete matW;
}
void HadrontherapyMaterial::DefineMaterials()
{
// Define required materials
G4double z; // Atomic numebr
G4double a; // Atomic mass
G4double d; // Density
G4int nComponents;// Number of components
G4double fractionmass; // Fraction in mass of an element in a material
G4int nAtoms; // Number of atoms in a molecuule
/////////////////////////////////////////////////////////////////////////////
// MATERIA DEFINITION FOLLOWING THE NIST DATABASE
// Pointer to the G4Nist manager
// for the material definition following
// the NIST database.
// It recommended to use this when
// the Standard models for electromagnetic physic
// are called
G4NistManager* nistMaterialManager = G4NistManager::Instance();
G4bool isotopes = false;
// Material NIST definition
nistMaterialManager -> FindOrBuildMaterial("G4_AIR" , isotopes);
nistMaterialManager -> FindOrBuildMaterial("G4_WATER", isotopes);
nistMaterialManager -> FindOrBuildMaterial("G4_PMMA", isotopes);
nistMaterialManager -> FindOrBuildMaterial("G4_MYLAR", isotopes);
/////////////////////////////////////////////////////////////////////////////
// Elements
a = 1.01*g/mole;
G4Element* elH = new G4Element ("Hydrogen","H",z = 1.,a);
a = 14.01*g/mole;
G4Element* elN = new G4Element("Nitrogen","N",z = 7.,a);
a = 16.00*g/mole;
G4Element* elO = new G4Element("Oxygen","O",z = 8.,a);
a = 12.011*g/mole;
G4Element* elC = new G4Element("Carbon","C",z = 6.,a);
a = 22.99*g/mole;
G4Element* elNa = new G4Element("Sodium","Na",z = 11.,a);
a = 24.305*g/mole;
G4Element* elMg = new G4Element("Magnesium","Mg",z = 12.,a);
a = 30.974*g/mole;
G4Element* elP = new G4Element("Phosphorus","P",z = 15.,a);
a = 32.06*g/mole;
G4Element* elS = new G4Element("Sulfur","S",z = 16.,a);
a = 35.453*g/mole;
G4Element* elCl = new G4Element("Chlorine","Cl",z = 17.,a);
a = 39.098*g/mole;
G4Element* elK = new G4Element("Potassium","K",z = 19.,a);
a = 40.08*g/mole;
G4Element* elCa = new G4Element("Calcium","Ca",z = 20.,a);
a = 65.38*g/mole;
G4Element* elZn = new G4Element("Zinc","Zn",z = 30.,a);
a = 55.85*g/mole;
G4Element* elFe = new G4Element("Iron","Fe",z = 26.,a);
a = 63.546*g/mole;
d = 8.90*g/cm3;
G4Element* elCu = new G4Element("Copper","Cu", z = 29., a);
// Materials
// Tungsten
z = 74.;
a = 183.84* g/mole;
d = 19.3*g/cm3;
matW = new G4Material("Tungsten", z, a, d);
// Aluminum
z = 13.;
a = 26.98*g/mole;
d = 2.700*g/cm3;
matAl = new G4Material("MatAluminum",z, a, d);
// Silicon
z = 14.;
a = 28.09*g/mole;
d = 2.330*g/cm3;
matSi = new G4Material("MatSilicon",z, a, d);
// Tantalum
z = 73.;
a = 180.948*g/mole;
d = 16.6*g/cm3;
matTa = new G4Material("MatTantalum", z, a, d);
// Copper
z = 29.;
a = 63.546*g/mole;
d = 8.90*g/cm3;
matCu = new G4Material("MatCopper", z, a, d);
// Vacuum
G4double density = universe_mean_density;
G4double pressure = 3.e-18*pascal;
G4double temperature = 2.73*kelvin;
a = 1.01*g/mole;
z = 1;
vacuum = new G4Material("Galactic", z, a,
density,kStateGas,temperature,pressure);
// Plexiglass
d = 1.18*g/cm3;
matplexiglass = new G4Material("PMMA",d,3);
matplexiglass -> AddElement(elH,0.08);
matplexiglass -> AddElement(elC,0.60);
matplexiglass -> AddElement(elO,0.32);
// Brass
d = 8.40*g/cm3;
nComponents = 2;
G4Material* brass = new G4Material("Brass", d, nComponents);
brass -> AddElement(elZn, fractionmass = 30*perCent);
brass -> AddElement(elCu, fractionmass = 70*perCent);
// Kapton
d = 1.43*g/cm3;
nComponents = 4;
G4Material* kapton = new G4Material("Kapton", d, nComponents);
kapton -> AddElement(elH, nAtoms = 10);
kapton -> AddElement(elO, nAtoms = 5);
kapton -> AddElement(elC, nAtoms = 22);
kapton -> AddElement(elN, nAtoms = 2);
// Lead
a = 207.19*g/mole;
z = 82.;
d = 11.35*g/cm3;
matPb = new G4Material("Lead", z, a, d);
// Titanium
z = 22.;
a = 47.88*g/mole;
d = 4.50*g/cm3;
titanium = new G4Material("titanium", z, a, d);
// Air material
d = 1.290*mg/cm3;
nComponents = 2;
G4Material* matAir = new G4Material("Air", d, nComponents);
matAir -> AddElement(elN,0.7);
matAir -> AddElement(elO,0.3);
// Water by "hand"
d = 1.000*g/cm3;
nComponents = 2;
matH2O = new G4Material("Water", d, nComponents);
matH2O -> AddElement(elH,2);
matH2O -> AddElement(elO,1);
matH2O -> GetIonisation()->SetMeanExcitationEnergy(75.0*eV);
matH2O -> SetChemicalFormula("H_2O");
G4cout << "-----------> CHEMICAL FORMULA FOR WATER FIXED <----------"<< G4endl;
//soft tissue(http://www.nist.gov)
d = 1.0*g/cm3;
nComponents = 13;
soft = new G4Material("tissue",d, nComponents);
soft -> AddElement(elH,0.104472);
soft -> AddElement(elC,0.23219);
soft -> AddElement(elN,0.02488);
soft -> AddElement(elO,0.630238);
soft -> AddElement(elNa,0.00113);
soft -> AddElement(elMg,0.00013);
soft -> AddElement(elP,0.00133);
soft -> AddElement(elS,0.00199);
soft -> AddElement(elCl,0.00134);
soft -> AddElement(elK,0.00199);
soft -> AddElement(elCa,0.00023);
soft -> AddElement(elFe,0.00005);
soft -> AddElement(elZn,0.00003);
// Gold
z = 79;
a = 196.97*g/mole;
d = 19.32*g/cm3;
gold = new G4Material("gold", z, a, d);
// Compact bone
d = 1.85*g/cm3;
nComponents = 8;
bone = new G4Material("bone", d, nComponents);
bone -> AddElement(elH,0.063984);
bone -> AddElement(elC,0.278);
bone -> AddElement(elN,0.027);
bone -> AddElement(elO,0.410016);
bone -> AddElement(elMg,0.002);
bone -> AddElement(elP,0.07);
bone -> AddElement(elS,0.002);
bone -> AddElement(elCa,0.147);
//muscle
nComponents = 9;
muscle = new G4Material("muscle", d, nComponents);
muscle -> AddElement(elH,0.101997);
muscle -> AddElement(elC,0.123);
muscle -> AddElement(elN,0.035);
muscle -> AddElement(elNa,0.0008);
muscle -> AddElement(elO,0.729);
muscle -> AddElement(elMg,0.0002);
muscle -> AddElement(elP,0.002);
muscle -> AddElement(elS,0.005);
muscle -> AddElement(elK,0.003);
}
G4Material* HadrontherapyMaterial::GetMat(G4String material)
{
G4Material* pttoMaterial = G4Material::GetMaterial(material);
return pttoMaterial;
}
@@ -23,58 +23,70 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: HadrontherapyMatrix.cc;
// Last modified: G.A.P.Cirrone, May 2008;
//
// See more at: http://geant4infn.wikispaces.com/HadrontherapyExample
//
// ----------------------------------------------------------------------------
// GEANT 4 - Hadrontherapy example
// ----------------------------------------------------------------------------
// Code developed by:
//
// G.A.P. Cirrone(a)*, F. Di Rosa(a), S. Guatelli(b), G. Russo(a)
//
// (a) Laboratori Nazionali del Sud
// of the National Institute for Nuclear Physics, Catania, Italy
// (b) National Institute for Nuclear Physics Section of Genova, genova, Italy
//
// * cirrone@lns.infn.it
// ----------------------------------------------------------------------------
// See more at: http://g4advancedexamples.lngs.infn.it/Examples/hadrontherapy//
#include "HadrontherapyMatrix.hh"
#include "HadrontherapyAnalysisManager.hh"
#include "globals.hh"
#include <fstream>
HadrontherapyMatrix::HadrontherapyMatrix()
HadrontherapyMatrix* HadrontherapyMatrix::instance = NULL;
// Static method that only return a pointer to the matrix object
HadrontherapyMatrix* HadrontherapyMatrix::getInstance()
{
return instance;
}
// This STATIC method delete (!) the old matrix and rewrite a new object returning a pointer to it
HadrontherapyMatrix* HadrontherapyMatrix::getInstance(G4int voxelX, G4int voxelY, G4int voxelZ)
{
if (instance) delete instance;
instance = new HadrontherapyMatrix(voxelX, voxelY, voxelZ);
instance -> Initialize();
return instance;
}
HadrontherapyMatrix::HadrontherapyMatrix(G4int voxelX, G4int voxelY, G4int voxelZ):
matrix(0)
{
// Number of the voxels of the phantom
numberVoxelX = 400;
numberVoxelY = 1;
numberVoxelZ = 1;
// Create the matrix
// 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
numberVoxelX = voxelX;
numberVoxelY = voxelY;
numberVoxelZ = voxelZ;
// Create the dose matrix
matrix = new G4double[numberVoxelX*numberVoxelY*numberVoxelZ];
if (matrix) G4cout << "Matrix: Memory space to store physical dose into " <<
numberVoxelX*numberVoxelY*numberVoxelZ <<
" voxels has been allocated " << G4endl;
else G4Exception("Can't allocate memory to store physical dose!");
}
HadrontherapyMatrix::~HadrontherapyMatrix()
{
delete[] matrix;
delete[] matrix;
}
void HadrontherapyMatrix::flush()
{
if(matrix)
for(int i=0; i<numberVoxelX*numberVoxelY*numberVoxelZ; i++)
{
matrix[i] = 0;
}
}
void HadrontherapyMatrix::Initialize()
{
// Initialise the elemnts of the matrix to zero
// Initialise the elements of the matrix to zero
for(G4int i = 0; i < numberVoxelX; i++)
{
for(G4int j = 0; j < numberVoxelY; j++)
{
for(G4int k = 0; k < numberVoxelZ; k++)
{
for(G4int k = 0; k < numberVoxelZ; k++)
matrix[(i*numberVoxelY+j)*numberVoxelZ+k] = 0.;
}
matrix[Index(i,j,k)] = 0.;
}
}
}
@@ -82,10 +94,10 @@ void HadrontherapyMatrix::Fill(G4int i, G4int j, G4int k,
G4double energyDeposit)
{
if (matrix)
matrix[(i*numberVoxelY+j)*numberVoxelZ+k] += energyDeposit;
matrix[Index(i,j,k)] += energyDeposit;
// Store the energy deposit in the matrix elemnt corresponding
// to the phantom voxel
// Store the energy deposit in the matrix element corresponding
// to the phantom voxel i, j, k
}
void HadrontherapyMatrix::TotalEnergyDeposit()
@@ -99,6 +111,9 @@ void HadrontherapyMatrix::TotalEnergyDeposit()
if (matrix)
{
std::ofstream ofs;
ofs.open("DoseDistribution.out");
for(G4int l = 0; l < numberVoxelZ; l++)
{
k = l;
@@ -112,15 +127,17 @@ void HadrontherapyMatrix::TotalEnergyDeposit()
i = n* numberVoxelZ * numberVoxelY + j;
if(matrix[i] != 0)
{
ofs << n << '\t' << m << '\t' <<
k << '\t' << matrix[i] << G4endl;
#ifdef G4ANALYSIS_USE
#ifdef ANALYSIS_USE
HadrontherapyAnalysisManager* analysis =
HadrontherapyAnalysisManager::getInstance();
HadrontherapyAnalysisManager::getInstance();
analysis -> FillEnergyDeposit(n, m, k, matrix[i]);
analysis -> BraggPeak(n, matrix[i]);
#endif
}
}
}
}
}
}
@@ -23,20 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: HadrontherapyModulator.cc; May 2005
// ----------------------------------------------------------------------------
// GEANT 4 - Hadrontherapy example
// ----------------------------------------------------------------------------
// Code developed by:
//
// G.A.P. Cirrone(a)*, F. Di Rosa(a), S. Guatelli(b), G. Russo(a)
//
// (a) Laboratori Nazionali del Sud
// of the National Institute for Nuclear Physics, Catania, Italy
// (b) National Institute for Nuclear Physics Section of Genova, genova, Italy
//
// * cirrone@lns.infn.it
// ----------------------------------------------------------------------------
// $Id: HadrontherapyModulator.cc;
// See more at: http://g4advancedexamples.lngs.infn.it/Examples/hadrontherapy
#include "G4Material.hh"
#include "G4Tubs.hh"
@@ -50,13 +38,12 @@
#include "G4RotationMatrix.hh"
#include "G4VisAttributes.hh"
#include "G4Colour.hh"
#include "HadrontherapyMaterial.hh"
#include "HadrontherapyModulator.hh"
#include "HadrontherapyMaterial.hh"
#include "G4Transform3D.hh"
#include "G4ios.hh"
#include <fstream>
#include "G4RunManager.hh"
#include "G4NistManager.hh"
HadrontherapyModulator::HadrontherapyModulator():physiMotherMod(0),
solidMod0(0), logicMod0(0), physiMod0(0),
@@ -140,37 +127,31 @@ HadrontherapyModulator::HadrontherapyModulator():physiMotherMod(0),
G4double phi = 270. *deg;
rm -> rotateY(phi);
}
/////////////////////////////////////////////////////////////////////////////
HadrontherapyModulator::~HadrontherapyModulator()
{
delete rm;
}
/////////////////////////////////////////////////////////////////////////////
void HadrontherapyModulator::BuildModulator(G4VPhysicalVolume* motherVolume)
{
G4bool isotopes = false;
G4Material* airNist = G4NistManager::Instance()->FindOrBuildMaterial("G4_AIR", isotopes);
//Materials used for the modulator wheel
HadrontherapyMaterial* material = new HadrontherapyMaterial();
G4Material* Mod0Mater = material -> GetMat("Air");
G4Material* ModMater = material -> GetMat("Air");
delete material;
G4Material* Mod0Mater = airNist;
G4Material* ModMater = airNist;
G4double innerRadiusOfTheTube = 2.5 *cm;
G4double outerRadiusOfTheTube = 9.5 *cm;
G4double hightOfTheTube = 0.03*cm;
// Mother of the modulator wheel
G4ThreeVector positionMotherMod = G4ThreeVector(-1960.50 *mm, 30 *mm, 50 *mm);
G4Box* solidMotherMod = new G4Box("MotherMod", 12 *cm, 12 *cm, 12 *cm);
G4LogicalVolume * logicMotherMod = new G4LogicalVolume(solidMotherMod, Mod0Mater,"MotherMod",0,0,0);
physiMotherMod = new G4PVPlacement(rm,positionMotherMod, "MotherMod",
logicMotherMod,
motherVolume,
@@ -199,7 +180,6 @@ void HadrontherapyModulator::BuildModulator(G4VPhysicalVolume* motherVolume)
logicMod0 = new G4LogicalVolume(solidMod0, Mod0Mater, "Mod0",0,0,0);
physiMod0 = new G4PVPlacement(G4Transform3D(rm2, positionMod0),
logicMod0,
"Mod0",
@@ -212,7 +192,6 @@ void HadrontherapyModulator::BuildModulator(G4VPhysicalVolume* motherVolume)
// First modulator sclice
//----------------------------------------------------------
G4double startAngleOfTheTube1 = 54.267*deg;
G4double spanningAngleOfTheTube1 = 71.466*deg;
@@ -0,0 +1,85 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// $Id: HadrontherapyInteractionParametersMessenger.cc;
// See more at: http://g4advancedexamples.lngs.infn.it/Examples/hadrontherapy
#include "HadrontherapyParameterMessenger.hh"
#include "HadrontherapyInteractionParameters.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAString.hh"
HadrontherapyParameterMessenger::HadrontherapyParameterMessenger(HadrontherapyInteractionParameters* 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);
}
HadrontherapyParameterMessenger::~HadrontherapyParameterMessenger()
{
delete paramDir;
delete dedxCmd;
delete listCmd;
}
void HadrontherapyParameterMessenger::SetNewValue(G4UIcommand* command, G4String vararg)
{
if (command == dedxCmd)
{
pParam -> GetStoppingTable(vararg);
}
else if (command == listCmd)
{
pParam -> ListOfNistMaterials(vararg);
}
}
@@ -23,20 +23,9 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: HadrontherapyParticles.cc; May 2005
// ----------------------------------------------------------------------------
// GEANT 4 - Hadrontherapy example
// ----------------------------------------------------------------------------
// Code developed by:
//
// G.A.P. Cirrone(a)*, F. Di Rosa(a), S. Guatelli(b), G. Russo(a)
//
// (a) Laboratori Nazionali del Sud
// of the National Institute for Nuclear Physics, Catania, Italy
// (b) National Institute for Nuclear Physics Section of Genova, genova, Italy
//
// * cirrone@lns.infn.it
// ----------------------------------------------------------------------------
// $Id: HadrontherapyParticles.cc;
// See more at: http://g4advancedexamples.lngs.infn.it/Examples/hadrontherapy
#include "HadrontherapyParticles.hh"
#include "G4ParticleDefinition.hh"
#include "G4ParticleTypes.hh"
File diff suppressed because it is too large Load Diff
@@ -23,63 +23,101 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: HadrontherapyPhisicsListMessenger.cc; Nov 2008
// ----------------------------------------------------------------------------
// GEANT 4 - Hadrontherapy example
// ----------------------------------------------------------------------------
// Code developed by:
//
// G.A.P. Cirrone(a)*, F. Di Rosa(a), S. Guatelli(b), G. Russo(a), M.P. Russo
//
// (a) Laboratori Nazionali del Sud
// of the National Institute for Nuclear Physics, Catania, Italy
// (b) National Institute for Nuclear Physics Section of Genova, genova, Italy
//
// * cirrone@lns.infn.it
// ----------------------------------------------------------------------------
// HadrontherapyPhysicsListMessenger.cc
// See more at: http://g4advancedexamples.lngs.infn.it/Examples/hadrontherapy
#include "HadrontherapyPhysicsListMessenger.hh"
#include "HadrontherapyPhysicsList.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithoutParameter.hh"
#include "G4UIcmdWithADouble.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithABool.hh"
#include "G4UIcmdWithAString.hh"
HadrontherapyPhysicsListMessenger::HadrontherapyPhysicsListMessenger(HadrontherapyPhysicsList * physList)
:physicsList(physList)
{
listDir = new G4UIdirectory("/physics/");
// Building modular PhysicsList
/////////////////////////////////////////////////////////////////////////////
HadrontherapyPhysicsListMessenger::HadrontherapyPhysicsListMessenger(HadrontherapyPhysicsList* pPhys)
:pPhysicsList(pPhys)
{
physDir = new G4UIdirectory("/physic/");
physDir->SetGuidance("Commands to activate physics models and set cuts");
gammaCutCmd = new G4UIcmdWithADoubleAndUnit("/physic/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);
physicsListCmd = new G4UIcmdWithAString("/physics/addPhysics",this);
physicsListCmd->SetGuidance("Add chunks of PhysicsList.");
physicsListCmd->SetParameterName("physList",false);
physicsListCmd->AvailableForStates(G4State_PreInit);
electCutCmd = new G4UIcmdWithADoubleAndUnit("/physic/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("/physic/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);
packageListCmd = new G4UIcmdWithAString("/physics/addPackage",this);
packageListCmd->SetGuidance("Add physics package.");
packageListCmd->SetParameterName("package",false);
packageListCmd->AvailableForStates(G4State_PreInit);
allCutCmd = new G4UIcmdWithADoubleAndUnit("/physic/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);
pListCmd = new G4UIcmdWithAString("/physic/addPhysics",this);
pListCmd->SetGuidance("Add physics list.");
pListCmd->SetParameterName("PList",false);
pListCmd->AvailableForStates(G4State_PreInit);
packageListCmd = new G4UIcmdWithAString("/physic/addPackage",this);
packageListCmd->SetGuidance("Add physics package.");
packageListCmd->SetParameterName("package",false);
packageListCmd->AvailableForStates(G4State_PreInit);
}
/////////////////////////////////////////////////////////////////////////////
HadrontherapyPhysicsListMessenger::~HadrontherapyPhysicsListMessenger()
{
delete physicsListCmd;
delete listDir;
delete gammaCutCmd;
delete electCutCmd;
delete protoCutCmd;
delete allCutCmd;
delete pListCmd;
delete physDir;
delete packageListCmd;
}
void HadrontherapyPhysicsListMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
{
if (command == physicsListCmd)
{ physicsList->AddPhysicsList(newValue);}
else if (command == packageListCmd)
{ physicsList->AddPackage(newValue);}
/////////////////////////////////////////////////////////////////////////////
void HadrontherapyPhysicsListMessenger::SetNewValue(G4UIcommand* command,
G4String newValue)
{
if( command == gammaCutCmd )
{ pPhysicsList->SetCutForGamma(gammaCutCmd->GetNewDoubleValue(newValue));}
if( command == electCutCmd )
{ pPhysicsList->SetCutForElectron(electCutCmd->GetNewDoubleValue(newValue));}
if( command == protoCutCmd )
{ pPhysicsList->SetCutForPositron(protoCutCmd->GetNewDoubleValue(newValue));}
if( command == allCutCmd )
{
G4double cut = allCutCmd->GetNewDoubleValue(newValue);
pPhysicsList->SetCutForGamma(cut);
pPhysicsList->SetCutForElectron(cut);
pPhysicsList->SetCutForPositron(cut);
}
if( command == pListCmd )
{ pPhysicsList->AddPhysicsList(newValue);}
if( command == packageListCmd )
{ pPhysicsList->AddPackage(newValue);}
}
@@ -23,24 +23,22 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: HadrontherapyPrimarygeneratorAction.cc;
// Last modified: G.A.P.Cirrone, May 2008;
//
// See more at: http://geant4infn.wikispaces.com/HadrontherapyExample
// HadrontherapyPrimarygeneratorAction.cc;
// See more at: http://g4advancedexamples.lngs.infn.it/Examples/hadrontherapy
// ----------------------------------------------------------------------------
// GEANT 4 - Hadrontherapy example
// ----------------------------------------------------------------------------
// Code developed by:
//
// G.A.P. Cirrone(a)*, F. Di Rosa(a), S. Guatelli(b), G. Russo(a)
// G.A.P. Cirrone(a)*, F.Romano(a)
//
// (a) Laboratori Nazionali del Sud
// of the National Institute for Nuclear Physics, Catania, Italy
// (b) National Institute for Nuclear Physics Section of Genova, genova, Italy
// of the INFN, Catania, Italy
//
// * cirrone@lns.infn.it
// ----------------------------------------------------------------------------
//
// ------------------------------------------------------------------------------
#include "HadrontherapyPrimaryGeneratorAction.hh"
#include "HadrontherapyPrimaryGeneratorMessenger.hh"
#include "G4Event.hh"
@@ -48,6 +46,7 @@
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "Randomize.hh"
#include "HadrontherapyAnalysisManager.hh"
HadrontherapyPrimaryGeneratorAction::HadrontherapyPrimaryGeneratorAction()
{
@@ -78,13 +77,18 @@ void HadrontherapyPrimaryGeneratorAction::SetDefaultPrimaryParticle()
particleGun -> SetParticleDefinition(particle);
// Define the energy of primary particles:
// gaussian distribution with mean energy = 64.00 *MeV
// and sigma = 300.0 *keV
G4double defaultMeanKineticEnergy = 64.00 *MeV;
// gaussian distribution with mean energy = 62.0 *MeV
// and sigma = 400.0 *keV
G4double defaultMeanKineticEnergy = 62.0 *MeV;
meanKineticEnergy = defaultMeanKineticEnergy;
G4double defaultsigmaEnergy = 300.0 *keV;
G4double defaultsigmaEnergy = 400.0 *keV;
sigmaEnergy = defaultsigmaEnergy;
#ifdef ANALYSIS_USE
// Write these values into the analysis if needed. Have to be written separately on change.
HadrontherapyAnalysisManager::getInstance()->setBeamMetaData(meanKineticEnergy, sigmaEnergy);
#endif
// Define the parameters of the initial position:
// the y, z coordinates have a gaussian distribution
@@ -115,6 +119,11 @@ void HadrontherapyPrimaryGeneratorAction::SetDefaultPrimaryParticle()
void HadrontherapyPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
#ifdef ANALYSIS_USE
// Increment the event counter
HadrontherapyAnalysisManager::getInstance()->startNewEvent();
#endif
// ****************************************
// Set the beam angular apread
// and spot size
@@ -166,10 +175,23 @@ void HadrontherapyPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
}
void HadrontherapyPrimaryGeneratorAction::SetmeanKineticEnergy (G4double val )
{ meanKineticEnergy = val;}
{
meanKineticEnergy = val;
#ifdef ANALYSIS_USE
// Update the beam-data in the analysis manager
HadrontherapyAnalysisManager::getInstance()->setBeamMetaData(meanKineticEnergy, sigmaEnergy);
#endif
}
void HadrontherapyPrimaryGeneratorAction::SetsigmaEnergy (G4double val )
{ sigmaEnergy = val;}
{
sigmaEnergy = val;
#ifdef ANALYSIS_USE
// Update the sigmaenergy in the metadata.
HadrontherapyAnalysisManager::getInstance()->setBeamMetaData(meanKineticEnergy, sigmaEnergy);
#endif
}
void HadrontherapyPrimaryGeneratorAction::SetXposition (G4double val )
{ X0 = val;}
@@ -191,3 +213,6 @@ void HadrontherapyPrimaryGeneratorAction::SetsigmaMomentumY (G4double val )
void HadrontherapyPrimaryGeneratorAction::SetsigmaMomentumZ (G4double val )
{ sigmaMomentumZ = val;}
G4double HadrontherapyPrimaryGeneratorAction::GetmeanKineticEnergy(void)
{ return meanKineticEnergy;}
@@ -23,20 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: HadrontherapyPrimaryGeneratorMessenger.cc; May 2005
// ----------------------------------------------------------------------------
// GEANT 4 - Hadrontherapy example
// ----------------------------------------------------------------------------
// Code developed by:
//
// G.A.P. Cirrone(a)*, F. Di Rosa(a), S. Guatelli(b), G. Russo(a)
//
// (a) Laboratori Nazionali del Sud
// of the National Institute for Nuclear Physics, Catania, Italy
// (b) National Institute for Nuclear Physics Section of Genova, genova, Italy
//
// * cirrone@lns.infn.it
// ----------------------------------------------------------------------------
// HadrontherapyPrimaryGeneratorMessenger.cc;
// See more at: http://g4advancedexamples.lngs.infn.it/Examples/hadrontherapy
#include "HadrontherapyPrimaryGeneratorMessenger.hh"
#include "HadrontherapyPrimaryGeneratorAction.hh"
@@ -23,20 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: HadrontherapyRunAction.cc,v 3.0, September 2004;
// ----------------------------------------------------------------------------
// GEANT 4 - Hadrontherapy example
// ----------------------------------------------------------------------------
// Code developed by:
//
// G.A.P. Cirrone(a)*, F. Di Rosa(a), S. Guatelli(b), G. Russo(a)
//
// (a) Laboratori Nazionali del Sud
// of the INFN, Catania, Italy
// (b) INFN Section of Genova, Genova, Italy
//
// * cirrone@lns.infn.it
// ----------------------------------------------------------------------------
// $Id: HadrontherapyRunAction.cc
// See more at: http://g4advancedexamples.lngs.infn.it/Examples/hadrontherapy
#include "HadrontherapyRunAction.hh"
#include "HadrontherapyEventAction.hh"
@@ -0,0 +1,76 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// HadrontherapyStepMax.cc
// See more at: http://g4advancedexamples.lngs.infn.it/Examples/hadrontherapy
#include "HadrontherapyStepMax.hh"
#include "HadrontherapyStepMaxMessenger.hh"
/////////////////////////////////////////////////////////////////////////////
HadrontherapyStepMax::HadrontherapyStepMax(const G4String& processName)
: G4VDiscreteProcess(processName),MaxChargedStep(DBL_MAX)
{
pMess = new HadrontherapyStepMaxMessenger(this);
}
/////////////////////////////////////////////////////////////////////////////
HadrontherapyStepMax::~HadrontherapyStepMax() { delete pMess; }
/////////////////////////////////////////////////////////////////////////////
G4bool HadrontherapyStepMax::IsApplicable(const G4ParticleDefinition& particle)
{
return (particle.GetPDGCharge() != 0.);
}
/////////////////////////////////////////////////////////////////////////////
void HadrontherapyStepMax::SetMaxStep(G4double step) {MaxChargedStep = step;}
/////////////////////////////////////////////////////////////////////////////
G4double HadrontherapyStepMax::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;
return ProposedStep;
}
/////////////////////////////////////////////////////////////////////////////
G4VParticleChange* HadrontherapyStepMax::PostStepDoIt(const G4Track& aTrack, const G4Step&)
{
// do nothing
aParticleChange.Initialize(aTrack);
return &aParticleChange;
}
@@ -0,0 +1,56 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// HadrontherapyStepMaxMessenger.cc
// See more at: http://g4advancedexamples.lngs.infn.it/Examples/hadrontherapy
#include "HadrontherapyStepMaxMessenger.hh"
#include "HadrontherapyStepMax.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
/////////////////////////////////////////////////////////////////////////////
HadrontherapyStepMaxMessenger::HadrontherapyStepMaxMessenger(HadrontherapyStepMax* 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");
}
/////////////////////////////////////////////////////////////////////////////
HadrontherapyStepMaxMessenger::~HadrontherapyStepMaxMessenger()
{
delete StepMaxCmd;
}
/////////////////////////////////////////////////////////////////////////////
void HadrontherapyStepMaxMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
{
if (command == StepMaxCmd)
{ stepMax->SetMaxStep(StepMaxCmd->GetNewDoubleValue(newValue));}
}
@@ -23,24 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: HadrontherapyProtonSteppingAction.cc;
// Last modified: G.A.P.Cirrone March 2008;
//
// See more at: http://geant4infn.wikispaces.com/HadrontherapyExample
//
// ----------------------------------------------------------------------------
// GEANT 4 - Hadrontherapy example
// ----------------------------------------------------------------------------
// Code developed by:
//
// G.A.P. Cirrone(a)*, F. Di Rosa(a), S. Guatelli(b), G. Russo(a)
//
// (a) Laboratori Nazionali del Sud
// of the INFN, Catania, Italy
// (b) INFN Section of Genova, Genova, Italy
//
// * cirrone@lns.infn.it
// ----------------------------------------------------------------------------
// HadrontherapyProtonSteppingAction.cc;
// See more at: http://g4advancedexamples.lngs.infn.it/Examples/hadrontherapy
#include "G4SteppingManager.hh"
#include "G4TrackVector.hh"
@@ -55,14 +39,12 @@
#include "G4ParticleDefinition.hh"
#include "G4ParticleTypes.hh"
#ifdef G4ANALYSIS_USE
#include "HadrontherapyAnalysisManager.hh"
#endif
#include "HadrontherapyRunAction.hh"
/////////////////////////////////////////////////////////////////////////////
HadrontherapySteppingAction::HadrontherapySteppingAction( HadrontherapyRunAction* run)
HadrontherapySteppingAction::HadrontherapySteppingAction( HadrontherapyRunAction *run)
{
runAction = run;
}
@@ -75,8 +57,57 @@ HadrontherapySteppingAction::~HadrontherapySteppingAction()
/////////////////////////////////////////////////////////////////////////////
void HadrontherapySteppingAction::UserSteppingAction(const G4Step* aStep)
{
if( aStep->GetTrack()->GetVolume()->GetName() == "NewDetectorPhys"){
#ifdef ANALYSIS_USE
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;
HadrontherapyAnalysisManager* analysisMgr = HadrontherapyAnalysisManager::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
HadrontherapyAnalysisManager::getInstance()->fillFragmentTuple(1, 1.0, energy, posX, posY, posZ);
}
G4String secondaryParticleName = def -> GetParticleName();
//G4cout <<"Particle: " << secondaryParticleName << G4endl;
//G4cout <<"Energy: " << secondaryParticleKineticEnergy << G4endl;
HadrontherapyAnalysisManager* analysis = HadrontherapyAnalysisManager::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))
@@ -102,7 +133,6 @@ void HadrontherapySteppingAction::UserSteppingAction(const G4Step* aStep)
// Retrieve information about the secondaries originated in the phantom
#ifdef G4ANALYSIS_USE
G4SteppingManager* steppingManager = fpSteppingManager;
// check if it is alive
@@ -115,11 +145,12 @@ void HadrontherapySteppingAction::UserSteppingAction(const G4Step* aStep)
{
G4String volumeName = (*fSecondary)[lp1] -> GetVolume() -> GetName();
if (volumeName == "PhantomPhys")
if (volumeName == "phantomPhys")
{
#ifdef ANALYSIS_USE
G4String secondaryParticleName = (*fSecondary)[lp1]->GetDefinition() -> GetParticleName();
G4double secondaryParticleKineticEnergy = (*fSecondary)[lp1] -> GetKineticEnergy();
HadrontherapyAnalysisManager* analysis = HadrontherapyAnalysisManager::getInstance();
if (secondaryParticleName == "e-")
@@ -147,9 +178,9 @@ void HadrontherapySteppingAction::UserSteppingAction(const G4Step* aStep)
// total number of electrons in the orbitals are stored in a ntuple
analysis -> genericIonInformation(a, z, electronOccupancy, secondaryParticleKineticEnergy/MeV);
}
#endif
}
}
#endif
}
@@ -0,0 +1,317 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// IAEADetectorConstruction.cc
// See more at: http://g4advancedexamples.lngs.infn.it/Examples/hadrontherapy
#include "G4SDManager.hh"
#include "G4RunManager.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 "G4VisAttributes.hh"
#include "G4NistManager.hh"
#include "HadrontherapyAnalysisManager.hh"
#include "HadrontherapyDetectorROGeometry.hh"
#include "IAEADetectorMessenger.hh"
#include "HadrontherapyDetectorSD.hh"
#include "IAEADetectorConstruction.hh"
#include "HadrontherapyModulator.hh"
/////////////////////////////////////////////////////////////////////////////
IAEADetectorConstruction::IAEADetectorConstruction()
: detectorSD(0), detectorROGeometry(0),
passiveProtonBeamLine(0), modulator(0),
physicalTreatmentRoom(0),
phantomPhysicalVolume(0),
detectorLogicalVolume(0),
detectorPhysicalVolume(0)
{
// Messenger to change parameters of the geometry
detectorMessenger = new IAEADetectorMessenger(this);
// Detector sizes
detectorSizeX = 20.*cm;
detectorSizeY = 20.*cm;
detectorSizeZ = 20.*cm;
// Number of the detector voxels
// This does notthing, since a primitive score is used
numberOfVoxelsAlongX = 400;
numberOfVoxelsAlongY = 1;
numberOfVoxelsAlongZ = 1;
startDetectorThickness = 5.*cm; // approximation, exact value not given by Haettner
phantomCenter = startDetectorThickness + 64.*cm;
phantomDepth = 27.9 *cm;
plexiThickness = 0.2 *cm;
aluWindowThickness = 0.01 *cm;
endDetectorThickness = 3.7 *cm;
moveEndDetectorForward = 0 *cm; //if detector needs to be moved
endDetectorPosition = startDetectorThickness + 358 *cm + (endDetectorThickness / 2) - moveEndDetectorForward;
noPhantom = false;
}
/////////////////////////////////////////////////////////////////////////////
IAEADetectorConstruction::~IAEADetectorConstruction()
{
if (detectorROGeometry) delete detectorROGeometry;
delete detectorMessenger;
}
/////////////////////////////////////////////////////////////////////////////
//void IAEADetectorConstruction::ChangeTheBeamLine(const G4String& name)
//if (name == emName) return;
//if (name == "ProtonPassiveBeamLine")
//{
//ConstructPassiveProtonBeamLine();
//}
/////////////////////////////////////////////////////////////////////////////
G4VPhysicalVolume* IAEADetectorConstruction::Construct()
{
ConstructPassiveProtonBeamLine();
ConstructDetector();
#ifdef ANALYSIS_USE
//write the metadata for analysis
HadrontherapyAnalysisManager::getInstance()->setGeometryMetaData((endDetectorPosition - endDetectorThickness/2)/10, phantomDepth/10, phantomCenter/10); //FIXME! unit correction hardcoded
#endif
// Set the sensitive detector where the energy deposit is collected
ConstructSensitiveDetector();
return physicalTreatmentRoom;
}
/////////////////////////////////////////////////////////////////////////////
void IAEADetectorConstruction::ConstructPassiveProtonBeamLine()
{
// -----------------------------
// Treatment room - World volume
//------------------------------
// Treatment room sizes
const G4double worldX = 400.0 *cm;
const G4double worldY = 200.0 *cm; //to fit, new bigger detector
const G4double worldZ = 200.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);
//----------------------------------------
// Phantom:
// A box used to approximate tissues. Is surrounded by plexi-glas.
//----------------------------------------
G4Material* waterNist = G4NistManager::Instance()->FindOrBuildMaterial("G4_WATER", isotopes);
G4Material* plexiGlas = G4NistManager::Instance()->FindOrBuildMaterial("G4_PLEXIGLASS", isotopes);
//G4Box* phantom = new G4Box("Phantom",10 *cm, 20 *cm, 20 *cm);
//the below for integrated angular distribution plot
G4Box* phantom = new G4Box("Phantom",phantomDepth/2, 32 *cm, 32 *cm); //< E.haettner has 32x8, but simulation takes scattering symmetrically
G4Box* plexiSheet = new G4Box("phantomEdge",plexiThickness/2, 32 *cm, 32 *cm);
G4LogicalVolume* phantomLogicalVolume = new G4LogicalVolume(phantom,
waterNist,
"phantomLog", 0, 0, 0);
G4LogicalVolume* phantomEdgeLogicalVolume = new G4LogicalVolume(plexiSheet,
plexiGlas,
"phantomEdgeLog", 0, 0, 0);
//5.5cm for veto and start detector, see fig 5.1 and 4.1 ref Haettner 2006
if(!noPhantom){
phantomPhysicalVolume = new G4PVPlacement(0,G4ThreeVector(phantomCenter, 0.*cm, 0.*cm),
"phantomPhys",
phantomLogicalVolume,
physicalTreatmentRoom,
false,0);
phantomEdge1PhysicalVolume = new G4PVPlacement(0,G4ThreeVector(phantomCenter - phantomDepth/2 - plexiThickness/2, 0.*cm, 0.*cm),
"phantomEdgePhys",
phantomEdgeLogicalVolume,
physicalTreatmentRoom,
false,0);
phantomEdge2PhysicalVolume = new G4PVPlacement(0,G4ThreeVector(phantomCenter + phantomDepth/2 + plexiThickness/2, 0.*cm, 0.*cm),
"phantomEdgePhys",
phantomEdgeLogicalVolume,
physicalTreatmentRoom,
false,0);
}
//----------------------------------------
// Beamwindow:
// The aluminium-window of the beam-source
//----------------------------------------
G4Material* aluNist = G4NistManager::Instance()->FindOrBuildMaterial("G4_Al", isotopes);
G4Box* beamWindow = new G4Box("beamwindow",aluWindowThickness/2, 10 *cm, 10 *mm);
G4LogicalVolume* beamWindowLogicalVolume = new G4LogicalVolume(beamWindow,
aluNist,
"beamWindowLog", 0, 0, 0);
beamWindowPhysicalVolume = new G4PVPlacement(0,G4ThreeVector(1.*mm, 0.*mm, 0.*mm),
"beamPhys",
beamWindowLogicalVolume,
physicalTreatmentRoom,
false,0); //just ahead of beam that starts at origo
//----------------------------------------
// NewDetector:
// A box used to simulate the end detector
//----------------------------------------
//G4Material* NewDetectorMaterial = G4NistManager::Instance()->FindOrBuildMaterial("G4_AIR", isotopes);
//G4Box* NewDetector = new G4Box("NewDetector",1 *cm, 20 *cm, 27.9 *cm);
// Visualisation attributes of the patient
red = new G4VisAttributes(G4Colour(255/255., 0/255. ,0/255.));
red -> SetVisibility(true);
red -> SetForceSolid(true);
//red -> SetForceWireframe(true);
phantomLogicalVolume -> SetVisAttributes(red);
}
void IAEADetectorConstruction::setWaterThickness(G4double newWaterThickness){
//This has to be run before the elements are constructed
//does not support multiple thicknesses per run.
if(newWaterThickness > 0){
this->phantomDepth = newWaterThickness;
}else{
this->noPhantom = true;
}
#ifdef ANALYSIS_USE
//update the geometry metadata
HadrontherapyAnalysisManager::getInstance()->setGeometryMetaData((this->endDetectorPosition - this->endDetectorThickness/2)/10, this->phantomDepth/10, this->phantomCenter/10); //FIXME! unit correction hardcoded
#endif
}
/////////////////////////////////////////////////////////////////////////////
void IAEADetectorConstruction::ConstructDetector()
{
//-----------
// Braggcurve Detector
//-----------
//Is currently not used
G4bool isotopes = false;
G4Material* waterNist = G4NistManager::Instance()->FindOrBuildMaterial("G4_WATER", isotopes);
G4Box* detector = new G4Box("Detector",detectorSizeX,detectorSizeY,detectorSizeZ);
detectorLogicalVolume = new G4LogicalVolume(detector,
waterNist,
"DetectorLog",
0,0,0);
//G4double detectorXtranslation = -180.*mm;
G4double detectorXtranslation = -180.*cm;
detectorPhysicalVolume = new G4PVPlacement(0,
G4ThreeVector(detectorXtranslation, 0.0 *mm, 0.0 *mm),
"DetectorPhys",
detectorLogicalVolume,
phantomPhysicalVolume,
false,0);
// Visualisation attributes of the phantom
skyBlue = new G4VisAttributes( G4Colour(135/255. , 206/255. , 235/255. ));
skyBlue -> SetVisibility(true);
skyBlue -> SetForceSolid(true);
detectorLogicalVolume -> SetVisAttributes(skyBlue);
//Visualization attributes for the beamwindow
//-----------
// NewDetector (mwpc etc. type behind the phantom)
//-----------
G4Material* NewDetectorMaterial = G4NistManager::Instance()->FindOrBuildMaterial("G4_AIR", false);
G4Box* NewDetector = new G4Box("NewDetector",endDetectorThickness/2,190.*cm,190.*cm); //huge detector, will be scaled in root
//For integrated angular distribution below
NewDetectorLogicalVolume = new G4LogicalVolume(NewDetector,
NewDetectorMaterial,
"NewDetectorLog",
0,0,0);
NewDetectorPhysicalVolume = new G4PVPlacement(0,
G4ThreeVector(endDetectorPosition, 0.0 *cm, 0.0 *cm),
"NewDetectorPhys",
NewDetectorLogicalVolume,
physicalTreatmentRoom,
false,0);
// **************
// Cut per Region
// **************
// A smaller cut is fixed in the phantom to calculate the energy deposit with the
// required accuracy
// G4Region* aRegion = new G4Region("DetectorLog");
//detectorLogicalVolume -> SetRegion(aRegion);
//aRegion -> AddRootLogicalVolume(detectorLogicalVolume);
}
/////////////////////////////////////////////////////////////////////////////
void IAEADetectorConstruction::ConstructSensitiveDetector()
{
// Sensitive Detector and ReadOut geometry definition
G4SDManager* sensitiveDetectorManager = G4SDManager::GetSDMpointer();
G4String sensitiveDetectorName = "Detector";
if(!detectorSD)
{
// The sensitive detector is instantiated
detectorSD = new HadrontherapyDetectorSD(sensitiveDetectorName);
// The Read Out Geometry is instantiated
G4String ROGeometryName = "DetectorROGeometry";
detectorROGeometry = new HadrontherapyDetectorROGeometry(ROGeometryName,
G4ThreeVector(20. *mm, // detector to world position!
0. *mm,
0. *mm),
phantomDepth/2,
detectorSizeY,
detectorSizeZ,
numberOfVoxelsAlongX,
numberOfVoxelsAlongY,
numberOfVoxelsAlongZ);
detectorROGeometry -> BuildROGeometry();
detectorSD -> SetROgeometry(detectorROGeometry);
sensitiveDetectorManager -> AddNewDetector(detectorSD);
detectorLogicalVolume -> SetSensitiveDetector(detectorSD);
}
}
@@ -0,0 +1,59 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// $Id: HadrontherapyDetectorMessenger.cc;
// See more at: http://g4advancedexamples.lngs.infn.it/Examples/hadrontherapy
#include "IAEADetectorMessenger.hh"
#include "IAEADetectorConstruction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithAString.hh"
IAEADetectorMessenger::IAEADetectorMessenger(IAEADetectorConstruction* detector)
:IAEADetector(detector)
{
setIAEAWaterPhantomThicknessCmd = new G4UIcmdWithADoubleAndUnit("/iaea/waterPhantomThickness",this);
setIAEAWaterPhantomThicknessCmd -> SetGuidance("Set size of water phantom");
setIAEAWaterPhantomThicknessCmd -> SetParameterName("Size",false);
setIAEAWaterPhantomThicknessCmd -> SetDefaultUnit("cm");
setIAEAWaterPhantomThicknessCmd -> SetUnitCandidates("mm cm m");
setIAEAWaterPhantomThicknessCmd -> AvailableForStates(G4State_PreInit, G4State_Idle);
}
IAEADetectorMessenger::~IAEADetectorMessenger()
{
delete setIAEAWaterPhantomThicknessCmd;
}
void IAEADetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
{
if( command == setIAEAWaterPhantomThicknessCmd ){
IAEADetector->setWaterThickness(setIAEAWaterPhantomThicknessCmd->GetNewDoubleValue(newValue));
}
}
@@ -0,0 +1,121 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// IAEAScoreWriter.cc
// See more at: http://g4advancedexamples.lngs.infn.it/Examples/hadrontherapy
#include "IAEAScoreWriter.hh"
#include "G4MultiFunctionalDetector.hh"
#include "G4SDParticleFilter.hh"
#include "G4VPrimitiveScorer.hh"
#include "G4VScoringMesh.hh"
#include "HadrontherapyAnalysisManager.hh"
#include <map>
#include <fstream>
IAEAScoreWriter::IAEAScoreWriter()
: G4VScoreWriter() {
;
}
IAEAScoreWriter::~IAEAScoreWriter() {
;
}
void IAEAScoreWriter::DumpQuantityToFiles(G4String & psName, G4String & option) {
//
if(verboseLevel > 0) {
G4cout << "User-defined DumpQuantityToFile() method is invoked."
<< G4endl;
G4cout << "Will write energy deposits along phantom"
<< G4endl;
}
// change the option string into lowercase to the case-insensitive.
G4String opt = option;
std::transform(opt.begin(), opt.end(), opt.begin(), (int (*)(int))(tolower));
// confirm the option
if(opt.size() == 0) opt = "csv";
// retrieve the map
MeshScoreMap fSMap = fScoringMesh->GetScoreMap();
MeshScoreMap::const_iterator msMapItr = fSMap.find(psName);
if(msMapItr == fSMap.end()) {
G4cerr << "ERROR : DumpToFile : Unknown quantity, \""
<< psName << "\"." << G4endl;
return;
}
std::map<G4int, G4double*> * score = msMapItr->second->GetMap();
// declare xy array
std::vector<double> projy;
for(int y = 0; y < fNMeshSegments[1]; y++) projy.push_back(0.);
std::vector<std::vector<double> > projxy;
for(int x = 0; x < fNMeshSegments[0]; x++) projxy.push_back(projy);
// accumulate
// ofile << std::setprecision(16); // for double value with 8 bytes
for(int x = 0; x < fNMeshSegments[0]; x++) {
for(int y = 0; y < fNMeshSegments[1]; y++) {
for(int z = 0; z < fNMeshSegments[2]; z++) {
G4int idx = GetIndex(x, y, z);
std::map<G4int, G4double*>::iterator value = score->find(idx);
if(value != score->end()) projxy[x][y] += *(value->second);
} // z
} // y
} // x
// write quantity
#ifdef ANALYSIS_USE // If we are using ROOT or AIDA analysis
HadrontherapyAnalysisManager* analysis = HadrontherapyAnalysisManager::getInstance();
#endif
for(int x = 0; x < fNMeshSegments[0]; x++) {
for(int y = 0; y < fNMeshSegments[1]; y++) {
/* There is one unused mashdimension here, but for now I've decided to ignore it */
if(verboseLevel > 0) {
std::cout << x << "\t" << projxy[x][y] << G4endl;
}
#ifdef ANALYSIS_USE
analysis->BraggPeak(x, projxy[x][y]);
#endif
} // y
} // x
// ofile << std::setprecision(6);
// close the file
//ofile.close();
}
@@ -0,0 +1,194 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
// LocalINCLIonIonInelasticPhysic.cc
// See more at: http://g4advancedexamples.lngs.infn.it/Examples/hadrontherapy
//
// In this class the models for ion-ion interactions at intermediate energies (0 - 1 GeV per nucleon)
// can be activate. This class can be used alternatively to the "binary_ion" physics list
//
// The usefullness of this class is that you can explicitally see the total inelastic sections
// activated and the models called. Moreover you can choose to activate for ions (from deuteron
// to heavier nucleus) three different and exclusive models: the Binary Light Ion cascade, the QMD
// and The Wilson.
// For hadrotherapy pouposes, where distributions of produced fragments is importante we strongly
// suggest to use Binary or QMD. The Binary model is the default and at moment, you can swith beetween models decommenting
// the line of code and recompiling
#include "LocalINCLIonIonInelasticPhysic.hh"
#include "G4ParticleDefinition.hh"
#include "G4ProcessManager.hh"
// Total cross section for inelastic processes
#include "G4TripathiCrossSection.hh"
#include "G4TripathiLightCrossSection.hh"
#include "G4IonsShenCrossSection.hh"
#include "G4DeuteronInelasticProcess.hh"
#include "G4TritonInelasticProcess.hh"
#include "G4AlphaInelasticProcess.hh"
#include "G4LEDeuteronInelastic.hh"
#include "G4LETritonInelastic.hh"
#include "G4LEAlphaInelastic.hh"
#include "G4BinaryLightIonReaction.hh"
#include "G4InclAblaLightIonInterface.hh"
#include "G4QMDReaction.hh"
#include "G4WilsonAbrasionModel.hh"
#include "G4IonInelasticProcess.hh"
#include "G4GeneralSpaceNNCrossSection.hh"
/////////////////////////////////////////////////////////////////////////////
LocalINCLIonIonInelasticPhysic::LocalINCLIonIonInelasticPhysic(const G4String& name):
G4VPhysicsConstructor(name)
{
G4cout << G4endl
<< "A local inelastic model is activated for all ions"
<< G4endl;
}
/////////////////////////////////////////////////////////////////////////////
LocalINCLIonIonInelasticPhysic::~LocalINCLIonIonInelasticPhysic()
{}
/////////////////////////////////////////////////////////////////////////////
void LocalINCLIonIonInelasticPhysic::ConstructProcess()
{
G4ParticleDefinition* particle = 0;
G4ProcessManager* processManager = 0;
// ****************************************************************
// *** Ion-Ion models definition ***
// ****************************************************************
G4QMDReaction* JQMDmodel = new G4QMDReaction();
JQMDmodel -> SetMinEnergy(0*MeV);
JQMDmodel -> SetMaxEnergy(10*GeV);
G4BinaryLightIonReaction* lightBinary = new G4BinaryLightIonReaction();
lightBinary -> SetMinEnergy(0*MeV);
lightBinary -> SetMaxEnergy(10*GeV);
G4WilsonAbrasionModel* WilsonModel = new G4WilsonAbrasionModel();
WilsonModel -> SetUseAblation(true);
WilsonModel -> SetMinEnergy(0*MeV);
WilsonModel -> SetMaxEnergy(10 *GeV);
// G4InclAblaLightIonInterface* INCLIonModel = new G4InclAblaLightIonInterface();
G4TripathiCrossSection* TripatiCrossSections = new G4TripathiCrossSection;
G4TripathiCrossSection* TripatiLightCrossSections = new G4TripathiCrossSection;
G4IonsShenCrossSection* ShenCrossSections = new G4IonsShenCrossSection;
// ****************
// *** Deuteron ***
// ****************
G4DeuteronInelasticProcess* deuteronInelasticProcess = new G4DeuteronInelasticProcess;
deuteronInelasticProcess -> AddDataSet(ShenCrossSections);
deuteronInelasticProcess -> AddDataSet(TripatiCrossSections);
deuteronInelasticProcess -> AddDataSet(TripatiLightCrossSections);
//deuteronInelasticProcess -> RegisterMe(INCLIonModel);
//deuteronInelasticProcess -> RegisterMe(lightBinary);
deuteronInelasticProcess -> RegisterMe(JQMDmodel);
//deuteronInelasticProcess -> RegisterMe(WilsonModel);
particle = G4Deuteron::Deuteron();
processManager = particle -> GetProcessManager();
processManager -> AddDiscreteProcess(deuteronInelasticProcess);
// **************
// *** Triton ***
// **************
G4TritonInelasticProcess* tritonInelasticProcess = new G4TritonInelasticProcess;
tritonInelasticProcess -> AddDataSet(ShenCrossSections);
tritonInelasticProcess -> AddDataSet(TripatiCrossSections);
tritonInelasticProcess -> AddDataSet(TripatiLightCrossSections);
//tritonInelasticProcess -> RegisterMe(INCLIonModel);
//tritonInelasticProcess -> RegisterMe(lightBinary);
tritonInelasticProcess -> RegisterMe(JQMDmodel);
//tritonInelasticProcess -> RegisterMe(WilsonModel);
particle = G4Triton::Triton();
processManager = particle -> GetProcessManager();
processManager -> AddDiscreteProcess(tritonInelasticProcess);
// *************
// *** He3 ***
// *************
/*
G4He3InelasticProcess* he3InelasticProcess = new G4He3InelasticProcess;
he3InelasticProcess -> AddDataSet(ShenCrossSections);
he3InelasticProcess -> AddDataSet(TripatiCrossSections);
he3InelasticProcess -> AddDataSet(TripatiLightCrossSections);
he3InelasticProcess -> RegisterMe(INCLIonModel);
particle = G4He3::He3();
processManager = particle -> GetProcessManager();
processManager -> AddDiscreteProcess(he3InelasticProcess);
*/
// *************
// *** Alpha ***
// *************
G4AlphaInelasticProcess* alphaInelasticProcess = new G4AlphaInelasticProcess;
alphaInelasticProcess -> AddDataSet(ShenCrossSections);
alphaInelasticProcess -> AddDataSet(TripatiCrossSections);
alphaInelasticProcess -> AddDataSet(TripatiLightCrossSections);
//alphaInelasticProcess -> RegisterMe(INCLIonModel);
//alphaInelasticProcess -> RegisterMe(lightBinary);
alphaInelasticProcess -> RegisterMe(JQMDmodel);
//alphaInelasticProcess -> RegisterMe(WilsonModel);
particle = G4Alpha::Alpha();
processManager = particle -> GetProcessManager();
processManager -> AddDiscreteProcess(alphaInelasticProcess);
// *******************
// *** Generic Ion ***
// *******************
G4IonInelasticProcess* genericIonInelasticProcess = new G4IonInelasticProcess();
genericIonInelasticProcess -> AddDataSet(ShenCrossSections);
genericIonInelasticProcess -> AddDataSet(TripatiCrossSections);
genericIonInelasticProcess -> AddDataSet(TripatiLightCrossSections);
//genericIonInelasticProcess -> RegisterMe(lightBinary);
genericIonInelasticProcess -> RegisterMe(JQMDmodel);
//genericIonInelasticProcess -> RegisterMe(WilsonModel);
particle = G4GenericIon::GenericIon();
processManager = particle -> GetProcessManager();
processManager -> AddDiscreteProcess(genericIonInelasticProcess);
}
@@ -0,0 +1,172 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
// LocalIonIonInelasticPhysic.cc
// See more at: http://g4advancedexamples.lngs.infn.it/Examples/hadrontherapy
//
// In this class the models for ion-ion interactions at intermediate energies (0 - 1 GeV per nucleon)
// can be activate. This class can be used alternatively to the "binary_ion" physics list
//
// The usefullness of this class is that you can explicitally see the total inelastic sections
// activated and the models called. Moreover you can choose to activate for ions (from deuteron
// to heavier nucleus) three different and exclusive models: the Binary Light Ion cascade, the QMD
// and The Wilson.
// For hadrotherapy pouposes, where distributions of produced fragments is importante we strongly
// suggest to use Binary or QMD. The Binary model is the default and at moment, you can swith beetween models decommenting
// the line of code and recompiling
#include "LocalIonIonInelasticPhysic.hh"
#include "G4ParticleDefinition.hh"
#include "G4ProcessManager.hh"
// Total cross section for inelastic processes
#include "G4TripathiCrossSection.hh"
#include "G4TripathiLightCrossSection.hh"
#include "G4IonsShenCrossSection.hh"
#include "G4DeuteronInelasticProcess.hh"
#include "G4TritonInelasticProcess.hh"
#include "G4AlphaInelasticProcess.hh"
#include "G4LEDeuteronInelastic.hh"
#include "G4LETritonInelastic.hh"
#include "G4LEAlphaInelastic.hh"
#include "G4BinaryLightIonReaction.hh"
#include "G4QMDReaction.hh"
#include "G4WilsonAbrasionModel.hh"
#include "G4IonInelasticProcess.hh"
#include "G4GeneralSpaceNNCrossSection.hh"
/////////////////////////////////////////////////////////////////////////////
LocalIonIonInelasticPhysic::LocalIonIonInelasticPhysic(const G4String& name):
G4VPhysicsConstructor(name)
{
G4cout << G4endl
<< "A local inelastic model is activated for all ions"
<< G4endl;
}
/////////////////////////////////////////////////////////////////////////////
LocalIonIonInelasticPhysic::~LocalIonIonInelasticPhysic()
{}
/////////////////////////////////////////////////////////////////////////////
void LocalIonIonInelasticPhysic::ConstructProcess()
{
G4ParticleDefinition* particle = 0;
G4ProcessManager* processManager = 0;
// ****************************************************************
// *** Ion-Ion models definition ***
// ****************************************************************
G4QMDReaction* JQMDmodel = new G4QMDReaction();
JQMDmodel -> SetMinEnergy(0*MeV);
JQMDmodel -> SetMaxEnergy(10*GeV);
G4BinaryLightIonReaction* ligthBinary = new G4BinaryLightIonReaction();
ligthBinary -> SetMinEnergy(0*MeV);
ligthBinary -> SetMaxEnergy(10*GeV);
G4WilsonAbrasionModel* WilsonModel = new G4WilsonAbrasionModel();
WilsonModel -> SetUseAblation(true);
WilsonModel -> SetMinEnergy(0*MeV);
WilsonModel -> SetMaxEnergy(10 *GeV);
G4TripathiCrossSection* TripatiCrossSections = new G4TripathiCrossSection;
G4TripathiLightCrossSection* TripatiLightCrossSections = new G4TripathiLightCrossSection;
G4IonsShenCrossSection* ShenCrossSections = new G4IonsShenCrossSection;
// ****************
// *** Deuteron ***
// ****************
G4DeuteronInelasticProcess* deuteronInelasticProcess = new G4DeuteronInelasticProcess;
deuteronInelasticProcess -> AddDataSet(ShenCrossSections);
deuteronInelasticProcess -> AddDataSet(TripatiCrossSections);
deuteronInelasticProcess -> AddDataSet(TripatiLightCrossSections);
deuteronInelasticProcess -> RegisterMe(ligthBinary);
//deuteronInelasticProcess -> RegisterMe(JQMDmodel);
//deuteronInelasticProcess -> RegisterMe(WilsonModel);
particle = G4Deuteron::Deuteron();
processManager = particle -> GetProcessManager();
processManager -> AddDiscreteProcess(deuteronInelasticProcess);
// **************
// *** Triton ***
// **************
G4TritonInelasticProcess* tritonInelasticProcess = new G4TritonInelasticProcess;
tritonInelasticProcess -> AddDataSet(ShenCrossSections);
tritonInelasticProcess -> AddDataSet(TripatiCrossSections);
tritonInelasticProcess -> AddDataSet(TripatiLightCrossSections);
tritonInelasticProcess -> RegisterMe(ligthBinary);
//tritonInelasticProcess -> RegisterMe(JQMDmodel);
//tritonInelasticProcess -> RegisterMe(WilsonModel);
particle = G4Triton::Triton();
processManager = particle -> GetProcessManager();
processManager -> AddDiscreteProcess(tritonInelasticProcess);
// *************
// *** Alpha ***
// *************
G4AlphaInelasticProcess* alphaInelasticProcess = new G4AlphaInelasticProcess;
alphaInelasticProcess -> AddDataSet(ShenCrossSections);
alphaInelasticProcess -> AddDataSet(TripatiCrossSections);
alphaInelasticProcess -> AddDataSet(TripatiLightCrossSections);
alphaInelasticProcess -> RegisterMe(ligthBinary);
//alphaInelasticProcess -> RegisterMe(JQMDmodel);
//alphaIonInelasticProcess -> RegisterMe(WilsonModel);
particle = G4Alpha::Alpha();
processManager = particle -> GetProcessManager();
processManager -> AddDiscreteProcess(alphaInelasticProcess);
// *******************
// *** Generic Ion ***
// *******************
G4IonInelasticProcess* genericIonInelasticProcess = new G4IonInelasticProcess();
genericIonInelasticProcess -> AddDataSet(ShenCrossSections);
genericIonInelasticProcess -> AddDataSet(TripatiCrossSections);
genericIonInelasticProcess -> AddDataSet(TripatiLightCrossSections);
genericIonInelasticProcess -> RegisterMe(ligthBinary);
//genericIonInelasticProcess -> RegisterMe(JQMDmodel);
//genericIonInelasticProcess -> RegisterMe(WilsonModel);
particle = G4GenericIon::GenericIon();
processManager = particle -> GetProcessManager();
processManager -> AddDiscreteProcess(genericIonInelasticProcess);
}
@@ -0,0 +1,179 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// passiveProtonBeamLineMessenger.cc;
// See more at: http://g4advancedexamples.lngs.infn.it/Examples/hadrontherapy
#include "PassiveProtonBeamLineMessenger.hh"
#include "PassiveProtonBeamLine.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithAString.hh"
PassiveProtonBeamLineMessenger::PassiveProtonBeamLineMessenger(PassiveProtonBeamLine* beamLine)
:passiveProton(beamLine)
{
changeTheBeamLineDir = new G4UIdirectory("/ChangeBeamLine/");
changeTheBeamLineDir -> SetGuidance("Command to change the transport beam line");
changeTheBeamLineNameCmd = new G4UIcmdWithAString("/ChangeBeamLine/beamLineName",this);
changeTheBeamLineNameCmd -> SetGuidance("Insert the name of the beam line you want simulate");
changeTheBeamLineNameCmd -> SetParameterName("List",false);
changeTheBeamLineNameCmd -> AvailableForStates(G4State_PreInit);
modulatorDir = new G4UIdirectory("/modulator/");
modulatorDir -> SetGuidance("Command to rotate the modulator wheel");
beamLineDir = new G4UIdirectory("/beamLine/");
beamLineDir -> SetGuidance("set specification of range shifter");
rangeShifterDir = new G4UIdirectory("/beamLine/RangeShifter/");
rangeShifterDir -> SetGuidance("set specification of range shifter");
firstScatteringFoilDir = new G4UIdirectory("/beamLine/ScatteringFoil1/");
firstScatteringFoilDir -> SetGuidance("set specification of first scattering foil");
secondScatteringFoilDir = new G4UIdirectory("/beamLine/ScatteringFoil2/");
secondScatteringFoilDir -> SetGuidance("set specification of second scattering foil");
rangeStopperDir = new G4UIdirectory("/beamLine/Stopper/");
rangeStopperDir -> SetGuidance("set specification of stopper");
finalCollimatorDir = new G4UIdirectory("/beamLine/FinalCollimator/");
finalCollimatorDir -> SetGuidance("set specification of final collimator");
modulatorAngleCmd = new G4UIcmdWithADoubleAndUnit("/modulator/angle",this);
modulatorAngleCmd -> SetGuidance("Set Modulator Angle");
modulatorAngleCmd -> SetParameterName("Size",false);
modulatorAngleCmd -> SetRange("Size>=0.");
modulatorAngleCmd -> SetUnitCategory("Angle");
modulatorAngleCmd -> AvailableForStates(G4State_Idle);
rangeShifterMatCmd = new G4UIcmdWithAString("/beamLine/RangeShifter/RSMat",this);
rangeShifterMatCmd -> SetGuidance("Set material of range shifter");
rangeShifterMatCmd -> SetParameterName("choice",false);
rangeShifterMatCmd -> AvailableForStates(G4State_Idle);
rangeShifterXSizeCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/RangeShifter/thickness",this);
rangeShifterXSizeCmd -> SetGuidance("Set half of the thickness of range shifter along X axis");
rangeShifterXSizeCmd -> SetParameterName("Size",false);
rangeShifterXSizeCmd -> SetDefaultUnit("mm");
rangeShifterXSizeCmd -> SetUnitCandidates("mm cm m");
rangeShifterXSizeCmd -> AvailableForStates(G4State_Idle);
rangeShifterXPositionCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/RangeShifter/position",this);
rangeShifterXPositionCmd -> SetGuidance("Set position of range shifter");
rangeShifterXPositionCmd -> SetParameterName("Size",false);
rangeShifterXPositionCmd -> SetDefaultUnit("mm");
rangeShifterXPositionCmd -> SetUnitCandidates("mm cm m");
rangeShifterXPositionCmd -> AvailableForStates(G4State_Idle);
firstScatteringFoilXSizeCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/ScatteringFoil1/thickness",this);
firstScatteringFoilXSizeCmd -> SetGuidance("Set half thickness of first scattering foil");
firstScatteringFoilXSizeCmd -> SetParameterName("Size",false);
firstScatteringFoilXSizeCmd -> SetDefaultUnit("mm");
firstScatteringFoilXSizeCmd -> SetUnitCandidates("mm cm m");
firstScatteringFoilXSizeCmd -> AvailableForStates(G4State_Idle);
secondScatteringFoilXSizeCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/ScatteringFoil2/thickness",this);
secondScatteringFoilXSizeCmd -> SetGuidance("Set half thickness of second scattering foil");
secondScatteringFoilXSizeCmd -> SetParameterName("Size",false);
secondScatteringFoilXSizeCmd -> SetDefaultUnit("mm");
secondScatteringFoilXSizeCmd -> SetUnitCandidates("mm cm m");
secondScatteringFoilXSizeCmd -> AvailableForStates(G4State_Idle);
outerRadiusStopperCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/Stopper/outRadius",this);
outerRadiusStopperCmd -> SetGuidance("Set size of outer radius");
outerRadiusStopperCmd -> SetParameterName("Size",false);
outerRadiusStopperCmd -> SetDefaultUnit("mm");
outerRadiusStopperCmd -> SetUnitCandidates("mm cm m");
outerRadiusStopperCmd -> AvailableForStates(G4State_Idle);
innerRadiusFinalCollimatorCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/FinalCollimator/halfInnerRad",this);
innerRadiusFinalCollimatorCmd -> SetGuidance("Set size of inner radius ( max 21.5 mm)");
innerRadiusFinalCollimatorCmd -> SetParameterName("Size",false);
innerRadiusFinalCollimatorCmd -> SetDefaultUnit("mm");
innerRadiusFinalCollimatorCmd -> SetUnitCandidates("mm cm m");
innerRadiusFinalCollimatorCmd -> AvailableForStates(G4State_Idle);
}
PassiveProtonBeamLineMessenger::~PassiveProtonBeamLineMessenger()
{
delete innerRadiusFinalCollimatorCmd;
delete outerRadiusStopperCmd;
delete secondScatteringFoilXSizeCmd;
delete firstScatteringFoilXSizeCmd;
delete rangeShifterXPositionCmd;
delete rangeShifterXSizeCmd;
delete rangeShifterMatCmd;
delete modulatorAngleCmd;
delete finalCollimatorDir;
delete rangeStopperDir;
delete secondScatteringFoilDir;
delete firstScatteringFoilDir;
delete rangeShifterDir;
delete beamLineDir;
delete modulatorDir;
}
void PassiveProtonBeamLineMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
{
if( command == modulatorAngleCmd )
{ passiveProton -> SetModulatorAngle
(modulatorAngleCmd -> GetNewDoubleValue(newValue));}
else if( command == rangeShifterMatCmd )
{ passiveProton -> SetRSMaterial(newValue);}
else if( command == rangeShifterXSizeCmd )
{ passiveProton -> SetRangeShifterXSize
(rangeShifterXSizeCmd -> GetNewDoubleValue(newValue));}
else if( command == rangeShifterXPositionCmd )
{ passiveProton -> SetRangeShifterXPosition
(rangeShifterXPositionCmd -> GetNewDoubleValue(newValue));}
else if( command == firstScatteringFoilXSizeCmd )
{ passiveProton -> SetFirstScatteringFoilXSize
(firstScatteringFoilXSizeCmd -> GetNewDoubleValue(newValue));}
else if( command == secondScatteringFoilXSizeCmd )
{ passiveProton -> SetSecondScatteringFoilXSize
(secondScatteringFoilXSizeCmd -> GetNewDoubleValue(newValue));}
else if( command == outerRadiusStopperCmd )
{ passiveProton -> SetOuterRadiusStopper(
outerRadiusStopperCmd -> GetNewDoubleValue(newValue));}
else if( command == innerRadiusFinalCollimatorCmd )
{ passiveProton -> SetInnerRadiusFinalCollimator
(innerRadiusFinalCollimatorCmd -> GetNewDoubleValue(newValue));}
}