Belle II Software development
Whizard.py
1
8
9'''
10This example shows how to run WHIZARD using our `whizard` module.
11'''
12
13import shutil
14
15import basf2 as b2
16import whizard
17from ROOT import Belle2
18
19
20# get the relevant information from command line arguments
21experiment = Belle2.Environment.Instance().getExperimentOverride() # --experiment
22run = Belle2.Environment.Instance().getRunOverride() # --run
23lastEventNumber = Belle2.Environment.Instance().getNumberEventsOverride() # -n
24firstEventNumber = Belle2.Environment.Instance().getSkipEventsOverride() # --skip-events
25events = lastEventNumber - firstEventNumber
26
27# run WHIZARD using the `whizard` module
28path, lhe, log = whizard.run_whizard(process='mumumumu', experiment=experiment, run=run, events=events)
29
30# run basf2
31main = b2.Path()
32main.add_module('EventInfoSetter')
33main.add_module('LHEInput',
34 inputFileList=lhe,
35 createEventMetaData=False,
36 nInitialParticles=2,
37 nVirtualParticles=2,
38 wrongSignPz=False)
39main.add_module('BoostMCParticles')
40main.add_module('SmearPrimaryVertex')
41main.add_module('Progress')
42main.add_module('PrintMCParticles', showStatus=True, showMomenta=True)
43main.add_module('RootOutput')
44b2.process(main)
45print(b2.statistics)
46
47# remove the files produced by WHIZARD (if necessary)
48shutil.rmtree(path, ignore_errors=True)
static Environment & Instance()
Static method to get a reference to the Environment instance.
Definition: Environment.cc:28
def run_whizard(process, experiment, run, events, print_sindarin=False)
Definition: whizard.py:106