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()
49 //____________________________________________________________________
50 AliFMDDensityCalculator::AliFMDDensityCalculator(const char* title)
51 : TNamed("fmdDensityCalculator", title),
72 // name Name of object
74 fRingHistos.SetName(GetName());
75 fRingHistos.SetOwner();
76 fRingHistos.Add(new RingHistos(1, 'I'));
77 fRingHistos.Add(new RingHistos(2, 'I'));
78 fRingHistos.Add(new RingHistos(2, 'O'));
79 fRingHistos.Add(new RingHistos(3, 'I'));
80 fRingHistos.Add(new RingHistos(3, 'O'));
81 fSumOfWeights = new TH1D("sumOfWeights", "Sum of Landau weights",
83 fSumOfWeights->SetFillColor(kRed+1);
84 fSumOfWeights->SetXTitle("#sum_{i} a_{i} f_{i}(#Delta)");
85 fWeightedSum = new TH1D("weightedSum", "Weighted sum of Landau propability",
87 fWeightedSum->SetFillColor(kBlue+1);
88 fWeightedSum->SetXTitle("#sum_{i} i a_{i} f_{i}(#Delta)");
89 fCorrections = new TH1D("corrections", "Distribution of corrections",
91 fCorrections->SetFillColor(kBlue+1);
92 fCorrections->SetXTitle("correction");
94 fAccI = GenerateAcceptanceCorrection('I');
95 fAccO = GenerateAcceptanceCorrection('O');
98 //____________________________________________________________________
99 AliFMDDensityCalculator::AliFMDDensityCalculator(const
100 AliFMDDensityCalculator& o)
103 fMultCut(o.fMultCut),
104 fSumOfWeights(o.fSumOfWeights),
105 fWeightedSum(o.fWeightedSum),
106 fCorrections(o.fCorrections),
107 fMaxParticles(o.fMaxParticles),
108 fUsePoisson(o.fUsePoisson),
111 fFMD1iMax(o.fFMD1iMax),
112 fFMD2iMax(o.fFMD2iMax),
113 fFMD2oMax(o.fFMD2oMax),
114 fFMD3iMax(o.fFMD3iMax),
115 fFMD3oMax(o.fFMD3oMax),
122 // o Object to copy from
124 TIter next(&o.fRingHistos);
126 while ((obj = next())) fRingHistos.Add(obj);
129 //____________________________________________________________________
130 AliFMDDensityCalculator::~AliFMDDensityCalculator()
135 fRingHistos.Delete();
138 //____________________________________________________________________
139 AliFMDDensityCalculator&
140 AliFMDDensityCalculator::operator=(const AliFMDDensityCalculator& o)
143 // Assignement operator
146 // o Object to assign from
149 // Reference to this object
151 TNamed::operator=(o);
153 fMultCut = o.fMultCut;
155 fMaxParticles = o.fMaxParticles;
156 fUsePoisson = o.fUsePoisson;
159 fFMD1iMax = o.fFMD1iMax;
160 fFMD2iMax = o.fFMD2iMax;
161 fFMD2oMax = o.fFMD2oMax;
162 fFMD3iMax = o.fFMD3iMax;
163 fFMD3oMax = o.fFMD3oMax;
165 fRingHistos.Delete();
166 TIter next(&o.fRingHistos);
168 while ((obj = next())) fRingHistos.Add(obj);
173 //____________________________________________________________________
175 AliFMDDensityCalculator::Init(const TAxis& axis)
177 // Intialize this sub-algorithm
183 TIter next(&fRingHistos);
185 while ((o = static_cast<RingHistos*>(next())))
189 //____________________________________________________________________
190 AliFMDDensityCalculator::RingHistos*
191 AliFMDDensityCalculator::GetRingHistos(UShort_t d, Char_t r) const
194 // Get the ring histogram container
201 // Ring histogram container
205 case 1: idx = 0; break;
206 case 2: idx = 1 + (r == 'I' || r == 'i' ? 0 : 1); break;
207 case 3: idx = 3 + (r == 'I' || r == 'i' ? 0 : 1); break;
209 if (idx < 0 || idx >= fRingHistos.GetEntries()) {
210 AliWarning(Form("Index %d of FMD%d%c out of range", idx, d, r));
214 return static_cast<RingHistos*>(fRingHistos.At(idx));
217 //____________________________________________________________________
219 AliFMDDensityCalculator::GetMultCut() const
222 // Get the multiplicity cut. If the user has set fMultCut (via
223 // SetMultCut) then that value is used. If not, then the lower
224 // value of the fit range for the enery loss fits is returned.
227 // Lower cut on multiplicity
229 if (fMultCut > 0) return fMultCut;
231 AliForwardCorrectionManager& fcm = AliForwardCorrectionManager::Instance();
232 AliFMDCorrELossFit* fits = fcm.GetELossFit();
233 return fits->GetLowCut();
236 //____________________________________________________________________
238 AliFMDDensityCalculator::Calculate(const AliESDFMD& fmd,
239 AliForwardUtil::Histos& hists,
244 // Do the calculations
247 // fmd AliESDFMD object (possibly) corrected for sharing
248 // hists Histogram cache
250 // lowFlux Low flux flag.
255 for (UShort_t d=1; d<=3; d++) {
256 UShort_t nr = (d == 1 ? 1 : 2);
257 for (UShort_t q=0; q<nr; q++) {
258 Char_t r = (q == 0 ? 'I' : 'O');
259 UShort_t ns= (q == 0 ? 20 : 40);
260 UShort_t nt= (q == 0 ? 512 : 256);
261 TH2D* h = hists.Get(d,r);
262 RingHistos* rh= GetRingHistos(d,r);
264 AliError(Form("No ring histogram found for FMD%d%c", d, r));
268 rh->ResetPoissonHistos();
270 for (UShort_t s=0; s<ns; s++) {
271 for (UShort_t t=0; t<nt; t++) {
272 Float_t mult = fmd.Multiplicity(d,r,s,t);
273 Float_t phi = fmd.Phi(d,r,s,t) / 180 * TMath::Pi();
274 Float_t eta = fmd.Eta(d,r,s,t);
275 rh->fTotalStrips->Fill(eta, phi);
276 if (mult < GetMultCut() || mult > 20) rh->fEmptyStrips->Fill(eta,phi);
277 if (mult == AliESDFMD::kInvalidMult || mult > 20) continue;
280 // rh->fEmptyStrips->Fill(eta,phi);
284 Float_t n = NParticles(mult,d,r,s,t,vtxbin,eta,lowFlux);
286 rh->fEvsN->Fill(mult,n);
287 rh->fEtaVsN->Fill(eta, n);
289 Float_t c = Correction(d,r,s,t,vtxbin,eta,lowFlux);
290 fCorrections->Fill(c);
292 rh->fEvsM->Fill(mult,n);
293 rh->fEtaVsM->Fill(eta, n);
294 rh->fCorr->Fill(eta, c);
296 //if (n < .9) rh->fEmptyStrips->Fill(eta,phi);
297 if (n > 0.9) rh->fBasicHits->Fill(eta,phi);
300 rh->fDensity->Fill(eta,phi,n);
303 //std::cout<<rh->fTotalStrips->GetEntries()<<" "<<rh->fEmptyStrips->GetEntries()<<std::endl;
304 // Loop over poisson histograms
305 for (Int_t ieta = 1; ieta <= h->GetNbinsX(); ieta++) {
306 for (Int_t iphi = 1; iphi <= h->GetNbinsY(); iphi++) {
307 Double_t eLossV = h->GetBinContent(ieta, iphi);
308 // Double_t eLossE = h->GetBinError(ieta, iphi);
309 Float_t eta = h->GetXaxis()->GetBinCenter(ieta);
310 Float_t phi = h->GetYaxis()->GetBinCenter(iphi);
311 Double_t empty = rh->fEmptyStrips->GetBinContent(rh->fEmptyStrips->GetXaxis()->FindBin(eta),
312 rh->fEmptyStrips->GetYaxis()->FindBin(phi)) ;
313 Double_t total = rh->fTotalStrips->GetBinContent(rh->fTotalStrips->GetXaxis()->FindBin(eta),
314 rh->fTotalStrips->GetYaxis()->FindBin(phi));
316 Double_t corr = rh->fCorr->GetBinContent(rh->fCorr->GetXaxis()->FindBin(eta));
319 Double_t hits = rh->fBasicHits->GetBinContent(ieta,iphi);
321 Double_t poissonV = (total <= 0 || empty <= 0 ? 0 :
322 -TMath::Log(empty / total));
324 poissonV = (hits * poissonV) / (1 - TMath::Exp(-1*poissonV));
326 poissonV = poissonV / corr;
330 // std::cout<<"event : "<<total<<" "<<empty<<" "<<hits<<" "<<poissonV<<" "<<eLossV<<std::endl;
331 Double_t poissonE = 0 ;
332 if(poissonV > 0) poissonE = TMath::Sqrt(poissonV);
336 rh->fELossVsPoisson->Fill(eLossV, poissonV);
337 rh->fEmptyVsTotal->Fill(total, empty);
339 h->SetBinContent(ieta,iphi,poissonV);
340 h->SetBinError(ieta,iphi,poissonE);
351 //_____________________________________________________________________
353 AliFMDDensityCalculator::FindMaxWeight(const AliFMDCorrELossFit* cor,
354 UShort_t d, Char_t r, Int_t iEta) const
357 // Find the max weight to use for FMD<i>dr</i> in eta bin @a iEta
365 AliFMDCorrELossFit::ELossFit* fit = cor->GetFit(d,r,iEta);
367 // AliWarning(Form("No energy loss fit for FMD%d%c at eta=%f", d, r, eta));
370 return fit->FindMaxWeight();
373 //_____________________________________________________________________
375 AliFMDDensityCalculator::CacheMaxWeights()
378 // Find the max weights and cache them
380 AliForwardCorrectionManager& fcm = AliForwardCorrectionManager::Instance();
381 AliFMDCorrELossFit* cor = fcm.GetELossFit();
382 const TAxis& eta = cor->GetEtaAxis();
384 Int_t nEta = eta.GetNbins();
391 for (Int_t i = 0; i < nEta; i++) {
392 fFMD1iMax[i] = FindMaxWeight(cor, 1, 'I', i+1);
393 fFMD2iMax[i] = FindMaxWeight(cor, 2, 'I', i+1);
394 fFMD2oMax[i] = FindMaxWeight(cor, 2, 'O', i+1);
395 fFMD3iMax[i] = FindMaxWeight(cor, 3, 'I', i+1);
396 fFMD3oMax[i] = FindMaxWeight(cor, 3, 'O', i+1);
400 //_____________________________________________________________________
402 AliFMDDensityCalculator::GetMaxWeight(UShort_t d, Char_t r, Int_t iEta) const
405 // Find the (cached) maximum weight for FMD<i>dr</i> in
406 // @f$\eta@f$ bin @a iEta
414 // max weight or <= 0 in case of problems
416 if (iEta < 0) return -1;
418 const TArrayI* max = 0;
420 case 1: max = &fFMD1iMax; break;
421 case 2: max = (r == 'I' || r == 'i' ? &fFMD2iMax : &fFMD2oMax); break;
422 case 3: max = (r == 'I' || r == 'i' ? &fFMD3iMax : &fFMD3oMax); break;
425 AliWarning(Form("No array for FMD%d%c", d, r));
429 if (iEta >= max->fN) {
430 AliWarning(Form("Eta bin %3d out of bounds [0,%d]",
435 AliDebug(30,Form("Max weight for FMD%d%c eta bin %3d: %d", d, r, iEta,
437 return max->At(iEta);
440 //_____________________________________________________________________
442 AliFMDDensityCalculator::GetMaxWeight(UShort_t d, Char_t r, Float_t eta) const
445 // Find the (cached) maximum weight for FMD<i>dr</i> iat
454 // max weight or <= 0 in case of problems
456 AliForwardCorrectionManager& fcm = AliForwardCorrectionManager::Instance();
457 Int_t iEta = fcm.GetELossFit()->FindEtaBin(eta) -1;
459 return GetMaxWeight(d, r, iEta);
462 //_____________________________________________________________________
464 AliFMDDensityCalculator::NParticles(Float_t mult,
471 Bool_t lowFlux) const
474 // Get the number of particles corresponding to the signal mult
481 // t Strip (not used)
483 // eta Pseudo-rapidity
484 // lowFlux Low-flux flag
487 // The number of particles
489 if (mult <= GetMultCut()) return 0;
490 if (lowFlux) return 1;
492 AliForwardCorrectionManager& fcm = AliForwardCorrectionManager::Instance();
493 AliFMDCorrELossFit::ELossFit* fit = fcm.GetELossFit()->FindFit(d,r,eta);
495 AliWarning(Form("No energy loss fit for FMD%d%c at eta=%f", d, r, eta));
499 Int_t m = GetMaxWeight(d,r,eta); // fit->FindMaxWeight();
501 AliWarning(Form("No good fits for FMD%d%c at eta=%f", d, r, eta));
504 UShort_t n = TMath::Min(fMaxParticles, UShort_t(m));
505 Double_t ret = fit->EvaluateWeighted(mult, n);
508 AliInfo(Form("FMD%d%c, eta=%7.4f, %8.5f -> %8.5f", d, r, eta, mult, ret));
511 fWeightedSum->Fill(ret);
512 fSumOfWeights->Fill(ret);
517 //_____________________________________________________________________
519 AliFMDDensityCalculator::Correction(UShort_t d,
525 Bool_t lowFlux) const
528 // Get the inverse correction factor. This consist of
530 // - acceptance correction (corners of sensors)
531 // - double hit correction (for low-flux events)
532 // - dead strip correction
538 // t Strip (not used)
540 // eta Pseudo-rapidity
541 // lowFlux Low-flux flag
546 AliForwardCorrectionManager& fcm = AliForwardCorrectionManager::Instance();
548 Float_t correction = AcceptanceCorrection(r,t);
551 if (fcm.GetDoubleHit())
552 dblHitCor = fcm.GetDoubleHit()->GetCorrection(d,r);
555 Double_t dblC = dblHitCor->GetBinContent(dblHitCor->FindBin(eta));
556 if (dblC > 0) correction *= dblC;
559 AliWarning(Form("Missing double hit correction for FMD%d%c",d,r));
565 //_____________________________________________________________________
567 AliFMDDensityCalculator::GenerateAcceptanceCorrection(Char_t r) const
570 // Generate the acceptance corrections
573 // r Ring to generate for
576 // Newly allocated histogram of acceptance corrections
578 const Double_t ic1[] = { 4.9895, 15.3560 };
579 const Double_t ic2[] = { 1.8007, 17.2000 };
580 const Double_t oc1[] = { 4.2231, 26.6638 };
581 const Double_t oc2[] = { 1.8357, 27.9500 };
582 const Double_t* c1 = (r == 'I' || r == 'i' ? ic1 : oc1);
583 const Double_t* c2 = (r == 'I' || r == 'i' ? ic2 : oc2);
584 Double_t minR = (r == 'I' || r == 'i' ? 4.5213 : 15.4);
585 Double_t maxR = (r == 'I' || r == 'i' ? 17.2 : 28.0);
586 Int_t nStrips = (r == 'I' || r == 'i' ? 512 : 256);
587 Int_t nSec = (r == 'I' || r == 'i' ? 20 : 40);
588 Float_t basearc = 2 * TMath::Pi() / nSec;
589 Double_t rad = maxR - minR;
590 Float_t segment = rad / nStrips;
591 Float_t cr = TMath::Sqrt(c1[0]*c1[0]+c1[1]*c1[1]);
593 // Numbers used to find end-point of strip.
594 // (See http://mathworld.wolfram.com/Circle-LineIntersection.html)
595 Float_t D = c1[0] * c2[1] - c1[1] * c2[0];
596 Float_t dx = c2[0] - c1[0];
597 Float_t dy = c2[1] - c1[1];
598 Float_t dr = TMath::Sqrt(dx*dx+dy*dy);
600 TH1D* ret = new TH1D(Form("acc%c", r),
601 Form("Acceptance correction for FMDx%c", r),
602 nStrips, -.5, nStrips-.5);
603 ret->SetXTitle("Strip");
604 ret->SetYTitle("#varphi acceptance");
605 ret->SetDirectory(0);
606 ret->SetFillColor(r == 'I' || r == 'i' ? kRed+1 : kBlue+1);
607 ret->SetFillStyle(3001);
609 for (Int_t t = 0; t < nStrips; t++) {
610 Float_t radius = minR + t * segment;
612 // If the radius of the strip is smaller than the radius corresponding
613 // to the first corner we have a full strip length
615 ret->SetBinContent(t+1, 1);
619 // Next, we should find the end-point of the strip - that is,
620 // the coordinates where the line from c1 to c2 intersects a circle
621 // with radius given by the strip.
622 // (See http://mathworld.wolfram.com/Circle-LineIntersection.html)
623 // Calculate the determinant
624 Float_t det = radius * radius * dr * dr - D*D;
627 // <0 means No intersection
628 // =0 means Exactly tangent
629 ret->SetBinContent(t+1, 1);
633 // Calculate end-point and the corresponding opening angle
634 Float_t x = (+D * dy + dx * TMath::Sqrt(det)) / dr / dr;
635 Float_t y = (-D * dx + dy * TMath::Sqrt(det)) / dr / dr;
636 Float_t th = TMath::ATan2(x, y);
638 ret->SetBinContent(t+1, th / basearc);
643 //_____________________________________________________________________
645 AliFMDDensityCalculator::AcceptanceCorrection(Char_t r, UShort_t t) const
648 // Get the acceptance correction for strip @a t in an ring of type @a r
651 // r Ring type ('I' or 'O')
655 // Inverse acceptance correction
657 TH1D* acc = (r == 'I' || r == 'i' ? fAccI : fAccO);
658 return acc->GetBinContent(t+1);
661 //____________________________________________________________________
663 AliFMDDensityCalculator::ScaleHistograms(const TList* dir, Int_t nEvents)
666 // Scale the histograms to the total number of events
669 // dir where to put the output
670 // nEvents Number of events
672 if (nEvents <= 0) return;
673 TList* d = static_cast<TList*>(dir->FindObject(GetName()));
676 TIter next(&fRingHistos);
678 while ((o = static_cast<RingHistos*>(next())))
679 o->ScaleHistograms(d, nEvents);
682 //____________________________________________________________________
684 AliFMDDensityCalculator::DefineOutput(TList* dir)
687 // Output diagnostic histograms to directory
690 // dir List to write in
692 TList* d = new TList;
693 d->SetName(GetName());
695 d->Add(fWeightedSum);
696 d->Add(fSumOfWeights);
697 d->Add(fCorrections);
701 TIter next(&fRingHistos);
703 while ((o = static_cast<RingHistos*>(next()))) {
707 //____________________________________________________________________
709 AliFMDDensityCalculator::Print(Option_t* option) const
717 char ind[gROOT->GetDirLevel()+3];
718 for (Int_t i = 0; i < gROOT->GetDirLevel(); i++) ind[i] = ' ';
719 ind[gROOT->GetDirLevel()] = '\0';
720 std::cout << ind << "AliFMDDensityCalculator: " << GetName() << '\n'
721 << ind << " Multiplicity cut: " << fMultCut << '\n'
722 << ind << " Max(particles): " << fMaxParticles
726 if (opt.Contains("nomax")) return;
728 std::cout << ind << " Max weights:\n";
730 for (UShort_t d=1; d<=3; d++) {
731 UShort_t nr = (d == 1 ? 1 : 2);
732 for (UShort_t q=0; q<nr; q++) {
733 ind[gROOT->GetDirLevel()] = ' ';
734 ind[gROOT->GetDirLevel()+1] = '\0';
735 Char_t r = (q == 0 ? 'I' : 'O');
736 std::cout << ind << " FMD" << d << r << ":";
737 ind[gROOT->GetDirLevel()+1] = ' ';
738 ind[gROOT->GetDirLevel()+2] = '\0';
740 const TArrayI& a = (d == 1 ? fFMD1iMax :
741 (d == 2 ? (r == 'I' ? fFMD2iMax : fFMD2oMax) :
742 (r == 'I' ? fFMD3iMax : fFMD3oMax)));
744 for (Int_t i = 0; i < a.fN; i++) {
745 if (a.fArray[i] < 1) continue;
746 if (j % 6 == 0) std::cout << "\n " << ind;
748 std::cout << " " << std::setw(3) << i << ": " << a.fArray[i];
750 std::cout << std::endl;
755 //====================================================================
756 AliFMDDensityCalculator::RingHistos::RingHistos()
757 : AliForwardUtil::RingHistos(),
775 //____________________________________________________________________
776 AliFMDDensityCalculator::RingHistos::RingHistos(UShort_t d, Char_t r)
777 : AliForwardUtil::RingHistos(d,r),
797 fEvsN = new TH2D(Form("%s_Eloss_N_nocorr", fName.Data()),
798 Form("#Delta E/#Delta E_{mip} vs uncorrected inclusive "
799 "N_{ch} in %s", fName.Data()),
800 2500, -.5, 24.5, 2500, -.5, 24.5);
801 fEvsM = new TH2D(Form("%s_Eloss_N_corr", fName.Data()),
802 Form("#Delta E/#Delta E_{mip} vs corrected inclusive "
803 "N_{ch} in %s", fName.Data()),
804 2500, -.5, 24.5, 2500, -.5, 24.5);
805 fEvsN->SetXTitle("#Delta E/#Delta E_{mip}");
806 fEvsN->SetYTitle("Inclusive N_{ch} (uncorrected)");
808 fEvsN->SetDirectory(0);
809 fEvsM->SetXTitle("#Delta E/#Delta E_{mip}");
810 fEvsM->SetYTitle("Inclusive N_{ch} (corrected)");
812 fEvsM->SetDirectory(0);
814 fEtaVsN = new TProfile(Form("%s_Eta_N_nocorr", fName.Data()),
815 Form("Average inclusive N_{ch} vs #eta (uncorrected) "
816 "in %s", fName.Data()), 200, -4, 6);
817 fEtaVsM = new TProfile(Form("%s_Eta_N_corr", fName.Data()),
818 Form("Average inclusive N_{ch} vs #eta (corrected) "
819 "in %s", fName.Data()), 200, -4, 6);
820 fEtaVsN->SetXTitle("#eta");
821 fEtaVsN->SetYTitle("#LT N_{ch,incl}#GT (uncorrected)");
822 fEtaVsN->SetDirectory(0);
823 fEtaVsN->SetLineColor(Color());
824 fEtaVsN->SetFillColor(Color());
825 fEtaVsM->SetXTitle("#eta");
826 fEtaVsM->SetYTitle("#LT N_{ch,incl}#GT (corrected)");
827 fEtaVsM->SetDirectory(0);
828 fEtaVsM->SetLineColor(Color());
829 fEtaVsM->SetFillColor(Color());
832 fCorr = new TProfile(Form("%s_corr", fName.Data()),
833 Form("Average correction in %s", fName.Data()),
835 fCorr->SetXTitle("#eta");
836 fCorr->SetYTitle("#LT correction#GT");
837 fCorr->SetDirectory(0);
838 fCorr->SetLineColor(Color());
839 fCorr->SetFillColor(Color());
841 fDensity = new TH2D(Form("%s_Incl_Density", fName.Data()),
842 Form("Inclusive N_{ch} density in %s", fName.Data()),
843 200, -4, 6, (r == 'I' || r == 'i' ? 20 : 40),
845 fDensity->SetDirectory(0);
846 fDensity->SetXTitle("#eta");
847 fDensity->SetYTitle("#phi [radians]");
848 fDensity->SetZTitle("Inclusive N_{ch} density");
850 fELossVsPoisson = new TH2D(Form("%s_eloss_vs_poisson", fName.Data()),
851 Form("N_{ch} from energy loss vs from Poission %s",
852 fName.Data()), 100, 0, 20, 100, 0, 20);
853 fELossVsPoisson->SetDirectory(0);
854 fELossVsPoisson->SetXTitle("N_{ch} from #DeltaE");
855 fELossVsPoisson->SetYTitle("N_{ch} from Poisson");
856 fELossVsPoisson->SetZTitle("Correlation");
858 fEmptyVsTotal = new TH2D(Form("%s_empty_vs_total", fName.Data()),
859 Form("# of empty strips vs. total @ # strips in %s",
860 fName.Data()), 21, -.5, 20.5, 21, -0.5, 20.5);
861 fEmptyVsTotal->SetDirectory(0);
862 fEmptyVsTotal->SetXTitle("Total # strips");
863 fEmptyVsTotal->SetYTitle("Empty # strips");
864 fEmptyVsTotal->SetZTitle("Correlation");
866 //____________________________________________________________________
867 AliFMDDensityCalculator::RingHistos::RingHistos(const RingHistos& o)
868 : AliForwardUtil::RingHistos(o),
874 fDensity(o.fDensity),
875 fELossVsPoisson(o.fELossVsPoisson),
876 fTotalStrips(o.fTotalStrips),
877 fEmptyStrips(o.fEmptyStrips),
878 fBasicHits(o.fBasicHits),
879 fEmptyVsTotal(o.fEmptyVsTotal)
885 // o Object to copy from
889 //____________________________________________________________________
890 AliFMDDensityCalculator::RingHistos&
891 AliFMDDensityCalculator::RingHistos::operator=(const RingHistos& o)
894 // Assignment operator
897 // o Object to assign from
902 AliForwardUtil::RingHistos::operator=(o);
904 if (fEvsN) delete fEvsN;
905 if (fEvsM) delete fEvsM;
906 if (fEtaVsN) delete fEtaVsN;
907 if (fEtaVsM) delete fEtaVsM;
908 if (fCorr) delete fCorr;
909 if (fDensity) delete fDensity;
910 if (fELossVsPoisson) delete fELossVsPoisson;
911 if (fTotalStrips) delete fTotalStrips;
912 if (fEmptyStrips) delete fEmptyStrips;
914 fEvsN = static_cast<TH2D*>(o.fEvsN->Clone());
915 fEvsM = static_cast<TH2D*>(o.fEvsM->Clone());
916 fEtaVsN = static_cast<TProfile*>(o.fEtaVsN->Clone());
917 fEtaVsM = static_cast<TProfile*>(o.fEtaVsM->Clone());
918 fCorr = static_cast<TProfile*>(o.fCorr->Clone());
919 fDensity = static_cast<TH2D*>(o.fDensity->Clone());
920 fELossVsPoisson = static_cast<TH2D*>(o.fELossVsPoisson);
921 fTotalStrips = static_cast<TH2D*>(o.fTotalStrips);
922 fEmptyStrips = static_cast<TH2D*>(o.fEmptyStrips);
926 //____________________________________________________________________
927 AliFMDDensityCalculator::RingHistos::~RingHistos()
932 if (fEvsN) delete fEvsN;
933 if (fEvsM) delete fEvsM;
934 if (fEtaVsN) delete fEtaVsN;
935 if (fEtaVsM) delete fEtaVsM;
936 if (fCorr) delete fCorr;
937 if (fDensity) delete fDensity;
938 if (fELossVsPoisson) delete fELossVsPoisson;
939 if (fTotalStrips) delete fTotalStrips;
940 if (fEmptyStrips) delete fEmptyStrips;
943 //____________________________________________________________________
945 AliFMDDensityCalculator::RingHistos::ResetPoissonHistos()
948 fTotalStrips->Reset();
949 fEmptyStrips->Reset();
955 //Float_t nbinlimitsFMD3I[8] = {-3.4,-3.2,-3,-2.8,-2.6,-2.4,-2.2,-2};
957 /*if(fName.Contains("FMD1I")) nbins = 7;
958 if(fName.Contains("FMD2I")) nbins = 8;
959 if(fName.Contains("FMD2O")) nbins = 4;
960 if(fName.Contains("FMD3I")) nbins = 8;
961 if(fName.Contains("FMD3O")) nbins = 4;*/
962 Float_t lowlimit = -4, highlimit = 6;
963 /*if(fName.Contains("FMD1I")) {lowlimit = 3.6; highlimit = 5;}
964 if(fName.Contains("FMD2I")) {lowlimit = 2.2; highlimit = 3.8;}
965 if(fName.Contains("FMD2O")) {lowlimit = 1.6; highlimit = 2.4;}
966 if(fName.Contains("FMD3I")) {lowlimit = -2.4; highlimit = -1.6;}
967 if(fName.Contains("FMD3O")) {lowlimit = -3.5; highlimit = -2.1;}
969 std::cout<<nbins<<" "<<lowlimit<<" "<<highlimit<<std::endl;
971 fTotalStrips = new TH2D(Form("total%s", fName.Data()),
972 Form("Total number of strips in %s", fName.Data()),
976 (fRing == 'I' || fRing == 'i' ? 5 : 10),
978 fEmptyStrips = new TH2D(Form("empty%s", fName.Data()),
979 Form("Empty number of strips in %s", fName.Data()),
983 (fRing == 'I' || fRing == 'i' ? 5 : 10),
985 fBasicHits = new TH2D(Form("basichits%s", fName.Data()),
986 Form("Basic number of hits in %s", fName.Data()),
990 (fRing == 'I' || fRing == 'i' ? 20 : 40),
993 fTotalStrips->SetDirectory(0);
994 fEmptyStrips->SetDirectory(0);
995 fBasicHits->SetDirectory(0);
996 fTotalStrips->SetXTitle("#eta");
997 fEmptyStrips->SetXTitle("#eta");
998 fBasicHits->SetXTitle("#eta");
999 fTotalStrips->SetYTitle("#varphi [radians]");
1000 fEmptyStrips->SetYTitle("#varphi [radians]");
1001 fBasicHits->SetYTitle("#varphi [radians]");
1002 fTotalStrips->Sumw2();
1003 fEmptyStrips->Sumw2();
1004 fBasicHits->Sumw2();
1007 //____________________________________________________________________
1009 AliFMDDensityCalculator::RingHistos::Init(const TAxis& /*eAxis*/)
1011 /*if (fTotalStrips) delete fTotalStrips;
1012 if (fEmptyStrips) delete fEmptyStrips;
1013 if (fBasicHits) delete fBasicHits;
1015 fTotalStrips = new TH2D(Form("total%s", fName.Data()),
1016 Form("Total number of strips in %s", fName.Data()),
1017 eAxis.GetNbins()/5.,
1020 (fRing == 'I' || fRing == 'i' ? 5 : 5),
1022 fEmptyStrips = new TH2D(Form("empty%s", fName.Data()),
1023 Form("Empty number of strips in %s", fName.Data()),
1024 eAxis.GetNbins()/5.,
1027 (fRing == 'I' || fRing == 'i' ? 5 : 10),
1029 fBasicHits = new TH2D(Form("basichits%s", fName.Data()),
1030 Form("Basic number of hits in %s", fName.Data()),
1034 (fRing == 'I' || fRing == 'i' ? 20 : 40),
1037 fTotalStrips->SetDirectory(0);
1038 fEmptyStrips->SetDirectory(0);
1039 fBasicHits->SetDirectory(0);
1040 fTotalStrips->SetXTitle("#eta");
1041 fEmptyStrips->SetXTitle("#eta");
1042 fBasicHits->SetXTitle("#eta");
1043 fTotalStrips->SetYTitle("#varphi [radians]");
1044 fEmptyStrips->SetYTitle("#varphi [radians]");
1045 fBasicHits->SetYTitle("#varphi [radians]");
1046 fTotalStrips->Sumw2();
1047 fEmptyStrips->Sumw2();
1048 fBasicHits->Sumw2();*/
1051 //____________________________________________________________________
1053 AliFMDDensityCalculator::RingHistos::Output(TList* dir)
1059 // dir Where to put it
1061 TList* d = DefineOutputList(dir);
1068 d->Add(fELossVsPoisson);
1069 d->Add(fEmptyVsTotal);
1070 d->Add(fTotalStrips);
1071 d->Add(fEmptyStrips);
1077 //____________________________________________________________________
1079 AliFMDDensityCalculator::RingHistos::ScaleHistograms(TList* dir, Int_t nEvents)
1082 // Scale the histograms to the total number of events
1085 // dir Where the output is
1086 // nEvents Number of events
1088 TList* l = GetOutputList(dir);
1091 TH1* density = GetOutputHist(l,Form("%s_Incl_Density", fName.Data()));
1092 if (density) density->Scale(1./nEvents);
1095 //____________________________________________________________________