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