Updated version of the Test TPC toolkits (Marian)
[u/mrichter/AliRoot.git] / TPC / macros / testTPC / action.sh
CommitLineData
8b35d234 1#!/bin/bash
2#aguments
3#1 TString jobID,
4#2 TString inputData
5#3 TString outputDir
6#4 TString action
7
027ef365 8echo INPUT ARGUMENT FOR ACTION
8b35d234 9echo $1
10echo $2
11echo $3
12echo $4
027ef365 13#
14#
15#
16olddir=`pwd`
17mkdir -p $jobhome/$1
18mkdir -p $jobhome/$1/$4
19cd $jobhome/$1/$4
20ln -sf $olddir home
21echo HOME DIR `pwd`
22#
23#
24#
25echo GETTING DATA - START
26date
8b35d234 27
027ef365 28CISIZE=0
29if [ $AGENTINPUTTYPE -eq 2 ]; then
30 CINAME=`echo $2| sed s_root://voalice04.cern.ch:1094/__`
31 echo CASTOR COPY $CINAME ;
32 CISIZE=`nsls -l $CINAME | gawk '{print $5}'`
33 if [ $CISIZE -gt 1000000 ]; then
34 rfcp $CINAME data.root
35 else
36 echo FILE TOO SMALL
37 exit
38 fi;
39fi;
40if [ $AGENTINPUTTYPE -eq 0 ]; then
41 echo XRD COPY $2 ;
42 xrdcp -np $2 data.root
43fi;
44echo GETTING DATA - STOP
45date
46echo LS DATA
47ls -al
48
49CISIZE=`ls -l data.root | gawk '{print $5}'`
50if [ $CISIZE -lt 100000 ]; then
51 exit
52fi;
53#
54#
55#
56echo BEGIN ACTION
57date
58echo aliroot -b -q $olddir/macros/$4.C
59aliroot -b -q $olddir/macros/$4.C
60echo END ACTION $1
61date
62#
63#
64#
65rm data.root
66rm TPCsignal.root
67ls -al `pwd`
68echo CREATING ZIP FILE
69zip -n root $4 *.root *.log
8b35d234 70
c6d9a3a0 71
027ef365 72isxrd=`echo $3 | grep root://`
73mkdir $olddir/filelists
74flist=$olddir/filelists/$1.list
75touch $flist
c6d9a3a0 76
027ef365 77#
78# ALIEN - PROBLEM WITH HOST CERTIFICATE
79#
80if [ ${#alien_HOME} -gt 1 ]; then
81 dirname=`echo $alien_HOME$3/$4 | sed s/.root//g `
82 echo alien_mkdir $dirname
83 alien_mkdir -p $dirname
84 echo ALIEN COPY DATA START
85 echo alien_cp -n $4.zip alien:${dirname}/$4_se.zip@ALICE::GSI::SE
86 #echo alien_cp -n $4.zip alien:${dirname}$4.zip@ALICE::ALICE::CASTOR2
87 for name in `ls *.root`; do
88 echo alien_cp -n $name alien:${dirname}/$name@ALICE::GSI::SE
89 alien_cp -n $name alien:${dirname}/$name@ALICE::GSI::SE
90
91 done
92 alien_cp -n $4.zip alien:${dirname}/$4_se.zip@ALICE::GSI::SE
93 #alien_cp $4.zip -n alien:${dirname}$4.zip@ALICE::ALICE::CASTOR2
94 echo END OF ALIEN COPY
95fi;
8b35d234 96
8b35d234 97
8b35d234 98
027ef365 99if [ ${#isxrd} -lt 1 ]; then
100 dirname=`echo $CASTOR_HOME$3/$4 | sed s/.root//g `
101 echo CASTOR COPPING DATA - START
102 echo DIRNAME - $dirname
103 echo XRD PATH = root://voalice04.cern.ch:1094/$dirname
104 echo
105 rfmkdir -p $dirname
106 #
107 for name in `ls *.root`; do
108 echo rfcp $name $dirname/$name
109 rfcp $name $dirname/$name
110 echo root://voalice04.cern.ch:1094/$dirname/$name >>$flist
111 done
112 echo rfcp $4.zip $dirname/$4.zip
113 rfcp $4.zip $dirname/$4.zip
114 echo root://voalice04.cern.ch:1094/$dirname/$4.zip >>$flist
115 echo END OF COPY
116else
117 echo XRD COPY DATA START
118 dirname=`echo $3/$4 | sed s/.root//g`
119 echo DIRNAME - $dirname
120 for name in `ls *.root`; do
121 echo xrdcp $name $dirname/$name
122 xrdcp -np $name $dirname/$name
123 echo $dirname/$name >>$flist
124 done
125 echo xrdcp -np $4.zip $dirname.zip
126 xrdcp -np $4.zip $dirname/$4.zip
127 echo $dirname/$4.zip >>$flist
128 echo END OF COPY
129fi;
c6d9a3a0 130
8b35d234 131
132
c6d9a3a0 133cd $olddir
8b35d234 134