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 747 of file cdc_and_svd_ckf_merger_mva_training.py.

Member Function Documentation

◆ output()

output ( self)
Output method.

Definition at line 787 of file cdc_and_svd_ckf_merger_mva_training.py.

787 def output(self):
788 """
789 Output method.
790 """
791 yield self.add_to_output(self.output_file_name)
792

◆ remove_output()

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

Definition at line 856 of file cdc_and_svd_ckf_merger_mva_training.py.

856 def remove_output(self):
857 """
858 Default function from base b2luigi.Task class.
859 """
860 self._remove_output()
861
862

◆ requires()

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

Definition at line 793 of file cdc_and_svd_ckf_merger_mva_training.py.

793 def requires(self):
794 """
795 Generate list of tasks that needs to be done for luigi to finish running
796 this steering file.
797 """
798
799 fast_bdt_options = [
800 [50, 8, 3, 0.1],
801 [100, 8, 3, 0.1],
802 [200, 8, 3, 0.1],
803 ]
804 cut_values = []
805 for i in range(4):
806 cut_values.append((i+1) * 0.2)
807
808 experiment_numbers = b2luigi.get_setting("experiment_numbers")
809
810 # iterate over all possible combinations of parameters from the above defined parameter lists
811 for experiment_number, fast_bdt_option, cut_value in itertools.product(
812 experiment_numbers, fast_bdt_options, cut_values
813 ):
814 yield ValidationAndOptimisationTask(
815 experiment_number=experiment_number,
816 n_events_training=self.n_events_training,
817 fast_bdt_option=fast_bdt_option,
818 n_events_testing=self.n_events_testing,
819 result_filter_cut=cut_value,
820 )
821

◆ run()

run ( self)
Run method.

Definition at line 822 of file cdc_and_svd_ckf_merger_mva_training.py.

822 def run(self):
823 """
824 Run method.
825 """
826 import ROOT # noqa
827
828 # These are the "TNtuple" names to check for
829 ntuple_names = (
830 'MCSideTrackingValidationModule_overview_figures_of_merit',
831 'PRSideTrackingValidationModule_overview_figures_of_merit',
832 'PRSideTrackingValidationModule_subdetector_figures_of_merit'
833 )
834
835 # Collect the information in a dictionary...
836 output_dict = {}
837 all_files = self.get_all_input_file_names()
838 for idx, single_file in enumerate(all_files):
839 with ROOT.TFile.Open(single_file, 'READ') as f:
840 branch_data = {}
841 for ntuple_name in ntuple_names:
842 ntuple = f.Get(ntuple_name)
843 for i in range(min(1, ntuple.GetEntries())): # Here we expect only 1 entry
844 ntuple.GetEntry(i)
845 for branch in ntuple.GetListOfBranches():
846 name = branch.GetName()
847 value = getattr(ntuple, name)
848 branch_data[name] = value
849 branch_data['file_path'] = single_file
850 output_dict[f'{idx}'] = branch_data
851
852 # ... and store the information in a JSON file
853 with open(self.get_output_file_name(self.output_file_name), 'w') as f:
854 json.dump(output_dict, f, indent=4)
855

Member Data Documentation

◆ batch_system

str batch_system = 'local'
static

Use local resources.

Definition at line 783 of file cdc_and_svd_ckf_merger_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 778 of file cdc_and_svd_ckf_merger_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 780 of file cdc_and_svd_ckf_merger_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 765 of file cdc_and_svd_ckf_merger_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 759 of file cdc_and_svd_ckf_merger_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 753 of file cdc_and_svd_ckf_merger_mva_training.py.

◆ num_processes

num_processes
static
Initial value:
= b2luigi.get_setting(
)

Number of basf2 processes to use in Basf2PathTasks.

Definition at line 771 of file cdc_and_svd_ckf_merger_mva_training.py.

◆ output_file_name

output_file_name = 'summary.json'
static

Output file name.

Definition at line 785 of file cdc_and_svd_ckf_merger_mva_training.py.


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