Skip to content

Commit 84eaf39

Browse files
authored
Merge pull request #39 from gconesab/master
Fix Pb PDG and automatic energy setting for Pb and HI pythia configuration
2 parents 0cf2b9f + 85894c9 commit 84eaf39

File tree

6 files changed

+100
-44
lines changed

6 files changed

+100
-44
lines changed

MC/bin/o2dpg_sim_workflow.py

Lines changed: 40 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,16 @@
55
# It aims to handle the different MC possible configurations
66
# It just creates a workflow.json txt file, to execute the workflow one must execute right after
77
# ${O2DPG_ROOT}/MC/bin/o2_dpg_workflow_runner.py -f workflow.json
8+
#
89
# Execution examples:
9-
# ./o2dpg_sim_workflow.py -e TGeant3 -nb 0 -ns 2 -j 8 -tf 1 -mod "-m TPC" -proc "jets" -ptTrigMin 3.5 -ptHatBin 3 -trigger "external" -ini "\$O2DPG_ROOT/MC/config/PWGGAJE/ini/trigger_decay_gamma.ini" --embedding False
10+
# - pp PYTHIA jets, 2 events, triggered on high pT decay photons on EMCal acceptance, eCMS 13 TeV
11+
# ./o2dpg_sim_workflow.py -e TGeant3 -ns 2 -j 8 -tf 1 -mod "--skipModules ZDC" -col pp -eCM 13000 \
12+
# -proc "jets" -ptTrigMin 3.5 -acceptance 4 -ptHatBin 3 \
13+
# -trigger "external" -ini "\$O2DPG_ROOT/MC/config/PWGGAJE/ini/trigger_decay_gamma.ini"
1014
#
11-
# ./o2dpg_sim_workflow.py -e TGeant3 -nb 0 -ns 2 -j 8 -tf 1 -mod "--skipModules ZDC" -proc "ccbar" --embedding True
15+
# - pp PYTHIA ccbar events embedded into heavy-ion environment, 2 PYTHIA events into 1 bkg event, beams energy 2.510
16+
# ./o2dpg_sim_workflow.py -e TGeant3 -nb 1 -ns 2 -j 8 -tf 1 -mod "--skipModules ZDC" \
17+
# -col pp -eA 2.510 -proc "ccbar" --embedding
1218
#
1319

1420
import argparse
@@ -25,7 +31,9 @@
2531
parser.add_argument('-ini',help='generator init parameters file, for example: ${O2DPG_ROOT}/MC/config/PWGHF/ini/GeneratorHF.ini', default='')
2632
parser.add_argument('-confKey',help='generator or trigger configuration key values, for example: GeneratorPythia8.config=pythia8.cfg', default='')
2733

28-
parser.add_argument('-eCMS',help='CMS energy', default=5200.0)
34+
parser.add_argument('-eCM',help='CMS energy', default=-1)
35+
parser.add_argument('-eA',help='Beam A energy', default=6499.) #6369 PbPb, 2.510 pp 5 TeV, 4 pPb
36+
parser.add_argument('-eB',help='Beam B energy', default=-1)
2937
parser.add_argument('-col',help='collision sytem: pp, PbPb, pPb, Pbp, ...', default='pp')
3038
parser.add_argument('-ptHatBin',help='pT hard bin number', default=-1)
3139
parser.add_argument('-ptHatMin',help='pT hard minimum when no bin requested', default=0)
@@ -34,6 +42,7 @@
3442

3543
parser.add_argument('-ptTrigMin',help='generated pT trigger minimum', default=0)
3644
parser.add_argument('-ptTrigMax',help='generated pT trigger maximum', default=-1)
45+
parser.add_argument('-acceptance',help='select particles within predefined acceptance in ${O2DPG_ROOT}/MC/run/common/detector_acceptance.C', default=0)
3746

