Belle II Software  release-06-01-15
Generation.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 
11 
12 # Generation of 1000 ee->mumu(ISR) events using PHOKHARA.
13 
14 import sys
15 import basf2
16 from beamparameters import add_beamparameters
17 
18 # Set the global log level
19 basf2.set_log_level(basf2.LogLevel.INFO)
20 
21 main = basf2.create_path()
22 
23 eventinfosetter = basf2.register_module('EventInfoSetter')
24 eventinfosetter.param('evtNumList', [1000]) # we want to process 1000 events
25 eventinfosetter.param('runList', [1]) # from run number 1
26 eventinfosetter.param('expList', [0]) # and experiment number 0
27 
28 # Basf2.Register the PHOKHARA module
29 phokhara = basf2.register_module('PhokharaInput')
30 
31 # Set the logging level for the PHOKHARA module to INFO in order to see the cross sections etc.
32 phokhara.set_log_level(basf2.LogLevel.INFO)
33 
34 # Set the parameter file (EXPERTS ONLY!)
35 # phokhara.param('ParameterFile', 'test.dat')
36 
37 # Set the final state particles
38 # mu+mu-(0), pi+pi-(1), 2pi0pi+pi-(2), 2pi+2pi-(3), ppbar(4), nnbar(5), K+K-(6),
39 # K0K0bar(7), pi+pi-pi0(8), lamb(->pi-p)lambbar(->pi+pbar)(9), eta pi+ pi- (10)
40 phokhara.param('FinalState', 0)
41 
42 # soft photon cutoff, final result is indepedent of the cut off as long as its small (<1e-3)
43 # photon multiplicity (and exclusive cross sections depent on that parameter)
44 # EXPERTS ONLY
45 phokhara.param('Epsilon', 0.0001)
46 
47 # Events (weighted) to be used for maximum weight search before generation
48 phokhara.param('SearchMax', 50000)
49 
50 # Events (unweighted) before event loop is aborted
51 phokhara.param('nMaxTrials', 25000)
52 
53 # CMS energy [GeV] (under devlopment, currently calculated from xml file)
54 # phokhara.param('CMSEnergy', 10.580)
55 
56 # LO switch --> Born corresponds to 1 photon (0), Born corresponds to 0 photons (1), only Born: 0 photons (-1)
57 # original comment: ph0 Born: 1ph(0), Born: 0ph(1), only Born: 0ph(-1)
58 phokhara.param('LO', 1)
59 
60 # NLO switch --> only for LO=0: off(0), on(1)
61 # original comment: 1 photon : Born(0), NLO(1)
62 phokhara.param('NLO', 1)
63 
64 # QED corrections: ISR only(0), ISR+FSR(1), ISR+INT+FSR(2), if NLO=1 only 0 and 2 are possible
65 # original comment: ISR only(0), ISR+FSR(1), ISR+INT+FSR(2)
66 phokhara.param('QED', 0)
67 
68 # NLO options (only if NLO=1 and QED=2) - CODE RUNS VERY (!) SLOW
69 # original comment: IFSNLO: no(0), yes(1)
70 phokhara.param('NLOIFI', 0)
71 # Vacuum polarization switch: off (0), on (1, [by Fred Jegerlehner, alphaQED/hadr5]), on (2,[by Thomas Teubner])
72 phokhara.param('Alpha', 0)
73 
74 # Pion FormFactor switch
75 # original comment: FF_pion: KS PionFormFactor(0),GS old (1),GS new (2)
76 phokhara.param('PionFF', 0)
77 
78 # Kaon FormFactor switch
79 # original comment: FF_kaon: KaonFormFactor constrained (0),KaonFormFactor unconstrained (1),KaonFormFactor old (2)
80 phokhara.param('KaonFF', 0)
81 
82 # Pion Structure
83 # original comment: for pi+pi- only: f0+f0(600): K+K- model(0), "no structure" model(1), no f0+f0(600)(2), f0 KLOE(3)
84 phokhara.param('PionStructure', 0)
85 
86 # Include narrow resonances (no Upsilon included yet!!!): no narrow resonances (0), j/psi (1) OR psi2s (2)
87 # original comment: narr_res: no narrow resonances (0), J/psi (1) and psi(2S) (2) only for pion = 0,1,6,7
88 phokhara.param('NarrowRes', 0)
89 
90 # Proton FormFactor switch
91 # original comment: FF_pp: ProtonFormFactor old(0), ProtonFormFactor new(1)
92 phokhara.param('ProtonFF', 1)
93 
94 # min/max angle of the photon
95 # original comment: minimal photon angle/missing momentum angle, maximal photon angle/missing momentum angle
96 phokhara.param('ScatteringAngleRangePhoton', [0., 180.])
97 
98 # min/max angle of the other final state particles
99 # original comment: minimal pions(muons,nucleons,kaons) angle, maximal pions(muons,nucleons,kaons) angle
100 phokhara.param('ScatteringAngleRangeFinalStates', [0., 180.])
101 # Minimal hadrons/muons-gamma invariant mass squared [GeV^2]
102 # original comment: minimal hadrons(muons)-gamma-inv. mass squared
103 phokhara.param('MinInvMassHadronsGamma', 0.)
104 
105 # Minimal hadrons/muons invariant mass squared [GeV^2]
106 # original comment: minimal inv. mass squared of the hadrons(muons)
107 phokhara.param('MinInvMassHadrons', 0.0)
108 
109 # Maximal hadrons/muons invariant mass squared [GeV^2]
110 # original comment: maximal inv. mass squared of the hadrons(muons)
111 phokhara.param('MaxInvMassHadrons', 200.0)
112 
113 # Minimal photon energy/missing energy, must be larger than 0.01*(CMS energy) [GeV]
114 # original comment: minimal photon energy/missing energy
115 phokhara.param('MinEnergyGamma', 0.25)
116 
117 # geometry parameter database
118 gearbox = basf2.register_module('Gearbox')
119 
120 # Register the Progress module and the Python histogram module
121 progress = basf2.register_module('Progress')
122 
123 # output
124 output = basf2.register_module('RootOutput')
125 output.param('outputFileName', sys.argv[1])
126 
127 # Create the main path and add the modules
128 main = basf2.create_path()
129 main.add_module(eventinfosetter)
130 add_beamparameters(main, "Y4S")
131 main.add_module(progress)
132 main.add_module(gearbox)
133 main.add_module(phokhara)
134 main.add_module(output)
135 
136 # generate events
137 basf2.process(main)
138 
139 # show call statistics
140 print(basf2.statistics)