Crombie Tools
haddbook.sh
Go to the documentation of this file.
1 #! /bin/bash
2 
3 export book=$1
4 shift
5 datasetlist=$1
6 shift
7 ncores=$1
8 shift
9 
10 if [ "$ncores" = "" ] || [ ! -f "$datasetlist" ]
11 then
12 
13  echo ""
14  echo "Usage: $0 <book> <datasetlist> <ncores>"
15  echo ""
16  echo "<datasetlist> must be the name of a text file"
17  echo "with a list of datasets to hadd together."
18  echo ""
19  exit 0
20 
21 fi
22 
23 _do_hadd () {
24 
25  dataset=$1
26  hadd /data/t3home000/dabercro/$book/$1.root /mnt/hadoop/cms/store/user/paus/$book/*$1*/*.root
27 
28 }
29 
30 export -f _do_hadd
31 
32 test -d /data/t3home000/dabercro/$book || mkdir -p /data/t3home000/dabercro/$book
33 
34 cat $datasetlist | awk -F "+" '{ print $1 }' | uniq | xargs -P$ncores bash -c '_do_hadd "$@"'