Belle II Software development
SummaryTask Class Reference
Inheritance diagram for SummaryTask:

Public Member Functions

 output (self)
 
 requires (self)
 
 run (self)
 
 remove_output (self)
 

Static Public Attributes

 n_events_training
 Number of events to generate for the training data set.
 
 n_events_testing
 Number of events to generate for the test data set.
 
 n_events_per_task
 Number of events per task.
 
 num_processes
 Number of basf2 processes to use in Basf2PathTasks.
 
 bkgfiles_by_exp = b2luigi.get_setting("bkgfiles_by_exp")
 Dictionary with experiment numbers as keys and background directory paths as values.
 
dict bkgfiles_by_exp = {int(key): val for (key, val) in bkgfiles_by_exp.items()}
 Transform dictionary keys (exp.
 
str batch_system = 'local'
 Use local resources.
 
str output_file_name = 'summary.json'
 Output file name.
 

Detailed Description

Task that collects and summarizes the main figure-of-merits from all the
(validation and optimisation) child taks.

Definition at line 1104 of file combined_to_pxd_ckf_mva_training.py.

Member Function Documentation

◆ output()

output ( self)
Output method.

Definition at line 1144 of file combined_to_pxd_ckf_mva_training.py.

1144 def output(self):
1145 """
1146 Output method.
1147 """
1148 yield self.add_to_output(self.output_file_name)
1149

◆ remove_output()

remove_output ( self)
Default function from base b2luigi.Task class.

Definition at line 1222 of file combined_to_pxd_ckf_mva_training.py.

1222 def remove_output(self):
1223 """
1224 Default function from base b2luigi.Task class.
1225 """
1226 self._remove_output()
1227
1228

◆ requires()

requires ( self)
Generate list of tasks that needs to be done for luigi to finish running
this steering file.

Definition at line 1150 of file combined_to_pxd_ckf_mva_training.py.

1150 def requires(self):
1151 """
1152 Generate list of tasks that needs to be done for luigi to finish running
1153 this steering file.
1154 """
1155
1156 fast_bdt_options = [
1157 [50, 8, 3, 0.1],
1158 [100, 8, 3, 0.1],
1159 [200, 8, 3, 0.1],
1160 ]
1161
1162 experiment_numbers = b2luigi.get_setting("experiment_numbers")
1163
1164 # iterate over all possible combinations of parameters from the above defined parameter lists
1165 for experiment_number, fast_bdt_option_state_filter, fast_bdt_option_result_filter in itertools.product(
1166 experiment_numbers, fast_bdt_options, fast_bdt_options
1167 ):
1168
1169 state_filter_cuts = [0.01, 0.02, 0.03, 0.05, 0.1, 0.2]
1170 n_best_states_list = [3, 5, 10]
1171 result_filter_cuts = [0.05, 0.1, 0.2]
1172 n_best_results_list = [2, 3, 5]
1173 for state_filter_cut, n_best_states, result_filter_cut, n_best_results in \
1174 itertools.product(state_filter_cuts, n_best_states_list, result_filter_cuts, n_best_results_list):
1175 yield self.clone(
1176 ValidationAndOptimisationTask,
1177 experiment_number=experiment_number,
1178 n_events_training=self.n_events_training,
1179 n_events_testing=self.n_events_testing,
1180 state_filter_cut=state_filter_cut,
1181 use_n_best_states=n_best_states,
1182 result_filter_cut=result_filter_cut,
1183 use_n_best_results=n_best_results,
1184 fast_bdt_option_state_filter=fast_bdt_option_state_filter,
1185 fast_bdt_option_result_filter=fast_bdt_option_result_filter,
1186 )
1187

◆ run()

run ( self)
Run method.

Definition at line 1188 of file combined_to_pxd_ckf_mva_training.py.

1188 def run(self):
1189 """
1190 Run method.
1191 """
1192 import ROOT # noqa
1193
1194 # These are the "TNtuple" names to check for
1195 ntuple_names = (
1196 'MCSideTrackingValidationModule_overview_figures_of_merit',
1197 'PRSideTrackingValidationModule_overview_figures_of_merit',
1198 'PRSideTrackingValidationModule_subdetector_figures_of_merit'
1199 )
1200
1201 # Collect the information in a dictionary...
1202 output_dict = {}
1203 all_files = self.get_all_input_file_names()
1204 for idx, single_file in enumerate(all_files):
1205 with ROOT.TFile.Open(single_file, 'READ') as f:
1206 branch_data = {}
1207 for ntuple_name in ntuple_names:
1208 ntuple = f.Get(ntuple_name)
1209 for i in range(min(1, ntuple.GetEntries())): # Here we expect only 1 entry
1210 ntuple.GetEntry(i)
1211 for branch in ntuple.GetListOfBranches():
1212 name = branch.GetName()
1213 value = getattr(ntuple, name)
1214 branch_data[name] = value
1215 branch_data['file_path'] = single_file
1216 output_dict[f'{idx}'] = branch_data
1217
1218 # ... and store the information in a JSON file
1219 with open(self.get_output_file_name(self.output_file_name), 'w') as f:
1220 json.dump(output_dict, f, indent=4)
1221

Member Data Documentation

◆ batch_system

str batch_system = 'local'
static

Use local resources.

Definition at line 1140 of file combined_to_pxd_ckf_mva_training.py.

◆ bkgfiles_by_exp [1/2]

bkgfiles_by_exp = b2luigi.get_setting("bkgfiles_by_exp")
static

Dictionary with experiment numbers as keys and background directory paths as values.

Definition at line 1135 of file combined_to_pxd_ckf_mva_training.py.

◆ bkgfiles_by_exp [2/2]

dict bkgfiles_by_exp = {int(key): val for (key, val) in bkgfiles_by_exp.items()}
static

Transform dictionary keys (exp.

numbers) from strings to int

Definition at line 1137 of file combined_to_pxd_ckf_mva_training.py.

◆ n_events_per_task

n_events_per_task
static
Initial value:
= b2luigi.get_setting(
)

Number of events per task.

Used to split up the simulation tasks.

Definition at line 1122 of file combined_to_pxd_ckf_mva_training.py.

◆ n_events_testing

n_events_testing
static
Initial value:
= b2luigi.get_setting(
)

Number of events to generate for the test data set.

Definition at line 1116 of file combined_to_pxd_ckf_mva_training.py.

◆ n_events_training

n_events_training
static
Initial value:
= b2luigi.get_setting(
)

Number of events to generate for the training data set.

Definition at line 1110 of file combined_to_pxd_ckf_mva_training.py.

◆ num_processes

num_processes
static
Initial value:
= b2luigi.get_setting(
)

Number of basf2 processes to use in Basf2PathTasks.

Definition at line 1128 of file combined_to_pxd_ckf_mva_training.py.

◆ output_file_name

output_file_name = 'summary.json'
static

Output file name.

Definition at line 1142 of file combined_to_pxd_ckf_mva_training.py.


The documentation for this class was generated from the following file: