Apply Calibrations

General Philosophy & operation

Our general philosophy:

  1. Keep the raw data available to the as much as possible!

  2. Allow easy access to derived quantities, i.e. calibrated Energy (E), corrected time...

  3. Keep calibration and setup objects in the same output file

Calibrating a single run can be a time intensive procedure, due to the fact that we are calculating the local trigger primitives for each tile & event in the same process. Consequently it might be advisable to separate the trigger calculation and actual calibration (if this might need repeating).

The trigger primitives are calculated in the same manner as for the MIP calibration step, depending on the data set size this can take multiple hours. In addition the local trigger bits are set accordingly:

aTile->SetLocalTriggerPrimitive(event.CalculateLocalMuonTrigg(calib, rand, aTile->GetCellID(), localTriggerTiles, avLGHGCorr));
bool localMuonTrigg   = event.InspectIfLocalMuonTrigg(aTile->GetCellID(), averageScale, factorMinTrigg, factorMaxTrigg);
bool localNoiseTrigg  = event.InspectIfNoiseTrigg(aTile->GetCellID(), averageScale, factorMinTriggNoise);
aTile->SetLocalTriggerBit(0);
if (localMuonTrigg) aTile->SetLocalTriggerBit(1);
if (localNoiseTrigg) aTile->SetLocalTriggerBit(2);

We recommend running it as follows:

# evaluate trigger first
./DataPrep -f -d 1 -T $CALIBFILE.root -i raw_$RUNNR.root -o rawWithLocTrigg_$RUNNR.root 

Where -T results in calling the

bool Analyses::RunEvalLocalTriggers(void) in Analyses.ccarrow-up-right.

This process will run for a while (hours) but in principle is sufficient do be done once, if nothing has been changed which should affect the trigger primitives calculation. This process won't create any plots.

Afterwards, the calibration can be run directly on that raw-file with the trigger primitives. Which is a rather quick procedure and could be repeated multiple times if need be.

The option -C results in the calibration application based on $CALIBFILE.root and calculation of the energies for each tile, while the option -t suppresses the trigger-calculation.

Alternatively everything can be done in one go by:

The calibration function can be found in

bool Analyses::Calibrate(void) in Analyses.ccarrow-up-right.

and will create a separate hist output root in addition to several plots.

Keep in mind that during the calibration step we are also removing tiles which do not exceed a minimum threshold energy defined by minMipFrac .

Total energy within the event (E_cell > 0.3 E_mip) vs nr. of active cells with E_cell > 0.3 E_mip. CAEN data August 2024, 1 8M module, 64 layers.
Total energy within the event (E_cell > 0.3 E_mip) vs nr. of active cells with E_cell > 0.3 E_mip. HGCROC data November 2025, 2 8M modules, 32 layers.

In the Etot vs NCells distribution (CAEN data, August 2024) the contamination to the electron beam can be clearly identified:

  • blob at Etot = 400: electrons

  • lower blob and diagonal: muons

  • blob around Etot = 700: mult part (i.e 2 electrons)

  • diag to electron blob: hadrons

This can be exploited later to do basic event selections, together with the more general distribution within the LFHCal module. With the different geometry and readout used in the 2025 TB campaign this is possible as well, however the separation isn't quite as obvious.

Total energy per event as measured for the HGCROC data from 2025.
Active number of cells per event as measured for the HGCROC data from 2025.
Calibrated cell energy as function of cell ID from the CAEN data from August 2024 (1 8M module)
Calibrated cell energy as function of cell ID from the HGCROC data from November 2025 (2 8M module)

In the per cell energy distributions, discontinuities can be found, where we are switching from HG to the LG signal. This feature is under investigation and might originate from a change in the run-by-run LG-HG correlation values.

Single layer energy distributions, CAEN data, August 2024, 1 8M module.

In the current implementation for the HGCROC data the total energy is solely extracted from the maximum ADC value, hence no range switching should be observed.

Single layer energy distributions, HGCROC data, November 2025, 2 8M modules.

The detailed layer by layer plots will only be drawn if option -e is specified.

Separating calib-object & raw data

For convenience and reducing the storage needs the calibration objects can be copied out of any file using the following command and stored in a separate file.

