Skip to content

Commit

Permalink
Now automaticaly loading trawvoltage if tvoltage is not available
Browse files Browse the repository at this point in the history
  • Loading branch information
lwpiotr committed May 31, 2024
1 parent 73e3fcf commit 7c77b69
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions grand/grandlib_classes/grandlib_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ def fill_event_from_trees(self, event_number=None, run_number=None, entry_number
if tvoltage := self.file_tvoltage.Get("tvoltage"):
self.tvoltage = TVoltage(_tree=tvoltage)
else:
print("No Voltage tree. Voltage information will not be available.")
# print("No Voltage tree. Voltage information will not be available.")
# Make tvoltage really None
self.tvoltage = None

Expand All @@ -492,19 +492,20 @@ def fill_event_from_trees(self, event_number=None, run_number=None, entry_number
if ret:
print("Voltage information loaded.")
else:
print("No Voltage tree. Voltage information will not be available.")
# print("No Voltage tree. Voltage information will not be available.")
# Make tvoltage really None
self.tvoltage = None

# Use trawvoltage tree
else:
# Use trawvoltage tree if requested or tvoltage tree not found
if use_trawvoltage or self.tvoltage==None:
# If initialising trees requested
if init_trees:
# Check the Voltage tree existence
if tvoltage := self.file_tvoltage.Get("trawvoltage"):
self.tvoltage = TRawVoltage(_tree=tvoltage)
use_trawvoltage = True
else:
print("No TRawVoltage tree. Voltage information will not be available.")
print("No Voltage or TRawVoltage tree. Voltage information will not be available.")
# Make tvoltage really None
self.tvoltage = None

Expand All @@ -515,7 +516,7 @@ def fill_event_from_trees(self, event_number=None, run_number=None, entry_number
if ret:
print("Voltage information (from TRawVoltage) loaded.")
else:
print("No TRawVoltage tree. Voltage information will not be available.")
print("No Voltage or TRawVoltage tree. Voltage information will not be available.")
# Make tvoltage really None
self.tvoltage = None

Expand Down

0 comments on commit 7c77b69

Please sign in to comment.