forked from CMSROMA/Utilities
-
Notifications
You must be signed in to change notification settings - Fork 2
/
makeclass.sh
executable file
·56 lines (45 loc) · 1.06 KB
/
makeclass.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
usage(){
echo "Usage: `basename $0` tree_name file nameclass [data]" > /dev/stderr
}
flag=""
case $# in
3)
;;
4)
flag=$4
;;
*)
echo -n "Error. "
usage
exit 1
;;
esac
tree_name=$1
file=$2
nameclass=$3
echo "/* inserire il valore dei file in n_file */" > ./makeclass.cc
echo "{" >> ./makeclass.cc
echo " gROOT->Reset();" >> ./makeclass.cc
echo " TChain chain(\"$tree_name\");" >> ./makeclass.cc
#for i in `ls -1 $dir/*.root`; do
echo " chain.Add(\"$file\");" >> ./makeclass.cc
#done
echo >> ./makeclass.cc
echo " chain->MakeClass(\"$nameclass""\");" >> ./makeclass.cc
echo "}" >> ./makeclass.cc
echo >> ./makeclass.cc
echo "Creo le classi dal file root" > /dev/stderr
root -l -b -q makeclass.cc || exit 1 # crea le classi
rm makeclass.cc
if [ -e "sed/class.sed" ];then
sed -i -f sed/class.sed $nameclass.h
fi
sed -i "/Loop()/ d" $nameclass.h
rm $nameclass.C
#sed -i "s|$nameclass|../include/$nameclass|" $nameclass.C
if [ "$flag" != "" ]; then
mv $nameclass.h $nameclass-$flag.h
else
mv $nameclass.h $nameclass-MC.h
fi