2 // This class collects the event histograms into single histograms,
3 // one for each ring in each vertex bin.
6 // - AliESDFMD object possibly corrected for sharing
9 // - 5 RingHistos objects - each with a number of vertex dependent
10 // 2D histograms of the inclusive charge particle density
12 // HistCollector used:
13 // - AliFMDCorrSecondaryMap
15 #include "AliFMDHistCollector.h"
16 #include <AliESDFMD.h>
20 #include "AliForwardCorrectionManager.h"
21 #include "AliFMDCorrSecondaryMap.h"
27 #include <TProfile2D.h>
28 #include <TObjArray.h>
34 ClassImp(AliFMDHistCollector)
39 //____________________________________________________________________
40 AliFMDHistCollector::AliFMDHistCollector()
48 fMergeMethod(kStraightMean),
49 fFiducialMethod(kByCut),
56 DGUARD(fDebug, 3, "Default CTOR of AliFMDHistCollector");
59 //____________________________________________________________________
60 AliFMDHistCollector::AliFMDHistCollector(const char* title)
61 : TNamed("fmdHistCollector", title),
69 fMergeMethod(kStraightMean),
70 fFiducialMethod(kByCut),
77 DGUARD(fDebug, 3, "Named CTOR of AliFMDHistCollector: %s", title);
79 //____________________________________________________________________
80 AliFMDHistCollector::AliFMDHistCollector(const AliFMDHistCollector& o)
82 fNCutBins(o.fNCutBins),
83 fCorrectionCut(o.fCorrectionCut),
86 fSumRings(o.fSumRings),
87 fCoverage(o.fCoverage),
89 fMergeMethod(o.fMergeMethod),
90 fFiducialMethod(o.fFiducialMethod),
91 fSkipFMDRings(o.fSkipFMDRings),
92 fBgAndHitMaps(o.fBgAndHitMaps),
95 fDoByCent(o.fDoByCent)
97 DGUARD(fDebug, 3, "Copy CTOR of AliFMDHistCollector");
100 //____________________________________________________________________
101 AliFMDHistCollector::~AliFMDHistCollector()
103 DGUARD(fDebug, 3, "DTOR of AliFMDHistCollector");
104 // if (fList) delete fList;
106 //____________________________________________________________________
108 AliFMDHistCollector::operator=(const AliFMDHistCollector& o)
111 // Assignement operator
114 // o Object to assign from
117 // Reference to this object
119 DGUARD(fDebug, 3, "Assignment of AliFMDHistCollector");
120 if (&o == this) return *this;
121 TNamed::operator=(o);
123 fNCutBins = o.fNCutBins;
124 fCorrectionCut = o.fCorrectionCut;
127 fSumRings = o.fSumRings;
128 fCoverage = o.fCoverage;
129 fSkipped = o.fSkipped;
130 fMergeMethod = o.fMergeMethod;
131 fFiducialMethod = o.fFiducialMethod;
132 fSkipFMDRings = o.fSkipFMDRings;
133 fBgAndHitMaps = o.fBgAndHitMaps;
134 fVtxList = o.fVtxList;
136 fDoByCent = o.fDoByCent;
140 //____________________________________________________________________
142 AliFMDHistCollector::SetupForData(const TAxis& vtxAxis,
143 const TAxis& etaAxis)
149 // vtxAxis Vertex axis
151 DGUARD(fDebug, 1, "Initialization of AliFMDHistCollector");
153 // AliForwardCorrectionManager& fcm = AliForwardCorrectionManager::Instance();
155 fSumRings = new TH2D("sumRings", "Sum in individual rings",
156 etaAxis.GetNbins(), etaAxis.GetXmin(), etaAxis.GetXmax(),
159 fSumRings->SetDirectory(0);
160 fSumRings->SetXTitle("#eta");
161 fSumRings->GetYaxis()->SetBinLabel(1,"FMD1i");
162 fSumRings->GetYaxis()->SetBinLabel(2,"FMD2i");
163 fSumRings->GetYaxis()->SetBinLabel(3,"FMD2o");
164 fSumRings->GetYaxis()->SetBinLabel(4,"FMD3i");
165 fSumRings->GetYaxis()->SetBinLabel(5,"FMD3o");
166 fList->Add(fSumRings);
168 fCoverage = new TH2D("coverage", "#eta coverage per v_{z}",
169 etaAxis.GetNbins(),etaAxis.GetXmin(),etaAxis.GetXmax(),
170 vtxAxis.GetNbins(),vtxAxis.GetXmin(),vtxAxis.GetXmax());
171 fCoverage->SetDirectory(0);
172 fCoverage->SetXTitle("#eta");
173 fCoverage->SetYTitle("v_{z} [cm]");
174 fCoverage->SetZTitle("n_{bins}");
175 fList->Add(fCoverage);
177 fSkipped = new TH1D("skipped", "Rings skipped", 5, 1, 6);
178 fSkipped->SetDirectory(0);
179 fSkipped->SetFillColor(kRed+1);
180 fSkipped->SetFillStyle(3001);
181 fSkipped->SetYTitle("Events");
182 fSkipped->GetXaxis()->SetBinLabel(1,"FMD1i");
183 fSkipped->GetXaxis()->SetBinLabel(2,"FMD2i");
184 fSkipped->GetXaxis()->SetBinLabel(3,"FMD2o");
185 fSkipped->GetXaxis()->SetBinLabel(4,"FMD3i");
186 fSkipped->GetXaxis()->SetBinLabel(5,"FMD3o");
187 fList->Add(fSkipped);
189 // --- Add parameters to output ------------------------------------
190 fList->Add(AliForwardUtil::MakeParameter("nCutBins",fNCutBins));
191 fList->Add(AliForwardUtil::MakeParameter("skipRings",fSkipFMDRings));
192 fList->Add(AliForwardUtil::MakeParameter("bgAndHits",fBgAndHitMaps));
193 fList->Add(AliForwardUtil::MakeParameter("fiducial",Int_t(fFiducialMethod)));
194 fList->Add(AliForwardUtil::MakeParameter("fiducialCut",fCorrectionCut));
195 fList->Add(AliForwardUtil::MakeParameter("merge",Int_t(fMergeMethod)));
197 UShort_t nVz = vtxAxis.GetNbins();
198 fVtxList = new TObjArray(nVz, 1);
199 fVtxList->SetName("histCollectorVtxBins");
200 fVtxList->SetOwner();
202 // Find the eta bin ranges
203 for (UShort_t iVz = 1; iVz <= nVz; iVz++) {
204 Double_t vMin = vtxAxis.GetBinLowEdge(iVz);
205 Double_t vMax = vtxAxis.GetBinUpEdge(iVz);
206 VtxBin* bin = new VtxBin(iVz, vMin, vMax, fNCutBins);
207 fVtxList->AddAt(bin, iVz);
209 bin->SetupForData(fCoverage, fSkipFMDRings, fFiducialMethod,
210 fCorrectionCut, fList, etaAxis,
211 fBgAndHitMaps, fBgAndHitMaps);
214 if (!fDoByCent) return;
217 fByCent->SetName("byCentrality");
222 Double_t minCent = -.5;
223 Double_t maxCent = 100.5;
224 for (Int_t i = 0; i < 5; i++) {
229 TH3* h = new TH3D(Form("FMD%d%c", d, r),
230 Form("dN/d#eta per centrality for FMD%d%c", d, r),
231 etaAxis.GetNbins(), etaAxis.GetXmin(), etaAxis.GetXmax(),
232 nCent, minCent, maxCent, 1, 0, 1);
233 h->SetXTitle("#eta");
234 h->SetYTitle("Centrality [%]");
235 h->SetZTitle("dN/d#eta");
237 h->SetMarkerColor(AliForwardUtil::RingColor(d, r));
238 h->SetMarkerStyle(20);
242 //____________________________________________________________________
244 AliFMDHistCollector::CheckCorrection(FiducialMethod m,
251 // Check if we should include the bin in the data range
254 // bg Secondary map histogram
259 // True if to be used
261 Double_t c = bg->GetBinContent(ie,ip);
266 if (2 * c < bg->GetBinContent(ie+1,ip) ||
267 2 * c < bg->GetBinContent(ie-1,ip)) return false;
270 AliErrorClass("No fiducal cut method defined");
275 //____________________________________________________________________
277 AliFMDHistCollector::CreateOutputObjects(TList* dir)
280 // Output diagnostic histograms to directory
283 // dir List to write in
285 DGUARD(fDebug, 1, "Define output of AliFMDHistCollector");
288 fList->SetName(GetName());
293 //____________________________________________________________________
295 AliFMDHistCollector::CheckSkip(UShort_t d, Char_t r, UShort_t skips)
297 UShort_t q = (r == 'I' || r == 'i' ? 0 : 1);
298 UShort_t c = 1 << (d-1);
299 UShort_t t = 1 << (c+q-1);
301 return (t & skips) == t;
304 //____________________________________________________________________
306 AliFMDHistCollector::GetIdx(UShort_t d, Char_t r)
309 // Get the ring index from detector number and ring identifier
316 // ring index or -1 in case of problems
320 case 1: idx = 0; break;
321 case 2: idx = 1 + (r == 'I' || r == 'i' ? 0 : 1); break;
322 case 3: idx = 3 + (r == 'I' || r == 'i' ? 0 : 1); break;
326 //____________________________________________________________________
328 AliFMDHistCollector::GetDetRing(Int_t idx, UShort_t& d, Char_t& r)
331 // Get the detector and ring from the ring index
335 // d On return, the detector or 0 in case of errors
336 // r On return, the ring id or '0' in case of errors
341 case 0: d = 1; r = 'I'; break;
342 case 1: d = 2; r = 'I'; break;
343 case 2: d = 2; r = 'O'; break;
344 case 3: d = 3; r = 'I'; break;
345 case 4: d = 3; r = 'O'; break;
349 //____________________________________________________________________
350 AliFMDHistCollector::VtxBin*
351 AliFMDHistCollector::GetVtxBin(Int_t ivtx)
354 // vtxBin Vertex bin (1 based)
355 if (!fVtxList) return 0;
356 if (ivtx < 1 || ivtx > fVtxList->GetEntriesFast()) return 0;
357 VtxBin* bin = static_cast<VtxBin*>(fVtxList->At(ivtx));
360 //____________________________________________________________________
361 const AliFMDHistCollector::VtxBin*
362 AliFMDHistCollector::GetVtxBin(Int_t ivtx) const
365 // vtxBin Vertex bin (1 based)
366 if (!fVtxList) return 0;
367 if (ivtx < 1 || ivtx > fVtxList->GetEntriesFast()) return 0;
368 VtxBin* bin = static_cast<VtxBin*>(fVtxList->At(ivtx));
372 //____________________________________________________________________
374 AliFMDHistCollector::MergeBins(MergeMethod m,
375 Double_t c, Double_t e,
376 Double_t oc, Double_t oe,
377 Double_t& rc, Double_t& re)
380 // Merge bins accoring to set method
387 // rc On return, the new content
388 // re On return, tne new error
393 case kPreferInner: // We only get these two when there's an overlap
394 case kPreferOuter: // between like rings, and we should do a straight mean
395 // calculate the average of old value (half the original),
396 // and this value, as well as the summed squared errors
397 // of the existing content (sqrt((e_1/2)^2=sqrt(e_1^2/4)=e_1/2)
398 // and half the error of this.
400 // So, on the first overlapping histogram we get
403 // e = sqrt((e_1 / 2)^2) = e_1/2
405 // On the second we get
407 // c' = c_2 / 2 + c = c_2 / 2 + c_1 / 2 = (c_1+c_2)/2
408 // e' = sqrt(e^2 + (e_2/2)^2)
409 // = sqrt(e_1^2/4 + e_2^2/4)
410 // = sqrt(1/4 * (e_1^2+e_2^2))
411 // = 1/2 * sqrt(e_1^2 + e_2^2)
413 re = TMath::Sqrt(oe*oe+(e*e)/4);
415 case kStraightMeanNoZero:
416 // If there's data in the overlapping histogram,
417 // calculate the average and add the errors in
420 // If there's no data in the overlapping histogram,
421 // then just fill in the data
424 re = TMath::Sqrt(oe*oe + e*e)/2;
431 case kWeightedMean: {
432 // Calculate the weighted mean
433 Double_t w = 1/(e*e);
437 Double_t ow = 1/(oe*oe);
442 re = TMath::Sqrt(1 / sw);
457 re = TMath::Sqrt(oe * oe + e * e);//Add in quadarature
460 AliErrorClass("No method for defining content of overlapping bins defined");
465 //____________________________________________________________________
467 AliFMDHistCollector::Collect(const AliForwardUtil::Histos& hists,
468 AliForwardUtil::Histos& sums,
476 // Do the calculations
479 // hists Cache of histograms
480 // vtxBin Vertex bin (1 based)
481 // out Output histogram
486 DGUARD(fDebug, 1, "Collect final histogram of AliFMDHistCollector");
487 // AliForwardCorrectionManager& fcm = AliForwardCorrectionManager::Instance();
488 // const TAxis* vtxAxis = fcm.GetVertexAxis();
489 // Double_t vMin = vtxAxis->GetBinLowEdge(vtxbin);
490 // Double_t vMax = vtxAxis->GetBinUpEdge(vtxbin);
491 VtxBin* bin = GetVtxBin(vtxbin);
492 if (!bin) return false;
493 Bool_t ret = bin->Collect(hists, sums, out, fSumRings, fSkipped, cent,
494 fMergeMethod, fSkipFMDRings,
495 fByCent, eta2phi, add);
500 #define PF(N,V,...) \
501 AliForwardUtil::PrintField(N,V, ## __VA_ARGS__)
502 #define PFB(N,FLAG) \
504 AliForwardUtil::PrintName(N); \
505 std::cout << std::boolalpha << (FLAG) << std::noboolalpha << std::endl; \
507 #define PFV(N,VALUE) \
509 AliForwardUtil::PrintName(N); \
510 std::cout << (VALUE) << std::endl; } while(false)
512 //____________________________________________________________________
514 AliFMDHistCollector::Print(Option_t* /* option */) const
522 TString merge("unknown");
523 switch (fMergeMethod) {
524 case kStraightMean: merge = "straight mean"; break;
525 case kStraightMeanNoZero: merge = "straight mean (no zeros)"; break;
526 case kWeightedMean: merge = "weighted mean"; break;
527 case kLeastError: merge = "least error"; break;
528 case kSum: merge = "straight sum"; break;
529 case kPreferInner: merge = "prefer inners"; break;
530 case kPreferOuter: merge = "prefer outers"; break;
533 AliForwardUtil::PrintTask(*this);
534 gROOT->IncreaseDirLevel();
535 PFV("# of cut bins", fNCutBins );
536 PFV("Fiducal method", (fFiducialMethod == kByCut ? "cut" : "distance"));
537 PFV("Fiducial cut", fCorrectionCut );
538 PFV("Merge method", merge);
541 gROOT->DecreaseDirLevel();
545 for (Int_t i = 0; i < gROOT->GetDirLevel(); i++) ind[i] = ' ';
546 ind[gROOT->GetDirLevel()] = '\0';
548 std::cout << ind << "Bin ranges:\n" << ind << " rings | Range ";
549 Int_t nVz = fVtxList->GetEntriesFast();
550 for (Int_t iIdx = 0; iIdx < 5; iIdx++) {
553 GetDetRing(iIdx, d, r);
554 std::cout << ind << " | FMD" << d << r << " ";
556 std::cout << '\n' << ind << " /vz_bin |-----------";
557 for (Int_t iIdx = 0; iIdx < 5; iIdx++)
558 std::cout << "-+--------";
559 std::cout << std::endl;
561 for (UShort_t iVz = 1; iVz <= nVz; iVz++) {
562 const VtxBin* bin = GetVtxBin(iVz);
564 std::cout << " " << std::right << std::setw(6) << iVz << " | "
565 << std::setw(3) << bin->fLow << " - " << std::left
566 << std::setw(3) << bin->fHigh << " ";
567 for (Int_t iIdx = 0; iIdx < 5; iIdx++) {
569 bin->GetFirstAndLast(iIdx, first, last);
570 std::cout << " | " << std::setw(3) << first << "-"
571 << std::setw(3) << last;
573 std::cout << std::endl;
575 gROOT->DecreaseDirLevel();
578 //____________________________________________________________________
579 AliFMDHistCollector::VtxBin::VtxBin(Int_t idx, Double_t minIpZ, Double_t maxIpZ,
590 //____________________________________________________________________
591 AliFMDHistCollector::VtxBin::VtxBin(const VtxBin& o)
597 fFirstBin(o.fFirstBin),
598 fLastBin(o.fLastBin),
599 fNCutBins(o.fNCutBins)
602 //____________________________________________________________________
603 AliFMDHistCollector::VtxBin&
604 AliFMDHistCollector::VtxBin::operator=(const VtxBin& o)
606 if (&o == this) return *this;
611 fFirstBin = o.fFirstBin;
612 fLastBin = o.fLastBin;
613 fNCutBins = o.fNCutBins;
616 //____________________________________________________________________
618 AliFMDHistCollector::VtxBin::GetName() const
620 return Form("%c%03d_%c%03d",
621 (fLow >= 0 ? 'p' : 'm'), Int_t(TMath::Abs(fLow)),
622 (fHigh >= 0 ? 'p' : 'm'), Int_t(TMath::Abs(fHigh)));
624 //____________________________________________________________________
626 AliFMDHistCollector::VtxBin::SetupForData(TH2* coverage,
628 FiducialMethod fiducial,
631 const TAxis& etaAxis,
636 if (doHitMaps || storeSecMap) {
638 out->SetName(GetName());
643 fHitMap = new AliForwardUtil::Histos();
644 fHitMap->Init(etaAxis);
649 AliForwardCorrectionManager& fcm = AliForwardCorrectionManager::Instance();
651 for (Int_t iIdx = 0; iIdx < 5; iIdx++) {
654 GetDetRing(iIdx, d, r);
656 // Skipping selected FMD rings
657 if (CheckSkip(d, r, skips)) continue;
659 // Get the background object
660 TH2D* bg = fcm.GetSecondaryMap()->GetCorrection(d,r,UShort_t(fIndex));
661 Int_t nEta = bg->GetNbinsX();
662 Int_t first = nEta+1;
665 // Loop over the eta bins
666 for (Int_t ie = 1; ie <= nEta; ie++) {
667 // Loop over the phi bins to make sure that we
668 // do not have holes in the coverage
670 for (Int_t ip = 1; ip <= bg->GetNbinsY(); ip++) {
671 if (!CheckCorrection(fiducial, cut, bg, ie, ip)) {
678 first = TMath::Min(ie, first);
679 last = TMath::Max(ie, last);
681 // Store result of first/last bin for this ring
682 fFirstBin[iIdx] = first;
683 fLastBin[iIdx] = last;
686 TH2* h = fHitMap->Get(d, r);
688 h->SetName(Form("hitMapFMD%d%c", d, r));
689 // if (r == 'O') h->RebinY(2);
695 obg = static_cast<TH2D*>(bg->Clone(Form("secMapFMD%d%c", d, r)));
696 obg->SetDirectory(0);
700 // Fill diagnostics histograms
701 for (Int_t ie = first+fNCutBins; ie <= last-fNCutBins; ie++) {
702 Double_t old = coverage->GetBinContent(ie, fIndex);
703 coverage->SetBinContent(ie, fIndex, old+1);
705 for (Int_t ip = 1; ip <= bg->GetNbinsY(); ip++) {
706 obg->SetBinContent(ie, ip, bg->GetBinContent(ie, ip));
707 obg->SetBinError(ie, ip, bg->GetBinError(ie, ip));
714 //____________________________________________________________________
716 AliFMDHistCollector::VtxBin::GetFirstAndLast(Int_t idx,
720 // Get the first and last eta bin to use for a given ring and vertex
723 // idx Ring index as given by GetIdx
724 // first On return, the first eta bin to use
725 // last On return, the last eta bin to use
730 if (idx < 0 || idx >= fFirstBin.GetSize()) return;
732 first = fFirstBin.At(idx)+fNCutBins;
733 last = fLastBin.At(idx)-fNCutBins;
735 //____________________________________________________________________
737 AliFMDHistCollector::VtxBin::GetFirst(Int_t idx) const
740 GetFirstAndLast(idx, first , last);
743 //____________________________________________________________________
745 AliFMDHistCollector::VtxBin::GetLast(Int_t idx) const
748 GetFirstAndLast(idx, first , last);
752 #define PRINT_OVERFLOW(D,R,T,H) do { \
753 printf("Content of FMD%d%c overflow %s rebinning", D, R, T); \
755 for (Int_t ix = 1; ix <= t->GetNbinsX(); ix++) { \
756 Double_t c = t->GetBinContent(ix, t->GetNbinsY()+1); \
757 if (c <= 1e-9) continue; \
758 if ((i % 10) == 0) printf("\n "); \
759 printf("%3d: %5.2f ", ix, c); \
765 //____________________________________________________________________
767 AliFMDHistCollector::VtxBin::Collect(const AliForwardUtil::Histos& hists,
768 AliForwardUtil::Histos& sums,
779 for (UShort_t d=1; d<=3; d++) {
780 UShort_t nr = (d == 1 ? 1 : 2);
781 for (UShort_t q=0; q<nr; q++) {
782 Char_t r = (q == 0 ? 'I' : 'O');
783 Int_t i = (d == 1 ? 1 : 2*d + (q == 0 ? -2 : -1));
784 TH2D* h = hists.Get(d,r);
785 if (CheckSkip(d, r, skips) || !h ||
786 h->TestBit(AliForwardUtil::kSkipRing)) {
787 // Skipping a ring - either because disable, not there, or
788 // because of flagged (too many outliers, ...)
792 TH2D* o = sums.Get(d, r);
793 TH2D* t = static_cast<TH2D*>(h->Clone(Form("FMD%d%c_tmp",d,r)));
798 GetFirstAndLast(d, r, first, last);
800 // Zero outside valid range
801 Int_t nY = t->GetNbinsY();
802 Int_t nX = t->GetNbinsX();
803 for (Int_t iPhi = 0; iPhi <= nY+1; iPhi++) {
805 for (Int_t iEta = 1; iEta < first; iEta++) {
806 t->SetBinContent(iEta,iPhi,0);
807 t->SetBinError(iEta,iPhi,0);
809 for (Int_t iEta = last+1; iEta <= nX; iEta++) {
810 t->SetBinContent(iEta,iPhi,0);
811 t->SetBinError(iEta,iPhi,0);
814 // Fill under-flow bins with eta coverage
815 for (Int_t iEta = first; iEta <= last; iEta++)
816 t->SetBinContent(iEta,0,1);
818 for (Int_t iEta = first; iEta <= last; iEta++)
819 t->SetBinContent(iEta,nY+1,1);
823 // Add to our per-ring sum
826 // If we store hit maps, update here
827 if (fHitMap) fHitMap->Get(d, r)->Add(t);
831 TH3* dNdetaCent = static_cast<TH3*>(byCent->At(i-1));
832 if (cent >= 0 && dNdetaCent) {
833 Int_t iCent = dNdetaCent->GetYaxis()->FindBin(cent);
835 if (iCent > 0 && iCent <= dNdetaCent->GetNbinsY()) {
836 // Make a projection of data
837 TH1* proj = static_cast<TH1*>(t->ProjectionX("tmp", 1, nY));
838 proj->SetDirectory(0);
839 for (Int_t iEta = 1; iEta <= nX; iEta++) {
840 Double_t v1 = proj->GetBinContent(iEta);
841 Double_t e1 = proj->GetBinError(iEta);
842 Double_t v2 = dNdetaCent->GetBinContent(iEta, iCent, 1);
843 Double_t e2 = dNdetaCent->GetBinError(iEta, iCent, 1);
844 dNdetaCent->SetBinContent(iEta,iCent,1, v1+v2);
845 dNdetaCent->SetBinError(iEta,iCent,1, TMath::Sqrt(e1*e1+e2*e2));
847 // Check under-/overflow bins
848 Double_t uF = t->GetBinContent(iEta, 0);
849 Double_t oF = t->GetBinContent(iEta, nY+1);
851 Double_t old = dNdetaCent->GetBinContent(iEta, iCent, 0);
852 dNdetaCent->SetBinContent(iEta, iCent, 0, old + uF);
855 Double_t old = dNdetaCent->GetBinContent(iEta, iCent, 2);
856 dNdetaCent->SetBinContent(iEta, iCent, 2, old + oF);
865 // Outer rings have better phi segmentation - rebin to same as inner.
867 // PRINT_OVERFLOW(d, r, "before", t);
869 // PRINT_OVERFLOW(d, r, "after", t);
874 // Now update profile output
875 for (Int_t iEta = first; iEta <= last; iEta++) {
877 // Get the possibly overlapping histogram
878 Int_t overlap = GetOverlap(d,r,iEta);
881 MergeMethod mm = m; // Possibly override method locally
883 if (m != kSum && overlap >= 0) {
884 // Default is to average
886 if (m == kPreferInner) {
887 // Current one is an outer overlapping an inner
888 if ((r == 'o' || r == 'O') &&
889 (overlap == 0 || overlap == 1 || overlap == 3))
890 // Do not use this signal
892 // Current one is inner overlapping an outer
893 else if ((r == 'i' || r == 'I') && (overlap == 2 || overlap == 4))
897 // In case of two overlapping inners
900 else if (m == kPreferOuter) {
901 // Current one is an inner overlapping an outer
902 if ((r == 'i' || r == 'I') && (overlap == 2 || overlap == 4))
903 // Do not use this signal
905 else if ((r == 'O' || r == 'o') &&
906 (overlap == 0 || overlap == 1 || overlap == 3))
909 // In case of two overlapping outers
914 // Fill eta acceptance for this event into the phi underflow bin
915 Float_t ooc = out.GetBinContent(iEta,0);
916 out.SetBinContent(iEta, 0, ooc + fac);
918 // Fill phi acceptance for this event into the phi overflow bin
919 Float_t oop = out.GetBinContent(iEta,nY+1);
920 Float_t nop = t->GetBinContent(iEta,nY+1);
922 Info("", "etaBin=%3d Setting phi acceptance to %f(%f+%f)=%f",
923 iEta, fac, oop, nop, fac*(oop+nop));
925 out.SetBinContent(iEta, nY+1, fac * nop + oop);
927 // Should we loop over h or t Y bins - I think it's t
928 for (Int_t iPhi = 1; iPhi <= nY; iPhi++) {
929 Double_t c = t->GetBinContent(iEta,iPhi);
930 Double_t e = t->GetBinError(iEta,iPhi);
931 Double_t ee = t->GetXaxis()->GetBinCenter(iEta);
932 sumRings->Fill(ee, i, c);
934 // If there's no signal or the signal was ignored because we
935 // prefer the inners/outers, continue if (e <= 0) continue;
936 if (fac <= 0 || c <= 0 || e <= 0) continue;
938 // If there's no overlapping histogram (ring) or if we
939 // prefer inner/outer, then fill in data and continue to the
941 if (overlap < 0 || fac >= 1) {
942 out.SetBinContent(iEta,iPhi,c);
943 out.SetBinError(iEta,iPhi,e);
947 // Get the current bin content and error
948 Double_t oc = out.GetBinContent(iEta,iPhi);
949 Double_t oe = out.GetBinError(iEta,iPhi);
952 MergeBins(mm, c, e, oc, oe, rc, re);
953 out.SetBinContent(iEta,iPhi, rc);
954 out.SetBinError(iEta,iPhi, re);
957 // Remove temporary histogram
963 //____________________________________________________________________
965 AliFMDHistCollector::VtxBin::GetOverlap(UShort_t d, Char_t r,
969 // Get the possibly overlapping histogram of eta bin @a e in
976 // v Vertex bin (1 based)
979 // Overlapping histogram index or -1
984 if (bin <= GetLast(2,'I')) other = GetIdx(2,'I');
986 else if (d == 2 && r == 'I') {
987 if (bin <= GetLast(2, 'O')) other = GetIdx(2, 'O');
988 else if (bin >= GetFirst(1, 'I')) other = GetIdx(1, 'I');
990 else if (d == 2 && r == 'O') {
991 if (bin >= GetFirst(2, 'I')) other = GetIdx(2,'I');
993 else if (d == 3 && r == 'O') {
994 if (bin <= GetLast(3, 'I')) other = GetIdx(3, 'I');
996 else if (d == 3 && r == 'I') {
997 if (bin >= GetFirst(3, 'O')) other = GetIdx(3, 'O');
999 // AliInfo(Form("FMD%d%c (%d) -> %d", d, r, GetIdx(d,r), other));
1004 //____________________________________________________________________