Skip to content

Fix missing trees

MR Description

After the update in !78 (merged), we spotted many files out of PreprocessRDF that did not contain any TTree in the bbττ production we performed in November. This MR aims to fix this issue.

The issue is coming from the behaviour of the Snapshot() function when in the presence of ROOT.ROOT.EnableThreadSafety() and ROOT.ROOT.EnableImplicitMT(self.request_cpus). In this configuration, if a dataframe is empty due to selections rejecting all events, the output file will be empty. This will then cause issues in the following steps because no Events tree is found to look into.

To fix the issue, before performing the snapshot in PreprocessRDF, the dataframe is inspected and the rows counted. If the rows are exactly zero, the Snapshot() is substituted by the creation of a file containing an empty Events tree.

FYI @fbrivio @tcuisset

MR Validation

The MR has been validated by running the PreprocessRDF and Categorization commands on several files. The new code has the same behaviour as the old one when the dataframes are not empty, and it fixes the issue of empty files when the dataframes are empty.

Merge request reports

Loading