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

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 VXDTF2 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 VXD track quality estimator

Definition at line 660 of file combined_quality_estimator_teacher.py.

Member Function Documentation

◆ create_path()

create_path ( self)
Create basf2 path with VXDTF2 tracking and VXD QE data collection.

Definition at line 746 of file combined_quality_estimator_teacher.py.

746 def create_path(self):
747 """
748 Create basf2 path with VXDTF2 tracking and VXD QE data collection.
749 """
750 path = basf2.create_path()
751 inputFileNames = self.get_input_files()
752 path.add_module(
753 "RootInput",
754 inputFileNames=inputFileNames,
755 )
756 path.add_module("Gearbox")
757 tracking.add_geometry_modules(path)
758 if 'DATA' in self.random_seed:
759 from rawdata import add_unpackers
760 add_unpackers(path, components=['SVD', 'PXD'])
761 tracking.add_hit_preparation_modules(path)
762 add_vxd_track_finding_vxdtf2(
763 path, components=["SVD"], add_mva_quality_indicator=False
764 )
765 if 'DATA' in self.random_seed:
766 path.add_module(
767 "VXDQETrainingDataCollector",
768 TrainingDataOutputName=self.get_output_file_name(self.get_records_file_name()),
769 SpacePointTrackCandsStoreArrayName="SPTrackCands",
770 EstimationMethod="tripletFit",
771 UseTimingInfo=False,
772 ClusterInformation="Average",
773 MCStrictQualityEstimator=False,
774 mva_target=False,
775 MCInfo=False,
776 )
777 else:
778 path.add_module(
779 "TrackFinderMCTruthRecoTracks",
780 RecoTracksStoreArrayName="MCRecoTracks",
781 WhichParticles=[],
782 UsePXDHits=False,
783 UseSVDHits=True,
784 UseCDCHits=False,
785 )
786 path.add_module(
787 "VXDQETrainingDataCollector",
788 TrainingDataOutputName=self.get_output_file_name(self.get_records_file_name()),
789 SpacePointTrackCandsStoreArrayName="SPTrackCands",
790 EstimationMethod="tripletFit",
791 UseTimingInfo=False,
792 ClusterInformation="Average",
793 MCStrictQualityEstimator=True,
794 mva_target=False,
795 )
796 return path
797
798

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

699 def get_input_files(self, n_events=None, random_seed=None):
700 """
701 Get input file names depending on the use case: If they already exist, search in
702 the corresponding folders, for data check the specified list and if they are created
703 in the same run, check for the task that produced them.
704 """
705 if n_events is None:
706 n_events = self.n_events
707 if random_seed is None:
708 random_seed = self.random_seed
709 if "USESIM" in random_seed:
710 if 'USESIMBB' in random_seed:
711 random_seed = 'BBBAR_' + random_seed.split("_", 1)[1]
712 elif 'USESIMEE' in random_seed:
713 random_seed = 'BHABHA_' + random_seed.split("_", 1)[1]
714 return ['datafiles/' + GenerateSimTask.output_file_name(GenerateSimTask,
715 n_events=n_events, random_seed=random_seed)]
716 elif "DATA" in random_seed:
717 return MasterTask.datafiles
718 else:
719 return self.get_input_file_names(GenerateSimTask.output_file_name(
720 GenerateSimTask, n_events=n_events, random_seed=random_seed))
721

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

679 def get_records_file_name(self, n_events=None, random_seed=None):
680 """
681 Create output file name depending on number of events and production
682 mode that is specified in the random_seed string.
683 """
684 if n_events is None:
685 n_events = self.n_events
686 if random_seed is None:
687 random_seed = self.random_seed
688 if 'vxd' not in random_seed:
689 random_seed += '_vxd'
690 if 'DATA' in random_seed:
691 return 'qe_records_DATA_vxd.root'
692 else:
693 if 'USESIMBB' in random_seed:
694 random_seed = 'BBBAR_' + random_seed.split("_", 1)[1]
695 elif 'USESIMEE' in random_seed:
696 random_seed = 'BHABHA_' + random_seed.split("_", 1)[1]
697 return 'qe_records_N' + str(n_events) + '_' + random_seed + '.root'
698

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

739 def output(self):
740 """
741 Generate list of output files that the task should produce.
742 The task is considered finished if and only if the outputs all exist.
743 """
744 yield self.add_to_output(self.get_records_file_name())
745

◆ requires()

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

Definition at line 722 of file combined_quality_estimator_teacher.py.

722 def requires(self):
723 """
724 Generate list of luigi Tasks that this Task depends on.
725 """
726 if "USESIM" in self.random_seed or "DATA" in self.random_seed:
727 for filename in self.get_input_files():
728 yield CheckExistingFile(
729 filename=filename,
730 )
731 else:
732 yield SplitNMergeSimTask(
733 bkgfiles_dir=MasterTask.bkgfiles_by_exp[self.experiment_number],
734 random_seed=self.random_seed,
735 n_events=self.n_events,
736 experiment_number=self.experiment_number,
737 )
738

Member Data Documentation

◆ experiment_number

experiment_number = b2luigi.IntParameter()
static

Experiment number of the conditions database, e.g.

defines simulation geometry

Definition at line 671 of file combined_quality_estimator_teacher.py.

◆ n_events

n_events = b2luigi.IntParameter()
static

Number of events to generate.

Definition at line 669 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 676 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 674 of file combined_quality_estimator_teacher.py.


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