Import Geant4 8.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 14:44:26 +02:00
parent 8a51e0bc40
commit 216a75eeb1
8717 changed files with 360418 additions and 141343 deletions
+216
View File
@@ -0,0 +1,216 @@
#!/usr/bin/python
# ==================================================================
# python script for Geant4Py test
#
# gtest01
# - check basic control flow
# ==================================================================
from Geant4 import *
import demo_wp
import MedicalBeam
import ROOT
# ==================================================================
# ROOT PART #
# ==================================================================
# ------------------------------------------------------------------
def init_root():
# ------------------------------------------------------------------
ROOT.gROOT.Reset()
# plot style
ROOT.gStyle.SetTextFont(42)
ROOT.gStyle.SetTitleFont(42, "X")
ROOT.gStyle.SetLabelFont(42, "X")
ROOT.gStyle.SetTitleFont(42, "Y")
ROOT.gStyle.SetLabelFont(42, "Y")
global gCanvas
gCanvas= ROOT.TCanvas("water_phantom_plots",
"Water Phantom Demo Plots",
620, 30, 800, 800)
# ------------------------------------------------------------------
def hini():
# ------------------------------------------------------------------
global gPad1
gPad1= ROOT.TPad("2D", "2D", 0.02, 0.5, 0.98, 1.)
gPad1.Draw()
gPad1.cd()
ROOT.gStyle.SetPalette(1);
global hist_dose2d
hist_dose2d= ROOT.TH2D("2D Dose", "Dose Distribution",
200, 0., 400.,
81, -81., 81.)
hist_dose2d.SetXTitle("Z (mm)")
hist_dose2d.SetYTitle("X (mm)")
hist_dose2d.SetStats(0)
hist_dose2d.Draw("colz")
gCanvas.cd()
global gPad2
gPad2= ROOT.TPad("Z", "Z", 0.02, 0., 0.98, 0.5)
gPad2.Draw()
gPad2.cd()
global hist_dosez
hist_dosez= ROOT.TH1D("Z Dose", "Depth Dose", 200, 0., 400.)
hist_dosez.SetXTitle("(mm)")
hist_dosez.SetYTitle("Accumulated Dose (MeV)")
hist_dosez.Draw()
# ------------------------------------------------------------------
def hshow():
# ------------------------------------------------------------------
gPad1.cd()
hist_dose2d.Draw("colz")
gPad2.cd()
hist_dosez.Draw()
# ==================================================================
# Geant4 PART #
# ==================================================================
# ==================================================================
# user actions in python
# ==================================================================
class MyPrimaryGeneratorAction(G4VUserPrimaryGeneratorAction):
"My Primary Generator Action"
def __init__(self):
G4VUserPrimaryGeneratorAction.__init__(self)
self.particleGun= G4ParticleGun(1)
def GeneratePrimaries(self, event):
self.particleGun.GeneratePrimaryVertex(event)
# ------------------------------------------------------------------
class MyRunAction(G4UserRunAction):
"My Run Action"
def EndOfRunAction(self, run):
print "*** End of Run"
print "- Run sammary : (id= %d, #events= %d)" \
% (run.GetRunID(), run.GetNumberOfEventToBeProcessed())
# ------------------------------------------------------------------
class MyEventAction(G4UserEventAction):
"My Event Action"
def EndOfEventAction(self, event):
gPad1.Modified()
gPad1.Update()
gPad2.Modified()
gPad2.Update()
ROOT.gSystem.ProcessEvents()
# ------------------------------------------------------------------
class MySteppingAction(G4UserSteppingAction):
"My Stepping Action"
def UserSteppingAction(self, step):
pass
# ------------------------------------------------------------------
class ScoreSD(G4VSensitiveDetector):
"SD for score voxels"
def __init__(self):
G4VSensitiveDetector.__init__(self, "ScoreVoxel")
def ProcessHits(self, step, rohist):
preStepPoint= step.GetPreStepPoint()
if(preStepPoint.GetCharge() == 0):
return
track= step.GetTrack()
touchable= track.GetTouchable()
voxel_id= touchable.GetReplicaNumber()
dedx= step.GetTotalEnergyDeposit()
xz= posXZ(voxel_id)
hist_dose2d.Fill(xz[1], xz[0], dedx/MeV)
if( abs(xz[0]) <= 100 ):
hist_dosez.Fill(xz[1], dedx/MeV)
# ------------------------------------------------------------------
def posXZ(copyN):
dd= 2.*mm
nx= 81
iz= copyN/nx
ix= copyN-iz*nx-nx/2
x0= ix*dd
z0= (iz+0.5)*dd
return (x0,z0)
# ==================================================================
# main
# ==================================================================
# init ROOT...
init_root()
hini()
# configure application
#app= demo_wp.MyApplication()
#app.Configure()
myMaterials= demo_wp.MyMaterials()
myMaterials.Construct()
myDC= demo_wp.MyDetectorConstruction()
gRunManager.SetUserInitialization(myDC)
myPL= demo_wp.MyPhysicsList()
gRunManager.SetUserInitialization(myPL)
# set user actions...
myPGA= MyPrimaryGeneratorAction()
gRunManager.SetUserAction(myPGA)
myRA= MyRunAction()
gRunManager.SetUserAction(myRA)
myEA= MyEventAction()
gRunManager.SetUserAction(myEA)
#mySA= MySteppingAction()
#gRunManager.SetUserAction(mySA)
# set particle gun
#pg= myPGA.particleGun
#pg.SetParticleByName("proton")
#pg.SetParticleEnergy(230.*MeV)
#pg.SetParticleMomentumDirection(G4ThreeVector(0., 0., 1.))
#pg.SetParticlePosition(G4ThreeVector(0.,0.,-50.)*cm)
# medical beam
beam= MedicalBeam.Construct()
beam.particle= "proton"
beam.kineticE= 230.*MeV
#beam.particle= "gamma"
#beam.kineticE= 1.77*MeV
beam.sourcePosition= G4ThreeVector(0.,0.,-100.*cm)
beam.SSD= 100.*cm
beam.fieldXY= [5.*cm, 5.*cm]
# initialize
gRunManager.Initialize()
# set SD (A SD should be set after geometry construction)
scoreSD= ScoreSD()
myDC.SetSDtoScoreVoxel(scoreSD)
# visualization
gApplyUICommand("/control/execute vis.mac")
# beamOn
gRunManager.BeamOn(100)
#ROOT.gSystem.Run()
@@ -0,0 +1,14 @@
# $Id: GNUmakefile,v 1.1 2006/05/11 04:35:32 kmura Exp $
# $Name: geant4-08-01 $
# ===========================================================
# Makefile for building Geant4Py modules
# ===========================================================
include ../../../../config/config.gmk
# python module name
MODULE := ../demo_wp#
include $(G4PY_INSTALL)/config/g4py.gmk
include $(G4PY_INSTALL)/config/module.gmk
@@ -0,0 +1,137 @@
//
// ********************************************************************
// * 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: MyDetectorConstruction.cc,v 1.3 2006/06/29 15:28:11 gunter Exp $
// $Name: geant4-08-01 $
// ====================================================================
// MyDetectorConstruction.cc
//
// 2005 Q
// ====================================================================
#include "MyDetectorConstruction.hh"
#include "G4Material.hh"
#include "G4Box.hh"
#include "G4LogicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4VisAttributes.hh"
// ====================================================================
//
// class description
//
// ====================================================================
////////////////////////////////////////////////
MyDetectorConstruction::MyDetectorConstruction()
: scoreVoxel(0)
////////////////////////////////////////////////
{
}
/////////////////////////////////////////////////
MyDetectorConstruction::~MyDetectorConstruction()
/////////////////////////////////////////////////
{
}
//////////////////////////////////////////////////////
G4VPhysicalVolume* MyDetectorConstruction::Construct()
//////////////////////////////////////////////////////
{
G4Material* mate;
G4VisAttributes* va;
// ==============================================================
// world volume
// ==============================================================
G4Box* areaSolid= new G4Box("area", 25.*cm, 25.*cm, 1.1*m);
G4Material* vacuum= G4Material::GetMaterial("Vacuum");
G4LogicalVolume* areaLV= new G4LogicalVolume(areaSolid, vacuum, "area");
G4PVPlacement* area= new G4PVPlacement(0, G4ThreeVector(), "area",
areaLV, 0, false, 0);
// vis. attributes
va= new G4VisAttributes(G4Color(1.,1.,1.));
va-> SetVisibility(false);
areaLV-> SetVisAttributes(va);
// ==============================================================
// phantom
// ==============================================================
// water phantom
const double dxyphantom= 40.*cm;
const double dzphantom= 50.*cm;
G4Box* sphantom= new G4Box("phantom",
dxyphantom/2., dxyphantom/2., dzphantom/2.);
G4Material* water= G4Material::GetMaterial("Water");
G4LogicalVolume* lphantom= new G4LogicalVolume(sphantom,
water, "phantom");
G4PVPlacement* phantom= new G4PVPlacement(0,
G4ThreeVector(0.,0., dzphantom/2.),
lphantom, "phantom",
areaLV, false, 0);
va= new G4VisAttributes(G4Color(0.,0.1,0.8));
lphantom-> SetVisAttributes(va);
// score voxels
const G4double dvoxel= 2.*mm;
const G4double dvoxel_y= 20.*mm;
G4Box* svoxel= new G4Box("voxel", dvoxel/2., dvoxel_y/2., dvoxel/2.);
scoreVoxel= new G4LogicalVolume(svoxel, water, "voxel");
va= new G4VisAttributes(G4Color(0.,0.8,0.8));
va-> SetVisibility(false);
scoreVoxel-> SetVisAttributes(va);
G4int ix, iz;
G4int index=0;
for (iz=0; iz<200; iz++) {
for (ix=-40; ix<=40; ix++) {
G4double x0= ix*dvoxel;
G4double z0= -dzphantom/2.+(iz+0.5)*dvoxel;
G4PVPlacement* pvoxel= new
G4PVPlacement(0, G4ThreeVector(x0, 0., z0),
scoreVoxel, "voxel", lphantom,
false, index);
index++;
}
}
return area;
}
/////////////////////////////////////////////////////////////////////////
void MyDetectorConstruction::SetSDtoScoreVoxel(G4VSensitiveDetector* asd)
/////////////////////////////////////////////////////////////////////////
{
if(scoreVoxel) {
scoreVoxel-> SetSensitiveDetector(asd);
}
}
@@ -0,0 +1,60 @@
//
// ********************************************************************
// * 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: MyDetectorConstruction.hh,v 1.3 2006/06/29 15:28:13 gunter Exp $
// $Name: geant4-08-01 $
// ====================================================================
// MyDetectorConstruction.hh
//
// 2005 Q
// ====================================================================
#ifndef MY_DETECTOR_CONSTRUCTION_H
#define MY_DETECTOR_CONSTRUCTION_H
#include "G4VUserDetectorConstruction.hh"
// ====================================================================
//
// class definition
//
// ====================================================================
class G4LogicalVolume;
class G4VSensitiveDetector;
class MyDetectorConstruction : public G4VUserDetectorConstruction {
private:
G4LogicalVolume* scoreVoxel;
public:
MyDetectorConstruction();
~MyDetectorConstruction();
virtual G4VPhysicalVolume* Construct();
void SetSDtoScoreVoxel(G4VSensitiveDetector* asd);
};
#endif
@@ -0,0 +1,121 @@
//
// ********************************************************************
// * 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: MyMaterials.cc,v 1.3 2006/06/29 15:28:16 gunter Exp $
// $Name: geant4-08-01 $
// ====================================================================
// MyMaterials.cc
//
// 2005 Q
// ====================================================================
#include "MyMaterials.hh"
#include "G4Material.hh"
// ====================================================================
//
// class description
//
// ====================================================================
//////////////////////////
MyMaterials::MyMaterials()
//////////////////////////
{
}
///////////////////////////
MyMaterials::~MyMaterials()
///////////////////////////
{
}
/////////////////////////////
void MyMaterials::Construct()
/////////////////////////////
{
G4double A, Z;
// ------------------------------------------------------------------------
// Elements
// ------------------------------------------------------------------------
G4Element* elH = new G4Element("Hydrogen","H", Z=1., A=1.00794*g/mole);
G4Element* elC = new G4Element("Carbon", "C", Z=6., A= 12.011 *g/mole);
G4Element* elN = new G4Element("Nitrogen","N", Z=7., A= 14.00674*g/mole);
G4Element* elO = new G4Element("Oxygen", "O", Z=8., A= 15.9994*g/mole);
// ------------------------------------------------------------------------
// Materials
// ------------------------------------------------------------------------
G4double density, massfraction;
G4int natoms, nel;
// temperature of experimental hall is controlled at 20 degree.
const G4double expTemp= STP_Temperature+20.*kelvin;
// vacuum
density= universe_mean_density;
G4Material* Vacuum= new G4Material("Vacuum", density, nel=2);
Vacuum-> AddElement(elN, .7);
Vacuum-> AddElement(elO, .3);
// air
density= 1.2929e-03 *g/cm3; // at 20 degree
G4Material* Air= new G4Material("Air", density, nel=2,
kStateGas, expTemp);
G4double ttt= 75.47+23.20;
Air-> AddElement(elN, massfraction= 75.47/ttt);
Air-> AddElement(elO, massfraction= 23.20/ttt);
// water
density= 1.000*g/cm3;
G4Material* H2O= new G4Material("Water", density, nel=2);
H2O-> AddElement(elH, natoms=2);
H2O-> AddElement(elO, natoms=1);
// alminium
A= 26.98 *g/mole;
density= 2.70 *g/cm3;
G4Material* Al= new G4Material("Al", Z=13., A, density);
// iron
A= 55.847 *g/mole;
density= 7.87 *g/cm3;
G4Material* Fe= new G4Material("Iron", Z=26., A, density);
// lead
A= 207.2 *g/mole;
density= 11.35 *g/cm3;
G4Material* Pb= new G4Material("Lead", Z=82., A, density);
// scintillator (Polystyene(C6H5CH=CH2))
density= 1.032 *g/cm3;
G4Material* Scinti= new G4Material("Scinti", density, nel=2);
Scinti-> AddElement(elC, natoms=8);
Scinti-> AddElement(elH, natoms=8);
}
@@ -0,0 +1,52 @@
//
// ********************************************************************
// * 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: MyMaterials.hh,v 1.3 2006/06/29 15:28:19 gunter Exp $
// $Name: geant4-08-01 $
// ====================================================================
// MyMaterials.hh
//
// 2005 Q
// ====================================================================
#ifndef MY_MATERIALS_H
#define MY_MATERIALS_H
#include "globals.hh"
// ====================================================================
//
// class definition
//
// ====================================================================
class MyMaterials {
public:
MyMaterials();
~MyMaterials();
void Construct();
};
#endif
@@ -0,0 +1,69 @@
//
// ********************************************************************
// * 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: MyPhysicsList.cc,v 1.3 2006/06/29 15:28:21 gunter Exp $
// $Name: geant4-08-01 $
// ====================================================================
// MyPhysicsList.cc
//
// 2005 Q
// ====================================================================
#include "MyPhysicsList.hh"
#include "Particles.hh"
#include "PhysicsListEMstd.hh"
#include "PhysicsListLHad.hh"
// ====================================================================
//
// class description
//
// ====================================================================
//////////////////////////////
MyPhysicsList::MyPhysicsList()
: G4VModularPhysicsList()
//////////////////////////////
{
defaultCutValue = 1.*mm;
SetVerboseLevel(1);
RegisterPhysics(new Particles);
RegisterPhysics(new PhysicsListEMstd);
RegisterPhysics(new PhysicsListLHad);
}
///////////////////////////////
MyPhysicsList::~MyPhysicsList()
///////////////////////////////
{
}
/////////////////////////////
void MyPhysicsList::SetCuts()
/////////////////////////////
{
SetCutsWithDefault();
}
@@ -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: MyPhysicsList.hh,v 1.3 2006/06/29 15:28:23 gunter Exp $
// $Name: geant4-08-01 $
// ====================================================================
// MyPhysicsList.hh
//
// 2005 Q
// ====================================================================
#ifndef MY_PHYSICS_LIST_H
#define MY_PHYSICS_LIST_H
#include "G4VModularPhysicsList.hh"
#include "globals.hh"
// ====================================================================
//
// class definition
//
// ====================================================================
class MyPhysicsList: public G4VModularPhysicsList {
public:
MyPhysicsList();
~MyPhysicsList();
virtual void SetCuts();
};
#endif
@@ -0,0 +1,82 @@
//
// ********************************************************************
// * 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: Particles.cc,v 1.3 2006/06/29 15:28:25 gunter Exp $
// $Name: geant4-08-01 $
// ====================================================================
// Particles.cc
//
// Physics list for defining particles
//
// ====================================================================
#include "Particles.hh"
#include "G4LeptonConstructor.hh"
#include "G4BosonConstructor.hh"
#include "G4MesonConstructor.hh"
#include "G4BaryonConstructor.hh"
#include "G4ShortLivedConstructor.hh"
#include "G4IonConstructor.hh"
// ====================================================================
//
// class description
//
// ====================================================================
//////////////////////////////////////
Particles::Particles()
: G4VPhysicsConstructor("Particles")
//////////////////////////////////////
{
}
///////////////////////
Particles::~Particles()
///////////////////////
{
}
///////////////////////////////////
void Particles::ConstructParticle()
///////////////////////////////////
{
G4LeptonConstructor::ConstructParticle();
G4BosonConstructor::ConstructParticle();
G4MesonConstructor::ConstructParticle();
G4BaryonConstructor::ConstructParticle();
G4ShortLivedConstructor::ConstructParticle();
G4IonConstructor::ConstructParticle();
}
//////////////////////////////////
void Particles::ConstructProcess()
//////////////////////////////////
{
}
@@ -0,0 +1,54 @@
//
// ********************************************************************
// * 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: Particles.hh,v 1.3 2006/06/29 15:28:27 gunter Exp $
// ====================================================================
// Particles.hh
//
// 2004 Q
// ====================================================================
#ifndef PARTICLES_H
#define PARTICLES_H
#include "G4VPhysicsConstructor.hh"
// ====================================================================
//
// class definition
//
// ====================================================================
class Particles : public G4VPhysicsConstructor {
public:
Particles();
~Particles();
virtual void ConstructParticle();
virtual void ConstructProcess();
};
#endif
@@ -0,0 +1,123 @@
//
// ********************************************************************
// * 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: PhysicsListEMstd.cc,v 1.3 2006/06/29 15:28:29 gunter Exp $
// $Name: geant4-08-01 $
// ====================================================================
// PhysicsListEMstd.cc
//
// Physics list for electron/positron/gamma
// EM-standard package w/ default parameters
//
// ====================================================================
#include "PhysicsListEMstd.hh"
#include "G4ProcessManager.hh"
#include "G4ParticleDefinition.hh"
#include "G4Gamma.hh"
#include "G4Electron.hh"
#include "G4Positron.hh"
#include "G4NeutrinoE.hh"
#include "G4AntiNeutrinoE.hh"
#include "G4ComptonScattering.hh"
#include "G4GammaConversion.hh"
#include "G4PhotoElectricEffect.hh"
#include "G4MultipleScattering.hh"
#include "G4eIonisation.hh"
#include "G4eBremsstrahlung.hh"
#include "G4eplusAnnihilation.hh"
// ====================================================================
//
// class description
//
// ====================================================================
////////////////////////////////////
PhysicsListEMstd::PhysicsListEMstd()
: G4VPhysicsConstructor("EM-std")
////////////////////////////////////
{
}
/////////////////////////////////////
PhysicsListEMstd::~PhysicsListEMstd()
/////////////////////////////////////
{
}
//////////////////////////////////////////
void PhysicsListEMstd::ConstructParticle()
//////////////////////////////////////////
{
}
/////////////////////////////////////////
void PhysicsListEMstd::ConstructProcess()
/////////////////////////////////////////
{
G4ProcessManager* pm;
// ----------------------------------------------------------
// gamma physics
// ----------------------------------------------------------
pm= G4Gamma::Gamma()-> GetProcessManager();
pm-> AddDiscreteProcess(new G4PhotoElectricEffect);
pm-> AddDiscreteProcess(new G4ComptonScattering);
pm-> AddDiscreteProcess(new G4GammaConversion);
// ----------------------------------------------------------
// electron physics
// ----------------------------------------------------------
G4MultipleScattering* msc= new G4MultipleScattering;
G4eIonisation* eion= new G4eIonisation;
G4eBremsstrahlung* ebrems= new G4eBremsstrahlung;
pm= G4Electron::Electron()->GetProcessManager();
pm-> AddProcess(msc, ordInActive, 1, 1);
pm-> AddProcess(eion, ordInActive, 2, 2);
pm-> AddProcess(ebrems, ordInActive, ordInActive, 3);
// ----------------------------------------------------------
// positron physics
// ----------------------------------------------------------
msc= new G4MultipleScattering;
eion= new G4eIonisation;
ebrems= new G4eBremsstrahlung;
G4eplusAnnihilation* annihilation= new G4eplusAnnihilation;
pm= G4Positron::Positron()-> GetProcessManager();
pm-> AddProcess(msc, ordInActive, 1, 1);
pm-> AddProcess(eion, ordInActive, 2, 2);
pm-> AddProcess(ebrems, ordInActive, ordInActive, 3);
pm-> AddProcess(annihilation, 0, ordInActive, 4);
}
@@ -0,0 +1,54 @@
//
// ********************************************************************
// * 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: PhysicsListEMstd.hh,v 1.3 2006/06/29 15:28:32 gunter Exp $
// ====================================================================
// PhysicsListEMstd.hh
//
// 2004 Q
// ====================================================================
#ifndef PHYSICS_LIST_EM_STD_H
#define PHYSICS_LIST_EM_STD_H
#include "G4VPhysicsConstructor.hh"
// ====================================================================
//
// class definition
//
// ====================================================================
class PhysicsListEMstd : public G4VPhysicsConstructor {
public:
PhysicsListEMstd();
~PhysicsListEMstd();
virtual void ConstructParticle();
virtual void ConstructProcess();
};
#endif
@@ -0,0 +1,396 @@
//
// ********************************************************************
// * 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: PhysicsListLHad.cc,v 1.3 2006/06/29 15:28:35 gunter Exp $
// ====================================================================
// PhysicsListLHad.cc
//
// Light package of hadron physics
// ====================================================================
#include "PhysicsListLHad.hh"
#include "G4ProcessManager.hh"
#include "G4ParticleDefinition.hh"
#include "G4MultipleScattering.hh"
#include "G4hIonisation.hh"
// Hadronic Processes
#include "G4HadronElasticProcess.hh"
#include "G4HadronFissionProcess.hh"
#include "G4HadronCaptureProcess.hh"
#include "G4ProtonInelasticProcess.hh"
#include "G4AntiProtonInelasticProcess.hh"
#include "G4NeutronInelasticProcess.hh"
#include "G4AntiNeutronInelasticProcess.hh"
#include "G4PionPlusInelasticProcess.hh"
#include "G4PionMinusInelasticProcess.hh"
#include "G4KaonPlusInelasticProcess.hh"
#include "G4KaonZeroSInelasticProcess.hh"
#include "G4KaonZeroLInelasticProcess.hh"
#include "G4KaonMinusInelasticProcess.hh"
// Low energy models
#include "G4LElastic.hh"
#include "G4LFission.hh"
#include "G4LCapture.hh"
#include "G4LEProtonInelastic.hh"
#include "G4LEAntiProtonInelastic.hh"
#include "G4LENeutronInelastic.hh"
#include "G4LEAntiNeutronInelastic.hh"
#include "G4LEPionPlusInelastic.hh"
#include "G4LEPionMinusInelastic.hh"
#include "G4LEKaonPlusInelastic.hh"
#include "G4LEKaonZeroSInelastic.hh"
#include "G4LEKaonZeroLInelastic.hh"
#include "G4LEKaonMinusInelastic.hh"
// High-energy Models
#include "G4HEProtonInelastic.hh"
#include "G4HEAntiProtonInelastic.hh"
#include "G4HEPionPlusInelastic.hh"
#include "G4HEPionMinusInelastic.hh"
#include "G4HEKaonPlusInelastic.hh"
#include "G4HEKaonZeroInelastic.hh"
#include "G4HEKaonZeroInelastic.hh"
#include "G4HEKaonMinusInelastic.hh"
// Stopping processes
#include "G4AntiProtonAnnihilationAtRest.hh"
// Binary Cascade
#include "G4BinaryCascade.hh"
#include "G4ProtonInelasticCrossSection.hh"
// ====================================================================
//
// class description
//
// ====================================================================
//////////////////////////////////
PhysicsListLHad::PhysicsListLHad()
: G4VPhysicsConstructor("LHad")
//////////////////////////////////
{
}
///////////////////////////////////
PhysicsListLHad::~PhysicsListLHad()
///////////////////////////////////
{
}
/////////////////////////////////////////
void PhysicsListLHad::ConstructParticle()
/////////////////////////////////////////
{
}
////////////////////////////////////////
void PhysicsListLHad::ConstructProcess()
////////////////////////////////////////
{
G4ProcessManager* pManager;
// ---------------------------------------------------------------
// proton
// ---------------------------------------------------------------
pManager= G4Proton::Proton()-> GetProcessManager();
// elastic
G4HadronElasticProcess* thepElasticProcess = new G4HadronElasticProcess();
G4LElastic* thepElasticModel = new G4LElastic();
thepElasticProcess->RegisterMe(thepElasticModel);
pManager-> AddDiscreteProcess(thepElasticProcess);
// inelastic
G4ProtonInelasticProcess* theProtonInelasticProcess
= new G4ProtonInelasticProcess();
G4HEProtonInelastic* theProtonHEPModel = new G4HEProtonInelastic();
G4LEProtonInelastic* theProtonLEPModel = new G4LEProtonInelastic();
theProtonLEPModel->SetMinEnergy(2.8*GeV);
G4BinaryCascade* theProtonBICModel = new G4BinaryCascade();
theProtonBICModel->SetMaxEnergy(3.2*GeV);
theProtonInelasticProcess-> RegisterMe(theProtonHEPModel);
theProtonInelasticProcess-> RegisterMe(theProtonLEPModel);
theProtonInelasticProcess-> RegisterMe(theProtonBICModel);
// add Xsection data of BIC
G4ProtonInelasticCrossSection* theProtonInelasticData
= new G4ProtonInelasticCrossSection();
theProtonInelasticProcess-> AddDataSet( theProtonInelasticData );
pManager-> AddDiscreteProcess(theProtonInelasticProcess);
// QED
G4VProcess* thepMultipleScattering = new G4MultipleScattering();
G4VProcess* thepIonisation = new G4hIonisation();
pManager-> AddProcess(thepIonisation);
pManager-> AddProcess(thepMultipleScattering);
pManager-> SetProcessOrdering(thepMultipleScattering, idxAlongStep, 1);
pManager-> SetProcessOrdering(thepIonisation, idxAlongStep, 2);
pManager-> SetProcessOrdering(thepMultipleScattering, idxPostStep, 1);
pManager-> SetProcessOrdering(thepIonisation, idxPostStep, 2);
// ---------------------------------------------------------------
// anti-proton
// ---------------------------------------------------------------
pManager= G4AntiProton::AntiProton()-> GetProcessManager();
// elastic
G4HadronElasticProcess* theapElasticProcess = new G4HadronElasticProcess();
G4LElastic* theapElasticModel = new G4LElastic();
theapElasticProcess-> RegisterMe(theapElasticModel);
pManager-> AddDiscreteProcess(theapElasticProcess);
// inelastic
G4AntiProtonInelasticProcess* theAntiProtonInelasticProcess
= new G4AntiProtonInelasticProcess();
G4LEAntiProtonInelastic* theAntiProtonLEPModel
= new G4LEAntiProtonInelastic();
G4HEAntiProtonInelastic* theAntiProtonHEPModel
= new G4HEAntiProtonInelastic();
theAntiProtonInelasticProcess-> RegisterMe(theAntiProtonLEPModel);
theAntiProtonInelasticProcess-> RegisterMe(theAntiProtonHEPModel);
pManager-> AddDiscreteProcess(theAntiProtonInelasticProcess);
G4AntiProtonAnnihilationAtRest* theAntiProtonAnnihilation
= new G4AntiProtonAnnihilationAtRest();
pManager-> AddRestProcess(theAntiProtonAnnihilation);
// QED
G4VProcess* theapMultipleScattering = new G4MultipleScattering();
G4VProcess* theapIonisation = new G4hIonisation();
pManager-> AddProcess(theapIonisation);
pManager-> AddProcess(theapMultipleScattering);
pManager->SetProcessOrdering(theapMultipleScattering, idxAlongStep, 1);
pManager->SetProcessOrdering(theapIonisation, idxAlongStep, 2);
pManager->SetProcessOrdering(theapMultipleScattering, idxPostStep, 1);
pManager->SetProcessOrdering(theapIonisation, idxPostStep, 2);
// ---------------------------------------------------------------
// mesons...
// ---------------------------------------------------------------
// ---------------------------------------------------------------
// pi+
// ---------------------------------------------------------------
pManager= G4PionPlus::PionPlus()-> GetProcessManager();
// elastic
G4HadronElasticProcess* theppElasticProcess = new G4HadronElasticProcess();
G4LElastic* theppElasticModel = new G4LElastic();
theppElasticProcess-> RegisterMe(theppElasticModel);
pManager-> AddDiscreteProcess(theppElasticProcess);
// inelastic
G4PionPlusInelasticProcess* thePionPlusInelasticProcess
= new G4PionPlusInelasticProcess();
G4LEPionPlusInelastic* thePionPlusLEPModel = new G4LEPionPlusInelastic();
G4HEPionPlusInelastic* thePionPlusHEPModel = new G4HEPionPlusInelastic();
thePionPlusInelasticProcess->RegisterMe(thePionPlusLEPModel);
thePionPlusInelasticProcess->RegisterMe(thePionPlusHEPModel);
pManager-> AddDiscreteProcess(thePionPlusInelasticProcess);
// QED
G4VProcess* theppMultipleScattering = new G4MultipleScattering();
G4VProcess* theppIonisation = new G4hIonisation();
pManager-> AddProcess(theppIonisation);
pManager-> AddProcess(theppMultipleScattering);
pManager-> SetProcessOrdering(theppMultipleScattering, idxAlongStep, 1);
pManager-> SetProcessOrdering(theppIonisation, idxAlongStep, 2);
pManager-> SetProcessOrdering(theppMultipleScattering, idxPostStep, 1);
pManager-> SetProcessOrdering(theppIonisation, idxPostStep, 2);
// ---------------------------------------------------------------
// pi-
// ---------------------------------------------------------------
pManager= G4PionMinus::PionMinus()-> GetProcessManager();
// elastic
G4HadronElasticProcess* thepmElasticProcess = new G4HadronElasticProcess();
G4LElastic* thepmElasticModel = new G4LElastic();
thepmElasticProcess->RegisterMe(thepmElasticModel);
pManager-> AddDiscreteProcess(thepmElasticProcess);
// inelastic
G4PionMinusInelasticProcess* thePionMinusInelasticProcess
= new G4PionMinusInelasticProcess();
G4LEPionMinusInelastic* thePionMinusLEPModel = new G4LEPionMinusInelastic();
G4HEPionMinusInelastic* thePionMinusHEPModel = new G4HEPionMinusInelastic();
thePionMinusInelasticProcess-> RegisterMe(thePionMinusLEPModel);
thePionMinusInelasticProcess-> RegisterMe(thePionMinusHEPModel);
pManager-> AddDiscreteProcess(thePionMinusInelasticProcess);
// QED
G4VProcess* thepmMultipleScattering = new G4MultipleScattering();
G4VProcess* thepmIonisation = new G4hIonisation();
pManager-> AddProcess(thepmIonisation);
pManager-> AddProcess(thepmMultipleScattering);
pManager-> SetProcessOrdering(thepmMultipleScattering, idxAlongStep, 1);
pManager-> SetProcessOrdering(thepmIonisation, idxAlongStep, 2);
pManager-> SetProcessOrdering(thepmMultipleScattering, idxPostStep, 1);
pManager-> SetProcessOrdering(thepmIonisation, idxPostStep, 2);
// ---------------------------------------------------------------
// K+
// ---------------------------------------------------------------
pManager= G4KaonPlus::KaonPlus()-> GetProcessManager();
// elastic
G4HadronElasticProcess* thekpElasticProcess = new G4HadronElasticProcess();
G4LElastic* thekpElasticModel = new G4LElastic();
thekpElasticProcess->RegisterMe(thekpElasticModel);
pManager->AddDiscreteProcess(thekpElasticProcess);
// inelastic
G4KaonPlusInelasticProcess* theKaonPlusInelasticProcess
= new G4KaonPlusInelasticProcess();
G4LEKaonPlusInelastic* theKaonPlusLEPModel = new G4LEKaonPlusInelastic();
G4HEKaonPlusInelastic* theKaonPlusHEPModel = new G4HEKaonPlusInelastic();
theKaonPlusInelasticProcess-> RegisterMe(theKaonPlusLEPModel);
theKaonPlusInelasticProcess-> RegisterMe(theKaonPlusHEPModel);
pManager-> AddDiscreteProcess(theKaonPlusInelasticProcess);
// QED
G4VProcess* thekpMultipleScattering = new G4MultipleScattering();
G4VProcess* thekpIonisation = new G4hIonisation();
pManager-> AddProcess(thekpIonisation);
pManager-> AddProcess(thekpMultipleScattering);
pManager-> SetProcessOrdering(thekpMultipleScattering, idxAlongStep, 1);
pManager-> SetProcessOrdering(thekpIonisation, idxAlongStep, 2);
pManager-> SetProcessOrdering(thekpMultipleScattering, idxPostStep, 1);
pManager-> SetProcessOrdering(thekpIonisation, idxPostStep, 2);
// ---------------------------------------------------------------
// K-
// ---------------------------------------------------------------
pManager= G4KaonMinus::KaonMinus()->GetProcessManager();
// elastic
G4HadronElasticProcess* thekmElasticProcess = new G4HadronElasticProcess();
G4LElastic* thekmElasticModel = new G4LElastic();
thekmElasticProcess->RegisterMe(thekmElasticModel);
pManager->AddDiscreteProcess(thekmElasticProcess);
// inelastic
G4KaonMinusInelasticProcess* theKaonMinusInelasticProcess
= new G4KaonMinusInelasticProcess();
G4LEKaonMinusInelastic* theKaonMinusLEPModel = new G4LEKaonMinusInelastic();
G4HEKaonMinusInelastic* theKaonMinusHEPModel = new G4HEKaonMinusInelastic();
theKaonMinusInelasticProcess->RegisterMe(theKaonMinusLEPModel);
theKaonMinusInelasticProcess->RegisterMe(theKaonMinusHEPModel);
pManager->AddDiscreteProcess(theKaonMinusInelasticProcess);
// QED
G4VProcess* thekmMultipleScattering = new G4MultipleScattering();
G4VProcess* thekmIonisation = new G4hIonisation();
pManager-> AddProcess(thekmIonisation);
pManager-> AddProcess(thekmMultipleScattering);
pManager->SetProcessOrdering(thekmMultipleScattering, idxAlongStep, 1);
pManager->SetProcessOrdering(thekmIonisation, idxAlongStep, 2);
pManager->SetProcessOrdering(thekmMultipleScattering, idxPostStep, 1);
pManager->SetProcessOrdering(thekmIonisation, idxPostStep, 2);
// ---------------------------------------------------------------
// K0L
// ---------------------------------------------------------------
pManager= G4KaonZeroLong::KaonZeroLong()-> GetProcessManager();
// elastic
G4HadronElasticProcess* thek0lElasticProcess = new G4HadronElasticProcess();
G4LElastic* thek0lElasticModel = new G4LElastic();
thek0lElasticProcess-> RegisterMe(thek0lElasticModel);
pManager-> AddDiscreteProcess(thek0lElasticProcess);
// inelastic
G4KaonZeroLInelasticProcess* theKaonZeroLInelasticProcess
= new G4KaonZeroLInelasticProcess();
G4LEKaonZeroLInelastic* theKaonZeroLLEPModel = new G4LEKaonZeroLInelastic();
G4HEKaonZeroInelastic* theKaonZerolHEPModel = new G4HEKaonZeroInelastic();
theKaonZeroLInelasticProcess-> RegisterMe(theKaonZeroLLEPModel);
theKaonZeroLInelasticProcess-> RegisterMe(theKaonZerolHEPModel);
pManager-> AddDiscreteProcess(theKaonZeroLInelasticProcess);
// ---------------------------------------------------------------
// K0S
// ---------------------------------------------------------------
pManager= G4KaonZeroShort::KaonZeroShort()-> GetProcessManager();
// elastic
G4HadronElasticProcess* thek0sElasticProcess = new G4HadronElasticProcess();
G4LElastic* thek0sElasticModel = new G4LElastic();
thek0sElasticProcess-> RegisterMe(thek0sElasticModel);
pManager-> AddDiscreteProcess(thek0sElasticProcess);
// inelastic
G4KaonZeroSInelasticProcess* theKaonZeroSInelasticProcess
= new G4KaonZeroSInelasticProcess();
G4LEKaonZeroSInelastic* theKaonZeroSLEPModel = new G4LEKaonZeroSInelastic();
G4HEKaonZeroInelastic* theKaonZerosHEPModel = new G4HEKaonZeroInelastic();
theKaonZeroSInelasticProcess-> RegisterMe(theKaonZeroSLEPModel);
theKaonZeroSInelasticProcess-> RegisterMe(theKaonZerosHEPModel);
pManager-> AddDiscreteProcess(theKaonZeroSInelasticProcess);
}
@@ -0,0 +1,54 @@
//
// ********************************************************************
// * 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: PhysicsListLHad.hh,v 1.3 2006/06/29 15:28:37 gunter Exp $
// ====================================================================
// PhysicsListLHad.hh
//
// 2004 Q
// ====================================================================
#ifndef PHYSICS_L_HAD_H
#define PHYSICS_L_HAD_H
#include "G4VPhysicsConstructor.hh"
// ====================================================================
//
// class definition
//
// ====================================================================
class PhysicsListLHad : public G4VPhysicsConstructor {
public:
PhysicsListLHad();
~PhysicsListLHad();
virtual void ConstructParticle();
virtual void ConstructProcess();
};
#endif
@@ -0,0 +1,63 @@
//
// ********************************************************************
// * 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: pydemo_wp.cc,v 1.3 2006/06/29 15:28:40 gunter Exp $
// $Name: geant4-08-01 $
// ====================================================================
// pydemo_wp.cc
//
// python wrapper for user application
// 2005 Q
// ====================================================================
#include <boost/python.hpp>
#include "MyMaterials.hh"
#include "MyDetectorConstruction.hh"
#include "MyPhysicsList.hh"
#include "G4VSensitiveDetector.hh"
using namespace boost::python;
// ====================================================================
// Expose to Python
// ====================================================================
BOOST_PYTHON_MODULE(demo_wp) {
class_<MyMaterials>("MyMaterials", "my material")
.def("Construct", &MyMaterials::Construct)
;
class_<MyDetectorConstruction, MyDetectorConstruction*,
bases<G4VUserDetectorConstruction> >
("MyDetectorConstruction", "my detector")
.def("SetSDtoScoreVoxel", &MyDetectorConstruction::SetSDtoScoreVoxel)
;
class_<MyPhysicsList, MyPhysicsList*,
bases<G4VUserPhysicsList> >
("MyPhysicsList", "my physics list")
;
}
+92
View File
@@ -0,0 +1,92 @@
#!/usr/bin/python
# ==================================================================
# python script for Geant4Py test
#
# ==================================================================
from Geant4 import *
import demo_wp
# ==================================================================
# user actions in python
# ==================================================================
class MyPrimaryGeneratorAction(G4VUserPrimaryGeneratorAction):
"My Primary Generator Action"
def __init__(self):
G4VUserPrimaryGeneratorAction.__init__(self)
self.particleGun= G4ParticleGun(1)
def GeneratePrimaries(self, event):
self.particleGun.GeneratePrimaryVertex(event)
# ------------------------------------------------------------------
class MyRunAction(G4UserRunAction):
"My Run Action"
def EndOfRunAction(self, run):
print "*** End of Run"
print "- Run sammary : (id= %d, #events= %d)" \
% (run.GetRunID(), run.GetNumberOfEventToBeProcessed())
# ------------------------------------------------------------------
class MyEventAction(G4UserEventAction):
"My Event Action"
def EndOfEventAction(self, event):
pass
# ------------------------------------------------------------------
class MySteppingAction(G4UserSteppingAction):
"My Stepping Action"
def UserSteppingAction(self, step):
pass
#print "*** dE/dx in current step=", step.GetTotalEnergyDeposit()
preStepPoint= step.GetPreStepPoint()
track= step.GetTrack()
touchable= track.GetTouchable()
#print "*** vid= ", touchable.GetReplicaNumber()
# ==================================================================
# main
# ==================================================================
myMaterials= demo_wp.MyMaterials()
myMaterials.Construct()
myDC= demo_wp.MyDetectorConstruction()
gRunManager.SetUserInitialization(myDC)
myPL= demo_wp.MyPhysicsList()
gRunManager.SetUserInitialization(myPL)
# set user actions...
myPGA= MyPrimaryGeneratorAction()
gRunManager.SetUserAction(myPGA)
myRA= MyRunAction()
gRunManager.SetUserAction(myRA)
myEA= MyEventAction()
gRunManager.SetUserAction(myEA)
mySA= MySteppingAction()
gRunManager.SetUserAction(mySA)
# set particle gun
pg= myPGA.particleGun
pg.SetParticleByName("proton")
pg.SetParticleEnergy(230.*HEPUnit.MeV)
pg.SetParticleMomentumDirection(G4ThreeVector(0., 0., 1.))
pg.SetParticlePosition(G4ThreeVector(0.,0.,-20.)*HEPUnit.cm)
gRunManager.Initialize()
# visualization
gApplyUICommand("/control/execute vis.mac")
# beamOn
#gRunManager.BeamOn(3)
@@ -0,0 +1,17 @@
# vis.mac
/vis/open OGLIX
#/vis/open OGLSX
/vis/scene/create
/vis/scene/add/volume
/vis/sceneHandler/attach
/vis/viewer/set/viewpointThetaPhi 90. 0.
/tracking/storeTrajectory 1
/vis/scene/add/trajectories
/vis/scene/endOfEventAction accumulate
#/vis/scene/endOfEventAction refresh