13from ROOT
import Belle2
24 Overloaded harvester, that stores its data into a pandas data frame instead of a numpy array,
25 because they are more flexible when it comes to changing columns and value types to be stored.
29 """Coroutine that receives the dictionaries of names and values from peel and store them into a pandas df."""
33 if isinstance(crop, numbers.Number):
36 crops.append({
"value": crop})
42 elif isinstance(crop, collections.abc.MutableMapping):
51 msg = f
"Unrecognised crop {crop} of type {type(crop)}"
58 """Receive the gathered crops and saves them into a ROOT file."""
67 Read in the trigger results stored in the data store and write them out into a ROOT file after all events have
71 def __init__(self, root_file_name="save_results.pkl", store_object_name="SoftwareTriggerResult"):
73 Create a new module to get the stored trigger decisions from the data store and save them to a root file.
74 :param root_file_name: The file name where to store the results.
75 :param store_object_name: The store object name where the trigger results an be found in the data store.
77 super().
__init__(foreach=store_object_name, output_file_name=root_file_name)
81 For each result ( = event), get the list of all trigger decisions and also add the total decision.
82 Write them back into the internal storage ( = pandas.DataFrame) of all events.
84 return_dict = {identifier: result
for identifier, result
in result.getResults()}
87 getFinalTriggerDecision = Belle2.SoftwareTrigger.FinalTriggerDecisionCalculator.getFinalTriggerDecision
88 return_dict[
"final_decision"] = getFinalTriggerDecision(result)
94 Read in the trigger variables stored in the data store and write them out into a ROOT file after all events have
98 def __init__(self, root_file_name="save_vars.pkl", store_object_name="SoftwareTriggerVariables"):
100 Create a new module to get the stored trigger variables from the data store and save them to a root file.
101 :param root_file_name: The file name where to store the variables.
102 :param store_object_name: The store object name where the trigger variables an be found in the data store.
104 super().
__init__(foreach=store_object_name, output_file_name=root_file_name)
108 For each collection of variables ( = event), get the list of all variables.
109 Write them back into the internal storage ( = pandas.DataFrame) of all events.
111 yield {identifier: value
for identifier, value
in variables.get()}
114if __name__ ==
"__main__":
115 path = basf2.create_path()
118 path.add_module(
"SeqRootInput", inputFileName=
"raw.sroot")
__init__(self, root_file_name="save_results.pkl", store_object_name="SoftwareTriggerResult")
__init__(self, root_file_name="save_vars.pkl", store_object_name="SoftwareTriggerVariables")
output_file_name
Name of the ROOT output file to be generated.