mkgclasses3.sh
Go to the documentation of this file.
1 #! /usr/bin/env bash
2 
3 do_mkclass="yes"
4 
5 for fbase in g3numi g4numi flugg g4lbne
6 do
7  tname="xyzzy"
8  if [ "$fbase" = "g3numi" ] ; then tname="h10" ; fi
9  if [ "$fbase" = "flugg" ] ; then tname="h10" ; fi
10  if [ "$fbase" = "g4numi" ] ; then tname="nudata" ; fi
11  if [ "$fbase" = "g4lbne" ] ; then tname="nudata" ; fi
12 
13  if [ "yes" = "${do_mkclass}" ] ; then
14  cat > make_generic.C <<EOF
15 #include <string>
16 #include <vector>
17 #include <map>
18 void make_generic()
19 {
20  TFile* g3file = TFile::Open("generic_${fbase}.root","READONLY");
21  gROOT->ProcessLine("${tname}->MakeClass();");
22 }
23 EOF
24  if [ ! -f generic_${fbase}.root ]; then
25  echo "skip $fbase for lack of generic_${fbase}.root"
26  continue
27  fi
28  root -b -q make_generic.C
29  rm -f make_generic.C
30  fi
31 
32  fnameh=${fbase}.h
33  fnameC=${fbase}.C
34  rm -f ${fnameh} ${fnameC}
35  touch ${fnameh} ${fnameC}
36 
37  cat ${tname}.h | sed -e "s/${tname}/${fbase}/g" >> $fnameh
38  cat ${tname}.C | sed -e "s/${tname}/${fbase}/g" >> $fnameC
39 
40 done
41 
42 
43 # End-of-Script