Belle II Software development
CDCQEDataCollectionTask Class Reference
Inheritance diagram for CDCQEDataCollectionTask:

Public Member Functions

 get_records_file_name (self, n_events=None, random_seed=None)
 Filename of the recorded/collected data for the final QE MVA training.
 
 get_input_files (self, n_events=None, random_seed=None)
 
 requires (self)
 
 output (self)
 
 create_path (self)
 

Static Public Attributes

 n_events = b2luigi.IntParameter()
 Number of events to generate.
 
 experiment_number = b2luigi.IntParameter()
 Experiment number of the conditions database, e.g.
 
 random_seed = b2luigi.Parameter()
 Random basf2 seed used by the GenerateSimTask.
 
str queue = 'l'
 specify queue.
 

Detailed Description

Collect variables/features from CDC tracking and write them to a ROOT file.

These variables are to be used as labelled training data for the MVA
classifier which is the CDC track quality estimator

Definition at line 799 of file combined_quality_estimator_teacher.py.

Member Function Documentation

◆ create_path()

create_path ( self)
Create basf2 path with CDC standalone tracking and CDC QE with recording filter for MVA feature collection.

Definition at line 884 of file combined_quality_estimator_teacher.py.

884 def create_path(self):
885 """
886 Create basf2 path with CDC standalone tracking and CDC QE with recording filter for MVA feature collection.
887 """
888 path = basf2.create_path()
889 inputFileNames = self.get_input_files()
890 path.add_module(
891 "RootInput",
892 inputFileNames=inputFileNames,
893 )
894 path.add_module("Gearbox")
895 tracking.add_geometry_modules(path)
896 if 'DATA' in self.random_seed:
897 filter_choice = "recording_data"
898 from rawdata import add_unpackers
899 add_unpackers(path, components=['CDC'])
900 else:
901 filter_choice = "recording"
902 # tracking.add_hit_preparation_modules(path) # only needed for SVD and
903 # PXD hit preparation. Does not change the CDC output.
904 add_cdc_track_finding(path, add_mva_quality_indicator=True)
905 basf2.set_module_parameters(
906 path,
907 name="TFCDC_TrackQualityEstimator",
908 filter=filter_choice,
909 filterParameters={
910 "rootFileName": self.get_output_file_name(self.get_records_file_name())
911 },
912 deactivateIfDeadBoard=False # original behavior before deactivateIfDeadBoard was introduced
913 )
914 return path
915
916

◆ get_input_files()

get_input_files ( self,
n_events = None,
random_seed = None )
Get input file names depending on the use case: If they already exist, search in
the corresponding folders, for data check the specified list and if they are created
in the same run, check for the task that produced them.

Definition at line 837 of file combined_quality_estimator_teacher.py.

837 def get_input_files(self, n_events=None, random_seed=None):
838 """
839 Get input file names depending on the use case: If they already exist, search in
840 the corresponding folders, for data check the specified list and if they are created
841 in the same run, check for the task that produced them.
842 """
843 if n_events is None:
844 n_events = self.n_events
845 if random_seed is None:
846 random_seed = self.random_seed
847 if "USESIM" in random_seed:
848 if 'USESIMBB' in random_seed:
849 random_seed = 'BBBAR_' + random_seed.split("_", 1)[1]
850 elif 'USESIMEE' in random_seed:
851 random_seed = 'BHABHA_' + random_seed.split("_", 1)[1]
852 return ['datafiles/' + GenerateSimTask.output_file_name(GenerateSimTask,
853 n_events=n_events, random_seed=random_seed)]
854 elif "DATA" in random_seed:
855 return MasterTask.datafiles
856 else:
857 return self.get_input_file_names(GenerateSimTask.output_file_name(
858 GenerateSimTask, n_events=n_events, random_seed=random_seed))
859

◆ get_records_file_name()

get_records_file_name ( self,
n_events = None,
random_seed = None )

Filename of the recorded/collected data for the final QE MVA training.

Create output file name depending on number of events and production
mode that is specified in the random_seed string.

Definition at line 817 of file combined_quality_estimator_teacher.py.

817 def get_records_file_name(self, n_events=None, random_seed=None):
818 """
819 Create output file name depending on number of events and production
820 mode that is specified in the random_seed string.
821 """
822 if n_events is None:
823 n_events = self.n_events
824 if random_seed is None:
825 random_seed = self.random_seed
826 if 'cdc' not in random_seed:
827 random_seed += '_cdc'
828 if 'DATA' in random_seed:
829 return 'qe_records_DATA_cdc.root'
830 else:
831 if 'USESIMBB' in random_seed:
832 random_seed = 'BBBAR_' + random_seed.split("_", 1)[1]
833 elif 'USESIMEE' in random_seed:
834 random_seed = 'BHABHA_' + random_seed.split("_", 1)[1]
835 return 'qe_records_N' + str(n_events) + '_' + random_seed + '.root'
836

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

877 def output(self):
878 """
879 Generate list of output files that the task should produce.
880 The task is considered finished if and only if the outputs all exist.
881 """
882 yield self.add_to_output(self.get_records_file_name())
883

◆ requires()

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

Definition at line 860 of file combined_quality_estimator_teacher.py.

860 def requires(self):
861 """
862 Generate list of luigi Tasks that this Task depends on.
863 """
864 if "USESIM" in self.random_seed or "DATA" in self.random_seed:
865 for filename in self.get_input_files():
866 yield CheckExistingFile(
867 filename=filename,
868 )
869 else:
870 yield SplitNMergeSimTask(
871 bkgfiles_dir=MasterTask.bkgfiles_by_exp[self.experiment_number],
872 random_seed=self.random_seed,
873 n_events=self.n_events,
874 experiment_number=self.experiment_number,
875 )
876

Member Data Documentation

◆ experiment_number

experiment_number = b2luigi.IntParameter()
static

Experiment number of the conditions database, e.g.

defines simulation geometry

Definition at line 809 of file combined_quality_estimator_teacher.py.

◆ n_events

n_events = b2luigi.IntParameter()
static

Number of events to generate.

Definition at line 807 of file combined_quality_estimator_teacher.py.

◆ queue

str queue = 'l'
static

specify queue.

E.g. choose between 'l' (long), 's' (short) or 'sx' (short, extra ram)

Definition at line 814 of file combined_quality_estimator_teacher.py.

◆ random_seed

random_seed = b2luigi.Parameter()
static

Random basf2 seed used by the GenerateSimTask.

It is further used to read of the production process to preserve clearness in the b2luigi output.

Definition at line 812 of file combined_quality_estimator_teacher.py.


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