]>
Commit | Line | Data |
---|---|---|
1 | // | |
2 | // This class inspects the event | |
3 | // | |
4 | // Input: | |
5 | // - AliESDFMD object possibly corrected for sharing | |
6 | // | |
7 | // Output: | |
8 | // - A histogram of v_z of events with triggers. | |
9 | // - A histogram of v_z of events with vertex and triggers | |
10 | // - A histogram of trigger counters | |
11 | // | |
12 | // Note, that these are added to the master output list | |
13 | // | |
14 | // Corrections used: | |
15 | // - None | |
16 | // | |
17 | #include "AliFMDEventInspector.h" | |
18 | #include "AliLog.h" | |
19 | #include "AliESDEvent.h" | |
20 | #include "AliMultiplicity.h" | |
21 | #include "AliAnalysisManager.h" | |
22 | #include "AliInputEventHandler.h" | |
23 | #include "AliTriggerAnalysis.h" | |
24 | #include "AliPhysicsSelection.h" | |
25 | #include "AliAODForwardMult.h" | |
26 | #include "AliForwardUtil.h" | |
27 | #include "AliCentrality.h" | |
28 | #include <TH1.h> | |
29 | #include <TList.h> | |
30 | #include <TDirectory.h> | |
31 | #include <TROOT.h> | |
32 | #include <iostream> | |
33 | #include <iomanip> | |
34 | ||
35 | //==================================================================== | |
36 | AliFMDEventInspector::AliFMDEventInspector() | |
37 | : TNamed(), | |
38 | fHEventsTr(0), | |
39 | fHEventsTrVtx(0), | |
40 | fHEventsAccepted(0), | |
41 | fHTriggers(0), | |
42 | fHType(0), | |
43 | fHWords(0), | |
44 | fHCent(0), | |
45 | fHCentVsQual(0), | |
46 | fLowFluxCut(1000), | |
47 | fMaxVzErr(0.2), | |
48 | fList(0), | |
49 | fEnergy(0), | |
50 | fField(999), | |
51 | fCollisionSystem(kUnknown), | |
52 | fDebug(0), | |
53 | fCentAxis(0), | |
54 | fVtxAxis(10,-10,10) | |
55 | { | |
56 | // | |
57 | // Constructor | |
58 | // | |
59 | } | |
60 | ||
61 | //____________________________________________________________________ | |
62 | AliFMDEventInspector::AliFMDEventInspector(const char* name) | |
63 | : TNamed("fmdEventInspector", name), | |
64 | fHEventsTr(0), | |
65 | fHEventsTrVtx(0), | |
66 | fHEventsAccepted(0), | |
67 | fHTriggers(0), | |
68 | fHType(0), | |
69 | fHWords(0), | |
70 | fHCent(0), | |
71 | fHCentVsQual(0), | |
72 | fLowFluxCut(1000), | |
73 | fMaxVzErr(0.2), | |
74 | fList(0), | |
75 | fEnergy(0), | |
76 | fField(999), | |
77 | fCollisionSystem(kUnknown), | |
78 | fDebug(0), | |
79 | fCentAxis(0), | |
80 | fVtxAxis(10,-10,10) | |
81 | { | |
82 | // | |
83 | // Constructor | |
84 | // | |
85 | // Parameters: | |
86 | // name Name of object | |
87 | // | |
88 | } | |
89 | ||
90 | //____________________________________________________________________ | |
91 | AliFMDEventInspector::AliFMDEventInspector(const AliFMDEventInspector& o) | |
92 | : TNamed(o), | |
93 | fHEventsTr(o.fHEventsTr), | |
94 | fHEventsTrVtx(o.fHEventsTrVtx), | |
95 | fHEventsAccepted(o.fHEventsAccepted), | |
96 | fHTriggers(o.fHTriggers), | |
97 | fHType(o.fHType), | |
98 | fHWords(o.fHWords), | |
99 | fHCent(o.fHCent), | |
100 | fHCentVsQual(o.fHCentVsQual), | |
101 | fLowFluxCut(o.fLowFluxCut), | |
102 | fMaxVzErr(o.fMaxVzErr), | |
103 | fList(o.fList), | |
104 | fEnergy(o.fEnergy), | |
105 | fField(o.fField), | |
106 | fCollisionSystem(o.fCollisionSystem), | |
107 | fDebug(0), | |
108 | fCentAxis(0), | |
109 | fVtxAxis(o.fVtxAxis) | |
110 | { | |
111 | // | |
112 | // Copy constructor | |
113 | // | |
114 | // Parameters: | |
115 | // o Object to copy from | |
116 | // | |
117 | } | |
118 | ||
119 | //____________________________________________________________________ | |
120 | AliFMDEventInspector::~AliFMDEventInspector() | |
121 | { | |
122 | // | |
123 | // Destructor | |
124 | // | |
125 | if (fList) delete fList; | |
126 | } | |
127 | //____________________________________________________________________ | |
128 | AliFMDEventInspector& | |
129 | AliFMDEventInspector::operator=(const AliFMDEventInspector& o) | |
130 | { | |
131 | // | |
132 | // Assignement operator | |
133 | // | |
134 | // Parameters: | |
135 | // o Object to assign from | |
136 | // | |
137 | // Return: | |
138 | // Reference to this object | |
139 | // | |
140 | TNamed::operator=(o); | |
141 | fHEventsTr = o.fHEventsTr; | |
142 | fHEventsTrVtx = o.fHEventsTrVtx; | |
143 | fHEventsAccepted = o.fHEventsAccepted; | |
144 | fHTriggers = o.fHTriggers; | |
145 | fHType = o.fHType; | |
146 | fHWords = o.fHWords; | |
147 | fHCent = o.fHCent; | |
148 | fHCentVsQual = o.fHCentVsQual; | |
149 | fLowFluxCut = o.fLowFluxCut; | |
150 | fMaxVzErr = o.fMaxVzErr; | |
151 | fDebug = o.fDebug; | |
152 | fList = (o.fList ? new TList : 0); | |
153 | fEnergy = o.fEnergy; | |
154 | fField = o.fField; | |
155 | fCollisionSystem = o.fCollisionSystem; | |
156 | fVtxAxis.Set(o.fVtxAxis.GetNbins(), o.fVtxAxis.GetXmin(), | |
157 | o.fVtxAxis.GetXmax()); | |
158 | if (fList) { | |
159 | fList->SetName(GetName()); | |
160 | if (fHEventsTr) fList->Add(fHEventsTr); | |
161 | if (fHEventsTrVtx) fList->Add(fHEventsTrVtx); | |
162 | if (fHTriggers) fList->Add(fHTriggers); | |
163 | if (fHType) fList->Add(fHType); | |
164 | if (fHWords) fList->Add(fHWords); | |
165 | if (fHCent) fList->Add(fHCent); | |
166 | if (fHCentVsQual) fList->Add(fHCentVsQual); | |
167 | } | |
168 | return *this; | |
169 | } | |
170 | ||
171 | //____________________________________________________________________ | |
172 | Bool_t | |
173 | AliFMDEventInspector::FetchHistograms(const TList* d, | |
174 | TH1I*& hEventsTr, | |
175 | TH1I*& hEventsTrVtx, | |
176 | TH1I*& hTriggers) const | |
177 | { | |
178 | // | |
179 | // Fetch our histograms from the passed list | |
180 | // | |
181 | // Parameters: | |
182 | // d Input | |
183 | // hEventsTr On return, pointer to histogram, or null | |
184 | // hEventsTrVtx On return, pointer to histogram, or null | |
185 | // hTriggers On return, pointer to histogram, or null | |
186 | // | |
187 | // Return: | |
188 | // true on success, false otherwise | |
189 | // | |
190 | hEventsTr = 0; | |
191 | hEventsTrVtx = 0; | |
192 | hTriggers = 0; | |
193 | TList* dd = dynamic_cast<TList*>(d->FindObject(GetName())); | |
194 | if (!dd) return kFALSE; | |
195 | ||
196 | hEventsTr = dynamic_cast<TH1I*>(dd->FindObject("nEventsTr")); | |
197 | hEventsTrVtx = dynamic_cast<TH1I*>(dd->FindObject("nEventsTrVtx")); | |
198 | hTriggers = dynamic_cast<TH1I*>(dd->FindObject("triggers")); | |
199 | ||
200 | if (!hEventsTr || !hEventsTrVtx || !hTriggers) return kFALSE; | |
201 | return kTRUE; | |
202 | } | |
203 | //____________________________________________________________________ | |
204 | void | |
205 | AliFMDEventInspector::Init(const TAxis& vtxAxis) | |
206 | { | |
207 | // | |
208 | // Initialize the object | |
209 | // | |
210 | // Parameters: | |
211 | // vtxAxis Vertex axis in use | |
212 | // | |
213 | ||
214 | // -1.5 -0.5 0.5 1.5 ... 89.5 ... 100.5 | |
215 | // ----- 92 number --------- ---- 1 --- | |
216 | TArrayD limits(93); | |
217 | for (Int_t i = 0; i < 92; i++) limits[i] = -1.5 + i; | |
218 | limits[92] = 100.5; | |
219 | ||
220 | fVtxAxis.Set(vtxAxis.GetNbins(), vtxAxis.GetXmin(), vtxAxis.GetXmax()); | |
221 | ||
222 | fCentAxis = new TAxis(limits.GetSize()-1, limits.GetArray()); | |
223 | fHEventsTr = new TH1I("nEventsTr", "Number of events w/trigger", | |
224 | 4*vtxAxis.GetNbins(), | |
225 | 2*vtxAxis.GetXmin(), | |
226 | 2*vtxAxis.GetXmax()); | |
227 | fHEventsTr->SetXTitle("v_{z} [cm]"); | |
228 | fHEventsTr->SetYTitle("# of events"); | |
229 | fHEventsTr->SetFillColor(kRed+1); | |
230 | fHEventsTr->SetFillStyle(3001); | |
231 | fHEventsTr->SetDirectory(0); | |
232 | // fHEventsTr->Sumw2(); | |
233 | fList->Add(fHEventsTr); | |
234 | ||
235 | fHEventsTrVtx = static_cast<TH1I*>(fHEventsTr->Clone("nEventsTrVtx")); | |
236 | fHEventsTrVtx->SetTitle("Number of events w/trigger and vertex"); | |
237 | fHEventsTrVtx->SetFillColor(kBlue+1); | |
238 | fHEventsTrVtx->SetDirectory(0); | |
239 | // fHEventsTrVtx->Sumw2(); | |
240 | fList->Add(fHEventsTrVtx); | |
241 | ||
242 | fHEventsAccepted = new TH1I("nEventsAccepted", | |
243 | "Number of events w/trigger and vertex in range", | |
244 | 2*vtxAxis.GetNbins(), | |
245 | 2*vtxAxis.GetXmin(), | |
246 | 2*vtxAxis.GetXmax()); | |
247 | fHEventsAccepted->SetXTitle("v_{z} [cm]"); | |
248 | fHEventsAccepted->SetYTitle("# of events"); | |
249 | fHEventsAccepted->SetFillColor(kGreen+1); | |
250 | fHEventsAccepted->SetFillStyle(3001); | |
251 | fHEventsAccepted->SetDirectory(0); | |
252 | // fHEventsAccepted->Sumw2(); | |
253 | fList->Add(fHEventsAccepted); | |
254 | ||
255 | ||
256 | fHTriggers = new TH1I("triggers", "Triggers", kOffline+1, 0, kOffline+1); | |
257 | fHTriggers->SetFillColor(kRed+1); | |
258 | fHTriggers->SetFillStyle(3001); | |
259 | fHTriggers->SetStats(0); | |
260 | fHTriggers->SetDirectory(0); | |
261 | fHTriggers->GetXaxis()->SetBinLabel(kInel +1,"INEL"); | |
262 | fHTriggers->GetXaxis()->SetBinLabel(kInelGt0+1,"INEL>0"); | |
263 | fHTriggers->GetXaxis()->SetBinLabel(kNSD +1,"NSD"); | |
264 | fHTriggers->GetXaxis()->SetBinLabel(kEmpty +1,"Empty"); | |
265 | fHTriggers->GetXaxis()->SetBinLabel(kA +1,"A"); | |
266 | fHTriggers->GetXaxis()->SetBinLabel(kB +1,"B"); | |
267 | fHTriggers->GetXaxis()->SetBinLabel(kC +1,"C"); | |
268 | fHTriggers->GetXaxis()->SetBinLabel(kE +1,"E"); | |
269 | fHTriggers->GetXaxis()->SetBinLabel(kPileUp +1,"Pileup"); | |
270 | fHTriggers->GetXaxis()->SetBinLabel(kMCNSD +1,"NSD_{MC}"); | |
271 | fHTriggers->GetXaxis()->SetBinLabel(kOffline+1,"Offline"); | |
272 | fList->Add(fHTriggers); | |
273 | ||
274 | fHType = new TH1I("type", Form("Event type (cut: SPD mult>%d)", | |
275 | fLowFluxCut), 2, -.5, 1.5); | |
276 | fHType->SetFillColor(kRed+1); | |
277 | fHType->SetFillStyle(3001); | |
278 | fHType->SetStats(0); | |
279 | fHType->SetDirectory(0); | |
280 | fHType->GetXaxis()->SetBinLabel(1,"Low-flux"); | |
281 | fHType->GetXaxis()->SetBinLabel(2,"High-flux"); | |
282 | fList->Add(fHType); | |
283 | ||
284 | ||
285 | fHWords = new TH1I("words", "Trigger words seen", 1, 0, 0); | |
286 | fHWords->SetFillColor(kBlue+1); | |
287 | fHWords->SetFillStyle(3001); | |
288 | fHWords->SetStats(0); | |
289 | fHWords->SetDirectory(0); | |
290 | fHWords->SetBit(TH1::kCanRebin); | |
291 | fList->Add(fHWords); | |
292 | ||
293 | fHCent = new TH1F("cent", "Centrality", limits.GetSize()-1,limits.GetArray()); | |
294 | fHCent->SetFillColor(kBlue+1); | |
295 | fHCent->SetFillStyle(3001); | |
296 | fHCent->SetStats(0); | |
297 | fHCent->SetDirectory(0); | |
298 | fHCent->SetXTitle("Centrality [%]"); | |
299 | fHCent->SetYTitle("Events"); | |
300 | fList->Add(fHCent); | |
301 | ||
302 | fHCentVsQual = new TH2F("centVsQuality", "Quality vs Centrality", | |
303 | 5, 0, 5, limits.GetSize()-1, limits.GetArray()); | |
304 | fHCentVsQual->SetXTitle("Quality"); | |
305 | fHCentVsQual->SetYTitle("Centrality [%]"); | |
306 | fHCentVsQual->SetZTitle("Events"); | |
307 | fHCentVsQual->GetXaxis()->SetBinLabel(1, "OK"); | |
308 | fHCentVsQual->GetXaxis()->SetBinLabel(2, "Outside v_{z} cut"); | |
309 | fHCentVsQual->GetXaxis()->SetBinLabel(3, "V0 vs SPD outlier"); | |
310 | fHCentVsQual->GetXaxis()->SetBinLabel(4, "V0 vs TPC outlier"); | |
311 | fHCentVsQual->GetXaxis()->SetBinLabel(5, "V0 vs ZDC outlier"); | |
312 | fList->Add(fHCentVsQual); | |
313 | } | |
314 | ||
315 | //____________________________________________________________________ | |
316 | void | |
317 | AliFMDEventInspector::DefineOutput(TList* dir) | |
318 | { | |
319 | // | |
320 | // Define the output histograms. These are put in a sub list of the | |
321 | // passed list. The histograms are merged before the parent task calls | |
322 | // AliAnalysisTaskSE::Terminate | |
323 | // | |
324 | // dir Directory to add to | |
325 | // | |
326 | fList = new TList; | |
327 | fList->SetName(GetName()); | |
328 | dir->Add(fList); | |
329 | } | |
330 | ||
331 | //____________________________________________________________________ | |
332 | UInt_t | |
333 | AliFMDEventInspector::Process(const AliESDEvent* event, | |
334 | UInt_t& triggers, | |
335 | Bool_t& lowFlux, | |
336 | UShort_t& ivz, | |
337 | Double_t& vz, | |
338 | Double_t& cent, | |
339 | UShort_t& nClusters) | |
340 | { | |
341 | // | |
342 | // Process the event | |
343 | // | |
344 | // Parameters: | |
345 | // event Input event | |
346 | // triggers On return, the triggers fired | |
347 | // lowFlux On return, true if the event is considered a low-flux | |
348 | // event (according to the setting of fLowFluxCut) | |
349 | // ivz On return, the found vertex bin (1-based). A zero | |
350 | // means outside of the defined vertex range | |
351 | // vz On return, the z position of the interaction | |
352 | // cent On return, the centrality - if not available < 0 | |
353 | // | |
354 | // Return: | |
355 | // 0 (or kOk) on success, otherwise a bit mask of error codes | |
356 | // | |
357 | ||
358 | // --- Check that we have an event --------------------------------- | |
359 | if (!event) { | |
360 | AliWarning("No ESD event found for input event"); | |
361 | return kNoEvent; | |
362 | } | |
363 | ||
364 | // --- Read trigger information from the ESD and store in AOD object | |
365 | if (!ReadTriggers(event, triggers, nClusters)) { | |
366 | if (fDebug > 2) { | |
367 | AliWarning("Failed to read triggers from ESD"); } | |
368 | return kNoTriggers; | |
369 | } | |
370 | ||
371 | // --- Check if this is a high-flux event -------------------------- | |
372 | const AliMultiplicity* testmult = event->GetMultiplicity(); | |
373 | if (!testmult) { | |
374 | if (fDebug > 3) { | |
375 | AliWarning("No central multiplicity object found"); } | |
376 | } | |
377 | else | |
378 | lowFlux = testmult->GetNumberOfTracklets() < fLowFluxCut; | |
379 | ||
380 | fHType->Fill(lowFlux ? 0 : 1); | |
381 | ||
382 | // --- Read centrality information | |
383 | cent = -10; | |
384 | UShort_t qual = 0; | |
385 | if (!ReadCentrality(event, cent, qual)) { | |
386 | if (fDebug > 3) | |
387 | AliWarning("Failed to get centrality"); | |
388 | } | |
389 | fHCent->Fill(cent); | |
390 | if (qual == 0) fHCentVsQual->Fill(0., cent); | |
391 | else { | |
392 | for (UShort_t i = 0; i < 4; i++) | |
393 | if (qual & (1 << i)) fHCentVsQual->Fill(Double_t(i+1), cent); | |
394 | } | |
395 | ||
396 | // --- Get the vertex information ---------------------------------- | |
397 | vz = 0; | |
398 | Bool_t vzOk = ReadVertex(event, vz); | |
399 | ||
400 | fHEventsTr->Fill(vz); | |
401 | if (!vzOk) { | |
402 | if (fDebug > 3) { | |
403 | AliWarning("Failed to read vertex from ESD"); } | |
404 | return kNoVertex; | |
405 | } | |
406 | fHEventsTrVtx->Fill(vz); | |
407 | ||
408 | // --- Get the vertex bin ------------------------------------------ | |
409 | ivz = fVtxAxis.FindBin(vz); | |
410 | if (ivz <= 0 || ivz > fVtxAxis.GetNbins()) { | |
411 | if (fDebug > 3) { | |
412 | AliWarning(Form("Vertex @ %f outside of range [%f,%f]", | |
413 | vz, fVtxAxis.GetXmin(), fVtxAxis.GetXmax())); | |
414 | } | |
415 | ivz = 0; | |
416 | return kBadVertex; | |
417 | } | |
418 | fHEventsAccepted->Fill(vz); | |
419 | ||
420 | // --- Check the FMD ESD data -------------------------------------- | |
421 | if (!event->GetFMDData()) { | |
422 | if (fDebug > 3) { | |
423 | AliWarning("No FMD data found in ESD"); } | |
424 | return kNoFMD; | |
425 | } | |
426 | ||
427 | ||
428 | return kOk; | |
429 | } | |
430 | ||
431 | //____________________________________________________________________ | |
432 | Bool_t | |
433 | AliFMDEventInspector::ReadCentrality(const AliESDEvent* esd, | |
434 | Double_t& cent, | |
435 | UShort_t& qual) const | |
436 | { | |
437 | // | |
438 | // Read centrality from event | |
439 | // | |
440 | // Parameters: | |
441 | // esd Event | |
442 | // cent On return, the centrality or negative if not found | |
443 | // | |
444 | // Return: | |
445 | // False on error, true otherwise | |
446 | // | |
447 | cent = -1; | |
448 | qual = 0; | |
449 | AliCentrality* centObj = const_cast<AliESDEvent*>(esd)->GetCentrality(); | |
450 | if (!centObj) return true; | |
451 | ||
452 | // AliInfo(Form("Got centrality object %p with quality %d", | |
453 | // centObj, centObj->GetQuality())); | |
454 | // centObj->Print(); | |
455 | cent = centObj->GetCentralityPercentile("V0M"); | |
456 | qual = centObj->GetQuality(); | |
457 | ||
458 | return true; | |
459 | } | |
460 | ||
461 | //____________________________________________________________________ | |
462 | Bool_t | |
463 | AliFMDEventInspector::ReadTriggers(const AliESDEvent* esd, UInt_t& triggers, | |
464 | UShort_t& nClusters) | |
465 | { | |
466 | // | |
467 | // Read the trigger information from the ESD event | |
468 | // | |
469 | // Parameters: | |
470 | // esd ESD event | |
471 | // triggers On return, contains the trigger bits | |
472 | // | |
473 | // Return: | |
474 | // @c true on success, @c false otherwise | |
475 | // | |
476 | triggers = 0; | |
477 | ||
478 | // Get the analysis manager - should always be there | |
479 | AliAnalysisManager* am = AliAnalysisManager::GetAnalysisManager(); | |
480 | if (!am) { | |
481 | AliWarning("No analysis manager defined!"); | |
482 | return kFALSE; | |
483 | } | |
484 | ||
485 | // Get the input handler - should always be there | |
486 | AliInputEventHandler* ih = | |
487 | static_cast<AliInputEventHandler*>(am->GetInputEventHandler()); | |
488 | if (!ih) { | |
489 | AliWarning("No input handler"); | |
490 | return kFALSE; | |
491 | } | |
492 | ||
493 | // Check if this is a collision candidate (MB) | |
494 | // Note, that we should use the value cached in the input | |
495 | // handler rather than calling IsCollisionCandiate directly | |
496 | // on the AliPhysicsSelection obejct. If we called the latter | |
497 | // then the AliPhysicsSelection object would overcount by a | |
498 | // factor of 2! :-( | |
499 | Bool_t offline = ih->IsEventSelected(); | |
500 | nClusters = 0; | |
501 | if (offline) { | |
502 | triggers |= AliAODForwardMult::kOffline; | |
503 | triggers |= AliAODForwardMult::kInel; | |
504 | fHTriggers->Fill(kOffline+0.5); | |
505 | ||
506 | // If this is inel, see if we have a tracklet | |
507 | const AliMultiplicity* spdmult = esd->GetMultiplicity(); | |
508 | if (!spdmult) { | |
509 | AliWarning("No SPD multiplicity"); | |
510 | } | |
511 | else { | |
512 | // Check if we have one or more tracklets | |
513 | // in the range -1 < eta < 1 to set the INEL>0 | |
514 | // trigger flag. | |
515 | // | |
516 | // Also count tracklets as a single cluster | |
517 | Int_t n = spdmult->GetNumberOfTracklets(); | |
518 | for (Int_t j = 0; j < n; j++) { | |
519 | if(TMath::Abs(spdmult->GetEta(j)) < 1) { | |
520 | triggers |= AliAODForwardMult::kInelGt0; | |
521 | nClusters++; | |
522 | } | |
523 | } | |
524 | n = spdmult->GetNumberOfSingleClusters(); | |
525 | for (Int_t j = 0; j < n; j++) { | |
526 | Double_t eta = -TMath::Log(TMath::Tan(spdmult->GetThetaSingle(j)/2.)); | |
527 | if (TMath::Abs(eta) < 1) nClusters++; | |
528 | } | |
529 | } | |
530 | if (nClusters > 0) triggers |= AliAODForwardMult::kNClusterGt0; | |
531 | } | |
532 | ||
533 | // Analyse some trigger stuff | |
534 | AliTriggerAnalysis ta; | |
535 | if (ta.IsOfflineTriggerFired(esd, AliTriggerAnalysis::kNSD1)) | |
536 | triggers |= AliAODForwardMult::kNSD; | |
537 | ||
538 | ||
539 | // Check for multiple vertices (pile-up) with at least 3 | |
540 | // contributors and at least 0.8cm from the primary vertex | |
541 | Bool_t pileup = esd->IsPileupFromSPD(3,0.8); | |
542 | if (pileup) { | |
543 | triggers |= AliAODForwardMult::kPileUp; | |
544 | fHTriggers->Fill(kPileUp+.5); | |
545 | } | |
546 | ||
547 | ||
548 | // Get trigger stuff | |
549 | TString trigStr = esd->GetFiredTriggerClasses(); | |
550 | // AliWarning(Form("Fired trigger classes: %s", trigStr.Data())); | |
551 | fHWords->Fill(trigStr.Data(), 1); | |
552 | #if 0 | |
553 | if (trigStr.Contains("MB1") || trigStr.Contains("MBBG3")) | |
554 | triggers |= AliAOODForwardMult::kB; | |
555 | if (trigStr.Contains("COTA")) | |
556 | triggers |= AliAODForwardMult::kA; | |
557 | if (trigStr.Contains("COTC")) | |
558 | triggers |= AliAODForwardMult::kC; | |
559 | #endif | |
560 | if (trigStr.Contains("CBEAMB-ABCE-NOPF-ALL")) { | |
561 | triggers |= AliAODForwardMult::kEmpty; | |
562 | fHTriggers->Fill(kEmpty+.5); | |
563 | } | |
564 | ||
565 | // Check for B triggers | |
566 | if (trigStr.Contains("CINT1B-ABCE-NOPF-ALL") || // Early pp | |
567 | trigStr.Contains("CINT1-B-NOPF-ALLNOTRD") || // Late pp | |
568 | trigStr.Contains("CINT1-B-NOPF-FASTNOTRD") || // Late pp | |
569 | trigStr.Contains("CSMBB-ABCE-NOPF-ALL") || // pp | |
570 | trigStr.Contains("CMBACS2-B-NOPF-ALL") || // PbPb | |
571 | // trigStr.Contains("C0SMH-B-NOPF-ALL") || // PbPb - high mult | |
572 | trigStr.Contains("CMBS2A-B-NOPF-ALL") || // PbPb | |
573 | trigStr.Contains("CMBS2C-B-NOPF-ALL") || // PbPb | |
574 | trigStr.Contains("CMBAC-B-NOPF-ALL") || // PbPb | |
575 | // trigStr.Contains("C0SMH-B-NOPF-ALL") || // PbPb - high mult | |
576 | trigStr.Contains("CMBACS2-B-NOPF-ALLNOTRD") // PbPb | |
577 | // trigStr.Contains("C0SMH-B-NOPF-ALLNOTRD") // PbPb - high mult | |
578 | ) { | |
579 | triggers |= AliAODForwardMult::kB; | |
580 | fHTriggers->Fill(kB+.5); | |
581 | } | |
582 | ||
583 | // Check for A triggers | |
584 | if (trigStr.Contains("CINT1A-ABCE-NOPF-ALL") || // Early pp | |
585 | trigStr.Contains("CINT1-AC_NOPF-ALLNOTRD") || // Late pp | |
586 | trigStr.Contains("CINT1-AC_NOPF-FASTNOTRD")|| // Late pp | |
587 | (trigStr.Contains("CSMBA-ABCE-NOPF-ALL") && | |
588 | !(triggers & AliAODForwardMult::kB)) || // pp | |
589 | trigStr.Contains("CMBACS2-A-NOPF-ALL") || // PbPb | |
590 | // trigStr.Contains("C0SMH-A-NOPF-ALL") || // PbPb - high mult | |
591 | trigStr.Contains("CMBS2A-A-NOPF-ALL") || // PbPb | |
592 | trigStr.Contains("CMBS2C-A-NOPF-ALL") || // PbPb | |
593 | trigStr.Contains("CMBAC-A-NOPF-ALL") || // PbPb | |
594 | // trigStr.Contains("C0SMH-A-NOPF-ALL") || // PbPb - high mult | |
595 | trigStr.Contains("CMBACS2-A-NOPF-ALLNOTRD") // PbPb | |
596 | // trigStr.Contains("C0SMH-A-NOPF-ALLNOTRD") // PbPb - high mult | |
597 | ) { | |
598 | triggers |= AliAODForwardMult::kA; | |
599 | fHTriggers->Fill(kA+.5); | |
600 | } | |
601 | ||
602 | // Check for C triggers | |
603 | if (trigStr.Contains("CINT1C-ABCE-NOPF-ALL") || // Early pp | |
604 | (trigStr.Contains("CSMBC-ABCE-NOPF-ALL") && | |
605 | !(triggers & AliAODForwardMult::kB)) || // pp | |
606 | trigStr.Contains("CMBACS2-C-NOPF-ALL") || // PbPb | |
607 | // trigStr.Contains("C0SMH-B-NOPF-ALL") || // PbPb - high mult | |
608 | trigStr.Contains("CMBS2A-C-NOPF-ALL") || // PbPb | |
609 | trigStr.Contains("CMBS2C-C-NOPF-ALL") || // PbPb | |
610 | trigStr.Contains("CMBAC-C-NOPF-ALL") || // PbPb | |
611 | // trigStr.Contains("C0SMH-B-NOPF-ALL") || // PbPb - high mult | |
612 | trigStr.Contains("CMBACS2-C-NOPF-ALLNOTRD") // PbPb | |
613 | // trigStr.Contains("C0SMH-B-NOPF-ALLNOTRD") // PbPb - high mult | |
614 | ) { | |
615 | triggers |= AliAODForwardMult::kC; | |
616 | fHTriggers->Fill(kC+.5); | |
617 | } | |
618 | ||
619 | // Check for E triggers | |
620 | if (trigStr.Contains("CINT1-E-NOPF-ALL") || // Early pp | |
621 | trigStr.Contains("CINT1-E-NOPF-ALLNOTRD") || // Late pp | |
622 | trigStr.Contains("CINT1-E-NOPF-FASTNOTRD") || // Late pp | |
623 | trigStr.Contains("CMBACS2-E-NOPF-ALL") || // PbPb | |
624 | // trigStr.Contains("C0SMH-B-NOPF-ALL") || // PbPb - high mult | |
625 | trigStr.Contains("CMBS2A-E-NOPF-ALL") || // PbPb | |
626 | trigStr.Contains("CMBS2C-E-NOPF-ALL") || // PbPb | |
627 | trigStr.Contains("CMBAC-E-NOPF-ALL") || // PbPb | |
628 | // trigStr.Contains("C0SMH-B-NOPF-ALL") || // PbPb - high mult | |
629 | trigStr.Contains("CMBACS2-E-NOPF-ALLNOTRD") // PbPb | |
630 | // trigStr.Contains("C0SMH-B-NOPF-ALLNOTRD") // PbPb - high mult | |
631 | ) { | |
632 | triggers |= AliAODForwardMult::kE; | |
633 | fHTriggers->Fill(kE+.5); | |
634 | } | |
635 | ||
636 | // Now check - if we have a collision - for offline triggers and | |
637 | // fill histogram. | |
638 | if (triggers & AliAODForwardMult::kB) { | |
639 | if (triggers & AliAODForwardMult::kInel) | |
640 | fHTriggers->Fill(kInel); | |
641 | ||
642 | if (triggers & AliAODForwardMult::kInelGt0) | |
643 | fHTriggers->Fill(kInelGt0+.5); | |
644 | ||
645 | if (triggers & AliAODForwardMult::kNSD) | |
646 | fHTriggers->Fill(kNSD+.5); | |
647 | } | |
648 | ||
649 | return kTRUE; | |
650 | } | |
651 | //____________________________________________________________________ | |
652 | Bool_t | |
653 | AliFMDEventInspector::ReadVertex(const AliESDEvent* esd, Double_t& vz) | |
654 | { | |
655 | // | |
656 | // Read the vertex information from the ESD event | |
657 | // | |
658 | // Parameters: | |
659 | // esd ESD event | |
660 | // vz On return, the vertex Z position | |
661 | // | |
662 | // Return: | |
663 | // @c true on success, @c false otherwise | |
664 | // | |
665 | vz = 0; | |
666 | #if 1 | |
667 | // This is the code used by the 1st physics people | |
668 | const AliESDVertex* vertex = esd->GetPrimaryVertex(); | |
669 | if (!vertex || !vertex->GetStatus()) { | |
670 | if (fDebug > 2) { | |
671 | AliWarning(Form("No primary vertex (%p) or bad status %d", | |
672 | vertex, (vertex ? vertex->GetStatus() : -1))); | |
673 | } | |
674 | return false; | |
675 | } | |
676 | const AliESDVertex* vertexSPD = esd->GetPrimaryVertexSPD(); | |
677 | if (!vertexSPD || !vertexSPD->GetStatus()) { | |
678 | if (fDebug > 2) { | |
679 | AliWarning(Form("No primary SPD vertex (%p) or bad status %d", | |
680 | vertexSPD, (vertexSPD ? vertexSPD->GetStatus() : -1))); | |
681 | } | |
682 | return false; | |
683 | } | |
684 | ||
685 | // if vertex is from SPD vertexZ, require more stringent cuts | |
686 | if (vertex->IsFromVertexerZ()) { | |
687 | if (vertex->GetDispersion() > fMaxVzErr || | |
688 | vertex->GetZRes() > 1.25 * fMaxVzErr) { | |
689 | if (fDebug > 2) { | |
690 | AliWarning(Form("Dispersion %f > %f or resolution %f > %f", | |
691 | vertex->GetDispersion(), fMaxVzErr, | |
692 | vertex->GetZRes(), 1.25 * fMaxVzErr)); | |
693 | } | |
694 | return false; | |
695 | } | |
696 | } | |
697 | vz = vertex->GetZ(); | |
698 | return true; | |
699 | #else | |
700 | // Get the vertex | |
701 | const AliESDVertex* vertex = esd->GetPrimaryVertexSPD(); | |
702 | if (!vertex) { | |
703 | if (fDebug > 2) { | |
704 | AliWarning("No SPD vertex found in ESD"); } | |
705 | return kFALSE; | |
706 | } | |
707 | ||
708 | // Check that enough tracklets contributed | |
709 | if(vertex->GetNContributors() <= 0) { | |
710 | if (fDebug > 2) { | |
711 | AliWarning(Form("Number of contributors to vertex is %d<=0", | |
712 | vertex->GetNContributors())); } | |
713 | vz = 0; | |
714 | return kFALSE; | |
715 | } | |
716 | // Check that the uncertainty isn't too large | |
717 | if (vertex->GetZRes() > fMaxVzErr) { | |
718 | if (fDebug > 2) { | |
719 | AliWarning(Form("Uncertaintity in Z of vertex is too large %f > %f", | |
720 | vertex->GetZRes(), fMaxVzErr)); } | |
721 | return kFALSE; | |
722 | } | |
723 | ||
724 | // Get the z coordiante | |
725 | vz = vertex->GetZ(); | |
726 | return kTRUE; | |
727 | #endif | |
728 | } | |
729 | ||
730 | //____________________________________________________________________ | |
731 | Bool_t | |
732 | AliFMDEventInspector::ReadRunDetails(const AliESDEvent* esd) | |
733 | { | |
734 | // | |
735 | // Read the collision system, collision energy, and L3 field setting | |
736 | // from the ESD | |
737 | // | |
738 | // Parameters: | |
739 | // esd ESD to get information from | |
740 | // | |
741 | // Return: | |
742 | // true on success, false | |
743 | // | |
744 | // AliInfo(Form("Parameters from 1st ESD event: cms=%s, sNN=%f, field=%f", | |
745 | // esd->GetBeamType(), 2*esd->GetBeamEnergy(), | |
746 | // esd->GetMagneticField())); | |
747 | fCollisionSystem = | |
748 | AliForwardUtil::ParseCollisionSystem(esd->GetBeamType()); | |
749 | fEnergy = | |
750 | AliForwardUtil::ParseCenterOfMassEnergy(fCollisionSystem, | |
751 | 2 * esd->GetBeamEnergy()); | |
752 | fField = | |
753 | AliForwardUtil::ParseMagneticField(esd->GetMagneticField()); | |
754 | ||
755 | if (fCollisionSystem == AliForwardUtil::kUnknown || | |
756 | fEnergy <= 0 || | |
757 | TMath::Abs(fField) > 10) | |
758 | return kFALSE; | |
759 | ||
760 | return kTRUE; | |
761 | } | |
762 | ||
763 | //____________________________________________________________________ | |
764 | void | |
765 | AliFMDEventInspector::Print(Option_t*) const | |
766 | { | |
767 | // | |
768 | // Print information | |
769 | // | |
770 | // option Not used | |
771 | // | |
772 | char ind[gROOT->GetDirLevel()+1]; | |
773 | for (Int_t i = 0; i < gROOT->GetDirLevel(); i++) ind[i] = ' '; | |
774 | ind[gROOT->GetDirLevel()] = '\0'; | |
775 | TString sNN(AliForwardUtil::CenterOfMassEnergyString(fEnergy)); | |
776 | sNN.Strip(TString::kBoth, '0'); | |
777 | sNN.ReplaceAll("GeV", " GeV"); | |
778 | TString field(AliForwardUtil::MagneticFieldString(fField)); | |
779 | field.ReplaceAll("p", "+"); | |
780 | field.ReplaceAll("m", "-"); | |
781 | field.ReplaceAll("kG", " kG"); | |
782 | ||
783 | std::cout << ind << ClassName() << ": " << GetName() << '\n' | |
784 | << ind << " Vertex bins: " << fVtxAxis.GetNbins() << '\n' | |
785 | << ind << " Vertex range: [" << fVtxAxis.GetXmin() | |
786 | << "," << fVtxAxis.GetXmax() << "]\n" | |
787 | << ind << " Low flux cut: " << fLowFluxCut << '\n' | |
788 | << ind << " Max(delta v_z): " << fMaxVzErr << " cm\n" | |
789 | << ind << " System: " | |
790 | << AliForwardUtil::CollisionSystemString(fCollisionSystem) << '\n' | |
791 | << ind << " CMS energy per nucleon: " << sNN << '\n' | |
792 | << ind << " Field: " << field << '\n'; | |
793 | if (!fCentAxis) { std::cout << std::flush; return; } | |
794 | Int_t nBin = fCentAxis->GetNbins(); | |
795 | std::cout << ind << " Centrality axis: " << nBin << " bins" | |
796 | << std::flush; | |
797 | for (Int_t i = 0; i < nBin; i++) { | |
798 | if ((i % 10) == 0) std::cout << '\n' << ind << " "; | |
799 | std::cout << std::setw(5) << fCentAxis->GetBinLowEdge(i+1) << '-'; | |
800 | } | |
801 | std::cout << std::setw(5) << fCentAxis->GetBinUpEdge(nBin) << std::endl; | |
802 | } | |
803 | ||
804 | ||
805 | // | |
806 | // EOF | |
807 | // | |
808 |