Import Geant4 10.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-10 11:51:14 +02:00
parent e2d2f9810a
commit 286caacf06
12421 changed files with 730077 additions and 502383 deletions
@@ -23,31 +23,53 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// -------------------------------------------------------------------
// $Id$
// -------------------------------------------------------------------
// 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 publication:
// Med. Phys. 37 (2010) 4692-4708
// The Geant4-DNA web site is available at http://geant4-dna.org
//
// If you use this example, please cite the following publication:
// Rad. Prot. Dos. 133 (2009) 2-11
#include "MicrobeamTrackingAction.hh"
#include "MicrobeamRunAction.hh"
#include "ActionInitialization.hh"
#include "PrimaryGeneratorAction.hh"
#include "RunAction.hh"
#include "EventAction.hh"
#include "SteppingAction.hh"
#include "DetectorConstruction.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
MicrobeamTrackingAction::MicrobeamTrackingAction(MicrobeamRunAction* run)
:Run(run)
{ }
ActionInitialization::ActionInitialization(DetectorConstruction* detConstruction)
: G4VUserActionInitialization(),
fDetectorConstruction(detConstruction)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void MicrobeamTrackingAction::PostUserTrackingAction(const G4Track*)
{
ActionInitialization::~ActionInitialization()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ActionInitialization::BuildForMaster() const
{
// No specific action for Master
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ActionInitialization::Build() const
{
SetUserAction(new PrimaryGeneratorAction());
RunAction* runAction= new RunAction(fDetectorConstruction);
SetUserAction(runAction);
SetUserAction(new EventAction(runAction));
SetUserAction(new SteppingAction(runAction,fDetectorConstruction));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,48 +23,54 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// -------------------------------------------------------------------
// $Id$
// -------------------------------------------------------------------
// 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 publication:
// Med. Phys. 37 (2010) 4692-4708
// The Geant4-DNA web site is available at http://geant4-dna.org
//
// If you use this example, please cite the following publication:
// Rad. Prot. Dos. 133 (2009) 2-11
#include "G4VPhysicalVolume.hh"
#include "CellParameterisation.hh"
#include "G4LogicalVolume.hh"
#include "MicrobeamCellParameterisation.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
MicrobeamCellParameterisation::MicrobeamCellParameterisation
CellParameterisation::CellParameterisation
(G4int NoBoxes, G4float DimBoxX, G4float DimBoxY, G4float DimBoxZ,
G4Material * nucleus1, G4Material * cytoplasm1,
G4Material * nucleus2, G4Material * cytoplasm2,
G4Material * nucleus3, G4Material * cytoplasm3
)
{
nucleusMaterial1 = nucleus1;
cytoplasmMaterial1 = cytoplasm1;
nucleusMaterial2 = nucleus2;
cytoplasmMaterial2 = cytoplasm2;
nucleusMaterial3 = nucleus3;
cytoplasmMaterial3 = cytoplasm3;
fNucleusMaterial1 = nucleus1;
fCytoplasmMaterial1 = cytoplasm1;
fNucleusMaterial2 = nucleus2;
fCytoplasmMaterial2 = cytoplasm2;
fNucleusMaterial3 = nucleus3;
fCytoplasmMaterial3 = cytoplasm3;
NoCellBoxes = NoBoxes;
DimCellBoxX = DimBoxX;
DimCellBoxY = DimBoxY;
DimCellBoxZ = DimBoxZ;
fNoCellBoxes = NoBoxes;
fDimCellBoxX = DimBoxX;
fDimCellBoxY = DimBoxY;
fDimCellBoxZ = DimBoxZ;
mapCell = new G4ThreeVector[NoCellBoxes];
material = new G4float[NoCellBoxes];
mass = new G4float[NoCellBoxes];
fMapCell = new G4ThreeVector[fNoCellBoxes];
fMaterial = new G4float[fNoCellBoxes];
fMass = new G4float[fNoCellBoxes];
G4int ncols,nlines;
G4int shiftX, shiftY, shiftZ;
G4float x,y,z,mat,den,tmp,sizeZ;
ncols=0; nlines=0;
// READ PHANTOM
FILE *fMap;
fMap = fopen("phantom.dat","r");
while (1)
{
if (nlines >= 0 && nlines <=1 ) ncols = fscanf(fMap,"%f %f %f",&tmp,&tmp,&sizeZ);
@@ -74,13 +80,13 @@ MicrobeamCellParameterisation::MicrobeamCellParameterisation
if (nlines > 4) ncols = fscanf(fMap,"%f %f %f %f %f %f",&x,&y,&z,&mat,&den,&tmp);
if (ncols < 0) break;
G4ThreeVector v(x+shiftX,y+shiftY,z-1500/sizeZ-shiftZ); // VOXEL SHIFT TO CENTER PHANTOM
G4ThreeVector v(x+shiftX,y+shiftY,z-1500/sizeZ-shiftZ); // VOXEL SHIFT IN ORDER TO CENTER PHANTOM
if (nlines>4)
{
mapCell[nlines-5]=v;
material[nlines-5]=mat;
mass[nlines-5]=den;
fMapCell[nlines-5]=v;
fMaterial[nlines-5]=mat;
fMass[nlines-5]=den;
}
nlines++;
@@ -88,114 +94,113 @@ MicrobeamCellParameterisation::MicrobeamCellParameterisation
fclose(fMap);
// NUCLEUS IN GREEN
nucleusAttributes1 = new G4VisAttributes;
nucleusAttributes1->SetColour(G4Colour(0,.8,0));
nucleusAttributes1->SetForceSolid(false);
fNucleusAttributes1 = new G4VisAttributes;
fNucleusAttributes1->SetColour(G4Colour(0,.8,0));
fNucleusAttributes1->SetForceSolid(false);
nucleusAttributes2 = new G4VisAttributes;
nucleusAttributes2->SetColour(G4Colour(0,.9,0));
nucleusAttributes2->SetForceSolid(false);
fNucleusAttributes2 = new G4VisAttributes;
fNucleusAttributes2->SetColour(G4Colour(0,.9,0));
fNucleusAttributes2->SetForceSolid(false);
nucleusAttributes3 = new G4VisAttributes;
nucleusAttributes3->SetColour(G4Colour(0,1,0));
nucleusAttributes3->SetForceSolid(false);
fNucleusAttributes3 = new G4VisAttributes;
fNucleusAttributes3->SetColour(G4Colour(0,1,0));
fNucleusAttributes3->SetForceSolid(false);
// CYTOPLASM IN RED
cytoplasmAttributes1 = new G4VisAttributes;
cytoplasmAttributes1->SetColour(G4Colour(1,0,0));
cytoplasmAttributes1->SetForceSolid(false);
// CYTOPLASM IN RED
fCytoplasmAttributes1 = new G4VisAttributes;
fCytoplasmAttributes1->SetColour(G4Colour(1,0,0));
fCytoplasmAttributes1->SetForceSolid(false);
cytoplasmAttributes2 = new G4VisAttributes; // nucleoli in yellow
cytoplasmAttributes2->SetColour(G4Colour(1.,1.,0));
cytoplasmAttributes2->SetForceSolid(false);
fCytoplasmAttributes2 = new G4VisAttributes; // nucleoli in yellow
fCytoplasmAttributes2->SetColour(G4Colour(1.,1.,0));
fCytoplasmAttributes2->SetForceSolid(false);
cytoplasmAttributes3 = new G4VisAttributes;
cytoplasmAttributes3->SetColour(G4Colour(1,0,0));
cytoplasmAttributes3->SetForceSolid(false);
fCytoplasmAttributes3 = new G4VisAttributes;
fCytoplasmAttributes3->SetColour(G4Colour(1,0,0));
fCytoplasmAttributes3->SetForceSolid(false);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
MicrobeamCellParameterisation::~MicrobeamCellParameterisation()
CellParameterisation::~CellParameterisation()
{
delete[] mapCell;
delete[] material;
delete[] mass;
delete[] fMapCell;
delete[] fMaterial;
delete[] fMass;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void MicrobeamCellParameterisation::ComputeTransformation
void CellParameterisation::ComputeTransformation
(const G4int copyNo, G4VPhysicalVolume* physVol) const
{
G4ThreeVector
origin(
mapCell[copyNo].x()*DimCellBoxX*2,
mapCell[copyNo].y()*DimCellBoxY*2,
mapCell[copyNo].z()*DimCellBoxZ*2);
fMapCell[copyNo].x()*fDimCellBoxX*2,
fMapCell[copyNo].y()*fDimCellBoxY*2,
fMapCell[copyNo].z()*fDimCellBoxZ*2);
physVol->SetTranslation(origin);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void MicrobeamCellParameterisation::ComputeDimensions
void CellParameterisation::ComputeDimensions
(G4Box& /*trackerChamber*/, const G4int /*copyNo*/, const G4VPhysicalVolume*) const
{
}
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4Material*
MicrobeamCellParameterisation::ComputeMaterial(const G4int copyNo,
CellParameterisation::ComputeMaterial(const G4int copyNo,
G4VPhysicalVolume* physVol,
const G4VTouchable*)
{
if( material[copyNo] == 2 ) // material 2 is nucleus
if( fMaterial[copyNo] == 2 ) // fMaterial 2 is nucleus
{
if( mass[copyNo] == 1 )
if( fMass[copyNo] == 1 )
{
physVol->SetName("physicalNucleus");
physVol->GetLogicalVolume()->SetVisAttributes( nucleusAttributes1 );
return nucleusMaterial1;
physVol->GetLogicalVolume()->SetVisAttributes( fNucleusAttributes1 );
return fNucleusMaterial1;
}
if( mass[copyNo] == 2 )
if( fMass[copyNo] == 2 )
{
physVol->SetName("physicalNucleus");
physVol->GetLogicalVolume()->SetVisAttributes( nucleusAttributes2 );
return nucleusMaterial2;
physVol->GetLogicalVolume()->SetVisAttributes( fNucleusAttributes2 );
return fNucleusMaterial2;
}
if( mass[copyNo] == 3 )
if( fMass[copyNo] == 3 )
{
physVol->SetName("physicalNucleus");
physVol->GetLogicalVolume()->SetVisAttributes( nucleusAttributes3 );
return nucleusMaterial3;
physVol->GetLogicalVolume()->SetVisAttributes( fNucleusAttributes3 );
return fNucleusMaterial3;
}
}
else if( material[copyNo] == 1 ) // material 1 is cytoplasm
else if( fMaterial[copyNo] == 1 ) // fMaterial 1 is cytoplasm
{
if( mass[copyNo] == 1 )
if( fMass[copyNo] == 1 )
{
physVol->SetName("physicalCytoplasm");
physVol->GetLogicalVolume()->SetVisAttributes( cytoplasmAttributes1 );
return cytoplasmMaterial1;
physVol->GetLogicalVolume()->SetVisAttributes( fCytoplasmAttributes1 );
return fCytoplasmMaterial1;
}
if( mass[copyNo] == 2 )
if( fMass[copyNo] == 2 )
{
physVol->SetName("physicalNucleus"); // nucleoli
physVol->GetLogicalVolume()->SetVisAttributes( cytoplasmAttributes2 );
return cytoplasmMaterial2;
physVol->GetLogicalVolume()->SetVisAttributes( fCytoplasmAttributes2 );
return fCytoplasmMaterial2;
}
if( mass[copyNo] == 3 )
if( fMass[copyNo] == 3 )
{
physVol->SetName("physicalCytoplasm");
physVol->GetLogicalVolume()->SetVisAttributes( cytoplasmAttributes3 );
return cytoplasmMaterial3;
physVol->GetLogicalVolume()->SetVisAttributes( fCytoplasmAttributes3 );
return fCytoplasmMaterial3;
}
}
return physVol->GetLogicalVolume()->GetMaterial();
}
+756
View File
@@ -0,0 +1,756 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// 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 publication:
// Med. Phys. 37 (2010) 4692-4708
// The Geant4-DNA web site is available at http://geant4-dna.org
//
// If you use this example, please cite the following publication:
// Rad. Prot. Dos. 133 (2009) 2-11
#include "DetectorConstruction.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4ThreadLocal EMField* DetectorConstruction::fField = 0;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
DetectorConstruction::DetectorConstruction()
:fDefaultMaterial(NULL),fCollimatorMaterial(NULL),fBoiteMaterial(NULL),
fCathodeMaterial(NULL),fVerreMaterial(NULL),fVerre2Material(NULL),
fKgmMaterial(NULL),fBoite2Material(NULL),fBoite3Material(NULL),
fNucleusMaterial1(NULL),fCytoplasmMaterial1(NULL),
fNucleusMaterial2(NULL),fCytoplasmMaterial2(NULL),
fNucleusMaterial3(NULL),fCytoplasmMaterial3(NULL),
fPhysiWorld(NULL),fLogicWorld(NULL),fSolidWorld(NULL),
fPhysiVol(NULL),fLogicVol(NULL),fSolidVol(NULL),
fPhysiBoite(NULL),fLogicBoite(NULL),fSolidBoite(NULL),
fPhysiYoke1(NULL),fLogicYoke1(NULL),fSolidYoke1(NULL),
fPhysi1Gap(NULL),fLogic1Gap(NULL),fSolid1Gap(NULL),
fPhysi2Gap(NULL),fLogic2Gap(NULL),fSolid2Gap(NULL),
fPhysi3Gap(NULL),fLogic3Gap(NULL),fSolid3Gap(NULL),
fPhysiYoke2(NULL),fLogicYoke2(NULL),fSolidYoke2(NULL),
fPhysi4Gap(NULL),fLogic4Gap(NULL),fSolid4Gap(NULL),
fPhysi5Gap(NULL),fLogic5Gap(NULL),fSolid5Gap(NULL),
fPhysiBoiteIso(NULL),fLogicBoiteIso(NULL),fSolidBoiteIso(NULL),
fPhysiCathode(NULL),fLogicCathode(NULL),fSolidCathode(NULL),
fPhysiIso(NULL),fLogicIso(NULL),fSolidIso(NULL),
fPhysiVerre(NULL),fLogicVerre(NULL),fSolidVerre(NULL),
fPhysiBoite2(NULL),fLogicBoite2(NULL),fSolidBoite2(NULL),
fPhysiBoite3(NULL),fLogicBoite3(NULL),fSolidBoite3(NULL),
fPhysiKgm(NULL),fLogicKgm(NULL),fSolidKgm(NULL),
fPhysiVerre2(NULL),fLogicVerre2(NULL),fSolidVerre2(NULL),
fPhysiPhantom(NULL),fLogicPhantom(NULL),fSolidPhantom(NULL)
{
fWorldSizeXY=fWorldSizeZ=0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
DetectorConstruction::~DetectorConstruction()
{
delete fDefaultMaterial;
delete fCollimatorMaterial;
delete fBoiteMaterial;
delete fCathodeMaterial;
delete fVerreMaterial;
delete fVerre2Material;
delete fKgmMaterial;
delete fBoite2Material;
delete fBoite3Material;
delete fNucleusMaterial1;
delete fCytoplasmMaterial1;
delete fNucleusMaterial2;
delete fCytoplasmMaterial2;
delete fNucleusMaterial3;
delete fCytoplasmMaterial3;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4VPhysicalVolume* DetectorConstruction::Construct()
{
DefineMaterials();
return ConstructLine();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void DetectorConstruction::DefineMaterials()
{
G4String name, symbol;
G4double density;
G4int ncomponents, natoms,nel;
G4double z, a;
G4double fractionmass;
G4double temperature, pressure;
// Define Elements
G4Element* H = new G4Element ("Hydrogen", "H", 1. , 1.01*g/mole);
G4Element* N = new G4Element ("Nitrogen", "N", 7., 14.01*g/mole);
G4Element* O = new G4Element ("Oxygen" , "O", 8. , 16.00*g/mole);
G4Element* Ar = new G4Element ("Argon" , "Ar", 18., 39.948*g/mole );
G4Element* C = new G4Element ("Carbon","C", 6., 12.011*g/mole);
G4Element * Si = new G4Element ("Silicon","Si",14., 28.0855*g/mole);
G4Element * Cu = new G4Element ("Cuivre","Cu",29., 63.546*g/mole);
G4Element * Zn = new G4Element ("Zinc","Zn",30.,65.409*g/mole);
G4Element * P = new G4Element ("Phosphorus","P",15.,30.973761*g/mole);
// Vacuum standard definition...
density = universe_mean_density;
G4Material* vacuum = new G4Material(name="Vacuum", z=1., a=1.01*g/mole,
density);
// Water
density = 1.000*g/cm3;
G4Material* H2O = new G4Material(name="H2O" , density, ncomponents=2);
H2O->AddElement(H, natoms=2);
H2O->AddElement(O, natoms=1);
// Air
density = 1.290*mg/cm3;
pressure = 1*atmosphere;
temperature = 293.16*kelvin;
G4Material* Air = new G4Material(name="Air" , density, ncomponents=2, kStateGas, temperature, pressure);
Air->AddElement(N, fractionmass=0.7);
Air->AddElement(O, fractionmass=0.3);
// Low Pressure air
density = (5e-6/1013.)*1.290*mg/cm3; // 5e-6 mbar is the usual beam pipe air pressure
pressure = 1*atmosphere;
temperature = 293.16*kelvin;
G4Material* LPAir = new G4Material(name="LPAir" , density, ncomponents=3, kStateGas, temperature, pressure);
LPAir->AddElement(N, fractionmass=0.715);
LPAir->AddElement(O, fractionmass=0.25);
LPAir->AddElement(Ar, fractionmass=0.035);
// Platinum
a = 195.09*g/mole;
density = 21.4*g/cm3;
G4Material* Pt = new G4Material(name="Pl", z=78., a, density);
// Butane @ 10 mbar
density = 2.552e-2*mg/cm3;
pressure = 0.01*bar;
temperature = 293.16*kelvin;
G4Material* Butane = new G4Material(name = "Butane", density, nel = 2, kStateGas, temperature, pressure);
Butane->AddElement (C, natoms=4);
Butane->AddElement (H, natoms=10);
// Polypropylene
density = 0.9*g/cm3;
G4Material* Polyprop = new G4Material(name = "Polyprop", density, nel = 2);
Polyprop->AddElement (C,3);
Polyprop->AddElement (H,6);
// Si3N4
density = 3.44*g/cm3;
G4Material* Si3N4 = new G4Material(name = "Si3N4", density, nel = 2);
Si3N4->AddElement (Si, natoms=3);
Si3N4->AddElement (N, natoms=4);
// SiO2
density = 2.5*g/cm3;
G4Material* SiO2 = new G4Material(name = "SiO2", density, nel = 2);
SiO2->AddElement (Si, natoms=1);
SiO2->AddElement (O, natoms=2);
// Brass
density = 8.5*g/cm3;
G4Material* Laiton = new G4Material(name = "Laiton", density, nel = 2);
Laiton->AddElement (Cu,1);
Laiton->AddElement (Zn,1);
// Phantom
fDensityPhantom = 1.; // in g/cm3
// Nucleus composition from Alard et al., Rad. Res. 158, 650 (2002) and
// Comp. Math. Meth. Med. 147252 (2012)
//
// Cytoplasm composition is assumed to be water
// Cytoplasm
fDensityCytoplasm = 1.; // in g/cm3
density = fDensityCytoplasm*g/cm3;
G4Material* Cytoplasm1 = new G4Material(name="Cytoplasm1" , density, ncomponents=2);
Cytoplasm1->AddElement(H, fractionmass=0.112);
Cytoplasm1->AddElement(O, fractionmass=0.888);
// Nucleoli
fDensityCytoplasm = 1.;
// in g/cm3 (nucleoli are assumed to have the same chemical comp. as nucleus)
density = fDensityCytoplasm*g/cm3;
G4Material* Cytoplasm2 = new G4Material(name="Cytoplasm2" , density, ncomponents=5);
Cytoplasm2->AddElement(H, fractionmass=0.1064);
Cytoplasm2->AddElement(O, fractionmass=0.745);
Cytoplasm2->AddElement(C, fractionmass=0.0904);
Cytoplasm2->AddElement(N, fractionmass=0.0321);
Cytoplasm2->AddElement(P, fractionmass=0.0261);
// default is water
fDensityCytoplasm = 1.; // in g/cm3
density = fDensityCytoplasm*g/cm3;
G4Material* Cytoplasm3 = new G4Material(name="Cytoplasm3" , density, ncomponents=2);
Cytoplasm3->AddElement(H, fractionmass=0.112);
Cytoplasm3->AddElement(O, fractionmass=0.888);
// Nucleus chemical composition
fDensityNucleus = 1.; // in g/cm3
density = fDensityNucleus*g/cm3;
G4Material* Nucleus1 = new G4Material(name="Nucleus1" , density, ncomponents=5);
Nucleus1->AddElement(H, fractionmass=0.1064);
Nucleus1->AddElement(O, fractionmass=0.745);
Nucleus1->AddElement(C, fractionmass=0.0904);
Nucleus1->AddElement(N, fractionmass=0.0321);
Nucleus1->AddElement(P, fractionmass=0.0261);
fDensityNucleus = 1.; // in g/cm3
density = fDensityNucleus*g/cm3;
G4Material* Nucleus2 = new G4Material(name="Nucleus2" , density, ncomponents=5);
Nucleus2->AddElement(H, fractionmass=0.1064);
Nucleus2->AddElement(O, fractionmass=0.745);
Nucleus2->AddElement(C, fractionmass=0.0904);
Nucleus2->AddElement(N, fractionmass=0.0321);
Nucleus2->AddElement(P, fractionmass=0.0261);
// default
fDensityNucleus = 1.; // in g/cm3
density = fDensityNucleus*g/cm3;
G4Material* Nucleus3 = new G4Material(name="Nucleus3" , density, ncomponents=5);
Nucleus3->AddElement(H, fractionmass=0.1064);
Nucleus3->AddElement(O, fractionmass=0.745);
Nucleus3->AddElement(C, fractionmass=0.0904);
Nucleus3->AddElement(N, fractionmass=0.0321);
Nucleus3->AddElement(P, fractionmass=0.0261);
// Materials in setup
fDefaultMaterial = vacuum;
fCollimatorMaterial = Pt;
fBoiteMaterial = Butane;
fCathodeMaterial = Laiton;
fVerreMaterial = Si3N4;
fVerre2Material = SiO2;
fKgmMaterial = H2O;
fBoite2Material = Air;
fBoite3Material = Polyprop;
fNucleusMaterial1 = Nucleus1;
fCytoplasmMaterial1 = Cytoplasm1;
fNucleusMaterial2 = Nucleus2;
fCytoplasmMaterial2 = Cytoplasm2;
fNucleusMaterial3 = Nucleus3;
fCytoplasmMaterial3 = Cytoplasm3;
// DISPLAY MATERIALS
G4cout << G4endl << *(G4Material::GetMaterialTable()) << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4VPhysicalVolume* DetectorConstruction::ConstructLine()
{
// WORLD
fWorldSizeXY = 20*m;
fWorldSizeZ = 40*m;
// MICROBEAM LINE ANGLE
fLineAngle = 10*deg;
// TARGET POSITION
fCiblePositionX = -1461.42*mm;
fCiblePositionY = 0*mm;
fCiblePositionZ = -1327 + (955*std::cos(fLineAngle))*mm;
//*************
// WORLD VOLUME
//*************
fSolidWorld = new G4Box("World", //its name
fWorldSizeXY/2,fWorldSizeXY/2,fWorldSizeZ/2); //its size
fLogicWorld = new G4LogicalVolume(fSolidWorld, //its solid
fDefaultMaterial, //its material
"World"); //its name
fPhysiWorld = new G4PVPlacement(0, //no rotation
G4ThreeVector(), //at (0,0,0)
"World", //its name
fLogicWorld, //its logical volume
NULL, //its mother volume
false, //no boolean operation
0); //copy number
//*****************
// FULL LINE VOLUME
//*****************
fSolidVol = new G4Box("Vol",
10.*m/2,10.*m/2,(14025)*mm/2);
fLogicVol = new G4LogicalVolume(fSolidVol,
fDefaultMaterial,
"Vol");
fPhysiVol = new G4PVPlacement(0,
G4ThreeVector(0,0,-2012.5*mm),
"Vol",
fLogicVol,
fPhysiWorld,
false,
0);
// *************************************************
// Whole microbeam line at 10 deg contained in a box
// *************************************************
G4double PosX = fCiblePositionX*mm +( (6958.3/2-3.3)*std::sin(fLineAngle))*mm;
G4double PosZ = (fCiblePositionZ+2012.5)*mm - ((6958.3/2-3.3)*std::cos(fLineAngle))*mm;
// Adjust box absolute position
PosX = PosX + 1.3 * micrometer * std::cos(fLineAngle);
PosZ = PosZ + 1.3 * micrometer * std::sin(fLineAngle);
G4RotationMatrix *rot = new G4RotationMatrix();
rot->rotateX(0*deg);
rot->rotateY(10*deg);
rot->rotateZ(0*deg);
fSolidBoite = new G4Box("Boite", 4*cm, 4*cm, 6958.3*mm/2);
fLogicBoite = new G4LogicalVolume(fSolidBoite, fDefaultMaterial, "Boite");
fPhysiBoite = new G4PVPlacement(rot,
G4ThreeVector(PosX,0,PosZ),
"Boite",
fLogicBoite,
fPhysiVol,
false,
0);
//*********************************************************************
// OBJECT COLLIMATOR (after switching magnet, 5 micrometer in diameter)
//*********************************************************************
fCollObjSizeXY = 8*cm;
fCollObjSizeZ = 0.07*mm;
fSolidYoke1 = new G4Box("_CollObj_yoke1_", fCollObjSizeXY/2,fCollObjSizeXY/2,fCollObjSizeZ/2);
fLogicYoke1 = new G4LogicalVolume(fSolidYoke1, fCollimatorMaterial, "_CollObj_yoke1_");
fPhysiYoke1 = new G4PVPlacement( 0, G4ThreeVector(0,0,6958.3*mm/2-3.3*mm-6955*mm+0.07*mm/2), fLogicYoke1,
"_CollObj_yoke1_",fLogicBoite, false, 0);
// --> FIRST PART
fSolid1Gap = new G4Cons("_CollObj_gap1_", 0.*micrometer, 6*micrometer,
0.*micrometer,2.5*micrometer,
3.5*micrometer,
0, ((360*CLHEP::pi)/180));
fLogic1Gap = new G4LogicalVolume(fSolid1Gap, fDefaultMaterial, "_CollObj_gap1_");
fPhysi1Gap = new G4PVPlacement(0, G4ThreeVector(0,0,0.0315*mm), fLogic1Gap, "_CollObj_gap1_",
fLogicYoke1, false, 0);
// --> SECOND PART
fSolid2Gap = new G4Cons("_CollObj_gap2_", 0.*micrometer, 15*micrometer,
0.*micrometer,6*micrometer,
6.5*micrometer,
0, ((360*CLHEP::pi)/180));
fLogic2Gap = new G4LogicalVolume(fSolid2Gap, fDefaultMaterial, "_CollObj_gap2_");
fPhysi2Gap = new G4PVPlacement(0, G4ThreeVector(0,0,0.0215*mm), fLogic2Gap, "_CollObj_gap2_",
fLogicYoke1, false, 0);
// --> THIRD PART
fSolid3Gap = new G4Cons("_CollObj_gap3_", 0.*micrometer, 105*micrometer,
0.*micrometer,15*micrometer,
25*micrometer,
0, ((360*CLHEP::pi)/180));
fLogic3Gap = new G4LogicalVolume(fSolid3Gap, fDefaultMaterial, "_CollObj_gap3_");
fPhysi3Gap = new G4PVPlacement(0, G4ThreeVector(0,0,-0.010*mm), fLogic3Gap, "_CollObj_gap3_", fLogicYoke1,
false, 0);
//************************
// GAS DETECTOR COLLIMATOR
//************************
fSolidYoke2 = new G4Box("_CollDet_yoke_", 2.5*cm, 2.5*cm, 0.035*mm);
fLogicYoke2 = new G4LogicalVolume(fSolidYoke2, fCollimatorMaterial, "_CollDet_yoke_");
fPhysiYoke2 = new G4PVPlacement(0,
G4ThreeVector(0,0,6958.3*mm/2-0.3*mm-3*mm-0.004*mm-0.1*mm-1*mm-2.5*mm-0.070*mm/2),
fLogicYoke2, "_CollDet_yoke_", fLogicBoite, false, 0);
// --> FIRST PART
fSolid4Gap = new G4Cons("_CollDet_gap4_", 0.*micrometer, 8*micrometer,
0.*micrometer,5*micrometer,
7.5*micrometer,
0, ((360*CLHEP::pi)/180));
fLogic4Gap = new G4LogicalVolume(fSolid4Gap, fDefaultMaterial, "_CollDet_gap4_");
fPhysi4Gap = new G4PVPlacement(0, G4ThreeVector(0,0,0.0275*mm), fLogic4Gap, "_CollDet_gap4_",
fLogicYoke2, false, 0);
// --> SECOND PART
fSolid5Gap = new G4Cons("_CollDet_gap5_", 0.*micrometer, 105*micrometer,
0.*micrometer,8*micrometer,
27.5*micrometer,
0, ((360*CLHEP::pi)/180));
fLogic5Gap = new G4LogicalVolume(fSolid5Gap, fDefaultMaterial, "_CollDet_gap5_");
fPhysi5Gap = new G4PVPlacement(0,
G4ThreeVector(0,0,-0.0075*mm),
fLogic5Gap,
"_CollDet_gap5_",
fLogicYoke2,
false,
0);
// ************
// GAS DETECTOR
// ************
fSolidBoiteIso = new G4Box("Isobutane", 2.5*cm, 2.5*cm, 1.75*mm);
fLogicBoiteIso = new G4LogicalVolume(fSolidBoiteIso, fBoiteMaterial, "Isobutane");
fPhysiBoiteIso = new G4PVPlacement(0,
G4ThreeVector(0,0,6958.3*mm/2-0.3*mm-3*mm-0.004*mm-0.1*mm-3.5*mm/2),
"Isobutane",
fLogicBoiteIso,
fPhysiBoite,
false,
0);
// --> GAS DETECTOR END CAP
fSolidCathode = new G4Box("_Laiton_", 2.5*cm, 2.5*cm, 0.5*mm);
fLogicCathode = new G4LogicalVolume(fSolidCathode, fCathodeMaterial, "_Laiton_");
fPhysiCathode = new G4PVPlacement(0,
G4ThreeVector(0,0,1.25*mm),
"_Laiton_",
fLogicCathode,
fPhysiBoiteIso,
false, 0);
// --> ISOBUTANE GAS
fSolidIso = new G4Box("_Iso_", 1.*mm, 1.*mm, 0.499925*mm);
fLogicIso = new G4LogicalVolume(fSolidIso, fBoiteMaterial, "_Iso_");
fPhysiIso = new G4PVPlacement(0,
G4ThreeVector(0,0,-0.000075*mm),
"_Iso_",
fLogicIso,
fPhysiCathode,
false,
0);
// --> Si3N4 WINDOW
fSolidVerre = new G4Box("_Si3N4_", 0.5*mm, 0.5*mm, 0.075*micrometer);
fLogicVerre = new G4LogicalVolume(fSolidVerre, fVerreMaterial, "_Si3N4_");
fPhysiVerre = new G4PVPlacement(0,
G4ThreeVector(0,0,0.499925*mm),
"_Si3N4_",
fLogicVerre,
fPhysiCathode,
false,
0);
// *******
// AIR GAP
// *******
fSolidBoite2 = new G4Box("_Air_", 2.5*cm, 2.5*cm, 0.1*mm/2);
fLogicBoite2 = new G4LogicalVolume(fSolidBoite2, fBoite2Material, "_Air_");
fPhysiBoite2 = new G4PVPlacement(0,
G4ThreeVector(0,0,6958.3*mm/2-0.3*mm-3*mm-0.004*mm-0.1*mm/2),
"_Air_",
fLogicBoite2,
fPhysiBoite,
false,
0);
//*************
// CELL SUPPORT
//*************
fSolidBoite3 = new G4Box("Polyprop", 2.5*cm, 2.5*cm, 0.004*mm/2);
fLogicBoite3 = new G4LogicalVolume(fSolidBoite3, fBoite3Material, "Polyprop");
fPhysiBoite3 = new G4PVPlacement(0,
G4ThreeVector(0,0,6958.3*mm/2-0.3*mm-3*mm-0.004*mm/2),
"Polyprop",
fLogicBoite3,
fPhysiBoite,
false,
0);
//****
// KGM
//****
fSolidKgm = new G4Box("KGM", 2.5*cm, 2.5*cm, 3*mm/2);
fLogicKgm = new G4LogicalVolume(fSolidKgm, fKgmMaterial, "KGM");
fPhysiKgm = new G4PVPlacement(0,
G4ThreeVector(0,0,6958.3*mm/2-0.3*mm-3*mm/2),
"KGM",
fLogicKgm,
fPhysiBoite,
false,
0);
//*****************
// MICROSCOPE PLATE
//*****************
fSolidVerre2 = new G4Box("_Lame_", 2.5*cm, 2.5*cm, 0.150*mm);
fLogicVerre2 = new G4LogicalVolume(fSolidVerre2, fVerre2Material, "_Lame_");
fPhysiVerre2 = new G4PVPlacement(0,
G4ThreeVector(0,0,6958.3*mm/2-0.3*mm/2),
"_Lame_",
fLogicVerre2,
fPhysiBoite,
false,
0);
// **************
// CELL CYTOPLASM
// **************
// WITHIN KGM
/*
fSolidCyto=new G4Ellipsoid("CYTO",25*micrometer, 25*micrometer, 11*micrometer);
fLogicCyto=new G4LogicalVolume (fSolidCyto, fDefaultMaterial, "CYTO");
fPhysiCyto=new G4PVPlacement(0, G4ThreeVector(0,0,-1.5*mm+11*micrometer),"CYTO",fLogicCyto, fPhysiKgm, false, 0);
*/
// ************
// CELL PHANTOM
// ************
fSolidPhantom = new G4Box("Phantom",
fMyPhantomConfiguration.GetPixelSizeX()/2,
fMyPhantomConfiguration.GetPixelSizeY()/2,
fMyPhantomConfiguration.GetPixelSizeZ()/2);
fLogicPhantom = new G4LogicalVolume(fSolidPhantom,fDefaultMaterial,"Phantom",0,0,0);
// PHANTOM MASSES
SetNbOfPixelsInPhantom (fMyPhantomConfiguration.GetPhantomTotalPixels());
SetMassNucleus(fMyPhantomConfiguration.GetNucleusMass());
SetMassCytoplasm(fMyPhantomConfiguration.GetCytoplasmMass());
// PHANTOM
fPhantomParam = new CellParameterisation
(fMyPhantomConfiguration.GetPhantomTotalPixels(),
fMyPhantomConfiguration.GetPixelSizeX()/2,
fMyPhantomConfiguration.GetPixelSizeY()/2,
fMyPhantomConfiguration.GetPixelSizeZ()/2,
fNucleusMaterial1,fCytoplasmMaterial1,
fNucleusMaterial2,fCytoplasmMaterial2,
fNucleusMaterial3,fCytoplasmMaterial3
);
fPhysiPhantom = new G4PVParameterised(
"Phantom", // their name
fLogicPhantom, // their logical volumr
//logicCyto, // Mother logical volume is Cyto
fLogicKgm, // Mother logical volume is Kgm
kUndefined, // Are placed along this axis
fPhantomParam->GetNoBoxes(), // Number of boxes
fPhantomParam,false); // The parametrisation
G4cout << " ==========> The phantom contains "
<< fMyPhantomConfiguration.GetPhantomTotalPixels() << " voxels " << G4endl;
G4cout << G4endl;
// USER LIMITS ON STEP LENGTH
fLogicWorld->SetUserLimits(new G4UserLimits(100*mm));
fLogicVol->SetUserLimits(new G4UserLimits(100*mm));
fLogicBoite->SetUserLimits(new G4UserLimits(10*mm));
/*
logicPhantom->SetUserLimits (new G4UserLimits(0.5*micrometer));
logic1Gap->SetUserLimits (new G4UserLimits(5*micrometer));
logic2Gap->SetUserLimits (new G4UserLimits(5*micrometer));
logic3Gap->SetUserLimits (new G4UserLimits(5*micrometer));
logic4Gap->SetUserLimits (new G4UserLimits(5*micrometer));
logic5Gap->SetUserLimits (new G4UserLimits(5*micrometer));
logicBoiteIso->SetUserLimits (new G4UserLimits(200.*micrometer));
logicCathode->SetUserLimits (new G4UserLimits(100.*micrometer));
logicIso->SetUserLimits (new G4UserLimits(100.*micrometer));
logicVerre->SetUserLimits (new G4UserLimits(0.02*micrometer));
logicBoite2->SetUserLimits (new G4UserLimits(10*micrometer));
logicBoite3->SetUserLimits (new G4UserLimits(0.2*micrometer));
logicKgm->SetUserLimits (new G4UserLimits(1*micrometer));
logicVerre2->SetUserLimits (new G4UserLimits(10*micrometer));
*/
// VISUALISATION ATTRIBUTES (for phantom, see in Parameterisation class)
G4VisAttributes* simpleWorldVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,1.0)); //White
simpleWorldVisAtt->SetVisibility(true);
G4VisAttributes* simplePlain= new G4VisAttributes(G4Colour(1.0,1.0,1.0)); //White
simplePlain->SetVisibility(true);
simplePlain->SetForceSolid(true);
G4VisAttributes* simpleBoxAttLine= new G4VisAttributes(G4Colour(1.0,0.0,0.0));
simpleBoxAttLine->SetVisibility(true);
G4VisAttributes* simpleBoxAtt= new G4VisAttributes(G4Colour(1.0,1.0,0.0));
simpleBoxAtt->SetDaughtersInvisible(false);
simpleBoxAtt->SetForceSolid(false);
G4VisAttributes* simpleBoxAtt2= new G4VisAttributes(G4Colour(0.0,1.0,0.0));
simpleBoxAtt2->SetDaughtersInvisible(false);
simpleBoxAtt2->SetForceSolid(false);
G4VisAttributes* simpleBoxAttKGM= new G4VisAttributes(G4Colour(0.0,0.0,1.0));
simpleBoxAttKGM->SetDaughtersInvisible(false);
simpleBoxAttKGM->SetForceSolid(false);
G4VisAttributes* simpleBoxAttPropyl= new G4VisAttributes(G4Colour(1.0,1.0,1.0));
simpleBoxAttPropyl->SetDaughtersInvisible(true);
simpleBoxAttPropyl->SetForceSolid(false);
G4VisAttributes* simpleBoxAttAir= new G4VisAttributes(G4Colour(0.0,1.0,0.0));
simpleBoxAttAir->SetDaughtersInvisible(true);
simpleBoxAttAir->SetForceSolid(false);
G4VisAttributes* simpleBoxAtt3= new G4VisAttributes(G4Colour(0.0,0.0,1.0));
simpleBoxAtt3->SetDaughtersInvisible(false);
simpleBoxAtt3->SetForceSolid(false);
fLogicYoke1->SetVisAttributes(simpleBoxAtt);
fLogic1Gap->SetVisAttributes(simpleBoxAtt);
fLogic2Gap->SetVisAttributes(simpleBoxAtt);
fLogic3Gap->SetVisAttributes(simpleBoxAtt);
fLogicYoke2->SetVisAttributes(simpleBoxAtt);
fLogic4Gap->SetVisAttributes(simpleBoxAtt);
fLogic5Gap->SetVisAttributes(simpleBoxAtt);
fLogicBoite->SetVisAttributes(simpleBoxAttLine);
fLogicCathode->SetVisAttributes(simpleBoxAttPropyl);
fLogicIso->SetVisAttributes(simpleBoxAttPropyl);
fLogicBoiteIso->SetVisAttributes(simpleBoxAttPropyl);
fLogicVerre->SetVisAttributes(simpleBoxAtt);
fLogicBoite2->SetVisAttributes(simpleBoxAttAir);
fLogicBoite3->SetVisAttributes(simpleBoxAtt);
fLogicKgm->SetVisAttributes(simpleBoxAttKGM);
fLogicVerre2->SetVisAttributes(simpleBoxAtt);
return fPhysiWorld;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void DetectorConstruction::ConstructSDandField()
{
if(!fField) fField = new EMField();
fEquation = new G4EqMagElectricField(fField);
fStepper = new G4ClassicalRK4 (fEquation);
fFieldMgr = G4TransportationManager::GetTransportationManager()->GetFieldManager();
fIntgrDriver = new G4MagInt_Driver(0.000001*mm,fStepper,fStepper->GetNumberOfVariables() );
fChordFinder = new G4ChordFinder(fIntgrDriver);
fFieldMgr->SetChordFinder(fChordFinder);
fFieldMgr->SetDetectorField(fField);
// FOLLOWING PARAMETERS TUNED FROM RAY-TRACING SIMULATIONS OF THE AIFIRA NANOBEAM LINE
fFieldMgr->GetChordFinder()->SetDeltaChord(1e-9*m);
fFieldMgr->SetDeltaIntersection(1e-9*m);
fFieldMgr->SetDeltaOneStep(1e-9*m);
fPropInField =
G4TransportationManager::GetTransportationManager()->GetPropagatorInField();
fPropInField->SetMinimumEpsilonStep(1e-11);
fPropInField->SetMaximumEpsilonStep(1e-10);
}
@@ -23,18 +23,23 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// -------------------------------------------------------------------
// $Id$
// -------------------------------------------------------------------
// 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 publication:
// Med. Phys. 37 (2010) 4692-4708
// The Geant4-DNA web site is available at http://geant4-dna.org
//
// If you use this example, please cite the following publication:
// Rad. Prot. Dos. 133 (2009) 2-11
#include "MicrobeamEMField.hh"
#include "EMField.hh"
#include "G4SystemOfUnits.hh"
MicrobeamEMField::MicrobeamEMField()
EMField::EMField()
{
}
void MicrobeamEMField::GetFieldValue(const double point[4], double *Bfield ) const
void EMField::GetFieldValue(const double point[4], double *Bfield ) const
{
// Magnetic field
Bfield[0] = 0;
@@ -520,4 +525,3 @@ if (z>=-1400*mm && z <-200*mm)
//
}
@@ -23,60 +23,66 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// -------------------------------------------------------------------
// $Id$
// -------------------------------------------------------------------
// 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 publication:
// Med. Phys. 37 (2010) 4692-4708
// The Geant4-DNA web site is available at http://geant4-dna.org
//
// If you use this example, please cite the following publication:
// Rad. Prot. Dos. 133 (2009) 2-11
#include "G4Event.hh"
#include "Randomize.hh"
#include "MicrobeamEventAction.hh"
#include "MicrobeamRunAction.hh"
#include "MicrobeamHistoManager.hh"
#include "EventAction.hh"
#include "RunAction.hh"
#include "Analysis.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
MicrobeamEventAction::MicrobeamEventAction(MicrobeamRunAction* run,
MicrobeamHistoManager * his)
:Run(run),Histo(his),drawFlag("all"),printModulo(10000)
EventAction::EventAction(RunAction* run)
:fRun(run)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
MicrobeamEventAction::~MicrobeamEventAction()
EventAction::~EventAction()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void MicrobeamEventAction::BeginOfEventAction(const G4Event* evt)
void EventAction::BeginOfEventAction(const G4Event* evt)
{
G4int evtNb = evt->GetEventID();
Run->SetNumEvent(evtNb);
Run->SetDoseN(0);
Run->SetDoseC(0);
fRun->SetNumEvent(evtNb);
fRun->SetDoseN(0);
fRun->SetDoseC(0);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void MicrobeamEventAction::EndOfEventAction(const G4Event* )
void EventAction::EndOfEventAction(const G4Event* )
{
// SAVE TOTAL ABSORBED DOSE IN PHANTOM
G4AnalysisManager* man = G4AnalysisManager::Instance();
if (Run->GetDoseN()>0 || Run->GetDoseC()>0)
{
Histo->FillNtuple(3,0,Run->GetDoseN());
Histo->FillNtuple(3,1,Run->GetDoseC());
Histo->AddRowNtuple(3);
// Save total absorbed dose in phantom
G4cout << " ===> The incident alpha particle has reached the targeted cell :" << G4endl;
G4cout << " -----> total absorbed dose within Nucleus is (Gy) = " << Run->GetDoseN() << G4endl;
G4cout << " -----> total absorbed dose within Cytoplasm is (Gy) = " << Run->GetDoseC() << G4endl;
G4cout << G4endl;
}
else
{
G4cout << " ===> Sorry, the incident alpha particle has missed the targeted cell !" << G4endl;
G4cout << G4endl;
}
if (fRun->GetDoseN()>0 || fRun->GetDoseC()>0)
{
// Fill ntuple #4
man->FillNtupleDColumn(4,0,fRun->GetDoseN());
man->FillNtupleDColumn(4,1,fRun->GetDoseC());
man->AddNtupleRow(4);
G4cout << " ===> The incident alpha particle has reached the targeted cell :" << G4endl;
G4cout << " -----> total absorbed dose within Nucleus is (Gy) = " << fRun->GetDoseN() << G4endl;
G4cout << " -----> total absorbed dose within Cytoplasm is (Gy) = " << fRun->GetDoseC() << G4endl;
G4cout << G4endl;
}
else
{
G4cout << " ===> Sorry, the incident alpha particle has missed the targeted cell !" << G4endl;
G4cout << G4endl;
}
}
@@ -1,721 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// -------------------------------------------------------------------
// $Id$
// -------------------------------------------------------------------
#include "MicrobeamDetectorConstruction.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
MicrobeamDetectorConstruction::MicrobeamDetectorConstruction()
:defaultMaterial(NULL),collimatorMaterial(NULL),BoiteMaterial(NULL),
CathodeMaterial(NULL),VerreMaterial(NULL),Verre2Material(NULL),
KgmMaterial(NULL),Boite2Material(NULL),Boite3Material(NULL),
nucleusMaterial1(NULL),cytoplasmMaterial1(NULL),
nucleusMaterial2(NULL),cytoplasmMaterial2(NULL),
nucleusMaterial3(NULL),cytoplasmMaterial3(NULL),
physiWorld(NULL),logicWorld(NULL),solidWorld(NULL),
physiVol(NULL),logicVol(NULL),solidVol(NULL),
physiBoite(NULL),logicBoite(NULL),solidBoite(NULL),
physiYoke1(NULL),logicYoke1(NULL),solidYoke1(NULL),
physi1Gap(NULL),logic1Gap(NULL),solid1Gap(NULL),
physi2Gap(NULL),logic2Gap(NULL),solid2Gap(NULL),
physi3Gap(NULL),logic3Gap(NULL),solid3Gap(NULL),
physiYoke2(NULL),logicYoke2(NULL),solidYoke2(NULL),
physi4Gap(NULL),logic4Gap(NULL),solid4Gap(NULL),
physi5Gap(NULL),logic5Gap(NULL),solid5Gap(NULL),
physiBoiteIso(NULL),logicBoiteIso(NULL),solidBoiteIso(NULL),
physiCathode(NULL),logicCathode(NULL),solidCathode(NULL),
physiIso(NULL),logicIso(NULL),solidIso(NULL),
physiVerre(NULL),logicVerre(NULL),solidVerre(NULL),
physiBoite2(NULL),logicBoite2(NULL),solidBoite2(NULL),
physiBoite3(NULL),logicBoite3(NULL),solidBoite3(NULL),
physiKgm(NULL),logicKgm(NULL),solidKgm(NULL),
physiVerre2(NULL),logicVerre2(NULL),solidVerre2(NULL),
physiPhantom(NULL),logicPhantom(NULL),solidPhantom(NULL)
{
WorldSizeXY=WorldSizeZ=0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
MicrobeamDetectorConstruction::~MicrobeamDetectorConstruction()
{
delete defaultMaterial;
delete collimatorMaterial;
delete BoiteMaterial;
delete CathodeMaterial;
delete VerreMaterial;
delete Verre2Material;
delete KgmMaterial;
delete Boite2Material;
delete Boite3Material;
delete nucleusMaterial1;
delete cytoplasmMaterial1;
delete nucleusMaterial2;
delete cytoplasmMaterial2;
delete nucleusMaterial3;
delete cytoplasmMaterial3;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4VPhysicalVolume* MicrobeamDetectorConstruction::Construct()
{
DefineMaterials();
return ConstructMicrobeamLine();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void MicrobeamDetectorConstruction::DefineMaterials()
{
G4String name, symbol;
G4double density;
G4int ncomponents, natoms,nel;
G4double z, a;
G4double fractionmass;
G4double temperature, pressure;
// Define Elements
G4Element* H = new G4Element ("Hydrogen", "H", 1. , 1.01*g/mole);
G4Element* N = new G4Element ("Nitrogen", "N", 7., 14.01*g/mole);
G4Element* O = new G4Element ("Oxygen" , "O", 8. , 16.00*g/mole);
G4Element* Ar = new G4Element ("Argon" , "Ar", 18., 39.948*g/mole );
G4Element* C = new G4Element ("Carbon","C", 6., 12.011*g/mole);
G4Element * Si = new G4Element ("Silicon","Si",14., 28.0855*g/mole);
G4Element * Cu = new G4Element ("Cuivre","Cu",29., 63.546*g/mole);
G4Element * Zn = new G4Element ("Zinc","Zn",30.,65.409*g/mole);
G4Element * P = new G4Element ("Phosphorus","P",15.,30.973761*g/mole);
// Vaccum standard definition...
density = universe_mean_density;
G4Material* vacuum = new G4Material(name="Vacuum", z=1., a=1.01*g/mole,
density);
// Water
density = 1.000*g/cm3;
G4Material* H2O = new G4Material(name="H2O" , density, ncomponents=2);
H2O->AddElement(H, natoms=2);
H2O->AddElement(O, natoms=1);
// Air
density = 1.290*mg/cm3;
pressure = 1*atmosphere;
temperature = 293.16*kelvin;
G4Material* Air = new G4Material(name="Air" , density, ncomponents=2, kStateGas, temperature, pressure);
Air->AddElement(N, fractionmass=0.7);
Air->AddElement(O, fractionmass=0.3);
// Low Pressure Air
density = (5e-6/1013.)*1.290*mg/cm3; // 5e-6 mbar is the usual beam pipe air pressure
pressure = 1*atmosphere;
temperature = 293.16*kelvin;
G4Material* LPAir = new G4Material(name="LPAir" , density, ncomponents=3, kStateGas, temperature, pressure);
LPAir->AddElement(N, fractionmass=0.715);
LPAir->AddElement(O, fractionmass=0.25);
LPAir->AddElement(Ar, fractionmass=0.035);
// Platine
a = 195.09*g/mole;
density = 21.4*g/cm3;
G4Material* Pt = new G4Material(name="Pl", z=78., a, density);
// Butane @ 10 mbar
density = 2.552e-2*mg/cm3;
pressure = 0.01*bar;
temperature = 293.16*kelvin;
G4Material* Butane = new G4Material(name = "Butane", density, nel = 2, kStateGas, temperature, pressure);
Butane->AddElement (C, natoms=4);
Butane->AddElement (H, natoms=10);
// Polypropylene
density = 0.9*g/cm3;
G4Material* Polyprop = new G4Material(name = "Polyprop", density, nel = 2);
Polyprop->AddElement (C,3);
Polyprop->AddElement (H,6);
// Si3N4
density = 3.44*g/cm3;
G4Material* Si3N4 = new G4Material(name = "Si3N4", density, nel = 2);
Si3N4->AddElement (Si, natoms=3);
Si3N4->AddElement (N, natoms=4);
// SiO2
density = 2.5*g/cm3;
G4Material* SiO2 = new G4Material(name = "SiO2", density, nel = 2);
SiO2->AddElement (Si, natoms=1);
SiO2->AddElement (O, natoms=2);
// Laiton
density = 8.5*g/cm3;
G4Material* Laiton = new G4Material(name = "Laiton", density, nel = 2);
Laiton->AddElement (Cu,1);
Laiton->AddElement (Zn,1);
// Phantom
densityPhantom = 1.; // in g/cm3
// Nucleus composition from Alard et al., Rad. Res. 158, 650 (2002)
// Cytoplasm chemical composition
densityCytoplasm = 1.; // in g/cm3
density = densityCytoplasm*g/cm3;
G4Material* Cytoplasm1 = new G4Material(name="Cytoplasm1" , density, ncomponents=2);
Cytoplasm1->AddElement(H, fractionmass=0.112);
Cytoplasm1->AddElement(O, fractionmass=0.888);
densityCytoplasm = 1.;
// in g/cm3 (nucleoli are assumed to have the same chemical comp. as nucleus)
density = densityCytoplasm*g/cm3;
G4Material* Cytoplasm2 = new G4Material(name="Cytoplasm2" , density, ncomponents=5);
Cytoplasm2->AddElement(H, fractionmass=0.1064);
Cytoplasm2->AddElement(O, fractionmass=0.745);
Cytoplasm2->AddElement(C, fractionmass=0.0904);
Cytoplasm2->AddElement(N, fractionmass=0.0321);
Cytoplasm2->AddElement(P, fractionmass=0.0261);
// default
densityCytoplasm = 1.; // in g/cm3
density = densityCytoplasm*g/cm3;
G4Material* Cytoplasm3 = new G4Material(name="Cytoplasm3" , density, ncomponents=2);
Cytoplasm3->AddElement(H, fractionmass=0.112);
Cytoplasm3->AddElement(O, fractionmass=0.888);
// Nucleus chemical composition
densityNucleus = 1.; // in g/cm3
density = densityNucleus*g/cm3;
G4Material* Nucleus1 = new G4Material(name="Nucleus1" , density, ncomponents=5);
Nucleus1->AddElement(H, fractionmass=0.1064);
Nucleus1->AddElement(O, fractionmass=0.745);
Nucleus1->AddElement(C, fractionmass=0.0904);
Nucleus1->AddElement(N, fractionmass=0.0321);
Nucleus1->AddElement(P, fractionmass=0.0261);
densityNucleus = 1.; // in g/cm3
density = densityNucleus*g/cm3;
G4Material* Nucleus2 = new G4Material(name="Nucleus2" , density, ncomponents=5);
Nucleus2->AddElement(H, fractionmass=0.1064);
Nucleus2->AddElement(O, fractionmass=0.745);
Nucleus2->AddElement(C, fractionmass=0.0904);
Nucleus2->AddElement(N, fractionmass=0.0321);
Nucleus2->AddElement(P, fractionmass=0.0261);
// default
densityNucleus = 1.; // in g/cm3
density = densityNucleus*g/cm3;
G4Material* Nucleus3 = new G4Material(name="Nucleus3" , density, ncomponents=5);
Nucleus3->AddElement(H, fractionmass=0.1064);
Nucleus3->AddElement(O, fractionmass=0.745);
Nucleus3->AddElement(C, fractionmass=0.0904);
Nucleus3->AddElement(N, fractionmass=0.0321);
Nucleus3->AddElement(P, fractionmass=0.0261);
// Materials in setup.
defaultMaterial = vacuum;
collimatorMaterial = Pt;
BoiteMaterial = Butane;
CathodeMaterial = Laiton;
VerreMaterial = Si3N4;
Verre2Material = SiO2;
KgmMaterial = H2O;
Boite2Material = Air;
Boite3Material = Polyprop;
nucleusMaterial1 = Nucleus1;
cytoplasmMaterial1 = Cytoplasm1;
nucleusMaterial2 = Nucleus2;
cytoplasmMaterial2 = Cytoplasm2;
nucleusMaterial3 = Nucleus3;
cytoplasmMaterial3 = Cytoplasm3;
// DISPLAY MATERIALS
G4cout << G4endl << *(G4Material::GetMaterialTable()) << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4VPhysicalVolume* MicrobeamDetectorConstruction::ConstructMicrobeamLine()
{
// WORLD
WorldSizeXY = 20*m;
WorldSizeZ = 40*m;
// MICROBEAM LINE ANGLE
lineAngle = 10*deg;
// TARGET POSITION
CiblePositionX = -1461.42*mm;
CiblePositionY = 0*mm;
CiblePositionZ = -1327 + (955*std::cos(lineAngle))*mm;
// ELECTROMAGNETIC FIELD PARAMETERS
static G4bool fieldIsInitialized = false;
if(!fieldIsInitialized)
{
Field = new MicrobeamEMField();
pEquation = new G4EqMagElectricField(Field);
pStepper = new G4ClassicalRK4 (pEquation);
pFieldMgr = G4TransportationManager::GetTransportationManager()->GetFieldManager();
pIntgrDriver = new G4MagInt_Driver(0.000001*mm,pStepper,pStepper->GetNumberOfVariables() );
pChordFinder = new G4ChordFinder(pIntgrDriver);
pFieldMgr->SetChordFinder( pChordFinder );
pFieldMgr->SetDetectorField(Field);
fieldIsInitialized = true;
// FOLLOWING PARAMETERS TUNED FROM RAY-TRACING SIMULATIONS OF THE AIFIRA NANOBEAM LINE
pFieldMgr->GetChordFinder()->SetDeltaChord(1e-9*m);
pFieldMgr->SetDeltaIntersection(1e-9*m);
pFieldMgr->SetDeltaOneStep(1e-9*m);
propInField =
G4TransportationManager::GetTransportationManager()->GetPropagatorInField();
propInField->SetMinimumEpsilonStep(1e-11);
propInField->SetMaximumEpsilonStep(1e-10);
}
//*************
// WORLD VOLUME
//*************
solidWorld = new G4Box("World", //its name
WorldSizeXY/2,WorldSizeXY/2,WorldSizeZ/2); //its size
logicWorld = new G4LogicalVolume(solidWorld, //its solid
defaultMaterial, //its material
"World"); //its name
physiWorld = new G4PVPlacement(0, //no rotation
G4ThreeVector(), //at (0,0,0)
"World", //its name
logicWorld, //its logical volume
NULL, //its mother volume
false, //no boolean operation
0); //copy number
//*****************
// FULL LINE VOLUME
//*****************
solidVol = new G4Box("Vol",
10.*m/2,10.*m/2,(14025)*mm/2);
logicVol = new G4LogicalVolume(solidVol,
defaultMaterial,
"Vol");
physiVol = new G4PVPlacement(0,
G4ThreeVector(0,0,-2012.5*mm),
"Vol",
logicVol,
physiWorld,
false,
0);
// *************************************************
// Whole microbeam line at 10 deg contained in a box
// *************************************************
G4double PosX = CiblePositionX*mm +( (6958.3/2-3.3)*std::sin(lineAngle))*mm;
G4double PosZ = (CiblePositionZ+2012.5)*mm - ((6958.3/2-3.3)*std::cos(lineAngle))*mm;
// Adjust box absolute position
PosX = PosX + 1.3 * micrometer * std::cos(lineAngle);
PosZ = PosZ + 1.3 * micrometer * std::sin(lineAngle);
G4RotationMatrix *rot = new G4RotationMatrix();
rot->rotateX(0*deg);
rot->rotateY(10*deg);
rot->rotateZ(0*deg);
solidBoite = new G4Box("Boite", 4*cm, 4*cm, 6958.3*mm/2);
logicBoite = new G4LogicalVolume(solidBoite, defaultMaterial, "Boite");
physiBoite = new G4PVPlacement(rot,
G4ThreeVector(PosX,0,PosZ),
"Boite",
logicBoite,
physiVol,
false,
0);
//*********************************************************************
// OBJECT COLLIMATOR (after switching magnet, 5 micrometer in diameter)
//*********************************************************************
CollObjSizeXY = 8*cm;
CollObjSizeZ = 0.07*mm;
solidYoke1 = new G4Box("_CollObj_yoke1_", CollObjSizeXY/2,CollObjSizeXY/2 , CollObjSizeZ/2);
logicYoke1 = new G4LogicalVolume(solidYoke1, collimatorMaterial, "_CollObj_yoke1_");
physiYoke1 = new G4PVPlacement( 0, G4ThreeVector(0,0,6958.3*mm/2-3.3*mm-6955*mm+0.07*mm/2), logicYoke1, "_CollObj_yoke1_",
logicBoite, false, 0);
// --> FIRST PART
solid1Gap = new G4Cons("_CollObj_gap1_", 0.*micrometer, 6*micrometer,
0.*micrometer,2.5*micrometer,
3.5*micrometer,
0, ((360*CLHEP::pi)/180));
logic1Gap = new G4LogicalVolume(solid1Gap, defaultMaterial, "_CollObj_gap1_");
physi1Gap = new G4PVPlacement(0, G4ThreeVector(0,0,0.0315*mm), logic1Gap, "_CollObj_gap1_", logicYoke1, false, 0);
// --> SECOND PART
solid2Gap = new G4Cons("_CollObj_gap2_", 0.*micrometer, 15*micrometer,
0.*micrometer,6*micrometer,
6.5*micrometer,
0, ((360*CLHEP::pi)/180));
logic2Gap = new G4LogicalVolume(solid2Gap, defaultMaterial, "_CollObj_gap2_");
physi2Gap = new G4PVPlacement(0, G4ThreeVector(0,0,0.0215*mm), logic2Gap, "_CollObj_gap2_", logicYoke1, false, 0);
// --> THIRD PART
solid3Gap = new G4Cons("_CollObj_gap3_", 0.*micrometer, 105*micrometer,
0.*micrometer,15*micrometer,
25*micrometer,
0, ((360*CLHEP::pi)/180));
logic3Gap = new G4LogicalVolume(solid3Gap, defaultMaterial, "_CollObj_gap3_");
physi3Gap = new G4PVPlacement(0, G4ThreeVector(0,0,-0.010*mm), logic3Gap, "_CollObj_gap3_", logicYoke1, false, 0);
//************************
// GAS DETECTOR COLLIMATOR
//************************
solidYoke2 = new G4Box("_CollDet_yoke_", 2.5*cm, 2.5*cm, 0.035*mm);
logicYoke2 = new G4LogicalVolume(solidYoke2, collimatorMaterial, "_CollDet_yoke_");
physiYoke2 = new G4PVPlacement(0, G4ThreeVector(0,0,6958.3*mm/2-0.3*mm-3*mm-0.004*mm-0.1*mm-1*mm-2.5*mm-0.070*mm/2), logicYoke2, "_CollDet_yoke_",
logicBoite, false, 0);
// --> FIRST PART
solid4Gap = new G4Cons("_CollDet_gap4_", 0.*micrometer, 8*micrometer,
0.*micrometer,5*micrometer,
7.5*micrometer,
0, ((360*CLHEP::pi)/180));
logic4Gap = new G4LogicalVolume(solid4Gap, defaultMaterial, "_CollDet_gap4_");
physi4Gap = new G4PVPlacement(0, G4ThreeVector(0,0,0.0275*mm), logic4Gap, "_CollDet_gap4_", logicYoke2, false, 0);
// --> SECOND PART
solid5Gap = new G4Cons("_CollDet_gap5_", 0.*micrometer, 105*micrometer,
0.*micrometer,8*micrometer,
27.5*micrometer,
0, ((360*CLHEP::pi)/180));
logic5Gap = new G4LogicalVolume(solid5Gap, defaultMaterial, "_CollDet_gap5_");
physi5Gap = new G4PVPlacement(0,
G4ThreeVector(0,0,-0.0075*mm),
logic5Gap,
"_CollDet_gap5_",
logicYoke2,
false,
0);
// ************
// GAS DETECTOR
// ************
solidBoiteIso = new G4Box("Isobutane", 2.5*cm, 2.5*cm, 1.75*mm);
logicBoiteIso = new G4LogicalVolume(solidBoiteIso, BoiteMaterial, "Isobutane");
physiBoiteIso = new G4PVPlacement(0,
G4ThreeVector(0,0,6958.3*mm/2-0.3*mm-3*mm-0.004*mm-0.1*mm-3.5*mm/2),
"Isobutane",
logicBoiteIso,
physiBoite,
false,
0);
// --> GAS DETECTOR END CAP
solidCathode = new G4Box("_Laiton_", 2.5*cm, 2.5*cm, 0.5*mm);
logicCathode = new G4LogicalVolume(solidCathode, CathodeMaterial, "_Laiton_");
physiCathode = new G4PVPlacement(0,
G4ThreeVector(0,0,1.25*mm),
"_Laiton_",
logicCathode,
physiBoiteIso,
false, 0);
// --> ISOBUTANE GAS
solidIso = new G4Box("_Iso_", 1.*mm, 1.*mm, 0.499925*mm);
logicIso = new G4LogicalVolume(solidIso, BoiteMaterial, "_Iso_");
physiIso = new G4PVPlacement(0,
G4ThreeVector(0,0,-0.000075*mm),
"_Iso_",
logicIso,
physiCathode,
false,
0);
// --> Si3N4 WINDOW
solidVerre = new G4Box("_Si3N4_", 0.5*mm, 0.5*mm, 0.075*micrometer);
logicVerre = new G4LogicalVolume(solidVerre, VerreMaterial, "_Si3N4_");
physiVerre = new G4PVPlacement(0,
G4ThreeVector(0,0,0.499925*mm),
"_Si3N4_",
logicVerre,
physiCathode,
false,
0);
// *******
// AIR GAP
// *******
solidBoite2 = new G4Box("_Air_", 2.5*cm, 2.5*cm, 0.1*mm/2);
logicBoite2 = new G4LogicalVolume(solidBoite2, Boite2Material, "_Air_");
physiBoite2 = new G4PVPlacement(0,
G4ThreeVector(0,0,6958.3*mm/2-0.3*mm-3*mm-0.004*mm-0.1*mm/2),
"_Air_",
logicBoite2,
physiBoite,
false,
0);
//*************
// CELL SUPPORT
//*************
solidBoite3 = new G4Box("Polyprop", 2.5*cm, 2.5*cm, 0.004*mm/2);
logicBoite3 = new G4LogicalVolume(solidBoite3, Boite3Material, "Polyprop");
physiBoite3 = new G4PVPlacement(0,
G4ThreeVector(0,0,6958.3*mm/2-0.3*mm-3*mm-0.004*mm/2),
"Polyprop",
logicBoite3,
physiBoite,
false,
0);
//****
// KGM
//****
solidKgm = new G4Box("KGM", 2.5*cm, 2.5*cm, 3*mm/2);
logicKgm = new G4LogicalVolume(solidKgm, KgmMaterial, "KGM");
physiKgm = new G4PVPlacement(0,
G4ThreeVector(0,0,6958.3*mm/2-0.3*mm-3*mm/2),
"KGM",
logicKgm,
physiBoite,
false,
0);
//*****************
// MICROSCOPE PLATE
//*****************
solidVerre2 = new G4Box("_Lame_", 2.5*cm, 2.5*cm, 0.150*mm);
logicVerre2 = new G4LogicalVolume(solidVerre2, Verre2Material, "_Lame_");
physiVerre2 = new G4PVPlacement(0,
G4ThreeVector(0,0,6958.3*mm/2-0.3*mm/2),
"_Lame_",
logicVerre2,
physiBoite,
false,
0);
// **************
// CELL CYTOPLASM
// **************
// WITHIN KGM
/*
solidCyto=new G4Ellipsoid("CYTO",25*micrometer, 25*micrometer, 11*micrometer);
logicCyto=new G4LogicalVolume (solidCyto, defaultMaterial, "CYTO");
physiCyto=new G4PVPlacement(0, G4ThreeVector(0,0,-1.5*mm+11*micrometer),"CYTO",logicCyto,physiKgm, false, 0);
*/
// ************
// CELL PHANTOM
// ************
solidPhantom = new G4Box("Phantom",
myMicrobeamPhantomConfiguration.GetPixelSizeX()/2,
myMicrobeamPhantomConfiguration.GetPixelSizeY()/2,
myMicrobeamPhantomConfiguration.GetPixelSizeZ()/2);
logicPhantom = new G4LogicalVolume(solidPhantom,defaultMaterial,"Phantom",0,0,0);
// PHANTOM MASSES
SetNbOfPixelsInPhantom (myMicrobeamPhantomConfiguration.GetPhantomTotalPixels());
SetMassNucleus(myMicrobeamPhantomConfiguration.GetNucleusMass());
SetMassCytoplasm(myMicrobeamPhantomConfiguration.GetCytoplasmMass());
// PHANTOM
phantomParam = new MicrobeamCellParameterisation
(myMicrobeamPhantomConfiguration.GetPhantomTotalPixels(),
myMicrobeamPhantomConfiguration.GetPixelSizeX()/2,
myMicrobeamPhantomConfiguration.GetPixelSizeY()/2,
myMicrobeamPhantomConfiguration.GetPixelSizeZ()/2,
nucleusMaterial1,cytoplasmMaterial1,
nucleusMaterial2,cytoplasmMaterial2,
nucleusMaterial3,cytoplasmMaterial3
);
physiPhantom = new G4PVParameterised(
"Phantom", // their name
logicPhantom, // their logical volumr
// logicCyto, // Mother logical volume
logicKgm, // Mother logical volume
kUndefined, // Are placed along this axis
phantomParam->GetNoBoxes(), // Number of boxes
phantomParam,false); // The parametrisation
G4cout << " ==========> The phantom contains "
<< myMicrobeamPhantomConfiguration.GetPhantomTotalPixels() << " voxels " << G4endl;
G4cout << G4endl;
// USER LIMITS ON STEP LENGTH
logicWorld->SetUserLimits(new G4UserLimits(100*mm));
logicVol->SetUserLimits(new G4UserLimits(100*mm));
logicBoite->SetUserLimits(new G4UserLimits(10*mm));
/*
logicPhantom->SetUserLimits (new G4UserLimits(0.5*micrometer));
logic1Gap->SetUserLimits (new G4UserLimits(5*micrometer));
logic2Gap->SetUserLimits (new G4UserLimits(5*micrometer));
logic3Gap->SetUserLimits (new G4UserLimits(5*micrometer));
logic4Gap->SetUserLimits (new G4UserLimits(5*micrometer));
logic5Gap->SetUserLimits (new G4UserLimits(5*micrometer));
logicBoiteIso->SetUserLimits (new G4UserLimits(200.*micrometer));
logicCathode->SetUserLimits (new G4UserLimits(100.*micrometer));
logicIso->SetUserLimits (new G4UserLimits(100.*micrometer));
logicVerre->SetUserLimits (new G4UserLimits(0.02*micrometer));
logicBoite2->SetUserLimits (new G4UserLimits(10*micrometer));
logicBoite3->SetUserLimits (new G4UserLimits(0.2*micrometer));
logicKgm->SetUserLimits (new G4UserLimits(1*micrometer));
logicVerre2->SetUserLimits (new G4UserLimits(10*micrometer));
*/
// VISUALISATION ATTRIBUTES (for phantom, see in Parameterisation class)
G4VisAttributes* simpleWorldVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,1.0)); //White
simpleWorldVisAtt->SetVisibility(true);
G4VisAttributes* simplePlain= new G4VisAttributes(G4Colour(1.0,1.0,1.0)); //White
simplePlain->SetVisibility(true);
simplePlain->SetForceSolid(true);
G4VisAttributes* simpleBoxAttLine= new G4VisAttributes(G4Colour(1.0,0.0,0.0));
simpleBoxAttLine->SetVisibility(true);
G4VisAttributes* simpleBoxAtt= new G4VisAttributes(G4Colour(1.0,1.0,0.0));
simpleBoxAtt->SetDaughtersInvisible(false);
simpleBoxAtt->SetForceSolid(false);
G4VisAttributes* simpleBoxAtt2= new G4VisAttributes(G4Colour(0.0,1.0,0.0));
simpleBoxAtt2->SetDaughtersInvisible(false);
simpleBoxAtt2->SetForceSolid(false);
G4VisAttributes* simpleBoxAttKGM= new G4VisAttributes(G4Colour(0.0,0.0,1.0));
simpleBoxAttKGM->SetDaughtersInvisible(false);
simpleBoxAttKGM->SetForceSolid(false);
G4VisAttributes* simpleBoxAttPropyl= new G4VisAttributes(G4Colour(1.0,1.0,1.0));
simpleBoxAttPropyl->SetDaughtersInvisible(true);
simpleBoxAttPropyl->SetForceSolid(false);
G4VisAttributes* simpleBoxAttAir= new G4VisAttributes(G4Colour(0.0,1.0,0.0));
simpleBoxAttAir->SetDaughtersInvisible(true);
simpleBoxAttAir->SetForceSolid(false);
G4VisAttributes* simpleBoxAtt3= new G4VisAttributes(G4Colour(0.0,0.0,1.0));
simpleBoxAtt3->SetDaughtersInvisible(false);
simpleBoxAtt3->SetForceSolid(false);
logicYoke1->SetVisAttributes(simpleBoxAtt);
logic1Gap->SetVisAttributes(simpleBoxAtt);
logic2Gap->SetVisAttributes(simpleBoxAtt);
logic3Gap->SetVisAttributes(simpleBoxAtt);
logicYoke2->SetVisAttributes(simpleBoxAtt);
logic4Gap->SetVisAttributes(simpleBoxAtt);
logic5Gap->SetVisAttributes(simpleBoxAtt);
logicBoite->SetVisAttributes(simpleBoxAttLine);
logicCathode->SetVisAttributes(simpleBoxAttPropyl);
logicIso->SetVisAttributes(simpleBoxAttPropyl);
logicBoiteIso->SetVisAttributes(simpleBoxAttPropyl);
logicVerre->SetVisAttributes(simpleBoxAtt);
logicBoite2->SetVisAttributes(simpleBoxAttAir);
logicBoite3->SetVisAttributes(simpleBoxAtt);
logicKgm->SetVisAttributes(simpleBoxAttKGM);
logicVerre2->SetVisAttributes(simpleBoxAtt);
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
return physiWorld;
}
@@ -1,171 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "MicrobeamHistoManager.hh"
#include "G4UnitsTable.hh"
#ifdef G4ANALYSIS_USE
#include "AIDA/AIDA.h"
#endif
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
MicrobeamHistoManager::MicrobeamHistoManager()
:af(0),tree(0),factoryOn(false)
{
#ifdef G4ANALYSIS_USE
// Creating the analysis factory
af = AIDA_createAnalysisFactory();
if(!af) {
G4cout << " MicrobeamHistoManager::MicrobeamHistoManager() :"
<< " problem creating the AIDA analysis factory."
<< G4endl;
}
#endif
fileName[0] = "microbeam";
fileType = "root";
fileOption = "";
ntupl0=0;
ntupl1=0;
ntupl2=0;
ntupl3=0;
ntupl4=0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
MicrobeamHistoManager::~MicrobeamHistoManager()
{
#ifdef G4ANALYSIS_USE
delete af;
#endif
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void MicrobeamHistoManager::book()
{
#ifdef G4ANALYSIS_USE
if(!af) return;
// Creating a tree mapped to an hbook file.
fileName[1] = fileName[0] + "." + fileType;
G4bool readOnly = false;
G4bool createNew = true;
AIDA::ITreeFactory* tf = af->createTreeFactory();
tree = tf->create(fileName[1], fileType, readOnly, createNew, fileOption);
delete tf;
if(!tree) {
G4cout << "MicrobeamHistoManager::book() :"
<< " problem creating the AIDA tree with "
<< " storeName = " << fileName[1]
<< " storeType = " << fileType
<< " readOnly = " << readOnly
<< " createNew = " << createNew
<< " options = " << fileOption
<< G4endl;
return;
}
// Creating a histogram & ntuplr factory
AIDA::IHistogramFactory* hf = af->createHistogramFactory(*tree);
AIDA::ITupleFactory* ntf = af->createTupleFactory(*tree);
ntupl0 = ntf->create( "ntuple0", "Stopping power", "double e, sp");
ntupl1 = ntf->create( "ntuple1", "Beam position", "double x, y");
ntupl2 = ntf->create( "ntuple2", "Range", "double x, y, z");
ntupl3 = ntf->create( "ntuple3", "Doses", "double doseN, doseC");
ntupl4 = ntf->create( "ntuple4", "3D", "double x, y, z, doseV");
factoryOn = true;
delete hf;
delete ntf;
if (factoryOn)
G4cout << "\n----> Histogram Tree is opened in " << fileName[1] << G4endl;
#endif
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void MicrobeamHistoManager::save()
{
#ifdef G4ANALYSIS_USE
if (factoryOn) {
tree->commit(); // Writing the histograms to the file
tree->close(); // and closing the tree (and the file)
G4cout << "\n----> Histogram Tree is saved in " << fileName[1] << G4endl;
delete tree;
tree = 0;
factoryOn = false;
}
#endif
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void MicrobeamHistoManager::FillNtuple(G4int nt, G4int column, G4double value)
{
if (nt >= MaxNtupl) {
G4cout << "---> warning from MicrobeamHistoManager::FillNtuple() : Ntuple " << nt
<< " does not exist " << column << value << G4endl;
return;
}
#ifdef G4ANALYSIS_USE
if(nt==0) ntupl0->fill(column, value);
if(nt==1) ntupl1->fill(column, value);
if(nt==2) ntupl2->fill(column, value);
if(nt==3) ntupl3->fill(column, value);
if(nt==4) ntupl4->fill(column, value);
#endif
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void MicrobeamHistoManager::AddRowNtuple(G4int nt)
{
if (nt >= MaxNtupl) {
G4cout << "---> warning from MicrobeamHistoManager::AddRowNtuple() : Ntuple " << nt
<< " do not exist" << G4endl;
return;
}
#ifdef G4ANALYSIS_USE
if(nt==0) ntupl0->addRow();
if(nt==1) ntupl1->addRow();
if(nt==2) ntupl2->addRow();
if(nt==3) ntupl3->addRow();
if(nt==4) ntupl4->addRow();
#endif
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -1,118 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "MicrobeamPhysicsListMessenger.hh"
#include "MicrobeamPhysicsList.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithAString.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
MicrobeamPhysicsListMessenger::MicrobeamPhysicsListMessenger(MicrobeamPhysicsList* pPhys)
:pPhysicsList(pPhys)
{
physDir = new G4UIdirectory("/microbeam/phys/");
physDir->SetGuidance("physics list commands");
gammaCutCmd = new G4UIcmdWithADoubleAndUnit("/microbeam/phys/setGCut",this);
gammaCutCmd->SetGuidance("Set gamma cut.");
gammaCutCmd->SetParameterName("Gcut",false);
gammaCutCmd->SetUnitCategory("Length");
gammaCutCmd->SetRange("Gcut>0.0");
gammaCutCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
electCutCmd = new G4UIcmdWithADoubleAndUnit("/microbeam/phys/setECut",this);
electCutCmd->SetGuidance("Set electron cut.");
electCutCmd->SetParameterName("Ecut",false);
electCutCmd->SetUnitCategory("Length");
electCutCmd->SetRange("Ecut>0.0");
electCutCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
protoCutCmd = new G4UIcmdWithADoubleAndUnit("/microbeam/phys/setPCut",this);
protoCutCmd->SetGuidance("Set positron cut.");
protoCutCmd->SetParameterName("Pcut",false);
protoCutCmd->SetUnitCategory("Length");
protoCutCmd->SetRange("Pcut>0.0");
protoCutCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
allCutCmd = new G4UIcmdWithADoubleAndUnit("/microbeam/phys/setCuts",this);
allCutCmd->SetGuidance("Set cut for all.");
allCutCmd->SetParameterName("cut",false);
allCutCmd->SetUnitCategory("Length");
allCutCmd->SetRange("cut>0.0");
allCutCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
pListCmd = new G4UIcmdWithAString("/microbeam/phys/addPhysics",this);
pListCmd->SetGuidance("Add modula physics list.");
pListCmd->SetParameterName("PList",false);
pListCmd->AvailableForStates(G4State_PreInit);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
MicrobeamPhysicsListMessenger::~MicrobeamPhysicsListMessenger()
{
delete gammaCutCmd;
delete electCutCmd;
delete protoCutCmd;
delete allCutCmd;
delete pListCmd;
delete physDir;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void MicrobeamPhysicsListMessenger::SetNewValue(G4UIcommand* command,
G4String newValue)
{
if( command == gammaCutCmd )
{ pPhysicsList->SetCutForGamma(gammaCutCmd->GetNewDoubleValue(newValue));}
if( command == electCutCmd )
{ pPhysicsList->SetCutForElectron(electCutCmd->GetNewDoubleValue(newValue));}
if( command == protoCutCmd )
{ pPhysicsList->SetCutForPositron(protoCutCmd->GetNewDoubleValue(newValue));}
if( command == allCutCmd )
{
G4double cut = allCutCmd->GetNewDoubleValue(newValue);
pPhysicsList->SetCutForGamma(cut);
pPhysicsList->SetCutForElectron(cut);
pPhysicsList->SetCutForPositron(cut);
}
if( command == pListCmd )
{ pPhysicsList->AddPhysicsList(newValue);}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -1,121 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// -------------------------------------------------------------------
// $Id$
// -------------------------------------------------------------------
#include "G4UImanager.hh"
#include "Randomize.hh"
#include "MicrobeamRunAction.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
MicrobeamRunAction::MicrobeamRunAction(MicrobeamDetectorConstruction* det,
MicrobeamHistoManager * his)
:Detector(det),Histo(his)
{
saveRndm = 0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
MicrobeamRunAction::~MicrobeamRunAction()
{
delete[] dose3DDose;
delete[] mapVoxels;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void MicrobeamRunAction::BeginOfRunAction(const G4Run* /*aRun*/)
{
// Histograms
Histo->book();
// save Rndm status
if (saveRndm > 0)
{
CLHEP::HepRandom::showEngineStatus();
CLHEP::HepRandom::saveEngineStatus("beginOfRun.rndm");
}
numEvent = 0;
nbOfHitsGas = 0;
// ABSORBED DOSES INITIALIZATION
DoseN = 0;
DoseC = 0;
massCytoplasm = Detector->GetMassCytoplasm();
massNucleus = Detector->GetMassNucleus();
nbOfPixels = Detector->GetNbOfPixelsInPhantom();
mapVoxels = new G4ThreeVector[nbOfPixels];
dose3DDose = new G4float[nbOfPixels];
for (G4int i=0; i<nbOfPixels; i++)
{
mapVoxels [i]=myMicrobeamPhantomConfiguration.GetVoxelThreeVector(i);
dose3DDose[i]=0;
G4ThreeVector v=mapVoxels[i];
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void MicrobeamRunAction::EndOfRunAction(const G4Run* /*aRun*/)
{
// save Rndm status
if (saveRndm == 1)
{
CLHEP::HepRandom::showEngineStatus();
CLHEP::HepRandom::saveEngineStatus("endOfRun.rndm");
}
for (G4int i=0; i<nbOfPixels; i++)
{
G4ThreeVector v;
v = mapVoxels[i];
if ( (GetNumEvent()+1) !=0)
{
Histo->FillNtuple(4,0,v.x());
Histo->FillNtuple(4,1,v.y());
Histo->FillNtuple(4,2,v.z());
Histo->FillNtuple(4,3,dose3DDose[i]/(GetNumEvent()+1));
Histo->AddRowNtuple(4);
}
}
G4cout << "-> Total number of particles detected by the gas detector : " << GetNbOfHitsGas() << G4endl;
G4cout << G4endl;
//save histograms
Histo->save();
}
@@ -1,172 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// -------------------------------------------------------------------
// $Id$
// -------------------------------------------------------------------
#include "G4UnitsTable.hh"
#include "MicrobeamSteppingVerbose.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
MicrobeamSteppingVerbose::MicrobeamSteppingVerbose()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
MicrobeamSteppingVerbose::~MicrobeamSteppingVerbose()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void MicrobeamSteppingVerbose::StepInfo()
{
CopyState();
G4int prec = G4cout.precision(6);
if( verboseLevel >= 1 ){
if( verboseLevel >= 4 ) VerboseTrack();
if( verboseLevel >= 3 ){
G4cout << G4endl;
G4cout << std::setw( 5) << "#Step#" << " "
<< std::setw( 6) << "X" << " "
<< std::setw( 6) << "Y" << " "
<< std::setw( 6) << "Z" << " "
<< std::setw( 9) << "KineE" << " "
<< std::setw( 9) << "dEStep" << " "
<< std::setw(10) << "StepLeng"
<< std::setw(10) << "TrakLeng"
<< std::setw(10) << "NextVolu"
<< std::setw(10) << "Process" << G4endl;
}
G4cout << std::setw( 5) << fTrack->GetCurrentStepNumber() << " "
<< std::setw( 7) << G4BestUnit(fTrack->GetPosition().x(),"Length") << " "
<< std::setw( 7) << G4BestUnit(fTrack->GetPosition().y(),"Length") << " "
<< std::setw( 7) << G4BestUnit(fTrack->GetPosition().z(),"Length") << " "
<< std::setw( 7) << G4BestUnit(fTrack->GetKineticEnergy(),"Energy") << " "
<< std::setw( 7) << G4BestUnit(fStep->GetTotalEnergyDeposit(),"Energy") << " "
<< std::setw( 7) << G4BestUnit(fStep->GetStepLength(),"Length") << " "
<< std::setw( 7) << G4BestUnit(fTrack->GetTrackLength(),"Length") << " ";
if( fTrack->GetNextVolume() != 0 ) {
G4cout << std::setw(11) << fTrack->GetNextVolume()->GetName() <<" ";
} else {
G4cout << std::setw(11) << "OutOfWorld";
}
if(fStep->GetPostStepPoint()->GetProcessDefinedStep() != NULL){
G4cout << std::setw(10) << fStep->GetPostStepPoint()->GetProcessDefinedStep()
->GetProcessName();
} else {
G4cout << "User Limit";
}
G4cout << G4endl;
if( verboseLevel == 2 ){
G4int tN2ndariesTot = fN2ndariesAtRestDoIt +
fN2ndariesAlongStepDoIt +
fN2ndariesPostStepDoIt;
if(tN2ndariesTot>0){
G4cout << " :----- List of 2ndaries - "
<< "#SpawnInStep=" << std::setw(3) << tN2ndariesTot
<< "(Rest=" << std::setw(2) << fN2ndariesAtRestDoIt
<< ",Along=" << std::setw(2) << fN2ndariesAlongStepDoIt
<< ",Post=" << std::setw(2) << fN2ndariesPostStepDoIt
<< "), "
<< "#SpawnTotal=" << std::setw(3) << (*fSecondary).size()
<< " ---------------"
<< G4endl;
for(size_t lp1=(*fSecondary).size()-tN2ndariesTot;
lp1<(*fSecondary).size(); lp1++){
G4cout << " : "
<< std::setw(6)
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().x(),"Length")
<< std::setw(6)
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().y(),"Length")
<< std::setw(6)
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().z(),"Length")
<< std::setw(6)
<< G4BestUnit((*fSecondary)[lp1]->GetKineticEnergy(),"Energy")
<< std::setw(10)
<< (*fSecondary)[lp1]->GetDefinition()->GetParticleName();
G4cout << G4endl;
}
G4cout << " :-----------------------------"
<< "----------------------------------"
<< "-- EndOf2ndaries Info ---------------"
<< G4endl;
}
}
}
G4cout.precision(prec);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void MicrobeamSteppingVerbose::TrackingStarted()
{
CopyState();
G4int prec = G4cout.precision(3);
if( verboseLevel > 0 ){
G4cout << std::setw( 5) << "Step#" << " "
<< std::setw( 6) << "X" << " "
<< std::setw( 6) << "Y" << " "
<< std::setw( 6) << "Z" << " "
<< std::setw( 9) << "KineE" << " "
<< std::setw( 9) << "dEStep" << " "
<< std::setw(10) << "StepLeng"
<< std::setw(10) << "TrakLeng"
<< std::setw(10) << "NextVolu"
<< std::setw(10) << "Process" << G4endl;
G4cout << std::setw( 5) << fTrack->GetCurrentStepNumber() << " "
<< std::setw( 6) << G4BestUnit(fTrack->GetPosition().x(),"Length")
<< std::setw( 6) << G4BestUnit(fTrack->GetPosition().y(),"Length")
<< std::setw( 6) << G4BestUnit(fTrack->GetPosition().z(),"Length")
<< std::setw( 6) << G4BestUnit(fTrack->GetKineticEnergy(),"Energy")
<< std::setw( 6) << G4BestUnit(fStep->GetTotalEnergyDeposit(),"Energy")
<< std::setw( 6) << G4BestUnit(fStep->GetStepLength(),"Length")
<< std::setw( 6) << G4BestUnit(fTrack->GetTrackLength(),"Length");
if(fTrack->GetNextVolume()){
G4cout << std::setw(11) << fTrack->GetNextVolume()->GetName() << " ";
} else {
G4cout << std::setw(11) << "OutOfWorld" << " ";
}
G4cout << std::setw(10) << "initStep" << G4endl;
}
G4cout.precision(prec);
G4cout<< "exit MicrobeamSteppingVerbose::TrackingStarted() " <<G4endl;
}
@@ -23,66 +23,75 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// -------------------------------------------------------------------
// $Id$
// -------------------------------------------------------------------
// 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 publication:
// Med. Phys. 37 (2010) 4692-4708
// The Geant4-DNA web site is available at http://geant4-dna.org
//
// If you use this example, please cite the following publication:
// Rad. Prot. Dos. 133 (2009) 2-11
#include "MicrobeamPhantomConfiguration.hh"
#include "PhantomConfiguration.hh"
#include "G4SystemOfUnits.hh"
G4int MicrobeamPhantomConfiguration::phantomTotalPixels = 0;
G4int MicrobeamPhantomConfiguration::nucleusTotalPixels = 0;
G4int MicrobeamPhantomConfiguration::cytoplasmTotalPixels = 0;
G4float MicrobeamPhantomConfiguration::dx = 0;
G4float MicrobeamPhantomConfiguration::dy = 0;
G4float MicrobeamPhantomConfiguration::dz = 0;
G4float MicrobeamPhantomConfiguration::nucleusMass = 0;
G4float MicrobeamPhantomConfiguration::cytoplasmMass = 0;
G4int PhantomConfiguration::fPhantomTotalPixels = 0;
G4int PhantomConfiguration::fNucleusTotalPixels = 0;
G4int PhantomConfiguration::fCytoplasmTotalPixels = 0;
G4float PhantomConfiguration::fDx = 0;
G4float PhantomConfiguration::fDy = 0;
G4float PhantomConfiguration::fDz = 0;
G4float PhantomConfiguration::fNucleusMass = 0;
G4float PhantomConfiguration::fCytoplasmMass = 0;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
MicrobeamPhantomConfiguration::MicrobeamPhantomConfiguration() {
Initialize();
}
MicrobeamPhantomConfiguration::~MicrobeamPhantomConfiguration()
PhantomConfiguration::PhantomConfiguration()
{
delete[] voxelThreeVector;
Initialize();
}
PhantomConfiguration::~PhantomConfiguration()
{
delete[] fVoxelThreeVector;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4int MicrobeamPhantomConfiguration::Initialize() {
G4int PhantomConfiguration::Initialize()
{
G4float vx, vy, vz, tmp, density;
G4int den, mat;
G4float denCyto1, denCyto2, denCyto3, denNucl1, denNucl2, denNucl3;
FILE* fMap;
phantomTotalPixels=0;
nucleusTotalPixels=0;
cytoplasmTotalPixels=0;
dx=0;
dy=0;
dz=0;
nucleusMass=0;
cytoplasmMass=0;
density=0;
fPhantomTotalPixels=0;
fNucleusTotalPixels=0;
fCytoplasmTotalPixels=0;
fDx=0;
fDy=0;
fDz=0;
fNucleusMass=0;
fCytoplasmMass=0;
// READ PHANTOM PARAMETERS
fMap = fopen("phantom.dat","r");
fscanf(fMap,"%i %i %i",&phantomTotalPixels, &nucleusTotalPixels, &cytoplasmTotalPixels);
fscanf(fMap,"%f %f %f",&dx, &dy, &dz);
fscanf(fMap,"%i %i %i",&fPhantomTotalPixels, &fNucleusTotalPixels, &fCytoplasmTotalPixels);
fscanf(fMap,"%f %f %f",&fDx, &fDy, &fDz);
fscanf(fMap,"%f %f %f",&tmp, &tmp, &tmp);
fscanf(fMap,"%f %f %f",&denCyto1, &denCyto2, &denCyto3);
fscanf(fMap,"%f %f %f",&denNucl1, &denNucl2, &denNucl3);
dx = dx * micrometer;
dy = dy * micrometer;
dz = dz * micrometer;
voxelThreeVector = new G4ThreeVector [phantomTotalPixels];
fDx = fDx * micrometer;
fDy = fDy * micrometer;
fDz = fDz * micrometer;
fVoxelThreeVector = new G4ThreeVector [fPhantomTotalPixels];
for (G4int i=0; i<phantomTotalPixels; i++)
for (G4int i=0; i<fPhantomTotalPixels; i++)
{
fscanf(fMap,"%f %f %f %i %i %f",&vx, &vy, &vz, &mat, &den, &tmp);
@@ -91,7 +100,7 @@ G4int MicrobeamPhantomConfiguration::Initialize() {
if (std::abs(den-1)<1.e-30) density = denNucl1*(g/cm3);
if (std::abs(den-2)<1.e-30) density = denNucl2*(g/cm3);
if (std::abs(den-3)<1.e-30) density = denNucl3*(g/cm3);
nucleusMass = nucleusMass + density * dx * dy * dz ;
fNucleusMass = fNucleusMass + density * fDx * fDy * fDz ;
}
if (std::abs(mat-1)<1.e-30) // CYTOPLASM
@@ -99,11 +108,11 @@ G4int MicrobeamPhantomConfiguration::Initialize() {
if (std::abs(den-1)<1e-30) density = denCyto1*(g/cm3);
if (std::abs(den-2)<1e-30) density = denCyto2*(g/cm3);
if (std::abs(den-3)<1e-30) density = denCyto3*(g/cm3);
cytoplasmMass = cytoplasmMass + density * dx * dy * dz ;
fCytoplasmMass = fCytoplasmMass + density * fDx * fDy * fDz ;
}
G4ThreeVector v(vx,vy,vz);
voxelThreeVector[i] = v;
fVoxelThreeVector[i] = v;
}
fclose(fMap);
@@ -23,17 +23,19 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
// 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 publication:
// Med. Phys. 37 (2010) 4692-4708
// The Geant4-DNA web site is available at http://geant4-dna.org
//
// If you use this example, please cite the following publication:
// Rad. Prot. Dos. 133 (2009) 2-11
#include "MicrobeamPhysicsList.hh"
#include "MicrobeamPhysicsListMessenger.hh"
#include "PhysicsList.hh"
#include "PhysicsListMessenger.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "G4UnitsTable.hh"
#include "G4StepLimiter.hh"
#include "G4EmStandardPhysics.hh"
@@ -43,15 +45,10 @@
#include "G4EmStandardPhysics_option4.hh"
#include "G4EmLivermorePhysics.hh"
#include "G4EmPenelopePhysics.hh"
#include "G4DecayPhysics.hh"
#include "G4LossTableManager.hh"
//#include "G4EmConfigurator.hh"
#include "G4ProcessManager.hh"
#include "G4Decay.hh"
#include "G4Gamma.hh"
#include "G4Electron.hh"
@@ -59,114 +56,112 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
MicrobeamPhysicsList::MicrobeamPhysicsList() : G4VModularPhysicsList()
PhysicsList::PhysicsList() : G4VModularPhysicsList()
{
G4LossTableManager::Instance();
defaultCutValue = 0.01*micrometer;
cutForGamma = defaultCutValue;
cutForElectron = defaultCutValue;
cutForPositron = defaultCutValue;
fCutForGamma = defaultCutValue;
fCutForElectron = defaultCutValue;
fCutForPositron = defaultCutValue;
pMessenger = new MicrobeamPhysicsListMessenger(this);
fMessenger = new PhysicsListMessenger(this);
SetVerboseLevel(1);
// EM physics
emName = G4String("emstandard_opt0");
fEmName = G4String("emlivermore");
emPhysicsList = new G4EmStandardPhysics(1);
fEmPhysicsList = new G4EmLivermorePhysics();
// Deacy physics and all particles
decPhysicsList = new G4DecayPhysics();
fDecPhysicsList = new G4DecayPhysics();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
MicrobeamPhysicsList::~MicrobeamPhysicsList()
PhysicsList::~PhysicsList()
{
delete pMessenger;
delete emPhysicsList;
delete decPhysicsList;
delete fMessenger;
delete fEmPhysicsList;
delete fDecPhysicsList;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void MicrobeamPhysicsList::ConstructParticle()
void PhysicsList::ConstructParticle()
{
decPhysicsList->ConstructParticle();
fDecPhysicsList->ConstructParticle();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void MicrobeamPhysicsList::ConstructProcess()
void PhysicsList::ConstructProcess()
{
// transportation
//
AddTransportation();
// electromagnetic physics list
//
emPhysicsList->ConstructProcess();
fEmPhysicsList->ConstructProcess();
// decay physics list
//
decPhysicsList->ConstructProcess();
fDecPhysicsList->ConstructProcess();
// step limitation (as a full process)
//
AddStepMax();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void MicrobeamPhysicsList::AddPhysicsList(const G4String& name)
void PhysicsList::AddPhysicsList(const G4String& name)
{
if (verboseLevel>1) {
G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
}
if (name == emName) return;
if (name == fEmName) return;
if (name == "emstandard_opt0") {
emName = name;
delete emPhysicsList;
emPhysicsList = new G4EmStandardPhysics(1);
fEmName = name;
delete fEmPhysicsList;
fEmPhysicsList = new G4EmStandardPhysics(1);
} else if (name == "emstandard_opt1") {
emName = name;
delete emPhysicsList;
emPhysicsList = new G4EmStandardPhysics_option1();
fEmName = name;
delete fEmPhysicsList;
fEmPhysicsList = new G4EmStandardPhysics_option1();
} else if (name == "emstandard_opt2") {
emName = name;
delete emPhysicsList;
emPhysicsList = new G4EmStandardPhysics_option2();
fEmName = name;
delete fEmPhysicsList;
fEmPhysicsList = new G4EmStandardPhysics_option2();
} else if (name == "emstandard_opt3") {
emName = name;
delete emPhysicsList;
emPhysicsList = new G4EmStandardPhysics_option3();
fEmName = name;
delete fEmPhysicsList;
fEmPhysicsList = new G4EmStandardPhysics_option3();
} else if (name == "emstandard_opt4") {
emName = name;
delete emPhysicsList;
emPhysicsList = new G4EmStandardPhysics_option4();
fEmName = name;
delete fEmPhysicsList;
fEmPhysicsList = new G4EmStandardPhysics_option4();
} else if (name == "emlivermore") {
emName = name;
delete emPhysicsList;
emPhysicsList = new G4EmLivermorePhysics();
fEmName = name;
delete fEmPhysicsList;
fEmPhysicsList = new G4EmLivermorePhysics();
} else if (name == "empenelope") {
emName = name;
delete emPhysicsList;
emPhysicsList = new G4EmPenelopePhysics();
fEmName = name;
delete fEmPhysicsList;
fEmPhysicsList = new G4EmPenelopePhysics();
}
}
@@ -174,26 +169,27 @@ void MicrobeamPhysicsList::AddPhysicsList(const G4String& name)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void MicrobeamPhysicsList::AddStepMax()
void PhysicsList::AddStepMax()
{
// Step limitation seen as a process
stepMaxProcess = new G4StepLimiter();
fStepMaxProcess = new G4StepLimiter();
theParticleIterator->reset();
while ((*theParticleIterator)()){
G4ParticleDefinition* particle = theParticleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
if (stepMaxProcess->IsApplicable(*particle) && pmanager)
if (fStepMaxProcess->IsApplicable(*particle) && pmanager)
{
pmanager ->AddDiscreteProcess(stepMaxProcess);
pmanager ->AddDiscreteProcess(fStepMaxProcess);
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void MicrobeamPhysicsList::SetCuts()
void PhysicsList::SetCuts()
{
if (verboseLevel >0){
@@ -201,37 +197,35 @@ void MicrobeamPhysicsList::SetCuts()
G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl;
}
// set cut values for gamma at first and for e- second and next for e+,
// because some processes for e+/e- need cut values for gamma
SetCutValue(cutForGamma, "gamma");
SetCutValue(cutForElectron, "e-");
SetCutValue(cutForPositron, "e+");
SetCutValue(fCutForGamma, "gamma");
SetCutValue(fCutForElectron, "e-");
SetCutValue(fCutForPositron, "e+");
if (verboseLevel>0) DumpCutValuesTable();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void MicrobeamPhysicsList::SetCutForGamma(G4double cut)
void PhysicsList::SetCutForGamma(G4double cut)
{
cutForGamma = cut;
SetParticleCuts(cutForGamma, G4Gamma::Gamma());
fCutForGamma = cut;
SetParticleCuts(fCutForGamma, G4Gamma::Gamma());
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void MicrobeamPhysicsList::SetCutForElectron(G4double cut)
void PhysicsList::SetCutForElectron(G4double cut)
{
cutForElectron = cut;
SetParticleCuts(cutForElectron, G4Electron::Electron());
fCutForElectron = cut;
SetParticleCuts(fCutForElectron, G4Electron::Electron());
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void MicrobeamPhysicsList::SetCutForPositron(G4double cut)
void PhysicsList::SetCutForPositron(G4double cut)
{
cutForPositron = cut;
SetParticleCuts(cutForPositron, G4Positron::Positron());
fCutForPositron = cut;
SetParticleCuts(fCutForPositron, G4Positron::Positron());
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,120 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// 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 publication:
// Med. Phys. 37 (2010) 4692-4708
// The Geant4-DNA web site is available at http://geant4-dna.org
//
// If you use this example, please cite the following publication:
// Rad. Prot. Dos. 133 (2009) 2-11
#include "PhysicsListMessenger.hh"
#include "PhysicsList.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithAString.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PhysicsListMessenger::PhysicsListMessenger(PhysicsList* pPhys)
:fPhysicsList(pPhys)
{
fPhysDir = new G4UIdirectory("/microbeam/phys/");
fPhysDir->SetGuidance("physics list commands");
fGammaCutCmd = new G4UIcmdWithADoubleAndUnit("/microbeam/phys/setGCut",this);
fGammaCutCmd->SetGuidance("Set gamma cut.");
fGammaCutCmd->SetParameterName("Gcut",false);
fGammaCutCmd->SetUnitCategory("Length");
fGammaCutCmd->SetRange("Gcut>0.0");
fGammaCutCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fElectCutCmd = new G4UIcmdWithADoubleAndUnit("/microbeam/phys/setECut",this);
fElectCutCmd->SetGuidance("Set electron cut.");
fElectCutCmd->SetParameterName("Ecut",false);
fElectCutCmd->SetUnitCategory("Length");
fElectCutCmd->SetRange("Ecut>0.0");
fElectCutCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fProtoCutCmd = new G4UIcmdWithADoubleAndUnit("/microbeam/phys/setPCut",this);
fProtoCutCmd->SetGuidance("Set positron cut.");
fProtoCutCmd->SetParameterName("Pcut",false);
fProtoCutCmd->SetUnitCategory("Length");
fProtoCutCmd->SetRange("Pcut>0.0");
fProtoCutCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fAllCutCmd = new G4UIcmdWithADoubleAndUnit("/microbeam/phys/setCuts",this);
fAllCutCmd->SetGuidance("Set cut for all.");
fAllCutCmd->SetParameterName("cut",false);
fAllCutCmd->SetUnitCategory("Length");
fAllCutCmd->SetRange("cut>0.0");
fAllCutCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fListCmd = new G4UIcmdWithAString("/microbeam/phys/addPhysics",this);
fListCmd->SetGuidance("Add modula physics list.");
fListCmd->SetParameterName("PList",false);
fListCmd->AvailableForStates(G4State_PreInit);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PhysicsListMessenger::~PhysicsListMessenger()
{
delete fGammaCutCmd;
delete fElectCutCmd;
delete fProtoCutCmd;
delete fAllCutCmd;
delete fListCmd;
delete fPhysDir;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PhysicsListMessenger::SetNewValue(G4UIcommand* command,
G4String newValue)
{
if( command == fGammaCutCmd )
{ fPhysicsList->SetCutForGamma(fGammaCutCmd->GetNewDoubleValue(newValue));}
if( command == fElectCutCmd )
{ fPhysicsList->SetCutForElectron(fElectCutCmd->GetNewDoubleValue(newValue));}
if( command == fProtoCutCmd )
{ fPhysicsList->SetCutForPositron(fProtoCutCmd->GetNewDoubleValue(newValue));}
if( command == fAllCutCmd )
{
G4double cut = fAllCutCmd->GetNewDoubleValue(newValue);
fPhysicsList->SetCutForGamma(cut);
fPhysicsList->SetCutForElectron(cut);
fPhysicsList->SetCutForPositron(cut);
}
if( command == fListCmd )
{ fPhysicsList->AddPhysicsList(newValue);}
}
@@ -23,38 +23,39 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// -------------------------------------------------------------------
// $Id$
// -------------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
// 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 publication:
// Med. Phys. 37 (2010) 4692-4708
// The Geant4-DNA web site is available at http://geant4-dna.org
//
// If you use this example, please cite the following publication:
// Rad. Prot. Dos. 133 (2009) 2-11
#include "G4SystemOfUnits.hh"
#include "G4Event.hh"
#include "G4ParticleTable.hh"
#include "Randomize.hh"
#include "MicrobeamPrimaryGeneratorAction.hh"
#include "MicrobeamDetectorConstruction.hh"
#include "PrimaryGeneratorAction.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
MicrobeamPrimaryGeneratorAction::MicrobeamPrimaryGeneratorAction(MicrobeamDetectorConstruction* DC)
:Detector(DC)
PrimaryGeneratorAction::PrimaryGeneratorAction()
{
particleGun = new G4ParticleGun(1);
fParticleGun = new G4ParticleGun(1);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
MicrobeamPrimaryGeneratorAction::~MicrobeamPrimaryGeneratorAction()
PrimaryGeneratorAction::~PrimaryGeneratorAction()
{
delete particleGun;
delete fParticleGun;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void MicrobeamPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
G4int numEvent;
numEvent=anEvent->GetEventID()+1;
@@ -109,18 +110,18 @@ void MicrobeamPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
<< G4endl;
*/
particleGun->SetParticleEnergy(e0);
fParticleGun->SetParticleEnergy(e0);
particleGun->SetParticleMomentumDirection(G4ThreeVector(xMom0,yMom0,zMom0));
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(xMom0,yMom0,zMom0));
particleGun->SetParticlePosition(G4ThreeVector(x0,y0,z0));
fParticleGun->SetParticlePosition(G4ThreeVector(x0,y0,z0));
G4ParticleDefinition* particle=
G4ParticleTable::GetParticleTable()->FindParticle("alpha");
particleGun->SetParticleDefinition(particle);
fParticleGun->SetParticleDefinition(particle);
particleGun->GeneratePrimaryVertex(anEvent);
fParticleGun->GeneratePrimaryVertex(anEvent);
}
+193
View File
@@ -0,0 +1,193 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// 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 publication:
// Med. Phys. 37 (2010) 4692-4708
// The Geant4-DNA web site is available at http://geant4-dna.org
//
// If you use this example, please cite the following publication:
// Rad. Prot. Dos. 133 (2009) 2-11
#include "G4UImanager.hh"
#include "Randomize.hh"
#include "RunAction.hh"
#include "Analysis.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
RunAction::RunAction(DetectorConstruction* det)
:fDetector(det)
{
fSaveRndm = 0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
RunAction::~RunAction()
{
delete[] fDose3DDose;
delete[] fMapVoxels;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void RunAction::BeginOfRunAction(const G4Run*)
{
// Histograms
// Get/create analysis manager
G4cout << "##### Create analysis manager " << " " << this << G4endl;
G4AnalysisManager* man = G4AnalysisManager::Instance();
G4cout << "Using " << man->GetType() << " analysis manager" << G4endl;
// Open an output file
man->OpenFile("microbeam");
man->SetFirstNtupleId(1);
//Declare ntuples
//
// Create 1st ntuple (id = 1)
//
man->CreateNtuple("ntuple0", "Stopping power");
man->CreateNtupleDColumn("e");
man->CreateNtupleDColumn("sp");
man->FinishNtuple();
//G4cout << "Ntuple-1 created" << G4endl;
//
// Create 2nd ntuple (id = 2)
//
man->CreateNtuple("ntuple1", "Beam position");
man->CreateNtupleDColumn("x");
man->CreateNtupleDColumn("y");
man->FinishNtuple();
//G4cout << "Ntuple-2 created" << G4endl;
//
// Create 3rd ntuple (id = 3)
//
man->CreateNtuple("ntuple2", "Range");
man->CreateNtupleDColumn("x");
man->CreateNtupleDColumn("y");
man->CreateNtupleDColumn("z");
man->FinishNtuple();
//G4cout << "Ntuple-3 created" << G4endl;
//
// Create 4th ntuple (id = 4)
//
man->CreateNtuple("ntuple3", "Doses");
man->CreateNtupleDColumn("doseN");
man->CreateNtupleDColumn("doseC");
man->FinishNtuple();
//G4cout << "Ntuple-4 created" << G4endl;
//
// Create 5th ntuple (id = 5)
//
man->CreateNtuple("ntuple4", "3D");
man->CreateNtupleDColumn("x");
man->CreateNtupleDColumn("y");
man->CreateNtupleDColumn("z");
man->CreateNtupleDColumn("doseV");
man->FinishNtuple();
//G4cout << "Ntuple-3 created" << G4endl;
G4cout << "All Ntuples have been created " << G4endl;
// save Rndm status
if (fSaveRndm > 0)
{
CLHEP::HepRandom::showEngineStatus();
CLHEP::HepRandom::saveEngineStatus("beginOfRun.rndm");
}
fNumEvent = 0;
fNbOfHitsGas = 0;
// ABSORBED DOSES INITIALIZATION
fDoseN = 0;
fDoseC = 0;
fMassCytoplasm = fDetector->GetMassCytoplasm();
fMassNucleus = fDetector->GetMassNucleus();
fNbOfPixels = fDetector->GetNbOfPixelsInPhantom();
fMapVoxels = new G4ThreeVector[fNbOfPixels];
fDose3DDose = new G4float[fNbOfPixels];
for (G4int i=0; i<fNbOfPixels; i++)
{
fMapVoxels [i]=fMyPhantomConfiguration.GetVoxelThreeVector(i);
fDose3DDose[i]=0;
G4ThreeVector v=fMapVoxels[i];
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void RunAction::EndOfRunAction(const G4Run* /*aRun*/)
{
G4AnalysisManager* man = G4AnalysisManager::Instance();
// save Rndm status
if (fSaveRndm == 1)
{
CLHEP::HepRandom::showEngineStatus();
CLHEP::HepRandom::saveEngineStatus("endOfRun.rndm");
}
for (G4int i=0; i<fNbOfPixels; i++)
{
G4ThreeVector v;
v = fMapVoxels[i];
if ( (GetNumEvent()+1) !=0)
{
//Fill ntuple #5
man->FillNtupleDColumn(5,0,v.x());
man->FillNtupleDColumn(5,1,v.y());
man->FillNtupleDColumn(5,2,v.z());
man->FillNtupleDColumn(5,3,fDose3DDose[i]/(GetNumEvent()+1));
man->AddNtupleRow(5);
}
}
G4cout << "-> Total number of particles detected by the gas detector : " << GetNbOfHitsGas() << G4endl;
G4cout << G4endl;
//save histograms
man->Write();
man->CloseFile();
// Complete clean-up
delete G4AnalysisManager::Instance();
}
@@ -23,77 +23,87 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// -------------------------------------------------------------------
// $Id$
// -------------------------------------------------------------------
// 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 publication:
// Med. Phys. 37 (2010) 4692-4708
// The Geant4-DNA web site is available at http://geant4-dna.org
//
// If you use this example, please cite the following publication:
// Rad. Prot. Dos. 133 (2009) 2-11
#include "G4SystemOfUnits.hh"
#include "G4SteppingManager.hh"
#include "MicrobeamSteppingAction.hh"
#include "MicrobeamRunAction.hh"
#include "MicrobeamDetectorConstruction.hh"
#include "SteppingAction.hh"
#include "RunAction.hh"
#include "DetectorConstruction.hh"
#include "Analysis.hh"
#include "G4Alpha.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
MicrobeamSteppingAction::MicrobeamSteppingAction(MicrobeamRunAction* run,MicrobeamDetectorConstruction* det,
MicrobeamHistoManager* his)
:Run(run),Detector(det),Histo(his)
SteppingAction::SteppingAction(RunAction* run,DetectorConstruction* det)
:fRun(run),fDetector(det)
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
MicrobeamSteppingAction::~MicrobeamSteppingAction()
SteppingAction::~SteppingAction()
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void MicrobeamSteppingAction::UserSteppingAction(const G4Step* aStep)
void SteppingAction::UserSteppingAction(const G4Step* aStep)
{
G4AnalysisManager* man = G4AnalysisManager::Instance();
// COUNT GAS DETECTOR HITS
if ( ((aStep->GetPreStepPoint()->GetPhysicalVolume()->GetName() == "_CollDet_yoke_")
&& (aStep->GetPostStepPoint()->GetPhysicalVolume()->GetName() == "Isobutane")
&& (aStep->GetTrack()->GetDynamicParticle()->GetDefinition() ->GetParticleName() == "alpha"))
if ( ((aStep->GetPreStepPoint()->GetTouchableHandle()->GetVolume()->GetLogicalVolume() == fDetector->GetLogicalCollDetYoke())
&& (aStep->GetPostStepPoint()->GetTouchableHandle()->GetVolume()->GetLogicalVolume() == fDetector->GetLogicalIsobutane())
&& (aStep->GetTrack()->GetDynamicParticle()->GetDefinition() == G4Alpha::AlphaDefinition() ))
||
((aStep->GetPreStepPoint()->GetPhysicalVolume()->GetName() == "_CollDet_gap4_")
&& (aStep->GetPostStepPoint()->GetPhysicalVolume()->GetName() == "Isobutane")
&& (aStep->GetTrack()->GetDynamicParticle()->GetDefinition() ->GetParticleName() == "alpha"))
((aStep->GetPreStepPoint()->GetTouchableHandle()->GetVolume()->GetLogicalVolume() == fDetector->GetLogicalCollDetGap4())
&& (aStep->GetPostStepPoint()->GetTouchableHandle()->GetVolume()->GetLogicalVolume() == fDetector->GetLogicalIsobutane())
&& (aStep->GetTrack()->GetDynamicParticle()->GetDefinition() == G4Alpha::AlphaDefinition() ))
||
((aStep->GetPreStepPoint()->GetPhysicalVolume()->GetName() == "_CollDet_gap5_")
&& (aStep->GetPostStepPoint()->GetPhysicalVolume()->GetName() == "Isobutane")
&& (aStep->GetTrack()->GetDynamicParticle()->GetDefinition() ->GetParticleName() == "alpha"))
((aStep->GetPreStepPoint()->GetTouchableHandle()->GetVolume()->GetLogicalVolume() == fDetector->GetLogicalCollDetGap4())
&& (aStep->GetPostStepPoint()->GetTouchableHandle()->GetVolume()->GetLogicalVolume() == fDetector->GetLogicalIsobutane())
&& (aStep->GetTrack()->GetDynamicParticle()->GetDefinition() == G4Alpha::AlphaDefinition() ))
)
{
Run->AddNbOfHitsGas();
fRun->AddNbOfHitsGas();
}
// STOPPING POWER AND BEAM SPOT SIZE AT CELL ENTRANCE
if ( ((aStep->GetPreStepPoint()->GetPhysicalVolume()->GetName() == "Polyprop")
&& (aStep->GetPostStepPoint()->GetPhysicalVolume()->GetName() == "KGM")
&& (aStep->GetTrack()->GetDynamicParticle()->GetDefinition() ->GetParticleName() == "alpha"))
if ( ((aStep->GetPreStepPoint()->GetTouchableHandle()->GetVolume()->GetLogicalVolume() == fDetector->GetLogicalPolyprop())
&& (aStep->GetPostStepPoint()->GetTouchableHandle()->GetVolume()->GetLogicalVolume() == fDetector->GetLogicalKgm())
&& (aStep->GetTrack()->GetDynamicParticle()->GetDefinition() == G4Alpha::AlphaDefinition() ))
||
((aStep->GetPreStepPoint()->GetPhysicalVolume()->GetName() == "Polyprop")
((aStep->GetPreStepPoint()->GetTouchableHandle()->GetVolume()->GetLogicalVolume() == fDetector->GetLogicalPolyprop())
&& (aStep->GetPostStepPoint()->GetPhysicalVolume()->GetName() == "physicalCytoplasm")
&& (aStep->GetTrack()->GetDynamicParticle()->GetDefinition() ->GetParticleName() == "alpha"))
&& (aStep->GetTrack()->GetDynamicParticle()->GetDefinition() == G4Alpha::AlphaDefinition() ))
)
{
if( (aStep->GetPreStepPoint()->GetKineticEnergy() - aStep->GetPostStepPoint()->GetKineticEnergy() ) >0)
{
Histo->FillNtuple(0,0,aStep->GetPreStepPoint()->GetKineticEnergy()/keV);
Histo->FillNtuple(0,1,
(aStep->GetPreStepPoint()->GetKineticEnergy() -
aStep->GetPostStepPoint()->GetKineticEnergy())/ keV/(aStep->GetStepLength()/micrometer));
Histo->AddRowNtuple(0);
//Fill ntupleid=1
man->FillNtupleDColumn(1,0,aStep->GetPreStepPoint()->GetKineticEnergy()/keV);
man->FillNtupleDColumn(1,1,
(aStep->GetPreStepPoint()->GetKineticEnergy() -
aStep->GetPostStepPoint()->GetKineticEnergy())/
keV/(aStep->GetStepLength()/micrometer));
man->AddNtupleRow(1);
}
// Average dE over step suggested by Michel Maire
@@ -111,18 +121,17 @@ if ( ((aStep->GetPreStepPoint()->GetPhysicalVolume()->GetName() == "Polypr
G4ThreeVector localPosition = localPosition1 + G4UniformRand()*(localPosition2-localPosition1);
// end
Histo->FillNtuple(1,0,localPosition.x()/micrometer);
Histo->FillNtuple(1,1,localPosition.y()/micrometer);
Histo->AddRowNtuple(1);
//Fill ntupleid=2
man->FillNtupleDColumn(2,0,localPosition.x()/micrometer);
man->FillNtupleDColumn(2,1,localPosition.y()/micrometer);
man->AddNtupleRow(2);
}
// ALPHA RANGE
if (
(aStep->GetTrack()->GetDynamicParticle()->GetDefinition() ->GetParticleName() == "alpha")
(aStep->GetTrack()->GetDynamicParticle()->GetDefinition() == G4Alpha::AlphaDefinition())
&&
@@ -131,16 +140,20 @@ if (
&&
( (aStep->GetPostStepPoint()->GetPhysicalVolume()->GetName() == "physicalCytoplasm")
|| (aStep->GetPostStepPoint()->GetPhysicalVolume()->GetName() == "KGM")
|| (aStep->GetPostStepPoint()->GetTouchableHandle()->GetVolume()->GetLogicalVolume() == fDetector->GetLogicalKgm())
|| (aStep->GetPostStepPoint()->GetPhysicalVolume()->GetName() == "physicalNucleus") )
)
{
Histo->FillNtuple(2,0,aStep->GetPostStepPoint()->GetPosition().x()/micrometer);
Histo->FillNtuple(2,1,aStep->GetPostStepPoint()->GetPosition().y()/micrometer);
Histo->FillNtuple(2,2,aStep->GetPostStepPoint()->GetPosition().z()/micrometer);
Histo->AddRowNtuple(2);
{
//Fill ntupleid=3
man->FillNtupleDColumn(3,0,
aStep->GetPostStepPoint()->GetPosition().x()/micrometer);
man->FillNtupleDColumn(3,1,
aStep->GetPostStepPoint()->GetPosition().y()/micrometer);
man->FillNtupleDColumn(3,2,
aStep->GetPostStepPoint()->GetPosition().z()/micrometer);
man->AddNtupleRow(3);
}
// TOTAL DOSE DEPOSIT AND DOSE DEPOSIT WITHIN A PHANTOM VOXEL
@@ -149,11 +162,11 @@ if (
if (aStep->GetPreStepPoint()->GetPhysicalVolume()->GetName() == "physicalNucleus")
{
G4double dose = (aStep->GetTotalEnergyDeposit()/joule)/(Run->GetMassNucleus()/kg);
Run->AddDoseN(dose);
G4double dose = (aStep->GetTotalEnergyDeposit()/joule)/(fRun->GetMassNucleus()/kg);
fRun->AddDoseN(dose);
G4ThreeVector v;
Run->AddDoseBox(aStep->GetPreStepPoint()->GetTouchableHandle()->GetReplicaNumber(),
fRun->AddDoseBox(aStep->GetPreStepPoint()->GetTouchableHandle()->GetReplicaNumber(),
aStep->GetTotalEnergyDeposit()/eV);
}
@@ -161,11 +174,11 @@ if (aStep->GetPreStepPoint()->GetPhysicalVolume()->GetName() == "physicalNucleu
if (aStep->GetPreStepPoint()->GetPhysicalVolume()->GetName() == "physicalCytoplasm")
{
G4double dose = (aStep->GetTotalEnergyDeposit()/joule)/(Run->GetMassCytoplasm()/kg);
Run->AddDoseC(dose);
G4double dose = (aStep->GetTotalEnergyDeposit()/joule)/(fRun->GetMassCytoplasm()/kg);
fRun->AddDoseC(dose);
G4ThreeVector v;
Run->AddDoseBox(aStep->GetPreStepPoint()->GetTouchableHandle()->GetReplicaNumber(),
fRun->AddDoseBox(aStep->GetPreStepPoint()->GetTouchableHandle()->GetReplicaNumber(),
aStep->GetTotalEnergyDeposit()/eV);
}
}