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