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 939 of file combined_cdc_to_svd_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 1015 of file combined_cdc_to_svd_ckf_mva_training.py.

1015 def create_optimisation_and_validation_path(self):
1016 """
1017 Create a path to validate the trained filters.
1018 """
1019 path = basf2.create_path()
1020
1021 # get all the file names from the list of input files that are meant for optimisation / validation
1022 file_list = [fname for fname in self.get_all_input_file_names()
1023 if "generated_mc_N" in fname and "optimisation" in fname and fname.endswith(".root")]
1024 path.add_module("RootInput", inputFileNames=file_list)
1025
1026 path.add_module("Gearbox")
1027 path.add_module("Geometry")
1028 path.add_module("SetupGenfitExtrapolation")
1029
1030 add_hit_preparation_modules(path, components=["SVD"])
1031
1032 add_track_finding(path, reco_tracks="CDCRecoTracks", components=["CDC"], prune_temporary_tracks=False)
1033
1034 fbdt_state_filter_string = create_fbdt_option_string(self.fast_bdt_option_state_filter)
1035 fbdt_result_filter_string = create_fbdt_option_string(self.fast_bdt_option_result_filter)
1036
1037 # write the tracking MVA filter parameters and the cut on MVA classifier to be applied on a local db
1038 iov = [0, 0, 0, -1]
1040 f"trk_CDCToSVDSpacePointStateFilter_1_Parameter{fbdt_state_filter_string}",
1041 iov,
1042 f"trk_CDCToSVDSpacePointStateFilter_1{fbdt_state_filter_string}",
1043 self.state_filter_cut)
1044
1046 f"trk_CDCToSVDSpacePointStateFilter_2_Parameter{fbdt_state_filter_string}",
1047 iov,
1048 f"trk_CDCToSVDSpacePointStateFilter_2{fbdt_state_filter_string}",
1049 self.state_filter_cut)
1050
1052 f"trk_CDCToSVDSpacePointStateFilter_3_Parameter{fbdt_state_filter_string}",
1053 iov,
1054 f"trk_CDCToSVDSpacePointStateFilter_3{fbdt_state_filter_string}",
1055 self.state_filter_cut)
1056
1058 f"trk_CDCToSVDSpacePointResultFilter_Parameter{fbdt_result_filter_string}",
1059 iov,
1060 f"trk_CDCToSVDSpacePointResultFilter{fbdt_result_filter_string}",
1061 self.result_filter_cut)
1062
1063 basf2.conditions.prepend_testing_payloads("localdb/database.txt")
1064 first_high_filter_parameters = {"DBPayloadName": f"trk_CDCToSVDSpacePointStateFilter_1_Parameter{fbdt_state_filter_string}",
1065 "direction": "backward"}
1066 second_high_filter_parameters = {
1067 "DBPayloadName": f"trk_CDCToSVDSpacePointStateFilter_2_Parameter{fbdt_state_filter_string}"}
1068 third_high_filter_parameters = {"DBPayloadName": f"trk_CDCToSVDSpacePointStateFilter_3_Parameter{fbdt_state_filter_string}"}
1069 filter_parameters = {"DBPayloadName": f"trk_CDCToSVDSpacePointResultFilter_Parameter{fbdt_result_filter_string}"}
1070
1071 path.add_module("CDCToSVDSpacePointCKF",
1072
1073 inputRecoTrackStoreArrayName="CDCRecoTracks",
1074 outputRecoTrackStoreArrayName="VXDRecoTracks",
1075 outputRelationRecoTrackStoreArrayName="CDCRecoTracks",
1076
1077 relationCheckForDirection="backward",
1078 reverseSeed=False,
1079 writeOutDirection="backward",
1080
1081 firstHighFilter="mva_with_direction_check",
1082 firstHighFilterParameters=first_high_filter_parameters,
1083 firstHighUseNStates=self.use_n_best_states,
1084
1085 advanceHighFilter="advance",
1086 advanceHighFilterParameters={"direction": "backward"},
1087
1088 secondHighFilter="mva",
1089 secondHighFilterParameters=second_high_filter_parameters,
1090 secondHighUseNStates=self.use_n_best_states,
1091
1092 updateHighFilter="fit",
1093
1094 thirdHighFilter="mva",
1095 thirdHighFilterParameters=third_high_filter_parameters,
1096 thirdHighUseNStates=self.use_n_best_states,
1097
1098 filter="mva",
1099 filterParameters=filter_parameters,
1100 useBestNInSeed=self.use_n_best_results,
1101
1102 exportTracks=True,
1103 enableOverlapResolving=True)
1104
1105 path.add_module('RelatedTracksCombiner',
1106 VXDRecoTracksStoreArrayName="VXDRecoTracks",
1107 CDCRecoTracksStoreArrayName="CDCRecoTracks",
1108 recoTracksStoreArrayName="RecoTracks")
1109
1110 path.add_module('TrackFinderMCTruthRecoTracks',
1111 RecoTracksStoreArrayName="MCRecoTracks",
1112 WhichParticles=[],
1113 UsePXDHits=True,
1114 UseSVDHits=True,
1115 UseCDCHits=True)
1116
1117 path.add_module("MCRecoTracksMatcher", UsePXDHits=False, UseSVDHits=True, UseCDCHits=True,
1118 mcRecoTracksStoreArrayName="MCRecoTracks",
1119 prRecoTracksStoreArrayName="RecoTracks")
1120
1121 path.add_module(
1122 CombinedTrackingValidationModule(
1123 output_file_name=self.get_output_file_name(
1124 f"cdc_to_svd_spacepoint_ckf_validation{fbdt_state_filter_string}{fbdt_result_filter_string}.root"),
1125 reco_tracks_name="RecoTracks",
1126 mc_reco_tracks_name="MCRecoTracks",
1127 name="",
1128 contact="",
1129 expert_level=200))
1130
1131 return path
1132

