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

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 create_path (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 = '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 180 of file combined_to_pxd_ckf_mva_training.py.

Member Function Documentation

◆ create_path()

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

Definition at line 227 of file combined_to_pxd_ckf_mva_training.py.

227 def create_path(self):
228 """
229 Create basf2 path to process with event generation and simulation.
230 """
231 basf2.set_random_seed(self.random_seed)
232 path = basf2.create_path()
233 path.add_module(
234 "EventInfoSetter", evtNumList=[self.n_events], runList=[0], expList=[self.experiment_number]
235 )
236 path.add_module("EvtGenInput")
237 bkg_files = ""
238 # \cond suppress doxygen warning
239 if self.experiment_number == 0:
241 else:
242 bkg_files = background.get_background_files(self.bkgfiles_dir)
243 # \endcond
244
245 simulation.add_simulation(path, bkgfiles=bkg_files, bkgOverlay=True, usePXDDataReduction=False)
246
247 path.add_module(
248 "RootOutput",
249 outputFileName=self.get_output_file_name(self.output_file_name()),
250 )
251 return path
252
253
254# I don't use the default MergeTask or similar because they only work if every input file is called the same.
255# Additionally, I want to add more features like deleting the original input to save storage space.
def get_background_files(folder=None, output_file_info=True)
Definition: background.py:17
def 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)
Definition: simulation.py:126

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

220 def output(self):
221 """
222 Generate list of output files that the task should produce.
223 The task is considered finished if and only if the outputs all exist.
224 """
225 yield self.add_to_output(self.output_file_name())
226

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

206 def output_file_name(self, n_events=None, random_seed=None):
207 """
208 Create output file name depending on number of events and production
209 mode that is specified in the random_seed string.
210
211 :param n_events: Number of events to simulate.
212 :param random_seed: Random seed to use for the simulation to create independent samples.
213 """
214 if n_events is None:
215 n_events = self.n_events
216 if random_seed is None:
217 random_seed = self.random_seed
218 return "generated_mc_N" + str(n_events) + "_" + random_seed + ".root"
219

Member Data Documentation

◆ bkgfiles_dir

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

Directory with overlay background root files.

Definition at line 197 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 190 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 195 of file combined_to_pxd_ckf_mva_training.py.

◆ queue

str queue = 'l'
static

specify queue.

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

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


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