Belle II Software development
RecoTrackQEHarvestingValidationTask Class Reference
Inheritance diagram for RecoTrackQEHarvestingValidationTask:
HarvestingValidationBaseTask

Public Member Functions

 requires (self)
 
 add_tracking_with_quality_estimation (self, path)
 
TrackQETeacherBaseTask teacher_task (self)
 
 output (self)
 
 create_path (self)
 

Static Public Attributes

 cdc_training_target = b2luigi.Parameter()
 Feature/variable to use as truth label for the CDC track quality estimator.
 
 n_events_testing = b2luigi.IntParameter()
 Number of events to generate for the test data set.
 
 n_events_training = b2luigi.IntParameter()
 Number of events to generate for the training data set.
 
 experiment_number = b2luigi.IntParameter()
 Experiment number of the conditions database, e.g.
 
# USESIM and USEREC process_type
 Define which kind of process shall be used.
 
 exclude_variables
 List of collected variables to not use in the training of the QE MVA classifier.
 
 fast_bdt_option
 Hyperparameter option of the FastBDT algorithm.
 
str validation_output_file_name = "harvesting_validation.root"
 Name of the "harvested" ROOT output file with variables that can be used for validation.
 
str reco_output_file_name = "reconstruction.root"
 Name of the output of the RootOutput module with reconstructed events.
 
 components = None
 Components for the MC matching and track fit creation.
 

Detailed Description

Run track reconstruction and write out (="harvest") a root file with variables useful for validation of the MVA track Quality Estimator.

Definition at line 1648 of file combined_quality_estimator_teacher.py.

Member Function Documentation

◆ add_tracking_with_quality_estimation()

add_tracking_with_quality_estimation ( self,
path )
Add modules for reco tracking with all track quality estimators to basf2 path.

Reimplemented from HarvestingValidationBaseTask.

Definition at line 1706 of file combined_quality_estimator_teacher.py.

1706 def add_tracking_with_quality_estimation(self, path):
1707 """
1708 Add modules for reco tracking with all track quality estimators to basf2 path.
1709 """
1710
1711 # add tracking reconstruction with quality estimator modules added
1712 tracking.add_tracking_reconstruction(
1713 path,
1714 add_cdcTrack_QI=True,
1715 add_vxdTrack_QI=True,
1716 add_recoTrack_QI=True,
1717 skipGeometryAdding=True,
1718 skipHitPreparerAdding=False,
1719 )
1720
1721 # Replace the weightfiles of all quality estimator modules by those
1722 # produced in the training by b2luigi
1723 cdc_qe_mva_filter_parameters = {
1724 "identifier": self.get_input_file_names(
1725 CDCQETeacherTask.get_weightfile_xml_identifier(
1726 CDCQETeacherTask,
1727 fast_bdt_option=self.fast_bdt_option))[0]}
1728 basf2.set_module_parameters(
1729 path,
1730 name="TFCDC_TrackQualityEstimator",
1731 filterParameters=cdc_qe_mva_filter_parameters,
1732 )
1733 basf2.set_module_parameters(
1734 path,
1735 name="VXDQualityEstimatorMVA",
1736 WeightFileIdentifier=self.get_input_file_names(
1737 VXDQETeacherTask.get_weightfile_xml_identifier(VXDQETeacherTask, fast_bdt_option=self.fast_bdt_option)
1738 )[0],
1739 )
1740 basf2.set_module_parameters(
1741 path,
1742 name="TrackQualityEstimatorMVA",
1743 WeightFileIdentifier=self.get_input_file_names(
1744 RecoTrackQETeacherTask.get_weightfile_xml_identifier(RecoTrackQETeacherTask, fast_bdt_option=self.fast_bdt_option)
1745 )[0],
1746 )
1747
1748

◆ create_path()

create_path ( self)
inherited
Create a basf2 path that uses ``add_tracking_with_quality_estimation()`` and adds the ``CombinedTrackingValidationModule`` to write out variables for validation.

Definition at line 1501 of file combined_quality_estimator_teacher.py.

1501 def create_path(self):
1502 """
1503 Create a basf2 path that uses ``add_tracking_with_quality_estimation()``
1504 and adds the ``CombinedTrackingValidationModule`` to write out variables
1505 for validation.
1506 """
1507 # prepare track finding
1508 path = basf2.create_path()
1509 if 'USE' in self.process_type:
1510 if 'BB' in self.process_type:
1511 process = 'BBBAR'
1512 elif 'EE' in self.process_type:
1513 process = 'BHABHA'
1514 inputFileNames = ['datafiles/generated_mc_N' + str(self.n_events_testing) + '_' + process + '_test.root']
1515 else:
1516 inputFileNames = self.get_input_file_names(GenerateSimTask.output_file_name(
1517 GenerateSimTask, n_events=self.n_events_testing, random_seed=self.process_type + '_test'))
1518 path.add_module(
1519 "RootInput",
1520 inputFileNames=inputFileNames,
1521 )
1522 path.add_module("Gearbox")
1523 tracking.add_geometry_modules(path)
1524 tracking.add_hit_preparation_modules(path) # only needed for simulated hits
1525 # add track finding module that needs to be validated
1526 self.add_tracking_with_quality_estimation(path)
1527 # add modules for validation
1528 path.add_module(
1529 CombinedTrackingValidationModule(
1530 name=None,
1531 contact=None,
1532 expert_level=200,
1533 output_file_name=self.get_output_file_name(
1534 self.validation_output_file_name
1535 ),
1536 )
1537 )
1538 path.add_module(
1539 "RootOutput",
1540 outputFileName=self.get_output_file_name(self.reco_output_file_name),
1541 )
1542 return path
1543
1544

