Import Geant4 9.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 15:37:50 +02:00
parent a8e9364cea
commit 96c8bcd0af
6923 changed files with 198390 additions and 41849 deletions
@@ -0,0 +1,241 @@
//
// ********************************************************************
// * 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: DetectorConstruction.cc,v 1.1 2007/08/16 10:32:04 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "DetectorConstruction.hh"
#include "DetectorMessenger.hh"
#include "G4Material.hh"
#include "G4Box.hh"
#include "G4LogicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4UniformMagField.hh"
#include "G4GeometryManager.hh"
#include "G4UserLimits.hh"
#include "G4PhysicalVolumeStore.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4SolidStore.hh"
#include "G4UnitsTable.hh"
#include "G4NistManager.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
DetectorConstruction::DetectorConstruction()
{
// default parameter values
absorSizeX = absorSizeYZ = 10 * cm;
worldSizeX = worldSizeYZ = 1.2 * absorSizeX;
maxStepSize = 5 * mm;
worldMaterial = absorMaterial = 0;
magField = 0;
lAbsor = 0;
DefineMaterials();
SetMaterial("G4_Al");
// create commands for interactive definition of the detector
detectorMessenger = new DetectorMessenger(this);
}
DetectorConstruction::~DetectorConstruction()
{delete detectorMessenger;}
G4VPhysicalVolume* DetectorConstruction::Construct()
{ return ConstructVolumes();}
void DetectorConstruction::DefineMaterials()
{
/*********************** define Elements *********************/
G4double z, a;
G4Element* N = new G4Element("Nitrogen", "N", z= 7, a= 14.01*g/mole);
G4Element* O = new G4Element("Oxygen" , "O", z= 8, a= 16.00*g/mole);
/*********************** define Materials **********************/
G4double density, temperature, pressure;
G4int ncomponents;
G4double fractionmass;
G4Material* Air = new G4Material("Air" , density = 1.290 * mg/cm3, ncomponents=2);
Air->AddElement(N, fractionmass = 0.7);
Air->AddElement(O, fractionmass = 0.3);
density = universe_mean_density; //from PhysicalConstants.h
pressure = 3.e-18 * pascal;
temperature = 2.73 * kelvin;
G4Material* vacuum = new G4Material("Galactic", z = 1, a = 1.008 * g/mole, density,
kStateGas, temperature, pressure);
G4cout << *(G4Material::GetMaterialTable()) << G4endl;
//default materials
worldMaterial = vacuum;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume* DetectorConstruction::ConstructVolumes()
{
G4GeometryManager::GetInstance()->OpenGeometry();
G4PhysicalVolumeStore::GetInstance()->Clean();
G4LogicalVolumeStore::GetInstance()->Clean();
G4SolidStore::GetInstance()->Clean();
/**************************** World *****************************/
G4Box * sWorld = new G4Box("world", //name
worldSizeX / 2, worldSizeYZ / 2, worldSizeYZ / 2); //dimensions
G4LogicalVolume * lWorld = new G4LogicalVolume(sWorld, //shape
worldMaterial, //material
"world"); //name
G4VPhysicalVolume * pWorld = new G4PVPlacement(0, //no rotation
G4ThreeVector(), //at (0,0,0)
lWorld, //logical volume
"world", //name
0, //mother volume
false, //no boolean operation
0); //copy number
/************************** Absorber ***************************/
G4Box * sAbsor = new G4Box("Absorber", //name
absorSizeX / 2, absorSizeYZ / 2, absorSizeYZ / 2); //dimensions
lAbsor = new G4LogicalVolume(sAbsor, //shape
absorMaterial, //material
"Absorber"); //name
new G4PVPlacement(0, //no rotation
G4ThreeVector(), //at (0,0,0)
lAbsor, //logical volume
"Absorber", //name
lWorld, //mother volume
false, //no boolean operation
0); //copy number
lAbsor->SetUserLimits(new G4UserLimits(maxStepSize));
PrintParameters();
/************ always return the World volume *****************/
return pWorld;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::PrintParameters()
{
G4cout << "\n---------------------------------------------------------\n";
G4cout << "---> The Absorber is " << G4BestUnit(absorSizeX, "Length")
<< " of " << absorMaterial->GetName() << G4endl;
G4cout << "\n---------------------------------------------------------\n";
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::SetSizeX(G4double value)
{
absorSizeX = value; worldSizeX = 1.2 * absorSizeX;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::SetSizeYZ(G4double value)
{
absorSizeYZ = value;
worldSizeYZ = 1.2 * absorSizeYZ;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::SetMaterial(G4String materialChoice)
{
// search the material by its name
G4Material * pttoMaterial = G4NistManager::Instance()->FindOrBuildMaterial(materialChoice);
if (pttoMaterial) absorMaterial = pttoMaterial;
else G4cout << "Material does not exist in DB" << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4FieldManager.hh"
#include "G4TransportationManager.hh"
void DetectorConstruction::SetMagField(G4double fieldValue)
{
//apply a global uniform magnetic field along Z axis
G4FieldManager * fieldMgr = G4TransportationManager::GetTransportationManager()->GetFieldManager();
if (magField) delete magField; //delete the existing magn field
if (fieldValue != 0.) // create a new one if non nul
{
magField = new G4UniformMagField(G4ThreeVector(0., 0., fieldValue));
fieldMgr->SetDetectorField(magField);
fieldMgr->CreateChordFinder(magField);
}
else
{
magField = 0;
fieldMgr->SetDetectorField(magField);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::SetMaxStepSize(G4double step_)
{
maxStepSize = step_;
if(lAbsor) lAbsor->SetUserLimits(new G4UserLimits(maxStepSize));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4RunManager.hh"
void DetectorConstruction::UpdateGeometry()
{
G4RunManager::GetRunManager()->DefineWorldVolume(ConstructVolumes());
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,126 @@
//
// ********************************************************************
// * 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: DetectorMessenger.cc,v 1.1 2007/08/16 10:32:04 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "DetectorMessenger.hh"
#include "DetectorConstruction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWith3VectorAndUnit.hh"
#include "G4UIcmdWithoutParameter.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
DetectorMessenger::DetectorMessenger(DetectorConstruction * Det)
:Detector(Det)
{
detDir = new G4UIdirectory("/testex/det/");
detDir->SetGuidance("detector construction commands");
MaterCmd = new G4UIcmdWithAString("/testex/det/setMat",this);
MaterCmd->SetGuidance("Select material of the box.");
MaterCmd->SetParameterName("choice",false);
MaterCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
SizeXCmd = new G4UIcmdWithADoubleAndUnit("/testex/det/setSizeX",this);
SizeXCmd->SetGuidance("Set sizeX of the absorber");
SizeXCmd->SetParameterName("SizeX",false);
SizeXCmd->SetRange("SizeX>0.");
SizeXCmd->SetUnitCategory("Length");
SizeXCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
SizeYZCmd = new G4UIcmdWithADoubleAndUnit("/testex/det/setSizeYZ",this);
SizeYZCmd->SetGuidance("Set sizeYZ of the absorber");
SizeYZCmd->SetParameterName("SizeYZ",false);
SizeYZCmd->SetRange("SizeYZ>0.");
SizeYZCmd->SetUnitCategory("Length");
SizeYZCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
StepSizeCmd = new G4UIcmdWithADoubleAndUnit("/testex/det/setStepSize",this);
StepSizeCmd->SetGuidance("Set maxStepSize in the absorber");
StepSizeCmd->SetParameterName("StepSize",false);
StepSizeCmd->SetRange("StepSize>0.");
StepSizeCmd->SetUnitCategory("Length");
StepSizeCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
MagFieldCmd = new G4UIcmdWithADoubleAndUnit("/testex/det/setField",this);
MagFieldCmd->SetGuidance("Define magnetic field.");
MagFieldCmd->SetGuidance("Magnetic field will be in Z direction.");
MagFieldCmd->SetParameterName("Bz",false);
MagFieldCmd->SetUnitCategory("Magnetic flux density");
MagFieldCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
UpdateCmd = new G4UIcmdWithoutParameter("/testex/det/update",this);
UpdateCmd->SetGuidance("Update calorimeter geometry.");
UpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
UpdateCmd->SetGuidance("if you changed geometrical value(s).");
UpdateCmd->AvailableForStates(G4State_Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
DetectorMessenger::~DetectorMessenger()
{
delete MaterCmd;
delete SizeXCmd;
delete SizeYZCmd;
delete StepSizeCmd;
delete MagFieldCmd;
delete UpdateCmd;
delete detDir;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
{
if( command == MaterCmd )
{ Detector->SetMaterial(newValue);}
if( command == SizeXCmd )
{ Detector->SetSizeX(SizeXCmd->GetNewDoubleValue(newValue));}
if( command == SizeYZCmd )
{ Detector->SetSizeYZ(SizeYZCmd->GetNewDoubleValue(newValue));}
if( command == MagFieldCmd )
{ Detector->SetMagField(MagFieldCmd->GetNewDoubleValue(newValue));}
if( command == StepSizeCmd )
{ Detector->SetMaxStepSize(StepSizeCmd->GetNewDoubleValue(newValue));}
if( command == UpdateCmd )
{ Detector->UpdateGeometry();}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,89 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: EventAction.cc,v 1.1 2007/08/16 10:32:04 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "EventAction.hh"
#include "EventActionMessenger.hh"
#include "G4Event.hh"
#include "G4TrajectoryContainer.hh"
#include "G4Trajectory.hh"
#include "G4VVisManager.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
EventAction::EventAction(): drawFlag("none"), printModulo(10000), eventMessenger(0)
{
eventMessenger = new EventActionMessenger(this);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
EventAction::~EventAction()
{
delete eventMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void EventAction::BeginOfEventAction(const G4Event* evt)
{
G4int evtNb = evt->GetEventID();
//printing survey
if (evtNb % printModulo == 0)
G4cout << "\n---> Begin of Event: " << evtNb << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void EventAction::EndOfEventAction(const G4Event* evt)
{
if (G4VVisManager::GetConcreteInstance())
{
G4TrajectoryContainer* trajectoryContainer = evt->GetTrajectoryContainer();
G4int n_trajectories = 0;
if (trajectoryContainer) n_trajectories = trajectoryContainer->entries();
for(G4int i=0; i<n_trajectories; i++)
{
G4Trajectory* trj = (G4Trajectory*) ((*(evt->GetTrajectoryContainer()))[i]);
if (drawFlag == "all")
trj->DrawTrajectory(1000);
else
if ((drawFlag == "charged") && (trj->GetCharge() != 0.))
trj->DrawTrajectory(1000);
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,81 @@
//
// ********************************************************************
// * 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: EventActionMessenger.cc,v 1.1 2007/08/16 10:32:04 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "EventActionMessenger.hh"
#include "EventAction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithAnInteger.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
EventActionMessenger::EventActionMessenger(EventAction* EvAct):eventAction(EvAct)
{
eventDir = new G4UIdirectory("/testex/event/");
eventDir->SetGuidance("event control");
DrawCmd = new G4UIcmdWithAString("/testex/event/drawTracks",this);
DrawCmd->SetGuidance("Draw the tracks in the event");
DrawCmd->SetGuidance(" Choice : none,charged, all");
DrawCmd->SetParameterName("choice",true);
DrawCmd->SetDefaultValue("all");
DrawCmd->SetCandidates("none charged all");
DrawCmd->AvailableForStates(G4State_Idle);
PrintCmd = new G4UIcmdWithAnInteger("/testex/event/printModulo",this);
PrintCmd->SetGuidance("Print events modulo n");
PrintCmd->SetParameterName("EventNb",false);
PrintCmd->SetRange("EventNb>0");
PrintCmd->AvailableForStates(G4State_Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
EventActionMessenger::~EventActionMessenger()
{
delete DrawCmd;
delete PrintCmd;
delete eventDir;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void EventActionMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
{
if(command == DrawCmd)
{eventAction->SetDrawFlag(newValue);}
if(command == PrintCmd)
{eventAction->SetPrintModulo(PrintCmd->GetNewIntValue(newValue));}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,112 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//---------------------------------------------------------------------------
//
// ClassName: G4Monopole
//
// Description:
//
// Authors: 21.03.05 V.Ivanchenko
//
// Modified:
//
//----------------------------------------------------------------------------
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "G4Monopole.hh"
#include "G4ParticleTable.hh"
// ######################################################################
// ### Monopole ###
// ######################################################################
G4Monopole* G4Monopole::theMonopole = 0;
G4double G4Monopole::magCharge = 0.0;
G4Monopole::G4Monopole(
const G4String& aName, G4double mass,
G4double width, G4double charge,
G4int iSpin, G4int iParity,
G4int iConjugation, G4int iIsospin,
G4int iIsospin3, G4int gParity,
const G4String& pType, G4int lepton,
G4int baryon, G4int encoding,
G4bool stable, G4double lifetime,
G4DecayTable *decaytable)
: G4ParticleDefinition( aName, mass, width, charge, iSpin, iParity,
iConjugation, iIsospin, iIsospin3, gParity, pType,
lepton, baryon, encoding, stable, lifetime, decaytable )
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4Monopole::~G4Monopole()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//
// Arguments for constructor are as follows
// name mass width charge
// 2*spin parity C-conjugation
// 2*Isospin 2*Isospin3 G-parity
// type lepton number baryon number PDG encoding
// stable lifetime decay table
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4Monopole* G4Monopole::MonopoleDefinition(G4double mass, G4int mCharge, G4int eCharge)
{
if(!theMonopole) {
magCharge = eplus * G4double(mCharge) / fine_structure_const * 0.5;
theMonopole = new G4Monopole(
"monopole", mass, 0.0*MeV, eplus*G4double(eCharge),
0, 0, 0,
0, 0, 0,
"boson", 0, 0, 0,
true, -1.0, 0);
G4cout << "Monopole is created: m(GeV)= " << theMonopole->GetPDGMass()/GeV
<< " Qel= " << theMonopole->GetPDGCharge()/eplus
<< " Qmag= " << magCharge/eplus
<< G4endl;
}
return theMonopole;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4Monopole* G4Monopole::Monopole()
{
if(!theMonopole) theMonopole = MonopoleDefinition();
return theMonopole;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,91 @@
//
// ********************************************************************
// * 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: G4MonopolePhysics.cc,v 1.1 2007/08/16 10:32:04 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
//---------------------------------------------------------------------------
//
// ClassName: G4MonopolePhysics
//
// Author: V.Ivanchenko 13.03.2005
//
// Modified:
//
//----------------------------------------------------------------------------
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4Monopole.hh"
#include "G4MonopolePhysics.hh"
#include "G4ParticleDefinition.hh"
#include "G4ProcessManager.hh"
#include "G4StepLimiter.hh"
#include "G4Transportation.hh"
#include "G4MultipleScattering.hh"
#include "G4mplIonisation.hh"
#include "G4hhIonisation.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4MonopolePhysics::G4MonopolePhysics(const G4String& name): G4VPhysicsConstructor(name)
{}
G4MonopolePhysics::~G4MonopolePhysics()
{}
void G4MonopolePhysics::ConstructParticle()
{
G4Monopole::MonopoleDefinition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4MonopolePhysics::ConstructProcess()
{
// Add standard EM Processes for gamma
G4cout << "G4MonopolePhysics::ConstructProcess" << G4endl;
G4Monopole* mpl = G4Monopole::MonopoleDefinition();
G4ProcessManager* pmanager = new G4ProcessManager(mpl);
mpl->SetProcessManager(pmanager);
pmanager->AddProcess( new G4Transportation(), -1, 0, 0);
pmanager->AddProcess( new G4mplIonisation(mpl->MagneticCharge()), -1, 1, 1);
pmanager->AddProcess( new G4StepLimiter(), -1, -1, 3);
if(mpl->GetPDGCharge() != 0.0) {
pmanager->AddProcess(new G4hhIonisation(), -1, 2, 2);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,93 @@
//
// ********************************************************************
// * 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: PrimaryGeneratorAction.cc,v 1.1 2007/08/16 10:32:04 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "PrimaryGeneratorAction.hh"
#include "DetectorConstruction.hh"
#include "PrimaryGeneratorMessenger.hh"
#include "G4Event.hh"
#include "G4ParticleGun.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "Randomize.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PrimaryGeneratorAction::PrimaryGeneratorAction(DetectorConstruction* det)
:detector(det)
{
particleGun = new G4ParticleGun(1);
G4ParticleDefinition* particle = G4ParticleTable::GetParticleTable()->FindParticle("monopole");
particleGun->SetParticleDefinition(particle);
particleGun->SetParticleEnergy(100 * GeV);
particleGun->SetParticleMomentumDirection(G4ThreeVector(1., 0., 0.));
rndmBeam = 0.;
EbeamCumul = 0.;
//create a messenger for this class
gunMessenger = new PrimaryGeneratorMessenger(this);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PrimaryGeneratorAction::~PrimaryGeneratorAction()
{
delete particleGun;
delete gunMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
//this function is called at the begining of event
G4double x0 = -0.5*(detector->GetWorldSizeX());
G4double y0 = 0.*cm, z0 = 0.*cm;
//randomize the beam, if requested.
if (rndmBeam > 0.)
{
if (rndmBeam > detector->GetAbsorSizeYZ())
rndmBeam = detector->GetAbsorSizeYZ();
G4double rbeam = 0.5*rndmBeam;
y0 = (2*G4UniformRand()-1.)*rbeam;
z0 = (2*G4UniformRand()-1.)*rbeam;
}
particleGun->SetParticlePosition(G4ThreeVector(x0,y0,z0));
particleGun->GeneratePrimaryVertex(anEvent);
EbeamCumul += particleGun->GetParticleEnergy();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,74 @@
//
// ********************************************************************
// * 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: PrimaryGeneratorMessenger.cc,v 1.1 2007/08/16 10:32:04 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "PrimaryGeneratorMessenger.hh"
#include "PrimaryGeneratorAction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PrimaryGeneratorMessenger::PrimaryGeneratorMessenger(PrimaryGeneratorAction* Gun):Action(Gun)
{
testexDir = new G4UIdirectory("/testex/");
testexDir->SetGuidance(" detector control.");
gunDir = new G4UIdirectory("/testex/gun/");
gunDir->SetGuidance("gun control");
RndmCmd = new G4UIcmdWithADoubleAndUnit("/testex/gun/rndm", this);
RndmCmd->SetGuidance("random lateral extension on the beam");
RndmCmd->SetParameterName("rBeam", false);
RndmCmd->SetRange("rBeam>=0.");
RndmCmd->SetUnitCategory("Length");
RndmCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PrimaryGeneratorMessenger::~PrimaryGeneratorMessenger()
{
delete RndmCmd;
delete gunDir;
delete testexDir;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PrimaryGeneratorMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
{
if (command == RndmCmd)
{Action->SetRndmBeam(RndmCmd->GetNewDoubleValue(newValue));}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,249 @@
//
// ********************************************************************
// * 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: RunAction.cc,v 1.1 2007/08/16 10:32:04 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "RunAction.hh"
#include "DetectorConstruction.hh"
#include "QGSP.hh"
#include "PrimaryGeneratorAction.hh"
#include "RunActionMessenger.hh"
#include "G4Run.hh"
#include "G4RunManager.hh"
#include "G4UnitsTable.hh"
#include "G4ios.hh"
#include "Randomize.hh"
#include "G4EmCalculator.hh"
#ifdef G4ANALYSIS_USE
#include "AIDA/AIDA.h"
#endif
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RunAction::RunAction(DetectorConstruction* det, PrimaryGeneratorAction* kin):detector(det), kinematic(kin), af(0), tree(0)
{
verboseLevel = 0;
binLength = offsetX = 0.;
histo[0] = 0;
tree = 0;
af = 0;
#ifdef G4ANALYSIS_USE
// Creating the analysis factory
af = AIDA_createAnalysisFactory();
ftype = "hbook";
fname = "monopole";
#endif
// create commands for interactive definition of the detector
runActionMessenger = new RunActionMessenger(this);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RunAction::~RunAction()
{
#ifdef G4ANALYSIS_USE
delete af;
#endif
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RunAction::bookHisto()
{
G4double length = detector->GetAbsorSizeX();
if(!binLength) binLength = 5 * mm;
if(binLength > detector->GetMaxStepSize()) binLength = detector->GetMaxStepSize();
G4int nbBins = (int)(0.5 + length / binLength);
offsetX = 0.5 * length;
#ifdef G4ANALYSIS_USE
if(GetVerbose() > 0) G4cout << "\n----> Histogram Tree opened" << G4endl;
// Create the tree factory
AIDA::ITreeFactory* tf = af->createTreeFactory();
// Create a tree mapped to an hbook file.
G4bool readOnly = false;
G4bool createNew = true;
//G4String ftype = "hbook";
//G4String fname = "monopole";
G4String fName = fname;
fName += ".";
fName += ftype;
G4String option = "--noErrors uncompress";
tree = tf->create(fName,ftype, readOnly, createNew, option);
// Create a histogram factory, whose histograms will be handled by the tree
AIDA::IHistogramFactory* hf = af->createHistogramFactory(*tree);
// Create histograms
histo[0] = hf->createHistogram1D("1","Edep (MeV/mm) along absorber (mm)", nbBins, 0, length);
histo[1] = hf->createHistogram1D("2","DEDX (MeV/mm) of proton", 100, -3., 7.);
histo[2] = hf->createHistogram1D("3","DEDX (MeV/mm) of monopole", 100, -3., 7.);
histo[3] = hf->createHistogram1D("4","Range(mm) of proton", 100, -3., 7.);
histo[4] = hf->createHistogram1D("5","Range(mm) of monopole", 100, -3., 7.);
delete tf;
delete hf;
#endif
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RunAction::saveHisto()
{
#ifdef G4ANALYSIS_USE
tree->commit(); // Writing the histograms to the file
tree->close(); // and closing the tree (and the file)
delete tree;
tree = 0;
if(GetVerbose() > 0) G4cout << "\n----> Histogram Tree saved" << G4endl;
#endif
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RunAction::SetBinSize(G4double size)
{
binLength = size;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RunAction::FillHisto(G4int ih, G4double x, G4double weight)
{
#ifdef G4ANALYSIS_USE
if(histo[ih]) histo[ih]->fill(x, weight);
#endif
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RunAction::BeginOfRunAction(const G4Run* aRun)
{
if(GetVerbose() > 0) G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
// save Rndm status
G4RunManager::GetRunManager()->SetRandomNumberStore(true);
CLHEP::HepRandom::showEngineStatus();
//initialize projected range, tallies, Ebeam, and book histograms
projRange = projRange2 = 0.;
kinematic->ResetEbeamCumul();
bookHisto();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RunAction::EndOfRunAction(const G4Run* aRun)
{
G4int NbofEvents = aRun->GetNumberOfEvent();
if (NbofEvents == 0) return;
//run conditions
//
G4Material* material = detector->GetAbsorMaterial();
G4double density = material->GetDensity();
G4String particle = kinematic->GetParticleGun()->GetParticleDefinition()->GetParticleName();
G4double energy = kinematic->GetParticleGun()->GetParticleEnergy();
if(GetVerbose() > 0){
G4cout << "\n The run consists of " << NbofEvents << " "<< particle << " of "
<< G4BestUnit(energy,"Energy") << " through "
<< G4BestUnit(detector->GetAbsorSizeX(),"Length") << " of "
<< material->GetName() << " (density: "
<< G4BestUnit(density,"Volumic Mass") << ")" << G4endl;
};
//compute projected range and straggling
projRange /= NbofEvents; projRange2 /= NbofEvents;
G4double rms = projRange2 - projRange*projRange;
if (rms>0.) rms = std::sqrt(rms); else rms = 0.;
if(GetVerbose() > 0){
G4cout.precision(5);
G4cout << "\n projected Range= " << G4BestUnit(projRange, "Length")
<< " rms= " << G4BestUnit(rms, "Length")
<< G4endl;
};
G4double ekin[100], dedxproton[100], dedxmp[100];
G4EmCalculator calc;
calc.SetVerbose(0);
G4int i;
for(i = 0; i < 100; i++) {
ekin[i] = std::pow(10., 0.1*G4double(i)) * keV;
dedxproton[i] = calc.ComputeElectronicDEDX(ekin[i], "proton", material->GetName());
dedxmp[i] = calc.ComputeElectronicDEDX(ekin[i], "monopole", material->GetName());
}
if(GetVerbose() > 1){
G4cout << "### Stopping Powers" << G4endl;
for(i=0; i<100; i++) {
G4cout << " E(MeV)= " << ekin[i] << " dedxp= " << dedxproton[i]
<< " dedxmp= " << dedxmp[i]
<< G4endl;
}
};
#ifdef G4ANALYSIS_USE
// normalize histogram
G4double fac = (mm/MeV) / (NbofEvents * binLength);
histo[0]->scale(fac);
G4String matName = detector->GetAbsorMaterial()->GetName();
if(GetVerbose() > 0){
G4cout << "Range table for " << matName << G4endl;
};
for(i=0; i<100; i++) {
G4double e = std::log10(ekin[i] / MeV) + 0.05;
histo[1]->fill(e, dedxproton[i]);
histo[2]->fill(e, dedxmp[i]);
histo[3]->fill(e, std::log10(calc.GetRange(ekin[i], "proton", matName) / mm));
histo[4]->fill(e, std::log10(calc.GetRange(ekin[i], "monopole", matName) / mm));
}
#endif
// save and clean histo
saveHisto();
// show Rndm status
CLHEP::HepRandom::showEngineStatus();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,98 @@
//
// ********************************************************************
// * 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: RunActionMessenger.cc,v 1.1 2007/08/16 10:32:04 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "RunActionMessenger.hh"
#include "RunAction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithADouble.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcmdWithAString.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RunActionMessenger::RunActionMessenger(RunAction * ra): runaction(ra)
{
actDir = new G4UIdirectory("/testex/run/");
actDir->SetGuidance("run commands");
binSizeCmd = new G4UIcmdWithADouble("/testex/run/binSize", this);
binSizeCmd->SetGuidance("Set bin size.");
binSizeCmd->SetParameterName("binSize", false);
binSizeCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
verboseCmd = new G4UIcmdWithAnInteger("/testex/run/verbose", this);
verboseCmd->SetGuidance("Set verbose level.");
verboseCmd->SetParameterName("verbose", false);
verboseCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
histoNameCmd = new G4UIcmdWithAString("/testex/run/HistoName", this);
histoNameCmd->SetGuidance("Set histo file name.");
histoNameCmd->SetParameterName("histoName", false);
histoNameCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
histoTypeCmd = new G4UIcmdWithAString("/testex/run/HistoType", this);
histoTypeCmd->SetGuidance("Set histo file type.");
histoTypeCmd->SetParameterName("histoType", false);
histoTypeCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RunActionMessenger::~RunActionMessenger()
{
delete binSizeCmd;
delete verboseCmd;
delete histoNameCmd;
delete histoTypeCmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RunActionMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
{
if( command == binSizeCmd )
{ runaction->SetBinSize(binSizeCmd->GetNewDoubleValue(newValue));}
if( command == verboseCmd )
{ runaction->SetVerbose(verboseCmd->GetNewIntValue(newValue));}
if( command == histoNameCmd )
{ runaction->SetHistoName(newValue);}
if( command == histoTypeCmd )
{ runaction->SetHistoType(newValue);}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,65 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: SteppingAction.cc,v 1.2 2007/12/10 16:28:17 gunter Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "SteppingAction.hh"
#include "DetectorConstruction.hh"
#include "RunAction.hh"
#include "G4SteppingManager.hh"
#include "G4VProcess.hh"
#include "G4ParticleTypes.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
SteppingAction::SteppingAction(DetectorConstruction* det,RunAction* RuAct):detector(det), runAction(RuAct)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
SteppingAction::~SteppingAction()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SteppingAction::UserSteppingAction(const G4Step* aStep)
{
G4double edep = aStep->GetTotalEnergyDeposit();
if (edep <= 0.) return;
//Bragg curve
G4StepPoint* prePoint = aStep->GetPreStepPoint();
G4StepPoint* postPoint = aStep->GetPostStepPoint();
G4double x = (prePoint->GetPosition().x() + postPoint->GetPosition().x()) * 0.5;
x += runAction->GetOffsetX();
runAction->FillHisto(0, x/mm , edep);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,53 @@
//
// ********************************************************************
// * 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: TrackingAction.cc,v 1.1 2007/08/16 10:32:04 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "TrackingAction.hh"
#include "RunAction.hh"
#include "G4Track.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
TrackingAction::TrackingAction(RunAction* run): runAction(run)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void TrackingAction::PostUserTrackingAction(const G4Track* aTrack)
{
// extract Projected Range of primary particle
if (aTrack->GetTrackID() == 1) {
G4double x = aTrack->GetPosition().x() + runAction->GetOffsetX();
runAction->AddProjRange(x);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......