Debugging - Uni2K/RootReader GitHub Wiki
Debugging and Error Management
To successfully use the software you need to understand it. I tried my best to explain it, but this probably does not solve all your questions. I encourage you to look into the different scripts and try to understand them. In order to check that the results make sense and match your input parameters, there is a set of possibilities:
The LOG output
If you run something you will see the log in the terminal/shell/console. This is usually the first step when debugging an application. Unfortunately this sometimes is too fast to read, in order to stop the process you can try "Ctr + C" and look at the logs. An example is given here: images/debuglog.png
The PDF Files
Especially waves.pdf is useful to verify the input parameters, see this example: images/baseline.png You can see that for this channel the correct calibration value was used (compare with CalibrationValues.txt), the correct Baseline (compare with Baseline.txt) etc. If you wonder whether your results show calibrated data or not you would now know that they are showing calibrated data.
The vertical lines are representing the integration window, measured from the maximum. The red horizontal lines are displaying the dynamic baseline and the green line the constant baseline. If one of the red horizontal line is placed exactly on the green line, this means that obviously a dynamic baseline was used.
Technical notes
Since the C++ scripts need to be compiled there is usually no debugger enabled. Meaning that you cannot stop the execution at a point to view the variables content. However, there is actually a way of using the read.C script inside of Visual Studio, but then the amount of RAM is limited to the 32bit maximum. I would not suggest debugging scripts like this, at least not the read.C script. Instead I use an extensive logging of variables. This is coming from my long history as programmer. Usually the schema is the following. Say there is an error somewhere in the script, a segmentation fault or similar, you dont know where it is, but your script consists of 4 lines of code (just an example); In the console you see: "Start" but not "End".
cout<<Start<<endl;
CODE LINE 1
CODE LINE 2
CODE LINE 3
CODE LINE 4
cout<<End<<endl;
You change this to:
cout<<Start<<endl;
CODE LINE 1
cout<<Debug 1<<endl;
CODE LINE 2
cout<<Debug 2<<endl;
CODE LINE 3
cout<<Debug 3<<endl;
CODE LINE 4
cout<<End<<endl;
And now you look into the terminal and see exactly at which line the error occured (the line before the log was not printed anymore). Of course this is only a simple example, but it highlights the way of a simple debugging without tools.