Python calculators Clause Samples
Python calculators. Two python classes were written. The first one, XCSITPhotonDetectorParameters, implements the abstract python class AbstractCalculatorParameters. Its purpose is to gather and check all the input parameters. If an parameter is set which is not specified in Constants an exception is raised. Nevertheless, instances of this class are essentially containers with property getter and setter functions. The properties are the same as the options in table 1. The second class is the calculator itself. It implements AbstractPhotonDetector which itself is de- rived from AbstractBaseCalculator. For this reason, the way the simulation is performed is already predetermined:
1. After instantiation python calls immediately the init function. This function possesses three formal parameters: a XCSITPhotonDetectorParameters instance, a variable to store the path for the input file and a variable to store the path for the output file. Since python variables do not have types, the init function has to check if the inserted actual parameters fit with the required instances. Furthermore, init deals with incomplete input.
2. The next method to call is readH5. Since the input to this calculator is different to the input of ParticleSim and ChargeSim, the data from the hdf5 input file has to be translated: The ma- trix of intensities is read and transformed into instances of PhotonEnty stored in an instance of PhotonData. The instances of PhotonEntry store for each photon the following attributes: energy, normalized vector of flight direction, current position. Those values where calculated from the input data by applying geometry.
3. For running the simulation the backengine method has to be called. It consists of two parts:
a) The PhotonData instance is passed into ParticleSim which transfers the container into XCSIT::XGeant4ParticleSim where interactions of the photons with the detector material are simulated. The output container InteractionData is also passed to those classes. During the simulation it is filled with instances of type InteractionEntry that contain for each interaction the deposited energy in the material at a given site of the detector and the time when that happens after start.
b) The instance of InteractionData is handed to the instance of ChargeSim which transfers it into XCSIT::XPlasmaPointChargeSim and the Geant4 classes respectively. Since the readout electronics cannot be at the surface of a detector an electrical field is applied to pull the created charge...