3847
parser.add_argument('--embedding',action='store_true', help='With embedding into background')
3948
parser.add_argument('-nb',help='number of background events / timeframe', default=20)
@@ -159,7 +168,9 @@ def getDPL_global_options(bigshm=False,nosmallrate=False):
159168
# function encapsulating the signal sim part
160169
# first argument is timeframe id
161170
RNDSEED=args.seed # 0 means random seed !
162-
ECMS=args.eCMS
171+
ECMS=float(args.eCM)
172+
EBEAMA=float(args.eA)
173+
EBEAMB=float(args.eB)
163174
NSIGEVENTS=args.ns
164175
GENERATOR=args.gen
165176
INIFILE=''
@@ -175,6 +186,7 @@ def getDPL_global_options(bigshm=False,nosmallrate=False):
175186

176187
PTTRIGMIN=float(args.ptTrigMin)
177188
PTTRIGMAX=float(args.ptTrigMax)
189+
PARTICLE_ACCEPTANCE=int(args.acceptance)
178190

179191
## Pt Hat productions
180192
WEIGHTPOW=int(args.weightPow)
@@ -219,24 +231,41 @@ def getDPL_global_options(bigshm=False,nosmallrate=False):
219231
PTHATMAX=hig_edge[PTHATBIN]
220232

221233
# translate here collision type to PDG
222-
# not sure this is what we want to do (GCB)
223234
COLTYPE=args.col
224235

225236
if COLTYPE == 'pp':
226237
PDGA=2212 # proton
227238
PDGB=2212 # proton
228239

229240
if COLTYPE == 'PbPb':
230-
PDGA=2212 # Pb???? #---> to be checked (seems same as pp case)
231-
PDGB=2212 # Pb????
241+
PDGA=1000822080 # Pb
242+
PDGB=1000822080 # Pb
243+
if ECMS < 0: # assign 5.02 TeV to Pb-Pb
244+
print('o2dpg_sim_workflow: Set CM Energy to PbPb case 5.02 TeV')
245+
ECMS=5020.0
232246

233247
if COLTYPE == 'pPb':
234-
PDGA=2212 # proton
235-
PDGB=2212 # Pb????
248+
PDGA=2212 # proton
249+
PDGB=1000822080 # Pb
236250

237251
if COLTYPE == 'Pbp':
238-
PDGA=2212 # Pb????
239-
PDGB=2212 # proton
252+
PDGA=1000822080 # Pb
253+
PDGB=2212 # proton
254+
255+
# If not set previously, set beam energy B equal to A
256+
if EBEAMB < 0 and ECMS < 0:
257+
EBEAMB=EBEAMA
258+
print('o2dpg_sim_workflow: Set beam energy same in A and B beams')
259+
if COLTYPE=="pPb" or COLTYPE=="Pbp":
260+
print('o2dpg_sim_workflow: Careful! both beam energies are the same')
261+
262+
if ECMS > 0:
263+
if COLTYPE=="pPb" or COLTYPE=="Pbp":
264+
print('o2dpg_sim_workflow: Careful! ECM set for pPb/Pbp collisions!')
265+
266+
if ECMS < 0 and EBEAMA < 0 and EBEAMB < 0:
267+
print('o2dpg_sim_workflow: Error! CM or Beam Energy not set!!!')
268+
exit(1)
240269

241270
# produce the signal configuration
242271
SGN_CONFIG_task=createTask(name='gensgnconf_'+str(tf), tf=tf, cwd=timeframeworkdir)

MC/config/PWGGAJE/hooks/jets_hook.C

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ R__ADD_INCLUDE_PATH($O2DPG_ROOT)
77

