Import Geant4 10.5.0 source tree
This commit is contained in:
@@ -23,11 +23,25 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// This example is provided by the Geant4-DNA collaboration
|
||||
// Any report or published results obtained using the Geant4-DNA software
|
||||
// shall cite the following Geant4-DNA collaboration publications:
|
||||
// Med. Phys. 37 (2010) 4692-4708
|
||||
// Phys. Med. 31 (2015) 861-874
|
||||
// The Geant4-DNA web site is available at http://geant4-dna.org
|
||||
//
|
||||
/// \file ActionInitialization.cc
|
||||
/// \brief Implementation of the ActionInitialization class
|
||||
|
||||
#include "ActionInitialization.hh"
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
#include "MyFile.hh"
|
||||
|
||||
#ifdef MYFILE
|
||||
#include "MyPrimaryGeneratorActionFromFile.hh"
|
||||
#else
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
#endif
|
||||
|
||||
#include "RunAction.hh"
|
||||
#include "EventAction.hh"
|
||||
#include "TrackingAction.hh"
|
||||
@@ -38,8 +52,9 @@
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ActionInitialization::ActionInitialization()
|
||||
: G4VUserActionInitialization()
|
||||
ActionInitialization::ActionInitialization(DetectorConstruction* detConstruction)
|
||||
: G4VUserActionInitialization(),
|
||||
fDetectorConstruction(detConstruction)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -58,7 +73,13 @@ void ActionInitialization::BuildForMaster() const
|
||||
|
||||
void ActionInitialization::Build() const
|
||||
{
|
||||
PrimaryGeneratorAction* primary = new PrimaryGeneratorAction();
|
||||
|
||||
#ifdef MYFILE
|
||||
MyPrimaryGeneratorActionFromFile* primary = new MyPrimaryGeneratorActionFromFile();
|
||||
#else
|
||||
PrimaryGeneratorAction* primary = new PrimaryGeneratorAction();
|
||||
#endif
|
||||
|
||||
SetUserAction(primary);
|
||||
|
||||
SetUserAction(new RunAction());
|
||||
@@ -68,7 +89,7 @@ void ActionInitialization::Build() const
|
||||
|
||||
SetUserAction(new TrackingAction(primary));
|
||||
|
||||
SetUserAction(new SteppingAction(event));
|
||||
SetUserAction(new SteppingAction(event, fDetectorConstruction));
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -23,6 +23,13 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// This example is provided by the Geant4-DNA collaboration
|
||||
// Any report or published results obtained using the Geant4-DNA software
|
||||
// shall cite the following Geant4-DNA collaboration publications:
|
||||
// Med. Phys. 37 (2010) 4692-4708
|
||||
// Phys. Med. 31 (2015) 861-874
|
||||
// The Geant4-DNA web site is available at http://geant4-dna.org
|
||||
//
|
||||
/// \file medical/dna/svalue/src/DetectorConstruction.cc
|
||||
/// \brief Implementation of the DetectorConstruction class
|
||||
|
||||
@@ -51,18 +58,28 @@
|
||||
|
||||
DetectorConstruction::DetectorConstruction()
|
||||
: G4VUserDetectorConstruction(),
|
||||
fAbsorMaterial(0),
|
||||
fAbsor(0),
|
||||
fNuclMaterial(0),
|
||||
fCytoMaterial(0),
|
||||
fWorldMaterial(0),
|
||||
fNucl(0),
|
||||
fCyto(0),
|
||||
fWorld(0),
|
||||
fDetectorMessenger(0)
|
||||
|
||||
{
|
||||
//default tracking cut
|
||||
fTrackingCut = 7.4*eV;
|
||||
|
||||
// default parameter values
|
||||
fAbsorRadius = 10*nm;
|
||||
fWorldRadius = 10*m;
|
||||
fCytoThickness = 20*nm;
|
||||
fNuclRadius = 10*nm;
|
||||
|
||||
DefineMaterials();
|
||||
SetMaterial("G4_WATER");
|
||||
SetWorldMaterial("G4_WATER");
|
||||
//SetWorldMaterial("G4_Galactic");
|
||||
SetCytoMaterial("G4_WATER");
|
||||
SetNuclMaterial("G4_WATER");
|
||||
|
||||
// create commands for interactive definition of the detector
|
||||
fDetectorMessenger = new DetectorMessenger(this);
|
||||
@@ -87,6 +104,7 @@ void DetectorConstruction::DefineMaterials()
|
||||
G4NistManager* man = G4NistManager::Instance();
|
||||
|
||||
man->FindOrBuildMaterial("G4_WATER");
|
||||
man->FindOrBuildMaterial("G4_Galactic");
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -98,33 +116,91 @@ G4VPhysicalVolume* DetectorConstruction::ConstructVolumes()
|
||||
G4LogicalVolumeStore::GetInstance()->Clean();
|
||||
G4SolidStore::GetInstance()->Clean();
|
||||
|
||||
// Sphereical absorber
|
||||
// Spherical world
|
||||
//
|
||||
G4Sphere*
|
||||
sAbsor = new G4Sphere("Absorber", //name
|
||||
0., fAbsorRadius, 0., twopi, 0., pi); //size
|
||||
sWorld = new G4Sphere("World",
|
||||
0.,
|
||||
1000*fNuclRadius,
|
||||
0.,
|
||||
twopi,
|
||||
0.,
|
||||
pi);
|
||||
|
||||
fLogicalAbsor = new G4LogicalVolume(sAbsor, //solid
|
||||
fAbsorMaterial, //material
|
||||
"Absorber"); //name
|
||||
fLogicalWorld = new G4LogicalVolume(sWorld,
|
||||
fWorldMaterial,
|
||||
"World");
|
||||
|
||||
fAbsor = new G4PVPlacement(0, //no rotation
|
||||
G4ThreeVector(), //at (0,0,0)
|
||||
fLogicalAbsor, //logical volume
|
||||
"Absorber", //name
|
||||
0, //mother volume
|
||||
false, //no boolean operation
|
||||
0); //copy number
|
||||
fWorld = new G4PVPlacement(0,
|
||||
G4ThreeVector(),
|
||||
fLogicalWorld,
|
||||
"World",
|
||||
0,
|
||||
false,
|
||||
0);
|
||||
|
||||
// Spherical nucleus
|
||||
//
|
||||
G4Sphere*
|
||||
sNucl = new G4Sphere("Nucl",
|
||||
0.,
|
||||
fNuclRadius,
|
||||
0.,
|
||||
twopi,
|
||||
0.,
|
||||
pi);
|
||||
|
||||
fLogicalNucl = new G4LogicalVolume(sNucl,
|
||||
fNuclMaterial,
|
||||
"Nucl");
|
||||
|
||||
fNucl = new G4PVPlacement(0,
|
||||
G4ThreeVector(),
|
||||
"Nucl",
|
||||
fLogicalNucl,
|
||||
fWorld,
|
||||
false,
|
||||
0);
|
||||
|
||||
// Spherical shell for cytoplasm
|
||||
//
|
||||
G4Sphere*
|
||||
sCyto = new G4Sphere("Cyto",
|
||||
fNuclRadius,
|
||||
fNuclRadius+fCytoThickness,
|
||||
0.,
|
||||
twopi,
|
||||
0.,
|
||||
pi);
|
||||
|
||||
fLogicalCyto = new G4LogicalVolume(sCyto,
|
||||
fCytoMaterial,
|
||||
"Cyto");
|
||||
|
||||
fCyto = new G4PVPlacement(0,
|
||||
G4ThreeVector(),
|
||||
"Cyto",
|
||||
fLogicalCyto,
|
||||
fWorld,
|
||||
false,
|
||||
0);
|
||||
//
|
||||
|
||||
PrintParameters();
|
||||
|
||||
fLogicalAbsor->SetUserLimits(new G4UserLimits(DBL_MAX,DBL_MAX,DBL_MAX,
|
||||
// Tracking cut
|
||||
//
|
||||
fLogicalNucl->SetUserLimits(new G4UserLimits(DBL_MAX,DBL_MAX,DBL_MAX,
|
||||
fTrackingCut));
|
||||
fLogicalCyto->SetUserLimits(new G4UserLimits(DBL_MAX,DBL_MAX,DBL_MAX,
|
||||
fTrackingCut));
|
||||
fLogicalWorld->SetUserLimits(new G4UserLimits(DBL_MAX,DBL_MAX,DBL_MAX,
|
||||
fTrackingCut));
|
||||
|
||||
//
|
||||
//always return the root volume
|
||||
//
|
||||
return fAbsor;
|
||||
return fWorld;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -134,10 +210,17 @@ void DetectorConstruction::PrintParameters() const
|
||||
G4cout << "\n---------------------------------------------------------\n";
|
||||
G4cout << "---> The tracking cut is set to "
|
||||
<< G4BestUnit(fTrackingCut,"Energy") << G4endl;
|
||||
G4cout << "---> The Absorber is a sphere of "
|
||||
<< G4BestUnit(fAbsorRadius,"Length") << " radius of "
|
||||
<< fAbsorMaterial->GetName() << " made of"
|
||||
<< "\n \n" << fAbsorMaterial << G4endl;
|
||||
G4cout << "---> The World is a sphere of "
|
||||
<< G4BestUnit(1000*fNuclRadius,"Length") << "radius of "
|
||||
<< fWorldMaterial->GetName() << G4endl;
|
||||
G4cout << "---> The Nucleus is a sphere of "
|
||||
<< G4BestUnit(fNuclRadius,"Length") << "radius of "
|
||||
<< fWorldMaterial->GetName() << " of mass "
|
||||
<< G4BestUnit(GetNuclMass(),"Mass") << G4endl;
|
||||
G4cout << "---> The Cytoplasm is a spherical shell of thickness "
|
||||
<< G4BestUnit(fCytoThickness,"Length") << "of "
|
||||
<< fWorldMaterial->GetName() << " of mass "
|
||||
<< G4BestUnit(GetCytoMass(),"Mass") << G4endl;
|
||||
G4cout << "\n---------------------------------------------------------\n";
|
||||
}
|
||||
|
||||
@@ -151,19 +234,50 @@ void DetectorConstruction::SetTrackingCut(G4double value)
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void DetectorConstruction::SetRadius(G4double value)
|
||||
void DetectorConstruction::SetNuclRadius(G4double value)
|
||||
{
|
||||
fAbsorRadius = value;
|
||||
fNuclRadius = value;
|
||||
G4RunManager::GetRunManager()->ReinitializeGeometry();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void DetectorConstruction::SetMaterial(G4String materialChoice)
|
||||
void DetectorConstruction::SetCytoThickness(G4double value)
|
||||
{
|
||||
fCytoThickness = value;
|
||||
G4RunManager::GetRunManager()->ReinitializeGeometry();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void DetectorConstruction::SetWorldMaterial(G4String materialChoice)
|
||||
{
|
||||
// search the material by its name
|
||||
G4Material* pttoMaterial = G4Material::GetMaterial(materialChoice);
|
||||
if (pttoMaterial) fAbsorMaterial = pttoMaterial;
|
||||
if (pttoMaterial) fWorldMaterial = pttoMaterial;
|
||||
G4RunManager::GetRunManager()->GeometryHasBeenModified();
|
||||
G4RunManager::GetRunManager()->PhysicsHasBeenModified();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void DetectorConstruction::SetCytoMaterial(G4String materialChoice)
|
||||
{
|
||||
// search the material by its name
|
||||
G4Material* pttoMaterial = G4Material::GetMaterial(materialChoice);
|
||||
if (pttoMaterial) fCytoMaterial = pttoMaterial;
|
||||
G4RunManager::GetRunManager()->GeometryHasBeenModified();
|
||||
G4RunManager::GetRunManager()->PhysicsHasBeenModified();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void DetectorConstruction::SetNuclMaterial(G4String materialChoice)
|
||||
{
|
||||
// search the material by its name
|
||||
G4Material* pttoMaterial = G4Material::GetMaterial(materialChoice);
|
||||
if (pttoMaterial) fNuclMaterial = pttoMaterial;
|
||||
G4RunManager::GetRunManager()->GeometryHasBeenModified();
|
||||
G4RunManager::GetRunManager()->PhysicsHasBeenModified();
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,13 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// This example is provided by the Geant4-DNA collaboration
|
||||
// Any report or published results obtained using the Geant4-DNA software
|
||||
// shall cite the following Geant4-DNA collaboration publications:
|
||||
// Med. Phys. 37 (2010) 4692-4708
|
||||
// Phys. Med. 31 (2015) 861-874
|
||||
// The Geant4-DNA web site is available at http://geant4-dna.org
|
||||
//
|
||||
/// \file medical/dna/svalue/src/DetectorMessenger.cc
|
||||
/// \brief Implementation of the DetectorMessenger class
|
||||
|
||||
@@ -40,9 +47,12 @@ DetectorMessenger::DetectorMessenger(DetectorConstruction * Det)
|
||||
:G4UImessenger(),fDetector(Det),
|
||||
fTestemDir(0),
|
||||
fDetDir(0),
|
||||
fMaterCmd(0),
|
||||
fRadiusCmd(0),
|
||||
fTrackingCutCmd(0)
|
||||
fMaterWorldCmd(0),
|
||||
fMaterCytoCmd(0),
|
||||
fMaterNuclCmd(0),
|
||||
fNuclRadiusCmd(0),
|
||||
fCytoThicknessCmd(0),
|
||||
fTrackingCutCmd(0)
|
||||
{
|
||||
fTestemDir = new G4UIdirectory("/svalue/");
|
||||
fTestemDir->SetGuidance(" detector control.");
|
||||
@@ -50,20 +60,40 @@ DetectorMessenger::DetectorMessenger(DetectorConstruction * Det)
|
||||
fDetDir = new G4UIdirectory("/svalue/det/");
|
||||
fDetDir->SetGuidance("detector construction commands");
|
||||
|
||||
fMaterCmd = new G4UIcmdWithAString("/svalue/det/setMat",this);
|
||||
fMaterCmd->SetGuidance("Select material of the box.");
|
||||
fMaterCmd->SetParameterName("choice",false);
|
||||
fMaterCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
fMaterCmd->SetToBeBroadcasted(false);
|
||||
fMaterWorldCmd = new G4UIcmdWithAString("/svalue/det/setWorldMat",this);
|
||||
fMaterWorldCmd->SetGuidance("Select material of the World");
|
||||
fMaterWorldCmd->SetParameterName("choice",false);
|
||||
fMaterWorldCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
fMaterWorldCmd->SetToBeBroadcasted(false);
|
||||
|
||||
fRadiusCmd = new G4UIcmdWithADoubleAndUnit("/svalue/det/setRadius",this);
|
||||
fRadiusCmd->SetGuidance("Set radius of the absorber");
|
||||
fRadiusCmd->SetParameterName("Radius",false);
|
||||
fRadiusCmd->SetRange("Radius>0.");
|
||||
fRadiusCmd->SetUnitCategory("Length");
|
||||
fRadiusCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
fRadiusCmd->SetToBeBroadcasted(false);
|
||||
fMaterNuclCmd = new G4UIcmdWithAString("/svalue/det/setNuclMat",this);
|
||||
fMaterNuclCmd->SetGuidance("Select material of the nucleus");
|
||||
fMaterNuclCmd->SetParameterName("choice",false);
|
||||
fMaterNuclCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
fMaterNuclCmd->SetToBeBroadcasted(false);
|
||||
|
||||
fMaterCytoCmd = new G4UIcmdWithAString("/svalue/det/setCytoMat",this);
|
||||
fMaterCytoCmd->SetGuidance("Select material of the cytoplasm");
|
||||
fMaterCytoCmd->SetParameterName("choice",false);
|
||||
fMaterCytoCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
fMaterCytoCmd->SetToBeBroadcasted(false);
|
||||
|
||||
fNuclRadiusCmd = new G4UIcmdWithADoubleAndUnit("/svalue/det/setNuclRadius",this);
|
||||
fNuclRadiusCmd->SetGuidance("Set radius of the nucleus");
|
||||
fNuclRadiusCmd->SetParameterName("Radius",false);
|
||||
fNuclRadiusCmd->SetRange("Radius>0.");
|
||||
fNuclRadiusCmd->SetUnitCategory("Length");
|
||||
fNuclRadiusCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
fNuclRadiusCmd->SetToBeBroadcasted(false);
|
||||
|
||||
fCytoThicknessCmd = new G4UIcmdWithADoubleAndUnit("/svalue/det/setCytoThickness",this);
|
||||
fCytoThicknessCmd->SetGuidance("Set thickness of the cytoplasm");
|
||||
fCytoThicknessCmd->SetParameterName("Thickness",false);
|
||||
fCytoThicknessCmd->SetRange("Thickness>0.");
|
||||
fCytoThicknessCmd->SetUnitCategory("Length");
|
||||
fCytoThicknessCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
fCytoThicknessCmd->SetToBeBroadcasted(false);
|
||||
|
||||
fTrackingCutCmd =
|
||||
new G4UIcmdWithADoubleAndUnit("/svalue/det/setTrackingCut",this);
|
||||
fTrackingCutCmd->SetGuidance("Set tracking cut in the absorber");
|
||||
@@ -78,8 +108,11 @@ DetectorMessenger::DetectorMessenger(DetectorConstruction * Det)
|
||||
|
||||
DetectorMessenger::~DetectorMessenger()
|
||||
{
|
||||
delete fMaterCmd;
|
||||
delete fRadiusCmd;
|
||||
delete fMaterWorldCmd;
|
||||
delete fMaterCytoCmd;
|
||||
delete fMaterNuclCmd;
|
||||
delete fNuclRadiusCmd;
|
||||
delete fCytoThicknessCmd;
|
||||
delete fTrackingCutCmd;
|
||||
delete fDetDir;
|
||||
delete fTestemDir;
|
||||
@@ -89,11 +122,20 @@ DetectorMessenger::~DetectorMessenger()
|
||||
|
||||
void DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
|
||||
{
|
||||
if( command == fMaterCmd )
|
||||
{ fDetector->SetMaterial(newValue);}
|
||||
if( command == fMaterWorldCmd )
|
||||
{ fDetector->SetWorldMaterial(newValue);}
|
||||
|
||||
if( command == fRadiusCmd )
|
||||
{ fDetector->SetRadius(fRadiusCmd->GetNewDoubleValue(newValue));}
|
||||
if( command == fMaterCytoCmd )
|
||||
{ fDetector->SetCytoMaterial(newValue);}
|
||||
|
||||
if( command == fMaterNuclCmd )
|
||||
{ fDetector->SetNuclMaterial(newValue);}
|
||||
|
||||
if( command == fNuclRadiusCmd )
|
||||
{ fDetector->SetNuclRadius(fNuclRadiusCmd->GetNewDoubleValue(newValue));}
|
||||
|
||||
if( command == fCytoThicknessCmd )
|
||||
{ fDetector->SetCytoThickness(fCytoThicknessCmd->GetNewDoubleValue(newValue));}
|
||||
|
||||
if( command == fTrackingCutCmd )
|
||||
{ fDetector->SetTrackingCut(fTrackingCutCmd->GetNewDoubleValue(newValue));}
|
||||
|
||||
@@ -23,6 +23,13 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// This example is provided by the Geant4-DNA collaboration
|
||||
// Any report or published results obtained using the Geant4-DNA software
|
||||
// shall cite the following Geant4-DNA collaboration publications:
|
||||
// Med. Phys. 37 (2010) 4692-4708
|
||||
// Phys. Med. 31 (2015) 861-874
|
||||
// The Geant4-DNA web site is available at http://geant4-dna.org
|
||||
//
|
||||
/// \file medical/dna/svalue/src/EventAction.cc
|
||||
/// \brief Implementation of the EventAction class
|
||||
|
||||
@@ -49,7 +56,8 @@ EventAction::~EventAction()
|
||||
void EventAction::BeginOfEventAction(const G4Event*)
|
||||
{
|
||||
//energy deposited per event
|
||||
fTotalEdep = 0.;
|
||||
fCytoEdep = 0.;
|
||||
fNuclEdep = 0.;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -58,17 +66,31 @@ void EventAction::EndOfEventAction(const G4Event*)
|
||||
{
|
||||
//plot energy deposited per event
|
||||
//
|
||||
if (fTotalEdep > 0.) {
|
||||
if (fCytoEdep > 0.) {
|
||||
|
||||
Run* run
|
||||
= static_cast<Run*>(G4RunManager::GetRunManager()->GetNonConstCurrentRun());
|
||||
|
||||
run->AddEdep(fTotalEdep);
|
||||
run->AddCytoEdep(fCytoEdep);
|
||||
|
||||
//G4cout << "*** Edep cumulated (eV) = " << run->GetEdep()/eV << G4endl;
|
||||
//G4cout << "*** Edep cumulated in cytoplasm (eV) = " << run->GetCytoEdep()/eV << G4endl;
|
||||
|
||||
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
|
||||
analysisManager->FillH1(2,fTotalEdep);
|
||||
analysisManager->FillH1(5,fCytoEdep);
|
||||
}
|
||||
|
||||
if (fNuclEdep > 0.) {
|
||||
|
||||
Run* run
|
||||
= static_cast<Run*>(G4RunManager::GetRunManager()->GetNonConstCurrentRun());
|
||||
|
||||
run->AddNuclEdep(fNuclEdep);
|
||||
|
||||
//G4cout << "*** Edep cumulated in nucleus (eV) = " << run->GetNuclEdep()/eV << G4endl;
|
||||
|
||||
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
|
||||
analysisManager->FillH1(6,fNuclEdep);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,13 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// This example is provided by the Geant4-DNA collaboration
|
||||
// Any report or published results obtained using the Geant4-DNA software
|
||||
// shall cite the following Geant4-DNA collaboration publications:
|
||||
// Med. Phys. 37 (2010) 4692-4708
|
||||
// Phys. Med. 31 (2015) 861-874
|
||||
// The Geant4-DNA web site is available at http://geant4-dna.org
|
||||
//
|
||||
/// \file medical/dna/svalue/src/HistoManager.cc
|
||||
/// \brief Implementation of the HistoManager class
|
||||
|
||||
@@ -57,16 +64,21 @@ void HistoManager::Book()
|
||||
analysisManager->SetActivation(true);
|
||||
|
||||
// Define histograms start values
|
||||
const G4int kMaxHisto = 8;
|
||||
const G4String id[] = {"0", "1", "2", "3", "4", "5", "6", "7"};
|
||||
const G4int kMaxHisto = 11;
|
||||
const G4String id[] = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10"};
|
||||
|
||||
const G4String title[] = {"dummy", //0
|
||||
"dummy2", //1
|
||||
"total energy deposited in absorber", //2
|
||||
"true track length of the primary particle", //3
|
||||
"true step size of the primary particle", //4
|
||||
"projected range of the primary particle", //5
|
||||
"true track length of charged secondaries", //6
|
||||
const G4String title[] = {
|
||||
"kinetic energy of new e- track", //0
|
||||
"kinetic energy of new e- track (log)", //1
|
||||
"kinetic energy of new gamma track", //2
|
||||
"kinetic energy of new gamma track (log)", //3
|
||||
"charge of new track", //4
|
||||
"total energy deposited in cytoplasm", //5
|
||||
"total energy deposited in nucleus", //6
|
||||
"true track length of the primary particle", //7
|
||||
"true step size of the primary particle", //8
|
||||
"projected range of the primary particle", //9
|
||||
"true track length of charged secondaries", //10
|
||||
"true step size of charged secondaries"};
|
||||
|
||||
// Default values (to be reset via /analysis/h1/set command)
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// Derived from
|
||||
// https://twiki.cern.ch/twiki/bin/view/Geant4/QuickMigrationGuideForGeant4V10
|
||||
// Courtesy of A. Dotti
|
||||
//
|
||||
// This example is provided by the Geant4-DNA collaboration
|
||||
// Any report or published results obtained using the Geant4-DNA software
|
||||
// shall cite the following Geant4-DNA collaboration publications:
|
||||
// Med. Phys. 37 (2010) 4692-4708
|
||||
// Phys. Med. 31 (2015) 861-874
|
||||
// The Geant4-DNA web site is available at http://geant4-dna.org
|
||||
//
|
||||
/// \file medical/dna/svalue2/src/MyFileReader.cc
|
||||
/// \brief Implementation of the MyFileReader class
|
||||
|
||||
#include "MyFileReader.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
MyFileReader::MyFileReader()
|
||||
{
|
||||
//******************************************************************
|
||||
//*** Specify file name containing list of incident energies (in eV)
|
||||
//******************************************************************
|
||||
G4String fileName= "spectrum.txt";
|
||||
//
|
||||
|
||||
inputFile.open(fileName.data());
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
MyFileReader::~MyFileReader()
|
||||
{ inputFile.close(); }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4double MyFileReader::GetAnEvent()
|
||||
{
|
||||
|
||||
//*******************************************
|
||||
//*** Specify number of lines to read at once
|
||||
//*******************************************
|
||||
G4int numberOfLinesToRead = 100;
|
||||
//
|
||||
|
||||
if( evList.size() == 0 )
|
||||
{
|
||||
for(G4int i=0;i<numberOfLinesToRead;i++)
|
||||
{
|
||||
G4double nrj;
|
||||
inputFile >> nrj;
|
||||
evList.push_back(nrj);
|
||||
}
|
||||
}
|
||||
|
||||
//get first element from list
|
||||
G4double ev = evList.front();
|
||||
|
||||
//remove this element from list
|
||||
evList.pop_front();
|
||||
|
||||
return ev;
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// Derived from
|
||||
// https://twiki.cern.ch/twiki/bin/view/Geant4/QuickMigrationGuideForGeant4V10
|
||||
// Courtesy of A. Dotti
|
||||
//
|
||||
// This example is provided by the Geant4-DNA collaboration
|
||||
// Any report or published results obtained using the Geant4-DNA software
|
||||
// shall cite the following Geant4-DNA collaboration publications:
|
||||
// Med. Phys. 37 (2010) 4692-4708
|
||||
// Phys. Med. 31 (2015) 861-874
|
||||
// The Geant4-DNA web site is available at http://geant4-dna.org
|
||||
//
|
||||
/// \file medical/dna/svalue2/src/MyPrimaryGeneratorActionFromFile.cc
|
||||
/// \brief Implementation of the MyPrimaryGeneratorActionFromFile class
|
||||
|
||||
#include "MyPrimaryGeneratorActionFromFile.hh"
|
||||
#include "MyFileReader.hh"
|
||||
#include "DetectorConstruction.hh"
|
||||
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "Randomize.hh"
|
||||
#include "G4RandomDirection.hh"
|
||||
#include "G4AutoLock.hh"
|
||||
#include "G4ParticleGun.hh"
|
||||
#include "G4String.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4StateManager.hh"
|
||||
|
||||
namespace { G4Mutex myPrimGenMutex = G4MUTEX_INITIALIZER; }
|
||||
|
||||
MyFileReader* MyPrimaryGeneratorActionFromFile::fileReader = 0;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
MyPrimaryGeneratorActionFromFile::MyPrimaryGeneratorActionFromFile()
|
||||
:G4VUserPrimaryGeneratorAction(), G4VStateDependent(),
|
||||
fParticleGun(0),
|
||||
fDetector(0)
|
||||
{
|
||||
fDetector =
|
||||
dynamic_cast<const DetectorConstruction*>(G4RunManager::GetRunManager()
|
||||
->GetUserDetectorConstruction());
|
||||
|
||||
G4AutoLock lock(&myPrimGenMutex);
|
||||
if( !fileReader ) fileReader = new MyFileReader();
|
||||
fParticleGun = new G4ParticleGun(1);
|
||||
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
|
||||
G4ParticleDefinition* particle = particleTable->FindParticle("e-");
|
||||
fParticleGun->SetParticleDefinition(particle);
|
||||
fParticleGun->SetParticleEnergy(10.*MeV);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
MyPrimaryGeneratorActionFromFile::~MyPrimaryGeneratorActionFromFile()
|
||||
{
|
||||
G4AutoLock lock(&myPrimGenMutex);
|
||||
if( fileReader ) { delete fileReader; fileReader = 0; }
|
||||
|
||||
G4StateManager::GetStateManager()->DeregisterDependent(this);
|
||||
if(fParticleGun) delete fParticleGun;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void MyPrimaryGeneratorActionFromFile::GeneratePrimaries(G4Event* anEvent)
|
||||
{
|
||||
//Energy is read from file
|
||||
//
|
||||
G4double nrj = 0;
|
||||
if(fileReader)
|
||||
{
|
||||
G4AutoLock lock(&myPrimGenMutex);
|
||||
nrj = fileReader->GetAnEvent();
|
||||
}
|
||||
fParticleGun->SetParticleEnergy(nrj*eV);
|
||||
|
||||
//
|
||||
G4double thickness = fDetector->GetCytoThickness();
|
||||
G4double radius = fDetector->GetNuclRadius();
|
||||
|
||||
G4double rx=1*m;
|
||||
G4double ry=1*m;
|
||||
G4double rz=1*m;
|
||||
G4double myRadius = 0;
|
||||
|
||||
do
|
||||
{
|
||||
rx = (2*G4UniformRand()-1)*(radius+thickness)*1.01;
|
||||
ry = (2*G4UniformRand()-1)*(radius+thickness)*1.01;
|
||||
rz = (2*G4UniformRand()-1)*(radius+thickness)*1.01;
|
||||
myRadius = std::sqrt(rx*rx+ry*ry+rz*rz);
|
||||
|
||||
} while (myRadius>radius+thickness || myRadius<radius) ;
|
||||
|
||||
fParticleGun->SetParticlePosition(G4ThreeVector(rx,ry,rz));
|
||||
fParticleGun->SetParticleMomentumDirection(G4RandomDirection());
|
||||
|
||||
//G4cout << "---> EVENT ID=" << anEvent->GetEventID()+1 << G4endl;
|
||||
//G4cout << "---> energy/eV=" << nrj << G4endl;
|
||||
|
||||
fParticleGun->GeneratePrimaryVertex(anEvent);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4bool MyPrimaryGeneratorActionFromFile::Notify(G4ApplicationState requestedState)
|
||||
{
|
||||
if(requestedState == G4State_Idle)
|
||||
{
|
||||
if(fParticleGun != 0) return true;
|
||||
|
||||
fParticleGun = new G4ParticleGun(1);
|
||||
|
||||
// Define default primary
|
||||
G4ParticleDefinition* particle
|
||||
= G4ParticleTable::GetParticleTable()->FindParticle("e-");
|
||||
fParticleGun->SetParticleDefinition(particle);
|
||||
fParticleGun->SetParticleEnergy(300*eV);
|
||||
fParticleGun->SetParticlePosition(G4ThreeVector());
|
||||
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(1,0,0));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -23,6 +23,13 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// This example is provided by the Geant4-DNA collaboration
|
||||
// Any report or published results obtained using the Geant4-DNA software
|
||||
// shall cite the following Geant4-DNA collaboration publications:
|
||||
// Med. Phys. 37 (2010) 4692-4708
|
||||
// Phys. Med. 31 (2015) 861-874
|
||||
// The Geant4-DNA web site is available at http://geant4-dna.org
|
||||
//
|
||||
/// \file medical/dna/svalue/src/PhysicsList.cc
|
||||
/// \brief Implementation of the PhysicsList class
|
||||
|
||||
@@ -38,6 +45,8 @@
|
||||
#include "G4EmDNAPhysics_option6.hh"
|
||||
#include "G4EmDNAPhysics_option7.hh"
|
||||
#include "G4EmStandardPhysics_option3.hh"
|
||||
#include "G4DecayPhysics.hh"
|
||||
#include "G4RadioactiveDecayPhysics.hh"
|
||||
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
@@ -54,6 +63,18 @@
|
||||
#include "G4ShortLivedConstructor.hh"
|
||||
#include "G4DNAGenericIonsManager.hh"
|
||||
|
||||
// decay
|
||||
|
||||
#include "G4RadioactiveDecay.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4NuclideTable.hh"
|
||||
#include "G4LossTableManager.hh"
|
||||
#include "G4UAtomicDeexcitation.hh"
|
||||
#include "G4NuclearLevelData.hh"
|
||||
#include "G4DeexPrecoParameters.hh"
|
||||
#include "G4NuclideTable.hh"
|
||||
#include "G4GenericIon.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
PhysicsList::PhysicsList() : G4VModularPhysicsList(),
|
||||
@@ -65,6 +86,38 @@ PhysicsList::PhysicsList() : G4VModularPhysicsList(),
|
||||
|
||||
// EM physics
|
||||
fEmPhysicsList = new G4EmDNAPhysics();
|
||||
|
||||
// ***Decay physics from rad01 example***
|
||||
//
|
||||
|
||||
//add new units for radioActive decays
|
||||
//
|
||||
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
|
||||
//
|
||||
G4NuclideTable::GetInstance()->SetThresholdOfHalfLife(0.1*picosecond);
|
||||
G4NuclideTable::GetInstance()->SetLevelTolerance(1.0*eV);
|
||||
|
||||
//read new PhotonEvaporation data set
|
||||
//
|
||||
G4DeexPrecoParameters* deex =
|
||||
G4NuclearLevelData::GetInstance()->GetParameters();
|
||||
|
||||
deex->SetCorrelatedGamma(false);
|
||||
|
||||
deex->SetStoreAllLevels(true);
|
||||
|
||||
deex->SetMaxLifeTime
|
||||
(G4NuclideTable::GetInstance()->GetThresholdOfHalfLife()/std::log(2.));
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -73,6 +126,7 @@ PhysicsList::~PhysicsList()
|
||||
{
|
||||
delete fMessenger;
|
||||
delete fEmPhysicsList;
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -97,6 +151,7 @@ void PhysicsList::ConstructParticle()
|
||||
G4ShortLivedConstructor pShortLivedConstructor;
|
||||
pShortLivedConstructor.ConstructParticle();
|
||||
|
||||
|
||||
G4DNAGenericIonsManager* genericIonsManager;
|
||||
genericIonsManager=G4DNAGenericIonsManager::Instance();
|
||||
genericIonsManager->GetIon("alpha++");
|
||||
@@ -123,6 +178,34 @@ void PhysicsList::ConstructProcess()
|
||||
// tracking cut
|
||||
//
|
||||
AddTrackingCut();
|
||||
|
||||
// decay
|
||||
//
|
||||
|
||||
G4RadioactiveDecay* radioactiveDecay = new G4RadioactiveDecay();
|
||||
|
||||
G4bool ARMflag = true;
|
||||
radioactiveDecay->SetARM(ARMflag); //Atomic Rearangement
|
||||
|
||||
// need to initialize atomic deexcitation
|
||||
//
|
||||
G4LossTableManager* man = G4LossTableManager::Instance();
|
||||
G4VAtomDeexcitation* deex = man->AtomDeexcitation();
|
||||
if (!deex) {
|
||||
G4EmParameters::Instance()->SetAugerCascade(ARMflag);
|
||||
deex = new G4UAtomicDeexcitation();
|
||||
deex->InitialiseAtomicDeexcitation();
|
||||
man->SetAtomDeexcitation(deex);
|
||||
}
|
||||
|
||||
// register radioactiveDecay
|
||||
//
|
||||
G4PhysicsListHelper* ph = G4PhysicsListHelper::GetPhysicsListHelper();
|
||||
ph->RegisterProcess(radioactiveDecay, G4GenericIon::GenericIon());
|
||||
|
||||
//printout
|
||||
//
|
||||
G4cout << "\n Set atomic relaxation mode " << ARMflag << G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -205,3 +288,28 @@ void PhysicsList::AddTrackingCut()
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void PhysicsList::SetCuts()
|
||||
{
|
||||
|
||||
// SetCutsWithDefault();
|
||||
|
||||
// or
|
||||
|
||||
defaultCutValue = 1. * nm;
|
||||
SetCutValue(defaultCutValue, "gamma");
|
||||
SetCutValue(defaultCutValue, "e-");
|
||||
SetCutValue(defaultCutValue, "e+");
|
||||
|
||||
G4double lowLimit = 10. * eV;
|
||||
G4double highLimit = 100. * GeV;
|
||||
|
||||
G4ProductionCutsTable::GetProductionCutsTable()->SetEnergyRange(lowLimit,
|
||||
highLimit);
|
||||
|
||||
// print cuts
|
||||
if (verboseLevel>0) DumpCutValuesTable();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,13 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// This example is provided by the Geant4-DNA collaboration
|
||||
// Any report or published results obtained using the Geant4-DNA software
|
||||
// shall cite the following Geant4-DNA collaboration publications:
|
||||
// Med. Phys. 37 (2010) 4692-4708
|
||||
// Phys. Med. 31 (2015) 861-874
|
||||
// The Geant4-DNA web site is available at http://geant4-dna.org
|
||||
//
|
||||
/// \file medical/dna/svalue/src/PhysicsListMessenger.cc
|
||||
/// \brief Implementation of the PhysicsListMessenger class
|
||||
|
||||
|
||||
@@ -23,6 +23,13 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// This example is provided by the Geant4-DNA collaboration
|
||||
// Any report or published results obtained using the Geant4-DNA software
|
||||
// shall cite the following Geant4-DNA collaboration publications:
|
||||
// Med. Phys. 37 (2010) 4692-4708
|
||||
// Phys. Med. 31 (2015) 861-874
|
||||
// The Geant4-DNA web site is available at http://geant4-dna.org
|
||||
//
|
||||
/// \file medical/dna/svalue/src/PrimaryGeneratorAction.cc
|
||||
/// \brief Implementation of the PrimaryGeneratorAction class
|
||||
|
||||
@@ -64,19 +71,22 @@ PrimaryGeneratorAction::~PrimaryGeneratorAction()
|
||||
|
||||
void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
{
|
||||
G4double radius = fDetector->GetAbsorRadius();
|
||||
G4double thickness = fDetector->GetCytoThickness();
|
||||
G4double radius = fDetector->GetNuclRadius();
|
||||
|
||||
G4double rx=1*m;
|
||||
G4double ry=1*m;
|
||||
G4double rz=1*m;
|
||||
G4double myRadius = 0;
|
||||
|
||||
do
|
||||
{
|
||||
rx = (2*G4UniformRand()-1)*radius;
|
||||
ry = (2*G4UniformRand()-1)*radius;
|
||||
rz = (2*G4UniformRand()-1)*radius;
|
||||
rx = (2*G4UniformRand()-1)*(radius+thickness)*1.01;
|
||||
ry = (2*G4UniformRand()-1)*(radius+thickness)*1.01;
|
||||
rz = (2*G4UniformRand()-1)*(radius+thickness)*1.01;
|
||||
myRadius = std::sqrt(rx*rx+ry*ry+rz*rz);
|
||||
|
||||
} while (std::sqrt(rx*rx+ry*ry+rz*rz)>radius) ;
|
||||
} while (myRadius>radius+thickness || myRadius<radius) ;
|
||||
|
||||
fParticleGun->SetParticlePosition(G4ThreeVector(rx,ry,rz));
|
||||
fParticleGun->SetParticleMomentumDirection(G4RandomDirection());
|
||||
@@ -97,7 +107,7 @@ G4bool PrimaryGeneratorAction::Notify(G4ApplicationState requestedState)
|
||||
G4ParticleDefinition* particle
|
||||
= G4ParticleTable::GetParticleTable()->FindParticle("e-");
|
||||
fParticleGun->SetParticleDefinition(particle);
|
||||
fParticleGun->SetParticleEnergy(300*eV);
|
||||
fParticleGun->SetParticleEnergy(0*eV);
|
||||
fParticleGun->SetParticlePosition(G4ThreeVector());
|
||||
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(1,0,0));
|
||||
}
|
||||
|
||||
@@ -23,13 +23,26 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// This example is provided by the Geant4-DNA collaboration
|
||||
// Any report or published results obtained using the Geant4-DNA software
|
||||
// shall cite the following Geant4-DNA collaboration publications:
|
||||
// Med. Phys. 37 (2010) 4692-4708
|
||||
// Phys. Med. 31 (2015) 861-874
|
||||
// The Geant4-DNA web site is available at http://geant4-dna.org
|
||||
//
|
||||
/// \file medical/dna/svalue/src/Run.cc
|
||||
/// \brief Implementation of the Run class
|
||||
|
||||
#include "Run.hh"
|
||||
#include "DetectorConstruction.hh"
|
||||
#include "HistoManager.hh"
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
#include "MyFile.hh"
|
||||
|
||||
#ifdef MYFILE
|
||||
#include "MyPrimaryGeneratorActionFromFile.hh"
|
||||
#else
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
#endif
|
||||
|
||||
#include "G4Material.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
@@ -41,7 +54,8 @@ Run::Run(const DetectorConstruction* detector)
|
||||
: G4Run(),
|
||||
fDetector(detector),
|
||||
fParticle(0), fEkin(0.),
|
||||
fEdeposit(0.), fEdeposit2(0.),
|
||||
fCytoEdeposit(0.), fCytoEdeposit2(0.),
|
||||
fNuclEdeposit(0.), fNuclEdeposit2(0.),
|
||||
fTrackLen(0.), fTrackLen2(0.),
|
||||
fProjRange(0.), fProjRange2(0.),
|
||||
fNbOfSteps(0), fNbOfSteps2(0),
|
||||
@@ -63,10 +77,18 @@ void Run::SetPrimary (G4ParticleDefinition* particle, G4double energy)
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void Run::AddEdep (G4double e)
|
||||
void Run::AddCytoEdep (G4double e)
|
||||
{
|
||||
fEdeposit += e;
|
||||
fEdeposit2 += e*e;
|
||||
fCytoEdeposit += e;
|
||||
fCytoEdeposit2 += e*e;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void Run::AddNuclEdep (G4double e)
|
||||
{
|
||||
fNuclEdeposit += e;
|
||||
fNuclEdeposit2 += e*e;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -106,8 +128,12 @@ void Run::Merge(const G4Run* run)
|
||||
fEkin = localRun->fEkin;
|
||||
|
||||
// accumulate sums
|
||||
fEdeposit += localRun->fEdeposit;
|
||||
fEdeposit2 += localRun->fEdeposit2;
|
||||
|
||||
fCytoEdeposit += localRun->fCytoEdeposit;
|
||||
fCytoEdeposit2 += localRun->fCytoEdeposit2;
|
||||
fNuclEdeposit += localRun->fNuclEdeposit;
|
||||
fNuclEdeposit2 += localRun->fNuclEdeposit2;
|
||||
|
||||
fTrackLen += localRun->fTrackLen;
|
||||
fTrackLen2 += localRun->fTrackLen2;
|
||||
fProjRange += localRun->fProjRange;
|
||||
@@ -130,17 +156,12 @@ void Run::EndOfRun()
|
||||
|
||||
//run conditions
|
||||
//
|
||||
G4Material* material = fDetector->GetAbsorMaterial();
|
||||
G4double density = material->GetDensity();
|
||||
G4String partName = fParticle->GetParticleName();
|
||||
|
||||
G4cout << "\n ======================== run summary =====================\n";
|
||||
G4cout
|
||||
<< "\n The run is " << numberOfEvent << " "<< partName << " of "
|
||||
<< G4BestUnit(fEkin,"Energy") << " through a sphere of radius "
|
||||
<< G4BestUnit(fDetector->GetAbsorRadius(),"Length") << "of "
|
||||
<< material->GetName() << " (density: "
|
||||
<< G4BestUnit(density,"Volumic Mass") << ")" << G4endl;
|
||||
<< G4BestUnit(fEkin,"Energy") << G4endl;
|
||||
|
||||
if (numberOfEvent == 0) {
|
||||
G4cout.setf(mode,std::ios::floatfield);
|
||||
@@ -148,30 +169,54 @@ void Run::EndOfRun()
|
||||
return;
|
||||
}
|
||||
|
||||
fEdeposit /= numberOfEvent; fEdeposit2 /= numberOfEvent;
|
||||
G4double rms = fEdeposit2 - fEdeposit*fEdeposit;
|
||||
if (rms>0.) rms = std::sqrt(rms); else rms = 0.;
|
||||
//
|
||||
|
||||
fCytoEdeposit /= numberOfEvent; fCytoEdeposit2 /= numberOfEvent;
|
||||
G4double rmsCyto = fCytoEdeposit2 - fCytoEdeposit*fCytoEdeposit;
|
||||
if (rmsCyto>0.) rmsCyto = std::sqrt(rmsCyto); else rmsCyto = 0.;
|
||||
|
||||
G4cout.precision(3);
|
||||
G4cout
|
||||
<< "\n Total Energy deposited = " << G4BestUnit(fEdeposit,"Energy")
|
||||
<< " +- " << G4BestUnit( rms,"Energy")
|
||||
<< "\n Total Energy deposited in cytoplasm = " << G4BestUnit(fCytoEdeposit,"Energy")
|
||||
<< " +- " << G4BestUnit( rmsCyto,"Energy")
|
||||
<< G4endl;
|
||||
|
||||
G4double sValue=fEdeposit/fDetector->GetAbsorMass();
|
||||
G4double rmsSValue=rms/fDetector->GetAbsorMass();
|
||||
G4double sValueCyto=fCytoEdeposit/fDetector->GetCytoMass();
|
||||
G4double rmsSValueCyto=rmsCyto/fDetector->GetCytoMass();
|
||||
|
||||
G4cout.precision(3);
|
||||
G4cout
|
||||
<< "\n S value = " << sValue/gray << " Gy/Bq.s "
|
||||
<< " +- " << rmsSValue/gray
|
||||
<< "\n S value for cytoplasm (C<-C) = " << sValueCyto/gray << " Gy/Bq.s "
|
||||
<< " +- " << rmsSValueCyto/gray
|
||||
<< " Gy/Bq.s "
|
||||
<< G4endl;
|
||||
|
||||
//
|
||||
|
||||
fNuclEdeposit /= numberOfEvent; fNuclEdeposit2 /= numberOfEvent;
|
||||
G4double rmsNucl = fNuclEdeposit2 - fNuclEdeposit*fNuclEdeposit;
|
||||
if (rmsNucl>0.) rmsNucl = std::sqrt(rmsNucl); else rmsNucl = 0.;
|
||||
|
||||
G4cout.precision(3);
|
||||
G4cout
|
||||
<< "\n Total Energy deposited in nucleus = " << G4BestUnit(fNuclEdeposit,"Energy")
|
||||
<< " +- " << G4BestUnit( rmsNucl,"Energy")
|
||||
<< G4endl;
|
||||
|
||||
G4double sValueNucl=fNuclEdeposit/fDetector->GetNuclMass();
|
||||
G4double rmsSValueNucl=rmsNucl/fDetector->GetNuclMass();
|
||||
|
||||
G4cout.precision(3);
|
||||
G4cout
|
||||
<< "\n S value for nucleus (N<-C) = " << sValueNucl/gray << " Gy/Bq.s "
|
||||
<< " +- " << rmsSValueNucl/gray
|
||||
<< " Gy/Bq.s "
|
||||
<< G4endl;
|
||||
|
||||
//compute track length of primary track
|
||||
//
|
||||
fTrackLen /= numberOfEvent; fTrackLen2 /= numberOfEvent;
|
||||
rms = fTrackLen2 - fTrackLen*fTrackLen;
|
||||
G4double rms = fTrackLen2 - fTrackLen*fTrackLen;
|
||||
if (rms>0.) rms = std::sqrt(rms); else rms = 0.;
|
||||
|
||||
G4cout.precision(3);
|
||||
@@ -227,8 +272,15 @@ void Run::EndOfRun()
|
||||
//output file
|
||||
FILE *myFile;
|
||||
myFile = fopen ("s.txt","a");
|
||||
fprintf (myFile, "%e %e %e %e \n", fDetector->GetAbsorRadius()/nm,fEkin/eV,
|
||||
sValue/gray, rmsSValue/gray );
|
||||
fprintf (myFile, "%e %e %e %e %e %e %e \n",
|
||||
fDetector->GetNuclRadius()/nm,
|
||||
fDetector->GetCytoThickness()/nm,
|
||||
fEkin/eV,
|
||||
sValueCyto/gray,
|
||||
rmsSValueCyto/gray,
|
||||
sValueNucl/gray,
|
||||
rmsSValueNucl/gray
|
||||
);
|
||||
fclose (myFile);
|
||||
|
||||
}
|
||||
|
||||
@@ -23,15 +23,28 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// This example is provided by the Geant4-DNA collaboration
|
||||
// Any report or published results obtained using the Geant4-DNA software
|
||||
// shall cite the following Geant4-DNA collaboration publications:
|
||||
// Med. Phys. 37 (2010) 4692-4708
|
||||
// Phys. Med. 31 (2015) 861-874
|
||||
// The Geant4-DNA web site is available at http://geant4-dna.org
|
||||
//
|
||||
/// \file medical/dna/svalue/src/RunAction.cc
|
||||
/// \brief Implementation of the RunAction class
|
||||
|
||||
#include "RunAction.hh"
|
||||
#include "DetectorConstruction.hh"
|
||||
#include "PhysicsList.hh"
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
#include "Run.hh"
|
||||
#include "HistoManager.hh"
|
||||
#include "MyFile.hh"
|
||||
|
||||
#ifdef MYFILE
|
||||
#include "MyPrimaryGeneratorActionFromFile.hh"
|
||||
#else
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
#endif
|
||||
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4EmCalculator.hh"
|
||||
@@ -83,10 +96,20 @@ void RunAction::BeginOfRunAction(const G4Run*)
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
const PrimaryGeneratorAction* primary =
|
||||
|
||||
#ifdef MYFILE
|
||||
|
||||
const MyPrimaryGeneratorActionFromFile* primary =
|
||||
dynamic_cast<const MyPrimaryGeneratorActionFromFile*>(G4RunManager::GetRunManager()
|
||||
->GetUserPrimaryGeneratorAction());
|
||||
|
||||
#else
|
||||
const PrimaryGeneratorAction* primary =
|
||||
dynamic_cast<const PrimaryGeneratorAction*>(G4RunManager::GetRunManager()
|
||||
->GetUserPrimaryGeneratorAction());
|
||||
|
||||
#endif
|
||||
|
||||
if (!primary) return; //
|
||||
|
||||
// keep run condition
|
||||
|
||||
@@ -23,21 +23,30 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// This example is provided by the Geant4-DNA collaboration
|
||||
// Any report or published results obtained using the Geant4-DNA software
|
||||
// shall cite the following Geant4-DNA collaboration publications:
|
||||
// Med. Phys. 37 (2010) 4692-4708
|
||||
// Phys. Med. 31 (2015) 861-874
|
||||
// The Geant4-DNA web site is available at http://geant4-dna.org
|
||||
//
|
||||
/// \file medical/dna/svalue/src/SteppingAction.cc
|
||||
/// \brief Implementation of the SteppingAction class
|
||||
|
||||
#include "SteppingAction.hh"
|
||||
#include "Run.hh"
|
||||
#include "EventAction.hh"
|
||||
#include "DetectorConstruction.hh"
|
||||
#include "HistoManager.hh"
|
||||
|
||||
#include "G4RunManager.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
SteppingAction::SteppingAction(EventAction* event)
|
||||
SteppingAction::SteppingAction(EventAction* event, DetectorConstruction* detector)
|
||||
:G4UserSteppingAction(),
|
||||
fEventAction(event)
|
||||
fEventAction(event),
|
||||
fDetectorConstruction(detector)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -52,9 +61,15 @@ void SteppingAction::UserSteppingAction(const G4Step* aStep)
|
||||
G4double edep = aStep->GetTotalEnergyDeposit();
|
||||
if (edep <= 0.) return;
|
||||
|
||||
//total energy deposit in absorber
|
||||
//total energy deposit in cytoplasm or nucleus
|
||||
//
|
||||
fEventAction->AddEdep(edep);
|
||||
if (aStep->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume()
|
||||
==fDetectorConstruction->GetCytoLogicalVolume()) fEventAction->AddCytoEdep(edep);
|
||||
|
||||
if (aStep->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume()
|
||||
==fDetectorConstruction->GetNuclLogicalVolume()) fEventAction->AddNuclEdep(edep);
|
||||
|
||||
//G4cout << edep << G4endl;
|
||||
|
||||
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
|
||||
|
||||
@@ -62,7 +77,7 @@ void SteppingAction::UserSteppingAction(const G4Step* aStep)
|
||||
//
|
||||
G4double steplen = aStep->GetStepLength();
|
||||
const G4Track* track = aStep->GetTrack();
|
||||
if (track->GetTrackID() == 1) analysisManager->FillH1(4, steplen);
|
||||
if (track->GetTrackID() == 1) analysisManager->FillH1(8, steplen);
|
||||
else if (track->GetDefinition()->GetPDGCharge() != 0.)
|
||||
analysisManager->FillH1(7, steplen);
|
||||
analysisManager->FillH1(9, steplen);
|
||||
}
|
||||
|
||||
@@ -23,6 +23,13 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// This example is provided by the Geant4-DNA collaboration
|
||||
// Any report or published results obtained using the Geant4-DNA software
|
||||
// shall cite the following Geant4-DNA collaboration publications:
|
||||
// Med. Phys. 37 (2010) 4692-4708
|
||||
// Phys. Med. 31 (2015) 861-874
|
||||
// The Geant4-DNA web site is available at http://geant4-dna.org
|
||||
//
|
||||
/// \file medical/dna/svalue/src/SteppingVerbose.cc
|
||||
/// \brief Implementation of the SteppingVerbose class
|
||||
|
||||
|
||||
@@ -23,23 +23,69 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// This example is provided by the Geant4-DNA collaboration
|
||||
// Any report or published results obtained using the Geant4-DNA software
|
||||
// shall cite the following Geant4-DNA collaboration publications:
|
||||
// Med. Phys. 37 (2010) 4692-4708
|
||||
// Phys. Med. 31 (2015) 861-874
|
||||
// The Geant4-DNA web site is available at http://geant4-dna.org
|
||||
//
|
||||
/// \file medical/dna/svalue/src/TrackingAction.cc
|
||||
/// \brief Implementation of the TrackingAction class
|
||||
|
||||
#include "TrackingAction.hh"
|
||||
#include "Run.hh"
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
#include "HistoManager.hh"
|
||||
#include "MyFile.hh"
|
||||
|
||||
#ifdef MYFILE
|
||||
#include "MyPrimaryGeneratorActionFromFile.hh"
|
||||
#else
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
#endif
|
||||
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4Gamma.hh"
|
||||
#include "G4Electron.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
|
||||
#ifdef MYFILE
|
||||
|
||||
TrackingAction::TrackingAction(MyPrimaryGeneratorActionFromFile* prim)
|
||||
:G4UserTrackingAction(),
|
||||
fPrimary(prim)
|
||||
{}
|
||||
|
||||
#else
|
||||
|
||||
TrackingAction::TrackingAction(PrimaryGeneratorAction* prim)
|
||||
:G4UserTrackingAction(),
|
||||
fPrimary(prim)
|
||||
{}
|
||||
|
||||
#endif
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void TrackingAction::PreUserTrackingAction(const G4Track* aTrack )
|
||||
{
|
||||
// histograms (useful for radionuclide spectrum, if set is vacuum)
|
||||
//
|
||||
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
|
||||
if (aTrack->GetDefinition()==G4Electron::ElectronDefinition())
|
||||
{
|
||||
analysisManager->FillH1(0, aTrack->GetKineticEnergy());
|
||||
analysisManager->FillH1(1, aTrack->GetKineticEnergy());
|
||||
}
|
||||
if (aTrack->GetDefinition()==G4Gamma::GammaDefinition())
|
||||
{
|
||||
analysisManager->FillH1(2, aTrack->GetKineticEnergy());
|
||||
analysisManager->FillH1(3, aTrack->GetKineticEnergy());
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void TrackingAction::PostUserTrackingAction(const G4Track* track)
|
||||
@@ -58,9 +104,9 @@ void TrackingAction::PostUserTrackingAction(const G4Track* track)
|
||||
G4double tracklen = track->GetTrackLength();
|
||||
if (trackID == 1) {
|
||||
run->AddTrackLength(tracklen);
|
||||
analysisManager->FillH1(3, tracklen);
|
||||
analysisManager->FillH1(7, tracklen);
|
||||
} else if (track->GetDefinition()->GetPDGCharge() != 0.)
|
||||
analysisManager->FillH1(6, tracklen);
|
||||
analysisManager->FillH1(10, tracklen);
|
||||
|
||||
//extract projected range of primary particle
|
||||
//
|
||||
@@ -68,7 +114,7 @@ void TrackingAction::PostUserTrackingAction(const G4Track* track)
|
||||
G4double pr = (track->GetPosition())*
|
||||
(fPrimary->GetParticleGun()->GetParticleMomentumDirection());
|
||||
run->AddProjRange(pr);
|
||||
analysisManager->FillH1(5, pr);
|
||||
analysisManager->FillH1(9, pr);
|
||||
}
|
||||
|
||||
//mean step size of primary particle
|
||||
|
||||
Reference in New Issue
Block a user