1 //____________________________________________________________________
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.
15 #include <AliFMDHit.h>
16 #include <AliFMDDigit.h>
17 #include <AliFMDInput.h>
18 #include <AliFMDUShortMap.h>
19 #include <AliFMDFloatMap.h>
20 #include <AliFMDRecPoint.h>
21 #include <AliESDFMD.h>
29 #include <TSpectrum.h>
34 @brief Draw digit ADC versus Rec point mult
37 Root> Compile("DrawESD.C")
43 class DrawESD : public AliFMDInput
46 TH1D* fMult; // Histogram
49 //__________________________________________________________________
50 DrawESD(Int_t n=1000, Double_t mmin=-0.5, Double_t mmax=20.5)
51 : fCorr(1) // 0.68377 / 1.1)
54 fMult = new TH1D("mult", " Multiplicity (strip)", n, mmin, mmax);
56 fMult->SetXTitle("Strip Multiplicity");
58 //__________________________________________________________________
60 @param ev Event number
61 @return @c false on error */
62 Bool_t Begin(Int_t ev)
64 return AliFMDInput::Begin(ev);
66 //__________________________________________________________________
67 Bool_t ProcessESD(UShort_t /* det */,
74 // Cache the energy loss
75 if (mult/fCorr > 0.01) fMult->Fill(mult/fCorr);
78 //__________________________________________________________________
79 TF1* FitPeak(Int_t n, TH1D* hist, Double_t min, Double_t& max)
81 TF1* l = new TF1(Form("l%02d", n), "landau", min, max);
82 hist->GetXaxis()->SetRangeUser(0, 4);
83 hist->Fit(l, "0Q", "", min, max);
84 Double_t mpv = l->GetParameter(1);
85 Double_t empv = l->GetParError(1);
86 Double_t sigma = l->GetParameter(2);
87 l->SetRange(mpv-empv, mpv+3*sigma);
88 hist->Fit(l, "EMQ0", "", mpv-3*empv, mpv+3*sigma);
89 std::cout << "Peak # " << n << " [" << min << "," << max << "]\n"
90 << " MPV: " << l->GetParameter(1)
91 << " +/- " << l->GetParError(1)
92 << " Var: " << l->GetParameter(2)
93 << " +/- " << l->GetParError(2)
94 << " Chi^2/NDF: " << l->GetChisquare() / l->GetNDF()
96 mpv = l->GetParameter(1);
97 sigma = l->GetParameter(2);
98 min = mpv - sigma * 2; // (n==1 ? 3 : 2);
99 max = mpv + sigma * 3;
100 // l->SetRange(min, max);
104 //__________________________________________________________________
105 void MaxInRange(TH1D* hist, Double_t min, Double_t& mean, Double_t& var)
107 hist->GetXaxis()->SetRangeUser(min, 4);
108 mean = hist->GetMean();
109 var = hist->GetRMS();
112 //__________________________________________________________________
115 gStyle->SetPalette(1);
116 gStyle->SetOptTitle(0);
117 gStyle->SetOptFit(1111111);
118 gStyle->SetCanvasColor(0);
119 gStyle->SetCanvasBorderSize(0);
120 gStyle->SetPadColor(0);
121 gStyle->SetPadBorderSize(0);
123 TCanvas* c = new TCanvas("c", "C");
126 fMult->GetXaxis()->SetRangeUser(0,4);
127 fMult->Scale(1. / fMult->GetEntries());
128 fMult->SetStats(kFALSE);
129 fMult->SetFillColor(2);
130 fMult->SetFillStyle(3001);
131 fMult->Draw("hist e");
134 MaxInRange(fMult, 0.2, mean, rms);
135 Double_t x1 = mean-rms/2; // .75; // .8; // .65 / fCorr;
136 Double_t x2 = mean+rms/2; // 1.3; // 1.7; // fCorr;
137 TF1* l1 = FitPeak(1, fMult, x1, x2);
138 x2 = TMath::Max(mean+rms/2, x2);
139 MaxInRange(fMult, x2, mean, rms);
140 Double_t x3 = mean + rms;
141 TF1* l2 = FitPeak(2, fMult, x2, x3);
142 Double_t diff = l2->GetParameter(1)-l1->GetParameter(1);
143 TF1* f = new TF1("user", "landau(0)+landau(3)", x1, x3);
145 fMult->GetXaxis()->SetRangeUser(0, 4);
146 f->SetParNames("A_{1}", "Mpv_{1}", "#sigma_{1}",
147 "A_{2}", "Mpv_{2}", "#sigma_{2}",
148 "A_{3}", "Mpv_{3}", "#sigma_{3}");
149 f->SetParameters(l1->GetParameter(0),
155 l2->GetParameter(0)/10,
156 l2->GetParameter(1) + diff,
157 l2->GetParameter(2));
158 fMult->Fit(f, "0Q", "", x1, x3);
159 fMult->Fit(f, "ME0", "E1", x1, x3);
160 fMult->DrawClone("same hist");
174 TLegend* l = new TLegend(0.6, 0.6, .89, .89);
175 l->AddEntry(l1, "1 particle Landau", "l");
176 l->AddEntry(l2, "2 particle Landau", "l");
177 l->AddEntry(f, "1+2 particle Landau", "l");
183 c = new TCanvas("c2", "Landaus");
185 fMult->DrawClone("axis");
187 Double_t* p1 = f->GetParameters();
188 Double_t* p2 = &(p1[3]);
189 TF1* ll1 = new TF1("ll1", "landau", 0, 4);
190 ll1->SetParameters(p1);
191 ll1->SetLineColor(3);
193 TF1* ll2 = new TF1("ll2", "landau", 0, 4);
194 ll2->SetParameters(p2);
195 ll2->SetLineColor(4);
198 Double_t y1 = fMult->GetMinimum() * 1.1;
199 Double_t y2 = fMult->GetMaximum() * .9;
200 Double_t xc1 = p1[1]-3*p1[2];
201 Double_t xc2 = p2[1]-2*p2[2];
202 Double_t xc3 = p2[1]-2*p2[2]+diff;
203 TLine* c1 = new TLine(xc1, y1, xc1, y2);
205 TLine* c2 = new TLine(xc2, y1, xc2, y2);
207 TLine* c3 = new TLine(xc3, y1, xc3, y2);
210 l = new TLegend(0.6, 0.6, .89, .89);
211 l->AddEntry(ll1, "1 particle Landau", "l");
212 l->AddEntry(ll2, "2 particle Landau", "l");
213 l->AddEntry(f, "1+2 particle Landau", "l");
226 //____________________________________________________________________