1 // This class calculates the inclusive charged particle density
2 // in each for the 5 FMD rings.
4 #include "AliFMDDensityCalculator.h"
9 #include "AliForwardCorrectionManager.h"
10 #include "AliFMDCorrDoubleHit.h"
11 #include "AliFMDCorrELossFit.h"
19 ClassImp(AliFMDDensityCalculator)
24 //____________________________________________________________________
25 AliFMDDensityCalculator::AliFMDDensityCalculator()
51 //____________________________________________________________________
52 AliFMDDensityCalculator::AliFMDDensityCalculator(const char* title)
53 : TNamed("fmdDensityCalculator", title),
76 // name Name of object
78 fRingHistos.SetName(GetName());
79 fRingHistos.SetOwner();
80 fRingHistos.Add(new RingHistos(1, 'I'));
81 fRingHistos.Add(new RingHistos(2, 'I'));
82 fRingHistos.Add(new RingHistos(2, 'O'));
83 fRingHistos.Add(new RingHistos(3, 'I'));
84 fRingHistos.Add(new RingHistos(3, 'O'));
85 fSumOfWeights = new TH1D("sumOfWeights", "Sum of Landau weights",
87 fSumOfWeights->SetFillColor(kRed+1);
88 fSumOfWeights->SetXTitle("#sum_{i} a_{i} f_{i}(#Delta)");
89 fWeightedSum = new TH1D("weightedSum", "Weighted sum of Landau propability",
91 fWeightedSum->SetFillColor(kBlue+1);
92 fWeightedSum->SetXTitle("#sum_{i} i a_{i} f_{i}(#Delta)");
93 fCorrections = new TH1D("corrections", "Distribution of corrections",
95 fCorrections->SetFillColor(kBlue+1);
96 fCorrections->SetXTitle("correction");
98 fAccI = GenerateAcceptanceCorrection('I');
99 fAccO = GenerateAcceptanceCorrection('O');
102 //____________________________________________________________________
103 AliFMDDensityCalculator::AliFMDDensityCalculator(const
104 AliFMDDensityCalculator& o)
107 fMultCut(o.fMultCut),
108 fSumOfWeights(o.fSumOfWeights),
109 fWeightedSum(o.fWeightedSum),
110 fCorrections(o.fCorrections),
111 fMaxParticles(o.fMaxParticles),
112 fUsePoisson(o.fUsePoisson),
115 fFMD1iMax(o.fFMD1iMax),
116 fFMD2iMax(o.fFMD2iMax),
117 fFMD2oMax(o.fFMD2oMax),
118 fFMD3iMax(o.fFMD3iMax),
119 fFMD3oMax(o.fFMD3oMax),
120 fEtaLumping(o.fEtaLumping),
121 fPhiLumping(o.fPhiLumping),
128 // o Object to copy from
130 TIter next(&o.fRingHistos);
132 while ((obj = next())) fRingHistos.Add(obj);
135 //____________________________________________________________________
136 AliFMDDensityCalculator::~AliFMDDensityCalculator()
141 fRingHistos.Delete();
144 //____________________________________________________________________
145 AliFMDDensityCalculator&
146 AliFMDDensityCalculator::operator=(const AliFMDDensityCalculator& o)
149 // Assignement operator
152 // o Object to assign from
155 // Reference to this object
157 TNamed::operator=(o);
159 fMultCut = o.fMultCut;
161 fMaxParticles = o.fMaxParticles;
162 fUsePoisson = o.fUsePoisson;
165 fFMD1iMax = o.fFMD1iMax;
166 fFMD2iMax = o.fFMD2iMax;
167 fFMD2oMax = o.fFMD2oMax;
168 fFMD3iMax = o.fFMD3iMax;
169 fFMD3oMax = o.fFMD3oMax;
170 fEtaLumping = o.fEtaLumping;
171 fPhiLumping = o.fPhiLumping;
172 fRingHistos.Delete();
173 TIter next(&o.fRingHistos);
175 while ((obj = next())) fRingHistos.Add(obj);
180 //____________________________________________________________________
182 AliFMDDensityCalculator::Init(const TAxis& axis)
184 // Intialize this sub-algorithm
190 TIter next(&fRingHistos);
192 while ((o = static_cast<RingHistos*>(next())))
196 //____________________________________________________________________
197 AliFMDDensityCalculator::RingHistos*
198 AliFMDDensityCalculator::GetRingHistos(UShort_t d, Char_t r) const
201 // Get the ring histogram container
208 // Ring histogram container
212 case 1: idx = 0; break;
213 case 2: idx = 1 + (r == 'I' || r == 'i' ? 0 : 1); break;
214 case 3: idx = 3 + (r == 'I' || r == 'i' ? 0 : 1); break;
216 if (idx < 0 || idx >= fRingHistos.GetEntries()) {
217 AliWarning(Form("Index %d of FMD%d%c out of range", idx, d, r));
221 return static_cast<RingHistos*>(fRingHistos.At(idx));
224 //____________________________________________________________________
226 AliFMDDensityCalculator::GetMultCut() const
229 // Get the multiplicity cut. If the user has set fMultCut (via
230 // SetMultCut) then that value is used. If not, then the lower
231 // value of the fit range for the enery loss fits is returned.
234 // Lower cut on multiplicity
236 if (fMultCut > 0) return fMultCut;
238 AliForwardCorrectionManager& fcm = AliForwardCorrectionManager::Instance();
239 AliFMDCorrELossFit* fits = fcm.GetELossFit();
240 return fits->GetLowCut();
243 //____________________________________________________________________
245 AliFMDDensityCalculator::Calculate(const AliESDFMD& fmd,
246 AliForwardUtil::Histos& hists,
251 // Do the calculations
254 // fmd AliESDFMD object (possibly) corrected for sharing
255 // hists Histogram cache
257 // lowFlux Low flux flag.
262 for (UShort_t d=1; d<=3; d++) {
263 UShort_t nr = (d == 1 ? 1 : 2);
264 for (UShort_t q=0; q<nr; q++) {
265 Char_t r = (q == 0 ? 'I' : 'O');
266 UShort_t ns= (q == 0 ? 20 : 40);
267 UShort_t nt= (q == 0 ? 512 : 256);
268 TH2D* h = hists.Get(d,r);
269 RingHistos* rh= GetRingHistos(d,r);
271 AliError(Form("No ring histogram found for FMD%d%c", d, r));
275 rh->ResetPoissonHistos(h, fEtaLumping, fPhiLumping);
277 for (UShort_t s=0; s<ns; s++) {
278 for (UShort_t t=0; t<nt; t++) {
279 Float_t mult = fmd.Multiplicity(d,r,s,t);
280 Float_t phi = fmd.Phi(d,r,s,t) / 180 * TMath::Pi();
281 Float_t eta = fmd.Eta(d,r,s,t);
282 rh->fTotalStrips->Fill(eta, phi);
283 if (mult < GetMultCut() || mult > 20) rh->fEmptyStrips->Fill(eta,phi);
284 if (mult == AliESDFMD::kInvalidMult || mult > 20) continue;
287 // rh->fEmptyStrips->Fill(eta,phi);
291 Float_t n = NParticles(mult,d,r,s,t,vtxbin,eta,lowFlux);
293 rh->fEvsN->Fill(mult,n);
294 rh->fEtaVsN->Fill(eta, n);
296 Float_t c = Correction(d,r,s,t,vtxbin,eta,lowFlux);
297 fCorrections->Fill(c);
299 rh->fEvsM->Fill(mult,n);
300 rh->fEtaVsM->Fill(eta, n);
301 rh->fCorr->Fill(eta, c);
303 if (n > 0.9 && c > 0) rh->fBasicHits->Fill(eta,phi, 1./c);
304 else rh->fEmptyStrips->Fill(eta,phi);
307 rh->fDensity->Fill(eta,phi,n);
312 // --- Loop over poisson histograms ----------------------------
313 for (Int_t ieta = 1; ieta <= h->GetNbinsX(); ieta++) {
314 for (Int_t iphi = 1; iphi <= h->GetNbinsY(); iphi++) {
315 Double_t eLossV = h->GetBinContent(ieta, iphi);
316 Float_t eta = h->GetXaxis()->GetBinCenter(ieta);
317 Float_t phi = h->GetYaxis()->GetBinCenter(iphi);
318 Int_t jeta = rh->fEmptyStrips->GetXaxis()->FindBin(eta);
319 Int_t jphi = rh->fEmptyStrips->GetYaxis()->FindBin(phi);
320 Double_t empty = rh->fEmptyStrips->GetBinContent(jeta, jphi);
321 Double_t total = rh->fTotalStrips->GetBinContent(jeta, jphi);
322 Double_t hits = rh->fBasicHits->GetBinContent(ieta,iphi);
323 // Mean in region of interest
324 Double_t poissonM = (total <= 0 || empty <= 0 ? 0 :
325 -TMath::Log(empty / total));
326 Double_t poissonV = 0;
328 // Correct for counting statistics and weight by counts
329 poissonV = (hits * poissonM) / (1 - TMath::Exp(-1*poissonM));
330 Double_t poissonE = 0 ;
331 if(poissonV > 0) poissonE = TMath::Sqrt(poissonV);
333 rh->fELossVsPoisson->Fill(eLossV, poissonV);
334 rh->fEmptyVsTotal->Fill(total, empty);
336 h->SetBinContent(ieta,iphi,poissonV);
337 h->SetBinError(ieta,iphi,poissonE);
348 //_____________________________________________________________________
350 AliFMDDensityCalculator::FindMaxWeight(const AliFMDCorrELossFit* cor,
351 UShort_t d, Char_t r, Int_t iEta) const
354 // Find the max weight to use for FMD<i>dr</i> in eta bin @a iEta
362 AliFMDCorrELossFit::ELossFit* fit = cor->GetFit(d,r,iEta);
364 // AliWarning(Form("No energy loss fit for FMD%d%c at eta=%f", d, r, eta));
367 return fit->FindMaxWeight();
370 //_____________________________________________________________________
372 AliFMDDensityCalculator::CacheMaxWeights()
375 // Find the max weights and cache them
377 AliForwardCorrectionManager& fcm = AliForwardCorrectionManager::Instance();
378 AliFMDCorrELossFit* cor = fcm.GetELossFit();
379 const TAxis& eta = cor->GetEtaAxis();
381 Int_t nEta = eta.GetNbins();
388 for (Int_t i = 0; i < nEta; i++) {
389 fFMD1iMax[i] = FindMaxWeight(cor, 1, 'I', i+1);
390 fFMD2iMax[i] = FindMaxWeight(cor, 2, 'I', i+1);
391 fFMD2oMax[i] = FindMaxWeight(cor, 2, 'O', i+1);
392 fFMD3iMax[i] = FindMaxWeight(cor, 3, 'I', i+1);
393 fFMD3oMax[i] = FindMaxWeight(cor, 3, 'O', i+1);
397 //_____________________________________________________________________
399 AliFMDDensityCalculator::GetMaxWeight(UShort_t d, Char_t r, Int_t iEta) const
402 // Find the (cached) maximum weight for FMD<i>dr</i> in
403 // @f$\eta@f$ bin @a iEta
411 // max weight or <= 0 in case of problems
413 if (iEta < 0) return -1;
415 const TArrayI* max = 0;
417 case 1: max = &fFMD1iMax; break;
418 case 2: max = (r == 'I' || r == 'i' ? &fFMD2iMax : &fFMD2oMax); break;
419 case 3: max = (r == 'I' || r == 'i' ? &fFMD3iMax : &fFMD3oMax); break;
422 AliWarning(Form("No array for FMD%d%c", d, r));
426 if (iEta >= max->fN) {
427 AliWarning(Form("Eta bin %3d out of bounds [0,%d]",
432 AliDebug(30,Form("Max weight for FMD%d%c eta bin %3d: %d", d, r, iEta,
434 return max->At(iEta);
437 //_____________________________________________________________________
439 AliFMDDensityCalculator::GetMaxWeight(UShort_t d, Char_t r, Float_t eta) const
442 // Find the (cached) maximum weight for FMD<i>dr</i> iat
451 // max weight or <= 0 in case of problems
453 AliForwardCorrectionManager& fcm = AliForwardCorrectionManager::Instance();
454 Int_t iEta = fcm.GetELossFit()->FindEtaBin(eta) -1;
456 return GetMaxWeight(d, r, iEta);
459 //_____________________________________________________________________
461 AliFMDDensityCalculator::NParticles(Float_t mult,
468 Bool_t lowFlux) const
471 // Get the number of particles corresponding to the signal mult
478 // t Strip (not used)
480 // eta Pseudo-rapidity
481 // lowFlux Low-flux flag
484 // The number of particles
486 if (mult <= GetMultCut()) return 0;
487 if (lowFlux) return 1;
489 AliForwardCorrectionManager& fcm = AliForwardCorrectionManager::Instance();
490 AliFMDCorrELossFit::ELossFit* fit = fcm.GetELossFit()->FindFit(d,r,eta);
492 AliWarning(Form("No energy loss fit for FMD%d%c at eta=%f", d, r, eta));
496 Int_t m = GetMaxWeight(d,r,eta); // fit->FindMaxWeight();
498 AliWarning(Form("No good fits for FMD%d%c at eta=%f", d, r, eta));
501 UShort_t n = TMath::Min(fMaxParticles, UShort_t(m));
502 Double_t ret = fit->EvaluateWeighted(mult, n);
505 AliInfo(Form("FMD%d%c, eta=%7.4f, %8.5f -> %8.5f", d, r, eta, mult, ret));
508 fWeightedSum->Fill(ret);
509 fSumOfWeights->Fill(ret);
514 //_____________________________________________________________________
516 AliFMDDensityCalculator::Correction(UShort_t d,
522 Bool_t lowFlux) const
525 // Get the inverse correction factor. This consist of
527 // - acceptance correction (corners of sensors)
528 // - double hit correction (for low-flux events)
529 // - dead strip correction
535 // t Strip (not used)
537 // eta Pseudo-rapidity
538 // lowFlux Low-flux flag
543 AliForwardCorrectionManager& fcm = AliForwardCorrectionManager::Instance();
545 Float_t correction = AcceptanceCorrection(r,t);
548 if (fcm.GetDoubleHit())
549 dblHitCor = fcm.GetDoubleHit()->GetCorrection(d,r);
552 Double_t dblC = dblHitCor->GetBinContent(dblHitCor->FindBin(eta));
553 if (dblC > 0) correction *= dblC;
556 AliWarning(Form("Missing double hit correction for FMD%d%c",d,r));
562 //_____________________________________________________________________
564 AliFMDDensityCalculator::GenerateAcceptanceCorrection(Char_t r) const
567 // Generate the acceptance corrections
570 // r Ring to generate for
573 // Newly allocated histogram of acceptance corrections
575 const Double_t ic1[] = { 4.9895, 15.3560 };
576 const Double_t ic2[] = { 1.8007, 17.2000 };
577 const Double_t oc1[] = { 4.2231, 26.6638 };
578 const Double_t oc2[] = { 1.8357, 27.9500 };
579 const Double_t* c1 = (r == 'I' || r == 'i' ? ic1 : oc1);
580 const Double_t* c2 = (r == 'I' || r == 'i' ? ic2 : oc2);
581 Double_t minR = (r == 'I' || r == 'i' ? 4.5213 : 15.4);
582 Double_t maxR = (r == 'I' || r == 'i' ? 17.2 : 28.0);
583 Int_t nStrips = (r == 'I' || r == 'i' ? 512 : 256);
584 Int_t nSec = (r == 'I' || r == 'i' ? 20 : 40);
585 Float_t basearc = 2 * TMath::Pi() / nSec;
586 Double_t rad = maxR - minR;
587 Float_t segment = rad / nStrips;
588 Float_t cr = TMath::Sqrt(c1[0]*c1[0]+c1[1]*c1[1]);
590 // Numbers used to find end-point of strip.
591 // (See http://mathworld.wolfram.com/Circle-LineIntersection.html)
592 Float_t D = c1[0] * c2[1] - c1[1] * c2[0];
593 Float_t dx = c2[0] - c1[0];
594 Float_t dy = c2[1] - c1[1];
595 Float_t dr = TMath::Sqrt(dx*dx+dy*dy);
597 TH1D* ret = new TH1D(Form("acc%c", r),
598 Form("Acceptance correction for FMDx%c", r),
599 nStrips, -.5, nStrips-.5);
600 ret->SetXTitle("Strip");
601 ret->SetYTitle("#varphi acceptance");
602 ret->SetDirectory(0);
603 ret->SetFillColor(r == 'I' || r == 'i' ? kRed+1 : kBlue+1);
604 ret->SetFillStyle(3001);
606 for (Int_t t = 0; t < nStrips; t++) {
607 Float_t radius = minR + t * segment;
609 // If the radius of the strip is smaller than the radius corresponding
610 // to the first corner we have a full strip length
612 ret->SetBinContent(t+1, 1);
616 // Next, we should find the end-point of the strip - that is,
617 // the coordinates where the line from c1 to c2 intersects a circle
618 // with radius given by the strip.
619 // (See http://mathworld.wolfram.com/Circle-LineIntersection.html)
620 // Calculate the determinant
621 Float_t det = radius * radius * dr * dr - D*D;
624 // <0 means No intersection
625 // =0 means Exactly tangent
626 ret->SetBinContent(t+1, 1);
630 // Calculate end-point and the corresponding opening angle
631 Float_t x = (+D * dy + dx * TMath::Sqrt(det)) / dr / dr;
632 Float_t y = (-D * dx + dy * TMath::Sqrt(det)) / dr / dr;
633 Float_t th = TMath::ATan2(x, y);
635 ret->SetBinContent(t+1, th / basearc);
640 //_____________________________________________________________________
642 AliFMDDensityCalculator::AcceptanceCorrection(Char_t r, UShort_t t) const
645 // Get the acceptance correction for strip @a t in an ring of type @a r
648 // r Ring type ('I' or 'O')
652 // Inverse acceptance correction
654 TH1D* acc = (r == 'I' || r == 'i' ? fAccI : fAccO);
655 return acc->GetBinContent(t+1);
658 //____________________________________________________________________
660 AliFMDDensityCalculator::ScaleHistograms(const TList* dir, Int_t nEvents)
663 // Scale the histograms to the total number of events
666 // dir where to put the output
667 // nEvents Number of events
669 if (nEvents <= 0) return;
670 TList* d = static_cast<TList*>(dir->FindObject(GetName()));
673 TIter next(&fRingHistos);
675 while ((o = static_cast<RingHistos*>(next())))
676 o->ScaleHistograms(d, nEvents);
679 //____________________________________________________________________
681 AliFMDDensityCalculator::DefineOutput(TList* dir)
684 // Output diagnostic histograms to directory
687 // dir List to write in
689 TList* d = new TList;
690 d->SetName(GetName());
692 d->Add(fWeightedSum);
693 d->Add(fSumOfWeights);
694 d->Add(fCorrections);
698 TIter next(&fRingHistos);
700 while ((o = static_cast<RingHistos*>(next()))) {
704 //____________________________________________________________________
706 AliFMDDensityCalculator::Print(Option_t* option) const
714 char ind[gROOT->GetDirLevel()+3];
715 for (Int_t i = 0; i < gROOT->GetDirLevel(); i++) ind[i] = ' ';
716 ind[gROOT->GetDirLevel()] = '\0';
717 std::cout << ind << "AliFMDDensityCalculator: " << GetName() << '\n'
718 << ind << " Multiplicity cut: " << fMultCut << '\n'
719 << ind << " Max(particles): " << fMaxParticles
723 if (opt.Contains("nomax")) return;
725 std::cout << ind << " Max weights:\n";
727 for (UShort_t d=1; d<=3; d++) {
728 UShort_t nr = (d == 1 ? 1 : 2);
729 for (UShort_t q=0; q<nr; q++) {
730 ind[gROOT->GetDirLevel()] = ' ';
731 ind[gROOT->GetDirLevel()+1] = '\0';
732 Char_t r = (q == 0 ? 'I' : 'O');
733 std::cout << ind << " FMD" << d << r << ":";
734 ind[gROOT->GetDirLevel()+1] = ' ';
735 ind[gROOT->GetDirLevel()+2] = '\0';
737 const TArrayI& a = (d == 1 ? fFMD1iMax :
738 (d == 2 ? (r == 'I' ? fFMD2iMax : fFMD2oMax) :
739 (r == 'I' ? fFMD3iMax : fFMD3oMax)));
741 for (Int_t i = 0; i < a.fN; i++) {
742 if (a.fArray[i] < 1) continue;
743 if (j % 6 == 0) std::cout << "\n " << ind;
745 std::cout << " " << std::setw(3) << i << ": " << a.fArray[i];
747 std::cout << std::endl;
752 //====================================================================
753 AliFMDDensityCalculator::RingHistos::RingHistos()
754 : AliForwardUtil::RingHistos(),
772 //____________________________________________________________________
773 AliFMDDensityCalculator::RingHistos::RingHistos(UShort_t d, Char_t r)
774 : AliForwardUtil::RingHistos(d,r),
794 fEvsN = new TH2D(Form("%s_Eloss_N_nocorr", fName.Data()),
795 Form("#Delta E/#Delta E_{mip} vs uncorrected inclusive "
796 "N_{ch} in %s", fName.Data()),
797 2500, -.5, 24.5, 2500, -.5, 24.5);
798 fEvsM = new TH2D(Form("%s_Eloss_N_corr", fName.Data()),
799 Form("#Delta E/#Delta E_{mip} vs corrected inclusive "
800 "N_{ch} in %s", fName.Data()),
801 2500, -.5, 24.5, 2500, -.5, 24.5);
802 fEvsN->SetXTitle("#Delta E/#Delta E_{mip}");
803 fEvsN->SetYTitle("Inclusive N_{ch} (uncorrected)");
805 fEvsN->SetDirectory(0);
806 fEvsM->SetXTitle("#Delta E/#Delta E_{mip}");
807 fEvsM->SetYTitle("Inclusive N_{ch} (corrected)");
809 fEvsM->SetDirectory(0);
811 fEtaVsN = new TProfile(Form("%s_Eta_N_nocorr", fName.Data()),
812 Form("Average inclusive N_{ch} vs #eta (uncorrected) "
813 "in %s", fName.Data()), 200, -4, 6);
814 fEtaVsM = new TProfile(Form("%s_Eta_N_corr", fName.Data()),
815 Form("Average inclusive N_{ch} vs #eta (corrected) "
816 "in %s", fName.Data()), 200, -4, 6);
817 fEtaVsN->SetXTitle("#eta");
818 fEtaVsN->SetYTitle("#LT N_{ch,incl}#GT (uncorrected)");
819 fEtaVsN->SetDirectory(0);
820 fEtaVsN->SetLineColor(Color());
821 fEtaVsN->SetFillColor(Color());
822 fEtaVsM->SetXTitle("#eta");
823 fEtaVsM->SetYTitle("#LT N_{ch,incl}#GT (corrected)");
824 fEtaVsM->SetDirectory(0);
825 fEtaVsM->SetLineColor(Color());
826 fEtaVsM->SetFillColor(Color());
829 fCorr = new TProfile(Form("%s_corr", fName.Data()),
830 Form("Average correction in %s", fName.Data()),
832 fCorr->SetXTitle("#eta");
833 fCorr->SetYTitle("#LT correction#GT");
834 fCorr->SetDirectory(0);
835 fCorr->SetLineColor(Color());
836 fCorr->SetFillColor(Color());
838 fDensity = new TH2D(Form("%s_Incl_Density", fName.Data()),
839 Form("Inclusive N_{ch} density in %s", fName.Data()),
840 200, -4, 6, (r == 'I' || r == 'i' ? 20 : 40),
842 fDensity->SetDirectory(0);
843 fDensity->SetXTitle("#eta");
844 fDensity->SetYTitle("#phi [radians]");
845 fDensity->SetZTitle("Inclusive N_{ch} density");
847 fELossVsPoisson = new TH2D(Form("%s_eloss_vs_poisson", fName.Data()),
848 Form("N_{ch} from energy loss vs from Poission %s",
849 fName.Data()), 100, 0, 20, 100, 0, 20);
850 fELossVsPoisson->SetDirectory(0);
851 fELossVsPoisson->SetXTitle("N_{ch} from #DeltaE");
852 fELossVsPoisson->SetYTitle("N_{ch} from Poisson");
853 fELossVsPoisson->SetZTitle("Correlation");
855 fEmptyVsTotal = new TH2D(Form("%s_empty_vs_total", fName.Data()),
856 Form("# of empty strips vs. total @ # strips in %s",
857 fName.Data()), 21, -.5, 20.5, 21, -0.5, 20.5);
858 fEmptyVsTotal->SetDirectory(0);
859 fEmptyVsTotal->SetXTitle("Total # strips");
860 fEmptyVsTotal->SetYTitle("Empty # strips");
861 fEmptyVsTotal->SetZTitle("Correlation");
863 //____________________________________________________________________
864 AliFMDDensityCalculator::RingHistos::RingHistos(const RingHistos& o)
865 : AliForwardUtil::RingHistos(o),
871 fDensity(o.fDensity),
872 fELossVsPoisson(o.fELossVsPoisson),
873 fTotalStrips(o.fTotalStrips),
874 fEmptyStrips(o.fEmptyStrips),
875 fBasicHits(o.fBasicHits),
876 fEmptyVsTotal(o.fEmptyVsTotal)
882 // o Object to copy from
886 //____________________________________________________________________
887 AliFMDDensityCalculator::RingHistos&
888 AliFMDDensityCalculator::RingHistos::operator=(const RingHistos& o)
891 // Assignment operator
894 // o Object to assign from
899 AliForwardUtil::RingHistos::operator=(o);
901 if (fEvsN) delete fEvsN;
902 if (fEvsM) delete fEvsM;
903 if (fEtaVsN) delete fEtaVsN;
904 if (fEtaVsM) delete fEtaVsM;
905 if (fCorr) delete fCorr;
906 if (fDensity) delete fDensity;
907 if (fELossVsPoisson) delete fELossVsPoisson;
908 if (fTotalStrips) delete fTotalStrips;
909 if (fEmptyStrips) delete fEmptyStrips;
911 fEvsN = static_cast<TH2D*>(o.fEvsN->Clone());
912 fEvsM = static_cast<TH2D*>(o.fEvsM->Clone());
913 fEtaVsN = static_cast<TProfile*>(o.fEtaVsN->Clone());
914 fEtaVsM = static_cast<TProfile*>(o.fEtaVsM->Clone());
915 fCorr = static_cast<TProfile*>(o.fCorr->Clone());
916 fDensity = static_cast<TH2D*>(o.fDensity->Clone());
917 fELossVsPoisson = static_cast<TH2D*>(o.fELossVsPoisson);
918 fTotalStrips = static_cast<TH2D*>(o.fTotalStrips);
919 fEmptyStrips = static_cast<TH2D*>(o.fEmptyStrips);
923 //____________________________________________________________________
924 AliFMDDensityCalculator::RingHistos::~RingHistos()
929 if (fEvsN) delete fEvsN;
930 if (fEvsM) delete fEvsM;
931 if (fEtaVsN) delete fEtaVsN;
932 if (fEtaVsM) delete fEtaVsM;
933 if (fCorr) delete fCorr;
934 if (fDensity) delete fDensity;
935 if (fELossVsPoisson) delete fELossVsPoisson;
936 if (fTotalStrips) delete fTotalStrips;
937 if (fEmptyStrips) delete fEmptyStrips;
940 //____________________________________________________________________
942 AliFMDDensityCalculator::RingHistos::ResetPoissonHistos(const TH2D* h,
947 fTotalStrips->Reset();
948 fEmptyStrips->Reset();
954 Int_t nEta = h->GetNbinsX() / etaLumping;
955 Int_t nEtaF = h->GetNbinsX();
956 Double_t etaMin = h->GetXaxis()->GetXmin();
957 Double_t etaMax = h->GetXaxis()->GetXmax();
958 Int_t nPhi = h->GetNbinsY() / phiLumping;
959 Int_t nPhiF = h->GetNbinsY();
960 Double_t phiMin = h->GetYaxis()->GetXmin();
961 Double_t phiMax = h->GetYaxis()->GetXmax();
963 fTotalStrips = new TH2D(Form("total%s", fName.Data()),
964 Form("Total number of strips in %s", fName.Data()),
965 nEta, etaMin, etaMax, nPhi, phiMin, phiMax);
966 fEmptyStrips = new TH2D(Form("empty%s", fName.Data()),
967 Form("Empty number of strips in %s", fName.Data()),
968 nEta, etaMin, etaMax, nPhi, phiMin, phiMax);
969 fBasicHits = new TH2D(Form("basichits%s", fName.Data()),
970 Form("Basic number of hits in %s", fName.Data()),
971 nEtaF, etaMin, etaMax, nPhiF, phiMin, phiMax);
973 fTotalStrips->SetDirectory(0);
974 fEmptyStrips->SetDirectory(0);
975 fBasicHits->SetDirectory(0);
976 fTotalStrips->SetXTitle("#eta");
977 fEmptyStrips->SetXTitle("#eta");
978 fBasicHits->SetXTitle("#eta");
979 fTotalStrips->SetYTitle("#varphi [radians]");
980 fEmptyStrips->SetYTitle("#varphi [radians]");
981 fBasicHits->SetYTitle("#varphi [radians]");
982 fTotalStrips->Sumw2();
983 fEmptyStrips->Sumw2();
987 //____________________________________________________________________
989 AliFMDDensityCalculator::RingHistos::Init(const TAxis& /*eAxis*/)
993 //____________________________________________________________________
995 AliFMDDensityCalculator::RingHistos::Output(TList* dir)
1001 // dir Where to put it
1003 TList* d = DefineOutputList(dir);
1010 d->Add(fELossVsPoisson);
1011 d->Add(fEmptyVsTotal);
1012 d->Add(fTotalStrips);
1013 d->Add(fEmptyStrips);
1019 //____________________________________________________________________
1021 AliFMDDensityCalculator::RingHistos::ScaleHistograms(TList* dir, Int_t nEvents)
1024 // Scale the histograms to the total number of events
1027 // dir Where the output is
1028 // nEvents Number of events
1030 TList* l = GetOutputList(dir);
1033 TH1* density = GetOutputHist(l,Form("%s_Incl_Density", fName.Data()));
1034 if (density) density->Scale(1./nEvents);
1037 //____________________________________________________________________