Import Geant4 6.2.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 10:56:29 +02:00
parent 1d812b78b1
commit e083ffb441
1415 changed files with 111223 additions and 21207 deletions
@@ -1,4 +1,4 @@
# $Id: GNUmakefile,v 1.12 2004/01/21 17:29:21 maire Exp $
# $Id: GNUmakefile,v 1.16 2004/06/21 10:52:54 maire Exp $
# --------------------------------------------------------------
# GNUmakefile for examples module. Gabriele Cosmo, 06/04/98.
# --------------------------------------------------------------
@@ -14,15 +14,20 @@ endif
.PHONY: all
all: lib bin
###G4ANALYSIS_USE := true
#### G4ANALYSIS_USE := true
ifdef G4ANALYSIS_USE
USE_AIDA := true
CPPFLAGS += -DG4ANALYSIS_USE
endif
ifdef USE_AIDA
CPPFLAGS += -DUSE_AIDA
endif
include $(G4INSTALL)/config/architecture.gmk
ifdef G4ANALYSIS_USE
ifdef USE_AIDA
# for the aida-config command see the README file
CPPFLAGS += `aida-config --include`
LDFLAGS += `aida-config --lib`
@@ -1,4 +1,4 @@
$Id: History,v 1.43 2004/01/21 17:29:22 maire Exp $
$Id: History,v 1.57 2004/06/21 10:52:54 maire Exp $
-------------------------------------------------------------------
=========================================================
@@ -13,7 +13,39 @@ track of all tags.
----------------------------------------------------------
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
---------------------------------------------------------
21-06-04 mma (testem3-V06-01-04)
- remove direct interface to ROOT
15-06-04 mma (testem3-V06-01-03)
- introduction of the class HistoManager (like TestEm5)
- EndOfRun: missprint in rms of totalTrackLength
09-06-04 mma (testem3-V06-01-02)
- move acceptance check in RunAction
- printout : remove leakage information
25-05-04 V.Ivanchenko
- Update printout
- Fix problem of dE/dx printout
- Add acceptance check activated by UI command
28-04-04 mma (testem3-V06-01-01)
- print resolution at EndOfRun
- suppress PhysListParticles and General
31-03-04 mma (testem3-V06-01-00)
- README : more informations about ROOT installation
17-03-04 mma (testem3-V06-00-02)
- energy leakage only from secondaries.
- idem in geant3
- suppression of DataVector in EventAction
- new macro dedx.max to quickly check dE/dx calculation
15-03-04 mma (testem3-V06-00-01)
- example of histograms with ROOT: USE_ROOT
21-01-04 mma
- possibility to have one histograms file per run.
@@ -1,4 +1,4 @@
$Id: README,v 1.12 2004/01/21 17:29:22 maire Exp $
$Id: README,v 1.18 2004/06/23 11:30:39 maire Exp $
-------------------------------------------------------------------
=========================================================
@@ -115,28 +115,51 @@ $Id: README,v 1.12 2004/01/21 17:29:22 maire Exp $
...etc...........
One can control the binning of the histo with the command:
/testem/run/setHisto idAbsor nbin Emin Emax unit
/testem/histo/setHisto idAbsor nbin Emin Emax unit
...etc...........
where unit is the desired energy unit for that histo (see TestEm3.in).
One can control the name of the histograms file with the command:
/testem/run/setFileName name (default testem3.paw)
/testem/histo/setFileName name (default testem3.paw)
Note that, by default, histograms are disabled. To activate them, uncomment
the flag G4ANALYSIS_USE in GNUmakefile.
8- Using the Anaphe implementation of the AIDA 3.0 histograms:
--------------------------------------------------------------
In order to use the Anaphe implementation of the AIDA 3.0 interfaces,
the 'aida-config' command (which is used in the GNUmakefile) is
available at:
/afs/cern.ch/sw/lhcxx/share/LHCXX/latest/scripts/aida-config
8- Using histograms
-------------------
In order to run the executable, you need to source the following
script (once):
$HOME/bin/setupAnaphe.csh (or $HOME/bin/setupAnaphe)
By default the histograms are not activated. To activate histograms
the environment variable G4ANALYSIS_USE should be defined. For instance
uncomment the flag G4ANALYSIS_USE in GNUmakefile.
At cern 'setupAnaphe' is available at:
/afs/cern.ch/sw/lhcxx/share/LHCXX/latest/scripts/setupAnaphe.csh
(or /afs/cern.ch/sw/lhcxx/share/LHCXX/latest/scripts/setupAnaphe)
To use histograms any of implementations of AIDA interfaces should
be available (see http://aida.freehep.org).
A package including AIDA and extended interfaces also using Python
is PI, available from: http://cern.ch/pi .
Once installed PI or PI-Lite in a specified local area $MYPY, it is
required to add the installation path to $PATH, i.e. for example,
for release 1.2.1 of PI:
setenv PATH ${PATH}:$MYPI/1.2.1/app/releases/PI/PI_1_2_1/rh73_gcc32/bin
CERN users can use the PATH to the LCG area on AFS.
Before compilation of the example it is optimal to clean up old
files:
gmake histclean
gmake
Before running the example the command should be issued:
eval `aida-config --runtime csh`
It is possible to choose the format of the output file with
histograms using UI command:
/testem/histo/setFileType type
The following types are available: hbook, root, xml.
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: TestEm3.cc,v 1.10 2003/11/28 12:30:00 vnivanch Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: TestEm3.cc,v 1.12 2004/06/15 11:39:55 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -33,10 +33,6 @@
#include "G4UItcsh.hh"
#include "Randomize.hh"
#ifdef G4VIS_USE
#include "VisManager.hh"
#endif
#include "DetectorConstruction.hh"
#include "PhysicsList.hh"
#include "PrimaryGeneratorAction.hh"
@@ -44,6 +40,11 @@
#include "EventAction.hh"
#include "SteppingAction.hh"
#include "SteppingVerbose.hh"
#include "HistoManager.hh"
#ifdef G4VIS_USE
#include "VisManager.hh"
#endif
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -63,17 +64,23 @@ int main(int argc,char** argv) {
runManager->SetUserInitialization(detector);
runManager->SetUserInitialization(new PhysicsList);
//
runManager->SetUserAction(new PrimaryGeneratorAction(detector));
PrimaryGeneratorAction* primary = new PrimaryGeneratorAction(detector);
runManager->SetUserAction(primary);
#ifdef G4VIS_USE
// visualization manager
G4VisManager* visManager = new VisManager;
visManager->Initialize();
#endif
HistoManager* histo = 0;
#ifdef G4ANALYSIS_USE
histo = new HistoManager();
#endif
// set user action classes
RunAction* runAct = new RunAction(detector);
EventAction* evtAct = new EventAction(detector,runAct);
RunAction* runAct = new RunAction(detector,primary,histo);
EventAction* evtAct = new EventAction(detector,runAct,histo);
SteppingAction* stpAct = new SteppingAction(detector,evtAct);
runManager->SetUserAction(runAct);
@@ -103,9 +110,13 @@ int main(int argc,char** argv) {
}
// job termination
#ifdef G4ANALYSIS_USE
delete histo;
#endif
#ifdef G4VIS_USE
delete visManager;
#endif
delete runManager;
return 0;
@@ -1,15 +1,14 @@
# $Id: TestEm3.in,v 1.9 2003/11/27 18:20:16 vnivanch Exp $
# $Id: TestEm3.in,v 1.16 2004/06/16 10:35:40 maire Exp $
#
# Macro file for "exampleN03.cc"
# Macro file for "exampleN03.cc"
# (can be run in batch, without graphic)
#
# Lead-liquidArgon 50 layers; electron 1 GeV
#
/control/verbose 2
/run/verbose 2
/tracking/verbose 0
#
##/testem/phys/addPhysics g4v52
#### /testem/phys/addPhysics g4v52
/testem/phys/addPhysics standard
#
/run/initialize
@@ -17,8 +16,9 @@
/gun/particle e-
/gun/energy 1 GeV
#
/testem/run/setHisto 0 100 700. 1000. MeV
/testem/run/setHisto 1 100 0. 300. MeV
###/testem/histo/setFileName testem3.paw
###/testem/histo/setHisto 0 100 700. 1000. MeV
###/testem/histo/setHisto 1 100 0. 300. MeV
#
/testem/event/printModulo 50
#
@@ -1,8 +1,8 @@
*************************************************************
Geant4 version $Name: geant4-06-01 $ (25-March-2004)
Geant4 version $Name: geant4-06-02 $ (25-June-2004)
Copyright : Geant4 Collaboration
Reference : NIM A 506 (2003), 250-303.
Reference : NIM A 506 (2003), 250-303
WWW : http://cern.ch/geant4
*************************************************************
@@ -23,9 +23,8 @@ Current available graphics systems are:
VRML1FILE (VRML1FILE)
VRML2FILE (VRML2FILE)
/run/verbose 2
/tracking/verbose 0
#
##/testem/phys/addPhysics g4v52
#### /testem/phys/addPhysics g4v52
/testem/phys/addPhysics standard
#
/run/initialize
@@ -58,8 +57,9 @@ PhysicsList::SetCuts:CutLength : 1 mm
/gun/particle e-
/gun/energy 1 GeV
#
/testem/run/setHisto 0 100 700. 1000. MeV
/testem/run/setHisto 1 100 0. 300. MeV
###/testem/histo/setFileName testem3.paw
###/testem/histo/setHisto 0 100 700. 1000. MeV
###/testem/histo/setHisto 1 100 0. 300. MeV
#
/testem/event/printModulo 50
#
@@ -112,8 +112,8 @@ msc: Model variant of multiple scattering for proton
hIoni: tables are built for proton
dE/dx and range tables from 100 eV to 100 TeV in 120 bins.
Lambda tables from threshold to 100 TeV in 120 bins.
Step function: finalRange(mm)= 1, dRoverRange= 0.2, integral: 0
Bether-Bloch model for Escaled > 2 MeV, parametrisation of Bragg peak below, Integral mode 0
Step function: finalRange(mm)= 1, dRoverRange= 0.2, integral: 1
Bether-Bloch model for Escaled > 2 MeV, parametrisation of Bragg peak below, Integral mode 1
msc: Model variant of multiple scattering for mu+
Lambda tables from 100 eV to 100 TeV in 120 bins.
@@ -122,7 +122,7 @@ msc: Model variant of multiple scattering for mu+
MuIoni: tables are built for mu+
dE/dx and range tables from 100 eV to 100 TeV in 120 bins.
Lambda tables from threshold to 100 TeV in 120 bins.
Step function: finalRange(mm)= 1, dRoverRange= 0.2, integral: 0
Step function: finalRange(mm)= 1, dRoverRange= 0.2, integral: 1
Bether-Bloch model for E > 0.2 MeV, parametrisation of Bragg peak below,
radiative corrections for E > 1 GeV
@@ -140,7 +140,7 @@ MuPairProd: tables are built for mu+
MuIoni: tables are built for mu-
dE/dx and range tables from 100 eV to 100 TeV in 120 bins.
Lambda tables from threshold to 100 TeV in 120 bins.
Step function: finalRange(mm)= 1, dRoverRange= 0.2, integral: 0
Step function: finalRange(mm)= 1, dRoverRange= 0.2, integral: 1
Bether-Bloch model for E > 0.2 MeV, parametrisation of Bragg peak below,
radiative corrections for E > 1 GeV
@@ -208,19 +208,19 @@ Start Run processing.
Run terminated.
Run Summary
Number of events processed : 100
User=37.72s Real=48.71s Sys=6.2s
User=42.97s Real=52.04s Sys=6.01s
-------------------------------------------------------------
total energy dep total tracklen mean energy leaving per layer
------------------------------------------------------------
material Total Edep sqrt(E0(GeV))*rmsE/Emean total tracklen
Absorber0 ( Lead) : 815.52 MeV +- 17.55 MeV 56.69 cm +- 1.37 cm 267.36 MeV +- 45.80 MeV
Absorber1 ( liquidArgon) : 174.13 MeV +- 15.78 MeV 86.03 cm +- 8.19 cm 263.78 MeV +- 45.88 MeV
Lead: 810.29 MeV +- 15.56 MeV 1.92 +- 0.192 % 56.1 cm +- 1.22 cm
liquidArgon: 179.93 MeV +- 14.46 MeV 8.035 +- 0.8035 % 88.8 cm +- 7.75 cm
-------------------------------------------------------------
------------------------------------------------------------
--------- Ranecu engine status ---------
Initial seed (index) = 0
Current couple of seeds = 1809837985, 1683402677
Current couple of seeds = 405591755, 816799671
----------------------------------------
Graphics systems deleted.
Visualization Manager deleting...
@@ -0,0 +1,31 @@
# $Id: dedx.mac,v 1.1 2004/03/17 12:32:57 maire Exp $
#
# Macro file for "TestEm3.cc"
# (can be run in batch, without graphic)
#
# To control dE/dx calculation:
# 1 layer; minimum ionizing particle
#
/control/verbose 2
/run/verbose 2
#
/testem/det/setNbOfLayers 1
/testem/det/setNbOfAbsor 1
/testem/det/setAbsor 0 Water 1 cm
/testem/det/setSizeYZ 1 cm
#
/testem/phys/addPhysics standard
/testem/phys/setCuts 1 km
#
/run/initialize
#
/process/inactivate msc
/process/eLoss/fluct false
#
/testem/gun/setDefault
/gun/particle mu+
/gun/energy 300 MeV
#
/tracking/verbose 1
#
/run/beamOn 2
@@ -0,0 +1,20 @@
FILE dedx.paw
LIST
C
C 1 layer; minimum ionizing particle
C
CALOR 1 (nbAbs) 1 (nbLay) 1. (calorYZ) 0. (field)
MATE 4 (water)
THICK 1. (cm)
LOSS 4
MULS 0
HADR 0
ABAN 0
CUTS 10.0e-6 (cutgam) 10.0e-6 (cutele) 3*10.e-3 (cutneu/had/muo)
2*10.0e+3 (bcute/m) 2*10.0e+3 (dcute/m)
C
KINE 5 (Itype) 0.3 (Ekine) 1000. (x0) 0. (y0) 0. (z0) 1. (ux) 0. (uy) 0. (uz)
SWIT 0 (draw)
DEBUG 1 5 1000
TRIG 2
END
@@ -1,4 +1,4 @@
COMMON/CELOSS/ EdepAbs(MaxAbs),TrckAbs(MaxAbs),
& sumEdep(MaxAbs),sumTrck(MaxAbs),
& su2Edep(MaxAbs),su2Trck(MaxAbs)
COMMON/CELOSS/ EdepAbs(MaxAbs),TrckAbs(MaxAbs),EleaAbs(MaxAbs),
& sumEdep(MaxAbs),sumTrck(MaxAbs),sumElea(MaxAbs),
& su2Edep(MaxAbs),su2Trck(MaxAbs),su2Elea(MaxAbs)
@@ -16,13 +16,15 @@
if (histo(k)) call hfill (k,EdepAbs(k)/histUnit(k),0.,1.)
enddo
*
* cumul energy deposited and charged track length
* cumul energy deposited, charged track length and energy leakage
do k=1,NbAbsor
sumEdep(k) = sumEdep(k) + EdepAbs(k)
sumTrck(k) = sumTrck(k) + TrckAbs(k)
sumElea(k) = sumElea(k) + EleaAbs(k)/NbLayer
*
su2Edep(k) = su2Edep(k) + EdepAbs(k)**2
su2Trck(k) = su2Trck(k) + TrckAbs(k)**2
su2Elea(k) = su2Elea(k) + (EleaAbs(k)/NbLayer)**2
enddo
*
* *** print
@@ -6,6 +6,7 @@
#include "geant321/gcflag.inc"
#include "geant321/gckine.inc"
#include "geant321/gcking.inc"
#include "geant321/gconst.inc"
#include "geant321/gctrak.inc"
#include "geant321/gctmed.inc"
#include "calor.inc"
@@ -25,5 +26,12 @@
if (DESTEP.NE.0.) EdepAbs(NUMED) = EdepAbs(NUMED) + DESTEP
if (CHARGE*STEP.NE.0.) TrckAbs(NUMED) = TrckAbs(NUMED) + STEP
ENDIF
*
* *** Energy leakage from secondaries
IF ((NUMED.LE.NbAbsor).and.(INWVOL.EQ.2).and.(ISTAK.GT.0)) THEN
Eleav = gekin
if (ipart.eq.2) Eleav = gekin + 2*emass
EleaAbs(NUMED) = EleaAbs(NUMED) + Eleav
ENDIF
*
END
@@ -10,6 +10,7 @@
do k=1,NbAbsor
EdepAbs(k) = 0.
TrckAbs(k) = 0.
EleaAbs(k) = 0.
enddo
*
CALL GTREVE
@@ -70,8 +70,10 @@
do k=1,MaxAbs
sumEdep(k) = 0.
sumTrck(k) = 0.
sumElea(k) = 0.
su2Edep(k) = 0.
su2Trck(k) = 0.
su2Elea(k) = 0.
enddo
*
END
@@ -3,14 +3,14 @@
*
* Termination routine to print histograms and statistics
*
#include "geant321/gcflag.inc"
#include "geant321/gcflag.inc"
#include "geant321/gctrak.inc"
#include "calor.inc"
#include "celoss.inc"
#include "histo.inc"
*
CHARACTER*20 matnam
CHARACTER*4 unitm,unitr
CHARACTER*4 unitdm,unitdr,unitlm,unitlr
*
* *** mean energy deposit and track length
PRINT 749
@@ -23,10 +23,15 @@
rmsEdep = fnorm*sqrt(abs(IEVENT*su2Edep(k)-sumEdep(k)**2))
aveTrck = fnorm*sumTrck(k)
rmsTrck = fnorm*sqrt(abs(IEVENT*su2Trck(k)-sumTrck(k)**2))
aveElea = fnorm*sumElea(k)
rmsElea = fnorm*sqrt(abs(IEVENT*su2Elea(k)-sumElea(k)**2))
*
CALL GEVKEV (aveEdep,Emean,unitm)
CALL GEVKEV (rmsEdep,Erms ,unitr)
PRINT 752,k-1,matnam,Emean,unitm,Erms,unitr,aveTrck,rmsTrck
CALL GEVKEV (aveEdep,Edmean,unitdm)
CALL GEVKEV (rmsEdep,Edrms ,unitdr)
CALL GEVKEV (aveElea,Elmean,unitlm)
CALL GEVKEV (rmsElea,Elrms ,unitlr)
PRINT 752,k-1,matnam,Edmean,unitdm,Edrms,unitdr,aveTrck,rmsTrck
+ ,Elmean,unitlm,Elrms,unitlr
enddo
PRINT 749
*
@@ -44,7 +49,9 @@
* *** formats
749 FORMAT(/ ,60(1H-),/)
750 FORMAT(1X,'Nb of events:',I6)
751 FORMAT(1X,'AbsNo Material',5X,'Energy deposit',14X,'Trck length')
752 FORMAT(I5,3X,A10,F8.3,A4,' +- ',F6.2,A4,F9.3,' cm +- ',F6.2,' cm')
751 FORMAT(1X,'AbsNo Material',5X,'Energy deposit',14X,'Trck length',
+ 12X,'E leakage by secondaries')
752 FORMAT(I5,3X,A10,F8.3,A4,' +- ',F6.2,A4,F9.3,' cm +- ',F6.2,' cm',
+ F9.3,A4,' +- ',F6.2,A4)
*
END
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: DetectorConstruction.hh,v 1.5 2004/01/16 14:14:08 vnivanch Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: DetectorConstruction.hh,v 1.9 2004/06/09 14:18:45 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -40,7 +40,6 @@ class G4VPhysicalVolume;
class G4Material;
class G4UniformMagField;
class G4UserLimits;
class DetectorMessenger;
const G4int MaxAbsor = 10;
@@ -60,10 +59,10 @@ class DetectorConstruction : public G4VUserDetectorConstruction
void SetAbsorMaterial (G4int,G4String);
void SetAbsorThickness(G4int,G4double);
void SetWorldMaterial (G4String);
void SetWorldMaterial (G4String);
void SetCalorSizeYZ (G4double);
void SetNbOfLayers (G4int);
void SetMagField (G4double);
void SetMaxStepSize(G4double);
@@ -86,27 +85,27 @@ class DetectorConstruction : public G4VUserDetectorConstruction
G4int GetNbOfAbsor() {return NbOfAbsor;};
G4Material* GetAbsorMaterial(G4int i) {return AbsorMaterial[i];};
G4double GetAbsorThickness(G4int i) {return AbsorThickness[i];};
const G4VPhysicalVolume* GetphysiWorld() {return physiWorld;};
const G4Material* GetWorldMaterial() {return defaultMaterial;};
const G4VPhysicalVolume* GetAbsorber(G4int i) {return physiAbsor[i];};
private:
G4int NbOfAbsor;
G4int NbOfAbsor;
G4Material* AbsorMaterial [MaxAbsor];
G4double AbsorThickness[MaxAbsor];
G4int NbOfLayers;
G4double LayerThickness;
G4double CalorSizeYZ;
G4double CalorThickness;
G4Material* defaultMaterial;
G4double WorldSizeYZ;
G4double WorldSizeX;
G4Box* solidWorld;
G4LogicalVolume* logicWorld;
G4VPhysicalVolume* physiWorld;
@@ -114,25 +113,25 @@ class DetectorConstruction : public G4VUserDetectorConstruction
G4Box* solidCalor;
G4LogicalVolume* logicCalor;
G4VPhysicalVolume* physiCalor;
G4Box* solidLayer;
G4LogicalVolume* logicLayer;
G4VPhysicalVolume* physiLayer;
G4Box* solidAbsor[MaxAbsor];
G4LogicalVolume* logicAbsor[MaxAbsor];
G4VPhysicalVolume* physiAbsor[MaxAbsor];
G4UniformMagField* magField;
G4UserLimits* userLimits;
DetectorMessenger* detectorMessenger;
private:
void DefineMaterials();
void ComputeCalorParameters();
G4VPhysicalVolume* ConstructCalorimeter();
G4VPhysicalVolume* ConstructCalorimeter();
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: DetectorMessenger.hh,v 1.1 2003/09/22 14:06:39 maire Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: DetectorMessenger.hh,v 1.5 2004/06/09 14:18:45 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
@@ -49,18 +49,18 @@ class DetectorMessenger: public G4UImessenger
public:
DetectorMessenger(DetectorConstruction* );
~DetectorMessenger();
void SetNewValue(G4UIcommand*, G4String);
private:
DetectorConstruction* Detector;
G4UIdirectory* testemDir;
G4UIcmdWithADoubleAndUnit* SizeYZCmd;
G4UIcmdWithAnInteger* NbLayersCmd;
G4UIcmdWithAnInteger* NbAbsorCmd;
G4UIcommand* AbsorCmd;
G4UIcommand* AbsorCmd;
G4UIcmdWithADoubleAndUnit* MagFieldCmd;
G4UIcmdWithADoubleAndUnit* MaxStepCmd;
G4UIcmdWithoutParameter* UpdateCmd;
@@ -21,45 +21,38 @@
// ********************************************************************
//
//
// $Id: PhysListParticles.hh,v 1.2 2003/10/06 10:09:23 maire Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: EmAcceptance.hh,v 1.2 2004/06/09 14:18:45 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef PhysListParticles_h
#define PhysListParticles_h 1
#ifndef EmAcceptance_h
#define EmAcceptance_h 1
#include "G4VPhysicsConstructor.hh"
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class PhysListParticles : public G4VPhysicsConstructor
class EmAcceptance
{
public:
PhysListParticles(const G4String& name = "particles");
~PhysListParticles();
public:
public:
// This method will be invoked in the Construct() method.
// each particle type will be instantiated
void ConstructParticle();
// This method is dummy.
void ConstructProcess() {};
EmAcceptance();
~EmAcceptance();
void BeginOfAcceptance(const G4String& title, G4int stat);
void EndOfAcceptance();
void EmAcceptanceGauss(const G4String& title, G4int stat,
G4double avr, G4double avr0,
G4double rms, G4double limit);
private:
G4bool isAccepted;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: EventAction.hh,v 1.3 2003/11/27 18:20:18 vnivanch Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: EventAction.hh,v 1.7 2004/06/15 11:39:57 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
@@ -35,17 +35,17 @@
#include "G4UserEventAction.hh"
#include "globals.hh"
#include "DetectorConstruction.hh"
#include "G4DataVector.hh"
class RunAction;
class EventActionMessenger;
class HistoManager;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class EventAction : public G4UserEventAction
{
public:
EventAction(DetectorConstruction*, RunAction*);
EventAction(DetectorConstruction*, RunAction*, HistoManager*);
~EventAction();
void BeginOfEventAction(const G4Event*);
@@ -63,12 +63,14 @@ class EventAction : public G4UserEventAction
DetectorConstruction* detector;
RunAction* runAct;
G4DataVector energyDeposit;
G4DataVector energyLeaving;
G4DataVector trackLengthCh;
G4String drawFlag; // draw the event
G4double energyDeposit[MaxAbsor];
G4double energyLeaving[MaxAbsor];
G4double trackLengthCh[MaxAbsor];
G4String drawFlag;
G4int printModulo;
EventActionMessenger* eventMessenger;
HistoManager* histoManager;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,101 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: HistoManager.hh,v 1.2 2004/06/21 10:52:55 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef HistoManager_h
#define HistoManager_h 1
#ifdef G4ANALYSIS_USE
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifdef USE_AIDA
namespace AIDA {
class ITree;
class IHistogramFactory;
class IHistogram1D;
}
#endif
class HistoMessenger;
#include "DetectorConstruction.hh"
const G4int MaxHisto = MaxAbsor;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class HistoManager
{
public:
HistoManager();
~HistoManager();
void SetFileName (G4String name) { fileName = name;};
void SetFactory ();
void SaveFactory ();
void SetHisto (G4int, G4int, G4double, G4double, G4String unit="none");
void RemoveHisto (G4int);
#ifdef USE_AIDA
AIDA::ITree* GetTree() {return tree;}
AIDA::IHistogramFactory* GetHistogramFactory() {return hf;}
AIDA::IHistogram1D* GetHisto(G4int id) {return histo[id];}
#endif
G4double GetHistoUnit(G4int id) {return Unit[id];}
G4double GetBinWidth (G4int id) {return Width[id];}
private:
G4String fileName;
#ifdef USE_AIDA
AIDA::ITree* tree;
AIDA::IHistogramFactory* hf;
AIDA::IHistogram1D* histo[MaxHisto];
#endif
G4bool exist[MaxHisto];
G4String Label[MaxHisto];
G4String Title[MaxHisto];
G4int Nbins[MaxHisto];
G4double Vmin [MaxHisto];
G4double Vmax [MaxHisto];
G4double Unit [MaxHisto];
G4double Width[MaxHisto];
G4bool factoryOn;
HistoMessenger* histoMessenger;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif //G4ANALYSIS_USE
#endif
@@ -20,46 +20,51 @@
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: PhysListGeneral.hh,v 1.2 2003/10/06 10:09:23 maire Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: HistoMessenger.hh,v 1.1 2004/06/15 11:39:57 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef PhysListGeneral_h
#define PhysListGeneral_h 1
#ifndef HistoMessenger_h
#define HistoMessenger_h 1
#include "G4VPhysicsConstructor.hh"
#ifdef G4ANALYSIS_USE
#include "G4UImessenger.hh"
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class PhysListGeneral : public G4VPhysicsConstructor
class HistoManager;
class G4UIdirectory;
class G4UIcommand;
class G4UIcmdWithAString;
class G4UIcmdWithAnInteger;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class HistoMessenger: public G4UImessenger
{
public:
PhysListGeneral(const G4String& name = "general");
~PhysListGeneral();
public:
public:
// This method is dummy for physics
void ConstructParticle() {};
HistoMessenger(HistoManager* );
~HistoMessenger();
void SetNewValue(G4UIcommand* ,G4String );
private:
HistoManager* histoManager;
G4UIdirectory* histoDir;
G4UIcmdWithAString* factoryCmd;
G4UIcommand* histoCmd;
G4UIcmdWithAnInteger* rmhistoCmd;
// This method will be invoked in the Construct() method.
// each physics process will be instantiated and
// registered to the process manager of each particle type
void ConstructProcess();
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
#endif
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: PhysicsList.hh,v 1.2 2003/10/06 10:09:24 maire Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: PhysicsList.hh,v 1.3 2004/04/28 17:40:42 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//
@@ -62,9 +62,8 @@ class PhysicsList: public G4VModularPhysicsList
G4double cutForElectron;
G4double cutForPositron;
G4double currentDefaultCut;
G4VPhysicsConstructor* emPhysicsList;
G4VPhysicsConstructor* generalPhysicsList;
G4VPhysicsConstructor* particleList;
G4String emName;
PhysicsListMessenger* pMessenger;
@@ -20,12 +20,9 @@
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: RunAction.hh,v 1.13 2004/06/15 11:39:57 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// $Id: RunAction.hh,v 1.8 2004/01/21 17:29:26 maire Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -35,64 +32,53 @@
#include "DetectorConstruction.hh"
#include "G4UserRunAction.hh"
#include "G4ThreeVector.hh"
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class G4Run;
class PrimaryGeneratorAction;
class RunActionMessenger;
class HistoManager;
#ifdef G4ANALYSIS_USE
namespace AIDA {
class ITree;
class IHistogramFactory;
class IHistogram1D;
}
#endif
class G4Run;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class RunAction : public G4UserRunAction
{
public:
RunAction(DetectorConstruction*);
RunAction(DetectorConstruction*, PrimaryGeneratorAction*, HistoManager*);
~RunAction();
void BeginOfRunAction(const G4Run*);
void EndOfRunAction(const G4Run*);
void fillPerEvent(G4int,G4double,G4double,G4double);
#ifdef G4ANALYSIS_USE
AIDA::IHistogram1D* GetHisto(G4int id) {return histo[id];}
G4double GetHistoUnit(G4int id) {return histoUnit[id];}
#endif
void SetFileName(const G4String& s) {fileName = s;};
void SetHisto (G4int, G4int, G4double, G4double, G4String);
void PrintDedxTables();
// Acceptance parameters
void SetEdepAndRMS(G4int, G4ThreeVector);
G4double GetAverageEdep(G4int i) const {return edeptrue[i];};
G4double GetRMSEdep(G4int i) const {return rmstrue[i];};
G4double GetLimitEdep(G4int i) const {return limittrue[i];};
private:
G4double sumEAbs [MaxAbsor], sum2EAbs [MaxAbsor];
G4double sumLAbs [MaxAbsor], sum2LAbs [MaxAbsor];
G4double sumEleav[MaxAbsor], sum2Eleav[MaxAbsor];
DetectorConstruction* Detector;
RunActionMessenger* runMessenger;
G4String fileName;
G4String hid [MaxAbsor], htitle[MaxAbsor];
G4int hbins[MaxAbsor];
G4double hmin [MaxAbsor], hmax [MaxAbsor];
G4double histoUnit[MaxAbsor];
#ifdef G4ANALYSIS_USE
AIDA::ITree* tree;
AIDA::IHistogramFactory* hf;
AIDA::IHistogram1D* histo[MaxAbsor];
#endif
DetectorConstruction* Detector;
PrimaryGeneratorAction* Primary;
RunActionMessenger* runMessenger;
HistoManager* histoManager;
G4double edeptrue [MaxAbsor];
G4double rmstrue [MaxAbsor];
G4double limittrue[MaxAbsor];
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -20,12 +20,9 @@
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: RunActionMessenger.hh,v 1.7 2004/06/15 11:39:58 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// $Id: RunActionMessenger.hh,v 1.3 2004/01/21 17:29:26 maire Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -36,8 +33,7 @@
#include "G4UImessenger.hh"
class RunAction;
class G4UIcommand;
class G4UIcmdWithAString;
class G4UIcmdWith3Vector;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -51,8 +47,8 @@ class RunActionMessenger: public G4UImessenger
private:
RunAction* Run;
G4UIcmdWithAString* fileCmd;
G4UIcommand* HistoCmd;
G4UIcmdWith3Vector* accCmd1;
G4UIcmdWith3Vector* accCmd2;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: SteppingAction.hh,v 1.2 2003/11/27 18:20:18 vnivanch Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: SteppingAction.hh,v 1.3 2004/03/16 18:25:29 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -43,9 +43,9 @@ class SteppingAction : public G4UserSteppingAction
{
public:
SteppingAction(DetectorConstruction*, EventAction*);
virtual ~SteppingAction();
~SteppingAction();
virtual void UserSteppingAction(const G4Step*);
void UserSteppingAction(const G4Step*);
G4double BirkAttenuation(const G4Step*);
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: SteppingVerbose.hh,v 1.2 2003/11/27 18:20:18 vnivanch Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: SteppingVerbose.hh,v 1.3 2004/03/16 18:27:18 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// This class manages the verbose outputs in G4SteppingManager.
// It inherits from G4SteppingVerbose.
@@ -43,7 +43,7 @@ class SteppingVerbose : public G4SteppingVerbose
public:
SteppingVerbose();
~SteppingVerbose();
~SteppingVerbose();
void StepInfo();
void TrackingStarted();
@@ -1,4 +1,4 @@
# $Id: ionC12.mac,v 1.3 2003/10/06 10:09:19 maire Exp $
# $Id: ionC12.mac,v 1.6 2004/06/16 10:35:41 maire Exp $
#
# Macro file for "TestEm3.cc"
# (can be run in batch, without graphic)
@@ -6,6 +6,7 @@
# CsI 1 layer;
#
/control/verbose 2
/run/verbose 2
#
# select EM PhysicsList
#
@@ -19,15 +20,14 @@
/testem/det/setAbsor 0 CsI 1.99 cm
/testem/det/setSizeYZ 3 cm
#
/testem/gun/setDefault
/run/initialize
#
/run/verbose 2
/testem/event/printModulo 1000
#
/testem/gun/setDefault
/gun/particle ionC12
/gun/energy 108 GeV
#
/testem/run/setHisto 0 100 3.e-3 6.e-3
/testem/histo/setHisto 0 200 350. 550. MeV
#
/run/beamOn 2000
/testem/event/printModulo 1000
/run/beamOn 5000
@@ -1,4 +1,4 @@
# $Id: run01.mac,v 1.11 2004/01/21 17:29:22 maire Exp $
# $Id: run01.mac,v 1.12 2004/06/16 10:35:41 maire Exp $
#
# Macro file for "exampleN03.cc"
# (can be run in batch, without graphic)
@@ -18,9 +18,9 @@
/gun/particle e-
/gun/energy 1 GeV
#
/testem/run/setFileName run01.paw
/testem/run/setHisto 0 100 700. 1000. MeV
/testem/run/setHisto 1 100 0. 300. MeV
/testem/histo/setFileName run01.paw
/testem/histo/setHisto 0 100 700. 1000. MeV
/testem/histo/setHisto 1 100 0. 300. MeV
#
/testem/event/printModulo 50
#
@@ -1,4 +1,4 @@
# $Id: run02.mac,v 1.10 2004/01/21 17:29:22 maire Exp $
# $Id: run02.mac,v 1.11 2004/06/16 10:35:41 maire Exp $
#
# Macro file for "TestEm3.cc"
# (can be run in batch, without graphic)
@@ -24,9 +24,9 @@
/gun/particle e-
/gun/energy 1 GeV
#
/testem/run/setFileName run02.paw
/testem/run/setHisto 0 100 900. 1000. MeV
/testem/run/setHisto 1 100 0. 50. MeV
/testem/histo/setFileName run02.paw
/testem/histo/setHisto 0 100 900. 1000. MeV
/testem/histo/setHisto 1 100 0. 50. MeV
#
/testem/event/printModulo 50
#
@@ -1,4 +1,4 @@
# $Id: run15.mac,v 1.10 2004/01/21 17:29:22 maire Exp $
# $Id: run15.mac,v 1.11 2004/06/16 10:35:41 maire Exp $
#
# Macro file for "TestEm3.cc"
# (can be run in batch, without graphic)
@@ -25,9 +25,9 @@
/gun/particle mu+
/gun/energy 20 GeV
#
/testem/run/setFileName run15.paw
/testem/run/setHisto 0 100 0. 2. GeV
/testem/run/setHisto 1 100 0. 100. MeV
/testem/histo/setFileName run15.paw
/testem/histo/setHisto 0 100 0. 2. GeV
/testem/histo/setHisto 1 100 0. 100. MeV
#
/testem/event/printModulo 1000
#
@@ -1,4 +1,4 @@
# $Id: sicapo3.mac,v 1.2 2003/10/06 10:09:22 maire Exp $
# $Id: sicapo3.mac,v 1.3 2004/06/16 10:35:41 maire Exp $
#
# Macro file for "TestEm3.cc"
# (can be run in batch, without graphic)
@@ -30,7 +30,7 @@
/gun/particle e-
/gun/energy 6 GeV
#
/testem/run/setHisto 2 100 0. 50. MeV
/testem/histo/setHisto 2 100 0. 50. MeV
#
/testem/event/printModulo 100
#
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: DetectorConstruction.cc,v 1.7 2004/01/21 17:29:27 maire Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: DetectorConstruction.cc,v 1.11 2004/06/09 14:18:47 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -54,12 +54,6 @@ DetectorConstruction::DetectorConstruction()
solidLayer(0),logicLayer(0),physiLayer(0),
magField(0)
{
for (G4int i=0; i<MaxAbsor; i++)
{
AbsorMaterial[i]=0; AbsorThickness[i]=0.;
solidAbsor[i]=0;logicAbsor[i]=0;physiAbsor[i]=0;
}
//
// default parameter values of the calorimeter
NbOfAbsor = 2;
AbsorThickness[0] = 2.3*mm;
@@ -67,13 +61,13 @@ DetectorConstruction::DetectorConstruction()
NbOfLayers = 50;
CalorSizeYZ = 40.*cm;
ComputeCalorParameters();
// materials
DefineMaterials();
SetWorldMaterial("Galactic");
SetAbsorMaterial(0,"Lead");
SetAbsorMaterial(1,"liquidArgon");
SetAbsorMaterial(1,"liquidArgon");
// create UserLimits
userLimits = new G4UserLimits();
@@ -106,7 +100,7 @@ void DetectorConstruction::DefineMaterials()
// define Elements
//
G4double z,a;
G4Element* H = new G4Element("Hydrogen", "H" , z= 1., a= 1.008*g/mole);
G4Element* C = new G4Element("Carbon", "C" , z= 6., a= 12.01*g/mole);
G4Element* N = new G4Element("Nitrogen", "N" , z= 7., a= 14.01*g/mole);
@@ -136,7 +130,7 @@ void DetectorConstruction::DefineMaterials()
// define simple materials
//
G4double density;
new G4Material("liquidH2", z=1., a= 1.008*g/mole, density= 70.8*mg/cm3);
new G4Material("Aluminium", z=13., a= 26.98*g/mole, density= 2.700*g/cm3);
new G4Material("liquidArgon", z=18., a= 39.95*g/mole, density= 1.390*g/cm3);
@@ -152,7 +146,7 @@ void DetectorConstruction::DefineMaterials()
// define a material from elements. case 1: chemical molecule
//
G4int natoms;
G4Material* H2O =
new G4Material("Water", density= 1.000*g/cm3, ncomponents=2);
H2O->AddElement(H, natoms=2);
@@ -522,6 +516,7 @@ void DetectorConstruction::SetMaxStepSize(G4double val)
userLimits->SetMaxAllowedStep(val);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4RunManager.hh"
@@ -21,11 +21,9 @@
// ********************************************************************
//
//
// $Id: DetectorMessenger.cc,v 1.1 2003/09/22 14:06:16 maire Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: DetectorMessenger.cc,v 1.5 2004/06/09 14:18:47 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -122,7 +120,7 @@ DetectorMessenger::~DetectorMessenger()
delete SizeYZCmd;
delete NbLayersCmd;
delete NbAbsorCmd;
delete AbsorCmd;
delete AbsorCmd;
delete MagFieldCmd;
delete UpdateCmd;
delete MaxStepCmd;
@@ -132,13 +130,13 @@ DetectorMessenger::~DetectorMessenger()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
{
{
if( command == SizeYZCmd )
{ Detector->SetCalorSizeYZ(SizeYZCmd->GetNewDoubleValue(newValue));}
if( command == NbLayersCmd )
{ Detector->SetNbOfLayers(NbLayersCmd->GetNewIntValue(newValue));}
if( command == NbAbsorCmd )
{ Detector->SetNbOfAbsor(NbAbsorCmd->GetNewIntValue(newValue));}
@@ -154,7 +152,7 @@ void DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
Detector->SetAbsorMaterial (num,material);
Detector->SetAbsorThickness(num,tick);
}
if( command == MagFieldCmd )
{ Detector->SetMagField(MagFieldCmd->GetNewDoubleValue(newValue));}
@@ -21,52 +21,57 @@
// ********************************************************************
//
//
// $Id: PhysListGeneral.cc,v 1.2 2003/10/06 10:09:25 maire Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: EmAcceptance.cc,v 1.3 2004/06/20 01:32:20 vnivanch Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "PhysListGeneral.hh"
#include "G4ParticleDefinition.hh"
#include "G4ProcessManager.hh"
#include "G4Decay.hh"
#include "EmAcceptance.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PhysListGeneral::PhysListGeneral(const G4String& name)
: G4VPhysicsConstructor(name)
EmAcceptance::EmAcceptance()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PhysListGeneral::~PhysListGeneral()
EmAcceptance::~EmAcceptance()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PhysListGeneral::ConstructProcess()
void EmAcceptance::BeginOfAcceptance(const G4String& title, G4int stat)
{
// Add Decay Process
G4Decay* fDecayProcess = new G4Decay();
theParticleIterator->reset();
while( (*theParticleIterator)() ){
G4ParticleDefinition* particle = theParticleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
if (fDecayProcess->IsApplicable(*particle)) {
pmanager ->AddProcess(fDecayProcess);
// set ordering for PostStepDoIt and AtRestDoIt
pmanager ->SetProcessOrdering(fDecayProcess, idxPostStep);
pmanager ->SetProcessOrdering(fDecayProcess, idxAtRest);
}
}
G4cout << "\n<<<<<ACCEPTANCE>>>>> " << stat << " events for " << title
<< G4endl;
isAccepted = true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void EmAcceptance::EndOfAcceptance()
{
G4String resume = "IS ACCEPTED";
if (!isAccepted) resume = "IS NOT ACCEPTED";
G4cout << "<<<<<END>>>>> " << resume << G4endl;
G4cout << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void EmAcceptance::EmAcceptanceGauss(const G4String& title, G4int stat,
G4double avr, G4double avr0,
G4double rms, G4double limit)
{
G4double x = sqrt((G4double)stat);
G4double dde = avr - avr0;
G4double de = dde*x/rms;
G4cout << title << ": " << avr << " del"<< title << "= " << dde
<< " nrms= " << de << G4endl;
if (abs(de) > limit) isAccepted = false;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -20,12 +20,9 @@
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: EventAction.cc,v 1.8 2004/06/21 10:52:55 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// $Id: EventAction.cc,v 1.4 2004/01/21 17:29:27 maire Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -33,21 +30,25 @@
#include "RunAction.hh"
#include "EventActionMessenger.hh"
#include "HistoManager.hh"
#include "G4Event.hh"
#include "G4TrajectoryContainer.hh"
#include "G4Trajectory.hh"
#include "G4VVisManager.hh"
#ifdef G4ANALYSIS_USE
#ifdef USE_AIDA
#include "AIDA/IHistogram1D.h"
#endif
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
EventAction::EventAction(DetectorConstruction* det, RunAction* run)
:detector(det),runAct(run),drawFlag("none"),printModulo(10000),eventMessenger(0)
EventAction::EventAction(DetectorConstruction* det, RunAction* run,
HistoManager* hist)
:detector(det), runAct(run), histoManager(hist)
{
drawFlag = "none";
printModulo = 10000;
eventMessenger = new EventActionMessenger(this);
}
@@ -69,15 +70,9 @@ void EventAction::BeginOfEventAction(const G4Event* evt)
G4cout << "\n---> Begin Of Event: " << evtNb << G4endl;
//initialize EnergyDeposit per event
size_t n = detector->GetNbOfAbsor();
energyDeposit.resize(n);
energyLeaving.resize(n);
trackLengthCh.resize(n);
for (size_t k=0; k<n; k++) {
energyDeposit[k] = 0.0;
energyLeaving[k] = 0.0;
trackLengthCh[k] = 0.0;
}
//
for (G4int k=0; k<MaxAbsor; k++)
energyDeposit[k] = energyLeaving[k] = trackLengthCh[k] = 0.0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -86,11 +81,12 @@ void EventAction::EndOfEventAction(const G4Event* evt)
{
for (G4int k=0; k<detector->GetNbOfAbsor(); k++) {
runAct->fillPerEvent(k,energyDeposit[k],trackLengthCh[k],
energyLeaving[k]/(G4double)(detector->GetNbOfLayers()));
#ifdef G4ANALYSIS_USE
if (runAct->GetHisto(k)) {
G4double unit = runAct->GetHistoUnit(k);
runAct->GetHisto(k)->fill(energyDeposit[k]/unit);
energyLeaving[k]/(G4double)(detector->GetNbOfLayers()));
#ifdef USE_AIDA
if (histoManager->GetHisto(k)) {
G4double unit = histoManager->GetHistoUnit(k);
histoManager->GetHisto(k)->fill(energyDeposit[k]/unit);
}
#endif
}
@@ -0,0 +1,159 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: HistoManager.cc,v 1.2 2004/06/21 10:52:55 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifdef G4ANALYSIS_USE
#include "HistoManager.hh"
#include "HistoMessenger.hh"
#include "G4UnitsTable.hh"
#ifdef USE_AIDA
#include "AIDA/AIDA.h"
#endif
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
HistoManager::HistoManager()
{
fileName = "testem3.paw";
factoryOn = false;
// histograms
for (G4int k=0; k<MaxHisto; k++) { histo[k] = 0; exist[k] = false;}
histoMessenger = new HistoMessenger(this);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
HistoManager::~HistoManager()
{
SaveFactory();
delete histoMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HistoManager::SetFactory()
{
if (factoryOn) {
G4cout << "\n--->HistoManager::SetFactory(): factory already exists"
<< G4endl;
SaveFactory();
}
#ifdef USE_AIDA
// Creating the analysis factory
AIDA::IAnalysisFactory* af = AIDA_createAnalysisFactory();
// Creating the tree factory
AIDA::ITreeFactory* tf = af->createTreeFactory();
// Creating a tree mapped to an hbook file.
G4bool readOnly = false;
G4bool createNew = true;
tree = tf->create(fileName, "hbook", readOnly, createNew);
// Creating a histogram factory, whose histograms will be handled by the tree
hf = af->createHistogramFactory(*tree);
// create selected histograms
for (G4int k=0; k<MaxHisto; k++) {
if (exist[k]) histo[k] = hf->createHistogram1D( Label[k], Title[k],
Nbins[k], Vmin[k], Vmax[k]);
else histo[k] = 0;
}
delete tf;
delete af;
#endif //USE_AIDA
factoryOn = true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HistoManager::SaveFactory()
{
if (factoryOn) {
#ifdef USE_AIDA
tree->commit(); // Writing the histograms to the file
tree->close(); // and closing the tree (and the file)
G4cout << "---> Histograms are saved" << G4endl;
delete hf;
delete tree;
#endif //USE_AIDA
factoryOn = false;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HistoManager::SetHisto(G4int ih,
G4int nbins, G4double valmin, G4double valmax, G4String unit)
{
if (ih > MaxHisto) {
G4cout << "---> warning from HistoManager::SetHisto() : histo " << ih
<< "does not exist" << G4endl;
return;
}
const G4String id[] = {"0","1","2","3","4","5","6","7","8""9","10"};
G4String title = "Edep in absorber " + id[ih] + " (" + unit + ")";
G4double valunit = G4UnitDefinition::GetValueOf(unit);
exist[ih] = true;
Label[ih] = id[ih+1];
Title[ih] = title;
Nbins[ih] = nbins;
Vmin[ih] = valmin/valunit;
Vmax[ih] = valmax/valunit;
Width[ih] = (valmax-valmin)/nbins;
Unit[ih] = valunit;
G4cout << "----> SetHisto " << ih << ": " << title << "; "
<< nbins << " bins from "
<< valmin << " " << unit << " to " << valmax << " " << unit << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HistoManager::RemoveHisto(G4int ih)
{
if (ih > MaxHisto) {
G4cout << "---> warning from HistoManager::RemoveHisto() : histo " << ih
<< "does not exist" << G4endl;
return;
}
histo[ih] = 0; exist[ih] = false;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif //G4ANALYSIS_USE
@@ -0,0 +1,118 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: HistoMessenger.cc,v 1.2 2004/06/16 10:35:43 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifdef G4ANALYSIS_USE
#include "HistoMessenger.hh"
#include "HistoManager.hh"
#include "G4UIdirectory.hh"
#include "G4UIcommand.hh"
#include "G4UIparameter.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithAnInteger.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
HistoMessenger::HistoMessenger(HistoManager* manager)
:histoManager (manager)
{
histoDir = new G4UIdirectory("/testem/histo/");
histoDir->SetGuidance("histograms control");
factoryCmd = new G4UIcmdWithAString("/testem/histo/setFileName",this);
factoryCmd->SetGuidance("set name for the histograms file");
histoCmd = new G4UIcommand("/testem/histo/setHisto",this);
histoCmd->SetGuidance("Set bining of the histo number ih :");
histoCmd->SetGuidance(" nbBins; valMin; valMax; unit (of vmin and vmax)");
//
G4UIparameter* ih = new G4UIparameter("ih",'i',false);
ih->SetGuidance("histo number : from 1 to MaxHisto");
ih->SetParameterRange("ih>=0");
histoCmd->SetParameter(ih);
//
G4UIparameter* nbBins = new G4UIparameter("nbBins",'i',false);
nbBins->SetGuidance("number of bins");
nbBins->SetParameterRange("nbBins>0");
histoCmd->SetParameter(nbBins);
//
G4UIparameter* valMin = new G4UIparameter("valMin",'d',false);
valMin->SetGuidance("valMin, expressed in unit");
histoCmd->SetParameter(valMin);
//
G4UIparameter* valMax = new G4UIparameter("valMax",'d',false);
valMax->SetGuidance("valMax, expressed in unit");
histoCmd->SetParameter(valMax);
//
G4UIparameter* unit = new G4UIparameter("unit",'s',true);
unit->SetGuidance("if omitted, vmin and vmax are assumed dimensionless");
unit->SetDefaultValue("none");
histoCmd->SetParameter(unit);
rmhistoCmd = new G4UIcmdWithAnInteger("/testem/histo/removeHisto",this);
rmhistoCmd->SetGuidance("desactivate histo #id");
rmhistoCmd->SetParameterName("id",false);
rmhistoCmd->SetRange("id>=0");
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
HistoMessenger::~HistoMessenger()
{
delete rmhistoCmd;
delete histoCmd;
delete factoryCmd;
delete histoDir;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HistoMessenger::SetNewValue(G4UIcommand* command, G4String newValues)
{
if (command == factoryCmd)
histoManager->SetFileName(newValues);
if (command == histoCmd)
{ G4int ih,nbBins; G4double vmin,vmax; char unts[30];
const char* t = newValues;
std::istrstream is((char*)t);
is >> ih >> nbBins >> vmin >> vmax >> unts;
G4String unit = unts;
G4double vUnit = 1. ;
if (unit != "none") vUnit = G4UIcommand::ValueOf(unit);
histoManager->SetHisto (ih,nbBins,vmin*vUnit,vmax*vUnit,unit);
}
if (command == rmhistoCmd)
{ histoManager->RemoveHisto(rmhistoCmd->GetNewIntValue(newValues));}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: PhysListEmG4v52.cc,v 1.1 2003/10/06 10:09:24 maire Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: PhysListEmG4v52.cc,v 1.2 2004/03/24 18:25:31 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -108,7 +108,7 @@ void PhysListEmG4v52::ConstructProcess()
(particle->GetParticleName() != "chargedgeantino")) {
//all others charged particles except geantino
pmanager->AddProcess(new G4MultipleScattering52,-1,1,1);
pmanager->AddProcess(new G4hIonisation52, -1,2,2);
pmanager->AddProcess(new G4hIonisation52, -1,2,2);
}
}
}
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: PhysListEmStandard.cc,v 1.3 2003/10/24 12:12:12 maire Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: PhysListEmStandard.cc,v 1.5 2004/04/28 16:58:49 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -1,144 +0,0 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: PhysListParticles.cc,v 1.1 2003/09/22 14:06:20 maire Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "PhysListParticles.hh"
// Bosons
#include "G4ChargedGeantino.hh"
#include "G4Geantino.hh"
#include "G4Gamma.hh"
#include "G4OpticalPhoton.hh"
// leptons
#include "G4MuonPlus.hh"
#include "G4MuonMinus.hh"
#include "G4NeutrinoMu.hh"
#include "G4AntiNeutrinoMu.hh"
#include "G4Electron.hh"
#include "G4Positron.hh"
#include "G4NeutrinoE.hh"
#include "G4AntiNeutrinoE.hh"
// Mesons
#include "G4PionPlus.hh"
#include "G4PionMinus.hh"
#include "G4PionZero.hh"
#include "G4Eta.hh"
#include "G4EtaPrime.hh"
#include "G4KaonPlus.hh"
#include "G4KaonMinus.hh"
#include "G4KaonZero.hh"
#include "G4AntiKaonZero.hh"
#include "G4KaonZeroLong.hh"
#include "G4KaonZeroShort.hh"
// Baryons
#include "G4Proton.hh"
#include "G4AntiProton.hh"
#include "G4Neutron.hh"
#include "G4AntiNeutron.hh"
// Nuclei
#include "G4Alpha.hh"
#include "G4Deuteron.hh"
#include "G4Triton.hh"
#include "G4He3.hh"
#include "G4GenericIon.hh"
#include "IonC12.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PhysListParticles::PhysListParticles(const G4String& name)
: G4VPhysicsConstructor(name)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PhysListParticles::~PhysListParticles()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PhysListParticles::ConstructParticle()
{
// pseudo-particles
G4Geantino::GeantinoDefinition();
G4ChargedGeantino::ChargedGeantinoDefinition();
// gamma
G4Gamma::GammaDefinition();
// optical photon
G4OpticalPhoton::OpticalPhotonDefinition();
// leptons
G4Electron::ElectronDefinition();
G4Positron::PositronDefinition();
G4MuonPlus::MuonPlusDefinition();
G4MuonMinus::MuonMinusDefinition();
G4NeutrinoE::NeutrinoEDefinition();
G4AntiNeutrinoE::AntiNeutrinoEDefinition();
G4NeutrinoMu::NeutrinoMuDefinition();
G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
// mesons
G4PionPlus::PionPlusDefinition();
G4PionMinus::PionMinusDefinition();
G4PionZero::PionZeroDefinition();
G4Eta::EtaDefinition();
G4EtaPrime::EtaPrimeDefinition();
G4KaonPlus::KaonPlusDefinition();
G4KaonMinus::KaonMinusDefinition();
G4KaonZero::KaonZeroDefinition();
G4AntiKaonZero::AntiKaonZeroDefinition();
G4KaonZeroLong::KaonZeroLongDefinition();
G4KaonZeroShort::KaonZeroShortDefinition();
// barions
G4Proton::ProtonDefinition();
G4AntiProton::AntiProtonDefinition();
G4Neutron::NeutronDefinition();
G4AntiNeutron::AntiNeutronDefinition();
// ions
G4Deuteron::DeuteronDefinition();
G4Triton::TritonDefinition();
G4He3::He3Definition();
G4Alpha::AlphaDefinition();
G4GenericIon::GenericIonDefinition();
IonC12::IonDefinition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -21,19 +21,20 @@
// ********************************************************************
//
//
// $Id: PhysicsList.cc,v 1.5 2004/04/28 17:40:48 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "PhysicsList.hh"
#include "PhysicsListMessenger.hh"
#include "PhysListParticles.hh"
#include "PhysListGeneral.hh"
#include "PhysListEmStandard.hh"
#include "PhysListEmG4v52.hh"
#include "G4LossTableManager.hh"
#include "G4UnitsTable.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -49,12 +50,6 @@ PhysicsList::PhysicsList() : G4VModularPhysicsList()
SetVerboseLevel(1);
// Particles
particleList = new PhysListParticles("particles");
// General Physics
generalPhysicsList = new PhysListGeneral("general");
// EM physics
emName = G4String("standard");
emPhysicsList = new PhysListEmStandard(emName);
@@ -70,17 +65,134 @@ PhysicsList::~PhysicsList()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
// Bosons
#include "G4ChargedGeantino.hh"
#include "G4Geantino.hh"
#include "G4Gamma.hh"
#include "G4OpticalPhoton.hh"
// leptons
#include "G4MuonPlus.hh"
#include "G4MuonMinus.hh"
#include "G4NeutrinoMu.hh"
#include "G4AntiNeutrinoMu.hh"
#include "G4Electron.hh"
#include "G4Positron.hh"
#include "G4NeutrinoE.hh"
#include "G4AntiNeutrinoE.hh"
// Mesons
#include "G4PionPlus.hh"
#include "G4PionMinus.hh"
#include "G4PionZero.hh"
#include "G4Eta.hh"
#include "G4EtaPrime.hh"
#include "G4KaonPlus.hh"
#include "G4KaonMinus.hh"
#include "G4KaonZero.hh"
#include "G4AntiKaonZero.hh"
#include "G4KaonZeroLong.hh"
#include "G4KaonZeroShort.hh"
// Baryons
#include "G4Proton.hh"
#include "G4AntiProton.hh"
#include "G4Neutron.hh"
#include "G4AntiNeutron.hh"
// Nuclei
#include "G4Alpha.hh"
#include "G4Deuteron.hh"
#include "G4Triton.hh"
#include "G4He3.hh"
#include "G4GenericIon.hh"
#include "IonC12.hh"
void PhysicsList::ConstructParticle()
{
particleList->ConstructParticle();
// pseudo-particles
G4Geantino::GeantinoDefinition();
G4ChargedGeantino::ChargedGeantinoDefinition();
// gamma
G4Gamma::GammaDefinition();
// optical photon
G4OpticalPhoton::OpticalPhotonDefinition();
// leptons
G4Electron::ElectronDefinition();
G4Positron::PositronDefinition();
G4MuonPlus::MuonPlusDefinition();
G4MuonMinus::MuonMinusDefinition();
G4NeutrinoE::NeutrinoEDefinition();
G4AntiNeutrinoE::AntiNeutrinoEDefinition();
G4NeutrinoMu::NeutrinoMuDefinition();
G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
// mesons
G4PionPlus::PionPlusDefinition();
G4PionMinus::PionMinusDefinition();
G4PionZero::PionZeroDefinition();
G4Eta::EtaDefinition();
G4EtaPrime::EtaPrimeDefinition();
G4KaonPlus::KaonPlusDefinition();
G4KaonMinus::KaonMinusDefinition();
G4KaonZero::KaonZeroDefinition();
G4AntiKaonZero::AntiKaonZeroDefinition();
G4KaonZeroLong::KaonZeroLongDefinition();
G4KaonZeroShort::KaonZeroShortDefinition();
// barions
G4Proton::ProtonDefinition();
G4AntiProton::AntiProtonDefinition();
G4Neutron::NeutronDefinition();
G4AntiNeutron::AntiNeutronDefinition();
// ions
G4Deuteron::DeuteronDefinition();
G4Triton::TritonDefinition();
G4He3::He3Definition();
G4Alpha::AlphaDefinition();
G4GenericIon::GenericIonDefinition();
IonC12::IonDefinition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4ProcessManager.hh"
#include "G4Decay.hh"
void PhysicsList::ConstructProcess()
{
AddTransportation();
generalPhysicsList->ConstructProcess();
// Add Decay Process
//
G4Decay* fDecayProcess = new G4Decay();
theParticleIterator->reset();
while( (*theParticleIterator)() ){
G4ParticleDefinition* particle = theParticleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
if (fDecayProcess->IsApplicable(*particle)) {
pmanager ->AddProcess(fDecayProcess);
// set ordering for PostStepDoIt and AtRestDoIt
pmanager ->SetProcessOrdering(fDecayProcess, idxPostStep);
pmanager ->SetProcessOrdering(fDecayProcess, idxAtRest);
}
}
// electromagnetic Physics List
//
emPhysicsList->ConstructProcess();
}
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: PrimaryGeneratorAction.cc,v 1.1 2003/09/22 14:06:20 maire Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: PrimaryGeneratorAction.cc,v 1.3 2004/04/28 16:58:49 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
@@ -20,39 +20,36 @@
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: RunAction.cc,v 1.19 2004/06/16 16:25:12 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// $Id: RunAction.cc,v 1.11 2004/01/21 17:29:27 maire Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "RunAction.hh"
#include "PrimaryGeneratorAction.hh"
#include "RunActionMessenger.hh"
#include "HistoManager.hh"
#include "EmAcceptance.hh"
#include "G4Run.hh"
#include "G4RunManager.hh"
#include "G4UnitsTable.hh"
#include "Randomize.hh"
#include <iomanip>
#ifdef G4ANALYSIS_USE
#include "AIDA/AIDA.h"
#endif
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RunAction::RunAction(DetectorConstruction* det)
:Detector(det)
RunAction::RunAction(DetectorConstruction* det, PrimaryGeneratorAction* prim,
HistoManager* hist)
:Detector(det), Primary(prim), histoManager(hist)
{
runMessenger = new RunActionMessenger(this);
fileName = "testem3.paw";
for (G4int k=0; k<MaxAbsor; k++) {hbins[k] = 0; histoUnit[k] = 1.;}
for (G4int k=0; k<MaxAbsor; k++) { edeptrue[k] = rmstrue[k] = 1.;
limittrue[k] = DBL_MAX;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -64,28 +61,6 @@ RunAction::~RunAction()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RunAction::SetHisto(G4int k,
G4int nbins, G4double valmin, G4double valmax, G4String unit)
{
const G4String id[] = {"0","1","2","3","4","5","6","7","8","9","10"};
G4String title = "Edep in absorber " + id[k] + " (" + unit + ")";
G4double valunit = G4UnitDefinition::GetValueOf(unit);
hid[k] = id[k+1];
htitle[k] = title;
hbins[k] = nbins;
hmin[k] = valmin/valunit;
hmax[k] = valmax/valunit;
histoUnit[k] = valunit;
#ifdef G4ANALYSIS_USE
G4cout << "---->SetHisto: " << title << " ; " << nbins << " bins from "
<< hmin[k] << " " + unit << " to " << hmax[k] << " " + unit << G4endl;
#endif
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RunAction::BeginOfRunAction(const G4Run* aRun)
{
G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
@@ -102,32 +77,13 @@ void RunAction::BeginOfRunAction(const G4Run* aRun)
sumEAbs[k] = sum2EAbs[k] = sumLAbs[k] = sum2LAbs[k] =
sumEleav[k]= sum2Eleav[k] = 0.;
}
//histograms
//
#ifdef G4ANALYSIS_USE
// Creating the analysis factory
std::auto_ptr<AIDA::IAnalysisFactory> af(AIDA_createAnalysisFactory());
// Creating the tree factory
std::auto_ptr<AIDA::ITreeFactory> tf(af->createTreeFactory());
// Creating a tree mapped to an hbook file.
G4bool readOnly = false;
G4bool createNew = true;
tree = tf->create(fileName, "hbook", readOnly, createNew);
// Creating a histogram factory, whose histograms will be handled by the tree
hf = af->createHistogramFactory(*tree);
// histograms
for (G4int k=0; k<MaxAbsor; k++) {
if (hbins[k] > 0)
histo[k] = hf->createHistogram1D(hid[k],htitle[k],hbins[k],hmin[k],hmax[k]);
else histo[k] = 0;
}
#endif
histoManager->SetFactory();
#endif
//example of print dEdx tables
//
////PrintDedxTables();
@@ -137,7 +93,7 @@ void RunAction::BeginOfRunAction(const G4Run* aRun)
void RunAction::fillPerEvent(G4int kAbs, G4double EAbs, G4double LAbs,
G4double Eleav)
{
{
//accumulate statistic
//
sumEAbs[kAbs] += EAbs; sum2EAbs[kAbs] += EAbs*EAbs;
@@ -153,58 +109,79 @@ void RunAction::EndOfRunAction(const G4Run* aRun)
//compute and print statistic
//
G4int NbOfEvents = aRun->GetNumberOfEvent();
G4double norme = 1./NbOfEvents;
G4double norm = 1.0/NbOfEvents;
G4double qnorm = sqrt(norm);
G4double beamEnergy = Primary->GetParticleGun()->GetParticleEnergy();
G4double sqbeam = sqrt(beamEnergy/GeV);
G4double MeanEAbs,rmsEAbs,MeanLAbs,rmsLAbs,MeanEleav,rmsEleav;
G4double MeanEAbs,MeanEAbs2,rmsEAbs,resolution,rmsres;
G4double MeanLAbs,MeanLAbs2,rmsLAbs;
std::ios::fmtflags mode = G4cout.flags();
G4cout.setf(std::ios::fixed,std::ios::floatfield);
G4int prec = G4cout.precision(2);
G4cout << "\n-------------------------------------------------------------\n"
<< std::setw(51) << "total energy dep"
<< std::setw(30) << "total tracklen"
<< std::setw(40) << "mean energy leaving per layer \n \n";
G4cout << "\n------------------------------------------------------------\n";
G4cout << std::setw( 8) << "material"
<< std::setw(23) << "Total Edep"
<< std::setw(27) << "sqrt(E0(GeV))*rmsE/Emean"
<< std::setw(23) << "total tracklen \n \n";
for (G4int k=0; k<Detector->GetNbOfAbsor(); k++)
{
MeanEAbs = norme*sumEAbs[k];
rmsEAbs = norme*sqrt(abs(NbOfEvents*sum2EAbs[k] - sumEAbs[k]*sumEAbs[k]));
MeanEAbs = sumEAbs[k]*norm;
MeanEAbs2 = sum2EAbs[k]*norm;
rmsEAbs = sqrt(abs(MeanEAbs2 - MeanEAbs*MeanEAbs));
resolution= 100.*sqbeam*rmsEAbs/MeanEAbs;
rmsres = resolution*qnorm;
MeanLAbs = norme*sumLAbs[k];
rmsLAbs = norme*sqrt(abs(NbOfEvents*sum2LAbs[k] - sumLAbs[k]*sumLAbs[k]));
MeanEleav = norme*sumEleav[k];
rmsEleav=norme*sqrt(abs(NbOfEvents*sum2Eleav[k]-sumEleav[k]*sumEleav[k]));
MeanLAbs = sumLAbs[k]*norm;
MeanLAbs2 = sum2LAbs[k]*norm;
rmsLAbs = sqrt(abs(MeanLAbs2 - MeanLAbs*MeanLAbs));
//print
//
G4cout
<< " Absorber" << k
<< " (" << std::setw(12) << Detector->GetAbsorMaterial(k)->GetName()
<< ") :"
<< std::setw( 7) << G4BestUnit(MeanEAbs,"Energy") << " +- "
<< std::setw( 5) << G4BestUnit( rmsEAbs,"Energy")
<< std::setw(12) << G4BestUnit(MeanLAbs,"Length") << " +- "
<< std::setw( 5) << G4BestUnit( rmsLAbs,"Length")
<< std::setw(22) << G4BestUnit(MeanEleav,"Energy") << " +- "
<< std::setw( 5) << G4BestUnit( rmsEleav,"Energy")
<< G4endl;
<< std::setw(10) << Detector->GetAbsorMaterial(k)->GetName() << ": "
<< std::setprecision(5)
<< std::setw(6) << G4BestUnit(MeanEAbs,"Energy") << " +- "
<< std::setprecision(4)
<< std::setw(5) << G4BestUnit( rmsEAbs,"Energy")
<< std::setw(10) << resolution << " +- "
<< std::setw(5) << rmsres << " %"
<< std::setprecision(3)
<< std::setw(10) << G4BestUnit(MeanLAbs,"Length") << " +- "
<< std::setw(4) << G4BestUnit( rmsLAbs,"Length")
<< G4endl;
}
G4cout << "\n------------------------------------------------------------\n";
G4cout << "\n-------------------------------------------------------------";
G4cout << G4endl;
G4cout.setf(mode,std::ios::floatfield);
G4cout.precision(prec);
// Acceptance
EmAcceptance acc;
G4bool isStarted = false;
for (G4int j=0; j<Detector->GetNbOfAbsor(); j++) {
if (limittrue[j] < DBL_MAX) {
if (!isStarted) {
acc.BeginOfAcceptance("Sampling Calorimeter",NbOfEvents);
isStarted = true;
}
MeanEAbs = sumEAbs[j]*norm;
MeanEAbs2 = sum2EAbs[j]*norm;
rmsEAbs = sqrt(abs(MeanEAbs2 - MeanEAbs*MeanEAbs));
G4String mat = Detector->GetAbsorMaterial(j)->GetName();
acc.EmAcceptanceGauss("Edep"+mat, NbOfEvents, MeanEAbs,
edeptrue[j], rmstrue[j], limittrue[j]);
acc.EmAcceptanceGauss("Erms"+mat, NbOfEvents, rmsEAbs,
rmstrue[j], rmstrue[j], 2.0*limittrue[j]);
}
}
if(isStarted) acc.EndOfAcceptance();
//save histograms and delete factory
//
//
#ifdef G4ANALYSIS_USE
tree->commit(); // Writing the histograms to the file
tree->close(); // and closing the tree (and the file)
G4cout << "---> Histograms are saved" << G4endl;
delete hf;
delete tree;
histoManager->SaveFactory();
#endif
// show Rndm status
@@ -218,7 +195,7 @@ void RunAction::EndOfRunAction(const G4Run* aRun)
#include "G4Gamma.hh"
#include "G4Electron.hh"
#include "G4ProductionCutsTable.hh"
#include "G4EnergyLossTables.hh"
#include "G4LossTableManager.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -259,16 +236,20 @@ void RunAction::PrintDedxTables()
G4ParticleDefinition*
part = G4ParticleTable::GetParticleTable()->FindParticle("mu+");
const G4ProductionCutsTable* theCoupleTable=
G4ProductionCutsTable* theCoupleTable =
G4ProductionCutsTable::GetProductionCutsTable();
size_t numOfCouples = theCoupleTable->GetTableSize();
const G4MaterialCutsCouple* couple = 0;
for (G4int iab=0;iab < Detector->GetNbOfAbsor(); iab++)
{
G4Material* mat = Detector->GetAbsorMaterial(iab);
G4int index = mat->GetIndex();
const G4MaterialCutsCouple* couple =
theCoupleTable->GetMaterialCutsCouple(index);
G4int index = 0;
for (size_t i=0; i<numOfCouples; i++) {
couple = theCoupleTable->GetMaterialCutsCouple(i);
if (couple->GetMaterial() == mat) {index = i; break;}
}
G4cout << "\nLIST";
G4cout << "\nC \nC dE/dx (MeV/cm) for " << part->GetParticleName()
<< " in " << mat ->GetName() << "\nC";
@@ -293,7 +274,8 @@ void RunAction::PrintDedxTables()
G4cout << "\nG4VAL \n ";
for (G4int l=0;l<nbin; ++l)
{
G4double dedx = G4EnergyLossTables::GetDEDX(part,tk[l],couple);
G4double dedx = G4LossTableManager::Instance()
->GetDEDX(part,tk[l],couple);
G4cout << dedx/(MeV/cm) << "\t";
if ((l+1)%ncolumn == 0) G4cout << "\n ";
}
@@ -305,3 +287,14 @@ void RunAction::PrintDedxTables()
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RunAction::SetEdepAndRMS(G4int i, G4ThreeVector Value)
{
if (i>=0 && i<MaxAbsor) {
edeptrue [i] = Value(0);
rmstrue [i] = Value(1);
limittrue[i] = Value(2);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -20,80 +20,54 @@
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: RunActionMessenger.cc,v 1.7 2004/06/15 11:39:59 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// $Id: RunActionMessenger.cc,v 1.3 2004/01/21 17:29:27 maire Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "RunActionMessenger.hh"
#include "RunAction.hh"
#include "G4UIcommand.hh"
#include "G4UIparameter.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWith3Vector.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RunActionMessenger::RunActionMessenger(RunAction* run)
:Run(run)
{
fileCmd = new G4UIcmdWithAString("/testem/run/setFileName",this);
fileCmd->SetGuidance("set name for the histograms file");
accCmd1 = new G4UIcmdWith3Vector("/testem/run/acceptanceL1",this);
accCmd1->SetGuidance("set Edep and RMS");
accCmd1->SetGuidance("acceptance values for first layer");
accCmd1->SetParameterName("edep","rms","limit",true);
accCmd1->SetRange("edep>0 && edep<1 && rms>0");
accCmd1->AvailableForStates(G4State_PreInit,G4State_Idle);
HistoCmd = new G4UIcommand("/testem/run/setHisto",this);
HistoCmd->SetGuidance("Set histo Edep in absorber k");
HistoCmd->SetGuidance(" histo=absor number : from 0 to NbOfAbsor-1");
HistoCmd->SetGuidance(" nb bins; Emin; Emax; unit (of Emin and Emax");
//
G4UIparameter* AbsNbPrm = new G4UIparameter("AbsorNb",'i',false);
AbsNbPrm->SetGuidance("histo=absor number : from 0 to NbOfAbsor-1");
AbsNbPrm->SetParameterRange("AbsorNb>=0");
HistoCmd->SetParameter(AbsNbPrm);
//
G4UIparameter* NbinPrm = new G4UIparameter("Nbin",'i',false);
NbinPrm->SetGuidance("number of bins");
NbinPrm->SetParameterRange("Nbin>=0");
HistoCmd->SetParameter(NbinPrm);
//
G4UIparameter* VminPrm = new G4UIparameter("Vmin",'d',false);
VminPrm->SetGuidance("Emin, expressed in unit");
HistoCmd->SetParameter(VminPrm);
//
G4UIparameter* VmaxPrm = new G4UIparameter("Vmax",'d',false);
VmaxPrm->SetGuidance("Emax, expressed in unit");
HistoCmd->SetParameter(VmaxPrm);
//
G4UIparameter* UnitPrm = new G4UIparameter("unit",'s',false);
HistoCmd->SetParameter(UnitPrm);
accCmd2 = new G4UIcmdWith3Vector("/testem/run/acceptanceL2",this);
accCmd2->SetGuidance("set Edep and RMS");
accCmd2->SetGuidance("acceptance values for 2nd layer");
accCmd2->SetParameterName("edep","rms","limit",true);
accCmd2->SetRange("edep>0 && edep<1 && rms>0");
accCmd2->AvailableForStates(G4State_PreInit,G4State_Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RunActionMessenger::~RunActionMessenger()
{
delete HistoCmd;
delete fileCmd;
delete accCmd1;
delete accCmd2;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RunActionMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
{
if (command == fileCmd) Run->SetFileName(newValue);
{
if( command == accCmd1 )
{ Run->SetEdepAndRMS(0,accCmd1->GetNew3VectorValue(newValue));}
if (command == HistoCmd)
{ G4int idh,nbins; G4double vmin,vmax; char unts[30];
const char* t = newValue;
std::istrstream is((char*)t);
is >> idh >> nbins >> vmin >> vmax >> unts;
G4String unit = unts;
G4double vUnit = G4UIcommand::ValueOf(unit);
Run->SetHisto (idh,nbins,vmin*vUnit,vmax*vUnit,unit);
}
if( command == accCmd2 )
{ Run->SetEdepAndRMS(1,accCmd2->GetNew3VectorValue(newValue));}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: SteppingAction.cc,v 1.9 2004/01/21 17:29:27 maire Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: SteppingAction.cc,v 1.10 2004/03/16 18:06:17 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -67,8 +67,8 @@ void SteppingAction::UserSteppingAction(const G4Step* aStep)
// sum up per event
eventAct->SumEnergy(absorNo,edep,stepl);
// energy leaving each volume
if (track->GetNextVolume() != volume) {
// energy from secondaries leaving each volume
if ((track->GetTrackID() != 1)&&(track->GetNextVolume() != volume)) {
G4double EnLeaving = track->GetKineticEnergy();
if (track->GetDefinition() == G4Positron::Positron())
EnLeaving += 2*electron_mass_c2;
@@ -1,4 +1,4 @@
# $Id: tbhec.mac,v 1.6 2004/01/21 17:29:22 maire Exp $
# $Id: tbhec.mac,v 1.10 2004/06/16 10:35:41 maire Exp $
#
# Macro file for "TestEm3.cc"
#
@@ -13,44 +13,20 @@
/testem/det/setAbsor 1 Copper 2.5 cm
/testem/det/setSizeYZ 17 cm
#
##/testem/phys/addPhysics g4v52
####/testem/phys/addPhysics g4v52
/testem/phys/addPhysics standard
/testem/phys/setCuts 0.07 mm
#
/run/initialize
#
/testem/run/setHisto 0 100 0. 100. MeV
/testem/run/setHisto 1 100 900. 1000. MeV
/testem/histo/setFileName 10gev.paw
/testem/histo/setHisto 0 100 0. 1000. MeV
/testem/histo/setHisto 1 100 9. 10. GeV
#
/gun/particle e-
/gun/energy 1 GeV
/gun/energy 10 GeV
/gun/position -40.635 0 0
#
/testem/phys/setCuts 10. mm
/testem/run/setFileName tb_1_10000.paw
/testem/event/printModulo 1000
/run/beamOn 10000
#
/testem/phys/setCuts 7. mm
/testem/run/setFileName tb_1_7000.paw
/run/beamOn 10000
#
/testem/phys/setCuts 1. mm
/testem/run/setFileName tb_1_1000.paw
/run/beamOn 10000
#
/testem/phys/setCuts 0.7 mm
/testem/run/setFileName tb_1_700.paw
/run/beamOn 10000
#
/testem/phys/setCuts 0.1 mm
/testem/run/setFileName tb_1_100.paw
/run/beamOn 10000
#
/testem/phys/setCuts 0.07 mm
/testem/run/setFileName tb_1_70.paw
/run/beamOn 10000
#
/testem/phys/setCuts 0.01 mm
/testem/run/setFileName tb_1_10.paw
/run/beamOn 10000
#
/testem/event/printModulo 100
/run/beamOn 1000