Belle II Software release-09-00-00
ValidationAndOptimisationTask Class Reference
Inheritance diagram for ValidationAndOptimisationTask:
Collaboration 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 844 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 917 of file combined_cdc_to_svd_ckf_mva_training.py.

917 def create_optimisation_and_validation_path(self):
918 """
919 Create a path to validate the trained filters.
920 """
921 path = basf2.create_path()
922
923 # get all the file names from the list of input files that are meant for optimisation / validation
924 file_list = [fname for sublist in self.get_input_file_names().values()
925 for fname in sublist if "generated_mc_N" in fname and "optimisation" in fname and fname.endswith(".root")]
926 path.add_module("RootInput", inputFileNames=file_list)
927
928 path.add_module("Gearbox")
929 path.add_module("Geometry")
930 path.add_module("SetupGenfitExtrapolation")
931
932 add_hit_preparation_modules(path, components=["SVD"])
933
934 add_track_finding(path, reco_tracks="CDCRecoTracks", components=["CDC"], prune_temporary_tracks=False)
935
936 fbdt_state_filter_string = create_fbdt_option_string(self.fast_bdt_option_state_filter)
937 fbdt_result_filter_string = create_fbdt_option_string(self.fast_bdt_option_result_filter)
938 path.add_module("CDCToSVDSpacePointCKF",
939
940 inputRecoTrackStoreArrayName="CDCRecoTracks",
941 outputRecoTrackStoreArrayName="VXDRecoTracks",
942 outputRelationRecoTrackStoreArrayName="CDCRecoTracks",
943
944 relationCheckForDirection="backward",
945 reverseSeed=False,
946 writeOutDirection="backward",
947
948 firstHighFilter="mva_with_direction_check",
949 firstHighFilterParameters={
950 "identifier": self.get_input_file_names(
951 f"trk_CDCToSVDSpacePointStateFilter_1{fbdt_state_filter_string}.xml")[0],
952 "cut": self.state_filter_cut,
953 "direction": "backward"},
954 firstHighUseNStates=self.use_n_best_states,
955
956 advanceHighFilter="advance",
957 advanceHighFilterParameters={"direction": "backward"},
958
959 secondHighFilter="mva",
960 secondHighFilterParameters={
961 "identifier": self.get_input_file_names(
962 f"trk_CDCToSVDSpacePointStateFilter_2{fbdt_state_filter_string}.xml")[0],
963 "cut": self.state_filter_cut},
964 secondHighUseNStates=self.use_n_best_states,
965
966 updateHighFilter="fit",
967
968 thirdHighFilter="mva",
969 thirdHighFilterParameters={
970 "identifier": self.get_input_file_names(
971 f"trk_CDCToSVDSpacePointStateFilter_3{fbdt_state_filter_string}.xml")[0],
972 "cut": self.state_filter_cut},
973 thirdHighUseNStates=self.use_n_best_states,
974
975 filter="mva",
976 filterParameters={
977 "identifier": self.get_input_file_names(
978 f"trk_CDCToSVDSpacePointResultFilter{fbdt_result_filter_string}.xml")[0],
979 "cut": self.result_filter_cut},
980 useBestNInSeed=self.use_n_best_results,
981
982 exportTracks=True,
983 enableOverlapResolving=True)
984
985 path.add_module('RelatedTracksCombiner',
986 VXDRecoTracksStoreArrayName="VXDRecoTracks",
987 CDCRecoTracksStoreArrayName="CDCRecoTracks",
988 recoTracksStoreArrayName="RecoTracks")
989
990 path.add_module('TrackFinderMCTruthRecoTracks',
991 RecoTracksStoreArrayName="MCRecoTracks",
992 WhichParticles=[],
993 UsePXDHits=True,
994 UseSVDHits=True,
995 UseCDCHits=True)
996
997 path.add_module("MCRecoTracksMatcher", UsePXDHits=False, UseSVDHits=True, UseCDCHits=True,
998 mcRecoTracksStoreArrayName="MCRecoTracks",
999 prRecoTracksStoreArrayName="RecoTracks")
1000
1001 path.add_module(
1002 CombinedTrackingValidationModule(
1003 output_file_name=self.get_output_file_name(
1004 f"cdc_to_svd_spacepoint_ckf_validation{fbdt_state_filter_string}_{fbdt_result_filter_string}.root"),
1005 reco_tracks_name="RecoTracks",
1006 mc_reco_tracks_name="MCRecoTracks",
1007 name="",
1008 contact="",
1009 expert_level=200))
1010
1011 return path
1012

◆ create_path()

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

Definition at line 1013 of file combined_cdc_to_svd_ckf_mva_training.py.

1013 def create_path(self):
1014 """
1015 Create basf2 path to process with event generation and simulation.
1016 """
1017 return self.create_optimisation_and_validation_path()
1018
1019

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

876 def output(self):
877 """
878 Generate list of output files that the task should produce.
879 The task is considered finished if and only if the outputs all exist.
880 """
881 fbdt_state_filter_string = create_fbdt_option_string(self.fast_bdt_option_state_filter)
882 fbdt_result_filter_string = create_fbdt_option_string(self.fast_bdt_option_result_filter)
883 yield self.add_to_output(
884 f"cdc_to_svd_spacepoint_ckf_validation{fbdt_state_filter_string}_{fbdt_result_filter_string}.root")
885

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

886 def requires(self):
887 """
888 This task requires trained result filters, trained state filters, and that an independent data set for validation was
889 created using the SplitMergeSimTask with the random seed optimisation.
890 """
891 fbdt_state_filter_string = create_fbdt_option_string(self.fast_bdt_option_state_filter)
892 yield CKFResultFilterTeacherTask(
893 result_filter_records_name=f"filter_records{fbdt_state_filter_string}.root",
894 experiment_number=self.experiment_number,
895 n_events=self.n_events_training,
896 fast_bdt_option_state_filter=self.fast_bdt_option_state_filter,
897 fast_bdt_option_result_filter=self.fast_bdt_option_result_filter,
898 random_seed='training'
899 )
900 yield SplitNMergeSimTask(
901 bkgfiles_dir=MainTask.bkgfiles_by_exp[self.experiment_number],
902 experiment_number=self.experiment_number,
903 n_events=self.n_events_testing,
904 random_seed="optimisation",
905 )
906 filter_numbers = [1, 2, 3]
907 for filter_number in filter_numbers:
908 yield self.clone(
909 CKFStateFilterTeacherTask,
910 experiment_number=self.experiment_number,
911 random_seed="training",
912 n_events=self.n_events_training,
913 filter_number=filter_number,
914 fast_bdt_option=self.fast_bdt_option_state_filter
915 )
916

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 850 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 860 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 854 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 866 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 852 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 872 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 868 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 874 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 870 of file combined_cdc_to_svd_ckf_mva_training.py.


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