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

Public Member Functions

def output_file_name (self, n_events=None, random_seed=None)
 Name of the ROOT output file with generated and simulated events.
 
def output (self)
 
def requires (self)
 
def process (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.
 
b2luigi bkgfiles_dir
 Directory with overlay background root files.
 
str queue = 'sx'
 specify queue.
 

Detailed Description

Generate simulated Monte Carlo with background overlay.

Make sure to use different ``random_seed`` parameters for the training data
format the classifier trainings and for the test data for the respective
evaluation/validation tasks.

Definition at line 550 of file combined_quality_estimator_teacher.py.

Member Function Documentation

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

587 def output(self):
588 """
589 Generate list of output files that the task should produce.
590 The task is considered finished if and only if the outputs all exist.
591 """
592 yield self.add_to_output(self.output_file_name())
593

◆ output_file_name()

def output_file_name (   self,
  n_events = None,
  random_seed = None 
)

Name of the ROOT output file with generated and simulated events.

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

Definition at line 576 of file combined_quality_estimator_teacher.py.

576 def output_file_name(self, n_events=None, random_seed=None):
577 """
578 Create output file name depending on number of events and production
579 mode that is specified in the random_seed string.
580 """
581 if n_events is None:
582 n_events = self.n_events
583 if random_seed is None:
584 random_seed = self.random_seed
585 return "generated_mc_N" + str(n_events) + "_" + random_seed + ".root"
586

◆ process()

def process (   self)
When all GenerateSimTasks finished, merge the output.

Definition at line 618 of file combined_quality_estimator_teacher.py.

618 def process(self):
619 """
620 When all GenerateSimTasks finished, merge the output.
621 """
622 create_output_dirs(self)
623
624 file_list = []
625 for _, file_name in self.get_input_file_names().items():
626 file_list.append(*file_name)
627 print("Merge the following files:")
628 print(file_list)
629 cmd = ["b2file-merge", "-f"]
630 args = cmd + [self.get_output_file_name(self.output_file_name())] + file_list
631 subprocess.check_call(args)
632 print("Finished merging. Now remove the input files to save space.")
633 cmd2 = ["rm", "-f"]
634 for tempfile in file_list:
635 args = cmd2 + [tempfile]
636 subprocess.check_call(args)
637
638

◆ requires()

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

Definition at line 594 of file combined_quality_estimator_teacher.py.

594 def requires(self):
595 """
596 Generate list of luigi Tasks that this Task depends on.
597 """
598 n_events_per_task = MasterTask.n_events_per_task
599 quotient, remainder = divmod(self.n_events, n_events_per_task)
600 for i in range(quotient):
601 yield GenerateSimTask(
602 bkgfiles_dir=self.bkgfiles_dir,
603 num_processes=MasterTask.num_processes,
604 random_seed=self.random_seed + '_' + str(i).zfill(3),
605 n_events=n_events_per_task,
606 experiment_number=self.experiment_number,
607 )
608 if remainder > 0:
609 yield GenerateSimTask(
610 bkgfiles_dir=self.bkgfiles_dir,
611 num_processes=MasterTask.num_processes,
612 random_seed=self.random_seed + '_' + str(quotient).zfill(3),
613 n_events=remainder,
614 experiment_number=self.experiment_number,
615 )
616

Member Data Documentation

◆ bkgfiles_dir

b2luigi bkgfiles_dir
static
Initial value:
= b2luigi.Parameter(
)

Directory with overlay background root files.

Definition at line 567 of file combined_quality_estimator_teacher.py.

◆ experiment_number

b2luigi experiment_number = b2luigi.IntParameter()
static

Experiment number of the conditions database, e.g.

defines simulation geometry

Definition at line 562 of file combined_quality_estimator_teacher.py.

◆ n_events

b2luigi n_events = b2luigi.IntParameter()
static

Number of events to generate.

Definition at line 560 of file combined_quality_estimator_teacher.py.

◆ queue

str queue = 'sx'
static

specify queue.

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

Definition at line 573 of file combined_quality_estimator_teacher.py.

◆ random_seed

b2luigi random_seed = b2luigi.Parameter()
static

Random basf2 seed.

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

Definition at line 565 of file combined_quality_estimator_teacher.py.


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