88
/// \brief Select jet events within acceptance or associated parton flavor using Pythia Hooks.
99
///
10-
/// Select outoging jets on the 2->2 process, at least one in a selected acceptance and
11-
/// with a given PDG value.
10+
/// Select outoging parton/jets on the 2->2 process, at least one in a selected acceptance and
11+
/// optionally select the parton with a given PDG value.
1212
/// Only valid for PYTHIA8 and using Hooks
1313
///
1414
/// \author Gustavo Conesa Balbastre (LPSC-IN2P3-CNRS)
@@ -22,6 +22,14 @@ class UserHooks_jets : public Pythia8::UserHooks
2222
~UserHooks_jets() = default;
2323
bool canVetoPartonLevel() override { return true; };
2424
bool doVetoPartonLevel(const Pythia8::Event& event) override {
25+
26+
// for (Int_t id = 0; id < 10; id++)
27+
// {
28+
// printf("parton %d PDG %d, status %d, mother %d, E %2.2f, pT %2.2f, eta %2.2f, phi %2.2f\n",
29+
// id, event[id].id() , event[id].status(), event[id].mother1(),
30+
// event[id].e() , event[id].pT(),
31+
// event[id].eta(), event[id].phi()*TMath::RadToDeg());
32+
// }
2533

2634
// Get the outgoing 2->2 partons.
2735
// The jets are in position 5 or 6.
@@ -37,39 +45,37 @@ class UserHooks_jets : public Pythia8::UserHooks
3745
if ( mOutPartonPDG > 0 && TMath::Abs(event[id1].id()) != mOutPartonPDG )
3846
okpdg1 = false;
3947

40-
if ( acc1 && okpdg1 )
41-
{
42-
printf("--- Accepted event, jet 1 ---\n");
43-
printf("PDG %d, status %d, mother %d, E %2.2f, pT %2.2f, eta %2.2f, phi %2.2f\n",
44-
event[id1].id() , event[id1].status(), event[id1].mother1(),
45-
event[id1].e() , event[id1].pT(),
46-
event[id1].eta(), event[id1].phi()*TMath::RadToDeg());
47-
48-
return false;
49-
}
50-
5148
// Check the second jet
5249
//
5350
bool acc2 = detector_acceptance(mAcceptance, event[id2].phi(), event[id2].eta()) ;
5451
bool okpdg2 = true;
5552

5653
if ( mOutPartonPDG > 0 && TMath::Abs(event[id2].id()) != mOutPartonPDG )
5754
okpdg2 = false;
58-
59-
if ( acc2 && okpdg2 )
55+
56+
//printf("acc1 %d, acc2 %d, okpdg1 %d, okpdf2 %d\n",acc1,acc2,okpdg1,okpdg2);
57+
58+
if ( (acc1 || acc2) && (okpdg1 || okpdg2) )
6059
{
61-
printf("--- Accepted event, jet 2 ---\n");
62-
printf("PDG %d, status %d, mother %d, E %2.2f, pT %2.2f, eta %2.2f, phi %2.2f\n",
60+
printf("--- Accepted event ---\n");
61+
printf("\t --- jet 1 ---\n");
62+
printf("\t PDG %d, status %d, mother %d, E %2.2f, pT %2.2f, eta %2.2f, phi %2.2f\n",
63+
event[id1].id() , event[id1].status(), event[id1].mother1(),
64+
event[id1].e() , event[id1].pT(),
65+
event[id1].eta(), event[id1].phi()*TMath::RadToDeg());
66+
67+
printf("\t --- jet 2 ---\n");
68+
printf("\t PDG %d, status %d, mother %d, E %2.2f, pT %2.2f, eta %2.2f, phi %2.2f\n",
6369
event[id2].id() , event[id2].status(), event[id2].mother1(),
6470
event[id2].e() , event[id2].pT(),
6571
event[id2].eta(), event[id2].phi()*TMath::RadToDeg());
66-
72+
6773
return false;
6874
}
6975

70-
// Jets not found
76+
// Jets rejected
7177
//
72-
printf("--- Rejected event ---\n");
78+
printf("\t --- Rejected event ---\n");
7379

7480
return true;
7581

@@ -97,9 +103,9 @@ pythia8_userhooks_jets(int acc = 0, int pdgPar = 0)
97103
printf("Select outgoing partons with pdg = %d\n",pdgPar);
98104
}
99105

100-
if ( !acc && gSystem->Getenv("CONFIG_DETECTOR_ACCEPTANCE") )
106+
if ( !acc && gSystem->Getenv("PARTICLE_ACCEPTANCE") )
101107
{
102-
acc = atoi(gSystem->Getenv("CONFIG_DETECTOR_ACCEPTANCE"));
108+
acc = atoi(gSystem->Getenv("PARTICLE_ACCEPTANCE"));
103109
printf("Requested acceptance %d\n",acc);
104110
}
105111

MC/config/PWGGAJE/hooks/prompt_gamma_hook.C

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,9 @@ Pythia8::UserHooks*
121121
printf("Select outgoing partons with pdg = %d\n",pdgPar);
122122
}
123123

