Skip to content

Commit e31d1dc

Browse files
committed
add beams energies as parameter
1 parent 5512ede commit e31d1dc

File tree

2 files changed

+37
-9
lines changed

2 files changed

+37
-9
lines changed

MC/bin/o2dpg_sim_workflow.py

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
parser.add_argument('-confKey',help='generator or trigger configuration key values, for example: GeneratorPythia8.config=pythia8.cfg', default='')
2727

2828
parser.add_argument('-eCMS',help='CMS energy', default=-1)
29+
parser.add_argument('-eBeamA',help='Beam A energy', default=6499.) #6369 PbPb, 2.510 pp 5 TeV, 4 pPb
30+
parser.add_argument('-eBeamB',help='Beam B energy', default=-1)
2931
parser.add_argument('-col',help='collision sytem: pp, PbPb, pPb, Pbp, ...', default='pp')
3032
parser.add_argument('-ptHatBin',help='pT hard bin number', default=-1)
3133
parser.add_argument('-ptHatMin',help='pT hard minimum when no bin requested', default=0)
@@ -160,7 +162,9 @@ def getDPL_global_options(bigshm=False,nosmallrate=False):
160162
# function encapsulating the signal sim part
161163
# first argument is timeframe id
162164
RNDSEED=args.seed # 0 means random seed !
163-
ECMS=args.eCMS
165+
ECMS=float(args.eCMS)
166+
EBEAMA=float(args.eBeamA)
167+
EBEAMB=float(args.eBeamB)
164168
NSIGEVENTS=args.ns
165169
GENERATOR=args.gen
166170
INIFILE=''
@@ -231,7 +235,7 @@ def getDPL_global_options(bigshm=False,nosmallrate=False):
231235
PDGA=1000822080 # Pb
232236
PDGB=1000822080 # Pb
233237
if ECMS < 0: # assign 5.02 TeV to Pb-Pb
234-
print('>>> Set CM Energy to PbPb case 5.02 TeV')
238+
print('o2dpg_sim_workflow: Set CM Energy to PbPb case 5.02 TeV')
235239
ECMS=5020.0
236240

237241
if COLTYPE == 'pPb':
@@ -242,8 +246,19 @@ def getDPL_global_options(bigshm=False,nosmallrate=False):
242246
PDGA=1000822080 # Pb
243247
PDGB=2212 # proton
244248

245-
if ECMS < 0:
246-
print('Error: Collision Energy not set!!!')
249+
# If not set previously, set beam energy B equal to A
250+
if EBEAMB < 0 and ECMS < 0:
251+
EBEAMB=EBEAMA
252+
print('o2dpg_sim_workflow: Set beam energy same in A and B beams')
253+
if COLTYPE=="pPb" or COLTYPE=="Pbp":
254+
print('o2dpg_sim_workflow: Careful! both beam energies are the same')
255+
256+
if ECMS > 0:
257+
if COLTYPE=="pPb" or COLTYPE=="Pbp":
258+
print('o2dpg_sim_workflow: Careful! ECM set for pPb/Pbp collisions!')
259+
260+
if ECMS < 0 and EBEAMA < 0 and EBEAMB < 0:
261+
print('o2dpg_sim_workflow: Error! CM or Beam Energy not set!!!')
247262
exit(1)
248263

249264
# produce the signal configuration

MC/config/common/pythia8/utils/mkpy8cfg.py

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,19 @@
1212
help='The random seed')
1313

1414
parser.add_argument('--idA', type=int, default='2212',
15-
help='PDG code of projectile beam')
15+
help='PDG code of projectile beam A')
1616

1717
parser.add_argument('--idB', type=int, default='2212',
18-
help='PDG code of target beam')
18+
help='PDG code of target beam B')
1919

20-
parser.add_argument('--eCM', type=float, default='13000.',
21-
help='Centre-of-mass energy')
20+
parser.add_argument('--eBeamA', type=float, default='6499.',
21+
help='Energy of beam A')
22+
23+
parser.add_argument('--eBeamB', type=float, default='6499.',
24+
help='Energy of beam B')
25+
26+
parser.add_argument('--eCM', type=float, default='-1',
27+
help='Centre-of-mass energy (careful!, better use beam energy)')
2228

2329
parser.add_argument('--process', default='inel', choices=['none', 'inel', 'ccbar', 'bbbar', 'heavy', 'jets', 'dirgamma'],
2430
help='Process to switch on')
@@ -76,7 +82,14 @@
7682
fout.write('### beams \n')
7783
fout.write('Beams:idA = %d \n' % (args.idA))
7884
fout.write('Beams:idB = %d \n' % (args.idB))
79-
fout.write('Beams:eCM = %f \n' % (args.eCM))
85+
if args.eCM > 0:
86+
fout.write('Beams:eCM = %f \n' % (args.eCM))
87+
elif args.eBeamA > 0 and args.eBeamB > 0:
88+
fout.write('Beams:eA = %f \n' % (args.eBeamA))
89+
fout.write('Beams:eB = %f \n' % (args.eBeamB))
90+
else:
91+
print('mkpy8cfg.py: Error, CM or Beam Energy not set!!!')
92+
exit(1)
8093
fout.write('\n')
8194

8295
### processes

0 commit comments

Comments
 (0)