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