Import Geant4 10.4.0.beta source tree
This commit is contained in:
@@ -54,9 +54,7 @@ ActionInitialization::~ActionInitialization()
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ActionInitialization::BuildForMaster() const
|
||||
{
|
||||
// No specific action for Master
|
||||
}
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -70,6 +68,4 @@ void ActionInitialization::Build() const
|
||||
SetUserAction(new EventAction(runAction));
|
||||
|
||||
SetUserAction(new SteppingAction(runAction,fDetectorConstruction));
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
}
|
||||
|
||||
@@ -83,9 +83,9 @@ CellParameterisation::CellParameterisation
|
||||
if (nlines == 0)
|
||||
{
|
||||
ncols = fscanf(fMap,"%i %i %i",&fPhantomTotalPixels,&fNucleusTotalPixels,&fCytoplasmTotalPixels);
|
||||
fMapCell = new G4ThreeVector[fPhantomTotalPixels];
|
||||
fMaterial = new G4double[fPhantomTotalPixels];
|
||||
fMass = new G4double[fPhantomTotalPixels];
|
||||
fMapCell = new G4ThreeVector[fPhantomTotalPixels];
|
||||
fMaterial = new G4double[fPhantomTotalPixels];
|
||||
fMass = new G4double[fPhantomTotalPixels];
|
||||
fTissueType = new G4int[fPhantomTotalPixels];
|
||||
}
|
||||
|
||||
@@ -151,8 +151,7 @@ CellParameterisation::CellParameterisation
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
//
|
||||
|
||||
if (std::abs(mat-2)<1.e-30) // NUCLEUS
|
||||
{
|
||||
@@ -225,27 +224,28 @@ CellParameterisation::~CellParameterisation()
|
||||
void CellParameterisation::ComputeTransformation
|
||||
(const G4int copyNo, G4VPhysicalVolume* physVol) const
|
||||
{
|
||||
G4ThreeVector
|
||||
origin(
|
||||
G4ThreeVector origin
|
||||
(
|
||||
fMapCell[copyNo].x()*fDimCellBoxX,
|
||||
fMapCell[copyNo].y()*fDimCellBoxY,
|
||||
fMapCell[copyNo].z()*fDimCellBoxZ);
|
||||
fMapCell[copyNo].z()*fDimCellBoxZ
|
||||
);
|
||||
|
||||
physVol->SetTranslation(origin);
|
||||
physVol->SetTranslation(origin);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void CellParameterisation::ComputeDimensions
|
||||
(G4Box& /*trackerChamber*/, const G4int /*copyNo*/, const G4VPhysicalVolume*) const
|
||||
(G4Box&, const G4int, const G4VPhysicalVolume*) const
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4Material*
|
||||
CellParameterisation::ComputeMaterial(const G4int copyNo,
|
||||
G4VPhysicalVolume* physVol,
|
||||
const G4VTouchable*)
|
||||
G4VPhysicalVolume* physVol,
|
||||
const G4VTouchable*)
|
||||
{
|
||||
if( fMaterial[copyNo] == 2 ) // fMaterial 2 is nucleus
|
||||
{
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4ThreadLocal EMField* DetectorConstruction::fField = 0;
|
||||
G4ThreadLocal EMField* DetectorConstruction::fField = nullptr;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
@@ -652,11 +652,6 @@ G4VPhysicalVolume* DetectorConstruction::ConstructLine()
|
||||
fLogicBoite->SetUserLimits(new G4UserLimits(10*mm));
|
||||
*/
|
||||
|
||||
// relaxed
|
||||
fLogicWorld->SetUserLimits(new G4UserLimits(1*mm));
|
||||
fLogicVol->SetUserLimits(new G4UserLimits(1*mm));
|
||||
fLogicBoite->SetUserLimits(new G4UserLimits(1*mm));
|
||||
|
||||
/*
|
||||
logicPhantom->SetUserLimits (new G4UserLimits(0.5*micrometer));
|
||||
logic1Gap->SetUserLimits (new G4UserLimits(5*micrometer));
|
||||
@@ -674,6 +669,11 @@ G4VPhysicalVolume* DetectorConstruction::ConstructLine()
|
||||
logicVerre2->SetUserLimits (new G4UserLimits(10*micrometer));
|
||||
*/
|
||||
|
||||
// Relaxed
|
||||
fLogicWorld->SetUserLimits(new G4UserLimits(10*mm));
|
||||
fLogicVol->SetUserLimits(new G4UserLimits(10*mm));
|
||||
fLogicBoite->SetUserLimits(new G4UserLimits(1*mm));
|
||||
|
||||
// VISUALISATION ATTRIBUTES (for phantom, see in Parameterisation class)
|
||||
|
||||
G4VisAttributes* simpleWorldVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,1.0)); //White
|
||||
@@ -736,13 +736,16 @@ void DetectorConstruction::ConstructSDandField()
|
||||
{
|
||||
if(!fField) fField = new EMField();
|
||||
|
||||
fEquation = new G4EqMagElectricField(fField);
|
||||
fStepper = new G4ClassicalRK4 (fEquation,8);
|
||||
fFieldMgr = G4TransportationManager::GetTransportationManager()->GetFieldManager();
|
||||
// relaxed
|
||||
// fIntgrDriver = new G4MagInt_Driver(0.000001*mm,fStepper,fStepper->GetNumberOfVariables() );
|
||||
fIntgrDriver = new G4MagInt_Driver(1*mm,fStepper,fStepper->GetNumberOfVariables() );
|
||||
fChordFinder = new G4ChordFinder(fIntgrDriver);
|
||||
G4EqMagElectricField* fEquation = new G4EqMagElectricField(fField);
|
||||
G4MagIntegratorStepper* fStepper = new G4ClassicalRK4 (fEquation,8);
|
||||
G4FieldManager* fFieldMgr =
|
||||
G4TransportationManager::GetTransportationManager()->GetFieldManager();
|
||||
|
||||
// Relaxed
|
||||
G4MagInt_Driver* fIntgrDriver =
|
||||
new G4MagInt_Driver(1*mm,fStepper,fStepper->GetNumberOfVariables() );
|
||||
|
||||
G4ChordFinder* fChordFinder = new G4ChordFinder(fIntgrDriver);
|
||||
fFieldMgr->SetChordFinder(fChordFinder);
|
||||
fFieldMgr->SetDetectorField(fField);
|
||||
|
||||
|
||||
@@ -31,14 +31,21 @@
|
||||
//
|
||||
// If you use this example, please cite the following publication:
|
||||
// Rad. Prot. Dos. 133 (2009) 2-11
|
||||
//
|
||||
// Based on purging magnet advanced example.
|
||||
//
|
||||
|
||||
#include "EMField.hh"
|
||||
#include "G4Exp.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
|
||||
EMField::EMField()
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void EMField::GetFieldValue(const double point[4], double *Bfield ) const
|
||||
{
|
||||
@@ -122,8 +129,8 @@ if ( (z >= limitMinEntrance) && (z < limitMaxEntrance) )
|
||||
// - HEART OF SWITCHING MAGNET
|
||||
|
||||
if (
|
||||
(z >= limitMaxEntrance)
|
||||
&& (( x*x + (z -(beamStart+zS))*(z -(beamStart+zS)) < limitMinExit*limitMinExit))
|
||||
(z >= limitMaxEntrance)
|
||||
&& (( x*x + (z -(beamStart+zS))*(z -(beamStart+zS)) < limitMinExit*limitMinExit))
|
||||
)
|
||||
{
|
||||
Bx=0;
|
||||
@@ -134,11 +141,11 @@ if ( (z >= limitMinEntrance) && (z < limitMaxEntrance) )
|
||||
// - EXIT OF SWITCHING MAGNET
|
||||
|
||||
if (
|
||||
(z >= limitMaxEntrance)
|
||||
&& (( x*x + (z -(beamStart+zS))*(z -(beamStart+zS))) >= limitMinExit*limitMinExit)
|
||||
&& (( x*x + (z -(beamStart+zS))*(z -(beamStart+zS))) < limitMaxExit*limitMaxExit)
|
||||
(z >= limitMaxEntrance)
|
||||
&& (( x*x + (z -(beamStart+zS))*(z -(beamStart+zS))) >= limitMinExit*limitMinExit)
|
||||
&& (( x*x + (z -(beamStart+zS))*(z -(beamStart+zS))) < limitMaxExit*limitMaxExit)
|
||||
|
||||
)
|
||||
)
|
||||
{
|
||||
|
||||
xcenter = 0;
|
||||
@@ -307,7 +314,7 @@ if (z>=-1400*mm && z <-200*mm)
|
||||
}
|
||||
|
||||
|
||||
if ( z_local < -z2[i] )
|
||||
if ( z_local < -z2[i] )
|
||||
{
|
||||
G0=0;
|
||||
G1=0;
|
||||
@@ -334,37 +341,37 @@ if (z>=-1400*mm && z <-200*mm)
|
||||
if ( ((z_local>=-z2[i]) & (z_local<-z1[i])) || ((z_local>z1[i]) & (z_local<=z2[i])) )
|
||||
{
|
||||
|
||||
vars = ( z_local - z1[i]) / a0[i] ;
|
||||
if (z_local<-z1[i]) vars = ( - z_local - z1[i]) / a0[i] ;
|
||||
vars = ( z_local - z1[i]) / a0[i] ;
|
||||
if (z_local<-z1[i]) vars = ( - z_local - z1[i]) / a0[i] ;
|
||||
|
||||
|
||||
P0 = c0[i]+c1[i]*vars+c2[i]*vars*vars;
|
||||
P0 = c0[i]+c1[i]*vars+c2[i]*vars*vars;
|
||||
|
||||
P1 = c1[i]/a0[i]+2*c2[i]*(z_local-z1[i])/a0[i]/a0[i];
|
||||
if (z_local<-z1[i]) P1 = -c1[i]/a0[i]+2*c2[i]*(z_local+z1[i])/a0[i]/a0[i];
|
||||
P1 = c1[i]/a0[i]+2*c2[i]*(z_local-z1[i])/a0[i]/a0[i];
|
||||
if (z_local<-z1[i]) P1 = -c1[i]/a0[i]+2*c2[i]*(z_local+z1[i])/a0[i]/a0[i];
|
||||
|
||||
P2 = 2*c2[i]/a0[i]/a0[i];
|
||||
P2 = 2*c2[i]/a0[i]/a0[i];
|
||||
|
||||
cte = 1 + G4Exp(c0[i]);
|
||||
cte = 1 + G4Exp(c0[i]);
|
||||
|
||||
K1 = -cte*P1*G4Exp(P0)/( (1+G4Exp(P0))*(1+G4Exp(P0)) );
|
||||
K1 = -cte*P1*G4Exp(P0)/( (1+G4Exp(P0))*(1+G4Exp(P0)) );
|
||||
|
||||
K2 = -cte*G4Exp(P0)*(
|
||||
P2/( (1+G4Exp(P0))*(1+G4Exp(P0)) )
|
||||
+2*P1*K1/(1+G4Exp(P0))/cte
|
||||
+P1*P1/(1+G4Exp(P0))/(1+G4Exp(P0))
|
||||
);
|
||||
|
||||
K3 = -cte*G4Exp(P0)*(
|
||||
(3*P2*P1+P1*P1*P1)/(1+G4Exp(P0))/(1+G4Exp(P0))
|
||||
+4*K1*(P1*P1+P2)/(1+G4Exp(P0))/cte
|
||||
+2*P1*(K1*K1/cte/cte+K2/(1+G4Exp(P0))/cte)
|
||||
K2 = -cte*G4Exp(P0)*(
|
||||
P2/( (1+G4Exp(P0))*(1+G4Exp(P0)) )
|
||||
+2*P1*K1/(1+G4Exp(P0))/cte
|
||||
+P1*P1/(1+G4Exp(P0))/(1+G4Exp(P0))
|
||||
);
|
||||
|
||||
K3 = -cte*G4Exp(P0)*(
|
||||
(3*P2*P1+P1*P1*P1)/(1+G4Exp(P0))/(1+G4Exp(P0))
|
||||
+4*K1*(P1*P1+P2)/(1+G4Exp(P0))/cte
|
||||
+2*P1*(K1*K1/cte/cte+K2/(1+G4Exp(P0))/cte)
|
||||
);
|
||||
|
||||
G0 = gradient[i]*cte/(1+G4Exp(P0));
|
||||
G1 = gradient[i]*K1;
|
||||
G2 = gradient[i]*K2;
|
||||
G3 = gradient[i]*K3;
|
||||
G0 = gradient[i]*cte/(1+G4Exp(P0));
|
||||
G1 = gradient[i]*K1;
|
||||
G2 = gradient[i]*K2;
|
||||
G3 = gradient[i]*K3;
|
||||
|
||||
}
|
||||
|
||||
@@ -468,11 +475,11 @@ if (z>=-1400*mm && z <-200*mm)
|
||||
|
||||
if
|
||||
(
|
||||
x <= slope1 * z + cte1
|
||||
&& x >= slope3 * z + cte3
|
||||
&& x <= slope4 * z + cte4
|
||||
&& x >= slope2 * z + cte2
|
||||
&& std::abs(y)<=electricPlateWidth1/2
|
||||
x <= slope1 * z + cte1
|
||||
&& x >= slope3 * z + cte3
|
||||
&& x <= slope4 * z + cte4
|
||||
&& x >= slope2 * z + cte2
|
||||
&& std::abs(y)<=electricPlateWidth1/2
|
||||
)
|
||||
|
||||
{
|
||||
@@ -510,11 +517,11 @@ if (z>=-1400*mm && z <-200*mm)
|
||||
|
||||
if
|
||||
(
|
||||
x <= slope1 * z + cte1
|
||||
&& x >= slope3 * z + cte3
|
||||
&& x <= slope4 * z + cte4
|
||||
&& x >= slope2 * z + cte2
|
||||
&& std::abs(y)<=electricPlateSpacing2/2
|
||||
x <= slope1 * z + cte1
|
||||
&& x >= slope3 * z + cte3
|
||||
&& x <= slope4 * z + cte4
|
||||
&& x >= slope2 * z + cte2
|
||||
&& std::abs(y)<=electricPlateSpacing2/2
|
||||
)
|
||||
|
||||
{
|
||||
|
||||
@@ -46,7 +46,6 @@
|
||||
#include "G4EmLivermorePhysics.hh"
|
||||
#include "G4EmPenelopePhysics.hh"
|
||||
#include "G4DecayPhysics.hh"
|
||||
#include "G4LossTableManager.hh"
|
||||
|
||||
#include "G4ProcessManager.hh"
|
||||
|
||||
@@ -58,12 +57,6 @@
|
||||
|
||||
PhysicsList::PhysicsList() : G4VModularPhysicsList()
|
||||
{
|
||||
G4LossTableManager::Instance();
|
||||
defaultCutValue = 0.01*micrometer;
|
||||
fCutForGamma = defaultCutValue;
|
||||
fCutForElectron = defaultCutValue;
|
||||
fCutForPositron = defaultCutValue;
|
||||
|
||||
fMessenger = new PhysicsListMessenger(this);
|
||||
|
||||
SetVerboseLevel(1);
|
||||
@@ -166,7 +159,6 @@ void PhysicsList::AddPhysicsList(const G4String& name)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void PhysicsList::AddStepMax()
|
||||
@@ -191,45 +183,3 @@ void PhysicsList::AddStepMax()
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void PhysicsList::SetCuts()
|
||||
{
|
||||
|
||||
if (verboseLevel >0){
|
||||
G4cout << "PhysicsList::SetCuts:";
|
||||
G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl;
|
||||
}
|
||||
|
||||
SetCutValue(fCutForGamma, "gamma");
|
||||
SetCutValue(fCutForElectron, "e-");
|
||||
SetCutValue(fCutForPositron, "e+");
|
||||
|
||||
if (verboseLevel>0) DumpCutValuesTable();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void PhysicsList::SetCutForGamma(G4double cut)
|
||||
{
|
||||
fCutForGamma = cut;
|
||||
SetParticleCuts(fCutForGamma, G4Gamma::Gamma());
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void PhysicsList::SetCutForElectron(G4double cut)
|
||||
{
|
||||
fCutForElectron = cut;
|
||||
SetParticleCuts(fCutForElectron, G4Electron::Electron());
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void PhysicsList::SetCutForPositron(G4double cut)
|
||||
{
|
||||
fCutForPositron = cut;
|
||||
SetParticleCuts(fCutForPositron, G4Positron::Positron());
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
|
||||
@@ -46,34 +46,6 @@ PhysicsListMessenger::PhysicsListMessenger(PhysicsList* 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);
|
||||
@@ -84,10 +56,6 @@ PhysicsListMessenger::PhysicsListMessenger(PhysicsList* pPhys)
|
||||
|
||||
PhysicsListMessenger::~PhysicsListMessenger()
|
||||
{
|
||||
delete fGammaCutCmd;
|
||||
delete fElectCutCmd;
|
||||
delete fProtoCutCmd;
|
||||
delete fAllCutCmd;
|
||||
delete fListCmd;
|
||||
delete fPhysDir;
|
||||
}
|
||||
@@ -97,23 +65,6 @@ PhysicsListMessenger::~PhysicsListMessenger()
|
||||
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);}
|
||||
}
|
||||
|
||||
@@ -124,7 +124,3 @@ void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
fParticleGun->GeneratePrimaryVertex(anEvent);
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
RunAction::RunAction(DetectorConstruction* det)
|
||||
RunAction::RunAction(const DetectorConstruction* det)
|
||||
:fDetector(det)
|
||||
{
|
||||
fSaveRndm = 0;
|
||||
@@ -59,7 +59,7 @@ RunAction::~RunAction()
|
||||
void RunAction::BeginOfRunAction(const G4Run*)
|
||||
{
|
||||
// Read phantom - Singleton
|
||||
fMyCellParameterisation = CellParameterisation::Instance();
|
||||
CellParameterisation* fMyCellParameterisation = CellParameterisation::Instance();
|
||||
|
||||
// Histograms
|
||||
// Get/create analysis manager
|
||||
@@ -126,10 +126,10 @@ void RunAction::BeginOfRunAction(const G4Run*)
|
||||
|
||||
// save Rndm status
|
||||
if (fSaveRndm > 0)
|
||||
{
|
||||
CLHEP::HepRandom::showEngineStatus();
|
||||
CLHEP::HepRandom::saveEngineStatus("beginOfRun.rndm");
|
||||
}
|
||||
{
|
||||
CLHEP::HepRandom::showEngineStatus();
|
||||
CLHEP::HepRandom::saveEngineStatus("beginOfRun.rndm");
|
||||
}
|
||||
|
||||
fNumEvent = 0;
|
||||
fNbOfHitsGas = 0;
|
||||
@@ -147,8 +147,8 @@ void RunAction::BeginOfRunAction(const G4Run*)
|
||||
|
||||
for (G4int i=0; i<fNbOfPixels; i++)
|
||||
{
|
||||
fMapVoxels [i]=fMyCellParameterisation->GetVoxelThreeVector(i);
|
||||
fDose3DDose[i]=0;
|
||||
fMapVoxels [i]=fMyCellParameterisation->GetVoxelThreeVector(i);
|
||||
fDose3DDose[i]=0;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -172,12 +172,12 @@ void RunAction::EndOfRunAction(const G4Run* /*aRun*/)
|
||||
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);
|
||||
//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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -45,14 +45,14 @@
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
SteppingAction::SteppingAction(RunAction* run,DetectorConstruction* det)
|
||||
SteppingAction::SteppingAction(RunAction* run,const DetectorConstruction* det)
|
||||
:fRun(run),fDetector(det)
|
||||
{ }
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
SteppingAction::~SteppingAction()
|
||||
{ }
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
@@ -67,163 +67,132 @@ void SteppingAction::UserSteppingAction(const G4Step* aStep)
|
||||
|
||||
fMyCellParameterisation = CellParameterisation::Instance();
|
||||
|
||||
//
|
||||
|
||||
// Material : 1 is cytoplasm, 2 is nucleus
|
||||
|
||||
G4int matVoxelPRE = -1;
|
||||
G4int matVoxelPOST = -1;
|
||||
G4int tmp=-1;
|
||||
|
||||
tmp = aStep->GetPreStepPoint()->GetTouchableHandle()->GetReplicaNumber();
|
||||
|
||||
const G4StepPoint* preStep = aStep->GetPreStepPoint();
|
||||
const G4StepPoint* postStep = aStep->GetPostStepPoint();
|
||||
const G4Track* track = aStep->GetTrack();
|
||||
|
||||
const G4LogicalVolume* preVolume =
|
||||
preStep->GetPhysicalVolume()->GetLogicalVolume();
|
||||
|
||||
const G4LogicalVolume* postVolume = nullptr;
|
||||
if(postStep->GetPhysicalVolume())
|
||||
{
|
||||
postVolume = postStep->GetPhysicalVolume()->GetLogicalVolume();
|
||||
}
|
||||
const G4ParticleDefinition* particle =
|
||||
track->GetDynamicParticle()->GetDefinition();
|
||||
|
||||
G4int preReplicaNumber = preStep->GetTouchableHandle()->GetReplicaNumber();
|
||||
G4double edep = aStep->GetTotalEnergyDeposit();
|
||||
|
||||
if (tmp>0)
|
||||
if (preReplicaNumber>0)
|
||||
{
|
||||
matVoxelPRE = fMyCellParameterisation->GetTissueType(tmp);
|
||||
matVoxelPRE = fMyCellParameterisation->GetTissueType(preReplicaNumber);
|
||||
}
|
||||
|
||||
if(postVolume)
|
||||
{
|
||||
G4int postReplicaNumber = postStep->GetTouchableHandle()->GetReplicaNumber();
|
||||
if (postReplicaNumber>0)
|
||||
{
|
||||
matVoxelPOST = fMyCellParameterisation->GetTissueType(postReplicaNumber);
|
||||
}
|
||||
}
|
||||
|
||||
tmp = aStep->GetPostStepPoint()->GetTouchableHandle()->GetReplicaNumber();
|
||||
|
||||
if (tmp>0)
|
||||
{
|
||||
matVoxelPOST = fMyCellParameterisation->GetTissueType(tmp);
|
||||
}
|
||||
|
||||
// COUNT GAS DETECTOR HITS
|
||||
|
||||
if ( ((aStep->GetPreStepPoint()->GetTouchableHandle()->GetVolume()->GetLogicalVolume() == fDetector->GetLogicalCollDetYoke())
|
||||
&& (aStep->GetPostStepPoint()->GetTouchableHandle()->GetVolume()->GetLogicalVolume() == fDetector->GetLogicalIsobutane())
|
||||
&& (aStep->GetTrack()->GetDynamicParticle()->GetDefinition() == G4Alpha::AlphaDefinition() ))
|
||||
|
||||
||
|
||||
((aStep->GetPreStepPoint()->GetTouchableHandle()->GetVolume()->GetLogicalVolume() == fDetector->GetLogicalCollDetGap4())
|
||||
&& (aStep->GetPostStepPoint()->GetTouchableHandle()->GetVolume()->GetLogicalVolume() == fDetector->GetLogicalIsobutane())
|
||||
&& (aStep->GetTrack()->GetDynamicParticle()->GetDefinition() == G4Alpha::AlphaDefinition() ))
|
||||
// COUNT GAS DETECTOR HITS
|
||||
|
||||
if (particle == G4Alpha::AlphaDefinition())
|
||||
{
|
||||
if(postVolume == fDetector->GetLogicalIsobutane() &&
|
||||
((preVolume == fDetector->GetLogicalCollDetYoke())
|
||||
||
|
||||
(preVolume == fDetector->GetLogicalCollDetGap4())
|
||||
||
|
||||
(preVolume == fDetector->GetLogicalCollDetGap4())))
|
||||
{
|
||||
fRun->AddNbOfHitsGas();
|
||||
}
|
||||
|
||||
// STOPPING POWER AND BEAM SPOT SIZE AT CELL ENTRANCE
|
||||
if(preVolume == fDetector->GetLogicalPolyprop() &&
|
||||
( (postVolume == fDetector->GetLogicalKgm()) ||
|
||||
(matVoxelPOST == 1)) )
|
||||
{
|
||||
G4double deltaE = preStep->GetKineticEnergy()
|
||||
- postStep->GetKineticEnergy();
|
||||
if(deltaE > 0.0)
|
||||
{
|
||||
//Fill ntupleid=1
|
||||
man->FillNtupleDColumn(1,0,preStep->GetKineticEnergy()/keV);
|
||||
man->FillNtupleDColumn(1,1,deltaE*micrometer/(keV*aStep->GetStepLength()));
|
||||
man->AddNtupleRow(1);
|
||||
}
|
||||
|
||||
((aStep->GetPreStepPoint()->GetTouchableHandle()->GetVolume()->GetLogicalVolume() == fDetector->GetLogicalCollDetGap4())
|
||||
&& (aStep->GetPostStepPoint()->GetTouchableHandle()->GetVolume()->GetLogicalVolume() == fDetector->GetLogicalIsobutane())
|
||||
&& (aStep->GetTrack()->GetDynamicParticle()->GetDefinition() == G4Alpha::AlphaDefinition() ))
|
||||
// Average dE over step suggested by Michel Maire
|
||||
G4ThreeVector coord1 = preStep->GetPosition();
|
||||
const G4AffineTransform transformation1 =
|
||||
preStep->GetTouchable()->GetHistory()->GetTopTransform();
|
||||
G4ThreeVector localPosition1 = transformation1.TransformPoint(coord1);
|
||||
|
||||
)
|
||||
{
|
||||
fRun->AddNbOfHitsGas();
|
||||
}
|
||||
|
||||
// STOPPING POWER AND BEAM SPOT SIZE AT CELL ENTRANCE
|
||||
G4ThreeVector coord2 = postStep->GetPosition();
|
||||
const G4AffineTransform transformation2 =
|
||||
postStep->GetTouchable()->GetHistory()->GetTopTransform();
|
||||
G4ThreeVector localPosition2 = transformation2.TransformPoint(coord2);
|
||||
|
||||
if ( ((aStep->GetPreStepPoint()->GetTouchableHandle()->GetVolume()->GetLogicalVolume() == fDetector->GetLogicalPolyprop())
|
||||
&& (aStep->GetPostStepPoint()->GetTouchableHandle()->GetVolume()->GetLogicalVolume() == fDetector->GetLogicalKgm())
|
||||
&& (aStep->GetTrack()->GetDynamicParticle()->GetDefinition() == G4Alpha::AlphaDefinition() ))
|
||||
|
||||
||
|
||||
((aStep->GetPreStepPoint()->GetTouchableHandle()->GetVolume()->GetLogicalVolume() == fDetector->GetLogicalPolyprop())
|
||||
&& (matVoxelPOST == 1)
|
||||
&& (aStep->GetTrack()->GetDynamicParticle()->GetDefinition() == G4Alpha::AlphaDefinition() ))
|
||||
)
|
||||
{
|
||||
|
||||
if( (aStep->GetPreStepPoint()->GetKineticEnergy() - aStep->GetPostStepPoint()->GetKineticEnergy() ) >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
|
||||
|
||||
G4StepPoint* p1 = aStep->GetPreStepPoint();
|
||||
G4ThreeVector coord1 = p1->GetPosition();
|
||||
const G4AffineTransform transformation1 = p1->GetTouchable()->GetHistory()->GetTopTransform();
|
||||
G4ThreeVector localPosition1 = transformation1.TransformPoint(coord1);
|
||||
|
||||
G4StepPoint* p2 = aStep->GetPostStepPoint();
|
||||
G4ThreeVector coord2 = p2->GetPosition();
|
||||
const G4AffineTransform transformation2 = p2->GetTouchable()->GetHistory()->GetTopTransform();
|
||||
G4ThreeVector localPosition2 = transformation2.TransformPoint(coord2);
|
||||
|
||||
G4ThreeVector localPosition = localPosition1 + G4UniformRand()*(localPosition2-localPosition1);
|
||||
G4ThreeVector localPosition =
|
||||
localPosition1 + G4UniformRand()*(localPosition2-localPosition1);
|
||||
|
||||
// end
|
||||
|
||||
//Fill ntupleid=2
|
||||
man->FillNtupleDColumn(2,0,localPosition.x()/micrometer);
|
||||
man->FillNtupleDColumn(2,1,localPosition.y()/micrometer);
|
||||
man->AddNtupleRow(2);
|
||||
}
|
||||
//Fill ntupleid=2
|
||||
man->FillNtupleDColumn(2,0,localPosition.x()/micrometer);
|
||||
man->FillNtupleDColumn(2,1,localPosition.y()/micrometer);
|
||||
man->AddNtupleRow(2);
|
||||
}
|
||||
|
||||
// ALPHA RANGE
|
||||
// ALPHA RANGE
|
||||
if (postStep->GetKineticEnergy() < eV &&
|
||||
( (matVoxelPOST==1) ||
|
||||
(postVolume == fDetector->GetLogicalKgm()) ||
|
||||
(matVoxelPOST==2) ) )
|
||||
{
|
||||
//Fill ntupleid=3
|
||||
man->FillNtupleDColumn(3,0,postStep->GetPosition().x()/micrometer);
|
||||
man->FillNtupleDColumn(3,1,postStep->GetPosition().y()/micrometer);
|
||||
man->FillNtupleDColumn(3,2,postStep->GetPosition().z()/micrometer);
|
||||
man->AddNtupleRow(3);
|
||||
}
|
||||
|
||||
// TOTAL DOSE DEPOSIT AND DOSE DEPOSIT WITHIN A PHANTOM VOXEL
|
||||
// FOR ALL PARTICLES
|
||||
}
|
||||
|
||||
if (
|
||||
if (matVoxelPRE == 2)
|
||||
{
|
||||
G4double dose = (edep/joule)/(fRun->GetMassNucleus()/kg);
|
||||
fRun->AddDoseN(dose);
|
||||
fRun->AddDoseBox(preReplicaNumber, edep/eV);
|
||||
}
|
||||
else if (matVoxelPRE == 1)
|
||||
{
|
||||
G4double dose = (edep/joule)/(fRun->GetMassCytoplasm()/kg);
|
||||
fRun->AddDoseC(dose);
|
||||
fRun->AddDoseBox(preReplicaNumber, edep/eV);
|
||||
}
|
||||
|
||||
(aStep->GetTrack()->GetDynamicParticle()->GetDefinition() == G4Alpha::AlphaDefinition())
|
||||
|
||||
&&
|
||||
|
||||
(aStep->GetTrack()->GetKineticEnergy()<1e-6)
|
||||
|
||||
&&
|
||||
|
||||
( (matVoxelPOST==1)
|
||||
|| (aStep->GetPostStepPoint()->GetTouchableHandle()->GetVolume()->GetLogicalVolume() == fDetector->GetLogicalKgm())
|
||||
|| (matVoxelPOST==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
|
||||
// FOR ALL PARTICLES
|
||||
|
||||
if (matVoxelPRE == 2)
|
||||
|
||||
{
|
||||
G4double dose = (aStep->GetTotalEnergyDeposit()/joule)/(fRun->GetMassNucleus()/kg);
|
||||
fRun->AddDoseN(dose);
|
||||
|
||||
G4ThreeVector v;
|
||||
fRun->AddDoseBox(aStep->GetPreStepPoint()->GetTouchableHandle()->GetReplicaNumber(),
|
||||
aStep->GetTotalEnergyDeposit()/eV);
|
||||
}
|
||||
|
||||
|
||||
if (matVoxelPRE == 1)
|
||||
|
||||
{
|
||||
G4double dose = (aStep->GetTotalEnergyDeposit()/joule)/(fRun->GetMassCytoplasm()/kg);
|
||||
fRun->AddDoseC(dose);
|
||||
|
||||
G4ThreeVector v;
|
||||
fRun->AddDoseBox(aStep->GetPreStepPoint()->GetTouchableHandle()->GetReplicaNumber(),
|
||||
aStep->GetTotalEnergyDeposit()/eV);
|
||||
}
|
||||
|
||||
// PROTECTION AGAINST MSC LOOPS FOR e-
|
||||
|
||||
if ( aStep->GetTotalEnergyDeposit()/MeV<1e-25
|
||||
&& aStep->GetTrack()->GetDefinition()==G4Electron::ElectronDefinition())
|
||||
{
|
||||
aStep->GetTrack()->SetTrackStatus(fStopAndKill);
|
||||
/*
|
||||
G4cout << "*** Warning *** : msc loop for "
|
||||
<< aStep->GetTrack()->GetDefinition()->GetParticleName()
|
||||
<< " in " <<
|
||||
aStep->GetPostStepPoint()->GetTouchableHandle()->GetVolume()->GetName() << G4endl;
|
||||
*/
|
||||
}
|
||||
// PROTECTION AGAINST POSSIBLE MSC LOOPS FOR e-
|
||||
|
||||
// if ( edep/MeV<1e-25 && particle == G4Electron::Electron())
|
||||
// {
|
||||
//aStep->GetTrack()->SetTrackStatus(fStopAndKill);
|
||||
/*
|
||||
G4cout << "*** Warning *** : msc loop for "
|
||||
<< track->GetDefinition()->GetParticleName()
|
||||
<< " in " <<
|
||||
postPoint->GetTouchableHandle()->GetVolume()->GetName() << G4endl;
|
||||
*/
|
||||
// }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user