dacsim module¶
dacsim¶
Data Acquisition Chain Simulation¶
Simulate the data acquisition chain of a scintillator. The following parts of the acquosition chain are modeled:
- scintillation process
- photomultiplier tube
- cable
- digitizer
The energy distribution and the decay times of the pulses can be defined in the dat files (see edist and scintillator modules). The simulation of pile-up events is also possible (pileup module).
Input file¶
The code reads an input file in which the following variables MUST be defined:
- nps: the number of pulses to be simulated
- ptype: the type of particle that deposited energy in the scintillator (electron, proton, all)
- cre: the electron countrate [Hz]
- crp: the proton countrate [Hz]
- output: the name of the output file (no extension)
- dt: the time step for the simulated pulses [ns]
- lc: the light collection efficiency of the scintillator
- qeff: the quantum efficiency of the photomultiplier tube
- k = conversion from keVee to number of photons
- ndyn: the number of dynodes in the pmt
- delta: the average gain of the dynodes
- sigma: the broadening of the pmt response
- tt: the transit time of the pmt
- cutoff: the frequency cutoff of the cable [GHz]
- imp: the impedance of the cable [ohm]
- noise: the noise level [V]
- bits: the number of bits of the digitizer
- minV: the minimum input level of the digitizer [V]
- maxV: the maximum input level of the digitizer [V]
- sampf: the sampling frequency of the digitizer [GHz]
- samples: number of digitized samples to be acquired
- th_on: turn the digitizer’s trigger threshold on (1) or off (0)
- th_lvl: trigger threshold level
- pretrig_samp: number of pretrigger samples
- fp: if 1, plot the first simulated pulse
example input file:
# input example for dacsim
# this line is a comment
# general parameters
nps 10
ptype electron
cre 20000
crp 0
output myout
# scintillator parameters
dt 0.05
lc 0.7
qeff 0.26
k 10.
# pmt parameters
ndyn 10
delta 4
sigma 5.2
tt 17.5
# cable parameters
cutoff 0.2
imp 50
noise 0.01
# digitizer parameters
bits 12
minV -0.1
maxV 1.2
sampf 0.4
samples 256
th_on = 1
th_lvl = 50
pretrig_samp 64
# plotting parameters
fp 1
Output¶
The codes generates a subdirectory called ‘output’ (if it does not exist) in the current directory and saves an output file with the name defined in the input and extension ‘.npy’. The output format is: [t_dig,[p_1,p_2,...,p_nps],pileup_log,time_int,inp_dict,coeff_dict,energy,intensity] where t_dig is the digitized time axis, p_1,p_2,..,p_nps are the digitized pulses, pileup_log is a list containing the number of pile-up pulses in each event, time_int is an array containing the time intervals between pulses, inp_dict is the input dictionary used to run the simulation, coeff_dict is the dictionary with the scintillator pulse shape coefficients, energy and intensity are the dictionaries containing the energy distributions for electrons and protons. For information on how to read the file refer to the numpy.load function
-
dacsim.read_input(fname)¶ Reads the input file and saves the parameters into a dictionary
- Args:
- fname (str): name of the input file
- Returns:
- inp_dict (dict): dictionary with the input parameters
-
dacsim.save_output(pulses, fname)¶ Saves the output file
- Args:
pulses (list): list of simulated pulses
fname (str): name of the output file