LDMX-Software / ldmx-sw

The Light Dark Matter eXperiment simulation and reconstruction framework.
https://ldmx-software.github.io
GNU General Public License v3.0
22 stars 21 forks source link

Hcal tot digitization #1475

Open vrm7fj opened 2 months ago

vrm7fj commented 2 months ago

I am updating ldmx-sw, with implemented Hcal TOT digitization.

What are the issues that this addresses?

Check List

vrm7fj commented 1 month ago

New Class 'PulseRecord':

This class is intended solely for plotting purposes and should not interfere with the existing workflow. The PulseRecord(double volts, int adc, int tot) function temporarily stores the digitized pulses when the HgcrocEmulator is called by either the Hcal or Ecal pipelines and is cleared each time the emulator is invoked. If the pulse is digitized using ADC, the TOT value is set to zero, and vice versa.

To my understanding, the HgcrocEmulator cannot be called by the Ecal and Hcal pipelines at the exact same time. Therefore, when the getter for PulseRecord is called within the HcalDigiProducer, it will only retrieve the digitized information corresponding to the pulses sent for digitization at that moment. If this understanding is incorrect, the class may only be suitable for studying the back Hcal.

HgcrocEmulator

HgcrocEmulator.h has been amended with a mutable vector ‘pulseRecord’ and a getter to access ‘pulseRecord’ to store and access digitizations.

Originally, the TOT digitization for an incoming pulse was set by comparing the voltage (vpeak) of the hit, calculated using the pulse function at the time of the hit that comes with the pulse. However, in ADC digitization, the voltage (bxvolts) is calculated using iADC and the clock cycle. There is a slight difference between the two voltage values. See the following debug print.

Screenshot 2024-09-26 at 2 15 34 PM

If we used the original setting:

if (vpeak > totThreshold) { startTOT = true; }

ADC and TOT digitizations look like this. Note that the ADC digitization does not reach up to 1024 counts here.

ADCTOT2

Instead, if we modify the code as follows, the complete ADC range is utilized in the digitization:

     if (bxvolts > totThreshold){
    /startTOT = true;
    }

ADCTOT

In this branch, the ‘bxvolts > totThreshold’ condition is currently used.

HcalDigiProducer

Once each section in HcalDigiProducer sends pulses to HgcrocEmulator, they are accessed through the getter and temporarily stored in the vector ‘DigiToPlot’, which is cleared for each ‘hitsByID’ in the loop. At the end of each section, the recorded digitized info is written into a text file following the format [Voltage ADC TOT]. The plots I showed above were generated using that text file.

hcal_hardcoded_conditions.py and proposed TOT reconstruction

Please see the following presentation to understand how changes were made to hcal_hardcoded_conditions and how TOT reconstruction can be implemented.

LDMX_HCAL.pdf

Discussion

Before the implementation of TOT digitization, the histogram of Hcal reconstructed energy was piling up towards the last bins. However, after the implementation, we now observe a smoothed decay in the reconstructed energy. Please note that the appropriate parameters for reconstruction have not yet been configured.

Image 10-10-24 at 1 25 PM