Skip to content

Commit e03a513

Browse files
committed
Allow TPC residual extraction in MC and data corr maps in the reco
Apply ccdb remapping if ALIEN_JDL_REMAPPINGS is defined
1 parent 1a30c42 commit e03a513

File tree

2 files changed

+78
-12
lines changed

2 files changed

+78
-12
lines changed

MC/bin/o2dpg_sim_workflow.py

Lines changed: 73 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@
153153

154154
# TPC options
155155
parser.add_argument('--tpc-distortion-type', default=0, type=int, help='Simulate distortions in the TPC (0=no distortions, 1=distortions without scaling, 2=distortions with CTP scaling)')
156+
parser.add_argument('--tpc-corrmap-lumi-mode', default=2, type=int, help='TPC corrections mode (0=linear, 1=derivative, 2=derivative for special MC maps')
156157
parser.add_argument('--ctp-scaler', default=0, type=float, help='CTP raw scaler value used for distortion simulation')
157158
# Global Forward reconstruction configuration
158159
parser.add_argument('--fwdmatching-assessment-full', action='store_true', help='enables complete assessment of global forward reco')
@@ -472,28 +473,32 @@ def extractVertexArgs(configKeyValuesStr, finalDiamondDict):
472473
workflow['stages'].append(globalinittask)
473474
####
474475

476+
usebkgcache=args.use_bkg_from!=None
477+
includeFullQC=args.include_qc=='True' or args.include_qc==True
478+
includeLocalQC=args.include_local_qc=='True' or args.include_local_qc==True
479+
includeAnalysis = args.include_analysis
480+
includeTPCResiduals=True if environ.get('ALIEN_JDL_DOTPCRESIDUALEXTRACTION') == '1' else False
481+
ccdbRemap = environ.get('ALIEN_JDL_REMAPPINGS')
482+
483+
qcdir = "QC"
484+
if (includeLocalQC or includeFullQC) and not isdir(qcdir):
485+
mkdir(qcdir)
486+
475487
def getDPL_global_options(bigshm=False, ccdbbackend=True):
476488
common=" -b --run "
477489
if len(args.dpl_child_driver) > 0:
478490
common=common + ' --child-driver ' + str(args.dpl_child_driver)
479491
if ccdbbackend:
480492
common=common + " --condition-not-after " + str(args.condition_not_after)
493+
if ccdbRemap != None:
494+
common=common + " --condition-remap " + ccdbRemap
481495
if args.noIPC!=None:
482496
return common + " --no-IPC "
483497
if bigshm:
484498
return common + " --shm-segment-size ${SHMSIZE:-50000000000} "
485499
else:
486500
return common
487-
488-
usebkgcache=args.use_bkg_from!=None
489-
includeFullQC=args.include_qc=='True' or args.include_qc==True
490-
includeLocalQC=args.include_local_qc=='True' or args.include_local_qc==True
491-
includeAnalysis = args.include_analysis
492-
493-
qcdir = "QC"
494-
if (includeLocalQC or includeFullQC) and not isdir(qcdir):
495-
mkdir(qcdir)
496-
501+
497502
# create/publish the GRPs and other GLO objects for consistent use further down the pipeline
498503
orbitsPerTF=int(args.orbitsPerTF)
499504
GRP_TASK = createTask(name='grpcreate', cpu='0')
@@ -1170,17 +1175,19 @@ def getDigiTaskName(det):
11701175
# in case of PbPb the conversion factor ZDC ->FT0 (pp) must be set
11711176
tpc_corr_options_mc=''
11721177

1178+
tpcCorrmapLumiMode = args.tpc_corrmap_lumi_mode
1179+
11731180
if tpcDistortionType == 0: # disable distortion corrections
11741181
tpc_corr_options_mc=' --corrmap-lumi-mode 0 '
11751182
tpcLocalCFreco['TPCCorrMap.lumiMean'] = '-1';
11761183
elif tpcDistortionType == 1: # disable scaling
1177-
tpc_corr_options_mc=' --corrmap-lumi-mode 2 '
1184+
tpc_corr_options_mc=' --corrmap-lumi-mode ' + str(tpcCorrmapLumiMode) + ' '
11781185
tpcLocalCFreco['TPCCorrMap.lumiInst'] = str(CTPSCALER)
11791186
tpcLocalCFreco['TPCCorrMap.lumiMean'] = str(CTPSCALER)
11801187
elif tpcDistortionType == 2: # full scaling with CTP values
11811188
if COLTYPE == 'PbPb':
11821189
tpcLocalCFreco['TPCCorrMap.lumiInstFactor'] = str(lumiInstFactor)
1183-
tpc_corr_options_mc=' --corrmap-lumi-mode 2 '
1190+
tpc_corr_options_mc=' --corrmap-lumi-mode ' + str(tpcCorrmapLumiMode) + ' '
11841191
tpcLocalCFreco['TPCCorrMap.lumiInst'] = str(CTPSCALER)
11851192

