# Proton Calorimetry/Detector Analysis

### From PBTWiki

< Proton Calorimetry

Revision as of 11:04, 11 September 2020 by SaadShaikh (Talk | contribs)

This page contains information on the analysis code for the QuARC detector data.

## Contents |

# CMOS Sensor Image Analysis

Details on how to process images taken by the ISDI CMOS Sensor to recover the average light output in each scintillator sheet.

- First, the 21 images taken by the CMOS sensor must be corrected for non-linearity effects in the photon-electron conversion. The MATLAB script
`linear_corr_tiff.m`

does this.- The correct full-well mode must be selected in the script, typically high full-well is chosen for its superior linearity.
- The script loops over each pixel in the 21 images and applies a correction using cubic interpolation of the linearity data (linearity_high.txt). A corrected version of each image is saved.

- The 21 corrected images are then averaged using
`averageTiffs.sh`

, which outputs a single image.- On MacOS, this may require ImageMagick, which can be installed with MacPorts:
`sudo port install ImageMagick`

- On MacOS, this may require ImageMagick, which can be installed with MacPorts:
- To apply background subtraction and corrections for non-linearity in scintillator light output, the MATLAB script
`edit_runs.m`

is run.- This requires a corrected/averaged background and shoot-through measurements (front and/or back).
- Important for background and shoot-through to have the same full-well mode as the measurement. Similar spot size for the shoot-through and measurement is also desirable.
- The script outputs a .txt file containing a column of data, representing the light output in each horizontal pixel row in arbitrary units.

- As part of the fitting procedure, the method
`readCMOSData`

calibrates the x-axis to WET and calculates the average light output in each sheet:- Each scintillator sheet is enumerated and a vector of the sheet thickness (in numerical order) is hardcoded along with the configuration of the sheets for a given experimental run.
- A small thickness correction is applied based on the physical measured thickness of the stack and the perceived thickness of the stack in the sensor.
- The sheet edges in WET is found by multiplying the corrected thickness by the RSP, which is found from the ratio of the measured WET of the stack and the physical thickness.
- The light output in each sheet (0.5 millimetres away from the edges) is averaged and then normalised based either on the maximum measured light output or the reference curve at detector entry.
- Uncertainty is calculated with contributions from: sheet cross-talk, direct hits of protons in the sensor, averaging errors, spot size and position and background.

# Photodiode Data Processing

Details on how to process hexadecimal data from the DDC232 to recover the charge in each photodiode. See the linked page for instructions on how to set up CoolTerm to save data from the Zybo.

- Data is saved in hexadecimal format where one line represents data of all photodiodes in the setup. Each photodiode measurement is represented by 5 hexadecimal characters.
- The script
`plotLive.cpp`

contains code that can be adapted to generate values that can be used in the fitting procedure. - The full-scale range must be set correctly based on the configuration of switches 1-3 on the Zybo.
- Each 5-character hex value is converted to an absolute decimal and then converted to a charge in pC. The zero-current offset is subtracted in the same step.
- The photodiode-input-resistor maps ensure that the ordering of measurements represents the physical order of photodiodes.
- As each photodiode is split across two inputs, the 32 total measurements become 16 measurements, where inputs of the same photodiode are summed.
- Practically, this makes the full-scale range twice that of what is set on the Zybo.

- The 16 charge values recovered can be used in a fit, along with the WET sheet edges (calculated in a similar way as above, but could also be hardcoded).

# Fitting QuARC Data

## Useful literature

- Laurent's paper on the quenched Bragg model.
- Original paper introducing Birks' Law.
- Paper mentioning 2nd order extension to Birks' Law.
- Paper on Bortfeld's analytical approximation of the Bragg curve.
- Paper on reference FLUKA curves at HIT.
- Paper on creating SOBPs.
- Paper about LibdEdx and its follow-up.
- Paper on Kramer's model.

## Notes on Fitting

- Loading either CMOS or Photodiode data into the fitting routine creates a Measurement object, which contains the following class variables:
- The measurement number, species, energy and absorber thickness.
- A reference range is taken from LibdEdx using the energy of the delivered beam, subtracting the thickness of any absorber used in the measurement.
- A relevant FLUKA curve for the beam energy, if it exists (HIT only).
- Vectors of the average light output in each sheet, the sheet edges in WET and the uncertainty of the light output.
- The RAW PDL in a TH1D object.

- Sigma is estimated with Bortfeld's approximation, which is only truly valid for protons.
- While sigma can be estimated from a Gaussian fit of the Bragg peak, the poor spatial resolution of the detector means that Bortfeld's estimation tends to work better for all particle species.

- Phi0 is estimated with a rough guess using the largest count.
- For low energies, there are more direct proton hits in the sensor, so the fit start is moved to avoid the first few sheets.
- The fit end is chosen to avoid the fragmentation tails of ion fits.
- Birks' law to second order has been implemented, though currently not tested. C is set to 0. kB is set to a rough estimate of 0.07, typically correct for protons.
- The particle species, material and buildup approximation codes are used as fake fixed parameters in the model, to set the correct constants.
- The buildup approximation is rarely ever used and can be ignored.

- The QB model is implemented in a TF1 object and is fitted using ROOT's binned fitting routine.
- After the QB model is fitted, the relevant fit parameter results are extracted to recover Bortfeld's Bragg curve, which can be compared against facility reference curves.
- The
`quenchedBraggHist`

function implements ROOT's binned fit by hand, it is often slower but can be useful for measurements with only a small number of data points.

- The

## SOBP Fit

- A reference SOBP for HIT can be constructed by interpolating and weighting individual FLUKA curves using the number of proton beams delivered, their energies and the number of particles in each beam.
- An SOBP fit this just weights and sums individual proton beams, using the additional parameters chi and p, which are described in this paper.
- At the moment, chi and p are estimated by hand.

## Ion Fits

- As mentioned, for ion fits, the QB fit range must be restricted to avoid the nuclear fragmentation tail after the Bragg peak.
- The QB model performs reasonably well with helium, but may not describe carbon well.
- Reference FLUKA curves for HIT are currently being sought in order to accurately determine the QB model performance in ion fits.
- Birks' law to second-order may be necessary here.

# Future Development

- Replace the QB model with Kramer's numerical model for depth-dose curves, applicable to all ions, and then apply (second-order) Birks' law.