AliRoot Core  837871f (837871f)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MakeLookup.C
Go to the documentation of this file.
1 
16 
17 /*
18  Example usage:
19  gROOT->Macro("~/rootlogon.C")
20  gSystem->AddIncludePath("-I$ALICE_ROOT/STAT")
21  gSystem->AddIncludePath("-I$ALICE_ROOT/TPC")
22  gSystem->AddIncludePath("-I$ALICE_ROOT/TPC/macros")
23  gSystem->Load("libANALYSIS");
24  gSystem->Load("libTPCcalib");
25  .L $ALICE_ROOT/TPC/CalibMacros/MakeLookup.C+
26  Int_t run=115888
27  // .x $ALICE_ROOT/ANALYSIS/CalibMacros/Pass0/ConfigCalibTrain.C(run,"local:///lustre/alice/alien/alice/data/2010/OCDB")
28 
29  MakeLookup(run,0);
30 
31  //Local check of procedure
32  TTreeSRedirector * pcstream = new TTreeSRedirector("mean.root");
33  TFile f("CalibObjects.root");
34  AliTPCcalibTime *calibTime= f.Get("calibTime");
35  THnSparse * his = calibTime->GetResHistoTPCITS(0);
36  his->GetAxis(1)->SetRangeUser(-1,1);
37  his->GetAxis(2)->SetRange(0,1000000);
38  his->GetAxis(3)->SetRangeUser(-0.3,0.3);
39  //
40 
41 
42 
43 */
44 
45 #if !defined(__CINT__) || defined(__MAKECINT__)
46 #include "THnSparse.h"
47 #include "TLatex.h"
48 #include "TCanvas.h"
49 #include "TLegend.h"
50 #include "TSystem.h"
51 #include "TFile.h"
52 #include "TChain.h"
53 #include "TCut.h"
54 #include "TH3.h"
55 #include "TProfile3D.h"
56 #include "TMath.h"
57 #include "TVectorD.h"
58 #include "TMatrixD.h"
59 #include "TStatToolkit.h"
60 #include "TTreeStream.h"
61 #include "AliExternalTrackParam.h"
62 #include "AliESDfriend.h"
63 #include "AliTPCcalibTime.h"
64 #include "TROOT.h"
65 #include "AliXRDPROOFtoolkit.h"
66 #include "AliTPCCorrection.h"
67 #include "AliTPCExBTwist.h"
68 #include "AliTPCGGVoltError.h"
70 #include "AliTPCExBConical.h"
71 #include "TPostScript.h"
72 #include "TStyle.h"
73 #include "AliTrackerBase.h"
75 #include "AliTPCExBEffective.h"
76 #include "AliTPCExBBShape.h"
77 #endif
78 
79 TChain * chain=0;
80 void MakeLookup(Int_t run, Int_t mode);
81 //void MakeLookupHisto(THnSparse * his, TTreeSRedirector *pcstream, const char* hname, Int_t run);
82 void FitLookup(TChain *chainIn, const char *prefix, TVectorD &vecA, TVectorD &vecC, TVectorD& vecStatA, TVectorD &vecStatD, TCut cut, TObjArray *picArray);
83 void MakeFits(Int_t run);
84 void MakeFitTree();
85 void DrawDistortionDy(TCut cutUser="", Double_t ymin=-0.6, Double_t ymax=0.6);
86 void DrawDistortionMaps(const char *fname="mean.root");
87 TCanvas * DrawDistortionMaps(TTree * treedy, TTree * treedsnp, TTree* treed1Pt, const char * name, const char *title);
89 void MakeLaserTree();
91 
92 void MakeLookup(Int_t run, Int_t mode){
96 
97  gSystem->AddIncludePath("-I$ALICE_ROOT/STAT");
98  gSystem->Load("libANALYSIS");
99  gSystem->Load("libTPCcalib");
100  if (mode==5) {MakeLaserTree();return;};
101  if (mode==4) {DrawDistortionMaps();return;}
102  if (mode==1){
103  DrawDistortionDy("abs(snp)<0.25");
105  return;
106  }
107  if (mode==2) return MakeFitTree();
108  TFile f("TPCTimeObjects.root");
109  AliTPCcalibTime *calibTime= (AliTPCcalibTime*)f.Get("calibTime");
110  if (!calibTime){
111  TFile* f2 = new TFile("CalibObjects.root");
112  calibTime= (AliTPCcalibTime*)f2->Get("calibTime");
113  if (!calibTime){
114  TFile* f3 = new TFile("../CalibObjects.root");
115  calibTime= (AliTPCcalibTime*)f3->Get("calibTime");
116  }
117  }
118  //
119  TTreeSRedirector * pcstream = new TTreeSRedirector("mean.root");
120  THnSparse * his = 0;
121  const char * hname[5]={"dy","dz","dsnp","dtheta","d1pt"};
122  if (calibTime){
123  for (Int_t ihis=0; ihis<5;ihis++){
124  his = calibTime->GetResHistoTPCITS(ihis);
125  his->GetAxis(1)->SetRangeUser(-1.1,1.1);
126  his->GetAxis(2)->SetRange(0,1000000);
127  his->GetAxis(3)->SetRangeUser(-0.5,0.5);
128  AliTPCCorrection::MakeDistortionMap(his,pcstream, Form("ITS%s",hname[ihis]),run);
129  //
130  his = calibTime->GetResHistoTPCvertex(ihis);
131  his->GetAxis(1)->SetRangeUser(-1.1,1.1);
132  his->GetAxis(2)->SetRange(0,1000000);
133  his->GetAxis(3)->SetRangeUser(-0.5,0.5);
134  AliTPCCorrection::MakeDistortionMap(his,pcstream, Form("Vertex%s",hname[ihis]),run);
135  //
136  his = calibTime->GetResHistoTPCTRD(ihis);
137  his->GetAxis(1)->SetRangeUser(-1.1,1.1);
138  his->GetAxis(2)->SetRange(0,1000000);
139  his->GetAxis(3)->SetRangeUser(-0.5,0.5);
140  AliTPCCorrection::MakeDistortionMap(his,pcstream, Form("TRD%s",hname[ihis]),run);
141  his = calibTime->GetResHistoTPCTOF(ihis);
142  if (his){
143  his->GetAxis(1)->SetRangeUser(-1.1,1.1);
144  his->GetAxis(2)->SetRange(0,1000000);
145  his->GetAxis(3)->SetRangeUser(-0.5,0.5);
146  AliTPCCorrection::MakeDistortionMap(his,pcstream, Form("TOF%s",hname[ihis]),run);
147  }
148  }
149  }
150  delete pcstream;
151  gSystem->Exec("echo `pwd`/mean.root > distort.txt");
152  MakeFits(run);
153 }
154 
155 
156 void MakeFits(Int_t run){
159 
160  TCut cut="entries>50&&rms>0";
161  TTreeSRedirector *pcstream = new TTreeSRedirector("distortFit.root");
162  AliXRDPROOFtoolkit tool;
163  TVectorD vecA[100],vecC[100], vecStatA[100],vecStatC[100];
164  TObjArray * picArray= new TObjArray();
165  //
166  TChain *chainITSdy = tool.MakeChain("distort.txt","ITSdy",0,100000);
167  TChain *chainITSdsnp = tool.MakeChain("distort.txt","ITSdsnp",0,100000);
168  TChain *chainTRDdy = tool.MakeChain("distort.txt","TRDdy",0,100000);
169  TChain *chainTRDdsnp = tool.MakeChain("distort.txt","TRDdsnp",0,100000);
170  TChain *chainVertexdy = tool.MakeChain("distort.txt","Vertexdy",0,100000);
171  TChain *chainVertexdsnp = tool.MakeChain("distort.txt","Vertexdsnp",0,100000);
172 
173  (*pcstream)<<"fits"<<"run="<<run;
174 
175  FitLookup(chainITSdy, "yits-tpc",vecA[0],vecC[0],vecStatA[0],vecStatC[0],cut, picArray);
176  (*pcstream)<<"fits"<<"itsdyA.="<<&vecA[0]<<"itsdyC.="<<&vecC[0];
177  (*pcstream)<<"fits"<<"itsdyAS.="<<&vecStatA[0]<<"itsdyCS.="<<&vecStatC[0];
178  FitLookup(chainITSdsnp, "snpits-tpc",vecA[1],vecC[1],vecStatA[1],vecStatC[1],cut, picArray);
179  (*pcstream)<<"fits"<<"itsdsnpA.="<<&vecA[1]<<"itsdsnpC.="<<&vecC[1];
180  (*pcstream)<<"fits"<<"itsdsnpAS.="<<&vecStatA[1]<<"itsdsnpCS.="<<&vecStatC[1];
181  //
182  FitLookup(chainTRDdy, "ytrd-tpc",vecA[5],vecC[5],vecStatA[5],vecStatC[5],cut, picArray);
183  (*pcstream)<<"fits"<<"trddyA.="<<&vecA[5]<<"trddyC="<<&vecC[5];
184  (*pcstream)<<"fits"<<"trddyAS.="<<&vecStatA[5]<<"trddyCS.="<<&vecStatC[5];
185  FitLookup(chainTRDdsnp, "snptrd-tpc",vecA[6],vecC[6],vecStatA[6],vecStatC[6],cut, picArray);
186  (*pcstream)<<"fits"<<"trddsnpA.="<<&vecA[6]<<"trddsnpC.="<<&vecC[6];
187  (*pcstream)<<"fits"<<"trddsnpAS.="<<&vecStatA[6]<<"trddsnpCS.="<<&vecStatC[6];
188  //
189  FitLookup(chainVertexdy, "yvertex-tpc",vecA[10],vecC[10],vecStatA[10],vecStatC[10],cut, picArray);
190  (*pcstream)<<"fits"<<"vertexdyA.="<<&vecA[10]<<"vertexdyC.="<<&vecC[10];
191  (*pcstream)<<"fits"<<"vertexdyAS.="<<&vecStatA[10]<<"vertexdyCS.="<<&vecStatC[10];
192  FitLookup(chainVertexdsnp, "snpvertex-tpc",vecA[11],vecC[11],vecStatA[11],vecStatC[11],cut, picArray);
193  (*pcstream)<<"fits"<<"vertexdsnpA.="<<&vecA[11]<<"vertexdsnpC.="<<&vecC[11];
194  (*pcstream)<<"fits"<<"vertexdsnpAS.="<<&vecStatA[11]<<"vertexdsnpCS.="<<&vecStatC[11];
195  //
196  (*pcstream)<<"fits"<<"\n";
197 
198  pcstream->GetFile()->cd();
199  for (Int_t i=0;i<picArray->GetEntries(); i++){
200  TObject * obj = picArray->At(i);
201  if (obj) obj->Write(obj->GetName());
202  }
203  //
204  //
205  //
206  chainITSdy->AddFriend(chainITSdy,"ITSdy");
207  chainITSdy->AddFriend(chainITSdsnp,"ITSdsnp");
208  chainITSdy->AddFriend(chainTRDdy,"TRDdy");
209  chainITSdy->AddFriend(chainTRDdsnp,"TRDdsnp");
210  chainITSdy->AddFriend(chainVertexdy,"Vertexdy");
211  chainITSdy->AddFriend(chainVertexdsnp,"Vertexdsnp");
212  TTree * tree = chainITSdy->CloneTree();
213  tree->Write("distortionTree");
214  delete pcstream;
215 
216  //
217  //
218 }
219 
220 
221 
222 
223 
224 void FitLookup(TChain *chainIn, const char *prefix, TVectorD &vecA, TVectorD &vecC, TVectorD& vecStatA, TVectorD &vecStatC, TCut cut, TObjArray *picArray){
226 
227  vecStatA.ResizeTo(6);
228  vecStatC.ResizeTo(6);
229  vecA.ResizeTo(10);
230  vecC.ResizeTo(10);
231  Int_t npointsMax=30000000;
233  Double_t chi2A=0;
234  Double_t chi2C=0;
235  Int_t npointsA=0;
236  Int_t npointsC=0;
237  TVectorD paramA;
238  TVectorD paramC;
239  TMatrixD covar;
240  TString *strFitYA;
241  TString *strFitYC;
242 
243  TString fstring=""; // magnetic part
244  //fstring+="(1)++"; //0 - offset value
245  fstring+="(cos(phi))++"; //1 - cos part
246  fstring+="(sin(phi))++"; //2 - sin part
247  //
248  fstring+="(theta)++"; //3
249  fstring+="(theta*cos(phi))++"; //4
250  fstring+="(theta*sin(phi))++"; //5
251  //
252  fstring+="(snp)++"; //6 - delta X(radial) coeficients - offset
253  fstring+="(snp*cos(phi))++"; //7 - delta X(radial) coeficient
254  fstring+="(snp*sin(phi))++"; //8
255  //
256  //
257  strFitYA = TStatToolkit::FitPlane(chainIn,"mean", fstring.Data(),cut+"theta>0", chi2A,npointsA,paramA,covar,-1,0, npointsMax, kFALSE);
258  strFitYC = TStatToolkit::FitPlane(chainIn,"mean", fstring.Data(),cut+"theta<0", chi2C,npointsC,paramC,covar,-1,0, npointsMax,kFALSE);
259  strFitYA->Tokenize("++")->Print();
260  strFitYC->Tokenize("++")->Print();
261  chainIn->SetAlias("dyA",strFitYA->Data());
262  chainIn->SetAlias("dyC",strFitYC->Data());
263  //
264  TH1 * his=0;
265  vecA.ResizeTo(paramA.GetNrows());
266  vecC.ResizeTo(paramC.GetNrows());
267  vecA=paramA;
268  vecC=paramC;
269  // A side stat
270  vecStatA[0]=npointsA;
271  vecStatA[1]=TMath::Sqrt(chi2A/npointsA);
272  chainIn->Draw("mean",cut+"theta>0");
273  his=chainIn->GetHistogram();
274  his->SetName(Form("Orig #Delta%sA",prefix));
275  his->SetTitle(Form("Orig #Delta%sA",prefix));
276  picArray->AddLast(his->Clone());
277  vecStatA[2] = his->GetMean();
278  vecStatA[3] = his->GetRMS();
279  chainIn->Draw("mean-dyA",cut+"theta>0");
280  his=chainIn->GetHistogram();
281  his->SetName(Form("Corr. #Delta%sA",prefix));
282  his->SetTitle(Form("Corr. #Delta%sA",prefix));
283  picArray->AddLast(his->Clone());
284  vecStatA[4] = his->GetMean();
285  vecStatA[5] = his->GetRMS();
286  //
287  // C side stat
288  vecStatC[0]=npointsC;
289  vecStatC[1]=TMath::Sqrt(chi2C/npointsC);
290  chainIn->Draw("mean",cut+"theta<0");
291  his=chainIn->GetHistogram();
292  his->SetName(Form("Orig #Delta%sC",prefix));
293  his->SetTitle(Form("Orig #Delta%sC",prefix));
294  picArray->AddLast(his->Clone());
295  vecStatC[2] = his->GetMean();
296  vecStatC[3] = his->GetRMS();
297  chainIn->Draw("mean-dyC",cut+"theta<0");
298  his=chainIn->GetHistogram();
299  his->SetName(Form("Corr. #Delta%sC",prefix));
300  his->SetTitle(Form("Corr. #Delta%sC",prefix));
301  picArray->AddLast(his->Clone());
302  vecStatC[4] = his->GetMean();
303  vecStatC[5] = his->GetRMS();
304 
305  vecStatA.Print();
306  vecStatC.Print();
307 }
308 
309 
310 
311 void DrawDistortionDy(TCut cutUser, Double_t ymin, Double_t ymax){
313 
314  TFile fplus("meanBplus.root");
315  TFile fminus("meanBminus.root");
316  TTree * titsDyPlus= (TTree*)fplus.Get("ITSdy");
317  TTree * titsDyMinus= (TTree*)fminus.Get("ITSdy");
318  TTree * ttrdDyPlus= (TTree*)fplus.Get("TRDdy");
319  TTree * ttrdDyMinus= (TTree*)fminus.Get("TRDdy");
320  //
321  TTree * titsDsnpPlus= (TTree*)fplus.Get("ITSdsnp");
322  TTree * titsDsnpMinus= (TTree*)fminus.Get("ITSdsnp");
323  TTree * ttrdDsnpPlus= (TTree*)fplus.Get("TRDdsnp");
324  TTree * ttrdDsnpMinus= (TTree*)fminus.Get("TRDdsnp");
325  TTree * titsDthetaPlus= (TTree*)fplus.Get("ITSdtheta");
326  TTree * titsDthetaMinus= (TTree*)fminus.Get("ITSdtheta");
327  TTree * ttrdDthetaPlus= (TTree*)fplus.Get("TRDdtheta");
328  TTree * ttrdDthetaMinus= (TTree*)fminus.Get("TRDdtheta");
329  TCut cut="rms>0&&entries>100&&abs(theta)<1&&abs(snp)<0.3";
330  cut+=cutUser;
331  //
332  titsDyPlus->AddFriend(titsDyMinus,"TM.");
333  titsDyPlus->AddFriend(titsDsnpMinus,"Tsnp.");
334  titsDyPlus->AddFriend(titsDthetaMinus,"Ttheta.");
335  ttrdDyPlus->AddFriend(ttrdDyMinus,"TM.");
336  titsDsnpPlus->AddFriend(titsDsnpMinus,"TM.");
337  ttrdDsnpPlus->AddFriend(ttrdDsnpMinus,"TM.");
338 
339  //
340  //
341  //
342  Int_t entries=0;
343  TGraph * graphITSYC[3];
344  TGraph * graphITSYA[3];
345  TGraph * graphTRDYC[3];
346  TGraph * graphTRDYA[3];
347  //
348  //
349  entries=titsDyPlus->Draw("mean-TM..mean:phi",cut+"theta<-0.1","goff");
350  graphITSYC[0] = new TGraph(entries, titsDyPlus->GetV2(),titsDyPlus->GetV1());
351  titsDyMinus->Draw("mean:phi",cut+"theta<-0.1","goff");
352  graphITSYC[2] = new TGraph(entries, titsDyMinus->GetV2(),titsDyMinus->GetV1());
353  titsDyPlus->Draw("mean:phi",cut+"theta<-0.1","goff");
354  graphITSYC[1] = new TGraph(entries, titsDyPlus->GetV2(),titsDyPlus->GetV1());
355  //
356  entries=titsDyPlus->Draw("mean-TM..mean:phi",cut+"theta>0.1","goff");
357  graphITSYA[0] = new TGraph(entries, titsDyPlus->GetV2(),titsDyPlus->GetV1());
358  titsDyMinus->Draw("mean:phi",cut+"theta>0.1","goff");
359  graphITSYA[2] = new TGraph(entries, titsDyMinus->GetV2(),titsDyMinus->GetV1());
360  titsDyPlus->Draw("mean:phi",cut+"theta>0.1","goff");
361  graphITSYA[1] = new TGraph(entries, titsDyPlus->GetV2(),titsDyPlus->GetV1());
362  //
363  entries=ttrdDyPlus->Draw("mean-TM..mean:phi",cut+"theta<-0.1&&TM..entries>100","goff");
364  graphTRDYC[0] = new TGraph(entries, ttrdDyPlus->GetV2(),ttrdDyPlus->GetV1());
365  ttrdDyMinus->Draw("mean:phi",cut+"theta<-0.1","goff");
366  graphTRDYC[2] = new TGraph(entries, ttrdDyMinus->GetV2(),ttrdDyMinus->GetV1());
367  ttrdDyPlus->Draw("mean:phi",cut+"theta<-0.1","goff");
368  graphTRDYC[1] = new TGraph(entries, ttrdDyPlus->GetV2(),ttrdDyPlus->GetV1());
369  //
370  entries=ttrdDyPlus->Draw("mean-TM..mean:phi",cut+"theta>0.1&&TM..entries>100","goff");
371  graphTRDYA[0] = new TGraph(entries, ttrdDyPlus->GetV2(),ttrdDyPlus->GetV1());
372  ttrdDyMinus->Draw("mean:phi",cut+"theta>0.1","goff");
373  graphTRDYA[2] = new TGraph(entries, ttrdDyMinus->GetV2(),ttrdDyMinus->GetV1());
374  ttrdDyPlus->Draw("mean:phi",cut+"theta>0.1","goff");
375  graphTRDYA[1] = new TGraph(entries, ttrdDyPlus->GetV2(),ttrdDyPlus->GetV1());
376  //
377 
378 
379  //
380  {for (Int_t i=0; i<3; i++){
381  graphITSYC[i]->SetMaximum(ymax+0.2); graphITSYC[i]->SetMinimum(ymin);
382  graphITSYC[i]->GetXaxis()->SetTitle("#phi"); graphITSYC[i]->GetYaxis()->SetTitle("#Delta r#phi (cm)");
383  graphITSYC[i]->SetMarkerColor(i+1); graphITSYC[i]->SetMarkerStyle(20+i);
384  graphITSYA[i]->SetMaximum(ymax+0.2); graphITSYA[i]->SetMinimum(ymin);
385  graphITSYA[i]->GetXaxis()->SetTitle("#phi"); graphITSYA[i]->GetYaxis()->SetTitle("#Delta r#phi (cm)");
386  graphITSYA[i]->SetMarkerColor(i+1); graphITSYA[i]->SetMarkerStyle(20+i);
387  graphTRDYC[i]->SetMaximum(ymax+0.2); graphTRDYC[i]->SetMinimum(ymin);
388  graphTRDYC[i]->GetXaxis()->SetTitle("#phi"); graphTRDYC[i]->GetYaxis()->SetTitle("#Delta r#phi (cm)");
389  graphTRDYC[i]->SetMarkerColor(i+1); graphTRDYC[i]->SetMarkerStyle(20+i);
390  graphTRDYA[i]->SetMaximum(ymax+0.2); graphTRDYA[i]->SetMinimum(ymin);
391  graphTRDYA[i]->GetXaxis()->SetTitle("#phi"); graphTRDYA[i]->GetYaxis()->SetTitle("#Delta r#phi (cm)");
392  graphTRDYA[i]->SetMarkerColor(i+1); graphTRDYA[i]->SetMarkerStyle(20+i);
393  }
394  }
395  TLegend *legend=0;
396  TString cname="cdeltaY";
397  TString dirName=gSystem->GetFromPipe("dirname `pwd` | xargs basename ");
398  TString splus=gSystem->GetFromPipe("ls -al meanBplus.root | gawk '{print \"File: \"$8\" \"$6\" \"$7\" \";}'");
399  TString sminus=gSystem->GetFromPipe("ls -al meanBminus.root | gawk '{print \"File: \"$8\" \"$6\" \"$7\" \";}'");
400 
401  TCanvas *cdeltaY = new TCanvas("cdeltaY","cdeltaY",1300,800);
402  cdeltaY->Divide(2,2);
403 
404  cdeltaY->cd(1);
405  graphITSYC[0]->Draw("ap");
406  graphITSYC[1]->Draw("p");
407  graphITSYC[2]->Draw("p");
408  legend = new TLegend(0.6,0.6,1.0,1.0,"ITS-TPC C side #Delta r-#phi");
409  legend->AddEntry("",dirName.Data());
410  legend->AddEntry("",splus.Data());
411  legend->AddEntry("",sminus.Data());
412  legend->AddEntry(graphITSYC[0],"B_{plus}-B_{minus}");
413  legend->AddEntry(graphITSYC[1],"B_{plus}");
414  legend->AddEntry(graphITSYC[2],"B_{minus}");
415  legend->Draw();
416 
417  cdeltaY->cd(2);
418  graphITSYA[0]->Draw("ap");
419  graphITSYA[1]->Draw("p");
420  graphITSYA[2]->Draw("p");
421  legend = new TLegend(0.6,0.6,1.0,1.0,"ITS-TPC A side #Delta r-#phi");
422  legend->AddEntry(graphITSYA[0],"B_{plus}-B_{minus}");
423  legend->AddEntry(graphITSYA[1],"B_{plus}");
424  legend->AddEntry(graphITSYA[2],"B_{minus}");
425  legend->Draw();
426 
427  //
428  cdeltaY->cd(3);
429  graphTRDYC[0]->Draw("ap");
430  graphTRDYC[1]->Draw("p");
431  graphTRDYC[2]->Draw("p");
432  legend = new TLegend(0.6,0.6,1.0,1.0,"TRD-TPC C side #Delta r-#phi");
433  legend->AddEntry(graphTRDYC[0],"B_{plus}-B_{minus}");
434  legend->AddEntry(graphTRDYC[1],"B_{plus}");
435  legend->AddEntry(graphTRDYC[2],"B_{minus}");
436  legend->Draw();
437 
438  cdeltaY->cd(4);
439  graphTRDYA[0]->Draw("ap");
440  graphTRDYA[1]->Draw("p");
441  graphTRDYA[2]->Draw("p");
442  legend = new TLegend(0.6,0.6,1.0,1.0,"TRD-TPC A side #Delta r-#phi");
443  legend->AddEntry(graphTRDYA[0],"B_{plus}-B_{minus}");
444  legend->AddEntry(graphTRDYA[1],"B_{plus}");
445  legend->AddEntry(graphTRDYA[2],"B_{minus}");
446  legend->Draw();
447  cdeltaY->SaveAs(dirName+"_deltaY.pdf");
448 
449 }
450 
451 
452 
453 
454 
455 
456 void MakeFitTree(){
460 
462  TObjArray * corr = (TObjArray*)(cc->GetCorrections());
463  // corr->AddLast(cc);
464  const Int_t kskip=23;
465  //
466  TFile f("mean.root");
467  TTree * tree= 0;
468  tree = (TTree*)f.Get("ITSdy");
469  printf("ITSdy\n");
470  AliTPCCorrection::MakeTrackDistortionTree(tree,0,0,corr,kskip);
471  tree = (TTree*)f.Get("TRDdy");
472  printf("TRDdy\n");
473  AliTPCCorrection::MakeTrackDistortionTree(tree,1,0,corr,kskip);
474  tree = (TTree*)f.Get("Vertexdy");
475  printf("Vertexdy\n");
476  AliTPCCorrection::MakeTrackDistortionTree(tree,2,0,corr,kskip);
477  tree = (TTree*)f.Get("TOFdy");
478  printf("TOFdy\n");
479  if (tree) AliTPCCorrection::MakeTrackDistortionTree(tree,3,0,corr,kskip);
480 
481  //
482  tree = (TTree*)f.Get("ITSdsnp");
483  printf("ITSdsnp\n");
484  AliTPCCorrection::MakeTrackDistortionTree(tree,0,2,corr,kskip);
485  tree = (TTree*)f.Get("TRDdsnp");
486  printf("TRDdsnp\n");
487  AliTPCCorrection::MakeTrackDistortionTree(tree,1,2,corr,kskip);
488  tree = (TTree*)f.Get("Vertexdsnp");
489  printf("Vertexdsnp\n");
490  AliTPCCorrection::MakeTrackDistortionTree(tree,2,2,corr,kskip);
491  //
492 
493  tree = (TTree*)f.Get("ITSd1pt");
494  printf("ITSd1pt\n");
495  if (tree) AliTPCCorrection::MakeTrackDistortionTree(tree,0,4,corr,kskip);
496 
497  tree = (TTree*)f.Get("TOFdz");
498  printf("TOFdz\n");
499  if (tree) AliTPCCorrection::MakeTrackDistortionTree(tree,3,0,corr,kskip);
500 
501 
502  tree = (TTree*)f.Get("ITSdz");
503  printf("ITSdz\n");
504  AliTPCCorrection::MakeTrackDistortionTree(tree,0,1,corr,kskip);
505  tree = (TTree*)f.Get("Vertexdz");
506  printf("Vertexdz\n");
507  AliTPCCorrection::MakeTrackDistortionTree(tree,2,1,corr,kskip);
508 
509  //
510  tree = (TTree*)f.Get("ITSdtheta");
511  printf("ITSdtheta\n");
512  AliTPCCorrection::MakeTrackDistortionTree(tree,0,3,corr,kskip);
513  //
514  tree = (TTree*)f.Get("Vertexdtheta");
515  printf("Vertexdtheta\n");
516  AliTPCCorrection::MakeTrackDistortionTree(tree,2,3,corr,kskip);
517 
518 
519 }
520 
521 
522 
524  AliXRDPROOFtoolkit tool;
525  TChain *chain = tool.MakeChain("distortion.txt","fit",0,100000);
526 
527  TCut cutS="rms>0&&entries>100";
528  TCut cut=cutS+"(ptype==0||ptype==2||ptype==3||(ptype==4&&dtype==0))";
529  Int_t npointsMax=30000000;
531  Double_t chi2=0;
532  Int_t npoints=0;
533  TVectorD param;
534  TMatrixD covar;
535  chain->SetAlias("side","(1+(theta>0)*2)");
536  TString fstring=""; // magnetic part
537  fstring+="tX1++"; //1 - twist x in mrad
538  fstring+="tY1++"; //2 - twist y in mrad
539  fstring+="ExBCon++"; //3 - custom
540  fstring+="ExBCon*cos(phi)++"; //3 - custom
541  fstring+="ExBCon*sin(phi)++"; //3 - custom
542  fstring+="ggA++"; //4 - gating grid
543  fstring+="ggA*cos(phi)++"; //4 - gating grid
544  fstring+="ggA*sin(phi)++"; //4 - gating grid
545  fstring+="ggC++"; //5 - gating grid
546  fstring+="ggC*cos(phi)++"; //5 - gating grid
547  fstring+="ggC*sin(phi)++"; //5 - gating grid
548  fstring+="(ptype==2)++";
549  fstring+="(ptype==3)++";
550  fstring+="(ptype==4)++";
551  fstring+="(ptype==4)*bz++";
552 
553  TString *strDelta = TStatToolkit::FitPlane(chain,"mean:rms", fstring.Data(),cut+"(Entry$%13==0)", chi2,npoints,param,covar,-1,0, npointsMax, kTRUE);
554  chain->SetAlias("delta",strDelta->Data());
555  strDelta->Tokenize("++")->Print();
556 
557 }
558 
559 
560 void MakeGlobalFitRelative(Int_t highFrequency=0){
564 
565  AliXRDPROOFtoolkit tool;
566  // TChain *chain = tool.MakeChain("distortion.txt","fit",0,100000);
567  TChain *chainPlus = tool.MakeChain("distortionPlus.txt","fit",0,100000);
568  TChain *chainMinus = tool.MakeChain("distortionMinus.txt","fit",0,100000);
569  TChain *chain0 = tool.MakeChain("distortionField0.txt","fit",0,100000);
570 
571  chainPlus->AddFriend(chainMinus,"M");
572  chainPlus->AddFriend(chain0,"F0");
573 
574  TCut cut="rms>0&&M.rms>0&&entries>100&&dtype==0&&(ptype==0||ptype==2||ptype==4)";
575  chainPlus->SetAlias("deltaM","mean-M.mean");
576  Int_t npointsMax=30000000;
578  Double_t chi2=0;
579  Int_t npoints=0;
580  TVectorD param;
581  TMatrixD covar;
582  //
583  TString fstring=""; // fit string
584  fstring+="(ptype==0)*cos(phi)++"; // - primitive gx movement
585  fstring+="(ptype==0)*sin(phi)++"; // - primitive gy movement
586 
587  fstring+="(tX1-M.tX1)++"; // 1 - twist x in mrad
588  fstring+="(tY1-M.tY1)++"; // 2 - twist y in mrad
589  //
590  fstring+="(ExBConA-M.ExBConA)++"; // 3 conical shape A side
591  fstring+="(ExBConC-M.ExBConC)++"; // 4 conical shape C side
592  //
593  fstring+="(ggA-M.ggA)++"; // 3 conical shape A side
594  fstring+="(ggC-M.ggC)++"; // 4 conical shape C side
595 
596  if (highFrequency) {for (Int_t i=1; i<highFrequency; i++){
597  fstring+=Form("((ggA-M.ggA)*cos(%d*phi))++",i);
598  fstring+=Form("((ggA-M.ggA)*sin(%d*phi))++",i);
599  //
600  fstring+=Form("((ggC-M.ggC)*cos(%d*phi))++",i);
601  fstring+=Form("((ggC-M.ggC)*sin(%d*phi))++",i);
602  if (i>1){
603  fstring+=Form("((ExBConA-M.ExBConA)*cos(%d*phi))++",i);
604  fstring+=Form("((ExBConA-M.ExBConA)*sin(%d*phi))++",i);
605  fstring+=Form("((ExBConC-M.ExBConC)*cos(%d*phi))++",i);
606  fstring+=Form("((ExBConC-M.ExBConC)*sin(%d*phi))++",i);
607  }
608  }}
609 
610  TString *strDelta = TStatToolkit::FitPlane(chainPlus,"deltaM:rms", fstring.Data(),cut+"(Entry$%7==0)", chi2,npoints,param,covar,-1,0, npointsMax, kTRUE);
611  chainPlus->SetAlias("delta",strDelta->Data());
612  TObjArray *fitArray = strDelta->Tokenize("++");
613  fitArray->Print();
614 
615  //
616  // Draw results
617  //
618  TH1::AddDirectory(0);
619  TLatex *lfit=new TLatex;
620 
621 
622  TCanvas * canvasdY= new TCanvas(Form("deltaY%d",highFrequency),Form("deltaY%d",highFrequency),1200,800);
623  TCanvas * canvasdSnp= new TCanvas(Form("deltaSnp%d",highFrequency),Form("deltaSnp%d",highFrequency),1200,800);
624  TCanvas * canvasd1pt= new TCanvas(Form("delta1pt%d",highFrequency),Form("delta1pt%d",highFrequency),1200,800);
625 
626  canvasdY->Divide(3,2);
627  chainPlus->SetMarkerStyle(25);
628  chainPlus->SetMarkerSize(0.5);
629  chainPlus->SetMarkerColor(1);
630  canvasdY->cd(1);
631  chainPlus->Draw("deltaM:delta",cut+"theta>0&&abs(snp)<0.2&&ptype==0","");
632  canvasdY->cd(2);
633  chainPlus->SetMarkerColor(1);
634  chainPlus->Draw("deltaM-delta>>deltaCorr(50,-0.4,0.4)",cut+"theta>0&&abs(snp)<0.2&&ptype==0","err");
635  chainPlus->SetMarkerColor(3);
636  chainPlus->Draw("deltaM",cut+"theta>0&&abs(snp)<0.2&&ptype==0","errsame");
637  canvasdY->cd(3);
638  chainPlus->SetMarkerColor(1);
639  chainPlus->Draw("deltaM:phi",cut+"theta>0&&abs(snp)<0.2&&ptype==0","");
640  chainPlus->SetMarkerColor(2);
641  chainPlus->Draw("deltaM-delta:phi",cut+"theta>0&&abs(snp)<0.2&&ptype==0","same");
642  canvasdY->cd(6);
643  chainPlus->SetMarkerStyle(26);
644  chainPlus->SetMarkerColor(1);
645  chainPlus->Draw("deltaM:phi",cut+"theta<0&&abs(snp)<0.2&&ptype==0","");
646  chainPlus->SetMarkerColor(4);
647  chainPlus->Draw("deltaM-delta:phi",cut+"theta<0&&abs(snp)<0.2&&ptype==0","same");
648 
649 
650 
651  canvasdSnp->Divide(3,2);
652  chainPlus->SetMarkerStyle(25);
653  chainPlus->SetMarkerSize(0.5);
654  chainPlus->SetMarkerColor(1);
655  canvasdSnp->cd(1);
656  chainPlus->Draw("1000*deltaM:1000*delta",cut+"theta>0&&abs(snp)<0.2&&ptype==2","");
657  canvasdSnp->cd(2);
658  chainPlus->SetMarkerColor(1);
659  chainPlus->Draw("1000*(deltaM-delta)>>deltaCorr(50,-4.,4)",cut+"theta>0&&abs(snp)<0.2&&ptype==2","err");
660  chainPlus->SetMarkerColor(3);
661  chainPlus->Draw("1000*deltaM",cut+"theta>0&&abs(snp)<0.2&&ptype==2","errsame");
662  canvasdSnp->cd(3);
663  chainPlus->SetMarkerColor(1);
664  chainPlus->Draw("1000*(deltaM):phi",cut+"theta>0&&abs(snp)<0.2&&ptype==2","");
665  chainPlus->SetMarkerColor(2);
666  chainPlus->Draw("1000*(deltaM-delta):phi",cut+"theta>0&&abs(snp)<0.2&&ptype==2","same");
667  canvasdSnp->cd(6);
668  chainPlus->SetMarkerStyle(26);
669  chainPlus->SetMarkerColor(1);
670  chainPlus->Draw("1000*(deltaM):phi",cut+"theta<0&&abs(snp)<0.2&&ptype==2","");
671  chainPlus->SetMarkerColor(4);
672  chainPlus->Draw("1000*(deltaM-delta):phi",cut+"theta<0&&abs(snp)<0.2&&ptype==2","same");
673 
674 
675 
676  canvasd1pt->Divide(3,2);
677  chainPlus->SetMarkerStyle(25);
678  chainPlus->SetMarkerSize(0.5);
679  chainPlus->SetMarkerColor(1);
680  canvasd1pt->cd(1);
681  chainPlus->Draw("deltaM:delta",cut+"theta>0&&abs(snp)<0.2&&ptype==4","");
682  canvasd1pt->cd(2);
683  chainPlus->SetMarkerColor(1);
684  chainPlus->Draw("deltaM-delta>>deltaCorr(50,-0.15,0.15)",cut+"theta>0&&abs(snp)<0.2&&ptype==4","err");
685  chainPlus->GetHistogram()->Fit("gaus");
686  chainPlus->SetMarkerColor(3);
687  chainPlus->Draw("deltaM",cut+"theta>0&&abs(snp)<0.2&&ptype==4","errsame");
688  canvasd1pt->cd(3);
689  chainPlus->SetMarkerColor(1);
690  chainPlus->Draw("deltaM:phi",cut+"theta>0&&abs(snp)<0.2&&ptype==4","");
691  chainPlus->SetMarkerColor(2);
692  chainPlus->Draw("deltaM-delta:phi",cut+"theta>0&&abs(snp)<0.2&&ptype==4","same");
693  canvasd1pt->cd(6);
694  chainPlus->SetMarkerStyle(26);
695  chainPlus->SetMarkerColor(1);
696  chainPlus->Draw("deltaM:phi",cut+"theta<0&&abs(snp)<0.2&&ptype==4","");
697  chainPlus->SetMarkerColor(4);
698  chainPlus->Draw("deltaM-delta:phi",cut+"theta<0&&abs(snp)<0.2&&ptype==4","same");
699 
700  {for (Int_t ipad=0; ipad<3;ipad++){
701  if (ipad==0) canvasdY->cd(5);
702  if (ipad==1) canvasdSnp->cd(5);
703  if (ipad==2) canvasd1pt->cd(5);
704  lfit->SetTextAlign(12); lfit->SetTextSize(0.04);
705  {for (Int_t i=1; i<fitArray->GetEntries(); i++){
706  lfit->DrawLatex(0.1,1-i/9.,fitArray->At(i)->GetName());
707  }}
708  if (ipad==0) canvasdY->cd(4);
709  if (ipad==1) canvasdSnp->cd(4);
710  if (ipad==2) canvasd1pt->cd(4);
711  lfit->DrawLatex(0.1,0.9,"Global fit - TPC ITS matching in r-#phi");
712  lfit->DrawLatex(0.1,0.8,"Residual minimization:");
713  lfit->DrawLatex(0.1,0.7,"r#phi_{0.5T}-r#phi_{-0.5T} (cm)");
714  lfit->DrawLatex(0.1,0.6,"sin(r#phi)_{0.5T}-sin(r#phi)_{-0.5T} (mrad)");
715  lfit->DrawLatex(0.1,0.5,"1/pt_{0.5T}-1/pt_{-0.5T} (1/GeV)");
716  }}
717 
718 
719  TFile *fpic = new TFile(Form("fitPictures%d.root",highFrequency),"update");
720  canvasd1pt->Write();
721  canvasdY->Write();
722  canvasdSnp->Write();
723  //
724  canvasd1pt->SaveAs(Form("fitd1pt%d.pdf",highFrequency));
725  canvasdY->SaveAs(Form("fitdy%d.pdf",highFrequency));
726  canvasdSnp->SaveAs(Form("fitdsnp%d.pdf",highFrequency));
727  delete fpic;
728 }
729 
730 void DrawDistortionMaps(const char *fname){
731  TFile f(fname);
732  TTree *ITSdy=(TTree*)f.Get("ITSdy");
733  TTree *ITSdsnp=(TTree*)f.Get("ITSdsnp");
734  TTree *ITSd1pt=(TTree*)f.Get("ITSd1pt");
735  TTree *TRDdy=(TTree*)f.Get("TRDdy");
736  TTree *TRDdsnp=(TTree*)f.Get("TRDdsnp");
737  TTree *TRDd1pt=(TTree*)f.Get("TRDd1pt");
738  TTree *Vertexdy=(TTree*)f.Get("Vertexdy");
739  TTree *Vertexdsnp=(TTree*)f.Get("Vertexdsnp");
740  TTree *Vertexd1pt=(TTree*)f.Get("Vertexd1pt");
741  TCanvas *cits = DrawDistortionMaps(ITSdy,ITSdsnp,ITSd1pt,"ITS","ITS");
742  cits->SaveAs("matchingITS.pdf");
743  TCanvas *ctrd = DrawDistortionMaps(TRDdy,TRDdsnp,TRDd1pt,"TRD","TRD");
744  ctrd->SaveAs("matchingTRD.pdf");
745  TCanvas *cvertex = DrawDistortionMaps(Vertexdy,Vertexdsnp,Vertexd1pt,"Vertex","Vertex");
746  cvertex->SaveAs("matchingVertex.pdf");
747  //
748  //
749  TPostScript *ps = new TPostScript("matching.ps", 112);
750  gStyle->SetOptTitle(1);
751  gStyle->SetOptStat(0);
752  ps->NewPage();
753  cits->Draw();
754  ps->NewPage();
755  ctrd->Draw();
756  ps->NewPage();
757  cvertex->Draw();
758  ps->Close();
759  delete ps;
760 }
761 
762 
763 TCanvas * DrawDistortionMaps(TTree * treedy, TTree * treedsnp, TTree* treed1pt, const char * name, const char *title){
765 
766  TH1::AddDirectory(0);
767  TCanvas *cdist = new TCanvas(name,name,1200,800);
768  cdist->Divide(3,2);
769  cdist->Draw("");
770  TH1 * his=0;
771 
772  cdist->cd(1);
773  treedy->Draw("10*mean","rms>0&&abs(snp)<0.25&&entries>100","");
774  his = (TH1*)treedy->GetHistogram()->Clone();
775  his->SetName("dY"); his->SetXTitle("#Delta_{r#phi} (cm)");
776  his->Draw();
777  //
778  cdist->cd(2);
779  treedsnp->Draw("1000*mean","rms>0&&abs(snp)<0.25&&entries>200","");
780  his = (TH1*)treedsnp->GetHistogram()->Clone();
781  his->SetName("dsnp"); his->SetXTitle("#Delta_{sin(#phi)}");
782  his->Draw();
783  //
784  cdist->cd(3);
785  treed1pt->Draw("mean","rms>0&&abs(snp)<0.15&&entries>400","");
786  his = (TH1*)treed1pt->GetHistogram()->Clone();
787  his->SetName("d1pt"); his->SetXTitle("#Delta_{1/pt} (1/GeV)");
788  his->Draw();
789  //
790  treedy->SetMarkerSize(1);
791  treedsnp->SetMarkerSize(1);
792  treed1pt->SetMarkerSize(1);
793  {for (Int_t type=0; type<3; type++){
794  cdist->cd(4+type);
795  TTree * tree =treedy;
796  if (type==1) tree=treedsnp;
797  if (type==2) tree=treed1pt;
798  Int_t counter=0;
799  for (Double_t theta=-1; theta<=1; theta+=0.2){
800  if (TMath::Abs(theta)<0.11) continue;
801  TCut cut=Form("rms>0&&abs(snp)<0.25&&entries>20&&abs(theta-%f)<0.1",theta);
802  tree->SetMarkerStyle(20+counter);
803  Option_t *option=(counter==0)? "": "same";
804  if (theta>0) tree->SetMarkerColor(2);
805  if (theta<0) tree->SetMarkerColor(4);
806  if (type==0) tree->Draw("10*mean:phi>>his(45,-pi,pi)",cut,"profgoff");
807  if (type==1) tree->Draw("1000*mean:phi>>his(45,-pi,pi)",cut,"profgoff");
808  if (type==2) tree->Draw("mean:phi>>his(45,-pi,pi)",cut,"profgoff");
809  his = (TH1*)tree->GetHistogram()->Clone();
810  his->SetName(Form("%d_%d",counter,type));
811  his->SetXTitle("#phi");
812  his->SetMaximum(4);
813  his->SetMinimum(-4);
814  if (type==2){
815  his->SetMaximum(0.06);
816  his->SetMinimum(-0.06);
817  }
818  his->Draw(option);
819  counter++;
820  }
821  }
822  }
823  // cdist->SaveAs(Form("%s.pdf"),name);
824  return cdist;
825 }
826 
827 
828 
829 
830 
832 
834 
835  Double_t bzField=AliTrackerBase::GetBz();
836  AliMagF* magF= (AliMagF*)(TGeoGlobalMagField::Instance()->GetField());
837  Double_t vdrift = 2.6; // [cm/us] // to be updated: per second (ideally)
838  Double_t ezField = 400; // [V/cm] // to be updated: never (hopefully)
839  Double_t wt = -10.0 * (bzField*10) * vdrift / ezField ;
840  Double_t T1 = 1.0;
841  Double_t T2 = 1.0;
842  //
843  //
844 
845 
846  AliTPCExBTwist *twistX1= new AliTPCExBTwist;
847  twistX1->SetXTwist(0.001); // 1 mrad twist in x
848  twistX1->SetName("tX1");
849  //
850  AliTPCExBTwist *twistY1= new AliTPCExBTwist;
851  twistY1->SetYTwist(0.001); // 1 mrad twist in Y
852  twistY1->SetName("tY1");
853  //
854  AliTPCGGVoltError* ggErrorA = new AliTPCGGVoltError;
855  ggErrorA->SetDeltaVGGA(40.); // delta GG - 1 mm
856  ggErrorA->SetName("ggA");
857  //
858  AliTPCGGVoltError* ggErrorC = new AliTPCGGVoltError;
859  ggErrorC->SetDeltaVGGC(40.); // delta GG - 1 mm
860  ggErrorC->SetName("ggC");
861  // conical free param
862  //
864  shiftX->SetXShift(0.1);
865  shiftX->SetName("shiftX");
867  shiftY->SetYShift(0.1);
868  shiftY->SetName("shiftY");
869 
870  AliTPCExBBShape *exb11 = new AliTPCExBBShape;
871  exb11->SetBField(magF);
872  exb11->SetName("exb11");
873  AliTPCExBBShape *exbT1 = new AliTPCExBBShape;
874  exbT1->SetBField(magF);
875  exbT1->SetName("exbT1");
876  AliTPCExBBShape *exbT2 = new AliTPCExBBShape;
877  exbT2->SetBField(magF);
878  exbT2->SetName("exbT2");
879 
880  TObjArray * corr = new TObjArray;
881  corr->AddLast(twistX1);
882  corr->AddLast(twistY1);
883  corr->AddLast(ggErrorA);
884  corr->AddLast(ggErrorC);
885  corr->AddLast(shiftX);
886  corr->AddLast(shiftY);
887  corr->AddLast(exb11);
888  corr->AddLast(exbT1);
889  corr->AddLast(exbT2);
890  //
892  cc->SetCorrections((TObjArray*)(corr));
894  cc->SetOmegaTauT1T2(wt,T1,T2);
895  exbT1->SetOmegaTauT1T2(wt,T1+0.1,T2);
896  exbT2->SetOmegaTauT1T2(wt,T1,T2+0.1);
897  cc->Init();
898  // cc->SetMode(1);
899  cc->Print("DA"); // Print used correction classes
900  cc->SetName("Comp");
901  return cc;
902 }
903 
904 
905 
908 
909  TMatrixD polA(18,4);
910  TMatrixD polC(18,4);
911  TMatrixD valA(18,1);
912  TMatrixD valC(18,1);
913  Int_t counter=0;
914  { for (Int_t iside=0; iside<=1; iside++){
915  {for (Int_t ir=0; ir<3; ir++)
916  for (Int_t id=0; id<3; id++) {
917  polA(counter,0)=0;
918  polA(counter,1)=ir;
919  polA(counter,2)=id;
920  polC(counter,0)=0;
921  polC(counter,1)=ir;
922  polC(counter,2)=id;
923  valA(counter,0)=0;
924  valC(counter,0)=0;
925  counter++;
926  }
927  }
928  }
929  }
930  counter=0;
931  TObjArray * array = (TObjArray*) comp->GetCorrections();
932  { for (Int_t iside=0; iside<=1; iside++)
933  for (Int_t ir=0; ir<3; ir++)
934  for (Int_t id=0; id<3; id++) {
936  valA*=0;
937  valC*=0;
938  eff->SetName(Form("eff%d_%d_%d",iside,ir,id));
939  if (iside==0) valA(counter,0)=0.1;
940  if (iside==1) valC(counter,0)=0.1;
941  eff->SetPolynoms(&polA,&polC);
942  eff->SetCoeficients(&valA,&valC);
943  valA.Print();
944  valC.Print();
945  array->AddLast(eff);
946  counter++;
947  }
948  }
949 }
950 
951 
952 
955 
957  TObjArray * corr = (TObjArray*)(cc->GetCorrections());
958  // corr->AddLast(cc);
959  TFile f("laserMean.root");
960  TTree* tree =(TTree*)f.Get("Mean");
962 
963 }
void MakeGlobalFitRelative(Int_t highFrequency=0)
Definition: MakeLookup.C:560
printf("Chi2/npoints = %f\n", TMath::Sqrt(chi2/npoints))
TOOLKIT for chain manipulation:
void MakeFits(Int_t run)
Definition: MakeLookup.C:156
void SetPolynoms(const TMatrixD *polA, const TMatrixD *polC)
TStyle * gStyle
#define TObjArray
void AddEffectiveCorrection(AliTPCComposedCorrection *comp)
Definition: MakeLookup.C:906
TCut cutS
AliTPCGGVoltError class.
AliTPCComposedCorrection * MakeComposedCorrection()
Definition: MakeLookup.C:831
TFile f("CalibObjects.root")
void SetOmegaTauT1T2(Float_t omegaTau, Float_t t1, Float_t t2)
TChain * chain0
Definition: ocdbScan.C:3
TCut cutUser
static TChain * MakeChain(const char *fileIn, const char *treeName, const char *fName=0, Int_t maxFiles=-1, Int_t startFile=0, Int_t checkLevel=0)
TObjArray * picArray
Definition: CalibCosmic.C:63
Correct for the rest of ExB effect which are not covered by physical models.
TTreeSRedirector * pcstream
void SetDeltaVGGC(Double_t deltaVGGC)
virtual void SetOmegaTauT1T2(Float_t omegaTau, Float_t t1, Float_t t2)
TTree * tree
npoints
Definition: driftITSTPC.C:85
AliTPCExBTwist class.
TObjArray * array
Definition: AnalyzeLaser.C:12
void SetYTwist(Float_t yTwist)
void DrawDistortionMaps(const char *fname="mean.root")
Definition: MakeLookup.C:730
Double_t chi2
Definition: AnalyzeLaser.C:7
AliTPCComposedCorrection class.
char * prefix
void SetXTwist(Float_t xTwist)
void SetCorrections(const TCollection *corrections)
static void MakeTrackDistortionTree(TTree *tinput, Int_t dtype, Int_t ptype, const TObjArray *corrArray, Int_t step=1, Int_t offset=0, Bool_t debug=0)
AliTPCExBBShape class.
AliComparisonDraw comp
Definition: TestAnalisys.C:74
AliTPCcalibTime * calibTime
Definition: CalibTime.C:20
static void MakeLaserDistortionTree(TTree *tree, TObjArray *corrArray, Int_t itype)
TStatToolkit toolkit
Definition: gainCalib.C:18
TString * FitPlane(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, Bool_t fix0=kFALSE)
void MakeLaserTree()
Definition: MakeLookup.C:953
Double_t theta
Definition: AliFMDv1.cxx:78
TCollection * GetCorrections() const
Double_t chi2A[6]
void MakeLookup(Int_t run, Int_t mode)
Definition: MakeLookup.C:92
TChain * chain
Definition: MakeLookup.C:79
void SetBField(const AliMagF *bField)
void SetDeltaVGGA(Double_t deltaVGGA)
Summary of statistics functions Subset of matheamtical functions not included in the TMath...
Double_t vdrift
Definition: DriftKalman.C:98
static void MakeDistortionMap(THnSparse *his0, TTreeSRedirector *pcstream, const char *hname, Int_t run, Float_t refX, Int_t type, Int_t integ=1)
void FitLookup(TChain *chainIn, const char *prefix, TVectorD &vecA, TVectorD &vecC, TVectorD &vecStatA, TVectorD &vecStatD, TCut cut, TObjArray *picArray)
Definition: MakeLookup.C:224
class TVectorT< Double_t > TVectorD
TCut cut
Definition: MakeGlobalFit.C:75
void MakeGlobalFit()
Definition: MakeLookup.C:523
void DrawDistortionDy(TCut cutUser="", Double_t ymin=-0.6, Double_t ymax=0.6)
Definition: MakeLookup.C:311
void SetCoeficients(const TMatrixD *valA, const TMatrixD *valC)
char * fname
void MakeFitTree()
Definition: MakeLookup.C:456
virtual void Print(Option_t *option="") const
class TMatrixT< Double_t > TMatrixD
return kTRUE
Definition: AliFMDv1.cxx:97