13 from 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 =
"Unrecognised crop {} of type {}".format(
61 """Receive the gathered crops and saves them into a ROOT file."""
68 Read in the trigger results stored in the data store and write them out into a ROOT file after all events have
72 def __init__(self, root_file_name="save_results.pkl", store_object_name="SoftwareTriggerResult"):
74 Create a new module to get the stored trigger decisions from the data store and save them to a root file.
75 :param root_file_name: The file name where to store the results.
76 :param store_object_name: The store object name where the trigger results an be found in the data store.
78 super().
__init__(foreach=store_object_name, output_file_name=root_file_name)
82 For each result ( = event), get the list of all trigger decisions and also add the total decision.
83 Write them back into the internal storage ( = pandas.DataFrame) of all events.
85 return_dict = {identifier: result
for identifier, result
in result.getResults()}
88 getFinalTriggerDecision = Belle2.SoftwareTrigger.FinalTriggerDecisionCalculator.getFinalTriggerDecision
89 return_dict[
"final_decision"] = getFinalTriggerDecision(result)
95 Read in the trigger variables stored in the data store and write them out into a ROOT file after all events have
99 def __init__(self, root_file_name="save_vars.pkl", store_object_name="SoftwareTriggerVariables"):
101 Create a new module to get the stored trigger variables from the data store and save them to a root file.
102 :param root_file_name: The file name where to store the variables.
103 :param store_object_name: The store object name where the trigger variables an be found in the data store.
105 super().
__init__(foreach=store_object_name, output_file_name=root_file_name)
109 For each collection of variables ( = event), get the list of all variables.
110 Write them back into the internal storage ( = pandas.DataFrame) of all events.
112 yield {identifier: value
for identifier, value
in variables.get()}
115 if __name__ ==
"__main__":
116 path = basf2.create_path()
119 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