Belle II Software development
ValidationAndOptimisationTask Class Reference
Inheritance diagram for ValidationAndOptimisationTask:
LSFTask

Public Member Functions

 output (self)
 
 requires (self)
 
 create_optimisation_and_validation_path (self)
 
 create_path (self)
 
 remove_output (self)
 

Public Attributes

 job_name = self.task_id
 set the job name (inherited variable)
 

Static Public Attributes

 experiment_number = b2luigi.IntParameter()
 Experiment number of the conditions database, e.g.
 
 n_events_training = b2luigi.IntParameter()
 Number of events to generate for the training data set.
 
 fast_bdt_option_state_filter
 FastBDT option to use to train the StateFilters.
 
 fast_bdt_option_result_filter
 FastBDT option to use to train the Result Filter.
 
 n_events_testing = b2luigi.IntParameter()
 Number of events to generate for the testing, validation, and optimisation data set.
 
 state_filter_cut = b2luigi.FloatParameter()
 Value of the cut on the MVA classifier output for accepting a state during CKF tracking.
 
 use_n_best_states = b2luigi.IntParameter()
 How many states should be kept at maximum in the combinatorial part of the CKF tree search.
 
 result_filter_cut = b2luigi.FloatParameter()
 Value of the cut on the MVA classifier output for a result candidate.
 
 use_n_best_results = b2luigi.IntParameter()
 How many results should be kept at maximum to search for overlaps.
 
str batch_system = 'lsf'
 batch system
 
str queue = 's'
 queue
 

Detailed Description

Validate the performance of the trained filters by trying various combinations of FastBDT options, as well as cut values for
the states, the number of best candidates kept after each filter, and similar for the result filter.

Definition at line 897 of file combined_to_pxd_ckf_mva_training.py.

Member Function Documentation

◆ create_optimisation_and_validation_path()

create_optimisation_and_validation_path ( self)
Create a path to validate the trained filters.

Definition at line 973 of file combined_to_pxd_ckf_mva_training.py.

