]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/MUON/scripts/extractdata.sh
Correcting the handling of TObject in constructors and assignment operators.
[u/mrichter/AliRoot.git] / HLT / MUON / scripts / extractdata.sh
1 #!/bin/bash
2 #
3
4 usage="<simplefile input directory> <number of events> [<output directory> (optional, default is current)]"
5
6 if [[ "$1" == "-h" || "$1" == "-help" || "$1" == "--help" ]] ; then
7   echo Usage: $0 $usage
8   exit
9 fi
10
11 if [ `file $1 | awk '{print $2}'` != "directory" ]; then
12   echo Error: $1 not a directory
13   echo Usage: $0 $usage
14   exit
15 fi
16
17 case $2 in 
18
19   *[!0-9+-]*|?*[-+]*|""|-|+)
20     echo Error: $2 not an integer
21     echo Usage: $0 $usage
22     exit
23     ;;
24
25   *)
26     if [ ! $2 -ge 0 ] ; then
27       echo Error: $2 not a positive integer
28       echo Usage: $0 $usage
29       exit
30     fi
31     ;;
32
33 esac
34
35
36 dir=`pwd`
37
38 if [ ! -z "$3" ] ; then
39   mkdir $3
40   dir=$3
41 fi
42
43 for (( i = 0 ; i < $2 ; i++ ));  do
44   suffix=`EventStorageExtractor -storagetype simplefile -storagename $1 -eventnr $i -metadatadump | grep fDataType | grep fDataBlocks | awk '{print $4}' | sed s/\(// | tr A-Z a-z`
45   EventStorageExtractor -storagetype simplefile -storagename $1 -eventnr $i -datadump > $dir/event_$i.$suffix
46 done