Skip to content

ArrayBench

pmeridian edited this page Apr 2, 2024 · 45 revisions

Table of Contents

READ CAREFULLY BEFORE START

a) do not close the laptop screen when pc is on (do not touch also when it is sleeping)

b) do not unplug any of the USB cables either on the laptop or the switch on the table

Connect via X2GO

Open X2GO Client on one of the two PC at the desk

Make sure that session type is set to XFCE

Double click on ARRAY BENCH

Restart Autoprocess

how to restart automatic process
OPEN NEW TERMINAL

sudo systemctl stop autoprocess 
ps aux | grep process.py

kill all process if any, then:

sudo systemctl start autoprocess 

to check the status do:

sudo systemctl status autoprocess 

Turn on CNC Motor

  1. Disconnect usb from CNC controller
  2. Connect 24 V
  3. Switch on cnc controller inside box
  4. Connect usb

Check if there is a process already running, if not follow this instructions

Make sure the CNC motor system is connected to the power.

OPEN NEW TERMINAL

cd /home/cmsdaq/Workspace/CNCMotor/
python3 grblServer.py --usb /dev/motor_0 -l /tmp/test.log --port=8820

Read Temperature sensors

Check if there is a process already running, if not follow this instructions

OPEN NEW TERMINAL

cd /home/cmsdaq/Workspace/TemperatureMonitor
python2 serial_monitor.py -d /dev/tempmon_0 -l temperature_tmp.txt &

keep terminal open

If you want to see the temperature:

  • on a new terminal (deprecated)
tail -f temperature_tmp.txt

in case you could not see anything on ThingSpeak, even if the serial monitor is running

sudo systemctl stop tmon.service
sudo systemctl start tmon.service

Turn on TOFPET

  • Switch on the TOFPET power: press the green "POWER" button in the white power unit inside the rack; the voltage is set by default to 12V.
  • Wait about 30 seconds for the system to warm up, until the current measured by the power unit is 1.62.
  • Connect TOFPET to pc: OPEN NEW TERMINAL
cd /home/cmsdaq/Workspace/TOFPET/Timing-TOFPET2/
./connect_TOFPET.sh

Note: keep this terminal always open.

Data acquisition

  • Turn off the fridge by pressing the on/off button for 2/3 seconds

  • Remove the Na22 radioactive source in its support from the box

  • Change the arrays in the setup (Pay attention when you undo the screws to not drop it on the setup)

  • Put back the Na22 source back in its support inside the box

  • REMEMBER TO CLOSE THE FRIDGE BEFORE STARTING ANY RUN !!!!

  • REMEMBER TO CHECK IF THE NA22 SOURCE IS IN THE FRIDGE BEFORE STARTING ANY RUN !!!!

  • Turn on the fridge by pressing the on/off button for 2/3 seconds

  • If not present, open the GUI

cd /home/cmsdaq/Workspace/TOFPET/Timing-TOFPET2/
./startBenchGui.sh
  • Once opened the GUI:
    • Select the Array code (to skip a position insert -1)
    • For normal measurement make sure the Longitudinal scan box is not checked
    • Select run tag (REFDAILY, PREIRR, POSTIRR) *Do at least 1 ref run each day (see Reference Runs)

Reference runs

Reference runs have tag REFDAILY and the 4 reference arrays placed in corresponding slots:

  • 32110000200049 in slot IARR0 (North-Est)
  • 32110000200050 in slot IARR1 (South-Est)
  • 32110000200051 in slot IARR2 (South-West)
  • 32110000200052 in slot IARR3 (North-West)

At one VALIDATED REFDAILY run is required each day, otherwise end-of-data analysis and loading to DB will fail. In case of multiple VALIDATE REFDAILY runs, the results of theese runs will be averaged. You can take a REFDAILY run whenever you want, at begin, middle or end of the day.

If you need to change the reference arrays, you should modify the script /home/cmedaq/Workspace/DBAnalysis/fillDB.py in the array bench PC. DO IT ONLY IF YOU KNOW WHAT YOU ARE DOING

Data Alignment

