1 |
anderson |
1.1 |
#!/bin/bash
|
2 |
|
|
#
|
3 |
|
|
# Given a list of files and weights (cross sections)
|
4 |
|
|
# this will do a SetWeight() on a TTree in those files.
|
5 |
|
|
#
|
6 |
|
|
# Usage:
|
7 |
|
|
# setTreeWeights fileOfFilenames treeName
|
8 |
|
|
#
|
9 |
|
|
# The "fileOfFilenames" should have two colums.
|
10 |
|
|
# One column is the root file name, the other is the weight.
|
11 |
|
|
# Example:
|
12 |
|
|
# file01.root 105.2
|
13 |
|
|
# file02.root 92.0
|
14 |
|
|
# file03.root 11.0
|
15 |
|
|
#
|
16 |
|
|
#
|
17 |
|
|
# Michael Anderson
|
18 |
|
|
# www.hep.wisc.edu/~mbanderson
|
19 |
|
|
# June 11, 2008
|
20 |
|
|
|
21 |
|
|
# This must point to the ROOT macro
|
22 |
|
|
rootMacro=./setTreeWeights.C
|
23 |
|
|
|
24 |
|
|
printUsage () {
|
25 |
|
|
echo "Please specify arguments like:"
|
26 |
|
|
echo "setTreeWeights fileList treeName"
|
27 |
|
|
echo ""
|
28 |
|
|
echo "Note, fileList must contain lines in format:"
|
29 |
|
|
echo "<file> <weight>"
|
30 |
|
|
echo "example:"
|
31 |
|
|
echo "Filename.root 1234.0"
|
32 |
|
|
}
|
33 |
|
|
|
34 |
|
|
# Check to make sure two arguments were given
|
35 |
|
|
if [ $# -lt 2 ]; then
|
36 |
|
|
# No Arguments given
|
37 |
|
|
printUsage
|
38 |
|
|
exit 2
|
39 |
|
|
else
|
40 |
|
|
# At least 2 arguments given
|
41 |
|
|
root -b -l -q "$rootMacro(\"$1\",\"$2\")"
|
42 |
|
|
fi
|