1 //____________________________________________________________________
3 // $Id: DrawSDigits.C 20907 2007-09-25 08:44:03Z cholm $
5 // Script that contains a class to draw eloss from hits, versus ADC
6 // counts from digits, using the AliFMDInputHits class in the util library.
8 // It draws the energy loss versus the p/(mq^2). It can be overlayed
9 // with the Bethe-Bloc curve to show how the simulation behaves
10 // relative to the expected.
12 // Use the script `Compile.C' to compile this class using ACLic.
16 #include <TProfile2D.h>
19 #include <AliFMDSDigit.h>
20 #include <AliFMDInput.h>
21 #include <AliFMDEdepMap.h>
22 #include <AliFMDGeometry.h>
29 /** @class DrawSDigits
30 @brief Draw hit energy loss versus digit ADC
33 Root> Compile("DrawSDigits.C")
39 class DrawSDigits : public AliFMDInput
42 TH1D* fAdc; // Histogram
43 TProfile2D* fPrimRatio[5]; // Histograms
45 void Idx2Det(UShort_t idx, UShort_t& d, Char_t& r) const
50 case 0: d = 1; r = 'I'; break;
51 case 1: d = 2; r = 'I'; break;
52 case 2: d = 2; r = 'O'; break;
53 case 3: d = 3; r = 'I'; break;
54 case 4: d = 3; r = 'O'; break;
57 Short_t Det2Idx(UShort_t d, Char_t r) const
61 case 1: idx = 0; break;
62 case 2: idx = 1; break;
63 case 3: idx = 3; break;
65 return (idx + ((r == 'O' || r == 'o') ? 1 : 0));
69 //__________________________________________________________________
70 DrawSDigits(Int_t m=1100, Double_t amin=-0.5, Double_t amax=1023.5)
71 : AliFMDInput("galice.root")
75 fAdc = new TH1D("adc", "ADC", m, amin, amax);
76 fAdc->SetXTitle("ADC value");
85 for (UShort_t i = 0; i < 5; i++) {
89 fPrimRatio[i] = new TProfile2D(Form("primRatio_fmd%d%c", d, r),
90 Form("Primary/Total - FMD%d%c", d, r),
91 eN, eMin, eMax, pN, pMin, pMax);
92 fPrimRatio[i]->SetXTitle("#eta");
93 fPrimRatio[i]->SetYTitle("#varphi");
94 fPrimRatio[i]->SetZTitle("M_{ch,primary}/M_{ch,total}");
95 fPrimRatio[i]->GetXaxis()->SetTitleFont(132);
96 fPrimRatio[i]->GetYaxis()->SetTitleFont(132);
97 fPrimRatio[i]->GetZaxis()->SetTitleFont(132);
98 fPrimRatio[i]->GetXaxis()->SetLabelFont(132);
99 fPrimRatio[i]->GetYaxis()->SetLabelFont(132);
100 fPrimRatio[i]->GetZaxis()->SetLabelFont(132);
101 fPrimRatio[i]->GetXaxis()->SetTitleSize(.06);
102 fPrimRatio[i]->GetYaxis()->SetTitleSize(.06);
103 fPrimRatio[i]->GetZaxis()->SetTitleSize(.06);
104 fPrimRatio[i]->GetXaxis()->SetLabelSize(.06);
105 fPrimRatio[i]->GetYaxis()->SetLabelSize(.06);
106 fPrimRatio[i]->GetZaxis()->SetLabelSize(.06);
107 fPrimRatio[i]->GetXaxis()->SetNdivisions(10);
108 fPrimRatio[i]->GetYaxis()->SetNdivisions(10);
109 fPrimRatio[i]->GetZaxis()->SetNdivisions(10);
114 Bool_t ret = AliFMDInput::Init();
115 AliFMDGeometry::Instance()->Init();
116 AliFMDGeometry::Instance()->InitTransformations();
120 //__________________________________________________________________
121 Bool_t ProcessSDigit(AliFMDSDigit* digit)
123 if (!digit) return kTRUE;
124 fAdc->Fill(digit->Counts());
126 if (digit->NParticles() == 0) return kTRUE;
129 Short_t primIdx = Det2Idx(digit->Detector(), digit->Ring());
130 if (primIdx < 0) return kTRUE;
132 AliFMDGeometry* geom = AliFMDGeometry::Instance();
134 geom->Detector2XYZ(digit->Detector(),
139 // We should get the primary vertex and do
140 // z += fCurrentVertex;
141 Double_t phi = TMath::ATan2(y, x) * 180. / TMath::Pi();
142 Double_t r = TMath::Sqrt(y * y + x * x);
143 Double_t theta = TMath::ATan2(r, z);
144 Double_t eta = -TMath::Log(TMath::Tan(theta / 2));
145 Double_t ratio = digit->NPrimaries() / digit->NParticles();
146 if (phi < 0) phi += 360;
147 fPrimRatio[primIdx]->Fill(eta, phi, ratio);
150 //__________________________________________________________________
153 gStyle->SetPalette(1);
154 gStyle->SetOptTitle(0);
155 gStyle->SetCanvasColor(0);
156 gStyle->SetCanvasBorderSize(0);
157 gStyle->SetPadColor(0);
158 gStyle->SetPadBorderSize(0);
160 TCanvas* c1 = new TCanvas("fmdSdigitSpectra", "FMD SDigit spectra");
161 fAdc->SetStats(kFALSE);
162 if (fAdc->GetEntries() != 0)
163 fAdc->Scale(1. / fAdc->GetEntries());
169 TCanvas* c2 = new TCanvas("fmdSdigitPrims", "FMD SDigit # prim/# ntotal",
172 c2->SetRightMargin(0);
173 c2->Divide(2, 3, 0, 0);
174 for (UShort_t i = 0; i < 5; i++) {
175 Int_t np = i+1+(i == 0 ? 0 : 1);
176 TVirtualPad* p = c2->cd(np);
178 p->SetTopMargin((np <= 2) ? 0.05 : 0);
179 p->SetLeftMargin((np % 2 == 1) ? 0.20 : 0);
180 p->SetRightMargin((np % 2 == 1) ? 0 : 0.20);
181 p->SetBottomMargin((np >= 5) ? 0.15 : 0);
182 fPrimRatio[i]->SetStats(kFALSE);
183 fPrimRatio[i]->Draw(Form("COL%c", (np % 2 == 1) ? ' ' : 'Z'));
187 TLatex* text = new TLatex(0, 180, Form("FMD%d%c", d, r));
188 text->SetTextFont(132);
189 text->SetTextAlign(22);
190 text->SetTextSize(0.08);
200 ClassDef(DrawSDigits,0);
203 //____________________________________________________________________