◆ output()

output ( self)
inherited
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 1493 of file combined_quality_estimator_teacher.py.

1493 def output(self):
1494 """
1495 Generate list of output files that the task should produce.
1496 The task is considered finished if and only if the outputs all exist.
1497 """
1498 yield self.add_to_output(self.validation_output_file_name)
1499 yield self.add_to_output(self.reco_output_file_name)
1500

◆ requires()

requires ( self)
Generate list of luigi Tasks that this Task depends on.

Reimplemented from HarvestingValidationBaseTask.

Definition at line 1662 of file combined_quality_estimator_teacher.py.

1662 def requires(self):
1663 """
1664 Generate list of luigi Tasks that this Task depends on.
1665 """
1666 yield CDCQETeacherTask(
1667 n_events_training=self.n_events_training,
1668 experiment_number=self.experiment_number,
1669 process_type=self.process_type,
1670 training_target=self.cdc_training_target,
1671 exclude_variables=MasterTask.exclude_variables_cdc,
1672 fast_bdt_option=self.fast_bdt_option,
1673 )
1674 yield VXDQETeacherTask(
1675 n_events_training=self.n_events_training,
1676 experiment_number=self.experiment_number,
1677 process_type=self.process_type,
1678 exclude_variables=MasterTask.exclude_variables_vxd,
1679 fast_bdt_option=self.fast_bdt_option,
1680 )
1681
1682 yield self.teacher_task(
1683 n_events_training=self.n_events_training,
1684 experiment_number=self.experiment_number,
1685 process_type=self.process_type,
1686 exclude_variables=self.exclude_variables,
1687 cdc_training_target=self.cdc_training_target,
1688 fast_bdt_option=self.fast_bdt_option,
1689 )
1690 if 'USE' in self.process_type: # USESIM and USEREC
1691 if 'BB' in self.process_type:
1692 process = 'BBBAR'
1693 elif 'EE' in self.process_type:
1694 process = 'BHABHA'
1695 yield CheckExistingFile(
1696 filename='datafiles/generated_mc_N' + str(self.n_events_testing) + '_' + process + '_test.root'
1697 )
1698 else:
1699 yield SplitNMergeSimTask(
1700 bkgfiles_dir=MasterTask.bkgfiles_by_exp[self.experiment_number],
1701 random_seed=self.process_type + '_test',
1702 n_events=self.n_events_testing,
1703 experiment_number=self.experiment_number,
1704 )
1705

◆ teacher_task()

TrackQETeacherBaseTask teacher_task ( self)
inherited
Teacher task to require to provide a quality estimator weightfile for ``add_tracking_with_quality_estimation``

Definition at line 1452 of file combined_quality_estimator_teacher.py.

1452 def teacher_task(self) -> TrackQETeacherBaseTask:
1453 """
1454 Teacher task to require to provide a quality estimator weightfile for ``add_tracking_with_quality_estimation``
1455 """
1456 raise NotImplementedError()
1457

Member Data Documentation

◆ cdc_training_target

cdc_training_target = b2luigi.Parameter()
static

Feature/variable to use as truth label for the CDC track quality estimator.

Definition at line 1654 of file combined_quality_estimator_teacher.py.

◆ components

components = None
staticinherited

Components for the MC matching and track fit creation.

Definition at line 1449 of file combined_quality_estimator_teacher.py.

◆ exclude_variables

exclude_variables
staticinherited
Initial value:
= b2luigi.ListParameter(
)

List of collected variables to not use in the training of the QE MVA classifier.

In addition to variables containing the "truth" substring, which are excluded by default.

Definition at line 1433 of file combined_quality_estimator_teacher.py.

◆ experiment_number

experiment_number = b2luigi.IntParameter()
staticinherited

Experiment number of the conditions database, e.g.

defines simulation geometry

Definition at line 1422 of file combined_quality_estimator_teacher.py.

◆ fast_bdt_option

fast_bdt_option
staticinherited
Initial value:
= b2luigi.ListParameter(
)

Hyperparameter option of the FastBDT algorithm.

default are the FastBDT default values.

Definition at line 1439 of file combined_quality_estimator_teacher.py.

◆ n_events_testing

n_events_testing = b2luigi.IntParameter()
staticinherited

Number of events to generate for the test data set.

Definition at line 1418 of file combined_quality_estimator_teacher.py.

◆ n_events_training

n_events_training = b2luigi.IntParameter()
staticinherited

Number of events to generate for the training data set.

Definition at line 1420 of file combined_quality_estimator_teacher.py.

◆ process_type

# USESIM and USEREC process_type
staticinherited
Initial value:
= b2luigi.Parameter(
)

Define which kind of process shall be used.

Decide between simulating BBBAR or BHABHA, MUMU, YY, DDBAR, UUBAR, SSBAR, CCBAR, reconstructing DATA or already simulated files (USESIMBB/EE) or running on existing reconstructed files (USERECBB/EE)

Definition at line 1426 of file combined_quality_estimator_teacher.py.

◆ reco_output_file_name

reco_output_file_name = "reconstruction.root"
staticinherited

Name of the output of the RootOutput module with reconstructed events.

Definition at line 1447 of file combined_quality_estimator_teacher.py.

◆ validation_output_file_name

validation_output_file_name = "harvesting_validation.root"
staticinherited

Name of the "harvested" ROOT output file with variables that can be used for validation.

Definition at line 1445 of file combined_quality_estimator_teacher.py.


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