Skip to content

Commit d0e1981

Browse files
authored
MC: allow ITS3 to be simulated by dpg scripts (#2128)
* MC: allow to specify detector list * MC: allow to run ITS3
1 parent 41467f3 commit d0e1981

File tree

1 file changed

+22
-10
lines changed

1 file changed

+22
-10
lines changed

MC/bin/o2dpg_sim_workflow.py

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
parser.add_argument('-trigger',help='event selection: particle, external', default='')
7272
parser.add_argument('-ini',help='generator init parameters file (full paths required), for example: ${O2DPG_ROOT}/MC/config/PWGHF/ini/GeneratorHF.ini', default='')
7373
parser.add_argument('-confKey',help='o2sim, generator or trigger configuration key values, for example: "GeneratorPythia8.config=pythia8.cfg;A.x=y"', default='')
74+
parser.add_argument('--detectorList',help='pick which version of ALICE should be simulated', default='ALICE2')
7475
parser.add_argument('--readoutDets',help='comma separated string of detectors readout (does not modify material budget - only hit creation)', default='all')
7576
parser.add_argument('--make-evtpool', help='Generate workflow for event pool creation.', action='store_true')
7677

@@ -565,7 +566,7 @@ def getDPL_global_options(bigshm=False, ccdbbackend=True):
565566
orbitsPerTF=int(args.orbitsPerTF)
566567
GRP_TASK = createTask(name='grpcreate', needs=["geomprefetch"], cpu='0')
567568
GRP_TASK['cmd'] = 'o2-grp-simgrp-tool createGRPs --timestamp ' + str(args.timestamp) + ' --run ' + str(args.run) + ' --publishto ${ALICEO2_CCDB_LOCALCACHE:-.ccdb} -o grp --hbfpertf ' + str(orbitsPerTF) + ' --field ' + args.field
568-
GRP_TASK['cmd'] += ' --readoutDets ' + " ".join(activeDetectors) + ' --print ' + ('','--lhcif-CCDB')[args.run_anchored]
569+
GRP_TASK['cmd'] += ' --detectorList ' + args.detectorList + ' --readoutDets ' + " ".join(activeDetectors) + ' --print ' + ('','--lhcif-CCDB')[args.run_anchored]
569570
if (not args.run_anchored == True) and len(args.bcPatternFile) > 0:
570571
GRP_TASK['cmd'] += ' --bcPatternFile ' + str(args.bcPatternFile)
571572
if len(CONFKEYMV) > 0:
@@ -714,7 +715,8 @@ def getDPL_global_options(bigshm=False, ccdbbackend=True):
714715
+ ' --field ccdb ' + str(CONFKEYBKG) \
715716
+ ('',' --timestamp ' + str(args.timestamp))[args.timestamp!=-1] + ' --run ' + str(args.run) \
716717
+ ' --vertexMode kCCDB' \
717-
+ ' --fromCollContext collisioncontext.root:bkg'
718+
+ ' --fromCollContext collisioncontext.root:bkg ' \
719+
+ ' --detectorList ' + args.detectorList
718720

719721
if not isActive('all'):
720722
BKGtask['cmd'] += ' --readoutDetectors ' + " ".join(activeDetectors)
@@ -748,6 +750,9 @@ def getDPL_global_options(bigshm=False, ccdbbackend=True):
748750

749751
# a list of smaller sensors (used to construct digitization tasks in a parametrized way)
750752
smallsensorlist = [ "ITS", "TOF", "FDD", "MCH", "MID", "MFT", "HMP", "PHS", "CPV", "ZDC" ]
753+
if args.detectorList == 'ALICE2.1':
754+
smallsensorlist = ['IT3' if sensor == 'ITS' else sensor for sensor in smallsensorlist]
755+
751756
# a list of detectors that serve as input for the trigger processor CTP --> these need to be processed together for now
752757
ctp_trigger_inputlist = [ "FT0", "FV0", "EMC" ]
753758

@@ -805,12 +810,15 @@ def getDPL_global_options(bigshm=False, ccdbbackend=True):
805810
# determine final conf key for QED simulation
806811
QEDBaseConfig = "GeneratorExternal.fileName=$O2_ROOT/share/Generators/external/QEDLoader.C;QEDGenParam.yMin=-7;QEDGenParam.yMax=7;QEDGenParam.ptMin=0.001;QEDGenParam.ptMax=1.;QEDGenParam.xSectionHad="+str(XSecSys[COLTYPE])+";QEDGenParam.Z="+str(Zsys[COLTYPE])+";QEDGenParam.cmEnergy="+str(ECMS)+";Diamond.width[2]=6.;"
807812
QEDCONFKEY = constructConfigKeyArg(create_geant_config(args, QEDBaseConfig + args.confKeyQED))
808-
813+
qed_detectorlist = ' ITS MFT FT0 FV0 FDD '
814+
if args.detectorList == 'ALICE2.1':
815+
qed_detectorlist = qed_detectorlist.replace('ITS', 'IT3')
809816
QED_task['cmd'] = 'o2-sim -e TGeant3 --field ccdb -j ' + str('1') + ' -o qed' \
810-
+ ' -n ' + str(NEventsQED) + ' -m PIPE ITS MFT FT0 FV0 FDD ' \
817+
+ ' -n ' + str(NEventsQED) + ' -m ' + qed_detectorlist \
811818
+ ('', ' --timestamp ' + str(args.timestamp))[args.timestamp!=-1] + ' --run ' + str(args.run) \
812819
+ ' --seed ' + str(TFSEED) \
813820
+ ' -g extgen ' \
821+
+ ' --detectorList ' + args.detectorList \
814822
+ QEDCONFKEY
815823
QED_task['cmd'] += '; RC=$?; QEDXSecCheck=`grep xSectionQED qedgenparam.ini | sed \'s/xSectionQED=//\'`'
816824
QED_task['cmd'] += '; echo "CheckXSection ' + str(QEDXSecExpected[COLTYPE]) + ' = $QEDXSecCheck"; [[ ${RC} == 0 ]]'
@@ -914,6 +922,7 @@ def getDPL_global_options(bigshm=False, ccdbbackend=True):
914922
+ ' -g ' + str(GENERATOR) + ' ' + str(INIFILE) + ' -o genevents ' + embeddinto \
915923
+ ('', ' --timestamp ' + str(args.timestamp))[args.timestamp!=-1] \
916924
+ ' --seed ' + str(TFSEED) + ' -n ' + str(NSIGEVENTS) \
925+
+ ' --detectorList ' + args.detectorList \
917926
+ ' --fromCollContext collisioncontext.root:' + signalprefix
918927
if GENERATOR=="hepmc":
919928
SGNGENtask['cmd'] += "; RC=$?; ${O2DPG_ROOT}/UTILS/UpdateHepMCEventSkip.sh ../HepMCEventSkip.json " + str(tf) + '; [[ ${RC} == 0 ]]'
@@ -935,6 +944,7 @@ def getDPL_global_options(bigshm=False, ccdbbackend=True):
935944
relative_cpu=7/8, n_workers=NWORKERS_TF, mem=str(sgnmem))
936945
sgncmdbase = '${O2_ROOT}/bin/o2-sim -e ' + str(SIMENGINE) + ' ' + str(MODULES) + ' -n ' + str(NSIGEVENTS) + ' --seed ' + str(TFSEED) \
937946
+ ' --field ccdb -j ' + str(NWORKERS_TF) + ' ' + str(CONFKEY) + ' ' + str(INIFILE) + ' -o ' + signalprefix + ' ' + embeddinto \
947+
+ ' --detectorList ' + args.detectorList \
938948
+ ('', ' --timestamp ' + str(args.timestamp))[args.timestamp!=-1] + ' --run ' + str(args.run)
939949
if sep_event_mode:
940950
SGNtask['cmd'] = sgncmdbase + ' -g extkinO2 --extKinFile genevents_Kine.root ' + ' --vertexMode kNoVertex'
@@ -1121,7 +1131,7 @@ def createRestDigiTask(name, det='ALLSMALLER'):
11211131
tneeds += [QED_task['name']]
11221132
commondigicmd = '${O2_ROOT}/bin/o2-sim-digitizer-workflow ' + getDPL_global_options() + ' -n ' + str(args.ns) + simsoption \
11231133
+ ' --interactionRate ' + str(INTRATE) + ' --incontext ' + str(CONTEXTFILE) + ' --disable-write-ini' \
1124-
+ putConfigValues(["MFTAlpideParam", "ITSAlpideParam", "ITSDigitizerParam"],
1134+
+ putConfigValues(["MFTAlpideParam", "ITSAlpideParam", "ITSDigitizerParam" if args.detectorList == 'ALICE2' else "IT3DigitizerParam"],
11251135
localCF={"DigiParams.seed" : str(TFSEED), "MCHDigitizer.seed" : str(TFSEED)}) + QEDdigiargs
11261136

11271137
if det=='ALLSMALLER': # here we combine all smaller digits in one DPL workflow
@@ -1294,12 +1304,12 @@ def getDigiTaskName(det):
12941304

12951305
#<--------- ITS reco task
12961306
ITSMemEstimate = 12000 if havePbPb else 2000 # PbPb has much large mem requirement for now (in worst case)
1297-
ITSRECOtask=createTask(name='itsreco_'+str(tf), needs=[getDigiTaskName("ITS")],
1298-
tf=tf, cwd=timeframeworkdir, lab=["RECO"], cpu='1', mem=str(ITSMemEstimate))
1307+
ITSRECOtask=createTask(name='itsreco_'+str(tf), needs=[getDigiTaskName("ITS" if args.detectorList == 'ALICE2' else "IT3")],
1308+
tf=tf, cwd=timeframeworkdir, lab=["RECO"], cpu='1', mem=str(ITSMemEstimate))
12991309
ITSRECOtask['cmd'] = task_finalizer([
1300-
"${O2_ROOT}/bin/o2-its-reco-workflow",
1310+
"${O2_ROOT}/bin/o2-its-reco-workflow" if args.detectorList == 'ALICE2' else "${O2_ROOT}/bin/o2-its3-reco-workflow",
13011311
getDPL_global_options(bigshm=havePbPb),
1302-
'--trackerCA',
1312+
'--trackerCA' if args.detectorList == 'ALICE2' else '',
13031313
'--tracking-mode async',
13041314
putConfigValues(["ITSVertexerParam",
13051315
"ITSAlpideParam",
@@ -1337,6 +1347,7 @@ def getDigiTaskName(det):
13371347
'ITSClustererParam',
13381348
'GPU_rec_tpc',
13391349
'trackTuneParams',
1350+
'GlobalParams',
13401351
'ft0tag'],
13411352
{"NameConf.mDirMatLUT" : ".."} | tpcLocalCFreco),
13421353
tpc_corr_scaling_options,
@@ -1365,6 +1376,7 @@ def getDigiTaskName(det):
13651376
'trackTuneParams',
13661377
'GPU_rec_tpc',
13671378
'TPCGasParam',
1379+
'GlobalParams',
13681380
'TPCCorrMap'], {"NameConf.mDirMatLUT" : ".."} | tpcLocalCFreco),
13691381
'--track-sources ' + trd_track_sources,
13701382
tpc_corr_scaling_options,
@@ -1655,7 +1667,7 @@ def getDigiTaskName(det):
16551667
[ '${O2_ROOT}/bin/o2-secondary-vertexing-workflow',
16561668
getDPL_global_options(bigshm=True),
16571669
svfinder_threads,
1658-
putConfigValues(['svertexer', 'TPCCorrMap'], {"NameConf.mDirMatLUT" : ".."} | tpcLocalCFreco),
1670+
putConfigValues(['svertexer', 'TPCCorrMap', 'GlobalParams'], {"NameConf.mDirMatLUT" : ".."} | tpcLocalCFreco),
16591671
tpc_corr_scaling_options,
16601672
tpc_corr_options_mc,
16611673
'--vertexing-sources ' + svfinder_sources,

0 commit comments

Comments
 (0)