Edit config_main_array_0,1,2,3.txt and run_DAQ_multiarrays_align.py as needed

Run daq:

python run_DAQ_multiarrays_align.py -c list_config_main_array.txt -o /data/cmsdaq/LYSOMULTIARRAYALIGN_XXX -n TEST

(substitute XXX with today's date)

Create root files:

python process_runs.py -r 1-34 -d /data/cmsdaq/LYSOMULTIARRAYALIGN_XXX

Analyze data:

python analysis/analyze_alignArray_with_barRef.py -i /data/cmsdaq/LYSOMULTIARRAYALIGN_XXX -o /data/cmsdaq/LYSOMULTIARRAYALIGN_XXX

Check plots: display /data/cmsdaq/LYSOMULTIARRAYALIGN_XXX/*.png

Finally edit run_DAQ_multiarrays.py with the positions of the arrays:

dict_array_x_y_z = {
    0: np.array([70., 40., 25.]),
    1: np.array([45., 140., 25.]),
    2: np.array([195., 140., 25.]),
    3: np.array([195., 40., 25.]),
}

Process data

THE PROCESS IS AUTOMATICALLY DONE, to check the status go on airtable SIPM
OPEN NEW TERMINAL (can use the same for following runs)

  • Process data:
python process_runs.py -r 1-34 -d /data/cmsdaq/LYSOMULTIARRAYNEWLAB4ARRAYS/

NOTES:

  • indicate the range of all runs (pedestals and physics)

Data Analysis

THE ANALYSIS IS AUTOMATICALLY DONE, to check the status go on airtable SIPM

  • Run analysis code:
cd Workspace/TOFPET/Timing-TOFPET2/
python analysis/launch_analyze_run_array.py --firstRun 1 -i /data/cmsdaq/LYSOMULTIARRAYNEWLAB4ARRAYS/ -o /data/cmsdaq/LYSOMULTIARRAYNEWLAB4ARRAYS/RESULTS/ --arrayCode 0"

NOTES:

  • indicate the PHYSICS run number (it is one minus the last run processed which should be a pedestal run) and the bar code.

  • the program will also analyze the corresponding PEDESTAL runs associated to the PHYSICS run.

  • Output:

    • stored in /data/cmsdaq/LYSOMULTIARRAYNEWLAB4ARRAYS/RESULTS/
    • histo_RunXXXXXX_BARYYYYYY.root : histograms and canvases
    • tree_RunXXXXXX_BARYYYYYY.root : measurements of light output and CTR stored in a root tree
    • tree_RunXXXXXX_BARYYYYYY.root : measurements of light output and CTR stored in a root tree.
    • the measurements with uncertainties are also printed out on airttable
  • Check fits on local pc (deprecated)

 display /data/cmsdaq/LYSOMULTIARRAYNEWLAB4ARRAYS/RESULTS/*XXX*.png 

(substitute XXX with run number)

  • Check fits on airtable:
    • OPEN A NEW BROWSER
    • go to airtable
    • open the Array bench page
    • check for the result column and click on the link
    • substitute localhost with the PC ip

After the processing is completed, always check the run and tag it as Validated or Failed

Special runs

Calibration runs

Calibration runs have to be made when changing reference arrays

BEFORE DATA-TAKING:

  • Edit file /home/cmsdaq/Workspace/TOFPET/Timing-TOFPET2/analysis/analyze_run_array_with_barRef.py
  • Edit line L413 setting "default=0" for option applyCalib
    parser.add_option("-c", "--applyCalib", dest="applyCalib", default=1,
                    help="apply calibrations")
    

DATA-TAKING:

  • Start with the ref. arrays in their default configuration and take 4 runs, shifting the arrays by one slot each time.

Example: if the default configuraiton is:

  • IARR0=405, IARR1=406, IARR2=407, IARR3=408

then, the configuration for the second run will be:

  • IARR0=408, IARR1=405, IARR2=406, IARR3=407

And so on.

  • Repeat the process with the arrays in the reversed position. The standard position has the bar code of the array facing the rear of the fridge, in the reversed position the bar code faces the fridge door and it is still visible (side up).

AFTER DATA-TAKING:

  • Edit /home/cmsd aq/Workspace/TOFPET/Timing-TOFPET2/analysis/makeCalib.py
  • Insert runs specifying run number, ref. and Reverse True/False position
  • launch calibration:
    cd /home/cmsdaq/Workspace/TOFPET/Timing-TOFPET2/
    source analysis/runCalib.sh
    

Overvoltage scan

To run an overvoltage scan edit file:

emacs -nw /home/cmsdaq/Workspace/TOFPET/Timing-TOFPET2/run_DAQ_multiarrays.py

comment/uncomment one of the following lines:

#ov_values = [8,4] #V                                                                                                                           
ov_values = [8] #V    

Longitudinal scan

Run a longitudinal scan checking the corresponding checkbox on the GUI and press Start Run
After all data are processed and the summary for the individual runs are produced, run the script:

cd /home/cmsdaq/Workspace/TOFPET/Timing-TOFPET2/
python analysis/launch_analyze_run_array_lscan.py --firstRun <first physics run of the scan> -i /data/cmsdaq/LYSOMULTIARRAYNEWLAB4ARRAYS/RESULTS/ -o /data/cmsdaq/LYSOMULTIARRAYNEWLAB4ARRAYS/RESULTS/ --arrayCode <array ID, ex. 405>

Update the elog

  • Post a message on the arraybench elog (elog):
    • run number (physics run), run type, bar code, configuration string
    • Light output measurements (at 511 keV peak): barCoinc peak 1
    • CTR (time resolution using pixel as reference): gaussian mean and sigma
    • Example of elog entry:

Output dir: /data/cmsdaq/LYSOMULTIARRAYNEWLAB4ARRAYS/RESULTS/*.log
ARRAY000485 RUNS: 1011 -
LY_mean= 76.59
LY_RMS= 1.41
sigmaT_sigma_mean= 131.5 ps
sigmaT_sigma_RMS= 7.5 ps
CTR_sigma_mean= 201.3 ps
CTR_sigma_RMS= 7.2 ps
XT_mean= 0.07
XT_RMS= 0.01

End of the day

  • Turn off TOFPET:

    • stop the program "./connect_TOFPET.sh" (CTRL-C in the terminal)
    • turn-on the power (press green button)
  • Put the Na22 radioactive source inside the safe

  • Close the Fridge

  • Leave the linux terminals used open for the next data taking

  • Check if all the good run are tagged as validated on airtable

Open airtable link from outside lab

Make an ssh tunnel to pccmsdaq03: ssh -L8888:10.0.0.100:80 [email protected] plots can be seen under: 127.0.0.1:8888

Update airtable key

Duplicate the old airtable DB into a new one giving the name "Array Bench Processing from XX/XX/202X" Delete all the runs records, keep crystals records (as you may need them for future runs). Once getting closer to 1000 records, the crystals' records without any associated run can be deleted to make some further space and prepare for the next update

Find the new API key: Once created the new DB, go to https://airtable.com/developers/web/api/introduction and click on the new DB to discover the new API key (typically appXXXXXXXX)

Update key on pccmsdaq03: Go to /home/cmsdaq/AutoProcess and edit runDB.py comment the old key and add the new key Restart autoprocess (sudo systemctl status autoprocess) and the bench_gui

Update key on hpz4: Go to /home/cmsdaq/AirTableTools edit airtablesDB.py commenting the previous key and add the new one

To check the key run ./checkAirtableRecords.sh which in mattermost channel https://mattermost.web.cern.ch/cms-roma-mtd/channels/check_airtable should return an updated set of records

Trouble-shooting

In case of reboot

  • login on ArrayBench PC and restart autoprocess:
sudo systemctl stop autoprocess 
ps aux | grep process.py
sudo systemctl start autoprocess
  • setup root:
cd ~
root_6_22_02/bin/thisroot.sh

Raw2root not working after update

  • do root setup then re-compile cpp:
/home/cmsdaq/Workspace/TOFPET/Timing-TOFPET2/
make