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

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 532 of file cdc_and_svd_ckf_merger_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 580 of file cdc_and_svd_ckf_merger_mva_training.py.

580 def create_optimisation_and_validation_path(self):
581 """
582 Create a path to validate the trained filters.
583 """
584 path = basf2.create_path()
585
586 # get all the file names from the list of input files that are meant for optimisation / validation
587 file_list = [fname for sublist in self.get_input_file_names().values()
588 for fname in sublist if "generated_mc_N" in fname and "optimisation" in fname and fname.endswith(".root")]
589 path.add_module("RootInput", inputFileNames=file_list)
590
591 path.add_module("Gearbox")
592 path.add_module("Geometry")
593 path.add_module("SetupGenfitExtrapolation")
594
595 add_hit_preparation_modules(path, components=["SVD"])
596
597 cdc_reco_tracks = "CDCRecoTracks"
598 svd_reco_tracks = "SVDRecoTracks"
599 reco_tracks = "RecoTracks"
600 mc_reco_tracks = "MCRecoTracks"
601
602 # CDC track finding and MC matching
603 add_cdc_track_finding(path, output_reco_tracks=cdc_reco_tracks)
604
605 path.add_module("DAFRecoFitter", recoTracksStoreArrayName=cdc_reco_tracks)
606
607 # SVD track finding and MC matching
608 add_svd_standalone_tracking(path, reco_tracks=svd_reco_tracks)
609
610 direction = "backward"
611 fbdt_string = create_fbdt_option_string(self.fast_bdt_option)
612 path.add_module(
613 "CDCToSVDSeedCKF",
614 inputRecoTrackStoreArrayName=cdc_reco_tracks,
615 fromRelationStoreArrayName=cdc_reco_tracks,
616 toRelationStoreArrayName=svd_reco_tracks,
617 relatedRecoTrackStoreArrayName=svd_reco_tracks,
618 cdcTracksStoreArrayName=cdc_reco_tracks,
619 vxdTracksStoreArrayName=svd_reco_tracks,
620 relationCheckForDirection=direction,
621 reverseSeed=False,
622 firstHighFilterParameters={
623 "direction": direction},
624 advanceHighFilterParameters={
625 "direction": direction},
626 writeOutDirection=direction,
627 endEarly=False,
628 filter='mva_with_relations',
629 filterParameters={
630 "identifier": self.get_input_file_names(f"trk_CDCToSVDSeedResultFilter{fbdt_string}.xml")[0],
631 "cut": self.result_filter_cut})
632
633 path.add_module('RelatedTracksCombiner',
634 VXDRecoTracksStoreArrayName=svd_reco_tracks,
635 CDCRecoTracksStoreArrayName=cdc_reco_tracks,
636 recoTracksStoreArrayName=reco_tracks)
637
638 path.add_module('TrackFinderMCTruthRecoTracks',
639 RecoTracksStoreArrayName=mc_reco_tracks,
640 WhichParticles=[],
641 UsePXDHits=True,
642 UseSVDHits=True,
643 UseCDCHits=True)
644
645 path.add_module("MCRecoTracksMatcher", UsePXDHits=False, UseSVDHits=True, UseCDCHits=True,
646 mcRecoTracksStoreArrayName=mc_reco_tracks,
647 prRecoTracksStoreArrayName=reco_tracks)
648
649 path.add_module(
650 CombinedTrackingValidationModule(
651 output_file_name=self.get_output_file_name(
652 f"cdc_svd_merger_ckf_validation{fbdt_string}_{self.result_filter_cut}.root"),
653 reco_tracks_name=reco_tracks,
654 mc_reco_tracks_name=mc_reco_tracks,
655 name="",
656 contact="",
657 expert_level=200))
658
659 return path
660

◆ create_path()

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

Definition at line 661 of file cdc_and_svd_ckf_merger_mva_training.py.

661 def create_path(self):
662 """
663 Create basf2 path to process with event generation and simulation.
664 """
665 return self.create_optimisation_and_validation_path()
666
667

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

552 def output(self):
553 """
554 Generate list of output files that the task should produce.
555 The task is considered finished if and only if the outputs all exist.
556 """
557 fbdt_string = create_fbdt_option_string(self.fast_bdt_option)
558 yield self.add_to_output(
559 f"cdc_svd_merger_ckf_validation{fbdt_string}_{self.result_filter_cut}.root")
560

◆ requires()

def 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 561 of file cdc_and_svd_ckf_merger_mva_training.py.

561 def requires(self):
562 """
563 This task requires trained result filters, and that an independent data set for validation was created using the
564 ``SplitMergeSimTask`` with the random seed optimisation.
565 """
566 yield CKFResultFilterTeacherTask(
567 result_filter_records_name="filter_records.root",
568 experiment_number=self.experiment_number,
569 n_events_training=self.n_events_training,
570 fast_bdt_option=self.fast_bdt_option,
571 random_seed='training'
572 )
573 yield SplitNMergeSimTask(
574 bkgfiles_dir=MainTask.bkgfiles_by_exp[self.experiment_number],
575 experiment_number=self.experiment_number,
576 n_events=self.n_events_testing,
577 random_seed="optimisation",
578 )
579

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

◆ fast_bdt_option

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

FastBDT option to use to train the StateFilters.

Definition at line 542 of file cdc_and_svd_ckf_merger_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 548 of file cdc_and_svd_ckf_merger_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 540 of file cdc_and_svd_ckf_merger_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 550 of file cdc_and_svd_ckf_merger_mva_training.py.


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