# PSD Digitization ## Overview This section introduces the process of PSD(Plastic Scintillator Detecor) digitization which convert the energy deposition to digitized signal. When charged particles pass through the plastic, part of energy will be deposited based on Bath-Bloch formule. The deposited energy is related with the velocity and proportional to the square of charge. Then the energy will be converted to photons with the correction of Birks Law and photons will propagate to the two ends of scintillator with speciafic attenuation. Limited by the area and PDE(Photon Detection Efficiency) of SiPM(Silicon Photomultiplier), only part of the photons could be detected. Then the accepted photons will be converted to ADC with the correction of non-linear function. Now we will go through the digitization process step by step combined with the HERDOS framework. ## Load geometry information At the beginning of digitization, the first thing is to load the **GeometrySvc** which contains the geometry information of all the PSD modules. Each PSD module has its own `cellcode` which is encoded by formule: $$ cellcode = 1e8*type + 1e6*sector + 1e4*layer + 100*col + row $$ ### Types Currently there are 3 types of plastic scintillator: long bar, short bar and tile which correspond to `type = 0, 1 and 2` respectively. ### Sectors In herd detector there are 5 sectors. The top sector is defined as `sector=0`. As shown in the figure below, the sector in +x direction is defined as `sector=1` and the three sectors in clockwise direction are defined as `sector=2,3,and 4` respectively. ![](figs/psd1.png) ### Layers There are 2 layers in each sector which correspond to `layer=0 and 1` respectively. The outer layer is defined as 0 while the inner layer is 1. ### Columns and rows The number of column and row is different when the layer, sector and type are different. ## Convertion from energy deposition to photons The convertion from energy deposition to photons is performed in function `edep2pe`. The generated photons are calculated with formule: $$ N_{Photons} = LY /2 * Birks(edep/L_{path}) * L_{path} $$ $N_{Photons}$ is the number of generated photons which propagate to one end of the scintillator; LY is the light yield of plastic; edep is the energy deposition; $L_{path}$ is the length of path when the charged particle pass through the scintillator; Birks is the correction function of Birks law which is $$ Birks(x) = {(1-a)*x \over 1+b*(1-a)*x} + a*x $$ a and b are two parameters measured by experiment. ### Photon attenuation during propagation When the generated photons propagate in the plastic scintillator, there will be attenuation. The attenuation function is calculated by the distance between hit position and end of scintillator(x). $$ f_{atn}(x) = C_0 * (e^{-{x \over \lambda}} + \alpha * e^{-{2L-x \over \lambda}}) $$ $$ C_0 = {1 \over {1 + \alpha * e^{-{2L \over \lambda}}}} $$ $\alpha$ and $\lambda$ are two parameters measured by experiment. L is the length of scintillator. This formule also take the photon reflection into account. Since the area of SiPM is smaller than that of scintillator, only part of the photons could be accepted by it. The rest of photons will be absorbed by the material. ### Signal generation in SiPM When the photons are accepted by the SiPM, electron-hole pairs will be generated in the PN junction and the avalanche signal will be generated. The signal is proportional to the accepted photons when the number of photons is less than a threshold. In case it is larger than the threshold, a correction of non-linear function will be applied. The fomate of non-linear function is: $$ f_{nonlinear}(x) = {[a(1-b)(1-e^{-{cx \over a}})+bcx](d+1) \over (d+{cx \over a-xe^{-2}})} $$ `a`, `b`, `c`, and `d` are parameters measured by experiment. Based on the rules above, the number of effective photons will be corrected. The ADC value will be calculated based on this corrected number. The ADC mean value and sigma of a single photon have been measured in experiment which are defined as `spe_adc` and `spe_sigma`. Then the ADC of final signal can be calibrated with this formule: $$ ADC = gRandom->Gaus(pe * spe_adc, spe_sigma); $$ where `pe` is the corrected number of photons. The ADC value of different hits in the same scintillator will be added as the final signal output. ### Output As shown in the figure below, the final output of the digization is a root file which contains three branches. The first branch records the `cellcode` of the PSD module and the other two branches record the ADC value of output signals. `ADC0` and `ADC1` stand for the signals read from two sides of the scintillator. ![](figs/psd2.png)