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 experiment_number = b2luigi.IntParameter()
 Experiment number of the conditions database, e.g.
 
b2luigi random_seed = b2luigi.Parameter()
 Random basf2 seed.
 
b2luigi n_events = b2luigi.IntParameter()
 Number of events to generate.
 
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 256 of file combined_to_pxd_ckf_mva_training.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 296 of file combined_to_pxd_ckf_mva_training.py.

296 def output(self):
297 """
298 Generate list of output files that the task should produce.
299 The task is considered finished if and only if the outputs all exist.
300 """
301 yield self.add_to_output(self.output_file_name())
302

◆ 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.

:param n_events: Number of events to simulate.
:param random_seed: Random seed to use for the simulation to create independent samples.

Definition at line 282 of file combined_to_pxd_ckf_mva_training.py.

282 def output_file_name(self, n_events=None, random_seed=None):
283 """
284 Create output file name depending on number of events and production
285 mode that is specified in the random_seed string.
286
287 :param n_events: Number of events to simulate.
288 :param random_seed: Random seed to use for the simulation to create independent samples.
289 """
290 if n_events is None:
291 n_events = self.n_events
292 if random_seed is None:
293 random_seed = self.random_seed
294 return "generated_mc_N" + str(n_events) + "_" + random_seed + ".root"
295

◆ process()

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

Definition at line 327 of file combined_to_pxd_ckf_mva_training.py.

327 def process(self):
328 """
329 When all GenerateSimTasks finished, merge the output.
330 """
331 create_output_dirs(self)
332
333 file_list = [item for sublist in self.get_input_file_names().values() for item in sublist]
334 print("Merge the following files:")
335 print(file_list)
336 cmd = ["b2file-merge", "-f"]
337 args = cmd + [self.get_output_file_name(self.output_file_name())] + file_list
338 subprocess.check_call(args)
339 print("Finished merging. Now remove the input files to save space.")
340 cmd2 = ["rm", "-f"]
341 for tempfile in file_list:
342 args = cmd2 + [tempfile]
343 subprocess.check_call(args)
344
345

◆ requires()

def requires (   self)
This task requires several GenerateSimTask to be finished so that he required number of events is created.

Definition at line 303 of file combined_to_pxd_ckf_mva_training.py.

303 def requires(self):
304 """
305 This task requires several GenerateSimTask to be finished so that he required number of events is created.
306 """
307 n_events_per_task = MainTask.n_events_per_task
308 quotient, remainder = divmod(self.n_events, n_events_per_task)
309 for i in range(quotient):
310 yield GenerateSimTask(
311 bkgfiles_dir=self.bkgfiles_dir,
312 num_processes=MainTask.num_processes,
313 random_seed=self.random_seed + '_' + str(i).zfill(3),
314 n_events=n_events_per_task,
315 experiment_number=self.experiment_number,
316 )
317 if remainder > 0:
318 yield GenerateSimTask(
319 bkgfiles_dir=self.bkgfiles_dir,
320 num_processes=MainTask.num_processes,
321 random_seed=self.random_seed + '_' + str(quotient).zfill(3),
322 n_events=remainder,
323 experiment_number=self.experiment_number,
324 )
325

Member Data Documentation

◆ bkgfiles_dir

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

Directory with overlay background root files.

Definition at line 273 of file combined_to_pxd_ckf_mva_training.py.

◆ experiment_number

b2luigi experiment_number = b2luigi.IntParameter()
static

Experiment number of the conditions database, e.g.

defines simulation geometry

Definition at line 266 of file combined_to_pxd_ckf_mva_training.py.

◆ n_events

b2luigi n_events = b2luigi.IntParameter()
static

Number of events to generate.

Definition at line 271 of file combined_to_pxd_ckf_mva_training.py.

◆ queue

str queue = 'sx'
static

specify queue.

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

Definition at line 279 of file combined_to_pxd_ckf_mva_training.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 269 of file combined_to_pxd_ckf_mva_training.py.


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