Belle II Software light-2405-quaxo
__init__.py
1
8
9
10__all__ = ["graFEI", "lcaSaver"]
11
12
13from grafei.modules.GraFEIModule import GraFEIModule
14from grafei.modules.LCASaverModule import LCASaverModule
15
16
17def graFEI(
18 particle_list,
19 path,
20 cfg_path=None,
21 param_file=None,
22 sig_side_lcas=None,
23 sig_side_masses=None,
24 gpu=False,
25 payload_config_name="graFEIConfigFile",
26 payload_model_name="graFEIModelFile",
27):
28 """
29 Wrapper function to add the GraFEIModule to the path in a single call.
30
31 Applies graFEI model to a particle list in basf2.
32 GraFEI information is stored as extraInfos.
33
34 Args:
35 particle_list (str): Name of particle list.
36 path (basf2.Path): Module is added to this path.
37 cfg_path (str): Path to config file. If `None` the config file in the global tag is used.
38 param_file (str): Path to parameter file containing the model. If `None` the parameter file in the global tag is used.
39 sig_side_lcas (list): List containing LCAS matrix of signal-side.
40 sig_side_masses (list): List containing mass hypotheses of signal-side.
41 gpu (bool): Whether to run on a GPU.
42 payload_config_name (str): Name of config file payload. The default should be kept, except in basf2 examples.
43 payload_model_name (str): Name of model file payload. The default should be kept, except in basf2 examples.
44 """
45 graFEI = GraFEIModule(
46 particle_list,
47 cfg_path=cfg_path,
48 param_file=param_file,
49 sig_side_lcas=sig_side_lcas,
50 sig_side_masses=sig_side_masses,
51 gpu=gpu,
52 payload_config_name=payload_config_name,
53 payload_model_name=payload_model_name,
54 )
55 path.add_module(graFEI)
56
57
58def lcaSaver(
59 particle_lists,
60 features,
61 mcparticle_list,
62 output_file,
63 path,
64):
65 """
66 Wrapper function to add the LCASaverModule to the path.
67
68 Save Lowest Common Ancestor matrix of each MC Particle in the given list.
69
70 Args:
71 particle_lists (list): Name of particle lists to save features of.
72 features (list): List of features to save for each particle.
73 mcparticle_list (str): Name of particle list to build LCAs from (will use as root).
74 output_file (str): Path to output file to save.
75 path (basf2.Path): Module is added to this path.
76 """
77 root_saver_module = LCASaverModule(
78 particle_lists=particle_lists,
79 features=features,
80 mcparticle_list=mcparticle_list,
81 output_file=output_file,
82 )
83 path.add_module(root_saver_module)
84
85
86print(r"""
87 ____ ____ _ ____ ____ _
88 | _ |__| /_\ |___ |___ |
89 |__| | \ / \ | |___ |
90
91 o
92 / \
93 / \ x-----x _ _
94 / \ |-----\ |\ /| |-----\ |0 1 3 3 5|
95 o \ |----- \ | \ / | |----- \ |1 0 3 3 5|
96 / \ \ |----- / | x | |----- / |3 3 0 1 5|
97 / \ \ |-----/ | / \ | |-----/ |3 3 1 0 5|
98 / \ \ |/ \| |5 5 5 5 0|
99 o o \ x-----x  ̄  ̄
100 / \ / \ \
101 x x x x x
102
103 Authors: Jacopo Cerasoli, Giulio Dujany, Lucas Martel, Corentin Santos. 2022 - 2024
104 Model description: https://indico.cern.ch/event/1106990/papers/4996235/files/12252-ACAT_2022_proceedings.pdf
105 Based on the work of Kahn et al: https://iopscience.iop.org/article/10.1088/2632-2153/ac8de0
106 Please consider citing both articles.
107 Code adapted from https://github.com/Helmholtz-AI-Energy/BaumBauen
108 """)