# ELogs/SaadShaikh

### From PBTWiki

< ELogs

Electronic Log for Saad Shaikh

## Contents |

## To Do

*Last updated 09/09/22*

**Detector Prototype****FPGA & DAQ**- Debug USB104 DAQ problems
- Implement data line header/footer, robust configuration pattern and version number.
- Increase fit speed: investigate work from Naoki

**Detector simulation**- Improve PDD and PDL accuracy.
- Fix photon propagation into photodiodes.
- Mylar foil simulation.
- Improve description of optical properties.

## Upcoming Dates

Date | Event |
---|---|

25-26th October 2022 | Manchester beam test |

3-4th November 2022 | Groningen beam test (TBC) |

??? ??? 2022 | Clatterbridge beam test |

??? December 2022 | UCLH beam test |

31st March 2023 | End of PhD funding |

## PhD Completed

- Review of literature given by Laurent
- Delivered MSci presentation to PG Physics Society.
- Set up environment in Eclipse for analysis code to fit Bortfeld and quenched Bortfeld Bragg curves to simulated data and data from range telescope.
- Tested analysis routines on simulated and raw data.

- HEP PG courses in term 1: SM1, SM2 & topics in particle physics.
- Medical physics course in term 1: Treatment with Ionising Radiation.
- Passed Standard Model exams: 80% SM1 and 48% SM2.
- Analysis of effects of beam spot size on range reconstruction from April 2019 HIT data, also with photodiode approximation. Results shown in this presentation
- Medical physics courses in term 2: Radiotherapy Physics & Medical Imaging with Ionising Radiation.
- Installed GEANT4 locally on MacOS High Sierra and Catalina, set up environment in Eclipse.
- Can successfully run simulation of range telescope with different parameters and analyse output data.

- Fully implemented Laurent's analysis code and made improvements for better code practice, better parameter estimation and started framework for He and C fitting.
- Analysis of performance of quenched Bortfeld model with heavy ions, results shown in this presentation
- Analysis of SOBP data, results shown in this presentation
- Preliminary testing of 2nd order Birks' Law, results shown in this presentation
- Presented on I/O signals and operation of TI DDC232CK based on datasheet information. Slides available here.
- Wrote code to interface FPGA with DDC232 and tested in simulation. Results of simulation discussed here.
- Interfaced DDC232 code with a UART transmitter, discussed UART interface in this presentation.
- DDC232 code operational, first tests discussed in this presentation.
- Implemented further features in DDC232 design, demo given in this presentation.
- Added FIFO between DDC232 and UART transmitter and wrote ROOT macro to plot live photodiode data being saved by CoolTerm on MacOS.
- Wrote PBT Wiki pages on Zybo Z7 and DDC232 and QuARC Data Analysis.
- Implemented readout before and after CONV toggles in FPGA design, to access shortest possible DDC232 integration times.
- Submitted transfer report.
- Delivered transfer talk.
- Completed transfer mini-viva and passed Upgrade.
- Ported FPGA design to Nexys Video.
- Can set FSR remotely and choose between several integration times using on-board switches.
- Took and analysed photodiode data at home and at UCL with Raffy.
- Results discussed with Ruben in this presentation.
- Results discussed with Marko in this presentation

- Created live quenched Bragg fit macro to read in photodiode data, perform fit and display results.
- Tested daisy-chaining 2nd DDC232 board prototype, discussed results in this presentation.
- Developed USB interface using FTDI chip on Nexys Video to send data to PC, using libFTDI. Designed to replace UART interface.
- Optimised speed and UI
- Ported code to Raspberry Pi.

