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