AIDA GELINA BRIKEN nToF CRIB ISOLDE CIRCE nTOFCapture DESPEC DTAS EDI_PSA 179Ta CARME StellarModelling DCF K40
  nToF  ELOG logo
Message ID: 65     Entry time: Thu Aug 17 10:26:51 2023
Author: Nikolay Sosnin 
Subject: Data Processing 

To run raw2root on LXPLUS, you will need to add the following line to your .bashrc, performed using

gedit ~/.bashrc &

then paste line at the bottome of the file

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/afs/cern.ch/user/n/ntofuser/public

then save and close the gedit (a linux text editor similar to Windows Notepad). Text file .bashrc is responsible for setting correct paths to various system settings when you log in. The line above sets correct libraries for raw2root from the n_TOF official directories.

 

The old version of raw2root which I use is stored in a directory on EOS accessible via LXPLUS:

cd /eos/home-n/nsosnin/public/raw2root

If you examine the contents of the directory using command ls, there will be two folders: ntoflib and prg. The relative location of these folders on your system should always be the same, and you do not need to do anything in the ntoflib directory, so we can explore the next directory

cd prg && ls

Command cd means change directory and ls is list contents, double-& chains commands in a sequence. Your terminal should now display two more directories: detector and raw2root. detector is a list of codes for various detector types, examine its contents with ls detector. We use MWDdetector.cc and its library header file MWDdetector.h. All the filters are defined and can be changed in MWDdetector.cc, which is a C++ code. You can browse and change its contents with gedit. raw2root codes, however, are run from the raw2root directory, so let's change to it

cd raw2root && ls

When you list the contents of this directory there will be many files, none of which you need to edit. There will also be a directory called Traces, which I created as the default location for signal traces to be written, if relevant sections of MWDdetector.cc are uncommented (discussed below). If you are happy with the contents of MWDdetector.cc, you need to re-compile raw2root. Using C++ code, unlike some others, is a two-step process: compilation and execution. Various bits of code in raw2root and its libraries are put together into one executable file called raw2root during compilation stage, and then the code can be run by executing the executable. To compile raw2root, you need to be in its directory, which you can check by typing in

pwd

which should then display /eos/home-n/nsosnin/public/raw2root/prg/raw2root and if you it displays something else, use

cd /eos/home-n/nsosnin/public/raw2root/prg/raw2root

To compile raw2root in this directory use

make clean && make proper && make

The code will start compiling and do so for a while. It will display some warnings associated with other older n_TOF codes. There should, however, be no errors. If there are errors, something went wrong in MWDdetector.cc, so try troubleshooting it by Googling the errors (the line with the error will also display two numbers, something like error: MWDdetector.cc:1211:45, and the the second number is the line where the problem occurred). C++ errors are a dark art though, so feel free to contact me for help.

If the compilation displays no errors (woo!), the code compiled successfully. To test it, two things are needed: UserInput file and .raw.finished file. UserInput file called UserInput_Silicons.h, which I use, is already stored in that directory. If you examine it with gedit, you will see lines with detector names and numbers and the filtering parameters. The parameters are read in at the top of MWDdetector.cc in order, so you can follow the variables they are read into throughout the code to figure out which parameter does what (this is not an easy task!).

.raw.finished files are binary data files with detector signal traces, which raw2root filters and makes into ROOT files. These need to be downloaded from CERN servers (I left two example ones in the directory though). While the experiment is running these are stored, but will eventually be deleted, so if they don't download, contact me on staging data (i.e. writing it onto servers again after deletion). To download such a binary file for this experiment to the directory you are in use

xrdcp xroot://eosctapublicdisk.cern.ch//eos/ctapublicdisk/archive/ntof/2023/EAR2/26Al_DSSSD/216408/stream1/run216408_1_s1.raw.finished .

Here, xrdcp command is CERN's own copying command, which takes data from the directory listed in the command. I have highlighted above in yellow the bits you may need to change in the command. The first two are simply run number. The last one is the data segment. n_TOF data within a run are subdivided into 20 proton bunch segments, so one such .raw.finished file that you download contains 20 bunches (which is a very small amount of data, so if you need mass_processing, contact me or Fran (francisco.garcia.infantes@cern.ch) at n_TOF). You can download different segments by changing this number. Bunches 1-20 are in segment 0, bunches 21-40 in segment 1, etc.

Once you have downloaded the file of interest execute raw2root with command

./raw2root -p UserInput_Silicons.h -f run216408_1_s1.raw.finished -r rootout.root

This will run for some time, applying settings from UserInput to filters in MWDdetector.cc, and running the filters over data in the .raw.finished file. This will produce an output file called rootout.root, but feel free to change the name in the command to whatever you like, otherwise you will just keep overwriting the old files. This output file will have the amplitudes, times etc. of all the extracted signals listed, but it will not produce traces, as that is not standard raw2root functionality, and requires my code, which I added to MWDdetector.cc

To print traces, open MWDdetector.cc using

gedit ../detector/MWDdetector.cc &

Note, ".." on Linux means "previous directory", so the command above will leave raw2root directory, go to detector directory and open the code. In this code, uncomment (i.e. remove // or /* or */ characters in C++) from lines 310-312, 441, 442, 465 and 529. This will now print trace ROOT files into the Traces directory. Warning: this runs very slowly, as it's a lot of data being written to disk!

The if() statment on line 465 allows you to gate on specific bunches and detectors for producing traces. The contents of histograms inside the output files can be understood in terms of what MWDdetector.cc does by reading the lines 514-522 of that code. This should be everything you need to get started with processing traces and filtering outputs. Good luck!

ELOG V3.1.4-unknown