- Attended HEP Summer School
- Wrote macros to perform single-channel/photodiode noise analysis of DDC232 data, replay previously acquired measurement and plot live data with background subtraction/calibration.
- Several tests of DDC232 rev. B board noise/daisy-chain performance: [1], [2] and [3].
- Beam test at UCLH on April 15th and data analysis, recorded on this page. Results discussed in this presentation.
- Attended Heavy Ion Therapy Masterclass School.
- Submitted entry for Doctoral School Research Poster Competition.
- Delivered seminar for PART.
- Optimised ROOT fitting speed: for 32 data points (105 MeV beam), 13Hz with ROOT display and 35-40Hz without.
- Painted 32 sheets, stripped of black paint, white and remeasured thicknesses.
- Beam test at UCLH on Nov 2nd and data analysis, recorded on this page. Results discussed in this presentation.
- Submitted video and poster for IEEE NSS MIC 2021.
- Submitted abstract for FRPT 2021. Awarded oral presentation – slides available here.
- Submitted application for HITRIplus internship at MedAustron, however did not receive a response after initial interview.
- Analysed Nikon images from 2nd November 2021 beam test, results discussed in this presentation.
- Submitted abstract for IOP HEPP and APP 2022 – awarded talk.
- Submitted abstract for CALOR 2022 – awarded talk, with trip being funded by MAPS PGR travel grant.
- Submitted abstract for Pisa Meeting 2021 – awarded poster and talk with Simon, with trip being funded by Young Researcher Grant award.
- Submitted abstract for PTCOG60 – awarded talk.
- Awarded grant of £3000 for project with MAPS EDI funding call.
- Tested and debugged Rev. C DDC232 boards from CosyLab.
- Ported Pmod FPGA design to compact USB104 board, however still debugging issues with data transfer.
- Built from scratch Geant4 simulation of detector geometry, with capability to measure dose and light in scintillator sheets.
- Completed LED lab tests with unpainted sheets and white paper, black card and mylar foil. Results presented in this presentation.
- Assembled prototypes for 16th June 2022 beam test at UCLH, performed analysis and presented results in this presentation.
- Wrote presentation on QuARC history.
- Tested and debugged Rev. D DDC232 boards from CosyLab.
- Assembled prototypes for 1st September 2022 beam test at UCLH, performed analysis and presented results in this presentation.

## MSci Completed

- Literature review.
- First Birmingham experimental run.
- Wrote code to load and plot Caen digitiser data in histograms.
- Overhauled LeCroy data analysis routines: (short region) double baseline sigma testing, dynamic integration window allocation, empty acquisition checks.
- Wrote code to scale and plot LeCroy & Caen data onto single plot, using approximate x and y-scale factors.
- Wrote code to load and plot PRaVDA data in 2D histograms.
- Wrote code to correlate tracker and calorimeter measurements, to produce a list of events with X, Y, E coordinates.
- Wrote code to plot matched events into various 3D histograms: XY, XE, YE.
- Progress report.
- Progress interview.
- Improved LeCroy & Caen matching by finding x-scale factor through chi-square minimisation.
- All runs from first Birmingham put through matching algorithm. Energy spectra, 2D tracker histograms, and 3D XY, XE & YE histograms plotted for all runs (187 plots).
- Wrote code to plot 3D XY histograms, but with the height of bars being the average energy in the bin.
- Improved LeCroy & Caen matching by finding y-scale factor through chi-square minimisation or through peak event counting. Peak event counting method best.
- Converted energy to range in XYE histogram.
- Plotted 2D number density histogram alongside 3D XYRange histogram.
- Produced poster for PPRIG 2019 of experiment with single-module calorimeter and PRaVDA tracker.
- Attended PPRIG 2019.
- Completed MSci Final report.
- Delivered presentation on project.
- Attended PTCOG 2019 and presented poster with Tony Price.

## Log of MSci Work

- Created class for Caen data, and implemented methods to plot data as graphs and histograms
- Plotted Caen data from Birmingham (26/11/18)
- Experimented with integration parameters to plot histograms of LeCroy data from Birmingham (26/11/18)
- Found that fixed pulse position assumption no longer entirely valid.
- Best parameters were an offset of -120ns and a window of 150ns, with a maximum baseline sigma of 30.
- Recovered good quality plots, however non-negligible number of entries centred around 0.

- Updated method of loading multiple .trc files as assumption of sequentially named files is not valid. User has to input the filenames by hand given a directory.
- Verified that writing histogram data to disk produces a list of energies and associated trigger times.
- Updated raw and subtracted waveform plotting to correctly reflect position of trigger. Removed functionality to plot more than one pulse in favour of this, however the code to plot waveforms is now much simpler/faster.
- Overhauled baseline subtraction method
- Since pulse could be in anywhere within the acquisition window, we now first test the pre-trigger window, and if the baseline sigma test is failed, then the equivalent region at the end of the window is also tested before the acquisition is labelled as false.
- Old version of code only kept the amount of the acquisition that resided in the pre-determined and constant integration window after baseline subtraction. This is no longer acceptable due to the varying position of the pulse, so after baseline subtraction, the full acquisition is stored, with a time axis that reflects the actual trigger position.
- While more data-intensive, actual code for baseline subtraction has become simpler.
- Maximum baseline sigma could then be restricted to 20 instead of 30.
- Dynamic pulse location for integration
- In attempt to solve “zero error”, implemented a method that searches each subtracted acquisition for the peak of the pulse, and then integrates 20ns before it, for the integration window specified by the user.
- User now does not need to guess the integration offset relative to the trigger, but the code is probably slightly slower due to the extra looping over the dataset.
- This did not appear to solve the “zero error” – suspected that such acquisitions simply contained no pulses. Need to plot raw waveform of such an acquisition to verify.

