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

Public Member Functions

def output (self)
 
def requires (self)
 
def create_optimisation_and_validation_path (self)
 
def create_path (self)
 

Static Public Attributes

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

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

Member Function Documentation

◆ create_optimisation_and_validation_path()

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

Definition at line 949 of file combined_cdc_to_svd_ckf_mva_training.py.

949 def create_optimisation_and_validation_path(self):
950 """
951 Create a path to validate the trained filters.
952 """
953 path = basf2.create_path()
954
955 # get all the file names from the list of input files that are meant for optimisation / validation
956 file_list = [fname for sublist in self.get_input_file_names().values()
957 for fname in sublist if "generated_mc_N" in fname and "optimisation" in fname and fname.endswith(".root")]
958 path.add_module("RootInput", inputFileNames=file_list)
959
960 path.add_module("Gearbox")
961 path.add_module("Geometry")
962 path.add_module("SetupGenfitExtrapolation")
963
964 add_hit_preparation_modules(path, components=["SVD"])
965
966 add_track_finding(path, reco_tracks="CDCRecoTracks", components=["CDC"], prune_temporary_tracks=False)
967
968 fbdt_state_filter_string = create_fbdt_option_string(self.fast_bdt_option_state_filter)
969 fbdt_result_filter_string = create_fbdt_option_string(self.fast_bdt_option_result_filter)
970
971 # write the tracking MVA filter parameters and the cut on MVA classifier to be applied on a local db
972 iov = [0, 0, 0, -1]
974 f"trk_CDCToSVDSpacePointStateFilter_1_Parameter{fbdt_state_filter_string}",
975 iov,
976 f"trk_CDCToSVDSpacePointStateFilter_1{fbdt_state_filter_string}",
977 self.state_filter_cut)
978
980 f"trk_CDCToSVDSpacePointStateFilter_2_Parameter{fbdt_state_filter_string}",
981 iov,
982 f"trk_CDCToSVDSpacePointStateFilter_2{fbdt_state_filter_string}",
983 self.state_filter_cut)
984
986 f"trk_CDCToSVDSpacePointStateFilter_3_Parameter{fbdt_state_filter_string}",
987 iov,
988 f"trk_CDCToSVDSpacePointStateFilter_3{fbdt_state_filter_string}",
989 self.state_filter_cut)
990
992 f"trk_CDCToSVDSpacePointResultFilter_Parameter{fbdt_result_filter_string}",
993 iov,
994 f"trk_CDCToSVDSpacePointResultFilter{fbdt_result_filter_string}",
995 self.result_filter_cut)
996
997 basf2.conditions.prepend_testing_payloads("localdb/database.txt")
998 first_high_filter_parameters = {"DBPayloadName": f"trk_CDCToSVDSpacePointStateFilter_1_Parameter{fbdt_state_filter_string}",
999 "direction": "backward"}
1000 second_high_filter_parameters = {
1001 "DBPayloadName": f"trk_CDCToSVDSpacePointStateFilter_2_Parameter{fbdt_state_filter_string}"}
1002 third_high_filter_parameters = {"DBPayloadName": f"trk_CDCToSVDSpacePointStateFilter_3_Parameter{fbdt_state_filter_string}"}
1003 filter_parameters = {"DBPayloadName": f"trk_CDCToSVDSpacePointResultFilter_Parameter{fbdt_result_filter_string}"}
1004
1005 path.add_module("CDCToSVDSpacePointCKF",
1006
1007 inputRecoTrackStoreArrayName="CDCRecoTracks",
1008 outputRecoTrackStoreArrayName="VXDRecoTracks",
1009 outputRelationRecoTrackStoreArrayName="CDCRecoTracks",
1010
1011 relationCheckForDirection="backward",
1012 reverseSeed=False,
1013 writeOutDirection="backward",
1014
1015 firstHighFilter="mva_with_direction_check",
1016 firstHighFilterParameters=first_high_filter_parameters,
1017 firstHighUseNStates=self.use_n_best_states,
1018
1019 advanceHighFilter="advance",
1020 advanceHighFilterParameters={"direction": "backward"},
1021
1022 secondHighFilter="mva",
1023 secondHighFilterParameters=second_high_filter_parameters,
1024 secondHighUseNStates=self.use_n_best_states,
1025
1026 updateHighFilter="fit",
1027
1028 thirdHighFilter="mva",
1029 thirdHighFilterParameters=third_high_filter_parameters,
1030 thirdHighUseNStates=self.use_n_best_states,
1031
1032 filter="mva",
1033 filterParameters=filter_parameters,
1034 useBestNInSeed=self.use_n_best_results,
1035
1036 exportTracks=True,
1037 enableOverlapResolving=True)
1038
1039 path.add_module('RelatedTracksCombiner',
1040 VXDRecoTracksStoreArrayName="VXDRecoTracks",
1041 CDCRecoTracksStoreArrayName="CDCRecoTracks",
1042 recoTracksStoreArrayName="RecoTracks")
1043
1044 path.add_module('TrackFinderMCTruthRecoTracks',
1045 RecoTracksStoreArrayName="MCRecoTracks",
1046 WhichParticles=[],
1047 UsePXDHits=True,
1048 UseSVDHits=True,
1049 UseCDCHits=True)
1050
1051 path.add_module("MCRecoTracksMatcher", UsePXDHits=False, UseSVDHits=True, UseCDCHits=True,
1052 mcRecoTracksStoreArrayName="MCRecoTracks",
1053 prRecoTracksStoreArrayName="RecoTracks")
1054
1055 path.add_module(
1056 CombinedTrackingValidationModule(
1057 output_file_name=self.get_output_file_name(
1058 f"cdc_to_svd_spacepoint_ckf_validation{fbdt_state_filter_string}_{fbdt_result_filter_string}.root"),
1059 reco_tracks_name="RecoTracks",
1060 mc_reco_tracks_name="MCRecoTracks",
1061 name="",
1062 contact="",
1063 expert_level=200))
1064
1065 return path
1066

