]>
Commit | Line | Data |
---|---|---|
7984e5f7 | 1 | // This class calculates the inclusive charged particle density |
2 | // in each for the 5 FMD rings. | |
3 | // | |
7e4038b5 | 4 | #include "AliFMDDensityCalculator.h" |
5 | #include <AliESDFMD.h> | |
6 | #include <TAxis.h> | |
7 | #include <TList.h> | |
8 | #include <TMath.h> | |
0bd4b00f | 9 | #include "AliForwardCorrectionManager.h" |
fb3430ac | 10 | #include "AliFMDCorrDoubleHit.h" |
11 | #include "AliFMDCorrELossFit.h" | |
7e4038b5 | 12 | #include "AliLog.h" |
13 | #include <TH2D.h> | |
0bd4b00f | 14 | #include <TProfile.h> |
5bb5d1f6 | 15 | #include <THStack.h> |
0bd4b00f | 16 | #include <TROOT.h> |
f7cfc454 | 17 | #include <TParameter.h> |
0bd4b00f | 18 | #include <iostream> |
19 | #include <iomanip> | |
7e4038b5 | 20 | |
21 | ClassImp(AliFMDDensityCalculator) | |
22 | #if 0 | |
23 | ; // For Emacs | |
24 | #endif | |
25 | ||
26 | //____________________________________________________________________ | |
27 | AliFMDDensityCalculator::AliFMDDensityCalculator() | |
28 | : TNamed(), | |
29 | fRingHistos(), | |
dd497217 | 30 | fSumOfWeights(0), |
31 | fWeightedSum(0), | |
ea3e5d95 | 32 | fCorrections(0), |
0bd4b00f | 33 | fMaxParticles(5), |
9d05ffeb | 34 | fUsePoisson(false), |
8411f7fe | 35 | fUsePhiAcceptance(kPhiCorrectNch), |
0bd4b00f | 36 | fAccI(0), |
37 | fAccO(0), | |
1174780f | 38 | fFMD1iMax(0), |
39 | fFMD2iMax(0), | |
40 | fFMD2oMax(0), | |
41 | fFMD3iMax(0), | |
42 | fFMD3oMax(0), | |
5bb5d1f6 | 43 | fMaxWeights(0), |
44 | fLowCuts(0), | |
21d778b1 | 45 | fEtaLumping(32), |
46 | fPhiLumping(4), | |
d2638bb7 | 47 | fDebug(0), |
6f4a5c0d | 48 | fCuts(), |
49 | fRecalculateEta(false) | |
7984e5f7 | 50 | { |
51 | // | |
52 | // Constructor | |
53 | // | |
6ab100ec | 54 | DGUARD(fDebug, 0, "Default CTOR of FMD density calculator"); |
7984e5f7 | 55 | } |
7e4038b5 | 56 | |
57 | //____________________________________________________________________ | |
58 | AliFMDDensityCalculator::AliFMDDensityCalculator(const char* title) | |
59 | : TNamed("fmdDensityCalculator", title), | |
60 | fRingHistos(), | |
dd497217 | 61 | fSumOfWeights(0), |
62 | fWeightedSum(0), | |
ea3e5d95 | 63 | fCorrections(0), |
0bd4b00f | 64 | fMaxParticles(5), |
9d05ffeb | 65 | fUsePoisson(false), |
8411f7fe | 66 | fUsePhiAcceptance(kPhiCorrectNch), |
0bd4b00f | 67 | fAccI(0), |
68 | fAccO(0), | |
1174780f | 69 | fFMD1iMax(0), |
70 | fFMD2iMax(0), | |
71 | fFMD2oMax(0), | |
72 | fFMD3iMax(0), | |
73 | fFMD3oMax(0), | |
5bb5d1f6 | 74 | fMaxWeights(0), |
75 | fLowCuts(0), | |
21d778b1 | 76 | fEtaLumping(32), |
77 | fPhiLumping(4), | |
d2638bb7 | 78 | fDebug(0), |
6f4a5c0d | 79 | fCuts(), |
80 | fRecalculateEta(false) | |
7e4038b5 | 81 | { |
7984e5f7 | 82 | // |
83 | // Constructor | |
84 | // | |
85 | // Parameters: | |
86 | // name Name of object | |
87 | // | |
6ab100ec | 88 | DGUARD(fDebug, 0, "Named CTOR of FMD density calculator: %s", title); |
7e4038b5 | 89 | fRingHistos.SetName(GetName()); |
e308a636 | 90 | fRingHistos.SetOwner(); |
7e4038b5 | 91 | fRingHistos.Add(new RingHistos(1, 'I')); |
92 | fRingHistos.Add(new RingHistos(2, 'I')); | |
93 | fRingHistos.Add(new RingHistos(2, 'O')); | |
94 | fRingHistos.Add(new RingHistos(3, 'I')); | |
95 | fRingHistos.Add(new RingHistos(3, 'O')); | |
dd497217 | 96 | fSumOfWeights = new TH1D("sumOfWeights", "Sum of Landau weights", |
97 | 200, 0, 20); | |
0bd4b00f | 98 | fSumOfWeights->SetFillColor(kRed+1); |
99 | fSumOfWeights->SetXTitle("#sum_{i} a_{i} f_{i}(#Delta)"); | |
dd497217 | 100 | fWeightedSum = new TH1D("weightedSum", "Weighted sum of Landau propability", |
101 | 200, 0, 20); | |
0bd4b00f | 102 | fWeightedSum->SetFillColor(kBlue+1); |
103 | fWeightedSum->SetXTitle("#sum_{i} i a_{i} f_{i}(#Delta)"); | |
dd497217 | 104 | fCorrections = new TH1D("corrections", "Distribution of corrections", |
105 | 100, 0, 10); | |
0bd4b00f | 106 | fCorrections->SetFillColor(kBlue+1); |
107 | fCorrections->SetXTitle("correction"); | |
dd497217 | 108 | |
0bd4b00f | 109 | fAccI = GenerateAcceptanceCorrection('I'); |
110 | fAccO = GenerateAcceptanceCorrection('O'); | |
5bb5d1f6 | 111 | |
112 | fMaxWeights = new TH2D("maxWeights", "Maximum i of a_{i}'s to use", | |
113 | 1, 0, 1, 1, 0, 1); | |
114 | fMaxWeights->SetXTitle("#eta"); | |
115 | fMaxWeights->SetDirectory(0); | |
116 | ||
117 | fLowCuts = new TH2D("lowCuts", "Low cuts used", 1, 0, 1, 1, 0, 1); | |
118 | fLowCuts->SetXTitle("#eta"); | |
119 | fLowCuts->SetDirectory(0); | |
120 | ||
7e4038b5 | 121 | } |
122 | ||
123 | //____________________________________________________________________ | |
124 | AliFMDDensityCalculator::AliFMDDensityCalculator(const | |
125 | AliFMDDensityCalculator& o) | |
126 | : TNamed(o), | |
127 | fRingHistos(), | |
dd497217 | 128 | fSumOfWeights(o.fSumOfWeights), |
129 | fWeightedSum(o.fWeightedSum), | |
ea3e5d95 | 130 | fCorrections(o.fCorrections), |
0bd4b00f | 131 | fMaxParticles(o.fMaxParticles), |
9d05ffeb | 132 | fUsePoisson(o.fUsePoisson), |
5bb5d1f6 | 133 | fUsePhiAcceptance(o.fUsePhiAcceptance), |
0bd4b00f | 134 | fAccI(o.fAccI), |
135 | fAccO(o.fAccO), | |
1174780f | 136 | fFMD1iMax(o.fFMD1iMax), |
137 | fFMD2iMax(o.fFMD2iMax), | |
138 | fFMD2oMax(o.fFMD2oMax), | |
139 | fFMD3iMax(o.fFMD3iMax), | |
140 | fFMD3oMax(o.fFMD3oMax), | |
5bb5d1f6 | 141 | fMaxWeights(o.fMaxWeights), |
142 | fLowCuts(o.fLowCuts), | |
b6b35c77 | 143 | fEtaLumping(o.fEtaLumping), |
144 | fPhiLumping(o.fPhiLumping), | |
d2638bb7 | 145 | fDebug(o.fDebug), |
6f4a5c0d | 146 | fCuts(o.fCuts), |
147 | fRecalculateEta(o.fRecalculateEta) | |
7e4038b5 | 148 | { |
7984e5f7 | 149 | // |
150 | // Copy constructor | |
151 | // | |
152 | // Parameters: | |
153 | // o Object to copy from | |
154 | // | |
6ab100ec | 155 | DGUARD(fDebug, 0, "Copy CTOR of FMD density calculator"); |
7e4038b5 | 156 | TIter next(&o.fRingHistos); |
157 | TObject* obj = 0; | |
158 | while ((obj = next())) fRingHistos.Add(obj); | |
159 | } | |
160 | ||
161 | //____________________________________________________________________ | |
162 | AliFMDDensityCalculator::~AliFMDDensityCalculator() | |
163 | { | |
7984e5f7 | 164 | // |
165 | // Destructor | |
166 | // | |
6ab100ec | 167 | DGUARD(fDebug, 3, "DTOR of FMD density calculator"); |
7e4038b5 | 168 | fRingHistos.Delete(); |
169 | } | |
170 | ||
171 | //____________________________________________________________________ | |
172 | AliFMDDensityCalculator& | |
173 | AliFMDDensityCalculator::operator=(const AliFMDDensityCalculator& o) | |
174 | { | |
7984e5f7 | 175 | // |
176 | // Assignement operator | |
177 | // | |
178 | // Parameters: | |
179 | // o Object to assign from | |
180 | // | |
181 | // Return: | |
182 | // Reference to this object | |
183 | // | |
6ab100ec | 184 | DGUARD(fDebug, 3, "Assignment of FMD density calculator"); |
d015ecfe | 185 | if (&o == this) return *this; |
ea3e5d95 | 186 | TNamed::operator=(o); |
7e4038b5 | 187 | |
d2638bb7 | 188 | fDebug = o.fDebug; |
189 | fMaxParticles = o.fMaxParticles; | |
190 | fUsePoisson = o.fUsePoisson; | |
191 | fUsePhiAcceptance = o.fUsePhiAcceptance; | |
192 | fAccI = o.fAccI; | |
193 | fAccO = o.fAccO; | |
194 | fFMD1iMax = o.fFMD1iMax; | |
195 | fFMD2iMax = o.fFMD2iMax; | |
196 | fFMD2oMax = o.fFMD2oMax; | |
197 | fFMD3iMax = o.fFMD3iMax; | |
198 | fFMD3oMax = o.fFMD3oMax; | |
199 | fMaxWeights = o.fMaxWeights; | |
200 | fLowCuts = o.fLowCuts; | |
201 | fEtaLumping = o.fEtaLumping; | |
202 | fPhiLumping = o.fPhiLumping; | |
203 | fCuts = o.fCuts; | |
6f4a5c0d | 204 | fRecalculateEta = o.fRecalculateEta; |
d2638bb7 | 205 | |
7e4038b5 | 206 | fRingHistos.Delete(); |
207 | TIter next(&o.fRingHistos); | |
208 | TObject* obj = 0; | |
209 | while ((obj = next())) fRingHistos.Add(obj); | |
210 | ||
211 | return *this; | |
212 | } | |
213 | ||
1174780f | 214 | //____________________________________________________________________ |
215 | void | |
9d05ffeb | 216 | AliFMDDensityCalculator::Init(const TAxis& axis) |
1174780f | 217 | { |
218 | // Intialize this sub-algorithm | |
219 | // | |
220 | // Parameters: | |
221 | // etaAxis Not used | |
6ab100ec | 222 | DGUARD(fDebug, 1, "Initialize FMD density calculator"); |
e2ebf8c4 | 223 | CacheMaxWeights(axis); |
4077f3e8 | 224 | |
9d05ffeb | 225 | TIter next(&fRingHistos); |
226 | RingHistos* o = 0; | |
d2638bb7 | 227 | while ((o = static_cast<RingHistos*>(next()))) { |
e18cb8bd | 228 | o->Init(axis); |
229 | // o->fMultCut = fCuts.GetFixedCut(o->fDet, o->fRing); | |
230 | // o->fPoisson.Init(o->fDet,o->fRing,fEtaLumping, fPhiLumping); | |
d2638bb7 | 231 | } |
1174780f | 232 | } |
233 | ||
7e4038b5 | 234 | //____________________________________________________________________ |
235 | AliFMDDensityCalculator::RingHistos* | |
236 | AliFMDDensityCalculator::GetRingHistos(UShort_t d, Char_t r) const | |
237 | { | |
7984e5f7 | 238 | // |
239 | // Get the ring histogram container | |
240 | // | |
241 | // Parameters: | |
242 | // d Detector | |
243 | // r Ring | |
244 | // | |
245 | // Return: | |
246 | // Ring histogram container | |
247 | // | |
7e4038b5 | 248 | Int_t idx = -1; |
249 | switch (d) { | |
250 | case 1: idx = 0; break; | |
251 | case 2: idx = 1 + (r == 'I' || r == 'i' ? 0 : 1); break; | |
252 | case 3: idx = 3 + (r == 'I' || r == 'i' ? 0 : 1); break; | |
253 | } | |
e308a636 | 254 | if (idx < 0 || idx >= fRingHistos.GetEntries()) { |
255 | AliWarning(Form("Index %d of FMD%d%c out of range", idx, d, r)); | |
256 | return 0; | |
257 | } | |
7e4038b5 | 258 | |
259 | return static_cast<RingHistos*>(fRingHistos.At(idx)); | |
260 | } | |
5bb5d1f6 | 261 | |
0bd4b00f | 262 | //____________________________________________________________________ |
263 | Double_t | |
5bb5d1f6 | 264 | AliFMDDensityCalculator::GetMultCut(UShort_t d, Char_t r, Int_t ieta, |
265 | Bool_t errors) const | |
0bd4b00f | 266 | { |
7984e5f7 | 267 | // |
268 | // Get the multiplicity cut. If the user has set fMultCut (via | |
269 | // SetMultCut) then that value is used. If not, then the lower | |
270 | // value of the fit range for the enery loss fits is returned. | |
271 | // | |
272 | // Return: | |
273 | // Lower cut on multiplicity | |
274 | // | |
d2638bb7 | 275 | return fCuts.GetMultCut(d,r,ieta,errors); |
5bb5d1f6 | 276 | } |
277 | ||
278 | //____________________________________________________________________ | |
279 | Double_t | |
280 | AliFMDDensityCalculator::GetMultCut(UShort_t d, Char_t r, Double_t eta, | |
8e400b14 | 281 | Bool_t errors) const |
5bb5d1f6 | 282 | { |
283 | // | |
284 | // Get the multiplicity cut. If the user has set fMultCut (via | |
285 | // SetMultCut) then that value is used. If not, then the lower | |
286 | // value of the fit range for the enery loss fits is returned. | |
287 | // | |
288 | // Return: | |
289 | // Lower cut on multiplicity | |
290 | // | |
d2638bb7 | 291 | return fCuts.GetMultCut(d,r,eta,errors); |
0bd4b00f | 292 | } |
293 | ||
7e4038b5 | 294 | //____________________________________________________________________ |
295 | Bool_t | |
296 | AliFMDDensityCalculator::Calculate(const AliESDFMD& fmd, | |
297 | AliForwardUtil::Histos& hists, | |
0bd4b00f | 298 | UShort_t vtxbin, |
21d778b1 | 299 | Bool_t lowFlux, |
b3d81bee | 300 | Double_t /*cent*/, |
6f4a5c0d | 301 | Double_t zvtx) |
7e4038b5 | 302 | { |
7984e5f7 | 303 | // |
304 | // Do the calculations | |
305 | // | |
306 | // Parameters: | |
307 | // fmd AliESDFMD object (possibly) corrected for sharing | |
308 | // hists Histogram cache | |
309 | // vtxBin Vertex bin | |
310 | // lowFlux Low flux flag. | |
311 | // | |
312 | // Return: | |
313 | // true on successs | |
6ab100ec | 314 | DGUARD(fDebug, 1, "Calculate density in FMD density calculator"); |
21d778b1 | 315 | |
7e4038b5 | 316 | for (UShort_t d=1; d<=3; d++) { |
317 | UShort_t nr = (d == 1 ? 1 : 2); | |
318 | for (UShort_t q=0; q<nr; q++) { | |
319 | Char_t r = (q == 0 ? 'I' : 'O'); | |
320 | UShort_t ns= (q == 0 ? 20 : 40); | |
321 | UShort_t nt= (q == 0 ? 512 : 256); | |
322 | TH2D* h = hists.Get(d,r); | |
323 | RingHistos* rh= GetRingHistos(d,r); | |
e308a636 | 324 | if (!rh) { |
325 | AliError(Form("No ring histogram found for FMD%d%c", d, r)); | |
326 | fRingHistos.ls(); | |
327 | return false; | |
328 | } | |
e18cb8bd | 329 | // rh->fPoisson.SetObject(d,r,vtxbin,cent); |
d23503ee | 330 | rh->fPoisson.Reset(0); |
821ffd28 | 331 | // rh->ResetPoissonHistos(h, fEtaLumping, fPhiLumping); |
9fde7142 | 332 | |
7e4038b5 | 333 | for (UShort_t s=0; s<ns; s++) { |
334 | for (UShort_t t=0; t<nt; t++) { | |
3e4a0875 | 335 | |
5bb5d1f6 | 336 | Float_t mult = fmd.Multiplicity(d,r,s,t); |
337 | Float_t phi = fmd.Phi(d,r,s,t) / 180 * TMath::Pi(); | |
338 | Float_t eta = fmd.Eta(d,r,s,t); | |
6f4a5c0d | 339 | |
340 | ||
341 | if(fRecalculateEta) | |
342 | eta = AliForwardUtil::GetEtaFromStrip(d,r,s,t,zvtx); | |
9fde7142 | 343 | |
5bb5d1f6 | 344 | if (mult == AliESDFMD::kInvalidMult || mult > 20) { |
21d778b1 | 345 | rh->fPoisson.Fill(t , s, false); |
5bb5d1f6 | 346 | rh->fEvsM->Fill(mult,0); |
33b078ef | 347 | continue; |
348 | } | |
8411f7fe | 349 | if (fUsePhiAcceptance == kPhiCorrectELoss) |
0082a8fc | 350 | mult *= AcceptanceCorrection(r,t); |
5bb5d1f6 | 351 | |
8e400b14 | 352 | Double_t cut = 1024; |
353 | if (eta != AliESDFMD::kInvalidEta) cut = GetMultCut(d, r, eta,false); | |
354 | ||
5bb5d1f6 | 355 | Double_t n = 0; |
356 | if (cut > 0 && mult > cut) | |
357 | n = NParticles(mult,d,r,s,t,vtxbin,eta,lowFlux); | |
9fde7142 | 358 | |
f7cfc454 | 359 | rh->fELoss->Fill(mult); |
7e4038b5 | 360 | rh->fEvsN->Fill(mult,n); |
0bd4b00f | 361 | rh->fEtaVsN->Fill(eta, n); |
9fde7142 | 362 | |
5bb5d1f6 | 363 | Double_t c = Correction(d,r,s,t,vtxbin,eta,lowFlux); |
dd497217 | 364 | fCorrections->Fill(c); |
7e4038b5 | 365 | if (c > 0) n /= c; |
366 | rh->fEvsM->Fill(mult,n); | |
0bd4b00f | 367 | rh->fEtaVsM->Fill(eta, n); |
368 | rh->fCorr->Fill(eta, c); | |
f7cfc454 | 369 | |
821ffd28 | 370 | Bool_t hit = (n > 0.9 && c > 0); |
371 | if (hit) rh->fELossUsed->Fill(mult); | |
21d778b1 | 372 | rh->fPoisson.Fill(t,s,hit,1./c); |
7e4038b5 | 373 | h->Fill(eta,phi,n); |
5bb5d1f6 | 374 | if (!fUsePoisson) rh->fDensity->Fill(eta,phi,n); |
7e4038b5 | 375 | } // for t |
376 | } // for s | |
21d778b1 | 377 | |
378 | TH2D* hclone = static_cast<TH2D*>(h->Clone("hclone")); | |
379 | if (!fUsePoisson) hclone->Reset(); | |
380 | if ( fUsePoisson) h->Reset(); | |
381 | ||
821ffd28 | 382 | TH2D* poisson = rh->fPoisson.Result(); |
d23503ee | 383 | for (Int_t t=0; t < poisson->GetNbinsX(); t++) { |
384 | for (Int_t s=0; s < poisson->GetNbinsY(); s++) { | |
21d778b1 | 385 | |
386 | Double_t poissonV = poisson->GetBinContent(t+1,s+1); | |
387 | Double_t phi = fmd.Phi(d,r,s,t) / 180 * TMath::Pi(); | |
388 | Double_t eta = fmd.Eta(d,r,s,t); | |
6f4a5c0d | 389 | if(fRecalculateEta) |
390 | eta = AliForwardUtil::GetEtaFromStrip(d,r,s,t,zvtx); | |
21d778b1 | 391 | if (fUsePoisson) |
392 | h->Fill(eta,phi,poissonV); | |
393 | else | |
394 | hclone->Fill(eta,phi,poissonV); | |
a7f31ad8 | 395 | if (fUsePoisson) rh->fDensity->Fill(eta, phi, poissonV); |
21d778b1 | 396 | } |
397 | } | |
398 | ||
399 | for (Int_t ieta=1; ieta <= h->GetNbinsX(); ieta++) { | |
400 | for (Int_t iphi=1; iphi<= h->GetNbinsY(); iphi++) { | |
e83d0620 | 401 | |
21d778b1 | 402 | Double_t poissonV = 0; //h->GetBinContent(,s+1); |
403 | Double_t eLossV = 0; | |
404 | if(fUsePoisson) { | |
405 | poissonV = h->GetBinContent(ieta,iphi); | |
406 | eLossV = hclone->GetBinContent(ieta,iphi); | |
407 | } | |
408 | else { | |
409 | poissonV = hclone->GetBinContent(ieta,iphi); | |
410 | eLossV = h->GetBinContent(ieta,iphi); | |
411 | } | |
7b03929c | 412 | |
9d05ffeb | 413 | rh->fELossVsPoisson->Fill(eLossV, poissonV); |
9d05ffeb | 414 | } |
415 | } | |
21d778b1 | 416 | delete hclone; |
417 | ||
7e4038b5 | 418 | } // for q |
419 | } // for d | |
a7f31ad8 | 420 | |
7e4038b5 | 421 | return kTRUE; |
422 | } | |
423 | ||
1174780f | 424 | //_____________________________________________________________________ |
425 | Int_t | |
fb3430ac | 426 | AliFMDDensityCalculator::FindMaxWeight(const AliFMDCorrELossFit* cor, |
1174780f | 427 | UShort_t d, Char_t r, Int_t iEta) const |
428 | { | |
fb3430ac | 429 | // |
430 | // Find the max weight to use for FMD<i>dr</i> in eta bin @a iEta | |
431 | // | |
432 | // Parameters: | |
433 | // cor Correction | |
434 | // d Detector | |
435 | // r Ring | |
436 | // iEta Eta bin | |
437 | // | |
6ab100ec | 438 | DGUARD(fDebug, 3, "Find maximum weight in FMD density calculator"); |
f61b1745 | 439 | if(!cor) return -1; |
440 | ||
1174780f | 441 | AliFMDCorrELossFit::ELossFit* fit = cor->GetFit(d,r,iEta); |
442 | if (!fit) { | |
443 | // AliWarning(Form("No energy loss fit for FMD%d%c at eta=%f", d, r, eta)); | |
444 | return -1; | |
445 | } | |
1f480471 | 446 | return TMath::Min(Int_t(fMaxParticles), fit->FindMaxWeight()); |
1174780f | 447 | } |
448 | ||
449 | //_____________________________________________________________________ | |
450 | void | |
e2ebf8c4 | 451 | AliFMDDensityCalculator::CacheMaxWeights(const TAxis& axis) |
1174780f | 452 | { |
fb3430ac | 453 | // |
454 | // Find the max weights and cache them | |
455 | // | |
6ab100ec | 456 | DGUARD(fDebug, 2, "Cache maximum weights in FMD density calculator"); |
1174780f | 457 | AliForwardCorrectionManager& fcm = AliForwardCorrectionManager::Instance(); |
458 | AliFMDCorrELossFit* cor = fcm.GetELossFit(); | |
a76fb27d | 459 | |
460 | TAxis eta(axis.GetNbins(), | |
461 | axis.GetXmin(), | |
462 | axis.GetXmax()); | |
463 | ||
f61b1745 | 464 | if(cor) |
465 | eta.Set(cor->GetEtaAxis().GetNbins(), | |
466 | cor->GetEtaAxis().GetXmin(), | |
467 | cor->GetEtaAxis().GetXmax()); | |
1174780f | 468 | |
469 | Int_t nEta = eta.GetNbins(); | |
470 | fFMD1iMax.Set(nEta); | |
471 | fFMD2iMax.Set(nEta); | |
472 | fFMD2oMax.Set(nEta); | |
473 | fFMD3iMax.Set(nEta); | |
474 | fFMD3oMax.Set(nEta); | |
475 | ||
5bb5d1f6 | 476 | fMaxWeights->SetBins(nEta, eta.GetXmin(), eta.GetXmax(), 5, .5, 5.5); |
477 | fMaxWeights->GetYaxis()->SetBinLabel(1, "FMD1i"); | |
478 | fMaxWeights->GetYaxis()->SetBinLabel(2, "FMD2i"); | |
479 | fMaxWeights->GetYaxis()->SetBinLabel(3, "FMD2o"); | |
480 | fMaxWeights->GetYaxis()->SetBinLabel(4, "FMD3i"); | |
481 | fMaxWeights->GetYaxis()->SetBinLabel(5, "FMD3o"); | |
482 | ||
483 | AliInfo(Form("Get eta axis with %d bins from %f to %f", | |
484 | nEta, eta.GetXmin(), eta.GetXmax())); | |
485 | fLowCuts->SetBins(nEta, eta.GetXmin(), eta.GetXmax(), 5, .5, 5.5); | |
486 | fLowCuts->GetYaxis()->SetBinLabel(1, "FMD1i"); | |
487 | fLowCuts->GetYaxis()->SetBinLabel(2, "FMD2i"); | |
488 | fLowCuts->GetYaxis()->SetBinLabel(3, "FMD2o"); | |
489 | fLowCuts->GetYaxis()->SetBinLabel(4, "FMD3i"); | |
490 | fLowCuts->GetYaxis()->SetBinLabel(5, "FMD3o"); | |
491 | ||
1174780f | 492 | for (Int_t i = 0; i < nEta; i++) { |
5bb5d1f6 | 493 | Double_t w[5]; |
494 | w[0] = fFMD1iMax[i] = FindMaxWeight(cor, 1, 'I', i+1); | |
495 | w[1] = fFMD2iMax[i] = FindMaxWeight(cor, 2, 'I', i+1); | |
496 | w[2] = fFMD2oMax[i] = FindMaxWeight(cor, 2, 'O', i+1); | |
497 | w[3] = fFMD3iMax[i] = FindMaxWeight(cor, 3, 'I', i+1); | |
498 | w[4] = fFMD3oMax[i] = FindMaxWeight(cor, 3, 'O', i+1); | |
499 | Double_t l[5]; | |
500 | l[0] = GetMultCut(1, 'I', i+1, false); | |
501 | l[1] = GetMultCut(2, 'I', i+1, false); | |
502 | l[2] = GetMultCut(2, 'O', i+1, false); | |
503 | l[3] = GetMultCut(3, 'I', i+1, false); | |
504 | l[4] = GetMultCut(3, 'O', i+1, false); | |
505 | for (Int_t j = 0; j < 5; j++) { | |
506 | if (w[j] > 0) fMaxWeights->SetBinContent(i+1, j+1, w[j]); | |
507 | if (l[j] > 0) fLowCuts->SetBinContent(i+1, j+1, l[j]); | |
508 | } | |
1174780f | 509 | } |
510 | } | |
511 | ||
512 | //_____________________________________________________________________ | |
513 | Int_t | |
514 | AliFMDDensityCalculator::GetMaxWeight(UShort_t d, Char_t r, Int_t iEta) const | |
515 | { | |
fb3430ac | 516 | // |
517 | // Find the (cached) maximum weight for FMD<i>dr</i> in | |
518 | // @f$\eta@f$ bin @a iEta | |
519 | // | |
520 | // Parameters: | |
521 | // d Detector | |
522 | // r Ring | |
523 | // iEta Eta bin | |
524 | // | |
525 | // Return: | |
526 | // max weight or <= 0 in case of problems | |
527 | // | |
1174780f | 528 | if (iEta < 0) return -1; |
529 | ||
530 | const TArrayI* max = 0; | |
531 | switch (d) { | |
532 | case 1: max = &fFMD1iMax; break; | |
533 | case 2: max = (r == 'I' || r == 'i' ? &fFMD2iMax : &fFMD2oMax); break; | |
534 | case 3: max = (r == 'I' || r == 'i' ? &fFMD3iMax : &fFMD3oMax); break; | |
535 | } | |
536 | if (!max) { | |
537 | AliWarning(Form("No array for FMD%d%c", d, r)); | |
538 | return -1; | |
539 | } | |
540 | ||
541 | if (iEta >= max->fN) { | |
542 | AliWarning(Form("Eta bin %3d out of bounds [0,%d]", | |
543 | iEta, max->fN-1)); | |
544 | return -1; | |
545 | } | |
546 | ||
547 | AliDebug(30,Form("Max weight for FMD%d%c eta bin %3d: %d", d, r, iEta, | |
548 | max->At(iEta))); | |
549 | return max->At(iEta); | |
550 | } | |
551 | ||
552 | //_____________________________________________________________________ | |
553 | Int_t | |
554 | AliFMDDensityCalculator::GetMaxWeight(UShort_t d, Char_t r, Float_t eta) const | |
555 | { | |
fb3430ac | 556 | // |
557 | // Find the (cached) maximum weight for FMD<i>dr</i> iat | |
558 | // @f$\eta@f$ | |
559 | // | |
560 | // Parameters: | |
561 | // d Detector | |
562 | // r Ring | |
563 | // eta Eta bin | |
564 | // | |
565 | // Return: | |
566 | // max weight or <= 0 in case of problems | |
567 | // | |
1174780f | 568 | AliForwardCorrectionManager& fcm = AliForwardCorrectionManager::Instance(); |
569 | Int_t iEta = fcm.GetELossFit()->FindEtaBin(eta) -1; | |
570 | ||
571 | return GetMaxWeight(d, r, iEta); | |
572 | } | |
573 | ||
7e4038b5 | 574 | //_____________________________________________________________________ |
575 | Float_t | |
576 | AliFMDDensityCalculator::NParticles(Float_t mult, | |
577 | UShort_t d, | |
578 | Char_t r, | |
579 | UShort_t /*s*/, | |
580 | UShort_t /*t*/, | |
0bd4b00f | 581 | UShort_t /*v*/, |
7e4038b5 | 582 | Float_t eta, |
583 | Bool_t lowFlux) const | |
584 | { | |
7984e5f7 | 585 | // |
586 | // Get the number of particles corresponding to the signal mult | |
587 | // | |
588 | // Parameters: | |
589 | // mult Signal | |
590 | // d Detector | |
591 | // r Ring | |
592 | // s Sector | |
593 | // t Strip (not used) | |
594 | // v Vertex bin | |
595 | // eta Pseudo-rapidity | |
596 | // lowFlux Low-flux flag | |
597 | // | |
598 | // Return: | |
599 | // The number of particles | |
600 | // | |
5bb5d1f6 | 601 | // if (mult <= GetMultCut()) return 0; |
6ab100ec | 602 | DGUARD(fDebug, 3, "Calculate Nch in FMD density calculator"); |
7e4038b5 | 603 | if (lowFlux) return 1; |
0bd4b00f | 604 | |
0bd4b00f | 605 | AliForwardCorrectionManager& fcm = AliForwardCorrectionManager::Instance(); |
606 | AliFMDCorrELossFit::ELossFit* fit = fcm.GetELossFit()->FindFit(d,r,eta); | |
607 | if (!fit) { | |
608 | AliWarning(Form("No energy loss fit for FMD%d%c at eta=%f", d, r, eta)); | |
609 | return 0; | |
610 | } | |
611 | ||
1174780f | 612 | Int_t m = GetMaxWeight(d,r,eta); // fit->FindMaxWeight(); |
0bd4b00f | 613 | if (m < 1) { |
614 | AliWarning(Form("No good fits for FMD%d%c at eta=%f", d, r, eta)); | |
615 | return 0; | |
616 | } | |
79909b8b | 617 | |
0bd4b00f | 618 | UShort_t n = TMath::Min(fMaxParticles, UShort_t(m)); |
619 | Double_t ret = fit->EvaluateWeighted(mult, n); | |
79909b8b | 620 | |
0bd4b00f | 621 | if (fDebug > 10) { |
622 | AliInfo(Form("FMD%d%c, eta=%7.4f, %8.5f -> %8.5f", d, r, eta, mult, ret)); | |
623 | } | |
79909b8b | 624 | |
0bd4b00f | 625 | fWeightedSum->Fill(ret); |
626 | fSumOfWeights->Fill(ret); | |
3e4a0875 | 627 | |
0bd4b00f | 628 | return ret; |
7e4038b5 | 629 | } |
630 | ||
631 | //_____________________________________________________________________ | |
632 | Float_t | |
0bd4b00f | 633 | AliFMDDensityCalculator::Correction(UShort_t d, |
634 | Char_t r, | |
635 | UShort_t /*s*/, | |
636 | UShort_t t, | |
637 | UShort_t /*v*/, | |
638 | Float_t eta, | |
639 | Bool_t lowFlux) const | |
7e4038b5 | 640 | { |
7984e5f7 | 641 | // |
642 | // Get the inverse correction factor. This consist of | |
643 | // | |
644 | // - acceptance correction (corners of sensors) | |
645 | // - double hit correction (for low-flux events) | |
646 | // - dead strip correction | |
647 | // | |
648 | // Parameters: | |
649 | // d Detector | |
650 | // r Ring | |
651 | // s Sector | |
652 | // t Strip (not used) | |
653 | // v Vertex bin | |
654 | // eta Pseudo-rapidity | |
655 | // lowFlux Low-flux flag | |
656 | // | |
657 | // Return: | |
658 | // | |
659 | // | |
6ab100ec | 660 | DGUARD(fDebug, 3, "Apply correction in FMD density calculator"); |
0bd4b00f | 661 | AliForwardCorrectionManager& fcm = AliForwardCorrectionManager::Instance(); |
7e4038b5 | 662 | |
5bb5d1f6 | 663 | Float_t correction = 1; |
8411f7fe | 664 | if (fUsePhiAcceptance == kPhiCorrectNch) |
665 | correction = AcceptanceCorrection(r,t); | |
7e4038b5 | 666 | if (lowFlux) { |
0bd4b00f | 667 | TH1D* dblHitCor = 0; |
668 | if (fcm.GetDoubleHit()) | |
669 | dblHitCor = fcm.GetDoubleHit()->GetCorrection(d,r); | |
670 | ||
7e4038b5 | 671 | if (dblHitCor) { |
0bd4b00f | 672 | Double_t dblC = dblHitCor->GetBinContent(dblHitCor->FindBin(eta)); |
673 | if (dblC > 0) correction *= dblC; | |
7e4038b5 | 674 | } |
0bd4b00f | 675 | else { |
7e4038b5 | 676 | AliWarning(Form("Missing double hit correction for FMD%d%c",d,r)); |
0bd4b00f | 677 | } |
7e4038b5 | 678 | } |
7e4038b5 | 679 | return correction; |
680 | } | |
681 | ||
0bd4b00f | 682 | //_____________________________________________________________________ |
683 | TH1D* | |
684 | AliFMDDensityCalculator::GenerateAcceptanceCorrection(Char_t r) const | |
685 | { | |
7984e5f7 | 686 | // |
687 | // Generate the acceptance corrections | |
688 | // | |
689 | // Parameters: | |
690 | // r Ring to generate for | |
691 | // | |
692 | // Return: | |
693 | // Newly allocated histogram of acceptance corrections | |
694 | // | |
6ab100ec | 695 | DGUARD(fDebug, 3, "Make acceptance correction in FMD density calculator"); |
0bd4b00f | 696 | const Double_t ic1[] = { 4.9895, 15.3560 }; |
697 | const Double_t ic2[] = { 1.8007, 17.2000 }; | |
698 | const Double_t oc1[] = { 4.2231, 26.6638 }; | |
699 | const Double_t oc2[] = { 1.8357, 27.9500 }; | |
700 | const Double_t* c1 = (r == 'I' || r == 'i' ? ic1 : oc1); | |
701 | const Double_t* c2 = (r == 'I' || r == 'i' ? ic2 : oc2); | |
702 | Double_t minR = (r == 'I' || r == 'i' ? 4.5213 : 15.4); | |
703 | Double_t maxR = (r == 'I' || r == 'i' ? 17.2 : 28.0); | |
704 | Int_t nStrips = (r == 'I' || r == 'i' ? 512 : 256); | |
705 | Int_t nSec = (r == 'I' || r == 'i' ? 20 : 40); | |
706 | Float_t basearc = 2 * TMath::Pi() / nSec; | |
707 | Double_t rad = maxR - minR; | |
708 | Float_t segment = rad / nStrips; | |
709 | Float_t cr = TMath::Sqrt(c1[0]*c1[0]+c1[1]*c1[1]); | |
710 | ||
711 | // Numbers used to find end-point of strip. | |
712 | // (See http://mathworld.wolfram.com/Circle-LineIntersection.html) | |
713 | Float_t D = c1[0] * c2[1] - c1[1] * c2[0]; | |
714 | Float_t dx = c2[0] - c1[0]; | |
715 | Float_t dy = c2[1] - c1[1]; | |
716 | Float_t dr = TMath::Sqrt(dx*dx+dy*dy); | |
717 | ||
718 | TH1D* ret = new TH1D(Form("acc%c", r), | |
719 | Form("Acceptance correction for FMDx%c", r), | |
720 | nStrips, -.5, nStrips-.5); | |
721 | ret->SetXTitle("Strip"); | |
722 | ret->SetYTitle("#varphi acceptance"); | |
723 | ret->SetDirectory(0); | |
724 | ret->SetFillColor(r == 'I' || r == 'i' ? kRed+1 : kBlue+1); | |
725 | ret->SetFillStyle(3001); | |
726 | ||
727 | for (Int_t t = 0; t < nStrips; t++) { | |
728 | Float_t radius = minR + t * segment; | |
729 | ||
730 | // If the radius of the strip is smaller than the radius corresponding | |
731 | // to the first corner we have a full strip length | |
732 | if (radius <= cr) { | |
733 | ret->SetBinContent(t+1, 1); | |
734 | continue; | |
735 | } | |
736 | ||
737 | // Next, we should find the end-point of the strip - that is, | |
738 | // the coordinates where the line from c1 to c2 intersects a circle | |
739 | // with radius given by the strip. | |
740 | // (See http://mathworld.wolfram.com/Circle-LineIntersection.html) | |
741 | // Calculate the determinant | |
742 | Float_t det = radius * radius * dr * dr - D*D; | |
743 | ||
744 | if (det <= 0) { | |
745 | // <0 means No intersection | |
746 | // =0 means Exactly tangent | |
747 | ret->SetBinContent(t+1, 1); | |
748 | continue; | |
749 | } | |
750 | ||
751 | // Calculate end-point and the corresponding opening angle | |
752 | Float_t x = (+D * dy + dx * TMath::Sqrt(det)) / dr / dr; | |
753 | Float_t y = (-D * dx + dy * TMath::Sqrt(det)) / dr / dr; | |
754 | Float_t th = TMath::ATan2(x, y); | |
755 | ||
756 | ret->SetBinContent(t+1, th / basearc); | |
757 | } | |
758 | return ret; | |
759 | } | |
7e4038b5 | 760 | |
761 | //_____________________________________________________________________ | |
762 | Float_t | |
763 | AliFMDDensityCalculator::AcceptanceCorrection(Char_t r, UShort_t t) const | |
764 | { | |
7984e5f7 | 765 | // |
766 | // Get the acceptance correction for strip @a t in an ring of type @a r | |
767 | // | |
768 | // Parameters: | |
769 | // r Ring type ('I' or 'O') | |
770 | // t Strip number | |
771 | // | |
772 | // Return: | |
773 | // Inverse acceptance correction | |
774 | // | |
0bd4b00f | 775 | TH1D* acc = (r == 'I' || r == 'i' ? fAccI : fAccO); |
776 | return acc->GetBinContent(t+1); | |
7e4038b5 | 777 | } |
778 | ||
779 | //____________________________________________________________________ | |
780 | void | |
fb3430ac | 781 | AliFMDDensityCalculator::ScaleHistograms(const TList* dir, Int_t nEvents) |
7e4038b5 | 782 | { |
7984e5f7 | 783 | // |
784 | // Scale the histograms to the total number of events | |
785 | // | |
786 | // Parameters: | |
787 | // dir where to put the output | |
788 | // nEvents Number of events | |
789 | // | |
6ab100ec | 790 | DGUARD(fDebug, 1, "Scale histograms in FMD density calculator"); |
7e4038b5 | 791 | if (nEvents <= 0) return; |
9d99b0dd | 792 | TList* d = static_cast<TList*>(dir->FindObject(GetName())); |
793 | if (!d) return; | |
7e4038b5 | 794 | |
795 | TIter next(&fRingHistos); | |
796 | RingHistos* o = 0; | |
5bb5d1f6 | 797 | THStack* sums = new THStack("sums", "sums of ring signals"); |
798 | while ((o = static_cast<RingHistos*>(next()))) { | |
9d99b0dd | 799 | o->ScaleHistograms(d, nEvents); |
5bb5d1f6 | 800 | TH1D* sum = o->fDensity->ProjectionX(o->GetName(), 1, |
801 | o->fDensity->GetNbinsY(),"e"); | |
802 | sum->Scale(1., "width"); | |
803 | sum->SetTitle(o->GetName()); | |
804 | sum->SetDirectory(0); | |
805 | sum->SetYTitle("#sum N_{ch,incl}"); | |
806 | sums->Add(sum); | |
807 | } | |
808 | d->Add(sums); | |
7e4038b5 | 809 | } |
810 | ||
811 | //____________________________________________________________________ | |
812 | void | |
9d99b0dd | 813 | AliFMDDensityCalculator::DefineOutput(TList* dir) |
7e4038b5 | 814 | { |
7984e5f7 | 815 | // |
816 | // Output diagnostic histograms to directory | |
817 | // | |
818 | // Parameters: | |
819 | // dir List to write in | |
820 | // | |
6ab100ec | 821 | DGUARD(fDebug, 1, "Define output FMD density calculator"); |
7e4038b5 | 822 | TList* d = new TList; |
5bb5d1f6 | 823 | d->SetOwner(); |
7e4038b5 | 824 | d->SetName(GetName()); |
825 | dir->Add(d); | |
dd497217 | 826 | d->Add(fWeightedSum); |
827 | d->Add(fSumOfWeights); | |
828 | d->Add(fCorrections); | |
0bd4b00f | 829 | d->Add(fAccI); |
830 | d->Add(fAccO); | |
5bb5d1f6 | 831 | d->Add(fMaxWeights); |
832 | d->Add(fLowCuts); | |
0bd4b00f | 833 | |
d2638bb7 | 834 | // TNamed* sigma = new TNamed("sigma", |
835 | // (fIncludeSigma ? "included" : "excluded")); | |
f7cfc454 | 836 | TNamed* maxP = new TNamed("maxParticle", Form("%d", fMaxParticles)); |
837 | TNamed* method = new TNamed("method", | |
838 | (fUsePoisson ? "Poisson" : "Energy loss")); | |
839 | TNamed* phiA = new TNamed("phiAcceptance", | |
0082a8fc | 840 | (fUsePhiAcceptance == 0 ? "disabled" : |
841 | fUsePhiAcceptance == 1 ? "particles" : | |
842 | "energy loss")); | |
f7cfc454 | 843 | TNamed* etaL = new TNamed("etaLumping", Form("%d", fEtaLumping)); |
844 | TNamed* phiL = new TNamed("phiLumping", Form("%d", fPhiLumping)); | |
d2638bb7 | 845 | // TParameter<double>* nxi = new TParameter<double>("nXi", fNXi); |
f7cfc454 | 846 | |
d2638bb7 | 847 | // d->Add(sigma); |
f7cfc454 | 848 | d->Add(maxP); |
849 | d->Add(method); | |
850 | d->Add(phiA); | |
851 | d->Add(etaL); | |
852 | d->Add(phiL); | |
d2638bb7 | 853 | // d->Add(nxi); |
854 | fCuts.Output(d,0); | |
f7cfc454 | 855 | |
7e4038b5 | 856 | TIter next(&fRingHistos); |
857 | RingHistos* o = 0; | |
858 | while ((o = static_cast<RingHistos*>(next()))) { | |
e18cb8bd | 859 | o->fPoisson.SetLumping(fEtaLumping, fPhiLumping); |
7e4038b5 | 860 | o->Output(d); |
861 | } | |
862 | } | |
0bd4b00f | 863 | //____________________________________________________________________ |
864 | void | |
1174780f | 865 | AliFMDDensityCalculator::Print(Option_t* option) const |
0bd4b00f | 866 | { |
7984e5f7 | 867 | // |
868 | // Print information | |
869 | // | |
870 | // Parameters: | |
871 | // option Not used | |
872 | // | |
1174780f | 873 | char ind[gROOT->GetDirLevel()+3]; |
0bd4b00f | 874 | for (Int_t i = 0; i < gROOT->GetDirLevel(); i++) ind[i] = ' '; |
875 | ind[gROOT->GetDirLevel()] = '\0'; | |
1f480471 | 876 | std::cout << ind << ClassName() << ": " << GetName() << '\n' |
5bb5d1f6 | 877 | << std::boolalpha |
1f480471 | 878 | << ind << " Max(particles): " << fMaxParticles << '\n' |
5bb5d1f6 | 879 | << ind << " Poisson method: " << fUsePoisson << '\n' |
880 | << ind << " Use phi acceptance: " << fUsePhiAcceptance << '\n' | |
1f480471 | 881 | << ind << " Eta lumping: " << fEtaLumping << '\n' |
882 | << ind << " Phi lumping: " << fPhiLumping << '\n' | |
5bb5d1f6 | 883 | << std::noboolalpha |
1f480471 | 884 | << std::flush; |
d2638bb7 | 885 | std::cout << ind << " Lower cut:" << std::endl; |
886 | fCuts.Print(); | |
1174780f | 887 | TString opt(option); |
888 | opt.ToLower(); | |
889 | if (opt.Contains("nomax")) return; | |
890 | ||
891 | std::cout << ind << " Max weights:\n"; | |
892 | ||
893 | for (UShort_t d=1; d<=3; d++) { | |
894 | UShort_t nr = (d == 1 ? 1 : 2); | |
895 | for (UShort_t q=0; q<nr; q++) { | |
896 | ind[gROOT->GetDirLevel()] = ' '; | |
897 | ind[gROOT->GetDirLevel()+1] = '\0'; | |
898 | Char_t r = (q == 0 ? 'I' : 'O'); | |
899 | std::cout << ind << " FMD" << d << r << ":"; | |
900 | ind[gROOT->GetDirLevel()+1] = ' '; | |
901 | ind[gROOT->GetDirLevel()+2] = '\0'; | |
902 | ||
903 | const TArrayI& a = (d == 1 ? fFMD1iMax : | |
904 | (d == 2 ? (r == 'I' ? fFMD2iMax : fFMD2oMax) : | |
905 | (r == 'I' ? fFMD3iMax : fFMD3oMax))); | |
906 | Int_t j = 0; | |
907 | for (Int_t i = 0; i < a.fN; i++) { | |
908 | if (a.fArray[i] < 1) continue; | |
909 | if (j % 6 == 0) std::cout << "\n " << ind; | |
910 | j++; | |
911 | std::cout << " " << std::setw(3) << i << ": " << a.fArray[i]; | |
912 | } | |
913 | std::cout << std::endl; | |
914 | } | |
915 | } | |
0bd4b00f | 916 | } |
7e4038b5 | 917 | |
918 | //==================================================================== | |
919 | AliFMDDensityCalculator::RingHistos::RingHistos() | |
9d99b0dd | 920 | : AliForwardUtil::RingHistos(), |
7e4038b5 | 921 | fEvsN(0), |
922 | fEvsM(0), | |
0bd4b00f | 923 | fEtaVsN(0), |
924 | fEtaVsM(0), | |
925 | fCorr(0), | |
9d05ffeb | 926 | fDensity(0), |
927 | fELossVsPoisson(0), | |
821ffd28 | 928 | fPoisson(), |
f7cfc454 | 929 | fELoss(0), |
930 | fELossUsed(0), | |
931 | fMultCut(0) | |
7984e5f7 | 932 | { |
933 | // | |
934 | // Default CTOR | |
935 | // | |
936 | } | |
7e4038b5 | 937 | |
938 | //____________________________________________________________________ | |
939 | AliFMDDensityCalculator::RingHistos::RingHistos(UShort_t d, Char_t r) | |
9d99b0dd | 940 | : AliForwardUtil::RingHistos(d,r), |
7e4038b5 | 941 | fEvsN(0), |
942 | fEvsM(0), | |
0bd4b00f | 943 | fEtaVsN(0), |
944 | fEtaVsM(0), | |
945 | fCorr(0), | |
9d05ffeb | 946 | fDensity(0), |
947 | fELossVsPoisson(0), | |
821ffd28 | 948 | fPoisson("ignored"), |
d2638bb7 | 949 | fELoss(0), |
f7cfc454 | 950 | fELossUsed(0), |
951 | fMultCut(0) | |
7e4038b5 | 952 | { |
7984e5f7 | 953 | // |
954 | // Constructor | |
955 | // | |
956 | // Parameters: | |
957 | // d detector | |
958 | // r ring | |
959 | // | |
5bb5d1f6 | 960 | fEvsN = new TH2D("elossVsNnocorr", |
961 | "#Delta E/#Delta E_{mip} vs uncorrected inclusive N_{ch}", | |
962 | 250, -.5, 24.5, 250, -.5, 24.5); | |
7e4038b5 | 963 | fEvsN->SetXTitle("#Delta E/#Delta E_{mip}"); |
964 | fEvsN->SetYTitle("Inclusive N_{ch} (uncorrected)"); | |
965 | fEvsN->Sumw2(); | |
966 | fEvsN->SetDirectory(0); | |
5bb5d1f6 | 967 | |
968 | fEvsM = static_cast<TH2D*>(fEvsN->Clone("elossVsNcorr")); | |
969 | fEvsM->SetTitle("#Delta E/#Delta E_{mip} vs corrected inclusive N_{ch}"); | |
7e4038b5 | 970 | fEvsM->SetDirectory(0); |
971 | ||
5bb5d1f6 | 972 | fEtaVsN = new TProfile("etaVsNnocorr", |
973 | "Average inclusive N_{ch} vs #eta (uncorrected)", | |
974 | 200, -4, 6); | |
0bd4b00f | 975 | fEtaVsN->SetXTitle("#eta"); |
976 | fEtaVsN->SetYTitle("#LT N_{ch,incl}#GT (uncorrected)"); | |
977 | fEtaVsN->SetDirectory(0); | |
978 | fEtaVsN->SetLineColor(Color()); | |
979 | fEtaVsN->SetFillColor(Color()); | |
5bb5d1f6 | 980 | |
981 | fEtaVsM = static_cast<TProfile*>(fEtaVsN->Clone("etaVsNcorr")); | |
982 | fEtaVsM->SetTitle("Average inclusive N_{ch} vs #eta (corrected)"); | |
0bd4b00f | 983 | fEtaVsM->SetYTitle("#LT N_{ch,incl}#GT (corrected)"); |
984 | fEtaVsM->SetDirectory(0); | |
0bd4b00f | 985 | |
986 | ||
5bb5d1f6 | 987 | fCorr = new TProfile("corr", "Average correction", 200, -4, 6); |
0bd4b00f | 988 | fCorr->SetXTitle("#eta"); |
989 | fCorr->SetYTitle("#LT correction#GT"); | |
990 | fCorr->SetDirectory(0); | |
991 | fCorr->SetLineColor(Color()); | |
992 | fCorr->SetFillColor(Color()); | |
993 | ||
5bb5d1f6 | 994 | fDensity = new TH2D("inclDensity", "Inclusive N_{ch} density", |
7e4038b5 | 995 | 200, -4, 6, (r == 'I' || r == 'i' ? 20 : 40), |
996 | 0, 2*TMath::Pi()); | |
997 | fDensity->SetDirectory(0); | |
5bb5d1f6 | 998 | fDensity->Sumw2(); |
999 | fDensity->SetMarkerColor(Color()); | |
7e4038b5 | 1000 | fDensity->SetXTitle("#eta"); |
1001 | fDensity->SetYTitle("#phi [radians]"); | |
1002 | fDensity->SetZTitle("Inclusive N_{ch} density"); | |
9d05ffeb | 1003 | |
5bb5d1f6 | 1004 | fELossVsPoisson = new TH2D("elossVsPoisson", |
1005 | "N_{ch} from energy loss vs from Poission", | |
3e4a0875 | 1006 | 500, 0, 100, 500, 0, 100); |
9d05ffeb | 1007 | fELossVsPoisson->SetDirectory(0); |
1008 | fELossVsPoisson->SetXTitle("N_{ch} from #DeltaE"); | |
1009 | fELossVsPoisson->SetYTitle("N_{ch} from Poisson"); | |
1010 | fELossVsPoisson->SetZTitle("Correlation"); | |
1011 | ||
f7cfc454 | 1012 | fELoss = new TH1D("eloss", "#Delta/#Delta_{mip} in all strips", |
1013 | 600, 0, 15); | |
1014 | fELoss->SetXTitle("#Delta/#Delta_{mip} (selected)"); | |
1015 | fELoss->SetYTitle("P(#Delta/#Delta_{mip})"); | |
1016 | fELoss->SetFillColor(Color()-2); | |
1017 | fELoss->SetFillStyle(3003); | |
1018 | fELoss->SetLineColor(kBlack); | |
1019 | fELoss->SetLineStyle(2); | |
1020 | fELoss->SetLineWidth(2); | |
1021 | fELoss->SetDirectory(0); | |
1022 | ||
1023 | fELossUsed = static_cast<TH1D*>(fELoss->Clone("elossUsed")); | |
1024 | fELossUsed->SetTitle("#Delta/#Delta_{mip} in used strips"); | |
1025 | fELossUsed->SetFillStyle(3002); | |
1026 | fELossUsed->SetLineStyle(1); | |
1027 | fELossUsed->SetDirectory(0); | |
1028 | ||
7e4038b5 | 1029 | } |
1030 | //____________________________________________________________________ | |
1031 | AliFMDDensityCalculator::RingHistos::RingHistos(const RingHistos& o) | |
9d99b0dd | 1032 | : AliForwardUtil::RingHistos(o), |
7e4038b5 | 1033 | fEvsN(o.fEvsN), |
1034 | fEvsM(o.fEvsM), | |
0bd4b00f | 1035 | fEtaVsN(o.fEtaVsN), |
1036 | fEtaVsM(o.fEtaVsM), | |
1037 | fCorr(o.fCorr), | |
9d05ffeb | 1038 | fDensity(o.fDensity), |
1039 | fELossVsPoisson(o.fELossVsPoisson), | |
821ffd28 | 1040 | fPoisson(o.fPoisson), |
f7cfc454 | 1041 | fELoss(o.fELoss), |
1042 | fELossUsed(o.fELossUsed), | |
1043 | fMultCut(o.fMultCut) | |
7984e5f7 | 1044 | { |
1045 | // | |
1046 | // Copy constructor | |
1047 | // | |
1048 | // Parameters: | |
1049 | // o Object to copy from | |
1050 | // | |
1051 | } | |
7e4038b5 | 1052 | |
1053 | //____________________________________________________________________ | |
1054 | AliFMDDensityCalculator::RingHistos& | |
1055 | AliFMDDensityCalculator::RingHistos::operator=(const RingHistos& o) | |
1056 | { | |
7984e5f7 | 1057 | // |
1058 | // Assignment operator | |
1059 | // | |
1060 | // Parameters: | |
1061 | // o Object to assign from | |
1062 | // | |
1063 | // Return: | |
1064 | // Reference to this | |
1065 | // | |
d015ecfe | 1066 | if (&o == this) return *this; |
9d99b0dd | 1067 | AliForwardUtil::RingHistos::operator=(o); |
7e4038b5 | 1068 | |
9d05ffeb | 1069 | if (fEvsN) delete fEvsN; |
1070 | if (fEvsM) delete fEvsM; | |
1071 | if (fEtaVsN) delete fEtaVsN; | |
1072 | if (fEtaVsM) delete fEtaVsM; | |
1073 | if (fCorr) delete fCorr; | |
1074 | if (fDensity) delete fDensity; | |
1075 | if (fELossVsPoisson) delete fELossVsPoisson; | |
7e4038b5 | 1076 | |
9d05ffeb | 1077 | fEvsN = static_cast<TH2D*>(o.fEvsN->Clone()); |
1078 | fEvsM = static_cast<TH2D*>(o.fEvsM->Clone()); | |
1079 | fEtaVsN = static_cast<TProfile*>(o.fEtaVsN->Clone()); | |
1080 | fEtaVsM = static_cast<TProfile*>(o.fEtaVsM->Clone()); | |
1081 | fCorr = static_cast<TProfile*>(o.fCorr->Clone()); | |
1082 | fDensity = static_cast<TH2D*>(o.fDensity->Clone()); | |
f7cfc454 | 1083 | fELossVsPoisson = static_cast<TH2D*>(o.fELossVsPoisson->Clone()); |
821ffd28 | 1084 | fPoisson = o.fPoisson; |
f7cfc454 | 1085 | fELoss = static_cast<TH1D*>(o.fELoss->Clone()); |
1086 | fELossUsed = static_cast<TH1D*>(o.fELossUsed->Clone()); | |
7e4038b5 | 1087 | |
1088 | return *this; | |
1089 | } | |
1090 | //____________________________________________________________________ | |
1091 | AliFMDDensityCalculator::RingHistos::~RingHistos() | |
1092 | { | |
7984e5f7 | 1093 | // |
1094 | // Destructor | |
1095 | // | |
9d05ffeb | 1096 | } |
1097 | ||
e308a636 | 1098 | |
1099 | //____________________________________________________________________ | |
9d05ffeb | 1100 | void |
9fde7142 | 1101 | AliFMDDensityCalculator::RingHistos::Init(const TAxis& /*eAxis*/) |
9d05ffeb | 1102 | { |
e18cb8bd | 1103 | fPoisson.Init(-1,-1); |
7e4038b5 | 1104 | } |
1105 | ||
1106 | //____________________________________________________________________ | |
1107 | void | |
1108 | AliFMDDensityCalculator::RingHistos::Output(TList* dir) | |
1109 | { | |
7984e5f7 | 1110 | // |
1111 | // Make output | |
1112 | // | |
1113 | // Parameters: | |
1114 | // dir Where to put it | |
1115 | // | |
9d99b0dd | 1116 | TList* d = DefineOutputList(dir); |
7e4038b5 | 1117 | d->Add(fEvsN); |
1118 | d->Add(fEvsM); | |
0bd4b00f | 1119 | d->Add(fEtaVsN); |
1120 | d->Add(fEtaVsM); | |
1121 | d->Add(fCorr); | |
7e4038b5 | 1122 | d->Add(fDensity); |
9d05ffeb | 1123 | d->Add(fELossVsPoisson); |
821ffd28 | 1124 | fPoisson.Output(d); |
d23503ee | 1125 | fPoisson.GetOccupancy()->SetFillColor(Color()); |
1126 | fPoisson.GetMean()->SetFillColor(Color()); | |
1127 | fPoisson.GetOccupancy()->SetFillColor(Color()); | |
f7cfc454 | 1128 | d->Add(fELoss); |
1129 | d->Add(fELossUsed); | |
d23503ee | 1130 | |
1131 | Bool_t inner = (fRing == 'I' || fRing == 'i'); | |
1132 | Int_t nStr = inner ? 512 : 256; | |
1133 | Int_t nSec = inner ? 20 : 40; | |
1134 | TAxis x(nStr, -.5, nStr-.5); | |
1135 | TAxis y(nSec, -.5, nSec-.5); | |
1136 | x.SetTitle("strip"); | |
1137 | y.SetTitle("sector"); | |
1138 | fPoisson.Define(x, y); | |
1139 | ||
f7cfc454 | 1140 | TParameter<double>* cut = new TParameter<double>("cut", fMultCut); |
1141 | d->Add(cut); | |
9d99b0dd | 1142 | } |
1143 | ||
1144 | //____________________________________________________________________ | |
1145 | void | |
1146 | AliFMDDensityCalculator::RingHistos::ScaleHistograms(TList* dir, Int_t nEvents) | |
1147 | { | |
7984e5f7 | 1148 | // |
1149 | // Scale the histograms to the total number of events | |
1150 | // | |
1151 | // Parameters: | |
1152 | // dir Where the output is | |
1153 | // nEvents Number of events | |
1154 | // | |
9d99b0dd | 1155 | TList* l = GetOutputList(dir); |
1156 | if (!l) return; | |
1157 | ||
5bb5d1f6 | 1158 | TH1* density = GetOutputHist(l,"inclDensity"); |
9d99b0dd | 1159 | if (density) density->Scale(1./nEvents); |
7e4038b5 | 1160 | } |
1161 | ||
1162 | //____________________________________________________________________ | |
1163 | // | |
1164 | // EOF | |
1165 | // | |
1166 | ||
1167 | ||
1168 |