3 # --------------------------------------------------------------------
8 if test $verb -lt 1 ; then return ; fi
12 # --------------------------------------------------------------------
16 Usage: $0 -p PRODUCTION [OPTIONS]
20 -v,--verbose Be verbose
21 -p,--production IDENTIFIER Production identifier [$prod]
22 -P,--pass NUMBER Reconstruction pass number [$pass]
23 -Q,--pre-pass STRING Prefix to pass identifier [${prep}]
24 -R,--post-pass STRING Postfix to pass identifier [$post]
25 -y,--year YEAR Year of production [$year]
26 -d,--destination DIRECTORY Directory to store result in [$dest]
27 -r,--run NUMBER Run number [$runn]
28 -q,--qa NUMBER QA number
29 -f,--file NAME File to get [$file]
30 -T,--trending Get trending.root file
31 -a,--archives Get ZIP archives
32 -n,--no-action Run dry (do not copy files)
34 If run number is set, get the parts of next-to-last merge of that run only.
39 # --------------------------------------------------------------------
43 scr=`mktemp -u Check_XXXXXXXX`
48 gSystem->Load("libANALYSIS");
49 gSystem->Load("libANALYSISalice");
50 gSystem->Load("libTENDER");
51 // gSystem->Load("libTENDERSupplies");
52 gSystem->Load("libPWG1");
53 gSystem->Load("libPWG3base");
54 TFile* file = TFile::Open("${inp}", "READ");
56 Error("${scr}", "No such file ${inp}");
59 TObject* forward1 = file->Get("Forward");
61 Error("${scr}", "No Forward object found in ${inp}");
64 TObject* forward2 = file->Get("ForwardResults");
66 Error("${scr}", "No ForwardResults object found in ${inp}");
73 mess -n "aliroot -l -b -q ${scr}.C "
74 aliroot -l -b -q ${scr}.C > /dev/null 2>&1
76 mess "-> $ret (0: good, 1: no file, 2: no Forward, 4: no ForwardResults"
81 # --------------------------------------------------------------------
94 while test $# -gt 0 ; do
96 -h|--help) usage ; exit 0 ;;
97 -v|--verbose) let verb=$verb+1 ;;
98 -p|--production) prod=$2 ; shift ;;
99 -P|--pass) pass=$2 ; shift ;;
100 -Q|--prepass) prep=$2 ; shift ;;
101 -R|--postpass) post=$2 ; shift ;;
102 -y|--year) year=$2 ; shift ;;
103 -d|--destination) dest=$2 ; shift ;;
104 -r|--run) runn=$2 ; shift ;;
105 -q|--qa) qano=$2 ; shift ;;
106 -f|--file) file=$2 ; shift ;;
107 -T|--trending) file=trending.root ; shift ;;
108 -a|--archives) arch=1 ;;
109 -n|--no-action) noac=1 ;;
110 *) echo "$0: Unknown option $1" > /dev/stderr ; exit 2 ;;
115 # --------------------------------------------------------------------
117 genv_file=/tmp/gclient_env_${uid}
119 if test ! -f ${genv_file} ; then
120 echo "No such file: ${genv_file}, please do alien-token-init" >/dev/stderr
124 alien-token-info | grep -q "Token is still valid"
125 if test $? -ne 0 ; then
126 echo "Token not valid, please re-new" > /dev/stderr
131 # --------------------------------------------------------------------
132 if test "x$prod" = "x" ; then
133 echo "No production identifier given" > /dev/stderr
137 if test "x$year" = "x" ; then
138 year=`echo $prod | sed -e 's/LHC\(..\).*/\1/'`
139 if test "x$year" = "x" ; then
140 echo "Couldn't get year from production identifier $prod" > /dev/stderr
144 lett=`echo $prod | sed -e "s/LHC${year}\(.\).*/\1/"`
145 suff=`echo $prod | sed -e "s/LHC${year}${lett}//"`
148 if test $verb -gt 1 ; then redir=/dev/stderr ; fi
150 # --------------------------------------------------------------------
151 if test "x$post" != "x" ; then
154 *) post="_${post}" ;;
157 if test ${pass} -ge 0 ; then
162 if test "x${suff}" != "x" ; then
166 path=/alice/${datd}/20${year}/${prod}/
167 store=${dest}/${prod}/${prep}${paid}${post}
168 search="${esdd}${prep}${paid}${post}"
169 if test $runn -gt 0 ; then
170 path=`printf "${path}%09d/ESDs/${prep}${paid}${pass}${post}/" $runn`
171 store=`printf "${store}/%09d" $runn`
174 if test $qano -gt 0 ; then
175 if test $runn -gt 0 ; then
176 path=`printf "%sQA%02d/" $path $qano`
178 if test "x$search" != "x" ; then search=${search}/ ; fi
179 search=${search}QA`printf %02d ${qano}`
182 if test $arch -gt 0 ; then
185 base=`basename $file .root`
186 if test "x$search" != "x" ; then search=${search}/ ; fi
187 search="${search}${file}"
189 # --------------------------------------------------------------------
205 Search string: $search
210 # --------------------------------------------------------------------
212 mess "alien_find ${path} ${search}"
213 files=`alien_find ${path} ${search} | grep -v "files found" 2> ${redir}`
217 b=`echo $i | sed -e "s,${path},,"`
219 if test $runn -gt 0 ; then
220 r=`echo $b | sed -e "s,[0-9]*${runn}\([0-9.]*\)/.*,\1," | tr '.' '_'`
221 if test $arch -lt 1 ; then
222 o=${store}/${base}_${r}.root
229 r=`echo $b | sed -e "s,/.*,,"`
230 o=${store}/${base}_${r}.root
234 if test $noac -lt 1 && test ! -f $o ; then
235 mess "alien_cp alien:${i} file:${o}"
236 alien_cp alien:${i} file:${o} > ${redir} 2>&1
238 if test $noac -lt 1 && test $arch -lt 1 ; then check_file $o ; fi
239 if test $noac -lt 1 && test $arch -gt 0 ; then
240 (cd ${d} && unzip QAarchive.zip) > $redir 2>&1
244 mess "Got a total of $j files for runs $runs"
246 # --------------------------------------------------------------------