]>
Commit | Line | Data |
---|---|---|
1 | // | |
2 | // Calculate the corrections in the forward regions | |
3 | // | |
4 | // Inputs: | |
5 | // - AliESDEvent | |
6 | // | |
7 | // Outputs: | |
8 | // - AliAODForwardMult | |
9 | // | |
10 | // Histograms | |
11 | // | |
12 | // Corrections used | |
13 | // | |
14 | #include "AliForwardMCCorrectionsTask.h" | |
15 | #include "AliForwardCorrectionManager.h" | |
16 | #include "AliTriggerAnalysis.h" | |
17 | #include "AliPhysicsSelection.h" | |
18 | #include "AliLog.h" | |
19 | #include "AliHeader.h" | |
20 | #include "AliGenEventHeader.h" | |
21 | #include "AliESDEvent.h" | |
22 | #include "AliAODHandler.h" | |
23 | #include "AliMultiplicity.h" | |
24 | #include "AliInputEventHandler.h" | |
25 | #include "AliStack.h" | |
26 | #include "AliMCEvent.h" | |
27 | #include "AliAODForwardMult.h" | |
28 | #include "AliFMDStripIndex.h" | |
29 | #include "AliFMDCorrSecondaryMap.h" | |
30 | #include <TH1.h> | |
31 | #include <TH2D.h> | |
32 | #include <TDirectory.h> | |
33 | #include <TTree.h> | |
34 | #include <TList.h> | |
35 | #include <TROOT.h> | |
36 | #include <iostream> | |
37 | ||
38 | //==================================================================== | |
39 | AliForwardMCCorrectionsTask::AliForwardMCCorrectionsTask() | |
40 | : AliBaseMCCorrectionsTask(), | |
41 | fTrackDensity(), | |
42 | fESDFMD(), | |
43 | fSecCorr(0) | |
44 | { | |
45 | // | |
46 | // Constructor | |
47 | // | |
48 | // Parameters: | |
49 | // name Name of task | |
50 | // | |
51 | } | |
52 | ||
53 | //____________________________________________________________________ | |
54 | AliForwardMCCorrectionsTask::AliForwardMCCorrectionsTask(const char* name) | |
55 | : AliBaseMCCorrectionsTask(name, &(AliForwardCorrectionManager::Instance())), | |
56 | fTrackDensity("trackDensity"), | |
57 | fESDFMD(), | |
58 | fSecCorr(0) | |
59 | { | |
60 | // | |
61 | // Constructor | |
62 | // | |
63 | // Parameters: | |
64 | // name Name of task | |
65 | } | |
66 | ||
67 | ||
68 | //____________________________________________________________________ | |
69 | AliBaseMCCorrectionsTask::VtxBin* | |
70 | AliForwardMCCorrectionsTask::CreateVtxBin(Double_t low, Double_t high) | |
71 | { | |
72 | return new AliForwardMCCorrectionsTask::VtxBin(low,high, fEtaAxis); | |
73 | } | |
74 | ||
75 | //____________________________________________________________________ | |
76 | Bool_t | |
77 | AliForwardMCCorrectionsTask::PreEvent() | |
78 | { | |
79 | // Clear our ESD object | |
80 | fESDFMD.Clear(); | |
81 | return true; | |
82 | } | |
83 | ||
84 | //____________________________________________________________________ | |
85 | Bool_t | |
86 | AliForwardMCCorrectionsTask::ProcessESD(const AliESDEvent& esd, | |
87 | const AliMCEvent& mc, | |
88 | AliBaseMCCorrectionsTask::VtxBin& bin, | |
89 | Double_t vz) | |
90 | { | |
91 | AliESDFMD* esdFMD = esd.GetFMDData(); | |
92 | ||
93 | fTrackDensity.Calculate(*esdFMD, mc, vz, fESDFMD, bin.fPrimary); | |
94 | bin.fCounts->Fill(0.5); | |
95 | ||
96 | AliForwardMCCorrectionsTask::VtxBin& vb = | |
97 | static_cast<AliForwardMCCorrectionsTask::VtxBin&>(bin); | |
98 | ||
99 | // And then bin the data in our vtxbin | |
100 | for (UShort_t d=1; d<=3; d++) { | |
101 | UShort_t nr = (d == 1 ? 1 : 2); | |
102 | for (UShort_t q=0; q<nr; q++) { | |
103 | Char_t r = (q == 0 ? 'I' : 'O'); | |
104 | UShort_t ns= (q == 0 ? 20 : 40); | |
105 | UShort_t nt= (q == 0 ? 512 : 256); | |
106 | TH2D* h = vb.fHists.Get(d,r); | |
107 | ||
108 | for (UShort_t s=0; s<ns; s++) { | |
109 | for (UShort_t t=0; t<nt; t++) { | |
110 | Float_t mult = fESDFMD.Multiplicity(d,r,s,t); | |
111 | ||
112 | if (mult == 0 || mult > 20) continue; | |
113 | ||
114 | Float_t phi = fESDFMD.Phi(d,r,s,t) / 180 * TMath::Pi(); | |
115 | Float_t eta = fESDFMD.Eta(d,r,s,t); | |
116 | h->Fill(eta,phi,mult); | |
117 | } // for t | |
118 | } // for s | |
119 | } // for q | |
120 | } // for d | |
121 | return true; | |
122 | } | |
123 | //____________________________________________________________________ | |
124 | void | |
125 | AliForwardMCCorrectionsTask::CreateCorrections(TList* results) | |
126 | { | |
127 | fSecCorr = new AliFMDCorrSecondaryMap; | |
128 | fSecCorr->SetVertexAxis(fVtxAxis); | |
129 | fSecCorr->SetEtaAxis(fEtaAxis); | |
130 | results->Add(fSecCorr); | |
131 | } | |
132 | ||
133 | //____________________________________________________________________ | |
134 | Bool_t | |
135 | AliForwardMCCorrectionsTask::FinalizeVtxBin(AliBaseMCCorrectionsTask::VtxBin* | |
136 | bin, UShort_t iVz) | |
137 | { | |
138 | ||
139 | AliForwardMCCorrectionsTask::VtxBin* vb = | |
140 | static_cast<AliForwardMCCorrectionsTask::VtxBin*>(bin); | |
141 | vb->Terminate(fList, fResults, iVz, fSecCorr); | |
142 | return true; | |
143 | } | |
144 | ||
145 | ||
146 | //____________________________________________________________________ | |
147 | void | |
148 | AliForwardMCCorrectionsTask::Print(Option_t* option) const | |
149 | { | |
150 | AliBaseMCCorrectionsTask::Print(option); | |
151 | gROOT->IncreaseDirLevel(); | |
152 | fTrackDensity.Print(option); | |
153 | gROOT->DecreaseDirLevel(); | |
154 | } | |
155 | ||
156 | //==================================================================== | |
157 | AliForwardMCCorrectionsTask::VtxBin::VtxBin() | |
158 | : AliBaseMCCorrectionsTask::VtxBin(), | |
159 | fHists() | |
160 | { | |
161 | } | |
162 | //____________________________________________________________________ | |
163 | AliForwardMCCorrectionsTask::VtxBin::VtxBin(Double_t low, | |
164 | Double_t high, | |
165 | const TAxis& axis) | |
166 | : AliBaseMCCorrectionsTask::VtxBin(low, high, axis, 40), | |
167 | fHists() | |
168 | { | |
169 | fHists.Init(axis); | |
170 | } | |
171 | ||
172 | ||
173 | //____________________________________________________________________ | |
174 | TList* | |
175 | AliForwardMCCorrectionsTask::VtxBin::CreateOutputObjects(TList* l) | |
176 | { | |
177 | TList* d = AliBaseMCCorrectionsTask::VtxBin::CreateOutputObjects(l); | |
178 | ||
179 | d->Add(fHists.fFMD1i); | |
180 | d->Add(fHists.fFMD2i); | |
181 | d->Add(fHists.fFMD2o); | |
182 | d->Add(fHists.fFMD3i); | |
183 | d->Add(fHists.fFMD3o); | |
184 | ||
185 | return d; | |
186 | } | |
187 | ||
188 | //____________________________________________________________________ | |
189 | TH2D* | |
190 | AliForwardMCCorrectionsTask::VtxBin::MakeBg(const TH2D* hits, | |
191 | const TH2D* primary) const | |
192 | { | |
193 | TH2D* h = static_cast<TH2D*>(hits->Clone()); | |
194 | h->SetDirectory(0); | |
195 | TString n(h->GetName()); | |
196 | n.ReplaceAll("_cache", ""); | |
197 | h->SetName(n); | |
198 | h->Divide(primary); | |
199 | ||
200 | return h; | |
201 | } | |
202 | ||
203 | //____________________________________________________________________ | |
204 | void | |
205 | AliForwardMCCorrectionsTask::VtxBin::Terminate(const TList* input, | |
206 | TList* output, | |
207 | UShort_t iVz, | |
208 | AliFMDCorrSecondaryMap* map) | |
209 | { | |
210 | TList* out = new TList; | |
211 | out->SetName(GetName()); | |
212 | out->SetOwner(); | |
213 | output->Add(out); | |
214 | ||
215 | TList* l = static_cast<TList*>(input->FindObject(GetName())); | |
216 | if (!l) { | |
217 | AliError(Form("List %s not found in %s", GetName(), input->GetName())); | |
218 | return; | |
219 | } | |
220 | ||
221 | TH2D* fmd1i = static_cast<TH2D*>(l->FindObject("FMD1I_cache")); | |
222 | TH2D* fmd2i = static_cast<TH2D*>(l->FindObject("FMD2I_cache")); | |
223 | TH2D* fmd2o = static_cast<TH2D*>(l->FindObject("FMD2O_cache")); | |
224 | TH2D* fmd3i = static_cast<TH2D*>(l->FindObject("FMD3I_cache")); | |
225 | TH2D* fmd3o = static_cast<TH2D*>(l->FindObject("FMD3O_cache")); | |
226 | TH2D* primO = static_cast<TH2D*>(l->FindObject("primary")); | |
227 | if (!fmd1i || !fmd2i || !fmd2o || !fmd3i || !fmd3o || !primO) { | |
228 | AliError(Form("Missing histogram(s): %p,%p,%p,%p,%p,%p", | |
229 | fmd1i, fmd2i, fmd2o, fmd3i, fmd3o, primO)); | |
230 | return; | |
231 | } | |
232 | ||
233 | // Half coverage in phi for inners | |
234 | TH2D* primI = static_cast<TH2D*>(primO->Clone()); | |
235 | primI->SetDirectory(0); | |
236 | primI->RebinY(2); | |
237 | ||
238 | TH2D* bg1i = MakeBg(fmd1i, primI); | |
239 | TH2D* bg2i = MakeBg(fmd2i, primI); | |
240 | TH2D* bg2o = MakeBg(fmd2o, primO); | |
241 | TH2D* bg3i = MakeBg(fmd3i, primI); | |
242 | TH2D* bg3o = MakeBg(fmd3o, primO); | |
243 | map->SetCorrection(1, 'I', iVz, bg1i); | |
244 | map->SetCorrection(2, 'I', iVz, bg2i); | |
245 | map->SetCorrection(2, 'O', iVz, bg2o); | |
246 | map->SetCorrection(3, 'I', iVz, bg3i); | |
247 | map->SetCorrection(3, 'O', iVz, bg3o); | |
248 | out->Add(bg1i); | |
249 | out->Add(bg2i); | |
250 | out->Add(bg2o); | |
251 | out->Add(bg3i); | |
252 | out->Add(bg3o); | |
253 | ||
254 | } | |
255 | ||
256 | // | |
257 | // EOF | |
258 | // |