Decalibrate simulated data
[u/mrichter/AliRoot.git] / PHOS / macros / testSuite / TestSuite.csh
CommitLineData
be66de47 1#! /bin/tcsh -f
2#
3# Prepare the environment
4#
5set TMPDIR=`mktemp -d $HOME/PHOSTestSuite.XXXXXX` ; cd $TMPDIR
6set SRCDIR=$ALICE_ROOT/PHOS/macros/testSuite
7set LOGFILE=$TMPDIR/TestSuite.log
8set ConfigSgnl=$SRCDIR/ConfigTestSuite.C
9set ConfigBckg=$SRCDIR/ConfigTestSuiteHij.C
10set GRUN=$SRCDIR/grunTestSuite.C
11
12printf "PHOS test suite is being executed in directory\n $TMPDIR\n"
13
14# Set mail address to send errors to
15set PHOS_LIBRARIAN=yves.schutz@cern.ch
16
17#
18#begin data
19set MINHITS=68
20set MAXHITS=72
21set MINSDIGITS=68
22set MAXSDIGITS=72
23set MINDIGITS=47
24set MAXDIGITS=51
25set MINEMCRECPOINTS=1
26set MAXEMCRECPOINTS=2
27set MINCPVRECPOINTS=0
28set MAXCPVRECPOINTS=2
29set MINTRACKSEGMENTS=1
30set MAXTRACKSEGMENTS=2
31set MINRECPARTICLES=1
32set MAXRECPARTICLES=2
33#end data
34
35#
36echo PHOS Test Suite run on `date` > $LOGFILE
37echo "=======================================================================" >> $LOGFILE
38echo AliROOT version `which aliroot` >> $LOGFILE
39echo Root version `root-config --version` in `which root` >> $LOGFILE
40echo "=======================================================================" >> $LOGFILE
41#
42# SIMULATION
43#
44printf "Signal simulation ... "
45echo " **** Signal SIMULATION **** " >> $LOGFILE
46mkdir -p $TMPDIR/signal
47cd $TMPDIR/signal
48aliroot -b -q ${GRUN}\(100,\"${ConfigSgnl}\"\) >>& $LOGFILE
49printf "done\n"
50
51printf "Background simulation ... "
52echo " **** Background SIMULATION **** " >> $LOGFILE
53mkdir -p $TMPDIR/background
54cd $TMPDIR/background
55aliroot -b -q ${GRUN}\(2,\"${ConfigBckg}\"\) >>& $LOGFILE
56printf "done\n"
57
58cd $TMPDIR
59cp -a $TMPDIR/signal $TMPDIR/signal+background
60
61printf "Simulation analysis ... "
62cd $TMPDIR/signal
63echo '{ ' > tempo.C
64echo " Int_t minhits = $MINHITS ;" >> tempo.C
65echo " Int_t maxhits = $MAXHITS ;" >> tempo.C
66echo ' AliPHOSGetter * gime = AliPHOSGetter::Instance("galice.root") ;' >> tempo.C
67echo ' TH1F * hitmul = new TH1F("hitmul", "PHOS Test Suite", 100, 0., 200.) ; ' >> tempo.C
68echo ' Int_t max = gime->MaxEvent() ; ' >> tempo.C
69echo ' Int_t evt = 0 ; ' >> tempo.C
70echo ' for ( evt = 0 ; evt < max ; evt++ ) { ' >> tempo.C
71echo ' gime->Event(evt,"H") ; ' >> tempo.C
72echo ' hitmul->Fill(gime->Hits()->GetEntries()) ; ' >> tempo.C
73echo ' } ' >> tempo.C
74echo ' TF1 * gaus = new TF1("gaus", "gaus", 0., 200.) ; ' >> tempo.C
75echo ' hitmul->Fit(gaus,"", "", 40, 100) ; ' >> tempo.C
76echo ' if( gaus->GetParameter(1) > maxhits || gaus->GetParameter(1) < minhits ) ' >> tempo.C
77echo ' printf("ERRORSIM 1") ; ' >> tempo.C
78echo ' else ' >> tempo.C
79echo ' printf("ERRORSIM 0") ; ' >> tempo.C
80echo '} ' >> tempo.C
81aliroot -b -q tempo.C >>& $LOGFILE
82set ERRORSIM = `cat $LOGFILE | grep ERRORSIM | awk '{print $2}'`
83if($ERRORSIM) then
84 printf "error\n"
85 uuencode $LOGFILE $LOGFILE | mail -s 'PHOS INSTALLATION ERROR' $PHOS_LIBRARIAN
86## exit(0)
87else
88 printf "done\n"
89endif
90rm tempo.C
91#
92# RECONSTRUCTION
93#
94printf "Reconstruction ... "
95echo " **** RECONSTRUCTION **** " >> $LOGFILE
96aliroot -b >>& $LOGFILE <<EOF
97 AliPHOSSDigitizer sd("galice.root") ;
98 sd.ExecuteTask("deb all") ;
99 AliPHOSDigitizer d("galice.root") ;
100 d.ExecuteTask("deb all") ;
101 AliPHOSClusterizerv1 cl("galice.root") ;
102 cl.ExecuteTask("deb all") ;
103 AliPHOSTrackSegmentMakerv1 ts("galice.root") ;
104 ts.ExecuteTask("deb all") ;
105 AliPHOSPIDv1 pd("galice.root") ;
106 pd.ExecuteTask("deb all") ;
107 .q
108EOF
109printf "done\n"
110
111printf "Reconstruction analysis ... "
112echo '{ ' > tempo.C
113echo " Int_t minsdig = $MINSDIGITS ;" >> tempo.C
114echo " Int_t maxsdig = $MAXSDIGITS ;" >> tempo.C
115echo " Int_t mindig = $MINDIGITS ;" >> tempo.C
116echo " Int_t maxdig = $MAXDIGITS ;" >> tempo.C
117echo " Int_t minemcrp = $MINEMCRECPOINTS ;" >> tempo.C
118echo " Int_t maxemcrp = $MAXEMCRECPOINTS ;" >> tempo.C
119echo " Int_t mincpvrp = $MINCPVRECPOINTS ;" >> tempo.C
120echo " Int_t maxcpvrp = $MAXCPVRECPOINTS ;" >> tempo.C
121echo " Int_t mints = $MINTRACKSEGMENTS ;" >> tempo.C
122echo " Int_t maxts = $MAXTRACKSEGMENTS ;" >> tempo.C
123echo " Int_t minpa = $MINRECPARTICLES ;" >> tempo.C
124echo " Int_t maxpa = $MAXRECPARTICLES ;" >> tempo.C
125echo ' AliPHOSGetter * gime = AliPHOSGetter::Instance("galice.root") ;' >> tempo.C
126echo ' TH1F * sdigmul = new TH1F("sdigmul", " SDigits PHOS Test Suite", 100, 0., 200.) ; ' >> tempo.C
127echo ' TH1F * digmul = new TH1F("digmul", " Digits PHOS Test Suite", 100, 0., 200.) ; ' >> tempo.C
128echo ' TH1F * emcrpmul= new TH1F("emcrpmul", " EMCRecPoints PHOS Test Suite", 100, 0., 200.) ; ' >> tempo.C
129echo ' TH1F * cpvrpmul= new TH1F("cpvrpmul", " CPVRecPoints PHOS Test Suite", 100, 0., 200.) ; ' >> tempo.C
130echo ' TH1F * tsmul = new TH1F("tsmul", " TrackSegments PHOS Test Suite", 100, 0., 200.) ; ' >> tempo.C
131echo ' TH1F * pamul = new TH1F("pamul", " RecParticles PHOS Test Suite", 100, 0., 200.) ; ' >> tempo.C
132echo ' Int_t max = gime->MaxEvent() ; ' >> tempo.C
133echo ' Int_t evt = 0 ; ' >> tempo.C
134echo ' for ( evt = 0 ; evt < max ; evt++ ) { ' >> tempo.C
135echo ' gime->Event(evt,"SDRTP") ; ' >> tempo.C
136echo ' sdigmul->Fill(gime->SDigits()->GetEntries()) ; ' >> tempo.C
137echo ' digmul->Fill(gime->Digits()->GetEntries()) ; ' >> tempo.C
138echo ' emcrpmul->Fill(gime->EmcRecPoints()->GetEntries()) ; ' >> tempo.C
139echo ' cpvrpmul->Fill(gime->CpvRecPoints()->GetEntries()) ; ' >> tempo.C
140echo ' tsmul->Fill(gime->TrackSegments()->GetEntries()) ; ' >> tempo.C
141echo ' pamul->Fill(gime->RecParticles()->GetEntries()) ; ' >> tempo.C
142echo ' } ' >> tempo.C
143echo ' TF1 * gaus = new TF1("gaus", "gaus", 0., 200.) ; ' >> tempo.C
144echo ' sdigmul->Fit(gaus, "", "", 40., 100.) ; ' >> tempo.C
145echo ' sdigmul->Draw() ; ' >> tempo.C
146echo ' if( gaus->GetParameter(1) > maxsdig || gaus->GetParameter(1) < minsdig ) ' >> tempo.C
147echo ' printf("ERRORREC 1 sdigits\n") ; ' >> tempo.C
148echo ' digmul->Fit(gaus, "", "", 20., 80.) ; ' >> tempo.C
149echo ' if( gaus->GetParameter(1) > maxdig || gaus->GetParameter(1) < mindig ) ' >> tempo.C
150echo ' printf("ERRORREC 1 digits\n") ; ' >> tempo.C
151echo ' emcrpmul->Fit(gaus, "", "", 0., 4.) ; ' >> tempo.C
152echo ' if( gaus->GetParameter(1) > maxemcrp || gaus->GetParameter(1) < minemcrp ) ' >> tempo.C
153echo ' printf("ERRORREC 1 emc recpoints\n") ; ' >> tempo.C
154echo ' cpvrpmul->Fit(gaus, "", "", 0., 4.) ; ' >> tempo.C
155echo ' if( gaus->GetParameter(1) > maxcpvrp || gaus->GetParameter(1) < mincpvrp ) ' >> tempo.C
156echo ' printf("ERRORREC 1 cpv recpoints\n") ; ' >> tempo.C
157echo ' tsmul->Fit(gaus, "", "", 0., 4.) ; ' >> tempo.C
158echo ' if( gaus->GetParameter(1) > maxts || gaus->GetParameter(1) < mints ) ' >> tempo.C
159echo ' printf("ERRORREC 1 track segments\n") ; ' >> tempo.C
160echo ' pamul->Fit(gaus, "", "", 0., 4. ) ; ' >> tempo.C
161echo ' if( gaus->GetParameter(1) > maxpa || gaus->GetParameter(1) < minpa ) ' >> tempo.C
162echo ' printf("ERRORREC 1 recparticles\n") ; ' >> tempo.C
163echo '} ' >> tempo.C
164aliroot -b -q tempo.C >>& $LOGFILE
165set ERRORREC = `cat $LOGFILE | grep ERRORREC | awk '{print $2}'`
166if( $?ERRORREC ) then
167 printf "error\n"
168 uuencode $LOGFILE $LOGFILE | mail -s 'PHOS INSTALLATION ERROR' $PHOS_LIBRARIAN
169## exit(0)
170else
171 printf "done\n"
172endif
173rm tempo.C
174
175# Signal+background merging
176printf "Signal+background merging ... "
177echo " **** Signal+background MERGING **** " >> $LOGFILE
178cd $TMPDIR/background
179aliroot -b >>& $LOGFILE <<EOF
180 AliPHOSSDigitizer sd("galice.root") ;
181 sd.ExecuteTask("deb all") ;
182EOF
183
184cd $TMPDIR/signal+background
185cp -a $TMPDIR/signal/PHOS.SDigits*.root .
186aliroot -b >>& $LOGFILE <<EOF
187 AliPHOSDigitizer d("galice.root") ;
188 d.MixWith("../background/galice.root") ;
189 d.ExecuteTask("deb all") ;
190 AliPHOSClusterizerv1 cl("galice.root") ;
191 cl.ExecuteTask("deb all") ;
192 AliPHOSTrackSegmentMakerv1 ts("galice.root") ;
193 ts.ExecuteTask("deb all") ;
194 AliPHOSPIDv1 pd("galice.root") ;
195 pd.ExecuteTask("deb all") ;
196 .q
197EOF
198printf "done\n"
199
200#rm -fr $TMPDIR