]>
Commit | Line | Data |
---|---|---|
7984e5f7 | 1 | // |
2 | // Calculate the multiplicity in the forward regions event-by-event | |
3 | // | |
4 | // Inputs: | |
5 | // - AliESDEvent | |
6 | // | |
7 | // Outputs: | |
8 | // - AliAODForwardMult | |
9 | // | |
10 | // Histograms | |
11 | // | |
12 | // Corrections used | |
13 | // | |
0bd4b00f | 14 | #include "AliForwardMultiplicityTask.h" |
7e4038b5 | 15 | #include "AliTriggerAnalysis.h" |
16 | #include "AliPhysicsSelection.h" | |
17 | #include "AliLog.h" | |
7e4038b5 | 18 | #include "AliESDEvent.h" |
19 | #include "AliAODHandler.h" | |
20 | #include "AliMultiplicity.h" | |
21 | #include "AliInputEventHandler.h" | |
0bd4b00f | 22 | #include "AliForwardCorrectionManager.h" |
23 | #include "AliAnalysisManager.h" | |
7e4038b5 | 24 | #include <TH1.h> |
25 | #include <TDirectory.h> | |
26 | #include <TTree.h> | |
0bd4b00f | 27 | #include <TROOT.h> |
7ec4d843 | 28 | |
7e4038b5 | 29 | |
30 | //==================================================================== | |
0bd4b00f | 31 | AliForwardMultiplicityTask::AliForwardMultiplicityTask() |
eb865a4f | 32 | : AliForwardMultiplicityBase(), |
7e4038b5 | 33 | fHData(0), |
7e4038b5 | 34 | fESDFMD(), |
35 | fHistos(), | |
36 | fAODFMD(), | |
5bb5d1f6 | 37 | fRingSums(), |
fffea31d | 38 | fEventInspector(), |
7e4038b5 | 39 | fSharingFilter(), |
40 | fDensityCalculator(), | |
41 | fCorrections(), | |
42 | fHistCollector(), | |
fffea31d | 43 | fList(0) |
7e4038b5 | 44 | { |
7984e5f7 | 45 | // |
46 | // Constructor | |
47 | // | |
7e4038b5 | 48 | } |
49 | ||
50 | //____________________________________________________________________ | |
0bd4b00f | 51 | AliForwardMultiplicityTask::AliForwardMultiplicityTask(const char* name) |
eb865a4f | 52 | : AliForwardMultiplicityBase(name), |
7e4038b5 | 53 | fHData(0), |
7e4038b5 | 54 | fESDFMD(), |
55 | fHistos(), | |
4cbdf467 | 56 | fAODFMD(false), |
5bb5d1f6 | 57 | fRingSums(), |
fffea31d | 58 | fEventInspector("event"), |
7e4038b5 | 59 | fSharingFilter("sharing"), |
60 | fDensityCalculator("density"), | |
61 | fCorrections("corrections"), | |
62 | fHistCollector("collector"), | |
fffea31d | 63 | fList(0) |
7e4038b5 | 64 | { |
7984e5f7 | 65 | // |
66 | // Constructor | |
67 | // | |
68 | // Parameters: | |
69 | // name Name of task | |
70 | // | |
7e4038b5 | 71 | DefineOutput(1, TList::Class()); |
7e4038b5 | 72 | } |
73 | ||
74 | //____________________________________________________________________ | |
0bd4b00f | 75 | AliForwardMultiplicityTask::AliForwardMultiplicityTask(const AliForwardMultiplicityTask& o) |
eb865a4f | 76 | : AliForwardMultiplicityBase(o), |
7e4038b5 | 77 | fHData(o.fHData), |
7e4038b5 | 78 | fESDFMD(o.fESDFMD), |
79 | fHistos(o.fHistos), | |
80 | fAODFMD(o.fAODFMD), | |
5bb5d1f6 | 81 | fRingSums(o.fRingSums), |
fffea31d | 82 | fEventInspector(o.fEventInspector), |
7e4038b5 | 83 | fSharingFilter(o.fSharingFilter), |
84 | fDensityCalculator(o.fDensityCalculator), | |
85 | fCorrections(o.fCorrections), | |
86 | fHistCollector(o.fHistCollector), | |
fffea31d | 87 | fList(o.fList) |
7e4038b5 | 88 | { |
7984e5f7 | 89 | // |
90 | // Copy constructor | |
91 | // | |
92 | // Parameters: | |
93 | // o Object to copy from | |
94 | // | |
0bd4b00f | 95 | DefineOutput(1, TList::Class()); |
7e4038b5 | 96 | } |
97 | ||
98 | //____________________________________________________________________ | |
0bd4b00f | 99 | AliForwardMultiplicityTask& |
100 | AliForwardMultiplicityTask::operator=(const AliForwardMultiplicityTask& o) | |
7e4038b5 | 101 | { |
7984e5f7 | 102 | // |
103 | // Assignment operator | |
104 | // | |
105 | // Parameters: | |
106 | // o Object to assign from | |
107 | // | |
108 | // Return: | |
109 | // Reference to this object | |
110 | // | |
d015ecfe | 111 | if (&o == this) return *this; |
eb865a4f | 112 | AliForwardMultiplicityBase::operator=(o); |
fffea31d | 113 | |
7e4038b5 | 114 | fHData = o.fHData; |
fffea31d | 115 | fEventInspector = o.fEventInspector; |
7e4038b5 | 116 | fSharingFilter = o.fSharingFilter; |
117 | fDensityCalculator = o.fDensityCalculator; | |
118 | fCorrections = o.fCorrections; | |
119 | fHistCollector = o.fHistCollector; | |
120 | fHistos = o.fHistos; | |
121 | fAODFMD = o.fAODFMD; | |
5bb5d1f6 | 122 | fRingSums = o.fRingSums; |
7e4038b5 | 123 | fList = o.fList; |
7e4038b5 | 124 | |
125 | return *this; | |
126 | } | |
127 | ||
fffea31d | 128 | //____________________________________________________________________ |
129 | void | |
0bd4b00f | 130 | AliForwardMultiplicityTask::SetDebug(Int_t dbg) |
fffea31d | 131 | { |
7984e5f7 | 132 | // |
133 | // Set debug level | |
134 | // | |
135 | // Parameters: | |
136 | // dbg Debug level | |
137 | // | |
fffea31d | 138 | fEventInspector.SetDebug(dbg); |
fffea31d | 139 | fSharingFilter.SetDebug(dbg); |
140 | fDensityCalculator.SetDebug(dbg); | |
141 | fCorrections.SetDebug(dbg); | |
142 | fHistCollector.SetDebug(dbg); | |
143 | } | |
144 | ||
7e4038b5 | 145 | //____________________________________________________________________ |
146 | void | |
0bd4b00f | 147 | AliForwardMultiplicityTask::InitializeSubs() |
7e4038b5 | 148 | { |
7984e5f7 | 149 | // |
150 | // Initialise the sub objects and stuff. Called on first event | |
151 | // | |
152 | // | |
7ec4d843 | 153 | const TAxis* pe = 0; |
154 | const TAxis* pv = 0; | |
0bd4b00f | 155 | |
7ec4d843 | 156 | if (!ReadCorrections(pe,pv)) return; |
fffea31d | 157 | |
0bd4b00f | 158 | fHistos.Init(*pe); |
159 | fAODFMD.Init(*pe); | |
5bb5d1f6 | 160 | fRingSums.Init(*pe); |
7e4038b5 | 161 | |
162 | fHData = static_cast<TH2D*>(fAODFMD.GetHistogram().Clone("d2Ndetadphi")); | |
163 | fHData->SetStats(0); | |
164 | fHData->SetDirectory(0); | |
9d99b0dd | 165 | fList->Add(fHData); |
166 | ||
5bb5d1f6 | 167 | TList* rings = new TList; |
168 | rings->SetName("ringSums"); | |
169 | rings->SetOwner(); | |
170 | fList->Add(rings); | |
171 | ||
172 | rings->Add(fRingSums.Get(1, 'I')); | |
173 | rings->Add(fRingSums.Get(2, 'I')); | |
174 | rings->Add(fRingSums.Get(2, 'O')); | |
175 | rings->Add(fRingSums.Get(3, 'I')); | |
176 | rings->Add(fRingSums.Get(3, 'O')); | |
177 | fRingSums.Get(1, 'I')->SetMarkerColor(AliForwardUtil::RingColor(1, 'I')); | |
178 | fRingSums.Get(2, 'I')->SetMarkerColor(AliForwardUtil::RingColor(2, 'I')); | |
179 | fRingSums.Get(2, 'O')->SetMarkerColor(AliForwardUtil::RingColor(2, 'O')); | |
180 | fRingSums.Get(3, 'I')->SetMarkerColor(AliForwardUtil::RingColor(3, 'I')); | |
181 | fRingSums.Get(3, 'O')->SetMarkerColor(AliForwardUtil::RingColor(3, 'O')); | |
182 | ||
0bd4b00f | 183 | fEventInspector.Init(*pv); |
5bb5d1f6 | 184 | fSharingFilter.Init(); |
1174780f | 185 | fDensityCalculator.Init(*pe); |
7ec4d843 | 186 | fCorrections.Init(*pe); |
12fffad7 | 187 | fHistCollector.Init(*pv,*pe); |
0bd4b00f | 188 | |
189 | this->Print(); | |
7e4038b5 | 190 | } |
191 | ||
192 | //____________________________________________________________________ | |
193 | void | |
0bd4b00f | 194 | AliForwardMultiplicityTask::UserCreateOutputObjects() |
7e4038b5 | 195 | { |
7984e5f7 | 196 | // |
197 | // Create output objects | |
198 | // | |
199 | // | |
7e4038b5 | 200 | fList = new TList; |
9d05ffeb | 201 | fList->SetOwner(); |
7e4038b5 | 202 | |
203 | AliAnalysisManager* am = AliAnalysisManager::GetAnalysisManager(); | |
0bd4b00f | 204 | AliAODHandler* ah = |
205 | dynamic_cast<AliAODHandler*>(am->GetOutputEventHandler()); | |
fffea31d | 206 | if (!ah) AliFatal("No AOD output handler set in analysis manager"); |
7e4038b5 | 207 | |
208 | ||
209 | TObject* obj = &fAODFMD; | |
210 | ah->AddBranch("AliAODForwardMult", &obj); | |
211 | ||
fffea31d | 212 | fEventInspector.DefineOutput(fList); |
9d99b0dd | 213 | fSharingFilter.DefineOutput(fList); |
214 | fDensityCalculator.DefineOutput(fList); | |
215 | fCorrections.DefineOutput(fList); | |
12fffad7 | 216 | fHistCollector.DefineOutput(fList); |
0bd4b00f | 217 | |
218 | PostData(1, fList); | |
7e4038b5 | 219 | } |
220 | //____________________________________________________________________ | |
221 | void | |
0bd4b00f | 222 | AliForwardMultiplicityTask::UserExec(Option_t*) |
7e4038b5 | 223 | { |
7984e5f7 | 224 | // |
225 | // Process each event | |
226 | // | |
227 | // Parameters: | |
228 | // option Not used | |
229 | // | |
230 | ||
0bd4b00f | 231 | // static Int_t cnt = 0; |
232 | // cnt++; | |
7e4038b5 | 233 | // Get the input data |
7ec4d843 | 234 | AliESDEvent* esd = GetESDEvent(); |
7e4038b5 | 235 | |
7e4038b5 | 236 | // Clear stuff |
237 | fHistos.Clear(); | |
238 | fESDFMD.Clear(); | |
239 | fAODFMD.Clear(); | |
e58000b7 | 240 | |
5bb5d1f6 | 241 | Bool_t lowFlux = kFALSE; |
242 | UInt_t triggers = 0; | |
243 | UShort_t ivz = 0; | |
244 | Double_t vz = 0; | |
245 | Double_t cent = -1; | |
246 | UShort_t nClusters = 0; | |
247 | UInt_t found = fEventInspector.Process(esd, triggers, lowFlux, | |
248 | ivz, vz, cent, nClusters); | |
e58000b7 | 249 | |
9bff843b | 250 | if (found & AliFMDEventInspector::kNoEvent) return; |
251 | if (found & AliFMDEventInspector::kNoTriggers) return; | |
252 | ||
fffea31d | 253 | // Set trigger bits, and mark this event for storage |
9d99b0dd | 254 | fAODFMD.SetTriggerBits(triggers); |
b2e7f2d6 | 255 | fAODFMD.SetSNN(fEventInspector.GetEnergy()); |
256 | fAODFMD.SetSystem(fEventInspector.GetCollisionSystem()); | |
e58000b7 | 257 | fAODFMD.SetCentrality(cent); |
5bb5d1f6 | 258 | fAODFMD.SetNClusters(nClusters); |
7e4038b5 | 259 | MarkEventForStore(); |
e58000b7 | 260 | |
3c5497d0 | 261 | if (found & AliFMDEventInspector::kNoSPD) return; |
262 | if (found & AliFMDEventInspector::kNoFMD) return; | |
263 | if (found & AliFMDEventInspector::kNoVertex) return; | |
e58000b7 | 264 | |
265 | if (triggers & AliAODForwardMult::kPileUp) return; | |
266 | ||
fffea31d | 267 | fAODFMD.SetIpZ(vz); |
7e4038b5 | 268 | |
fffea31d | 269 | if (found & AliFMDEventInspector::kBadVertex) return; |
7e4038b5 | 270 | |
0bd4b00f | 271 | // We we do not want to use low flux specific code, we disable it here. |
272 | if (!fEnableLowFlux) lowFlux = false; | |
273 | ||
fffea31d | 274 | // Get FMD data |
275 | AliESDFMD* esdFMD = esd->GetFMDData(); | |
12fffad7 | 276 | // // Apply the sharing filter (or hit merging or clustering if you like) |
fffea31d | 277 | if (!fSharingFilter.Filter(*esdFMD, lowFlux, fESDFMD)) { |
278 | AliWarning("Sharing filter failed!"); | |
7e4038b5 | 279 | return; |
280 | } | |
281 | ||
7e4038b5 | 282 | // Calculate the inclusive charged particle density |
21d778b1 | 283 | if (!fDensityCalculator.Calculate(fESDFMD, fHistos, ivz, lowFlux, cent)) { |
f7cfc454 | 284 | // if (!fDensityCalculator.Calculate(*esdFMD, fHistos, ivz, lowFlux)) { |
7e4038b5 | 285 | AliWarning("Density calculator failed!"); |
286 | return; | |
287 | } | |
288 | ||
289 | // Do the secondary and other corrections. | |
290 | if (!fCorrections.Correct(fHistos, ivz)) { | |
291 | AliWarning("Corrections failed"); | |
292 | return; | |
293 | } | |
294 | ||
5bb5d1f6 | 295 | if (!fHistCollector.Collect(fHistos, fRingSums, |
296 | ivz, fAODFMD.GetHistogram())) { | |
7e4038b5 | 297 | AliWarning("Histogram collector failed"); |
298 | return; | |
299 | } | |
300 | ||
301 | if (fAODFMD.IsTriggerBits(AliAODForwardMult::kInel)) | |
302 | fHData->Add(&(fAODFMD.GetHistogram())); | |
2d68d438 | 303 | |
304 | PostData(1, fList); | |
7e4038b5 | 305 | } |
306 | ||
307 | //____________________________________________________________________ | |
308 | void | |
0bd4b00f | 309 | AliForwardMultiplicityTask::Terminate(Option_t*) |
7e4038b5 | 310 | { |
7984e5f7 | 311 | // |
312 | // End of job | |
313 | // | |
314 | // Parameters: | |
315 | // option Not used | |
316 | // | |
317 | ||
7e4038b5 | 318 | TList* list = dynamic_cast<TList*>(GetOutputData(1)); |
319 | if (!list) { | |
2d68d438 | 320 | AliError(Form("No output list defined (%p)", GetOutputData(1))); |
321 | if (GetOutputData(1)) GetOutputData(1)->Print(); | |
7e4038b5 | 322 | return; |
323 | } | |
9d99b0dd | 324 | |
325 | // Get our histograms from the container | |
fffea31d | 326 | TH1I* hEventsTr = 0;//static_cast<TH1I*>(list->FindObject("nEventsTr")); |
327 | TH1I* hEventsTrVtx = 0;//static_cast<TH1I*>(list->FindObject("nEventsTrVtx")); | |
328 | TH1I* hTriggers = 0; | |
329 | if (!fEventInspector.FetchHistograms(list, hEventsTr, | |
330 | hEventsTrVtx, hTriggers)) { | |
331 | AliError(Form("Didn't get histograms from event selector " | |
332 | "(hEventsTr=%p,hEventsTrVtx=%p)", | |
333 | hEventsTr, hEventsTrVtx)); | |
334 | list->ls(); | |
335 | return; | |
336 | } | |
337 | ||
9d99b0dd | 338 | TH2D* hData = static_cast<TH2D*>(list->FindObject("d2Ndetadphi")); |
fffea31d | 339 | if (!hData) { |
340 | AliError(Form("Couldn't get our summed histogram from output " | |
341 | "list %s (d2Ndetadphi=%p)", list->GetName(), hData)); | |
2d68d438 | 342 | list->ls(); |
343 | return; | |
344 | } | |
9d99b0dd | 345 | |
7e4038b5 | 346 | // TH1D* dNdeta = fHData->ProjectionX("dNdeta", 0, -1, "e"); |
9d99b0dd | 347 | TH1D* dNdeta = hData->ProjectionX("dNdeta", 1, -1, "e"); |
12fffad7 | 348 | TH1D* norm = hData->ProjectionX("norm", 0, 0, ""); |
7e4038b5 | 349 | dNdeta->SetTitle("dN_{ch}/d#eta in the forward regions"); |
350 | dNdeta->SetYTitle("#frac{1}{N}#frac{dN_{ch}}{d#eta}"); | |
351 | dNdeta->Divide(norm); | |
352 | dNdeta->SetStats(0); | |
9d99b0dd | 353 | dNdeta->Scale(Double_t(hEventsTrVtx->GetEntries())/hEventsTr->GetEntries(), |
7e4038b5 | 354 | "width"); |
7e4038b5 | 355 | list->Add(dNdeta); |
0bd4b00f | 356 | list->Add(norm); |
fffea31d | 357 | |
5bb5d1f6 | 358 | MakeRingdNdeta(list, "ringSums", list, "ringResults"); |
359 | ||
6feacd76 | 360 | fSharingFilter.ScaleHistograms(list,Int_t(hEventsTr->Integral())); |
361 | fDensityCalculator.ScaleHistograms(list,Int_t(hEventsTrVtx->Integral())); | |
362 | fCorrections.ScaleHistograms(list,Int_t(hEventsTrVtx->Integral())); | |
7e4038b5 | 363 | } |
7e4038b5 | 364 | |
365 | // | |
366 | // EOF | |
367 | // |