]>
Commit | Line | Data |
---|---|---|
7984e5f7 | 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 | // | |
8565b10b | 17 | #include "AliFMDEventInspector.h" |
18 | #include "AliLog.h" | |
19 | #include "AliESDEvent.h" | |
20 | #include "AliMultiplicity.h" | |
21 | #include "AliAnalysisManager.h" | |
11d40ecb | 22 | #include "AliMCEventHandler.h" |
8565b10b | 23 | #include "AliInputEventHandler.h" |
24 | #include "AliTriggerAnalysis.h" | |
25 | #include "AliPhysicsSelection.h" | |
e85a76b7 | 26 | #include "AliOADBPhysicsSelection.h" |
8565b10b | 27 | #include "AliAODForwardMult.h" |
0bd4b00f | 28 | #include "AliForwardUtil.h" |
5e4d905e | 29 | #include "AliCentrality.h" |
8565b10b | 30 | #include <TH1.h> |
31 | #include <TList.h> | |
32 | #include <TDirectory.h> | |
0bd4b00f | 33 | #include <TROOT.h> |
e6463868 | 34 | #include <TParameter.h> |
0bd4b00f | 35 | #include <iostream> |
36 | #include <iomanip> | |
65abd48b | 37 | #include "AliMCEvent.h" |
38 | #include "AliHeader.h" | |
39 | #include "AliGenEventHeader.h" | |
40 | #include "AliCollisionGeometry.h" | |
da70cd6a | 41 | #include "AliVVZERO.h" |
e1f47419 | 42 | |
8565b10b | 43 | //==================================================================== |
5ca83fee | 44 | const char* AliFMDEventInspector::fgkFolderName = "fmdEventInspector"; |
45 | ||
46 | //____________________________________________________________________ | |
8565b10b | 47 | AliFMDEventInspector::AliFMDEventInspector() |
48 | : TNamed(), | |
49 | fHEventsTr(0), | |
50 | fHEventsTrVtx(0), | |
5bb5d1f6 | 51 | fHEventsAccepted(0), |
96110c91 | 52 | fHEventsAcceptedXY(0), |
8565b10b | 53 | fHTriggers(0), |
66cf95f2 | 54 | fHTriggerCorr(0), |
0bd4b00f | 55 | fHType(0), |
5ca83fee | 56 | fHWords(0), |
57 | fHCent(0), | |
58 | fHCentVsQual(0), | |
59 | fHStatus(0), | |
60 | fLowFluxCut(1000), | |
61 | fMaxVzErr(0.2), | |
62 | fList(0), | |
63 | fEnergy(0), | |
0bd4b00f | 64 | fField(999), |
5ca83fee | 65 | fCollisionSystem(kUnknown), |
e308a636 | 66 | fDebug(0), |
5bb5d1f6 | 67 | fCentAxis(0), |
e83d0620 | 68 | fVtxAxis(10,-10,10), |
5ca83fee | 69 | fUseFirstPhysicsVertex(false), |
70 | fUseV0AND(false), | |
71 | fMinPileupContrib(3), | |
72 | fMinPileupDistance(0.8), | |
65abd48b | 73 | fUseDisplacedVertices(false), |
241cca4d | 74 | fDisplacedVertex(), |
75 | fCollWords(), | |
76 | fBgWords() | |
8565b10b | 77 | { |
7984e5f7 | 78 | // |
79 | // Constructor | |
80 | // | |
241cca4d | 81 | DGUARD(fDebug,1,"Default CTOR of AliFMDEventInspector"); |
8565b10b | 82 | } |
83 | ||
84 | //____________________________________________________________________ | |
85 | AliFMDEventInspector::AliFMDEventInspector(const char* name) | |
5ca83fee | 86 | : TNamed(fgkFolderName, name), |
8565b10b | 87 | fHEventsTr(0), |
88 | fHEventsTrVtx(0), | |
5bb5d1f6 | 89 | fHEventsAccepted(0), |
96110c91 | 90 | fHEventsAcceptedXY(0), |
8565b10b | 91 | fHTriggers(0), |
66cf95f2 | 92 | fHTriggerCorr(0), |
0bd4b00f | 93 | fHType(0), |
fe52e455 | 94 | fHWords(0), |
5e4d905e | 95 | fHCent(0), |
e308a636 | 96 | fHCentVsQual(0), |
241cca4d | 97 | fHStatus(0), |
8565b10b | 98 | fLowFluxCut(1000), |
9d05ffeb | 99 | fMaxVzErr(0.2), |
8565b10b | 100 | fList(0), |
0bd4b00f | 101 | fEnergy(0), |
102 | fField(999), | |
103 | fCollisionSystem(kUnknown), | |
e308a636 | 104 | fDebug(0), |
5bb5d1f6 | 105 | fCentAxis(0), |
e83d0620 | 106 | fVtxAxis(10,-10,10), |
5ca83fee | 107 | fUseFirstPhysicsVertex(false), |
e6463868 | 108 | fUseV0AND(false), |
109 | fMinPileupContrib(3), | |
65abd48b | 110 | fMinPileupDistance(0.8), |
111 | fUseDisplacedVertices(false), | |
241cca4d | 112 | fDisplacedVertex(), |
113 | fCollWords(), | |
114 | fBgWords() | |
8565b10b | 115 | { |
7984e5f7 | 116 | // |
117 | // Constructor | |
118 | // | |
119 | // Parameters: | |
120 | // name Name of object | |
121 | // | |
241cca4d | 122 | DGUARD(fDebug,1,"Named CTOR of AliFMDEventInspector: %s", name); |
8565b10b | 123 | } |
124 | ||
125 | //____________________________________________________________________ | |
126 | AliFMDEventInspector::AliFMDEventInspector(const AliFMDEventInspector& o) | |
127 | : TNamed(o), | |
128 | fHEventsTr(o.fHEventsTr), | |
129 | fHEventsTrVtx(o.fHEventsTrVtx), | |
5bb5d1f6 | 130 | fHEventsAccepted(o.fHEventsAccepted), |
96110c91 | 131 | fHEventsAcceptedXY(o.fHEventsAcceptedXY), |
8565b10b | 132 | fHTriggers(o.fHTriggers), |
66cf95f2 | 133 | fHTriggerCorr(o.fHTriggerCorr), |
0bd4b00f | 134 | fHType(o.fHType), |
fe52e455 | 135 | fHWords(o.fHWords), |
5e4d905e | 136 | fHCent(o.fHCent), |
e308a636 | 137 | fHCentVsQual(o.fHCentVsQual), |
241cca4d | 138 | fHStatus(o.fHStatus), |
6feacd76 | 139 | fLowFluxCut(o.fLowFluxCut), |
8565b10b | 140 | fMaxVzErr(o.fMaxVzErr), |
141 | fList(o.fList), | |
0bd4b00f | 142 | fEnergy(o.fEnergy), |
143 | fField(o.fField), | |
144 | fCollisionSystem(o.fCollisionSystem), | |
e308a636 | 145 | fDebug(0), |
5bb5d1f6 | 146 | fCentAxis(0), |
e83d0620 | 147 | fVtxAxis(o.fVtxAxis), |
31554871 | 148 | fUseFirstPhysicsVertex(o.fUseFirstPhysicsVertex), |
e6463868 | 149 | fUseV0AND(o.fUseV0AND), |
150 | fMinPileupContrib(o.fMinPileupContrib), | |
65abd48b | 151 | fMinPileupDistance(o.fMinPileupDistance), |
152 | fUseDisplacedVertices(o.fUseDisplacedVertices), | |
241cca4d | 153 | fDisplacedVertex(o.fDisplacedVertex), |
154 | fCollWords(), | |
155 | fBgWords() | |
8565b10b | 156 | { |
7984e5f7 | 157 | // |
158 | // Copy constructor | |
159 | // | |
160 | // Parameters: | |
161 | // o Object to copy from | |
162 | // | |
241cca4d | 163 | DGUARD(fDebug,1,"Copy CTOR of AliFMDEventInspector"); |
8565b10b | 164 | } |
165 | ||
166 | //____________________________________________________________________ | |
167 | AliFMDEventInspector::~AliFMDEventInspector() | |
168 | { | |
7984e5f7 | 169 | // |
170 | // Destructor | |
171 | // | |
c929bc03 | 172 | DGUARD(fDebug,1,"DTOR of AliFMDEventInspector"); |
173 | // if (fList) delete fList; | |
8565b10b | 174 | } |
175 | //____________________________________________________________________ | |
176 | AliFMDEventInspector& | |
177 | AliFMDEventInspector::operator=(const AliFMDEventInspector& o) | |
178 | { | |
7984e5f7 | 179 | // |
180 | // Assignement operator | |
181 | // | |
182 | // Parameters: | |
183 | // o Object to assign from | |
184 | // | |
185 | // Return: | |
186 | // Reference to this object | |
187 | // | |
6ab100ec | 188 | DGUARD(fDebug,3,"Assignment of AliFMDEventInspector"); |
d015ecfe | 189 | if (&o == this) return *this; |
8565b10b | 190 | TNamed::operator=(o); |
191 | fHEventsTr = o.fHEventsTr; | |
192 | fHEventsTrVtx = o.fHEventsTrVtx; | |
5bb5d1f6 | 193 | fHEventsAccepted = o.fHEventsAccepted; |
96110c91 | 194 | fHEventsAcceptedXY = o.fHEventsAcceptedXY; |
8565b10b | 195 | fHTriggers = o.fHTriggers; |
66cf95f2 | 196 | fHTriggerCorr = o.fHTriggerCorr; |
0bd4b00f | 197 | fHType = o.fHType; |
fe52e455 | 198 | fHWords = o.fHWords; |
5e4d905e | 199 | fHCent = o.fHCent; |
e308a636 | 200 | fHCentVsQual = o.fHCentVsQual; |
241cca4d | 201 | fHStatus = o.fHStatus; |
8565b10b | 202 | fLowFluxCut = o.fLowFluxCut; |
203 | fMaxVzErr = o.fMaxVzErr; | |
204 | fDebug = o.fDebug; | |
205 | fList = (o.fList ? new TList : 0); | |
0bd4b00f | 206 | fEnergy = o.fEnergy; |
207 | fField = o.fField; | |
208 | fCollisionSystem = o.fCollisionSystem; | |
5bb5d1f6 | 209 | fVtxAxis.Set(o.fVtxAxis.GetNbins(), o.fVtxAxis.GetXmin(), |
210 | o.fVtxAxis.GetXmax()); | |
e83d0620 | 211 | |
212 | fUseFirstPhysicsVertex = o.fUseFirstPhysicsVertex; | |
31554871 | 213 | fUseV0AND = o.fUseV0AND; |
e6463868 | 214 | fMinPileupContrib = o.fMinPileupContrib; |
215 | fMinPileupDistance = o.fMinPileupDistance; | |
65abd48b | 216 | fUseDisplacedVertices = o.fUseDisplacedVertices; |
217 | fDisplacedVertex = o.fDisplacedVertex; | |
8565b10b | 218 | if (fList) { |
219 | fList->SetName(GetName()); | |
220 | if (fHEventsTr) fList->Add(fHEventsTr); | |
221 | if (fHEventsTrVtx) fList->Add(fHEventsTrVtx); | |
222 | if (fHTriggers) fList->Add(fHTriggers); | |
66cf95f2 | 223 | if (fHTriggerCorr) fList->Add(fHTriggerCorr); |
0bd4b00f | 224 | if (fHType) fList->Add(fHType); |
fe52e455 | 225 | if (fHWords) fList->Add(fHWords); |
5e4d905e | 226 | if (fHCent) fList->Add(fHCent); |
e308a636 | 227 | if (fHCentVsQual) fList->Add(fHCentVsQual); |
241cca4d | 228 | if (fHStatus) fList->Add(fHStatus); |
8565b10b | 229 | } |
230 | return *this; | |
231 | } | |
232 | ||
233 | //____________________________________________________________________ | |
234 | Bool_t | |
fb3430ac | 235 | AliFMDEventInspector::FetchHistograms(const TList* d, |
8565b10b | 236 | TH1I*& hEventsTr, |
237 | TH1I*& hEventsTrVtx, | |
5ca83fee | 238 | TH1I*& hEventsAcc, |
8565b10b | 239 | TH1I*& hTriggers) const |
240 | { | |
7984e5f7 | 241 | // |
242 | // Fetch our histograms from the passed list | |
243 | // | |
244 | // Parameters: | |
245 | // d Input | |
246 | // hEventsTr On return, pointer to histogram, or null | |
247 | // hEventsTrVtx On return, pointer to histogram, or null | |
248 | // hTriggers On return, pointer to histogram, or null | |
249 | // | |
250 | // Return: | |
251 | // true on success, false otherwise | |
252 | // | |
6ab100ec | 253 | DGUARD(fDebug,3,"Fetch histograms in AliFMDEventInspector"); |
8565b10b | 254 | hEventsTr = 0; |
255 | hEventsTrVtx = 0; | |
5ca83fee | 256 | hEventsAcc = 0; |
257 | hTriggers = 0; | |
8565b10b | 258 | TList* dd = dynamic_cast<TList*>(d->FindObject(GetName())); |
259 | if (!dd) return kFALSE; | |
260 | ||
261 | hEventsTr = dynamic_cast<TH1I*>(dd->FindObject("nEventsTr")); | |
262 | hEventsTrVtx = dynamic_cast<TH1I*>(dd->FindObject("nEventsTrVtx")); | |
5ca83fee | 263 | hEventsAcc = dynamic_cast<TH1I*>(dd->FindObject("nEventsAccepted")); |
8565b10b | 264 | hTriggers = dynamic_cast<TH1I*>(dd->FindObject("triggers")); |
265 | ||
5ca83fee | 266 | if (!hEventsTr || |
267 | !hEventsTrVtx || | |
268 | !hEventsAcc || | |
269 | !hTriggers) return kFALSE; | |
8565b10b | 270 | return kTRUE; |
271 | } | |
241cca4d | 272 | //____________________________________________________________________ |
273 | void | |
274 | AliFMDEventInspector::CacheConfiguredTriggerClasses(TList& cache, | |
275 | const TList* classes, | |
276 | AliOADBPhysicsSelection* o) | |
277 | { | |
278 | TIter nextClass(classes); | |
279 | TObjString* trigClass = 0; | |
280 | // Loop over all trigger classes. Trigger classes have the format | |
281 | // | |
282 | // class := positive_words SPACE(s) negative_words | |
283 | // positive_words := | |
284 | // | '+' words | |
285 | // negative_words := | |
286 | // | '-' words | |
287 | // words := word | |
288 | // | word ',' words | |
289 | // | |
290 | while ((trigClass = static_cast<TObjString*>(nextClass()))) { | |
291 | // Tokenize on space to get positive and negative parts | |
292 | TString side = o->GetBeamSide(trigClass->String()); | |
293 | TObjArray* parts = trigClass->String().Tokenize(" "); | |
294 | TObjString* part = 0; | |
295 | TIter nextPart(parts); | |
296 | while ((part = static_cast<TObjString*>(nextPart()))) { | |
297 | // We only care about the positive ones | |
298 | if (part->GetName()[0] != '+') continue; | |
299 | part->String().Remove(0,1); | |
300 | ||
301 | // Tokenize on a comma to get the words | |
302 | TObjArray* words = part->String().Tokenize(","); | |
303 | TObjString* word = 0; | |
304 | TIter nextWord(words); | |
305 | while ((word = static_cast<TObjString*>(nextWord()))) { | |
306 | TNamed* store = new TNamed(word->String(), side); | |
307 | cache.Add(store); | |
308 | DMSG(fDebug,3,"Caching %s trigger word %s", | |
309 | store->GetTitle(), store->GetName()); | |
310 | } // while (word) | |
311 | delete words; | |
312 | } | |
313 | delete parts; | |
314 | } | |
315 | } | |
316 | ||
8565b10b | 317 | //____________________________________________________________________ |
318 | void | |
319 | AliFMDEventInspector::Init(const TAxis& vtxAxis) | |
320 | { | |
7984e5f7 | 321 | // |
241cca4d | 322 | // Initialize the object - this is called on the first seen event. |
7984e5f7 | 323 | // |
324 | // Parameters: | |
325 | // vtxAxis Vertex axis in use | |
326 | // | |
6ab100ec | 327 | DGUARD(fDebug,1,"Initialize in AliFMDEventInspector"); |
241cca4d | 328 | |
329 | AliAnalysisManager* am = AliAnalysisManager::GetAnalysisManager(); | |
330 | ||
331 | // Get the input handler - should always be there | |
332 | AliInputEventHandler* ih = | |
333 | static_cast<AliInputEventHandler*>(am->GetInputEventHandler()); | |
334 | if (!ih) { | |
335 | AliWarning("No input handler"); | |
336 | return; | |
337 | } | |
338 | // Get the physics selection - should always be there | |
339 | AliPhysicsSelection* ps = | |
340 | static_cast<AliPhysicsSelection*>(ih->GetEventSelection()); | |
341 | if (!ps) { | |
342 | AliWarning("No physics selection"); | |
343 | return; | |
344 | } | |
345 | // Get the configured triggers | |
346 | AliOADBPhysicsSelection* oadb = | |
347 | const_cast<AliOADBPhysicsSelection*>(ps->GetOADBPhysicsSelection()); | |
348 | if (!oadb) { | |
349 | AliWarning("No OADB physics selection object"); | |
350 | return; | |
351 | } | |
352 | // Get the configured trigger words from the physics selection | |
353 | const TList* collTriggClasses = ps->GetCollisionTriggerClasses(); | |
354 | const TList* bgTriggClasses = ps->GetBGTriggerClasses(); | |
355 | if (!collTriggClasses) { | |
356 | AliWarning("No configured collision trigger classes"); | |
357 | return; | |
358 | } | |
359 | if (!bgTriggClasses) { | |
360 | AliWarning("No configured background trigger classes"); | |
361 | return; | |
362 | } | |
363 | CacheConfiguredTriggerClasses(fCollWords, collTriggClasses, oadb); | |
364 | CacheConfiguredTriggerClasses(fBgWords, bgTriggClasses, oadb); | |
365 | // fCollWords.ls(); | |
366 | // fBgWords.ls(); | |
367 | ||
e308a636 | 368 | |
369 | // -1.5 -0.5 0.5 1.5 ... 89.5 ... 100.5 | |
370 | // ----- 92 number --------- ---- 1 --- | |
371 | TArrayD limits(93); | |
372 | for (Int_t i = 0; i < 92; i++) limits[i] = -1.5 + i; | |
d8244e9e | 373 | limits[92] = 100.5; |
5bb5d1f6 | 374 | |
375 | fVtxAxis.Set(vtxAxis.GetNbins(), vtxAxis.GetXmin(), vtxAxis.GetXmax()); | |
e308a636 | 376 | |
377 | fCentAxis = new TAxis(limits.GetSize()-1, limits.GetArray()); | |
8565b10b | 378 | fHEventsTr = new TH1I("nEventsTr", "Number of events w/trigger", |
5bb5d1f6 | 379 | 4*vtxAxis.GetNbins(), |
380 | 2*vtxAxis.GetXmin(), | |
381 | 2*vtxAxis.GetXmax()); | |
8565b10b | 382 | fHEventsTr->SetXTitle("v_{z} [cm]"); |
383 | fHEventsTr->SetYTitle("# of events"); | |
384 | fHEventsTr->SetFillColor(kRed+1); | |
385 | fHEventsTr->SetFillStyle(3001); | |
386 | fHEventsTr->SetDirectory(0); | |
387 | // fHEventsTr->Sumw2(); | |
388 | fList->Add(fHEventsTr); | |
389 | ||
5bb5d1f6 | 390 | fHEventsTrVtx = static_cast<TH1I*>(fHEventsTr->Clone("nEventsTrVtx")); |
391 | fHEventsTrVtx->SetTitle("Number of events w/trigger and vertex"); | |
8565b10b | 392 | fHEventsTrVtx->SetFillColor(kBlue+1); |
8565b10b | 393 | fHEventsTrVtx->SetDirectory(0); |
394 | // fHEventsTrVtx->Sumw2(); | |
395 | fList->Add(fHEventsTrVtx); | |
396 | ||
5bb5d1f6 | 397 | fHEventsAccepted = new TH1I("nEventsAccepted", |
398 | "Number of events w/trigger and vertex in range", | |
399 | 2*vtxAxis.GetNbins(), | |
400 | 2*vtxAxis.GetXmin(), | |
401 | 2*vtxAxis.GetXmax()); | |
402 | fHEventsAccepted->SetXTitle("v_{z} [cm]"); | |
403 | fHEventsAccepted->SetYTitle("# of events"); | |
404 | fHEventsAccepted->SetFillColor(kGreen+1); | |
405 | fHEventsAccepted->SetFillStyle(3001); | |
406 | fHEventsAccepted->SetDirectory(0); | |
407 | // fHEventsAccepted->Sumw2(); | |
408 | fList->Add(fHEventsAccepted); | |
409 | ||
96110c91 | 410 | fHEventsAcceptedXY = new TH2D("nEventsAcceptedXY", |
411 | "XY vertex w/trigger and Z vertex in range", | |
412 | 1000,-1,1,1000,-1,1); | |
413 | ||
414 | fHEventsAcceptedXY->SetXTitle("v_{x} [cm]"); | |
415 | fHEventsAcceptedXY->SetYTitle("v_{y} [cm]"); | |
416 | fHEventsAcceptedXY->SetDirectory(0); | |
417 | // fHEventsAccepted->Sumw2(); | |
418 | fList->Add(fHEventsAcceptedXY); | |
419 | ||
420 | ||
0be6c8cd | 421 | fHTriggers = new TH1I("triggers", "Triggers", kOffline+1, 0, kOffline+1); |
8565b10b | 422 | fHTriggers->SetFillColor(kRed+1); |
423 | fHTriggers->SetFillStyle(3001); | |
424 | fHTriggers->SetStats(0); | |
425 | fHTriggers->SetDirectory(0); | |
66cf95f2 | 426 | |
427 | fHTriggerCorr = new TH2I("triggerCorr", "Trigger correlation", | |
428 | kOffline+1, 0, kOffline+1, | |
429 | kOffline+1, 0, kOffline+1); | |
430 | fHTriggerCorr->SetStats(0); | |
431 | fHTriggerCorr->SetDirectory(0); | |
cd51b0dd | 432 | fHTriggerCorr->SetXTitle("Requirement"); |
433 | fHTriggerCorr->SetYTitle("Companion"); | |
434 | ||
66cf95f2 | 435 | Int_t binNum[] = { kInel +1, |
436 | kInelGt0+1, | |
437 | kNSD +1, | |
438 | kV0AND +1, | |
439 | kEmpty +1, | |
440 | kA +1, | |
441 | kB +1, | |
442 | kC +1, | |
443 | kE +1, | |
444 | kPileUp +1, | |
445 | kMCNSD +1, | |
446 | kOffline+1 }; | |
447 | const char* binLbl[] = { "INEL", | |
448 | "INEL>0", | |
449 | "NSD", | |
450 | "VOAND", | |
451 | "Empty", | |
452 | "A", | |
453 | "B", | |
454 | "C", | |
455 | "E", | |
456 | "Pileup", | |
457 | "NSD_{MC}", | |
458 | "Offline" }; | |
cd51b0dd | 459 | for (Int_t i = 0; i < kOffline+1; i++) { |
66cf95f2 | 460 | fHTriggers->GetXaxis()->SetBinLabel(binNum[i], binLbl[i]); |
461 | fHTriggerCorr->GetXaxis()->SetBinLabel(binNum[i], binLbl[i]); | |
462 | fHTriggerCorr->GetYaxis()->SetBinLabel(binNum[i], binLbl[i]); | |
463 | } | |
8565b10b | 464 | fList->Add(fHTriggers); |
66cf95f2 | 465 | fList->Add(fHTriggerCorr); |
466 | ||
0bd4b00f | 467 | |
468 | fHType = new TH1I("type", Form("Event type (cut: SPD mult>%d)", | |
469 | fLowFluxCut), 2, -.5, 1.5); | |
470 | fHType->SetFillColor(kRed+1); | |
471 | fHType->SetFillStyle(3001); | |
472 | fHType->SetStats(0); | |
473 | fHType->SetDirectory(0); | |
474 | fHType->GetXaxis()->SetBinLabel(1,"Low-flux"); | |
475 | fHType->GetXaxis()->SetBinLabel(2,"High-flux"); | |
476 | fList->Add(fHType); | |
fe52e455 | 477 | |
c56f8519 | 478 | #if 0 |
479 | // This histogram disabled as it causes problems in the merge | |
fe52e455 | 480 | fHWords = new TH1I("words", "Trigger words seen", 1, 0, 0); |
481 | fHWords->SetFillColor(kBlue+1); | |
482 | fHWords->SetFillStyle(3001); | |
483 | fHWords->SetStats(0); | |
484 | fHWords->SetDirectory(0); | |
485 | fHWords->SetBit(TH1::kCanRebin); | |
486 | fList->Add(fHWords); | |
c56f8519 | 487 | #endif |
5e4d905e | 488 | |
e308a636 | 489 | fHCent = new TH1F("cent", "Centrality", limits.GetSize()-1,limits.GetArray()); |
5e4d905e | 490 | fHCent->SetFillColor(kBlue+1); |
491 | fHCent->SetFillStyle(3001); | |
492 | fHCent->SetStats(0); | |
493 | fHCent->SetDirectory(0); | |
494 | fHCent->SetXTitle("Centrality [%]"); | |
495 | fHCent->SetYTitle("Events"); | |
496 | fList->Add(fHCent); | |
e308a636 | 497 | |
498 | fHCentVsQual = new TH2F("centVsQuality", "Quality vs Centrality", | |
499 | 5, 0, 5, limits.GetSize()-1, limits.GetArray()); | |
500 | fHCentVsQual->SetXTitle("Quality"); | |
501 | fHCentVsQual->SetYTitle("Centrality [%]"); | |
502 | fHCentVsQual->SetZTitle("Events"); | |
503 | fHCentVsQual->GetXaxis()->SetBinLabel(1, "OK"); | |
504 | fHCentVsQual->GetXaxis()->SetBinLabel(2, "Outside v_{z} cut"); | |
505 | fHCentVsQual->GetXaxis()->SetBinLabel(3, "V0 vs SPD outlier"); | |
506 | fHCentVsQual->GetXaxis()->SetBinLabel(4, "V0 vs TPC outlier"); | |
507 | fHCentVsQual->GetXaxis()->SetBinLabel(5, "V0 vs ZDC outlier"); | |
b7ab8a2c | 508 | fHCentVsQual->SetDirectory(0); |
e308a636 | 509 | fList->Add(fHCentVsQual); |
241cca4d | 510 | |
511 | fHStatus = new TH1I("status", "Status", 7, 1, 8); | |
512 | fHStatus->SetFillColor(kRed+1); | |
513 | fHStatus->SetFillStyle(3001); | |
514 | fHStatus->SetStats(0); | |
515 | fHStatus->SetDirectory(0); | |
516 | fHStatus->GetXaxis()->SetBinLabel(1, "OK"); | |
517 | fHStatus->GetXaxis()->SetBinLabel(2, "No event"); | |
518 | fHStatus->GetXaxis()->SetBinLabel(3, "No triggers"); | |
519 | fHStatus->GetXaxis()->SetBinLabel(4, "No SPD"); | |
520 | fHStatus->GetXaxis()->SetBinLabel(5, "No FMD"); | |
521 | fHStatus->GetXaxis()->SetBinLabel(6, "No vertex"); | |
522 | fHStatus->GetXaxis()->SetBinLabel(7, "Bad vertex"); | |
523 | fList->Add(fHStatus); | |
8565b10b | 524 | } |
525 | ||
f7cfc454 | 526 | //____________________________________________________________________ |
527 | void | |
9b2f2e39 | 528 | AliFMDEventInspector::StoreInformation(Int_t runNo) |
f7cfc454 | 529 | { |
530 | // Write TNamed objects to output list containing information about | |
531 | // the running conditions | |
6ab100ec | 532 | DGUARD(fDebug,2,"Store information from AliFMDEventInspector"); |
f7cfc454 | 533 | if (!fList) return; |
534 | ||
241cca4d | 535 | |
536 | fList->Add(AliForwardUtil::MakeParameter("sys", fCollisionSystem)); | |
537 | fList->Add(AliForwardUtil::MakeParameter("sNN", fEnergy)); | |
538 | fList->Add(AliForwardUtil::MakeParameter("field", fField)); | |
539 | fList->Add(AliForwardUtil::MakeParameter("runNo", runNo)); | |
540 | fList->Add(AliForwardUtil::MakeParameter("lowFlux", fLowFluxCut)); | |
541 | fList->Add(AliForwardUtil::MakeParameter("fpVtx",fUseFirstPhysicsVertex)); | |
542 | fList->Add(AliForwardUtil::MakeParameter("v0and",fUseV0AND)); | |
543 | fList->Add(AliForwardUtil::MakeParameter("nPileUp", fMinPileupContrib)); | |
544 | fList->Add(AliForwardUtil::MakeParameter("dPileup", fMinPileupDistance)); | |
f7cfc454 | 545 | } |
546 | ||
8565b10b | 547 | //____________________________________________________________________ |
548 | void | |
549 | AliFMDEventInspector::DefineOutput(TList* dir) | |
550 | { | |
7984e5f7 | 551 | // |
552 | // Define the output histograms. These are put in a sub list of the | |
553 | // passed list. The histograms are merged before the parent task calls | |
554 | // AliAnalysisTaskSE::Terminate | |
555 | // | |
556 | // dir Directory to add to | |
557 | // | |
6ab100ec | 558 | DGUARD(fDebug,1,"Define output from AliFMDEventInspector"); |
8565b10b | 559 | fList = new TList; |
560 | fList->SetName(GetName()); | |
c929bc03 | 561 | fList->SetOwner(); |
8565b10b | 562 | dir->Add(fList); |
563 | } | |
564 | ||
565 | //____________________________________________________________________ | |
566 | UInt_t | |
567 | AliFMDEventInspector::Process(const AliESDEvent* event, | |
568 | UInt_t& triggers, | |
569 | Bool_t& lowFlux, | |
0bd4b00f | 570 | UShort_t& ivz, |
5ca83fee | 571 | TVector3& ip, |
5bb5d1f6 | 572 | Double_t& cent, |
573 | UShort_t& nClusters) | |
8565b10b | 574 | { |
7984e5f7 | 575 | // |
576 | // Process the event | |
577 | // | |
578 | // Parameters: | |
579 | // event Input event | |
580 | // triggers On return, the triggers fired | |
581 | // lowFlux On return, true if the event is considered a low-flux | |
582 | // event (according to the setting of fLowFluxCut) | |
583 | // ivz On return, the found vertex bin (1-based). A zero | |
584 | // means outside of the defined vertex range | |
585 | // vz On return, the z position of the interaction | |
5e4d905e | 586 | // cent On return, the centrality - if not available < 0 |
7984e5f7 | 587 | // |
588 | // Return: | |
589 | // 0 (or kOk) on success, otherwise a bit mask of error codes | |
590 | // | |
6ab100ec | 591 | DGUARD(fDebug,1,"Process event in AliFMDEventInspector"); |
7984e5f7 | 592 | |
e1f47419 | 593 | // --- Check that we have an event --------------------------------- |
8565b10b | 594 | if (!event) { |
595 | AliWarning("No ESD event found for input event"); | |
241cca4d | 596 | fHStatus->Fill(2); |
8565b10b | 597 | return kNoEvent; |
598 | } | |
599 | ||
e1f47419 | 600 | // --- Read trigger information from the ESD and store in AOD object |
241cca4d | 601 | if (!ReadTriggers(*event, triggers, nClusters)) { |
0bd4b00f | 602 | if (fDebug > 2) { |
603 | AliWarning("Failed to read triggers from ESD"); } | |
241cca4d | 604 | fHStatus->Fill(3); |
8565b10b | 605 | return kNoTriggers; |
606 | } | |
607 | ||
e1f47419 | 608 | // --- Check if this is a high-flux event -------------------------- |
8565b10b | 609 | const AliMultiplicity* testmult = event->GetMultiplicity(); |
610 | if (!testmult) { | |
0bd4b00f | 611 | if (fDebug > 3) { |
612 | AliWarning("No central multiplicity object found"); } | |
8565b10b | 613 | } |
e1f47419 | 614 | else |
615 | lowFlux = testmult->GetNumberOfTracklets() < fLowFluxCut; | |
5e4d905e | 616 | |
0bd4b00f | 617 | fHType->Fill(lowFlux ? 0 : 1); |
241cca4d | 618 | |
619 | // --- Process satellite event information is requested ------------ | |
620 | if (fUseDisplacedVertices) { | |
621 | if (!fDisplacedVertex.Process(event)) | |
622 | AliWarning("Failed to process satellite event"); | |
623 | } | |
5e4d905e | 624 | |
e1f47419 | 625 | // --- Read centrality information |
e308a636 | 626 | cent = -10; |
627 | UShort_t qual = 0; | |
241cca4d | 628 | if (!ReadCentrality(*event, cent, qual)) { |
e1f47419 | 629 | if (fDebug > 3) |
630 | AliWarning("Failed to get centrality"); | |
8565b10b | 631 | } |
e308a636 | 632 | fHCent->Fill(cent); |
633 | if (qual == 0) fHCentVsQual->Fill(0., cent); | |
634 | else { | |
635 | for (UShort_t i = 0; i < 4; i++) | |
636 | if (qual & (1 << i)) fHCentVsQual->Fill(Double_t(i+1), cent); | |
637 | } | |
8565b10b | 638 | |
5ca83fee | 639 | // --- Get the interaction point ----------------------------------- |
640 | Bool_t vzOk = ReadVertex(*event, ip); | |
641 | fHEventsTr->Fill(ip.Z()); | |
8565b10b | 642 | if (!vzOk) { |
0bd4b00f | 643 | if (fDebug > 3) { |
644 | AliWarning("Failed to read vertex from ESD"); } | |
241cca4d | 645 | fHStatus->Fill(6); |
8565b10b | 646 | return kNoVertex; |
647 | } | |
5ca83fee | 648 | fHEventsTrVtx->Fill(ip.Z()); |
96110c91 | 649 | |
e1f47419 | 650 | // --- Get the vertex bin ------------------------------------------ |
5ca83fee | 651 | ivz = fVtxAxis.FindBin(ip.Z()); |
5bb5d1f6 | 652 | if (ivz <= 0 || ivz > fVtxAxis.GetNbins()) { |
0bd4b00f | 653 | if (fDebug > 3) { |
8565b10b | 654 | AliWarning(Form("Vertex @ %f outside of range [%f,%f]", |
5ca83fee | 655 | ip.Z(), fVtxAxis.GetXmin(), fVtxAxis.GetXmax())); |
5bb5d1f6 | 656 | } |
0bd4b00f | 657 | ivz = 0; |
241cca4d | 658 | fHStatus->Fill(7); |
8565b10b | 659 | return kBadVertex; |
660 | } | |
5ca83fee | 661 | fHEventsAccepted->Fill(ip.Z()); |
662 | fHEventsAcceptedXY->Fill(ip.X(),ip.Y()); | |
e58000b7 | 663 | |
e1f47419 | 664 | // --- Check the FMD ESD data -------------------------------------- |
665 | if (!event->GetFMDData()) { | |
666 | if (fDebug > 3) { | |
667 | AliWarning("No FMD data found in ESD"); } | |
241cca4d | 668 | fHStatus->Fill(5); |
e1f47419 | 669 | return kNoFMD; |
670 | } | |
671 | ||
241cca4d | 672 | fHStatus->Fill(1); |
8565b10b | 673 | return kOk; |
674 | } | |
675 | ||
e1f47419 | 676 | //____________________________________________________________________ |
677 | Bool_t | |
241cca4d | 678 | AliFMDEventInspector::ReadCentrality(const AliESDEvent& esd, |
e308a636 | 679 | Double_t& cent, |
680 | UShort_t& qual) const | |
e1f47419 | 681 | { |
682 | // | |
683 | // Read centrality from event | |
684 | // | |
685 | // Parameters: | |
686 | // esd Event | |
687 | // cent On return, the centrality or negative if not found | |
688 | // | |
689 | // Return: | |
690 | // False on error, true otherwise | |
691 | // | |
6ab100ec | 692 | DGUARD(fDebug,2,"Read the centrality in AliFMDEventInspector"); |
241cca4d | 693 | |
694 | if(fUseDisplacedVertices) { | |
695 | Double_t zvtx = fDisplacedVertex.GetVertexZ(); | |
65abd48b | 696 | qual = 1; |
697 | if(TMath::Abs(zvtx) < 999) { | |
241cca4d | 698 | cent = fDisplacedVertex.GetCentralityPercentile(); |
65abd48b | 699 | qual = 0; |
700 | } | |
241cca4d | 701 | return true; |
65abd48b | 702 | } |
703 | ||
241cca4d | 704 | cent = -1; |
705 | qual = 0; | |
706 | AliCentrality* centObj = const_cast<AliESDEvent&>(esd).GetCentrality(); | |
707 | if (!centObj) return true; | |
708 | ||
709 | cent = centObj->GetCentralityPercentile("V0M"); | |
710 | qual = centObj->GetQuality(); | |
e1f47419 | 711 | |
712 | return true; | |
713 | } | |
714 | ||
da70cd6a | 715 | //____________________________________________________________________ |
716 | Bool_t | |
717 | AliFMDEventInspector::CheckpAExtraV0(const AliESDEvent& esd) const | |
718 | { | |
719 | if (fCollisionSystem != AliForwardUtil::kPPb) return true; | |
720 | ||
721 | AliVVZERO* esdV0 = esd.GetVZEROData(); | |
722 | if ((esdV0->GetV0ADecision()!=1) || (esdV0->GetV0CDecision()!=1)) | |
723 | return false; | |
724 | return true; | |
725 | } | |
726 | ||
8565b10b | 727 | //____________________________________________________________________ |
728 | Bool_t | |
241cca4d | 729 | AliFMDEventInspector::ReadTriggers(const AliESDEvent& esd, UInt_t& triggers, |
5bb5d1f6 | 730 | UShort_t& nClusters) |
8565b10b | 731 | { |
7984e5f7 | 732 | // |
733 | // Read the trigger information from the ESD event | |
734 | // | |
735 | // Parameters: | |
736 | // esd ESD event | |
737 | // triggers On return, contains the trigger bits | |
738 | // | |
739 | // Return: | |
740 | // @c true on success, @c false otherwise | |
741 | // | |
6ab100ec | 742 | DGUARD(fDebug,2,"Read the triggers in AliFMDEventInspector"); |
8565b10b | 743 | triggers = 0; |
744 | ||
745 | // Get the analysis manager - should always be there | |
746 | AliAnalysisManager* am = AliAnalysisManager::GetAnalysisManager(); | |
241cca4d | 747 | DMSG(fDebug,10,"Got analysis manager %p", am); |
8565b10b | 748 | if (!am) { |
749 | AliWarning("No analysis manager defined!"); | |
750 | return kFALSE; | |
751 | } | |
752 | ||
753 | // Get the input handler - should always be there | |
754 | AliInputEventHandler* ih = | |
755 | static_cast<AliInputEventHandler*>(am->GetInputEventHandler()); | |
241cca4d | 756 | DMSG(fDebug,10,"Got input handler %p", ih); |
8565b10b | 757 | if (!ih) { |
758 | AliWarning("No input handler"); | |
759 | return kFALSE; | |
760 | } | |
e85a76b7 | 761 | |
e1f47419 | 762 | // Check if this is a collision candidate (MB) |
e333578d | 763 | // Note, that we should use the value cached in the input |
764 | // handler rather than calling IsCollisionCandiate directly | |
765 | // on the AliPhysicsSelection obejct. If we called the latter | |
766 | // then the AliPhysicsSelection object would overcount by a | |
767 | // factor of 2! :-( | |
da70cd6a | 768 | Bool_t offline = ih->IsEventSelected(); |
241cca4d | 769 | Bool_t fastonly = (ih->IsEventSelected() & AliVEvent::kFastOnly); |
770 | TString trigStr = esd.GetFiredTriggerClasses(); | |
771 | ||
772 | if (fHWords) fHWords->Fill(trigStr.Data(), 1); | |
11d40ecb | 773 | |
241cca4d | 774 | if(fUseDisplacedVertices) { |
775 | DMSG(fDebug,3,"Using displaced vertex stuff"); | |
776 | if (TMath::Abs(fDisplacedVertex.GetVertexZ()) >= 999) offline = false; | |
777 | } | |
65abd48b | 778 | |
241cca4d | 779 | if (CheckFastPartition(fastonly)) offline = false; |
780 | if (offline && CheckCosmics(trigStr)) offline = false; | |
c929bc03 | 781 | // if (!CheckpAExtraV0(esd)) offline = false; |
241cca4d | 782 | |
783 | DMSG(fDebug,2,"Event is %striggered by off-line", offline ? "" : "NOT "); | |
784 | ||
785 | if (offline) { | |
786 | triggers |= AliAODForwardMult::kOffline; | |
787 | triggers |= AliAODForwardMult::kInel; | |
788 | if (!fHTriggers) { | |
789 | AliWarning("Histogram of triggers not defined - has init been called"); | |
790 | return false; | |
791 | } | |
cd51b0dd | 792 | // fHTriggers->Fill(kOffline+0.5); |
65abd48b | 793 | |
241cca4d | 794 | CheckINELGT0(esd, nClusters, triggers); |
65abd48b | 795 | } |
796 | ||
241cca4d | 797 | CheckNSD(esd,triggers); |
cd51b0dd | 798 | CheckPileup(esd, triggers); |
799 | CheckEmpty(trigStr, triggers); | |
800 | // if (CheckPileup(esd, triggers)) fHTriggers->Fill(kPileUp+.5); | |
801 | // if (CheckEmpty(trigStr, triggers)) fHTriggers->Fill(kEmpty+.5); | |
241cca4d | 802 | |
803 | CheckWords(esd, triggers); | |
804 | ||
cd51b0dd | 805 | #if 0 |
241cca4d | 806 | // Now check - if we have a collision - for offline triggers and |
807 | // fill histogram. | |
808 | if (triggers & AliAODForwardMult::kB) { | |
809 | fHTriggers->Fill(kB+.5); | |
810 | if (triggers & AliAODForwardMult::kInel) | |
66cf95f2 | 811 | fHTriggers->Fill(kInel+.5); |
241cca4d | 812 | |
813 | if (triggers & AliAODForwardMult::kInelGt0) | |
814 | fHTriggers->Fill(kInelGt0+.5); | |
65abd48b | 815 | |
241cca4d | 816 | if (triggers & AliAODForwardMult::kNSD) |
817 | fHTriggers->Fill(kNSD+.5); | |
818 | ||
819 | if (triggers & AliAODForwardMult::kV0AND) | |
820 | fHTriggers->Fill(kV0AND+.5); | |
65abd48b | 821 | } |
241cca4d | 822 | if (triggers & AliAODForwardMult::kA) fHTriggers->Fill(kA+.5); |
823 | if (triggers & AliAODForwardMult::kC) fHTriggers->Fill(kC+.5); | |
824 | if (triggers & AliAODForwardMult::kE) fHTriggers->Fill(kE+.5); | |
cd51b0dd | 825 | #endif |
66cf95f2 | 826 | #define TEST_TRIG_BIN(RET,BIN,TRIGGERS) \ |
827 | do { switch (BIN) { \ | |
828 | case kInel: RET = triggers & AliAODForwardMult::kInel; break; \ | |
829 | case kInelGt0: RET = triggers & AliAODForwardMult::kInelGt0; break; \ | |
830 | case kNSD: RET = triggers & AliAODForwardMult::kNSD; break; \ | |
831 | case kV0AND: RET = triggers & AliAODForwardMult::kV0AND; break; \ | |
832 | case kEmpty: RET = triggers & AliAODForwardMult::kEmpty; break; \ | |
833 | case kA: RET = triggers & AliAODForwardMult::kA; break; \ | |
834 | case kB: RET = triggers & AliAODForwardMult::kB; break; \ | |
835 | case kC: RET = triggers & AliAODForwardMult::kC; break; \ | |
836 | case kE: RET = triggers & AliAODForwardMult::kE; break; \ | |
837 | case kPileUp: RET = triggers & AliAODForwardMult::kPileUp; break; \ | |
838 | case kMCNSD: RET = triggers & AliAODForwardMult::kMCNSD; break; \ | |
839 | case kOffline: RET = triggers & AliAODForwardMult::kOffline; break; \ | |
840 | default: RET = false; } } while(false) | |
841 | ||
241cca4d | 842 | |
66cf95f2 | 843 | for (Int_t i = 0; i < kOffline+1; i++) { |
844 | Bool_t hasX = false; | |
845 | TEST_TRIG_BIN(hasX, i, triggers); | |
846 | if (!hasX) continue; | |
cd51b0dd | 847 | fHTriggers->Fill(i+.5); |
848 | for (Int_t j = 0; j < kOffline+1; j++) { | |
66cf95f2 | 849 | Bool_t hasY = false; |
850 | TEST_TRIG_BIN(hasY, j, triggers); | |
851 | if (!hasY) continue; | |
852 | ||
853 | fHTriggerCorr->Fill(i+.5, j+.5); | |
854 | } | |
855 | } | |
241cca4d | 856 | return kTRUE; |
857 | } | |
858 | ||
859 | //____________________________________________________________________ | |
860 | Bool_t | |
861 | AliFMDEventInspector::CheckFastPartition(bool fastonly) const | |
862 | { | |
11d40ecb | 863 | // For the 2.76 TeV p+p run, the FMD ran in the slow partition |
864 | // so it received no triggers from the fast partition. Therefore | |
865 | // the fast triggers are removed here but not for MC where all | |
866 | // triggers are fast. | |
241cca4d | 867 | if (TMath::Abs(fEnergy - 2750.) > 20) return false; |
868 | if (fCollisionSystem != AliForwardUtil::kPP) return false; | |
869 | if (fastonly) | |
870 | DMSG(fDebug,1,"Fast trigger in pp @ sqrt(s)=2.76TeV removed"); | |
871 | ||
872 | return fastonly; | |
873 | } | |
874 | ||
875 | //____________________________________________________________________ | |
876 | Bool_t | |
877 | AliFMDEventInspector::CheckCosmics(const TString& trigStr) const | |
878 | { | |
879 | // MUON triggers are not strictly minimum bias (MB) so they are | |
880 | // removed (HHD) | |
881 | if(trigStr.Contains("CMUS1")) { | |
882 | DMSG(fDebug,1,"Cosmic trigger ins't min-bias, removed"); | |
883 | return true; | |
884 | } | |
885 | return false; | |
886 | } | |
887 | ||
888 | //____________________________________________________________________ | |
889 | Bool_t | |
890 | AliFMDEventInspector::CheckINELGT0(const AliESDEvent& esd, | |
891 | UShort_t& nClusters, | |
892 | UInt_t& triggers) const | |
893 | { | |
5bb5d1f6 | 894 | nClusters = 0; |
8565b10b | 895 | |
241cca4d | 896 | // If this is inel, see if we have a tracklet |
897 | const AliMultiplicity* spdmult = esd.GetMultiplicity(); | |
898 | if (!spdmult) { | |
899 | AliWarning("No SPD multiplicity"); | |
900 | return false; | |
901 | } | |
902 | ||
903 | // Check if we have one or more tracklets | |
904 | // in the range -1 < eta < 1 to set the INEL>0 | |
905 | // trigger flag. | |
906 | // | |
907 | // Also count tracklets as a single cluster | |
908 | Int_t n = spdmult->GetNumberOfTracklets(); | |
909 | for (Int_t j = 0; j < n; j++) { | |
910 | if(TMath::Abs(spdmult->GetEta(j)) < 1) { | |
911 | triggers |= AliAODForwardMult::kInelGt0; | |
912 | nClusters++; | |
8565b10b | 913 | } |
914 | } | |
241cca4d | 915 | n = spdmult->GetNumberOfSingleClusters(); |
916 | for (Int_t j = 0; j < n; j++) { | |
917 | Double_t eta = -TMath::Log(TMath::Tan(spdmult->GetThetaSingle(j)/2.)); | |
918 | if (TMath::Abs(eta) < 1) nClusters++; | |
919 | } | |
920 | if (nClusters > 0) triggers |= AliAODForwardMult::kNClusterGt0; | |
921 | ||
922 | return triggers & AliAODForwardMult::kNClusterGt0; | |
923 | } | |
924 | ||
925 | //____________________________________________________________________ | |
926 | Bool_t | |
927 | AliFMDEventInspector::CheckNSD(const AliESDEvent& esd, UInt_t& triggers) const | |
928 | { | |
8565b10b | 929 | // Analyse some trigger stuff |
930 | AliTriggerAnalysis ta; | |
241cca4d | 931 | if (ta.IsOfflineTriggerFired(&esd, AliTriggerAnalysis::kV0AND)) { |
e6463868 | 932 | triggers |= AliAODForwardMult::kV0AND; |
933 | if (fUseV0AND) | |
31554871 | 934 | triggers |= AliAODForwardMult::kNSD; |
935 | } | |
241cca4d | 936 | if (ta.IsOfflineTriggerFired(&esd, AliTriggerAnalysis::kNSD1)) |
e6463868 | 937 | triggers |= AliAODForwardMult::kNSD; |
241cca4d | 938 | return triggers & AliAODForwardMult::kNSD; |
939 | } | |
940 | //____________________________________________________________________ | |
941 | Bool_t | |
942 | AliFMDEventInspector::CheckPileup(const AliESDEvent& esd, | |
943 | UInt_t& triggers) const | |
944 | { | |
5bb5d1f6 | 945 | // Check for multiple vertices (pile-up) with at least 3 |
946 | // contributors and at least 0.8cm from the primary vertex | |
241cca4d | 947 | if(fCollisionSystem != AliForwardUtil::kPP) return false; |
948 | ||
949 | Bool_t pileup = esd.IsPileupFromSPD(fMinPileupContrib,fMinPileupDistance); | |
950 | if (pileup) triggers |= AliAODForwardMult::kPileUp; | |
951 | return pileup; | |
952 | } | |
953 | ||
954 | //____________________________________________________________________ | |
955 | Bool_t | |
956 | AliFMDEventInspector::CheckEmpty(const TString& trigStr, UInt_t& triggers) const | |
957 | { | |
8565b10b | 958 | if (trigStr.Contains("CBEAMB-ABCE-NOPF-ALL")) { |
959 | triggers |= AliAODForwardMult::kEmpty; | |
241cca4d | 960 | return true; |
8565b10b | 961 | } |
241cca4d | 962 | return false; |
963 | } | |
964 | //____________________________________________________________________ | |
965 | Bool_t | |
966 | AliFMDEventInspector::CheckWords(const AliESDEvent& esd, UInt_t& triggers) const | |
967 | { | |
968 | TObject* word = 0; | |
969 | TIter nextColl(&fCollWords); | |
970 | while ((word = nextColl())) { | |
971 | DMSG(fDebug,10,"Checking if %s trigger %s is fired", | |
972 | word->GetTitle(), word->GetName()); | |
973 | if (!esd.IsTriggerClassFired(word->GetName())) continue; | |
8565b10b | 974 | |
241cca4d | 975 | TString beamSide = word->GetTitle(); |
976 | DMSG(fDebug,10,"Found it - this is a %s trigger", beamSide.Data()); | |
e85a76b7 | 977 | |
241cca4d | 978 | if (!beamSide.EqualTo("B")) continue; |
979 | triggers |= AliAODForwardMult::kB; | |
980 | break; // No more to do here | |
e85a76b7 | 981 | } |
241cca4d | 982 | TIter nextBg(&fBgWords); |
983 | UInt_t all = (AliAODForwardMult::kA | | |
984 | AliAODForwardMult::kC | | |
985 | AliAODForwardMult::kE); | |
986 | while ((word = nextBg())) { | |
987 | DMSG(fDebug,10,"Checking if %s trigger %s is fired", | |
988 | word->GetTitle(), word->GetName()); | |
989 | if (!esd.IsTriggerClassFired(word->GetName())) continue; | |
0be6c8cd | 990 | |
241cca4d | 991 | TString beamSide = word->GetTitle(); |
992 | DMSG(fDebug,10,"Found it - this is a %s trigger", beamSide.Data()); | |
e6463868 | 993 | |
241cca4d | 994 | if (beamSide.Contains("A")) triggers |= AliAODForwardMult::kA; |
995 | if (beamSide.Contains("C")) triggers |= AliAODForwardMult::kC; | |
996 | if (beamSide.Contains("E")) triggers |= AliAODForwardMult::kE; | |
997 | ||
998 | if ((triggers & all) == all) break; // No more to do | |
0be6c8cd | 999 | } |
241cca4d | 1000 | return true; |
8565b10b | 1001 | } |
241cca4d | 1002 | |
1003 | ||
8565b10b | 1004 | //____________________________________________________________________ |
1005 | Bool_t | |
5ca83fee | 1006 | AliFMDEventInspector::ReadVertex(const AliESDEvent& esd, TVector3& ip) |
8565b10b | 1007 | { |
7984e5f7 | 1008 | // |
1009 | // Read the vertex information from the ESD event | |
1010 | // | |
1011 | // Parameters: | |
1012 | // esd ESD event | |
1013 | // vz On return, the vertex Z position | |
1014 | // | |
1015 | // Return: | |
1016 | // @c true on success, @c false otherwise | |
1017 | // | |
6ab100ec | 1018 | DGUARD(fDebug,2,"Read the vertex in AliFMDEventInspector"); |
5ca83fee | 1019 | ip.SetXYZ(1024, 1024, 0); |
65abd48b | 1020 | |
241cca4d | 1021 | if(fUseDisplacedVertices) { |
1022 | Double_t zvtx = fDisplacedVertex.GetVertexZ(); | |
1023 | ||
65abd48b | 1024 | if(TMath::Abs(zvtx) < 999) { |
5ca83fee | 1025 | ip.SetZ(zvtx); |
65abd48b | 1026 | return true; |
1027 | } | |
241cca4d | 1028 | return false; |
65abd48b | 1029 | } |
1030 | ||
5ca83fee | 1031 | if(fUseFirstPhysicsVertex) return CheckPWGUDVertex(esd, ip); |
241cca4d | 1032 | |
1033 | ||
5ca83fee | 1034 | return CheckVertex(esd, ip); |
241cca4d | 1035 | } |
1036 | ||
1037 | //____________________________________________________________________ | |
1038 | Bool_t | |
1039 | AliFMDEventInspector::CheckPWGUDVertex(const AliESDEvent& esd, | |
5ca83fee | 1040 | TVector3& ip) const |
241cca4d | 1041 | { |
1042 | // This is the code used by the 1st physics people | |
1043 | const AliESDVertex* vertex = esd.GetPrimaryVertex(); | |
1044 | if (!vertex || !vertex->GetStatus()) { | |
1045 | DMSG(fDebug,2,"No primary vertex (%p) or bad status %d", | |
1046 | vertex, (vertex ? vertex->GetStatus() : -1)); | |
1047 | return false; | |
1048 | } | |
1049 | const AliESDVertex* vertexSPD = esd.GetPrimaryVertexSPD(); | |
1050 | if (!vertexSPD || !vertexSPD->GetStatus()) { | |
1051 | DMSG(fDebug,2,"No primary SPD vertex (%p) or bad status %d", | |
1052 | vertexSPD, (vertexSPD ? vertexSPD->GetStatus() : -1)); | |
1053 | return false; | |
1054 | } | |
96110c91 | 1055 | |
241cca4d | 1056 | // if vertex is from SPD vertexZ, require more stringent cuts |
1057 | if (vertex->IsFromVertexerZ()) { | |
1058 | if (vertex->GetDispersion() > fMaxVzErr || | |
1059 | vertex->GetZRes() > 1.25 * fMaxVzErr) { | |
1060 | DMSG(fDebug,2,"Dispersion %f > %f or resolution %f > %f", | |
1061 | vertex->GetDispersion(), fMaxVzErr, | |
1062 | vertex->GetZRes(), 1.25 * fMaxVzErr); | |
1063 | return false; | |
96110c91 | 1064 | } |
96110c91 | 1065 | } |
5ca83fee | 1066 | ip.SetZ(vertex->GetZ()); |
241cca4d | 1067 | |
1068 | if(!vertex->IsFromVertexerZ()) { | |
5ca83fee | 1069 | ip.SetX(vertex->GetX()); |
1070 | ip.SetY(vertex->GetY()); | |
241cca4d | 1071 | } |
1072 | return true; | |
1073 | } | |
1074 | //____________________________________________________________________ | |
1075 | Bool_t | |
1076 | AliFMDEventInspector::CheckVertex(const AliESDEvent& esd, | |
5ca83fee | 1077 | TVector3& ip) const |
241cca4d | 1078 | { |
1079 | // Use standard SPD vertex (perhaps preferable for Pb+Pb) | |
1080 | // Get the vertex | |
1081 | const AliESDVertex* vertex = esd.GetPrimaryVertexSPD(); | |
1082 | if (!vertex) { | |
1083 | if (fDebug > 2) { | |
1084 | AliWarning("No SPD vertex found in ESD"); } | |
1085 | return false; | |
1086 | } | |
e83d0620 | 1087 | |
241cca4d | 1088 | // Check that enough tracklets contributed |
1089 | if(vertex->GetNContributors() <= 0) { | |
1090 | DMSG(fDebug,2,"Number of contributors to vertex is %d<=0", | |
1091 | vertex->GetNContributors()); | |
5ca83fee | 1092 | ip.SetZ(0); |
241cca4d | 1093 | return false; |
1094 | } | |
1095 | // Check that the uncertainty isn't too large | |
1096 | if (vertex->GetZRes() > fMaxVzErr) { | |
1097 | DMSG(fDebug,2,"Uncertaintity in Z of vertex is too large %f > %f", | |
1098 | vertex->GetZRes(), fMaxVzErr); | |
1099 | return false; | |
1100 | } | |
e83d0620 | 1101 | |
241cca4d | 1102 | // Get the z coordiante |
5ca83fee | 1103 | ip.SetZ(vertex->GetZ()); |
241cca4d | 1104 | const AliESDVertex* vertexXY = esd.GetPrimaryVertex(); |
96110c91 | 1105 | |
5ca83fee | 1106 | |
241cca4d | 1107 | if(!vertexXY->IsFromVertexerZ()) { |
5ca83fee | 1108 | ip.SetX(vertexXY->GetX()); |
1109 | ip.SetY(vertexXY->GetY()); | |
241cca4d | 1110 | } |
1111 | return true; | |
8565b10b | 1112 | } |
241cca4d | 1113 | |
0bd4b00f | 1114 | //____________________________________________________________________ |
1115 | Bool_t | |
1116 | AliFMDEventInspector::ReadRunDetails(const AliESDEvent* esd) | |
1117 | { | |
7984e5f7 | 1118 | // |
1119 | // Read the collision system, collision energy, and L3 field setting | |
1120 | // from the ESD | |
1121 | // | |
1122 | // Parameters: | |
1123 | // esd ESD to get information from | |
1124 | // | |
1125 | // Return: | |
1126 | // true on success, false | |
1127 | // | |
cc83fca2 | 1128 | // AliInfo(Form("Parameters from 1st ESD event: cms=%s, sNN=%f, field=%f", |
1129 | // esd->GetBeamType(), 2*esd->GetBeamEnergy(), | |
1130 | // esd->GetMagneticField())); | |
6ab100ec | 1131 | DGUARD(fDebug,2,"Read the run details in AliFMDEventInspector"); |
d4d486f8 | 1132 | const char* sys = esd->GetBeamType(); |
1133 | Float_t cms = 2 * esd->GetBeamEnergy(); | |
1134 | Float_t fld = esd->GetMagneticField(); | |
1135 | fCollisionSystem = AliForwardUtil::ParseCollisionSystem(sys); | |
1136 | fEnergy = AliForwardUtil::ParseCenterOfMassEnergy(fCollisionSystem, | |
1137 | cms); | |
1138 | fField = AliForwardUtil::ParseMagneticField(fld); | |
f7cfc454 | 1139 | |
9b2f2e39 | 1140 | StoreInformation(esd->GetRunNumber()); |
d4d486f8 | 1141 | if (fCollisionSystem == AliForwardUtil::kUnknown) { |
1142 | AliWarningF("Unknown collision system: %s - please check", sys); | |
1143 | return false; | |
1144 | } | |
1145 | if (fEnergy <= 0) { | |
1146 | AliWarningF("Unknown CMS energy: %f (%d) - please check", cms, fEnergy); | |
1147 | return false; | |
1148 | } | |
1149 | if (TMath::Abs(fField) > 10) { | |
1150 | AliWarningF("Unknown L3 field setting: %f (%d) - please check", fld,fField); | |
1151 | return false; | |
1152 | } | |
0bd4b00f | 1153 | |
d4d486f8 | 1154 | return true; |
0bd4b00f | 1155 | } |
1156 | ||
241cca4d | 1157 | |
1158 | //____________________________________________________________________ | |
1159 | const Char_t* | |
1160 | AliFMDEventInspector::CodeString(UInt_t code) | |
1161 | { | |
1162 | static TString s; | |
1163 | s = ""; | |
1164 | if (code & kNoEvent) s.Append("NOEVENT "); | |
1165 | if (code & kNoTriggers) s.Append("NOTRIGGERS "); | |
1166 | if (code & kNoSPD) s.Append("NOSPD "); | |
1167 | if (code & kNoFMD) s.Append("NOFMD "); | |
1168 | if (code & kNoVertex) s.Append("NOVERTEX "); | |
1169 | if (code & kBadVertex) s.Append("BADVERTEX "); | |
1170 | return s.Data(); | |
1171 | } | |
0bd4b00f | 1172 | //____________________________________________________________________ |
1173 | void | |
1174 | AliFMDEventInspector::Print(Option_t*) const | |
1175 | { | |
7984e5f7 | 1176 | // |
1177 | // Print information | |
1178 | // | |
1179 | // option Not used | |
1180 | // | |
0bd4b00f | 1181 | char ind[gROOT->GetDirLevel()+1]; |
1182 | for (Int_t i = 0; i < gROOT->GetDirLevel(); i++) ind[i] = ' '; | |
1183 | ind[gROOT->GetDirLevel()] = '\0'; | |
1184 | TString sNN(AliForwardUtil::CenterOfMassEnergyString(fEnergy)); | |
1185 | sNN.Strip(TString::kBoth, '0'); | |
1186 | sNN.ReplaceAll("GeV", " GeV"); | |
1187 | TString field(AliForwardUtil::MagneticFieldString(fField)); | |
1188 | field.ReplaceAll("p", "+"); | |
1189 | field.ReplaceAll("m", "-"); | |
1190 | field.ReplaceAll("kG", " kG"); | |
1191 | ||
241cca4d | 1192 | std::cout << std::boolalpha |
1193 | << ind << ClassName() << ": " << GetName() << '\n' | |
2a9e4c0b | 1194 | << ind << " Vertex bins: " << fVtxAxis.GetNbins() << '\n' |
1195 | << ind << " Vertex range: [" << fVtxAxis.GetXmin() | |
1196 | << "," << fVtxAxis.GetXmax() << "]\n" | |
0bd4b00f | 1197 | << ind << " Low flux cut: " << fLowFluxCut << '\n' |
1198 | << ind << " Max(delta v_z): " << fMaxVzErr << " cm\n" | |
e6463868 | 1199 | << ind << " Min(nContrib_pileup): " << fMinPileupContrib << '\n' |
1200 | << ind << " Min(v-pileup): " << fMinPileupDistance << '\n' | |
0bd4b00f | 1201 | << ind << " System: " |
1202 | << AliForwardUtil::CollisionSystemString(fCollisionSystem) << '\n' | |
1203 | << ind << " CMS energy per nucleon: " << sNN << '\n' | |
241cca4d | 1204 | << ind << " Field: " << field << '\n' |
1205 | << ind << " Satellite events: " << fUseDisplacedVertices | |
1206 | << "\n" << std::noboolalpha; | |
d8244e9e | 1207 | if (!fCentAxis) { std::cout << std::flush; return; } |
1208 | Int_t nBin = fCentAxis->GetNbins(); | |
1209 | std::cout << ind << " Centrality axis: " << nBin << " bins" | |
1210 | << std::flush; | |
1211 | for (Int_t i = 0; i < nBin; i++) { | |
1212 | if ((i % 10) == 0) std::cout << '\n' << ind << " "; | |
1213 | std::cout << std::setw(5) << fCentAxis->GetBinLowEdge(i+1) << '-'; | |
1214 | } | |
1215 | std::cout << std::setw(5) << fCentAxis->GetBinUpEdge(nBin) << std::endl; | |
0bd4b00f | 1216 | } |
1217 | ||
1218 | ||
8565b10b | 1219 | // |
1220 | // EOF | |
1221 | // | |
1222 |