- Zero Error Testing
- By printing out the indices of pulses that produced negative energy (the erroneous events follow a Gaussian around zero, hence some integrals were negative), erroneous event waveforms were plotted.
- It was found that such events simply had no pulse in them, the plots revealed only dark current/noise.
- Implemented a method alongside baseline testing to also check if a negative value of pd was recorded in the pre-subtracted waveform, since dark current/noise takes distinctly positive values.
- Now an acquisition must have a distinct region of dark current, and have recorded a negative value of pd in order to be labelled as “good”.
- This fixed the zero error.
- This has made the baseline test method clunkier, so the method could potentially use some refinement.

- It’s possibly been found that in the messier data, the code outperforms the digitiser by filtering out sufficient pileup to produce cleaner peaks.
- Each file typically labels ~10% of acquisitions as “bad”.
- Moved good acquisition check to the plotting stage, such that bad acquisitions will also have an integral and be written to disk as well. This is to preserve the 1:1 ratio of tracker and calorimeter data.
- Implemented method to plot Caen and LeCroy data onto same graph. By finding the ADC count with the highest frequency for both Caen and LeCroy data, scaling factors for the x and y axis were found. The Caen data was scaled and plot with the LeCroy data, giving an excellent match.
- Improved ADC spectra of LeCroy by shortening the region over where the baseline sigma was evaluated (from 9/10 to 8/10), to reduce the chances of the pulse interfering with the calculation. This allowed for the maximum baseline sigma to be reduced from 20 to 5, giving a spectrum closer to that of the Caen ADC, with less noise and a similar number of acquisitions being labelled as “bad”.
- It seems as though most pulses arrive at around -120ns. If so, and if the first baseline test is passed, any acquisitions with extra pulses towards the end of the acquisition will be labelled as good.
- Wrote code to load and plot tracker data in a 2D histogram.
- Added labels of good/bad acquisitions to text file output of LeCroy data.
- Matched good LeCroy acquisitions and good tracker hits by matching LeCroy events to tracker events within a threshold of 500 + 3.42E-6*trackerTime. Needed a shifting threshold due to the clocks shifting further out of alignment.
- Wrote code to output a list of matched event coordinates in X, Y, E space to a text file.
- Wrote code to make 3D histograms of spatial hit distributions: XY, XE, YE. Expected results seen but need to work out how to create 4D plots (X, Y, E, Counts).
- Initial attempt to match Caen and LeCroy energy spectra by minimisation of chi-square: Y-scale calculated as before, but an X-shift calculated by the smallest Chi-Square given in a certain range. Result was not a close match – need an X-scale not an X-shift.
- Improved Chi-Square method by using approximate x scale factor, and then testing scale factors in re-binned Caen data +- 0.5% of the approximate factor in 0.1% steps, choosing the scale factor that gives the smallest chi-square.
- Tested on all runs: some gave no change to the approximate scale factor, but some gave a small change of ~0.003.
- The best chi-square is dependant on binning. Choose bin number to give an integer value within x-range. Instead of 500 bins, 550 bins were chosen for an x-range of 2200. Sets precedent for number of bins to choose.
- Extended range to +- 1.5% in steps of 0.05% to improve resolution and because some chi-squares didn’t quite minimise previously. Typically takes 6-7 mins to complete.
- After testing all runs with the extended test range, the average x scale factor was found to be:
- Wrote code to calculate the y-scale factor by comparing the number of events in a specific range around the peak. Could not explain factor of 4 difference in the returned y-scale value.
- Investigated a routine to find y-scale using a chi-square minimisation, however this was not possible. To evaluate the chi-square, one requires the comparison between two histograms with the same number of bins. However, the number of bins chosen affects the overall y-scale, so one cannot find a y-scale for the full resolution Caen digitiser data by re-binning into the same number of bins as the LeCroy.
- That being said, despite errors messages when evaluating a chi-square with differently binned histograms, one does get a chi-square value returned. However, this result is not reliable. By minimising the chi-square for the x-scale using differently binned histograms, one gets a worse result (tested on run 7). Better to stick with peak counting to find the y-scale.
- Wrote code to plot XY histograms but with the height of the bars being the average energy of particles in each bin. Plot filters bins with events less than a user-defined minimum (20 events works well).
- Transformed average energy to average range using a power law found from Geant4 of proton range in water for energies between 4-40 MeV.
- Wrote code to plot 2D number density histogram as a plane on top of the average range 3D histogram.