Import Geant4 1.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 15:28:20 +02:00
parent aaa409b6ee
commit ca1c8cb059
2995 changed files with 106830 additions and 299600 deletions
@@ -0,0 +1,22 @@
# $Id: GNUmakefile,v 1.1 1999/10/11 13:07:23 maire Exp $
# --------------------------------------------------------------
# GNUmakefile for examples module. Gabriele Cosmo, 06/04/98.
# --------------------------------------------------------------
name := TestEm1
G4TARGET := $(name)
G4EXLIB := true
ifndef G4INSTALL
G4INSTALL = ../../../..
endif
.PHONY: all
all: lib bin
include $(G4INSTALL)/config/architecture.gmk
LDFLAGS += -L/cern/pro/lib
LOADLIBS += -lpacklib $(FCLIBS)
include $(G4INSTALL)/config/binmake.gmk
@@ -0,0 +1,43 @@
$Id: History,v 1.2 1999/10/11 13:14:31 maire Exp $
-------------------------------------------------------------------
=========================================================
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
=========================================================
TestEm1 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 *
----------------------------------------------------------
11-10-99 moved from: source/processes/electromagnetic/test
to: examples/extended/electromagnetic
09-08-99 Commands for save/read Rndm status
17-06-99 added histogramming facility
10-05-99 user's actions adapted to geant4-00-ref-04
03-12-98 subdirectory geant3 which contains the geant3 equivalent
example.
24.11.98 due to new computation of SetCut for electron, the cut in range
for e-/+ has been modified in init.mac and run10.mac (beta03-00)
27.10.98 interactive command for setting StepFunction: deemax + stmin.
modifs in setxxCut functions (Hisaya).
Count occurence of processes.
Now TestEm1 is equivalent to g3-testem1
Both can be run in batch with reference files:
run1.mac (g4), run1.dat (g3).
19.10.98 Moved in subdirectory electromagnetic/test/TestEm1.
Interactive commands in PhysicsList for setting cuts.
14.09.98 Created, Michel Maire
@@ -0,0 +1,102 @@
$Id: README,v 1.1 1999/10/11 13:07:24 maire Exp $
-------------------------------------------------------------------
=========================================================
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
=========================================================
TestEm1
-------
This example has been setup to test individualy the electromagnetic
processes.
1- GEOMETRY DEFINITION
It is a simple box which represente an 'infinite' homogeneous medium.
Two parameters define the geometry :
- the material of the box,
- the (full) size of the box.
In addition a transverse uniform magnetic field can be applied.
The default geometry is constructed in DetectorConstruction class,
but all of the above parameters can be changed interactively via
the commands defined in the DetectorMessenger class.
2- PHYSICS LIST
The particle list is the one of novice/exampleN03.
The physics list contains the 'standard' electromagnetic processes,
and decay.
Few commands have been added to PhysicsList, in order to set the
production threshold for secondaries either in range for gamma,
e-/e+, proton or directly in energy for all charged.
3- AN EVENT : THE PRIMARY GENERATOR
The primary kinematic consists of a single particle starting at the
middle of the box. The type of the particle and its energy are set
in the PrimaryGeneratorAction class, and can be changed via the G4
build-in commands of ParticleGun class (see the macros provided with
this example).
A RUN is a set of events.
4- VISUALIZATION
The Visualization Manager is set in the main().
The initialisation of the drawing is done via the command
/vis~/create_view in the macro init.mac. This macro is
automatically read from the main in case of interactive running mode.
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.
Optionaly one can choose to draw all particles, only the charged one,
or none. This command is defined in EventActionMessenger class.
5- PHYSICS SURVEY
The particle's type and the physic processes which will be available
in this example are set in PhysicsList class.
A set of macros defining various run conditions are provided.
The processes are actived/inactived together with differents
cuts, in order to survey the processes one by one.
The number of produced secondaries are counted, the number of steps,
and the number of process calls responsible of the step.
6- HOW TO START ?
- compile and link to generate an executable
% cd geant4/examples/extended/electromagnetic/TestEm1
% gmake
- execute TestEm1 in 'batch' mode from macro files
% TestEm1 run10.mac
- execute TestEm1 in 'interactive mode' with visualization
% TestEm1
....
Idle> type your commands
....
Idle> exit
7- HISTOGRAMS
Testem1 produces several histo which are saved as testem1.histo
Content of these histo:
1 : track length of a charged particle
2 : number of steps per track (charged particle)
3 : step length (charged particle)
@@ -0,0 +1,107 @@
// 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: TestEm1.cc,v 1.1.4.1 1999/12/07 20:46:52 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
// --------------------------------------------------------------
// GEANT 4 - example Em1
//
// For information related to this code contact:
// CERN, IT Division, ASD Group
// --------------------------------------------------------------
// Comments
//
//
// --------------------------------------------------------------
#define Em1NoOptimize 1
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "G4UIterminal.hh"
#include "Randomize.hh"
#include "Em1DetectorConstruction.hh"
#include "Em1PhysicsList.hh"
#include "Em1PrimaryGeneratorAction.hh"
#ifdef Em1NoOptimize
#include "Em1RunAction.hh"
#include "Em1EventAction.hh"
#include "Em1TrackingAction.hh"
#include "Em1SteppingAction.hh"
#ifdef G4VIS_USE
#include "Em1VisManager.hh"
#endif
#endif
int main(int argc,char** argv) {
//choose the Random engine
HepRandom::setTheEngine(new RanecuEngine);
// Construct the default run manager
G4RunManager * runManager = new G4RunManager;
// set mandatory initialization classes
Em1DetectorConstruction* det;
runManager->SetUserInitialization(det = new Em1DetectorConstruction);
runManager->SetUserInitialization(new Em1PhysicsList(det));
runManager->SetUserAction(new Em1PrimaryGeneratorAction);
#ifdef Em1NoOptimize
#ifdef G4VIS_USE
// visualization manager
G4VisManager* visManager = new Em1VisManager;
visManager->Initialize();
#endif
// set user action classes
Em1RunAction* RunAct;
Em1EventAction* EvtAct;
runManager->SetUserAction(RunAct = new Em1RunAction);
runManager->SetUserAction(EvtAct = new Em1EventAction(RunAct));
runManager->SetUserAction(new Em1TrackingAction(RunAct));
runManager->SetUserAction(new Em1SteppingAction(RunAct,EvtAct));
#endif
//Initialize G4 kernel
runManager->Initialize();
// get the pointer to the User Interface manager
G4UImanager* UI = G4UImanager::GetUIpointer();
if (argc==1) // Define UI terminal for interactive mode
{
G4UIsession * session = new G4UIterminal;
UI->ApplyCommand("/control/execute init.mac");
session->SessionStart();
delete session;
}
else // Batch mode
{
G4String command = "/control/execute ";
G4String fileName = argv[1];
UI->ApplyCommand(command+fileName);
}
// job termination
#ifdef Em1NoOptimize
#ifdef G4VIS_USE
delete visManager;
#endif
#endif
delete runManager;
return 0;
}
@@ -0,0 +1,26 @@
testem1.cra is the geant3 equivalent of TestEm1
% cd geant3
% gmakeB to make an executable (Batch version)
% gmakeT to make an executable (inTeractive version)
To execute:
% cd geant3
% $G4SYSTEM/testem1.xb (for batch) or testem1.xt (for interactive)
The program will ask:
G3 > gives the filename of the data cards to be read:
run01.dat (runNN.dat is the equivalent of the G4 runNN.mac)
testem1 produces several histo saved as testem1.histo if ISWIT(2)=1
Content of these histo:
1 : track length of a charged particle
2 : number of steps per track (charged particle)
3 : step length (charged particle)
+43
View File
@@ -0,0 +1,43 @@
#
# @(#) Script to build a Batch geant executable
#
set name=testem1
set extnam=" "
if ($G4SYSTEM == AIX-AFS) set extnam=-qextname
#
mkdir $G4SYSTEM
cd $G4SYSTEM
#
# Run patchy
#
cat > temp.cra << eocra
+USE,batch.
eocra
cat ../$name.cra >> temp.cra
#
ypatchy - $name temp $name - $name :go
rm temp.cra
#
# fortran compilation
#
fsplit $name.f
rm $name.f
hepf77 $extnam -c -g *.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 *.lis *.lst *.f *.o
echo 'done'
exit
+37
View File
@@ -0,0 +1,37 @@
#
# @(#) Script to build an inTeractive geant executable
#
set name=testem1
set extnam=" "
if ($G4SYSTEM == AIX-AFS) set extnam=-qextname
#
mkdir $G4SYSTEM
cd $G4SYSTEM
#
# Run patchy
#
ypatchy - $name ../$name $name - $name :go
#
# fortran compilation
#
fsplit $name.f
rm $name.f
hepf77 $extnam -c -g *.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 *.lis *.lst *.f *.o
echo 'done'
exit
@@ -0,0 +1,14 @@
LIST
C
C geantino; 10000 evts
C
CALOR 5 (Imat) 2000. (size) 0. (field)
TRIG 10000
KINE 48 (Itype) 1.0 (Ekine)
DEBUG 10 5 1000
SWIT 0 (draw) 0 (save)
CUTS 10.e-6 (cutgam) 10.e-6 (cutele) 3*10.e-3 (cutneu/had/muo)
2*10.e-6 (bcute/m) 2*10.e-6 (dcute/m) 10.e-3 (ppcutm)
ABAN 0
LOSS 1
TIME 2=1.
@@ -0,0 +1,18 @@
LIST
C
C Eloss only; no fluctuation; e- 1 Gev
C
CALOR 5 (Imat) 2000. (size) 0. (field)
TRIG 100
KINE 3 (Itype) 1.000 (Ekine)
DEBUG 10 5 1000
SWIT 0 (draw) 0 (save)
CUTS 10.e-6 (cutgam) 10.e-6 (cutele) 3*10.e-3 (cutneu/had/muo)
2*10.e+3 (bcute/m) 2*10.e+3 (dcute/m) 10.e-3 (ppcutm)
ABAN 0
PHOT 0
COMP 0
PAIR 0
MULS 0
LOSS 4
TIME 2=1.
@@ -0,0 +1,18 @@
LIST
C
C Eloss only; glandz fluctuations; e- 1 Gev
C
CALOR 5 (Imat) 2000. (size) 0. (field)
TRIG 100
KINE 3 (Itype) 1.000 (Ekine)
DEBUG 10 5 1000
SWIT 0 (draw) 0 (save)
CUTS 10.e-6 (cutgam) 10.e-6 (cutele) 3*10.e-3 (cutneu/had/muo)
2*10.e+3 (bcute/m) 2*10.e+3 (dcute/m) 10.e-3 (ppcutm)
ABAN 0
PHOT 0
COMP 0
PAIR 0
MULS 0
LOSS 1
TIME 2=1.
@@ -0,0 +1,18 @@
LIST
C
C Eloss+muls only; no fluctuation; e- 10 Mev
C
CALOR 5 (Imat) 2000. (size) 0. (field)
TRIG 100
KINE 3 (Itype) 0.010 (Ekine)
DEBUG 10 5 1000
SWIT 0 (draw) 0 (save)
CUTS 10.e-6 (cutgam) 10.e-6 (cutele) 3*10.e-3 (cutneu/had/muo)
2*10.e+3 (bcute/m) 2*10.e+3 (dcute/m) 10.e-3 (ppcutm)
ABAN 0
PHOT 0
COMP 0
PAIR 0
MULS 1
LOSS 4
TIME 2=1.
@@ -0,0 +1,18 @@
LIST
C
C full Ionisation only; e- 100 Mev
C
CALOR 5 (Imat) 2000. (size) 0. (field)
TRIG 100
KINE 3 (Itype) 0.100 (Ekine)
DEBUG 10 5 1000
SWIT 0 (draw) 0 (save)
CUTS 10.e-6 (cutgam) 10.e-6 (cutele) 3*10.e-3 (cutneu/had/muo)
2*10.e+3 (bcute/m) 2*10.e-6 (dcute/m) 10.e-3 (ppcutm)
ABAN 0
PHOT 0
COMP 0
PAIR 0
MULS 0
LOSS 1
TIME 2=1.
@@ -0,0 +1,18 @@
LIST
C
C full Brems only; e- 1 Gev
C
CALOR 5 (Imat) 2000. (size) 0. (field)
TRIG 100
KINE 3 (Itype) 1.000 (Ekine)
DEBUG 10 5 1000
SWIT 0 (draw) 0 (save)
CUTS 10.e-6 (cutgam) 10.e-6 (cutele) 3*10.e-3 (cutneu/had/muo)
2*10.e-6 (bcute/m) 2*10.e+3 (dcute/m) 10.e-3 (ppcutm)
ABAN 0
PHOT 0
COMP 0
PAIR 0
MULS 0
LOSS 1
TIME 2=1.
@@ -0,0 +1,18 @@
LIST
C
C Compton + Photo electric; gamma 10 MeV
C
CALOR 5 (Imat) 2000. (size) 0. (field)
TRIG 1000
KINE 1 (Itype) 0.010 (Ekine)
DEBUG 10 5 1000
SWIT 0 (draw) 0 (save)
CUTS 10.e-6 (cutgam) 10.e-6 (cutele) 3*10.e-3 (cutneu/had/muo)
2*10.e+3 (bcute/m) 2*10.e+3 (dcute/m) 10.e-3 (ppcutm)
ABAN 0
PHOT 2
COMP 2
PAIR 0
MULS 0
LOSS 1
TIME 2=1.
@@ -0,0 +1,19 @@
LIST
C
C Gamma conversion and e+ annihilation; gamma 100 MeV
C
CALOR 5 (Imat) 2000. (size) 0. (field)
TRIG 1000
KINE 1 (Itype) 0.100 (Ekine)
DEBUG 10 5 1000
SWIT 0 (draw) 0 (save)
CUTS 10.e-6 (cutgam) 10.e-6 (cutele) 3*10.e-3 (cutneu/had/muo)
2*10.e+3 (bcute/m) 2*15.e-3 (dcute/m) 10.e-3 (ppcutm)
ABAN 0
PHOT 0
COMP 0
PAIR 1
ANNI 2
MULS 0
LOSS 1
TIME 2=1.
@@ -0,0 +1,14 @@
LIST
C
C e- 100 Mev; all processes
C
CALOR 5 (Imat) 2000. (size) 0. (field)
TRIG 100
KINE 3 (Itype) 0.100 (Ekine)
DEBUG 10 5 1000
SWIT 0 (draw) 0 (save)
CUTS 10.e-6 (cutgam) 10.e-6 (cutele) 3*10.e-3 (cutneu/had/muo)
2*10.e-6 (bcute/m) 2*10.e-6 (dcute/m) 10.e-3 (ppcutm)
ABAN 0
LOSS 1
TIME 2=1.
@@ -0,0 +1,14 @@
LIST
C
C e- 1 Gev; all processes
C
CALOR 5 (Imat) 2000. (size) 0. (field)
TRIG 100
KINE 3 (Itype) 1.000 (Ekine)
DEBUG 10 5 1000
SWIT 0 (draw) 0 (save)
CUTS 10.e-6 (cutgam) 10.e-6 (cutele) 3*10.e-3 (cutneu/had/muo)
2*10.e-6 (bcute/m) 2*10.e-6 (dcute/m) 10.e-3 (ppcutm)
ABAN 0
LOSS 1
TIME 2=1.
@@ -0,0 +1,14 @@
LIST
C
C Eloss only + muls; e- 1 Gev
C
CALOR 5 (Imat) 2000. (size) 0. (field)
TRIG 1000
KINE 3 (Itype) 1.000 (Ekine)
DEBUG 10 5 1000
SWIT 0 (draw) 1 (save)
CUTS 10.e-6 (cutgam) 10.e-6 (cutele) 3*10.e-3 (cutneu/had/muo)
2*10.e+3 (bcute/m) 2*100.e-3 (dcute/m) 10.e-3 (ppcutm)
ABAN 0
LOSS 1
TIME 2=1.
@@ -0,0 +1,423 @@
+OPTION,MAPASM.
+ASM,23.
+USE,GCDES,TestEm1,T=EXE.
*
+EXE,CRA*.
*
+PAM,11,T=CARD,T=ATTACH. /cern/pro/src/car/geant321.car
+PATCH,TestEm1.
+DECK,BLANKDEK.
*
* TestEm1 1.00 /01 980918 13.00 GEANT EXAMPLES
*
* TEST PROGRAM FOR GEANT TEST
*
* Author M.Maire *********
*
*
* History
* -------
*
*
+KEEP,CALOR.
COMMON/CALOR/Imat,BoxSize,Field
*
* Imat = GEANT material number. (data card CALOR)
* BoxSize = total size of the box (cm) (data card CALOR)
* Field = magnetic field (tesla) (data card CALOR)
*
+KEEP,CELOSS.
COMMON/CELOSS/ ETOT,NTRAK0,NTRAK1,NSTEP0,NSTEP1,NBCALL(12),
+ NSTRK0,NSTRK1
+DECK,main,if=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
+DECK,main,IF=-batch.
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
+DECK,UGINIT
SUBROUTINE UGINIT
*
* To initialise GEANT/USER program and read data cards
*
+SEQ,CALOR,CELOSS.
*
CHARACTER*20 filnam
*
* *** Define the GEANT parameters
CALL GINIT
* *** read data cards
PRINT *, 'G3 > gives the filename of the data cards to be read:'
READ (*,'(A)') filnam
IF (filnam.EQ.' ') filnam = 'testem1.dat'
OPEN (unit=5,file=filnam,status='unknown',form='formatted')
*
* *** Calor definition
CALL FFKEY('CALOR',Imat,3,'MIXED')
*
* *** read data cards
CALL GFFGO
*
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)
*
* *** Define user histograms
CALL UHINIT
*
* *** some initialisation
NTRAK0 = 0
NTRAK1 = 0
NSTEP0 = 0
NSTEP1 = 0
CALL VZERO (NBCALL,12)
*
END
+DECK,UGEOM.
SUBROUTINE UGEOM
*
* *** Define user geometry set up
*
*
+SEQ,CALOR.
*
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,'Lead ',207.19, 82., 11.35 , 0.56, 18.5, 0,0)
CALL GSMATE( 8,'Uranium ',238.03, 92., 18.95 , 0.32, 12. , 0,0)
*
*
* *** Defines USER tracking media parameters
IFIELD = 0
IF (Field.GT.0.) IFIELD = 3
FIELDM = 10*Field
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 = 1.
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
+DECK,UHINIT.
SUBROUTINE UHINIT
*
* To book the user's histograms
*
CALL HBOOK1(1,'track length (mm) of a charged particle',
+ 100,0.,500.,0.)
CALL HBOOK1(2,'Nb of steps per track (charged particle)',
+ 100,0.,100.,0.)
CALL HBOOK1(3,'step length (mm) charged particle',
+ 100,0.,10. ,0.)
*
END
+DECK,GUKINE
SUBROUTINE GUKINE
*
* Generates Kinematics for primary track
*
* Data card Kine : Itype Ekine
*
+SEQ,GCBANK,GCFLAG,GCKINE.
*
DIMENSION VERTEX(3),PLAB(3)
*
DATA VERTEX/3*0./
DATA PLAB /3*0./
*
*
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
+DECK,GUTREV
SUBROUTINE GUTREV
*
* User routine to control tracking of one event
* Called by GRUN
*
+SEQ,CELOSS
*
ETOT = 0.
*
CALL GTREVE
*
END
+DECK,GUTRAK
SUBROUTINE GUTRAK
*
* User routine to control tracking of one track
* Called by GTREVE
*
+SEQ,GCKINE.
+SEQ,GCTRAK.
+SEQ,CELOSS.
*
*
* *** initialisation track per track
NSTRK0 = 0
NSTRK1 = 0
*
CALL GTRACK
*
* *** count nb of tracks
IF (CHARGE.NE.0.) THEN
NTRAK1 = NTRAK1 + 1
CALL HFILL (1,SLENG*10,0.,1.)
CALL HFILL (2,REAL(NSTRK1),0.,1.)
ELSE
NTRAK0 = NTRAK0 + 1
ENDIF
*
END
+DECK,GUSTEP
SUBROUTINE GUSTEP
*
* User routine called at the end of each tracking step
*
+SEQ,GCFLAG.
+SEQ,GCKINE,GCKING,GCTRAK.
+SEQ,CELOSS.
*
*
* *** Debug event and store tracks for drawing
IF (IDEBUG.NE.0) CALL GPCXYZ
IF ((ISWIT(1).EQ.1).AND.(CHARGE.NE.0.)) CALL GSXYZ
IF (ISWIT(1).EQ.2) CALL GSXYZ
*
* *** Something generated ?
IF(NGKINE.GT.0) CALL GSKING(0)
*
* *** Energy deposited
ETOT = ETOT + DESTEP
*
* *** count number of steps
IF (CHARGE.NE.0.) THEN
NSTEP1 = NSTEP1 + 1
NSTRK1 = NSTRK1 + 1
CALL HFILL (3,STEP*10,0.,1.)
ELSE
NSTEP0 = NSTEP0 + 1
NSTRK0 = NSTRK0 + 1
ENDIF
*
* *** count nb of invoked processes
IF (NMEC.GT.0) THEN
DO IM = 1,NMEC
IPROC = LMEC(IM)
IF (IPROC.EQ.21) IPROC = 12
IF (IPROC.LE.12) NBCALL(IPROC) = NBCALL(IPROC)+1
ENDDO
ENDIF
END
+DECK,GUOUT
SUBROUTINE GUOUT
*
* User routine called at the end of each event
*
+SEQ,GCFLAG.
+SEQ,CELOSS.
*
CHARACTER*4 unit
*
* *** drawing
*
+self,if=-batch.
IF (ISWIT(1).NE.0) THEN
CALL GDHEAD (110110,'TestEm1',0.)
CALL GDSHOW (3)
CALL GDXYZ (0)
END IF
+self.
*
* energy deposited
*
CALL GEVKEV (ETOT,ETunit,unit)
IF (ISWIT(1).NE.0) PRINT 750,ETunit,unit
*
750 FORMAT(1X,'Energy deposit: ',F8.3,A4)
*
END
+DECK,UGLAST
SUBROUTINE UGLAST
*
* Termination routine to print histograms and statistics
*
+SEQ,GCFLAG.
+SEQ,GCTRAK.
+SEQ,CELOSS.
*
* *** nb of steps and tracks per event
TOTEVT = IEVENT
FNTRK0 = NTRAK0/TOTEVT
FNTRK1 = NTRAK1/TOTEVT
FNSTP0 = NSTEP0/TOTEVT
FNSTP1 = NSTEP1/TOTEVT
PRINT 750, FNTRK0,FNTRK1,FNSTP0,FNSTP1
*
* *** frequency of processes call
CALL UCTOH('MUNU',NAMEC(12),4,4)
PRINT 760,(NAMEC(I),I=1,12)
PRINT 761,(NBCALL(I)/TOTEVT,I=1,12)
*
* *** geant termination
CALL GLAST
*
* *** print selected histo
*
* *** close HIGZ file
CALL HPLEND
*
* *** Save selected histograms
IF (ISWIT(2).EQ.1) THEN
CALL HRPUT(0,'testem1.histo','N')
ENDIF
*
* *** formats
750 FORMAT(//,1X,'nb tracks/event neutral: ',F9.2,' charged: ',F9.2,
+ /,1X,'nb steps/event neutral: ',F9.2,' charged: ',F9.2)
760 FORMAT(//,1X,'nb of process calls per event: ',
+ /,3X,12A9)
761 FORMAT( 3X,12F9.2,//)
*
END
+DECK,ffread,T=data.
LIST
CALOR 5 (Imat) 2000. (size) 0. (field)
TRIG 100
KINE 3 (Itype) 0.100 (Ekine)
DEBUG 10 5 1000
SWIT 0 (draw) 0 (save)
CUTS 10.e-6 (cutgam) 10.e-6 (cutele) 3*10.e-3 (cutneu/had/muo)
2*10.e-6 (bcute/m) 2*10.e-6 (dcute/m) 10.e-3 (ppcutm)
ABAN 0
LOSS 1
TIME 2=1.
+QUIT.
@@ -0,0 +1,77 @@
// 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: Em1DetectorConstruction.hh,v 1.1.4.1 1999/12/07 20:46:53 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#ifndef Em1DetectorConstruction_h
#define Em1DetectorConstruction_h 1
#include "G4VUserDetectorConstruction.hh"
#include "globals.hh"
class G4LogicalVolume;
class G4Material;
class G4UniformMagField;
class Em1DetectorMessenger;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class Em1DetectorConstruction : public G4VUserDetectorConstruction
{
public:
Em1DetectorConstruction();
~Em1DetectorConstruction();
public:
G4VPhysicalVolume* Construct();
void SetSize (G4double);
void SetMaterial (G4String);
void SetMagField (G4double);
void UpdateGeometry();
public:
const
G4VPhysicalVolume* GetWorld() {return pBox;};
G4double GeSize() {return BoxSize;};
G4Material* GetMaterial() {return aMaterial;};
void PrintParameters();
private:
G4VPhysicalVolume* pBox;
G4LogicalVolume* lBox;
G4double BoxSize;
G4Material* aMaterial;
G4UniformMagField* magField;
Em1DetectorMessenger* detectorMessenger;
private:
void DefineMaterials();
G4VPhysicalVolume* ConstructVolumes();
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
@@ -0,0 +1,51 @@
// 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: Em1DetectorMessenger.hh,v 1.1.4.1 1999/12/07 20:46:53 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#ifndef Em1DetectorMessenger_h
#define Em1DetectorMessenger_h 1
#include "globals.hh"
#include "G4UImessenger.hh"
class Em1DetectorConstruction;
class G4UIdirectory;
class G4UIcmdWithAString;
class G4UIcmdWithADoubleAndUnit;
class G4UIcmdWithoutParameter;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class Em1DetectorMessenger: public G4UImessenger
{
public:
Em1DetectorMessenger(Em1DetectorConstruction* );
~Em1DetectorMessenger();
void SetNewValue(G4UIcommand*, G4String);
private:
Em1DetectorConstruction* Em1Detector;
G4UIdirectory* Em1detDir;
G4UIcmdWithAString* MaterCmd;
G4UIcmdWithADoubleAndUnit* SizeCmd;
G4UIcmdWithADoubleAndUnit* MagFieldCmd;
G4UIcmdWithoutParameter* UpdateCmd;
};
#endif
@@ -0,0 +1,53 @@
// 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: Em1EventAction.hh,v 1.1.4.1 1999/12/07 20:46:53 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#ifndef Em1EventAction_h
#define Em1EventAction_h 1
#include "G4UserEventAction.hh"
#include "globals.hh"
class Em1RunAction;
class Em1EventActionMessenger;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class Em1EventAction : public G4UserEventAction
{
public:
Em1EventAction(Em1RunAction*);
~Em1EventAction();
public:
void BeginOfEventAction(const G4Event*);
void EndOfEventAction(const G4Event*);
void addEdep(G4double Edep) {TotalEnergyDeposit += Edep;};
G4double GetEnergyDeposit() {return TotalEnergyDeposit;};
void SetDrawFlag(G4String val) {drawFlag = val;};
void SetPrintModulo(G4int val) {printModulo = val;};
private:
Em1RunAction* Em1Run;
G4double TotalEnergyDeposit;
G4String drawFlag;
G4int printModulo;
Em1EventActionMessenger* eventMessenger;
};
#endif
@@ -0,0 +1,42 @@
// 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: Em1EventActionMessenger.hh,v 1.1.4.1 1999/12/07 20:46:53 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#ifndef Em1EventActionMessenger_h
#define Em1EventActionMessenger_h 1
#include "globals.hh"
#include "G4UImessenger.hh"
class Em1EventAction;
class G4UIcmdWithAString;
class G4UIcmdWithAnInteger;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class Em1EventActionMessenger: public G4UImessenger
{
public:
Em1EventActionMessenger(Em1EventAction*);
~Em1EventActionMessenger();
void SetNewValue(G4UIcommand*, G4String);
private:
Em1EventAction* eventAction;
G4UIcmdWithAString* DrawCmd;
G4UIcmdWithAnInteger* PrintCmd;
};
#endif
@@ -0,0 +1,66 @@
// 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: Em1PhysicsList.hh,v 1.1.4.1 1999/12/07 20:46:53 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#ifndef Em1PhysicsList_h
#define Em1PhysicsList_h 1
#include "G4VUserPhysicsList.hh"
#include "globals.hh"
class Em1DetectorConstruction;
class Em1PhysicsListMessenger;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class Em1PhysicsList: public G4VUserPhysicsList
{
public:
Em1PhysicsList(Em1DetectorConstruction*);
~Em1PhysicsList();
protected:
// Construct particles
void ConstructParticle();
void ConstructBosons();
void ConstructLeptons();
void ConstructMesons();
void ConstructBarions();
public:
void SetCuts();
void SetGammaCut(G4double);
void SetElectronCut(G4double);
void SetProtonCut(G4double);
void SetCutsByEnergy(G4double);
void GetRange(G4double);
protected:
// Construct processes and register them
void ConstructProcess();
void ConstructGeneral();
void ConstructEM();
private:
Em1DetectorConstruction* pDet;
Em1PhysicsListMessenger* pMes;
G4double cutForGamma;
G4double cutForElectron;
G4double cutForProton;
};
#endif
@@ -0,0 +1,44 @@
// 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: Em1PhysicsListMessenger.hh,v 1.1.4.1 1999/12/07 20:46:54 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#ifndef Em1PhysicsListMessenger_h
#define Em1PhysicsListMessenger_h 1
#include "globals.hh"
#include "G4UImessenger.hh"
class Em1PhysicsList;
class G4UIcmdWithADoubleAndUnit;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class Em1PhysicsListMessenger: public G4UImessenger
{
public:
Em1PhysicsListMessenger(Em1PhysicsList*);
~Em1PhysicsListMessenger();
void SetNewValue(G4UIcommand*, G4String);
private:
Em1PhysicsList* physList;
G4UIcmdWithADoubleAndUnit* cutGCmd;
G4UIcmdWithADoubleAndUnit* cutECmd;
G4UIcmdWithADoubleAndUnit* cutPCmd;
G4UIcmdWithADoubleAndUnit* rCmd;
G4UIcmdWithADoubleAndUnit* eCmd;
};
#endif
@@ -0,0 +1,43 @@
// 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: Em1PrimaryGeneratorAction.hh,v 1.1.4.1 1999/12/07 20:46:54 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#ifndef Em1PrimaryGeneratorAction_h
#define Em1PrimaryGeneratorAction_h 1
#include "G4VUserPrimaryGeneratorAction.hh"
#include "globals.hh"
class G4ParticleGun;
class G4Event;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class Em1PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
{
public:
Em1PrimaryGeneratorAction();
~Em1PrimaryGeneratorAction();
public:
void GeneratePrimaries(G4Event*);
private:
G4ParticleGun* particleGun; //pointer a to G4 service class
};
#endif
@@ -0,0 +1,69 @@
// 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: Em1RunAction.hh,v 1.1.4.1 1999/12/07 20:46:54 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#ifndef Em1RunAction_h
#define Em1RunAction_h 1
#include "G4UserRunAction.hh"
#include "ProcessesCount.hh"
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class G4Run;
class Em1RunActionMessenger;
class HepTupleManager;
class HepHistogram;
class Em1RunAction : public G4UserRunAction
{
public:
Em1RunAction();
~Em1RunAction();
public:
void BeginOfRunAction(const G4Run*);
void EndOfRunAction(const G4Run*);
void CountTraks0(G4int nt) { NbOfTraks0 += nt;}
void CountTraks1(G4int nt) { NbOfTraks1 += nt;}
void CountSteps0(G4int ns) { NbOfSteps0 += ns;}
void CountSteps1(G4int ns) { NbOfSteps1 += ns;}
void CountProcesses(G4String);
public:
HepHistogram* GetHisto(G4int id) {return histo[id];}
void SetRndmFreq(G4int val) {saveRndm = val;}
G4int GetRndmFreq() {return saveRndm;}
private:
void bookHisto();
void cleanHisto();
private:
G4int NbOfTraks0, NbOfTraks1;
G4int NbOfSteps0, NbOfSteps1;
ProcessesCount* ProcCounter;
HepTupleManager* hbookManager;
HepHistogram* histo[3];
Em1RunActionMessenger* runMessenger;
G4int saveRndm;
};
#endif
@@ -0,0 +1,45 @@
// 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: Em1RunActionMessenger.hh,v 1.1.4.1 1999/12/07 20:46:54 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#ifndef Em1RunActionMessenger_h
#define Em1RunActionMessenger_h 1
#include "globals.hh"
#include "G4UImessenger.hh"
class Em1RunAction;
class G4UIdirectory;
class G4UIcmdWithAString;
class G4UIcmdWithAnInteger;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class Em1RunActionMessenger: public G4UImessenger
{
public:
Em1RunActionMessenger(Em1RunAction*);
~Em1RunActionMessenger();
void SetNewValue(G4UIcommand*, G4String);
private:
Em1RunAction* Em1Run;
G4UIdirectory* RndmDir;
G4UIcmdWithAnInteger* RndmSaveCmd;
G4UIcmdWithAString* RndmReadCmd;
};
#endif
@@ -0,0 +1,39 @@
// 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: Em1SteppingAction.hh,v 1.1.4.1 1999/12/07 20:46:54 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#ifndef Em1SteppingAction_h
#define Em1SteppingAction_h 1
#include "G4UserSteppingAction.hh"
class Em1RunAction;
class Em1EventAction;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class Em1SteppingAction : public G4UserSteppingAction
{
public:
Em1SteppingAction(Em1RunAction*,Em1EventAction*);
~Em1SteppingAction();
void UserSteppingAction(const G4Step*);
private:
Em1RunAction* runAction;
Em1EventAction* eventAction;
};
#endif
@@ -0,0 +1,34 @@
// 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: Em1TrackingAction.hh,v 1.1.4.1 1999/12/07 20:46:54 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
#ifndef Em1TrackingAction_h
#define Em1TrackingAction_h 1
#include "G4UserTrackingAction.hh"
class Em1RunAction;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class Em1TrackingAction : public G4UserTrackingAction {
public:
Em1TrackingAction(Em1RunAction*);
~Em1TrackingAction() {};
void PostUserTrackingAction(const G4Track*);
private:
Em1RunAction* runAction;
};
#endif
@@ -0,0 +1,50 @@
// 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: Em1VisManager.hh,v 1.1.4.1 1999/12/07 20:46:54 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
//....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 Em1VisManager_h
#define Em1VisManager_h 1
#include "G4VisManager.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class Em1VisManager: public G4VisManager {
public:
Em1VisManager ();
private:
void RegisterGraphicsSystems ();
};
#endif
@@ -0,0 +1,61 @@
// 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.2.1.2.1 1999/12/07 20:46:55 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
// -----------------------------------------------------------------
// GEANT 4 class header file
//
// For information related to this code contact:
// CERN, CN Division, ASD group
//
// ------------------- class ProcessesCount -----------------
//
// 26-10-98: first version, M.Maire
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#ifndef ProcessesCount_HH
#define ProcessesCount_HH
#include "globals.hh"
#include "g4rw/tpordvec.h"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class OneProcessCount
{
public:
OneProcessCount(G4String name) {Name=name; Counter=0;};
~OneProcessCount() {};
G4int operator==(const OneProcessCount& right) const {return (this==&right);};
G4int operator!=(const OneProcessCount& right) const {return (this!=&right);};
private:
OneProcessCount(OneProcessCount& right) {*this= right;};
const OneProcessCount& operator=(const OneProcessCount& right) {return right;};
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 G4RWTPtrOrderedVector<OneProcessCount> ProcessesCount;
#endif
@@ -0,0 +1,41 @@
#
# Macro file for the initialization phase of "TestEm1.cc"
#
# Sets some default verbose
# and initializes the graphic.
#
/control/verbose 2
#
####/run/initialize
#
####/process/eLoss/StepFunction 0.183 170 micrometer
####/calor/cutG 2.2 mm
####/calor/cutE 1.4 micrometer #before beta03-00 (17.11.98)
####/calor/cutE 6.05 micrometer #from beta03-00 (17.11.98)
####/run/initialize
####/run/particle/dumpCutValues
#
# Create empty scene ("world" is default)
/vis/scene/create
#
# Add volume to scene
/vis/scene/add/volume
#
# Create a scene handler for a specific graphics system
# Edit the next line(s) to choose another graphic system
#
#/vis/sceneHandler/create DAWNFILE
/vis/sceneHandler/create OGLIX
#
# Create a viewer
/vis/viewer/create
#
# Draw scene
/vis/scene/notifyHandlers
#
# for drawing the tracks
# if too many tracks cause core dump => storeTrajectory 0
/tracking/storeTrajectory 1
/event/drawTracks all
#
/run/verbose 2
@@ -0,0 +1,17 @@
# $Id: run00.mac,v 1.1 1999/10/11 13:07:25 maire Exp $
#
# Macro file for "TestEm1.cc"
# (can be run in batch, without graphic)
#
# geantino 1 GeV; 10000 evts
#
/control/verbose 2
#
/run/initialize
#
/run/verbose 2
/event/drawTracks none
#
/gun/particle geantino
/gun/energy 1 GeV
/run/beamOn 10000
@@ -0,0 +1,29 @@
# $Id: run01.mac,v 1.1 1999/10/11 13:07:26 maire Exp $
#
# Macro file for "TestEm1.cc"
# (can be run in batch, without graphic)
#
# Eloss only; no fluctuation; e- 1 GeV
#
/control/verbose 2
#
/run/initialize
#
/process/eLoss/StepFunction 0.183 170 micrometer
/calor/cutG 95 cm
/calor/cutE 95 cm
/run/initialize
/run/particle/dumpCutValues
#
/process/inactivate phot
/process/inactivate compt
/process/inactivate conv
/process/inactivate msc
/process/eLoss/fluct 0
#
/run/verbose 2
/event/drawTracks none
#
/gun/particle e-
/gun/energy 1 GeV
/run/beamOn 100
@@ -0,0 +1,29 @@
# $Id: run02.mac,v 1.1 1999/10/11 13:07:26 maire Exp $
#
# Macro file for "TestEm1.cc"
# (can be run in batch, without graphic)
#
# Eloss only; glandz fluctuations; e- 1 GeV
#
/control/verbose 2
#
/run/initialize
#
/process/eLoss/StepFunction 0.183 170 micrometer
/calor/cutG 95 cm
/calor/cutE 95 cm
/run/initialize
/run/particle/dumpCutValues
#
/process/inactivate phot
/process/inactivate compt
/process/inactivate conv
/process/inactivate msc
/process/eLoss/fluct 1
#
/run/verbose 2
/event/drawTracks none
#
/gun/particle e-
/gun/energy 1 GeV
/run/beamOn 100
@@ -0,0 +1,28 @@
# $Id: run03.mac,v 1.1 1999/10/11 13:07:26 maire Exp $
#
# Macro file for "TestEm1.cc"
# (can be run in batch, without graphic)
#
# Eloss+Muls only; no fluctuation; e- 10 MeV
#
/control/verbose 2
#
/run/initialize
#
/process/eLoss/StepFunction 0.183 170 micrometer
/calor/cutG 95 cm
/calor/cutE 95 cm
/run/initialize
/run/particle/dumpCutValues
#
/process/inactivate phot
/process/inactivate compt
/process/inactivate conv
/process/eLoss/fluct 0
#
/run/verbose 2
/event/drawTracks none
#
/gun/particle e-
/gun/energy 10 MeV
/run/beamOn 100
@@ -0,0 +1,28 @@
# $Id: run04.mac,v 1.1 1999/10/11 13:07:27 maire Exp $
#
# Macro file for "TestEm1.cc"
# (can be run in batch, without graphic)
#
# full Ionisation only; e- 100 MeV
#
/control/verbose 2
#
/run/initialize
#
/process/eLoss/StepFunction 0.183 170 micrometer
/calor/cutG 95 cm
/calor/cutE 6.05 micrometer
/run/initialize
/run/particle/dumpCutValues
#
/process/inactivate phot
/process/inactivate compt
/process/inactivate conv
/process/inactivate msc
#
/run/verbose 2
/event/drawTracks none
#
/gun/particle e-
/gun/energy 100 MeV
/run/beamOn 100
@@ -0,0 +1,28 @@
# $Id: run05.mac,v 1.1 1999/10/11 13:07:27 maire Exp $
#
# Macro file for "TestEm1.cc"
# (can be run in batch, without graphic)
#
# full Brems only; e- 1 GeV
#
/control/verbose 2
#
/run/initialize
#
/process/eLoss/StepFunction 0.183 170 micrometer
/calor/cutG 2.2 mm
/calor/cutE 95 cm
/run/initialize
/run/particle/dumpCutValues
#
/process/inactivate phot
/process/inactivate compt
/process/inactivate conv
/process/inactivate msc
#
/run/verbose 2
/event/drawTracks none
#
/gun/particle e-
/gun/energy 1 GeV
/run/beamOn 100
@@ -0,0 +1,26 @@
# $Id: run06.mac,v 1.1 1999/10/11 13:07:27 maire Exp $
#
# Macro file for "TestEm1.cc"
# (can be run in batch, without graphic)
#
# Compton + PhotoElectricEffect; Gamma 10 Mev
#
/control/verbose 2
#
/run/initialize
#
/process/eLoss/StepFunction 0.183 170 micrometer
/calor/cutG 95 cm
/calor/cutE 95 cm
/run/initialize
/run/particle/dumpCutValues
#
/process/inactivate conv
/process/inactivate msc
#
/run/verbose 2
/event/drawTracks none
#
/gun/particle gamma
/gun/energy 10 MeV
/run/beamOn 1000
@@ -0,0 +1,27 @@
# $Id: run07.mac,v 1.1 1999/10/11 13:07:27 maire Exp $
#
# Macro file for "TestEm1.cc"
# (can be run in batch, without graphic)
#
# Gamma conversion and e+ annihilation; gamma 100 MeV
#
/control/verbose 2
#
/run/initialize
#
/process/eLoss/StepFunction 0.183 170 micrometer
/calor/cutG 95 cm
/calor/cutE 30 mm
/run/initialize
/run/particle/dumpCutValues
#
/process/inactivate phot
/process/inactivate compt
/process/inactivate msc
#
/run/verbose 2
/event/drawTracks none
#
/gun/particle gamma
/gun/energy 100 MeV
/run/beamOn 1000
@@ -0,0 +1,24 @@
# $Id: run08.mac,v 1.1 1999/10/11 13:07:28 maire Exp $
#
# Macro file for "TestEm1.cc"
# (can be run in batch, without graphic)
#
# electron 100 MeV; all processes
#
/control/verbose 2
#
/run/initialize
#
/process/eLoss/StepFunction 0.183 170 micrometer
/calor/cutG 2.2 mm
####/calor/cutE 1.4 micrometer #before beta03-00 (17.11.98)
/calor/cutE 6.05 micrometer #from beta03-00 (17.11.98)
/run/initialize
/run/particle/dumpCutValues
#
/run/verbose 2
/event/drawTracks none
#
/gun/particle e-
/gun/energy 100 MeV
/run/beamOn 100
@@ -0,0 +1,25 @@
# $Id: run09.mac,v 1.1 1999/10/11 13:07:28 maire Exp $
#
# Macro file for "TestEm1.cc"
# (can be run in batch, without graphic)
#
# electron 1 GeV; all processes
#
/control/verbose 2
#
/run/initialize
#
/process/eLoss/StepFunction 0.183 170 micrometer
/calor/cutG 2.2 mm
####/calor/cutE 1.4 micrometer #before beta03-00 (17.11.98)
/calor/cutE 6.05 micrometer #from beta03-00 (17.11.98)
/run/initialize
/run/particle/dumpCutValues
#
/run/verbose 2
/event/drawTracks none
#
/gun/particle e-
/gun/energy 1 GeV
/event/printModulo 10
/run/beamOn 100
@@ -0,0 +1,19 @@
# $Id: run11.mac,v 1.1 1999/10/11 13:07:29 maire Exp $
#
# Macro file for "TestEm1.cc"
# (can be run in batch, without graphic)
#
# Eloss only + muls; e- 1 GeV
#
/control/verbose 2
#
/calor/cutG 95 cm
/calor/cutE 17 cm
/run/initialize
#
/run/verbose 2
/event/drawTracks none
#
/gun/particle e-
/gun/energy 1 GeV
/run/beamOn 1000
@@ -0,0 +1,224 @@
// 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: Em1DetectorConstruction.cc,v 1.1.4.1 1999/12/07 20:46:55 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "Em1DetectorConstruction.hh"
#include "Em1DetectorMessenger.hh"
#include "G4Material.hh"
#include "G4Box.hh"
#include "G4LogicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4UniformMagField.hh"
#include "G4FieldManager.hh"
#include "G4TransportationManager.hh"
#include "G4RunManager.hh"
#include "G4VisAttributes.hh"
#include "G4Colour.hh"
#include "G4UnitsTable.hh"
#include "G4ios.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Em1DetectorConstruction::Em1DetectorConstruction()
:pBox (NULL), lBox (NULL),
aMaterial(NULL),
magField (NULL)
{
// create commands for interactive definition of the detector
detectorMessenger = new Em1DetectorMessenger(this);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Em1DetectorConstruction::~Em1DetectorConstruction()
{ delete detectorMessenger;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4VPhysicalVolume* Em1DetectorConstruction::Construct()
{
DefineMaterials();
BoxSize = 20*m;
return ConstructVolumes();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em1DetectorConstruction::DefineMaterials()
{
//This function illustrates the possible ways to define materials
G4String name, symbol; //a=mass of a mole;
G4double a, z, density; //z=mean number of protons;
G4int ncomponents, natoms;
G4double fractionmass;
//
// define Elements
//
a = 1.01*g/mole;
G4Element* H = new G4Element(name="Hydrogen",symbol="H" , z= 1., a);
a = 14.01*g/mole;
G4Element* N = new G4Element(name="Nitrogen",symbol="N" , z= 7., a);
a = 16.00*g/mole;
G4Element* O = new G4Element(name="Oxygen" ,symbol="O" , z= 8., a);
//
// define materials
//
density = 1.290*mg/cm3;
G4Material* Air = new G4Material(name="Air" , density, ncomponents=2);
Air->AddElement(N, fractionmass=70.*perCent);
Air->AddElement(O, fractionmass=30.*perCent);
density = 70.8*mg/cm3;
G4Material* H2l = new G4Material(name="H2liquid", density, ncomponents=1);
H2l->AddElement(H, fractionmass=1.);
density = 1.000*g/cm3;
G4Material* H2O = new G4Material(name="Water", density, ncomponents=2);
H2O->AddElement(H, natoms=2);
H2O->AddElement(O, natoms=1);
density = 1.390*g/cm3;
a = 39.95*g/mole;
G4Material* lAr = new G4Material(name="liquidArgon", z=18., a, density);
density = 2.700*g/cm3;
a = 26.98*g/mole;
G4Material* Al = new G4Material(name="Aluminium" , z=13., a, density);
density = 7.870*g/cm3;
a = 55.85*g/mole;
G4Material* Fe = new G4Material(name="Iron" , z=26., a, density);
density = 11.35*g/cm3;
a = 207.19*g/mole;
G4Material* Pb = new G4Material(name="Lead" , z=82., a, density);
density = 18.95*g/cm3;
a = 238.03*g/mole;
G4Material* U = new G4Material(name="Uranium" , z=82., a, density);
G4cout << *(G4Material::GetMaterialTable()) << endl;
//default materials of the calorimeter
aMaterial = Al;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4VPhysicalVolume* Em1DetectorConstruction::ConstructVolumes()
{
G4Box*
sBox = new G4Box("Container", //its name
BoxSize/2,BoxSize/2,BoxSize/2); //its dimensions
lBox = new G4LogicalVolume(sBox, //its shape
aMaterial, //its material
"Container"); //its name
pBox = new G4PVPlacement(0, //no rotation
G4ThreeVector(), //at (0,0,0)
"Container", //its name
lBox, //its logical volume
NULL, //its mother volume
false, //no boolean operation
0); //copy number
//
// Visualization attributes
//
G4VisAttributes* visAtt= new G4VisAttributes(G4Colour(1.0,1.0,1.0));
visAtt->SetVisibility(true);
lBox->SetVisAttributes(visAtt);
//
//always return the root volume
//
PrintParameters();
return pBox;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em1DetectorConstruction::PrintParameters()
{
G4cout << "\n The Box is " << G4BestUnit(BoxSize,"Length")
<< " of " << aMaterial->GetName() << endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em1DetectorConstruction::SetMaterial(G4String materialChoice)
{
// search the material by its name
G4Material* pttoMaterial = G4Material::GetMaterial(materialChoice);
if (pttoMaterial)
{aMaterial = pttoMaterial;
lBox->SetMaterial(aMaterial);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em1DetectorConstruction::SetSize(G4double value)
{
BoxSize = value;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em1DetectorConstruction::SetMagField(G4double fieldValue)
{
//apply a global uniform magnetic field along Z axis
G4FieldManager* fieldMgr
= G4TransportationManager::GetTransportationManager()->GetFieldManager();
if (magField) delete magField; //delete the existing magn field
if (fieldValue!=0.) // create a new one if non nul
{
magField = new G4UniformMagField(G4ThreeVector(0.,0.,fieldValue));
fieldMgr->SetDetectorField(magField);
fieldMgr->CreateChordFinder(magField);
}
else
{
magField = NULL;
fieldMgr->SetDetectorField(magField);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em1DetectorConstruction::UpdateGeometry()
{
G4RunManager::GetRunManager()->DefineWorldVolume(ConstructVolumes());
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,86 @@
// 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: Em1DetectorMessenger.cc,v 1.1.4.1 1999/12/07 20:46:55 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "Em1DetectorMessenger.hh"
#include "Em1DetectorConstruction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithoutParameter.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Em1DetectorMessenger::Em1DetectorMessenger(Em1DetectorConstruction * Em1Det)
:Em1Detector(Em1Det)
{
Em1detDir = new G4UIdirectory("/calor/");
Em1detDir->SetGuidance("Em1 detector control.");
MaterCmd = new G4UIcmdWithAString("/calor/setMat",this);
MaterCmd->SetGuidance("Select material of the box.");
MaterCmd->SetParameterName("choice",false);
MaterCmd->AvailableForStates(Idle);
SizeCmd = new G4UIcmdWithADoubleAndUnit("/calor/setSize",this);
SizeCmd->SetGuidance("Set size of the box");
SizeCmd->SetParameterName("Size",false);
SizeCmd->SetRange("Size>0.");
SizeCmd->SetUnitCategory("Length");
SizeCmd->AvailableForStates(Idle);
MagFieldCmd = new G4UIcmdWithADoubleAndUnit("/calor/setField",this);
MagFieldCmd->SetGuidance("Define magnetic field.");
MagFieldCmd->SetGuidance("Magnetic field will be in Z direction.");
MagFieldCmd->SetParameterName("Bz",false);
MagFieldCmd->SetUnitCategory("Magnetic flux density");
MagFieldCmd->AvailableForStates(Idle);
UpdateCmd = new G4UIcmdWithoutParameter("/calor/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(Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Em1DetectorMessenger::~Em1DetectorMessenger()
{
delete MaterCmd;
delete SizeCmd;
delete MagFieldCmd;
delete UpdateCmd;
delete Em1detDir;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em1DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
{
if( command == MaterCmd )
{ Em1Detector->SetMaterial(newValue);}
if( command == SizeCmd )
{ Em1Detector->SetSize(SizeCmd->GetNewDoubleValue(newValue));}
if( command == MagFieldCmd )
{ Em1Detector->SetMagField(MagFieldCmd->GetNewDoubleValue(newValue));}
if( command == UpdateCmd )
{ Em1Detector->UpdateGeometry(); }
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,92 @@
// 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: Em1EventAction.cc,v 1.1.4.1 1999/12/07 20:46:55 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "Em1EventAction.hh"
#include "Em1RunAction.hh"
#include "Em1EventActionMessenger.hh"
#include "G4Event.hh"
#include "G4EventManager.hh"
#include "G4TrajectoryContainer.hh"
#include "G4Trajectory.hh"
#include "G4VVisManager.hh"
#include "G4ios.hh"
#include "G4UnitsTable.hh"
#include "Randomize.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Em1EventAction::Em1EventAction(Em1RunAction* run)
:Em1Run(run),drawFlag("all"),printModulo(10000),eventMessenger(NULL)
{
eventMessenger = new Em1EventActionMessenger(this);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Em1EventAction::~Em1EventAction()
{
delete eventMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em1EventAction::BeginOfEventAction(const G4Event* evt)
{
G4int evtNb = evt->GetEventID();
if (evtNb%printModulo == 0)
G4cout << "\n---> Begin of Event: " << evtNb << endl;
TotalEnergyDeposit = 0.;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em1EventAction::EndOfEventAction(const G4Event* evt)
{
if (drawFlag != "none") G4cout << " Energy deposit: "
<< G4BestUnit(TotalEnergyDeposit,"Energy")
<< endl;
if (G4VVisManager::GetConcreteInstance())
{
const G4Event* evt = fpEventManager->GetConstCurrentEvent();
G4TrajectoryContainer* trajectoryContainer = evt->GetTrajectoryContainer();
G4int n_trajectories = 0;
if (trajectoryContainer) n_trajectories = trajectoryContainer->entries();
for(G4int i=0; i<n_trajectories; i++)
{ G4Trajectory* trj = (G4Trajectory*)((*(evt->GetTrajectoryContainer()))[i]);
if (drawFlag == "all") trj->DrawTrajectory(50);
else if ((drawFlag == "charged")&&(trj->GetCharge() != 0.))
trj->DrawTrajectory(50);
}
}
//save rndm status
if (Em1Run->GetRndmFreq() == 2)
{
HepRandom::saveEngineStatus("endOfEvent.rndm");
G4int evtNb = evt->GetEventID();
if (evtNb%printModulo == 0)
{
G4cout << "\n---> End of Event: " << evtNb << endl;
HepRandom::showEngineStatus();
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,63 @@
// 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: Em1EventActionMessenger.cc,v 1.1.4.1 1999/12/07 20:46:55 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "Em1EventActionMessenger.hh"
#include "Em1EventAction.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Em1EventActionMessenger::Em1EventActionMessenger(Em1EventAction* EvAct)
:eventAction(EvAct)
{
DrawCmd = new G4UIcmdWithAString("/event/drawTracks",this);
DrawCmd->SetGuidance("Draw the tracks in the event");
DrawCmd->SetGuidance(" Choice : none,charged, all");
DrawCmd->SetParameterName("choice",true);
DrawCmd->SetDefaultValue("all");
DrawCmd->SetCandidates("none charged all");
DrawCmd->AvailableForStates(Idle);
PrintCmd = new G4UIcmdWithAnInteger("/event/printModulo",this);
PrintCmd->SetGuidance("Print events modulo n");
PrintCmd->SetParameterName("EventNb",false);
PrintCmd->SetRange("EventNb>0");
PrintCmd->AvailableForStates(Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Em1EventActionMessenger::~Em1EventActionMessenger()
{
delete DrawCmd;
delete PrintCmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em1EventActionMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
{
if(command == DrawCmd)
{eventAction->SetDrawFlag(newValue);}
if(command == PrintCmd)
{eventAction->SetPrintModulo(PrintCmd->GetNewIntValue(newValue));}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,325 @@
// 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: Em1PhysicsList.cc,v 1.1.4.1 1999/12/07 20:46:55 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "Em1PhysicsList.hh"
#include "G4ParticleDefinition.hh"
#include "G4ParticleWithCuts.hh"
#include "G4ProcessManager.hh"
#include "G4ParticleTypes.hh"
#include "G4ParticleTable.hh"
#include "G4ios.hh"
#include "G4ParticleTable.hh"
#include "G4EnergyLossTables.hh"
#include "G4Material.hh"
#include "G4RunManager.hh"
#include "Em1DetectorConstruction.hh"
#include "Em1PhysicsListMessenger.hh"
#include "G4UImanager.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Em1PhysicsList::Em1PhysicsList(Em1DetectorConstruction* p)
: G4VUserPhysicsList()
{
pDet = p;
defaultCutValue = 1.*mm;
cutForGamma = defaultCutValue;
cutForElectron = defaultCutValue;
cutForProton = defaultCutValue;
SetVerboseLevel(1);
pMes = new Em1PhysicsListMessenger(this);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Em1PhysicsList::~Em1PhysicsList()
{ delete pMes; }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em1PhysicsList::ConstructParticle()
{
// In this method, static member functions should be called
// for all particles which you want to use.
// This ensures that objects of these particle types will be
// created in the program.
ConstructBosons();
ConstructLeptons();
ConstructMesons();
ConstructBarions();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em1PhysicsList::ConstructBosons()
{
// pseudo-particles
G4Geantino::GeantinoDefinition();
G4ChargedGeantino::ChargedGeantinoDefinition();
// gamma
G4Gamma::GammaDefinition();
// optical photon
G4OpticalPhoton::OpticalPhotonDefinition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em1PhysicsList::ConstructLeptons()
{
// leptons
G4Electron::ElectronDefinition();
G4Positron::PositronDefinition();
G4MuonPlus::MuonPlusDefinition();
G4MuonMinus::MuonMinusDefinition();
G4NeutrinoE::NeutrinoEDefinition();
G4AntiNeutrinoE::AntiNeutrinoEDefinition();
G4NeutrinoMu::NeutrinoMuDefinition();
G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em1PhysicsList::ConstructMesons()
{
// mesons
G4PionPlus::PionPlusDefinition();
G4PionMinus::PionMinusDefinition();
G4PionZero::PionZeroDefinition();
G4Eta::EtaDefinition();
G4EtaPrime::EtaPrimeDefinition();
G4RhoZero::RhoZeroDefinition();
G4KaonPlus::KaonPlusDefinition();
G4KaonMinus::KaonMinusDefinition();
G4KaonZero::KaonZeroDefinition();
G4AntiKaonZero::AntiKaonZeroDefinition();
G4KaonZeroLong::KaonZeroLongDefinition();
G4KaonZeroShort::KaonZeroShortDefinition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em1PhysicsList::ConstructBarions()
{
// barions
G4Proton::ProtonDefinition();
G4AntiProton::AntiProtonDefinition();
G4Neutron::NeutronDefinition();
G4AntiNeutron::AntiNeutronDefinition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em1PhysicsList::ConstructProcess()
{
AddTransportation();
ConstructEM();
ConstructGeneral();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "G4ComptonScattering.hh"
#include "G4GammaConversion.hh"
#include "G4PhotoElectricEffect.hh"
#include "G4MultipleScattering.hh"
#include "G4eIonisation.hh"
#include "G4eBremsstrahlung.hh"
#include "G4eplusAnnihilation.hh"
#include "G4MuIonisation.hh"
#include "G4MuBremsstrahlung.hh"
#include "G4MuPairProduction.hh"
#include "G4hIonisation.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em1PhysicsList::ConstructEM()
{
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);
} else if (particleName == "e-") {
//electron
pmanager->AddProcess(new G4MultipleScattering,-1, 1,1);
pmanager->AddProcess(new G4eIonisation, -1, 2,2);
pmanager->AddProcess(new G4eBremsstrahlung, -1,-1,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,-1,3);
pmanager->AddProcess(new G4eplusAnnihilation, 0,-1,4);
} else if( particleName == "mu+" ||
particleName == "mu-" ) {
//muon
pmanager->AddProcess(new G4MultipleScattering,-1, 1,1);
pmanager->AddProcess(new G4MuIonisation, -1, 2,2);
pmanager->AddProcess(new G4MuBremsstrahlung, -1,-1,3);
pmanager->AddProcess(new G4MuPairProduction, -1,-1,4);
} else if ((!particle->IsShortLived()) &&
(particle->GetPDGCharge() != 0.0) &&
(particle->GetParticleName() != "chargedgeantino")) {
//all others charged particles except geantino
pmanager->AddProcess(new G4MultipleScattering,-1,1,1);
pmanager->AddProcess(new G4hIonisation, -1,2,2);
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "G4Decay.hh"
void Em1PhysicsList::ConstructGeneral()
{
// Add Decay Process
G4Decay* theDecayProcess = new G4Decay();
theParticleIterator->reset();
while ((*theParticleIterator)()){
G4ParticleDefinition* particle = theParticleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
if (theDecayProcess->IsApplicable(*particle)) {
pmanager ->AddProcess(theDecayProcess);
// set ordering for PostStepDoIt and AtRestDoIt
pmanager ->SetProcessOrdering(theDecayProcess, idxPostStep);
pmanager ->SetProcessOrdering(theDecayProcess, idxAtRest);
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em1PhysicsList::SetCuts()
{
if (verboseLevel >0){
G4cout << "Em1PhysicsList::SetCuts:";
G4cout << "CutLength : " << defaultCutValue/mm << " (mm)" << endl;
}
// set cut values for gamma at first and for e- second and next for e+,
// because some processes for e+/e- need cut values for gamma
SetCutValue(cutForGamma, "gamma");
SetCutValue(cutForElectron, "e-");
SetCutValue(cutForElectron, "e+");
// set cut values for proton and anti_proton before all other hadrons
// because some processes for hadrons need cut values for proton/anti_proton
SetCutValue(cutForProton, "proton");
SetCutValue(cutForProton, "anti_proton");
SetCutValueForOthers(defaultCutValue);
if (verboseLevel>0) DumpCutValuesTable();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em1PhysicsList::SetGammaCut(G4double val)
{
ResetCuts();
cutForGamma = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em1PhysicsList::SetElectronCut(G4double val)
{
ResetCuts();
cutForElectron = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em1PhysicsList::SetProtonCut(G4double val)
{
ResetCuts();
cutForProton = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em1PhysicsList::SetCutsByEnergy(G4double val)
{
G4ParticleTable* theParticleTable = G4ParticleTable::GetParticleTable();
G4Material* currMat = pDet->GetMaterial();
// 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
G4ParticleDefinition* part;
G4double cut;
part = theParticleTable->FindParticle("e-");
cut = G4EnergyLossTables::GetRange(part,val,currMat);
SetCutValue(cut, "e-");
part = theParticleTable->FindParticle("e+");
cut = G4EnergyLossTables::GetRange(part,val,currMat);
SetCutValue(cut, "e+");
// set cut values for proton and anti_proton before all other hadrons
// because some processes for hadrons need cut values for proton/anti_proton
part = theParticleTable->FindParticle("proton");
cut = G4EnergyLossTables::GetRange(part,val,currMat);
SetCutValue(cut, "proton");
part = theParticleTable->FindParticle("anti_proton");
cut = G4EnergyLossTables::GetRange(part,val,currMat);
SetCutValue(cut, "anti_proton");
SetCutValueForOthers(cut);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em1PhysicsList::GetRange(G4double val)
{
G4ParticleTable* theParticleTable = G4ParticleTable::GetParticleTable();
G4Material* currMat = pDet->GetMaterial();
G4ParticleDefinition* part;
G4double cut;
part = theParticleTable->FindParticle("e-");
cut = G4EnergyLossTables::GetRange(part,val,currMat);
G4cout << "material : " << currMat->GetName() << endl;
G4cout << "particle : " << part->GetParticleName() << endl;
G4cout << "energy : " << val / keV << " (keV)" << endl;
G4cout << "range : " << cut / mm << " (mm)" << endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,91 @@
// 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: Em1PhysicsListMessenger.cc,v 1.1.4.1 1999/12/07 20:46:55 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "Em1PhysicsListMessenger.hh"
#include "Em1PhysicsList.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Em1PhysicsListMessenger::Em1PhysicsListMessenger(Em1PhysicsList* EvAct)
:physList(EvAct)
{
cutGCmd = new G4UIcmdWithADoubleAndUnit("/calor/cutG",this);
cutGCmd->SetGuidance("Set cut values by RANGE for Gamma.");
cutGCmd->SetParameterName("range",false);
cutGCmd->SetRange("range>0.");
cutGCmd->SetUnitCategory("Length");
cutGCmd->AvailableForStates(Idle);
cutECmd = new G4UIcmdWithADoubleAndUnit("/calor/cutE",this);
cutECmd->SetGuidance("Set cut values by RANGE for e- e+.");
cutECmd->SetParameterName("range",false);
cutECmd->SetRange("range>0.");
cutECmd->SetUnitCategory("Length");
cutECmd->AvailableForStates(Idle);
cutPCmd = new G4UIcmdWithADoubleAndUnit("/calor/cutP",this);
cutPCmd->SetGuidance("Set cut values by RANGE for proton and others.");
cutPCmd->SetParameterName("range",false);
cutPCmd->SetRange("range>0.");
cutPCmd->SetUnitCategory("Length");
cutPCmd->AvailableForStates(Idle);
eCmd = new G4UIcmdWithADoubleAndUnit("/calor/cutEnergy",this);
eCmd->SetGuidance("Set cut values by ENERGY for charged particles.");
eCmd->SetParameterName("energy",false);
eCmd->SetRange("energy>0.");
eCmd->SetUnitCategory("Energy");
eCmd->AvailableForStates(Idle);
rCmd = new G4UIcmdWithADoubleAndUnit("/calor/range",this);
rCmd->SetGuidance("Display the RANGE of Electron for the current material.");
rCmd->SetParameterName("energy",false);
rCmd->SetRange("energy>0.");
rCmd->SetUnitCategory("Energy");
rCmd->AvailableForStates(Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Em1PhysicsListMessenger::~Em1PhysicsListMessenger()
{
delete cutGCmd;
delete cutECmd;
delete cutPCmd;
delete rCmd;
delete eCmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em1PhysicsListMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
{
if(command == cutGCmd)
{physList->SetGammaCut(cutGCmd->GetNewDoubleValue(newValue));}
if(command == cutECmd)
{physList->SetElectronCut(eCmd->GetNewDoubleValue(newValue));}
if(command == cutPCmd)
{physList->SetProtonCut(eCmd->GetNewDoubleValue(newValue));}
if(command == eCmd)
{physList->SetCutsByEnergy(cutECmd->GetNewDoubleValue(newValue));}
if(command == rCmd)
{physList->GetRange(rCmd->GetNewDoubleValue(newValue));}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,55 @@
// 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: Em1PrimaryGeneratorAction.cc,v 1.1.4.1 1999/12/07 20:46:55 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "Em1PrimaryGeneratorAction.hh"
#include "G4Event.hh"
#include "G4ParticleGun.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Em1PrimaryGeneratorAction::Em1PrimaryGeneratorAction()
{
G4int n_particle = 1;
particleGun = new G4ParticleGun(n_particle);
// default particle kinematic
G4ParticleDefinition* particle
= G4ParticleTable::GetParticleTable()->FindParticle("e-");
particleGun->SetParticleDefinition(particle);
particleGun->SetParticleMomentumDirection(G4ThreeVector(1.,0.,0.));
particleGun->SetParticleEnergy(100*MeV);
particleGun->SetParticlePosition(G4ThreeVector(0.*cm,0.*cm,0.*cm));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Em1PrimaryGeneratorAction::~Em1PrimaryGeneratorAction()
{
delete particleGun;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em1PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
particleGun->GeneratePrimaryVertex(anEvent);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,153 @@
// 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: Em1RunAction.cc,v 1.1.4.1 1999/12/07 20:46:55 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "Em1RunAction.hh"
#include "Em1RunActionMessenger.hh"
#include "G4Run.hh"
#include "G4UImanager.hh"
#include "G4VVisManager.hh"
#include "G4ios.hh"
#include <iomanip.h>
#include "Randomize.hh"
#include "CLHEP/Hist/HBookFile.h"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Em1RunAction::Em1RunAction()
:hbookManager(NULL)
{runMessenger = new Em1RunActionMessenger(this);
saveRndm = 1;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Em1RunAction::~Em1RunAction()
{cleanHisto();
delete runMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em1RunAction::bookHisto()
{
hbookManager = new HBookFile("testem1.histo", 68);
// booking histograms
histo[0] = hbookManager->histogram("track length (mm) of a charged particle",100,0.,50*cm);
histo[1] = hbookManager->histogram("Nb of steps per track (charged particle)",100,0.,100.);
histo[2] = hbookManager->histogram("step length (mm) charged particle",100,0.,10*mm);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em1RunAction::cleanHisto()
{
delete [] histo;
delete hbookManager;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em1RunAction::BeginOfRunAction(const G4Run* aRun)
{
G4cout << "### Run " << aRun->GetRunID() << " start." << endl;
// save Rndm status
if (saveRndm > 0)
{ HepRandom::showEngineStatus();
HepRandom::saveEngineStatus("beginOfRun.rndm");
}
NbOfTraks0 = 0; NbOfTraks1 = 0; NbOfSteps0 = 0; NbOfSteps1 = 0;
ProcCounter = new ProcessesCount;
//histograms
//
if (aRun->GetRunID() == 0) bookHisto();
if (G4VVisManager::GetConcreteInstance())
{
G4UImanager* UI = G4UImanager::GetUIpointer();
UI->ApplyCommand("/vis/clear/view");
UI->ApplyCommand("/vis/draw/current");
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em1RunAction::CountProcesses(G4String procName)
{
//does the process already encounted ?
size_t nbProc = ProcCounter->entries();
size_t i = 0;
while ((i<nbProc)&&((*ProcCounter)[i]->GetName()!=procName)) i++;
if (i == nbProc) ProcCounter->insert( new OneProcessCount(procName));
(*ProcCounter)[i]->Count();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em1RunAction::EndOfRunAction(const G4Run* aRun)
{
G4int NbOfEvents = aRun->GetNumberOfEvent();
if (NbOfEvents)
{ //nb of tracks and steps per event
G4double dNbOfEvents = double(NbOfEvents);
G4long oldform = G4cout.setf(ios::fixed,ios::floatfield);
G4int oldprec = G4cout.precision(2);
G4cout << "\n nb tracks/event"
<< " neutral: " << setw(7) << NbOfTraks0/dNbOfEvents
<< " charged: " << setw(7) << NbOfTraks1/dNbOfEvents
<< "\n nb steps/event"
<< " neutral: " << setw(7) << NbOfSteps0/dNbOfEvents
<< " charged: " << setw(7) << NbOfSteps1/dNbOfEvents
<< endl;
//frequency of processes call
G4cout << "\n nb of process calls per event: \n ";
for (G4int i=0; i< ProcCounter->entries();i++)
G4cout << setw(9) << (*ProcCounter)[i]->GetName();
G4cout << "\n ";
for (G4int j=0; j< ProcCounter->entries();j++)
G4cout << setw(9) << ((*ProcCounter)[j]->GetCounter())/dNbOfEvents;
G4cout << endl;
G4cout.setf(oldform,ios::floatfield);
G4cout.precision(oldprec);
}
delete ProcCounter;
//draw the events
if (G4VVisManager::GetConcreteInstance())
G4UImanager::GetUIpointer()->ApplyCommand("/vis/show/view");
// writing histogram file
hbookManager->write();
// save Rndm status
if (saveRndm == 1)
{ HepRandom::showEngineStatus();
HepRandom::saveEngineStatus("endOfRun.rndm");
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,72 @@
// 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: Em1RunActionMessenger.cc,v 1.1.4.1 1999/12/07 20:46:55 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "Em1RunActionMessenger.hh"
#include "Em1RunAction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4ios.hh"
#include "globals.hh"
#include "Randomize.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Em1RunActionMessenger::Em1RunActionMessenger(Em1RunAction* run)
:Em1Run(run)
{
RndmDir = new G4UIdirectory("/rndm/");
RndmDir->SetGuidance("Rndm status control.");
RndmSaveCmd = new G4UIcmdWithAnInteger("/rndm/save",this);
RndmSaveCmd->SetGuidance("set frequency to save rndm status on external files.");
RndmSaveCmd->SetGuidance("freq = 0 not saved");
RndmSaveCmd->SetGuidance("freq > 0 saved on: beginOfRun.rndm");
RndmSaveCmd->SetGuidance("freq = 1 saved on: endOfRun.rndm");
RndmSaveCmd->SetGuidance("freq = 2 saved on: endOfEvent.rndm");
RndmSaveCmd->SetParameterName("frequency",false);
RndmSaveCmd->SetRange("frequency>=0 && frequency<=2");
RndmSaveCmd->AvailableForStates(PreInit,Idle);
RndmReadCmd = new G4UIcmdWithAString("/rndm/read",this);
RndmReadCmd->SetGuidance("get rndm status from an external file.");
RndmReadCmd->SetParameterName("fileName",true);
RndmReadCmd->SetDefaultValue ("beginOfRun.rndm");
RndmReadCmd->AvailableForStates(PreInit,Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Em1RunActionMessenger::~Em1RunActionMessenger()
{
delete RndmSaveCmd; delete RndmReadCmd; delete RndmDir;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em1RunActionMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
{
if (command == RndmSaveCmd)
Em1Run->SetRndmFreq(RndmSaveCmd->GetNewIntValue(newValue));
if (command == RndmReadCmd)
{ G4cout << "\n---> rndm status restored from file: " << newValue << endl;
HepRandom::restoreEngineStatus(newValue);
HepRandom::showEngineStatus();
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,52 @@
// 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: Em1SteppingAction.cc,v 1.1.4.1 1999/12/07 20:46:56 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "Em1SteppingAction.hh"
#include "Em1RunAction.hh"
#include "Em1EventAction.hh"
#include "G4SteppingManager.hh"
#include "G4VProcess.hh"
#include "CLHEP/Hist/HBookFile.h"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Em1SteppingAction::Em1SteppingAction(Em1RunAction* RuAct, Em1EventAction* EvAct)
:runAction(RuAct),eventAction(EvAct)
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Em1SteppingAction::~Em1SteppingAction()
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em1SteppingAction::UserSteppingAction(const G4Step* aStep)
{
G4double EdepStep = aStep->GetTotalEnergyDeposit();
if (EdepStep > 0.) eventAction->addEdep(EdepStep);
const G4VProcess* process = aStep->GetPostStepPoint()->GetProcessDefinedStep();
if (process) runAction->CountProcesses(process->GetProcessName());
G4double charge = aStep->GetTrack()->GetDefinition()->GetPDGCharge();
G4double steplen = aStep->GetStepLength();
if (charge != 0.) runAction->GetHisto(2)->accumulate(steplen);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,48 @@
// 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: Em1TrackingAction.cc,v 1.1.4.1 1999/12/07 20:46:56 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "Em1TrackingAction.hh"
#include "Em1RunAction.hh"
#include "G4Track.hh"
#include "CLHEP/Hist/HBookFile.h"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Em1TrackingAction::Em1TrackingAction(Em1RunAction* RunAct)
:runAction(RunAct)
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em1TrackingAction::PostUserTrackingAction(const G4Track* aTrack)
{
//increase nb of processed tracks
//count nb of steps of this track
G4int nbSteps = aTrack->GetCurrentStepNumber();
G4double Trleng = aTrack->GetTrackLength();
if (aTrack->GetDefinition()->GetPDGCharge() == 0.)
{runAction->CountTraks0(1); runAction->CountSteps0(nbSteps);}
else {runAction->CountTraks1(1); runAction->CountSteps1(nbSteps);
runAction->GetHisto(0)->accumulate(Trleng);
runAction->GetHisto(1)->accumulate((float)nbSteps);
}
}
@@ -0,0 +1,141 @@
// 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: Em1VisManager.cc,v 1.1.4.1 1999/12/07 20:46:56 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
// John Allison 24th January 1998.
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#ifdef G4VIS_USE
#include "Em1VisManager.hh"
// Supported drivers...
#ifdef G4VIS_USE_DAWN
#include "G4FukuiRenderer.hh"
#endif
#ifdef G4VIS_USE_DAWNFILE
#include "G4DAWNFILE.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_RAYX
#include "G4RayX.hh"
#endif
#ifdef G4VIS_USE_VRML
#include "G4VRML1.hh"
// #include "G4VRML2.hh"
#endif
#ifdef G4VIS_USE_VRMLFILE
#include "G4VRML1File.hh"
//#include "G4VRML2File.hh"
#endif
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Em1VisManager::Em1VisManager () {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em1VisManager::RegisterGraphicsSystems () {
#ifdef G4VIS_USE_DAWN
RegisterGraphicsSystem (new G4FukuiRenderer);
#endif
#ifdef G4VIS_USE_DAWNFILE
RegisterGraphicsSystem (new G4DAWNFILE);
#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_RAYX
RegisterGraphicsSystem (new G4RayX);
#endif
#ifdef G4VIS_USE_VRML
RegisterGraphicsSystem (new G4VRML1);
// RegisterGraphicsSystem (new G4VRML2);
#endif
#ifdef G4VIS_USE_VRMLFILE
RegisterGraphicsSystem (new G4VRML1File);
// RegisterGraphicsSystem (new G4VRML2File);
#endif
if (fVerbose > 0) {
G4cout <<
"\nYou have successfully chosen to use the following graphics systems."
<< endl;
PrintAvailableGraphicsSystems ();
}
}
#endif
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....