]>
Commit | Line | Data |
---|---|---|
03db7927 | 1 | #if !defined(__CINT__) || defined(__MAKECINT__) |
2 | #include <TFile.h> | |
3 | #include <TH1F.h> | |
4 | #include <TH2I.h> | |
5 | #include <TGraph.h> | |
6 | #include <TExec.h> | |
7 | #include <TStyle.h> | |
8 | #include <TString.h> | |
9 | #include <TSystem.h> | |
10 | #include <TGrid.h> | |
11 | #include <TLatex.h> | |
12 | #include <TCanvas.h> | |
13 | #include <TObjArray.h> | |
374200ee | 14 | #include <TPaveStats.h> |
03db7927 | 15 | #include "AliCDBEntry.h" |
16 | #include "AliITSresponseSDD.h" | |
17 | #endif | |
18 | ||
e8eba358 | 19 | /* $Id: ShowResponseSDD.C 44072 2010-10-04 15:48:32Z prino $ */ |
03db7927 | 20 | |
21 | // Macro to plot the calibration parameters | |
22 | // (time zero, ADCtokeV and Vdrift correction) | |
23 | // from the OCDB file created from SDD offline calibration | |
24 | // (OCDB/ITS/Calib/RespSDD) | |
25 | ||
26 | void ShowResponseSDD(TString filename="$ALICE_ROOT/OCDB/ITS/Calib/RespSDD/Run0_999999999_v0_s0.root"){ | |
27 | if(filename.Contains("alien")){ | |
28 | TGrid::Connect("alien:"); | |
29 | } | |
30 | TFile* fr=TFile::Open(filename.Data()); | |
31 | AliCDBEntry* e=(AliCDBEntry*)fr->Get("AliCDBEntry"); | |
32 | AliITSresponseSDD* r=(AliITSresponseSDD*)e->GetObject(); | |
33 | TH1F* hTimeZero=new TH1F("hTimeZero","",260,239.5,499.5); | |
34 | TH1F* hVdriftCorrLeft=new TH1F("hVdriftCorrLeft","",260,239.5,499.5); | |
35 | TH1F* hVdriftCorrRight=new TH1F("hVdriftCorrRight","",260,239.5,499.5); | |
4d8feb56 | 36 | TH1F* hdistVdriftCorrLeft=new TH1F("hdistVdriftCorrLeft","",100,-0.2,0.2); |
37 | TH1F* hdistVdriftCorrRight=new TH1F("hdistVdriftCorrRight","",100,-0.2,0.2); | |
03db7927 | 38 | TH1F* hADCtokeV=new TH1F("hADCtokeV","",260,239.5,499.5); |
374200ee | 39 | TH1F* hADCvsTime=new TH1F("hADCvsTime","",260,239.5,499.5); |
03db7927 | 40 | Float_t averTz=0.; |
41 | Float_t averCv0=0.; | |
42 | Float_t averCv1=0.; | |
43 | Float_t averAk=0.; | |
374200ee | 44 | Float_t averAt=0.; |
03db7927 | 45 | for(Int_t iMod=240; iMod<500; iMod++){ |
46 | Float_t tz=r->GetTimeZero(iMod); | |
47 | Float_t cv0=r->GetDeltaVDrift(iMod,kFALSE); | |
48 | Float_t cv1=r->GetDeltaVDrift(iMod,kTRUE); | |
49 | Float_t ak=r->GetADCtokeV(iMod); | |
374200ee | 50 | Float_t at=r->GetADCvsDriftTime(iMod); |
4d8feb56 | 51 | hTimeZero->SetBinContent(iMod-240+1,tz); |
03db7927 | 52 | hVdriftCorrLeft->SetBinContent(iMod-240+1,cv0); |
53 | hVdriftCorrRight->SetBinContent(iMod-240+1,cv1); | |
4d8feb56 | 54 | hdistVdriftCorrLeft->Fill(cv0); |
55 | hdistVdriftCorrRight->Fill(cv1); | |
03db7927 | 56 | hADCtokeV->SetBinContent(iMod-240+1,ak); |
374200ee | 57 | hADCvsTime->SetBinContent(iMod-240+1,at); |
03db7927 | 58 | averTz+=tz; |
59 | averCv0+=cv0; | |
60 | averCv1+=cv1; | |
61 | averAk+=ak; | |
374200ee | 62 | averAt+=at; |
03db7927 | 63 | } |
64 | averTz/=260.; | |
65 | averCv0/=260.; | |
66 | averCv1/=260.; | |
67 | averAk/=260.; | |
374200ee | 68 | averAt/=260.; |
03db7927 | 69 | |
70 | hTimeZero->SetMarkerStyle(20); | |
71 | hADCtokeV->SetMarkerStyle(20); | |
374200ee | 72 | hADCvsTime->SetMarkerStyle(20); |
03db7927 | 73 | hVdriftCorrLeft->SetMarkerStyle(22); |
74 | hVdriftCorrLeft->SetMarkerColor(2); | |
75 | hVdriftCorrRight->SetMarkerStyle(24); | |
76 | hVdriftCorrRight->SetMarkerColor(4); | |
77 | hTimeZero->SetMaximum(hTimeZero->GetMaximum()*1.2); | |
78 | hADCtokeV->SetMaximum(hADCtokeV->GetMaximum()*1.2); | |
374200ee | 79 | hADCvsTime->SetMaximum(hADCvsTime->GetMaximum()*1.2); |
03db7927 | 80 | Float_t maxV=TMath::Max(hVdriftCorrLeft->GetMaximum(),hVdriftCorrRight->GetMaximum()); |
81 | Float_t minV=TMath::Min(hVdriftCorrLeft->GetMinimum(),hVdriftCorrRight->GetMinimum()); | |
82 | Float_t scale=TMath::Max(TMath::Abs(maxV),TMath::Abs(minV)); | |
83 | if(scale<0.02){ | |
84 | hVdriftCorrLeft->SetMinimum(-0.05); | |
85 | hVdriftCorrLeft->SetMaximum(0.05); | |
86 | }else{ | |
87 | hVdriftCorrLeft->SetMaximum(1.2*scale); | |
88 | hVdriftCorrLeft->SetMinimum(-1.2*scale); | |
89 | } | |
90 | ||
4d8feb56 | 91 | // gStyle->SetOptStat(0); |
03db7927 | 92 | |
93 | printf("Charge vs. Time correction factor = %f\n",r->GetChargevsTime()); | |
94 | ||
95 | TCanvas* c1=new TCanvas("c1","Time Zero"); | |
374200ee | 96 | hTimeZero->SetStats(0); |
03db7927 | 97 | hTimeZero->Draw("P"); |
98 | hTimeZero->GetXaxis()->SetTitle("Module Id"); | |
99 | hTimeZero->GetYaxis()->SetTitle("Time Zero (ns)"); | |
100 | TLatex* tt=new TLatex(0.2,0.8,Form("Average Tzero = %.2f",averTz)); | |
101 | tt->SetNDC(); | |
102 | tt->Draw(); | |
103 | c1->Modified(); | |
104 | ||
374200ee | 105 | TCanvas* c2=new TCanvas("c2","Vdrift Corr",800,900); |
106 | c2->Divide(1,2); | |
107 | c2->cd(1); | |
108 | hVdriftCorrLeft->SetStats(0); | |
03db7927 | 109 | hVdriftCorrLeft->Draw("P"); |
110 | hVdriftCorrRight->Draw("PSAME"); | |
111 | hVdriftCorrLeft->GetXaxis()->SetTitle("Module Id"); | |
112 | hVdriftCorrLeft->GetYaxis()->SetTitle("Vdrift correction (#mum/ns)"); | |
113 | TLatex* tc0=new TLatex(0.2,0.8,Form("Average Vdrift corr Left = %.3f",averCv0)); | |
114 | tc0->SetNDC(); | |
115 | tc0->SetTextColor(2); | |
116 | tc0->Draw(); | |
117 | TLatex* tc1=new TLatex(0.2,0.72,Form("Average Vdrift corr Right = %.3f",averCv1)); | |
118 | tc1->SetNDC(); | |
119 | tc1->SetTextColor(4); | |
120 | tc1->Draw(); | |
374200ee | 121 | c2->cd(2); |
122 | hdistVdriftCorrLeft->SetLineColor(2); | |
123 | hdistVdriftCorrLeft->GetXaxis()->SetTitle("Vdrift correction (#mum/ns)"); | |
4d8feb56 | 124 | hdistVdriftCorrLeft->Draw(); |
374200ee | 125 | c2->Update(); |
126 | TPaveStats *stL=(TPaveStats*)hdistVdriftCorrLeft->GetListOfFunctions()->FindObject("stats"); | |
127 | stL->SetY1NDC(0.71); | |
128 | stL->SetY2NDC(0.9); | |
129 | stL->SetTextColor(2); | |
130 | hdistVdriftCorrRight->SetLineColor(4); | |
4d8feb56 | 131 | hdistVdriftCorrRight->Draw("SAMES"); |
374200ee | 132 | c2->Update(); |
133 | TPaveStats *stR=(TPaveStats*)hdistVdriftCorrRight->GetListOfFunctions()->FindObject("stats"); | |
134 | stR->SetY1NDC(0.51); | |
135 | stR->SetY2NDC(0.7); | |
136 | stR->SetTextColor(4); | |
4d8feb56 | 137 | |
374200ee | 138 | TCanvas* c3=new TCanvas("c3","ADC calib",800,900); |
139 | c3->Divide(1,2); | |
140 | c3->cd(1); | |
141 | hADCvsTime->SetStats(0); | |
142 | hADCvsTime->Draw("P"); | |
143 | hADCvsTime->GetXaxis()->SetTitle("Module Id"); | |
144 | hADCvsTime->GetYaxis()->SetTitle("ADC vs. Drift Time Slope (ADC/ns)"); | |
145 | TLatex* ts=new TLatex(0.2,0.8,Form("Average ADCvsTime = %.3f",averAt)); | |
146 | ts->SetNDC(); | |
147 | ts->Draw(); | |
148 | c3->cd(2); | |
149 | hADCtokeV->SetStats(0); | |
03db7927 | 150 | hADCtokeV->Draw("P"); |
151 | hADCtokeV->GetXaxis()->SetTitle("Module Id"); | |
152 | hADCtokeV->GetYaxis()->SetTitle("ADC to keV conv. factor"); | |
153 | TLatex* ta=new TLatex(0.2,0.8,Form("Average ADCtokeV = %.3f",averAk)); | |
154 | ta->SetNDC(); | |
155 | ta->Draw(); | |
03db7927 | 156 | |
157 | } |