====== Primasoft extension for radiation dose estimations ====== ==== Introduction ==== The purpose of this extension is to use the Geant4 package to estimate the radiation dose the various component of the Primakoff experiment setup might absorb during a certain number of hours of operation. The result of the simulation is a three dimensional radiation map of the whole hall or a selected region. This is subdivided in elementary cubic volumes (or voxels), and a mean radiation dose per beam electron in each voxel is calculated. "Mean" implies here an average over many events and over the volume of the voxel. For some case (e.g. radiation absorbed by some small compoents), the mean dose can be calculated for full physical volumes without mapping it into voxels. The followed strategy implies: * making use of the "parallel world" feature of Geant4 for scoring the dose independently of the "mass geometry", i.e. the geometry used for simulating the physical processes and doing the tracking; * simulating events starting with beam electrons directed to the target; * using one or more sensitive detector classes to gather the radiation dose in every tracking step and to sort it into appropriate data structures; * summing the energy deposited in every step divided by the density of the material in which the step took place (this is needed in case the voxel includes parts of different physical volumes, i.e. different materials); * At the end of the simulation, the sum needs to be divided by the voxel volume and the number of simulated events in order to obtain the mean radiation dose absorbed in the voxel per beam electron. ==== Software Upgrade ==== == Modifications to existing code == * PRIMASimulationConfig\\ new command ''do-radiation-studies'' added to switch on the radiation dosis simulation (referred to as ''doRadStudies'' in the following). * PRIMASimInfo:\\ the ''doRadStudies'' flag is added to the info class. * PRIMAPostDetConstruction in method Initialize(), if ''doRadStudies'' is 1 * the ''radStudiesPW'' parallel world is instantiated and registered; * A step limit of 1 mm is defined for the ''DefaultRegionForTheWorld'' (entire geometry); * A step limit without restriction is defined for the vacuum in order to subside the 1 mm limit. * PRIMAPhysicsList: if ''doRadStudies'' is 1,\\ the ''G4ParallelWorldProcess'' for the ''radStudiesPW'' parallel world is defined and assigned to all particles. * PRIMARunAction in method ''EndOfRunAction()'', if ''doRadStudies'' is 1\\ the radiation map filled by the parallel world sensitive detector is written to the output file. * PRIMAPrimaryGeneratorAction:\\ the class ''PRIMABeamGenerator'' has just been defined but not yet implemented. If the beam is simulated with fixed energy and 0 emittance, it is not needed, since the G4 particle gun is sufficient. (Possibly to be done by Alex). * primag4simLinkDef.h:\\ the new classes requiring a dictionary are added to the ''LinkDef'' file. == New files and classes == * ''PRIMARadDosisData.{hh,cc}'' * ''struct PRIMARadStudiesVoxelId'' represents a voxel by an index triple ''i,j,k'' * ''class PRIMARadStudiesVoxelIdComparator'' is used for sorting and distinguishing the voxel objects. It is needed to use them as key for a ''std::map''. * ''class PRIMARadStudiesMap'' is an interface class to be able to write one of its instances to a root file with a given name. It is defined as class PRIMARadStudiesMap: public std::map, public TNamed * ''PRIMARadDosisStudies.{hh,cc}'' * ''class PRIMARadSudiesParallelWorld'' * derives from ''G4VUserParallelWorld'' * takes the pointer to the world volume of the parallel geometry and places a box of the dimensions of the hall inside of it * instantiates a sensitive detector and assigns it to the full hall * ''class PRIMARadStudiesSD''\\ sensitive detector (derives from ''G4VSensitiveDetector'') holding the radiation map (''PRIMARadStudiesMap'' object). * The ''ProcessHit'' functioning: * finds the voxel corresponding to the mid point of the step * calculates the energy deposit to density ratio * creates/updates map entry for that voxels * A method ''WriteTextFile'' is provided to dump the map into a ASCII file for testing purposes. Activation and output file name are hard coded so far. Dynamical settings could be added to ''PRIMASimulationConfig'' if needed. ==== First example ==== In the example a geometry containing only the target, the vacuum volume and parts of the beam pipe downstream of the scattering chamber is defined. The radiation dose is scored over the full hall subdivided in voxels of 1 cm side length. == Geometry == * Two new materials (TGeoMedium) have been defined: * Tantalum for the target * Iron for the octagonal pipe. The density of the pure iron "Armco-Eisen" has been used. * Two support functions are defined and implemented in ''geometry/PRIMABeamPipe.{hh,cc}'' * ''TGeoVolume* ConstructVacuumVolume()''\\ defines the vacuum volume, i.e. inner scattering chamber and inner beam pipe, as a single ''TGeoVolume'' from a composite shape. This is important to ensure that the beam electrons inside the vacuum can travel until the end of the hall without unwanted material layers. * ''TGeoVolumeAssembly* ConstructBeamPipe()''\\ places the vacuum volume, the aluminium flange at the target chamber exit, and a simplified "octagonal" pipe (defined as a cone) inside a ''TGeoVolumeAssembly'' * A new main is implemented in ''geometry/build_beam_pipe.cxx'' for generating the root file with the geometry, containing the assembly described above and the tantalum target inside the hall. == Geant4 Settings == * Geometry: as just described. * Primary generator: the particle gun shooting electrons * from the beam axis upstream of the target * in the beam direction (positive z direction) * with an energy of 1.5 GeV * Simulated events: 106 == Results == In order to analyse the output map from the geant4 simulation the example macro ''rootmacros/rad_studies.C'' has been introduced. It shows: * how to read and handle the radiation map, * how to loop over the map entries, and * make a 2d map for the region around the yz-plane (vertical plane containing the beam direction). {{ :software:g4simulation:rad_map_x0_example.png?nolink&500 |}} == FLUKA simulations == A guide to the FLUKA simulations using Flair can be found [[FLUKA#Simulations|here]]