973 def create_optimisation_and_validation_path(self):
974 """
975 Create a path to validate the trained filters.
976 """
977 path = basf2.create_path()
978
979 # get all the file names from the list of input files that are meant for optimisation / validation
980 file_list = [fname for fname in self.get_all_input_file_names()
981 if "generated_mc_N" in fname and "optimisation" in fname and fname.endswith(".root")]
982 path.add_module("RootInput", inputFileNames=file_list)
983
984 path.add_module("Gearbox")
985 path.add_module("Geometry")
986 path.add_module("SetupGenfitExtrapolation")
987
988 add_hit_preparation_modules(path, components=["SVD", "PXD"])
989
990 add_track_finding(path, reco_tracks="CDCSVDRecoTracks", components=["CDC", "SVD"], prune_temporary_tracks=False)
991
992 path.add_module("DAFRecoFitter", recoTracksStoreArrayName="CDCSVDRecoTracks")
993
994 fbdt_state_filter_string = create_fbdt_option_string(self.fast_bdt_option_state_filter)
995 fbdt_result_filter_string = create_fbdt_option_string(self.fast_bdt_option_result_filter)
996
997 # write the tracking MVA filter parameters and the cut on MVA classifier to be applied on a local db
998 iov = [0, 0, 0, -1]
1000 f"trk_ToPXDStateFilter_1_Parameter{fbdt_state_filter_string}",
1001 iov,
1002 f"trk_ToPXDStateFilter_1{fbdt_state_filter_string}",
1003 self.state_filter_cut)
1004
1006 f"trk_ToPXDStateFilter_2_Parameter{fbdt_state_filter_string}",
1007 iov,
1008 f"trk_ToPXDStateFilter_2{fbdt_state_filter_string}",
1009 self.state_filter_cut)
1010
1012 f"trk_ToPXDStateFilter_3_Parameter{fbdt_state_filter_string}",
1013 iov,
1014 f"trk_ToPXDStateFilter_3{fbdt_state_filter_string}",
1015 self.state_filter_cut)
1016
1018 f"trk_ToPXDResultFilter_Parameter{fbdt_result_filter_string}",
1019 iov,
1020 f"trk_ToPXDResultFilter{fbdt_result_filter_string}",
1021 self.result_filter_cut)
1022
1023 basf2.conditions.prepend_testing_payloads("localdb/database.txt")
1024 first_high_filter_parameters = {"DBPayloadName": f"trk_ToPXDStateFilter_1_Parameter{fbdt_state_filter_string}",
1025 "direction": "backward"}
1026 second_high_filter_parameters = {"DBPayloadName": f"trk_ToPXDStateFilter_2_Parameter{fbdt_state_filter_string}"}
1027 third_high_filter_parameters = {"DBPayloadName": f"trk_ToPXDStateFilter_3_Parameter{fbdt_state_filter_string}"}
1028 filter_parameters = {"DBPayloadName": f"trk_ToPXDResultFilter_Parameter{fbdt_result_filter_string}"}
1029
1030 path.add_module("ToPXDCKF",
1031 inputRecoTrackStoreArrayName="CDCSVDRecoTracks",
1032 outputRecoTrackStoreArrayName="PXDRecoTracks",
1033 outputRelationRecoTrackStoreArrayName="CDCSVDRecoTracks",
1034
1035 relationCheckForDirection="backward",
1036 reverseSeed=False,
1037 writeOutDirection="backward",
1038
1039 firstHighFilter="mva_with_direction_check",
1040 firstHighFilterParameters=first_high_filter_parameters,
1041 firstHighUseNStates=self.use_n_best_states,
1042
1043 advanceHighFilter="advance",
1044 advanceHighFilterParameters={"direction": "backward"},
1045
1046 secondHighFilter="mva",
1047 secondHighFilterParameters=second_high_filter_parameters,
1048 secondHighUseNStates=self.use_n_best_states,
1049
1050 updateHighFilter="fit",
1051
1052 thirdHighFilter="mva",
1053 thirdHighFilterParameters=third_high_filter_parameters,
1054 thirdHighUseNStates=self.use_n_best_states,
1055
1056 filter="mva",
1057 filterParameters=filter_parameters,
1058 useBestNInSeed=self.use_n_best_results,
1059
1060 exportTracks=True,
1061 enableOverlapResolving=True)
1062
1063 path.add_module('RelatedTracksCombiner',
1064 VXDRecoTracksStoreArrayName="PXDRecoTracks",
1065 CDCRecoTracksStoreArrayName="CDCSVDRecoTracks",
1066 recoTracksStoreArrayName="RecoTracks")
1067
1068 path.add_module('TrackFinderMCTruthRecoTracks',
1069 RecoTracksStoreArrayName="MCRecoTracks",
1070 WhichParticles=[],
1071 UsePXDHits=True,
1072 UseSVDHits=True,
1073 UseCDCHits=True)
1074
1075 path.add_module("MCRecoTracksMatcher", UsePXDHits=True, UseSVDHits=True, UseCDCHits=True,
1076 mcRecoTracksStoreArrayName="MCRecoTracks",
1077 prRecoTracksStoreArrayName="RecoTracks")
1078
1079 path.add_module(
1080 CombinedTrackingValidationModule(
1081 output_file_name=self.get_output_file_name(
1082 f"to_pxd_ckf_validation{fbdt_state_filter_string}{fbdt_result_filter_string}.root"),
1083 reco_tracks_name="RecoTracks",
1084 mc_reco_tracks_name="MCRecoTracks",
1085 name="",
1086 contact="",
1087 expert_level=200))
1088
1089 return path
1090

◆ create_path()

create_path ( self)
Create basf2 path to process with event generation and simulation.

Definition at line 1091 of file combined_to_pxd_ckf_mva_training.py.

1091 def create_path(self):
1092 """
1093 Create basf2 path to process with event generation and simulation.
1094 """
1095 return self.create_optimisation_and_validation_path()
1096

◆ output()

output ( self)
Generate list of output files that the task should produce.
The task is considered finished if and only if the outputs all exist.

Definition at line 932 of file combined_to_pxd_ckf_mva_training.py.

932 def output(self):
933 """
934 Generate list of output files that the task should produce.
935 The task is considered finished if and only if the outputs all exist.
936 """
937 fbdt_state_filter_string = create_fbdt_option_string(self.fast_bdt_option_state_filter)
938 fbdt_result_filter_string = create_fbdt_option_string(self.fast_bdt_option_result_filter)
939 yield self.add_to_output(
940 f"to_pxd_ckf_validation{fbdt_state_filter_string}{fbdt_result_filter_string}.root")
941

◆ remove_output()

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

Definition at line 1097 of file combined_to_pxd_ckf_mva_training.py.

