]>
Commit | Line | Data |
---|---|---|
7984e5f7 | 1 | // |
2 | // This class calculates the exclusive charged particle density | |
3 | // in each for the 5 FMD rings. | |
4 | // | |
5 | // Input: | |
6 | // - 5 RingHistos objects - each with a number of vertex dependent | |
7 | // 2D histograms of the inclusive charge particle density | |
8 | // | |
9 | // Output: | |
10 | // - 5 RingHistos objects - each with a number of vertex dependent | |
11 | // 2D histograms of the exclusive charge particle density | |
12 | // | |
13 | // Corrections used: | |
14 | // - AliFMDCorrSecondaryMap; | |
15 | // - AliFMDCorrVertexBias | |
16 | // - AliFMDCorrMergingEfficiency | |
17 | // | |
72cc12cd | 18 | #include "AliFMDMCCorrector.h" |
886dd429 | 19 | #include <AliESDFMD.h> |
20 | #include <TAxis.h> | |
21 | #include <TList.h> | |
22 | #include <TMath.h> | |
23 | #include "AliForwardCorrectionManager.h" | |
fb3430ac | 24 | #include "AliFMDCorrVertexBias.h" |
886dd429 | 25 | #include "AliLog.h" |
26 | #include <TH2D.h> | |
27 | #include <TROOT.h> | |
28 | #include <TProfile2D.h> | |
e58000b7 | 29 | #include <iostream> |
72cc12cd | 30 | ClassImp(AliFMDMCCorrector) |
886dd429 | 31 | #if 0 |
32 | ; // For Emacs | |
33 | #endif | |
34 | ||
35 | ||
36 | //____________________________________________________________________ | |
72cc12cd | 37 | AliFMDMCCorrector::~AliFMDMCCorrector() |
886dd429 | 38 | { |
7984e5f7 | 39 | // |
40 | // Destructor | |
41 | // | |
886dd429 | 42 | if (fComps) fComps->Clear(); |
43 | if (fFMD1i) delete fFMD1i; | |
44 | if (fFMD2i) delete fFMD2i; | |
45 | if (fFMD2o) delete fFMD2o; | |
46 | if (fFMD3i) delete fFMD3i; | |
47 | if (fFMD3o) delete fFMD3o; | |
48 | } | |
49 | ||
50 | //____________________________________________________________________ | |
72cc12cd | 51 | AliFMDMCCorrector& |
52 | AliFMDMCCorrector::operator=(const AliFMDMCCorrector& o) | |
886dd429 | 53 | { |
7984e5f7 | 54 | // |
55 | // Assignement operator | |
56 | // | |
57 | // Parameters: | |
58 | // o Object to assign from | |
59 | // | |
60 | // Return: | |
61 | // Reference to this object | |
62 | // | |
72cc12cd | 63 | AliFMDCorrector::operator=(o); |
5bb5d1f6 | 64 | fSecondaryForMC = o.fSecondaryForMC; |
886dd429 | 65 | return *this; |
66 | } | |
67 | ||
68 | //____________________________________________________________________ | |
69 | Bool_t | |
72cc12cd | 70 | AliFMDMCCorrector::CorrectMC(AliForwardUtil::Histos& hists, |
886dd429 | 71 | UShort_t vtxbin) |
72 | { | |
7984e5f7 | 73 | // |
74 | // Do the calculations | |
75 | // | |
76 | // Parameters: | |
77 | // hists Cache of histograms | |
78 | // vtxBin Vertex bin | |
79 | // | |
80 | // Return: | |
81 | // true on successs | |
82 | // | |
5bb5d1f6 | 83 | if ((!fUseSecondaryMap || !fSecondaryForMC) && fUseVertexBias) |
84 | return kTRUE; | |
85 | ||
886dd429 | 86 | AliForwardCorrectionManager& fcm = AliForwardCorrectionManager::Instance(); |
87 | ||
88 | UShort_t uvb = vtxbin; | |
89 | for (UShort_t d=1; d<=3; d++) { | |
90 | UShort_t nr = (d == 1 ? 1 : 2); | |
91 | for (UShort_t q=0; q<nr; q++) { | |
92 | Char_t r = (q == 0 ? 'I' : 'O'); | |
93 | TH2D* h = hists.Get(d,r); | |
7ec4d843 | 94 | |
95 | ||
5bb5d1f6 | 96 | if (fUseSecondaryMap && fSecondaryForMC) { |
7ec4d843 | 97 | TH2D* bg = fcm.GetSecondaryMap()->GetCorrection(d,r,uvb); |
98 | if (!bg) { | |
99 | AliWarning(Form("No secondary correction for FMDM%d%c in vertex bin %d", | |
100 | d, r, uvb)); | |
101 | continue; | |
102 | } | |
103 | // Divide by primary/total ratio | |
104 | h->Divide(bg); | |
886dd429 | 105 | } |
7ec4d843 | 106 | if (fUseVertexBias) { |
107 | TH2D* ef = fcm.GetVertexBias()->GetCorrection(r, uvb); | |
e58000b7 | 108 | if (!ef) { |
7ec4d843 | 109 | AliWarning(Form("No event vertex bias correction in vertex bin %d", |
886dd429 | 110 | uvb)); |
7ec4d843 | 111 | continue; |
112 | } | |
113 | // Divide by the event selection efficiency | |
114 | h->Divide(ef); | |
886dd429 | 115 | } |
886dd429 | 116 | } |
117 | } | |
118 | ||
119 | return kTRUE; | |
120 | } | |
121 | ||
122 | //____________________________________________________________________ | |
123 | void | |
72cc12cd | 124 | AliFMDMCCorrector::Init(const TAxis& eAxis) |
886dd429 | 125 | { |
7984e5f7 | 126 | // |
127 | // Initialize this object | |
128 | // | |
129 | // Parameters: | |
130 | // etaAxis Eta axis to use | |
131 | // | |
7ec4d843 | 132 | AliFMDCorrector::Init(eAxis); |
133 | ||
886dd429 | 134 | fFMD1i = Make(1,'I',eAxis); |
135 | fFMD2i = Make(2,'I',eAxis); | |
136 | fFMD2o = Make(2,'O',eAxis); | |
137 | fFMD3i = Make(3,'I',eAxis); | |
138 | fFMD3o = Make(3,'O',eAxis); | |
139 | ||
140 | fComps->Add(fFMD1i); | |
141 | fComps->Add(fFMD2i); | |
142 | fComps->Add(fFMD2o); | |
143 | fComps->Add(fFMD3i); | |
144 | fComps->Add(fFMD3o); | |
145 | } | |
146 | ||
147 | //____________________________________________________________________ | |
148 | TProfile2D* | |
72cc12cd | 149 | AliFMDMCCorrector::Make(UShort_t d, Char_t r, |
886dd429 | 150 | const TAxis& axis) const |
151 | { | |
7984e5f7 | 152 | // |
153 | // MAke comparison profiles | |
154 | // | |
155 | // Parameters: | |
156 | // d Detector | |
157 | // r Ring | |
158 | // axis Eta axis | |
159 | // | |
160 | // Return: | |
161 | // Newly allocated profile object | |
162 | // | |
886dd429 | 163 | TProfile2D* ret = new TProfile2D(Form("FMD%d%c_esd_vs_mc", d, r), |
164 | Form("ESD/MC signal for FMD%d%c", d, r), | |
165 | axis.GetNbins(), | |
166 | axis.GetXmin(), | |
167 | axis.GetXmax(), | |
168 | (r == 'I' || r == 'i') ? 20 : 40, | |
169 | 0, 2*TMath::Pi()); | |
170 | ret->GetXaxis()->SetTitle("#eta"); | |
171 | ret->GetYaxis()->SetTitle("#varphi [degrees]"); | |
172 | ret->GetZaxis()->SetTitle("#LT primary density ESD/MC#GT"); | |
173 | ret->SetDirectory(0); | |
174 | return ret; | |
175 | } | |
176 | //____________________________________________________________________ | |
177 | void | |
72cc12cd | 178 | AliFMDMCCorrector::Fill(UShort_t d, Char_t r, TH2* esd, TH2* mc) |
886dd429 | 179 | { |
7984e5f7 | 180 | // |
181 | // Fill comparison profiles | |
182 | // | |
183 | // Parameters: | |
184 | // d Detector | |
185 | // r Ring | |
186 | // esd ESD histogram | |
187 | // mc MC histogram | |
188 | // | |
886dd429 | 189 | if (!esd || !mc) return; |
190 | TProfile2D* p = 0; | |
191 | switch (d) { | |
192 | case 1: p = fFMD1i; break; | |
193 | case 2: p = (r == 'I' || r == 'i' ? fFMD2i : fFMD2o); break; | |
194 | case 3: p = (r == 'I' || r == 'i' ? fFMD3i : fFMD3o); break; | |
195 | } | |
196 | if (!p) return; | |
197 | ||
198 | for (Int_t iEta = 1; iEta <= esd->GetNbinsX(); iEta++) { | |
199 | Double_t eta = esd->GetXaxis()->GetBinCenter(iEta); | |
200 | for (Int_t iPhi = 1; iPhi <= esd->GetNbinsY(); iPhi++) { | |
201 | Double_t phi = esd->GetYaxis()->GetBinCenter(iPhi); | |
202 | Double_t mEsd = esd->GetBinContent(iEta,iPhi); | |
203 | Double_t mMc = mc->GetBinContent(iEta,iPhi); | |
204 | ||
205 | p->Fill(eta, phi, (mMc > 0 ? mEsd / mMc : 0)); | |
206 | } | |
207 | } | |
208 | } | |
209 | ||
210 | //____________________________________________________________________ | |
211 | Bool_t | |
72cc12cd | 212 | AliFMDMCCorrector::CompareResults(AliForwardUtil::Histos& esd, |
886dd429 | 213 | AliForwardUtil::Histos& mc) |
214 | { | |
7984e5f7 | 215 | // |
216 | // Compare the result of analysing the ESD for | |
217 | // the inclusive charged particle density to analysing | |
218 | // MC truth | |
219 | // | |
220 | // Parameters: | |
221 | // esd | |
222 | // mc | |
223 | // | |
224 | // Return: | |
225 | // true | |
226 | // | |
886dd429 | 227 | Fill(1, 'I', esd.Get(1,'I'), mc.Get(1,'I')); |
228 | Fill(2, 'I', esd.Get(2,'I'), mc.Get(2,'I')); | |
229 | Fill(2, 'O', esd.Get(2,'O'), mc.Get(2,'O')); | |
230 | Fill(3, 'I', esd.Get(3,'I'), mc.Get(3,'I')); | |
231 | Fill(3, 'O', esd.Get(3,'O'), mc.Get(3,'O')); | |
232 | ||
233 | return kTRUE; | |
234 | } | |
235 | ||
236 | //____________________________________________________________________ | |
237 | void | |
72cc12cd | 238 | AliFMDMCCorrector::DefineOutput(TList* dir) |
886dd429 | 239 | { |
7984e5f7 | 240 | // |
241 | // Output diagnostic histograms to directory | |
242 | // | |
243 | // Parameters: | |
244 | // dir List to write in | |
245 | // | |
72cc12cd | 246 | AliFMDCorrector::DefineOutput(dir); |
886dd429 | 247 | TList* d = static_cast<TList*>(dir->FindObject(GetName())); |
248 | ||
249 | fComps = new TList; | |
250 | fComps->SetName("esd_mc_comparison"); | |
251 | d->Add(fComps); | |
252 | } | |
5bb5d1f6 | 253 | //____________________________________________________________________ |
254 | void | |
255 | AliFMDMCCorrector::Print(Option_t* option) const | |
256 | { | |
257 | // | |
258 | // Print information | |
259 | // Parameters: | |
260 | // option Not used | |
261 | // | |
262 | char ind[gROOT->GetDirLevel()+1]; | |
263 | for (Int_t i = 0; i < gROOT->GetDirLevel(); i++) ind[i] = ' '; | |
264 | ind[gROOT->GetDirLevel()] = '\0'; | |
265 | AliFMDCorrector::Print(option); | |
266 | std::cout << std::boolalpha | |
267 | << ind << " Use sec. map on MC: " << fSecondaryForMC | |
268 | << std::noboolalpha << std::endl; | |
269 | } | |
886dd429 | 270 | |
271 | //____________________________________________________________________ | |
272 | // | |
273 | // EOF | |
274 | // | |
275 | ||
276 | ||
277 |