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 n_events = b2luigi.IntParameter()
 Number of events to generate.
 
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 243 of file cdc_and_svd_ckf_merger_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 283 of file cdc_and_svd_ckf_merger_mva_training.py.

283 def output(self):
284 """
285 Generate list of output files that the task should produce.
286 The task is considered finished if and only if the outputs all exist.
287 """
288 yield self.add_to_output(self.output_file_name())
289

◆ 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 269 of file cdc_and_svd_ckf_merger_mva_training.py.

269 def output_file_name(self, n_events=None, random_seed=None):
270 """
271 Create output file name depending on number of events and production
272 mode that is specified in the random_seed string.
273
274 :param n_events: Number of events to simulate.
275 :param random_seed: Random seed to use for the simulation to create independent samples.
276 """
277 if n_events is None:
278 n_events = self.n_events
279 if random_seed is None:
280 random_seed = self.random_seed
281 return "generated_mc_N" + str(n_events) + "_" + random_seed + ".root"
282

◆ process()

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

Definition at line 314 of file cdc_and_svd_ckf_merger_mva_training.py.

314 def process(self):
315 """
316 When all GenerateSimTasks finished, merge the output.
317 """
318 create_output_dirs(self)
319
320 file_list = [item for sublist in self.get_input_file_names().values() for item in sublist]
321 print("Merge the following files:")
322 print(file_list)
323 cmd = ["b2file-merge", "-f"]
324 args = cmd + [self.get_output_file_name(self.output_file_name())] + file_list
325 subprocess.check_call(args)
326 print("Finished merging. Now remove the input files to save space.")
327 cmd2 = ["rm", "-f"]
328 for tempfile in file_list:
329 args = cmd2 + [tempfile]
330 subprocess.check_call(args)
331
332

◆ requires()

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

Definition at line 290 of file cdc_and_svd_ckf_merger_mva_training.py.

290 def requires(self):
291 """
292 This task requires several GenerateSimTask to be finished so that he required number of events is created.
293 """
294 n_events_per_task = MainTask.n_events_per_task
295 quotient, remainder = divmod(self.n_events, n_events_per_task)
296 for i in range(quotient):
297 yield GenerateSimTask(
298 bkgfiles_dir=self.bkgfiles_dir,
299 num_processes=MainTask.num_processes,
300 random_seed=self.random_seed + '_' + str(i).zfill(3),
301 n_events=n_events_per_task,
302 experiment_number=self.experiment_number,
303 )
304 if remainder > 0:
305 yield GenerateSimTask(
306 bkgfiles_dir=self.bkgfiles_dir,
307 num_processes=MainTask.num_processes,
308 random_seed=self.random_seed + '_' + str(quotient).zfill(3),
309 n_events=remainder,
310 experiment_number=self.experiment_number,
311 )
312

Member Data Documentation

◆ bkgfiles_dir

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

Directory with overlay background root files.

Definition at line 260 of file cdc_and_svd_ckf_merger_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 253 of file cdc_and_svd_ckf_merger_mva_training.py.

◆ n_events

b2luigi n_events = b2luigi.IntParameter()
static

Number of events to generate.

Definition at line 255 of file cdc_and_svd_ckf_merger_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 266 of file cdc_and_svd_ckf_merger_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 258 of file cdc_and_svd_ckf_merger_mva_training.py.


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