12 """This steering file shows how to generate particle gun
13 MC samples in DST root format for ECL charged PID analysis.
22 $ basf2 MakeMC.py -- --pdgCode <integer>
23 --momentum <min> <max>
25 --fileNumber <integer>
31 from simulation
import add_simulation
32 from reconstruction
import add_reconstruction
37 parser = argparse.ArgumentParser()
39 parser.add_argument(
'--pdgCode',
42 help=
'PDG code of particle'
44 'http://pdg.lbl.gov/2019/reviews/rpp2018-rev-monte-carlo-numbering.pdf')
46 parser.add_argument(
'--momentum',
50 help=
'Range for momentum of particle in GeV'
51 'First argument is minimum and second is maximum.'
52 'Example: --momentum 0.5 1')
54 parser.add_argument(
'--theta',
58 help=
'Range for polar angle of particle in degree'
59 'First argument is minimum and second is maximum.'
60 'Example: --theta 12.4 155.1')
62 parser.add_argument(
'--fileNumber',
65 help=
'File numbering scheme')
69 args = argparser().parse_args()
71 momentumRange = list(args.momentum)
72 thetaRange = list(args.theta)
75 mainPath = b2.create_path()
78 eventInfoSetter = b2.register_module(
'EventInfoSetter')
79 eventInfoSetter.param({
'evtNumList': [100],
82 mainPath.add_module(eventInfoSetter)
85 b2.set_log_level(b2.LogLevel.INFO)
88 b2.set_random_seed(123456)
91 particleGun = b2.register_module(
'ParticleGun')
93 'pdgCodes': [args.pdgCode],
95 'momentumGeneration':
'uniform',
96 'momentumParams': momentumRange,
97 'thetaGeneration':
'uniform',
98 'thetaParams': thetaRange,
99 'phiGeneration':
'uniform',
100 'phiParams': [0., 360.],
101 'vertexGeneration':
'uniform',
102 'xVertexParams': [0.0, 0.0],
103 'yVertexParams': [0.0, 0.0],
104 'zVertexParams': [0.0, 0.0],
106 particleGun.param(param_particleGun)
107 mainPath.add_module(particleGun)
110 pathToBkgDirectory =
'/group/belle2/BGFile/OfficialBKG/15thCampaign/bgoverlay_phase3/'
111 bgFiles = glob.glob(pathToBkgDirectory +
'*.root')
114 add_simulation(mainPath, bkgfiles=bgFiles)
117 add_reconstruction(mainPath)
120 outputFile = b2.register_module(
'RootOutput')
121 outputFile.param(
'outputFileName',
122 'pdg{}_BGx1_{}.mdst.root'.format(args.pdgCode,
124 mainPath.add_module(outputFile)
127 mainPath.add_module(
'Progress')