# ELogs/SaadShaikh

### From PBTWiki

< ELogs

Revision as of 15:31, 25 May 2021 by SaadShaikh (Talk | contribs)

Electronic Log for Saad Shaikh

## Contents |

## To Do

*Last updated 25/05/21*

**FPGA & DAQ**- Non-ROOT-based fit using GNU Scientific Library.
- Debug signals crossing clock domains

**Heavy-ion fitting**- Acquire HIT FLUKA tables for He, C and O beams.
- Re-read relevant papers and implement Kramer's model for protons.
- Implement Kramer's model for helium ions using cross-section formulae in Kramer 2016.
- Implement Kramer's model for carbon ions: get in touch with Lenny or Kramer to discuss how to obtain cross-section data.

**Detector simulation**- Reinstall GEANT4 with correct Qt5 usage to fix visualisation bug in MacOS Catalina.
- Rebuild Laurent's QuARC simulation to fix bugs and enable multi-threading.
- Improve accuracy of optical properties.

## Dates 2021

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

PART Seminar | 11th June |

## 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 and data analysis, recorded on this page.
- Attended Heavy Ion Therapy Masterclass School.
- Submitted entry for Doctoral School Research Poster Competition.

## 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.