]>
Commit | Line | Data |
---|---|---|
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: | |
6 | RUNLISTFULL=runlistLHC11h.txt | |
7 | AFILENAME=AnalysisResults.root | |
8 | GRID_PATH=/alice/data/2011/LHC11h_2 | |
4522fd11 | 9 | GRID_FILE_PATERN=ESDs/pass2/AOD115/PWGGA/GA_PbPb/17_20121218-1528/$AFILENAME |
b8149578 | 10 | # Where to store: |
4522fd11 | 11 | LOCAL_DIR=$(pwd)/GA_PbPb_17 |
a9374e35 | 12 | FIND_RESULTS_FILE=$LOCAL_DIR/find_results.txt |
13 | RUNFILE=$LOCAL_DIR/runFile.txt | |
b8149578 | 14 | |
15 | ||
16 | ||
a9374e35 | 17 | if [ -f "$FIND_RESULTS_FILE" ]; then |
18 | echo using $FIND_RESULTS_FILE | |
19 | else | |
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 | |
26 | fi | |
b8149578 | 27 | |
a9374e35 | 28 | # Remove the file which lists runs and files |
29 | rm -rf $RUNFILE | |
b8149578 | 30 | |
a9374e35 | 31 | # Download run output files, and fill $RUNFILE |
b8149578 | 32 | for 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 | |
56 | done |