11861193
# Setup the TPC correction scaling options for reco; They come from the anchoring setup
@@ -1629,6 +1636,60 @@ def getDigiTaskName(det):
16291636
# Consider in future: AODtask['disable_alternative_reco_software'] = True # do not apply reco software here (we prefer latest aod converter)
16301637
workflow['stages'].append(AODtask)
16311638

1639+
if includeTPCResiduals:
1640+
print ("Adding TPC residuals extraction and aggregation")
1641+
1642+
#<------------- TPC residuals extraction
1643+
scdcalib_vertex_sources = dpl_option_from_config(anchorConfig,
1644+
'o2-tpc-scdcalib-interpolation-workflow',
1645+
'vtx-sources',
1646+
default_value='ITS-TPC,TPC-TRD,ITS-TPC-TRD,TPC-TOF,ITS-TPC-TOF,TPC-TRD-TOF,ITS-TPC-TRD-TOF,MFT-MCH,MCH-MID,ITS,MFT,TPC,TOF,FT0,MID,EMC,PHS,CPV,FDD,HMP,FV0,TRD,MCH,CTP')
1647+
1648+
scdcalib_track_sources = dpl_option_from_config(anchorConfig,
1649+
'o2-tpc-scdcalib-interpolation-workflow',
1650+
'tracking-sources',
1651+
default_value='ITS-TPC,TPC-TRD,ITS-TPC-TRD,TPC-TOF,ITS-TPC-TOF,TPC-TRD-TOF,ITS-TPC-TRD-TOF,MFT-MCH,MCH-MID,ITS,MFT,TPC,TOF,FT0,MID,EMC,PHS,CPV,FDD,HMP,FV0,TRD,MCH,CTP')
1652+
1653+
scdcalib_track_extraction = dpl_option_from_config(anchorConfig,
1654+
'o2-tpc-scdcalib-interpolation-workflow',
1655+
'tracking-sources-map-extraction',
1656+
default_value='ITS-TPC')
1657+
1658+
SCDCALIBtask = createTask(name='scdcalib_'+str(tf), needs=[PVFINDERtask['name']], tf=tf, cwd=timeframeworkdir, lab=["CALIB"], mem='4000')
1659+
SCDCALIBtask['cmd'] = task_finalizer(
1660+
[ '${O2_ROOT}/bin/o2-tpc-scdcalib-interpolation-workflow',
1661+
getDPL_global_options(bigshm=True),
1662+
putConfigValues(['scdcalib']),
1663+
'--vtx-sources ' + scdcalib_vertex_sources,
1664+
'--tracking-sources ' + scdcalib_track_sources,
1665+
'--tracking-sources-map-extraction ' + scdcalib_track_extraction,
1666+
'--sec-per-slot 1 ',
1667+
'--send-track-data'
1668+
])
1669+
workflow['stages'].append(SCDCALIBtask)
1670+
1671+
#<------------- TPC residuals aggregator
1672+
scdaggreg_secperslot = dpl_option_from_config(anchorConfig,
1673+
'o2-calibration-residual-aggregator',
1674+
'sec-per-slot',
1675+
default_value='600')
1676+
scdaggreg_outputtype = dpl_option_from_config(anchorConfig,
1677+
'o2-calibration-residual-aggregator',
1678+
'output-type',
1679+
default_value='trackParams,unbinnedResid')
1680+
1681+
SCDAGGREGtask = createTask(name='scdaggreg_'+str(tf), needs=[SCDCALIBtask['name']], tf=tf, cwd=timeframeworkdir, lab=["CALIB"], mem='1500')
1682+
SCDAGGREGtask['cmd'] = task_finalizer(
1683+
[ '${O2_ROOT}/bin/o2-calibration-residual-aggregator',
1684+
getDPL_global_options(bigshm=True),
1685+
'--sec-per-slot ' + scdaggreg_secperslot,
1686+
'--enable-ctp ',
1687+
'--output-dir ./',
1688+
'--output-type ' + scdaggreg_outputtype
1689+
])
1690+
workflow['stages'].append(SCDAGGREGtask)
1691+
1692+
# conditional
16321693
#
16331694
# QC tasks follow
16341695
#

MC/run/ANCHOR/anchorMC.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,11 @@ if [[ "${MCRC}" == "0" && "${ALIEN_JDL_ADDTIMESERIESINMC}" != "0" ]]; then
393393
# Note: We could maybe avoid this if-else by including `tpctimes` directly in the workflow-targets above
394394
fi
395395

396+
if [[ "${MCRC}" == "0" && "${ALIEN_JDL_DOTPCRESIDUALEXTRACTION}" = "1" ]]; then
397+
echo_info "Running TPC residuals extraction and aggregation"
398+
${O2DPG_ROOT}/MC/bin/o2_dpg_workflow_runner.py -f workflow.json -tt scdaggreg
399+
fi
400+
396401
[[ -n "${DISABLE_QC}" ]] && echo_info "QC is disabled, skip it."
397402

398403
if [[ -z "${DISABLE_QC}" && "${MCRC}" == "0" && "${remainingargs}" == *"--include-local-qc"* ]] ; then

0 commit comments

Comments
 (0)