124-
if ( !acc && gSystem->Getenv("CONFIG_DETECTOR_ACCEPTANCE") )
124+
if ( !acc && gSystem->Getenv("PARTICLE_ACCEPTANCE") )
125125
{
126-
acc = atoi(gSystem->Getenv("CONFIG_DETECTOR_ACCEPTANCE"));
126+
acc = atoi(gSystem->Getenv("PARTICLE_ACCEPTANCE"));
127127
printf("Requested acceptance %d\n",acc);
128128
}
129129

MC/config/PWGGAJE/trigger/decay_gamma_jets.C

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ o2::eventgen::Trigger decay_gamma_jets( )
2727
// Select photons within acceptance
2828
//
2929
Int_t acceptance = 0;
30-
if ( gSystem->Getenv("CONFIG_DETECTOR_ACCEPTANCE") )
31-
acceptance = atoi(gSystem->Getenv("CONFIG_DETECTOR_ACCEPTANCE"));
30+
if ( gSystem->Getenv("PARTICLE_ACCEPTANCE") )
31+
acceptance = atoi(gSystem->Getenv("PARTICLE_ACCEPTANCE"));
3232
//printf("Requested acceptance %d\n",acceptance);
3333

3434
// Particle loop

MC/config/PWGGAJE/trigger/prompt_gamma.C

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ o2::eventgen::Trigger prompt_gamma( )
7171
// Select photons within acceptance
7272
//
7373
Int_t acceptance = 0;
74-
if ( gSystem->Getenv("CONFIG_DETECTOR_ACCEPTANCE") )
75-
acceptance = atoi(gSystem->Getenv("CONFIG_DETECTOR_ACCEPTANCE"));
74+
if ( gSystem->Getenv("PARTICLE_ACCEPTANCE") )
75+
acceptance = atoi(gSystem->Getenv("PARTICLE_ACCEPTANCE"));
7676
//printf("Requested acceptance %d\n",acceptance);
7777

7878
if ( detector_acceptance(acceptance, gamma.Phi(),gamma.Eta()) )

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

Lines changed: 26 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('--eA', type=float, default='6499.',
21+
help='Energy of beam A')
22+
23+
parser.add_argument('--eB', 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.eA > 0 and args.eB > 0:
88+
fout.write('Beams:eA = %f \n' % (args.eA))
89+
fout.write('Beams:eB = %f \n' % (args.eB))
90+
else:
91+
print('mkpy8cfg.py: Error, CM or Beam Energy not set!!!')
92+
exit(1)
8093
fout.write('\n')
8194

8295
### processes
@@ -94,6 +107,14 @@
94107
fout.write('PromptPhoton:all = on \n')
95108
fout.write('\n')
96109

110+
### heavy ion settings (valid for Pb-Pb 5520 only)
111+
if args.idA==1000822080 and args.idB==1000822080:
112+
fout.write('### heavy-ion settings (valid for Pb-Pb 5520 only) \n')
113+
fout.write('HeavyIon:SigFitNGen = 0 \n')
114+
fout.write('HeavyIon:SigFitDefPar = 13.88,1.84,0.22,0.0,0.0,0.0,0.0,0.0 \n')
115+
fout.write('HeavyIon:bWidth = 14.48 \n')
116+
fout.write('\n')
117+
97118
### decays
98119
fout.write('### decays \n')
99120
fout.write('ParticleDecays:limitTau0 = on \n') ### we will need to put some parameters for these settings

0 commit comments

Comments
 (0)