]>
Commit | Line | Data |
---|---|---|
bfcbb65a | 1 | #include "AliFMDMultCuts.h" |
2 | #include "AliForwardCorrectionManager.h" | |
3 | #include "AliFMDCorrELossFit.h" | |
241cca4d | 4 | #include "AliForwardUtil.h" |
bfcbb65a | 5 | #include <iostream> |
6 | #include <TROOT.h> | |
7 | #include <TParameter.h> | |
8 | ||
9 | ClassImp(AliFMDMultCuts) | |
10 | #if 0 | |
11 | ; // This is for Emacs | |
12 | #endif | |
13 | ||
14 | //____________________________________________________________________ | |
15 | AliFMDMultCuts::AliFMDMultCuts() | |
16 | : TObject(), | |
17 | fMPVFraction(0), | |
18 | fNXi(0), | |
19 | fIncludeSigma(true) | |
20 | { | |
21 | for (Int_t i = 0; i < 5; i++) fMultCuts[i] = 0; | |
22 | } | |
23 | //____________________________________________________________________ | |
24 | AliFMDMultCuts::AliFMDMultCuts(const AliFMDMultCuts& o) | |
25 | : TObject(o), | |
26 | fMPVFraction(o.fMPVFraction), | |
27 | fNXi(o.fNXi), | |
28 | fIncludeSigma(o.fIncludeSigma) | |
29 | { | |
30 | for (Int_t i = 0; i < 5; i++) fMultCuts[i] = o.fMultCuts[i]; | |
31 | } | |
32 | //____________________________________________________________________ | |
33 | AliFMDMultCuts& | |
34 | AliFMDMultCuts::operator=(const AliFMDMultCuts& o) | |
35 | { | |
d015ecfe | 36 | if (&o == this) return *this; |
bfcbb65a | 37 | fMPVFraction = o.fMPVFraction; |
38 | fNXi = o.fNXi; | |
39 | fIncludeSigma = o.fIncludeSigma; | |
40 | for (Int_t i = 0; i < 5; i++) fMultCuts[i] = o.fMultCuts[i]; | |
41 | return *this; | |
42 | } | |
43 | ||
44 | //____________________________________________________________________ | |
45 | Double_t | |
46 | AliFMDMultCuts::GetFixedCut(UShort_t d, Char_t r) const | |
47 | { | |
48 | // Int_t idx = (d == 1 ? 0 : 2*(d - 2) + 1 + ((r=='I' || r=='i') ? 0 : 1)); | |
49 | Int_t idx = -1; | |
50 | switch (d) { | |
51 | case 1: idx = 0; break; | |
b63fc7df | 52 | case 2: idx = 1 + ((r == 'I' || r == 'i') ? 0 : 1); break; |
53 | case 3: idx = 3 + ((r == 'I' || r == 'i') ? 0 : 1); break; | |
bfcbb65a | 54 | } |
55 | if (idx < 0) return 1024; | |
56 | return fMultCuts[idx]; | |
57 | } | |
58 | ||
59 | //____________________________________________________________________ | |
60 | void | |
61 | AliFMDMultCuts::SetMultCuts(Double_t fmd1i, | |
62 | Double_t fmd2i, | |
63 | Double_t fmd2o, | |
64 | Double_t fmd3i, | |
65 | Double_t fmd3o) | |
66 | { | |
67 | fMultCuts[0] = 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; | |
72 | } | |
73 | ||
74 | ||
75 | //____________________________________________________________________ | |
76 | Double_t | |
77 | AliFMDMultCuts::GetMultCut(UShort_t d, Char_t r, Int_t ieta, | |
78 | Bool_t errors) const | |
79 | { | |
80 | // | |
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. | |
84 | // | |
85 | // Return: | |
86 | // Lower cut on multiplicity | |
87 | // | |
88 | Double_t rcut = GetFixedCut(d, r); | |
4077f3e8 | 89 | |
bfcbb65a | 90 | if (rcut > 0) return rcut; |
91 | ||
92 | AliForwardCorrectionManager& fcm = AliForwardCorrectionManager::Instance(); | |
93 | AliFMDCorrELossFit* fits = fcm.GetELossFit(); | |
94 | if (fMPVFraction > 0) | |
95 | return fits->GetLowerBound(d, r, ieta, fMPVFraction); | |
96 | ||
97 | if (fNXi < 0) return fits->GetLowCut(); | |
98 | ||
99 | return fits->GetLowerBound(d, r, ieta, fNXi, errors, fIncludeSigma); | |
100 | } | |
101 | ||
102 | //____________________________________________________________________ | |
103 | Double_t | |
104 | AliFMDMultCuts::GetMultCut(UShort_t d, Char_t r, Double_t eta, | |
105 | Bool_t errors) const | |
106 | { | |
107 | // | |
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. | |
111 | // | |
112 | // Return: | |
113 | // Lower cut on multiplicity | |
114 | // | |
115 | AliForwardCorrectionManager& fcm = AliForwardCorrectionManager::Instance(); | |
116 | AliFMDCorrELossFit* fits = fcm.GetELossFit(); | |
e441e255 | 117 | Int_t iEta = fits ? fits->FindEtaBin(eta) : 1; |
bfcbb65a | 118 | |
119 | return GetMultCut(d, r, iEta, errors); | |
120 | } | |
121 | //____________________________________________________________________ | |
122 | void | |
123 | AliFMDMultCuts::Output(TList* l, const char* name) const | |
124 | { | |
125 | TList* ll = l; | |
126 | if (name && name[0] != '\0') { | |
127 | ll = new TList; | |
128 | ll->SetName(name); | |
129 | ll->SetOwner(); | |
130 | l->Add(ll); | |
131 | } | |
132 | ||
241cca4d | 133 | ll->Add(AliForwardUtil::MakeParameter("nXi", fNXi)); |
134 | ll->Add(AliForwardUtil::MakeParameter("frac", fMPVFraction)); | |
135 | ll->Add(AliForwardUtil::MakeParameter("sigma", fIncludeSigma)); | |
136 | } | |
137 | //____________________________________________________________________ | |
138 | Bool_t | |
139 | AliFMDMultCuts::Input(TList* l, const char* name) | |
140 | { | |
141 | if (!l) return false; | |
142 | TList* ll = l; | |
143 | if (name && name[0] != '\0') { | |
144 | ll = static_cast<TList*>(l->FindObject(name)); | |
145 | } | |
146 | if (!ll) return false; | |
147 | ||
148 | TObject* nXi = ll->FindObject("nXi"); | |
149 | TObject* frac = ll->FindObject("frac"); | |
150 | TObject* sigma = ll->FindObject("sigma"); | |
151 | if (!nXi || !frac || !sigma) return false; | |
152 | AliForwardUtil::GetParameter(nXi, fNXi); | |
153 | AliForwardUtil::GetParameter(frac, fMPVFraction); | |
154 | AliForwardUtil::GetParameter(sigma, fIncludeSigma); | |
155 | ||
156 | return true; | |
bfcbb65a | 157 | } |
158 | ||
159 | //____________________________________________________________________ | |
160 | void | |
161 | AliFMDMultCuts::Print(Option_t*) const | |
162 | { | |
163 | char ind[gROOT->GetDirLevel()+1]; | |
164 | for (Int_t i = 0; i < gROOT->GetDirLevel(); i++) ind[i] = ' '; | |
165 | ind[gROOT->GetDirLevel()] = '\0'; | |
166 | std::cout << std::boolalpha | |
167 | << ind << " Method used: " | |
168 | << (fMultCuts[0] >= 0 ? "fixed value" : | |
169 | fMPVFraction > 0 ? "fraction of MPV" : | |
170 | fNXi < 0 ? "fit range" : | |
171 | "landau width") << '\n' | |
172 | << ind << " Fixed cuts: " | |
173 | << "FMD1i=" << GetFixedCut(1,'I') << " " | |
174 | << "FMD2i=" << GetFixedCut(2,'I') << " " | |
175 | << "FMD2o=" << GetFixedCut(2,'O') << " " | |
176 | << "FMD3i=" << GetFixedCut(3,'I') << " " | |
177 | << "FMD3o=" << GetFixedCut(3,'O') << "\n" | |
178 | << ind << " N xi factor: " << fNXi << '\n' | |
179 | << ind << " Include sigma in cut: " << fIncludeSigma << '\n' | |
180 | << ind << " MPV fraction: " << fMPVFraction | |
181 | << std::noboolalpha << std::endl; | |
182 | } | |
183 | //____________________________________________________________________ | |
184 | // | |
185 | // EOF | |
186 | // |