-
Notifications
You must be signed in to change notification settings - Fork 0
4. ReadROOT's Merger
In order to use the Merger, we need to import it from ReadROOT.
>>> from ReadROOT import merge
The merge subpackage of ReadROOT contains two important classes that are used to find the TOF events, the Merger and the Converter.
The Merger can be accessed from the merge subpackage. It is usually used with the GUI in a QThread. When creating a Merger instance, two files need to be passed as well as a time window and a TTree key.
If cuts are enabled, the user can select the minimum and maximum energies used for the cuts for each file. The following commands can be executed:
>>> new_merge = merge.Merger(file0, file1, window, "Data_R")
>>> new_merge.select_cuts(min, max, 0)
The last option of the function select_cuts allows to choose which file is affected by the cut.
Note that
file0here represents the stop file andfile1the start file. If you are in an IDE where you can see documentation, you should be able to seeMerger(stop_file : Path, start_file : Path, window : U64, tree : str). This also means that0for the file selected inselect_cutswill be the stop file and1the start file.
Using the merge function, the data will be parsed quickly and return a list of ConsolidatedData. This ConsolidatedData is a simple data class made for the Merger class. When the parsing is done, the resulting list will be emitted through a pyqtSignal and will also be returned. This can then be used by the Converter class.
The Converter can be accessed just like the Merger class from the merge subpackage. The only use of this class is to convert a list of ConsolidatedData returned by the Merger.merge function into a .csv format, compressed or not. This means that this class should always be used after the Merger is no longer used.
When creating a Converter instance, a list of ConsolidatedData is passed. Using the Converter.save function, one can save to a specified file path the data. By default all the .csv files saved with the Converter class will be compressed with bz2. This can be turned off using Converter.compress = False. This will then save the .csv files as normal, without any compression.