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 799 of file combined_to_pxd_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 872 of file combined_to_pxd_ckf_mva_training.py.

872 def create_optimisation_and_validation_path(self):
873 """
874 Create a path to validate the trained filters.
875 """
876 path = basf2.create_path()
877
878 # get all the file names from the list of input files that are meant for optimisation / validation
879 file_list = [fname for sublist in self.get_input_file_names().values()
880 for fname in sublist if "generated_mc_N" in fname and "optimisation" in fname and fname.endswith(".root")]
881 path.add_module("RootInput", inputFileNames=file_list)
882
883 path.add_module("Gearbox")
884 path.add_module("Geometry")
885 path.add_module("SetupGenfitExtrapolation")
886
887 add_hit_preparation_modules(path, components=["SVD", "PXD"])
888
889 add_track_finding(path, reco_tracks="CDCSVDRecoTracks", components=["CDC", "SVD"], prune_temporary_tracks=False)
890
891 path.add_module("DAFRecoFitter", recoTracksStoreArrayName="CDCSVDRecoTracks")
892
893 fbdt_state_filter_string = create_fbdt_option_string(self.fast_bdt_option_state_filter)
894 fbdt_result_filter_string = create_fbdt_option_string(self.fast_bdt_option_result_filter)
895 path.add_module("ToPXDCKF",
896 inputRecoTrackStoreArrayName="CDCSVDRecoTracks",
897 outputRecoTrackStoreArrayName="PXDRecoTracks",
898 outputRelationRecoTrackStoreArrayName="CDCSVDRecoTracks",
899
900 relationCheckForDirection="backward",
901 reverseSeed=False,
902 writeOutDirection="backward",
903
904 firstHighFilter="mva_with_direction_check",
905 firstHighFilterParameters={
906 "identifier": self.get_input_file_names(
907 f"trk_ToPXDStateFilter_1{fbdt_state_filter_string}.xml")[0],
908 "cut": self.state_filter_cut,
909 "direction": "backward"},
910 firstHighUseNStates=self.use_n_best_states,
911
912 advanceHighFilter="advance",
913 advanceHighFilterParameters={"direction": "backward"},
914
915 secondHighFilter="mva",
916 secondHighFilterParameters={
917 "identifier": self.get_input_file_names(
918 f"trk_ToPXDStateFilter_2{fbdt_state_filter_string}.xml")[0],
919 "cut": self.state_filter_cut},
920 secondHighUseNStates=self.use_n_best_states,
921
922 updateHighFilter="fit",
923
924 thirdHighFilter="mva",
925 thirdHighFilterParameters={
926 "identifier": self.get_input_file_names(
927 f"trk_ToPXDStateFilter_3{fbdt_state_filter_string}.xml")[0],
928 "cut": self.state_filter_cut},
929 thirdHighUseNStates=self.use_n_best_states,
930
931 filter="mva",
932 filterParameters={
933 "identifier": self.get_input_file_names(
934 f"trk_ToPXDResultFilter{fbdt_result_filter_string}.xml")[0],
935 "cut": self.result_filter_cut},
936 useBestNInSeed=self.use_n_best_results,
937
938 exportTracks=True,
939 enableOverlapResolving=True)
940
941 path.add_module('RelatedTracksCombiner',
942 VXDRecoTracksStoreArrayName="PXDRecoTracks",
943 CDCRecoTracksStoreArrayName="CDCSVDRecoTracks",
944 recoTracksStoreArrayName="RecoTracks")
945
946 path.add_module('TrackFinderMCTruthRecoTracks',
947 RecoTracksStoreArrayName="MCRecoTracks",
948 WhichParticles=[],
949 UsePXDHits=True,
950 UseSVDHits=True,
951 UseCDCHits=True)
952
953 path.add_module("MCRecoTracksMatcher", UsePXDHits=True, UseSVDHits=True, UseCDCHits=True,
954 mcRecoTracksStoreArrayName="MCRecoTracks",
955 prRecoTracksStoreArrayName="RecoTracks")
956
957 path.add_module(
958 CombinedTrackingValidationModule(
959 output_file_name=self.get_output_file_name(
960 f"to_pxd_ckf_validation{fbdt_state_filter_string}_{fbdt_result_filter_string}.root"),
961 reco_tracks_name="RecoTracks",
962 mc_reco_tracks_name="MCRecoTracks",
963 name="",
964 contact="",
965 expert_level=200))
966
967 return path
968

◆ create_path()

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

Definition at line 969 of file combined_to_pxd_ckf_mva_training.py.

969 def create_path(self):
970 """
971 Create basf2 path to process with event generation and simulation.
972 """
973 return self.create_optimisation_and_validation_path()
974
975

◆ 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 831 of file combined_to_pxd_ckf_mva_training.py.

831 def output(self):
832 """
833 Generate list of output files that the task should produce.
834 The task is considered finished if and only if the outputs all exist.
835 """
836 fbdt_state_filter_string = create_fbdt_option_string(self.fast_bdt_option_state_filter)
837 fbdt_result_filter_string = create_fbdt_option_string(self.fast_bdt_option_result_filter)
838 yield self.add_to_output(
839 f"to_pxd_ckf_validation{fbdt_state_filter_string}_{fbdt_result_filter_string}.root")
840

◆ 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 841 of file combined_to_pxd_ckf_mva_training.py.

841 def requires(self):
842 """
843 This task requires trained result filters, trained state filters, and that an independent data set for validation was
844 created using the SplitMergeSimTask with the random seed optimisation.
845 """
846 fbdt_state_filter_string = create_fbdt_option_string(self.fast_bdt_option_state_filter)
847 yield CKFResultFilterTeacherTask(
848 result_filter_records_name=f"filter_records{fbdt_state_filter_string}.root",
849 experiment_number=self.experiment_number,
850 n_events=self.n_events_training,
851 fast_bdt_option_state_filter=self.fast_bdt_option_state_filter,
852 fast_bdt_option_result_filter=self.fast_bdt_option_result_filter,
853 random_seed='training'
854 )
855 yield SplitNMergeSimTask(
856 bkgfiles_dir=MainTask.bkgfiles_by_exp[self.experiment_number],
857 experiment_number=self.experiment_number,
858 n_events=self.n_events_testing,
859 random_seed="optimisation",
860 )
861 filter_numbers = [1, 2, 3]
862 for filter_number in filter_numbers:
863 yield self.clone(
864 CKFStateFilterTeacherTask,
865 experiment_number=self.experiment_number,
866 n_events=self.n_events_training,
867 random_seed="training",
868 filter_number=filter_number,
869 fast_bdt_option_state_filter=self.fast_bdt_option_state_filter
870 )
871

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 805 of file combined_to_pxd_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 815 of file combined_to_pxd_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 809 of file combined_to_pxd_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 821 of file combined_to_pxd_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 807 of file combined_to_pxd_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 827 of file combined_to_pxd_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 823 of file combined_to_pxd_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 829 of file combined_to_pxd_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 825 of file combined_to_pxd_ckf_mva_training.py.


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