1097 def remove_output(self):
1098 """
1099 Default function from base b2luigi.Task class.
1100 """
1101 self._remove_output()
1102
1103

◆ requires()

requires ( self)
This task requires trained result filters, trained state filters, and that an independent data set for validation was
created using the SplitMergeSimTask with the random seed optimisation.

Definition at line 942 of file combined_to_pxd_ckf_mva_training.py.

942 def requires(self):
943 """
944 This task requires trained result filters, trained state filters, and that an independent data set for validation was
945 created using the SplitMergeSimTask with the random seed optimisation.
946 """
947 fbdt_state_filter_string = create_fbdt_option_string(self.fast_bdt_option_state_filter)
948 yield CKFResultFilterTeacherTask(
949 result_filter_records_name=f"filter_records{fbdt_state_filter_string}.root",
950 experiment_number=self.experiment_number,
951 n_events=self.n_events_training,
952 fast_bdt_option_state_filter=self.fast_bdt_option_state_filter,
953 fast_bdt_option_result_filter=self.fast_bdt_option_result_filter,
954 random_seed='training'
955 )
956 yield SplitNMergeSimTask(
957 bkgfiles_dir=SummaryTask.bkgfiles_by_exp[self.experiment_number],
958 experiment_number=self.experiment_number,
959 n_events=self.n_events_testing,
960 random_seed="optimisation",
961 )
962 filter_numbers = [1, 2, 3]
963 for filter_number in filter_numbers:
964 yield self.clone(
965 CKFStateFilterTeacherTask,
966 experiment_number=self.experiment_number,
967 n_events=self.n_events_training,
968 random_seed="training",
969 filter_number=filter_number,
970 fast_bdt_option_state_filter=self.fast_bdt_option_state_filter
971 )
972

Member Data Documentation

◆ batch_system

str batch_system = 'lsf'
staticinherited

batch system

Definition at line 189 of file combined_to_pxd_ckf_mva_training.py.

◆ experiment_number

experiment_number = b2luigi.IntParameter()
static

Experiment number of the conditions database, e.g.

defines simulation geometry.

Definition at line 903 of file combined_to_pxd_ckf_mva_training.py.

◆ fast_bdt_option_result_filter

fast_bdt_option_result_filter
static
Initial value:
= b2luigi.ListParameter(
# ##
)

FastBDT option to use to train the Result Filter.

Definition at line 913 of file combined_to_pxd_ckf_mva_training.py.

◆ fast_bdt_option_state_filter

fast_bdt_option_state_filter
static
Initial value:
= b2luigi.ListParameter(
# ##
)

FastBDT option to use to train the StateFilters.

Definition at line 907 of file combined_to_pxd_ckf_mva_training.py.

◆ job_name

job_name = self.task_id
inherited

set the job name (inherited variable)

Definition at line 197 of file combined_to_pxd_ckf_mva_training.py.

◆ n_events_testing

n_events_testing = b2luigi.IntParameter()
static

Number of events to generate for the testing, validation, and optimisation data set.

Definition at line 919 of file combined_to_pxd_ckf_mva_training.py.

◆ n_events_training

n_events_training = b2luigi.IntParameter()
static

Number of events to generate for the training data set.

Definition at line 905 of file combined_to_pxd_ckf_mva_training.py.

◆ queue

str queue = 's'
staticinherited

queue

Definition at line 191 of file combined_to_pxd_ckf_mva_training.py.

◆ result_filter_cut

result_filter_cut = b2luigi.FloatParameter()
static

Value of the cut on the MVA classifier output for a result candidate.

Definition at line 925 of file combined_to_pxd_ckf_mva_training.py.

◆ state_filter_cut

state_filter_cut = b2luigi.FloatParameter()
static

Value of the cut on the MVA classifier output for accepting a state during CKF tracking.

Definition at line 921 of file combined_to_pxd_ckf_mva_training.py.

◆ use_n_best_results

use_n_best_results = b2luigi.IntParameter()
static

How many results should be kept at maximum to search for overlaps.

Definition at line 927 of file combined_to_pxd_ckf_mva_training.py.

◆ use_n_best_states

use_n_best_states = b2luigi.IntParameter()
static

How many states should be kept at maximum in the combinatorial part of the CKF tree search.

Definition at line 923 of file combined_to_pxd_ckf_mva_training.py.


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