Belle II Software development
GenerateSimTask Class Reference
Inheritance diagram for GenerateSimTask:
LSFTask

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)
 
 create_path (self)
 
 remove_output (self)
 

Public Attributes

 job_name = self.task_id
 set the job name (inherited variable)
 

Static Public Attributes

 experiment_number = b2luigi.IntParameter()
 Experiment number of the conditions database, e.g.
 
 random_seed = b2luigi.Parameter()
 Random basf2 seed.
 
 n_events = b2luigi.IntParameter()
 Number of events to generate.
 
 bkgfiles_dir
 Directory with overlay background root files.
 
str batch_system = 'lsf'
 batch system
 
str queue = 's'
 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 209 of file combined_to_pxd_ckf_mva_training.py.

Member Function Documentation

◆ create_path()

create_path ( self)
Create basf2 path to process with event generation and simulation.

Definition at line 254 of file combined_to_pxd_ckf_mva_training.py.

254 def create_path(self):
255 """
256 Create basf2 path to process with event generation and simulation.
257 """
258 basf2.set_random_seed(self.random_seed)
259 path = basf2.create_path()
260 path.add_module(
261 "EventInfoSetter", evtNumList=[self.n_events], runList=[0], expList=[self.experiment_number]
262 )
263 path.add_module("EvtGenInput")
264 bkg_files = ""
265 # \cond suppress doxygen warning
266 if self.experiment_number == 0:
268 else:
269 bkg_files = background.get_background_files(self.bkgfiles_dir)
270 # \endcond
271
272 simulation.add_simulation(path, bkgfiles=bkg_files, bkgOverlay=True, usePXDDataReduction=False)
273
274 path.add_module(
275 "RootOutput",
276 outputFileName=self.get_output_file_name(self.output_file_name()),
277 )
278 return path
279
get_background_files(folder=None, output_file_info=True)
Definition background.py:17
add_simulation(path, components=None, bkgfiles=None, bkgOverlay=True, forceSetPXDDataReduction=False, usePXDDataReduction=True, cleanupPXDDataReduction=True, generate_2nd_cdc_hits=False, simulateT0jitter=True, isCosmics=False, FilterEvents=False, usePXDGatedMode=False, skipExperimentCheckForBG=False, save_slow_pions_in_mc=False, save_all_charged_particles_in_mc=False)

◆ 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 247 of file combined_to_pxd_ckf_mva_training.py.

247 def output(self):
248 """
249 Generate list of output files that the task should produce.
250 The task is considered finished if and only if the outputs all exist.
251 """
252 yield self.add_to_output(self.output_file_name())
253

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

: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 233 of file combined_to_pxd_ckf_mva_training.py.

233 def output_file_name(self, n_events=None, random_seed=None):
234 """
235 Create output file name depending on number of events and production
236 mode that is specified in the random_seed string.
237
238 :param n_events: Number of events to simulate.
239 :param random_seed: Random seed to use for the simulation to create independent samples.
240 """
241 if n_events is None:
242 n_events = self.n_events
243 if random_seed is None:
244 random_seed = self.random_seed
245 return "generated_mc_N" + str(n_events) + "_" + random_seed + ".root"
246

◆ remove_output()

remove_output ( self)
Default function from base b2luigi.Task class.

Definition at line 280 of file combined_to_pxd_ckf_mva_training.py.

280 def remove_output(self):
281 """
282 Default function from base b2luigi.Task class.
283 """
284 self._remove_output()
285
286
287# I don't use the default MergeTask or similar because they only work if every input file is called the same.
288# Additionally, I want to add more features like deleting the original input to save storage space.

Member Data Documentation

◆ batch_system

str batch_system = 'lsf'
staticinherited

batch system

Definition at line 189 of file combined_to_pxd_ckf_mva_training.py.

◆ bkgfiles_dir

bkgfiles_dir
static
Initial value:
= b2luigi.Parameter(
)

Directory with overlay background root files.

Definition at line 226 of file combined_to_pxd_ckf_mva_training.py.

◆ experiment_number

experiment_number = b2luigi.IntParameter()
static

Experiment number of the conditions database, e.g.

defines simulation geometry

Definition at line 219 of file combined_to_pxd_ckf_mva_training.py.

◆ job_name

job_name = self.task_id
inherited

set the job name (inherited variable)

Definition at line 197 of file combined_to_pxd_ckf_mva_training.py.

◆ n_events

n_events = b2luigi.IntParameter()
static

Number of events to generate.

Definition at line 224 of file combined_to_pxd_ckf_mva_training.py.

◆ queue

str queue = 's'
staticinherited

queue

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


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