Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-03 08:20:22

0001 #!/usr/bin/bash
0002 
0003 filename=`basename ${1}`   # must be a local file
0004 destination=${2}
0005 rename=${3:-${filename}}
0006 
0007 if [[ "$USER" == "chiu" ]]
0008 then
0009   echo $0 $filename $destination $rename
0010   exit
0011 fi
0012 
0013 mv ${filename} ${rename}
0014 filename=${rename}
0015 
0016 echo stageout ${filename} ${destination} start `date`
0017 
0018 regex_dsttype_run="(DST_[A-Z_]+[a-z0-9]+)_([a-z0-9]+)_(202[345]p[0-9][0-9][0-9])-([0-9]+)-([0-9]+)"
0019 regex_dsttype_range="(DST_[A-Z_]+[a-z0-9]+)_([a-z0-9]+)_(202[345]p[0-9][0-9][0-9])-([0-9]+)-([0-9]+)-([0-9]+)"
0020 
0021 # decode filename
0022 base=${filename/.root/}
0023 dstname=${base%%-*}
0024 
0025 # Filename matches a dsttype with a single run
0026 if [[ $base =~ $regex_dsttype_run ]]; then
0027    dsttype=${BASH_REMATCH[1]}
0028  echo $dsttype ...
0029    build=${BASH_REMATCH[2]}
0030  echo $build
0031    dbtag=${BASH_REMATCH[3]}
0032  echo $dbtag
0033    runnumber=${BASH_REMATCH[4]}
0034  echo $runnumber
0035    segment=${BASH_REMATCH[5]}
0036  echo $segment
0037 fi
0038 # Filename matches a dst "run range" type
0039 if [[ $base =~ $regex_dsttype_range ]]; then
0040    dsttype=${BASH_REMATCH[1]}
0041  echo $dsttype ...
0042    build=${BASH_REMATCH[2]}
0043  echo $build
0044    dbtag=${BASH_REMATCH[3]}
0045  echo $dbtag
0046    runnumber=${BASH_REMATCH[4]}
0047  echo $runnumber
0048    runnumber2=${BASH_REMATCH[5]}
0049  echo $runnumber
0050    segment=${BASH_REMATCH[6]}
0051  echo $segment
0052 fi
0053 
0054 nevents_=$( root.exe -q -b GetEntries.C\(\"${filename}\"\) | awk '/Number of Entries/{ print $4; }' )
0055 nevents=${nevents_:--1}
0056 
0057 # prodtype is required... specifies whether the production status entry manages a single output file (only) or many output files (many).
0058 echo ./cups.py -r ${runnumber} -s ${segment} -d ${dstname}  stageout ${filename} ${destination} --dsttype ${dsttype} --dataset ${build}_${dbtag} --nevents ${nevents} --inc --prodtype many
0059      ./cups.py -r ${runnumber} -s ${segment} -d ${dstname}  stageout ${filename} ${destination} --dsttype ${dsttype} --dataset ${build}_${dbtag} --nevents ${nevents} --inc --prodtype many
0060 
0061 
0062 echo stageout ${filename} ${destination} finish `date`
0063 
0064 
0065 
0066