Import Geant4 10.0.0 source tree
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: S. Guatelli, susanna@uow.edu.au
|
||||
//
|
||||
#include "BrachyActionInitialization.hh"
|
||||
#include "BrachyPrimaryGeneratorAction.hh"
|
||||
#include "BrachySteppingAction.hh"
|
||||
#include "G4RunManager.hh"
|
||||
|
||||
BrachyActionInitialization::BrachyActionInitialization(BrachyAnalysisManager* analysis_manager):
|
||||
G4VUserActionInitialization()
|
||||
{
|
||||
analysis = analysis_manager;
|
||||
}
|
||||
|
||||
|
||||
BrachyActionInitialization::~BrachyActionInitialization()
|
||||
{}
|
||||
|
||||
void BrachyActionInitialization::BuildForMaster() const
|
||||
{
|
||||
// In MT mode, to be clearer, the RunAction class for the master thread might be
|
||||
// different than the one used for the workers.
|
||||
// This RunAction will be called before and after starting the
|
||||
// workers.
|
||||
}
|
||||
|
||||
|
||||
void BrachyActionInitialization::Build() const
|
||||
{
|
||||
// Initialize the primary particles
|
||||
BrachyPrimaryGeneratorAction* primary = new BrachyPrimaryGeneratorAction(analysis);
|
||||
SetUserAction(primary);
|
||||
|
||||
BrachySteppingAction* stepping = new BrachySteppingAction(analysis);
|
||||
SetUserAction(stepping);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,147 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: Susanna Guatelli
|
||||
*/
|
||||
// The class BrachyAnalysisManager creates and manages histograms and ntuples
|
||||
|
||||
// The analysis was included in this application following the extended Geant4
|
||||
// example analysis/AnaEx01
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "BrachyAnalysisManager.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
BrachyAnalysisManager::BrachyAnalysisManager()
|
||||
{
|
||||
|
||||
factoryOn = false;
|
||||
|
||||
// Initialization
|
||||
// histograms
|
||||
for (G4int k=0; k<MaxHisto; k++) fHistId[k] = 0;
|
||||
|
||||
// Initialization ntuple
|
||||
for (G4int k=0; k<MaxNtCol; k++) {
|
||||
fNtColId[k] = 0;
|
||||
}
|
||||
|
||||
primaryParticleSpectrum = 0;
|
||||
|
||||
}
|
||||
|
||||
BrachyAnalysisManager::~BrachyAnalysisManager()
|
||||
{
|
||||
}
|
||||
|
||||
void BrachyAnalysisManager::book()
|
||||
{
|
||||
G4AnalysisManager* AnalysisManager = G4AnalysisManager::Instance();
|
||||
|
||||
AnalysisManager->SetVerboseLevel(2);
|
||||
|
||||
// Create a root file
|
||||
G4String fileName = "brachytherapy.root";
|
||||
|
||||
// Create directories
|
||||
AnalysisManager->SetHistoDirectoryName("brachy_histo");
|
||||
AnalysisManager->SetNtupleDirectoryName("brachy_ntuple");
|
||||
|
||||
|
||||
G4bool fileOpen = AnalysisManager->OpenFile(fileName);
|
||||
if (!fileOpen) {
|
||||
G4cout << "\n---> HistoManager::book(): cannot open "
|
||||
<< fileName[1]
|
||||
<< G4endl;
|
||||
return;
|
||||
}
|
||||
|
||||
//creating a 1D histograms
|
||||
AnalysisManager->SetFirstHistoId(1);
|
||||
|
||||
// Histogram containing the primary particle energy (MeV)
|
||||
fHistId[1] = AnalysisManager -> CreateH1("1",
|
||||
"Initial energy",
|
||||
1000, 0., 1000.);
|
||||
|
||||
//Parameters of CreateH1: histoID, histo name, bins' number, xmin, xmax
|
||||
|
||||
primaryParticleSpectrum = AnalysisManager-> GetH1(fHistId[1]);
|
||||
|
||||
//creating a ntuple, containg 3D energy deposition in the phantom
|
||||
AnalysisManager -> CreateNtuple("1", "3Dedep");
|
||||
fNtColId[0] = AnalysisManager->CreateNtupleDColumn("xx");
|
||||
fNtColId[1] = AnalysisManager->CreateNtupleDColumn("yy");
|
||||
fNtColId[2] = AnalysisManager->CreateNtupleDColumn("zz");
|
||||
fNtColId[3] = AnalysisManager->CreateNtupleDColumn("edep");
|
||||
AnalysisManager->FinishNtuple();
|
||||
|
||||
factoryOn = true;
|
||||
}
|
||||
|
||||
void BrachyAnalysisManager::FillPrimaryParticleHistogram(G4double primaryParticleEnergy)
|
||||
{
|
||||
// 1DHistogram: energy spectrum of primary particles
|
||||
primaryParticleSpectrum -> fill(primaryParticleEnergy);
|
||||
}
|
||||
|
||||
void BrachyAnalysisManager::FillNtupleWithEnergyDeposition(G4double xx,
|
||||
G4double yy,
|
||||
G4double zz,
|
||||
G4double energyDep)
|
||||
{
|
||||
G4AnalysisManager* AnalysisManager = G4AnalysisManager::Instance();
|
||||
AnalysisManager->FillNtupleDColumn(fNtColId[0], xx);
|
||||
AnalysisManager->FillNtupleDColumn(fNtColId[1], yy);
|
||||
AnalysisManager->FillNtupleDColumn(fNtColId[2], zz);
|
||||
AnalysisManager->FillNtupleDColumn(fNtColId[3], energyDep);
|
||||
AnalysisManager->AddNtupleRow();
|
||||
}
|
||||
|
||||
void BrachyAnalysisManager::save()
|
||||
{
|
||||
if (factoryOn)
|
||||
{
|
||||
G4AnalysisManager* AnalysisManager = G4AnalysisManager::Instance();
|
||||
AnalysisManager->Write();
|
||||
AnalysisManager->CloseFile();
|
||||
|
||||
delete G4AnalysisManager::Instance();
|
||||
factoryOn = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -59,32 +59,32 @@
|
||||
#include "BrachyDetectorMessenger.hh"
|
||||
#include "BrachyDetectorConstruction.hh"
|
||||
|
||||
BrachyDetectorConstruction::BrachyDetectorConstruction()
|
||||
: detectorChoice(0), factory(0),
|
||||
BrachyDetectorConstruction::BrachyDetectorConstruction():
|
||||
detectorChoice(0), factory(0),
|
||||
World(0), WorldLog(0), WorldPhys(0),
|
||||
Phantom(0), PhantomLog(0), PhantomPhys(0),
|
||||
phantomAbsorberMaterial(0)
|
||||
{
|
||||
// Define half size of the phantom along the x, y, z axis
|
||||
phantomSizeX = 15.*cm ;
|
||||
phantomSizeY = 15.*cm;
|
||||
phantomSizeZ = 15.*cm;
|
||||
|
||||
// Define the sizes of the World volume containing the phantom
|
||||
worldSizeX = 4.0*m;
|
||||
worldSizeY = 4.0*m;
|
||||
worldSizeZ = 4.0*m;
|
||||
// Define half size of the phantom along the x, y, z axis
|
||||
phantomSizeX = 15.*cm;
|
||||
phantomSizeY = 15.*cm;
|
||||
phantomSizeZ = 15.*cm;
|
||||
|
||||
// Define the sizes of the World volume containing the phantom
|
||||
worldSizeX = 4.0*m;
|
||||
worldSizeY = 4.0*m;
|
||||
worldSizeZ = 4.0*m;
|
||||
|
||||
// Define the messenger of the Detector component
|
||||
// It is possible to modify geometrical parameters through UI
|
||||
detectorMessenger = new BrachyDetectorMessenger(this);
|
||||
// Define the messenger of the Detector component
|
||||
// It is possible to modify geometrical parameters through UI
|
||||
detectorMessenger = new BrachyDetectorMessenger(this);
|
||||
|
||||
// Define the Iridium source as default source modelled in the geometry
|
||||
factory = new BrachyFactoryIr();
|
||||
factory = new BrachyFactoryIr();
|
||||
|
||||
// BrachyMaterial defined the all the materials necessary
|
||||
// for the experimental set-up
|
||||
pMaterial = new BrachyMaterial();
|
||||
pMaterial = new BrachyMaterial();
|
||||
}
|
||||
|
||||
BrachyDetectorConstruction::~BrachyDetectorConstruction()
|
||||
@@ -96,88 +96,78 @@ BrachyDetectorConstruction::~BrachyDetectorConstruction()
|
||||
|
||||
G4VPhysicalVolume* BrachyDetectorConstruction::Construct()
|
||||
{
|
||||
pMaterial -> DefineMaterials();
|
||||
|
||||
// Model the phantom (water box)
|
||||
ConstructPhantom();
|
||||
pMaterial -> DefineMaterials();
|
||||
|
||||
// Model the source in the phantom
|
||||
factory -> CreateSource(PhantomPhys);
|
||||
// Model the phantom (water box)
|
||||
ConstructPhantom();
|
||||
|
||||
return WorldPhys;
|
||||
// Model the source in the phantom
|
||||
factory -> CreateSource(PhantomPhys);
|
||||
|
||||
return WorldPhys;
|
||||
}
|
||||
|
||||
void BrachyDetectorConstruction::SwitchBrachytherapicSeed()
|
||||
{
|
||||
// Change the source in the water phantom
|
||||
factory -> CleanSource();
|
||||
G4cout << "Old Source is deleted ..." << G4endl;
|
||||
delete factory;
|
||||
|
||||
switch(detectorChoice)
|
||||
{
|
||||
case 1:
|
||||
case 1:
|
||||
factory = new BrachyFactoryI();
|
||||
break;
|
||||
case 2:
|
||||
case 2:
|
||||
factory = new BrachyFactoryLeipzig();
|
||||
break;
|
||||
case 3:
|
||||
factory = new BrachyFactoryIr();
|
||||
break;
|
||||
default:
|
||||
case 3:
|
||||
factory = new BrachyFactoryIr();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
factory = new BrachyFactoryIr();
|
||||
break;
|
||||
}
|
||||
|
||||
factory -> CreateSource(PhantomPhys);
|
||||
G4cout << "... New source is created ..." << G4endl;
|
||||
|
||||
// Notify run manager that the new geometry has been built
|
||||
G4RunManager::GetRunManager() -> DefineWorldVolume( WorldPhys );
|
||||
G4RunManager::GetRunManager() -> GeometryHasBeenModified();
|
||||
G4cout << "... Geometry is notified .... THAT'S IT!!!!!" << G4endl;
|
||||
}
|
||||
|
||||
void BrachyDetectorConstruction::SelectBrachytherapicSeed(G4String val)
|
||||
{
|
||||
if(val == "Iodium")
|
||||
{
|
||||
detectorChoice = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(val=="Leipzig")
|
||||
{
|
||||
detectorChoice = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(val=="Iridium")
|
||||
{
|
||||
detectorChoice = 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
G4cout << "Now the source is " << val << G4endl;
|
||||
if (val == "Iodium") detectorChoice = 1;
|
||||
else{
|
||||
if(val=="Leipzig") detectorChoice = 2;
|
||||
else{
|
||||
if(val=="Iridium") detectorChoice = 3;
|
||||
else G4cout << val << "is not available!!!!" <<G4endl;
|
||||
}
|
||||
}
|
||||
G4cout << "Now the source is " << val << G4endl;
|
||||
}
|
||||
|
||||
void BrachyDetectorConstruction::ConstructPhantom()
|
||||
{
|
||||
// Model the water phantom
|
||||
|
||||
|
||||
// Define the light blue color
|
||||
G4Colour lblue (0.0, 0.0, .75);
|
||||
|
||||
|
||||
G4Material* air = pMaterial -> GetMat("Air") ;
|
||||
G4Material* water = pMaterial -> GetMat("Water");
|
||||
|
||||
// World volume
|
||||
World = new G4Box("World",worldSizeX,worldSizeY,worldSizeZ);
|
||||
WorldLog = new G4LogicalVolume(World,air,"WorldLog",0,0,0);
|
||||
WorldPhys = new G4PVPlacement(0,G4ThreeVector(),
|
||||
"WorldPhys",WorldLog,0,false,0);
|
||||
WorldPhys = new G4PVPlacement(0,G4ThreeVector(),"WorldPhys",WorldLog,0,false,0);
|
||||
|
||||
// Water Box
|
||||
Phantom = new G4Box("Phantom",phantomSizeX,phantomSizeY,
|
||||
phantomSizeZ);
|
||||
Phantom = new G4Box("Phantom",phantomSizeX,phantomSizeY,phantomSizeZ);
|
||||
|
||||
// Logical volume
|
||||
PhantomLog = new G4LogicalVolume(Phantom,water,"PhantomLog",0,0,0);
|
||||
@@ -185,10 +175,9 @@ void BrachyDetectorConstruction::ConstructPhantom()
|
||||
// Physical volume
|
||||
PhantomPhys = new G4PVPlacement(0,G4ThreeVector(), // Position: rotation and translation
|
||||
"PhantomPhys", // Name
|
||||
PhantomLog, // Associated logical volume
|
||||
PhantomLog, // Associated logical volume
|
||||
WorldPhys, // Mother volume
|
||||
false,0);
|
||||
|
||||
false,0);
|
||||
WorldLog -> SetVisAttributes (G4VisAttributes::Invisible);
|
||||
|
||||
// Visualization attributes of the phantom
|
||||
@@ -198,11 +187,9 @@ void BrachyDetectorConstruction::ConstructPhantom()
|
||||
PhantomLog -> SetVisAttributes(simpleBoxVisAtt);
|
||||
}
|
||||
|
||||
|
||||
void BrachyDetectorConstruction::PrintDetectorParameters()
|
||||
{
|
||||
G4cout << "-----------------------------------------------------------------------"
|
||||
<< G4endl
|
||||
G4cout << "----------------" << G4endl
|
||||
<< "the phantom is a water box whose size is: " << G4endl
|
||||
<< phantomSizeX *2./cm
|
||||
<< " cm * "
|
||||
@@ -213,7 +200,7 @@ void BrachyDetectorConstruction::PrintDetectorParameters()
|
||||
<< "The phantom is made of "
|
||||
<< phantomAbsorberMaterial -> GetName() <<G4endl
|
||||
<< "the source is at the center of the phantom" << G4endl
|
||||
<< "-------------------------------------------------------------------------"
|
||||
<< "----------------"
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
@@ -222,15 +209,14 @@ void BrachyDetectorConstruction::SetPhantomMaterial(G4String materialChoice)
|
||||
// It is possible to change the material of the phantom
|
||||
// interactively
|
||||
|
||||
// Search the material by its name
|
||||
G4Material* pttoMaterial = G4Material::GetMaterial(materialChoice);
|
||||
// Search the material by its name
|
||||
G4Material* pttoMaterial = G4Material::GetMaterial(materialChoice);
|
||||
|
||||
if (pttoMaterial)
|
||||
{
|
||||
phantomAbsorberMaterial = pttoMaterial;
|
||||
PhantomLog -> SetMaterial(pttoMaterial);
|
||||
PhantomLog -> SetMaterial(pttoMaterial);
|
||||
PrintDetectorParameters();
|
||||
}
|
||||
else
|
||||
G4cout << "WARNING: material '" << materialChoice
|
||||
<< "' not available!" << G4endl;
|
||||
} else
|
||||
{ G4cout << "WARNING: material '" << materialChoice << "' not available!" << G4endl;}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
// * *
|
||||
// ****************************************
|
||||
//
|
||||
// $Id$
|
||||
// $Id: BrachyDetectorConstructionI.cc 69765 2013-05-14 10:11:22Z gcosmo $
|
||||
//
|
||||
#include "globals.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
@@ -58,7 +58,10 @@
|
||||
#include "G4Colour.hh"
|
||||
|
||||
BrachyDetectorConstructionI::BrachyDetectorConstructionI():
|
||||
capsulePhys(0),capsuleTipPhys1(0),capsuleTipPhys2(0), iodiumCorePhys(0),markerPhys(0)
|
||||
defaultTub(0), capsule(0), capsuleTip(0),iodiumCore(0), defaultTubLog(0),
|
||||
capsuleLog(0), capsuleTipLog(0), iodiumCoreLog(0),defaultTubPhys(0),
|
||||
capsulePhys(0),capsuleTipPhys1(0),capsuleTipPhys2(0), iodiumCorePhys(0),
|
||||
simpleiodiumVisAtt(0), simpleCapsuleVisAtt(0), simpleCapsuleTipVisAtt(0)
|
||||
{
|
||||
pMaterial = new BrachyMaterial();
|
||||
}
|
||||
@@ -76,98 +79,106 @@ void BrachyDetectorConstructionI::ConstructIodium(G4VPhysicalVolume* mother)
|
||||
G4Material* titanium = pMaterial -> GetMat("titanium");
|
||||
G4Material* air = pMaterial -> GetMat("Air");
|
||||
G4Material* iodium = pMaterial -> GetMat("Iodium");
|
||||
G4Material* gold = pMaterial -> GetMat("gold");
|
||||
|
||||
|
||||
G4Colour red (1.0, 0.0, 0.0) ;
|
||||
G4Colour magenta (1.0, 0.0, 1.0) ;
|
||||
G4Colour lblue (0.0, 0.0, .75);
|
||||
|
||||
// Air tub
|
||||
G4Tubs* defaultTub = new G4Tubs("DefaultTub",0.*mm, 0.40*mm, 1.84*mm, 0.*deg, 360.*deg);
|
||||
G4LogicalVolume* defaultTubLog = new G4LogicalVolume(defaultTub,air,"DefaultTub_Log");
|
||||
G4VPhysicalVolume* defaultTubPhys = new G4PVPlacement(0,
|
||||
defaultTub = new G4Tubs("DefaultTub",0.*mm, 0.40*mm, 1.84*mm, 0.*deg, 360.*deg);
|
||||
defaultTubLog = new G4LogicalVolume(defaultTub,air,"DefaultTub_Log");
|
||||
defaultTubPhys = new G4PVPlacement(0,
|
||||
G4ThreeVector(),
|
||||
"defaultTub_Phys",
|
||||
defaultTubLog,
|
||||
mother,
|
||||
false,
|
||||
0);
|
||||
0, true);
|
||||
// Capsule main body ...
|
||||
G4double capsuleR = 0.35*mm;
|
||||
G4Tubs* capsule = new G4Tubs("Capsule", capsuleR,0.40*mm,1.84*mm,0.*deg,360.*deg);
|
||||
G4LogicalVolume* capsuleLog = new G4LogicalVolume(capsule,titanium,"CapsuleLog");
|
||||
capsule = new G4Tubs("Capsule", capsuleR,0.40*mm,1.84*mm,0.*deg,360.*deg);
|
||||
capsuleLog = new G4LogicalVolume(capsule,titanium,"CapsuleLog");
|
||||
capsulePhys = new G4PVPlacement(0,
|
||||
G4ThreeVector(),
|
||||
"CapsulePhys",
|
||||
capsuleLog,
|
||||
defaultTubPhys,
|
||||
false,
|
||||
0);
|
||||
0, true);
|
||||
// Capsule tips
|
||||
G4Sphere* capsuleTip = new G4Sphere("CapsuleTip",
|
||||
capsuleTip = new G4Sphere("CapsuleTip",
|
||||
0.*mm,
|
||||
0.40*mm,
|
||||
0.*deg,
|
||||
360.*deg,
|
||||
0.*deg,
|
||||
90.*deg);
|
||||
G4LogicalVolume* capsuleTipLog = new G4LogicalVolume(capsuleTip,titanium,"CapsuleTipLog");
|
||||
capsuleTipLog = new G4LogicalVolume(capsuleTip,titanium,"CapsuleTipLog");
|
||||
capsuleTipPhys1 = new G4PVPlacement(0,
|
||||
G4ThreeVector(0.,0.,1.84*mm),
|
||||
"CapsuleTipPhys1",
|
||||
"IodineCapsuleTipPhys1",
|
||||
capsuleTipLog,
|
||||
mother,
|
||||
false,
|
||||
0);
|
||||
0, true);
|
||||
|
||||
G4RotationMatrix* rotateMatrix = new G4RotationMatrix();
|
||||
rotateMatrix -> rotateX(180.0*deg);
|
||||
capsuleTipPhys2 = new G4PVPlacement(rotateMatrix,
|
||||
G4ThreeVector(0,0,-1.84*mm),
|
||||
"CapsuleTipPhys2",
|
||||
"IodineCapsuleTipPhys2",
|
||||
capsuleTipLog,
|
||||
mother,
|
||||
false,
|
||||
0);
|
||||
0, true);
|
||||
|
||||
// Radiactive core ...
|
||||
G4Tubs* iodiumCore = new G4Tubs("ICore",0.085*mm,0.35*mm,1.75*mm,0.*deg,360.*deg);
|
||||
G4LogicalVolume* iodiumCoreLog = new G4LogicalVolume(iodiumCore,iodium,"iodiumCoreLog");
|
||||
iodiumCore = new G4Tubs("ICore",0.085*mm,0.35*mm,1.75*mm,0.*deg,360.*deg);
|
||||
iodiumCoreLog = new G4LogicalVolume(iodiumCore,iodium,"iodiumCoreLog");
|
||||
iodiumCorePhys = new G4PVPlacement(0,
|
||||
G4ThreeVector(0.,0.,0.),
|
||||
"iodiumCorePhys",
|
||||
iodiumCoreLog,
|
||||
defaultTubPhys,
|
||||
false,
|
||||
0);
|
||||
// Golden marker
|
||||
G4Tubs* marker = new G4Tubs("GoldenMarker",0.*mm,0.085*mm,1.75*mm,0.*deg,360.*deg);
|
||||
G4LogicalVolume* markerLog = new G4LogicalVolume(marker,gold,"MarkerLog");
|
||||
markerPhys = new G4PVPlacement(0,
|
||||
G4ThreeVector(0.,0.,0.),
|
||||
"MarkerPhys",
|
||||
markerLog,
|
||||
defaultTubPhys,
|
||||
false,
|
||||
0);
|
||||
0, true);
|
||||
|
||||
// Visual attributes ...
|
||||
G4VisAttributes* simpleMarkerVisAtt= new G4VisAttributes(lblue);
|
||||
simpleMarkerVisAtt -> SetVisibility(true);
|
||||
simpleMarkerVisAtt -> SetForceSolid(true);
|
||||
markerLog -> SetVisAttributes( simpleMarkerVisAtt);
|
||||
|
||||
G4VisAttributes* simpleiodiumVisAtt= new G4VisAttributes(magenta);
|
||||
|
||||
simpleiodiumVisAtt= new G4VisAttributes(magenta);
|
||||
simpleiodiumVisAtt -> SetVisibility(true);
|
||||
simpleiodiumVisAtt -> SetForceWireframe(true);
|
||||
simpleiodiumVisAtt -> SetForceSolid(true);
|
||||
iodiumCoreLog -> SetVisAttributes(simpleiodiumVisAtt);
|
||||
|
||||
G4VisAttributes* simpleCapsuleVisAtt= new G4VisAttributes(red);
|
||||
simpleCapsuleVisAtt= new G4VisAttributes(red);
|
||||
simpleCapsuleVisAtt -> SetVisibility(true);
|
||||
simpleCapsuleVisAtt -> SetForceWireframe(true);
|
||||
capsuleLog -> SetVisAttributes( simpleCapsuleVisAtt);
|
||||
|
||||
G4VisAttributes* simpleCapsuleTipVisAtt= new G4VisAttributes(red);
|
||||
simpleCapsuleTipVisAtt= new G4VisAttributes(red);
|
||||
simpleCapsuleTipVisAtt -> SetVisibility(true);
|
||||
simpleCapsuleTipVisAtt -> SetForceSolid(true);
|
||||
capsuleTipLog -> SetVisAttributes( simpleCapsuleTipVisAtt);
|
||||
}
|
||||
|
||||
void BrachyDetectorConstructionI::CleanIodium()
|
||||
{
|
||||
delete simpleiodiumVisAtt; simpleiodiumVisAtt = 0;
|
||||
delete simpleCapsuleVisAtt; simpleCapsuleVisAtt = 0;
|
||||
delete simpleCapsuleTipVisAtt; simpleCapsuleTipVisAtt = 0;
|
||||
delete capsuleTipPhys1; capsuleTipPhys1 = 0;
|
||||
delete capsuleTipPhys2; capsuleTipPhys2 = 0;
|
||||
delete iodiumCorePhys; iodiumCorePhys = 0;
|
||||
delete capsulePhys; capsulePhys = 0;
|
||||
delete defaultTubPhys; defaultTubPhys = 0;
|
||||
delete defaultTubLog; defaultTubLog = 0;
|
||||
delete capsuleLog; capsuleLog = 0;
|
||||
delete capsuleTipLog; capsuleTipLog = 0;
|
||||
delete iodiumCoreLog; iodiumCoreLog = 0;
|
||||
delete defaultTub; defaultTub = 0;
|
||||
delete capsule; capsule = 0;
|
||||
delete capsuleTip; capsuleTip = 0;
|
||||
delete iodiumCore; iodiumCore = 0;
|
||||
|
||||
G4RunManager::GetRunManager() -> GeometryHasBeenModified();
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
// * *
|
||||
// ****************************************
|
||||
//
|
||||
// $Id$
|
||||
// $Id: BrachyDetectorConstructionIr.cc 69765 2013-05-14 10:11:22Z gcosmo $
|
||||
//
|
||||
#include "globals.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
@@ -87,11 +87,11 @@ void BrachyDetectorConstructionIr::ConstructIridium(G4VPhysicalVolume* mother)
|
||||
capsuleLog = new G4LogicalVolume(capsule,capsuleMat,"CapsuleLog");
|
||||
capsulePhys = new G4PVPlacement(0,
|
||||
G4ThreeVector(0,0,-1.975*mm),
|
||||
"CapsulePhys",
|
||||
"IridiumCapsulePhys",
|
||||
capsuleLog,
|
||||
mother,
|
||||
false,
|
||||
0);
|
||||
0, true);
|
||||
|
||||
// Capsule tip
|
||||
capsuleTip = new G4Sphere("CapsuleTipIridium",
|
||||
@@ -111,7 +111,7 @@ void BrachyDetectorConstructionIr::ConstructIridium(G4VPhysicalVolume* mother)
|
||||
capsuleTipLog,
|
||||
mother,
|
||||
false,
|
||||
0);
|
||||
0, true);
|
||||
|
||||
// Iridium core
|
||||
iridiumCore = new G4Tubs("IrCore",0,0.30*mm,1.75*mm,0.*deg,360.*deg);
|
||||
@@ -124,7 +124,7 @@ void BrachyDetectorConstructionIr::ConstructIridium(G4VPhysicalVolume* mother)
|
||||
iridiumCoreLog,
|
||||
capsulePhys,
|
||||
false,
|
||||
0);
|
||||
0, true);
|
||||
|
||||
simpleCapsuleVisAtt = new G4VisAttributes(red);
|
||||
simpleCapsuleVisAtt -> SetVisibility(true);
|
||||
@@ -179,4 +179,6 @@ void BrachyDetectorConstructionIr::CleanIridium()
|
||||
|
||||
delete capsuleLog;
|
||||
capsuleLog = 0;
|
||||
|
||||
G4RunManager::GetRunManager() -> GeometryHasBeenModified();
|
||||
}
|
||||
|
||||
@@ -38,9 +38,10 @@
|
||||
// *******************************************
|
||||
//
|
||||
//
|
||||
// $Id$
|
||||
// $Id: BrachyDetectorConstructionLeipzig.cc 69765 2013-05-14 10:11:22Z gcosmo $
|
||||
//
|
||||
// Code by S. Guatelli
|
||||
//
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "BrachyDetectorConstructionLeipzig.hh"
|
||||
@@ -61,13 +62,11 @@
|
||||
|
||||
// Leipzig Applicator ...
|
||||
|
||||
BrachyDetectorConstructionLeipzig::BrachyDetectorConstructionLeipzig()
|
||||
:
|
||||
capsulePhys(0),
|
||||
capsuleTipPhys(0),
|
||||
iridiumCorePhys(0),
|
||||
applicator1Phys(0),
|
||||
applicator2Phys(0)
|
||||
BrachyDetectorConstructionLeipzig::BrachyDetectorConstructionLeipzig():
|
||||
capsule(0),capsuleTip(0), iridiumCore(0), applicator1(0), applicator2(0),
|
||||
capsuleLog(0), capsuleTipLog(0), iridiumCoreLog(0), applicator1Log(0),
|
||||
applicator2Log(0),capsulePhys(0), capsuleTipPhys(0),iridiumCorePhys(0),
|
||||
applicator1Phys(0), applicator2Phys(0)
|
||||
{
|
||||
pMaterial = new BrachyMaterial();
|
||||
}
|
||||
@@ -77,86 +76,75 @@ BrachyDetectorConstructionLeipzig::~BrachyDetectorConstructionLeipzig()
|
||||
delete pMaterial;
|
||||
}
|
||||
|
||||
void BrachyDetectorConstructionLeipzig::ConstructLeipzig(G4VPhysicalVolume* mother)
|
||||
void BrachyDetectorConstructionLeipzig::ConstructLeipzig(G4VPhysicalVolume* mother)
|
||||
{
|
||||
G4Colour red (1.0, 0.0, 0.0) ;
|
||||
G4Colour lblue (0.0, 0.0, .75);
|
||||
|
||||
G4Material* capsuleMat = pMaterial -> GetMat("Stainless steel");
|
||||
G4Material* iridium = pMaterial -> GetMat("Iridium");
|
||||
G4Material* tungsten =pMaterial -> GetMat("Tungsten");
|
||||
G4Material* tungsten = pMaterial -> GetMat("Tungsten");
|
||||
|
||||
//Iridium source ...
|
||||
|
||||
G4Tubs* capsule = new G4Tubs("Capsule",0,0.55*mm,3.725*mm,0.*deg,360.*deg);
|
||||
G4LogicalVolume* capsuleLog = new G4LogicalVolume(capsule,capsuleMat,"CapsuleLog");
|
||||
capsulePhys = new G4PVPlacement(0,
|
||||
G4ThreeVector(0,0,-1.975*mm),
|
||||
"CapsulePhys",
|
||||
capsuleLog,
|
||||
mother, //mother volume: phantom
|
||||
false,
|
||||
0);
|
||||
capsule = new G4Tubs("Capsule",0,0.55*mm,3.725*mm,0.*deg,360.*deg);
|
||||
capsuleLog = new G4LogicalVolume(capsule,capsuleMat,"CapsuleLog");
|
||||
capsulePhys = new G4PVPlacement(0, G4ThreeVector(0,0,-1.975*mm),"CapsulePhys",
|
||||
capsuleLog,mother, //mother volume: phantom
|
||||
false,0, true);
|
||||
|
||||
// Capsule tip
|
||||
G4Sphere* capsuleTip = new G4Sphere("CapsuleTip",0.*mm,0.55*mm,0.*deg,360.*deg,0.*deg,90.*deg);
|
||||
G4LogicalVolume* capsuleTipLog = new G4LogicalVolume(capsuleTip,capsuleMat,"CapsuleTipLog");
|
||||
capsuleTipPhys = new G4PVPlacement(0,
|
||||
G4ThreeVector(0.,0.,1.75*mm),
|
||||
"CapsuleTipPhys",
|
||||
capsuleTipLog,
|
||||
mother,
|
||||
false,
|
||||
0);
|
||||
capsuleTip = new G4Sphere("CapsuleTip",0.*mm,0.55*mm,0.*deg,360.*deg,0.*deg,90.*deg);
|
||||
capsuleTipLog = new G4LogicalVolume(capsuleTip,capsuleMat,"CapsuleTipLog");
|
||||
capsuleTipPhys = new G4PVPlacement(0,G4ThreeVector(0.,0.,1.75*mm),"CapsuleTipPhys",
|
||||
capsuleTipLog,mother,false,0, true);
|
||||
// Iridium core
|
||||
|
||||
G4Tubs* iridiumCore = new G4Tubs("IrCore",0,0.30*mm,1.75*mm,0.*deg,360.*deg);
|
||||
G4LogicalVolume* iridiumCoreLog = new G4LogicalVolume(iridiumCore,
|
||||
iridium,
|
||||
"IridiumCoreLog");
|
||||
iridiumCorePhys = new G4PVPlacement(0,
|
||||
G4ThreeVector(0.,0.,1.975*mm),
|
||||
"IridiumCorePhys",
|
||||
iridiumCoreLog,
|
||||
capsulePhys,
|
||||
false,
|
||||
0);
|
||||
iridiumCore = new G4Tubs("IrCore",0,0.30*mm,1.75*mm,0.*deg,360.*deg);
|
||||
iridiumCoreLog = new G4LogicalVolume(iridiumCore, iridium, "IridiumCoreLog");
|
||||
iridiumCorePhys = new G4PVPlacement(0,G4ThreeVector(0.,0.,1.975*mm),"IridiumCorePhys",
|
||||
iridiumCoreLog,capsulePhys,false,0, true);
|
||||
|
||||
//Leipzig Applicator is modelled with two different volumes
|
||||
applicator1 = new G4Tubs("Appl1",5*mm,10.5*mm,12*mm,0.*deg,360.*deg);
|
||||
applicator1Log = new G4LogicalVolume(applicator1,tungsten,"Appl1Log");
|
||||
applicator1Phys = new G4PVPlacement(0,G4ThreeVector(0,0,4.0*mm),"Appl1Phys",applicator1Log,
|
||||
mother,false,0, true);
|
||||
|
||||
G4Tubs* applicator1 = new G4Tubs("Appl1",5*mm,10.5*mm,12*mm,0.*deg,360.*deg);
|
||||
G4LogicalVolume* applicator1Log = new G4LogicalVolume(applicator1,tungsten,"Appl1Log");
|
||||
applicator1Phys = new G4PVPlacement(0,
|
||||
G4ThreeVector(0,0,4.0*mm),
|
||||
"Appl1Phys",
|
||||
applicator1Log,
|
||||
mother,
|
||||
false,
|
||||
0);
|
||||
applicator2 = new G4Tubs("Appl2",0.55*mm,5.*mm,3.125*mm,0.*deg,360.*deg);
|
||||
applicator2Log = new G4LogicalVolume(applicator2,tungsten,"Appl2");
|
||||
applicator2Phys = new G4PVPlacement(0,G4ThreeVector(0,0,-4.875*mm),
|
||||
"Appl2Phys",applicator2Log,mother,false,0, true);
|
||||
|
||||
G4Tubs* applicator2 = new G4Tubs("Appl2",0.55*mm,5.*mm,3.125*mm,0.*deg,360.*deg);
|
||||
G4LogicalVolume* applicator2Log = new G4LogicalVolume(applicator2,tungsten,"Appl2");
|
||||
applicator2Phys = new G4PVPlacement(0,
|
||||
G4ThreeVector(0,0,-4.875*mm),
|
||||
"Appl2Phys",
|
||||
applicator2Log,
|
||||
mother,
|
||||
false,
|
||||
0);
|
||||
|
||||
G4VisAttributes* simpleCapsuleVisAtt = new G4VisAttributes(red);
|
||||
simpleCapsuleVisAtt = new G4VisAttributes(red);
|
||||
simpleCapsuleVisAtt -> SetVisibility(true);
|
||||
simpleCapsuleVisAtt -> SetForceSolid(true);
|
||||
simpleCapsuleVisAtt -> SetForceWireframe(true);
|
||||
capsuleLog -> SetVisAttributes(simpleCapsuleVisAtt);
|
||||
|
||||
G4VisAttributes* simpleCapsuleTipVisAtt = new G4VisAttributes(red);
|
||||
simpleCapsuleTipVisAtt = new G4VisAttributes(red);
|
||||
simpleCapsuleTipVisAtt -> SetVisibility(true);
|
||||
simpleCapsuleTipVisAtt -> SetForceSolid(true);
|
||||
capsuleTipLog -> SetVisAttributes(simpleCapsuleTipVisAtt);
|
||||
|
||||
G4VisAttributes* applicatorVisAtt = new G4VisAttributes(lblue);
|
||||
iridiumCoreLog -> SetVisAttributes(simpleCapsuleTipVisAtt);
|
||||
|
||||
applicatorVisAtt = new G4VisAttributes(lblue);
|
||||
applicatorVisAtt -> SetVisibility(true);
|
||||
applicatorVisAtt -> SetForceWireframe(true);
|
||||
applicator1Log -> SetVisAttributes(applicatorVisAtt);
|
||||
applicator2Log -> SetVisAttributes(applicatorVisAtt);
|
||||
applicator1Log -> SetVisAttributes(applicatorVisAtt);
|
||||
applicator2Log -> SetVisAttributes(applicatorVisAtt);
|
||||
}
|
||||
void BrachyDetectorConstructionLeipzig::CleanLeipzigApplicator()
|
||||
{
|
||||
delete applicatorVisAtt; applicatorVisAtt = 0;
|
||||
delete simpleCapsuleTipVisAtt; simpleCapsuleTipVisAtt = 0;
|
||||
delete simpleCapsuleVisAtt; simpleCapsuleVisAtt = 0;
|
||||
delete applicator2Phys; applicator2Phys = 0;
|
||||
delete applicator1Phys; applicator1Phys = 0;
|
||||
delete iridiumCorePhys; iridiumCorePhys = 0;
|
||||
delete capsuleTipPhys; capsuleTipPhys = 0;
|
||||
delete capsulePhys; capsulePhys = 0;
|
||||
delete applicator2Log; applicator2Log = 0;
|
||||
delete applicator1Log; applicator1Log = 0;
|
||||
delete iridiumCoreLog; iridiumCoreLog = 0;
|
||||
delete capsuleTipLog; capsuleTipLog = 0;
|
||||
delete capsuleLog; capsuleLog = 0;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
// *********************************
|
||||
//
|
||||
//
|
||||
// $Id$
|
||||
// $Id: BrachyDetectorMessenger.cc 69765 2013-05-14 10:11:22Z gcosmo $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
// * *
|
||||
// *******************************
|
||||
//
|
||||
// $Id$
|
||||
// $Id: BrachyFactory.cc 69765 2013-05-14 10:11:22Z gcosmo $
|
||||
//
|
||||
// Factory of brachytherapic sources
|
||||
//
|
||||
|
||||
@@ -32,10 +32,9 @@
|
||||
// * *
|
||||
// *******************************
|
||||
//
|
||||
// $Id$
|
||||
// $Id: BrachyFactoryI.cc 69765 2013-05-14 10:11:22Z gcosmo $
|
||||
//
|
||||
#include "BrachyFactoryI.hh"
|
||||
#include "BrachyPrimaryGeneratorActionI.hh"
|
||||
#include "BrachyDetectorConstructionI.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "Randomize.hh"
|
||||
@@ -49,7 +48,6 @@
|
||||
BrachyFactoryI:: BrachyFactoryI()
|
||||
{
|
||||
iodiumSource = new BrachyDetectorConstructionI();
|
||||
iodiumPrimaryParticle = new BrachyPrimaryGeneratorActionI();
|
||||
}
|
||||
|
||||
BrachyFactoryI::~BrachyFactoryI()
|
||||
@@ -57,15 +55,13 @@ BrachyFactoryI::~BrachyFactoryI()
|
||||
delete iodiumSource;
|
||||
}
|
||||
|
||||
void BrachyFactoryI::CreatePrimaryGeneratorAction(G4Event* anEvent)
|
||||
{
|
||||
iodiumPrimaryParticle -> GeneratePrimaries(anEvent);
|
||||
}
|
||||
|
||||
void BrachyFactoryI::CreateSource(G4VPhysicalVolume* mother)
|
||||
{
|
||||
iodiumSource -> ConstructIodium(mother);
|
||||
}
|
||||
|
||||
void BrachyFactoryI::CleanSource()
|
||||
{;}
|
||||
{
|
||||
iodiumSource -> CleanIodium();
|
||||
iodiumSource = 0;
|
||||
}
|
||||
|
||||
@@ -32,11 +32,10 @@
|
||||
// * *
|
||||
// *******************************
|
||||
//
|
||||
// $Id$
|
||||
// $Id: BrachyFactoryIr.cc 69765 2013-05-14 10:11:22Z gcosmo $
|
||||
//
|
||||
#include "globals.hh"
|
||||
#include "BrachyFactoryIr.hh"
|
||||
#include "BrachyPrimaryGeneratorActionIr.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "Randomize.hh"
|
||||
#include "G4Event.hh"
|
||||
@@ -50,20 +49,13 @@
|
||||
BrachyFactoryIr:: BrachyFactoryIr()
|
||||
{
|
||||
iridiumSource = new BrachyDetectorConstructionIr();
|
||||
iridiumPrimaryParticle = new BrachyPrimaryGeneratorActionIr();
|
||||
}
|
||||
|
||||
BrachyFactoryIr:: ~BrachyFactoryIr()
|
||||
{
|
||||
delete iridiumSource;
|
||||
delete iridiumPrimaryParticle;
|
||||
}
|
||||
|
||||
void BrachyFactoryIr::CreatePrimaryGeneratorAction(G4Event* anEvent)
|
||||
{
|
||||
iridiumPrimaryParticle -> GeneratePrimaries(anEvent);
|
||||
}
|
||||
|
||||
void BrachyFactoryIr::CreateSource(G4VPhysicalVolume* mother)
|
||||
{
|
||||
iridiumSource -> ConstructIridium(mother);
|
||||
@@ -72,4 +64,5 @@ void BrachyFactoryIr::CreateSource(G4VPhysicalVolume* mother)
|
||||
void BrachyFactoryIr::CleanSource()
|
||||
{
|
||||
iridiumSource -> CleanIridium();
|
||||
iridiumSource = 0;
|
||||
}
|
||||
|
||||
@@ -32,12 +32,11 @@
|
||||
// * *
|
||||
// *******************************
|
||||
//
|
||||
// $Id$
|
||||
// $Id: BrachyFactoryLeipzig.cc 69765 2013-05-14 10:11:22Z gcosmo $
|
||||
//
|
||||
|
||||
#include "globals.hh"
|
||||
#include "BrachyFactoryLeipzig.hh"
|
||||
#include"BrachyPrimaryGeneratorActionIr.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "Randomize.hh"
|
||||
#include "G4Event.hh"
|
||||
@@ -51,7 +50,6 @@
|
||||
BrachyFactoryLeipzig:: BrachyFactoryLeipzig()
|
||||
{
|
||||
leipzigSource = new BrachyDetectorConstructionLeipzig();
|
||||
iridiumPrimaryParticle = new BrachyPrimaryGeneratorActionIr();
|
||||
}
|
||||
|
||||
BrachyFactoryLeipzig:: ~BrachyFactoryLeipzig()
|
||||
@@ -59,11 +57,6 @@ BrachyFactoryLeipzig:: ~BrachyFactoryLeipzig()
|
||||
delete leipzigSource;
|
||||
}
|
||||
|
||||
void BrachyFactoryLeipzig::CreatePrimaryGeneratorAction(G4Event* anEvent)
|
||||
{
|
||||
iridiumPrimaryParticle -> GeneratePrimaries(anEvent);
|
||||
}
|
||||
|
||||
void BrachyFactoryLeipzig::CreateSource(G4VPhysicalVolume* mother)
|
||||
{
|
||||
leipzigSource -> ConstructLeipzig(mother);
|
||||
@@ -71,5 +64,6 @@ void BrachyFactoryLeipzig::CreateSource(G4VPhysicalVolume* mother)
|
||||
|
||||
void BrachyFactoryLeipzig::CleanSource()
|
||||
{
|
||||
;
|
||||
leipzigSource -> CleanLeipzigApplicator();
|
||||
leipzigSource = 0;
|
||||
}
|
||||
|
||||
@@ -32,9 +32,8 @@
|
||||
// * *
|
||||
// *******************************
|
||||
//
|
||||
// $Id$
|
||||
// $Id: BrachyMaterial.cc 69765 2013-05-14 10:11:22Z gcosmo $
|
||||
//
|
||||
|
||||
#include "globals.hh"
|
||||
#include "Randomize.hh"
|
||||
#include "G4PhysicalConstants.hh"
|
||||
@@ -148,7 +147,7 @@ void BrachyMaterial::DefineMaterials()
|
||||
|
||||
// Air material
|
||||
d = 1.290*mg/cm3;
|
||||
G4Material* matAir = new G4Material("Air",d,2);
|
||||
matAir = new G4Material("Air",d,2);
|
||||
matAir->AddElement(elN,0.7);
|
||||
matAir->AddElement(elO,0.3);
|
||||
|
||||
@@ -159,7 +158,6 @@ void BrachyMaterial::DefineMaterials()
|
||||
matH2O->AddElement(elO,1);
|
||||
matH2O->GetIonisation()->SetMeanExcitationEnergy(75.0*eV);
|
||||
|
||||
|
||||
//soft tissue(http://www.nist.gov)
|
||||
d = 1.0*g/cm3;
|
||||
soft = new G4Material("tissue",d,13);
|
||||
@@ -206,8 +204,7 @@ void BrachyMaterial::DefineMaterials()
|
||||
G4double pressure = 3.e-18*pascal;
|
||||
G4double temperature = 2.73*kelvin;
|
||||
A=1.01*g/mole;
|
||||
Vacuum = new G4Material("Galactic", Z = 1., A,
|
||||
density,kStateGas,temperature,pressure);
|
||||
Vacuum = new G4Material("Galactic", Z = 1., A,density,kStateGas,temperature,pressure);
|
||||
|
||||
//compact bone (http://www.NIST.gov)
|
||||
d = 1.85*g/cm3;
|
||||
|
||||
@@ -23,11 +23,9 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// Code developed by:
|
||||
// S. Agostinelli, F. Foppiano, S. Garelli , M. Tropeano, S.Guatelli
|
||||
//
|
||||
// Code review: MGP, 5 November 2006 (still to be completed)
|
||||
/*
|
||||
Author: Susanna Guatelli
|
||||
*/
|
||||
//
|
||||
// **********************************
|
||||
// * *
|
||||
@@ -35,174 +33,91 @@
|
||||
// * *
|
||||
// **********************************
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
#include "G4EmStandardPhysics_option4.hh"
|
||||
#include "G4EmLivermorePhysics.hh"
|
||||
#include "G4DecayPhysics.hh"
|
||||
#include "G4RadioactiveDecayPhysics.hh"
|
||||
#include "G4EmPenelopePhysics.hh"
|
||||
#include "BrachyPhysicsList.hh"
|
||||
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4VPhysicsConstructor.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4ProductionCutsTable.hh"
|
||||
#include "G4ProcessManager.hh"
|
||||
#include "G4ParticleTypes.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4ios.hh"
|
||||
// gamma
|
||||
#include "G4PhotoElectricEffect.hh"
|
||||
#include "G4LivermorePhotoElectricModel.hh"
|
||||
#include "G4ios.hh"
|
||||
#include "G4StepLimiter.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "globals.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
#include "G4ComptonScattering.hh"
|
||||
#include "G4LivermoreComptonModel.hh"
|
||||
|
||||
#include "G4GammaConversion.hh"
|
||||
#include "G4LivermoreGammaConversionModel.hh"
|
||||
|
||||
#include "G4RayleighScattering.hh"
|
||||
#include "G4LivermoreRayleighModel.hh"
|
||||
|
||||
// e-
|
||||
#include "G4eMultipleScattering.hh"
|
||||
#include "G4eIonisation.hh"
|
||||
#include "G4LivermoreIonisationModel.hh"
|
||||
#include "G4eBremsstrahlung.hh"
|
||||
#include "G4LivermoreBremsstrahlungModel.hh"
|
||||
|
||||
// e+
|
||||
#include "G4eIonisation.hh"
|
||||
#include "G4eBremsstrahlung.hh"
|
||||
#include "G4eplusAnnihilation.hh"
|
||||
|
||||
BrachyPhysicsList::BrachyPhysicsList(): G4VUserPhysicsList()
|
||||
BrachyPhysicsList::BrachyPhysicsList(): G4VModularPhysicsList()
|
||||
{
|
||||
SetVerboseLevel(1);
|
||||
SetVerboseLevel(1);
|
||||
|
||||
// EM physics: 3 alternatives
|
||||
|
||||
emPhysicsList = new G4EmStandardPhysics_option4(1);
|
||||
|
||||
// Alternatively you can substitute this physics list
|
||||
// with the LowEnergy Livermore or LowEnergy Penelope:
|
||||
// emPhysicsList = new G4EmLivermorePhysics();
|
||||
// Low Energy based on Livermore Evaluated Data Libraries
|
||||
//
|
||||
// Penelope physics
|
||||
//emPhysicsList = new G4EmPenelopePhysics();
|
||||
|
||||
// Add Decay
|
||||
decPhysicsList = new G4DecayPhysics();
|
||||
radDecayPhysicsList = new G4RadioactiveDecayPhysics();
|
||||
|
||||
}
|
||||
|
||||
BrachyPhysicsList::~BrachyPhysicsList()
|
||||
{
|
||||
{
|
||||
delete decPhysicsList;
|
||||
delete radDecayPhysicsList;
|
||||
delete emPhysicsList;
|
||||
}
|
||||
|
||||
void BrachyPhysicsList::ConstructParticle()
|
||||
{
|
||||
// In this method, static member functions should be called
|
||||
// for all particles which you want to use.
|
||||
// This ensures that objects of these particle types will be
|
||||
// created in the program.
|
||||
|
||||
ConstructBosons();
|
||||
ConstructLeptons();
|
||||
|
||||
}
|
||||
|
||||
void BrachyPhysicsList::ConstructBosons()
|
||||
{
|
||||
// photons
|
||||
G4Gamma::GammaDefinition();
|
||||
}
|
||||
|
||||
void BrachyPhysicsList::ConstructLeptons()
|
||||
{
|
||||
// leptons
|
||||
G4Electron::ElectronDefinition();
|
||||
G4Positron::PositronDefinition();
|
||||
decPhysicsList -> ConstructParticle();
|
||||
}
|
||||
|
||||
void BrachyPhysicsList::ConstructProcess()
|
||||
{
|
||||
AddTransportation();
|
||||
ConstructEM();
|
||||
}
|
||||
AddTransportation();
|
||||
emPhysicsList -> ConstructProcess();
|
||||
|
||||
void BrachyPhysicsList::ConstructEM()
|
||||
{
|
||||
theParticleIterator->reset();
|
||||
|
||||
while( (*theParticleIterator)() ){
|
||||
|
||||
G4ParticleDefinition* particle = theParticleIterator->value();
|
||||
G4ProcessManager* pmanager = particle->GetProcessManager();
|
||||
G4String particleName = particle->GetParticleName();
|
||||
|
||||
// Processes
|
||||
|
||||
if (particleName == "gamma") {
|
||||
|
||||
// Photon
|
||||
G4RayleighScattering* theRayleigh = new G4RayleighScattering();
|
||||
theRayleigh->SetModel(new G4LivermoreRayleighModel()); //not strictly necessary
|
||||
pmanager->AddDiscreteProcess(theRayleigh);
|
||||
|
||||
G4PhotoElectricEffect* thePhotoElectricEffect = new G4PhotoElectricEffect();
|
||||
thePhotoElectricEffect->SetModel(new G4LivermorePhotoElectricModel());
|
||||
pmanager->AddDiscreteProcess(thePhotoElectricEffect);
|
||||
|
||||
G4ComptonScattering* theComptonScattering = new G4ComptonScattering();
|
||||
theComptonScattering->SetModel(new G4LivermoreComptonModel());
|
||||
pmanager->AddDiscreteProcess(theComptonScattering);
|
||||
|
||||
G4GammaConversion* theGammaConversion = new G4GammaConversion();
|
||||
theGammaConversion->SetModel(new G4LivermoreGammaConversionModel());
|
||||
pmanager->AddDiscreteProcess(theGammaConversion);
|
||||
|
||||
} else if (particleName == "e-") {
|
||||
// Electron
|
||||
|
||||
G4eMultipleScattering* msc = new G4eMultipleScattering();
|
||||
msc->SetStepLimitType(fUseDistanceToBoundary);
|
||||
pmanager->AddProcess(msc,-1, 1, 1);
|
||||
|
||||
// Ionisation
|
||||
G4eIonisation* eIonisation = new G4eIonisation();
|
||||
eIonisation->SetEmModel(new G4LivermoreIonisationModel());
|
||||
eIonisation->SetStepFunction(0.2, 100*um); //improved precision in tracking
|
||||
pmanager->AddProcess(eIonisation,-1, 2, 2);
|
||||
|
||||
// Bremsstrahlung
|
||||
G4eBremsstrahlung* eBremsstrahlung = new G4eBremsstrahlung();
|
||||
eBremsstrahlung->SetEmModel(new G4LivermoreBremsstrahlungModel());
|
||||
pmanager->AddProcess(eBremsstrahlung, -1,-3, 3);
|
||||
|
||||
} else if (particleName == "e+") {
|
||||
// Positron
|
||||
G4eMultipleScattering* msc = new G4eMultipleScattering();
|
||||
msc->SetStepLimitType(fUseDistanceToBoundary);
|
||||
pmanager->AddProcess(msc,-1, 1, 1);
|
||||
|
||||
// Ionisation
|
||||
G4eIonisation* eIonisation = new G4eIonisation();
|
||||
eIonisation->SetStepFunction(0.2, 100*um); //
|
||||
pmanager->AddProcess(eIonisation, -1, 2, 2);
|
||||
|
||||
//Bremsstrahlung (use default, no low-energy available)
|
||||
pmanager->AddProcess(new G4eBremsstrahlung(), -1,-1, 3);
|
||||
|
||||
//Annihilation
|
||||
pmanager->AddProcess(new G4eplusAnnihilation(),0,-1, 4);
|
||||
|
||||
}
|
||||
}
|
||||
// decay physics list
|
||||
decPhysicsList -> ConstructProcess();
|
||||
radDecayPhysicsList -> ConstructProcess();
|
||||
}
|
||||
|
||||
void BrachyPhysicsList::SetCuts()
|
||||
{
|
||||
// The production threshold is fixed to 0.1 mm for all the particles
|
||||
// Secondary particles with a range bigger than 0.1 mm
|
||||
// are generated; otherwise their energy is considered deposited locally
|
||||
|
||||
defaultCutValue = 0.1 * mm;
|
||||
|
||||
const G4double cutForGamma = defaultCutValue;
|
||||
const G4double cutForElectron = defaultCutValue;
|
||||
const G4double cutForPositron = defaultCutValue;
|
||||
|
||||
SetCutValue(cutForGamma, "gamma");
|
||||
SetCutValue(cutForElectron, "e-");
|
||||
SetCutValue(cutForPositron, "e+");
|
||||
|
||||
// Set the secondary production cut lower than 990. eV
|
||||
// Very important for high precision of lowenergy processes at low energies
|
||||
|
||||
G4double lowLimit = 250. * eV;
|
||||
G4double highLimit = 100. * GeV;
|
||||
G4ProductionCutsTable::GetProductionCutsTable()->SetEnergyRange(lowLimit, highLimit);
|
||||
// Definition of threshold of production
|
||||
// of secondary particles
|
||||
// This is defined in range.
|
||||
defaultCutValue = 0.1 * mm;
|
||||
SetCutValue(defaultCutValue, "gamma");
|
||||
SetCutValue(defaultCutValue, "e-");
|
||||
SetCutValue(defaultCutValue, "e+");
|
||||
|
||||
if (verboseLevel>0) DumpCutValuesTable();
|
||||
// By default the low energy limit to produce
|
||||
// secondary particles is 990 eV.
|
||||
// This value is correct when using the EM Standard Physics.
|
||||
// When using the Low Energy Livermore this value can be
|
||||
// changed to 250 eV corresponding to the limit
|
||||
// of validity of the physics models.
|
||||
// Comment out following three lines if the
|
||||
// Standard electromagnetic Package is adopted.
|
||||
G4double lowLimit = 250. * eV;
|
||||
G4double highLimit = 100. * GeV;
|
||||
|
||||
G4ProductionCutsTable::GetProductionCutsTable()->SetEnergyRange(lowLimit,
|
||||
highLimit);
|
||||
|
||||
// Print the cuts
|
||||
if (verboseLevel>0) DumpCutValuesTable();
|
||||
}
|
||||
|
||||
@@ -37,58 +37,43 @@
|
||||
// * *
|
||||
// ********************************************
|
||||
//
|
||||
// $Id$
|
||||
// $Id: BrachyPrimaryGeneratorAction.cc 74021 2013-09-19 13:41:54Z gcosmo $
|
||||
//
|
||||
|
||||
#include "globals.hh"
|
||||
#include "BrachyPrimaryGeneratorAction.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "Randomize.hh"
|
||||
#include "G4Event.hh"
|
||||
#include "G4ParticleGun.hh"
|
||||
#include "G4IonTable.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4GeneralParticleSource.hh"
|
||||
#include "G4RunManager.hh"
|
||||
#include "BrachyFactory.hh"
|
||||
#include "BrachyFactoryLeipzig.hh"
|
||||
#include "BrachyFactoryIr.hh"
|
||||
#include "BrachyFactoryI.hh"
|
||||
#include "BrachyPrimaryGeneratorMessenger.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "BrachyAnalysisManager.hh"
|
||||
|
||||
BrachyPrimaryGeneratorAction::BrachyPrimaryGeneratorAction()
|
||||
BrachyPrimaryGeneratorAction::BrachyPrimaryGeneratorAction(BrachyAnalysisManager* analysis_manager)
|
||||
{
|
||||
|
||||
primaryMessenger = new BrachyPrimaryGeneratorMessenger(this);
|
||||
// Default source: iridium source
|
||||
factory = new BrachyFactoryIr();
|
||||
// Use the GPS to generate primary particles,
|
||||
// Particle type, energy position, direction are specified in the
|
||||
// the macro file primary.mac
|
||||
gun = new G4GeneralParticleSource();
|
||||
analysis = analysis_manager;
|
||||
}
|
||||
|
||||
BrachyPrimaryGeneratorAction::~BrachyPrimaryGeneratorAction()
|
||||
{
|
||||
delete factory;
|
||||
delete primaryMessenger;
|
||||
delete gun;
|
||||
}
|
||||
|
||||
void BrachyPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
{
|
||||
factory -> CreatePrimaryGeneratorAction(anEvent);
|
||||
gun -> GeneratePrimaryVertex(anEvent);
|
||||
|
||||
#ifdef ANALYSIS_USE
|
||||
if (gun -> GetParticleDefinition()-> GetParticleName()== "gamma")
|
||||
{
|
||||
G4double energy = gun -> GetParticleEnergy();
|
||||
analysis -> FillPrimaryParticleHistogram(energy);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void BrachyPrimaryGeneratorAction::SwitchEnergy(G4String sourceChoice)
|
||||
{
|
||||
G4int flag = 0;
|
||||
|
||||
// Switch the energy spectrum of the photons delivered by the radiative source
|
||||
if (sourceChoice == "Iodium")
|
||||
{
|
||||
flag=1;
|
||||
if (factory) delete factory;
|
||||
}
|
||||
switch(flag)
|
||||
{
|
||||
case 1:
|
||||
factory = new BrachyFactoryI;
|
||||
break;
|
||||
default:
|
||||
factory = new BrachyFactoryIr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,135 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
// GEANT 4 - Brachytherapy example
|
||||
// --------------------------------------------------------------
|
||||
//
|
||||
// Code developed by:
|
||||
// S.Guatelli
|
||||
//
|
||||
// ********************************************
|
||||
// * *
|
||||
// * BrachyPrimaryGeneratorActionI.cc *
|
||||
// * *
|
||||
// ********************************************
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
#include "BrachyPrimaryGeneratorActionI.hh"
|
||||
#include "globals.hh"
|
||||
#include "Randomize.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4Event.hh"
|
||||
#include "G4ParticleGun.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4RunManager.hh"
|
||||
|
||||
BrachyPrimaryGeneratorActionI::BrachyPrimaryGeneratorActionI()
|
||||
{
|
||||
G4int numberParticles = 1;
|
||||
|
||||
particleGun = new G4ParticleGun(numberParticles);
|
||||
|
||||
// Gamma energy spectrum ...
|
||||
// Fill a vector with the energy probabilities
|
||||
energySpectrum.push_back(0.783913);
|
||||
energySpectrum.push_back(0.170416);
|
||||
energySpectrum.push_back(0.045671);
|
||||
}
|
||||
|
||||
BrachyPrimaryGeneratorActionI::~BrachyPrimaryGeneratorActionI()
|
||||
{
|
||||
if(particleGun)
|
||||
delete particleGun;
|
||||
}
|
||||
|
||||
void BrachyPrimaryGeneratorActionI::GeneratePrimaries(G4Event* anEvent)
|
||||
{
|
||||
// Define the primary particle type
|
||||
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
|
||||
G4String ParticleName = "gamma";
|
||||
G4ParticleDefinition* particle = particleTable -> FindParticle(ParticleName);
|
||||
|
||||
particleGun -> SetParticleDefinition(particle);
|
||||
|
||||
// Random generation of gamma source point inside the Iodium core ...
|
||||
G4double x,y,z;
|
||||
G4double radiuMax = 0.30*mm;
|
||||
G4double radiusMin = 0.085*mm;
|
||||
|
||||
do{
|
||||
x = (G4UniformRand()-0.5)*(radiuMax)/0.5;
|
||||
y = (G4UniformRand()-0.5)*(radiuMax)/0.5;
|
||||
}while(((x*x+y*y )> (radiuMax*radiuMax))||((x*x+y*y)<(radiusMin*radiusMin)));
|
||||
|
||||
z = (G4UniformRand()-0.5)*1.75*mm/0.5 ;
|
||||
|
||||
G4ThreeVector position(x,y,z);
|
||||
particleGun -> SetParticlePosition(position);
|
||||
|
||||
// Random generation of the impulse direction of primary particles ...
|
||||
G4double a,b,c;
|
||||
G4double n;
|
||||
do{
|
||||
a = (G4UniformRand()-0.5)/0.5;
|
||||
b = (G4UniformRand()-0.5)/0.5;
|
||||
c = (G4UniformRand()-0.5)/0.5;
|
||||
n = a*a+b*b+c*c;
|
||||
}while(n > 1 || n == 0.0);
|
||||
n = std::sqrt(n);
|
||||
a /= n;
|
||||
b /= n;
|
||||
c /= n;
|
||||
|
||||
G4ThreeVector direction(a,b,c);
|
||||
particleGun -> SetParticleMomentumDirection(direction);
|
||||
|
||||
// Generate the primary particles with a defined energy spectrum
|
||||
G4double random = G4UniformRand();
|
||||
G4double sum = 0;
|
||||
G4int i = 0;
|
||||
while(sum<random){sum+=energySpectrum[i];
|
||||
i++;}
|
||||
|
||||
// energy spectrum
|
||||
if(i==1){primaryParticleEnergy = 27.4*keV;}
|
||||
else{
|
||||
if(i==2){primaryParticleEnergy = 31.4*keV;}
|
||||
else {primaryParticleEnergy = 35.5*keV;}}
|
||||
|
||||
particleGun -> SetParticleEnergy(primaryParticleEnergy);
|
||||
|
||||
// generate primary particle
|
||||
particleGun->GeneratePrimaryVertex(anEvent);
|
||||
}
|
||||
|
||||
G4double BrachyPrimaryGeneratorActionI::GetEnergy()
|
||||
{
|
||||
return primaryParticleEnergy;
|
||||
}
|
||||
|
||||
@@ -1,111 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
// GEANT 4 - Brachytherapy example
|
||||
// --------------------------------------------------------------
|
||||
//
|
||||
// Code developed by:
|
||||
// S. Agostinelli, F. Foppiano, S. Garelli , M. Tropeano, S.Guatelli
|
||||
//
|
||||
// ********************************************
|
||||
// * *
|
||||
// * BrachyPrimaryGeneratorActionIr.cc *
|
||||
// * *
|
||||
// ********************************************
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
#include "BrachyPrimaryGeneratorActionIr.hh"
|
||||
#include "globals.hh"
|
||||
#include "Randomize.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4Event.hh"
|
||||
#include "G4ParticleGun.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4RunManager.hh"
|
||||
|
||||
BrachyPrimaryGeneratorActionIr::BrachyPrimaryGeneratorActionIr()
|
||||
{
|
||||
G4int NumParticles = 1;
|
||||
particleGun = new G4ParticleGun(NumParticles);
|
||||
}
|
||||
|
||||
BrachyPrimaryGeneratorActionIr::~BrachyPrimaryGeneratorActionIr()
|
||||
{
|
||||
if(particleGun)
|
||||
delete particleGun;
|
||||
}
|
||||
|
||||
void BrachyPrimaryGeneratorActionIr::GeneratePrimaries(G4Event* anEvent)
|
||||
{
|
||||
|
||||
// Define primary particle type
|
||||
G4ParticleTable* pParticleTable = G4ParticleTable::GetParticleTable();
|
||||
G4String ParticleName = "gamma";
|
||||
G4ParticleDefinition* pParticle = pParticleTable -> FindParticle(ParticleName);
|
||||
particleGun -> SetParticleDefinition(pParticle);
|
||||
|
||||
// Random generation of gamma source point inside the Iridium core
|
||||
G4double x,y,z;
|
||||
G4double radius = 0.30*mm;
|
||||
do{
|
||||
x = (G4UniformRand()-0.5)*(radius)/0.5;
|
||||
y = (G4UniformRand()-0.5)*(radius)/0.5;
|
||||
}while(x*x+y*y > radius*radius);
|
||||
|
||||
z = (G4UniformRand()-0.5)*1.75*mm/0.5 -1.975*mm ;
|
||||
|
||||
G4ThreeVector position(x,y,z);
|
||||
particleGun -> SetParticlePosition(position);
|
||||
|
||||
// Random generation of the impulse direction
|
||||
G4double a,b,c;
|
||||
G4double n;
|
||||
do{
|
||||
a = (G4UniformRand()-0.5)/0.5;
|
||||
b = (G4UniformRand()-0.5)/0.5;
|
||||
c = (G4UniformRand()-0.5)/0.5;
|
||||
n = a*a+b*b+c*c;
|
||||
}while(n > 1 || n == 0.0);
|
||||
n = std::sqrt(n);
|
||||
a /= n;
|
||||
b /= n;
|
||||
c /= n;
|
||||
|
||||
G4ThreeVector direction(a,b,c);
|
||||
particleGun->SetParticleMomentumDirection(direction);
|
||||
|
||||
// Primary particle energy
|
||||
primaryParticleEnergy = 356.*keV;
|
||||
particleGun->SetParticleEnergy(primaryParticleEnergy);
|
||||
|
||||
|
||||
// Generate a primary particle
|
||||
particleGun -> GeneratePrimaryVertex(anEvent);
|
||||
}
|
||||
|
||||
@@ -1,76 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// Code developed by:
|
||||
// S.Guatelli
|
||||
//
|
||||
// *****************************************
|
||||
// * *
|
||||
// * BrachyPrimaryGeneratorMessenger.cc *
|
||||
// * *
|
||||
// *****************************************
|
||||
//
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
|
||||
#include "BrachyPrimaryGeneratorMessenger.hh"
|
||||
#include "BrachyPrimaryGeneratorAction.hh"
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
|
||||
BrachyPrimaryGeneratorMessenger::BrachyPrimaryGeneratorMessenger(BrachyPrimaryGeneratorAction* primary):
|
||||
primaryAction(primary)
|
||||
{
|
||||
primaryDir = new G4UIdirectory("/primary/");
|
||||
primaryDir -> SetGuidance("primary particles control.");
|
||||
|
||||
// Define interactive command
|
||||
primaryParticleEnergySpectrumCmd =
|
||||
new G4UIcmdWithAString("/primary/energy",this);
|
||||
primaryParticleEnergySpectrumCmd -> SetGuidance("Select the energy of gamma emitted by the source.");
|
||||
primaryParticleEnergySpectrumCmd -> SetGuidance("Iodium: Iodium Source");
|
||||
primaryParticleEnergySpectrumCmd -> SetGuidance("Iridium: Iridium Source");
|
||||
primaryParticleEnergySpectrumCmd -> SetParameterName("choice",true);
|
||||
primaryParticleEnergySpectrumCmd -> SetDefaultValue("Iridium");
|
||||
primaryParticleEnergySpectrumCmd -> SetCandidates("Iridium / Iodium");
|
||||
primaryParticleEnergySpectrumCmd -> AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
}
|
||||
|
||||
BrachyPrimaryGeneratorMessenger::~BrachyPrimaryGeneratorMessenger()
|
||||
{
|
||||
delete primaryParticleEnergySpectrumCmd;
|
||||
delete primaryDir;
|
||||
}
|
||||
|
||||
void BrachyPrimaryGeneratorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
|
||||
{
|
||||
// Change the energy of the emitted photons (iridium - iodium source)
|
||||
if(command == primaryParticleEnergySpectrumCmd)
|
||||
primaryAction -> SwitchEnergy(newValue);
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
// * *
|
||||
// *******************************
|
||||
//
|
||||
// $Id$
|
||||
// $Id: BrachyRunAction.cc 69765 2013-05-14 10:11:22Z gcosmo $
|
||||
//
|
||||
|
||||
#include "BrachyRunAction.hh"
|
||||
|
||||
@@ -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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: SteppingAction.cc,v 1.10 2006/06/29 16:24:25 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02-ref-04 $
|
||||
//
|
||||
//
|
||||
// Author: Susanna Guatelli (guatelli@ge.infn.it)
|
||||
//
|
||||
|
||||
#include "G4ios.hh"
|
||||
#include "G4SteppingManager.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4StepPoint.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4TrackStatus.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4Gamma.hh"
|
||||
#include "BrachyAnalysisManager.hh"
|
||||
#include "BrachySteppingAction.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
BrachySteppingAction::BrachySteppingAction(BrachyAnalysisManager* analysisMan):analysis(analysisMan)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
BrachySteppingAction::~BrachySteppingAction()
|
||||
{
|
||||
}
|
||||
|
||||
void BrachySteppingAction::UserSteppingAction(const G4Step* aStep)
|
||||
{
|
||||
|
||||
// Retrieve the spectrum of gamma emitted in the Radioactive Decay
|
||||
// and store it in a 1D histogram
|
||||
|
||||
G4SteppingManager* steppingManager = fpSteppingManager;
|
||||
G4Track* theTrack = aStep-> GetTrack();
|
||||
|
||||
// check if it is alive
|
||||
if(theTrack-> GetTrackStatus() == fAlive) {return;}
|
||||
|
||||
// G4cout << "Start secondariessss" << G4endl;
|
||||
// Retrieve the secondary particles
|
||||
G4TrackVector* fSecondary = steppingManager -> GetfSecondary();
|
||||
|
||||
for(size_t lp1=0;lp1<(*fSecondary).size(); lp1++)
|
||||
{
|
||||
// Retrieve particle
|
||||
const G4ParticleDefinition* particleName = (*fSecondary)[lp1] -> GetDefinition();
|
||||
|
||||
if (particleName == G4Gamma::Definition())
|
||||
{
|
||||
G4String process = (*fSecondary)[lp1]-> GetCreatorProcess()-> GetProcessName();
|
||||
|
||||
// Retrieve the process originating it
|
||||
// G4cout << "creator process " << process << G4endl;
|
||||
if (process == "RadioactiveDecay")
|
||||
{
|
||||
#ifdef ANALYSIS_USE
|
||||
G4double energy = (*fSecondary)[lp1] -> GetKineticEnergy();
|
||||
// Store the initial energy of particles in a 1D histogram
|
||||
analysis -> FillPrimaryParticleHistogram(energy/keV);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -30,132 +30,106 @@
|
||||
//
|
||||
Original code from geant4/examples/extended/runAndEvent/RE03, by M. Asai
|
||||
*/
|
||||
|
||||
#include <map>
|
||||
#include <fstream>
|
||||
|
||||
#include "BrachyUserScoreWriter.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "BrachyAnalysis.hh"
|
||||
#include "BrachyAnalysisManager.hh"
|
||||
#include "G4MultiFunctionalDetector.hh"
|
||||
#include "G4SDParticleFilter.hh"
|
||||
#include "G4VPrimitiveScorer.hh"
|
||||
#include "G4VScoringMesh.hh"
|
||||
|
||||
// The default output is
|
||||
// voxelX, voxelY, voxelZ, edep
|
||||
// The BrachyUserScoreWriter allows to change the format of the output file.
|
||||
// in the specific case:
|
||||
// xx (mm) yy(mm) zz(mm) edep(keV)
|
||||
|
||||
// The same information is stored in a ntuple, in the
|
||||
// brachytherapy.root file
|
||||
|
||||
BrachyUserScoreWriter::BrachyUserScoreWriter(): G4VScoreWriter()
|
||||
{;}
|
||||
BrachyUserScoreWriter::BrachyUserScoreWriter(BrachyAnalysisManager* analysis_manager):
|
||||
G4VScoreWriter()
|
||||
{
|
||||
analysis = analysis_manager;
|
||||
}
|
||||
|
||||
BrachyUserScoreWriter::~BrachyUserScoreWriter()
|
||||
{;}
|
||||
|
||||
void BrachyUserScoreWriter::DumpQuantityToFile(const G4String & psName, const G4String & fileName, const G4String & option)
|
||||
void BrachyUserScoreWriter::DumpQuantityToFile(const G4String & psName,
|
||||
const G4String & fileName,
|
||||
const G4String & option)
|
||||
{
|
||||
if(verboseLevel > 0) {
|
||||
G4cout << "BrachyUserScorer-defined DumpQuantityToFile() method is invoked."
|
||||
<< G4endl; }
|
||||
|
||||
// change the option string into lowercase to the case-insensitive.
|
||||
G4String opt = option;
|
||||
std::transform(opt.begin(), opt.end(), opt.begin(), (int (*)(int))(tolower));
|
||||
|
||||
// confirm the option
|
||||
if(opt.size() == 0) opt = "csv";
|
||||
|
||||
// open the file
|
||||
std::ofstream ofile(fileName);
|
||||
if(!ofile) {
|
||||
G4cerr << "ERROR : DumpToFile : File open error -> "
|
||||
<< fileName << G4endl;
|
||||
return;
|
||||
if(verboseLevel > 0)
|
||||
{G4cout << "BrachyUserScorer-defined DumpQuantityToFile() method is invoked."
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
// change the option string into lowercase to the case-insensitive.
|
||||
G4String opt = option;
|
||||
std::transform(opt.begin(), opt.end(), opt.begin(), (int (*)(int))(tolower));
|
||||
|
||||
// confirm the option
|
||||
if(opt.size() == 0) opt = "csv";
|
||||
|
||||
// open the file
|
||||
std::ofstream ofile(fileName);
|
||||
|
||||
if(!ofile)
|
||||
{
|
||||
G4cerr << "ERROR : DumpToFile : File open error -> " << fileName << G4endl;
|
||||
return;
|
||||
}
|
||||
ofile << "# mesh name: " << fScoringMesh->GetWorldName() << G4endl;
|
||||
|
||||
// retrieve the map
|
||||
MeshScoreMap fSMap = fScoringMesh -> GetScoreMap();
|
||||
// retrieve the map
|
||||
MeshScoreMap fSMap = fScoringMesh -> GetScoreMap();
|
||||
|
||||
MeshScoreMap::const_iterator msMapItr = fSMap.find(psName);
|
||||
if(msMapItr == fSMap.end()) {
|
||||
G4cerr << "ERROR : DumpToFile : Unknown quantity, \""
|
||||
<< psName << "\"." << G4endl;
|
||||
return;
|
||||
MeshScoreMap::const_iterator msMapItr = fSMap.find(psName);
|
||||
|
||||
if(msMapItr == fSMap.end())
|
||||
{
|
||||
G4cerr << "ERROR : DumpToFile : Unknown quantity, \""<< psName
|
||||
<< "\"." << G4endl;
|
||||
return;
|
||||
}
|
||||
std::map<G4int, G4double*> * score = msMapItr -> second-> GetMap();
|
||||
ofile << "# primitive scorer name: " << msMapItr -> first << G4endl;
|
||||
|
||||
|
||||
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
|
||||
|
||||
//
|
||||
// Open a ROOT output file
|
||||
//
|
||||
|
||||
analysisManager -> OpenFile("brachytherapy");
|
||||
|
||||
//
|
||||
// Creating ntuple
|
||||
//
|
||||
analysisManager -> CreateNtuple("EnergyDeposition", "Edep(keV) in the phantom");
|
||||
analysisManager -> CreateNtupleDColumn("xx");
|
||||
analysisManager -> CreateNtupleDColumn("yy");
|
||||
analysisManager -> CreateNtupleDColumn("zz");
|
||||
analysisManager -> CreateNtupleDColumn("edep");
|
||||
analysisManager -> FinishNtuple();
|
||||
|
||||
//
|
||||
// Write quantity in the ASCII output file and in brachytherapy.root
|
||||
//
|
||||
ofile << std::setprecision(16); // for double value with 8 bytes
|
||||
for(int x = 0; x < fNMeshSegments[0]; x++) {
|
||||
for(int y = 0; y < fNMeshSegments[1]; y++) {
|
||||
for(int z = 0; z < fNMeshSegments[2]; z++) {
|
||||
|
||||
G4int numberOfVoxel = fNMeshSegments[0];
|
||||
|
||||
// If the voxel width is changed in the macro file,
|
||||
// the voxel width variable must be updated
|
||||
G4double voxelWidth = 1. *mm;
|
||||
//
|
||||
|
||||
G4double xx = ( - numberOfVoxel + 1+ 2*x )* voxelWidth/2;
|
||||
G4double yy = ( - numberOfVoxel + 1+ 2*y )* voxelWidth/2;
|
||||
G4double zz = ( - numberOfVoxel + 1+ 2*z )* voxelWidth/2;
|
||||
|
||||
std::map<G4int, G4double*> * score = msMapItr -> second-> GetMap();
|
||||
|
||||
ofile << "# primitive scorer name: " << msMapItr -> first << G4endl;
|
||||
//
|
||||
// Write quantity in the ASCII output file and in brachytherapy.root
|
||||
//
|
||||
ofile << std::setprecision(16); // for double value with 8 bytes
|
||||
|
||||
for(int x = 0; x < fNMeshSegments[0]; x++) {
|
||||
for(int y = 0; y < fNMeshSegments[1]; y++) {
|
||||
for(int z = 0; z < fNMeshSegments[2]; z++){
|
||||
G4int numberOfVoxel = fNMeshSegments[0];
|
||||
// If the voxel width is changed in the macro file,
|
||||
// the voxel width variable must be updated
|
||||
G4double voxelWidth = 1. *mm;
|
||||
//
|
||||
G4double xx = ( - numberOfVoxel + 1+ 2*x )* voxelWidth/2;
|
||||
G4double yy = ( - numberOfVoxel + 1+ 2*y )* voxelWidth/2;
|
||||
G4double zz = ( - numberOfVoxel + 1+ 2*z )* voxelWidth/2;
|
||||
G4int idx = GetIndex(x, y, z);
|
||||
|
||||
std::map<G4int, G4double*>::iterator value = score -> find(idx);
|
||||
|
||||
if (value != score -> end())
|
||||
std::map<G4int, G4double*>::iterator value = score -> find(idx);
|
||||
|
||||
if (value != score -> end())
|
||||
{
|
||||
// Print in the ASCII output file the information
|
||||
ofile << xx << " " << yy << " " << zz <<" " <<*(value->second)/keV << G4endl;
|
||||
|
||||
// Print in the ASCII output file the information
|
||||
ofile << xx << " " << yy << " " << zz <<" "
|
||||
<<*(value->second)/keV << G4endl;
|
||||
|
||||
#ifdef ANALYSIS_USE
|
||||
// Save the same information in the output analysis file
|
||||
analysisManager = G4AnalysisManager::Instance();
|
||||
analysisManager -> FillNtupleDColumn(0, xx);
|
||||
analysisManager -> FillNtupleDColumn(1, yy);
|
||||
analysisManager -> FillNtupleDColumn(2, zz);
|
||||
analysisManager -> FillNtupleDColumn(3, *(value->second)/keV);
|
||||
analysisManager -> AddNtupleRow();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ofile << std::setprecision(6);
|
||||
analysis -> FillNtupleWithEnergyDeposition(xx, yy, zz, *(value->second)/keV);
|
||||
#endif
|
||||
}}}}
|
||||
|
||||
// Close the output ASCII file
|
||||
ofile.close();
|
||||
ofile << std::setprecision(6);
|
||||
|
||||
// Close the output brachytherapy.root
|
||||
analysisManager -> Write();
|
||||
analysisManager -> CloseFile();
|
||||
// Close the output ASCII file
|
||||
ofile.close();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user