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