ROOTPWA
doamps.sh
Go to the documentation of this file.
1 #!/bin/bash
2 
3 WORKDIR=$PWD
4 echo $KEYDIR
5 cd $KEYDIR
6 
7 COUNTER=0;
8 
9 echo "MAXKEYPERJOB = $MAXKEYPERJOB"
10 
11 for i in *.key ;
12  do echo "Processing keyfile: $i" ;
13  date;
14  outfile=${i/key/amp};
15  # check if amplitude is already there!
16  test -s $AMPDIR/$outfile && echo "File $AMPDIR/$outfile already exists! Skipping!"
17  test -s $AMPDIR/$outfile && continue;
18  test -s $AMPDIR/OLD/$outfile && echo "File $AMPDIR/OLD/$outfile already exists! Skipping!"
19  test -s $AMPDIR/OLD/$outfile && continue;
20 
21  test -s $AMPDIR/$outfile.inprogress && echo "File $AMPDIR/$outfile is being processed already! Skipping!"
22  test -s $AMPDIR/$outfile.inprogress && continue;
23  date > $AMPDIR/$outfile.inprogress
24  test -s $AMPDIR/$outfile || cat $1 | gamp -P $PDG $i > $AMPDIR/$outfile ;
25  rm -f $AMPDIR/$outfile.inprogress
26  let COUNTER=$COUNTER+1;
27  if [ $COUNTER -ge $MAXKEYPERJOB ] ; then
28  echo "Reached max key per job limit! Aborting";
29  break;
30  fi;
31 
32  #test -s $AMPDIR/$outfile || echo do it > $AMPDIR/$outfile;
33 done
34 
35 # now do adding of amps
36 #for i in *list.dat ;
37 # do echo "Adding amplitudes as specified in $i" ;
38 # addamp $i $AMPDIR/OLD/ ;
39 #done;
40 
41 cd $WORKDIR