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

 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.
 
str cdc_training_target = "truth"
 Feature/variable to use as truth label for the CDC track quality estimator.
 

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 1784 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 1842 of file combined_quality_estimator_teacher.py.

1842 def add_tracking_with_quality_estimation(self, path):
1843 """
1844 Add modules for reco tracking with all track quality estimators to basf2 path.
1845 """
1846 # add tracking reconstruction with quality estimator modules added
1847 tracking.add_tracking_reconstruction(
1848 path,
1849 add_cdcTrack_QI=True,
1850 add_vxdTrack_QI=True,
1851 add_recoTrack_QI=True,
1852 skipGeometryAdding=True,
1853 skipHitPreparerAdding=True,
1854 )
1855
1856 name = 'TrackingMVAFilterParameters'
1857 cdc_qe_mva_filter_parameters = {'DBPayloadName': name}
1858 basf2.set_module_parameters(
1859 path,
1860 name="TFCDC_TrackQualityEstimator",
1861 filterParameters=cdc_qe_mva_filter_parameters,
1862 deactivateIfDeadBoard=False, # original behavior before deactivateIfDeadBoard was introduced
1863 )
1864 vxd_name = 'VXDQualityEstimatorMVA'
1865 basf2.set_module_parameters(
1866 path,
1867 name="VXDQualityEstimatorMVA",
1868 WeightFileIdentifier=vxd_name,
1869 )
1870 recotrack_name = 'TrackQualityEstimatorMVA'
1871 basf2.set_module_parameters(
1872 path,
1873 name="TrackQualityEstimatorMVA",
1874 WeightFileIdentifier=recotrack_name,
1875 )
1876
1877

◆ 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 1604 of file combined_quality_estimator_teacher.py.

1604 def create_path(self):
1605 """
1606 Create a basf2 path that uses ``add_tracking_with_quality_estimation()``
1607 and adds the ``CombinedTrackingValidationModule`` to write out variables
1608 for validation.
1609 """
1610 basf2.conditions.prepend_testing_payloads("localdb/database.txt")
1611 # prepare track finding
1612 path = basf2.create_path()
1613 if 'USE' in self.process_type:
1614 if 'BB' in self.process_type:
1615 process = 'BBBAR'
1616 elif 'EE' in self.process_type:
1617 process = 'BHABHA'
1618 inputFileNames = ['datafiles/generated_mc_N' + str(self.n_events_testing) + '_' + process + '_test.root']
1619 else:
1620 inputFileNames = self.get_input_file_names(GenerateSimTask.output_file_name(
1621 GenerateSimTask, n_events=self.n_events_testing, random_seed=self.process_type + '_test'))
1622 path.add_module(
1623 "RootInput",
1624 inputFileNames=inputFileNames,
1625 )
1626 path.add_module("Gearbox")
1627 tracking.add_geometry_modules(path)
1628 tracking.add_hit_preparation_modules(path) # only needed for simulated hits
1629 # add track finding module that needs to be validated
1630 self.add_tracking_with_quality_estimation(path)
1631 # add modules for validation
1632 path.add_module(
1633 CombinedTrackingValidationModule(
1634 name=None,
1635 contact=None,
1636 expert_level=200,
1637 output_file_name=self.get_output_file_name(
1638 self.validation_output_file_name
1639 ),
1640 )
1641 )
1642 path.add_module(
1643 "RootOutput",
1644 outputFileName=self.get_output_file_name(self.reco_output_file_name),
1645 )
1646 return path
1647
1648

◆ 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 1596 of file combined_quality_estimator_teacher.py.

1596 def output(self):
1597 """
1598 Generate list of output files that the task should produce.
1599 The task is considered finished if and only if the outputs all exist.
1600 """
1601 yield self.add_to_output(self.validation_output_file_name)
1602 yield self.add_to_output(self.reco_output_file_name)
1603

◆ requires()

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

Reimplemented from HarvestingValidationBaseTask.

Definition at line 1798 of file combined_quality_estimator_teacher.py.

1798 def requires(self):
1799 """
1800 Generate list of luigi Tasks that this Task depends on.
1801 """
1802 yield CDCQETeacherTask(
1803 n_events_training=self.n_events_training,
1804 experiment_number=self.experiment_number,
1805 process_type=self.process_type,
1806 training_target=self.cdc_training_target,
1807 exclude_variables=MasterTask.exclude_variables_cdc,
1808 fast_bdt_option=self.fast_bdt_option,
1809 )
1810 yield VXDQETeacherTask(
1811 n_events_training=self.n_events_training,
1812 experiment_number=self.experiment_number,
1813 process_type=self.process_type,
1814 exclude_variables=MasterTask.exclude_variables_vxd,
1815 fast_bdt_option=self.fast_bdt_option,
1816 )
1817
1818 yield self.teacher_task(
1819 n_events_training=self.n_events_training,
1820 experiment_number=self.experiment_number,
1821 process_type=self.process_type,
1822 exclude_variables=self.exclude_variables,
1823 cdc_training_target=self.cdc_training_target,
1824 fast_bdt_option=self.fast_bdt_option,
1825 )
1826 if 'USE' in self.process_type: # USESIM and USEREC
1827 if 'BB' in self.process_type:
1828 process = 'BBBAR'
1829 elif 'EE' in self.process_type:
1830 process = 'BHABHA'
1831 yield CheckExistingFile(
1832 filename='datafiles/generated_mc_N' + str(self.n_events_testing) + '_' + process + '_test.root'
1833 )
1834 else:
1835 yield SplitNMergeSimTask(
1836 bkgfiles_dir=MasterTask.bkgfiles_by_exp[self.experiment_number],
1837 random_seed=self.process_type + '_test',
1838 n_events=self.n_events_testing,
1839 experiment_number=self.experiment_number,
1840 )
1841

◆ 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 1555 of file combined_quality_estimator_teacher.py.

1555 def teacher_task(self) -> TrackQETeacherBaseTask:
1556 """
1557 Teacher task to require to provide a quality estimator weightfile for ``add_tracking_with_quality_estimation``
1558 """
1559 raise NotImplementedError()
1560

Member Data Documentation

◆ cdc_training_target

str cdc_training_target = "truth"
staticinherited

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

Definition at line 1552 of file combined_quality_estimator_teacher.py.

◆ components

components = None
staticinherited

Components for the MC matching and track fit creation.

Definition at line 1550 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 1534 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 1523 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 1540 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 1519 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 1521 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 1527 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 1548 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 1546 of file combined_quality_estimator_teacher.py.


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