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."""
65 Read in the trigger results stored
in the data store
and write them out into a ROOT file after all events have
69 def __init__(self, root_file_name="save_results.pkl", store_object_name="SoftwareTriggerResult"):
71 Create a new module to get the stored trigger decisions from the data store
and save them to a root file.
72 :param root_file_name: The file name where to store the results.
73 :param store_object_name: The store object name where the trigger results an be found
in the data store.
75 super().__init__(foreach=store_object_name, output_file_name=root_file_name)
79 For each result ( = event), get the list of all trigger decisions and also add the total decision.
80 Write them back into the internal storage ( = pandas.DataFrame) of all events.
82 return_dict = {identifier: result for identifier, result
in result.getResults()}
85 getFinalTriggerDecision = Belle2.SoftwareTrigger.FinalTriggerDecisionCalculator.getFinalTriggerDecision
86 return_dict[
"final_decision"] = getFinalTriggerDecision(result)
92 Read in the trigger variables stored
in the data store
and write them out into a ROOT file after all events have
96 def __init__(self, root_file_name="save_vars.pkl", store_object_name="SoftwareTriggerVariables"):
98 Create a new module to get the stored trigger variables from the data store
and save them to a root file.
99 :param root_file_name: The file name where to store the variables.
100 :param store_object_name: The store object name where the trigger variables an be found
in the data store.
102 super().__init__(foreach=store_object_name, output_file_name=root_file_name)
106 For each collection of variables ( = event), get the list of all variables.
107 Write them back into the internal storage ( = pandas.DataFrame) of all events.
109 yield {identifier: value
for identifier, value
in variables.get()}
112if __name__ ==
"__main__":
113 path = basf2.create_path()
116 path.add_module(
"SeqRootInput", inputFileName=
"raw.sroot")
crops
The gathered crops until now.
def __init__(self, root_file_name="save_results.pkl", store_object_name="SoftwareTriggerResult")
def __init__(self, root_file_name="save_vars.pkl", store_object_name="SoftwareTriggerVariables")
def peel(self, variables)
output_file_name
Name of the ROOT output file to be generated.
crops
the dictionaries from peel