#modify the OCDB: set the year
if [[ ${dataType} =~ sim ]]; then
- anchorYear=$(for x in $mcProductionMap ; do [[ "${x}" =~ ${originalPeriod} ]] && echo ${x} && break; done)
- anchorYear=${anchorYear#*=}
+ anchorYear=$(run2year $runNumber)
if [[ -z "${anchorYear}" ]]; then
- echo WARNING: anchorYear not available for this production: ${originalPeriod}, cannot set the OCDB."
+ echo "WARNING: anchorYear not available for this production: ${originalPeriod}, runNumber: ${runNumber}. Cannot set the OCDB."
return 1
fi
ocdbStorage=$(setYear ${anchorYear} ${ocdbStorage})
fi
#if [[ -z ${dataType} || -z ${year} || -z ${period} || -z ${runNumber}} || -z ${pass} ]];
- if [[ -z ${runNumber}} ]]
+ if [[ -z ${runNumber} ]]
then
#error condition
return 1
fi
}
+run2year()
+{
+ #for a given run print the year.
+ #the run-year table is ${runMap} (a string)
+ #defined in the config file
+ #one line per year, format: year runMin runMax
+ local run=$1
+ [[ -z ${run} ]] && return 1
+ local year=""
+ local runMin=""
+ local runMax=""
+ while read year runMin runMax; do
+ [[ -z ${year} || -z ${runMin} || -z ${runMax} ]] && continue
+ [[ ${run} -ge ${runMin} && ${run} -le ${runMax} ]] && echo ${year} && break
+ done < <(echo "${runMap}")
+ return 0
+}
+
substituteDetectorName()
{
local det=$1