]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGGA/PHOSTasks/PHOS_PbPb/macros/LEGO/copyRunFiles.sh
modified to accommodate aod115.
[u/mrichter/AliRoot.git] / PWGGA / PHOSTasks / PHOS_PbPb / macros / LEGO / copyRunFiles.sh
CommitLineData
b8149578 1# This macro can be used to copy the run merge files of a lego train to local machine
2# You may need to change some of the following variables
3# author: Henrik Qvigstad <henrik.qvigstad@cern.ch>
4
5# From where to read:
6RUNLISTFULL=runlistLHC11h.txt
7AFILENAME=AnalysisResults.root
8GRID_PATH=/alice/data/2011/LHC11h_2
4522fd11 9GRID_FILE_PATERN=ESDs/pass2/AOD115/PWGGA/GA_PbPb/17_20121218-1528/$AFILENAME
b8149578 10# Where to store:
4522fd11 11LOCAL_DIR=$(pwd)/GA_PbPb_17
a9374e35 12FIND_RESULTS_FILE=$LOCAL_DIR/find_results.txt
13RUNFILE=$LOCAL_DIR/runFile.txt
b8149578 14
15
16
a9374e35 17if [ -f "$FIND_RESULTS_FILE" ]; then
18 echo using $FIND_RESULTS_FILE
19else
aa259aba 20 mkdir -p $LOCAL_DIR
a9374e35 21 echo Doing alien_find $GRID_PATH $GRID_FILE_PATERN,
22 echo may take some time ...
23 alien_find $GRID_PATH $GRID_FILE_PATERN >> $FIND_RESULTS_FILE
24 echo done
25 echo storing results to $FIND_RESULTS_FILE
26fi
b8149578 27
a9374e35 28# Remove the file which lists runs and files
29rm -rf $RUNFILE
b8149578 30
a9374e35 31# Download run output files, and fill $RUNFILE
b8149578 32for run in $(cat $RUNLISTFULL); do
33 echo looking for run $run in find results
a9374e35 34 for line in $(cat $FIND_RESULTS_FILE); do
b8149578 35 file=$(echo $line | grep $run)
36 if [ -n "$file" ]; then
37 break
38 fi
39 done
40 if [ -n "$file" ]; then
41 TOPATH=$LOCAL_DIR/$run
42 TOFILE=$TOPATH/$AFILENAME
43 mkdir -p $TOPATH
a9374e35 44 if [[ -f "$TOFILE" && -s "$TOFILE" ]]; then
b8149578 45 echo file exists, abort copying.
46 else
47 echo alien_cp alien:$file file:$TOFILE
48 alien_cp alien:$file file:$TOFILE
49 fi
a9374e35 50 echo adding to $RUNFILE
51 echo " $run and $TOFILE"
52 echo "$run $TOFILE" >> $RUNFILE
b8149578 53 else
54 echo $run has no file
55 fi
56done