2 // Class to do the sharing correction. That is, a filter that merges
3 // adjacent strip signals presumably originating from a single particle
4 // that impinges on the detector in such a way that it deposite energy
5 // into two or more strips.
8 // - AliESDFMD object - from reconstruction
11 // - AliESDFMD object - copy of input, but with signals merged
14 // - AliFMDCorrELossFit
17 // - For each ring (FMD1i, FMD2i, FMD2o, FMD3i, FMD3o) the distribution of
18 // signals before and after the filter.
19 // - For each ring (see above), an array of distributions of number of
20 // hit strips for each vertex bin (if enabled - see Init method)
24 #include "AliFMDSharingFilter.h"
25 #include <AliESDFMD.h>
30 #include "AliForwardCorrectionManager.h"
31 #include "AliFMDCorrELossFit.h"
35 #include <TParameter.h>
39 ClassImp(AliFMDSharingFilter)
41 ; // This is for Emacs
45 do { if (L>fDebug)break; std::cout << (M) << std::flush;} while(false)
47 do { if (L>fDebug)break; std::cout << (M) << std::endl;} while(false)
51 //____________________________________________________________________
52 AliFMDSharingFilter::AliFMDSharingFilter()
55 fCorrectAngles(kFALSE),
61 fZeroSharedHitsBelowThreshold(false),
64 fUseSimpleMerging(false),
65 fThreeStripSharing(true),
66 fRecalculateEta(false)
69 // Default Constructor - do not use
71 DGUARD(fDebug,1, "Default CTOR for AliFMDSharingFilter");
74 //____________________________________________________________________
75 AliFMDSharingFilter::AliFMDSharingFilter(const char* title)
76 : TNamed("fmdSharingFilter", title),
78 fCorrectAngles(kFALSE),
84 fZeroSharedHitsBelowThreshold(false),
87 fUseSimpleMerging(false),
88 fThreeStripSharing(true),
89 fRecalculateEta(false)
95 // title Title of object - not significant
97 DGUARD(fDebug,1, "Named CTOR for AliFMDSharingFilter: %s", title);
98 fRingHistos.SetName(GetName());
99 fRingHistos.SetOwner();
101 fRingHistos.Add(new RingHistos(1, 'I'));
102 fRingHistos.Add(new RingHistos(2, 'I'));
103 fRingHistos.Add(new RingHistos(2, 'O'));
104 fRingHistos.Add(new RingHistos(3, 'I'));
105 fRingHistos.Add(new RingHistos(3, 'O'));
108 fHCuts.SetIncludeSigma(1);
109 fLCuts.SetMultCuts(.15);
112 //____________________________________________________________________
113 AliFMDSharingFilter::AliFMDSharingFilter(const AliFMDSharingFilter& o)
116 fCorrectAngles(o.fCorrectAngles),
118 fHighCuts(o.fHighCuts),
119 fLowCuts(o.fLowCuts),
122 fZeroSharedHitsBelowThreshold(o.fZeroSharedHitsBelowThreshold),
125 fUseSimpleMerging(o.fUseSimpleMerging),
126 fThreeStripSharing(o.fThreeStripSharing),
127 fRecalculateEta(o.fRecalculateEta)
133 // o Object to copy from
135 DGUARD(fDebug,1, "Copy CTOR for AliFMDSharingFilter");
136 TIter next(&o.fRingHistos);
138 while ((obj = next())) fRingHistos.Add(obj);
141 //____________________________________________________________________
142 AliFMDSharingFilter::~AliFMDSharingFilter()
147 DGUARD(fDebug,3, "DTOR for AliFMDSharingFilter");
148 fRingHistos.Delete();
151 //____________________________________________________________________
153 AliFMDSharingFilter::operator=(const AliFMDSharingFilter& o)
156 // Assignment operator
159 // o Object to assign from
164 DGUARD(fDebug,3, "Assigment for AliFMDSharingFilter");
165 if (&o == this) return *this;
166 TNamed::operator=(o);
168 fCorrectAngles = o.fCorrectAngles;
172 fHighCuts = o.fHighCuts;
173 fLowCuts = o.fLowCuts;
174 fZeroSharedHitsBelowThreshold = o.fZeroSharedHitsBelowThreshold;
177 fUseSimpleMerging = o.fUseSimpleMerging;
178 fThreeStripSharing = o.fThreeStripSharing;
179 fRecalculateEta = o.fRecalculateEta;
181 fRingHistos.Delete();
182 TIter next(&o.fRingHistos);
184 while ((obj = next())) fRingHistos.Add(obj);
189 //____________________________________________________________________
190 AliFMDSharingFilter::RingHistos*
191 AliFMDSharingFilter::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()) return 0;
211 return static_cast<RingHistos*>(fRingHistos.At(idx));
214 //____________________________________________________________________
216 AliFMDSharingFilter::Init(const TAxis& axis)
219 DGUARD(fDebug,1, "Initialize for AliFMDSharingFilter");
220 AliForwardCorrectionManager& fcm = AliForwardCorrectionManager::Instance();
221 AliFMDCorrELossFit* fits = fcm.GetELossFit();
223 // Get the high cut. The high cut is defined as the
224 // most-probably-value peak found from the energy distributions, minus
225 // 2 times the width of the corresponding Landau.
227 TAxis eAxis(axis.GetNbins(),
231 eAxis.Set(fits->GetEtaAxis().GetNbins(),
232 fits->GetEtaAxis().GetXmin(),
233 fits->GetEtaAxis().GetXmax());
235 UShort_t nEta = eAxis.GetNbins();
237 fHighCuts->SetBins(nEta, eAxis.GetXmin(), eAxis.GetXmax(), 5, .5, 5.5);
238 fHighCuts->GetYaxis()->SetBinLabel(1, "FMD1i");
239 fHighCuts->GetYaxis()->SetBinLabel(2, "FMD2i");
240 fHighCuts->GetYaxis()->SetBinLabel(3, "FMD2o");
241 fHighCuts->GetYaxis()->SetBinLabel(4, "FMD3i");
242 fHighCuts->GetYaxis()->SetBinLabel(5, "FMD3o");
244 fLowCuts->SetBins(nEta, eAxis.GetXmin(), eAxis.GetXmax(), 5, .5, 5.5);
245 fLowCuts->GetYaxis()->SetBinLabel(1, "FMD1i");
246 fLowCuts->GetYaxis()->SetBinLabel(2, "FMD2i");
247 fLowCuts->GetYaxis()->SetBinLabel(3, "FMD2o");
248 fLowCuts->GetYaxis()->SetBinLabel(4, "FMD3i");
249 fLowCuts->GetYaxis()->SetBinLabel(5, "FMD3o");
252 for (UShort_t d = 1; d <= 3; d++) {
253 UShort_t nr = (d == 1 ? 1 : 2);
254 for (UShort_t q = 0; q < nr; q++) {
255 Char_t r = (q == 0 ? 'I' : 'O');
257 for (UShort_t e = 1; e <= nEta; e++) {
258 Double_t eta = eAxis.GetBinCenter(e);
260 if (fDebug > 3) fHCuts.Print();
262 Double_t hcut = GetHighCut(d, r, eta, false);
263 Double_t lcut = GetLowCut(d, r, eta);
265 if (hcut > 0) fHighCuts->SetBinContent(e, ybin, hcut);
266 if (lcut > 0) fLowCuts ->SetBinContent(e, ybin, lcut);
272 //____________________________________________________________________
273 #define ETA2COS(ETA) \
274 TMath::Cos(2*TMath::ATan(TMath::Exp(-TMath::Abs(ETA))))
277 AliFMDSharingFilter::Filter(const AliESDFMD& input,
283 // Filter the input AliESDFMD object
287 // lowFlux If this is a low-flux event
288 // output Output AliESDFMD object
291 // True on success, false otherwise
293 DGUARD(fDebug,1, "Filter event in AliFMDSharingFilter");
295 TIter next(&fRingHistos);
297 while ((o = static_cast<RingHistos*>(next())))
300 if (fOper) fOper->Reset(0);
302 Int_t nCandidate = 0;
311 for(UShort_t d = 1; d <= 3; d++) {
312 Int_t nRings = (d == 1 ? 1 : 2);
313 for (UShort_t q = 0; q < nRings; q++) {
314 Char_t r = (q == 0 ? 'I' : 'O');
315 UShort_t nsec = (q == 0 ? 20 : 40);
316 UShort_t nstr = (q == 0 ? 512 : 256);
317 RingHistos* histos = GetRingHistos(d, r);
319 for(UShort_t s = 0; s < nsec; s++) {
321 for (UShort_t t = 0; t < nstr; t++) status[t] = kCandidate;
323 #ifdef USE_OLDER_MERGING
324 Bool_t usedThis = kFALSE;
325 Bool_t usedPrev = kFALSE;
328 Bool_t used = kFALSE;
329 Double_t eTotal = -1;
330 Int_t nDistanceBefore = -1;
331 Int_t nDistanceAfter = -1;
332 Bool_t twoLow = kFALSE;
333 for(UShort_t t = 0; t < nstr; t++) {
337 output.SetMultiplicity(d,r,s,t,0.);
338 Float_t mult = SignalInStrip(input,d,r,s,t);
339 Float_t multNext = (t<nstr-1) ? SignalInStrip(input,d,r,s,t+1) :0;
340 Float_t multNextNext = (t<nstr-2) ? SignalInStrip(input,d,r,s,t+2) :0;
341 if (multNext == AliESDFMD::kInvalidMult) multNext = 0;
342 if (multNextNext == AliESDFMD::kInvalidMult) multNextNext = 0;
343 if(!fThreeStripSharing) multNextNext = 0;
345 // Get the pseudo-rapidity
346 Double_t eta = input.Eta(d,r,s,t);
347 Double_t phi = input.Phi(d,r,s,t) * TMath::Pi() / 180.;
348 if (s == 0) output.SetEta(d,r,s,t,eta);
350 if(fRecalculateEta) {
351 Double_t etaOld = eta;
352 Double_t etaCalc = AliForwardUtil::GetEtaFromStrip(d,r,s,t,zvtx);
355 if (mult > 0 && mult != AliESDFMD::kInvalidMult ) {
356 Double_t cosOld = ETA2COS(etaOld);
357 Double_t cosNew = ETA2COS(etaCalc);
358 Double_t corr = cosNew / cosOld;
361 multNextNext *= corr;
365 // Keep dead-channel information.
366 if(mult == AliESDFMD::kInvalidMult)
367 output.SetMultiplicity(d,r,s,t,AliESDFMD::kInvalidMult);
369 // If no signal or dead strip, go on.
370 if (mult == AliESDFMD::kInvalidMult || mult == 0) {
371 if (mult == 0) histos->fSum->Fill(eta,phi,mult);
376 // Fill the diagnostics histogram
377 histos->fBefore->Fill(mult);
379 Double_t mergedEnergy = 0;
381 if(fUseSimpleMerging) {
383 if (t < nstr-1) histos->fNeighborsBefore->Fill(mult,multNext);
384 if(mult > GetHighCut(d, r, eta ,false)) {
385 histos->fDistanceBefore->Fill(nDistanceBefore);
386 nDistanceBefore = -1;
390 if(fThreeStripSharing && multNext > GetLowCut(d, r, eta) &&
391 (multNext < GetHighCut(d, r, eta ,false) || twoLow)) {
392 eTotal = eTotal + multNext;
394 histos->fTriple->Fill(eTotal);
400 histos->fDouble->Fill(eTotal);
407 if(used) {used = kFALSE; continue; }
408 if(mult > GetLowCut(d, r, eta)) etot = mult;
410 if(mult > GetLowCut(d, r, eta) &&
411 multNext > GetLowCut(d, r, eta) &&
412 (mult < GetHighCut(d, r, eta ,false) ||
413 multNext < GetHighCut(d, r, eta ,false))) {
415 if(mult < GetHighCut(d, r, eta ,false) &&
416 multNext < GetHighCut(d, r, eta ,false) )
419 if(mult>multNext && multNextNext < GetLowCut(d, r, eta))
421 etot = mult + multNext;
423 histos->fDouble->Fill(etot);
428 eTotal = mult + multNext;
433 histos->fSingle->Fill(etot);
434 histos->fSinglePerStrip->Fill(etot,t);
441 if(mergedEnergy > GetHighCut(d, r, eta ,false) ) {
442 histos->fDistanceAfter->Fill(nDistanceAfter);
445 //if(mult>0 && multNext >0)
446 // std::cout<<mult<<" "<<multNext<<" "<<mergedEnergy<<std::endl;
447 } // End of simple merge
449 // Get next and previous signal - if any
452 Status prevStatus = (t == 0 ? kNone : status[t-1]);
453 Status thisStatus = status[t];
454 Status nextStatus = (t == nstr-1 ? kNone : status[t+1]);
456 prevE = SignalInStrip(input,d,r,s,t-1);
457 if (prevE == AliESDFMD::kInvalidMult) prevE = 0;
460 nextE = SignalInStrip(input,d,r,s,t+1);
461 if (nextE == AliESDFMD::kInvalidMult) nextE = 0;
463 if (t != 0) histos->fNeighborsBefore->Fill(prevE, mult);
465 #ifdef USE_OLDER_MERGING
466 /*Double_t*/ mergedEnergy = MultiplicityOfStrip(mult,eta,prevE,nextE,
469 status[t] = (usedPrev ? kMergedWithOther : kNone);
470 if (t != nstr - 1) status[t] = (usedThis ? kMergedWithOther : kNone);
472 /*Double_t*/ mergedEnergy = MultiplicityOfStrip(mult, prevE, nextE,
478 if (t != 0) status[t-1] = prevStatus;
479 if (t != nstr-1) status[t+1] = nextStatus;
480 status[t] = thisStatus;
483 // If we're processing on non-angle corrected data, we
484 // should do the angle correction here
485 } // End of non-simple
487 mergedEnergy = AngleCorrect(mergedEnergy, eta);
488 if (mergedEnergy > 0) histos->Incr();
491 histos->fNeighborsAfter->Fill(output.Multiplicity(d,r,s,t-1),
493 histos->fBeforeAfter->Fill(mult, mergedEnergy);
495 histos->fAfter->Fill(mergedEnergy);
496 histos->fSum->Fill(eta,phi,mergedEnergy);
498 output.SetMultiplicity(d,r,s,t,mergedEnergy);
500 for (UShort_t t = 0; t < nstr; t++) {
501 if (fOper) fOper->operator()(d, r, s, t) = status[t];
503 case kNone: nNone++; break;
504 case kCandidate: nCandidate++; break;
505 case kMergedWithOther: nMerged++; break;
506 case kMergedInto: nSummed++; break;
512 fSummed->Fill(kNone, nNone);
513 fSummed->Fill(kCandidate, nCandidate);
514 fSummed->Fill(kMergedWithOther, nMerged);
515 fSummed->Fill(kMergedInto, nSummed);
517 DMSG(fDebug, 3,"single=%9d, double=%9d, triple=%9d",
518 nSingle, nDouble, nTriple);
520 while ((o = static_cast<RingHistos*>(next())))
526 //_____________________________________________________________________
528 AliFMDSharingFilter::SignalInStrip(const AliESDFMD& input,
535 // Get the signal in a strip
547 Double_t mult = input.Multiplicity(d,r,s,t);
549 // - bad value (invalid or 0)
550 // - we want angle corrected and data is
551 // - we don't want angle corrected and data isn't
552 // just return read value
553 if (mult == AliESDFMD::kInvalidMult ||
555 (fCorrectAngles && input.IsAngleCorrected()) ||
556 (!fCorrectAngles && !input.IsAngleCorrected()))
559 // If we want angle corrected data, correct it,
560 // otherwise de-correct it
561 if (fCorrectAngles) mult = AngleCorrect(mult, input.Eta(d,r,s,t));
562 else mult = DeAngleCorrect(mult, input.Eta(d,r,s,t));
565 //_____________________________________________________________________
567 AliFMDSharingFilter::GetLowCut(UShort_t d, Char_t r, Double_t eta) const
570 // Get the low cut. Normally, the low cut is taken to be the lower
571 // value of the fit range used when generating the energy loss fits.
572 // However, if fLowCut is set (using SetLowCit) to a value greater
573 // than 0, then that value is used.
575 return fLCuts.GetMultCut(d,r,eta,false);
577 if (!fCutAtFractionOfMPV && fLowCut > 0) return fLowCut;
579 AliForwardCorrectionManager& fcm = AliForwardCorrectionManager::Instance();
580 AliFMDCorrELossFit* fits = fcm.GetELossFit();
582 if (fCutAtFractionOfMPV) {
583 AliFMDCorrELossFit::ELossFit* func = fits->GetFit(d,r,eta);
584 return fFractionOfMPV*func->GetDelta() ;
586 return fits->GetLowCut();
590 //_____________________________________________________________________
592 AliFMDSharingFilter::GetHighCut(UShort_t d, Char_t r,
593 Double_t eta, Bool_t errors) const
596 // Get the high cut. The high cut is defined as the
597 // most-probably-value peak found from the energy distributions, minus
598 // 2 times the width of the corresponding Landau.
600 return fHCuts.GetMultCut(d,r,eta,errors);
603 //_____________________________________________________________________
605 const char* status2String(AliFMDSharingFilter::Status s)
608 case AliFMDSharingFilter::kNone: return "none ";
609 case AliFMDSharingFilter::kCandidate: return "candidate";
610 case AliFMDSharingFilter::kMergedWithOther: return "merged ";
611 case AliFMDSharingFilter::kMergedInto: return "summed ";
617 //_____________________________________________________________________
619 AliFMDSharingFilter::MultiplicityOfStrip(Double_t thisE,
630 Status& nextStatus) const
632 Double_t lowCut = GetLowCut(d, r, eta);
634 DBG(3,Form("FMD%d%c[%2d,%3d]: this=%9f(%s), prev=%9f(%s), next=%9f(%s)",
636 thisE, status2String(thisStatus),
637 prevE, status2String(prevStatus),
638 nextE, status2String(nextStatus)));
640 // If below cut, then modify zero signal and make sure the next
641 // strip is considered a candidate.
642 if (thisE < lowCut || thisE > 20) {
644 DBGL(5,Form(" %9f<%9f || %9f>20, 0'ed", thisE, lowCut, thisE));
645 if (prevStatus == kCandidate) prevStatus = kNone;
648 // It this strip was merged with the previous strip, then
649 // make the next strip a candidate and zero the value in this strip.
650 if (thisStatus == kMergedWithOther) {
651 DBGL(5,Form(" Merged with other, 0'ed"));
655 // Get the upper cut on the sharing
656 Double_t highCut = GetHighCut(d, r, eta ,false);
662 // Only for low-flux events
664 // If this is smaller than the next, and the next is larger
665 // then the cut, mark both as candidates for sharing.
666 // They should be be merged on the next iteration
667 if (thisE < nextE && nextE > highCut) {
668 thisStatus = kCandidate;
669 nextStatus = kCandidate;
674 // Variable to sum signal in
675 Double_t totalE = thisE;
677 // If the previous signal was between the two cuts, and is still
678 // marked as a candidate , then merge it in here.
679 if (prevStatus == kCandidate && prevE > lowCut && prevE < highCut) {
681 prevStatus = kMergedWithOther;
682 DBG(3, Form(" Prev candidate %9f<%9f<%9f->%9f",
683 lowCut, prevE, highCut, totalE));
686 // If the next signal is between the two cuts, then merge it here
687 if (nextE > lowCut && nextE < highCut) {
689 nextStatus = kMergedWithOther;
690 DBG(3, Form(" Next %9f<%9f<%9f->%9f", lowCut, nextE, highCut,totalE));
693 // If the signal is bigger than the high-cut, then return the value
694 if (totalE > highCut) {
696 thisStatus = kMergedInto;
699 DBGL(5, Form(" %9f>%f9 (was %9f) -> %9f %s",
700 totalE, highCut, thisE, totalE,status2String(thisStatus)));
704 // This is below cut, so flag next as a candidate
705 DBG(3, Form(" %9f<=%9f, next candidate", totalE, highCut));
706 nextStatus = kCandidate;
709 // If the total signal is smaller than low cut then zero this and kill this
710 if (totalE < lowCut) {
711 DBGL(5, Form(" %9f<%9f (was %9f), zeroed", totalE, lowCut, thisE));
716 // If total signal not above high cut or lower than low cut,
717 // mark this as a candidate for merging into the next, and zero signal
718 DBGL(5, Form(" %9f<%9f<%9f (was %9f), zeroed, candidate",
719 lowCut, totalE, highCut, thisE));
720 thisStatus = kCandidate;
721 return (fZeroSharedHitsBelowThreshold ? 0 : totalE);
724 //_____________________________________________________________________
726 AliFMDSharingFilter::MultiplicityOfStrip(Double_t mult,
736 Bool_t& usedThis) const
739 // The actual algorithm
742 // mult The unfiltered signal in the strip
743 // eta Psuedo rapidity
744 // prevE Previous strip signal (or 0)
745 // nextE Next strip signal (or 0)
746 // lowFlux Whether this is a low flux event
751 // usedPrev Whether the previous strip was used in sharing or not
752 // usedThis Wether this strip was used in sharing or not.
755 // The filtered signal in the strip
758 // IF the multiplicity is very large, or below the cut, reject it, and
759 // flag it as candidate for sharing
760 Double_t lowCut = GetLowCut(d,r,eta);
761 if(mult > 12 || mult < lowCut) {
767 // If this was shared with the previous signal, return 0 and mark it as
768 // not a candiate for sharing
775 //analyse and perform sharing on one strip
778 Double_t highCut = GetHighCut(d, r, eta, false);
785 // If this signal is smaller than the next, and the next signal is smaller
786 // than then the high cut, and it's a low-flux event, then mark this and
787 // the next signal as candidates for sharing
789 // This is the test if the signal is the smaller of two possibly
799 Double_t totalE = mult;
801 // If the previous signal was larger than the low cut, and
802 // the previous was smaller than high cut, and the previous signal
803 // isn't marked as used, then add it's energy to this signal
804 if (prevE > lowCut &&
809 // If the next signal is larger than the low cut, and
810 // the next signal is smaller than the high cut, then add the next signal
811 // to this, and marked the next signal as used
812 if(nextE > lowCut && nextE < highCut ) {
817 // If we're processing on non-angle corrected data, we should do the
818 // angle correction here
819 // if (!fCorrectAngles)
820 // totalE = AngleCorrect(totalE, eta);
822 // Fill post processing histogram
823 // if(totalE > fLowCut)
824 // GetRingHistos(d,r)->fAfter->Fill(totalE);
827 Double_t mergedEnergy = 0;
830 // If we have a signal, then this is used (sharedPrev=true) and
831 // the signal is set to the result
832 mergedEnergy = totalE;
836 // If we do not have a signal (too low), then this is not shared,
837 // and the next strip is not shared either
844 //____________________________________________________________________
846 AliFMDSharingFilter::AngleCorrect(Double_t mult, Double_t eta) const
849 // Angle correct the signal
852 // mult Angle Un-corrected Signal
853 // eta Pseudo-rapidity
856 // Angle corrected signal
858 Double_t theta = 2 * TMath::ATan(TMath::Exp(-eta));
859 if (eta < 0) theta -= TMath::Pi();
860 return mult * TMath::Cos(theta);
862 //____________________________________________________________________
864 AliFMDSharingFilter::DeAngleCorrect(Double_t mult, Double_t eta) const
867 // Angle de-correct the signal
870 // mult Angle corrected Signal
871 // eta Pseudo-rapidity
874 // Angle un-corrected signal
876 Double_t theta = 2 * TMath::ATan(TMath::Exp(-eta));
877 if (eta < 0) theta -= TMath::Pi();
878 return mult / TMath::Cos(theta);
881 //____________________________________________________________________
883 AliFMDSharingFilter::ScaleHistograms(const TList* dir, Int_t nEvents)
886 // Scale the histograms to the total number of events
889 // dir Where the output is
890 // nEvents Number of events
892 DGUARD(fDebug,1, "Scale histograms in AliFMDSharingFilter");
893 if (nEvents <= 0) return;
894 TList* d = static_cast<TList*>(dir->FindObject(GetName()));
897 TIter next(&fRingHistos);
899 THStack* sums = new THStack("sums", "Sum of ring signals");
900 while ((o = static_cast<RingHistos*>(next()))) {
901 o->ScaleHistograms(d, nEvents);
902 TH1D* sum = o->fSum->ProjectionX(o->GetName(), 1, o->fSum->GetNbinsY(),"e");
903 sum->Scale(1., "width");
904 sum->SetTitle(o->GetName());
905 sum->SetDirectory(0);
906 sum->SetYTitle("#sum #Delta/#Delta_{mip}");
912 //____________________________________________________________________
914 AliFMDSharingFilter::DefineOutput(TList* dir)
917 // Define the output histograms. These are put in a sub list of the
918 // passed list. The histograms are merged before the parent task calls
919 // AliAnalysisTaskSE::Terminate
922 // dir Directory to add to
924 DGUARD(fDebug,1, "Define output in AliFMDSharingFilter");
925 TList* d = new TList;
926 d->SetName(GetName());
929 fSummed = new TH2I("operations", "Strip operations",
930 kMergedInto, kNone-.5, kMergedInto+.5,
931 51201, -.5, 51200.5);
932 fSummed->SetXTitle("Operation");
933 fSummed->SetYTitle("# of strips");
934 fSummed->SetZTitle("Events");
935 fSummed->GetXaxis()->SetBinLabel(kNone, "None");
936 fSummed->GetXaxis()->SetBinLabel(kCandidate, "Candidate");
937 fSummed->GetXaxis()->SetBinLabel(kMergedWithOther, "Merged w/other");
938 fSummed->GetXaxis()->SetBinLabel(kMergedInto, "Merged into");
939 fSummed->SetDirectory(0);
942 fHighCuts = new TH2D("highCuts", "High cuts used", 1,0,1, 1,0,1);
943 fHighCuts->SetXTitle("#eta");
944 fHighCuts->SetDirectory(0);
947 fLowCuts = new TH2D("lowCuts", "Low cuts used", 1,0,1, 1,0,1);
948 fLowCuts->SetXTitle("#eta");
949 fLowCuts->SetDirectory(0);
955 d->Add(AliForwardUtil::MakeParameter("angle", fCorrectAngles));
956 d->Add(AliForwardUtil::MakeParameter("lowSignal",
957 fZeroSharedHitsBelowThreshold));
958 d->Add(AliForwardUtil::MakeParameter("simple", fUseSimpleMerging));
959 fLCuts.Output(d,"lCuts");
960 fHCuts.Output(d,"hCuts");
962 TIter next(&fRingHistos);
964 while ((o = static_cast<RingHistos*>(next()))) {
968 //____________________________________________________________________
970 AliFMDSharingFilter::Print(Option_t* /*option*/) const
978 char ind[gROOT->GetDirLevel()+1];
979 for (Int_t i = 0; i < gROOT->GetDirLevel(); i++) ind[i] = ' ';
980 ind[gROOT->GetDirLevel()] = '\0';
981 std::cout << ind << ClassName() << ": " << GetName() << '\n'
983 << ind << " Debug: " << fDebug << "\n"
984 << ind << " Use corrected angles: " << fCorrectAngles << '\n'
985 << ind << " Zero below threshold: "
986 << fZeroSharedHitsBelowThreshold << '\n'
987 << ind << " Use simple sharing: " << fUseSimpleMerging << '\n'
988 << std::noboolalpha << std::endl;
989 std::cout << ind << " Low cuts: " << std::endl;
991 std::cout << ind << " High cuts: " << std::endl;
995 //====================================================================
996 AliFMDSharingFilter::RingHistos::RingHistos()
997 : AliForwardUtil::RingHistos(),
1007 fNeighborsBefore(0),
1019 //____________________________________________________________________
1020 AliFMDSharingFilter::RingHistos::RingHistos(UShort_t d, Char_t r)
1021 : AliForwardUtil::RingHistos(d,r),
1031 fNeighborsBefore(0),
1044 fBefore = new TH1D("esdEloss", Form("Energy loss in %s (reconstruction)",
1045 GetName()), 600, 0, 15);
1046 fBefore->SetXTitle("#Delta E/#Delta E_{mip}");
1047 fBefore->SetYTitle("P(#Delta E/#Delta E_{mip})");
1048 fBefore->SetFillColor(Color());
1049 fBefore->SetFillStyle(3001);
1050 fBefore->SetLineColor(kBlack);
1051 fBefore->SetLineStyle(2);
1052 fBefore->SetDirectory(0);
1054 fAfter = static_cast<TH1D*>(fBefore->Clone("anaEloss"));
1055 fAfter->SetTitle(Form("Energy loss in %s (sharing corrected)", GetName()));
1056 fAfter->SetFillColor(Color()+2);
1057 fAfter->SetLineStyle(1);
1058 fAfter->SetDirectory(0);
1060 fSingle = new TH1D("singleEloss", "Energy loss (single strips)",
1062 fSingle->SetXTitle("#Delta/#Delta_{mip}");
1063 fSingle->SetYTitle("P(#Delta/#Delta_{mip})");
1064 fSingle->SetFillColor(Color());
1065 fSingle->SetFillStyle(3001);
1066 fSingle->SetLineColor(kBlack);
1067 fSingle->SetLineStyle(2);
1068 fSingle->SetDirectory(0);
1070 fDouble = static_cast<TH1D*>(fSingle->Clone("doubleEloss"));
1071 fDouble->SetTitle("Energy loss (two strips)");
1072 fDouble->SetFillColor(Color()+1);
1073 fDouble->SetDirectory(0);
1075 fTriple = static_cast<TH1D*>(fSingle->Clone("tripleEloss"));
1076 fTriple->SetTitle("Energy loss (three strips)");
1077 fTriple->SetFillColor(Color()+2);
1078 fTriple->SetDirectory(0);
1080 //Int_t nBinsForInner = (r == 'I' ? 32 : 16);
1081 Int_t nBinsForInner = (r == 'I' ? 512 : 256);
1082 Int_t nStrips = (r == 'I' ? 512 : 256);
1084 fSinglePerStrip = new TH2D("singlePerStrip", "SinglePerStrip",
1085 600,0,15, nBinsForInner,0,nStrips);
1086 fSinglePerStrip->SetXTitle("#Delta/#Delta_{mip}");
1087 fSinglePerStrip->SetYTitle("Strip #");
1088 fSinglePerStrip->SetZTitle("Counts");
1089 fSinglePerStrip->SetDirectory(0);
1091 fDistanceBefore = new TH1D("distanceBefore", "Distance before sharing",
1092 nStrips , 0,nStrips );
1093 fDistanceBefore->SetXTitle("Distance");
1094 fDistanceBefore->SetYTitle("Counts");
1095 fDistanceBefore->SetFillColor(kGreen+2);
1096 fDistanceBefore->SetFillStyle(3001);
1097 fDistanceBefore->SetLineColor(kBlack);
1098 fDistanceBefore->SetLineStyle(2);
1099 fDistanceBefore->SetDirectory(0);
1101 fDistanceAfter = static_cast<TH1D*>(fDistanceBefore->Clone("distanceAfter"));
1102 fDistanceAfter->SetTitle("Distance after sharing");
1103 fDistanceAfter->SetFillColor(kGreen+1);
1104 fDistanceAfter->SetDirectory(0);
1109 Int_t n = int((max-min) / (max / 300));
1110 fBeforeAfter = new TH2D("beforeAfter", "Before and after correlation",
1111 n, min, max, n, min, max);
1112 fBeforeAfter->SetXTitle("#Delta E/#Delta E_{mip} before");
1113 fBeforeAfter->SetYTitle("#Delta E/#Delta E_{mip} after");
1114 fBeforeAfter->SetZTitle("Correlation");
1115 fBeforeAfter->SetDirectory(0);
1117 fNeighborsBefore = static_cast<TH2D*>(fBeforeAfter->Clone("neighborsBefore"));
1118 fNeighborsBefore->SetTitle("Correlation of neighbors before");
1119 fNeighborsBefore->SetXTitle("#Delta E_{i}/#Delta E_{mip}");
1120 fNeighborsBefore->SetYTitle("#Delta E_{i+1}/#Delta E_{mip}");
1121 fNeighborsBefore->SetDirectory(0);
1124 static_cast<TH2D*>(fNeighborsBefore->Clone("neighborsAfter"));
1125 fNeighborsAfter->SetTitle("Correlation of neighbors after");
1126 fNeighborsAfter->SetDirectory(0);
1128 fSum = new TH2D("summed", "Summed signal", 200, -4, 6,
1129 (fRing == 'I' || fRing == 'i' ? 20 : 40), 0, 2*TMath::Pi());
1130 fSum->SetDirectory(0);
1132 fSum->SetMarkerColor(Color());
1133 // fSum->SetFillColor(Color());
1134 fSum->SetXTitle("#eta");
1135 fSum->SetYTitle("#varphi [radians]");
1136 fSum->SetZTitle("#sum #Delta/#Delta_{mip}(#eta,#varphi) ");
1138 fHits = new TH1D("hits", "Number of hits", 200, 0, 200000);
1139 fHits->SetDirectory(0);
1140 fHits->SetXTitle("# of hits");
1141 fHits->SetFillColor(kGreen+1);
1143 //____________________________________________________________________
1144 AliFMDSharingFilter::RingHistos::RingHistos(const RingHistos& o)
1145 : AliForwardUtil::RingHistos(o),
1151 fSinglePerStrip(o.fSinglePerStrip),
1152 fDistanceBefore(o.fDistanceBefore),
1153 fDistanceAfter(o.fDistanceAfter),
1154 fBeforeAfter(o.fBeforeAfter),
1155 fNeighborsBefore(o.fNeighborsBefore),
1156 fNeighborsAfter(o.fNeighborsAfter),
1165 // o Object to copy from
1169 //____________________________________________________________________
1170 AliFMDSharingFilter::RingHistos&
1171 AliFMDSharingFilter::RingHistos::operator=(const RingHistos& o)
1174 // Assignment operator
1177 // o Object to assign from
1180 // Reference to this
1182 if (&o == this) return *this;
1183 AliForwardUtil::RingHistos::operator=(o);
1187 if (fBefore) delete fBefore;
1188 if (fAfter) delete fAfter;
1189 if (fSingle) delete fSingle;
1190 if (fDouble) delete fDouble;
1191 if (fTriple) delete fTriple;
1192 if (fSinglePerStrip) delete fSinglePerStrip;
1193 if (fDistanceBefore) delete fDistanceBefore;
1194 if (fDistanceAfter) delete fDistanceAfter;
1195 if (fHits) delete fHits;
1198 fBefore = static_cast<TH1D*>(o.fBefore->Clone());
1199 fAfter = static_cast<TH1D*>(o.fAfter->Clone());
1200 fSingle = static_cast<TH1D*>(o.fSingle->Clone());
1201 fDouble = static_cast<TH1D*>(o.fDouble->Clone());
1202 fTriple = static_cast<TH1D*>(o.fTriple->Clone());
1203 fSinglePerStrip = static_cast<TH2D*>(o.fSinglePerStrip->Clone());
1204 fDistanceBefore = static_cast<TH1D*>(o.fDistanceBefore->Clone());
1205 fDistanceAfter = static_cast<TH1D*>(o.fDistanceAfter->Clone());
1206 fBeforeAfter = static_cast<TH2D*>(o.fBeforeAfter->Clone());
1207 fNeighborsBefore = static_cast<TH2D*>(o.fNeighborsBefore->Clone());
1208 fNeighborsAfter = static_cast<TH2D*>(o.fNeighborsAfter->Clone());
1209 fHits = static_cast<TH1D*>(o.fHits->Clone());
1210 fSum = static_cast<TH2D*>(o.fSum->Clone());
1214 //____________________________________________________________________
1215 AliFMDSharingFilter::RingHistos::~RingHistos()
1221 //____________________________________________________________________
1223 AliFMDSharingFilter::RingHistos::Finish()
1229 fHits->Fill(fNHits);
1232 //____________________________________________________________________
1234 AliFMDSharingFilter::RingHistos::ScaleHistograms(const TList* dir,
1238 // Scale the histograms to the total number of events
1241 // nEvents Number of events
1242 // dir Where the output is
1244 TList* l = GetOutputList(dir);
1248 TH1D* before = static_cast<TH1D*>(l->FindObject("esdEloss"));
1249 TH1D* after = static_cast<TH1D*>(l->FindObject("anaEloss"));
1250 if (before) before->Scale(1./nEvents);
1251 if (after) after->Scale(1./nEvents);
1254 TH2D* summed = static_cast<TH2D*>(l->FindObject("summed"));
1255 if (summed) summed->Scale(1./nEvents);
1259 //____________________________________________________________________
1261 AliFMDSharingFilter::RingHistos::Output(TList* dir)
1267 // dir where to store
1269 TList* d = DefineOutputList(dir);
1276 d->Add(fSinglePerStrip);
1277 d->Add(fDistanceBefore);
1278 d->Add(fDistanceAfter);
1279 d->Add(fBeforeAfter);
1280 d->Add(fNeighborsBefore);
1281 d->Add(fNeighborsAfter);
1285 // Removed to avoid doubly adding the list which destroys
1290 //____________________________________________________________________