]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/Upgrade/macros/epsilonScanFineBinningForPerformanceNote.C
d7718a80d4a19ab4c18814e4a04a5f764a4f17eb
[u/mrichter/AliRoot.git] / TPC / Upgrade / macros / epsilonScanFineBinningForPerformanceNote.C
1
2
3 void epsilonScanFineBinningForPerformanceNote(Int_t radiusScale=1, Int_t epsScale=1,Int_t iOmegaTau = 0, Double_t x = 85., Double_t y = 0., Double_t z = 10.,Double_t integrateStep = 0.,Bool_t bLowE = kFALSE){
4   //
5   // do for one gas (with omegaTau values accordingly) the correction
6   // use the integrate along drift line option if integrateStep > 0
7   // else old method
8   //
9   // 1. Initialzation form space charge maps
10   //
11   AliTPCSpaceCharge3D *spaceCharge = new AliTPCSpaceCharge3D;
12
13   // omega tau parameters and TF1 
14   const Int_t nOmegaTau = 1;
15   Double_t omegaTau[nOmegaTau] = {0.32};
16   TString tGas[nOmegaTau] = {"NeCO2_2"}; 
17   TString tGasOut[nOmegaTau] = {"NeCO2_2"}; 
18   TString sGas[nOmegaTau] = {"Ne-CO_{2}-N_{2} (90-10-5)"};
19   TString sLowE = "";
20   //if(bLowE) sLowE = "_lowE";
21   if(bLowE) sLowE = "_lowE2"; //second iteration
22
23   const Int_t nEps = 51;
24   Double_t epsilon[nEps];
25   for(Int_t iEps = 0; iEps < nEps; iEps++){
26     epsilon[iEps] = (Double_t)iEps;
27   }
28   TH1F *hR    = new TH1F("hR",Form("distortion at x = %.0f, y = %.0f, z = %.0f",x,y,z),nEps,epsilon[0],epsilon[nEps-1]+1);
29   TH1F *hPhiR = new TH1F("hPhiR",Form("distortion at x = %.0f, y = %.0f, z = %.0f",x,y,z),nEps,epsilon[0],epsilon[nEps-1]+1);
30
31   //use always the integrate option here
32   Double_t rate = 50.;
33
34   for(Int_t iEps = 0; iEps < nEps; iEps++){
35
36     // select gas 
37     // 0 = NeCO2N2 
38     cout<<"Open file = "<<Form("/Users/physics/ALICE/TPCupgrade/SpaceCharge/Maps/SC_%s_eps%.0f_50kHz_radiusScaling%d_epsScaling%d/SpaceChargeMap.root",tGas[iOmegaTau].Data(),epsilon[iEps],radiusScale,epsScale)<<endl;
39     spaceCharge->SetSCDataFileName(Form("/Users/physics/ALICE/TPCupgrade/SpaceCharge/Maps/SC_%s_eps%.0f_50kHz_radiusScaling%d_epsScaling%d/SpaceChargeMap.root",tGas[iOmegaTau].Data(),epsilon[iEps],radiusScale,epsScale));
40     
41     // select omegaTau value
42     if(iOmegaTau ==  0){
43       spaceCharge->SetOmegaTauT1T2(omegaTau[iOmegaTau],1,0.99); // Ne CO2 N2
44     }
45  
46     //
47     // init and add to corrections
48     spaceCharge->InitSpaceCharge3DDistortion();
49     spaceCharge->AddVisualCorrection(spaceCharge,1);
50     
51     //
52     // 2. get TH1F with differences 
53     //
54     // get corrections (at x, y and z) for visual correction 1 (last argument)
55     // 0 = dR
56     // 1 = dPhiR
57     // 2 = dZ?    
58     if(integrateStep < 0.0001){// == 0. --> old method
59       hR->Fill(epsilon[iEps],AliTPCCorrection::GetDistXYZ(x,y,z,0,1));
60       hPhiR->Fill(epsilon[iEps],AliTPCCorrection::GetDistXYZ(x,y,z,1,1));
61     }
62     else{// > 0. --> following driftlines
63       hR->Fill(epsilon[iEps],AliTPCCorrection::GetDistXYZIntegrateZ(x,y,z,0,1,integrateStep));
64       hPhiR->Fill(epsilon[iEps],AliTPCCorrection::GetDistXYZIntegrateZ(x,y,z,1,1,integrateStep));
65     }
66   }
67
68
69   //
70   // 3. Plot and store TH1Fs
71   //
72
73   TCanvas *cEpsilon = new TCanvas("cEpsilon","cEpsilon",1200,500);
74   cEpsilon->Divide(2,1);
75
76   TLegend *legend = new TLegend(0.6,0.3,0.85,0.75,"","brNDC");
77   setupLegend(legend,0.04);
78
79   TString outfilename = Form("epsilonScanFineBinning_performanceNote_radiusScaling%d_epsScaling%d_%s%s_x%0.f_y%.0f_z%.0f_int%.0f.root",radiusScale,epsScale,tGasOut[iOmegaTau].Data(),sLowE.Data(),x,y,z,integrateStep);
80   TFile *fOut = TFile::Open(Form("%s",outfilename.Data()),"recreate");
81  
82   cEpsilon->cd(1);
83   hR->Draw();
84
85   cEpsilon->cd(2);
86   hPhiR->Draw();
87
88
89   cEpsilon->SaveAs(Form("epsilonScanFineBinning_performanceNote_radiusScaling%d_epsScaling%d_%s%s_x%0.f_y%.0f_z%.0f_int%.0f.eps",radiusScale,epsScale,tGasOut[iOmegaTau].Data(),sLowE.Data(),x,y,z,integrateStep));
90   
91   hR->Write();
92   hPhiR->Write();
93   fOut->Close();
94 }
95
96 void epsilonScanFineBinningPlotOnly(Int_t radiusScale=1, Int_t epsScale=1,Int_t iOmegaTau = 0, Double_t x = 85., Double_t y = 0., Double_t z = 10.){
97   //
98   // do for one gas (with omegaTau values accordingly) the correction
99   // use the integrate along drift line option
100
101   gStyle->SetOptStat(0);
102
103   //
104   // 1. Plot and store TH1Fs
105   //
106
107   // omega tau parameters and TF1 
108   const Int_t nOmegaTau = 1;
109   Double_t omegaTau[nOmegaTau] = {0.32};
110   TString tGas[nOmegaTau] = {"NeCO2_2"}; 
111   TString sGas[nOmegaTau] = {"Ne/CO_{2}/N_{2} (90-10-5)"};
112
113  
114   TCanvas *cEpsilon = new TCanvas("cEpsilon","cEpsilon",1200,500);
115   cEpsilon->Divide(2,1);
116
117   TLegend *legend = new TLegend(0.15,0.6,0.6,0.85,Form("%s: 50 kHz",sGas[iOmegaTau].Data(),"brNDC"));
118   setupLegend(legend,0.05);
119
120   TString infilename0 = Form("epsilonScanFineBinning_performanceNote_radiusScaling%d_epsScaling%d_%s_x%0.f_y%.0f_z%.0f_int0.root",radiusScale,epsScale,tGas[iOmegaTau].Data(),x,y,z);
121   TString infilename1 = Form("epsilonScanFineBinning_performanceNote_radiusScaling%d_epsScaling%d_%s_x%0.f_y%.0f_z%.0f_int1.root",radiusScale,epsScale,tGas[iOmegaTau].Data(),x,y,z);
122   TFile *fIn0 = TFile::Open(Form("%s",infilename0.Data()),"read");
123   TFile *fIn1 = TFile::Open(Form("%s",infilename1.Data()),"read");
124
125   TH1F *hR0    = (TH1F*)fIn0->Get("hR");
126   TH1F *hPhiR0 = (TH1F*)fIn0->Get("hPhiR");
127  
128   TH1F *hR1    = (TH1F*)fIn1->Get("hR");
129   TH1F *hPhiR1 = (TH1F*)fIn1->Get("hPhiR");
130
131   hR0->SetTitle(Form("x = %.0f, y = %.0f, z = %.0f",x,y,z)); 
132   hPhiR0->SetTitle(Form("x = %.0f, y = %.0f, z = %.0f",x,y,z)); 
133
134   hR1->SetTitle(Form("x = %.0f, y = %.0f, z = %.0f",x,y,z)); 
135   hPhiR1->SetTitle(Form("x = %.0f, y = %.0f, z = %.0f",x,y,z)); 
136
137   cEpsilon->cd(1);
138   hR0->GetXaxis()->SetTitle("#varepsilon");
139   hR0->GetYaxis()->SetTitle("dr (cm)");
140   hR0->SetLineWidth(2);
141   hR0->DrawCopy("lp");
142   hR1->SetLineWidth(2);
143   hR1->SetLineColor(2);
144   hR1->DrawCopy("lp,same");
145
146   legend->AddEntry(hR0,"linear","l");
147   legend->AddEntry(hR1,"integrated in z","l");
148
149   legend->Draw();
150
151   cEpsilon->cd(2);
152   hPhiR0->GetXaxis()->SetTitle("#varepsilon");
153   hPhiR0->GetYaxis()->SetTitle("d(r#varphi) (cm)");
154   hPhiR0->SetLineWidth(2);
155   hPhiR0->DrawCopy("lp");
156   hPhiR1->SetLineWidth(2);
157   hPhiR1->SetLineColor(2);
158   hPhiR1->DrawCopy("lp,same");
159
160
161   cEpsilon->SaveAs(Form("epsilonScanFineBinning_performanceNote_radiusScaling%d_epsScaling%d_%s_x%0.f_y%.0f_z%.0f.eps",radiusScale,epsScale,tGas[iOmegaTau].Data(),x,y,z));
162   cEpsilon->SaveAs(Form("epsilonScanFineBinning_performanceNote_radiusScaling%d_epsScaling%d_%s_x%0.f_y%.0f_z%.0f.pdf",radiusScale,epsScale,tGas[iOmegaTau].Data(),x,y,z));
163   cEpsilon->SaveAs(Form("epsilonScanFineBinning_performanceNote_radiusScaling%d_epsScaling%d_%s_x%0.f_y%.0f_z%.0f.png",radiusScale,epsScale,tGas[iOmegaTau].Data(),x,y,z));
164   
165   fIn0->Close();
166   fIn1->Close();
167 }
168
169
170
171
172   
173 //____________________________________________________________//
174 void setupLegend(TLegend *currentLegend=0,float currentTextSize=0.07){
175   currentLegend->SetTextFont(42);
176   currentLegend->SetBorderSize(0);
177   currentLegend->SetFillStyle(0);
178   currentLegend->SetFillColor(0);
179   currentLegend->SetMargin(0.25);
180   currentLegend->SetTextSize(currentTextSize);
181   currentLegend->SetEntrySeparation(0.5);
182   return;
183 }