copy_DL1files_from_dCache.sh 1.53 KB
Newer Older
Gernot Maier's avatar
Gernot Maier committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/bash
#
# copy DL1 files from tar in dCache (!!) files to target directory
# 
# ./copy_DL1files.sh
#

if [ $# -eq 0 ]; then
   echo "./copy_DL1files.sh copy"
   echo
   echo "note the hardwired values"
fi

# hardwired values
DSET="Prod5_LaPalma_AdvancedBaseline_NSB1x"
PLIST="gamma_onSource gamma_cone proton"
PLIST="gamma_onSource gamma_cone proton electron"
# targetdir
Gernot Maier's avatar
Gernot Maier committed
19
OSET="prod5-LaPalma-20deg-EVNDISP"
Gernot Maier's avatar
Gernot Maier committed
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
########################
# list of arrays
# South
# declare -a ARRAY=("BL-0LSTs15MSTs50SSTs-MSTF" "BL-0LSTs15MSTs50SSTs-MSTN" "BL-4LSTs25MSTs70SSTs-MSTF" "BL-4LSTs25MSTs70SSTs-MSTN" )
# North
declare -a ARRAY=("BL-4LSTs05MSTs-MSTF" "BL-4LSTs09MSTs-MSTF" "BL-4LSTs15MSTs-MSTF" ) 

for P in $PLIST
do
   if [[ ${P} == *"gamma_cone"* ]]; then
        PP="gamma-diffuse"
   elif [[ ${P} == "gamma_onSource" ]]; then
        PP="gamma"
   elif [[ ${P} == *"proton"* ]]; then
        PP="proton"
   elif [[ ${P} == *"electron"* ]]; then
        PP="electron"
   else
        echo "unknown particle in $P"
        continue
   fi
   for A in "${ARRAY[@]}"
   do
      # files are copied here
Gernot Maier's avatar
Gernot Maier committed
44
      ODIR=${CTA_USER_DATA_DIR}/analysis/AnalysisData/${OSET}/N.${A}/EVNDISP/$P
Gernot Maier's avatar
Gernot Maier committed
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
      echo $ODIR
      mkdir -p ${ODIR}
      for D in North South
      do
        FLIST=${DSET}/${DSET}_${PP}_${D}_20deg_DL1.dCache.list
        FF=$(cat ${FLIST})
        for F in $FF
        do
           echo $F ${A}
           dccp ${F} tt.tar.gz
           tar --overwrite -C ${ODIR} -xvzf tt.tar.gz --wildcards "*${A}*"
           rm -f tt.tar.gz
        done 
      done
   done
done