Calibration framework
NB Always setup environment source setup.sh
The calibration algorithm is implemented in one python script configuration.py
located in project's main directory. Before launching script you need to write/create text file settings.txt
in project's main directory. This is a file with mandatory parameters for using this framework. File must contain following lines:
m_qcal = 35
vth = 60
n_pulses = 10000
acc = 10
q_cal = 35
range = 30
step = 2
post_range = 60
post_step = 3
Parameters names must be exactly like listed (line order and white spaces do not matter). m_qcal
is charge injection level in steps for matrix check, vth
- voltage threshold for matrix check (see below), n_pulses
- number of pulses being sent by function generator, acc
- the deviation value in % from which we consider pixel to be bad, q_cal
- charge injection level for matrix calibration, range
- range for S-curve plotting for calibration, step
- increment for S-curve plotting for calibration, post_range
- range for S-curve plotting after calibration, and post_step
is the increment for S-curve plotting after calibration.
If you have properly installed Python (see guide) the usage is simple:
python3 configuration.py <filename>
where filename
is the name of file for writing matrix configuration.
The script will consequentially in automatic mode launch couple executables and other scripts for matrix calibration.
-
First app to be launched is
matrix_check
. This executable scans through the whole matrix for identification of "bad" pixels (pixels don't work of work weirdly). As an output this code delivers text file with bad pixels addresses. One per line in form<row>:<column>:<subcolumn>
. Expected time for running2 minutes
-
After scanning for bad pixels
calibration2
executable will be launched. This app delivers S-curve for each pixel (excluding bad ones) in the matrix for certainQcal
. The output is a set of text files and oneoutput.root
file inRun
directory. Expected time for running30 minutes
-
The next step in
trim.py
that fits all s-curves and gives calculatedtrim
value for all pixels andvth
for each column pair. Expected time for runningcouple seconds
-
generateConfig
is the next executable to be launched. It deliversfilename
file contains configuration for all pixels in the matrix. It includes disabling bad pixels, trimming and discriminator thresholds for all column pairs. Expected time for runningcouple seconds
-
postConfig
is the last executable to be launched. This app loads matrix configuration obtained within previous steps and plots S-curves for all trimmed pixels.
One can launch these scripts manually for better control and understanding. Usage of each:
./matrix_check <m_qcal> <vth> <n_pulses> <acc>
./calibration2 <start_row> <q_cal> [<range> <step>]
see specific section for details.
python3 trim.py <runN>
runN
should be the run obtained by launching calibration2
executable.
./generateConfig <q_cal> <fname>
One can only launch this executable if vth.txt
, 0-trim.txt
and 1-trim.txt
were created before by trim.py
./postConfig <fname> [<post_range> <post_step>]
where <fname>
is a text file with pixel configuration (e.g. obtained by generateConfig
executable).
Analysis framework
NB Always setup environment source setup.sh
The analysis algorithm is also implemented in one python script noise_ana.py
located in project's main directory. If you have properly installed Python (see guide) the usage is not as simple as for calibration, but not very difficult.
-
Launch
./matrix_check <Qcal> <Vth> <Acc>
for generating the file contains bad pixels addresses (you can skip this step, but the software is unstable when bad pixels are not excluded). -
Open the script in any text editor and set
charge_arr
array. This is an array ofQval
values in steps that you want to study. You need to set at least twoQval
since the analysis includes linear fit of pixel noise vs. charge value. Save the modifications. -
Just launch the script
python3 noise_ana.py
The script will launch calibration2
executable for each Qval
you set in an array. Expected time for running each is 30 minutes
.
After successful runs the file setup.txt
will be created in the project's main directory, that contains 2 lines: each Qval
and corresponding RunN
. Then script will launch another script calibration.py
.
- For each
RunN
for all pixels in the matrix scripts does fit of s-curve usingerf((x-mu)/sigma)
. - Then it fits
mu(Qval)
by linear function. The slopek
of this function is a coefficient that allows to calculate noise in electrons for all pixels:sigma/k
Every s-curve and its fit, sigma
distribution for each run, linear fit, etc. are stored in res.root
file in tdcpix_var/res/<date-time>/
directory. Also the scripts saves raw data in text files (mu
and sigma
for each run for all pixels) in tdcpix_var/res/<date-time>/raw/
directory.
If you want more control you can launch runs manually by calibration2
with variable Qval
. In this case in noise_ana.py
you need to set two arrays: charge_arr
and corresponding list runs
with runN
for each run. Then you need to comment lines responsible for launching calibration2
: 6 lines with a loop contains calling execute
function. Then just launch script normally. The output will be the same.
There is a possibility to check only one run obtained by calibration2
executable. Use scurve_analysis2.py
from project's main directory for that:
python3 scurve_analysis2.py <run_N> <subcol>
where subcol =0 even; =1 odd; =2 both
.
The output will be STD
and MEAN
distributions written to res.root
file in tdcpix_var/res/<date-time>/
directory. As well as text files (mu
and sigma
for each run for all pixels) in tdcpix_var/res/<date-time>/raw/
directory.