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
 FastBDT option to use to train the StateFilters.
 
 n_events_testing = b2luigi.IntParameter()
 Number of events to generate for the testing, validation, and optimisation data set.
 
 result_filter_cut = b2luigi.FloatParameter()
 Value of the cut on the MVA classifier output for a result candidate.
 
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 590 of file cdc_and_svd_ckf_merger_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 642 of file cdc_and_svd_ckf_merger_mva_training.py.

642 def create_optimisation_and_validation_path(self):
643 """
644 Create a path to validate the trained filters.
645 """
646 path = basf2.create_path()
647
648 # get all the file names from the list of input files that are meant for optimisation / validation
649 file_list = [fname for fname in self.get_all_input_file_names()
650 if "generated_mc_N" in fname and "optimisation" in fname and fname.endswith(".root")]
651 path.add_module("RootInput", inputFileNames=file_list)
652
653 path.add_module("Gearbox")
654 path.add_module("Geometry")
655 path.add_module("SetupGenfitExtrapolation")
656
657 add_hit_preparation_modules(path, components=["SVD"])
658
659 cdc_reco_tracks = "CDCRecoTracks"
660 svd_reco_tracks = "SVDRecoTracks"
661 reco_tracks = "RecoTracks"
662 mc_reco_tracks = "MCRecoTracks"
663
664 # CDC track finding and MC matching
665 add_cdc_track_finding(path, output_reco_tracks=cdc_reco_tracks)
666
667 path.add_module("DAFRecoFitter", recoTracksStoreArrayName=cdc_reco_tracks)
668
669 # SVD track finding and MC matching
670 add_svd_standalone_tracking(path, reco_tracks=svd_reco_tracks)
671
672 direction = "backward"
673 fbdt_string = create_fbdt_option_string(self.fast_bdt_option)
674
675 # write the tracking MVA filter parameters and the cut on MVA classifier to be applied on a local db
676 iov = [0, 0, 0, -1]
678 f"trk_CDCToSVDSeedResultFilterParameter{fbdt_string}",
679 iov,
680 f"trk_CDCToSVDSeedResultFilter{fbdt_string}",
681 self.result_filter_cut)
682
683 basf2.conditions.prepend_testing_payloads("localdb/database.txt")
684 result_filter_parameters = {"DBPayloadName": f"trk_CDCToSVDSeedResultFilterParameter{fbdt_string}"}
685
686 path.add_module(
687 "CDCToSVDSeedCKF",
688 inputRecoTrackStoreArrayName=cdc_reco_tracks,
689 fromRelationStoreArrayName=cdc_reco_tracks,
690 toRelationStoreArrayName=svd_reco_tracks,
691 relatedRecoTrackStoreArrayName=svd_reco_tracks,
692 cdcTracksStoreArrayName=cdc_reco_tracks,
693 vxdTracksStoreArrayName=svd_reco_tracks,
694 relationCheckForDirection=direction,
695 reverseSeed=False,
696 firstHighFilterParameters={
697 "direction": direction},
698 advanceHighFilterParameters={
699 "direction": direction},
700 writeOutDirection=direction,
701 endEarly=False,
702 filter='mva_with_relations',
703 filterParameters=result_filter_parameters
704 )
705
706 path.add_module('RelatedTracksCombiner',
707 VXDRecoTracksStoreArrayName=svd_reco_tracks,
708 CDCRecoTracksStoreArrayName=cdc_reco_tracks,
709 recoTracksStoreArrayName=reco_tracks)
710
711 path.add_module('TrackFinderMCTruthRecoTracks',
712 RecoTracksStoreArrayName=mc_reco_tracks,
713 WhichParticles=[],
714 UsePXDHits=True,
715 UseSVDHits=True,
716 UseCDCHits=True)
717
718 path.add_module("MCRecoTracksMatcher", UsePXDHits=False, UseSVDHits=True, UseCDCHits=True,
719 mcRecoTracksStoreArrayName=mc_reco_tracks,
720 prRecoTracksStoreArrayName=reco_tracks)
721
722 path.add_module(
723 CombinedTrackingValidationModule(
724 output_file_name=self.get_output_file_name(
725 f"cdc_svd_merger_ckf_validation{fbdt_string}{self.result_filter_cut}.root"),
726 reco_tracks_name=reco_tracks,
727 mc_reco_tracks_name=mc_reco_tracks,
728 name="",
729 contact="",
730 expert_level=200))
731
732 return path
733

◆ create_path()

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

Definition at line 734 of file cdc_and_svd_ckf_merger_mva_training.py.

734 def create_path(self):
735 """
736 Create basf2 path to process with event generation and simulation.
737 """
738 return self.create_optimisation_and_validation_path()
739

◆ 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 614 of file cdc_and_svd_ckf_merger_mva_training.py.

614 def output(self):
615 """
616 Generate list of output files that the task should produce.
617 The task is considered finished if and only if the outputs all exist.
618 """
619 fbdt_string = create_fbdt_option_string(self.fast_bdt_option)
620 yield self.add_to_output(
621 f"cdc_svd_merger_ckf_validation{fbdt_string}{self.result_filter_cut}.root")
622

◆ remove_output()

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

Definition at line 740 of file cdc_and_svd_ckf_merger_mva_training.py.

740 def remove_output(self):
741 """
742 Default function from base b2luigi.Task class.
743 """
744 self._remove_output()
745
746

◆ requires()

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

Definition at line 623 of file cdc_and_svd_ckf_merger_mva_training.py.

623 def requires(self):
624 """
625 This task requires trained result filters, and that an independent data set for validation was created using the
626 ``SplitMergeSimTask`` with the random seed optimisation.
627 """
628 yield CKFResultFilterTeacherTask(
629 result_filter_records_name="filter_records.root",
630 experiment_number=self.experiment_number,
631 n_events_training=self.n_events_training,
632 fast_bdt_option=self.fast_bdt_option,
633 random_seed='training'
634 )
635 yield SplitNMergeSimTask(
636 bkgfiles_dir=SummaryTask.bkgfiles_by_exp[self.experiment_number],
637 experiment_number=self.experiment_number,
638 n_events=self.n_events_testing,
639 random_seed="optimisation",
640 )
641

Member Data Documentation

◆ batch_system

str batch_system = 'lsf'
staticinherited

batch system

Definition at line 177 of file cdc_and_svd_ckf_merger_mva_training.py.

◆ experiment_number

experiment_number = b2luigi.IntParameter()
static

Experiment number of the conditions database, e.g.

defines simulation geometry.

Definition at line 597 of file cdc_and_svd_ckf_merger_mva_training.py.

◆ fast_bdt_option

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

FastBDT option to use to train the StateFilters.

Definition at line 601 of file cdc_and_svd_ckf_merger_mva_training.py.

◆ job_name

job_name = self.task_id
inherited

set the job name (inherited variable)

Definition at line 185 of file cdc_and_svd_ckf_merger_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 607 of file cdc_and_svd_ckf_merger_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 599 of file cdc_and_svd_ckf_merger_mva_training.py.

◆ queue

str queue = 's'
staticinherited

queue

Definition at line 179 of file cdc_and_svd_ckf_merger_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 609 of file cdc_and_svd_ckf_merger_mva_training.py.


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