1 #include "AliFMDMultCuts.h"
2 #include "AliForwardCorrectionManager.h"
3 #include "AliFMDCorrELossFit.h"
4 #include "AliForwardUtil.h"
7 #include <TParameter.h>
9 ClassImp(AliFMDMultCuts)
11 ; // This is for Emacs
14 //____________________________________________________________________
15 AliFMDMultCuts::AliFMDMultCuts()
21 for (Int_t i = 0; i < 5; i++) fMultCuts[i] = 0;
23 //____________________________________________________________________
24 AliFMDMultCuts::AliFMDMultCuts(const AliFMDMultCuts& o)
26 fMPVFraction(o.fMPVFraction),
28 fIncludeSigma(o.fIncludeSigma)
30 for (Int_t i = 0; i < 5; i++) fMultCuts[i] = o.fMultCuts[i];
32 //____________________________________________________________________
34 AliFMDMultCuts::operator=(const AliFMDMultCuts& o)
36 if (&o == this) return *this;
37 fMPVFraction = o.fMPVFraction;
39 fIncludeSigma = o.fIncludeSigma;
40 for (Int_t i = 0; i < 5; i++) fMultCuts[i] = o.fMultCuts[i];
44 //____________________________________________________________________
46 AliFMDMultCuts::GetFixedCut(UShort_t d, Char_t r) const
48 // Int_t idx = (d == 1 ? 0 : 2*(d - 2) + 1 + ((r=='I' || r=='i') ? 0 : 1));
51 case 1: idx = 0; break;
52 case 2: idx = 1 + ((r == 'I' || r == 'i') ? 0 : 1); break;
53 case 3: idx = 3 + ((r == 'I' || r == 'i') ? 0 : 1); break;
55 if (idx < 0) return -1024;
56 return fMultCuts[idx];
59 //____________________________________________________________________
61 AliFMDMultCuts::SetMultCuts(Double_t fmd1i,
68 fMultCuts[1] = fmd2i >= 0 ? fmd2i : fmd1i;
69 fMultCuts[2] = fmd2o >= 0 ? fmd2o : fmd1i;
70 fMultCuts[3] = fmd3i >= 0 ? fmd3i : fmd1i;
71 fMultCuts[4] = fmd3o >= 0 ? fmd3o : fmd1i;
75 //____________________________________________________________________
77 AliFMDMultCuts::GetMultCut(UShort_t d, Char_t r, Int_t ieta,
81 // Get the multiplicity cut. If the user has set fMultCut (via
82 // SetMultCut) then that value is used. If not, then the lower
83 // value of the fit range for the enery loss fits is returned.
86 // Lower cut on multiplicity
88 Double_t rcut = GetFixedCut(d, r);
90 if (rcut > 0) return rcut;
92 AliForwardCorrectionManager& fcm = AliForwardCorrectionManager::Instance();
93 const AliFMDCorrELossFit* fits = fcm.GetELossFit();
95 return fits->GetLowerBound(d, r, ieta, fMPVFraction);
97 if (fNXi < 0) return fits->GetLowCut();
99 return fits->GetLowerBound(d, r, ieta, fNXi, errors, fIncludeSigma);
102 //____________________________________________________________________
104 AliFMDMultCuts::GetMultCut(UShort_t d, Char_t r, Double_t eta,
108 // Get the multiplicity cut. If the user has set fMultCut (via
109 // SetMultCut) then that value is used. If not, then the lower
110 // value of the fit range for the enery loss fits is returned.
113 // Lower cut on multiplicity
115 AliForwardCorrectionManager& fcm = AliForwardCorrectionManager::Instance();
116 const AliFMDCorrELossFit* fits = fcm.GetELossFit();
117 Int_t iEta = fits ? fits->FindEtaBin(eta) : 1;
119 return GetMultCut(d, r, iEta, errors);
121 //____________________________________________________________________
123 AliFMDMultCuts::GetMethod() const
125 return (fMultCuts[0] >= 0 ? kFixed : // Fixed
126 fMPVFraction > 0 ? kMPVFraction : // Fraction MPV
127 fNXi < 0 ? kFitRange : // Fit range
130 //____________________________________________________________________
132 AliFMDMultCuts::GetMethodString() const
134 switch (GetMethod()) {
135 case kFixed: return "fixed value";
136 case kMPVFraction: return "fraction of MPV";
137 case kFitRange: return "fit range";
138 case kLandauWidth: return "landau width";
143 //____________________________________________________________________
145 AliFMDMultCuts::Output(TList* l, const char* name) const
148 if (name && name[0] != '\0') {
156 ll->Add(AliForwardUtil::MakeParameter("nXi", fNXi));
157 ll->Add(AliForwardUtil::MakeParameter("frac", fMPVFraction));
158 ll->Add(AliForwardUtil::MakeParameter("sigma", fIncludeSigma));
159 ll->Add(AliForwardUtil::MakeParameter("method", GetMethod()));
161 //____________________________________________________________________
163 AliFMDMultCuts::Input(TList* l, const char* name)
165 if (!l) return false;
167 if (name && name[0] != '\0') {
168 ll = static_cast<TList*>(l->FindObject(name));
170 if (!ll) return false;
172 TObject* nXi = ll->FindObject("nXi");
173 TObject* frac = ll->FindObject("frac");
174 TObject* sigma = ll->FindObject("sigma");
175 if (!nXi || !frac || !sigma) return false;
176 AliForwardUtil::GetParameter(nXi, fNXi);
177 AliForwardUtil::GetParameter(frac, fMPVFraction);
178 AliForwardUtil::GetParameter(sigma, fIncludeSigma);
183 //____________________________________________________________________
185 AliFMDMultCuts::Print(Option_t*) const
187 char ind[gROOT->GetDirLevel()+1];
188 for (Int_t i = 0; i < gROOT->GetDirLevel(); i++) ind[i] = ' ';
189 ind[gROOT->GetDirLevel()] = '\0';
190 std::cout << std::boolalpha
191 << ind << " Method used: " << GetMethodString() << '\n'
192 << ind << " Fixed cuts: "
193 << "FMD1i=" << GetFixedCut(1,'I') << " "
194 << "FMD2i=" << GetFixedCut(2,'I') << " "
195 << "FMD2o=" << GetFixedCut(2,'O') << " "
196 << "FMD3i=" << GetFixedCut(3,'I') << " "
197 << "FMD3o=" << GetFixedCut(3,'O') << "\n"
198 << ind << " N xi factor: " << fNXi << '\n'
199 << ind << " Include sigma in cut: " << fIncludeSigma << '\n'
200 << ind << " MPV fraction: " << fMPVFraction
201 << std::noboolalpha << std::endl;
203 //____________________________________________________________________