Import Geant4 10.6.0 source tree
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// Author: F. Poignant, floriane.poignant@gmail.com
|
||||
//
|
||||
// file STCyclotronActionInitialization.cc
|
||||
//
|
||||
#include "STCyclotronActionInitialization.hh"
|
||||
#include "STCyclotronRunAction.hh"
|
||||
#include "STCyclotronPrimaryGeneratorAction.hh"
|
||||
#include "G4RunManager.hh"
|
||||
#include "STCyclotronDetectorConstruction.hh"
|
||||
|
||||
STCyclotronActionInitialization::STCyclotronActionInitialization(STCyclotronDetectorConstruction* det):
|
||||
G4VUserActionInitialization()
|
||||
{
|
||||
fDetector = det;
|
||||
}
|
||||
|
||||
STCyclotronActionInitialization::~STCyclotronActionInitialization()
|
||||
{}
|
||||
|
||||
void STCyclotronActionInitialization::BuildForMaster() const
|
||||
{
|
||||
STCyclotronRunAction* run = new STCyclotronRunAction(fDetector);
|
||||
SetUserAction(run);
|
||||
}
|
||||
|
||||
void STCyclotronActionInitialization::Build() const
|
||||
{
|
||||
// Initialize the primary particles
|
||||
STCyclotronPrimaryGeneratorAction* primary = new STCyclotronPrimaryGeneratorAction();
|
||||
SetUserAction(primary);
|
||||
|
||||
// Initialize the run action
|
||||
STCyclotronRunAction* run = new STCyclotronRunAction(fDetector);
|
||||
SetUserAction(run);
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,497 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// Author: F. Poignant, floriane.poignant@gmail.com
|
||||
//
|
||||
// file STCyclotronDetectorMesseger.cc
|
||||
//
|
||||
|
||||
#include "STCyclotronDetectorMessenger.hh"
|
||||
#include "STCyclotronDetectorConstruction.hh"
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcmdWithADoubleAndUnit.hh"
|
||||
#include "G4UIcmdWithoutParameter.hh"
|
||||
#include "G4UIcmdWithADouble.hh"
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
#include "G4UIcmdWithAnInteger.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4UIcommand.hh"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
STCyclotronDetectorMessenger::STCyclotronDetectorMessenger(STCyclotronDetectorConstruction* detector)
|
||||
:fDet(detector)
|
||||
{
|
||||
/////////////////////////////
|
||||
// Change Target parameters//
|
||||
/////////////////////////////
|
||||
fChangeTarget = new G4UIdirectory("/changeTarget/");
|
||||
fChangeTarget -> SetGuidance("Change the Target diameter/thickness/material");
|
||||
|
||||
// change Target diameter
|
||||
fChangeTargetDiameterCmd = new G4UIcmdWithADoubleAndUnit("/changeTarget/diameter", this);
|
||||
fChangeTargetDiameterCmd -> SetGuidance("Change the diameter value of the target. "
|
||||
"\nDefault value is 7. mm."
|
||||
"\nThe range is between 0 and 15 mm.");
|
||||
fChangeTargetDiameterCmd -> SetParameterName("TargetDiameter", true);
|
||||
fChangeTargetDiameterCmd -> SetRange("TargetDiameter > 0. && TargetDiameter < 15.");
|
||||
fChangeTargetDiameterCmd -> SetDefaultValue(7.*mm);
|
||||
fChangeTargetDiameterCmd -> AvailableForStates(G4State_Idle);
|
||||
fChangeTargetDiameterCmd -> SetDefaultUnit("mm");
|
||||
fChangeTargetDiameterCmd -> SetUnitCandidates("mm");
|
||||
|
||||
// Change Target parameters
|
||||
fChangeTargetMaterial = new G4UIdirectory("/changeTarget/designedMaterial/");
|
||||
fChangeTargetMaterial -> SetGuidance("Change the Target material choosing isotopes and elements, and their abundance in the target");
|
||||
|
||||
//Change target material defining isotopes
|
||||
fTargetIsotopeName = new G4UIcmdWithAString("/changeTarget/designedMaterial/isotopeName",this);
|
||||
fTargetIsotopeName->SetGuidance("name of the isotope - ex : Ni64");
|
||||
fTargetIsotopeName->SetParameterName("IsotopeName",false);
|
||||
fTargetIsotopeName->AvailableForStates(G4State_Idle);
|
||||
|
||||
fTargetIsotopeZ = new G4UIcmdWithADouble("/changeTarget/designedMaterial/isotopeZ",this);
|
||||
fTargetIsotopeZ-> SetGuidance("Z of the isotope");
|
||||
fTargetIsotopeZ->SetParameterName("IsotopeZ",false);
|
||||
fTargetIsotopeZ->AvailableForStates(G4State_Idle);
|
||||
|
||||
fTargetIsotopeN = new G4UIcmdWithAnInteger("/changeTarget/designedMaterial/isotopeN",this);
|
||||
fTargetIsotopeN->SetGuidance("N (number of nucleons) of the isotope");
|
||||
fTargetIsotopeN->SetParameterName("IsotopeN",false);
|
||||
fTargetIsotopeN->AvailableForStates(G4State_Idle);
|
||||
|
||||
fTargetIsotopeA = new G4UIcmdWithADouble("/changeTarget/designedMaterial/isotopeA",this);
|
||||
fTargetIsotopeA->SetGuidance("A of the isotope, in g/cm3");
|
||||
fTargetIsotopeA->SetParameterName("IsotopeA",false);
|
||||
fTargetIsotopeA->AvailableForStates(G4State_Idle);
|
||||
|
||||
//Define elements
|
||||
fTargetElementName= new G4UIcmdWithAString("/changeTarget/designedMaterial/ElementName",this);
|
||||
fTargetElementName->SetGuidance("Name of the material - ex : PureNi64");
|
||||
fTargetElementName->SetParameterName("ElementName",false);
|
||||
fTargetElementName->AvailableForStates(G4State_Idle);
|
||||
|
||||
fTargetElementSymbole=new G4UIcmdWithAString("/changeTarget/designedMaterial/ElementSymbole",this);
|
||||
fTargetElementSymbole->SetGuidance("Symbole of the element : ex 64Ni");
|
||||
fTargetElementSymbole->SetParameterName("ElementSymbole", false);
|
||||
fTargetElementSymbole->AvailableForStates(G4State_Idle);
|
||||
|
||||
fTargetElementNComponents = new G4UIcmdWithAnInteger("/changeTarget/designedMaterial/ElementNComponents",this);
|
||||
fTargetElementNComponents->SetGuidance("Number of isotopes in the element");
|
||||
fTargetElementNComponents->SetParameterName("ElementNComponent", false);
|
||||
fTargetElementNComponents->AvailableForStates(G4State_Idle);
|
||||
|
||||
fTargetElementAbundance = new G4UIcmdWithADouble("/changeTarget/designedMaterial/IsotopeAbundanceInElement",this);
|
||||
fTargetElementAbundance->SetGuidance("Abundance of the isotope in the target");
|
||||
fTargetElementAbundance->SetParameterName("IsotopeAbundance",false);
|
||||
fTargetElementAbundance->AvailableForStates(G4State_Idle);
|
||||
|
||||
//Change material properties
|
||||
fChangeTargetMaterialDensityCmd = new G4UIcmdWithADouble("/changeTarget/designedMaterial/materialDensity", this);
|
||||
fChangeTargetMaterialDensityCmd -> SetGuidance("Change the density value of the Target Material."
|
||||
"\nDefault value : 8.85 g/cm3.");
|
||||
fChangeTargetMaterialDensityCmd -> SetParameterName("TargetMaterialDensity", true);
|
||||
fChangeTargetMaterialDensityCmd -> SetDefaultValue(8.85);
|
||||
fChangeTargetMaterialDensityCmd -> AvailableForStates(G4State_Idle);
|
||||
|
||||
fTargetMaterialNComponents = new G4UIcmdWithAnInteger("/changeTarget/designedMaterial/MaterialNComponents",this);
|
||||
fTargetMaterialNComponents->SetGuidance("Number of elements in the target material");
|
||||
fTargetMaterialNComponents->SetParameterName("MaterialNComponents",false);
|
||||
fTargetMaterialNComponents->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
fTargetMaterialFractionMass= new G4UIcmdWithADouble("/changeTarget/designedMaterial/MaterialFractionMass",this);
|
||||
fTargetMaterialFractionMass->SetGuidance("Fraction mass of the element in the material");
|
||||
fTargetMaterialFractionMass->SetParameterName("MaterialFractionMass",false);
|
||||
fTargetMaterialFractionMass->AvailableForStates(G4State_Idle);
|
||||
|
||||
fTargetMaterialNaturalElement= new G4UIcmdWithAString("/changeTarget/designedMaterial/naturalElementName",this);
|
||||
fTargetMaterialNaturalElement->SetGuidance("Add an element using NIST database");
|
||||
fTargetMaterialNaturalElement->SetParameterName("NaturalElement",false);
|
||||
fTargetMaterialNaturalElement->AvailableForStates(G4State_Idle);
|
||||
|
||||
fTargetMaterialNaturalElementFractionMass= new G4UIcmdWithADouble("/changeTarget/designedMaterial/naturalElementFractionMass",this);
|
||||
fTargetMaterialNaturalElementFractionMass->SetGuidance("Add the fraction mass of the natural element");
|
||||
fTargetMaterialNaturalElementFractionMass->SetParameterName("NaturalElementFractionMass",false);
|
||||
fTargetMaterialNaturalElementFractionMass->AvailableForStates(G4State_Idle);
|
||||
|
||||
|
||||
fUpdateMaterial = new G4UIcmdWithoutParameter("/changeTarget/designedMaterial/update",this);
|
||||
fUpdateMaterial->SetGuidance("Update the material once its components are defined");
|
||||
fUpdateMaterial->AvailableForStates(G4State_Idle);
|
||||
|
||||
//Change material using physics NIST
|
||||
fChangeTargetMaterialCmd = new G4UIcmdWithAString("/changeTarget/materialNist", this);
|
||||
fChangeTargetMaterialCmd -> SetGuidance("Change the material of your target using the NIST database."
|
||||
"\nTo get the list of the available NIST materials, please select 'TargetMaterial->NistMaterialList'."
|
||||
"\nExample of a NIST material : 'G4_Ni'.");
|
||||
fChangeTargetMaterialCmd -> SetParameterName("TargetMaterial",false);
|
||||
|
||||
|
||||
//Change Target thickness
|
||||
fChangeTargetThicknessCmd = new G4UIcmdWithADoubleAndUnit("/changeTarget/thickness", this);
|
||||
fChangeTargetThicknessCmd -> SetGuidance("Change the thickness value of the Target."
|
||||
"\nDefault value : 0.6 mm.");
|
||||
fChangeTargetThicknessCmd -> SetParameterName("TargetThickness", true);
|
||||
fChangeTargetThicknessCmd -> SetDefaultValue(0.6*mm);
|
||||
fChangeTargetThicknessCmd -> AvailableForStates(G4State_Idle);
|
||||
fChangeTargetThicknessCmd -> SetDefaultUnit("mm");
|
||||
fChangeTargetThicknessCmd -> SetUnitCandidates("mm");
|
||||
|
||||
|
||||
//////////////////////////
|
||||
//Change foil parameters//
|
||||
//////////////////////////
|
||||
|
||||
fChangeFoil = new G4UIdirectory("/changeFoil/");
|
||||
fChangeFoil -> SetGuidance("Change the Foil thickness");
|
||||
|
||||
// Change Foil Thickness
|
||||
fChangeFoilThicknessCmd = new G4UIcmdWithADoubleAndUnit("/changeFoil/thickness", this);
|
||||
fChangeFoilThicknessCmd -> SetGuidance("Change the thickness value of the foil "
|
||||
"\nThe default value is 0.32 mm.");
|
||||
fChangeFoilThicknessCmd -> SetParameterName("FoilThickness", true);
|
||||
fChangeFoilThicknessCmd -> SetDefaultValue(.32*mm);
|
||||
fChangeFoilThicknessCmd -> AvailableForStates(G4State_Idle);
|
||||
fChangeFoilThicknessCmd -> SetDefaultUnit("mm");
|
||||
fChangeFoilThicknessCmd -> SetUnitCandidates("mm");
|
||||
|
||||
// Change Target material
|
||||
fChangeFoilMaterial = new G4UIdirectory("/changeFoil/designedMaterial/");
|
||||
fChangeFoilMaterial -> SetGuidance("Change the Foil material choosing isotopes and elements, and their abundance in the foil");
|
||||
|
||||
//Change target material defining isotopes
|
||||
fFoilIsotopeName = new G4UIcmdWithAString("/changeFoil/designedMaterial/isotopeName",this);
|
||||
fFoilIsotopeName->SetGuidance("name of the isotope - ex : Ni64");
|
||||
fFoilIsotopeName->SetParameterName("foilIsotopeName",false);
|
||||
fFoilIsotopeName->AvailableForStates(G4State_Idle);
|
||||
|
||||
fFoilIsotopeZ = new G4UIcmdWithADouble("/changeFoil/designedMaterial/isotopeZ",this);
|
||||
fFoilIsotopeZ-> SetGuidance("Z of the isotope");
|
||||
fFoilIsotopeZ->SetParameterName("foilIsotopeZ",false);
|
||||
fFoilIsotopeZ->AvailableForStates(G4State_Idle);
|
||||
|
||||
fFoilIsotopeN = new G4UIcmdWithAnInteger("/changeFoil/designedMaterial/isotopeN",this);
|
||||
fFoilIsotopeN->SetGuidance("N (number of nucleons) of the isotope");
|
||||
fFoilIsotopeN->SetParameterName("foilIsotopeN",false);
|
||||
fFoilIsotopeN->AvailableForStates(G4State_Idle);
|
||||
|
||||
fFoilIsotopeA = new G4UIcmdWithADouble("/changeFoil/designedMaterial/isotopeA",this);
|
||||
fFoilIsotopeA->SetGuidance("A of the isotope, in g/cm3");
|
||||
fFoilIsotopeA->SetParameterName("foilIsotopeA",false);
|
||||
fFoilIsotopeA->AvailableForStates(G4State_Idle);
|
||||
|
||||
//Define elements
|
||||
|
||||
fFoilElementName= new G4UIcmdWithAString("/changeFoil/designedMaterial/ElementName",this);
|
||||
fFoilElementName->SetGuidance("Name of the material - ex : PureNi64");
|
||||
fFoilElementName->SetParameterName("foilElementName",false);
|
||||
fFoilElementName->AvailableForStates(G4State_Idle);
|
||||
|
||||
fFoilElementSymbole=new G4UIcmdWithAString("/changeFoil/designedMaterial/ElementSymbole",this);
|
||||
fFoilElementSymbole->SetGuidance("Symbole of the element : ex 64Ni");
|
||||
fFoilElementSymbole->SetParameterName("foilElementSymbole", false);
|
||||
fFoilElementSymbole->AvailableForStates(G4State_Idle);
|
||||
|
||||
fFoilElementNComponents = new G4UIcmdWithAnInteger("/changeFoil/designedMaterial/ElementNComponents",this);
|
||||
fFoilElementNComponents->SetGuidance("Number of isotopes in the element");
|
||||
fFoilElementNComponents->SetParameterName("foilElementNComponent", false);
|
||||
fFoilElementNComponents->AvailableForStates(G4State_Idle);
|
||||
|
||||
fFoilElementAbundance = new G4UIcmdWithADouble("/changeFoil/designedMaterial/IsotopeAbundanceInElement",this);
|
||||
fFoilElementAbundance->SetGuidance("Abundance of the isotope in the foil");
|
||||
fFoilElementAbundance->SetParameterName("foilIsotopeAbundance",false);
|
||||
fFoilElementAbundance->AvailableForStates(G4State_Idle);
|
||||
|
||||
//Change material properties
|
||||
fChangeFoilMaterialDensityCmd = new G4UIcmdWithADouble("/changeFoil/designedMaterial/materialDensity", this);
|
||||
fChangeFoilMaterialDensityCmd -> SetGuidance("Change the density value of the Target Material");
|
||||
fChangeFoilMaterialDensityCmd -> SetParameterName("FoilMaterialDensity", true);
|
||||
fChangeFoilMaterialDensityCmd -> AvailableForStates(G4State_Idle);
|
||||
|
||||
fFoilMaterialNComponents = new G4UIcmdWithAnInteger("/changeFoil/designedMaterial/MaterialNComponents",this);
|
||||
fFoilMaterialNComponents->SetGuidance("Number of elements in the target material");
|
||||
fFoilMaterialNComponents->SetParameterName("foilMaterialNComponents",false);
|
||||
fFoilMaterialNComponents->AvailableForStates(G4State_Idle);
|
||||
|
||||
fFoilMaterialFractionMass= new G4UIcmdWithADouble("/changeFoil/designedMaterial/MaterialFractionMass",this);
|
||||
fFoilMaterialFractionMass->SetGuidance("Fraction mass of the element in the material");
|
||||
fFoilMaterialFractionMass->SetParameterName("foilMaterialFractionMass",false);
|
||||
fFoilMaterialFractionMass->AvailableForStates(G4State_Idle);
|
||||
|
||||
fFoilMaterialNaturalElement= new G4UIcmdWithAString("/changeFoil/designedMaterial/naturalElementName",this);
|
||||
fFoilMaterialNaturalElement->SetGuidance("Add an element using NIST database");
|
||||
fFoilMaterialNaturalElement->SetParameterName("foilNaturalElement",false);
|
||||
fFoilMaterialNaturalElement->AvailableForStates(G4State_Idle);
|
||||
|
||||
fFoilMaterialNaturalElementFractionMass= new G4UIcmdWithADouble("/changeFoil/designedMaterial/naturalElementFractionMass",this);
|
||||
fFoilMaterialNaturalElementFractionMass->SetGuidance("Add the fraction mass of the natural element");
|
||||
fFoilMaterialNaturalElementFractionMass->SetParameterName("foilNaturalElementFractionMass",false);
|
||||
fFoilMaterialNaturalElementFractionMass->AvailableForStates(G4State_Idle);
|
||||
|
||||
|
||||
fUpdateFoilMaterial = new G4UIcmdWithoutParameter("/changeFoil/designedMaterial/update",this);
|
||||
fUpdateFoilMaterial->SetGuidance("Update the material once its components are defined");
|
||||
fUpdateFoilMaterial->AvailableForStates(G4State_Idle);
|
||||
|
||||
//Change foil material using physics NIST
|
||||
|
||||
fChangeFoilMaterialCmd = new G4UIcmdWithAString("/changeFoil/materialNist", this);
|
||||
fChangeFoilMaterialCmd -> SetGuidance("Change the material of your foil using the NIST database."
|
||||
"\nTo get the list of the available NIST materials, please select 'TargetMaterial->NistMaterialList'."
|
||||
"\nExample of a NIST material : 'G4_Ni'.");
|
||||
fChangeFoilMaterialCmd -> SetParameterName("FoilMaterial",false);
|
||||
|
||||
}
|
||||
|
||||
STCyclotronDetectorMessenger::~STCyclotronDetectorMessenger()
|
||||
{
|
||||
delete fChangeTarget;
|
||||
delete fChangeTargetDiameterCmd;
|
||||
delete fChangeTargetMaterial;
|
||||
delete fTargetIsotopeName;
|
||||
delete fTargetIsotopeZ ;
|
||||
delete fTargetIsotopeN;
|
||||
delete fTargetIsotopeA;
|
||||
delete fTargetElementName;
|
||||
delete fTargetElementSymbole;
|
||||
delete fTargetElementNComponents;
|
||||
delete fTargetElementAbundance ;
|
||||
delete fChangeTargetMaterialDensityCmd ;
|
||||
delete fTargetMaterialNComponents;
|
||||
delete fTargetMaterialFractionMass;
|
||||
delete fTargetMaterialNaturalElement;
|
||||
delete fTargetMaterialNaturalElementFractionMass;
|
||||
delete fUpdateMaterial;
|
||||
delete fChangeTargetMaterialCmd;
|
||||
delete fChangeFoilMaterial;
|
||||
delete fFoilIsotopeName;
|
||||
delete fFoilIsotopeZ ;
|
||||
delete fFoilIsotopeN;
|
||||
delete fFoilIsotopeA;
|
||||
delete fFoilElementName;
|
||||
delete fFoilElementSymbole;
|
||||
delete fFoilElementNComponents;
|
||||
delete fFoilElementAbundance ;
|
||||
delete fChangeFoilMaterialDensityCmd ;
|
||||
delete fFoilMaterialNComponents;
|
||||
delete fFoilMaterialFractionMass;
|
||||
delete fFoilMaterialNaturalElement;
|
||||
delete fFoilMaterialNaturalElementFractionMass;
|
||||
delete fUpdateFoilMaterial;
|
||||
delete fChangeFoilMaterialCmd;
|
||||
delete fChangeTargetThicknessCmd;
|
||||
delete fChangeFoil;
|
||||
delete fChangeFoilThicknessCmd;
|
||||
|
||||
}
|
||||
|
||||
void STCyclotronDetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
|
||||
{
|
||||
//TARGET
|
||||
//DIAMETER
|
||||
if( command == fChangeTargetDiameterCmd)
|
||||
{
|
||||
G4double updatedValue = fChangeTargetDiameterCmd -> GetNewDoubleValue(newValue);
|
||||
fDet -> SetTargetDiameter(updatedValue);
|
||||
}
|
||||
|
||||
//MATERIAL
|
||||
else if(command == fTargetIsotopeName)
|
||||
{
|
||||
fDet -> SetTargetIsotopeName(newValue);
|
||||
}
|
||||
|
||||
else if(command == fTargetIsotopeZ)
|
||||
{
|
||||
fDet -> SetTargetIsotopeZ(fTargetIsotopeZ->GetNewDoubleValue(newValue));
|
||||
}
|
||||
|
||||
else if(command == fTargetIsotopeN)
|
||||
{
|
||||
fDet -> SetTargetIsotopeN(fTargetIsotopeN->GetNewIntValue(newValue));
|
||||
}
|
||||
|
||||
else if(command == fTargetIsotopeA)
|
||||
{
|
||||
fDet -> SetTargetIsotopeA(fTargetIsotopeA->GetNewDoubleValue(newValue));
|
||||
}
|
||||
|
||||
else if(command == fTargetElementName)
|
||||
{
|
||||
fDet -> SetTargetElementName(newValue);
|
||||
}
|
||||
|
||||
else if(command == fTargetElementSymbole)
|
||||
{
|
||||
fDet -> SetTargetElementSymbole(newValue);
|
||||
}
|
||||
|
||||
else if(command == fTargetElementNComponents)
|
||||
{
|
||||
fDet -> SetTargetElementNComponents(fTargetElementNComponents->GetNewIntValue(newValue));
|
||||
}
|
||||
|
||||
else if(command == fTargetElementAbundance)
|
||||
{
|
||||
fDet -> SetTargetElementAbundance(fTargetElementAbundance->GetNewDoubleValue(newValue));
|
||||
}
|
||||
|
||||
|
||||
else if (command == fChangeTargetMaterialDensityCmd )
|
||||
{
|
||||
G4double updatedValue = fChangeTargetMaterialDensityCmd -> GetNewDoubleValue(newValue);
|
||||
fDet -> SetTargetMaterialDensity(updatedValue);
|
||||
}
|
||||
|
||||
else if(command == fTargetMaterialNComponents)
|
||||
{
|
||||
fDet -> SetTargetMaterialNComponents(fTargetMaterialNComponents->GetNewIntValue(newValue));
|
||||
}
|
||||
|
||||
else if(command == fTargetMaterialFractionMass)
|
||||
{
|
||||
fDet -> SetTargetMaterialFractionMass(fTargetMaterialFractionMass->GetNewDoubleValue(newValue));
|
||||
}
|
||||
|
||||
else if(command == fUpdateMaterial)
|
||||
{
|
||||
fDet -> UpdateMaterial();
|
||||
}
|
||||
|
||||
//NATURAL ELEMENT
|
||||
else if(command == fTargetMaterialNaturalElement)
|
||||
{
|
||||
fDet ->SetTargetNaturalElement(newValue);
|
||||
}
|
||||
|
||||
else if(command == fTargetMaterialNaturalElementFractionMass)
|
||||
{
|
||||
fDet ->SetTargetNaturalMaterialFractionMass(fTargetMaterialNaturalElementFractionMass->GetNewDoubleValue(newValue));
|
||||
}
|
||||
|
||||
|
||||
//NATURAL MATERIAL
|
||||
|
||||
else if (command == fChangeTargetMaterialCmd )
|
||||
{
|
||||
fDet -> SetTargetMaterial(newValue);
|
||||
}
|
||||
|
||||
//THICKNESS
|
||||
|
||||
else if (command == fChangeTargetThicknessCmd )
|
||||
{
|
||||
G4double updatedValue = fChangeTargetThicknessCmd -> GetNewDoubleValue(newValue);
|
||||
fDet -> SetTargetThickness(updatedValue);
|
||||
}
|
||||
|
||||
//FOIL
|
||||
|
||||
else if (command == fChangeFoilThicknessCmd )
|
||||
{
|
||||
G4double updatedValue = fChangeFoilThicknessCmd -> GetNewDoubleValue(newValue);
|
||||
fDet -> SetFoilThickness(updatedValue);
|
||||
}
|
||||
|
||||
//MATERIAL FOIL
|
||||
else if(command == fFoilIsotopeName)
|
||||
{
|
||||
fDet -> SetFoilIsotopeName(newValue);
|
||||
}
|
||||
|
||||
else if(command == fFoilIsotopeZ)
|
||||
{
|
||||
fDet -> SetFoilIsotopeZ(fFoilIsotopeZ->GetNewDoubleValue(newValue));
|
||||
}
|
||||
|
||||
else if(command == fFoilIsotopeN)
|
||||
{
|
||||
fDet -> SetFoilIsotopeN(fFoilIsotopeN->GetNewIntValue(newValue));
|
||||
}
|
||||
|
||||
else if(command == fFoilIsotopeA)
|
||||
{
|
||||
fDet -> SetFoilIsotopeA(fFoilIsotopeA->GetNewDoubleValue(newValue));
|
||||
}
|
||||
|
||||
else if(command == fFoilElementName)
|
||||
{
|
||||
fDet -> SetFoilElementName(newValue);
|
||||
}
|
||||
|
||||
else if(command == fFoilElementSymbole)
|
||||
{
|
||||
fDet -> SetFoilElementSymbole(newValue);
|
||||
}
|
||||
|
||||
else if(command == fFoilElementNComponents)
|
||||
{
|
||||
fDet -> SetFoilElementNComponents(fFoilElementNComponents->GetNewIntValue(newValue));
|
||||
}
|
||||
|
||||
else if(command == fFoilElementAbundance)
|
||||
{
|
||||
fDet -> SetFoilElementAbundance(fFoilElementAbundance->GetNewDoubleValue(newValue));
|
||||
}
|
||||
|
||||
|
||||
else if (command == fChangeFoilMaterialDensityCmd )
|
||||
{
|
||||
G4double updatedValue = fChangeFoilMaterialDensityCmd -> GetNewDoubleValue(newValue);
|
||||
fDet -> SetFoilMaterialDensity(updatedValue);
|
||||
}
|
||||
|
||||
else if(command == fFoilMaterialNComponents)
|
||||
{
|
||||
fDet -> SetFoilMaterialNComponents(fFoilMaterialNComponents->GetNewIntValue(newValue));
|
||||
}
|
||||
|
||||
else if(command == fFoilMaterialFractionMass)
|
||||
{
|
||||
fDet -> SetFoilMaterialFractionMass(fFoilMaterialFractionMass->GetNewDoubleValue(newValue));
|
||||
}
|
||||
|
||||
else if(command == fUpdateFoilMaterial)
|
||||
{
|
||||
fDet -> UpdateFoilMaterial();
|
||||
}
|
||||
|
||||
//NATURAL ELEMENT
|
||||
else if(command == fFoilMaterialNaturalElement)
|
||||
{
|
||||
fDet ->SetFoilNaturalElement(newValue);
|
||||
}
|
||||
|
||||
else if(command == fFoilMaterialNaturalElementFractionMass)
|
||||
{
|
||||
fDet ->SetFoilNaturalMaterialFractionMass(fFoilMaterialNaturalElementFractionMass->GetNewDoubleValue(newValue));
|
||||
}
|
||||
|
||||
//NATURAL MATERIAL
|
||||
else if (command == fChangeFoilMaterialCmd )
|
||||
{
|
||||
fDet -> SetFoilMaterial(newValue);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// Author: F. Poignant, floriane.poignant@gmail.com
|
||||
//
|
||||
// file STyclotronPrimaryGeneratorAction.cc
|
||||
|
||||
#include "STCyclotronPrimaryGeneratorAction.hh"
|
||||
#include "STCyclotronRun.hh"
|
||||
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4Event.hh"
|
||||
#include "G4GeneralParticleSource.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "STCyclotronPrimaryGeneratorActionMessenger.hh"
|
||||
|
||||
STCyclotronPrimaryGeneratorAction::STCyclotronPrimaryGeneratorAction()
|
||||
: G4VUserPrimaryGeneratorAction()
|
||||
{
|
||||
fMessenger = new STCyclotronPrimaryGeneratorActionMessenger(this);
|
||||
fParticleBeam = new G4GeneralParticleSource();
|
||||
fBeamCurrent = 10.E-6 ; //ampere;
|
||||
//The rest of the parameters (type of particle, energy, beam shape ..) are defined in the init_beam.vis class.
|
||||
}
|
||||
|
||||
STCyclotronPrimaryGeneratorAction::~STCyclotronPrimaryGeneratorAction()
|
||||
{
|
||||
delete fMessenger;
|
||||
delete fParticleBeam;
|
||||
}
|
||||
|
||||
void STCyclotronPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
{
|
||||
//Set up the number of particles per event
|
||||
G4double timePerEvent = 1.E-11 ; //s;
|
||||
G4double chargeParticle = fParticleBeam->GetParticleDefinition()->GetPDGCharge()*1.6E-19;
|
||||
G4double numberOfPart = std::abs(fBeamCurrent*timePerEvent/chargeParticle);
|
||||
G4String name = fParticleBeam->GetParticleDefinition()->GetParticleName();
|
||||
G4double energy = fParticleBeam->GetParticleEnergy();
|
||||
|
||||
G4int fPrimariesPerEvent = (G4int)numberOfPart;
|
||||
|
||||
if(fPrimariesPerEvent < 1){
|
||||
G4cout << "Warning: number of particles per event below 0: " << numberOfPart << G4endl;
|
||||
return;
|
||||
}
|
||||
|
||||
fParticleBeam->SetNumberOfParticles(fPrimariesPerEvent);
|
||||
fParticleBeam->GeneratePrimaryVertex(anEvent);
|
||||
|
||||
STCyclotronRun* fRun = static_cast<STCyclotronRun*>(G4RunManager::GetRunManager()->GetNonConstCurrentRun());
|
||||
fRun->SetPrimariesPerEvent(fPrimariesPerEvent);
|
||||
fRun->SetTimePerEvent(timePerEvent);
|
||||
|
||||
fRun->SetBeamName(name);
|
||||
fRun->SetBeamCurrent(fBeamCurrent);
|
||||
fRun->SetBeamEnergy(energy);
|
||||
|
||||
//G4cout << "The new beam current is the following : " << fBeamCurrent << " Ampere." << G4endl;
|
||||
//G4cout << "Particles per event : " << numberOfParticlePerEvent << " particles." << G4endl;
|
||||
|
||||
}
|
||||
|
||||
void STCyclotronPrimaryGeneratorAction::SetBeamCurrent(G4double current)
|
||||
{
|
||||
if(fBeamCurrent!=current){
|
||||
fBeamCurrent=current;
|
||||
G4cout << "The new beam current is the following : " << fBeamCurrent << " Ampere." << G4endl;
|
||||
}
|
||||
}
|
||||
+268
@@ -0,0 +1,268 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// Author: F. Poignant, floriane.poignant@gmail.com
|
||||
//
|
||||
|
||||
#include "STCyclotronPhysicsList.hh"
|
||||
#include "G4Proton.hh"
|
||||
#include "G4Neutron.hh"
|
||||
#include "G4Electron.hh"
|
||||
#include "G4Positron.hh"
|
||||
#include "G4Gamma.hh"
|
||||
#include "G4Deuteron.hh"
|
||||
|
||||
//Physic Lists (contained inside the Geant 4 distribution)
|
||||
#include "G4EmStandardPhysics_option3.hh"
|
||||
#include "G4DecayPhysics.hh"
|
||||
#include "G4Decay.hh"
|
||||
#include "G4StepLimiter.hh"
|
||||
#include "G4LossTableManager.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4ProcessManager.hh"
|
||||
#include "G4Region.hh"
|
||||
#include "G4RegionStore.hh"
|
||||
|
||||
#include "G4EmExtraPhysics.hh"
|
||||
#include "G4EmParameters.hh"
|
||||
#include "G4NuclideTable.hh"
|
||||
|
||||
#include "G4HadronPhysicsQGSP_BERT.hh"
|
||||
#include "G4HadronPhysicsQGSP_BIC.hh"
|
||||
#include "G4HadronPhysicsQGSP_BIC_HP.hh"
|
||||
#include "G4HadronPhysicsQGSP_BIC_AllHP.hh"
|
||||
#include "G4RadioactiveDecayPhysics.hh"
|
||||
//#include "QGSP_BIC_HP.hh"
|
||||
#include "G4PhysListFactory.hh"
|
||||
#include "G4DeexPrecoParameters.hh"
|
||||
#include "G4NuclideTable.hh"
|
||||
|
||||
STCyclotronPhysicsList::STCyclotronPhysicsList(STCyclotronDetectorConstruction* det)
|
||||
: G4VModularPhysicsList(){
|
||||
|
||||
//add new units for radioActive decays
|
||||
|
||||
new G4UnitDefinition( "millielectronVolt", "meV", "Energy", 1.e-3*eV);
|
||||
const G4double minute = 60*second;
|
||||
const G4double hour = 60*minute;
|
||||
const G4double day = 24*hour;
|
||||
const G4double year = 365*day;
|
||||
new G4UnitDefinition("minute", "min", "Time", minute);
|
||||
new G4UnitDefinition("hour", "h", "Time", hour);
|
||||
new G4UnitDefinition("day", "d", "Time", day);
|
||||
new G4UnitDefinition("year", "y", "Time", year);
|
||||
|
||||
// Mandatory for G4NuclideTable
|
||||
// Half-life threshold must be set small or many short-lived isomers
|
||||
// will not be assigned life times (default to 0)
|
||||
G4NuclideTable::GetInstance()->SetThresholdOfHalfLife(0.1*second);
|
||||
G4NuclideTable::GetInstance()->SetLevelTolerance(1.0*eV);
|
||||
|
||||
//---
|
||||
fDetector = det;
|
||||
|
||||
G4LossTableManager::Instance();
|
||||
|
||||
defaultCutValue = 0.1*mm;
|
||||
fCutForGamma = defaultCutValue;
|
||||
fCutForElectron = defaultCutValue;
|
||||
fCutForPositron = defaultCutValue;
|
||||
|
||||
fThickness_foil = defaultCutValue;
|
||||
fThickness_target = defaultCutValue;
|
||||
|
||||
fCutTargetProton = fThickness_target;
|
||||
fCutTargetElectron = fThickness_target;
|
||||
fCutTargetPositron = fThickness_target;
|
||||
fCutTargetGamma = fThickness_target;
|
||||
fCutTargetNeutron = fThickness_target;
|
||||
|
||||
fCutFoilProton = fThickness_foil;
|
||||
fCutFoilElectron = fThickness_foil;
|
||||
fCutFoilPositron = fThickness_foil;
|
||||
fCutFoilGamma = fThickness_foil;
|
||||
fCutFoilNeutron = fThickness_foil;
|
||||
|
||||
//EM physics
|
||||
fEmPhysicsList = new G4EmStandardPhysics_option3(0);
|
||||
fEmName = G4String("emstandard_opt3");
|
||||
|
||||
//Decay physics and all particles
|
||||
fDecPhysicsList = new G4DecayPhysics(0);
|
||||
fRaddecayList = new G4RadioactiveDecayPhysics(0);
|
||||
|
||||
//Hadron physics
|
||||
fHadPhysicsList = new G4HadronPhysicsQGSP_BIC_AllHP(0);
|
||||
//fHadPhysicsList = new G4HadronPhysicsQGSP_BIC(0);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
STCyclotronPhysicsList::~STCyclotronPhysicsList()
|
||||
{
|
||||
|
||||
delete fEmPhysicsList ;
|
||||
delete fDecPhysicsList;
|
||||
delete fRaddecayList;
|
||||
delete fHadPhysicsList;
|
||||
|
||||
|
||||
}
|
||||
|
||||
void STCyclotronPhysicsList::ConstructParticle()
|
||||
{
|
||||
|
||||
G4Proton::ProtonDefinition();
|
||||
G4Gamma::GammaDefinition();
|
||||
G4Electron::ElectronDefinition();
|
||||
G4Positron::PositronDefinition();
|
||||
G4Neutron::NeutronDefinition();
|
||||
G4Deuteron::DeuteronDefinition();
|
||||
|
||||
fDecPhysicsList->ConstructParticle();
|
||||
|
||||
|
||||
}
|
||||
|
||||
void STCyclotronPhysicsList::ConstructProcess()
|
||||
{
|
||||
// Define transportation process
|
||||
|
||||
|
||||
AddTransportation();
|
||||
|
||||
//electromagnetic physics list
|
||||
fEmPhysicsList->ConstructProcess();
|
||||
//em_config.AddModels();
|
||||
|
||||
//decay physics list
|
||||
fDecPhysicsList->ConstructProcess();
|
||||
fRaddecayList->ConstructProcess();
|
||||
|
||||
//hadronic physics lists
|
||||
fHadPhysicsList->ConstructProcess();
|
||||
|
||||
//Get the value of the fThickness of foil and target
|
||||
fThickness_foil = fDetector->GetFoilThickness()*mm;
|
||||
fThickness_target = fDetector->GetTargetThickness()*mm;
|
||||
|
||||
//Update the cuts with the 1/2 of the thickness of the foil/target
|
||||
//SetCuts();
|
||||
|
||||
SetCutTarget(0.01,fThickness_target/2.,fThickness_target/2.,fThickness_target/2.,fThickness_target/2.);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
void STCyclotronPhysicsList::SetCuts()
|
||||
{
|
||||
|
||||
if (verboseLevel >0){
|
||||
G4cout << "PhysicsList::SetCuts:";
|
||||
G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl;
|
||||
}
|
||||
|
||||
// set cut values for gamma at first and for e- second and next for e+,
|
||||
// because some processes for e+/e- need cut values for gamma
|
||||
SetCutValue(fCutForGamma, "gamma");
|
||||
SetCutValue(fCutForElectron, "e-");
|
||||
SetCutValue(fCutForPositron, "e+");
|
||||
|
||||
// Set cuts for detector
|
||||
SetCutFoil(0.1,fThickness_foil/2.,fThickness_foil/2.,fThickness_foil/2.,fThickness_foil/2.);
|
||||
SetCutTarget(0.01,fThickness_target/2.,fThickness_target/2.,fThickness_target/2.,fThickness_target/2.);
|
||||
if (verboseLevel>0) DumpCutValuesTable();
|
||||
}
|
||||
|
||||
void STCyclotronPhysicsList::SetCutForGamma(G4double cut)
|
||||
{
|
||||
fCutForGamma = cut;
|
||||
SetParticleCuts(fCutForGamma, G4Gamma::Gamma());
|
||||
}
|
||||
|
||||
void STCyclotronPhysicsList::SetCutForElectron(G4double cut)
|
||||
{
|
||||
fCutForElectron = cut;
|
||||
SetParticleCuts(fCutForElectron, G4Electron::Electron());
|
||||
}
|
||||
|
||||
void STCyclotronPhysicsList::SetCutForPositron(G4double cut)
|
||||
{
|
||||
fCutForPositron = cut;
|
||||
SetParticleCuts(fCutForPositron, G4Positron::Positron());
|
||||
}
|
||||
|
||||
void STCyclotronPhysicsList::SetCutTarget(G4double cutProton, G4double cutElectron, G4double cutPositron, G4double cutGamma, G4double cutNeutron){
|
||||
|
||||
fCutTargetProton = cutProton*mm;
|
||||
fCutTargetElectron = cutElectron*mm;
|
||||
fCutTargetPositron = cutPositron*mm;
|
||||
fCutTargetGamma = cutGamma*mm;
|
||||
fCutTargetNeutron = cutNeutron*mm;
|
||||
|
||||
G4String regionNameTarget = "Target";
|
||||
G4Region* regionTarget = G4RegionStore::GetInstance()->GetRegion(regionNameTarget);
|
||||
|
||||
G4ProductionCuts* cutsTarget = new G4ProductionCuts ;
|
||||
cutsTarget -> SetProductionCut(fCutTargetGamma,G4ProductionCuts::GetIndex("gamma"));
|
||||
cutsTarget -> SetProductionCut(fCutTargetElectron,G4ProductionCuts::GetIndex("e-"));
|
||||
cutsTarget -> SetProductionCut(fCutTargetPositron,G4ProductionCuts::GetIndex("e+"));
|
||||
cutsTarget -> SetProductionCut(fCutTargetProton,G4ProductionCuts::GetIndex("proton"));
|
||||
cutsTarget->SetProductionCut(fCutTargetProton, G4ProductionCuts::GetIndex("deuteron"));
|
||||
cutsTarget -> SetProductionCut(fCutTargetNeutron,G4ProductionCuts::GetIndex("neutron"));
|
||||
|
||||
regionTarget -> SetProductionCuts(cutsTarget);
|
||||
|
||||
}
|
||||
|
||||
void STCyclotronPhysicsList::SetCutFoil(G4double cutProton, G4double cutElectron, G4double cutPositron, G4double cutGamma, G4double cutNeutron){
|
||||
|
||||
fCutFoilProton = cutProton*mm;
|
||||
fCutFoilElectron = cutElectron*mm;
|
||||
fCutFoilPositron = cutPositron*mm;
|
||||
fCutFoilGamma = cutGamma*mm;
|
||||
fCutFoilNeutron = cutNeutron*mm;
|
||||
|
||||
G4RegionStore::GetInstance()->GetRegion("Foil");
|
||||
G4String regionNameFoil = "Foil";
|
||||
G4Region* regionFoil = G4RegionStore::GetInstance()->GetRegion(regionNameFoil);
|
||||
|
||||
G4ProductionCuts* cutsFoil = new G4ProductionCuts ;
|
||||
cutsFoil -> SetProductionCut(fCutFoilGamma,G4ProductionCuts::GetIndex("gamma"));
|
||||
cutsFoil -> SetProductionCut(fCutFoilElectron,G4ProductionCuts::GetIndex("e-"));
|
||||
cutsFoil -> SetProductionCut(fCutFoilPositron,G4ProductionCuts::GetIndex("e+"));
|
||||
cutsFoil -> SetProductionCut(fCutFoilProton,G4ProductionCuts::GetIndex("proton"));
|
||||
cutsFoil->SetProductionCut(fCutFoilProton, G4ProductionCuts::GetIndex("deuteron"));
|
||||
cutsFoil -> SetProductionCut(fCutFoilNeutron,G4ProductionCuts::GetIndex("neutron"));
|
||||
|
||||
regionFoil -> SetProductionCuts(cutsFoil);
|
||||
|
||||
}
|
||||
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// Author: F. Poignant, floriane.poignant@gmail.com
|
||||
//
|
||||
|
||||
#include "STCyclotronPrimaryGeneratorActionMessenger.hh"
|
||||
#include "STCyclotronPrimaryGeneratorAction.hh"
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcmdWithADouble.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
|
||||
STCyclotronPrimaryGeneratorActionMessenger::STCyclotronPrimaryGeneratorActionMessenger(STCyclotronPrimaryGeneratorAction* primary)
|
||||
:fG4Primary(primary)
|
||||
{
|
||||
// Change beam current
|
||||
fBeamCurrent = new G4UIdirectory("/setBeamCurrent/");
|
||||
fBeamCurrent -> SetGuidance("Change the beam current of the cyclotron");
|
||||
|
||||
fChangeBeamCurrentCmd = new G4UIcmdWithADouble("/setBeamCurrent/beamCurrent", this);
|
||||
fChangeBeamCurrentCmd -> SetGuidance("Change the value of the current (in ampere)."
|
||||
"\nThe default value is 30E-6 ampere.");
|
||||
fChangeBeamCurrentCmd -> SetParameterName("BeamCurrent", true);
|
||||
fChangeBeamCurrentCmd -> SetRange("BeamCurrent > 0.");
|
||||
fChangeBeamCurrentCmd -> SetDefaultValue(30.E-6);
|
||||
fChangeBeamCurrentCmd -> AvailableForStates(G4State_Idle);
|
||||
|
||||
}
|
||||
|
||||
STCyclotronPrimaryGeneratorActionMessenger::~STCyclotronPrimaryGeneratorActionMessenger()
|
||||
{
|
||||
delete fBeamCurrent;
|
||||
delete fChangeBeamCurrentCmd;
|
||||
|
||||
}
|
||||
|
||||
void STCyclotronPrimaryGeneratorActionMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
|
||||
{
|
||||
|
||||
if( command == fChangeBeamCurrentCmd)
|
||||
{
|
||||
G4double updatedValue = fChangeBeamCurrentCmd -> GetNewDoubleValue(newValue);
|
||||
fG4Primary -> SetBeamCurrent(updatedValue);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,582 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// Author: F. Poignant, floriane.poignant@gmail.com
|
||||
//
|
||||
// file STCyclotronRun.cc
|
||||
|
||||
#include "STCyclotronRun.hh"
|
||||
#include "STCyclotronAnalysis.hh"
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4Event.hh"
|
||||
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4HCofThisEvent.hh"
|
||||
#include "G4THitsMap.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
STCyclotronRun::STCyclotronRun()
|
||||
: G4Run(),fTotalEnergyDepositTarget(0.),fTotalEnergyDepositFoil(0.),fParticleTarget(0),fTargetThickness(0.),fTargetDiameter(0.),fFoilThickness(0.),fTargetVolume(0.),fFoilVolume(0.),fPrimariesPerEvent(0),fTimePerEvent(0),fBeamName(""),fBeamCurrent(0.),fBeamEnergy(0.)
|
||||
{ }
|
||||
|
||||
STCyclotronRun::~STCyclotronRun()
|
||||
{ }
|
||||
|
||||
void STCyclotronRun::Merge(const G4Run* aRun)
|
||||
{
|
||||
|
||||
const STCyclotronRun* localRun = static_cast<const STCyclotronRun*>(aRun);
|
||||
|
||||
//Merging cumulable variables
|
||||
fTotalEnergyDepositTarget += localRun->fTotalEnergyDepositTarget;
|
||||
fTotalEnergyDepositFoil += localRun->fTotalEnergyDepositFoil;
|
||||
fParticleTarget += localRun->fParticleTarget;
|
||||
|
||||
//Constant over the different runs
|
||||
if(localRun->fTargetVolume!=0)fTargetVolume = localRun->fTargetVolume;
|
||||
if(localRun->fFoilVolume!=0)fFoilVolume = localRun->fFoilVolume;
|
||||
if(localRun->fPrimariesPerEvent!=0)fPrimariesPerEvent = localRun->fPrimariesPerEvent;
|
||||
if(localRun->fTimePerEvent!=0)fTimePerEvent = localRun->fTimePerEvent;
|
||||
if(localRun->fTargetThickness!=0)fTargetThickness = localRun->fTargetThickness;
|
||||
if(localRun->fTargetDiameter!=0)fTargetDiameter = localRun->fTargetDiameter;
|
||||
if(localRun->fFoilThickness!=0)fFoilThickness = localRun->fFoilThickness;
|
||||
fBeamName = localRun->fBeamName;
|
||||
if(localRun->fBeamCurrent!=0.)fBeamCurrent = localRun->fBeamCurrent;
|
||||
if(localRun->fBeamEnergy!=0.)fBeamEnergy = localRun->fBeamEnergy;
|
||||
|
||||
|
||||
|
||||
//<<<----toMerge
|
||||
std::map<G4String,G4int>::iterator itSI;
|
||||
std::map<G4String,G4double>::iterator itSD;
|
||||
std::map<G4String,G4String>::iterator itSS;
|
||||
std::map<G4int,G4String>::iterator itIS;
|
||||
|
||||
//----Merging results for primary isotopes
|
||||
std::map<G4String,G4int> locPrimaryIsotopeCountTarget = localRun->fPrimaryIsotopeCountTarget;
|
||||
for (itSI = locPrimaryIsotopeCountTarget.begin(); itSI != locPrimaryIsotopeCountTarget.end(); itSI++)
|
||||
{
|
||||
G4String name = itSI->first;
|
||||
G4int count = itSI->second;
|
||||
fPrimaryIsotopeCountTarget[name] += count;
|
||||
}
|
||||
|
||||
std::map<G4String,G4double> locPrimaryIsotopeTimeTarget = localRun->fPrimaryIsotopeTimeTarget;
|
||||
for (itSD = locPrimaryIsotopeTimeTarget.begin(); itSD != locPrimaryIsotopeTimeTarget.end(); itSD++)
|
||||
{
|
||||
G4String name = itSD->first;
|
||||
G4double time = itSD->second;
|
||||
fPrimaryIsotopeTimeTarget[name] = time;
|
||||
}
|
||||
|
||||
//----Merging results for decay isotopes
|
||||
// std::map<G4int,G4String> fIsotopeIDTarget;
|
||||
std::map<G4String,G4String> locDecayIsotopeCountTarget = localRun->fDecayIsotopeCountTarget;
|
||||
for (itSS = locDecayIsotopeCountTarget.begin(); itSS != locDecayIsotopeCountTarget.end(); itSS++)
|
||||
{
|
||||
G4String nameDaughter = itSS->first;
|
||||
G4String mum = itSS->second;
|
||||
fDecayIsotopeCountTarget[nameDaughter] = mum;
|
||||
}
|
||||
std::map<G4String,G4double> locDecayIsotopeTimeTarget = localRun->fDecayIsotopeTimeTarget;
|
||||
for (itSD = locDecayIsotopeTimeTarget.begin(); itSD != locDecayIsotopeTimeTarget.end(); itSD++)
|
||||
{
|
||||
G4String nameDaughter = itSD->first;
|
||||
G4double time = itSD->second;
|
||||
fDecayIsotopeTimeTarget[nameDaughter] = time;
|
||||
}
|
||||
std::map<G4String,G4String> locParticleParent = localRun->fParticleParent;
|
||||
for (itSS = locParticleParent.begin(); itSS != locParticleParent.end(); itSS++)
|
||||
{
|
||||
G4String nameDaughter = itSS->first;
|
||||
G4String parent = itSS->second;
|
||||
fParticleParent[nameDaughter] = parent;
|
||||
}
|
||||
std::map<G4int,G4String> locIsotopeIDTarget = localRun->fIsotopeIDTarget;
|
||||
for (itIS = locIsotopeIDTarget.begin(); itIS != locIsotopeIDTarget.end(); itIS++)
|
||||
{
|
||||
G4int ID = itIS->first;
|
||||
G4String name = itIS->second;
|
||||
fIsotopeIDTarget[ID] = name;
|
||||
}
|
||||
|
||||
|
||||
//----Merging results for stable isotopes
|
||||
std::map<G4String,G4int> locStableIsotopeCountTarget = localRun->fStableIsotopeCountTarget;
|
||||
for (itSI = locStableIsotopeCountTarget.begin(); itSI != locStableIsotopeCountTarget.end(); itSI++)
|
||||
{
|
||||
G4String name = itSI->first;
|
||||
G4int count = itSI->second;
|
||||
fStableIsotopeCountTarget[name] += count;
|
||||
}
|
||||
|
||||
//----Merging results for particles
|
||||
std::map<G4String,G4int> locParticleCountTarget = localRun->fParticleCountTarget;
|
||||
for (itSI = locParticleCountTarget.begin(); itSI != locParticleCountTarget.end(); itSI++)
|
||||
{
|
||||
G4String name = itSI->first;
|
||||
G4int count = itSI->second;
|
||||
fParticleCountTarget[name] += count;
|
||||
}
|
||||
|
||||
|
||||
G4Run::Merge(aRun);
|
||||
|
||||
}
|
||||
|
||||
void STCyclotronRun::EndOfRun(G4double irradiationTime)
|
||||
{
|
||||
|
||||
G4int nbEvents = GetNumberOfEvent();
|
||||
|
||||
if (nbEvents == 0) return;
|
||||
|
||||
//------------------------------------------------------
|
||||
// Opening the ASCII file
|
||||
//------------------------------------------------------
|
||||
fOutPut.open("Output_General.txt",std::ofstream::out);
|
||||
fOutPut1.open("Output_ParentIsotopes.txt",std::ofstream::out);
|
||||
fOutPut2.open("Output_DaughterIsotopes.txt",std::ofstream::out);
|
||||
fOutPut3.open("Output_OtherParticles.txt",std::ofstream::out);
|
||||
fOutPut4.open("Output_StableIsotopes.txt",std::ofstream::out);
|
||||
|
||||
//------------------------------------------------------
|
||||
// Calculates the equivalent time for a given run
|
||||
//------------------------------------------------------
|
||||
G4double timePerEvent = fTimePerEvent; //in seconds
|
||||
G4double timeForARun = nbEvents*timePerEvent; //in seconds
|
||||
G4double minDecay = 0.0001; //in seconds
|
||||
G4double maxDecay = 1000000.; //in seconds
|
||||
|
||||
//------------------------------------------------------
|
||||
// Rescale the value of the beam current to account for
|
||||
// the loss of primary particles due to the foil.
|
||||
//------------------------------------------------------
|
||||
|
||||
G4int totalPrimaries = fPrimariesPerEvent*nbEvents;
|
||||
G4double currentFactor;
|
||||
if(fParticleTarget>0.) currentFactor =(fParticleTarget*1.)/(totalPrimaries*1.);
|
||||
else currentFactor = 0.;
|
||||
|
||||
|
||||
fOutPut << "//-----------------------------------//" << G4endl;
|
||||
fOutPut << "// Parameters of the simulation: //" << G4endl;
|
||||
fOutPut << "//-----------------------------------//" << G4endl;
|
||||
fOutPut << "Beam parameters: " << G4endl;
|
||||
fOutPut << fBeamName << " - Name of beam primary particles." << G4endl;
|
||||
fOutPut << fBeamEnergy << " - Energy of beam primary particles (MeV)." << G4endl;
|
||||
fOutPut << fBeamCurrent << " - Beam current (Ampere)." << G4endl;
|
||||
fOutPut << irradiationTime << " - Irradiation time in hour(s)." << G4endl;
|
||||
fOutPut << currentFactor << " - Current factor." << G4endl;
|
||||
fOutPut << "//-----------------------------------//" << G4endl;
|
||||
fOutPut << "Simulation parameters: " << G4endl;
|
||||
fOutPut << timePerEvent << " - Equivalent time per event (s)." << G4endl;
|
||||
fOutPut << nbEvents << " - Number of events" << G4endl;
|
||||
fOutPut << fPrimariesPerEvent << " - Primaries per event" << G4endl;
|
||||
fOutPut << fPrimariesPerEvent*nbEvents << " - Total number of particles sent." << G4endl;
|
||||
fOutPut << "//-----------------------------------//" << G4endl;
|
||||
fOutPut << "Geometry parameters: " << G4endl;
|
||||
fOutPut << fTargetThickness << " - target thickness (mm)." << G4endl;
|
||||
fOutPut << fTargetDiameter << " - target diameter (mm)." << G4endl;
|
||||
fOutPut << fFoilThickness << " - foil thickness (mm)." << G4endl;
|
||||
//Add particle type, particle energy, beam diameter, beam current
|
||||
|
||||
//target material???
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//////////Calculation of the number of isotopes at the end of the irradiation and the activity generated/////////
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
//Maps to fill
|
||||
std::map<G4String,G4double> fPrimaryIsotopeEOBTarget;
|
||||
std::map<G4String,G4double> fPrimaryActivityTarget;
|
||||
std::map<G4String,G4double> fDecayIsotopeEOBTarget;
|
||||
std::map<G4String,G4double> fDecayActivityTarget;
|
||||
|
||||
|
||||
//----------------------------------------------
|
||||
// CASE 1 : Parent isotopes
|
||||
//----------------------------------------------
|
||||
|
||||
|
||||
std::map<G4String,G4int>::iterator it;
|
||||
G4double primaryActivityTotal = 0.;
|
||||
G4double decayActivityTotal=0.;
|
||||
|
||||
fOutPut1 << "//-----------------------------------//\n"
|
||||
<< "// Data for parent isotopes //\n"
|
||||
<< "//-----------------------------------//\n" << G4endl;
|
||||
|
||||
for (it = fPrimaryIsotopeCountTarget.begin(); it != fPrimaryIsotopeCountTarget.end(); it++)
|
||||
{
|
||||
|
||||
|
||||
G4String name = it->first;
|
||||
G4double count = (it->second)*currentFactor;
|
||||
G4double halfLifeTime = fPrimaryIsotopeTimeTarget[name]*10E-10/3600.*std::log(2.);
|
||||
G4String process = fParticleParent[name];
|
||||
|
||||
//Only store isotopes with a life time between minDecay and maxDecay.
|
||||
G4bool store;
|
||||
if(halfLifeTime > minDecay && halfLifeTime < maxDecay) store = true;
|
||||
else store = false;
|
||||
|
||||
|
||||
//Calculation of the yield (s-1)
|
||||
G4double decayConstant = 1/(fPrimaryIsotopeTimeTarget[name]*10E-10);
|
||||
|
||||
|
||||
//----------------------------------------------
|
||||
// Number of particles per second
|
||||
//----------------------------------------------
|
||||
|
||||
G4double particlesPerSecond = fPrimaryIsotopeCountTarget[name]*currentFactor/timeForARun;
|
||||
|
||||
//----------------------------------------------
|
||||
// Calculation yield EOB
|
||||
//----------------------------------------------
|
||||
|
||||
fPrimaryIsotopeEOBTarget[name] = particlesPerSecond/decayConstant * (1. - std::exp(-irradiationTime*3600*decayConstant));
|
||||
|
||||
//----------------------------------------------
|
||||
// Calculation of the activity
|
||||
// conversion factor Bq to mCi
|
||||
//----------------------------------------------
|
||||
|
||||
G4double conv = 2.7E-8;
|
||||
fPrimaryActivityTarget[name]= fPrimaryIsotopeEOBTarget[name]*decayConstant*conv;
|
||||
|
||||
if(store)
|
||||
{
|
||||
|
||||
//----------------------------------------------
|
||||
// Incrementation for total primary activity
|
||||
//----------------------------------------------
|
||||
|
||||
primaryActivityTotal = primaryActivityTotal + fPrimaryActivityTarget[name];
|
||||
}
|
||||
|
||||
|
||||
//---------------------------//
|
||||
// Printing out results //
|
||||
//---------------------------//
|
||||
|
||||
if(store)
|
||||
{
|
||||
fOutPut1 << name << " - name of parent isotope." << G4endl;
|
||||
fOutPut1 << count/currentFactor << " - number of isotopes created during the simulation." << G4endl;
|
||||
fOutPut1 << decayConstant << " - decay constant in s-1." << G4endl;
|
||||
fOutPut1 << halfLifeTime << " - half life time in hour(s)." << G4endl;
|
||||
fOutPut1 << process << " - creation process." << G4endl;
|
||||
fOutPut1 << particlesPerSecond << " - isotope per sec." << G4endl;
|
||||
fOutPut1 << fPrimaryIsotopeEOBTarget[name] << " - yield EOB." << G4endl;
|
||||
fOutPut1 << fPrimaryActivityTarget[name] << " - activity (mCi) at the EOB." << G4endl;
|
||||
fOutPut1 << "------------------------" << G4endl;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------
|
||||
// CASE 2 : isotopes from primary isotopes decay
|
||||
//----------------------------------------------
|
||||
|
||||
fOutPut2 << "//-----------------------------------//\n"
|
||||
<< "// Data for daughter isotopes //\n"
|
||||
<< "//-----------------------------------//\n" << G4endl;
|
||||
|
||||
std::map<G4String,G4String>::iterator it1;
|
||||
|
||||
for (it1 = fDecayIsotopeCountTarget.begin(); it1 != fDecayIsotopeCountTarget.end(); it1++)
|
||||
{
|
||||
|
||||
|
||||
G4String nameDaughter = it1->first;
|
||||
G4String nameMum = it1->second;
|
||||
|
||||
G4double halfLifeTimeMum = fDecayIsotopeTimeTarget[nameDaughter]*10E10/3600;
|
||||
G4double halfLifeTimeDaughter = fPrimaryIsotopeTimeTarget[nameMum]*10E10/3600;
|
||||
|
||||
G4bool store;
|
||||
if(halfLifeTimeMum > minDecay && halfLifeTimeMum < maxDecay &&
|
||||
halfLifeTimeDaughter > minDecay && halfLifeTimeDaughter < maxDecay){store=true;}
|
||||
else{store=false;}
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------
|
||||
// Calculation of the yield
|
||||
// fParticleTime[name] is the time
|
||||
// life of the particle, divided by ln(2), in nS
|
||||
//----------------------------------------------
|
||||
|
||||
G4double decayConstantMum = 1/(fPrimaryIsotopeTimeTarget[nameMum]*10.E-10);
|
||||
G4double decayConstantDaughter = 1/(fDecayIsotopeTimeTarget[nameDaughter]*10.E-10);
|
||||
|
||||
|
||||
//----------------------------------------------
|
||||
// Number of particles per second
|
||||
//----------------------------------------------
|
||||
|
||||
G4double particlesPerSecond = fPrimaryIsotopeCountTarget[nameMum]*currentFactor/timeForARun;
|
||||
|
||||
//----------------------------------------------
|
||||
// Number of particles at the EOB
|
||||
//----------------------------------------------
|
||||
|
||||
fDecayIsotopeEOBTarget[nameDaughter] = particlesPerSecond*((1 - std::exp(-irradiationTime*3600*decayConstantDaughter))/decayConstantDaughter + (std::exp(-irradiationTime*3600*decayConstantDaughter) - std::exp(-irradiationTime*3600*decayConstantMum))/(decayConstantDaughter-decayConstantMum));
|
||||
|
||||
|
||||
//----------------------------------------------
|
||||
// Calculation of activity
|
||||
// conversion factor Bq to mCu
|
||||
//----------------------------------------------
|
||||
|
||||
G4double conv = 2.7E-8;
|
||||
fDecayActivityTarget[nameDaughter]= fDecayIsotopeEOBTarget[nameDaughter]*decayConstantDaughter*conv;
|
||||
|
||||
if(store)
|
||||
{
|
||||
decayActivityTotal = decayActivityTotal + fDecayActivityTarget[nameDaughter];
|
||||
}
|
||||
|
||||
if(store)
|
||||
{
|
||||
fOutPut2 << nameDaughter << " - name of daughter isotope." << G4endl;
|
||||
fOutPut2 << nameMum << " - name of parent isotope." << G4endl;
|
||||
fOutPut2 << decayConstantDaughter << " - decay constant of daughter in s-1." << G4endl;
|
||||
fOutPut2 << decayConstantMum << " - decay constant of mum in s-1." << G4endl;
|
||||
fOutPut2 << halfLifeTimeDaughter << " - half life time of daughter in hour(s)." << G4endl;
|
||||
fOutPut2 << halfLifeTimeMum << " - half life time of mum in hour(s)." << G4endl;
|
||||
fOutPut2 << particlesPerSecond << " - isotope per sec." << G4endl;
|
||||
fOutPut2 << fDecayIsotopeEOBTarget[nameDaughter] << " - yield at the EOB." << G4endl;
|
||||
fOutPut2 << fDecayActivityTarget[nameDaughter] << " - activity (mCi) at the EOB." << G4endl;
|
||||
fOutPut2 << "------------------------" << G4endl;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//----------------------------------------------
|
||||
// Particles created, other than nuclei
|
||||
//----------------------------------------------
|
||||
|
||||
fOutPut3 << "//-----------------------------------//\n"
|
||||
<< "// Data for other particles //\n"
|
||||
<< "//-----------------------------------//" << G4endl;
|
||||
|
||||
std::map<G4String, G4int>::iterator it3;
|
||||
for(it3=fParticleCountTarget.begin(); it3!= fParticleCountTarget.end(); it3++)
|
||||
{
|
||||
G4String name = it3->first;
|
||||
G4double number = it3->second;
|
||||
fOutPut3 << name << " - name of the particle" << G4endl;
|
||||
fOutPut3 << number << " - number of particles" << G4endl;
|
||||
fOutPut3 << "------------------------" << G4endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
fOutPut4 << "//-----------------------------------//\n"
|
||||
<< "// Data for stable isotopes //\n"
|
||||
<< "//-----------------------------------//\n" << G4endl;
|
||||
|
||||
std::map<G4String, G4int>::iterator it6;
|
||||
for(it6=fStableIsotopeCountTarget.begin();it6!=fStableIsotopeCountTarget.end();it6++)
|
||||
{
|
||||
G4String isotope = it6 ->first;
|
||||
G4int number = it6 -> second;
|
||||
fOutPut4 << isotope << " - name of the isotope" << G4endl;
|
||||
fOutPut4 << number << " - number of isotopes" << G4endl;
|
||||
fOutPut4 << "------------------------" << G4endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Clear the maps
|
||||
fPrimaryIsotopeEOBTarget.clear();
|
||||
fPrimaryActivityTarget.clear();
|
||||
fDecayIsotopeEOBTarget.clear();
|
||||
fDecayActivityTarget.clear();
|
||||
|
||||
|
||||
//Clear the maps
|
||||
fPrimaryIsotopeCountTarget.clear();
|
||||
fPrimaryIsotopeTimeTarget.clear();
|
||||
fDecayIsotopeCountTarget.clear();
|
||||
fDecayIsotopeTimeTarget.clear();
|
||||
fParticleParent.clear();
|
||||
fParticleCountTarget.clear();
|
||||
fStableIsotopeCountTarget.clear();
|
||||
fIsotopeIDTarget.clear();
|
||||
|
||||
|
||||
//-----------------------------
|
||||
// Calculation of heat
|
||||
//-----------------------------
|
||||
|
||||
G4double totalEnergyDepositTargetEOB = fTotalEnergyDepositTarget/timeForARun * irradiationTime * 3600.;
|
||||
G4double totalEnergyDepositTargetPerSecond = fTotalEnergyDepositTarget/timeForARun;
|
||||
//Heat calculation in W/mm3
|
||||
G4double heatTarget = totalEnergyDepositTargetPerSecond/fTargetVolume * 1.60E-13;
|
||||
G4double heatFoil = fTotalEnergyDepositFoil / fFoilVolume * 1.60E-13;
|
||||
|
||||
|
||||
//Output data in a .txt file
|
||||
fOutPut << "//-------------------------------------------------//\n"
|
||||
<< "// Heating, total activity and process data //\n"
|
||||
<< "//-------------------------------------------------//" << G4endl;
|
||||
|
||||
fOutPut << "Total heating in the target : "
|
||||
<< heatTarget << " W/mm3" << G4endl;
|
||||
fOutPut << "The total heating during the irradiation is " << totalEnergyDepositTargetEOB << "J/mm3" << G4endl;
|
||||
fOutPut << "Total heating in the foil : " << heatFoil << " W/mm3" << G4endl;
|
||||
|
||||
|
||||
fOutPut.close();
|
||||
fOutPut1.close();
|
||||
fOutPut2.close();
|
||||
fOutPut3.close();
|
||||
fOutPut4.close();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Accumulation functions for maps used at the end of run action
|
||||
|
||||
void STCyclotronRun::PrimaryIsotopeCountTarget(G4String name,G4double time)
|
||||
{
|
||||
fPrimaryIsotopeCountTarget[name]++;
|
||||
fPrimaryIsotopeTimeTarget[name]=time;
|
||||
}
|
||||
//------------------------------------
|
||||
void STCyclotronRun::CountStableIsotopes(G4String name)
|
||||
{
|
||||
fStableIsotopeCountTarget[name]++;
|
||||
}
|
||||
//------------------------------------
|
||||
void STCyclotronRun::DecayIsotopeCountTarget(G4String nameDaughter,G4String mum, G4double time)
|
||||
{
|
||||
fDecayIsotopeCountTarget[nameDaughter]=mum;
|
||||
fDecayIsotopeTimeTarget[nameDaughter]=time;
|
||||
}
|
||||
//------------------------------------
|
||||
void STCyclotronRun::ParticleParent(G4String isotope, G4String parent)
|
||||
{
|
||||
fParticleParent[isotope]=parent;
|
||||
}
|
||||
//
|
||||
//-----> Count other particles
|
||||
//------------------------------------
|
||||
void STCyclotronRun::ParticleCountTarget(G4String name)
|
||||
{
|
||||
fParticleCountTarget[name]++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------
|
||||
// Accumulation functions for maps used only during the run
|
||||
//
|
||||
//-----> Isotope ID to obtain the "mother isotope" in SensitiveTarget()
|
||||
//------------------------------------
|
||||
void STCyclotronRun::StoreIsotopeID(G4int ID, G4String name)
|
||||
{
|
||||
fIsotopeIDTarget[ID]=name;
|
||||
}
|
||||
//
|
||||
std::map<G4int,G4String> STCyclotronRun::GetIsotopeID()
|
||||
{
|
||||
return fIsotopeIDTarget;
|
||||
}
|
||||
|
||||
|
||||
void STCyclotronRun::EnergyDepositionTarget(G4double edep)
|
||||
{
|
||||
fTotalEnergyDepositTarget += edep;
|
||||
}
|
||||
|
||||
void STCyclotronRun::EnergyDepositionFoil(G4double edep)
|
||||
{
|
||||
fTotalEnergyDepositFoil += edep;
|
||||
}
|
||||
|
||||
void STCyclotronRun::CountParticlesTarget()
|
||||
{
|
||||
fParticleTarget++;
|
||||
}
|
||||
|
||||
void STCyclotronRun::SetFoilVolume(G4double foilVolume)
|
||||
{
|
||||
fFoilVolume = foilVolume;
|
||||
}
|
||||
|
||||
void STCyclotronRun::SetFoilThickness(G4double foilThickness)
|
||||
{
|
||||
fFoilThickness = foilThickness;
|
||||
}
|
||||
|
||||
void STCyclotronRun::SetTargetVolume(G4double targetVolume)
|
||||
{
|
||||
fTargetVolume = targetVolume;
|
||||
}
|
||||
|
||||
void STCyclotronRun::SetTargetThickness(G4double targetThickness)
|
||||
{
|
||||
fTargetThickness = targetThickness;
|
||||
}
|
||||
|
||||
void STCyclotronRun::SetTargetDiameter(G4double targetDiameter)
|
||||
{
|
||||
fTargetDiameter = targetDiameter;
|
||||
}
|
||||
|
||||
void STCyclotronRun::SetPrimariesPerEvent(G4int primaries)
|
||||
{
|
||||
fPrimariesPerEvent = primaries;
|
||||
}
|
||||
|
||||
void STCyclotronRun::SetTimePerEvent(G4double timePerEvent)
|
||||
{
|
||||
fTimePerEvent = timePerEvent;
|
||||
}
|
||||
|
||||
void STCyclotronRun::SetBeamName(G4String beamName)
|
||||
{
|
||||
fBeamName = beamName;
|
||||
}
|
||||
|
||||
void STCyclotronRun::SetBeamCurrent(G4double beamCurrent)
|
||||
{
|
||||
fBeamCurrent = beamCurrent;
|
||||
}
|
||||
|
||||
void STCyclotronRun::SetBeamEnergy(G4double beamEnergy)
|
||||
{
|
||||
fBeamEnergy = beamEnergy;
|
||||
}
|
||||
+137
@@ -0,0 +1,137 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// Author: F. Poignant, floriane.poignant@gmail.com
|
||||
//
|
||||
// file STCyclotronRunAction.cc
|
||||
//
|
||||
#include "STCyclotronRunAction.hh"
|
||||
#include "STCyclotronRunActionMessenger.hh"
|
||||
#include "STCyclotronPrimaryGeneratorAction.hh"
|
||||
#include "STCyclotronSensitiveTarget.hh"
|
||||
#include "STCyclotronRun.hh"
|
||||
#include "STCyclotronDetectorConstruction.hh"
|
||||
#include "STCyclotronAnalysis.hh"
|
||||
#include "G4GeneralParticleSource.hh"
|
||||
#include "G4UserRunAction.hh"
|
||||
#include "G4Run.hh"
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4AccumulableManager.hh"
|
||||
#include "G4LogicalVolumeStore.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4PhysicalConstants.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
#include <iomanip>
|
||||
#include <cmath>
|
||||
|
||||
|
||||
STCyclotronRunAction::STCyclotronRunAction(STCyclotronDetectorConstruction*)
|
||||
{
|
||||
|
||||
//----------------------------------------------
|
||||
//Set printing event number per each 100 events
|
||||
//G4RunManager::GetRunManager()->SetPrintProgress(100);
|
||||
//----------------------------------------------
|
||||
fMessenger = new STCyclotronRunActionMessenger(this);
|
||||
fIrradiationTime = 3.; //in hour
|
||||
fIn = 185; //in mm
|
||||
fOut = 188; //in mm
|
||||
|
||||
//----------------------------------------------
|
||||
// Analysis Manager for storage of data in histograms
|
||||
//----------------------------------------------
|
||||
|
||||
auto analysisManager = G4AnalysisManager::Instance();
|
||||
G4cout << "Using " << analysisManager->GetType() << G4endl;
|
||||
analysisManager->SetVerboseLevel(1);
|
||||
|
||||
//The edges/bin are default value that may be modified in the file 'Macro/init_parameters.mac'
|
||||
//Create TH1D histograms
|
||||
analysisManager->CreateH1("H10","Energy of the primary particles when reaching the target (MeV)", 500,12.,19.); //in MeV
|
||||
analysisManager->CreateH1("H11","Energy of the primary particle when reaching the foil (MeV)",100,12.,19.); //in MeV
|
||||
analysisManager->CreateH1("H12","Energy spectrum of primaries going out from the target (MeV)", 100, 0., 19.); //in MeV
|
||||
analysisManager->CreateH1("H13","Energy of the primary particle when going out from the foil (MeV)",100,0,19);
|
||||
analysisManager->CreateH1("H14","Depth of isotope creation in the target (mm)", 300, fIn, fOut);
|
||||
analysisManager->CreateH1("H15","Energy spectrum of the positrons created in the target by the beam and secondaries (MeV)", 100, 0., 17.);
|
||||
analysisManager->CreateH1("H16","Energy spectrum of the electrons created in the target by the beam and secondaries (MeV)", 100, 0., 17.); //in MeV
|
||||
analysisManager->CreateH1("H17","Energy spectrum of the gammas created in the target by the beam and secondaries (MeV)", 100, 0., 17.); //in MeV
|
||||
analysisManager->CreateH1("H18","Energy spectrum of the neutrons created in the target by the beam and secondaries (MeV)", 100, 0., 17.); //in MeV
|
||||
analysisManager->CreateH1("H19","Energy spectrum of the positrons created in the target by the decay (MeV)", 100, 0., 17.);//, MeV);
|
||||
analysisManager->CreateH1("H110","Energy spectrum of the electrons created in the target by the decay (MeV)", 100, 0., 17.);
|
||||
analysisManager->CreateH1("H111","Energy spectrum of the gammas created in the target (MeV) by the decay", 100, 0., 17.);
|
||||
analysisManager->CreateH1("H112","Energy spectrum of the neutrons created in the target (MeV) by the decay", 100, 0., 17.);
|
||||
analysisManager->CreateH1("H113","Energy spectrum of the nu_e created in the target (MeV) by the decay", 100, 0., 17.);
|
||||
analysisManager->CreateH1("H114","Energy spectrum of the anti_nu_e created in the target (MeV) by the decay", 100, 0., 17.);
|
||||
|
||||
//Create TH2D histograms
|
||||
|
||||
analysisManager->CreateH2("H20", "Beam intensity before hiting the target (mm)",100, -7.5 , 7.5, 100, -7.5, 7.5);
|
||||
analysisManager->CreateH2("H21", "Beam intensity before hiting the foil (mm)",100, -7.5 , 7.5, 100, -7.5, 7.5);
|
||||
analysisManager->CreateH2("H22", "Radioisotopes produced", 11, 24.5, 35.5, 20, 54.5, 74.5);
|
||||
analysisManager->CreateH2("H23", "Energy (MeV) = f(depth (mm))", 100, fIn, fOut,100,0.,16.);
|
||||
analysisManager->CreateH2("H24", "Beam intensity going out from the target (mm)",100, -7.5 , 7.5, 100, -7.5, 7.5);
|
||||
analysisManager->CreateH2("H25", "Beam intensity going out from the foil (mm)", 100, -7.5 , 7.5, 100, -7.5, 7.5);
|
||||
}
|
||||
|
||||
STCyclotronRunAction::~STCyclotronRunAction()
|
||||
{
|
||||
delete fMessenger;
|
||||
delete G4AnalysisManager::Instance();
|
||||
}
|
||||
|
||||
G4Run* STCyclotronRunAction::GenerateRun()
|
||||
{
|
||||
fRun = new STCyclotronRun();
|
||||
return fRun;
|
||||
}
|
||||
|
||||
void STCyclotronRunAction::BeginOfRunAction(const G4Run*)
|
||||
{
|
||||
//----------------------------------------------
|
||||
// Inform the runManager to save random number seed
|
||||
//----------------------------------------------
|
||||
G4RunManager::GetRunManager()->SetRandomNumberStore(false);
|
||||
auto analysisManager = G4AnalysisManager::Instance();
|
||||
analysisManager->OpenFile("SolidTargetCyclotron");
|
||||
}
|
||||
|
||||
void STCyclotronRunAction::EndOfRunAction(const G4Run*)
|
||||
{
|
||||
if(isMaster)fRun->EndOfRun(fIrradiationTime);
|
||||
auto analysisManager = G4AnalysisManager::Instance();
|
||||
analysisManager->Write();
|
||||
analysisManager->CloseFile();
|
||||
|
||||
}
|
||||
|
||||
void STCyclotronRunAction::SetIrradiationTime(G4double time)
|
||||
{
|
||||
if(fIrradiationTime != time){
|
||||
fIrradiationTime = time;
|
||||
G4cout << "The time of irradiation is now the following : " << fIrradiationTime << " hour(s)." << G4endl;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// Author: F. Poignant, floriane.poignant@gmail.com
|
||||
//
|
||||
|
||||
|
||||
#include "STCyclotronRunActionMessenger.hh"
|
||||
#include "STCyclotronRunAction.hh"
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcmdWithADouble.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
STCyclotronRunActionMessenger::STCyclotronRunActionMessenger(STCyclotronRunAction* run)
|
||||
:fG4Run(run)
|
||||
{
|
||||
// change the time of irradiation
|
||||
fIrradiationTime = new G4UIdirectory("/setTimeOfIrradiation/");
|
||||
fIrradiationTime -> SetGuidance("Change time of irradiation, in hour(s).");
|
||||
|
||||
fChangeIrradiationTimeCmd = new G4UIcmdWithADouble("/setTimeOfIrradiation/time", this);
|
||||
fChangeIrradiationTimeCmd -> SetGuidance("Change the value of the time of irradiation (in hours)"
|
||||
"\nDefault value is 6 hours");
|
||||
fChangeIrradiationTimeCmd -> SetParameterName("TimeOfIrradiation", true);
|
||||
fChangeIrradiationTimeCmd -> SetRange("TimeOfIrradiation > 0.");
|
||||
fChangeIrradiationTimeCmd -> SetDefaultValue(6.);
|
||||
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
STCyclotronRunActionMessenger::~STCyclotronRunActionMessenger()
|
||||
{
|
||||
delete fIrradiationTime;
|
||||
delete fChangeIrradiationTimeCmd;
|
||||
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
void STCyclotronRunActionMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
|
||||
{
|
||||
|
||||
if( command == fChangeIrradiationTimeCmd)
|
||||
{
|
||||
G4double updatedValue = fChangeIrradiationTimeCmd -> GetNewDoubleValue(newValue);
|
||||
fG4Run -> SetIrradiationTime(updatedValue);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// Author: F. Poignant, floriane.poignant@gmail.com
|
||||
//
|
||||
// file STCyclotronSensitiveFoil.cc
|
||||
//
|
||||
#include "STCyclotronRun.hh"
|
||||
#include "STCyclotronSensitiveFoil.hh"
|
||||
#include "STCyclotronAnalysis.hh"
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4HCofThisEvent.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4ios.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
STCyclotronSensitiveFoil::STCyclotronSensitiveFoil(const G4String& name,
|
||||
STCyclotronDetectorConstruction* det)
|
||||
: G4VSensitiveDetector(name),
|
||||
fDet(det)
|
||||
{
|
||||
fTempTrack = 0;
|
||||
fTempTrack1 = 0;
|
||||
fTempEnergy = 0.;
|
||||
fTempVector = G4ThreeVector(0.,0.,0.);
|
||||
fRun =0;
|
||||
}
|
||||
|
||||
STCyclotronSensitiveFoil::~STCyclotronSensitiveFoil()
|
||||
{
|
||||
delete fRun;
|
||||
}
|
||||
|
||||
G4bool STCyclotronSensitiveFoil::ProcessHits(G4Step* aStep, G4TouchableHistory*)
|
||||
{
|
||||
|
||||
fRun = static_cast<STCyclotronRun*>(G4RunManager::GetRunManager()->GetNonConstCurrentRun());
|
||||
G4Track* fTrack = aStep->GetTrack();
|
||||
|
||||
auto analysisManager = G4AnalysisManager::Instance();
|
||||
|
||||
//Step/track information
|
||||
G4double edep = aStep->GetTotalEnergyDeposit();
|
||||
G4double energy = aStep->GetPreStepPoint()->GetKineticEnergy();
|
||||
G4ThreeVector momentumDirection = aStep->GetPreStepPoint()->GetMomentumDirection();
|
||||
G4ThreeVector vectorPosition = aStep->GetPreStepPoint()->GetPosition();
|
||||
G4String name = fTrack->GetDefinition()->GetParticleName();
|
||||
|
||||
//Collect general information concerning all of the particles
|
||||
fRun->EnergyDepositionFoil(edep);
|
||||
|
||||
//Collect information about protons
|
||||
if(name == "proton" || name == "deuteron"){
|
||||
|
||||
if(fTrack->GetTrackID()!=fTempTrack && (momentumDirection.getZ()>0.) &&
|
||||
vectorPosition.getX()< 7.5 &&
|
||||
vectorPosition.getX()>-7.5 &&
|
||||
vectorPosition.getY()< 7.5 &&
|
||||
vectorPosition.getY()>-7.5){
|
||||
|
||||
analysisManager->FillH2(1,vectorPosition.getX(),vectorPosition.getY());
|
||||
analysisManager->FillH1(1,energy);
|
||||
|
||||
fTempTrack = fTrack->GetTrackID();
|
||||
|
||||
}
|
||||
|
||||
if(fTempTrack1 == 0){
|
||||
fTempTrack1 = fTrack->GetTrackID();
|
||||
}
|
||||
|
||||
if(fTrack->GetTrackID()!=fTempTrack1 && (momentumDirection.getZ()>0.) &&
|
||||
vectorPosition.getX()< 7.5 &&
|
||||
vectorPosition.getX()>-7.5 &&
|
||||
vectorPosition.getY()< 7.5 &&
|
||||
vectorPosition.getY()>-7.5 ){
|
||||
|
||||
analysisManager->FillH2(5,fTempVector.getX(),fTempVector.getY());
|
||||
analysisManager->FillH1(3,fTempEnergy);
|
||||
|
||||
fTempTrack1 = fTrack->GetTrackID();
|
||||
|
||||
}
|
||||
|
||||
fTempVector = aStep->GetPostStepPoint()->GetPosition();//vectorPosition;
|
||||
fTempEnergy = aStep->GetPostStepPoint()->GetKineticEnergy();//energy;
|
||||
}
|
||||
|
||||
fRun->SetFoilVolume(fDet->GetFoilVolume());
|
||||
fRun->SetFoilThickness(fDet->GetFoilThickness());
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,282 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// Author: F. Poignant, floriane.poignant@gmail.com
|
||||
//
|
||||
// file STCyclotronSensitiveTarget.cc
|
||||
//
|
||||
#include "STCyclotronAnalysis.hh"
|
||||
#include "STCyclotronRun.hh"
|
||||
#include "STCyclotronSensitiveTarget.hh"
|
||||
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4HCofThisEvent.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4SteppingManager.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4ios.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4DecayTable.hh"
|
||||
#include "G4VDecayChannel.hh"
|
||||
#include "G4RadioactiveDecay.hh"
|
||||
#include "G4TrackVector.hh"
|
||||
#include "G4VProcess.hh"
|
||||
#include "G4Tubs.hh"
|
||||
#include <map>
|
||||
|
||||
STCyclotronSensitiveTarget::STCyclotronSensitiveTarget(G4String name,
|
||||
STCyclotronDetectorConstruction* det)
|
||||
: G4VSensitiveDetector(name),
|
||||
fDet(det)
|
||||
{
|
||||
fTempTrack = 0;
|
||||
fTempTrack1 = 0;
|
||||
fTempEnergy = 0.;
|
||||
fTempVector = G4ThreeVector(0.,0.,0.);
|
||||
fTrack=0;
|
||||
}
|
||||
|
||||
STCyclotronSensitiveTarget::~STCyclotronSensitiveTarget()
|
||||
{
|
||||
delete fTrack;
|
||||
}
|
||||
|
||||
G4bool STCyclotronSensitiveTarget::ProcessHits(G4Step* aStep, G4TouchableHistory*)
|
||||
{
|
||||
|
||||
STCyclotronRun* fRun = static_cast<STCyclotronRun*>(G4RunManager::GetRunManager()->GetNonConstCurrentRun());
|
||||
fTrack = aStep->GetTrack();
|
||||
|
||||
auto analysisManager = G4AnalysisManager::Instance();
|
||||
|
||||
//----------------------------------------------
|
||||
// Volume info
|
||||
//----------------------------------------------
|
||||
G4double targetHalfDiameter= (fDet->GetTargetDiameter())/2.;
|
||||
|
||||
//----------------------------------------------
|
||||
// Step information
|
||||
//----------------------------------------------
|
||||
|
||||
G4double edep = aStep->GetTotalEnergyDeposit();
|
||||
G4double energy = aStep->GetPreStepPoint()->GetKineticEnergy();
|
||||
G4ThreeVector momentumDirection = aStep->GetPreStepPoint()->GetMomentumDirection();
|
||||
G4ThreeVector vectorPosition = aStep->GetPreStepPoint()->GetPosition();
|
||||
|
||||
//----------------------------------------------
|
||||
// Track
|
||||
//----------------------------------------------
|
||||
|
||||
G4ParticleDefinition* thePartDef = fTrack->GetDefinition();
|
||||
G4String partType= fTrack->GetDefinition()->GetParticleType();
|
||||
G4String name = fTrack->GetDefinition()->GetParticleName();
|
||||
G4double timeLife = fTrack->GetDefinition()->GetPDGLifeTime(); //<---
|
||||
const G4VProcess* process = fTrack->GetCreatorProcess();
|
||||
|
||||
//----------------------------------------------
|
||||
// Collect general information concerning all of the particles
|
||||
// Collect energy deposition ; separe decay case to beam case
|
||||
//----------------------------------------------
|
||||
|
||||
fRun->EnergyDepositionTarget(edep);
|
||||
|
||||
|
||||
//----------------------------------------------
|
||||
//Collect information about protons and deuterons
|
||||
//----------------------------------------------
|
||||
|
||||
if(name == "proton" || name == "deuteron")
|
||||
{
|
||||
|
||||
if(fTrack->GetTrackID()!=fTempTrack && (momentumDirection.getZ()>0.) &&
|
||||
vectorPosition.getX()<targetHalfDiameter &&
|
||||
vectorPosition.getX()>-targetHalfDiameter &&
|
||||
vectorPosition.getY()<targetHalfDiameter &&
|
||||
vectorPosition.getY()>-targetHalfDiameter)
|
||||
{
|
||||
analysisManager->FillH2(0,vectorPosition.getX(),vectorPosition.getY());
|
||||
analysisManager->FillH1(0,energy);
|
||||
fRun->CountParticlesTarget();
|
||||
fTempTrack = fTrack->GetTrackID();
|
||||
}
|
||||
|
||||
if(fTempTrack1 == 0)
|
||||
{
|
||||
fTempTrack1 = fTrack->GetTrackID();
|
||||
}
|
||||
|
||||
if(fTrack->GetTrackID()!=fTempTrack1 && (momentumDirection.getZ()>0.) &&
|
||||
fTempVector.getX()<targetHalfDiameter &&
|
||||
fTempVector.getX()>-targetHalfDiameter &&
|
||||
fTempVector.getY()<targetHalfDiameter &&
|
||||
fTempVector.getY()>-targetHalfDiameter )
|
||||
{
|
||||
|
||||
analysisManager->FillH2(4,fTempVector.getX(),fTempVector.getY());
|
||||
analysisManager->FillH1(2,fTempEnergy);
|
||||
fTempTrack1 = fTrack->GetTrackID();
|
||||
}
|
||||
|
||||
fTempVector = aStep->GetPostStepPoint()->GetPosition(); //vectorPosition;
|
||||
fTempEnergy = aStep->GetPostStepPoint()->GetKineticEnergy(); //energy;
|
||||
|
||||
analysisManager->FillH2(3,vectorPosition.getZ(),energy);
|
||||
|
||||
}
|
||||
|
||||
//----------------------------------------------
|
||||
// Store ID for particles that are
|
||||
// not protons/electrons or deuterons
|
||||
//----------------------------------------------
|
||||
|
||||
if((name != "proton") && (name != "e-") && (name != "deuteron"))
|
||||
{
|
||||
fRun->StoreIsotopeID(fTrack->GetTrackID(),name);
|
||||
}
|
||||
|
||||
//----------------------------------------------
|
||||
// Collect of information for unstable isotopes
|
||||
// generated from an interaction with the target
|
||||
//----------------------------------------------
|
||||
|
||||
if (name!="deuteron")
|
||||
{
|
||||
if (( partType == "nucleus") && !(thePartDef->GetPDGStable()) && (fTrack->GetCurrentStepNumber()==1) && timeLife!=0.)
|
||||
{
|
||||
//G4cout << "Saving unstable particles ..." << G4endl;
|
||||
G4int Z=thePartDef->GetAtomicNumber();
|
||||
G4int A=thePartDef->GetAtomicMass();
|
||||
analysisManager->FillH2(2,Z,A);
|
||||
|
||||
//----------------------------------------------
|
||||
// isotopes count
|
||||
//----------------------------------------------
|
||||
|
||||
fRun->PrimaryIsotopeCountTarget(name,timeLife);
|
||||
analysisManager->FillH1(4,fTrack->GetPosition().getZ());
|
||||
//particle that created the nucleus
|
||||
std::map<G4int,G4String> parentID = fRun->GetIsotopeID();
|
||||
G4String nameParent = parentID[fTrack->GetParentID()];
|
||||
fRun->ParticleParent(name, process->GetProcessName());
|
||||
|
||||
//G4cout << name << " : " << process->GetProcessName() << " with track ID " << fTrack->GetTrackID() << " and step ID " << fTrack->GetCurrentStepNumber() << G4endl;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------
|
||||
// Collect of information for stable isotopes
|
||||
// generated from an interaction with the target
|
||||
//----------------------------------------------
|
||||
|
||||
if (name!="deuteron")
|
||||
{
|
||||
if (( partType == "nucleus") && (thePartDef->GetPDGStable()) && (process->GetProcessName() != "RadioactiveDecay") && (fTrack->GetCurrentStepNumber()==1) )
|
||||
{
|
||||
//----------------------------------------------
|
||||
// isotopes count
|
||||
//----------------------------------------------
|
||||
fRun->CountStableIsotopes(name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------
|
||||
// Collect unstable isotopes from decay
|
||||
//----------------------------------------------
|
||||
|
||||
if (( partType == "nucleus") && !(thePartDef->GetPDGStable()) && (process->GetProcessName() == "RadioactiveDecay") && (fTrack->GetCurrentStepNumber()==1) && timeLife!=0)
|
||||
{
|
||||
std::map<G4int,G4String>::iterator itbis;
|
||||
std::map<G4int,G4String> parentID = fRun->GetIsotopeID();
|
||||
G4String nameParent = parentID[fTrack->GetParentID()];
|
||||
fRun->DecayIsotopeCountTarget(name,nameParent,timeLife);
|
||||
}
|
||||
|
||||
//----------------------------------------------
|
||||
// Collect any other particles emitted
|
||||
//----------------------------------------------
|
||||
|
||||
if((partType!="nucleus")&&(name!="proton")&&(name!="deuteron"))
|
||||
{
|
||||
fRun->ParticleCountTarget(name);
|
||||
//Condition so the particle will be counted for only one step
|
||||
if((fTrack->GetCurrentStepNumber()==1))
|
||||
{
|
||||
if(process->GetProcessName() != "RadioactiveDecay")
|
||||
{
|
||||
if(name=="e+"){
|
||||
analysisManager->FillH1(5,energy);
|
||||
}
|
||||
if(name=="e-"){
|
||||
analysisManager->FillH1(6,energy);
|
||||
}
|
||||
if(name=="gamma"){
|
||||
analysisManager->FillH1(7,energy);
|
||||
}
|
||||
if(name=="neutron"){
|
||||
analysisManager->FillH1(8,energy);
|
||||
}
|
||||
}
|
||||
|
||||
if(process->GetProcessName() == "RadioactiveDecay")
|
||||
{
|
||||
if(name=="e+"){
|
||||
analysisManager->FillH1(9,energy);
|
||||
}
|
||||
if(name=="e-"){
|
||||
analysisManager->FillH1(10,energy);
|
||||
}
|
||||
if(name=="gamma"){
|
||||
analysisManager->FillH1(11,energy);
|
||||
}
|
||||
if(name=="neutron"){
|
||||
analysisManager->FillH1(12,energy);
|
||||
}
|
||||
if(name=="nu_e"){
|
||||
analysisManager->FillH1(13,energy);
|
||||
}
|
||||
if(name=="anti_nu_e"){
|
||||
analysisManager->FillH1(14,energy);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fRun->SetTargetVolume(fDet->GetTargetVolume());
|
||||
fRun->SetTargetThickness(fDet->GetTargetThickness());
|
||||
fRun->SetTargetDiameter(fDet->GetTargetDiameter());
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user