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