Import Geant4 6.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 10:49:58 +02:00
parent 96686e0c8f
commit 1d812b78b1
4545 changed files with 24433 additions and 175005 deletions
@@ -29,8 +29,8 @@
// * *
// *******************************
//
// $Id: BrachyAnalysisManager.cc,v 1.12 2003/12/09 15:29:54 gunter Exp $
// GEANT4 tag $Name: geant4-06-00 $
// $Id: BrachyAnalysisManager.cc,v 1.13 2004/03/11 15:38:42 guatelli Exp $
// GEANT4 tag $Name: geant4-06-01 $
//
#ifdef G4ANALYSIS_USE
#include <stdlib.h>
@@ -102,6 +102,9 @@ void BrachyAnalysisManager::book()
//creating a 2D histogram ...
h2 = histFact->createHistogram1D("20","Initial Energy", //histoID,histo name
100,0.,1.); //bins' number, xmin, xmax
h3 = histFact->createHistogram1D("30","Dose Distribution",
300,-150.,150.); //bins' number, xmin, xmax
//defining the ntuple columns' name ...
std::string columnNames = "float energy; float x; float y; float z";
@@ -138,7 +141,7 @@ void BrachyAnalysisManager::FillNtupleWithEnergy(G4double xx,
void BrachyAnalysisManager::FillHistogramWithEnergy(G4double x,
G4double z,
G4float energyDeposit)
G4double energyDeposit)
{
//2DHistrogram: energy deposit in a voxel which center is fixed in position (x,z)
h1->fill(x,z,energyDeposit);
@@ -149,6 +152,11 @@ void BrachyAnalysisManager::PrimaryParticleEnergySpectrum(G4double primaryPartic
//1DHisotgram: energy spectrum of primary particles
h2->fill(primaryParticleEnergy);
}
void BrachyAnalysisManager::DoseDistribution(G4double x,G4double energy)
{
//1DHisotgram: energy spectrum of primary particles
h3->fill(x, energy);
}
void BrachyAnalysisManager::finish()
{
@@ -34,8 +34,8 @@
// * *
// ****************************************
//
// $Id: BrachyDetectorConstruction.cc,v 1.22 2003/12/09 15:29:55 gunter Exp $
// GEANT4 tag $Name: geant4-06-00 $
// $Id: BrachyDetectorConstruction.cc,v 1.24 2004/03/11 16:05:02 guatelli Exp $
// GEANT4 tag $Name: geant4-06-01 $
//
#include "BrachyPhantomROGeometry.hh"
#include "BrachyPhantomSD.hh"
@@ -82,9 +82,9 @@ BrachyDetectorConstruction::BrachyDetectorConstruction(G4String &SDName)
Phantom(0), PhantomLog(0), PhantomPhys(0),
phantomAbsorberMaterial(0)
{
phantomDimensionX=30*cm ;
phantomDimensionY=30*cm;
phantomDimensionZ=30*cm;
phantomDimensionX=15.*cm ;
phantomDimensionY=15.*cm;
phantomDimensionZ=15.*cm;
numberOfVoxelsAlongX=300;
numberOfVoxelsAlongZ=300;
@@ -177,7 +177,7 @@ void BrachyDetectorConstruction::ConstructPhantom()
G4Colour lblue (0.0, 0.0, .75);
G4Material* air=pMaterial->GetMat("Air") ;
G4Material* soft=pMaterial->GetMat("tissue");
G4Material* water=pMaterial->GetMat("Water");
ComputeDimVoxel();
@@ -187,8 +187,8 @@ void BrachyDetectorConstruction::ConstructPhantom()
WorldPhys = new G4PVPlacement(0,G4ThreeVector(),"WorldPhys",WorldLog,0,false,0);
// Water Box
Phantom = new G4Box("Phantom",phantomDimensionX/2,phantomDimensionY/2,phantomDimensionZ/2);
PhantomLog = new G4LogicalVolume(Phantom,soft,"PhantomLog",0,0,0);
Phantom = new G4Box("Phantom",phantomDimensionX,phantomDimensionY,phantomDimensionZ);
PhantomLog = new G4LogicalVolume(Phantom,water,"PhantomLog",0,0,0);
PhantomPhys = new G4PVPlacement(0,G4ThreeVector(),"PhantomPhys",PhantomLog,WorldPhys,false,0);
WorldLog->SetVisAttributes (G4VisAttributes::Invisible);
@@ -207,7 +207,7 @@ void BrachyDetectorConstruction::ConstructSensitiveDetector()
if(!phantomSD)
{
phantomSD = new BrachyPhantomSD(sensitiveDetectorName,numberOfVoxelsAlongX,numberOfVoxelsAlongZ);
phantomSD = new BrachyPhantomSD(sensitiveDetectorName);
G4String ROGeometryName = "PhantomROGeometry";
phantomROGeometry = new BrachyPhantomROGeometry(ROGeometryName,phantomDimensionX,phantomDimensionZ,numberOfVoxelsAlongX,numberOfVoxelsAlongZ);
phantomROGeometry->BuildROGeometry();
@@ -34,7 +34,7 @@
// ****************************************
//
// $Id: BrachyDetectorConstructionI.cc,v 1.6 2003/12/09 15:29:56 gunter Exp $
// GEANT4 tag $Name: geant4-06-00 $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
//
#include "globals.hh"
#include "BrachyDetectorConstructionI.hh"
@@ -34,8 +34,8 @@
// * *
// ****************************************
//
// $Id: BrachyDetectorConstructionIr.cc,v 1.7 2003/12/09 15:29:57 gunter Exp $
// GEANT4 tag $Name: geant4-06-00 $
// $Id: BrachyDetectorConstructionIr.cc,v 1.8 2004/03/11 15:38:42 guatelli Exp $
// GEANT4 tag $Name: geant4-06-01 $
//
#include "globals.hh"
#include "BrachyDetectorConstructionIr.hh"
@@ -93,7 +93,7 @@ void BrachyDetectorConstructionIr::ConstructIridium(G4VPhysicalVolume* mother)
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),
G4ThreeVector(0,0,-1.975*mm),
"CapsulePhys",
capsuleLog,
mother,
@@ -36,7 +36,7 @@
//
//
// $Id: BrachyDetectorConstructionLeipzig.cc,v 1.7 2003/12/09 15:29:58 gunter Exp $
// GEANT4 tag $Name: geant4-06-00 $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
//
#include "globals.hh"
@@ -32,7 +32,7 @@
//
//
// $Id: BrachyDetectorMessenger.cc,v 1.8 2003/05/26 09:20:14 guatelli Exp $
// GEANT4 tag $Name: geant4-06-00 $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
//
//
@@ -29,8 +29,8 @@
// * *
// *******************************
//
// $Id: BrachyEventAction.cc,v 1.17 2003/05/27 08:37:54 guatelli Exp $
// GEANT4 tag $Name: geant4-06-00 $
// $Id: BrachyEventAction.cc,v 1.19 2004/03/11 16:05:03 guatelli Exp $
// GEANT4 tag $Name: geant4-06-01 $
//
#include "BrachyEventAction.hh"
#include "BrachyPhantomHit.hh"
@@ -54,72 +54,22 @@
// Retrieve information about the energy deposit in the phantom ...
BrachyEventAction::BrachyEventAction(G4String &SDName) :
BrachyEventAction::BrachyEventAction() :
drawFlag("all" )
{
hitsCollectionID = -1;
G4String sensitiveDetectorName = SDName;
detector=new BrachyDetectorConstruction(sensitiveDetectorName);
numberOfVoxelZ = detector->GetNumVoxelZ();
voxelWidthZ = 0.1*cm;
}
BrachyEventAction::~BrachyEventAction()
{
delete detector;
}
void BrachyEventAction::BeginOfEventAction(const G4Event*)
{
G4SDManager* sensitiveDetectorManager = G4SDManager::GetSDMpointer();
if(hitsCollectionID == -1)
hitsCollectionID =
sensitiveDetectorManager->GetCollectionID("PhantomHitsCollection");
}
void BrachyEventAction::EndOfEventAction(const G4Event* evt)
{
if(hitsCollectionID < 0) return;
G4HCofThisEvent* HCE = evt->GetHCofThisEvent();
BrachyPhantomHitsCollection* CHC = NULL;
if(HCE)
CHC = (BrachyPhantomHitsCollection*)(HCE->GetHC(hitsCollectionID));
if(CHC)
{
G4int hitCount = CHC->entries();
for (G4int h = 0; h < hitCount; h++)
{
#ifdef G4ANALYSIS_USE
//Store information about energy deposit in a 2DHistogram and in
// a ntuple ...
BrachyAnalysisManager* analysis =
BrachyAnalysisManager::getInstance();
G4int i=((*CHC)[h])->GetZID();
G4int k=((*CHC)[h])->GetXID();
G4int j=((*CHC)[h])->GetYID();
G4double EnergyDep=((*CHC)[h]->GetEdep());
G4double x = (-numberOfVoxelZ+1+2*k)*voxelWidthZ/2;
G4double z = (- numberOfVoxelZ+1+2*i)*voxelWidthZ/2;
G4double y = (- numberOfVoxelZ+1+2*j)*voxelWidthZ/2;
if(EnergyDep != 0)
{
if (y<1.*mm){if (y> -1.*mm)
{analysis->FillHistogramWithEnergy(x,z,EnergyDep/MeV);}}
}
if(EnergyDep != 0)analysis->FillNtupleWithEnergy(x,y,z,EnergyDep/MeV);
#endif
}
}
// extract the trajectories and draw them ...
if (G4VVisManager::GetConcreteInstance())
@@ -32,7 +32,7 @@
// *******************************
//
// $Id: BrachyFactory.cc,v 1.5 2003/12/09 15:29:59 gunter Exp $
// GEANT4 tag $Name: geant4-06-00 $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
//
#include"BrachyFactory.hh"
@@ -30,7 +30,7 @@
// *******************************
//
// $Id: BrachyFactoryI.cc,v 1.4 2003/05/22 17:20:43 guatelli Exp $
// GEANT4 tag $Name: geant4-06-00 $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
//
#include "BrachyFactoryI.hh"
#include "BrachyPrimaryGeneratorActionI.hh"
@@ -30,7 +30,7 @@
// *******************************
//
// $Id: BrachyFactoryIr.cc,v 1.4 2003/05/22 17:20:43 guatelli Exp $
// GEANT4 tag $Name: geant4-06-00 $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
//
#include "globals.hh"
#include "BrachyFactoryIr.hh"
@@ -30,7 +30,7 @@
// *******************************
//
// $Id: BrachyFactoryLeipzig.cc,v 1.4 2003/05/22 17:20:43 guatelli Exp $
// GEANT4 tag $Name: geant4-06-00 $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
//
#include "globals.hh"
@@ -29,8 +29,8 @@
// * *
// *******************************
//
// $Id: BrachyMaterial.cc,v 1.4 2003/05/27 08:37:54 guatelli Exp $
// GEANT4 tag $Name: geant4-06-00 $
// $Id: BrachyMaterial.cc,v 1.5 2004/03/11 15:38:42 guatelli Exp $
// GEANT4 tag $Name: geant4-06-01 $
//
#include "G4MaterialPropertiesTable.hh"
@@ -153,6 +153,8 @@ void BrachyMaterial::DefineMaterials()
matH2O = new G4Material("Water",d,2);
matH2O->AddElement(elH,2);
matH2O->AddElement(elO,1);
matH2O->GetIonisation()->SetMeanExcitationEnergy(75.0*eV);
//soft tissue(http://www.nist.gov)
d = 1.0*g/cm3;
@@ -31,7 +31,7 @@
// ********************************
//
// $Id: BrachyPhantomHit.cc,v 1.5 2003/05/27 08:37:55 guatelli Exp $
// GEANT4 tag $Name: geant4-06-00 $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
//
#include "BrachyPhantomHit.hh"
#include "G4ios.hh"
@@ -30,8 +30,8 @@
// * *
// ************************************
//
// $Id: BrachyPhantomROGeometry.cc,v 1.7 2003/11/18 13:31:46 guatelli Exp $
// GEANT4 tag $Name: geant4-06-00 $
// $Id: BrachyPhantomROGeometry.cc,v 1.8 2004/03/11 15:38:43 guatelli Exp $
// GEANT4 tag $Name: geant4-06-01 $
//
#include "BrachyPhantomROGeometry.hh"
#include "BrachyDummySD.hh"
@@ -77,20 +77,15 @@ G4VPhysicalVolume* BrachyPhantomROGeometry::Build()
G4double worldDimensionY = 4.0*m;
G4double worldDimensionZ = 4.0*m;
G4double halfPhantomDimensionX = phantomDimensionX/2;
G4double halfPhantomDimensionZ = phantomDimensionZ/2;
G4double halfPhantomDimensionY = phantomDimensionX/2 ;
G4double halfPhantomDimensionX = phantomDimensionX;
G4double halfPhantomDimensionZ = phantomDimensionZ;
G4double halfPhantomDimensionY = phantomDimensionX;
// variables for x division ...
G4double halfXVoxelDimensionX = halfPhantomDimensionX/numberOfVoxelsAlongX;
G4double halfXVoxelDimensionZ = halfPhantomDimensionZ;
G4double voxelXThickness = 2*halfXVoxelDimensionX;
// variables for z and y division ...
G4double halfZVoxelDimensionX = halfPhantomDimensionX;
G4double halfZVoxelDimensionZ = halfPhantomDimensionZ/numberOfVoxelsAlongZ;
G4double voxelZThickness = 2*halfZVoxelDimensionZ;
// world volume of ROGeometry ...
G4Box *ROWorld = new G4Box("ROWorld",
worldDimensionX,
@@ -148,9 +143,9 @@ G4VPhysicalVolume* BrachyPhantomROGeometry::Build()
// ...then Z division
G4Box *ROPhantomZDivision = new G4Box("ROPhantomZDivision",
halfZVoxelDimensionX,
halfZVoxelDimensionX,
halfZVoxelDimensionZ);
halfXVoxelDimensionX,
halfXVoxelDimensionZ,
halfXVoxelDimensionX);
G4LogicalVolume *ROPhantomZDivisionLog = new G4LogicalVolume(ROPhantomZDivision,
dummyMat,
@@ -162,13 +157,13 @@ G4VPhysicalVolume* BrachyPhantomROGeometry::Build()
ROPhantomXDivisionPhys,
kZAxis,
numberOfVoxelsAlongZ,
voxelZThickness);
voxelXThickness);
// ...then Y division
G4Box *ROPhantomYDivision = new G4Box("ROPhantomYDivision",
halfZVoxelDimensionZ,
halfZVoxelDimensionZ,
halfZVoxelDimensionZ);
halfXVoxelDimensionX,
halfXVoxelDimensionX,
halfXVoxelDimensionX);
G4LogicalVolume *ROPhantomYDivisionLog = new G4LogicalVolume(ROPhantomYDivision,
dummyMat,
@@ -180,7 +175,7 @@ G4VPhysicalVolume* BrachyPhantomROGeometry::Build()
ROPhantomZDivisionPhys,
kYAxis,
numberOfVoxelsAlongZ,
voxelZThickness);
voxelXThickness);
BrachyDummySD *dummySD = new BrachyDummySD;
ROPhantomYDivisionLog->SetSensitiveDetector(dummySD);
@@ -30,12 +30,12 @@
// * *
// ********************************
//
// $Id: BrachyPhantomSD.cc,v 1.5 2003/05/26 09:20:14 guatelli Exp $
// GEANT4 tag $Name: geant4-06-00 $
// $Id: BrachyPhantomSD.cc,v 1.7 2004/03/11 16:05:03 guatelli Exp $
// GEANT4 tag $Name: geant4-06-01 $
//
#include "BrachyPhantomSD.hh"
#include "BrachyPhantomHit.hh"
#include "BrachyAnalysisManager.hh"
#include "BrachyDetectorConstruction.hh"
#include "G4Track.hh"
#include "G4LogicalVolume.hh"
@@ -48,30 +48,18 @@
//....
BrachyPhantomSD::BrachyPhantomSD(G4String name, G4int NumVoxelX, G4int NumVoxelZ)
:G4VSensitiveDetector(name),numberOfVoxelsX(NumVoxelX),numberOfVoxelsZ(NumVoxelZ)
BrachyPhantomSD::BrachyPhantomSD(G4String name):G4VSensitiveDetector(name)
{
G4String HCname;
collectionName.insert(HCname = "PhantomHitsCollection");
voxelID = new G4int[numberOfVoxelsX * numberOfVoxelsZ * numberOfVoxelsZ];
phantomHitsCollection = NULL;
}
BrachyPhantomSD::~BrachyPhantomSD()
{
delete[] voxelID;
}
void BrachyPhantomSD::Initialize(G4HCofThisEvent*)
{
G4int numberOfVoxelsY = 300;
phantomHitsCollection = new BrachyPhantomHitsCollection(SensitiveDetectorName,collectionName[0]);
for(G4int k=0;k<numberOfVoxelsZ;k++)
for(G4int i=0;i<numberOfVoxelsX;i++)
for(G4int j=0;j<numberOfVoxelsY;j++)
voxelID[i+k*numberOfVoxelsX+j*numberOfVoxelsY*numberOfVoxelsY] = -1;
}
}
G4bool BrachyPhantomSD::ProcessHits(G4Step* aStep, G4TouchableHistory* ROhist)
{
@@ -85,43 +73,40 @@ G4bool BrachyPhantomSD::ProcessHits(G4Step* aStep, G4TouchableHistory* ROhist)
if(energyDeposit == 0.)
return false;
G4VPhysicalVolume* physVol = ROhist->GetVolume();
//G4VPhysicalVolume* mothVol = ROhist->GetVolume(1);
// Read Voxel indexes: i is the x index, k is the z index
G4int k = ROhist->GetReplicaNumber(1);
G4int i = ROhist->GetReplicaNumber(2);
G4int j= ROhist->GetReplicaNumber();
if(voxelID[i+k*numberOfVoxelsX+j*numberOfVoxelsX*numberOfVoxelsX] == -1)
{
BrachyPhantomHit* PhantomHit = new BrachyPhantomHit(physVol->GetLogicalVolume(),i,j,k);
G4RotationMatrix rotM;
if(physVol->GetObjectRotation())
rotM = *(physVol->GetObjectRotation());
PhantomHit->SetEdep(energyDeposit);
PhantomHit->SetPos(physVol->GetTranslation());
PhantomHit->SetRot(rotM);
G4int VoxelID = phantomHitsCollection->insert(PhantomHit);
voxelID[i+k*numberOfVoxelsX+j*numberOfVoxelsX*numberOfVoxelsX] = VoxelID - 1;
}
else
(*phantomHitsCollection)
[voxelID[i+k*numberOfVoxelsX+j*numberOfVoxelsX*numberOfVoxelsX]]->AddEdep(energyDeposit);
G4int j = ROhist->GetReplicaNumber();
G4int numberOfVoxelZ = 300;
G4double voxelWidthZ = 1. *mm;
G4double x = (-numberOfVoxelZ+1+2*i)*voxelWidthZ/2;
G4double y = (- numberOfVoxelZ+1+2*j)*voxelWidthZ/2;
G4double z = (- numberOfVoxelZ+1+2*k)*voxelWidthZ/2;
if(energyDeposit != 0)
{
#ifdef G4ANALYSIS_USE
BrachyAnalysisManager* analysis =
BrachyAnalysisManager::getInstance();
analysis -> FillNtupleWithEnergy(x,y,z,energyDeposit);
if (y<0.8*mm && y> -0.8*mm)
{
analysis -> FillHistogramWithEnergy(x,z,energyDeposit/MeV);
if (z<0.8*mm && z> -0.8*mm)
analysis -> DoseDistribution(x,energyDeposit/MeV);
}
#endif
}
return true;
}
void BrachyPhantomSD::EndOfEvent(G4HCofThisEvent*HCE)
void BrachyPhantomSD::EndOfEvent(G4HCofThisEvent*)
{
static G4int HCID = -1;
if(HCID<0)
{
HCID = GetCollectionID(0);
}
HCE->AddHitsCollection(HCID,phantomHitsCollection);
}
void BrachyPhantomSD::clear()
@@ -30,8 +30,8 @@
// * *
// **********************************
//
// $Id: BrachyPhysicsList.cc,v 1.9 2003/10/20 18:09:18 vnivanch Exp $
// GEANT4 tag $Name: geant4-06-00 $
// $Id: BrachyPhysicsList.cc,v 1.10 2004/01/08 17:25:13 silvarod Exp $
// GEANT4 tag $Name: geant4-06-01 $
//
#include "BrachyPhysicsList.hh"
@@ -126,6 +126,7 @@ void BrachyPhysicsList::ConstructEM()
//electron
loweIon = new G4LowEnergyIonisation("LowEnergyIoni");
loweBrem = new G4LowEnergyBremsstrahlung("LowEnBrem");
loweBrem->SetAngularGenerator("tsai");
pmanager->AddProcess(new G4MultipleScattering, -1, 1,1);
pmanager->AddProcess(loweIon, -1, 2,2);
@@ -35,7 +35,7 @@
// ********************************************
//
// $Id: BrachyPrimaryGeneratorAction.cc,v 1.16 2003/12/09 15:30:00 gunter Exp $
// GEANT4 tag $Name: geant4-06-00 $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
//
#include "globals.hh"
#include "BrachyPrimaryGeneratorAction.hh"
@@ -35,7 +35,7 @@
// ********************************************
//
// $Id: BrachyPrimaryGeneratorActionI.cc,v 1.7 2003/12/09 15:30:01 gunter Exp $
// GEANT4 tag $Name: geant4-06-00 $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
//
#include "BrachyPrimaryGeneratorActionI.hh"
@@ -34,8 +34,8 @@
// * *
// ********************************************
//
// $Id: BrachyPrimaryGeneratorActionIr.cc,v 1.7 2003/12/09 15:30:02 gunter Exp $
// GEANT4 tag $Name: geant4-06-00 $
// $Id: BrachyPrimaryGeneratorActionIr.cc,v 1.8 2004/03/11 15:38:43 guatelli Exp $
// GEANT4 tag $Name: geant4-06-01 $
//
#include "BrachyPrimaryGeneratorActionIr.hh"
@@ -83,7 +83,7 @@ void BrachyPrimaryGeneratorActionIr::GeneratePrimaries(G4Event* anEvent)
y = (G4UniformRand()-0.5)*(radius)/0.5;
}while(x*x+y*y > radius*radius);
z = (G4UniformRand()-0.5)*1.75*mm/0.5 ;
z = (G4UniformRand()-0.5)*1.75*mm/0.5 -1.975*mm ;
G4ThreeVector position(x,y,z);
particleGun->SetParticlePosition(position);
@@ -36,7 +36,7 @@
// *******************************
//
// $Id: BrachyRunAction.cc,v 1.13 2003/12/09 15:30:03 gunter Exp $
// GEANT4 tag $Name: geant4-06-00 $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
//
#include "BrachyRunAction.hh"
@@ -24,7 +24,7 @@
// S.Guatelli
//
// $Id: BrachyRunMessenger.cc,v 1.4 2003/05/22 17:20:44 guatelli Exp $
// GEANT4 tag $Name: geant4-06-00 $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
//
//
//
@@ -29,7 +29,7 @@
// *******************************
//
// $Id: BrachyVisManager.cc,v 1.7 2003/11/12 16:44:13 johna Exp $
// GEANT4 tag $Name: geant4-06-00 $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
//
#ifdef G4VIS_USE