11"""This steering file shows how to generate particle gun
12 MC samples in DST root format
for ECL charged PID analysis.
21 $ basf2 MakeMC.py -- --pdgCode <integer>
22 --momentum <min> <max>
24 --fileNumber <integer>
30from simulation import add_simulation
31from reconstruction import add_reconstruction
36 parser = argparse.ArgumentParser()
38 parser.add_argument('--pdgCode',
41 help=
'PDG code of particle'
43 'http://pdg.lbl.gov/2019/reviews/rpp2018-rev-monte-carlo-numbering.pdf')
45 parser.add_argument(
'--momentum',
49 help=
'Range for momentum of particle in GeV'
50 'First argument is minimum and second is maximum.'
51 'Example: --momentum 0.5 1')
53 parser.add_argument(
'--theta',
57 help=
'Range for polar angle of particle in degree'
58 'First argument is minimum and second is maximum.'
59 'Example: --theta 12.4 155.1')
61 parser.add_argument(
'--fileNumber',
64 help=
'File numbering scheme')
68args = argparser().parse_args()
70momentumRange = list(args.momentum)
71thetaRange = list(args.theta)
74mainPath = b2.create_path()
77eventInfoSetter = b2.register_module(
'EventInfoSetter')
78eventInfoSetter.param({
'evtNumList': [100],
81mainPath.add_module(eventInfoSetter)
84b2.set_log_level(b2.LogLevel.INFO)
87b2.set_random_seed(123456)
90particleGun = b2.register_module(
'ParticleGun')
92 'pdgCodes': [args.pdgCode],
94 'momentumGeneration':
'uniform',
95 'momentumParams': momentumRange,
96 'thetaGeneration':
'uniform',
97 'thetaParams': thetaRange,
98 'phiGeneration':
'uniform',
99 'phiParams': [0., 360.],
100 'vertexGeneration':
'uniform',
101 'xVertexParams': [0.0, 0.0],
102 'yVertexParams': [0.0, 0.0],
103 'zVertexParams': [0.0, 0.0],
105particleGun.param(param_particleGun)
106mainPath.add_module(particleGun)
109pathToBkgDirectory =
'/group/belle2/BGFile/OfficialBKG/15thCampaign/bgoverlay_phase3/'
110bgFiles = glob.glob(pathToBkgDirectory +
'*.root')
113add_simulation(mainPath, bkgfiles=bgFiles)
116add_reconstruction(mainPath)
119outputFile = b2.register_module(
'RootOutput')
120outputFile.param(
'outputFileName',
121 f
'pdg{args.pdgCode}_BGx1_{args.fileNumber}.mdst.root')
122mainPath.add_module(outputFile)
125mainPath.add_module(
'Progress')