Skip to content

Commit

Permalink
DataDirectory returns None when requesting non existing files/trees; …
Browse files Browse the repository at this point in the history
…fix to file attribute name
  • Loading branch information
lwpiotr committed Feb 13, 2024
1 parent 6910a58 commit 8b59a06
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions grand/dataio/root_trees.py
Original file line number Diff line number Diff line change
Expand Up @@ -2331,7 +2331,7 @@ def __init__(self, dir_name: str, recursive: bool = False, analysis_level: int =

def __getattr__(self, name):
"""For non-existing tree files or tree parameters, return None instead of rising an exception"""
trees_to_check = ["trun", "trunvoltage", "trawvoltage", "tadc", "tvoltage", "tefield", "trunefieldsim", "trunshowersim", "tshowersim", "trunnoise"]
trees_to_check = ["trun", "trunvoltage", "trawvoltage", "tadc", "tvoltage", "tefield", "tshower", "trunefieldsim", "trunshowersim", "tshowersim", "trunnoise"]
if any(s in name for s in trees_to_check):
return None
else:
Expand Down Expand Up @@ -2369,7 +2369,7 @@ def init_sim2root_structure(self):
max_level = l
# Assign the file with the highest or requested analysis level as default to the class instance
# ToDo: This may assign all files until it goes to the max level. Probably could be avoided
setattr(self, f"{flistname[-1]}", f)
setattr(self, f"{flistname[:-1]}", f)
# Assign the tree with the highest or requested analysis level as default to the class instance
setattr(self, f"{flistname[1:-1]}", getattr(f, f"{flistname[1:-1]}"))
# For the run trees, expecting only single file per each type
Expand Down

0 comments on commit 8b59a06

Please sign in to comment.