ReadRoot

class nndm_library.ReadRoot(path: str, output_base_tree='treeout', pattern_output='first', output_base_middle_branch='/e/out', leafs=['out.t', 'out.x', 'out.y', 'out.z', 'out._mass'], recursive=False, files_dir=None, relabel_events=True)[source]

Class to read the labeled data coming in ROOT format. By default it assumes values for output_base_tree, pattern_output, output_base_middle_branch, and leafs. This is for a fast reading.

Parameters
  • path (str) – the direction to the root file(s)

  • output_base_name (str) – Name bas of the first node of the tree that has the data. For instance, if the base name is treeout, there options could be treeout1, treeout2, …., treeoutN.

  • pattern_output (str) – The idea is this parameter define a methodology to choose from the possible first nodes that have a given output_base_name. As an example, first would choose treeoout1 in the example before.

  • output_base_middle_branch (str) – middle branch that goes after the selected first node chosen by the output pattern. If this variable is “e/out”, following the example the tree to consult at the moment would be treeout1/e/out/.

  • leafs (list of strings) – what are the leafs to exaplore in the actual branch. If out.a is the ouput name for the a momenta, giving a list [out.x, out.y] will give the data to consult. That is, treeout1/e/out/out.x and treeout1/e/out/out.y

  • relabel_events (bool) – there is an id for each possible event. For instance a collision have an id for it and two sub ids for the particle that interact in it. When relabel_events is True, the values of id are associated unequivocally with each event.

Variables
  • data – dataframe with the read events

  • files_dir – directory with the name of the files read and its id

add_angle(axes=['px', 'py', 'pz'], angle_axis='pz')

Calculate the angle of the particles starting from a list of the form [px, py, pz]. This with respect to the “axis” element.

extract_params_from_path()

Format is as follows: {particle_name}_{param1}_{value1}_{param2}_{value2}_{param3}_{value3}*.lhe An example would be eta_decay_events_mk_0.38_eps2_5.404557191441203e-07.lhe.

Returns

dictionary with all extracted data