``c++ This code implements theTArtCalibNEBULA::ReconstructData()` method, whose main function is to reconstruct and calibrate physical quantities for each plastic scintillator (Pla) detector unit in the NEBULA detector.

First, the function checks whether the raw data has been loaded (fDataLoaded); if not, it calls LoadData() to load it. Then, it defines three position offsets (posxoff, posyoff, poszoff), all currently set to 0, which can be adjusted later as needed for the experiment.

The main loop iterates over all NEBULA detector units (using GetNumNEBULAPla() and GetNEBULAPla(i)). For each unit, it looks up its parameter object (para) by ID; if the parameter is not found, it skips to the next unit. If the unit is a reference signal (Tref), it is also skipped.

Next, the code retrieves the reference times (tref) for the upper (U) and lower (D) signals, and calculates raw times, widths, energies, and other physical quantities. It also attempts to obtain the global T0 calibration (if available) for subsequent time corrections.

The code then determines the hit type (hit) based on the validity of the raw energy and time signals, and processes the energy signals by subtracting the pedestal, calibrating, applying logarithmic transformations, and calculating various energy-related variables. Time signals are also corrected using the reference time, linear calibration, and slewing correction (a nonlinear correction dependent on energy), and time differences and averages are computed.

Position reconstruction is based on the time difference and geometric information from the parameter table, ultimately yielding 3D spatial coordinates. The code also corrects for light attenuation effects based on position and energy. Finally, it calculates the flight length, angle, and time-of-flight (TOF) for different particles, such as gamma rays and neutrons.

All computed results are written back to the TArtNEBULAPla object via a series of Set methods, and the data is marked as reconstructed. After the loop, the fReconstructed flag is set to true, indicating that all detector unit data for this event have been reconstructed.

Overall, this method implements the complete reconstruction process from raw signals to physical quantities (energy, time, position, TOF, etc.), and is a core step in NEBULA detector data analysis.


Last update: 2025-08-13
Created: 2025-08-13