Introduction - Uni2K/RootReader GitHub Wiki
How to start:
Download the repository inside a non WSL folder (if you are using Windows). Run the RootReader with:
./RootReader.sh
the following home screen will appear: images/demo.PNG
It expects you to make a selection. To do this, just type the number in the terminal.
- Start: Used to start the process. Press this after you set up everything.
- Run Number: The number of the run that should be read in. This is why runs need to have a number in their name. For example: data folder called: 11_pos5_e26, needs to be used together with the run number: 11. Use "a" for all runs in the /data/ folder. More options are also available, see text output.
- Settings: Threads : how many threads should be used Automatic Integration Window: the integration windows are searched in a text file called /src/IntegrationWindows.txt depending on the run number. If you start the run with the number 11, the integrationWindows.txt file is needed to have an entry called "IW_11_pos5_e26={.....}". The last line with IW_11 is used then. Automatic Config Saving: store the configuration of the RootReader in a config.txt file automatically after each start Compile Readscript: Whether it should compile the read.C script or not, if you changed something in the script set this to true Binary Headersize: How many bytes the head takes. Just set this to "a" for automatic. Calibration/Baseline: IsDarkCountMeasurement: Toggles the isDC flag in the read.C script. It is automatically set to true if the run name contains "dc". If this is true it will use the integration window of the run specified in the read.C in the variable: dcIntegrationWindow. Dynamic Baseline: If its true, the dynamic baseline will be used, if false the constant ones will be used. A constant BL requires an entry with the name "BL_11_pos5_e26={...}" in a file called: /src/Baselines.txt. This file will be created by the AverageBaseline.sh script in the Root Analysis package. Calibrate Measurements: Whether the calibration values are already available. If true, it will use them. Requires an entry with the name: "11_pos5_e26={...}" in a file called /src/CalibrationValues.txt. Use Existing RunList: If you edited the RunList.txt which will be created after a run manually. Otherwise it will just create a runlist from the run numbers you entered. Change Input Folders: Use with caution. Will change the input directory. Usually it is /data/. Place the folders produced by the WaveCatcher client in the input dir. Change Output Folders: Will change the output directory. Usually it is /runs/. It will contain the created .root files.
- Tools: Automatically starts the runs and sets up the options. Also copies the .txt files.
- Config: Save and Load a config.
- Informations: Just some hints.
Typical usage: Convert the .bin files of a WaveCatcher run into .root files and use time integrals as observables.
- Record the measurement with the WaveCatcher, make sure everything (also the saving options are configured). It will create folder with a name you need to enter. Make sure this name starts with a run number (just iterate). In this example, name it: 1_measurement
- Move this folder with the .bin files inside to the input folder of the RootReader. The default is RootReader/data/.
- Open the RootReader, press 2, enter 1, enter 1 again to start. You will see that it has started. If will also show some informations. Wait for it to finish. Always look for Exceptions/Errors.
- Once this completed, go into the output folder (/runs/). There will be a folder with exactly the run name. In this folder there are 4 files. Besides the .root file, there are multiple pdfs. The most important one is the waveforms.pdf. It containts a visual represenation of the raw data in a histogram. In its legend you can read some observables and verify the correctness of your settings. More details see output section below.
- Now you have a .root file. Go into root (open Terminal, type "root") and start a TBrowser (in root environment type "new TBrowser()", in WSL this needs an X Server like XMing). Browse to the root file and view it. You will see the individual branches and histograms. Those contain all available channels, so they are not suitable for the further analysis.
- You only have a basic configuration which misses some important things. On the one hand, the baseline is not set (chose dynamic baseline by default) on the other hand, the integration window is also not right (see waveforms.pdf and see the lines, compare them with the master thesis by J. Zimmermann). Now you will understand how to create those missing things.
- First the baseline. Download the RootAnalysis repository by me and place it inside a folder. Create a folder in this repository called (RootAnalysis)/rootfiles/. All analysis scripts are looking for .root files ONLY inside this folder. So, copy the 1_measurement.root from /runs/ to RootAnalysis/rootfiles.
- Open the RootAnalysis/Baselines/BaselineAverage.sh script. It will print out some values and finally generate a text file named: Baselines.txt. In this text file, there is a line called: BL_1_measurement={...}. Copy this file into RootReader/src.
- Start the RootReader again and now go to settings and set the baseline to constant (Dynamic Baseline: 0). Afterwards, start the run with run number 1. It now reads in the binary files again, but this time it uses the baseline values inside the Baselines.txt. 10.Once it is finished, go into /runs/1_measurement/waveforms.pdf and look at each channel. You notice that the green line (baseline) now has the value mentioned in the Baselines.txt file.
- This procedure is repeated for the Integration Window 2 times. So, again, copy the /runs/1_measurement.root (this time with the correct baseline) into the RootAnalysis/rootfiles folder and open the IntegrationWindowsAnalysis.sh script. It will create some txt files that you need to place into /RootReader/src. Then rerun the RootReader, it will now take the correct integration windows. Then place the resulting root files again in the /rootfiles/ folder and run the integration windows analysis again. This time it will print some correction factors in the txt files. Copy again all txt files to /src/ and start a last time. At this point the integration and the integration errors should be working correctly.
- Always analysis the pdf files, if you encounter any error just get sure that the script output is making sense.
Input Files
Created by a WaveCatcher, split 1000 events in one file, binary option on. For more details see WC config files.
All files are bundled into a folder with the runname as folder name. See: images/in.png
Output Files
The output depends on the settings in the read.C file. At its default, it will generate the following files:
- waveforms.pdf : individual waveforms, printed eventwise for specific events (printing can be defined using booleans inside the read.C file, e.g. allowForcePrinting), mainly used to debug
- RUNNAME.root: the root file containing all the calculated data, this will be used to carry out the analysis, also contains several histograms
- waveforms_chSum.pdf: channel-wise sum of all events in a run, mainly used for debugging
- waveforms_womSum.pdf: sums up all events belonging to a specific WOM, this is based on WOM-IDs. WOM= Wavelength-shifting Optical Module, see master thesis
Folder structure:
The top level structure is:
Inside the /src/ folder:
Additional text files (see /Examples/)
Data is transferred and read in from text files. The script is designed to depend on some specific files:
-
analysisPath.txt (placed inside the root (not ROOT) directory), Tools features depend on it. Points to the root directory of https://github.com/Uni2K/RootAnalysis.
-
src/CorrectionValues.txt: Created by the IntegrationsWindowAnalysis script inside of the RootAnalysis package, contains correction values needed for correct integral determination
-
src/IntegrationWindows.txt: Same as CorrectionValues.txt but this time it holds the integration bounds
-
src/Baselines.txt: Holds the constant baselines of a run, they are generated by BaselineAverage.sh inside of the RootAnalysis package
-
src/CalibrationValues.txt: Holds the calibration values, they are needed to convert arbitrary integral units (e.g. mVxns) to number-of-photoelectrons. They are calculated using the FitCharge.sh (GainFit) method from the RootAnalysis package. Difficult to obtain, contains WOM-D default values.
Its always possible to use dummy values, however, it must be checked if the values are correct. This can be done by seeing the legend in the waves.pdf file or the output in the terminal. The read.C script usually searches for values with the same runName.