Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions DATA/common/setenv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -225,3 +225,22 @@ add_comma_separated()
fi
done
}

add_semicolon_separated()
{
if (( $# < 2 )); then
echo "$# parameters received"
echo "Function name: ${FUNCNAME} expects at least 2 parameters:"
echo "it concatenates the string in 1st parameter by the following"
echo "ones, forming semi-colon-separated string. $# parameters received"
exit 1
fi

for ((i = 2; i <= $#; i++ )); do
if [[ -z ${!1} ]]; then
eval $1+="${!i}"
else
eval $1+="\;${!i}"
fi
done
}
50 changes: 50 additions & 0 deletions DATA/common/setenv_calib.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/bin/bash

# ---------------------------------------------------------------------------------------------------------------------

# Check that the requirements to enable the calibrations are met, and
# enabled them by default if they are not yet enabled or
# if they are not explicitly disabled.
# Then, configure data spec according to enabled calibrations

source $O2DPG_ROOT/DATA/common/setenv.sh

if [[ $BEAMTYPE != "cosmic" ]] && [[ $FORCECALIBRATIONS != 1 ]] ; then

# calibrations for primary vertex
if has_detector_calib ITS && has_detectors_reco ITS && has_detector_matching PRIMVTX && [[ ! -z "$VERTEXING_SOURCES" ]]; then
if [[ -z $CALIB_PRIMVTX_MEANVTX ]]; then CALIB_PRIMVTX_MEANVTX=1; fi
else
CALIB_PRIMVTX_MEANVTX=0
fi

# calibrations for TOF
if has_detector_calib TOF && has_detector_reco TOF; then
if has_detector_matching ITSTPCTOF || has_detector_matching ITSTPCTRDTOF; then
if [[ -z $CALIB_TOF_LHCPHASE ]]; then CALIB_TOF_LHCPHASE=1; fi
if [[ -z $CALIB_TOF_CHANNELOFFSETS ]]; then CALIB_TOF_CHANNELOFFSETS=1; fi
else
CALIB_TOF_LHCPHASE=0
CALIB_TOF_CHANNELOFFSETS=0
fi
if [[ -z $CALIB_TOF_DIAGNOSTICS ]]; then CALIB_TOF_DIAGNOSTICS=1; fi
else
CALIB_TOF_DIAGNOSTICS=0
fi

# calibrations for TPC
if has_detector_calib TPC && has_detectors ITS TPC TOF TRD; then
if has_detectors TPC ITS TRD TOF && has_detector_matching ITSTPCTRDTOF; then
if [[ -z $CALIB_TPC_SCDCALIB ]]; then CALIB_TPC_SCDCALIB=1; fi
else
CALIB_TPC_SCDCALIB=0
fi
fi
fi

if [[ $CALIB_PRIMVTX_MEANVTX == 1 ]] ; then add_semicolon_separated CALIBDATASPEC "pvtx:GLO/PVTX/0"; fi
if [[ $CALIB_TOF_LHCPHASE == 1 ]] || [[ $CALIB_TOF_CHANNELOFFSETS == 1 ]]; then add_semicolon_separated CALIBDATASPEC "calibTOF:TOF/CALIBDATA/0"; fi
if [[ $CALIB_TOF_DIAGNOSTICS == 1 ]]; then add_semicolon_separated CALIBDATASPEC "diagWords:TOF/DIAFREQ/0"; fi

echo CALIBDATASPEC = $CALIBDATASPEC 1>&2