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

Public Member Functions

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

Static Public Attributes

b2luigi n_events = b2luigi.IntParameter()
 Number of events to generate.
 
b2luigi experiment_number = b2luigi.IntParameter()
 Experiment number of the conditions database, e.g.
 
b2luigi 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 793 of file combined_quality_estimator_teacher.py.

Member Function Documentation

◆ create_path()

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

Definition at line 878 of file combined_quality_estimator_teacher.py.

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

◆ get_input_files()

def 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 831 of file combined_quality_estimator_teacher.py.

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

◆ get_records_file_name()

def 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 811 of file combined_quality_estimator_teacher.py.

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

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

871 def output(self):
872 """
873 Generate list of output files that the task should produce.
874 The task is considered finished if and only if the outputs all exist.
875 """
876 yield self.add_to_output(self.get_records_file_name())
877

◆ requires()

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

Definition at line 854 of file combined_quality_estimator_teacher.py.

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

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

◆ n_events

b2luigi n_events = b2luigi.IntParameter()
static

Number of events to generate.

Definition at line 801 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 808 of file combined_quality_estimator_teacher.py.

◆ random_seed

b2luigi 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 806 of file combined_quality_estimator_teacher.py.


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