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

Public Member Functions

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

Member Function Documentation

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

595 def output(self):
596 """
597 Generate list of output files that the task should produce.
598 The task is considered finished if and only if the outputs all exist.
599 """
600 yield self.add_to_output(self.output_file_name())
601

◆ output_file_name()

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

584 def output_file_name(self, n_events=None, random_seed=None):
585 """
586 Create output file name depending on number of events and production
587 mode that is specified in the random_seed string.
588 """
589 if n_events is None:
590 n_events = self.n_events
591 if random_seed is None:
592 random_seed = self.random_seed
593 return "generated_mc_N" + str(n_events) + "_" + random_seed + ".root"
594

◆ process()

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

Definition at line 626 of file combined_quality_estimator_teacher.py.

626 def process(self):
627 """
628 When all GenerateSimTasks finished, merge the output.
629 """
630 file_list = self.get_all_input_file_names()
631 file_list = flat(file_list)
632 print("Merge the following files:\n")
633 print(file_list)
634 cmd = ["b2file-merge", "-f"]
635 args = cmd + [self.get_output_file_name(self.output_file_name())] + file_list
636 print(f"args to merge: {args}")
637 subprocess.check_call(args)
638 print("Finished merging. Removing the input files to save space.")
639 cmd2 = ["rm", "-f"]
640 args = cmd2 + file_list
641 print(f"args for deleting: {args}")
642 subprocess.check_call(args)
643
644

◆ requires()

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

Definition at line 602 of file combined_quality_estimator_teacher.py.

602 def requires(self):
603 """
604 Generate list of luigi Tasks that this Task depends on.
605 """
606 n_events_per_task = MasterTask.n_events_per_task
607 quotient, remainder = divmod(self.n_events, n_events_per_task)
608 for i in range(quotient):
609 yield GenerateSimTask(
610 bkgfiles_dir=self.bkgfiles_dir,
611 num_processes=MasterTask.num_processes,
612 random_seed=self.random_seed + '_' + str(i).zfill(3),
613 n_events=n_events_per_task,
614 experiment_number=self.experiment_number,
615 )
616 if remainder > 0:
617 yield GenerateSimTask(
618 bkgfiles_dir=self.bkgfiles_dir,
619 num_processes=MasterTask.num_processes,
620 random_seed=self.random_seed + '_' + str(quotient).zfill(3),
621 n_events=remainder,
622 experiment_number=self.experiment_number,
623 )
624

Member Data Documentation

◆ bkgfiles_dir

bkgfiles_dir
static
Initial value:
= b2luigi.Parameter(
)

Directory with overlay background root files.

Definition at line 575 of file combined_quality_estimator_teacher.py.

◆ experiment_number

experiment_number = b2luigi.IntParameter()
static

Experiment number of the conditions database, e.g.

defines simulation geometry

Definition at line 570 of file combined_quality_estimator_teacher.py.

◆ n_events

n_events = b2luigi.IntParameter()
static

Number of events to generate.

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

◆ random_seed

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


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