26 #include <AliESDFMD.h>
36 #include <TParameter.h>
46 do { if (L>fDebug)break; std::cout << (M) << std::flush;} while(false)
48 do { if (L>fDebug)break; std::cout << (M) << std::endl;} while(false)
56 fCorrectAngles(kFALSE),
62 fZeroSharedHitsBelowThreshold(false),
65 fUseSimpleMerging(false),
66 fThreeStripSharing(true),
67 fMergingDisabled(false),
68 fIgnoreESDForAngleCorrection(false)
73 DGUARD(fDebug,1,
"Default CTOR for AliFMDSharingFilter");
78 :
TNamed(
"fmdSharingFilter", title),
80 fCorrectAngles(kFALSE),
86 fZeroSharedHitsBelowThreshold(false),
89 fUseSimpleMerging(false),
90 fThreeStripSharing(true),
91 fMergingDisabled(false),
92 fIgnoreESDForAngleCorrection(false)
100 DGUARD(
fDebug,1,
"Named CTOR for AliFMDSharingFilter: %s", title);
136 case 1: idx = 0;
break;
137 case 2: idx = 1 + (r ==
'I' || r ==
'i' ? 0 : 1);
break;
138 case 3: idx = 3 + (r ==
'I' || r ==
'i' ? 0 : 1);
break;
140 if (idx < 0 || idx >=
fRingHistos.GetEntries())
return 0;
158 TAxis eAxis(axis.GetNbins(),
168 fHighCuts->SetBins(nEta, eAxis.GetXmin(), eAxis.GetXmax(), 5, .5, 5.5);
169 fHighCuts->GetYaxis()->SetBinLabel(1,
"FMD1i");
170 fHighCuts->GetYaxis()->SetBinLabel(2,
"FMD2i");
171 fHighCuts->GetYaxis()->SetBinLabel(3,
"FMD2o");
172 fHighCuts->GetYaxis()->SetBinLabel(4,
"FMD3i");
173 fHighCuts->GetYaxis()->SetBinLabel(5,
"FMD3o");
175 fLowCuts->SetBins(nEta, eAxis.GetXmin(), eAxis.GetXmax(), 5, .5, 5.5);
176 fLowCuts->GetYaxis()->SetBinLabel(1,
"FMD1i");
177 fLowCuts->GetYaxis()->SetBinLabel(2,
"FMD2i");
178 fLowCuts->GetYaxis()->SetBinLabel(3,
"FMD2o");
179 fLowCuts->GetYaxis()->SetBinLabel(4,
"FMD3i");
180 fLowCuts->GetYaxis()->SetBinLabel(5,
"FMD3o");
188 #define ETA2COS(ETA) \
189 TMath::Cos(2*TMath::ATan(TMath::Exp(-TMath::Abs(ETA))))
208 DGUARD(
fDebug,1,
"Filter event in AliFMDSharingFilter");
212 while ((o = static_cast<RingHistos*>(next()))) o->Clear();
219 Int_t nRings = (d == 1 ? 1 : 2);
220 for (
UShort_t q = 0; q < nRings; q++) {
221 Char_t r = (q == 0 ?
'I' :
'O');
223 UShort_t nstr = (q == 0 ? 512 : 256);
226 for(
UShort_t s = 0; s < nsec; s++) {
237 Int_t nStripsAboveCut = 0;
239 for(
UShort_t t = 0; t < nstr; t++) {
243 output.SetMultiplicity(d,r,s,t,0.);
247 if (multNext == AliESDFMD::kInvalidMult) multNext = 0;
248 if (multNextNext == AliESDFMD::kInvalidMult) multNextNext = 0;
253 Double_t phi = input.Phi(d,r,s,t) * TMath::Pi() / 180.;
254 if (s == 0) output.SetEta(d,r,s,t,eta);
259 if (mult == AliESDFMD::kInvalidMult) {
260 output.SetMultiplicity(d,r,s,t,AliESDFMD::kInvalidMult);
262 mult = AliESDFMD::kInvalidMult;
267 if (mult != AliESDFMD::kInvalidMult && mult > lowCut) {
269 histos->
fSumESD->Fill(eta, phi, mult);
273 if (mult == AliESDFMD::kInvalidMult || mult == 0) {
274 if (mult == 0) histos->
fSum->Fill(eta,phi,mult);
276 if (eTotal > 0 && t > 0)
277 output.SetMultiplicity(d,r,s,t-1,eTotal);
284 if (mult == AliESDFMD::kInvalidMult)
286 nStripsAboveCut = -1;
299 if(nStripsAboveCut < 1) {
321 Bool_t thisValid = mult > lowCut;
322 Bool_t nextValid = multNext > lowCut;
323 Bool_t thisSmall = mult < highCut;
324 Bool_t nextSmall = multNext < highCut;
341 eTotal = eTotal + multNext;
362 if (used) {used = kFALSE;
continue; }
365 if (thisValid) etot = mult;
369 if (thisValid && nextValid && (thisSmall || nextSmall)) {
373 if (thisSmall && nextSmall) twoLow = kTRUE;
378 if (mult>multNext && multNextNext < lowCut) {
379 etot = mult + multNext;
387 eTotal = mult + multNext;
416 histos->
fAfter->Fill(mergedEnergy);
417 histos->
fSum->Fill(eta,phi,mergedEnergy);
419 output.SetMultiplicity(d,r,s,t,mergedEnergy);
425 DMSG(
fDebug, 3,
"single=%9d, double=%9d, triple=%9d",
426 nSingle, nDouble, nTriple);
454 Double_t mult = input.Multiplicity(d,r,s,t);
460 if (mult == AliESDFMD::kInvalidMult ||
478 case 1: ybin = 1;
break;
479 case 2: ybin = (r==
'i' || r==
'I') ? 2 : 3;
break;
480 case 3: ybin = (r==
'i' || r==
'I') ? 4 : 5;
break;
483 Int_t xbin = h->GetXaxis()->FindBin(eta);
484 if (xbin < 1 && xbin > h->GetXaxis()->GetNbins())
return ret;
485 ret = h->GetBinContent(xbin,ybin);
500 return Rng2Cut(d, r, eta,
fLowCuts);
532 Double_t theta = 2 * TMath::ATan(TMath::Exp(-eta));
533 if (eta < 0) theta -= TMath::Pi();
534 return mult * TMath::Cos(theta);
550 Double_t theta = 2 * TMath::ATan(TMath::Exp(-eta));
551 if (eta < 0) theta -= TMath::Pi();
552 return mult / TMath::Cos(theta);
566 DGUARD(
fDebug,1,
"Scale histograms in AliFMDSharingFilter");
567 if (nEvents <= 0)
return;
568 TList* d =
static_cast<TList*
>(dir->FindObject(GetName()));
572 out->SetName(d->GetName());
578 TH2* lowCuts =
static_cast<TH2*
>(d->FindObject(
"lowCuts"));
579 TH2* highCuts =
static_cast<TH2*
>(d->FindObject(
"highCuts"));
580 if (lowCuts && nFiles) {
581 TH1* oh =
static_cast<TH1*
>(lowCuts->Clone());
582 oh->Scale(1. / nFiles->GetVal());
587 AliWarning(
"low cuts histogram not found in input list");
588 if (highCuts && nFiles) {
589 TH1* oh =
static_cast<TH1*
>(highCuts->Clone());
590 oh->Scale(1. / nFiles->GetVal());
595 AliWarning(
"high cuts histogram not found in input list");
605 THStack* sums =
new THStack(
"sums",
"Sum of ring signals");
606 THStack* sumsESD =
new THStack(
"sumsESD",
"Sum of ring ESD signals");
607 while ((o = static_cast<RingHistos*>(next()))) {
610 Warning(
"Terminate",
"No sum histogram found for ring %s", o->
GetName());
614 sum->Scale(1.,
"width");
616 sum->SetDirectory(0);
617 sum->SetYTitle(
"#sum_{c} #Delta/#Delta_{mip}");
623 sum->Scale(1.,
"width");
625 sum->SetDirectory(0);
626 sum->SetYTitle(
"#sum_{s} #Delta/#Delta_{mip}");
647 DGUARD(
fDebug,1,
"Define output in AliFMDSharingFilter");
650 d->SetName(GetName());
654 fSummed =
new TH2I(
"operations",
"Strip operations",
656 51201, -.5, 51200.5);
657 fSummed->SetXTitle(
"Operation");
658 fSummed->SetYTitle(
"# of strips");
659 fSummed->SetZTitle(
"Events");
660 fSummed->GetXaxis()->SetBinLabel(
kNone,
"None");
661 fSummed->GetXaxis()->SetBinLabel(
kCandidate,
"Candidate");
663 fSummed->GetXaxis()->SetBinLabel(
kMergedInto,
"Merged into");
664 fSummed->SetDirectory(0);
668 fHighCuts =
new TH2D(
"highCuts",
"High cuts used", 1,0,1, 1,0,1);
673 fLowCuts =
new TH2D(
"lowCuts",
"Low cuts used", 1,0,1, 1,0,1);
688 nFiles->SetMergeMode(
'+');
702 while ((o = static_cast<RingHistos*>(next()))) {
706 #define PF(N,V,...) \
707 AliForwardUtil::PrintField(N,V, ## __VA_ARGS__)
708 #define PFB(N,FLAG) \
710 AliForwardUtil::PrintName(N); \
711 std::cout << std::boolalpha << (FLAG) << std::noboolalpha << std::endl; \
713 #define PFV(N,VALUE) \
715 AliForwardUtil::PrintName(N); \
716 std::cout << (VALUE) << std::endl; } while(false)
729 gROOT->IncreaseDirLevel();
739 gROOT->DecreaseDirLevel();
797 fBefore =
new TH1D(
"esdEloss", Form(
"Energy loss in %s (reconstruction)",
799 fBefore->SetXTitle(
"#Delta E/#Delta E_{mip}");
800 fBefore->SetYTitle(
"P(#Delta E/#Delta E_{mip})");
808 fAfter->SetTitle(Form(
"Energy loss in %s (sharing corrected)",
GetName()));
813 fSingle =
new TH1D(
"singleEloss",
"Energy loss (single strips)",
815 fSingle->SetXTitle(
"#Delta/#Delta_{mip}");
816 fSingle->SetYTitle(
"P(#Delta/#Delta_{mip})");
824 fDouble->SetTitle(
"Energy loss (two strips)");
829 fTriple->SetTitle(
"Energy loss (three strips)");
834 Int_t nBinsForInner = (r ==
'I' ? 512 : 256);
835 Int_t nStrips = (r ==
'I' ? 512 : 256);
838 600,0,15, nBinsForInner,0,nStrips);
845 fDistanceBefore =
new TH1D(
"distanceBefore",
"Distance before sharing",
846 nStrips , 0,nStrips );
847 fDistanceBefore->SetXTitle(
"Distance");
848 fDistanceBefore->SetYTitle(
"Counts");
849 fDistanceBefore->SetFillColor(kGreen+2);
850 fDistanceBefore->SetFillStyle(3001);
851 fDistanceBefore->SetLineColor(kBlack);
852 fDistanceBefore->SetLineStyle(2);
853 fDistanceBefore->SetDirectory(0);
855 fDistanceAfter =
static_cast<TH1D*
>(fDistanceBefore->Clone(
"distanceAfter"));
856 fDistanceAfter->SetTitle(
"Distance after sharing");
857 fDistanceAfter->SetFillColor(kGreen+1);
858 fDistanceAfter->SetDirectory(0);
863 Int_t n = int((max-min) / (max / 300));
865 n, min, max, n, min, max);
866 fBeforeAfter->SetXTitle(
"#Delta E/#Delta E_{mip} before");
867 fBeforeAfter->SetYTitle(
"#Delta E/#Delta E_{mip} after");
882 fSumESD =
new TH2D(
"summedESD",
"Summed ESD signal", 200, -4, 6,
889 fSumESD->SetYTitle(
"#varphi [radians]");
890 fSumESD->SetZTitle(
"#sum_{strip} #Delta/#Delta_{mip}(#eta,#varphi) ");
893 fSum->SetTitle(
"Summed cluster signal");
894 fSum->SetZTitle(
"#sum_{cluster} #Delta/#Delta_{mip}(#eta,#varphi) ");
895 fSum->SetDirectory(0);
914 fHits =
new TH1D(
"hits",
"Number of hits", 200, 0, 200000);
915 fHits->SetDirectory(0);
916 fHits->SetXTitle(
"# of hits");
917 fHits->SetFillColor(kGreen+1);
928 fSinglePerStrip(o.fSinglePerStrip),
931 fBeforeAfter(o.fBeforeAfter),
932 fNeighborsBefore(o.fNeighborsBefore),
933 fNeighborsAfter(o.fNeighborsAfter),
936 fNConsecutive(o.fNConsecutive)
962 if (&o ==
this)
return *
this;
967 if (fBefore)
delete fBefore;
968 if (fAfter)
delete fAfter;
969 if (fSingle)
delete fSingle;
970 if (fDouble)
delete fDouble;
971 if (fTriple)
delete fTriple;
972 if (fSinglePerStrip)
delete fSinglePerStrip;
973 if (fNConsecutive)
delete fNConsecutive;
980 fAfter =
static_cast<TH1D*
>(o.
fAfter->Clone());
992 fSum =
static_cast<TH2D*
>(o.
fSum->Clone());
1007 AliFMDSharingFilter::RingHistos::Finish()
1027 TList* l = GetOutputList(dir);
1031 TH1D* before =
static_cast<TH1D*
>(l->FindObject(
"esdEloss"));
1032 TH1D* after =
static_cast<TH1D*
>(l->FindObject(
"anaEloss"));
1033 if (before) before->Scale(1./nEvents);
1034 if (after) after->Scale(1./nEvents);
1037 TH2D* summed =
static_cast<TH2D*
>(l->FindObject(
"summed"));
1038 if (summed) summed->Scale(1./nEvents);
1041 TH2D* summedESD =
static_cast<TH2D*
>(l->FindObject(
"summedESD"));
1042 if (summedESD) summedESD->Scale(1./nEvents);
1043 fSumESD = summedESD;
1045 TH1D* consecutive =
static_cast<TH1D*
>(l->FindObject(
"nConsecutive"));
1046 if (consecutive) consecutive->Scale(1./nEvents);
1047 fNConsecutive= consecutive;
1060 TList* d = DefineOutputList(dir);
1067 d->Add(fSinglePerStrip);
1070 d->Add(fBeforeAfter);
1071 d->Add(fNeighborsBefore);
1072 d->Add(fNeighborsAfter);
1076 d->Add(fNConsecutive);
Bool_t fIgnoreESDForAngleCorrection
RingHistos & operator=(const RingHistos &o)
void Print(Option_t *option="") const
void Terminate(const TList *dir, Int_t nEvents)
Double_t SignalInStrip(const AliESDFMD &fmd, UShort_t d, Char_t r, UShort_t s, UShort_t t) const
Double_t AngleCorrect(Double_t mult, Double_t eta) const
Bool_t fZeroSharedHitsBelowThreshold
void CreateOutputObjects(TList *dir)
const TAxis & GetEtaAxis() const
virtual Double_t GetHighCut(UShort_t d, Char_t r, Double_t eta, Bool_t errors=true) const
void SetupForData(const TAxis &axis)
#define DMSG(L, N, F,...)
const char * GetName() const
virtual void Terminate(const TList *dir, TList *output, Int_t nEvents)
Bool_t fThreeStripSharing
void Output(TList *l, const char *name=0) const
Bool_t Filter(const AliESDFMD &input, Bool_t lowFlux, AliESDFMD &output, Double_t zvtx)
ClassImp(AliFMDSharingFilter) AliFMDSharingFilter
virtual ~AliFMDSharingFilter()
void Set(EMethod method, Double_t fmd1i, Double_t fmd2i=-1, Double_t fmd2o=-1, Double_t fmd3i=-1, Double_t fmd3o=-1)
const AliFMDCorrELossFit * GetELossFit() const
#define DGUARD(L, N, F,...)
static void PrintTask(const TObject &o)
virtual void CreateOutputObjects(TList *dir)
static TObject * MakeParameter(const char *name, UShort_t value)
const UShort_t & NSector() const
Float_t nEvents[nProd]
Input train file.
Double_t DeAngleCorrect(Double_t mult, Double_t eta) const
virtual void Print(Option_t *option="") const
void FillHistogram(TH2 *h) const
virtual Double_t GetLowCut(UShort_t d, Char_t r, Double_t eta) const
RingHistos * GetRingHistos(UShort_t d, Char_t r) const
RingHistos & operator=(const RingHistos &o)
static AliForwardCorrectionManager & Instance()