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 15:08:23 maire Exp $
# --------------------------------------------------------------
# GNUmakefile for examples module. Gabriele Cosmo, 06/04/98.
# --------------------------------------------------------------
name := TestEm2
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,110 @@
$Id: README,v 1.1 1999/10/11 15:08:24 maire Exp $
-------------------------------------------------------------------
=========================================================
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
=========================================================
TestEm2
-------
This example allows to do the shower development of an single primary
particle, and to survey the physics processes which occur,
with printing and visualization.
1- GEOMETRY DEFINITION
The geometry consists of a cylinder of homegenous material.
This cylinder is replicated longitudinaly (slice) and radialy (ring).
The default geometry is constructed in DetectorConstruction class,
but all of the above parameters can be modified interactively via
the commands defined in the DetectorMessenger class.
Material can be choosen: Air Water lAr Al Fe BGO PbWO4 Pb.
eg: /calor/setMat PbWO4
The size of the slices and rings are expressed in radiation length units
and can be changed.
eg: /calor/setLbin 20 1. ---> 20 slices of 1. radl
/calor/setRbin 5 0.25 ---> 5 rings of 0.25 radl
/calor/update ---> rebuild the geometry
An uniform magnetic field along the cylinder axis can be set.
eg: /calor/setField 5 tesla
2- AN EVENT : THE PRIMARY GENERATOR
The primary kinematic consists of a single particle which hits the
cylinder perpendicular to the input face. The type of the particle
and its energy are set in the PrimaryGeneratorAction class, and can
changed via the G4 build-in commands of ParticleGun class (see
the macros provided with this example).
A RUN is a set of events.
3- 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
cylinder.
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.
4- PHYSICS DEMO
The particle's type and the physic processes which will be available
in this example are set in PhysicsList class.
In addition a build-in interactive command (/process/inactivate proname)
allows to activate/inactivate the processes one by one.
The threshold for producing secondaries can be changed.
eg: /run/particle/setCut 100 microm
/run/initialize
5- HOW TO START ?
- compile and link to generate an executable
% cd TestEm2
% gmake
- execute TestEm2 in 'batch' mode from macro files
% TestEm2 run01.mac
- execute TestEm2 in 'interactive mode' with visualization
% TestEm2
....
Idle> type your commands. For instance:
Idle> /control/execute newgeom.mac
....
Idle> exit
7- HISTOGRAMS
Testem2 produces several histo which are saved as testem2.histo
under the control of the command /run/save on
Content of these histo:
1 : energy deposit per event
2 : charged track length per event
3 : neutral track length per event
4 : longitudinal energy profile
5 : cumulated longitudinal energy profile
6 : rms of cumulated longitudinal energy profile
7 : gamma's flux
8 : positron's flux
9 : electron's flux
10 : radial energy profile
11 : cumulated radial energy profile
12 : rms of cumulated radial energy profile
@@ -0,0 +1,90 @@
// 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: TestEm2.cc,v 1.1.4.1 1999/12/07 20:46:56 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
// Comments
//
//
// --------------------------------------------------------------
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "G4UIterminal.hh"
#include "Randomize.hh"
#ifdef G4VIS_USE
#include "Em2VisManager.hh"
#endif
#include "Em2DetectorConstruction.hh"
#include "Em2PhysicsList.hh"
#include "Em2PrimaryGeneratorAction.hh"
#include "Em2RunAction.hh"
#include "Em2EventAction.hh"
#include "Em2TrackingAction.hh"
#include "Em2SteppingAction.hh"
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
Em2DetectorConstruction* detector = new Em2DetectorConstruction;
runManager->SetUserInitialization(detector);
runManager->SetUserInitialization(new Em2PhysicsList);
Em2PrimaryGeneratorAction* primary = new Em2PrimaryGeneratorAction(detector);
runManager->SetUserAction(primary);
#ifdef G4VIS_USE
// visualization manager
G4VisManager* visManager = new Em2VisManager;
visManager->Initialize();
#endif
// set user action classes
Em2RunAction* RunAct = new Em2RunAction(detector,primary);
runManager->SetUserAction(RunAct);
runManager->SetUserAction(new Em2EventAction (RunAct));
runManager->SetUserAction(new Em2TrackingAction(RunAct));
runManager->SetUserAction(new Em2SteppingAction(detector,RunAct));
//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 G4VIS_USE
delete visManager;
#endif
delete runManager;
return 0;
}
@@ -0,0 +1,37 @@
testem2.cra is the geant3 equivalent of TestEm2
% cd geant3
% gmakeB to make an executable (Batch version)
% gmakeT to make an executable (inTeractive version)
To execute:
% cd geant3
% $G4SYSTEM/testem2.xb (for batch) or testem2.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)
testem2 produces several histo saved as testem2.histo if ISWIT(2)=1
Content of these histo:
1 : energy deposit per event
2 : charged track length per event
3 : neutral track length per event
4 : longitudinal energy profile
5 : cumulated longitudinal energy profile
6 : rms of cumulated longitudinal energy profile
7 : gamma's flux
8 : positron's flux
9 : electron's flux
10 : radial energy profile
11 : cumulated radial energy profile
12 : rms of cumulated radial energy profile
+43
View File
@@ -0,0 +1,43 @@
#
# @(#) Script to build a Batch geant executable
#
set name=testem2
set extnam=" "
if ($G4SYSTEM == AIX-xlC) 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=testem2
set extnam=" "
if ($G4SYSTEM == AIX-xlC) 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,18 @@
LIST
C
C PbWO4 L=20radl R=5radl
C e- 5 GeV 500 events
C
C
MATE 7
BINS 20 (nbZ) 20 (nbR) 1. (dZ/radl) 0.25 (dR/radl)
TRIG 500
KINE 3 (Itype) 5. (Ekine)
DEBUG 10 5 10
SWIT 0 (draw) 1 (save)
CUTS 10.0e-6 (cutgam) 10.0e-6 (cutele) 3*10.e-03 (cutneu/had/muo)
2*84.8e-6 (bcute/m) 2*1.13e-3 (dcute/m)
LOSS 1
HADR 0
ABAN 0
TIME 2=1.
@@ -0,0 +1,20 @@
LIST
C
C Al L=13.5radl R=1.35radl
C e- 1 GeV 500 events
C
C Experimental results: Electron-induced cascade showers
C J&H Crannel - Phys. Rev. 184-2 - August69
C
MATE 4
BINS 12 (nbZ) 12 (nbR) 1.1245 (dZ/radl) 0.11245 (dR/radl)
TRIG 500
KINE 3 (Itype) 1. (Ekine)
DEBUG 10 5 10
SWIT 0 (draw) 1 (save)
CUTS 10.0e-6 (cutgam) 10.0e-6 (cutele) 3*10.e-03 (cutneu/had/muo)
2*10.8e-6 (bcute/m) 2*1.03e-3 (dcute/m)
LOSS 1
HADR 0
ABAN 0
TIME 2=1.
@@ -0,0 +1,20 @@
LIST
C
C H2O L=9.97radl R=0.665radl
C e- 1 GeV 500 events
C
C Experimental results: Electron-induced cascade showers
C J&H Crannel - Phys. Rev. 184-2 - August69
C
MATE 2
BINS 9 (nbZ) 6 (nbR) 1.11 (dZ/radl) 0.111 (dR/radl)
TRIG 500
KINE 3 (Itype) 1. (Ekine)
DEBUG 10 5 10
SWIT 0 (draw) 1 (save)
CUTS 10.0e-6 (cutgam) 10.0e-6 (cutele) 3*10.e-03 (cutneu/had/muo)
2*10.0e-6 (bcute/m) 2*1.16e-3 (dcute/m)
LOSS 1
HADR 0
ABAN 0
TIME 2=1.
@@ -0,0 +1,20 @@
LIST
C
C Fe L=20 radl R=5 radl
C e- 30 GeV 100 events
C
C EGS4 simulation: Particle Data Group - Phys.Rev.D 50-3 - August94
C
C
MATE 5
BINS 40 (nbZ) 20 (nbR) 0.5 (dZ/radl) 0.25 (dR/radl)
TRIG 100
KINE 3 (Itype) 30. (Ekine)
DEBUG 10 5 10
SWIT 0 (draw) 1 (save)
CUTS 10.0e-6 (cutgam) 10.0e-6 (cutele) 3*10.e-03 (cutneu/had/muo)
2*18.4e-6 (bcute/m) 2*1.06e-3 (dcute/m)
LOSS 1
HADR 0
ABAN 0
TIME 2=1.
@@ -0,0 +1,586 @@
+OPTION,MAPASM.
+ASM,23.
+USE,GCDES,TestEm2,T=EXE.
*
+EXE,CRA*.
*
+PAM,11,T=CARD,T=ATTACH. /cern/pro/src/car/geant321.car
+PATCH,TestEm2.
+DECK,BLANKDEK.
*
* SHOWER 3.00 /01 900121 18.00 GEANT EXAMPLES
*
* TEST PROGRAM FOR GEANT/SHOWER STUDIES
*
* Authors R.Brun, M.Maire *********
*
* This program generates showers within a cylinder made of an
* homogeneous material.The statistics of shower profiles and
* particle's flux are computed and plotted.
* It has been used to do the GEANT/EGS comparison.(CERN/DD/85/1)
*
* The present release has been modified :
*
* - to increase the flexibility of the volume definition from
* data cards.(see description of the common /PVOLUM/ )
*
* - to permit to define all kinds of primary particles,i.e electrons
* as well pions ( ===> hadronic showers ).
* see data card KINE.
*
*
* History
* -------
*
* 08-02-99 : adapted for Geant4 comparison: electromagnetic/test/TestEm2
* 17-02-98 : adapted to Unix + interactive + graphic
* 21-01-90 : Simplified version (i.e. near gexam1)
* 06-04-89 : Add Hydrogen in the material library (imate=2)
* 10-02-89 : new histgrams for the resolution of the energy profile
*
+KEEP,PVOLUM.
COMMON/PVOLUM/ IMAT,NLTOT,NRTOT,DLX0,DRX0,X0,Z1,R1
*
* IMAT = GEANT material number. (data card MATE)
* NLTOT = total number of longitudinal bins. (data card BINS)
* NRTOT = total number of radial bins. (data card BINS)
* DLX0 = longitudinal bin length , in radiation length unit. (data card BINS)
* DRX0 = radial bin length , in radiation length unit. (data card BINS)
*
+KEEP,CELOSS.
PARAMETER (NBIN= 50)
COMMON/CELOSS/ SEL1(NBIN), SEL1C(NBIN), SER1(NBIN), SER1C(NBIN),
+ SEL2(NBIN), SEL2C(NBIN), SER2(NBIN), SER2C(NBIN),
+ DEDL(NBIN), DEDR(NBIN) , FNPAT(NBIN,3),
+ STRCH,STRCH1,STRCH2,STRNE,STRNE1,STRNE2
+DECK,main,if=batch.
PROGRAM main
*
*
PARAMETER (NGBANK=500000, NHBOOK=5000)
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,PVOLUM.
+SEQ,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 = 'testem2.dat'
OPEN (unit=5,file=filnam,status='unknown',form='formatted')
*
* *** material definition
CALL FFKEY('MATE',IMAT,1,'INTEGER')
*
* *** volumes and bins definition
CALL FFKEY('BINS',NLTOT,4,'MIXED')
*
* *** read data cards
CALL GFFGO
* *** achieve initialization
NLTOT = MIN(NLTOT,NBIN)
NRTOT = MIN(NRTOT,NBIN)
CALL VZERO(SEL1,13*NBIN+6)
*
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
*
END
+DECK,UGEOM.
SUBROUTINE UGEOM
*
* *** Define user geometry set up
*
+SEQ,GCBANK.
+SEQ,PVOLUM.
*
DIMENSION ZAir (2),AAir (2),WAir (2)
DIMENSION ZH2O (2),AH2O (2),WH2O (2)
DIMENSION ZBGO (3),ABGO (3),WBGO (3)
DIMENSION ZPbWO(3),APbWO(3),WPbWO(3)
DIMENSION PAR(3)
*
* *** Air mixture parameters
DATA ZAir/ 7.00, 8.00 /
DATA AAir/ 14.01, 16.00 /
DATA WAir/ 0.70, 0.30 /
*
* *** H2O compound parameters
DATA ZH2O/ 1.00, 8.00 /
DATA AH2O/ 1.01, 16.00 /
DATA WH2O/ 2. , 1. /
*
* *** BGO compound parameters
DATA ZBGO/ 8.00, 32.00, 83.00 /
DATA ABGO/ 16.00, 72.59, 208.98 /
DATA WBGO/ 12. , 3. , 4. /
*
* *** PbWO4 compound parameters
DATA ZPbWO/ 8.00, 74.00, 82.00 /
DATA APbWO/ 16.00, 183.84, 207.19 /
DATA WPbWO/ 4. , 1. , 1. /
*
* *** Defines USER perticular materials
*
CALL GSMIXT( 1,'Air' , AAir , ZAir , 1.29E-3, 2,WAir)
CALL GSMIXT( 2,'Water' , AH2O , ZH2O , 1.0 ,-2,WH2O)
CALL GSMATE( 3,'Ar Liquid', 40.00, 18. , 1.39 ,14.0 ,84.0,0,0)
CALL GSMATE( 4,'Aluminium', 26.98, 13. , 2.7 , 8.9 ,37.2,0,0)
CALL GSMATE( 5,'Iron' , 55.85, 26. , 7.87 , 1.76,17.1,0,0)
CALL GSMIXT( 6,'BGO' , ABGO , ZBGO , 7.1 ,-3,WBGO)
CALL GSMIXT( 7,'PbWO' , APbWO, ZPbWO, 8.28 ,-3,WPbWO)
CALL GSMATE( 8,'Lead ' ,207.19, 82. ,11.35 ,0.56,18.5,0,0)
*
* *** Defines USER tracking media parameters
FIELDM = 0.0
IFIELD = 0
TMAXFD = 10.0
STEMAX = 1000.
DEEMAX = 0.20
EPSIL = 0.001
STMIN = 0.010
*
CALL GSTMED( 1,'Absorber',IMAT, 0 ,IFIELD,FIELDM,TMAXFD,
* STEMAX,DEEMAX,EPSIL,STMIN, 0 , 0 )
*
* *** Defines USER'S VOLUMES
JMA = LQ(JMATE-IMAT)
X0 = Q(JMA + 9)
R1 = NRTOT*DRX0*X0
Z1 = NLTOT*DLX0*X0*0.5
*
PAR(1) = 0.
PAR(2) = R1
PAR(3) = Z1
CALL GSVOLU( 'ECAL' , 'TUBE' , 1, PAR , 3 , IVOL )
*
CALL GSDVN( 'RING' , 'ECAL' , NRTOT , 1)
CALL GSDVN( 'SLAB' , 'RING' , NLTOT , 3)
*
* *** Close geometry banks. (obligatory system routine)
CALL GGCLOS
**
* *** dessin
CALL GSATT ('*' ,'SEEN',1)
CALL GSATT ('RING','SEEN',0)
*
DO IX =1,3
CALL GDOPEN (IX)
SCALE = 9.5/Z1
PAXIS = 0.
SAXIS = 0.2*Z1
CALL GDRAWC ('ECAL',IX,0.,10.,10.,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
*
+SEQ,GCKINE
+SEQ,PVOLUM
*
* *** Histograms for showers development
*
EDMIN=0.
EDMAX=100.
TRKMX=100.*PKINE(1)
*
CALL HBOOK1(1,'total energy deposition (in percent of E inc)'
*,100,EDMIN,EDMAX,0.0)
CALL HBOOK1(2,'total charged tracklengh (in radl)'
*,100, 0. , TRKMX, 0.0)
CALL HBOOK1(3,'total neutral tracklengh (in radl)'
*,100, 0. , 10*TRKMX, 0.0)
*
CALL HIDOPT(0,'STAT')
*
* *** Longitudinal profile
ZMAX=NLTOT*DLX0
CALL HBPROF(4,'longit energy profile (in percent of E inc)'
*, NLTOT, 0.,ZMAX, 0., 1000.,' ')
*
ZMIN = 0.5*DLX0
ZMAX = ZMIN + NLTOT*DLX0
CALL HBPROF(5,'cumul longit energy dep. (in percent of E inc)'
*, NLTOT, ZMIN,ZMAX, 0., 100.,' ')
CALL HBOOK1(6,'resolution: cumul L energy dep. (% of E inc)'
*, NLTOT, ZMIN,ZMAX, 0.0)
*
* *** Particle flux
CALL HBPROF(7,'nb of gamma per plane'
*, NLTOT, ZMIN,ZMAX, 0., 1.E+6,' ')
CALL HBPROF(8,'nb of posit per plane'
*, NLTOT, ZMIN,ZMAX, 0., 1.E+6,' ')
CALL HBPROF(9,'nb of elect per plane'
*, NLTOT, ZMIN,ZMAX, 0., 1.E+6,' ')
*
* *** Radial profile
RMAX=NRTOT*DRX0
CALL HBPROF(10,'radial energy profile (in percent of E inc)'
*, NRTOT, 0.,RMAX, 0., 1000.,' ')
*
RMIN = 0.5*DRX0
RMAX = RMIN + NRTOT*DRX0
CALL HBPROF(11,'cumul radial energy dep. (in percent of E inc)'
*, NRTOT, RMIN,RMAX, 0., 100.,' ')
CALL HBOOK1(12,'resolution: cumul R energy dep. (% of E inc)'
*, NRTOT, RMIN,RMAX, 0.0)
*
END
+DECK,GUKINE
SUBROUTINE GUKINE
*
* Generates Kinematics for primary track
*
* Data card Kine : Itype Ekine
* (pkine(3) is used internaly to store Etot)
*
+SEQ,GCBANK,GCFLAG,GCKINE.
+SEQ,PVOLUM
*
DIMENSION VERTEX(3),PLAB(3)
DATA VERTEX/3*0./
DATA PLAB /3*0./
*
VERTEX(3) = - Z1 + 0.01
CALL GSVERT(VERTEX,0,0,0,0,NVERT)
*
JPA = LQ(JPART-IKINE)
XMASS = Q(JPA+7)
PKINE(3) = XMASS + PKINE(1)
PLAB(3) = SQRT(PKINE(1)*(PKINE(3)+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
*
CALL VZERO(DEDL,5*NBIN)
STRCH = 0.
STRNE = 0.
*
CALL GTREVE
*
END
+DECK,GUSTEP
SUBROUTINE GUSTEP
*
* User routine called at the end of each tracking step
*
+SEQ,GCFLAG,GCONST.
+SEQ,GCKINE,GCKING,GCTMED,GCTRAK,GCVOLU.
+SEQ,PVOLUM,CELOSS.
*
SAVE NLOLD
*
* *** Debug event and strore track 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
IF (DESTEP.GT.0.)THEN
NR = NUMBER(NLEVEL-1)
NL = NUMBER(NLEVEL)
DEDR(NR) = DEDR(NR) + DESTEP
DEDL(NL) = DEDL(NL) + DESTEP
ENDIF
*
* *** track length
IF (CHARGE.NE.0.) THEN
STRCH = STRCH + STEP
ELSE
STRNE = STRNE + STEP
ENDIF
*
* *** Particle's flux
NL = NUMBER(NLEVEL)
IF(SLENG.LE.0.) NLOLD = NL
IF(NL.NE.NLOLD) THEN
NPL = (NL + NLOLD)/2
IF (IPART.LE.3) FNPAT(NPL,IPART) = FNPAT(NPL,IPART) + 1.
NLOLD = NL
ENDIF
*
END
+DECK,GUOUT
SUBROUTINE GUOUT
*
* User routine called at the end of each event
*
+SEQ,GCFLAG,GCKINE.
+SEQ,PVOLUM,CELOSS.
*
* *** drawing
*
+self,if=-batch.
IF (ISWIT(1).NE.0) THEN
CALL GDHEAD (110110,'testem2',0.)
CALL GDSHOW (1)
CALL GDXYZ (0)
END IF
+self.
*
*
* *** statistic
*
DLC = 0.
DRC = 0.
* longitudinal profile
*
DO 2 I = 1,NLTOT
SEL1 (I) = SEL1 (I) + DEDL(I)
SEL2 (I) = SEL2 (I) + DEDL(I)**2
DLC = DLC + DEDL(I)
SEL1C(I) = SEL1C(I) + DLC
SEL2C(I) = SEL2C(I) + DLC**2
BIN = (FLOAT(I)-0.5)*DLX0
CALL HFILL(4,BIN,100*DEDL(I)/(DLX0*PKINE(3)),1.)
BIN = FLOAT(I)*DLX0
CALL HFILL(5,BIN,100*DLC /PKINE(3),1.)
2 CONTINUE
* radial profile
*
DO 3 I = 1,NRTOT
SER1 (I) = SER1 (I) + DEDR(I)
SER2 (I) = SER2 (I) + DEDR(I)**2
DRC = DRC + DEDR(I)
SER1C(I) = SER1C(I) + DRC
SER2C(I) = SER2C(I) + DRC**2
BIN = (FLOAT(I)-0.5)*DRX0
CALL HFILL(10,BIN,100*DEDR(I)/(DRX0*PKINE(3)),1.)
BIN = FLOAT(I)*DRX0
CALL HFILL(11,BIN,100*DRC /PKINE(3),1.)
3 CONTINUE
* particle flux
*
DO 14 IPAT = 1,3
DO 14 NPL = 1,NLTOT
BIN = FLOAT(NPL)*DLX0
CALL HFILL(6+IPAT,BIN,FNPAT(NPL,IPAT),1.)
14 CONTINUE
* energy deposited and track length
*
ESEEN = 100.*DLC/PKINE(3)
CALL HFILL(1, ESEEN,0.,1.)
CALL HFILL(2,STRCH/X0,0.,1.)
CALL HFILL(3,STRNE/X0,0.,1.)
*
STRCH1 = STRCH1 + STRCH
STRCH2 = STRCH2 + STRCH**2
STRNE1 = STRNE1 + STRNE
STRNE2 = STRNE2 + STRNE**2
*
END
+DECK,UGLAST
SUBROUTINE UGLAST
*
* Termination routine to print histograms and statistics
*
+SEQ,GCBANK,GCKINE,GCFLAG.
+SEQ,PVOLUM,CELOSS.
*
DIMENSION XSEL1(NBIN),XSEL1C(NBIN),XSER1(NBIN),XSER1C(NBIN),
+ XSEL2(NBIN),XSEL2C(NBIN),XSER2(NBIN),XSER2C(NBIN)
*
*
CALL GLAST
*
* *** close HIGZ
CALL HPLEND
*
* *** Normalize and print energy distribution
XEVENT=IEVENT
CNORM = 100./(XEVENT*PKINE(3))
*
* *** longitudinal profile
DO 2 I = 1,NLTOT
XSEL1 (I) = CNORM * SEL1 (I)
XSEL2 (I) = CNORM*SQRT(ABS(XEVENT*SEL2 (I) - SEL1 (I)**2))
XSEL1C(I) = CNORM * SEL1C(I)
XSEL2C(I) = CNORM*SQRT(ABS(XEVENT*SEL2C(I) - SEL1C(I)**2))
2 CONTINUE
CALL HPAK (6,XSEL2C)
*
* *** radial profile
DO 3 I = 1,NRTOT
XSER1 (I) = CNORM * SER1 (I)
XSER2 (I) = CNORM*SQRT(ABS(XEVENT*SER2 (I) - SER1 (I)**2))
XSER1C(I) = CNORM * SER1C(I)
XSER2C(I) = CNORM*SQRT(ABS(XEVENT*SER2C(I) - SER1C(I)**2))
3 CONTINUE
CALL HPAK (12,XSER2C)
*
* *** total track length
CNORM = 1./(XEVENT*X0)
XTRCH1 = CNORM*STRCH1
XTRCH2 = CNORM*SQRT(ABS(XEVENT*STRCH2 - STRCH1**2))
XTRNE1 = CNORM*STRNE1
XTRNE2 = CNORM*SQRT(ABS(XEVENT*STRNE2 - STRNE1**2))
*
* *** Print profiles
*
PRINT 749
PRINT 750
PRINT 751
DO 15 I=1,NLTOT
B0 = (I-1)*DLX0
B1 = I*DLX0
PRINT 754,B0,B1,XSEL1(I),XSEL2(I),B1,XSEL1C(I),XSEL2C(I)
15 CONTINUE
PRINT 760
PRINT 751
DO 16 I=1,NRTOT
B0 = (I-1)*DRX0
B1 = I*DRX0
PRINT 754,B0,B1,XSER1(I),XSER2(I),B1,XSER1C(I),XSER2C(I)
16 CONTINUE
*
* *** print summary
PRINT 770
PRINT 771,XSEL1C(NLTOT),XSEL2C(NLTOT)
PRINT 772,XTRCH1,XTRCH2
PRINT 773,XTRNE1,XTRNE2
*
* *** Save selected histograms
IF (ISWIT(2).EQ.1) THEN
CALL HRPUT(0,'testem2.histo','N')
ENDIF
*
749 FORMAT(///)
750 FORMAT(15X,'LATERAL PROFILE',35X,'CUMULATIVE LATERAL PROFILE'/)
751 FORMAT( 8X,'Bin',12X,' Mean ',5X,' rms',
* 19X,'Bin', 9X,' Mean ',5X,' rms',/)
754 FORMAT( 3X,F5.2,'->',F5.2,' radl: ',F7.2,'% ',F7.2,'%',
* 13X, '0->',F5.2,' radl: ',F7.2,'% ',F7.2,'%')
760 FORMAT(///,15X,'RADIAL PROFILE',35X,'CUMULATIVE RADIAL PROFILE'/)
770 FORMAT(///,30X,'SUMMARY',/)
771 FORMAT( 25X,'energy deposit : ',F7.2,' % E0 +- ',F7.2,' % E0')
772 FORMAT( 25X,'charged traklen: ',F7.2,' radl +- ',F7.2,' radl')
773 FORMAT( 25X,'neutral traklen: ',F7.2,' radl +- ',F7.2,' radl')
*
END
+DECK,ffread,T=data.
LIST
MATE 7
BINS 20 (nbZ) 20 (nbR) 1. (dZ/radl) 0.25 (dR/radl)
TRIG 500
KINE 3 (Itype) 5. (Ekine)
DEBUG 10 5 10
SWIT 0 (draw) 1 (save)
CUTS 10.0e-6 (cutgam) 10.0e-6 (cutele) 3*10.e-03 (cutneu/had/muo)
2*84.8e-6 (bcute/m) 2*1.13e-3 (dcute/m)
LOSS 1
HADR 0
ABAN 0
TIME 2=1.
+QUIT.
@@ -0,0 +1,97 @@
// 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: Em2DetectorConstruction.hh,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....
#ifndef Em2DetectorConstruction_h
#define Em2DetectorConstruction_h 1
#include "G4VUserDetectorConstruction.hh"
#include "globals.hh"
#include "G4ThreeVector.hh"
#include "G4Material.hh"
#include "G4VPhysicalVolume.hh"
class G4Tubs;
class G4LogicalVolume;
class G4UniformMagField;
class Em2DetectorMessenger;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class Em2DetectorConstruction : public G4VUserDetectorConstruction
{
public:
Em2DetectorConstruction();
~Em2DetectorConstruction();
public:
void SetMaterial(G4String);
void SetLBining (G4ThreeVector);
void SetRBining (G4ThreeVector);
void SetMagField(G4double);
G4VPhysicalVolume* Construct();
void UpdateGeometry();
public:
const
G4VPhysicalVolume* GetEcal() {return physiEcal;};
G4Material* GetMaterial() {return myMaterial;};
G4int GetnLtot() {return nLtot;};
G4int GetnRtot() {return nRtot;};
G4double GetdLradl() {return dLradl;};
G4double GetdRradl() {return dRradl;};
G4double GetfullLength() {return EcalLength;};
G4double GetfullRadius() {return EcalRadius;};
private:
G4int nLtot, nRtot; // nb of bins: longitudinal and radial
G4double dLradl, dRradl; // bin thickness (in radl unit)
G4Material* myMaterial; //pointer to the material
G4UniformMagField* magField; //pointer to the mag field
G4double EcalLength; //full length of the Calorimeter
G4double EcalRadius; //radius of the Calorimeter
G4Tubs* solidEcal; //pointer to the solid calorimeter
G4LogicalVolume* logicEcal; //pointer to the logical calorimeter
G4VPhysicalVolume* physiEcal; //pointer to the physical calorimeter
G4Tubs* solidSlice; //pointer to the solid L-slice
G4LogicalVolume* logicSlice; //pointer to the logical L-slide
G4VPhysicalVolume* physiSlice; //pointer to the physical L-slide
G4Tubs* solidRing; //pointer to the solid R-slice
G4LogicalVolume* logicRing; //pointer to the logical R-slide
G4VPhysicalVolume* physiRing; //pointer to the physical R-slide
Em2DetectorMessenger* detectorMessenger; //pointer to the Messenger object
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: Em2DetectorMessenger.hh,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....
#ifndef Em2DetectorMessenger_h
#define Em2DetectorMessenger_h 1
#include "globals.hh"
#include "G4UImessenger.hh"
class Em2DetectorConstruction;
class G4UIdirectory;
class G4UIcmdWithAString;
class G4UIcmdWith3Vector;
class G4UIcmdWithADoubleAndUnit;
class G4UIcmdWithoutParameter;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class Em2DetectorMessenger: public G4UImessenger
{
public:
Em2DetectorMessenger(Em2DetectorConstruction* );
~Em2DetectorMessenger();
void SetNewValue(G4UIcommand*, G4String);
private:
Em2DetectorConstruction* Em2Detector;
G4UIdirectory* Em2detDir;
G4UIcmdWithAString* MaterCmd;
G4UIcmdWith3Vector* LBinCmd;
G4UIcmdWith3Vector* RBinCmd;
G4UIcmdWithADoubleAndUnit* FieldCmd;
G4UIcmdWithoutParameter* UpdateCmd;
};
#endif
@@ -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: Em2EventAction.hh,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....
#ifndef Em2EventAction_h
#define Em2EventAction_h 1
#include "G4UserEventAction.hh"
#include "globals.hh"
class Em2RunAction;
class Em2EventActionMessenger;
class G4Event;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class Em2EventAction : public G4UserEventAction
{
public:
Em2EventAction(Em2RunAction*);
~Em2EventAction();
void BeginOfEventAction(const G4Event*);
void EndOfEventAction(const G4Event*);
void SetDrawFlag (G4String val) {drawFlag = val;};
void SetPrintModulo(G4int val) {printModulo = val;};
private:
Em2RunAction* Em2Run;
G4String drawFlag;
G4int printModulo;
Em2EventActionMessenger* 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: Em2EventActionMessenger.hh,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....
#ifndef Em2EventActionMessenger_h
#define Em2EventActionMessenger_h 1
#include "globals.hh"
#include "G4UImessenger.hh"
class Em2EventAction;
class G4UIcmdWithAString;
class G4UIcmdWithAnInteger;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class Em2EventActionMessenger: public G4UImessenger
{
public:
Em2EventActionMessenger(Em2EventAction*);
~Em2EventActionMessenger();
void SetNewValue(G4UIcommand*, G4String);
private:
Em2EventAction* eventAction;
G4UIcmdWithAString* DrawCmd;
G4UIcmdWithAnInteger* PrintCmd;
};
#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: Em2PhysicsList.hh,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....
#ifndef Em2PhysicsList_h
#define Em2PhysicsList_h 1
#include "G4VUserPhysicsList.hh"
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class Em2PhysicsList: public G4VUserPhysicsList
{
public:
Em2PhysicsList();
~Em2PhysicsList();
protected:
// Construct particles
void ConstructParticle();
void ConstructBosons();
void ConstructLeptons();
void ConstructMesons();
void ConstructBarions();
public:
void SetCuts();
protected:
// Construct processes and register them
void ConstructProcess();
void ConstructGeneral();
void ConstructEM();
};
#endif
@@ -0,0 +1,46 @@
// 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: Em2PrimaryGeneratorAction.hh,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....
#ifndef Em2PrimaryGeneratorAction_h
#define Em2PrimaryGeneratorAction_h 1
#include "G4VUserPrimaryGeneratorAction.hh"
#include "G4ParticleGun.hh"
#include "globals.hh"
class G4Event;
class Em2DetectorConstruction;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class Em2PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
{
public:
Em2PrimaryGeneratorAction(Em2DetectorConstruction*);
~Em2PrimaryGeneratorAction();
public:
void GeneratePrimaries(G4Event*);
G4ParticleGun* GetParticleGun() {return particleGun;};
private:
G4ParticleGun* particleGun;
Em2DetectorConstruction* Em2Detector;
};
#endif
@@ -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: Em2RunAction.hh,v 1.1.2.1.2.1 1999/12/07 20:46:56 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#ifndef Em2RunAction_h
#define Em2RunAction_h 1
#include "G4UserRunAction.hh"
#include "G4ParticleDefinition.hh"
#include "G4Gamma.hh"
#include "G4Electron.hh"
#include "G4Positron.hh"
#include "globals.hh"
#include "g4rw/tvvector.h"
typedef G4RWTValVector<G4double> MyVector;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class Em2DetectorConstruction;
class Em2PrimaryGeneratorAction;
class Em2RunActionMessenger;
class G4Run;
class HepTupleManager;
class HepHistogram;
class Em2RunAction : public G4UserRunAction
{
public:
Em2RunAction(Em2DetectorConstruction*, Em2PrimaryGeneratorAction*);
~Em2RunAction();
void BeginOfRunAction(const G4Run*);
void EndOfRunAction(const G4Run*);
inline void initializePerEvent();
void fillPerEvent();
inline void fillPerTrack(G4double,G4double);
inline void fillPerStep (G4double,G4int,G4int);
inline void particleFlux(G4ParticleDefinition*,G4int);
void SetSaveFlag (G4String val) {saveFlag = val;}
void SetRndmFreq(G4int val) {saveRndm = val;}
G4int GetRndmFreq() {return saveRndm;}
private:
void bookHisto();
void cleanHisto();
private:
Em2DetectorConstruction* Em2Det;
Em2PrimaryGeneratorAction* Em2Kin;
G4int nLbin;
MyVector dEdL;
MyVector sumELongit;
MyVector sumE2Longit;
MyVector sumELongitCumul;
MyVector sumE2LongitCumul;
G4int nRbin;
MyVector dEdR;
MyVector sumERadial;
MyVector sumE2Radial;
MyVector sumERadialCumul;
MyVector sumE2RadialCumul;
MyVector gammaFlux;
MyVector electronFlux;
MyVector positronFlux;
G4double ChargTrLength;
G4double sumChargTrLength;
G4double sum2ChargTrLength;
G4double NeutrTrLength;
G4double sumNeutrTrLength;
G4double sum2NeutrTrLength;
HepTupleManager* hbookManager;
HepHistogram *histo1, *histo2, *histo3;
HepHistogram *histo4, *histo5, *histo6;
HepHistogram *histo7, *histo8, *histo9;
HepHistogram *hist10, *hist11, *hist12;
Em2RunActionMessenger* runMessenger;
G4String saveFlag;
G4int saveRndm;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline
void Em2RunAction::initializePerEvent()
{
//initialize arrays of energy deposit per bin
for (G4int i=0; i<nLbin; i++)
{ dEdL(i) = 0.; }
for (G4int j=0; j<nRbin; j++)
{ dEdR(j) = 0.; }
//initialize tracklength
ChargTrLength = NeutrTrLength = 0.;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline
void Em2RunAction::fillPerTrack(G4double charge, G4double trkLength)
{
if (charge != 0.) ChargTrLength += trkLength;
else NeutrTrLength += trkLength;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline
void Em2RunAction::fillPerStep(G4double dEstep, G4int Lbin, G4int Rbin)
{
dEdL(Lbin) += dEstep; dEdR(Rbin) += dEstep;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline
void Em2RunAction::particleFlux(G4ParticleDefinition* particle, G4int Lplan)
{
if (particle == G4Gamma::Gamma()) gammaFlux(Lplan)++;
else if (particle == G4Electron::Electron()) electronFlux(Lplan)++;
else if (particle == G4Positron::Positron()) positronFlux(Lplan)++;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#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: Em2RunActionMessenger.hh,v 1.1.4.1 1999/12/07 20:46:57 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#ifndef Em2RunActionMessenger_h
#define Em2RunActionMessenger_h 1
#include "globals.hh"
#include "G4UImessenger.hh"
class Em2RunAction;
class G4UIdirectory;
class G4UIcmdWithAString;
class G4UIcmdWithAnInteger;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class Em2RunActionMessenger: public G4UImessenger
{
public:
Em2RunActionMessenger(Em2RunAction*);
~Em2RunActionMessenger();
void SetNewValue(G4UIcommand*, G4String);
private:
Em2RunAction* Em2Run;
G4UIcmdWithAString* SaveCmd;
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: Em2SteppingAction.hh,v 1.1.4.1 1999/12/07 20:46:57 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#ifndef Em2SteppingAction_h
#define Em2SteppingAction_h 1
#include "G4UserSteppingAction.hh"
class Em2DetectorConstruction;
class Em2RunAction;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class Em2SteppingAction : public G4UserSteppingAction
{
public:
Em2SteppingAction(Em2DetectorConstruction*,Em2RunAction*);
~Em2SteppingAction();
void UserSteppingAction(const G4Step*);
private:
Em2DetectorConstruction* Em2Det;
Em2RunAction* Em2Run;
};
#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: Em2TrackingAction.hh,v 1.1.4.1 1999/12/07 20:46:57 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
#ifndef Em2TrackingAction_h
#define Em2TrackingAction_h 1
#include "G4UserTrackingAction.hh"
class Em2RunAction;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class Em2TrackingAction : public G4UserTrackingAction {
public:
Em2TrackingAction(Em2RunAction*);
~Em2TrackingAction() {};
void PostUserTrackingAction(const G4Track*);
private:
Em2RunAction* Em2Run;
};
#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: Em2VisManager.hh,v 1.1.4.1 1999/12/07 20:46:57 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 Em2VisManager_h
#define Em2VisManager_h 1
#include "G4VisManager.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class Em2VisManager: public G4VisManager {
public:
Em2VisManager ();
private:
void RegisterGraphicsSystems ();
};
#endif
@@ -0,0 +1,35 @@
#
# Macro file for the initialization phase of "TestEm2.cc"
#
# Sets some default verbose
# and initializes the graphic.
#
/control/verbose 2
#
# 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/camera/viewpoint 90 180
/vis/draw/axes 0 0 0 20
/vis/camera/zoom 1.
/vis/scene/notifyHandlers
#
# for drawing the tracks
# if too many tracks cause core dump => storeTrajectory 0
/tracking/storeTrajectory 1
/event/drawTracks charged
#
/run/verbose 2
@@ -0,0 +1,22 @@
# $Id: run01.mac,v 1.1 1999/10/11 15:08:26 maire Exp $
#
# Macro file for "TestEm2.cc"
# (can be run in batch, without graphic)
#
# PbWO4 L = 20 radl R = 5 radl; electron 5 GeV
#
/control/verbose 2
#
#/run/particle/setCut 1.0 mm
#/run/initialize
#
/run/verbose 2
/event/drawTracks none
/event/printModulo 10
/run/save on
#
/gun/particle electron
/gun/energy 5 GeV
/run/beamOn 500
@@ -0,0 +1,30 @@
# $Id: run02.mac,v 1.1 1999/10/11 15:08:26 maire Exp $
#
# Macro file for "TestEm2.cc"
# (can be run in batch, without graphic)
#
# Al L = 13.5 radl R = 1.35 radl; electron 1 GeV
#
# Experimental results: Electron-induced cascade showers
# J&H Crannel - Phys. Rev. 184-2 - August69
#
/control/verbose 2
#
/calor/setMat Al
/calor/setLbin 12 1.1245
/calor/setRbin 12 0.11245
/calor/update
#
/run/particle/setCut 2.0 mm
/run/initialize
#
/run/verbose 2
/event/drawTracks none
/event/printModulo 10
/run/save on
#
/gun/particle electron
/gun/energy 1 GeV
/run/beamOn 500
@@ -0,0 +1,30 @@
# $Id: run03.mac,v 1.1 1999/10/11 15:08:26 maire Exp $
#
# Macro file for "TestEm2.cc"
# (can be run in batch, without graphic)
#
# H2O L = 9.97 radl R = 0.665 radl; electron 1 GeV
#
# Experimental results: Electron-induced cascade showers
# J&H Crannel - Phys. Rev. 184-2 - August69
#
/control/verbose 2
#
/calor/setMat Water
/calor/setLbin 9 1.11
/calor/setRbin 6 0.111
/calor/update
#
/run/particle/setCut 5.0 mm
/run/initialize
#
/run/verbose 2
/event/drawTracks none
/event/printModulo 10
/run/save on
#
/gun/particle electron
/gun/energy 1 GeV
/run/beamOn 500
@@ -0,0 +1,29 @@
# $Id: run04.mac,v 1.1 1999/10/11 15:08:27 maire Exp $
#
# Macro file for "TestEm2.cc"
# (can be run in batch, without graphic)
#
# Fe L = 20 radl R = 5 radl; electron 30 GeV
#
# EGS4 simulation: Particle Data Group - Phys.Rev.D 50-3 - August94
#
/control/verbose 2
#
/calor/setMat Fe
/calor/setLbin 40 0.5
/calor/setRbin 20 0.25
/calor/update
#
/run/particle/setCut 0.8 mm
/run/initialize
#
/run/verbose 2
/event/drawTracks none
/event/printModulo 10
/run/save on
#
/gun/particle electron
/gun/energy 30 GeV
/run/beamOn 100
@@ -0,0 +1,256 @@
// 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: Em2DetectorConstruction.cc,v 1.1.4.1 1999/12/07 20:46:57 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "Em2DetectorConstruction.hh"
#include "Em2DetectorMessenger.hh"
#include "G4Tubs.hh"
#include "G4LogicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4PVReplica.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....
Em2DetectorConstruction::Em2DetectorConstruction()
:solidEcal(NULL) ,logicEcal(NULL) ,physiEcal(NULL),
solidSlice(NULL),logicSlice(NULL),physiSlice(NULL),
solidRing(NULL) ,logicRing(NULL) ,physiRing(NULL),
myMaterial(NULL),magField(NULL) ,
nLtot(20),dLradl(1.),nRtot(20),dRradl(0.25),
EcalLength(0.),EcalRadius(0.)
{
detectorMessenger = new Em2DetectorMessenger(this);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Em2DetectorConstruction::~Em2DetectorConstruction()
{ delete detectorMessenger;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4VPhysicalVolume* Em2DetectorConstruction::Construct()
{
DefineMaterials();
return ConstructVolumes();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em2DetectorConstruction::DefineMaterials()
{
G4String name, symbol;
G4double a, z, density;
G4int ncomponents, natoms;
G4double fractionmass;
//
// define few 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);
a = 72.59*g/mole;
G4Element* Ge = new G4Element(name="Germanium", symbol="Ge",z=32., a);
a = 183.84*g/mole;
G4Element* W = new G4Element(name="Tungsten" , symbol="W", z=74., a);
a = 207.19*g/mole;
G4Element* Pb = new G4Element(name="Lead" , symbol="Pb",z=82., a);
a = 208.98*g/mole;
G4Element* Bi = new G4Element(name="Bismuth" , symbol="Bi",z=83., a);
//
// define materials
//
//Air
density = 1.29*mg/cm3;
G4Material* Air = new G4Material(name="Air", density, ncomponents=2);
Air->AddElement(N, fractionmass=0.7);
Air->AddElement(O, fractionmass=0.3);
//H2O
density = 1.00*g/cm3;
G4Material* H2O = new G4Material(name="Water", density, ncomponents=2);
H2O->AddElement(H, natoms=2);
H2O->AddElement(O, natoms=1);
//liquid argon
a = 39.95*g/mole;
density = 1.390*g/cm3;
G4Material* lAr = new G4Material(name="lAr", z=18., a, density);
//Al
a = 26.98*g/mole;
density = 2.7*g/cm3;
G4Material* Al = new G4Material(name="Al", z=13., a, density);
//Fe
a = 55.85*g/mole;
density = 7.87*g/cm3;
G4Material* Fe = new G4Material(name="Fe", z=26., a, density);
//BGO
density = 7.10*g/cm3;
G4Material* BGO = new G4Material(name="BGO", density, ncomponents=3);
BGO->AddElement(O , natoms=12);
BGO->AddElement(Ge, natoms= 3);
BGO->AddElement(Bi, natoms= 4);
//PbWO4
density = 8.28*g/cm3;
G4Material* PbWO = new G4Material(name="PbWO4", density, ncomponents=3);
PbWO->AddElement(O , natoms=4);
PbWO->AddElement(Pb, natoms=1);
PbWO->AddElement(W , natoms=1);
//Pb
density = 11.35*g/cm3;
G4Material* pb = new G4Material(name="Lead", density, ncomponents=1);
pb->AddElement(Pb, fractionmass=1.0);
G4cout << *(G4Material::GetMaterialTable()) << endl;
//choose material
myMaterial = PbWO;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4VPhysicalVolume* Em2DetectorConstruction::ConstructVolumes()
{
G4double Radl = myMaterial->GetRadlen();
G4double dL = dLradl*Radl, dR = dRradl*Radl;
EcalLength = nLtot*dL; EcalRadius = nRtot*dR;
//
// Ecal
//
solidEcal = new G4Tubs("Ecal",0.,EcalRadius,0.5*EcalLength,0.,360*deg);
logicEcal = new G4LogicalVolume( solidEcal,myMaterial,"Ecal",0,0,0);
physiEcal = new G4PVPlacement(0,G4ThreeVector(),
"Ecal",logicEcal,0,false,0);
// Ring
solidRing = new G4Tubs("Ring",0.,dR,0.5*EcalLength,0.,360*deg);
logicRing = new G4LogicalVolume(solidRing,myMaterial,"Ring",0,0,0);
if (nRtot >1)
physiRing = new G4PVReplica("Ring",logicRing,physiEcal,
kRho,nRtot,dR);
else
physiRing = new G4PVPlacement(0,G4ThreeVector(),"Ring",logicRing,
physiEcal,false,0);
// Slice
solidSlice = new G4Tubs("Slice",0.,dR,0.5*dL,0.,360*deg);
logicSlice = new G4LogicalVolume(solidSlice,myMaterial,"Slice",0,0,0);
if (nLtot >1)
physiSlice = new G4PVReplica("Slice",logicSlice,physiRing,
kZAxis,nLtot,dL);
else
physiSlice = new G4PVPlacement(0,G4ThreeVector(),"Slice",logicSlice,
physiRing,false,0);
cout << "Absorber is " << G4BestUnit(EcalLength,"Length")
<< " of " << myMaterial->GetName() << endl;
G4VisAttributes* VisAtt= new G4VisAttributes(G4Colour(1.0,1.0,1.0));
VisAtt->SetVisibility(true);
logicEcal->SetVisAttributes(VisAtt);
//
//always return the physical World
//
return physiEcal;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em2DetectorConstruction::SetMaterial(G4String materialChoice)
{
// search the material by its name
G4Material* pttoMaterial = G4Material::GetMaterial(materialChoice);
if (pttoMaterial)
{myMaterial = pttoMaterial;
logicEcal->SetMaterial(myMaterial);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em2DetectorConstruction::SetLBining(G4ThreeVector Value)
{
nLtot = (G4int)Value(0); dLradl = Value(1);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em2DetectorConstruction::SetRBining(G4ThreeVector Value)
{
nRtot = (G4int)Value(0); dRradl = Value(1);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em2DetectorConstruction::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 Em2DetectorConstruction::UpdateGeometry()
{
G4RunManager::GetRunManager()->DefineWorldVolume(ConstructVolumes());
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,98 @@
// 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: Em2DetectorMessenger.cc,v 1.1.4.1 1999/12/07 20:46:58 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "Em2DetectorMessenger.hh"
#include "Em2DetectorConstruction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWith3Vector.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithoutParameter.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Em2DetectorMessenger::Em2DetectorMessenger(Em2DetectorConstruction * Det)
:Em2Detector(Det)
{
Em2detDir = new G4UIdirectory("/calor/");
Em2detDir->SetGuidance("Em2 detector control.");
MaterCmd = new G4UIcmdWithAString("/calor/setMat",this);
MaterCmd->SetGuidance("Select Material.");
MaterCmd->SetParameterName("material",false);
MaterCmd->AvailableForStates(PreInit,Idle);
LBinCmd = new G4UIcmdWith3Vector("/calor/setLbin",this);
LBinCmd->SetGuidance("set longitudinal bining");
LBinCmd->SetGuidance("nb of bins; bin thickness (in radl)");
LBinCmd->SetParameterName("nLtot","dLradl"," ",true);
LBinCmd->SetRange("nLtot>=1 && dLradl>0");
LBinCmd->AvailableForStates(PreInit,Idle);
RBinCmd = new G4UIcmdWith3Vector("/calor/setRbin",this);
RBinCmd->SetGuidance("set radial bining");
RBinCmd->SetGuidance("nb of bins; bin thickness (in radl)");
RBinCmd->SetParameterName("nRtot","dRradl"," ",true);
RBinCmd->SetRange("nRtot>=1 && dRradl>0");
RBinCmd->AvailableForStates(PreInit,Idle);
FieldCmd = new G4UIcmdWithADoubleAndUnit("/calor/setField",this);
FieldCmd->SetGuidance("Define magnetic field.");
FieldCmd->SetGuidance("Magnetic field will be in Z direction.");
FieldCmd->SetParameterName("Bz",false);
FieldCmd->SetUnitCategory("Magnetic flux density");
FieldCmd->AvailableForStates(PreInit,Idle);
UpdateCmd = new G4UIcmdWithoutParameter("/calor/update",this);
UpdateCmd->SetGuidance("Update 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....
Em2DetectorMessenger::~Em2DetectorMessenger()
{
delete MaterCmd;
delete LBinCmd;
delete RBinCmd;
delete FieldCmd;
delete UpdateCmd;
delete Em2detDir;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em2DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
{
if( command == MaterCmd )
{ Em2Detector->SetMaterial(newValue);}
if( command == LBinCmd )
{ Em2Detector->SetLBining(LBinCmd->GetNew3VectorValue(newValue));}
if( command == RBinCmd )
{ Em2Detector->SetRBining(RBinCmd->GetNew3VectorValue(newValue));}
if( command == FieldCmd )
{ Em2Detector->SetMagField(FieldCmd->GetNewDoubleValue(newValue));}
if( command == UpdateCmd )
{ Em2Detector->UpdateGeometry();}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,89 @@
// 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: Em2EventAction.cc,v 1.1.4.1 1999/12/07 20:46:58 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "Em2EventAction.hh"
#include "Em2RunAction.hh"
#include "Em2EventActionMessenger.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....
Em2EventAction::Em2EventAction(Em2RunAction* run)
:Em2Run(run),drawFlag("charged"),printModulo(10000)
{
eventMessenger = new Em2EventActionMessenger(this);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Em2EventAction::~Em2EventAction()
{
delete eventMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em2EventAction::BeginOfEventAction(const G4Event* evt)
{
G4int evtNb = evt->GetEventID();
if (evtNb%printModulo == 0)
G4cout << "\n---> Begin Of Event: " << evtNb << endl;
Em2Run->initializePerEvent();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em2EventAction::EndOfEventAction(const G4Event* evt)
{
Em2Run->fillPerEvent();
if (G4VVisManager::GetConcreteInstance())
{
G4TrajectoryContainer * trajectoryContainer = evt->GetTrajectoryContainer();
G4int n_trajectories = 0;
if (trajectoryContainer) n_trajectories = trajectoryContainer->entries();
for (G4int i=0; i<n_trajectories; i++)
{ G4Trajectory* trj = (G4Trajectory *)((*(evt->GetTrajectoryContainer()))[i]);
if (drawFlag == "all") trj->DrawTrajectory(50);
else if ((drawFlag == "charged")&&(trj->GetCharge() != 0.))
trj->DrawTrajectory(50);
}
}
//save rndm status
if (Em2Run->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: Em2EventActionMessenger.cc,v 1.1.4.1 1999/12/07 20:46:58 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "Em2EventActionMessenger.hh"
#include "Em2EventAction.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Em2EventActionMessenger::Em2EventActionMessenger(Em2EventAction* 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("charged");
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....
Em2EventActionMessenger::~Em2EventActionMessenger()
{
delete DrawCmd;
delete PrintCmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em2EventActionMessenger::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,235 @@
// 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: Em2PhysicsList.cc,v 1.1.4.1 1999/12/07 20:46:58 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "Em2PhysicsList.hh"
#include "G4ParticleDefinition.hh"
#include "G4ParticleWithCuts.hh"
#include "G4ProcessManager.hh"
#include "G4ParticleTypes.hh"
#include "G4ParticleTable.hh"
#include "G4Material.hh"
#include "G4ios.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Em2PhysicsList::Em2PhysicsList()
: G4VUserPhysicsList()
{
defaultCutValue = 1.*mm;
SetVerboseLevel(1);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Em2PhysicsList::~Em2PhysicsList()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em2PhysicsList::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 Em2PhysicsList::ConstructBosons()
{
// pseudo-particles
G4Geantino::GeantinoDefinition();
G4ChargedGeantino::ChargedGeantinoDefinition();
// gamma
G4Gamma::GammaDefinition();
// optical photon
G4OpticalPhoton::OpticalPhotonDefinition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em2PhysicsList::ConstructLeptons()
{
// leptons
G4Electron::ElectronDefinition();
G4Positron::PositronDefinition();
G4MuonPlus::MuonPlusDefinition();
G4MuonMinus::MuonMinusDefinition();
G4NeutrinoE::NeutrinoEDefinition();
G4AntiNeutrinoE::AntiNeutrinoEDefinition();
G4NeutrinoMu::NeutrinoMuDefinition();
G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em2PhysicsList::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 Em2PhysicsList::ConstructBarions()
{
// barions
G4Proton::ProtonDefinition();
G4AntiProton::AntiProtonDefinition();
G4Neutron::NeutronDefinition();
G4AntiNeutron::AntiNeutronDefinition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em2PhysicsList::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 Em2PhysicsList::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 Em2PhysicsList::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 Em2PhysicsList::SetCuts()
{
if (verboseLevel >0){
G4cout << "Em2PhysicsList::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(defaultCutValue, "gamma");
SetCutValue(defaultCutValue, "e-");
SetCutValue(defaultCutValue, "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(defaultCutValue, "proton");
SetCutValue(defaultCutValue, "anti_proton");
SetCutValueForOthers(defaultCutValue);
if (verboseLevel>0) DumpCutValuesTable();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,60 @@
// 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: Em2PrimaryGeneratorAction.cc,v 1.1.4.1 1999/12/07 20:46:58 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "Em2PrimaryGeneratorAction.hh"
#include "Em2DetectorConstruction.hh"
#include "G4Event.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Em2PrimaryGeneratorAction::Em2PrimaryGeneratorAction(
Em2DetectorConstruction* det)
:Em2Detector(det)
{
G4int n_particle = 1;
particleGun = new G4ParticleGun(n_particle);
G4ParticleDefinition* particle
= G4ParticleTable::GetParticleTable()->FindParticle("e-");
particleGun->SetParticleDefinition(particle);
particleGun->SetParticleMomentumDirection(G4ThreeVector(0.,0.,1.));
particleGun->SetParticleEnergy(5.*GeV);
G4double position = -0.5*(Em2Detector->GetfullLength());
particleGun->SetParticlePosition(G4ThreeVector(0.*cm,0.*cm,position));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Em2PrimaryGeneratorAction::~Em2PrimaryGeneratorAction()
{
delete particleGun;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em2PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
//this function is called at the begining of event
//
G4double position = -0.5*(Em2Detector->GetfullLength());
particleGun->SetParticlePosition(G4ThreeVector(0.*cm,0.*cm,position));
particleGun->GeneratePrimaryVertex(anEvent);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,389 @@
// 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: Em2RunAction.cc,v 1.1.4.1 1999/12/07 20:46:58 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "Em2RunAction.hh"
#include "Em2DetectorConstruction.hh"
#include "Em2PrimaryGeneratorAction.hh"
#include "Em2RunActionMessenger.hh"
#include "G4Run.hh"
#include "G4UImanager.hh"
#include "G4VVisManager.hh"
#include "G4ios.hh"
#include "G4UnitsTable.hh"
#include <iomanip.h>
#include <assert.h>
#include "Randomize.hh"
#include "CLHEP/Hist/HBookFile.h"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Em2RunAction::Em2RunAction(Em2DetectorConstruction* det,
Em2PrimaryGeneratorAction* kin)
:Em2Det(det),Em2Kin(kin),hbookManager(NULL)
{
nLbin = Em2Det->GetnLtot();
dEdL = *new MyVector(nLbin);
sumELongit = *new MyVector(nLbin);
sumELongitCumul = *new MyVector(nLbin);
sumE2Longit = *new MyVector(nLbin);
sumE2LongitCumul = *new MyVector(nLbin);
gammaFlux = *new MyVector(nLbin);
electronFlux = *new MyVector(nLbin);
positronFlux = *new MyVector(nLbin);
nRbin = Em2Det->GetnRtot();
dEdR = *new MyVector(nRbin);
sumERadial = *new MyVector(nRbin);
sumERadialCumul = *new MyVector(nRbin);
sumE2Radial = *new MyVector(nRbin);
sumE2RadialCumul = *new MyVector(nRbin);
runMessenger = new Em2RunActionMessenger(this);
saveFlag = "off";
saveRndm = 1;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Em2RunAction::~Em2RunAction()
{
cleanHisto();
delete runMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em2RunAction::bookHisto()
{
hbookManager = new HBookFile("TestEm2.histo", 68);
assert (hbookManager != 0);
G4double Ekin = Em2Kin->GetParticleGun()->GetParticleEnergy();
G4double dLradl = Em2Det->GetdLradl();
G4double dRradl = Em2Det->GetdRradl();
histo1 = hbookManager->histogram("total energy deposit (percent of E inc)",
100,0.,100.);
histo2 = hbookManager->histogram("total charged tracklength (radl)",
100,0.,100.*Ekin/GeV);
histo3 = hbookManager->histogram("total neutral tracklength (radl)",
100,0.,1000.*Ekin/GeV);
histo4 = hbookManager->histogram("longit energy profile (% of E inc)",
nLbin,0.,nLbin*dLradl);
G4double Zmin=0.5*dLradl, Zmax=Zmin+nLbin*dLradl;
histo5 = hbookManager->histogram("cumul longit energy dep (% of E inc)",
nLbin,Zmin,Zmax);
histo6 = hbookManager->histogram("rms on cumul longit Edep (% of E inc)",
nLbin,Zmin,Zmax);
histo7 = hbookManager->histogram("nb of gamma per plane",
nLbin,Zmin,Zmax);
histo8 = hbookManager->histogram("nb of positron per plane",
nLbin,Zmin,Zmax);
histo9 = hbookManager->histogram("nb of electron per plane",
nLbin,Zmin,Zmax);
hist10 = hbookManager->histogram("radial energy profile (% of E inc)",
nRbin,0.,nRbin*dRradl);
G4double Rmin=0.5*dRradl, Rmax=Rmin+nRbin*dRradl;
hist11 = hbookManager->histogram("cumul radial energy dep (% of E inc)",
nRbin,Rmin,Rmax);
hist12 = hbookManager->histogram("rms on cumul radial Edep (% of E inc)",
nRbin,Rmin,Rmax);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em2RunAction::cleanHisto()
{
delete histo1; delete histo2; delete histo3;
delete histo4; delete histo5; delete histo6;
delete histo7; delete histo8; delete histo9;
delete hist10; delete hist11; delete hist12;
delete hbookManager;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em2RunAction::BeginOfRunAction(const G4Run* aRun)
{
G4cout << "### Run " << aRun->GetRunID() << " start." << endl;
// save Rndm status
if (saveRndm > 0)
{ HepRandom::showEngineStatus();
HepRandom::saveEngineStatus("beginOfRun.rndm");
}
//reshape arrays if needed
//
G4bool rebin(false);
G4int nLtot = Em2Det->GetnLtot();
if(nLbin != nLtot)
{dEdL.reshape(nLbin=nLtot);
sumELongit.reshape(nLbin) ; sumE2Longit.reshape(nLbin);
sumELongitCumul.reshape(nLbin); sumE2LongitCumul.reshape(nLbin);
gammaFlux.reshape(nLbin) ;
electronFlux.reshape(nLbin) ; positronFlux.reshape(nLbin);
rebin=true;
}
G4int nRtot = Em2Det->GetnRtot();
if(nRbin != nRtot)
{dEdR.reshape(nRbin=nRtot);
sumERadial.reshape(nRbin) ; sumE2Radial.reshape(nRbin);
sumERadialCumul.reshape(nRbin); sumE2RadialCumul.reshape(nRbin);
rebin=true;
}
//initialize arrays of cumulative energy deposition
//
for (G4int i=0; i<nLbin; i++)
sumELongit(i)=sumE2Longit(i)=sumELongitCumul(i)=sumE2LongitCumul(i)=0.;
for (G4int j=0; j<nRbin; j++)
sumELongit(j)=sumE2Longit(j)=sumELongitCumul(j)=sumE2LongitCumul(j)=0.;
//initialize track length
sumChargTrLength=sum2ChargTrLength=sumNeutrTrLength=sum2NeutrTrLength=0.;
//histograms
//
if (aRun->GetRunID() == 0) bookHisto();
else if (rebin) {cleanHisto(); bookHisto();}
//drawing
//
if (G4VVisManager::GetConcreteInstance())
{
G4UImanager* UI = G4UImanager::GetUIpointer();
UI->ApplyCommand("/vis/clear/view");
UI->ApplyCommand("/vis/draw/current");
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em2RunAction::fillPerEvent()
{
//accumulate statistic
//
G4double dLCumul = 0.;
for (G4int i=0; i<nLbin; i++)
{
sumELongit(i) += dEdL(i);
sumE2Longit(i) += dEdL(i)*dEdL(i);
dLCumul += dEdL(i);
sumELongitCumul(i) += dLCumul;
sumE2LongitCumul(i) += dLCumul*dLCumul;
}
G4double dRCumul = 0.;
for (G4int j=0; j<nRbin; j++)
{
sumERadial(j) += dEdR(j);
sumE2Radial(j) += dEdR(j)*dEdR(j);
dRCumul += dEdR(j);
sumERadialCumul(j) += dRCumul;
sumE2RadialCumul(j) += dRCumul*dRCumul;
}
sumChargTrLength += ChargTrLength;
sum2ChargTrLength += ChargTrLength*ChargTrLength;
sumNeutrTrLength += NeutrTrLength;
sum2NeutrTrLength += NeutrTrLength*NeutrTrLength;
//fill histograms
//
G4double Ekin=Em2Kin->GetParticleGun()->GetParticleEnergy();
G4double mass=Em2Kin->GetParticleGun()->GetParticleDefinition()->GetPDGMass();
G4double radl=Em2Det->GetMaterial()->GetRadlen();
histo1->accumulate(100.*dLCumul/(Ekin+mass));
histo2->accumulate(ChargTrLength/radl);
histo3->accumulate(NeutrTrLength/radl);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em2RunAction::EndOfRunAction(const G4Run* aRun)
{
if (G4VVisManager::GetConcreteInstance())
G4UImanager::GetUIpointer()->ApplyCommand("/vis/show/view");
//compute and print statistic
//
G4int NbOfEvents = aRun->GetNumberOfEvent();
G4double kinEnergy = Em2Kin->GetParticleGun()->GetParticleEnergy();
assert(NbOfEvents*kinEnergy > 0);
G4double mass=Em2Kin->GetParticleGun()->GetParticleDefinition()->GetPDGMass();
G4double norme = 100./(NbOfEvents*(kinEnergy+mass));
//longitudinal
//
G4double dLradl = Em2Det->GetdLradl();
MyVector MeanELongit (nLbin), rmsELongit (nLbin);
MyVector MeanELongitCumul(nLbin), rmsELongitCumul(nLbin);
G4int i; G4double bin;
for (i=0; i<nLbin; i++)
{
MeanELongit(i) = norme*sumELongit(i);
rmsELongit(i) = norme*sqrt(abs(NbOfEvents*sumE2Longit(i)
- sumELongit(i)*sumELongit(i)));
MeanELongitCumul(i) = norme*sumELongitCumul(i);
rmsELongitCumul(i) = norme*sqrt(abs(NbOfEvents*sumE2LongitCumul(i)
- sumELongitCumul(i)*sumELongitCumul(i)));
gammaFlux (i) /= NbOfEvents;
electronFlux(i) /= NbOfEvents;
positronFlux(i) /= NbOfEvents;
bin = i*dLradl;
histo4->accumulate(bin,MeanELongit(i)/dLradl);
bin = (i+1)*dLradl;
histo5->accumulate(bin,MeanELongitCumul(i));
histo6->accumulate(bin, rmsELongitCumul(i));
histo7->accumulate(bin, gammaFlux(i));
histo8->accumulate(bin, electronFlux(i));
histo9->accumulate(bin, positronFlux(i));
}
//radial
//
G4double dRradl = Em2Det->GetdRradl();
MyVector MeanERadial (nRbin), rmsERadial (nRbin);
MyVector MeanERadialCumul(nRbin), rmsERadialCumul(nRbin);
for (i=0; i<nRbin; i++)
{
MeanERadial(i) = norme*sumERadial(i);
rmsERadial(i) = norme*sqrt(abs(NbOfEvents*sumE2Radial(i)
- sumERadial(i)*sumERadial(i)));
MeanERadialCumul(i) = norme*sumERadialCumul(i);
rmsERadialCumul(i) = norme*sqrt(abs(NbOfEvents*sumE2RadialCumul(i)
- sumERadialCumul(i)*sumERadialCumul(i)));
bin = i*dRradl;
hist10->accumulate(bin,MeanERadial(i)/dRradl);
bin = (i+1)*dRradl;
hist11->accumulate(bin,MeanERadialCumul(i));
hist12->accumulate(bin, rmsERadialCumul(i));
}
//track length
//
norme = 1./(NbOfEvents*(Em2Det->GetMaterial()->GetRadlen()));
G4double MeanChargTrLength = norme*sumChargTrLength;
G4double rmsChargTrLength = norme*sqrt(abs(NbOfEvents*sum2ChargTrLength
- sumChargTrLength*sumChargTrLength));
G4double MeanNeutrTrLength = norme*sumNeutrTrLength;
G4double rmsNeutrTrLength = norme*sqrt(abs(NbOfEvents*sum2NeutrTrLength
- sumNeutrTrLength*sumNeutrTrLength));
//print
//
G4long oldform = G4cout.setf(ios::fixed,ios::floatfield);
G4int oldprec = G4cout.precision(2);
G4cout << " LATERAL PROFILE "
<< " CUMULATIVE LATERAL PROFILE" << endl << endl;
G4cout << " bin " << " Mean rms "
<< " bin " << " Mean rms \n" << endl;
for (i=0; i<nLbin; i++)
{
G4double inf=i*dLradl, sup=inf+dLradl;
G4cout << setw(8) << inf << "->" << setw(5) << sup << " radl: "
<< setw(7) << MeanELongit(i) << "% "
<< setw(9) << rmsELongit(i) << "% "
<< " 0->" << setw(5) << sup << " radl: "
<< setw(7) << MeanELongitCumul(i) << "% "
<< setw(7) << rmsELongitCumul(i) << "% "
<<endl;
}
G4cout << endl << endl << endl;
G4cout << " RADIAL PROFILE "
<< " CUMULATIVE RADIAL PROFILE" << endl << endl;
G4cout << " bin " << " Mean rms "
<< " bin " << " Mean rms \n" << endl;
for (i=0; i<nRbin; i++)
{
G4double inf=i*dRradl, sup=inf+dRradl;
G4cout << setw(8) << inf << "->" << setw(5) << sup << " radl: "
<< setw(7) << MeanERadial(i) << "% "
<< setw(9) << rmsERadial(i) << "% "
<< " 0->" << setw(5) << sup << " radl: "
<< setw(7) << MeanERadialCumul(i) << "% "
<< setw(7) << rmsERadialCumul(i) << "% "
<<endl;
}
G4cout << endl;
G4cout << setw(37) << "SUMMARY" << endl;
G4cout << setw(42) << "energy deposit : "
<< setw(7) << MeanELongitCumul(nLbin-1) << " % E0 +- "
<< setw(7) << rmsELongitCumul(nLbin-1) << " % E0" << endl;
G4cout << setw(42) << "charged traklen: "
<< setw(7) << MeanChargTrLength << " radl +- "
<< setw(7) << rmsChargTrLength << " radl" << endl;
G4cout << setw(42) << "neutral traklen: "
<< setw(7) << MeanNeutrTrLength << " radl +- "
<< setw(7) << rmsNeutrTrLength << " radl" << endl;
G4cout.setf(oldform,ios::floatfield);
G4cout.precision(oldprec);
// Write histogram file
if (saveFlag == "on") hbookManager->write();
// save Rndm status
if (saveRndm == 1)
{ HepRandom::showEngineStatus();
HepRandom::saveEngineStatus("endOfRun.rndm");
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,83 @@
// 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: Em2RunActionMessenger.cc,v 1.1.4.1 1999/12/07 20:46:59 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "Em2RunActionMessenger.hh"
#include "Em2RunAction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4ios.hh"
#include "globals.hh"
#include "Randomize.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Em2RunActionMessenger::Em2RunActionMessenger(Em2RunAction* run)
:Em2Run(run)
{
SaveCmd = new G4UIcmdWithAString("/run/save",this);
SaveCmd->SetGuidance("Save run statistic (histo)");
SaveCmd->SetGuidance(" Choice : on,off(default)");
SaveCmd->SetParameterName("choice",true);
SaveCmd->SetDefaultValue("on");
SaveCmd->SetCandidates("on off");
SaveCmd->AvailableForStates(Idle);
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....
Em2RunActionMessenger::~Em2RunActionMessenger()
{
delete SaveCmd;
delete RndmSaveCmd; delete RndmReadCmd; delete RndmDir;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em2RunActionMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
{
if (command == SaveCmd) Em2Run->SetSaveFlag(newValue);
if (command == RndmSaveCmd)
Em2Run->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,64 @@
// 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: Em2SteppingAction.cc,v 1.1.4.1 1999/12/07 20:46:59 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "Em2SteppingAction.hh"
#include "Em2DetectorConstruction.hh"
#include "Em2RunAction.hh"
#include "G4SteppingManager.hh"
#include "G4VTouchable.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Em2SteppingAction::Em2SteppingAction(Em2DetectorConstruction* det,
Em2RunAction* run)
:Em2Det(det),Em2Run(run)
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Em2SteppingAction::~Em2SteppingAction()
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em2SteppingAction::UserSteppingAction(const G4Step* aStep)
{
G4Track* aTrack = aStep->GetTrack();
// energy deposit
//
G4int SlideNb(0), RingNb(0);
if (Em2Det->GetnRtot()>1)
RingNb = aStep->GetPreStepPoint()->GetTouchable()->GetReplicaNumber(1);
if (Em2Det->GetnLtot()>1)
SlideNb = aStep->GetPreStepPoint()->GetTouchable()->GetReplicaNumber();
G4double dEStep = aStep->GetTotalEnergyDeposit();
if (dEStep > 0.) Em2Run->fillPerStep(dEStep,SlideNb,RingNb);
// particle flux
//
if ((Em2Det->GetnLtot()>1)&&
(aStep->GetPostStepPoint()->GetTouchable()->GetVolume()))
{
G4int next = aStep->GetPostStepPoint()->GetTouchable()->GetReplicaNumber();
if (next != SlideNb)
Em2Run->particleFlux(aTrack->GetDefinition(), (SlideNb+next)/2);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,40 @@
// 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: Em2TrackingAction.cc,v 1.1.4.1 1999/12/07 20:46:59 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "Em2TrackingAction.hh"
#include "Em2RunAction.hh"
#include "G4TrackingManager.hh"
#include "G4Track.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Em2TrackingAction::Em2TrackingAction(Em2RunAction* run)
:Em2Run(run)
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em2TrackingAction::PostUserTrackingAction(const G4Track* aTrack)
{
//count total track length
G4double charge = aTrack->GetDefinition()->GetPDGCharge();
G4double TrLeng = aTrack->GetTrackLength();
Em2Run->fillPerTrack(charge,TrLeng);
}
@@ -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: Em2VisManager.cc,v 1.1.4.1 1999/12/07 20:46:59 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 "Em2VisManager.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....
Em2VisManager::Em2VisManager () {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em2VisManager::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....