]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TPC/scripts/OCDBscan/makeTPCTrendPlots.C
composition of the Alluminum alloy that constitutes the ITS-TPC support rings updated...
[u/mrichter/AliRoot.git] / TPC / scripts / OCDBscan / makeTPCTrendPlots.C
CommitLineData
eeca88a1 1/*
2 Make a TPC basic calibration trend plots:
3 Input - calibTime.root tree with summary info per run expected to be in the local directory
4 - optional parameters run range can be specified - startRun -endRun
5 Output - default plots are saved in the pwd/pic/
6 macro to define the picture style (NimStyle.C) expected to be in the current directory
7
8
9 Example usage:
10
11 aliroot -b -q /u/miranov/AliRoot/trunk/TPC/scripts/OCDBscan/makeTPCTrendPlots.C
12
13*/
14
15TTree * tree=0;
16const Double_t kmin=0.01;
17const Double_t kmax=0.99;
18const Double_t kEpsilon=0.0000001;
19Int_t run0=0; // value to set from outside
20Int_t run1=10000000; // vaue to set from outside
21
22void makeTPCTrendPlots(Int_t startRun=0, Int_t endRun=1000000){
23 //
24 // make trend plots of the basic TPC calibration parameters
25 //
26 run0=startRun;
27 run1=endRun;
28 gROOT->Macro("NimStyle.C");
29 TFile f("calibTime.root");
30 tree = (TTree*)f.Get("dcs");
31 tree->SetMarkerStyle(25);
32 tree->SetMarkerSize(0.4);
33 gStyle->SetMarkerSize(0.4);
34 tree->SetAlias("isValidITS","abs(dits)<3600");
35 tree->SetAlias("isValidCE","min(abs(dcea),abs(dcec))<3600&&max(tdriftCE.fElements[72],tdriftCE.fElements[73])>100");
36 tree->SetAlias("isValidCEB","max(abs(dcea),abs(dcec))<3600&&min(tdriftCE.fElements[72],tdriftCE.fElements[73])>100");
37 printf("makeTPCTrendPlots.C\n\n");
38 printf("Processing DrawDriftTime();\n\n");
39 DrawDriftTime();
40 printf("DrawDriftRun();\n\n");
41 DrawDriftRun();
42 printf("DrawDriftCorel();\n\n");
43 DrawDriftCorel();
44}
45
46
47
48void DrawDriftTime(){
49 //
50 // Draw drift velocity trend grapsh - as function of time
51 //
52 TCut cutRun=Form("run>%d&&run<%d",run0,run1);
53 TCut cutCE="(tdriftCE.fElements[72]>100||tdriftCE.fElements[72]>100)&&min(abs(dcea),abs(dcec))<3600";
54 TCut cutITS="abs(dits)<3600";
55
56 Int_t entries=0;
57 Double_t max=6;
58 Double_t min= -6;
59 Double_t maxT=0,minT=0;
60 Double_t dmaxmin= 200000;
61 TCanvas * canvasDrift = new TCanvas("canvasDriftTime","canvasDriftTime",2000,900);
62 canvasDrift->Divide(1,3);
63 // P/T part
64 entries=tree->Draw("100*ptrel0:time",cutRun,"goff");
65 TGraph * graphPTA = new TGraph(entries,tree->GetV2(),tree->GetV1());
66 graphPTA->SetTitle("P/T correction A side");
67 graphPTA->SetName("PTcorrectionAside");
68 //
69 entries=tree->Draw("100*ptrel1:time",cutRun,"goff");
70 TGraph * graphPTC = new TGraph(entries,tree->GetV2(),tree->GetV1());
71 graphPTC->SetTitle("P/T correction C side");
72 graphPTC->SetName("PTcorrectionCside");
73 //
74 entries=tree->Draw("1000*(ptrel0-ptrel1):time",cutRun,"goff");
75 TGraph * graphPTAMC = new TGraph(entries,tree->GetV2(),tree->GetV1());
76 graphPTAMC->SetTitle("P/T correction A-C side");
77 graphPTAMC->SetName("PTcorrectionAMCside");
78 //
79 //
80 entries=tree->Draw("isValidCE*(-tdriftCE.fElements[72]+990)/10:time",cutRun,"goff");
81 TGraph * graphCEA = new TGraph(entries,tree->GetV2(),tree->GetV1());
82 graphCEA->SetName("CEAside");
83 //
84 entries=tree->Draw("isValidCE*(-tdriftCE.fElements[73]+990)/10:time",cutRun,"goff");
85 TGraph * graphCEC = new TGraph(entries,tree->GetV2(),tree->GetV1());
86 graphCEC->SetName("CECside");
87 //
88 entries=tree->Draw("isValidCE*(tdriftCE.fElements[73]-tdriftCE.fElements[72]):time",cutRun,"goff");
89 TGraph * graphCEAMC = new TGraph(entries,tree->GetV2(),tree->GetV1());
90 graphCEAMC->SetName("CEAMCside");
91 //
92 entries=tree->Draw("isValidITS*vdriftITS*100:time",cutRun,"goff");
93 TGraph * graphITSTPCA = new TGraph(entries,tree->GetV2(),tree->GetV1());
94 graphITSTPCA->SetName("ITSTPCAside");
95 //
96 entries=tree->Draw("isValidITS*vdriftITS*100:time",cutRun,"goff");
97 TGraph * graphITSTPCC = new TGraph(entries,tree->GetV2(),tree->GetV1());
98 graphITSTPCC->SetName("ITSTPCCside");
99 //
100 // Drawing part
101 //
102 min=-6;
103 max=6;
104 graphCEA->SetMinimum(min);
105 graphCEA->SetMaximum(max);
106 graphPTA->SetMinimum(min);
107 graphPTA->SetMaximum(max);
108 graphITSTPCA->SetMinimum(min);
109 graphITSTPCA->SetMaximum(max);
110 graphPTA->GetXaxis()->SetRangeUser(minT,maxT);
111 graphCEA->GetXaxis()->SetRangeUser(minT,maxT);
112 graphITSTPCA->GetXaxis()->SetRangeUser(minT,maxT);
113 //
114 //
115 canvasDrift->cd(1);
116 graphPTA->GetXaxis()->SetTimeDisplay(kTRUE);
117 graphPTA->GetYaxis()->SetTitle("#Delta P/T (%)");
118 graphPTA->SetMarkerColor(2);graphPTA->SetMarkerStyle(25);
119 graphPTC->SetMarkerColor(4);graphPTC->SetMarkerStyle(27);
120 graphPTA->Draw("alp");
121 graphPTC->Draw("lp");
122 graphPTAMC->SetMarkerColor(3);graphPTAMC->SetMarkerStyle(25);
123 graphPTAMC->Draw("lp");
124 TLegend *legend = new TLegend(0.11,0.11,0.4,0.35,"P/T correction");
125 legend->AddEntry(graphPTA,"A side (%)");
126 legend->AddEntry(graphPTC,"C side (%)");
127 legend->AddEntry(graphPTAMC,"A-C side (0.1%)");
128 legend->Draw();
129 //
130 canvasDrift->cd(2);
131 graphITSTPCA->GetXaxis()->SetTimeDisplay(kTRUE);
132 graphITSTPCA->GetYaxis()->SetTitle("v_{dcorr} (%)");
133 graphITSTPCA->SetMarkerColor(2);graphITSTPCA->SetMarkerStyle(25);
134 graphITSTPCC->SetMarkerColor(4);graphITSTPCC->SetMarkerStyle(27);
135 graphITSTPCA->Draw("ap");
136 graphITSTPCC->Draw("p");
137 TLegend *legend = new TLegend(0.11,0.11,0.4,0.35,"Drift correction (TPC-ITS)");
138 legend->AddEntry(graphITSTPCA,"A side (%)");
139 legend->AddEntry(graphITSTPCC,"C side (%)");
140 legend->Draw();
141 //
142 canvasDrift->cd(3);
143 graphCEA->GetXaxis()->SetTimeDisplay(kTRUE);
144 graphCEA->GetYaxis()->SetTitle("(T_{CE0}-T_{CE})/T_{CE0}");
145 graphCEA->SetMarkerColor(2);graphCEA->SetMarkerStyle(25);
146 graphCEC->SetMarkerColor(4);graphCEC->SetMarkerStyle(27);
147 graphCEA->Draw("ap");
148 graphCEC->Draw("p");
149 graphCEAMC->SetMarkerColor(3);graphCEAMC->SetMarkerStyle(25);
150 graphCEAMC->Draw("p");
151 TLegend *legend = new TLegend(0.11,0.11,0.4,0.35,"CE laser time (T_{CE0}=990)");
152 legend->AddEntry(graphCEA,"A side (%)");
153 legend->AddEntry(graphCEC,"C side (%)");
154 legend->AddEntry(graphCEAMC,"A-C side (0.1%)");
155 legend->Draw();
156 //
157 canvasDrift->SaveAs("pic/canvasDriftTime.gif");
158}
159
160
161void DrawDriftRun(){
162 //
163 //
164 TCut cutRun=Form("run>%d&&run<%d",run0,run1);
165 TCut cutCE="(tdriftCE.fElements[72]>100||tdriftCE.fElements[72]>100)&&min(abs(dcea),abs(dcec))<3600";
166 TCut cutITS="abs(dits)<3600";
167
168 Int_t entries=0;
169 Double_t max=-100000;
170 Double_t min= 100000;
171 Double_t maxT=0,minT=0;
172 Double_t dmaxmin= 200000;
173 TCanvas * canvasDrift = new TCanvas("canvasDriftRun","canvasDriftRun",2000,900);
174 canvasDrift->Divide(1,3);
175 //
176 // P/T part
177 TGraph * graphPTA = TStatToolkit::MakeGraphSparse(tree,"100*ptrel0:run",cutRun);
178 graphPTA->SetTitle("P/T correction A side");
179 graphPTA->SetName("PTcorrectionAside");
180 TGraph * graphPTC = TStatToolkit::MakeGraphSparse(tree,"100*ptrel1:run",cutRun);
181 graphPTC->SetTitle("P/T correction C side");
182 graphPTC->SetName("PTcorrectionCside");
183 TGraph * graphPTAMC = TStatToolkit::MakeGraphSparse(tree,"1000*(ptrel0-ptrel1):run",cutRun);
184 graphPTAMC->SetTitle("P/T correction A-C side");
185 graphPTAMC->SetName("PTcorrectionAMCside");
186 //
187 TGraph * graphCEA = TStatToolkit::MakeGraphSparse(tree,"isValidCE*(-tdriftCE.fElements[72]+990)/10:run",cutRun+cutITS);
188 graphCEA->SetTitle("P/T correction A side");
189 graphCEA->SetName("CEcorrectionAside");
190 TGraph * graphCEC = TStatToolkit::MakeGraphSparse(tree,"isValidCE*(-tdriftCE.fElements[73]+990)/10:run",cutRun+cutITS);
191 graphCEC->SetTitle("P/T correction C side");
192 graphCEC->SetName("CEcorrectionCside");
193 TGraph * graphCEAMC = TStatToolkit::MakeGraphSparse(tree,"(tdriftCE.fElements[73]-tdriftCE.fElements[72]):run",cutRun+cutITS);
194 graphCEAMC->SetTitle("P/T correction A-C side");
195 graphCEAMC->SetName("CEcorrectionAMCside");
196 //
197 TGraph * graphITSTPCA = TStatToolkit::MakeGraphSparse(tree,"isValidITS*vdriftITS*100:run",cutRun+cutITS);
198 graphITSTPCA->SetTitle("P/T correction A side");
199 graphITSTPCA->SetName("ITSTPCcorrectionAside");
200 TGraph * graphITSTPCC = TStatToolkit::MakeGraphSparse(tree,"isValidITS*vdriftITS*100:run",cutRun+cutITS);
201 graphITSTPCC->SetTitle("P/T correction C side");
202 graphITSTPCC->SetName("ITSTPCcorrectionCside");
203 //
204 // Drawing part
205 //
206 min=-6;
207 max=6;
208 graphCEA->SetMinimum(min);
209 graphCEA->SetMaximum(max);
210 graphPTA->SetMinimum(min);
211 graphPTA->SetMaximum(max);
212 graphITSTPCA->SetMinimum(min);
213 graphITSTPCA->SetMaximum(max);
214 //
215 //
216 canvasDrift->cd(1);
217 graphPTA->GetXaxis()->SetTimeDisplay(kTRUE);
218 graphPTA->GetYaxis()->SetTitle("#Delta P/T (%)");
219 graphPTA->SetMarkerColor(2);graphPTA->SetMarkerStyle(25);
220 graphPTC->SetMarkerColor(4);graphPTC->SetMarkerStyle(27);
221 graphPTA->Draw("alp");
222 graphPTC->Draw("lp");
223 graphPTAMC->SetMarkerColor(3);graphPTAMC->SetMarkerStyle(25);
224 graphPTAMC->Draw("lp");
225 TLegend *legend = new TLegend(0.11,0.11,0.4,0.35,"P/T correction");
226 legend->AddEntry(graphPTA,"A side (%)");
227 legend->AddEntry(graphPTC,"C side (%)");
228 legend->AddEntry(graphPTAMC,"A-C side (0.1%)");
229 legend->Draw();
230 //
231 canvasDrift->cd(2);
232 graphITSTPCA->GetXaxis()->SetTimeDisplay(kTRUE);
233 graphITSTPCA->GetYaxis()->SetTitle("v_{dcorr} (%)");
234 graphITSTPCA->SetMarkerColor(2);graphITSTPCA->SetMarkerStyle(25);
235 graphITSTPCC->SetMarkerColor(4);graphITSTPCC->SetMarkerStyle(27);
236 graphITSTPCA->Draw("ap");
237 graphITSTPCC->Draw("p");
238 TLegend *legend = new TLegend(0.11,0.11,0.4,0.35,"Drift correction (TPC-ITS)");
239 legend->AddEntry(graphITSTPCA,"A side (%)");
240 legend->AddEntry(graphITSTPCC,"C side (%)");
241 legend->Draw();
242 //
243 canvasDrift->cd(3);
244 graphCEA->GetXaxis()->SetTimeDisplay(kTRUE);
245 graphCEA->GetYaxis()->SetTitle("(T_{CE0}-T_{CE})/T_{CE0}");
246 graphCEA->SetMarkerColor(2);graphCEA->SetMarkerStyle(25);
247 graphCEC->SetMarkerColor(4);graphCEC->SetMarkerStyle(27);
248 graphCEA->Draw("ap");
249 graphCEC->Draw("p");
250 graphCEAMC->SetMarkerColor(3);graphCEAMC->SetMarkerStyle(25);
251 graphCEAMC->Draw("p");
252 TLegend *legend = new TLegend(0.11,0.11,0.4,0.35,"CE laser time (T_{CE0}=990)");
253 legend->AddEntry(graphCEA,"A side (%)");
254 legend->AddEntry(graphCEC,"C side (%)");
255 legend->AddEntry(graphCEAMC,"A-C side (0.1%)");
256 legend->Draw();
257 //
258 canvasDrift->SaveAs("pic/canvasDriftRun.gif");
259}
260
261void DrawDriftCorel(){
262 //
263 //
264 //
265 TStatToolkit toolkit;
266 Double_t chi2=0;
267 Int_t npoints=0;
268 TVectorD param;
269 TMatrixD covar;
270 TString *strDelta=0;
271 Int_t npointsMax=100000;
272 //
273 tree->SetAlias("tCEB","(tdriftCE.fElements[72]+tdriftCE.fElements[73]-2000)/2000");
274 tree->SetAlias("tCEA","(tdriftCE.fElements[72]-1000)/1000");
275 tree->SetAlias("tCEC","(tdriftCE.fElements[73]-1000)/1000");
276
277 tree->SetAlias("tCEE","1-((1+(ptrel0+ptrel1)*0.5)*(1+vdriftITS))");
278 strDelta= TStatToolkit::FitPlaneConstrain(tree,"tCEB", "tCEE","isValidCEB&&isValidITS", chi2,npoints,param,covar,-1,0, npointsMax, 20);
279 //
280 strDelta->Tokenize("++")->Print();
281 tree->SetAlias("tCEF",strDelta->Data());
282
283 TGraph * graphLT = TStatToolkit::MakeGraphSparse(tree,"2.64*1000*(tCEB-tCEF):run","isValidCEB&&isValidITS");
284 TGraph * graphLTA = TStatToolkit::MakeGraphSparse(tree,"2.64*1000*(tCEA-tCEF):run","isValidCEB&&isValidITS");
285 TGraph * graphLTC = TStatToolkit::MakeGraphSparse(tree,"2.64*1000*(tCEC-tCEF):run","isValidCEB&&isValidITS");
286 graphLT->GetYaxis()->SetTitle("#Delta (mm)");
287 graphLT->SetMarkerStyle(25);
288 graphLTA->SetMarkerStyle(26); graphLTA->SetMarkerColor(2);
289 graphLTC->SetMarkerStyle(27); graphLTC->SetMarkerColor(4);
290 graphLT->SetMaximum(10);
291 graphLT->SetMinimum(-10);
292
293 TCanvas * canvasDrift = new TCanvas("canvasDriftDiff","canvasDriftDiff",2000,500);
294 graphLT->Draw("alp");
295 graphLTA->Draw("lp");
296 graphLTC->Draw("lp");
297 TLegend *legend = new TLegend(0.11,0.11,0.4,0.35,"CE plane - corrected with tracks");
298 legend->AddEntry(graphLT,"AC side mean (mm)");
299 legend->AddEntry(graphLTA,"A side (mm)");
300 legend->AddEntry(graphLTC,"C side (mm)");
301 legend->Draw();
302 //
303 canvasDrift->SaveAs("pic/canvasDriftDiffRun.gif");
304}