◆ create_path()

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

Definition at line 1133 of file combined_cdc_to_svd_ckf_mva_training.py.

1133 def create_path(self):
1134 """
1135 Create basf2 path to process with event generation and simulation.
1136 """
1137 return self.create_optimisation_and_validation_path()
1138

◆ 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 974 of file combined_cdc_to_svd_ckf_mva_training.py.

974 def output(self):
975 """
976 Generate list of output files that the task should produce.
977 The task is considered finished if and only if the outputs all exist.
978 """
979 fbdt_state_filter_string = create_fbdt_option_string(self.fast_bdt_option_state_filter)
980 fbdt_result_filter_string = create_fbdt_option_string(self.fast_bdt_option_result_filter)
981 yield self.add_to_output(
982 f"cdc_to_svd_spacepoint_ckf_validation{fbdt_state_filter_string}{fbdt_result_filter_string}.root")
983

◆ remove_output()

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

Definition at line 1139 of file combined_cdc_to_svd_ckf_mva_training.py.

1139 def remove_output(self):
1140 """
1141 Default function from base b2luigi.Task class.
1142 """
1143 self._remove_output()
1144
1145

◆ 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 984 of file combined_cdc_to_svd_ckf_mva_training.py.

984 def requires(self):
985 """
986 This task requires trained result filters, trained state filters, and that an independent data set for validation was
987 created using the SplitMergeSimTask with the random seed optimisation.
988 """
989 fbdt_state_filter_string = create_fbdt_option_string(self.fast_bdt_option_state_filter)
990 yield CKFResultFilterTeacherTask(
991 result_filter_records_name=f"filter_records{fbdt_state_filter_string}.root",
992 experiment_number=self.experiment_number,
993 n_events=self.n_events_training,
994 fast_bdt_option_state_filter=self.fast_bdt_option_state_filter,
995 fast_bdt_option_result_filter=self.fast_bdt_option_result_filter,
996 random_seed='training'
997 )
998 yield SplitNMergeSimTask(
999 bkgfiles_dir=SummaryTask.bkgfiles_by_exp[self.experiment_number],
1000 experiment_number=self.experiment_number,
1001 n_events=self.n_events_testing,
1002 random_seed="optimisation",
1003 )
1004 filter_numbers = [1, 2, 3]
1005 for filter_number in filter_numbers:
1006 yield self.clone(
1007 CKFStateFilterTeacherTask,
1008 experiment_number=self.experiment_number,
1009 random_seed="training",
1010 n_events=self.n_events_training,
1011 filter_number=filter_number,
1012 fast_bdt_option=self.fast_bdt_option_state_filter
1013 )
1014

Member Data Documentation

◆ batch_system

str batch_system = 'lsf'
staticinherited

batch system

Definition at line 189 of file combined_cdc_to_svd_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 945 of file combined_cdc_to_svd_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 955 of file combined_cdc_to_svd_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 949 of file combined_cdc_to_svd_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_cdc_to_svd_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 961 of file combined_cdc_to_svd_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 947 of file combined_cdc_to_svd_ckf_mva_training.py.

◆ queue

str queue = 's'
staticinherited

queue

Definition at line 191 of file combined_cdc_to_svd_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 967 of file combined_cdc_to_svd_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 963 of file combined_cdc_to_svd_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 969 of file combined_cdc_to_svd_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 965 of file combined_cdc_to_svd_ckf_mva_training.py.


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