Once more the -a option triggers the writing of the calibrations also to a txt file with the same name as $NEWCALIBFILEONLY.root ending in _calib.txt.

The original calibrations contained in the input root file can be overwritten as usual with the option -k $CALIBTXTFILE.

CAEN data specific information

For the CAEN data, the primary variable changed during the calibration procedure (besides the trigger primitives) is the energy of each cell. It is calculated as follows during the calib process:

Here the corrHG and corrLG reflect the pedestal corrected high gain and low gain ADC values of the CAEN readout, while corrHGADCSwap is the predefined value where we go from high gain to low gain. Only tiles with an energy surpassing the minMipFrac will be stored in the final output.

The following plots will be produced and should be looked at for the CAEN data to ensure everything went as intended.

HG spectra for all cells as function of cell ID.
LG spectra for all cells as function of cell ID.
Pedestal corrected HG spectra for all cells as function of cell ID.
Pedestal corrected LG spectra for all cells as function of cell ID.
Pedestal corrected HG spectra for all cells as function of cell ID. Zoomed in close to pedestal.
Pedestal corrected LG spectra for all cells as function of cell ID. Zoomed in close to pedestal.
Pedestal corrected HG spectra for all locally noise triggered cells as function of cell ID. Zoomed in close to pedestal.
Pedestal corrected LG spectra for all locally noise triggered cells as function of cell ID. Zoomed in close to pedestal.

For monitoring purposes the uncorrected, pedestal corrected as well as noise trigger pedestal corrected spectra are plotted. In order to identify possible problems with the pedestal subtraction or possible pedestal shifts due to common mode noise/cross-talk.

HG spectra plotted together for all triggers and noise triggered tiles.

HGCROC data specific information

For the HGCROC data we are touching significantly more variables during the calibration process and only the waveforms themselves reflect the raw data. The current tile energy estimates are based solely on the maximum ADC values scaled by the respective mip response. The calculation is done as follows:

In this routine, besides the energy calculation:

  1. the pedestals are reset,

  2. the integrated ADC is reevaluated and

  3. the TOA offset is corrected for

The steps 1-3 are handled in the same manner as during the Transfer-Calib routine and the same QA plots are created for the TOA offset correction. For all intents and purposes the Transfer-Calib routine should only be necessary to run for the muon runs, while all other runs would be calibrated using the full calibration procedure described here.

In addition, the following HGCROC specific plots are produced and should be checked for their correctness. Layer dependent plots will only be enabled if the extended plotting option is enabled -e or -E [0-3] , depending on how much detail you'd like to produce. When running consider that those options might be small as they produce rather large and detailed outputs.

Max adc vs cellID for all events.
TOT vs cellID for all events.
Frequency of reaching saturation of the ADC range vs cellID.
Max ADCs vs cellID for cells which were triggered by the local noise trigger.
TOT vs cellID for cells which were triggered by the local noise trigger. If this plot has entries, something went seriously wrong!
Max ADC distribution for one single layer of the HGCROC data obtained in November 2025 (2 8M modules).
TOT distribution for one single layer of the HGCROC data obtained in November 2025 (2 8M modules).
Max ADC vs TOT distribution for one single layer of the HGCROC data obtained in November 2025 (2 8M modules). Profile distribution reflecting the mean is overlaid in red dots.

Scripted Operation

CAEN Data

September 2023 data

No scripts have been created yet.

October 2023 data

No scripts have been created yet.

August 2024 data

The primary script for the application of the calibrations of this data set is applyCalibration_2024.sh, in order to apply the calibrations for a specific scan the following commands need to be executed in order. The next command should only be executed if the outputs of the previous step have been checked.

The 2nd argument defines which scan it is, please check which are currently available and expand where necessary.

HGCROC Data

August 2024

No scripts have been created yet.

November 2025

The primary script for the application of the calibrations of this data set is applyCalibrationHGCROC_2025.sh, in order to apply the calibrations for a specific scan the following commands need to be executed in order. The next command should only be executed if the outputs of the previous step have been checked.

The 2nd argument defines which scan it is, please check which are currently available and expand where necessary.

Last updated