PageRenderTime 11ms CodeModel.GetById 1ms app.highlight 7ms RepoModel.GetById 2ms app.codeStats 0ms

/ElectroWeakAnalysis/ZMuMu/bin/testToy.sh

https://github.com/aivanov-cern/cmssw
Shell | 68 lines | 54 code | 5 blank | 9 comment | 7 complexity | 8f0dbb6cb789bab9ef55fc45ad8635f0 MD5 | raw file
 1#!/bin/sh
 2#########################
 3#
 4# Driver script for Toy Monte Carlo submission with CRAB 
 5#
 6# author: Luca Lista, INFN
 7#                      
 8#########################
 9
10if [ -e outputToy ]; then 
11  rm -rf outputToy 
12fi
13mkdir outputToy
14
15i="$1"
16l="$2"
17if [ "$i" == "help" ]; then
18  echo "usage: testToy.sh <job index> <luminosity>"
19  exit 0;
20fi
21if [ "$i" = "" ]; then
22  echo "Error: missing job index"
23  exit 1;
24fi
25if [ "$i" = "" ]; then
26  echo "Error: missing job index"
27  exit 1;
28fi
29if [ "$l" = "" ]; then
30  echo "Error: missing luminosity"
31  exit 1;
32fi
33
34rm -f fitResults.txt
35echo "# par_name init_val fin_val par_err global_corr" > fitResults.txt
36((j = 1)) 
37((jmax=$i))
38
39echo "job number: #$i"
40echo "j value: #$j"
41while [ $j -le $jmax ]; do
42echo "running toy MC : zMuMuRooFit -i Analisi_45pb.root -o out.root -r 2 2 10 60  -t -s $j -l $l"
43        zMuMuRooFit -i Analisi_45pb.root  -o out.root -r 2 2 10 60 -t -s $j -l $l >& log.txt
44        # retrieve fit values and store into a single file  
45	grep "        Yield" log.txt  >> fitResults.txt
46	grep "        a0" log.txt  >> fitResults.txt	
47	grep "        a1" log.txt  >> fitResults.txt	
48	grep "        a2" log.txt  >> fitResults.txt	
49	grep "        alpha" log.txt  >> fitResults.txt	
50	grep "        b0" log.txt  >> fitResults.txt	
51	grep "        b1" log.txt  >> fitResults.txt	
52	grep "        b2" log.txt  >> fitResults.txt	
53	grep "        beta" log.txt  >> fitResults.txt	
54	grep "        eff_hlt" log.txt  >> fitResults.txt	
55	grep "        eff_iso" log.txt  >> fitResults.txt
56	grep "        eff_sa" log.txt  >> fitResults.txt
57	grep "        eff_tk" log.txt  >> fitResults.txt
58	grep "        nbkg_mumuNotIso" log.txt  >> fitResults.txt
59	grep "        nbkg_mutrk" log.txt  >> fitResults.txt
60	mv mass.eps outputToy/mass_$j.eps
61	mv out.root outputToy/out_$j.root
62	mv log.txt outputToy/log_$j.txt 
63        mv fitResults.txt  outputToy/
64        ((j= $j + 1))
65done
66echo "pack the results"
67tar cvfz outputToy.tgz outputToy/
68