◆ create_path()

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

Definition at line 1067 of file combined_cdc_to_svd_ckf_mva_training.py.

1067 def create_path(self):
1068 """
1069 Create basf2 path to process with event generation and simulation.
1070 """
1071 return self.create_optimisation_and_validation_path()
1072
1073

◆ output()

def 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 908 of file combined_cdc_to_svd_ckf_mva_training.py.

908 def output(self):
909 """
910 Generate list of output files that the task should produce.
911 The task is considered finished if and only if the outputs all exist.
912 """
913 fbdt_state_filter_string = create_fbdt_option_string(self.fast_bdt_option_state_filter)
914 fbdt_result_filter_string = create_fbdt_option_string(self.fast_bdt_option_result_filter)
915 yield self.add_to_output(
916 f"cdc_to_svd_spacepoint_ckf_validation{fbdt_state_filter_string}_{fbdt_result_filter_string}.root")
917

◆ requires()

def 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 918 of file combined_cdc_to_svd_ckf_mva_training.py.

918 def requires(self):
919 """
920 This task requires trained result filters, trained state filters, and that an independent data set for validation was
921 created using the SplitMergeSimTask with the random seed optimisation.
922 """
923 fbdt_state_filter_string = create_fbdt_option_string(self.fast_bdt_option_state_filter)
924 yield CKFResultFilterTeacherTask(
925 result_filter_records_name=f"filter_records{fbdt_state_filter_string}.root",
926 experiment_number=self.experiment_number,
927 n_events=self.n_events_training,
928 fast_bdt_option_state_filter=self.fast_bdt_option_state_filter,
929 fast_bdt_option_result_filter=self.fast_bdt_option_result_filter,
930 random_seed='training'
931 )
932 yield SplitNMergeSimTask(
933 bkgfiles_dir=MainTask.bkgfiles_by_exp[self.experiment_number],
934 experiment_number=self.experiment_number,
935 n_events=self.n_events_testing,
936 random_seed="optimisation",
937 )
938 filter_numbers = [1, 2, 3]
939 for filter_number in filter_numbers:
940 yield self.clone(
941 CKFStateFilterTeacherTask,
942 experiment_number=self.experiment_number,
943 random_seed="training",
944 n_events=self.n_events_training,
945 filter_number=filter_number,
946 fast_bdt_option=self.fast_bdt_option_state_filter
947 )
948

Member Data Documentation

◆ experiment_number

b2luigi experiment_number = b2luigi.IntParameter()
static

Experiment number of the conditions database, e.g.

defines simulation geometry.

Definition at line 879 of file combined_cdc_to_svd_ckf_mva_training.py.

◆ fast_bdt_option_result_filter

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

FastBDT option to use to train the Result Filter.

Definition at line 889 of file combined_cdc_to_svd_ckf_mva_training.py.

◆ fast_bdt_option_state_filter

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

FastBDT option to use to train the StateFilters.

Definition at line 883 of file combined_cdc_to_svd_ckf_mva_training.py.

◆ n_events_testing

b2luigi n_events_testing = b2luigi.IntParameter()
static

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

Definition at line 895 of file combined_cdc_to_svd_ckf_mva_training.py.

◆ n_events_training

b2luigi n_events_training = b2luigi.IntParameter()
static

Number of events to generate for the training data set.

Definition at line 881 of file combined_cdc_to_svd_ckf_mva_training.py.

◆ result_filter_cut

b2luigi result_filter_cut = b2luigi.FloatParameter()
static

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

Definition at line 901 of file combined_cdc_to_svd_ckf_mva_training.py.

◆ state_filter_cut

b2luigi 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 897 of file combined_cdc_to_svd_ckf_mva_training.py.

◆ use_n_best_results

b2luigi use_n_best_results = b2luigi.IntParameter()
static

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

Definition at line 903 of file combined_cdc_to_svd_ckf_mva_training.py.

◆ use_n_best_states

b2luigi 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 899 of file combined_cdc_to_svd_ckf_mva_training.py.


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