![]() |
Advanced Programming Concepts 2014 23-27 June 2014 MPI Munich, Germany School web site Refactoring session web page |


Install a hypervisor on your laptop.
The following procedure has been tested on VirtualBox,
but in principle it should work with any other hypervisor.
Follow the instructions
to configure your hypervisor.
Configure
your CernVM virtual machine.
You may want to share a folder on your laptop devoted to refactoring exercises.
If you did not yet define a suitable context (a set of configuration options),
create a new one.
Pair
your virtual machine to the context that you defined.
Login on your virtual machine.
You can download
it or you can
wget http://www.ge.infn.it/geant4/training/APC2014/exercise2/APC2014ex2.tgz
Unpack the tarball in your home directory: tar -zxf APC2014ex2.tgz| geant4.10.00.p01 |
contains Geant4 code, version 10.0-patch01 |
| work10APC | contains Geant4 libraries (precompiled on SL6 with gcc 4.4.7) and the test executables you will create in the exercise |
| parametersAPC | contains "original" and "improved" Aij parameters for the calculation of photoelectric cross sections |
| dataAPC | contains experimental data for validation; you will place the cross sections calculated by the test here |
| test | contains the test code to be used in the refactoring process |
| rwork | contains R scripts for data analysis |
| setup10APC.csh setup10APC.sh |
defines some environmental variables needed for the test |
The setup10APC script defines a convenient environment variable corresponding to the directory containing the meterial for the exercise:
Place new tests in $APCDIR/test. The following instructions assume you are using the tcsh shell; adapt them as appropriate, if you use the Bourne shell.
If you wish to rebuild a test from scratch:

![]() |
We could investigate the use
of some of the techniques described in the
book "Working Effectively with Legacy Code" to make the calculation of
the photoelectric cross section testable. As physicists, we perceive a "bad smell": we want to be able to know the cross sections used in our simulation and to compare them with experimental data without creating unnecessary objects that have no relation with a cross section. We decide to refactor (reengineer) the code and make the photoelectric cross section testable. |


Place new classes in $G4INSTALL/source/processes/electromagnetic/pii/:
Whenever you add or modify a class in the pii package, recompile it: