ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/RootMacros/entryCount
Revision: 1.1
Committed: Sat Sep 6 18:52:17 2008 UTC (16 years, 7 months ago) by anderson
Branch: MAIN
CVS Tags: HEAD
Error occurred while calculating annotation data.
Log Message:
Bash script to run entryCount.C

File Contents

# Content
1 #!/bin/bash
2 #
3 # Usage:
4 # entryCount rootfile.root
5 # entryCount rootfile.root histogramName
6 # entryCount histogramName
7 #
8 # Michael Anderson
9 # www.hep.wisc.edu/~mbanderson
10 # April 16, 2008
11
12
13 # This must point to the ROOT macro
14 counterMacro=./entryCount.C
15
16 # Grab the first two arguments if there are any given
17 arg1=$1
18 arg2=$2
19
20 printUsage () {
21 echo "Please specify arguments like:"
22 echo "entryCount filename.root"
23 echo "entryCount histogramName"
24 }
25
26
27 # Check to make sure at least one
28 # argument was given.
29 if [ -n "$arg1" ]; then
30
31 # See if two arguments were given
32 if [ -n "$arg2" ]; then
33
34 # See if argument 1 is a file
35 if ! [ -f "$arg1" ]; then
36 echo "ERROR: No such file: $arg1"
37 printUsage
38 exit 1
39 fi
40
41 # 2 arguments were given, pass both to root macro
42 root -b -l -q "$counterMacro(\"$arg1\",\"$arg2\")"
43
44 else
45
46 # Only 1 argument was given, pass it to root macro
47 root -b -l -q "$counterMacro(\"$arg1\")"
48
49 fi
50
51 else
52 # No arguments were given
53 printUsage
54 fi