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