Project

General

Profile

Changes to test27

These changes were done in "Standalone" mode (see README, using CMakeLists_Standalone.txt)

Changes to test27.cc itself

Changes to this class demonstrate the drop-in compatibility of the new factory. One would like to register the physics list Tst27PhysicsList that is associated with this test program. Unfortunately Tst27PhysicsList derives from G4VUserPhysicsList and not G4VModularPhysicsList. The factory interface allows only returning those derived from the later (following on the original factory interface); changing this would require significant changes to all existing code that uses the factory.

$ diff -u -w test27.cc ../../source/geant4/tests/test27/
--- test27.cc    2016-01-31 22:34:33.838933000 -0600
+++ ../../source/geant4/tests/test27/test27.cc    2016-01-31 17:52:14.894426000 -0600
@@ -33,15 +33,7 @@
 #include "G4UImanager.hh" 
 #include "G4UIterminal.hh" 

-#ifdef USE_OLD_FACTORY
   #include "G4PhysListFactory.hh" 
-#else
-  #include "G4PhysListFactoryAlt.hh" 
-  // G4_DECLARE_PHYSLIST_FACTORY(Tst27PhysicsList);
-  // can't add Tst27PhysicsList because it's derived from G4VUserPhysicsList
-  // and not G4VModularPhysicsList
-  using namespace g4alt;
-#endif
 #include "CLHEP/Random/Ranlux64Engine.h" 

 #ifdef G4MULTITHREADED

Testing

The code was first build unadulterated, and two passes run (once using the default, then specifying a physics list on the command line). The code was then updated, rebuild and then re-run.

cd ${GEANT4_DIR}/tests-standalone/test27-standalone/
if [ ! -f CMakeLists.txtorg ]; then
  mv CMakeLists.txt CMakeLists.txtorig
  mv CMakeLists_Standalone.txt CMakeLists.txt
fi
$CCFORCE cmake .   # CCFORCE to use alternative gcc
make -f Makefile
cp ./test27.cc ./test27.cc_original_code
mv ./test27 ./test27_original_code
./test27_original_code test27.in >& test27.out.original_code
./test27_original_code test27.in FTFP_BERT >& test27.out.original_code_FTFP_BERT
make -f Makefile clean
make -f Makefile
mv ./test27 ./test27_new_factory
./test27_new_factory test27.in >& test27.out.new_factory
./test27_new_factory test27.in FTFP_BERT >& test27.out.new_factory_FTFP_BERT

differences

For the case where no physics list is specified it runs using Tst27PhysicsList and the output is identical except for a series of reported times, which vary by minor amounts. These will be suppressed in further outputs.

$ diff test27.out.original_code test27.out.new_factory
448c448
<   User=20.99s Real=21.05s Sys=0.04s
---
>   User=21.63s Real=21.84s Sys=0.09s
[... similar timing differences ...]

When actually using a G4PhysListFactory both report using FTFP_BERT but report it with a slightly different variation on the actual format.

diff test27.out.original_code_FTFP_BERT test27.out.new_factory_FTFP_BERT
10c10
< G4PhysListFactory::GetReferencePhysList <FTFP_BERT>  EMoption= 0
---
> G4PhysListRegistry::GetModularPhysicsList <FTFP_BERT>, as "FTFP_BERT" with extensions "" 
[... difference in reported timing ...]

A final cross check of what should be two different physics lists, show that they indeed are:

diff test27.out.original_code test27.out.new_factory_FTFP_BERT
> G4PhysListRegistry::GetModularPhysicsList <FTFP_BERT>, as "FTFP_BERT" with extensions "" 
> <<< Geant4 Physics List simulation engine: FTFP_BERT 2.0
> 
> <<< Reference Physics List FTFP_BERT is built
> 
12d16
< Tst27PhysicsList::SetCuts:CutLength : 1000 (mm)
16a21
> ### Adding tracking cuts for neutron  TimeCut(ns)= 10000  KinEnergyCut(MeV)= 0
19d23
< Tst27PhysicsList::SetCuts:CutLength : 1000 (mm)
30,31c34,35
< conv:   for  gamma    SubType= 14  BuildTable= 1
<       Lambda table from 1.022 MeV to 10 TeV, 20 bins per decade, spline: 1
---
> phot:   for  gamma    SubType= 12  BuildTable= 0
>       LambdaPrime table from 200 keV to 10 TeV in 54 bins 
33,34c37
<         BetheHeitler :  Emin=        0 eV    Emax=       80 GeV
<      BetheHeitlerLPM :  Emin=       80 GeV   Emax=       10 TeV
---
>        PhotoElectric :  Emin=        0 eV    Emax=       10 TeV   AngularGenSauterGavrila  FluoActive
42,43c45,46
< phot:   for  gamma    SubType= 12  BuildTable= 0
<       LambdaPrime table from 200 keV to 10 TeV in 54 bins 
---
> conv:   for  gamma    SubType= 14  BuildTable= 1
>       Lambda table from 1.022 MeV to 10 TeV, 20 bins per decade, spline: 1
45c48,49
<        PhotoElectric :  Emin=        0 eV    Emax=       10 TeV   AngularGenSauterGavrila
---
>         BetheHeitler :  Emin=        0 eV    Emax=       80 GeV
>      BetheHeitlerLPM :  Emin=       80 GeV   Emax=       10 TeV
50c54,55
<             UrbanMsc :  Emin=        0 eV    Emax=       10 TeV  Table with 77 bins Emin=    100 eV    Emax=     10 TeV
---
>             UrbanMsc :  Emin=        0 eV    Emax=      100 MeV  Table with 42 bins Emin=    100 eV    Emax=    100 MeV
>         WentzelVIUni :  Emin=      100 MeV   Emax=       10 TeV  Table with 35 bins Emin=    100 MeV   Emax=     10 TeV
[... and so forth ...]