DTC toolkit

From pCT

The Digital Tracking Calorimeter Toolkit is located at Helge's github (but should be moved to the Gitlab when ready).

To clone the project, run

   git clone https://github.com/HelgeEgil/focal

in a new folder to contain the project. The folder structure will be

   DTCToolkit/                 <- the reconstruction and analysis code
   DTCToolkit/Analysis         <- User programs for running the code
   DTCToolkit/Classes          <- All the classes needed for the project
   DTCToolkit/Data             <- Data files: Range-energy look up tables, Monte Carlo code, LET data from experiments, the beam data from Groningen, ...
   DTCToolkit/GlobalConstants  <- Constants to adjust how the programs are run. Material parameters, geometry, ...
   DTCToolkit/HelperFunctions  <- Small programs to help running the code.
   DTCToolkit/OutputFiles      <- All output files (csv, jpg, ...) should be put here
   DTCToolkit/RootFiles        <- ROOT specific configuration files.
   DTCToolkit/Scripts          <- Independent scripts for helping the analysis. E.g. to create Range-energy look up tables from Monte Carlo data
   gate/                       <- All Gate-related files
   gate/python                 <- The DTC geometry builder
   projects/                   <- Other projects related to WP1

The best way to learn how to use the code is to look at the user programs, e.g. Analysis.C::DrawBraggPeakGraphFit which is the function used to create the Bragg Peak model fits and beam range estimation used in the 2017 NIMA article. From here it is possible to follow what the code does. It is also a good idea to read through what the different classes are and how they interact:

  • Hit: A (int x,int y,int layer, float edep) object from a pixel hit. edep information only from MC
  • Hits: A TClonesArray collection of Hit objects
  • Cluster: A (float x, float y, int layer, float clustersize) object from a cluster of Hits The (x,y) position is the mean position of all involved hits.
  • Clusters: A TClonesArray collection of Cluster objects.
  • Track: A TClonesArray collection of Cluster objects... But only one per layer, and is connected through a physical proton track. Many helpful member functions to calculate track properties.
  • Tracks: A TClonesArray collection of Track objects.
  • Layer: The contents of a single detector layer. Is stored as a TH2F histogram, and has a Layer::findHits function to find hits, as well as the cluster diffusion model Layer::diffuseLayer. It is controlled from a CalorimeterFrame object.
  • CalorimeterFrame: The collection of all Layers in the detector.
  • DataInterface: The class to talk to DTC data, either through semi-Hit objects as retrieved from Utrecht from the Groningen beam test, or from ROOT files as generated in Gate.

To run the code, do

   [DTCToolkit] $ root Load.C

and ROOT will run the script Load.C which loads all code and starts the interpreter. From here it is possible to directly run scripts as defined in the Analysis.C file:

   ROOT [1] drawBraggPeakGraphFit(...)

Quick guide to drawBraggPeakGraphFit

In order to run the function drawBraggPeakGraphFit, which is the main body of the code used to generate interesting results, the following arguments are needed:

   drawBraggPeakGraphFit(Int_t Runs, Int_t dataType = kMC, Bool_t recreate = 0, Float_t energy = 188, Float_t degraderThickness = 0)
  • Runs: The number of times to run the code on n proton histories. The number n is defined as kEventsPerRun in GlobalConstants>Constants.C.
  • dataType: Monte Carlo (0) or experimental data (1)
  • recreate: Use stored tracks for this dataType/energy in Data/Tracks to save time (0), or recreate the tracks (1)
  • energy: Which energy to run the code on. Fetches the corresponding MC / exp. file from Data/MonteCarlo[ExperimentalData]/...%dMeV....ROOT
  • degraderThickness: If the code is to be run in energy degrader mode (constant initial energy modulated by a water phantom of varying thickness), then set useDegrader = true in Constants.h and give the water thickness in mm here.

Example, to run MC with a 240 mm degrader, with a DTC geometry of 3 mm (this has to be set as the kAbsorberThickness in Constants.h), and do one run on new data:

   drawBraggPeakGraphFit(1, 0, 1, 250, 240)

The file Data/MonteCarlo/DTC_Aluminium_Absorber3mm_Degrader240mm_250MeV.root is then loaded into memory.

Tip: In order to run multiple files in batch mode, look at the script DTCToolkit/Scripts/makeBraggPeakPDFDegrader.C, controlled with the bash script DTCToolkit/makeFitResultPlotsDegrader.sh. The results are stored in the DTCToolkit/OutputFiles/results_makebraggpeakfit.csv file. To loop through with the above configuration, but with degrader thicknesses of 50 to 350 with 5 MeV steps, do

   [DTCToolkit] $ sh makeFitResultPlotsDegrader.sh 50 5 350

When this is done, look through the file result_makebraggpeakfit.csv. The script DTCToolkit/Scripts/makePlots.C can create nice output from this file:

   [DTCToolkit] $ root Scripts/makePlots.C