Skip to content

Commit 9f35ffe

Browse files
committed
Allow TPC residual extraction in MC and data corr maps in the reco
1 parent 529b92a commit 9f35ffe

File tree

2 files changed

+65
-2
lines changed

2 files changed

+65
-2
lines changed

MC/bin/o2dpg_sim_workflow.py

Lines changed: 60 additions & 2 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')
@@ -489,6 +490,7 @@ def getDPL_global_options(bigshm=False, ccdbbackend=True):
489490
includeFullQC=args.include_qc=='True' or args.include_qc==True
490491
includeLocalQC=args.include_local_qc=='True' or args.include_local_qc==True
491492
includeAnalysis = args.include_analysis
493+
includeTPCResiduals=True if environ.get('ALIEN_JDL_DOTPCRESIDUALEXTRACTION') == '1' else False
492494

493495
qcdir = "QC"
494496
if (includeLocalQC or includeFullQC) and not isdir(qcdir):
@@ -1170,17 +1172,19 @@ def getDigiTaskName(det):
11701172
# in case of PbPb the conversion factor ZDC ->FT0 (pp) must be set
11711173
tpc_corr_options_mc=''
11721174

1175+
tpcCorrmapLumiMode = args.tpc_corrmap_lumi_mode
1176+
11731177
if tpcDistortionType == 0: # disable distortion corrections
11741178
tpc_corr_options_mc=' --corrmap-lumi-mode 0 '
11751179
tpcLocalCFreco['TPCCorrMap.lumiMean'] = '-1';
11761180
elif tpcDistortionType == 1: # disable scaling
1177-
tpc_corr_options_mc=' --corrmap-lumi-mode 2 '
1181+
tpc_corr_options_mc=' --corrmap-lumi-mode ' + str(tpcCorrmapLumiMode) + ' '
11781182
tpcLocalCFreco['TPCCorrMap.lumiInst'] = str(CTPSCALER)
11791183
tpcLocalCFreco['TPCCorrMap.lumiMean'] = str(CTPSCALER)
11801184
elif tpcDistortionType == 2: # full scaling with CTP values
11811185
if COLTYPE == 'PbPb':
11821186
tpcLocalCFreco['TPCCorrMap.lumiInstFactor'] = str(lumiInstFactor)
1183-
tpc_corr_options_mc=' --corrmap-lumi-mode 2 '
1187+
tpc_corr_options_mc=' --corrmap-lumi-mode ' + str(tpcCorrmapLumiMode) + ' '
11841188
tpcLocalCFreco['TPCCorrMap.lumiInst'] = str(CTPSCALER)
11851189

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

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

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)