22 """A helper class to create the dataset for the tutorial below."""
24 main_file =
"df037_TTreeEventMatching_py_main.root"
25 aux_file_1 =
"df037_TTreeEventMatching_py_aux_1.root"
26 aux_file_2 =
"df037_TTreeEventMatching_py_aux_2.root"
27 main_tree_name =
"events"
28 aux_tree_name_1 =
"auxdata_1"
29 aux_tree_name_2 =
"auxdata_2"
32 with ROOT.TFile(self.main_file,
"RECREATE")
as f:
33 main_tree =
ROOT.TTree(self.main_tree_name, self.main_tree_name)
52 with ROOT.TFile(self.aux_file_1,
"RECREATE")
as f:
53 aux_tree_1 =
ROOT.TTree(self.aux_tree_name_1, self.aux_tree_name_1)
69 with ROOT.TFile(self.aux_file_2,
"RECREATE")
as f:
70 aux_tree_2 =
ROOT.TTree(self.aux_tree_name_2, self.aux_tree_name_2)
131 .DefaultValueFor(aux_tree_1_coly, default_value)
132 .DefaultValueFor(aux_tree_2_colidx, default_value)
133 .DefaultValueFor(aux_tree_2_colz, default_value)
135 (
"idx", aux_tree_1_colidx, aux_tree_2_colidx,
"x", aux_tree_1_coly, aux_tree_2_colz))
143 .DefaultValueFor(aux_tree_2_colz, default_value)
144 .FilterAvailable(aux_tree_1_coly)
146 (
"idx", aux_tree_1_colidx, aux_tree_2_colidx,
"x", aux_tree_1_coly, aux_tree_2_colz))
153 print(
"Example 1: provide default values for all columns")
155 print(
"Example 2: always skip the entry when there is no match")
157 print(
"Example 3: keep entries from the main tree for which there is no match in the auxiliary tree")
161if __name__ ==
"__main__":
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
ROOT's RDataFrame offers a modern, high-level interface for analysis of data stored in TTree ,...