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