Import Geant4 6.2.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 10:56:29 +02:00
parent 1d812b78b1
commit e083ffb441
1415 changed files with 111223 additions and 21207 deletions
@@ -0,0 +1,40 @@
# $Id: GNUmakefile,v 1.1 2004/04/28 11:09:04 maire Exp $
# --------------------------------------------------------------
# GNUmakefile for examples module. Gabriele Cosmo, 06/04/98.
# --------------------------------------------------------------
name := PhotonProcesses
G4TARGET := $(name)
G4EXLIB := true
ifndef G4INSTALL
G4INSTALL = ../../../..
endif
.PHONY: all
all: lib bin
#### G4ANALYSIS_USE := true
ifdef G4ANALYSIS_USE
USE_AIDA := true
endif
ifdef USE_AIDA
CPPFLAGS += -DG4ANALYSIS_USE
CPPFLAGS += -DUSE_AIDA
endif
include $(G4INSTALL)/config/architecture.gmk
ifdef USE_AIDA
# for the aida-config command see the README file
CPPFLAGS += `aida-config --include`
LDFLAGS += `aida-config --lib`
endif
include $(G4INSTALL)/config/binmake.gmk
visclean:
rm -f g4*.prim g4*.eps g4*.wrl
rm -f .DAWN_*
@@ -0,0 +1,23 @@
$Id: History,v 1.3 2004/06/10 15:55:35 maire Exp $
-------------------------------------------------------------------
=========================================================
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
=========================================================
PhotonProcesses History file
--------------------
This file should be used by the G4 example coordinator to briefly
summarize all major modifications introduced in the code and keep
track of all tags.
----------------------------------------------------------
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
10.06.04 mma (photonprocesses-V06-01-01)
- modifs in HistoManager and messenger to allow a multiruns job.
23.04.04 Michel Maire (photonprocesses-V06-01-00)
- creation, from TestEm1
@@ -0,0 +1,121 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: PhotonProcesses.cc,v 1.2 2004/06/10 15:55:35 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "G4UIterminal.hh"
#include "G4UItcsh.hh"
#include "Randomize.hh"
#include "DetectorConstruction.hh"
#include "PhysicsList.hh"
#include "PrimaryGeneratorAction.hh"
#include "SteppingVerbose.hh"
#include "RunAction.hh"
#include "EventAction.hh"
#include "SteppingAction.hh"
#include "HistoManager.hh"
#ifdef G4VIS_USE
#include "VisManager.hh"
#endif
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
int main(int argc,char** argv) {
//choose the Random engine
HepRandom::setTheEngine(new RanecuEngine);
//my Verbose output class
G4VSteppingVerbose::SetInstance(new SteppingVerbose);
// Construct the default run manager
G4RunManager * runManager = new G4RunManager;
// set mandatory initialization classes
DetectorConstruction* det;
PrimaryGeneratorAction* prim;
runManager->SetUserInitialization(det = new DetectorConstruction);
runManager->SetUserInitialization(new PhysicsList);
runManager->SetUserAction(prim = new PrimaryGeneratorAction(det));
#ifdef G4VIS_USE
// visualization manager
G4VisManager* visManager = new VisManager;
visManager->Initialize();
#endif
HistoManager* histo = 0;
#ifdef G4ANALYSIS_USE
histo = new HistoManager();
#endif
// set user action classes
RunAction* run;
runManager->SetUserAction(run = new RunAction(det,prim,histo));
runManager->SetUserAction(new EventAction);
runManager->SetUserAction(new SteppingAction(run,histo));
// get the pointer to the User Interface manager
G4UImanager* UI = G4UImanager::GetUIpointer();
if (argc==1) // Define UI terminal for interactive mode
{
G4UIsession * session = 0;
#ifdef G4UI_USE_TCSH
session = new G4UIterminal(new G4UItcsh);
#else
session = new G4UIterminal();
#endif
session->SessionStart();
delete session;
}
else // Batch mode
{
G4String command = "/control/execute ";
G4String fileName = argv[1];
UI->ApplyCommand(command+fileName);
}
// job termination
#ifdef G4ANALYSIS_USE
delete histo;
#endif
#ifdef G4VIS_USE
delete visManager;
#endif
delete runManager;
return 0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,20 @@
# $Id: PhotonProcesses.in,v 1.1 2004/04/28 11:09:05 maire Exp $
#
# Macro file for "PhotonProcesses.cc"
# (can be run in batch, without graphic)
#
# photon 100 keV; all processes
#
/control/verbose 2
/run/verbose 2
#
/testem/det/setMat Water
/testem/det/setSize 100 m
#
/run/initialize
#
/gun/energy 100 keV
#
/testem/event/printModulo 10000
#
/run/beamOn 100000
@@ -0,0 +1,143 @@
$Id: README,v 1.3 2004/06/23 11:28:26 maire Exp $
-------------------------------------------------------------------
=========================================================
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
=========================================================
PhotonProcesses
---------------
This test is devoted to the photon processes: gamma conversion, coherent
and incoherent scattering, photoelectric effect. It allows to compute
absorption coefficients and to plot final state.
1- GEOMETRY DEFINITION
It is a single box representing a 'semi infinite' homogeneous medium.
Two parameters define the geometry :
- the material of the box,
- the (full) size of the box.
The default geometry (100 m of water) is constructed in
DetectorConstruction, but the above parameters can be changed
interactively via the commands defined in DetectorMessenger.
2- PHYSICS LIST
The particle list contains only gamma, e+, e-, mu+, mu-.
The physics list contains the 'standard' electromagnetic processes.
3- AN EVENT : THE PRIMARY GENERATOR
The primary kinematic consists of a single particle starting at the edge
of the box. The type of the particle and its energy are set in
PrimaryGeneratorAction (1 MeV gamma), and can be changed via the G4
build-in commands of ParticleGun class (see the macros provided with
this example).
4- PHYSICS
The incident particle is a photon. The event is killed at the first
interaction of the photon.
The absorption length is computed as the mean value of the track length
of the photon.
The energy spectrum and the angular distribution of the scattered photon
(if any) and of the secondaries are plotted (see SteppingAction).
A set of macros defining various run conditions are provided.
The processes are actived/inactived in order to survey the processes
individually.
5- HISTOGRAMS
The test contains 6 built-in 1D histograms, which are managed by the
HistoManager class and its Messenger. The histos can be individually
activated with the command :
/testem/histo/setHisto id nbBins valMin valMax unit
where unit is the desired unit for the histo (MeV or keV, etc..)
(see the macros xxxx.mac).
1 "scattered primary particle: energy spectrum"
2 "scattered primary particle: costheta distribution"
3 "charged secondaries: energy spectrum"
4 "charged secondaries: costheta distribution"
5 "neutral secondaries: energy spectrum"
6 "neutral secondaries: costheta distribution"
The histograms can be viewed using PAW. See below the note on
ANAPHE+AIDA.
One can control the name of the histograms file with the command:
/testem/histo/setFileName name (default photonprocesses.paw)
Note that, by default, histograms are disabled. To activate them,
uncomment the flag G4ANALYSIS_USE in GNUmakefile.
6- VISUALIZATION
The Visualization Manager is set in the main().
The initialisation of the drawing is done via the commands
/vis/... in the macro vis.mac. To get visualisation:
> /control/execute vis.mac
The detector has a default view which is a longitudinal view of the
box.
The tracks are drawn at the end of event, and erased at the end of run.
7- HOW TO START ?
compile and link to generate an executable
% cd geant4/examples/extended/electromagnetic/PhotonProcesses
% gmake
execute PhotonProcesses in 'batch' mode from macro files :
% PhotonProcesses compt.mac
execute PhotonProcesses in 'interactive mode' with visualization :
% PhotonProcesses
Idle> control/execute vis.mac
....
Idle> type your commands
....
Idle> exit
8- Using histograms
-------------------
By default the histograms are not activated. To activate histograms
the environment variable G4ANALYSIS_USE should be defined. For instance
uncomment the flag G4ANALYSIS_USE in GNUmakefile.
To use histograms any of implementations of AIDA interfaces should
be available (see http://aida.freehep.org).
A package including AIDA and extended interfaces also using Python
is PI, available from: http://cern.ch/pi .
Once installed PI or PI-Lite in a specified local area $MYPY, it is
required to add the installation path to $PATH, i.e. for example,
for release 1.2.1 of PI:
setenv PATH ${PATH}:$MYPI/1.2.1/app/releases/PI/PI_1_2_1/rh73_gcc32/bin
CERN users can use the PATH to the LCG area on AFS.
Before compilation of the example it is optimal to clean up old
files:
gmake histclean
gmake
Before running the example the command should be issued:
eval `aida-config --runtime csh`
It is possible to choose the format of the output file with
histograms using UI command:
/testem/histo/setFileType type
The following types are available: hbook, root, xml.
@@ -0,0 +1,20 @@
# $Id: allproceses.mac,v 1.1 2004/04/28 11:09:06 maire Exp $
#
# Macro file for "PhotonProcesses.cc"
# (can be run in batch, without graphic)
#
# photon 100 keV; all processes
#
/control/verbose 2
/run/verbose 2
#
/testem/det/setMat Water
/testem/det/setSize 100 m
#
/run/initialize
#
/gun/energy 100 keV
#
/testem/event/printModulo 10000
#
/run/beamOn 100000
@@ -0,0 +1,29 @@
# $Id: compton.mac,v 1.1 2004/04/28 11:09:06 maire Exp $
#
# Macro file for "PhotonProcesses.cc"
# (can be run in batch, without graphic)
#
# photon 300 keV; compton
#
/control/verbose 2
/run/verbose 2
#
/testem/det/setMat Aluminium
#
/run/initialize
#
/process/inactivate phot
/process/inactivate conv
/process/inactivate GammaToMuPair
#
/gun/energy 300 keV
#
/testem/histo/setFileName compton.paw
/testem/histo/setHisto 1 100 0. 300. keV #energy of primary
/testem/histo/setHisto 2 200 -1. +1. none #costeta of primary
/testem/histo/setHisto 3 100 0. 300. keV #energy of ch. secondary
/testem/histo/setHisto 4 200 -1. +1. none #costeta of ch. secondary
#
/testem/event/printModulo 10000
#
/run/beamOn 100000
@@ -0,0 +1,27 @@
# $Id: conv.mac,v 1.2 2004/06/10 15:55:36 maire Exp $
#
# Macro file for "PhotonProcesses.cc"
# (can be run in batch, without graphic)
#
# photon 100 MeV; gamma conversion to e+e-
#
/control/verbose 2
/run/verbose 2
#
/testem/det/setMat Lead
#
/run/initialize
#
/process/inactivate phot
/process/inactivate compt
/process/inactivate GammaToMuPair
#
/gun/energy 100 MeV
#
/testem/histo/setFileName conv.paw
/testem/histo/setHisto 3 200 0. 100. MeV #energy of ch. secondaries
/testem/histo/setHisto 4 200 0. +1. none #costeta of ch. secondaries
#
/testem/event/printModulo 10000
#
/run/beamOn 100000
@@ -0,0 +1,28 @@
# $Id: convtomu.mac,v 1.1 2004/04/28 11:09:07 maire Exp $
#
# Macro file for "PhotonProcesses.cc"
# (can be run in batch, without graphic)
#
# photon 100 TeV; gamma conversion to mu+mu-
#
/control/verbose 2
/run/verbose 2
#
/testem/det/setMat Iron
/testem/det/setSize 10 km
#
/run/initialize
#
/process/inactivate phot
/process/inactivate compt
/process/inactivate conv
#
/gun/energy 100 TeV
#
/testem/histo/setFileName convtomu.paw
/testem/histo/setHisto 3 200 0. 100. TeV #energy of ch. secondaries
/testem/histo/setHisto 4 100 0.9 1.1 none #costeta of ch. secondaries
#
/testem/event/printModulo 10000
#
/run/beamOn 100000
@@ -0,0 +1,44 @@
photonprocesses is the geant3 equivalent of PhotonProcesses
% cd geant3
% gmakeB to make an executable (Batch version)
% gmakeT to make an executable (inTeractive version)
To execute:
% cd geant3
% $G4SYSTEM/photonprocesses.xb (for batch) or photonprocesses.xt (for interactive)
The program will ask:
G3 > gives the filename of the data cards to be read:
myMacro.dat (myMacro.dat is the equivalent of the G4 myMacro.mac)
data cards
----------
Most of the data cards used in xxxx.dat are standard data cards of GEANT3,
but some of them are defined in testem5:
KEY VARIABLE/type Short description
FILE fileName (character) fileName of the histos
(the FILE data card should be the
first, with the format A4,A2,A25)
DETECTOR MAT (integer) mat.number of the absorber
THICK (real) X thickness of the absorber
histograms
----------
The list of built-in histograms is identical to TestEm5.cc
(see G4 README or histo.F)
One can control the binning of the histograms with the data card:
*HISTO id1 nbBins valMin valMax valUnit
*HISTO id2 nbBins valMin valMax valUnit
... etc ...........
valMin and ValMax are given in the desired unit, whose numerical value must
be specified in valUnit. Remember that Geant3 defaults are: GeV, cm, rad.
@@ -0,0 +1,18 @@
FILE allprocesses.paw
LIST
C
C Photon Processes; gamma 1 MeV
C
DETECTOR 3 (Water) 10000. (cm)
KINE 1 (gamma) 0.001 (GeV)
C
PHOT 1
COMP 1
PAIR 1
C
CUTS 10.e-6 (cutgam) 10.e-6 (cutele)
C
SWIT 0 (draw)
DEBUG 10 5 10000
C
TRIG 100000
@@ -0,0 +1,23 @@
FILE compton.paw
LIST
C
C Photon 300 keV; compton
C
DETECTOR 5 (Aluminium) 10000. (cm)
KINE 1 (gamma) 300.e-6 (GeV)
C
*HISTO 1 (id) 100 (nbins) 0. (Emin) 300. (Emax) 1.e-6 (keV)
*HISTO 2 (id) 200 (nbins) -1. (cost1) +1. (cost2)
*HISTO 3 (id) 100 (nbins) 0. (Emin) 300. (Emax) 1.e-6 (keV)
*HISTO 4 (id) 200 (nbins) -1. (cost1) +1. (cost2)
C
PHOT 0
COMP 1
PAIR 0
C
CUTS 10.e-6 (cutgam) 10.e-6 (cutele)
C
SWIT 0 (draw)
DEBUG 10 5 10000
C
TRIG 100000
@@ -0,0 +1,21 @@
FILE conversion.paw
LIST
C
C Photon 100 MeV; gamma conversion to e+e-
C
DETECTOR 8 (Lead) 10000. (cm)
KINE 1 (gamma) 0.1 (GeV)
C
*HISTO 3 (id) 200 (nbins) 0. (Emin) 100. (Emax) 1.e-3 (MeV)
*HISTO 4 (id) 200 (nbins) 0. (cost1) +1. (cost2)
C
PHOT 0
COMP 0
PAIR 1
C
CUTS 10.e-6 (cutgam) 10.e-6 (cutele)
C
SWIT 0 (draw)
DEBUG 10 5 10000
C
TRIG 100000
@@ -0,0 +1,32 @@
#
# @(#) Script to build a Batch geant executable
#
set name=photonprocesses
set extnam=" "
if ($G4SYSTEM == AIX-AFS) set extnam=-qextname
#
mkdir $G4SYSTEM
cd $G4SYSTEM
#
# fortran compilation
#
hepf77 $extnam -c -g -Dbatch -I/cern/pro/include -I../include ../src/*.F
#
# Link
#
echo 'linking geant3+cernlib libraries ...'
#
hepf77 $extnam -g -o $name.xb *.o \
`cernlib geant321 pawlib graflib packlib mathlib kernlib`
#
#
chmod +x $name.xb
#
# cleanup
#
rm -f *.o
echo 'done'
exit
@@ -0,0 +1,31 @@
#
# @(#) Script to build an inTeractive geant executable
#
set name=photonprocesses
set extnam=" "
if ($G4SYSTEM == AIX-AFS) set extnam=-qextname
#
mkdir $G4SYSTEM
cd $G4SYSTEM
#
# fortran compilation
#
hepf77 $extnam -c -g -I/cern/pro/include -I../include ../src/*.F
#
# Link
#
echo 'linking geant3+cernlib libraries...'
#
hepf77 $extnam -g -o $name.xt *.o \
`cernlib geant321 pawlib graflib packlib mathlib kernlib`
#
#
chmod +x $name.xt
#
# cleanup
#
rm -f *.o
echo 'done'
exit
@@ -0,0 +1,6 @@
COMMON/DETECTOR/Imat,BoxSize
*
* Imat = GEANT material number. (data card DETECTOR)
* BoxSize = total size of the box (cm) (data card DETECTOR)
*
@@ -0,0 +1,8 @@
CHARACTER*25 fileName
COMMON/HISTO1/fileName
COMMON/HISTO2/idhist,nbBins,valmin,valmax,valunit
PARAMETER (MaxHist = 6)
LOGICAL histo
COMMON/HISTO3/histo(MaxHist),histUnit(MaxHist),binWidth(MaxHist)
@@ -0,0 +1,2 @@
COMMON/PROCESS/nbCall(12),sumTrak,sumTrak2
@@ -0,0 +1,11 @@
SUBROUTINE FFUSER(ikey)
*
* The routine is called when a *key card is read
*
CHARACTER*4 keyw
*
call UHTOC(ikey,4,keyw,4)
if (keyw.eq.'HIST') call uhinit
*
END
@@ -0,0 +1,267 @@
SUBROUTINE GTGAMA
C.
C. ******************************************************************
C. * *
C. * Photon track. Computes step size and propagates particle *
C. * through step. *
C. * *
C. * ==>Called by : GTRACK *
C. * Authors R.Brun, F.Bruyant L.Urban ******** *
C. * *
C. ******************************************************************
C.
#include "geant321/gcbank.inc"
#include "geant321/gccuts.inc"
#include "geant321/gcjloc.inc"
#include "geant321/gconsp.inc"
#include "geant321/gcphys.inc"
#include "geant321/gcstak.inc"
#include "geant321/gctmed.inc"
#include "geant321/gcmulo.inc"
#include "geant321/gctrak.inc"
#include "geant321/gcunit.inc"
PARAMETER (EPSMAC=1.E-6)
DOUBLE PRECISION ONE,XCOEF1,XCOEF2,XCOEF3,ZERO
PARAMETER (ONE=1,ZERO=0)
PARAMETER (EPCUT=1.022E-3)
C.
*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
IABAN = NINT(DPHYS1)
*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
C. ------------------------------------------------------------------
*
* *** Particle below energy threshold ? Short circuit
*
*
IF (GEKIN.LE.CUTGAM) GOTO 998
*
* *** Update local pointers if medium has changed
*
IF(IUPD.EQ.0)THEN
IUPD = 1
JPHOT = LQ(JMA-6)
JCOMP = LQ(JMA-8)
JPAIR = LQ(JMA-10)
JPFIS = LQ(JMA-12)
JRAYL = LQ(JMA-13)
ENDIF
*
* *** Compute current step size
*
IPROC = 103
STEP = STEMAX
GEKRT1 = 1 .-GEKRAT
*
* ** Step limitation due to pair production ?
*
IF (GETOT.GT.EPCUT) THEN
IF (IPAIR.GT.0) THEN
STEPPA = GEKRT1*Q(JPAIR+IEKBIN) +GEKRAT*Q(JPAIR+IEKBIN+1)
SPAIR = STEPPA*ZINTPA
IF (SPAIR.LT.STEP) THEN
STEP = SPAIR
IPROC = 6
ENDIF
ENDIF
ENDIF
*
* ** Step limitation due to Compton scattering ?
*
IF (ICOMP.GT.0) THEN
STEPCO = GEKRT1*Q(JCOMP+IEKBIN) +GEKRAT*Q(JCOMP+IEKBIN+1)
SCOMP = STEPCO*ZINTCO
IF (SCOMP.LT.STEP) THEN
STEP = SCOMP
IPROC = 7
ENDIF
ENDIF
*
* ** Step limitation due to photo-electric effect ?
*
IF (GEKIN.LT.0.4) THEN
IF (IPHOT.GT.0) THEN
STEPPH = GEKRT1*Q(JPHOT+IEKBIN) +GEKRAT*Q(JPHOT+IEKBIN+1)
SPHOT = STEPPH*ZINTPH
IF (SPHOT.LT.STEP) THEN
STEP = SPHOT
IPROC = 8
ENDIF
ENDIF
ENDIF
*
* ** Step limitation due to photo-fission ?
*
IF (JPFIS.GT.0) THEN
STEPPF = GEKRT1*Q(JPFIS+IEKBIN) +GEKRAT*Q(JPFIS+IEKBIN+1)
SPFIS = STEPPF*ZINTPF
IF (SPFIS.LT.STEP) THEN
STEP = SPFIS
IPROC = 23
ENDIF
ENDIF
*
* ** Step limitation due to Rayleigh scattering ?
*
IF (IRAYL.GT.0) THEN
IF (GEKIN.LT.0.01) THEN
STEPRA = GEKRT1*Q(JRAYL+IEKBIN) +GEKRAT*Q(JRAYL+IEKBIN+1)
SRAYL = STEPRA*ZINTRA
IF (SRAYL.LT.STEP) THEN
STEP = SRAYL
IPROC = 25
ENDIF
ENDIF
ENDIF
*
IF (STEP.LT.0.) STEP = 0.
*
* ** Step limitation due to geometry ?
*
IF (STEP.GE.SAFETY) THEN
CALL GTNEXT
IF (IGNEXT.NE.0) THEN
STEP = SNEXT + PREC
INWVOL= 2
IPROC = 0
NMEC = 1
LMEC(1)=1
ENDIF
*
* Update SAFETY in stack companions, if any
IF (IQ(JSTAK+3).NE.0) THEN
DO 10 IST = IQ(JSTAK+3),IQ(JSTAK+1)
JST = JSTAK +3 +(IST-1)*NWSTAK
Q(JST+11) = SAFETY
10 CONTINUE
IQ(JSTAK+3) = 0
ENDIF
*
ELSE
IQ(JSTAK+3) = 0
ENDIF
*
* *** Linear transport
*
IF (INWVOL.EQ.2) THEN
DO 20 I = 1,3
VECTMP = VECT(I) +STEP*VECT(I+3)
IF(VECTMP.EQ.VECT(I)) THEN
*
* *** Correct for machine precision
*
IF(VECT(I+3).NE.0.) THEN
VECTMP = VECT(I)+ABS(VECT(I))*SIGN(1.,VECT(I+3))*
+ EPSMAC
IF(NMEC.GT.0) THEN
IF(LMEC(NMEC).EQ.104) NMEC=NMEC-1
ENDIF
NMEC=NMEC+1
LMEC(NMEC)=104
#ifdef G3DEBUG
WRITE(CHMAIL, 10000)
CALL GMAIL(0,0)
WRITE(CHMAIL, 10100) GEKIN, NUMED, STEP, SNEXT
CALL GMAIL(0,0)
10000 FORMAT(' Boundary correction in GTGAMA: ',
+ ' GEKIN NUMED STEP SNEXT')
10100 FORMAT(31X,E10.3,1X,I10,1X,E10.3,1X,E10.3,1X)
#endif
ENDIF
ENDIF
VECT(I) = VECTMP
20 CONTINUE
ELSE
DO 30 I = 1,3
VECT(I) = VECT(I) +STEP*VECT(I+3)
30 CONTINUE
ENDIF
*
SLENG = SLENG +STEP
*
* *** Update time of flight
*
TOFG = TOFG +STEP/CLIGHT
*
* *** Update interaction probabilities
*
IF (GETOT.GT.EPCUT) THEN
IF (IPAIR.GT.0) ZINTPA = ZINTPA -STEP/STEPPA
ENDIF
IF (ICOMP.GT.0) ZINTCO = ZINTCO -STEP/STEPCO
IF (GEKIN.LT.0.4) THEN
IF (IPHOT.GT.0) ZINTPH = ZINTPH -STEP/STEPPH
ENDIF
IF (JPFIS.GT.0) ZINTPF = ZINTPF -STEP/STEPPF
IF (IRAYL.GT.0) THEN
IF (GEKIN.LT.0.01) ZINTRA = ZINTRA -STEP/STEPRA
ENDIF
*
IF (IPROC.EQ.0) GO TO 999
NMEC = 1
LMEC(1) = IPROC
*
* ** Pair production ?
*
IF (IPROC.EQ.6) THEN
CALL GPAIRG
*
* ** Compton scattering ?
*
ELSE IF (IPROC.EQ.7) THEN
CALL GCOMP
*
* ** Photo-electric effect ?
*
ELSE IF (IPROC.EQ.8) THEN
*
IF ((IABAN.NE.0).AND.(GEKIN.LE.0.001)) THEN
* Calculate range of the photoelectron ( with kin. energy Ephot)
JCOEF = LQ(JMA-17)
IF(GEKRAT.LT.0.7) THEN
I1 = MAX(IEKBIN-1,1)
ELSE
I1 = MIN(IEKBIN,NEKBIN-1)
ENDIF
I1 = 3*(I1-1)+1
XCOEF1 = Q(JCOEF+I1)
XCOEF2 = Q(JCOEF+I1+1)
XCOEF3 = Q(JCOEF+I1+2)
IF(XCOEF1.NE.0.) THEN
STOPMX = -XCOEF2+SIGN(ONE,XCOEF1)*SQRT(XCOEF2**2 - (XCOEF3-
+ GEKIN/XCOEF1))
ELSE
STOPMX = - (XCOEF3-GEKIN)/XCOEF2
ENDIF
*
* DO NOT call GPHOT if this (overestimated) range is smaller
* than SAFETY
*
IF (STOPMX.LE.SAFETY) GOTO 998
ENDIF
CALL GPHOT
*
* ** Rayleigh effect ?
*
ELSE IF (IPROC.EQ.25) THEN
CALL GRAYL
*
* ** Photo-fission ?
*
ELSE IF (IPROC.EQ.23) THEN
CALL GPFIS
*
ENDIF
*
GOTO 999
998 DESTEP = GEKIN
GEKIN = 0.
GETOT = 0.
VECT(7)= 0.
ISTOP = 2
NMEC = 1
LMEC(1)= 30
999 END
@@ -0,0 +1,40 @@
SUBROUTINE GUKINE
*
* Generates Kinematics for primary track
*
* Data card Kine : Itype Ekine
*
#include "geant321/gcbank.inc"
#include "geant321/gcflag.inc"
#include "geant321/gckine.inc"
*
#include "detector.inc"
*
DIMENSION vertex(3),Plab(3)
dimension rndm(2)
*
DATA vertex/3*0./
DATA Plab /3*0./
*
vertex(1) = -0.5*BoxSize
*
* random in YZ
beam = 0.4*BoxSize
call GRNDM (rndm,2)
*
vertex(2) = (2*rndm(1)-1.)*beam
vertex(3) = (2*rndm(2)-1.)*beam
*
CALL GSVERT(vertex,0,0,0,0,NVERT)
*
JPA = LQ(JPART-IKINE)
XMASS = Q(JPA+7)
Plab(1) = SQRT(PKINE(1)*(PKINE(1)+2*XMASS))
*
CALL GSKINE(Plab,IKINE,NVERT,0,0,NT)
*
* *** Kinematics debug
IF (IEVENT.EQ.1.OR.IDEBUG.NE.0) CALL GPRINT('KINE',0)
*
END
@@ -0,0 +1,18 @@
SUBROUTINE GUOUT
*
* User routine called at the end of each event
*
#include "geant321/gcflag.inc"
*
* *** drawing
*
#ifndef batch
IF (ISWIT(1).NE.0) THEN
CALL GDHEAD (110110,'PhotonProcesses',0.)
CALL GDSHOW (3)
CALL GDXYZ (0)
END IF
#endif
*
END
@@ -0,0 +1,67 @@
SUBROUTINE GUSTEP
*
* User routine called at the end of each tracking step
*
#include "geant321/gcflag.inc"
#include "geant321/gckine.inc"
#include "geant321/gcking.inc"
#include "geant321/gctrak.inc"
*
#include "process.inc"
#include "histo.inc"
*
character*20 cdum
*
* *** Debug event and store tracks for drawing
IF (IDEBUG.NE.0) CALL GPCXYZ
IF (IDEBUG.NE.0) CALL GPGKIN
IF ((ISWIT(1).EQ.1).AND.(CHARGE.NE.0.)) CALL GSXYZ
IF (ISWIT(1).EQ.2) CALL GSXYZ
*
* *** if no process: return
IF (NMEC.EQ.0) return
*
* *** count nb of invoked processes
DO IM = 1,NMEC
IPROC = LMEC(IM)
IF (IPROC.EQ.21) IPROC = 12
IF (IPROC.LE.12) NBCALL(IPROC) = NBCALL(IPROC)+1
ENDDO
*
* *** sum track length for photon processes
if ((iproc.eq.6).or.(iproc.eq.7).or.(iproc.eq.8)) then
sumTrak = sumTrak + sleng
sumTrak2 = sumTrak2 + sleng*sleng
endif
*
* *** plot final state
*
* scattered primary particle (if still alive)
if (istop.eq.0) then
id = 1
if (histo(id)) call hfill (id,gekin/histUnit(id),0.,1.)
id = 2
if (histo(id)) call hfill (id,vect(4),0.,1.)
endif
*
* *** secondaries
if (ngkine.gt.0) then
do lp = 1,ngkine
ipar = gkin(5,lp) + 0.1
call gfpart(ipar,cdum,ndum,gmass,gcharg,dum,dum,ndum)
ekin = gkin(4,lp) - gmass
pc = sqrt(gkin(1,lp)**2 + gkin(2,lp)**2 + gkin(3,lp)**2)
cost = gkin(1,lp)/pc
if (gcharg.ne.0.) id = 3
if (gcharg.eq.0.) id = 5
if (histo(id)) call hfill (id,ekin/histUnit(id),0.,1.)
id = id + 1
if (histo(id)) call hfill (id,cost,0.,1.)
enddo
endif
*
* *** stop the tracking
istop = 1
*
END
@@ -0,0 +1,61 @@
#ifdef batch
PROGRAM main
*
*
PARAMETER (NGBANK=100000, NHBOOK=10000)
COMMON/GCBANK/Q(NGBANK)
COMMON/PAWC /H(NHBOOK)
*
CALL GZEBRA( NGBANK)
CALL HLIMIT(-NHBOOK)
*
* *** initialize HIGZ
CALL HPLINT(0)
*
* *** GEANT initialisation
CALL UGINIT
*
* *** Start events processing
CALL GRUN
*
* *** End of RUN
CALL UGLAST
*
STOP
END
#else
PROGRAM main
*
* GEANT main program. To link with the MOTIF user interface
* the routine GPAWPP(NWGEAN,NWPAW) should be called, whereas
* the routine GPAW(NWGEAN,NWPAW) gives access to the basic
* graphics version.
*
PARAMETER (NWGEAN=3000000, NWPAW=1000000)
COMMON/GCBANK/GEANT(NWGEAN)
COMMON/PAWC /PAW (NWPAW)
*
*
CALL GPAW (NWGEAN,NWPAW)
*
END
*
SUBROUTINE qnext
END
*
SUBROUTINE czopen
END
*
SUBROUTINE cztcp
END
*
SUBROUTINE czclos
END
*
SUBROUTINE czputa
END
#endif
@@ -0,0 +1,74 @@
SUBROUTINE UGEOM
*
* *** Define user geometry set up
*
*
#include "detector.inc"
*
DIMENSION PAR(3)
DIMENSION Aair(2),Zair(2),Wair(2)
DIMENSION AH2O(2),ZH2O(2),WH2O(2)
*
* *** Air compound parameters
DATA Aair/14.01, 16.00/
DATA Zair/ 7. , 8. /
DATA Wair/ 0.7 , 0.3 /
*
* *** Air compound parameters
DATA AH2O/ 1.01, 16.00/
DATA ZH2O/ 1. , 8. /
DATA WH2O/ 2. , 1. /
*
* *** Defines USER perticular materials
CALL GSMIXT( 1,'Air' , Aair ,Zair, 1.29E-3, 2 , Wair)
CALL GSMATE( 2,'H2 Liquid', 1.01, 1., 0.0708 , 865., 790., 0,0)
CALL GSMIXT( 3,'Water' , AH2O ,ZH2O, 1.0 ,-2 , WH2O)
CALL GSMATE( 4,'Liquid Ar', 39.95, 18., 1.39 , 14.0, 84.0, 0,0)
CALL GSMATE( 5,'Aluminium', 26.98, 13., 2.7 , 8.9, 37.2, 0,0)
CALL GSMATE( 6,'Iron' , 55.85, 26., 7.87 , 1.76, 17.1, 0,0)
CALL GSMATE( 7,'Tungsten' ,183.85, 74., 19.30 , 0.35, 18.5, 0,0)
CALL GSMATE( 8,'Lead' ,207.19, 82., 11.35 , 0.56, 18.5, 0,0)
CALL GSMATE( 9,'Uranium' ,238.03, 92., 18.95 , 0.32, 12. , 0,0)
CALL GSMATE(10,'Germanium', 72.61, 32., 5.323 , 2.30, 16.6, 0,0)
*
* *** Defines USER tracking media parameters
IFIELD = 0
FIELDM = 0.
TMAXFD = 10.0
STEMAX = 1000.
DEEMAX = 0.20
EPSIL = 0.001
STMIN = 0.010
*
CALL GSTMED( 1,'Container',Imat, 0 ,IFIELD,FIELDM,TMAXFD,
* STEMAX,DEEMAX,EPSIL,STMIN, 0 , 0 )
*
*
* *** Geometry
PAR(1) = BoxSize/2.
PAR(2) = BoxSize/2.
PAR(3) = BoxSize/2.
CALL GSVOLU('aBox','BOX ',1,PAR,3,IVOL)
*
* *** Close geometry banks. (obligatory system routine)
CALL GGCLOS
*
*
* *** dessin
CALL GSATT ('*','SEEN',1)
*
DO IX = 1,3
CALL GDOPEN (IX)
SCALE = 18./BoxSize
PAXIS = 0.
SAXIS = 0.1*BoxSize
CALL GDRAWC ('aBox',IX,0.,10.,9.3,SCALE,SCALE)
CALL GDAXIS (PAXIS,PAXIS,PAXIS,SAXIS)
CALL GDSCAL (10. , 0.3)
CALL GDCLOS
END DO
*
END
@@ -0,0 +1,66 @@
SUBROUTINE UGINIT
*
* To initialise GEANT/USER program and read data cards
*
#include "detector.inc"
#include "process.inc"
#include "histo.inc"
*
CHARACTER*20 filnam
CHARACTER*4 key
CHARACTER*2 spaces
*
* *** Define the GEANT parameters
CALL GINIT
*
* histograms
do ih = 1,MaxHist
histo(ih) = .false.
enddo
*
* *** Detector definition
CALL FFKEY('DETECTOR',Imat,2,'MIXED')
*
* histograms
CALL FFKEY('HISTO',idhist,5,'MIXED')
*
* *** read data cards
PRINT *, 'G3 > gives the filename of the data cards to be read:'
READ (*,'(A)') filnam
IF (filnam.EQ.' ') filnam = 'allprocesses.dat'
OPEN (unit=5,file=filnam,status='unknown',form='formatted')
*
* filename should be 1st data card !
fileName = 'photonprocesses.paw'
READ(5,98)key,spaces,fileName
98 FORMAT(A4,A2,A25)
*
* *** read data cards
CALL GFFGO
*
write(6,99) fileName
99 FORMAT(/,15x,'histogram file --> Name: ',A25)
*
CALL GZINIT
CALL GPART
*
CALL GDINIT
*
* *** Geometry and materials description
CALL UGEOM
*
* *** Energy loss and cross-sections initialisations
CALL GPHYSI
*
CALL GPRINT('MATE',0)
CALL GPRINT('TMED',0)
CALL GPRINT('VOLU',0)
*
* *** initialisation of /process/
CALL VZERO (nbCall,12)
sumTrak = 0.
sumTrak2 = 0.
*
END
@@ -0,0 +1,63 @@
SUBROUTINE UGLAST
*
* Termination routine to print histograms and statistics
*
#include "geant321/gcflag.inc"
#include "geant321/gckine.inc"
#include "geant321/gctrak.inc"
*
#include "detector.inc"
#include "process.inc"
#include "histo.inc"
*
character*20 material, particle
character*4 unit
real massMFP, massAC
*
* *** run conditions
call gfmate(Imat,material,dum,dum,density,dum,dum,dum,ndum)
call gfpart(Ikine,particle,ndum,dum,dum,dum,dum,ndum)
call gevkev(pkine(1),energy,unit)
PRINT 750, ievent,particle,energy,unit,boxSize,material,density
*
* *** frequency of processes call
CALL UCTOH('MUNU',NAMEC(12),4,4)
PRINT 760,(NAMEC(I),I=1,12)
PRINT 761,(NBCALL(I),I=1,12)
*
* *** compute mean free path and related quantities
nbProc = nbcall(6) + nbcall(7) + nbcall(8)
avTrak = sumTrak /nbProc
avTrak2 = sumTrak2/nbProc
rms = sqrt(abs(avTrak2 - avTrak*avTrak))
AtteCoef = 1./avTrak
*
massMFP = avTrak*density
massAC = 1./massMFP
print 770, avTrak,rms,massMFP,AtteCoef,massAC
*
* *** geant termination
CALL GLAST
*
* *** close HIGZ file
CALL HPLEND
*
* *** histograms
CALL HRPUT(0,fileName,'N')
*
* *** formats
*
750 FORMAT(/,1X,'The run consists of ',I7,1X,A8,' of ',F7.2,A4,
+ ' throught',F10.2,' cm of ',A8,' (density: ',F7.3,' g/cm3)')
760 FORMAT(/,1X,'Frequency of process calls: ',
+ /,1X,12A8)
761 FORMAT( 1X,12I8,/)
770 FORMAT(/,1X,'MeanFreePath: ',F12.5,' cm +- ',F12.5,' cm',
+ 5X,'massic: ',F12.5,' g/cm2',
+ /,1X,'AttenuationCoef: ',F12.5,' cm^-1 ',15X,
+ 5X,'massic: ',F12.5,' cm2/g',/)
*
END
@@ -0,0 +1,28 @@
SUBROUTINE UHINIT
*
*
#include "histo.inc"
*
CHARACTER*50 title(6)
*
data title /
1 'scattered primary particle: energy spectrum',
2 'scattered primary particle: costheta distribution',
3 'charged secondaries: energy spectrum',
4 'charged secondaries: costheta distribution',
5 'neutral secondaries: energy spectrum',
6 'neutral secondaries: costheta distribution' /
*
if (histo(idhist)) call hdelet(idhist)
*
vmin = valmin
vmax = valmax
call hbook1(idhist,title(idhist),nbBins,vmin,vmax,0.)
*
histo (idhist) = .true.
binWidth(idhist) = (valmax-valmin)/nbBins
if (valunit.le.0.) valunit = 1.
histUnit(idhist) = valunit
*
END
@@ -0,0 +1,89 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: DetectorConstruction.hh,v 1.1 2004/04/28 11:11:54 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef DetectorConstruction_h
#define DetectorConstruction_h 1
#include "G4VUserDetectorConstruction.hh"
#include "globals.hh"
class G4LogicalVolume;
class G4Material;
class DetectorMessenger;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class DetectorConstruction : public G4VUserDetectorConstruction
{
public:
DetectorConstruction();
~DetectorConstruction();
public:
G4VPhysicalVolume* Construct();
void SetSize (G4double);
void SetMaterial (G4String);
void UpdateGeometry();
public:
const
G4VPhysicalVolume* GetWorld() {return pBox;};
G4double GetSize() {return BoxSize;};
G4Material* GetMaterial() {return aMaterial;};
void PrintParameters();
private:
G4VPhysicalVolume* pBox;
G4LogicalVolume* lBox;
G4double BoxSize;
G4Material* aMaterial;
DetectorMessenger* detectorMessenger;
private:
void DefineMaterials();
G4VPhysicalVolume* ConstructVolumes();
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,69 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: DetectorMessenger.hh,v 1.1 2004/04/28 11:11:54 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef DetectorMessenger_h
#define DetectorMessenger_h 1
#include "G4UImessenger.hh"
#include "globals.hh"
class DetectorConstruction;
class G4UIdirectory;
class G4UIcmdWithAString;
class G4UIcmdWithADoubleAndUnit;
class G4UIcmdWithoutParameter;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class DetectorMessenger: public G4UImessenger
{
public:
DetectorMessenger(DetectorConstruction* );
~DetectorMessenger();
void SetNewValue(G4UIcommand*, G4String);
private:
DetectorConstruction* Detector;
G4UIdirectory* testemDir;
G4UIdirectory* detDir;
G4UIcmdWithAString* MaterCmd;
G4UIcmdWithADoubleAndUnit* SizeCmd;
G4UIcmdWithoutParameter* UpdateCmd;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,62 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: EventAction.hh,v 1.1 2004/04/28 11:11:54 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef EventAction_h
#define EventAction_h 1
#include "G4UserEventAction.hh"
#include "globals.hh"
class EventActionMessenger;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class EventAction : public G4UserEventAction
{
public:
EventAction();
~EventAction();
public:
void BeginOfEventAction(const G4Event*);
void EndOfEventAction(const G4Event*);
void SetPrintModulo(G4int val) {printModulo = val;};
private:
G4int printModulo;
EventActionMessenger* eventMessenger;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,60 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: EventActionMessenger.hh,v 1.1 2004/04/28 11:11:55 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef EventActionMessenger_h
#define EventActionMessenger_h 1
#include "G4UImessenger.hh"
#include "globals.hh"
class EventAction;
class G4UIdirectory;
class G4UIcmdWithAnInteger;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class EventActionMessenger: public G4UImessenger
{
public:
EventActionMessenger(EventAction*);
~EventActionMessenger();
void SetNewValue(G4UIcommand*, G4String);
private:
EventAction* eventAction;
G4UIdirectory* eventDir;
G4UIcmdWithAnInteger* PrintCmd;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,92 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: HistoManager.hh,v 1.2 2004/06/10 15:55:36 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef HistoManager_h
#define HistoManager_h 1
#ifdef USE_AIDA
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
namespace AIDA {
class ITree;
class IHistogramFactory;
class IHistogram1D;
}
class HistoMessenger;
const G4int MaxHisto = 7;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class HistoManager
{
public:
HistoManager();
~HistoManager();
void SetFileName (G4String name) { fileName = name;};
void SetFactory ();
void SaveFactory ();
void SetHisto (G4int, G4int, G4double, G4double, G4String unit="none");
void RemoveHisto (G4int);
AIDA::ITree* GetTree() {return tree;}
AIDA::IHistogramFactory* GetHistogramFactory() {return hf;}
AIDA::IHistogram1D* GetHisto(G4int id) {return histo[id];}
G4double GetHistoUnit(G4int id) {return Unit[id];}
G4double GetBinWidth (G4int id) {return Width[id];}
private:
G4String fileName;
AIDA::ITree* tree;
AIDA::IHistogramFactory* hf;
AIDA::IHistogram1D* histo[MaxHisto];
G4bool exist[MaxHisto];
G4String Label[MaxHisto];
G4String Title[MaxHisto];
G4int Nbins[MaxHisto];
G4double Vmin [MaxHisto];
G4double Vmax [MaxHisto];
G4double Unit [MaxHisto];
G4double Width[MaxHisto];
G4bool factoryOn;
HistoMessenger* histoMessenger;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
#endif
@@ -0,0 +1,70 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: HistoMessenger.hh,v 1.2 2004/06/10 15:55:36 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef HistoMessenger_h
#define HistoMessenger_h 1
#ifdef G4ANALYSIS_USE
#include "G4UImessenger.hh"
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class HistoManager;
class G4UIdirectory;
class G4UIcommand;
class G4UIcmdWithAString;
class G4UIcmdWithAnInteger;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class HistoMessenger: public G4UImessenger
{
public:
HistoMessenger(HistoManager* );
~HistoMessenger();
void SetNewValue(G4UIcommand* ,G4String );
private:
HistoManager* histoManager;
G4UIdirectory* histoDir;
G4UIcmdWithAString* factoryCmd;
G4UIcommand* histoCmd;
G4UIcmdWithAnInteger* rmhistoCmd;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
#endif
@@ -0,0 +1,64 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: PhysListEmStandard.hh,v 1.1 2004/04/28 11:11:55 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef PhysListEmStandard_h
#define PhysListEmStandard_h 1
#include "G4VPhysicsConstructor.hh"
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class PhysListEmStandard : public G4VPhysicsConstructor
{
public:
PhysListEmStandard(const G4String& name = "standard");
~PhysListEmStandard();
public:
// This method is dummy for physics
void ConstructParticle() {};
// This method will be invoked in the Construct() method.
// each physics process will be instantiated and
// registered to the process manager of each particle type
void ConstructProcess();
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,67 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: PhysicsList.hh,v 1.1 2004/04/28 11:11:55 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//
// 14.10.02 (V.Ivanchenko) provide modular list on base of old PhysicsList
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef PhysicsList_h
#define PhysicsList_h 1
#include "G4VModularPhysicsList.hh"
#include "globals.hh"
class G4VPhysicsConstructor;
class PhysicsListMessenger;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class PhysicsList: public G4VModularPhysicsList
{
public:
PhysicsList();
~PhysicsList();
void ConstructParticle();
void ConstructProcess();
void AddPhysicsList(const G4String& name);
void SetCuts();
private:
G4String emName;
G4VPhysicsConstructor* emPhysicsList;
PhysicsListMessenger* messenger;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,64 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: PhysicsListMessenger.hh,v 1.1 2004/04/28 11:11:55 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef PhysicsListMessenger_h
#define PhysicsListMessenger_h 1
#include "G4UImessenger.hh"
#include "globals.hh"
class PhysicsList;
class G4UIdirectory;
class G4UIcmdWithAString;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class PhysicsListMessenger: public G4UImessenger
{
public:
PhysicsListMessenger(PhysicsList* );
~PhysicsListMessenger();
void SetNewValue(G4UIcommand*, G4String);
private:
PhysicsList* physicsList;
G4UIdirectory* physDir;
G4UIcmdWithAString* pListCmd;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,62 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: PrimaryGeneratorAction.hh,v 1.1 2004/04/28 11:11:55 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef PrimaryGeneratorAction_h
#define PrimaryGeneratorAction_h 1
#include "G4VUserPrimaryGeneratorAction.hh"
#include "G4ParticleGun.hh"
#include "globals.hh"
class G4Event;
class DetectorConstruction;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
{
public:
PrimaryGeneratorAction(DetectorConstruction*);
~PrimaryGeneratorAction();
public:
void GeneratePrimaries(G4Event*);
G4ParticleGun* GetParticleGun() {return particleGun;};
private:
G4ParticleGun* particleGun;
DetectorConstruction* detector;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,65 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: ProcessesCount.hh,v 1.1 2004/04/28 11:11:55 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef ProcessesCount_HH
#define ProcessesCount_HH
#include "globals.hh"
#include <vector>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class OneProcessCount
{
public:
OneProcessCount(G4String name) {Name=name; Counter=0;};
~OneProcessCount() {};
public:
G4String GetName() {return Name;};
G4int GetCounter() {return Counter;};
void Count() {Counter++;};
private:
G4String Name; // process name
G4int Counter; // process counter
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
typedef std::vector<OneProcessCount*> ProcessesCount;
#endif
@@ -0,0 +1,76 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: RunAction.hh,v 1.2 2004/06/10 15:55:37 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef RunAction_h
#define RunAction_h 1
#include "G4UserRunAction.hh"
#include "ProcessesCount.hh"
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class DetectorConstruction;
class PrimaryGeneratorAction;
class HistoManager;
class G4Run;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class RunAction : public G4UserRunAction
{
public:
RunAction(DetectorConstruction*, PrimaryGeneratorAction*, HistoManager*);
~RunAction();
public:
void BeginOfRunAction(const G4Run*);
void EndOfRunAction(const G4Run*);
void CountProcesses(G4String);
void SumTrack (G4double track)
{totalCount++; sumTrack += track; sumTrack2 += track*track;};
private:
DetectorConstruction* detector;
PrimaryGeneratorAction* primary;
ProcessesCount* ProcCounter;
HistoManager* histoManager;
G4int totalCount; //all processes counter
G4double sumTrack; //sum of trackLength
G4double sumTrack2; //sum of trackLength*trackLength
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,57 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: SteppingAction.hh,v 1.1 2004/04/28 11:11:55 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef SteppingAction_h
#define SteppingAction_h 1
#include "G4UserSteppingAction.hh"
class RunAction;
class HistoManager;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class SteppingAction : public G4UserSteppingAction
{
public:
SteppingAction(RunAction*, HistoManager*);
~SteppingAction();
void UserSteppingAction(const G4Step*);
private:
RunAction* runAction;
HistoManager* histoManager;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,55 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: SteppingVerbose.hh,v 1.1 2004/04/28 11:11:55 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// This class manages the verbose outputs in G4SteppingManager.
// It inherits from G4SteppingVerbose.
// It shows how to extract informations during the tracking of a particle.
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef SteppingVerbose_h
#define SteppingVerbose_h 1
#include "G4SteppingVerbose.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class SteppingVerbose : public G4SteppingVerbose {
public:
SteppingVerbose();
~SteppingVerbose();
void StepInfo();
void TrackingStarted();
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,68 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: VisManager.hh,v 1.1 2004/04/28 11:11:56 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
// Example Visualization Manager implementing virtual function
// RegisterGraphicsSystems. Exploits C-pre-processor variables
// G4VIS_USE_DAWN, etc., which are set by the GNUmakefiles if
// environment variables of the same name are set.
// So all you have to do is set environment variables and compile and
// instantiate this in your main().
// Alternatively, you can implement an empty function here and just
// register the systems you want in your main(), e.g.:
// G4VisManager* myVisManager = new MyVisManager;
// myVisManager -> RegisterGraphicsSystem (new MyGraphicsSystem);
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef VisManager_h
#define VisManager_h 1
#include "G4VisManager.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class VisManager: public G4VisManager {
public:
VisManager ();
private:
void RegisterGraphicsSystems ();
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,28 @@
# $Id: phot.mac,v 1.1 2004/04/28 11:09:07 maire Exp $
#
# Macro file for "PhotonProcesses.cc"
# (can be run in batch, without graphic)
#
# photon 100 keV; photoelectric
#
/control/verbose 2
/run/verbose 2
#
#/testem/det/setMat Iron
/testem/det/setMat BGO
#
/run/initialize
#
/process/inactivate compt
/process/inactivate conv
/process/inactivate GammaToMuPair
#
/gun/energy 100 keV
#
/testem/histo/setFileName phot.paw
/testem/histo/setHisto 3 100 0. 100. keV #energy of ch. secondaries
/testem/histo/setHisto 4 200 -1. +1. none #costeta of ch. secondaries
#
/testem/event/printModulo 10000
#
/run/beamOn 100000
@@ -0,0 +1,201 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: DetectorConstruction.cc,v 1.1 2004/04/28 11:12:38 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
//....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 "G4GeometryManager.hh"
#include "G4PhysicalVolumeStore.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4SolidStore.hh"
#include "G4UnitsTable.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
DetectorConstruction::DetectorConstruction()
:pBox(0), lBox(0), aMaterial(0)
{
BoxSize = 100*m;
DefineMaterials();
SetMaterial("Water");
detectorMessenger = new DetectorMessenger(this);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
DetectorConstruction::~DetectorConstruction()
{ delete detectorMessenger;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume* DetectorConstruction::Construct()
{
return ConstructVolumes();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::DefineMaterials()
{
//
// define Elements
//
G4double z,a;
G4Element* H = new G4Element("Hydrogen" ,"H" , z= 1., a= 1.01*g/mole);
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);
G4Element* Ge = new G4Element("Germanium","Ge", z=32., a= 72.59*g/mole);
G4Element* Bi = new G4Element("Bismuth" ,"Bi", z=83., a= 208.98*g/mole);
//
// define materials
//
G4double density;
G4int ncomponents, natoms;
G4double fractionmass;
G4Material* Air =
new G4Material("Air", density= 1.290*mg/cm3, ncomponents=2);
Air->AddElement(N, fractionmass=70.*perCent);
Air->AddElement(O, fractionmass=30.*perCent);
G4Material* H2l =
new G4Material("H2liquid", density= 70.8*mg/cm3, ncomponents=1);
H2l->AddElement(H, fractionmass=1.);
G4Material* H2O =
new G4Material("Water", density= 1.000*g/cm3, ncomponents=2);
H2O->AddElement(H, natoms=2);
H2O->AddElement(O, natoms=1);
H2O->SetChemicalFormula("H_2O");
H2O->GetIonisation()->SetMeanExcitationEnergy(75.0*eV);
new G4Material("liquidArgon", z=18., a= 39.95*g/mole, density= 1.390*g/cm3);
new G4Material("Aluminium" , z=13., a= 26.98*g/mole, density= 2.700*g/cm3);
new G4Material("Silicon" , z=14., a= 28.09*g/mole, density= 2.330*g/cm3);
new G4Material("Germanium" , z=32., a= 72.61*g/mole, density= 5.323*g/cm3);
G4Material* BGO =
new G4Material("BGO", density= 7.10*g/cm3, ncomponents=3);
BGO->AddElement(O , natoms=12);
BGO->AddElement(Ge, natoms= 3);
BGO->AddElement(Bi, natoms= 4);
new G4Material("Iron" , z=26., a= 55.85*g/mole, density= 7.870*g/cm3);
new G4Material("Tungsten" , z=74., a=183.85*g/mole, density= 19.30*g/cm3);
new G4Material("Lead" , z=82., a=207.19*g/mole, density= 11.35*g/cm3);
new G4Material("Uranium" , z=92., a=238.03*g/mole, density= 18.95*g/cm3);
G4cout << *(G4Material::GetMaterialTable()) << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume* DetectorConstruction::ConstructVolumes()
{
// Cleanup old geometry
G4GeometryManager::GetInstance()->OpenGeometry();
G4PhysicalVolumeStore::GetInstance()->Clean();
G4LogicalVolumeStore::GetInstance()->Clean();
G4SolidStore::GetInstance()->Clean();
G4Box*
sBox = new G4Box("Container", //its name
BoxSize/2,BoxSize/2,BoxSize/2); //its dimensions
lBox = new G4LogicalVolume(sBox, //its shape
aMaterial, //its material
aMaterial->GetName()); //its name
pBox = new G4PVPlacement(0, //no rotation
G4ThreeVector(), //at (0,0,0)
lBox, //its logical volume
aMaterial->GetName(), //its name
0, //its mother volume
false, //no boolean operation
0); //copy number
PrintParameters();
//always return the root volume
//
return pBox;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::PrintParameters()
{
G4cout << "\n The Box is " << G4BestUnit(BoxSize,"Length")
<< " of " << aMaterial->GetName() << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::SetMaterial(G4String materialChoice)
{
// search the material by its name
G4Material* pttoMaterial = G4Material::GetMaterial(materialChoice);
if (pttoMaterial) aMaterial = pttoMaterial;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::SetSize(G4double value)
{
BoxSize = value;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4RunManager.hh"
void DetectorConstruction::UpdateGeometry()
{
G4RunManager::GetRunManager()->DefineWorldVolume(ConstructVolumes());
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,95 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: DetectorMessenger.cc,v 1.1 2004/04/28 11:12:39 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "DetectorMessenger.hh"
#include "DetectorConstruction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithoutParameter.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
DetectorMessenger::DetectorMessenger(DetectorConstruction * Det)
:Detector(Det)
{
testemDir = new G4UIdirectory("/testem/");
testemDir->SetGuidance("commands specific to this example");
detDir = new G4UIdirectory("/testem/det/");
detDir->SetGuidance("detector construction");
MaterCmd = new G4UIcmdWithAString("/testem/det/setMat",this);
MaterCmd->SetGuidance("Select material of the box.");
MaterCmd->SetParameterName("choice",false);
MaterCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
SizeCmd = new G4UIcmdWithADoubleAndUnit("/testem/det/setSize",this);
SizeCmd->SetGuidance("Set size of the box");
SizeCmd->SetParameterName("Size",false);
SizeCmd->SetRange("Size>0.");
SizeCmd->SetUnitCategory("Length");
SizeCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
UpdateCmd = new G4UIcmdWithoutParameter("/testem/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 SizeCmd;
delete UpdateCmd;
delete detDir;
delete testemDir;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
{
if( command == MaterCmd )
{ Detector->SetMaterial(newValue);}
if( command == SizeCmd )
{ Detector->SetSize(SizeCmd->GetNewDoubleValue(newValue));}
if( command == UpdateCmd )
{ Detector->UpdateGeometry(); }
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,86 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: EventAction.cc,v 1.1 2004/04/28 11:12:39 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
//....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"
#include "G4UnitsTable.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
EventAction::EventAction()
: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]);
trj->DrawTrajectory(1000);
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,69 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: EventActionMessenger.cc,v 1.1 2004/04/28 11:12:39 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "EventActionMessenger.hh"
#include "EventAction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAnInteger.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
EventActionMessenger::EventActionMessenger(EventAction* EvAct)
:eventAction(EvAct)
{
eventDir = new G4UIdirectory("/testem/event/");
eventDir ->SetGuidance("physics list");
PrintCmd = new G4UIcmdWithAnInteger("/testem/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 PrintCmd;
delete eventDir;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void EventActionMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
{
if (command == PrintCmd)
{eventAction->SetPrintModulo(PrintCmd->GetNewIntValue(newValue));}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,168 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: HistoManager.cc,v 1.2 2004/06/10 15:55:37 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifdef USE_AIDA
#include "HistoManager.hh"
#include "HistoMessenger.hh"
#include "AIDA/AIDA.h"
#include "G4UnitsTable.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
HistoManager::HistoManager()
:tree(0),hf(0),factoryOn(false)
{
fileName = "photonprocesses.paw";
// histograms
for (G4int k=0; k<MaxHisto; k++) { histo[k] = 0; exist[k] = false;}
histoMessenger = new HistoMessenger(this);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
HistoManager::~HistoManager()
{
SaveFactory();
delete histoMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HistoManager::SetFactory()
{
if (factoryOn) {
G4cout << "\n--->HistoManager::SetFactory(): factory already exists"
<< G4endl;
SaveFactory();
}
// Creating the analysis factory
AIDA::IAnalysisFactory* af = AIDA_createAnalysisFactory();
// Creating the tree factory
AIDA::ITreeFactory* tf = af->createTreeFactory();
// Creating a tree mapped to an hbook file.
G4bool readOnly = false;
G4bool createNew = true;
tree = tf->create(fileName, "hbook", readOnly, createNew);
// Creating a histogram factory, whose histograms will be handled by the tree
hf = af->createHistogramFactory(*tree);
// create selected histograms
for (G4int k=0; k<MaxHisto; k++) {
if (exist[k]) histo[k] = hf->createHistogram1D( Label[k], Title[k],
Nbins[k], Vmin[k], Vmax[k]);
}
delete tf;
delete af;
factoryOn = true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HistoManager::SaveFactory()
{
if (factoryOn) {
tree->commit(); // Writing the histograms to the file
tree->close(); // and closing the tree (and the file)
delete hf;
delete tree;
factoryOn = false;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HistoManager::SetHisto(G4int ih,
G4int nbins, G4double valmin, G4double valmax, G4String unit)
{
if (ih > MaxHisto) {
G4cout << "---> warning from HistoManager::SetHisto() : histo " << ih
<< "does not exist" << G4endl;
return;
}
const G4String id[] = { "0", "1", "2", "3", "4", "5", "6"};
const G4String title[] =
{ "dummy", //0
"scattered primary particle: energy spectrum", //1
"scattered primary particle: costheta distribution", //2
"charged secondaries: energy spectrum", //3
"charged secondaries: costheta distribution", //4
"neutral secondaries: energy spectrum", //5
"neutral secondaries: costheta distribution" //6
};
G4String titl = title[ih];
G4double vmin = valmin, vmax = valmax;
Unit[ih] = 1.;
if (unit != "none") {
titl = title[ih] + " (" + unit + ")";
Unit[ih] = G4UnitDefinition::GetValueOf(unit);
vmin = valmin/Unit[ih]; vmax = valmax/Unit[ih];
}
exist[ih] = true;
Label[ih] = id[ih];
Title[ih] = titl;
Nbins[ih] = nbins;
Vmin[ih] = vmin;
Vmax[ih] = vmax;
Width[ih] = (valmax-valmin)/nbins;
G4cout << "----> SetHisto " << ih << ": " << titl << "; "
<< nbins << " bins from "
<< vmin << " " << unit << " to " << vmax << " " << unit << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HistoManager::RemoveHisto(G4int ih)
{
if (ih > MaxHisto) {
G4cout << "---> warning from HistoManager::RemoveHisto() : histo " << ih
<< "does not exist" << G4endl;
return;
}
histo[ih] = 0; exist[ih] = false;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,119 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: HistoMessenger.cc,v 1.2 2004/06/10 15:55:37 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifdef G4ANALYSIS_USE
#include "HistoMessenger.hh"
#include "HistoManager.hh"
#include "G4UIdirectory.hh"
#include "G4UIcommand.hh"
#include "G4UIparameter.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithAnInteger.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
HistoMessenger::HistoMessenger(HistoManager* manager)
:histoManager (manager)
{
histoDir = new G4UIdirectory("/testem/histo/");
histoDir->SetGuidance("histograms control");
factoryCmd = new G4UIcmdWithAString("/testem/histo/setFileName",this);
factoryCmd->SetGuidance("set name for the histograms file");
histoCmd = new G4UIcommand("/testem/histo/setHisto",this);
histoCmd->SetGuidance("Set bining of the histo number ih :");
histoCmd->SetGuidance(" nbBins; valMin; valMax; unit (of vmin and vmax)");
//
G4UIparameter* ih = new G4UIparameter("ih",'i',false);
ih->SetGuidance("histo number : from 1 to MaxHisto");
ih->SetParameterRange("ih>0");
histoCmd->SetParameter(ih);
//
G4UIparameter* nbBins = new G4UIparameter("nbBins",'i',false);
nbBins->SetGuidance("number of bins");
nbBins->SetParameterRange("nbBins>0");
histoCmd->SetParameter(nbBins);
//
G4UIparameter* valMin = new G4UIparameter("valMin",'d',false);
valMin->SetGuidance("valMin, expressed in unit");
histoCmd->SetParameter(valMin);
//
G4UIparameter* valMax = new G4UIparameter("valMax",'d',false);
valMax->SetGuidance("valMax, expressed in unit");
histoCmd->SetParameter(valMax);
//
G4UIparameter* unit = new G4UIparameter("unit",'s',true);
unit->SetGuidance("if omitted, vmin and vmax are assumed dimensionless");
unit->SetDefaultValue("none");
histoCmd->SetParameter(unit);
rmhistoCmd = new G4UIcmdWithAnInteger("/testem/histo/removeHisto",this);
rmhistoCmd->SetGuidance("desactivate histo #id");
rmhistoCmd->SetParameterName("id",false);
rmhistoCmd->SetRange("id>0");
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
HistoMessenger::~HistoMessenger()
{
delete rmhistoCmd;
delete histoCmd;
delete factoryCmd;
delete histoDir;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HistoMessenger::SetNewValue(G4UIcommand* command, G4String newValues)
{
if (command == factoryCmd)
histoManager->SetFileName(newValues);
if (command == histoCmd)
{ G4int ih,nbBins; G4double vmin,vmax; char unts[30];
const char* t = newValues;
std::istrstream is((char*)t);
is >> ih >> nbBins >> vmin >> vmax >> unts;
G4String unit = unts;
G4double vUnit = 1. ;
if (unit != "none") vUnit = G4UIcommand::ValueOf(unit);
histoManager->SetHisto (ih,nbBins,vmin*vUnit,vmax*vUnit,unit);
}
if (command == rmhistoCmd)
{ histoManager->RemoveHisto(rmhistoCmd->GetNewIntValue(newValues));}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,92 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: PhysListEmStandard.cc,v 1.1 2004/04/28 11:12:39 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "PhysListEmStandard.hh"
#include "G4ParticleDefinition.hh"
#include "G4ProcessManager.hh"
#include "G4PhotoElectricEffect.hh"
#include "G4ComptonScattering.hh"
#include "G4GammaConversion.hh"
#include "G4GammaConversionToMuons.hh"
#include "G4MultipleScattering.hh"
#include "G4eIonisation.hh"
#include "G4eBremsstrahlung.hh"
#include "G4eplusAnnihilation.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PhysListEmStandard::PhysListEmStandard(const G4String& name)
: G4VPhysicsConstructor(name)
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PhysListEmStandard::~PhysListEmStandard()
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PhysListEmStandard::ConstructProcess()
{
// Add standard EM Processes
theParticleIterator->reset();
while( (*theParticleIterator)() ){
G4ParticleDefinition* particle = theParticleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
G4String particleName = particle->GetParticleName();
if (particleName == "gamma") {
// gamma
pmanager->AddDiscreteProcess(new G4PhotoElectricEffect);
pmanager->AddDiscreteProcess(new G4ComptonScattering);
pmanager->AddDiscreteProcess(new G4GammaConversion);
pmanager->AddDiscreteProcess(new G4GammaConversionToMuons);
} else if (particleName == "e-") {
//electron
pmanager->AddProcess(new G4MultipleScattering, -1, 1,1);
pmanager->AddProcess(new G4eIonisation, -1, 2,2);
pmanager->AddProcess(new G4eBremsstrahlung, -1, 3,3);
} else if (particleName == "e+") {
//positron
pmanager->AddProcess(new G4MultipleScattering, -1, 1,1);
pmanager->AddProcess(new G4eIonisation, -1, 2,2);
pmanager->AddProcess(new G4eBremsstrahlung, -1, 3,3);
pmanager->AddProcess(new G4eplusAnnihilation, 0,-1,4);
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,117 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: PhysicsList.cc,v 1.1 2004/04/28 11:12:39 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "PhysicsList.hh"
#include "PhysicsListMessenger.hh"
#include "PhysListEmStandard.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PhysicsList::PhysicsList()
: G4VModularPhysicsList()
{
defaultCutValue = 1.0*mm;
messenger = new PhysicsListMessenger(this);
// EM physics
emName = G4String("standard");
emPhysicsList = new PhysListEmStandard(emName);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PhysicsList::~PhysicsList()
{
delete messenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4Geantino.hh"
#include "G4Gamma.hh"
#include "G4Electron.hh"
#include "G4Positron.hh"
#include "G4MuonMinus.hh"
#include "G4MuonPlus.hh"
void PhysicsList::ConstructParticle()
{
G4Geantino::GeantinoDefinition();
G4Gamma::GammaDefinition();
G4Electron::ElectronDefinition();
G4Positron::PositronDefinition();
G4MuonMinus::MuonMinusDefinition();
G4MuonPlus::MuonPlusDefinition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PhysicsList::ConstructProcess()
{
AddTransportation();
emPhysicsList->ConstructProcess();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PhysicsList::AddPhysicsList(const G4String& name)
{
G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
if (name == emName) return;
if (name == "standard") {
emName = name;
delete emPhysicsList;
emPhysicsList = new PhysListEmStandard(name);
} else {
G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
<< " is not defined"
<< G4endl;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PhysicsList::SetCuts()
{
// set cut values for gamma at first and for e- second and next for e+,
// because some processes for e+/e- need cut values for gamma
SetCutValue(defaultCutValue, "gamma");
SetCutValue(defaultCutValue, "e-");
SetCutValue(defaultCutValue, "e+");
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,67 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: PhysicsListMessenger.cc,v 1.1 2004/04/28 11:12:39 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "PhysicsListMessenger.hh"
#include "PhysicsList.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAString.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PhysicsListMessenger::PhysicsListMessenger(PhysicsList* pPhys)
:physicsList(pPhys)
{
physDir = new G4UIdirectory("/testem/phys/");
physDir ->SetGuidance("physics list");
pListCmd = new G4UIcmdWithAString("/testem/phys/addPhysics",this);
pListCmd->SetGuidance("Add modular physics list");
pListCmd->SetParameterName("PList",false);
pListCmd->AvailableForStates(G4State_PreInit);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PhysicsListMessenger::~PhysicsListMessenger()
{
delete pListCmd;
delete physDir;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PhysicsListMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
{
if (command == pListCmd)
{physicsList->AddPhysicsList(newValue);}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,80 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: PrimaryGeneratorAction.cc,v 1.1 2004/04/28 11:12:39 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "PrimaryGeneratorAction.hh"
#include "DetectorConstruction.hh"
#include "G4Event.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("gamma");
particleGun->SetParticleDefinition(particle);
particleGun->SetParticleEnergy(1*MeV);
particleGun->SetParticleMomentumDirection(G4ThreeVector(1.,0.,0.));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PrimaryGeneratorAction::~PrimaryGeneratorAction()
{
delete particleGun;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
//this function is called at the begining of event
//
G4double halfSize = 0.5*(detector->GetSize());
G4double x0 = - halfSize;
//randomize (y0,z0)
//
G4double beam = 0.8*halfSize;
G4double y0 = (2*G4UniformRand()-1.)*beam;
G4double z0 = (2*G4UniformRand()-1.)*beam;
particleGun->SetParticlePosition(G4ThreeVector(x0,y0,z0));
particleGun->GeneratePrimaryVertex(anEvent);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,164 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: RunAction.cc,v 1.2 2004/06/10 15:55:38 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "RunAction.hh"
#include "DetectorConstruction.hh"
#include "PrimaryGeneratorAction.hh"
#include "HistoManager.hh"
#include "G4Run.hh"
#include "G4RunManager.hh"
#include "G4UnitsTable.hh"
#include "Randomize.hh"
#include <iomanip>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RunAction::RunAction(DetectorConstruction* det, PrimaryGeneratorAction* prim,
HistoManager* histo)
: detector(det), primary(prim), ProcCounter(0), histoManager(histo)
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RunAction::~RunAction()
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RunAction::BeginOfRunAction(const G4Run* aRun)
{
G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
// save Rndm status
G4RunManager::GetRunManager()->SetRandomNumberStore(true);
HepRandom::showEngineStatus();
ProcCounter = new ProcessesCount;
totalCount = 0;
sumTrack = sumTrack2 = 0.;
#ifdef G4ANALYSIS_USE
histoManager->SetFactory();
#endif
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RunAction::CountProcesses(G4String procName)
{
//does the process already encounted ?
size_t nbProc = ProcCounter->size();
size_t i = 0;
while ((i<nbProc)&&((*ProcCounter)[i]->GetName()!=procName)) i++;
if (i == nbProc) ProcCounter->push_back( new OneProcessCount(procName));
(*ProcCounter)[i]->Count();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RunAction::EndOfRunAction(const G4Run* aRun)
{
G4int NbOfEvents = aRun->GetNumberOfEvent();
if (NbOfEvents == 0) return;
std::ios::fmtflags mode = G4cout.flags();
G4cout.setf(std::ios::fixed,std::ios::floatfield);
G4int prec = G4cout.precision(2);
G4Material* material = detector->GetMaterial();
G4double density = material->GetDensity();
G4int survive = 0;
G4String particle = primary->GetParticleGun()->GetParticleDefinition()
->GetParticleName();
G4double energy = primary->GetParticleGun()->GetParticleEnergy();
G4cout << "\n The run consists of " << NbOfEvents << " "<< particle << " of "
<< G4BestUnit(energy,"Energy") << " through "
<< G4BestUnit(detector->GetSize(),"Length") << " of "
<< material->GetName() << " (density: "
<< G4BestUnit(density,"Volumic Mass") << ")" << G4endl;
//frequency of processes
G4cout << "\n Frequency of process calls --->";
for (size_t i=0; i< ProcCounter->size();i++) {
G4String procName = (*ProcCounter)[i]->GetName();
G4int count = (*ProcCounter)[i]->GetCounter();
G4cout << "\t" << procName << " : " << count;
if (procName == "Transportation") survive = count;
}
if (survive > 0) {
G4cout << "\n\n Nb of incident particles surviving after "
<< G4BestUnit(detector->GetSize(),"Length") << " of "
<< material->GetName() << " : " << survive << G4endl;
}
//compute mean free path and related quantities
//
G4double MeanFreePath = sumTrack /totalCount;
G4double MeanTrack2 = sumTrack2/totalCount;
G4double rms = sqrt(abs(MeanTrack2 - MeanFreePath*MeanFreePath));
G4double AttenuationCoef = 1./MeanFreePath;
G4double massicMFP = MeanFreePath*density;
G4double massicAC = 1./massicMFP;
G4cout.precision(5);
G4cout << "\n\n MeanFreePath: \t"<< G4BestUnit(MeanFreePath,"Length")
<< " +- " << G4BestUnit( rms,"Length")
<< "\tmassic: " << massicMFP*cm2/g << " g/cm2 "
<< "\n AttenuationCoef:\t" << AttenuationCoef*cm << " cm^-1 "
<< "\t\t\tmassic: " << massicAC*g/cm2 << " cm2/g"
<< G4endl;
G4cout.setf(mode,std::ios::floatfield);
G4cout.precision(prec);
// delete and remove all contents in ProcCounter
while (ProcCounter->size()>0){
OneProcessCount* aProcCount=ProcCounter->back();
ProcCounter->pop_back();
delete aProcCount;
}
delete ProcCounter;
#ifdef G4ANALYSIS_USE
histoManager->SaveFactory();
#endif
// show Rndm status
HepRandom::showEngineStatus();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,112 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: SteppingAction.cc,v 1.1 2004/04/28 11:12:40 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "SteppingAction.hh"
#include "RunAction.hh"
#include "HistoManager.hh"
#include "G4RunManager.hh"
#ifdef USE_AIDA
#include "AIDA/IHistogram1D.h"
#endif
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
SteppingAction::SteppingAction(RunAction* RuAct, HistoManager* Hist)
:runAction(RuAct), histoManager(Hist)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
SteppingAction::~SteppingAction()
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SteppingAction::UserSteppingAction(const G4Step* aStep)
{
G4StepPoint* endPoint = aStep->GetPostStepPoint();
G4String procName = endPoint->GetProcessDefinedStep()->GetProcessName();
G4double stepLength = aStep->GetStepLength();
//count processes and sum track length
//
runAction->CountProcesses(procName);
if (procName != "Transportation") runAction->SumTrack(stepLength);
#ifdef USE_AIDA
//plot final state
//
//scattered primary particle
//
G4int id = 1;
if (aStep->GetTrack()->GetTrackStatus() == fAlive) {
if (histoManager->GetHisto(id)) {
G4double energy = endPoint->GetKineticEnergy();
G4double unit = histoManager->GetHistoUnit(id);
histoManager->GetHisto(id)->fill(energy/unit);
}
id = 2;
if (histoManager->GetHisto(id)) {
G4ThreeVector direction = endPoint->GetMomentumDirection();
G4double costeta = direction.x();
histoManager->GetHisto(id)->fill(costeta);
}
}
//secondaries
//
G4TrackVector* secondary = fpSteppingManager->GetSecondary();
for (size_t lp=0; lp<(*secondary).size(); lp++) {
G4double charge = (*secondary)[lp]->GetDefinition()->GetPDGCharge();
if (charge != 0.) id = 3; else id = 5;
if (histoManager->GetHisto(id)) {
G4double energy = (*secondary)[lp]->GetKineticEnergy();
G4double unit = histoManager->GetHistoUnit(id);
histoManager->GetHisto(id)->fill(energy/unit);
}
id++;
if (histoManager->GetHisto(id)) {
G4ThreeVector direction = (*secondary)[lp]->GetMomentumDirection();
G4double costeta = direction.x();
histoManager->GetHisto(id)->fill(costeta);
}
}
#endif
// kill event after first interaction
//
G4RunManager::GetRunManager()->AbortEvent();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,178 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: SteppingVerbose.cc,v 1.1 2004/04/28 11:12:40 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "SteppingVerbose.hh"
#include "G4SteppingManager.hh"
#include "G4UnitsTable.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
SteppingVerbose::SteppingVerbose()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
SteppingVerbose::~SteppingVerbose()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SteppingVerbose::StepInfo()
{
CopyState();
G4int prec = G4cout.precision(3);
if( verboseLevel >= 1 ){
if( verboseLevel >= 4 ) VerboseTrack();
if( verboseLevel >= 3 ){
G4cout << G4endl;
G4cout << std::setw( 5) << "#Step#" << " "
<< std::setw( 6) << "X" << " "
<< std::setw( 6) << "Y" << " "
<< std::setw( 6) << "Z" << " "
<< std::setw( 9) << "KineE" << " "
<< std::setw( 9) << "dEStep" << " "
<< std::setw(10) << "StepLeng"
<< std::setw(10) << "TrakLeng"
<< std::setw(10) << "Volume" << " "
<< std::setw(10) << "Process" << G4endl;
}
G4cout << std::setw(5) << fTrack->GetCurrentStepNumber() << " "
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().x(),"Length")
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().y(),"Length")
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().z(),"Length")
<< std::setw(6) << G4BestUnit(fTrack->GetKineticEnergy(),"Energy")
<< std::setw(6) << G4BestUnit(fStep->GetTotalEnergyDeposit(),"Energy")
<< std::setw(6) << G4BestUnit(fStep->GetStepLength(),"Length")
<< std::setw(6) << G4BestUnit(fTrack->GetTrackLength(),"Length")
<< " ";
// if( fStepStatus != fWorldBoundary){
if( fTrack->GetNextVolume() != 0 ) {
G4cout << std::setw(10) << fTrack->GetVolume()->GetName();
} else {
G4cout << std::setw(10) << "OutOfWorld";
}
if(fStep->GetPostStepPoint()->GetProcessDefinedStep() != NULL){
G4cout << " "
<< std::setw(10) << fStep->GetPostStepPoint()
->GetProcessDefinedStep()->GetProcessName();
} else {
G4cout << " UserLimit";
}
G4cout << G4endl;
if( verboseLevel == 2 ){
G4int tN2ndariesTot = fN2ndariesAtRestDoIt +
fN2ndariesAlongStepDoIt +
fN2ndariesPostStepDoIt;
if(tN2ndariesTot>0){
G4cout << " :----- List of 2ndaries - "
<< "#SpawnInStep=" << std::setw(3) << tN2ndariesTot
<< "(Rest=" << std::setw(2) << fN2ndariesAtRestDoIt
<< ",Along=" << std::setw(2) << fN2ndariesAlongStepDoIt
<< ",Post=" << std::setw(2) << fN2ndariesPostStepDoIt
<< "), "
<< "#SpawnTotal=" << std::setw(3) << (*fSecondary).size()
<< " ---------------"
<< G4endl;
for(size_t lp1=(*fSecondary).size()-tN2ndariesTot;
lp1<(*fSecondary).size(); lp1++){
G4cout << " : "
<< std::setw(6)
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().x(),"Length")
<< std::setw(6)
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().y(),"Length")
<< std::setw(6)
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().z(),"Length")
<< std::setw(6)
<< G4BestUnit((*fSecondary)[lp1]->GetKineticEnergy(),"Energy")
<< std::setw(10)
<< (*fSecondary)[lp1]->GetDefinition()->GetParticleName();
G4cout << G4endl;
}
G4cout << " :-----------------------------"
<< "----------------------------------"
<< "-- EndOf2ndaries Info ---------------"
<< G4endl;
}
}
}
G4cout.precision(prec);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SteppingVerbose::TrackingStarted()
{
CopyState();
G4int prec = G4cout.precision(3);
if( verboseLevel > 0 ){
G4cout << std::setw( 5) << "Step#" << " "
<< std::setw( 6) << "X" << " "
<< std::setw( 6) << "Y" << " "
<< std::setw( 6) << "Z" << " "
<< std::setw( 9) << "KineE" << " "
<< std::setw( 9) << "dEStep" << " "
<< std::setw(10) << "StepLeng"
<< std::setw(10) << "TrakLeng"
<< std::setw(10) << "Volume" << " "
<< std::setw(10) << "Process" << G4endl;
G4cout << std::setw(5) << fTrack->GetCurrentStepNumber() << " "
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().x(),"Length")
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().y(),"Length")
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().z(),"Length")
<< std::setw(6) << G4BestUnit(fTrack->GetKineticEnergy(),"Energy")
<< std::setw(6) << G4BestUnit(fStep->GetTotalEnergyDeposit(),"Energy")
<< std::setw(6) << G4BestUnit(fStep->GetStepLength(),"Length")
<< std::setw(6) << G4BestUnit(fTrack->GetTrackLength(),"Length")
<< " ";
if(fTrack->GetNextVolume()){
G4cout << std::setw(10) << fTrack->GetVolume()->GetName();
} else {
G4cout << std::setw(10) << "OutOfWorld";
}
G4cout << " initStep" << G4endl;
}
G4cout.precision(prec);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,155 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: VisManager.cc,v 1.1 2004/04/28 11:12:40 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
// John Allison 24th January 1998.
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifdef G4VIS_USE
#include "VisManager.hh"
// Supported drivers...
// Not needing external packages or libraries...
#include "G4ASCIITree.hh"
#include "G4DAWNFILE.hh"
#include "G4GAGTree.hh"
#include "G4HepRepFile.hh"
#include "G4HepRep.hh"
#include "G4RayTracer.hh"
#include "G4VRML1File.hh"
#include "G4VRML2File.hh"
// Needing external packages or libraries...
#ifdef G4VIS_USE_DAWN
#include "G4FukuiRenderer.hh"
#endif
#ifdef G4VIS_USE_OPACS
#include "G4Wo.hh"
#include "G4Xo.hh"
#endif
#ifdef G4VIS_USE_OPENGLX
#include "G4OpenGLImmediateX.hh"
#include "G4OpenGLStoredX.hh"
#endif
#ifdef G4VIS_USE_OPENGLWIN32
#include "G4OpenGLImmediateWin32.hh"
#include "G4OpenGLStoredWin32.hh"
#endif
#ifdef G4VIS_USE_OPENGLXM
#include "G4OpenGLImmediateXm.hh"
#include "G4OpenGLStoredXm.hh"
#endif
#ifdef G4VIS_USE_OIX
#include "G4OpenInventorX.hh"
#endif
#ifdef G4VIS_USE_OIWIN32
#include "G4OpenInventorWin32.hh"
#endif
#ifdef G4VIS_USE_VRML
#include "G4VRML1.hh"
#include "G4VRML2.hh"
#endif
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
VisManager::VisManager () {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void VisManager::RegisterGraphicsSystems () {
// Graphics Systems not needing external packages or libraries...
RegisterGraphicsSystem (new G4ASCIITree);
RegisterGraphicsSystem (new G4DAWNFILE);
RegisterGraphicsSystem (new G4GAGTree);
RegisterGraphicsSystem (new G4HepRepFile);
RegisterGraphicsSystem (new G4HepRep);
RegisterGraphicsSystem (new G4RayTracer);
RegisterGraphicsSystem (new G4VRML1File);
RegisterGraphicsSystem (new G4VRML2File);
// Graphics systems needing external packages or libraries...
#ifdef G4VIS_USE_DAWN
RegisterGraphicsSystem (new G4FukuiRenderer);
#endif
#ifdef G4VIS_USE_OPACS
RegisterGraphicsSystem (new G4Wo);
RegisterGraphicsSystem (new G4Xo);
#endif
#ifdef G4VIS_USE_OPENGLX
RegisterGraphicsSystem (new G4OpenGLImmediateX);
RegisterGraphicsSystem (new G4OpenGLStoredX);
#endif
#ifdef G4VIS_USE_OPENGLWIN32
RegisterGraphicsSystem (new G4OpenGLImmediateWin32);
RegisterGraphicsSystem (new G4OpenGLStoredWin32);
#endif
#ifdef G4VIS_USE_OPENGLXM
RegisterGraphicsSystem (new G4OpenGLImmediateXm);
RegisterGraphicsSystem (new G4OpenGLStoredXm);
#endif
#ifdef G4VIS_USE_OIX
RegisterGraphicsSystem (new G4OpenInventorX);
#endif
#ifdef G4VIS_USE_OIWIN32
RegisterGraphicsSystem (new G4OpenInventorWin32);
#endif
#ifdef G4VIS_USE_VRML
RegisterGraphicsSystem (new G4VRML1);
RegisterGraphicsSystem (new G4VRML2);
#endif
if (fVerbose > 0) {
G4cout <<
"\nYou have successfully chosen to use the following graphics systems."
<< G4endl;
PrintAvailableGraphicsSystems ();
}
}
#endif
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,32 @@
#
# Macro file for the initialization phase of "TestEm1.cc"
#
# Sets some default verbose
# and initializes the graphic.
#
/control/verbose 2
/run/verbose 2
#
/run/initialize
#
# Create empty scene ("world" is default)
/vis/scene/create
#
# Create a scene handler for a specific graphics system
# Edit the next line(s) to choose another graphic system
#
/vis/open OGLIX
#
#/vis/open DAWNFILE
#
# Draw scene
/vis/viewer/zoom 1.4
/vis/viewer/flush
#
# for drawing the tracks
# if too many tracks cause core dump => storeTrajectory 0
/tracking/storeTrajectory 1
/vis/scene/endOfEventAction accumulate
#
/testem/event/drawTracks