Skip to content

Commit 3247645

Browse files
authored
Include special runs in wf creator (#1982)
* Include special runs to wf creator * Include/modify QED for special runs
1 parent 180f1ed commit 3247645

File tree

2 files changed

+49
-51
lines changed

2 files changed

+49
-51
lines changed

MC/bin/o2dpg_sim_workflow.py

Lines changed: 47 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -412,40 +412,28 @@ def extractVertexArgs(configKeyValuesStr, finalDiamondDict):
412412
PTHATMIN=float(args.ptHatMin)
413413
PTHATMAX=float(args.ptHatMax)
414414

415-
# translate here collision type to PDG
415+
colsys = {'pp':[2212,2212], 'pPb':[2212,1000822080], 'Pbp':[1000822080,2212], 'PbPb':[1000822080,1000822080], 'pO':[2212,1000080160], 'Op':[1000080160,2212], 'OO':[1000080160,1000080160], 'NeNe':[1000100200,1000100200]}
416+
# translate here collision type to PDG of allowed particles
416417
COLTYPE=args.col
418+
if COLTYPE in colsys.keys():
419+
PDGA=colsys[COLTYPE][0]
420+
PDGB=colsys[COLTYPE][1]
421+
else:
422+
print('o2dpg_sim_workflow: Error! Unknown collision system %s' % COLTYPE)
423+
exit(1)
417424

418425
doembedding=True if args.embedding=='True' or args.embedding==True else False
419426

420-
if COLTYPE == 'pp':
421-
PDGA=2212 # proton
422-
PDGB=2212 # proton
423-
424-
if COLTYPE == 'PbPb':
425-
PDGA=1000822080 # Pb
426-
PDGB=1000822080 # Pb
427-
if ECMS < 0: # assign 5.02 TeV to Pb-Pb
428-
print('o2dpg_sim_workflow: Set CM Energy to PbPb case 5.02 TeV')
429-
ECMS=5020.0
430-
431-
if COLTYPE == 'pPb':
432-
PDGA=2212 # proton
433-
PDGB=1000822080 # Pb
434-
435-
if COLTYPE == 'Pbp':
436-
PDGA=1000822080 # Pb
437-
PDGB=2212 # proton
438-
439427
# If not set previously, set beam energy B equal to A
440428
if EBEAMB < 0 and ECMS < 0:
441429
EBEAMB=EBEAMA
442430
print('o2dpg_sim_workflow: Set beam energy same in A and B beams')
443-
if COLTYPE=="pPb" or COLTYPE=="Pbp":
444-
print('o2dpg_sim_workflow: Careful! both beam energies are the same')
431+
if PDGA != PDGB:
432+
print('o2dpg_sim_workflow: Careful! Set same energies for different particle beams!')
445433

446434
if ECMS > 0:
447-
if COLTYPE=="pPb" or COLTYPE=="Pbp":
448-
print('o2dpg_sim_workflow: Careful! ECM set for pPb/Pbp collisions!')
435+
if PDGA != PDGB:
436+
print('o2dpg_sim_workflow: Careful! ECM set for for different particle beams!')
449437

450438
if ECMS < 0 and EBEAMA < 0 and EBEAMB < 0:
451439
print('o2dpg_sim_workflow: Error! CM or Beam Energy not set!!!')
@@ -507,7 +495,9 @@ def getDPL_global_options(bigshm=False, ccdbbackend=True):
507495

508496
workflow['stages'].append(GRP_TASK)
509497

510-
includeQED = (COLTYPE == 'PbPb' or (doembedding and COLTYPEBKG == "PbPb")) or (args.with_qed == True)
498+
# QED is enabled only for same beam species for now
499+
QED_enabled = True if (PDGA==PDGB and PDGA!=2212) else False
500+
includeQED = (QED_enabled or (doembedding and QED_enabled)) or (args.with_qed == True)
511501
signalprefix='sgn'
512502

513503
# No vertexing for event pool generation; otherwise the vertex comes from CCDB and later from CollContext
@@ -518,8 +508,15 @@ def getDPL_global_options(bigshm=False, ccdbbackend=True):
518508
# preproduce the collision context / timeframe structure for all timeframes at once
519509
precollneeds=[GRP_TASK['name']]
520510
NEventsQED=10000 # max number of QED events to simulate per timeframe
521-
PbPbXSec=8. # expected PbPb cross section
522-
QEDXSecExpected=35237.5 # expected magnitude of QED cross section
511+
# Hadronic cross section values are taken from Glauber MC
512+
XSecSys = {'PbPb': 8., 'OO': 1.273, 'NeNe': 1.736}
513+
# QED cross section values were calculated with TEPEMGEN
514+
# OO and NeNe at 5.36 TeV, while the old PbPb value was kept as before
515+
# If the collision energy changes these values need to be updated
516+
# More info on the calculation can be found in the TEPEMGEN folder of AEGIS
517+
# specifically in the epemgen.f file
518+
QEDXSecExpected = {'PbPb': 35237.5, 'OO': 3.17289, 'NeNe': 7.74633} # expected magnitude of QED cross section from TEPEMGEN
519+
Zsys = {'PbPb': 82, 'OO': 8, 'NeNe': 10} # atomic number of colliding species
523520
PreCollContextTask=createTask(name='precollcontext', needs=precollneeds, cpu='1')
524521

525522
# adapt timeframeID + orbits + seed + qed
@@ -543,9 +540,14 @@ def getDPL_global_options(bigshm=False, ccdbbackend=True):
543540

544541
PreCollContextTask['cmd'] += ' --bcPatternFile ccdb' # <--- the object should have been set in (local) CCDB
545542
if includeQED:
546-
qedrate = INTRATE * QEDXSecExpected / PbPbXSec # hadronic interaction rate * cross_section_ratio
547-
qedspec = 'qed' + ',' + str(qedrate) + ',10000000:' + str(NEventsQED)
548-
PreCollContextTask['cmd'] += ' --QEDinteraction ' + qedspec
543+
if PDGA==2212 or PDGB==2212:
544+
# QED is not enabled for pp and pA collisions
545+
print('o2dpg_sim_workflow: Warning! QED is not enabled for pp or pA collisions')
546+
includeQED = False
547+
else:
548+
qedrate = INTRATE * QEDXSecExpected[COLTYPE] / XSecSys[COLTYPE] # hadronic interaction rate * cross_section_ratio
549+
qedspec = 'qed' + ',' + str(qedrate) + ',10000000:' + str(NEventsQED)
550+
PreCollContextTask['cmd'] += ' --QEDinteraction ' + qedspec
549551
workflow['stages'].append(PreCollContextTask)
550552

551553

@@ -558,43 +560,37 @@ def getDPL_global_options(bigshm=False, ccdbbackend=True):
558560
print('o2dpg_sim_workflow: Error! embedding background generator name not provided')
559561
exit(1)
560562

563+
# PDG translation for background
564+
if COLTYPEBKG in colsys.keys():
565+
PDGABKG=colsys[COLTYPEBKG][0]
566+
PDGBBKG=colsys[COLTYPEBKG][1]
567+
else:
568+
print('o2dpg_sim_workflow: Error! Unknown background collision system %s' % COLTYPEBKG)
569+
exit(1)
570+
561571
PROCESSBKG=args.procBkg
562572
ECMSBKG=float(args.eCM)
563573
EBEAMABKG=float(args.eA)
564574
EBEAMBBKG=float(args.eB)
565575

566-
if COLTYPEBKG == 'pp':
567-
PDGABKG=2212 # proton
568-
PDGBBKG=2212 # proton
569-
570576
if COLTYPEBKG == 'PbPb':
571-
PDGABKG=1000822080 # Pb
572-
PDGBBKG=1000822080 # Pb
573577
if ECMSBKG < 0: # assign 5.02 TeV to Pb-Pb
574578
print('o2dpg_sim_workflow: Set BKG CM Energy to PbPb case 5.02 TeV')
575579
ECMSBKG=5020.0
576580
if GENBKG == 'pythia8' and PROCESSBKG != 'heavy_ion':
577581
PROCESSBKG = 'heavy_ion'
578582
print('o2dpg_sim_workflow: Process type not considered for Pythia8 PbPb')
579583

580-
if COLTYPEBKG == 'pPb':
581-
PDGABKG=2212 # proton
582-
PDGBBKG=1000822080 # Pb
583-
584-
if COLTYPEBKG == 'Pbp':
585-
PDGABKG=1000822080 # Pb
586-
PDGBBKG=2212 # proton
587-
588584
# If not set previously, set beam energy B equal to A
589585
if EBEAMBBKG < 0 and ECMSBKG < 0:
590586
EBEAMBBKG=EBEAMABKG
591587
print('o2dpg_sim_workflow: Set beam energy same in A and B beams')
592-
if COLTYPEBKG=="pPb" or COLTYPEBKG=="Pbp":
593-
print('o2dpg_sim_workflow: Careful! both beam energies in bkg are the same')
588+
if PDGABKG != PDGBBKG:
589+
print('o2dpg_sim_workflow: Careful! Set same energies for different background beams!')
594590

595591
if ECMSBKG > 0:
596-
if COLTYPEBKG=="pPb" or COLTYPEBKG=="Pbp":
597-
print('o2dpg_sim_workflow: Careful! bkg ECM set for pPb/Pbp collisions!')
592+
if PDGABKG != PDGBBKG:
593+
print('o2dpg_sim_workflow: Careful! ECM set for different background beams!')
598594

599595
if ECMSBKG < 0 and EBEAMABKG < 0 and EBEAMBBKG < 0:
600596
print('o2dpg_sim_workflow: Error! bkg ECM or Beam Energy not set!!!')
@@ -727,11 +723,11 @@ def getDPL_global_options(bigshm=False, ccdbbackend=True):
727723
+ ' -n ' + str(NEventsQED) + ' -m PIPE ITS MFT FT0 FV0 FDD ' \
728724
+ ('', ' --timestamp ' + str(args.timestamp))[args.timestamp!=-1] + ' --run ' + str(args.run) \
729725
+ ' --seed ' + str(TFSEED) \
730-
+ ' -g extgen --configKeyValues \"GeneratorExternal.fileName=$O2_ROOT/share/Generators/external/QEDLoader.C;QEDGenParam.yMin=-7;QEDGenParam.yMax=7;QEDGenParam.ptMin=0.001;QEDGenParam.ptMax=1.;Diamond.width[2]=6.\"' # + ' --fromCollContext collisioncontext.root'
726+
+ ' -g extgen --configKeyValues \"GeneratorExternal.fileName=$O2_ROOT/share/Generators/external/QEDLoader.C;QEDGenParam.yMin=-7;QEDGenParam.yMax=7;QEDGenParam.ptMin=0.001;QEDGenParam.ptMax=1.;QEDGenParam.Z='+str(Zsys[COLTYPE])+';QEDGenParam.cmEnergy='+str(ECMS)+';Diamond.width[2]=6.\"' # + ' --fromCollContext collisioncontext.root'
731727
QED_task['cmd'] += '; RC=$?; QEDXSecCheck=`grep xSectionQED qedgenparam.ini | sed \'s/xSectionQED=//\'`'
732-
QED_task['cmd'] += '; echo "CheckXSection ' + str(QEDXSecExpected) + ' = $QEDXSecCheck"; [[ ${RC} == 0 ]]'
728+
QED_task['cmd'] += '; echo "CheckXSection ' + str(QEDXSecExpected[COLTYPE]) + ' = $QEDXSecCheck"; [[ ${RC} == 0 ]]'
733729
# TODO: propagate the Xsecion ratio dynamically
734-
QEDdigiargs=' --simPrefixQED qed' + ' --qed-x-section-ratio ' + str(QEDXSecExpected/PbPbXSec)
730+
QEDdigiargs=' --simPrefixQED qed' + ' --qed-x-section-ratio ' + str(QEDXSecExpected[COLTYPE]/XSecSys[COLTYPE])
735731
workflow['stages'].append(QED_task)
736732

737733
# recompute the number of workers to increase CPU efficiency

MC/config/common/external/generator/QEDepem.C

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ o2::eventgen::GeneratorTGenerator* QEDepem()
2929
genBg->SetPtRange(qedParam.ptMin, qedParam.ptMax); // Set pt limits (GeV) for e+-: 1MeV corresponds to max R=13.3mm at 5kGaus
3030
genBg->SetOrigin(diamond.position[0], diamond.position[1], diamond.position[2]); // vertex position in space
3131
genBg->SetSigma(diamond.width[0], diamond.width[1], diamond.width[2]); // vertex sigma
32+
genBg->SetCMEnergy(qedParam.cmEnergy); // center of mass energy per nucleon pair in GeV
33+
genBg->SetZ(qedParam.Z); // atomic number of the projectile/target (only symmetric systems are compatible for now)
3234
genBg->SetTimeOrigin(0.); // vertex position in time
3335
genBg->Init();
3436

0 commit comments

Comments
 (0)