StartOfflineWatchers.sh 3.12 KB
Newer Older
1 2 3 4
#!/bin/bash

Mode=""
EntryPoint=""
5
ReadMezz="0"
6

7
echo "#Temporary RootAFP.conf" > RootAFP.conf.temp
8 9 10 11 12 13 14

for i in $*
do
    if [[ $i == "-l" ]]
        then Mode="l"
             continue
    fi
15 16 17 18
    if [[ $i == "-BatchMode" ]]
        then Batch="1"
             continue
    fi
19 20 21 22
    if [[ $i == "-ep" ]]
        then Mode="ep"
             continue
    fi
23 24 25 26
    if [[ $i == "-CDAT" ]]
        then ReadMezz="1"
             continue
    fi
27 28 29
    if [[ $i == "--help" ]]
        then echo "You need to specify the entry type: "
             echo "-l for listing input files"
30
             echo "-ep to define the ADF entry point : possible choices are ADF CRYSTAL CCRYSTAL PSA RANC0 EB MERGER TRACKING TRACKING_DEBUG"
31 32 33 34 35 36
             exit 2
    fi
    if [[ $Mode == "" ]]
    then
         echo "You need to specify the entry type: "
         echo "-l for listing input files"
37
         echo "-ep to define the ADF entry point : possible choices are ADF CRYSTAL CCRYSTAL PSA RANC0 EB MERGER TRACKING TRACKING_DEBUG"
38
         echo "-CDAT to read traces files"
39
	 echo "-BatchMode to execute Watchers in batch mode"
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
         exit 2
    else
        if [[ ${Mode} == "ep" ]]
            then
                EntryPoint=$i
        fi
        if [[ ${Mode} == "l" ]]
        then
            if [ -f $i ]
            then
                echo "$Mode $i" >> RootAFP.conf.temp
            else
                echo "$i not found"
                exit 2
            fi
        fi
    fi
done

if [[ $Mode == "" ]]
then
61 62 63 64 65 66
     	echo "You need to specify the entry type: "
     	echo "-l for listing input files"
     	echo "-ep to define the ADF entry point : possible choices are ADF CRYSTAL CCRYSTAL PSA RANC0 EB MERGER TRACKING TRACKING_DEBUG"
	echo "-CDAT to read traces files"
	echo "-BatchMode to execute Watchers in batch mode"
     	exit 2
67 68
fi

69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
test=`more RootAFP.conf.temp | grep ".adf"`
if [[ ${test} != ""  && ${ReadMezz} == "1" ]]
then
    echo "WARNING !!!! You askes for traces producer but loaded adf files ==> EXIT"
    exit 2
fi

test=`more RootAFP.conf.temp | grep ".cdat."`
if [[ ${test} != ""  && ${ReadMezz} == "" ]]
then
    echo "WARNING !!!! You askes for adf producer but loaded traces files ==> EXIT"
    exit 2
fi

if [[ ${ReadMezz} == "1" ]]
then
    cp RootAFP.conf.temp ReadMezzAFP.conf
fi
87 88 89 90 91 92

echo
echo "********************************************"
echo "*****       RootAFP.conf.temp         ******"
echo "********************************************"

J.Dudouet [IPNL/CSNSM]'s avatar
Debug  
J.Dudouet [IPNL/CSNSM] committed
93
more RootAFP.conf.temp
94 95
echo

96 97
if [[ ${EntryPoint} != "" ]]
then
J.Dudouet [IPNL/CSNSM]'s avatar
J.Dudouet [IPNL/CSNSM] committed
98
     if [[ " ADF CRYSTAL CCRYSTAL PSA NEDA NEDAB DIAMANT DIAMANTB EB MERGER TRACKING " =~ " ${EntryPoint} " ]]
99 100 101
     then
          echo "ADF entry point: ${EntryPoint}"
     else
J.Dudouet [IPNL/CSNSM]'s avatar
J.Dudouet [IPNL/CSNSM] committed
102
          echo "${EntryPoint} is not a correct ADF entry point, possible choices are: ADF CRYSTAL CCRYSTAL PSA NEDA NEDAB DIAMANT DIAMANTB EB MERGER TRACKING"
103 104 105
          exit 2
     fi
fi
106

107
if [[ ${Batch} == "1" ]]
108 109 110 111 112 113 114 115
then 
	root -l -b -q "RunOffline.C(-1,\"RootAFP.conf.temp\",\"${EntryPoint}\",${ReadMezz})"
else 
	echo
	echo "Press any key to continue"
	read
	root -l "RunOffline.C(-1,\"RootAFP.conf.temp\",\"${EntryPoint}\",${ReadMezz})"
fi
116 117 118 119

if [ -f "RootAFP.conf.temp" ]
then rm RootAFP.conf.temp
fi