Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions config/TMS_Readout_Default_Config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,41 @@
DepositBinLength = 1.0 # mm
# Consecutive steps of one trajectory in one bar further apart than this start a new passage
PassageMaxGap = 0.5 # mm
# A5202 timing-mode front end (needs UseResponseElements = true): per channel, the photons'
# fast-shaper pulses are summed and a discriminator gives the hit time (threshold crossing)
# and time over threshold, both in TDC steps; replaces the readout-window model.
FrontEndTimingMode = false

[Sim.FrontEnd]
# Citiroc-1A fast shaper: 15 ns peaking time, not programmable (CAEN Citiroc-1A datasheet).
FastShaperPeakingTime = 15.0 # ns
# Pulse shape (t/tp)^n exp(n(1 - t/tp)), unit height per photoelectron at t = tp. The order n sets the tail
# length and hence the time over threshold. n = 2 is a fit to the ToT-versus-injected-charge curve measured with
# the A5202 in timing mode (CAEN UM7945 rev. 4 sec. 9.3.2, ToT = 31.514 ln(Qin/pC) + 45.127 in 0.5 ns steps,
# Qin 0.5-13.5 pC): rms residual 2.8 ns, against 11.8 ns for n = 1; it also fixes the bench threshold at a pulse
# height of 0.48 pC, i.e. 1.7 pe at the S13360-2050VE gain of 1.7e6 (0.272 pC per pe). The fit is
# scripts/Validation/DetSim/fit_tot_curve.py. It assumes a unipolar pulse, no fast-shaper undershoot.
FastShaperOrder = 2
# Discriminator threshold in photoelectrons of pulse height. The chip allows down to 1/3 pe. 1.7 pe is what the
# bench fit gives for the A5202 "TD Coarse Threshold" of 290 (the manual's examples use 290-300; the TMS setting
# is still TBD, to be set from a dark-count staircase). Earlier versions used 3.0 to match the 3 PE pedestal
# threshold of the readout-window model.
DiscriminatorThreshold = 1.7 # pe
# Threshold below which the pulse ends (discriminator hysteresis). <= 0: same as DiscriminatorThreshold (no
# hysteresis). The A5202 manual gives no value; to be filled in from the electronics group.
DiscriminatorStopThreshold = -1.0 # pe
# The A5202 stores the ToT in 9 bits (0.5 ns steps) in timing mode with ToT enabled (UM7945 sec. 8.5.3):
# longer ToTs are clipped to this value. What the board does on overflow (clip or wrap) is not documented.
ToTMax = 255.5 # ns
TDCStep = 0.5 # ns, time stamp and ToT granularity (A5202)
TimingJitter = 0.1 # ns, Gaussian (Citiroc-1A: < 100 ps RMS)
# Hamamatsu S13360-2050VE (DUNE ND PDR Table 1.16)
SiPMCrosstalkProbability = 0.03
SiPMPixels = 1584
# Estimate the hit energy from its ToT (inverting the mean waveform: fast-shaper pulse smeared
# by the scintillator and WLS decay times) instead of from the detected photon count, as real
# timing-mode data would have to
EnergyFromToT = false



Expand Down
34 changes: 34 additions & 0 deletions scripts/Validation/DetSim/fit_tot_curve.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
"""Fit of the fast-shaper pulse order and the bench threshold to the A5202 ToT-versus-charge curve.

Source: CAEN UM7945 (A5202/DT5202 user manual) rev. 4, sec. 9.3.2: ToT = 31.514 ln(Qin/pC) + 45.127 (0.5 ns channels), TD threshold
290, Qin 0.5-13.5 pC. Model: unipolar pulse (t/tp)^n exp(n(1-t/tp)), tp = 15 ns (Citiroc-1A fast shaper), first lobe only.
Result (2026-10-12): n = 2.1 (n = 2: rms 2.8 ns; n = 1: 11.8 ns), threshold 0.48 pC = 1.7 pe at 1.7e6 gain (0.272 pC/pe);
used for Sim.FrontEnd.FastShaperOrder / DiscriminatorThreshold in config/TMS_Readout_Default_Config.toml.
Run: PYTHONDONTWRITEBYTECODE=1 python3 fit_tot_curve.py (needs numpy)
"""
import numpy as np
tp = 15.0
Q = np.exp(np.linspace(np.log(0.5), np.log(13.5), 40))
tot_data = 0.5 * (31.514 * np.log(Q) + 45.127) # ns
t = np.arange(0, 600, 0.05)
def tot_model(n, qth): # qth = charge (pC) whose pulse peak just reaches threshold
x = t / tp; shape = x**n * np.exp(n * (1 - x))
out = []
for q in Q:
above = (q / qth) * shape >= 1.0
out.append(0.05 * above.sum() if above.any() else 0.0) # first pulse only (unipolar, single lobe)
return np.array(out)
best = None
for n in np.arange(0.5, 4.01, 0.1):
for qth in np.exp(np.linspace(np.log(0.02), np.log(8.0), 160)):
r = tot_model(n, qth) - tot_data
c = np.sqrt(np.mean(r**2))
if best is None or c < best[0]: best = (c, n, qth)
c, n, qth = best
print("best n=%.2f qth=%.3f pC rms residual=%.2f ns" % (n, qth, c))
for nn in (1, 2):
b = min(((np.sqrt(np.mean((tot_model(nn, q) - tot_data)**2)), q) for q in np.exp(np.linspace(np.log(0.02), np.log(8.0), 300))))
print("n=%d: best qth=%.3f pC rms=%.2f ns" % (nn, b[1], b[0]))
m = tot_model(n, qth)
for i in range(0, 40, 6): print("Q=%.2f pC data %.1f ns model %.1f ns" % (Q[i], tot_data[i], m[i]))
print("pC per PE (gain 1.7e6): %.3f ; qth in PE: %.2f" % (1.7e6 * 1.602e-7, qth / (1.7e6 * 1.602e-7)))
Loading
Loading