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

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

◆ create_path()

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

Definition at line 677 of file cdc_and_svd_ckf_merger_mva_training.py.

677 def create_path(self):
678 """
679 Create basf2 path to process with event generation and simulation.
680 """
681 return self.create_optimisation_and_validation_path()
682
683

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

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

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

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

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 540 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 544 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 550 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 542 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 552 of file cdc_and_svd_ckf_merger_mva_training.py.


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