2 // This class inspects the event
5 // - AliESDFMD object possibly corrected for sharing
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
12 // Note, that these are added to the master output list
17 #include "AliFMDEventInspector.h"
19 #include "AliESDEvent.h"
20 #include "AliMultiplicity.h"
21 #include "AliAnalysisManager.h"
22 #include "AliMCEventHandler.h"
23 #include "AliInputEventHandler.h"
24 #include "AliTriggerAnalysis.h"
25 #include "AliPhysicsSelection.h"
26 #include "AliOADBPhysicsSelection.h"
27 #include "AliAODForwardMult.h"
28 #include "AliForwardUtil.h"
29 #include "AliCentrality.h"
32 #include <TDirectory.h>
34 #include <TParameter.h>
38 //====================================================================
39 AliFMDEventInspector::AliFMDEventInspector()
44 fHEventsAcceptedXY(0),
55 fCollisionSystem(kUnknown),
59 fUseFirstPhysicsVertex(true),
62 fMinPileupDistance(0.8)
69 //____________________________________________________________________
70 AliFMDEventInspector::AliFMDEventInspector(const char* name)
71 : TNamed("fmdEventInspector", name),
75 fHEventsAcceptedXY(0),
86 fCollisionSystem(kUnknown),
90 fUseFirstPhysicsVertex(true),
93 fMinPileupDistance(0.8)
99 // name Name of object
103 //____________________________________________________________________
104 AliFMDEventInspector::AliFMDEventInspector(const AliFMDEventInspector& o)
106 fHEventsTr(o.fHEventsTr),
107 fHEventsTrVtx(o.fHEventsTrVtx),
108 fHEventsAccepted(o.fHEventsAccepted),
109 fHEventsAcceptedXY(o.fHEventsAcceptedXY),
110 fHTriggers(o.fHTriggers),
114 fHCentVsQual(o.fHCentVsQual),
115 fLowFluxCut(o.fLowFluxCut),
116 fMaxVzErr(o.fMaxVzErr),
120 fCollisionSystem(o.fCollisionSystem),
123 fVtxAxis(o.fVtxAxis),
124 fUseFirstPhysicsVertex(o.fUseFirstPhysicsVertex),
125 fUseV0AND(o.fUseV0AND),
126 fMinPileupContrib(o.fMinPileupContrib),
127 fMinPileupDistance(o.fMinPileupDistance)
133 // o Object to copy from
137 //____________________________________________________________________
138 AliFMDEventInspector::~AliFMDEventInspector()
143 if (fList) delete fList;
145 //____________________________________________________________________
146 AliFMDEventInspector&
147 AliFMDEventInspector::operator=(const AliFMDEventInspector& o)
150 // Assignement operator
153 // o Object to assign from
156 // Reference to this object
158 if (&o == this) return *this;
159 TNamed::operator=(o);
160 fHEventsTr = o.fHEventsTr;
161 fHEventsTrVtx = o.fHEventsTrVtx;
162 fHEventsAccepted = o.fHEventsAccepted;
163 fHEventsAcceptedXY = o.fHEventsAcceptedXY;
164 fHTriggers = o.fHTriggers;
168 fHCentVsQual = o.fHCentVsQual;
169 fLowFluxCut = o.fLowFluxCut;
170 fMaxVzErr = o.fMaxVzErr;
172 fList = (o.fList ? new TList : 0);
175 fCollisionSystem = o.fCollisionSystem;
176 fVtxAxis.Set(o.fVtxAxis.GetNbins(), o.fVtxAxis.GetXmin(),
177 o.fVtxAxis.GetXmax());
179 fUseFirstPhysicsVertex = o.fUseFirstPhysicsVertex;
180 fUseV0AND = o.fUseV0AND;
181 fMinPileupContrib = o.fMinPileupContrib;
182 fMinPileupDistance = o.fMinPileupDistance;
185 fList->SetName(GetName());
186 if (fHEventsTr) fList->Add(fHEventsTr);
187 if (fHEventsTrVtx) fList->Add(fHEventsTrVtx);
188 if (fHTriggers) fList->Add(fHTriggers);
189 if (fHType) fList->Add(fHType);
190 if (fHWords) fList->Add(fHWords);
191 if (fHCent) fList->Add(fHCent);
192 if (fHCentVsQual) fList->Add(fHCentVsQual);
197 //____________________________________________________________________
199 AliFMDEventInspector::FetchHistograms(const TList* d,
202 TH1I*& hTriggers) const
205 // Fetch our histograms from the passed list
209 // hEventsTr On return, pointer to histogram, or null
210 // hEventsTrVtx On return, pointer to histogram, or null
211 // hTriggers On return, pointer to histogram, or null
214 // true on success, false otherwise
219 TList* dd = dynamic_cast<TList*>(d->FindObject(GetName()));
220 if (!dd) return kFALSE;
222 hEventsTr = dynamic_cast<TH1I*>(dd->FindObject("nEventsTr"));
223 hEventsTrVtx = dynamic_cast<TH1I*>(dd->FindObject("nEventsTrVtx"));
224 hTriggers = dynamic_cast<TH1I*>(dd->FindObject("triggers"));
226 if (!hEventsTr || !hEventsTrVtx || !hTriggers) return kFALSE;
229 //____________________________________________________________________
231 AliFMDEventInspector::Init(const TAxis& vtxAxis)
234 // Initialize the object
237 // vtxAxis Vertex axis in use
240 // -1.5 -0.5 0.5 1.5 ... 89.5 ... 100.5
241 // ----- 92 number --------- ---- 1 ---
243 for (Int_t i = 0; i < 92; i++) limits[i] = -1.5 + i;
246 fVtxAxis.Set(vtxAxis.GetNbins(), vtxAxis.GetXmin(), vtxAxis.GetXmax());
248 fCentAxis = new TAxis(limits.GetSize()-1, limits.GetArray());
249 fHEventsTr = new TH1I("nEventsTr", "Number of events w/trigger",
250 4*vtxAxis.GetNbins(),
252 2*vtxAxis.GetXmax());
253 fHEventsTr->SetXTitle("v_{z} [cm]");
254 fHEventsTr->SetYTitle("# of events");
255 fHEventsTr->SetFillColor(kRed+1);
256 fHEventsTr->SetFillStyle(3001);
257 fHEventsTr->SetDirectory(0);
258 // fHEventsTr->Sumw2();
259 fList->Add(fHEventsTr);
261 fHEventsTrVtx = static_cast<TH1I*>(fHEventsTr->Clone("nEventsTrVtx"));
262 fHEventsTrVtx->SetTitle("Number of events w/trigger and vertex");
263 fHEventsTrVtx->SetFillColor(kBlue+1);
264 fHEventsTrVtx->SetDirectory(0);
265 // fHEventsTrVtx->Sumw2();
266 fList->Add(fHEventsTrVtx);
268 fHEventsAccepted = new TH1I("nEventsAccepted",
269 "Number of events w/trigger and vertex in range",
270 2*vtxAxis.GetNbins(),
272 2*vtxAxis.GetXmax());
273 fHEventsAccepted->SetXTitle("v_{z} [cm]");
274 fHEventsAccepted->SetYTitle("# of events");
275 fHEventsAccepted->SetFillColor(kGreen+1);
276 fHEventsAccepted->SetFillStyle(3001);
277 fHEventsAccepted->SetDirectory(0);
278 // fHEventsAccepted->Sumw2();
279 fList->Add(fHEventsAccepted);
281 fHEventsAcceptedXY = new TH2D("nEventsAcceptedXY",
282 "XY vertex w/trigger and Z vertex in range",
283 1000,-1,1,1000,-1,1);
285 fHEventsAcceptedXY->SetXTitle("v_{x} [cm]");
286 fHEventsAcceptedXY->SetYTitle("v_{y} [cm]");
287 fHEventsAcceptedXY->SetDirectory(0);
288 // fHEventsAccepted->Sumw2();
289 fList->Add(fHEventsAcceptedXY);
292 fHTriggers = new TH1I("triggers", "Triggers", kOffline+1, 0, kOffline+1);
293 fHTriggers->SetFillColor(kRed+1);
294 fHTriggers->SetFillStyle(3001);
295 fHTriggers->SetStats(0);
296 fHTriggers->SetDirectory(0);
297 fHTriggers->GetXaxis()->SetBinLabel(kInel +1,"INEL");
298 fHTriggers->GetXaxis()->SetBinLabel(kInelGt0+1,"INEL>0");
299 fHTriggers->GetXaxis()->SetBinLabel(kNSD +1,"NSD");
300 fHTriggers->GetXaxis()->SetBinLabel(kV0AND +1,"VOAND");
301 fHTriggers->GetXaxis()->SetBinLabel(kEmpty +1,"Empty");
302 fHTriggers->GetXaxis()->SetBinLabel(kA +1,"A");
303 fHTriggers->GetXaxis()->SetBinLabel(kB +1,"B");
304 fHTriggers->GetXaxis()->SetBinLabel(kC +1,"C");
305 fHTriggers->GetXaxis()->SetBinLabel(kE +1,"E");
306 fHTriggers->GetXaxis()->SetBinLabel(kPileUp +1,"Pileup");
307 fHTriggers->GetXaxis()->SetBinLabel(kMCNSD +1,"NSD_{MC}");
308 fHTriggers->GetXaxis()->SetBinLabel(kOffline+1,"Offline");
309 fList->Add(fHTriggers);
311 fHType = new TH1I("type", Form("Event type (cut: SPD mult>%d)",
312 fLowFluxCut), 2, -.5, 1.5);
313 fHType->SetFillColor(kRed+1);
314 fHType->SetFillStyle(3001);
316 fHType->SetDirectory(0);
317 fHType->GetXaxis()->SetBinLabel(1,"Low-flux");
318 fHType->GetXaxis()->SetBinLabel(2,"High-flux");
322 // This histogram disabled as it causes problems in the merge
323 fHWords = new TH1I("words", "Trigger words seen", 1, 0, 0);
324 fHWords->SetFillColor(kBlue+1);
325 fHWords->SetFillStyle(3001);
326 fHWords->SetStats(0);
327 fHWords->SetDirectory(0);
328 fHWords->SetBit(TH1::kCanRebin);
332 fHCent = new TH1F("cent", "Centrality", limits.GetSize()-1,limits.GetArray());
333 fHCent->SetFillColor(kBlue+1);
334 fHCent->SetFillStyle(3001);
336 fHCent->SetDirectory(0);
337 fHCent->SetXTitle("Centrality [%]");
338 fHCent->SetYTitle("Events");
341 fHCentVsQual = new TH2F("centVsQuality", "Quality vs Centrality",
342 5, 0, 5, limits.GetSize()-1, limits.GetArray());
343 fHCentVsQual->SetXTitle("Quality");
344 fHCentVsQual->SetYTitle("Centrality [%]");
345 fHCentVsQual->SetZTitle("Events");
346 fHCentVsQual->GetXaxis()->SetBinLabel(1, "OK");
347 fHCentVsQual->GetXaxis()->SetBinLabel(2, "Outside v_{z} cut");
348 fHCentVsQual->GetXaxis()->SetBinLabel(3, "V0 vs SPD outlier");
349 fHCentVsQual->GetXaxis()->SetBinLabel(4, "V0 vs TPC outlier");
350 fHCentVsQual->GetXaxis()->SetBinLabel(5, "V0 vs ZDC outlier");
351 fList->Add(fHCentVsQual);
354 //____________________________________________________________________
356 AliFMDEventInspector::StoreInformation(Int_t runNo)
358 // Write TNamed objects to output list containing information about
359 // the running conditions
362 TNamed* sys = new TNamed("sys", "");
363 TNamed* sNN = new TNamed("sNN", "");
364 TNamed* fld = new TNamed("field", "");
365 TNamed* run = new TNamed("runNo", Form("%d", runNo));
366 TNamed* low = new TNamed("lowFlux", Form("%d", fLowFluxCut));
367 TNamed* fpv = new TNamed("fpVtx", Form("%s", fUseFirstPhysicsVertex ? "true" : "false"));
368 TNamed* v0a = new TNamed("v0and", Form("%s", fUseV0AND ? "true" : "false"));
369 TNamed* nCp = new TNamed("nPileup", Form("%d", fMinPileupContrib));
370 sys->SetTitle(AliForwardUtil::CollisionSystemString(fCollisionSystem));
371 sNN->SetTitle(AliForwardUtil::CenterOfMassEnergyString(fEnergy));
372 fld->SetTitle(AliForwardUtil::MagneticFieldString(fField));
373 sys->SetUniqueID(fCollisionSystem);
374 sNN->SetUniqueID(fEnergy);
375 fld->SetUniqueID(fField);
376 run->SetUniqueID(runNo);
377 low->SetUniqueID(fLowFluxCut);
378 fpv->SetUniqueID(fUseFirstPhysicsVertex ? 1 : 0);
379 v0a->SetUniqueID(fUseV0AND ? 1 : 0);
380 nCp->SetUniqueID(fMinPileupContrib);
382 TParameter<Double_t>* dP = new TParameter<Double_t>("dPileup", fMinPileupDistance);
396 //____________________________________________________________________
398 AliFMDEventInspector::DefineOutput(TList* dir)
401 // Define the output histograms. These are put in a sub list of the
402 // passed list. The histograms are merged before the parent task calls
403 // AliAnalysisTaskSE::Terminate
405 // dir Directory to add to
408 fList->SetName(GetName());
412 //____________________________________________________________________
414 AliFMDEventInspector::Process(const AliESDEvent* event,
427 // triggers On return, the triggers fired
428 // lowFlux On return, true if the event is considered a low-flux
429 // event (according to the setting of fLowFluxCut)
430 // ivz On return, the found vertex bin (1-based). A zero
431 // means outside of the defined vertex range
432 // vz On return, the z position of the interaction
433 // cent On return, the centrality - if not available < 0
436 // 0 (or kOk) on success, otherwise a bit mask of error codes
439 // --- Check that we have an event ---------------------------------
441 AliWarning("No ESD event found for input event");
445 // --- Read trigger information from the ESD and store in AOD object
446 if (!ReadTriggers(event, triggers, nClusters)) {
448 AliWarning("Failed to read triggers from ESD"); }
452 // --- Check if this is a high-flux event --------------------------
453 const AliMultiplicity* testmult = event->GetMultiplicity();
456 AliWarning("No central multiplicity object found"); }
459 lowFlux = testmult->GetNumberOfTracklets() < fLowFluxCut;
461 fHType->Fill(lowFlux ? 0 : 1);
463 // --- Read centrality information
466 if (!ReadCentrality(event, cent, qual)) {
468 AliWarning("Failed to get centrality");
471 if (qual == 0) fHCentVsQual->Fill(0., cent);
473 for (UShort_t i = 0; i < 4; i++)
474 if (qual & (1 << i)) fHCentVsQual->Fill(Double_t(i+1), cent);
477 // --- Get the vertex information ----------------------------------
483 Bool_t vzOk = ReadVertex(event, vz,vx,vy);
485 fHEventsTr->Fill(vz);
488 AliWarning("Failed to read vertex from ESD"); }
491 fHEventsTrVtx->Fill(vz);
493 // --- Get the vertex bin ------------------------------------------
494 ivz = fVtxAxis.FindBin(vz);
495 if (ivz <= 0 || ivz > fVtxAxis.GetNbins()) {
497 AliWarning(Form("Vertex @ %f outside of range [%f,%f]",
498 vz, fVtxAxis.GetXmin(), fVtxAxis.GetXmax()));
503 fHEventsAccepted->Fill(vz);
504 fHEventsAcceptedXY->Fill(vx,vy);
506 // --- Check the FMD ESD data --------------------------------------
507 if (!event->GetFMDData()) {
509 AliWarning("No FMD data found in ESD"); }
517 //____________________________________________________________________
519 AliFMDEventInspector::ReadCentrality(const AliESDEvent* esd,
521 UShort_t& qual) const
524 // Read centrality from event
528 // cent On return, the centrality or negative if not found
531 // False on error, true otherwise
535 AliCentrality* centObj = const_cast<AliESDEvent*>(esd)->GetCentrality();
536 if (!centObj) return true;
538 // AliInfo(Form("Got centrality object %p with quality %d",
539 // centObj, centObj->GetQuality()));
541 cent = centObj->GetCentralityPercentile("V0M");
542 //cent = centObj->GetCentralityPercentile("ZEMvsZDC");
543 qual = centObj->GetQuality();
548 //____________________________________________________________________
550 AliFMDEventInspector::ReadTriggers(const AliESDEvent* esd, UInt_t& triggers,
554 // Read the trigger information from the ESD event
558 // triggers On return, contains the trigger bits
561 // @c true on success, @c false otherwise
565 // Get the analysis manager - should always be there
566 AliAnalysisManager* am = AliAnalysisManager::GetAnalysisManager();
568 AliWarning("No analysis manager defined!");
572 // Get the input handler - should always be there
573 AliInputEventHandler* ih =
574 static_cast<AliInputEventHandler*>(am->GetInputEventHandler());
576 AliWarning("No input handler");
579 AliPhysicsSelection* ps =
580 static_cast<AliPhysicsSelection*>(ih->GetEventSelection());
582 AliWarning("No physics selection");
585 AliOADBPhysicsSelection* oadb =
586 const_cast<AliOADBPhysicsSelection*>(ps->GetOADBPhysicsSelection());
588 AliWarning("No OADB physics selection object");
592 // Check if this is a collision candidate (MB)
593 // Note, that we should use the value cached in the input
594 // handler rather than calling IsCollisionCandiate directly
595 // on the AliPhysicsSelection obejct. If we called the latter
596 // then the AliPhysicsSelection object would overcount by a
598 Bool_t offline = ih->IsEventSelected() ;
599 Bool_t fastonly = (ih->IsEventSelected() & AliVEvent::kFastOnly);
600 TString trigStr = esd->GetFiredTriggerClasses();
602 //If we have the MC input handler, this must be MC
603 Bool_t isMC = am->GetMCtruthEventHandler() != 0;
605 // For the 2.76 TeV p+p run, the FMD ran in the slow partition
606 // so it received no triggers from the fast partition. Therefore
607 // the fast triggers are removed here but not for MC where all
608 // triggers are fast.
609 if(TMath::Abs(fEnergy - 2750.) < 20 &&
610 fCollisionSystem == AliForwardUtil::kPP &&
612 if (fastonly) offline = false;
615 // MUON triggers are not strictly minimum bias (MB) so they are removed (HHD)
617 if(offline && trigStr.Contains("CMUS1")) offline = false;
620 triggers |= AliAODForwardMult::kOffline;
621 triggers |= AliAODForwardMult::kInel;
622 fHTriggers->Fill(kOffline+0.5);
624 // If this is inel, see if we have a tracklet
625 const AliMultiplicity* spdmult = esd->GetMultiplicity();
627 AliWarning("No SPD multiplicity");
630 // Check if we have one or more tracklets
631 // in the range -1 < eta < 1 to set the INEL>0
634 // Also count tracklets as a single cluster
635 Int_t n = spdmult->GetNumberOfTracklets();
636 for (Int_t j = 0; j < n; j++) {
637 if(TMath::Abs(spdmult->GetEta(j)) < 1) {
638 triggers |= AliAODForwardMult::kInelGt0;
642 n = spdmult->GetNumberOfSingleClusters();
643 for (Int_t j = 0; j < n; j++) {
644 Double_t eta = -TMath::Log(TMath::Tan(spdmult->GetThetaSingle(j)/2.));
645 if (TMath::Abs(eta) < 1) nClusters++;
648 if (nClusters > 0) triggers |= AliAODForwardMult::kNClusterGt0;
651 // Analyse some trigger stuff
652 AliTriggerAnalysis ta;
653 if (ta.IsOfflineTriggerFired(esd, AliTriggerAnalysis::kV0AND)) {
654 triggers |= AliAODForwardMult::kV0AND;
656 triggers |= AliAODForwardMult::kNSD;
658 if (ta.IsOfflineTriggerFired(esd, AliTriggerAnalysis::kNSD1))
659 triggers |= AliAODForwardMult::kNSD;
661 // Check for multiple vertices (pile-up) with at least 3
662 // contributors and at least 0.8cm from the primary vertex
663 Bool_t pileup = kFALSE;
664 if(fCollisionSystem == AliForwardUtil::kPP)
665 pileup = esd->IsPileupFromSPD(fMinPileupContrib,fMinPileupDistance);
667 triggers |= AliAODForwardMult::kPileUp;
668 fHTriggers->Fill(kPileUp+.5);
673 //TString trigStr = esd->GetFiredTriggerClasses();
674 // AliWarning(Form("Fired trigger classes: %s", trigStr.Data()));
675 if (fHWords) fHWords->Fill(trigStr.Data(), 1);
677 if (trigStr.Contains("MB1") || trigStr.Contains("MBBG3"))
678 triggers |= AliAOODForwardMult::kB;
679 if (trigStr.Contains("COTA"))
680 triggers |= AliAODForwardMult::kA;
681 if (trigStr.Contains("COTC"))
682 triggers |= AliAODForwardMult::kC;
684 if (trigStr.Contains("CBEAMB-ABCE-NOPF-ALL")) {
685 triggers |= AliAODForwardMult::kEmpty;
686 fHTriggers->Fill(kEmpty+.5);
689 // Check for B triggers
690 if (trigStr.Contains("CINT1B-ABCE-NOPF-ALL") || // Early pp
691 trigStr.Contains("CINT1-B-NOPF-ALLNOTRD") || // Late pp
692 trigStr.Contains("CINT1-B-NOPF-FASTNOTRD") || // Late pp
693 //trigStr.Contains("CMUS1-B-NOPF-MUON") || // Late pp -- HHD 160811
694 trigStr.Contains("CSMBB-ABCE-NOPF-ALL") || // pp
695 trigStr.Contains("CMBACS2-B-NOPF-ALL") || // PbPb
696 // trigStr.Contains("C0SMH-B-NOPF-ALL") || // PbPb - high mult
697 trigStr.Contains("CMBS2A-B-NOPF-ALL") || // PbPb
698 trigStr.Contains("CMBS2C-B-NOPF-ALL") || // PbPb
699 trigStr.Contains("CMBAC-B-NOPF-ALL") || // PbPb
700 // trigStr.Contains("C0SMH-B-NOPF-ALL") || // PbPb - high mult
701 trigStr.Contains("CMBACS2-B-NOPF-ALLNOTRD") // PbPb
702 // trigStr.Contains("C0SMH-B-NOPF-ALLNOTRD") // PbPb - high mult
704 Bool_t bTrigger = kTRUE;
705 if ( trigStr.Contains("CINT1-B-NOPF-FASTNOTRD") &&
706 !trigStr.Contains("CINT1-B-NOPF-ALLNOTRD") &&
707 TMath::Abs(fEnergy - 2750.) < 20 &&
708 fCollisionSystem == AliForwardUtil::kPP)
711 triggers |= AliAODForwardMult::kB;
712 fHTriggers->Fill(kB+.5);
716 // Check for A triggers
717 if (trigStr.Contains("CINT1A-ABCE-NOPF-ALL") || // Early pp
718 trigStr.Contains("CINT1-AC-NOPF-ALLNOTRD") || // Late pp
719 trigStr.Contains("CINT1-AC-NOPF-FASTNOTRD") || // Late pp
720 (trigStr.Contains("CSMBA-ABCE-NOPF-ALL") &&
721 !(triggers & AliAODForwardMult::kB)) || // pp
722 trigStr.Contains("CMBACS2-A-NOPF-ALL") || // PbPb
723 // trigStr.Contains("C0SMH-A-NOPF-ALL") || // PbPb - high mult
724 trigStr.Contains("CMBS2A-A-NOPF-ALL") || // PbPb
725 trigStr.Contains("CMBS2C-A-NOPF-ALL") || // PbPb
726 trigStr.Contains("CMBAC-A-NOPF-ALL") || // PbPb
727 // trigStr.Contains("C0SMH-A-NOPF-ALL") || // PbPb - high mult
728 trigStr.Contains("CMBACS2-A-NOPF-ALLNOTRD") // PbPb
729 // trigStr.Contains("C0SMH-A-NOPF-ALLNOTRD") // PbPb - high mult
731 triggers |= AliAODForwardMult::kA;
732 fHTriggers->Fill(kA+.5);
735 // Check for C triggers
736 if (trigStr.Contains("CINT1C-ABCE-NOPF-ALL") || // Early pp
737 (trigStr.Contains("CSMBC-ABCE-NOPF-ALL") &&
738 !(triggers & AliAODForwardMult::kB)) || // pp
739 trigStr.Contains("CMBACS2-C-NOPF-ALL") || // PbPb
740 // trigStr.Contains("C0SMH-B-NOPF-ALL") || // PbPb - high mult
741 trigStr.Contains("CMBS2A-C-NOPF-ALL") || // PbPb
742 trigStr.Contains("CMBS2C-C-NOPF-ALL") || // PbPb
743 trigStr.Contains("CMBAC-C-NOPF-ALL") || // PbPb
744 // trigStr.Contains("C0SMH-B-NOPF-ALL") || // PbPb - high mult
745 trigStr.Contains("CMBACS2-C-NOPF-ALLNOTRD") // PbPb
746 // trigStr.Contains("C0SMH-B-NOPF-ALLNOTRD") // PbPb - high mult
748 triggers |= AliAODForwardMult::kC;
749 fHTriggers->Fill(kC+.5);
752 // Check for E triggers
753 if (trigStr.Contains("CINT1-E-NOPF-ALL") || // Early pp
754 trigStr.Contains("CINT1-E-NOPF-ALLNOTRD") || // Late pp
755 trigStr.Contains("CINT1-E-NOPF-FASTNOTRD") || // Late pp
756 trigStr.Contains("CMBACS2-E-NOPF-ALL") || // PbPb
757 // trigStr.Contains("C0SMH-B-NOPF-ALL") || // PbPb - high mult
758 trigStr.Contains("CMBS2A-E-NOPF-ALL") || // PbPb
759 trigStr.Contains("CMBS2C-E-NOPF-ALL") || // PbPb
760 trigStr.Contains("CMBAC-E-NOPF-ALL") || // PbPb
761 // trigStr.Contains("C0SMH-B-NOPF-ALL") || // PbPb - high mult
762 trigStr.Contains("CMBACS2-E-NOPF-ALLNOTRD") // PbPb
763 // trigStr.Contains("C0SMH-B-NOPF-ALLNOTRD") // PbPb - high mult
765 triggers |= AliAODForwardMult::kE;
766 fHTriggers->Fill(kE+.5);
770 const TList* collTriggClasses = ps->GetCollisionTriggerClasses();
771 const TList* bgTriggClasses = ps->GetBGTriggerClasses();
773 TIter nextColl(collTriggClasses);
774 TObjString* oadbString = 0;
775 TObjArray* tokens = 0;
776 while ((oadbString = static_cast<TObjString*>(nextColl()))) {
777 tokens = oadbString->String().Tokenize(" ");
778 for (Int_t i = 0; i < tokens->GetEntries(); i++) {
779 TString string = (((TObjString*)tokens->At(i))->String());
780 if (string[0] != '+') continue;
782 if (trigStr.Contains(string.Data())) {
783 TString beamSide = oadb->GetBeamSide(oadbString->String().Data());
784 if (beamSide.EqualTo("B")) {
785 triggers |= AliAODForwardMult::kB;
786 fHTriggers->Fill(kB+.5);
791 TIter nextBG(bgTriggClasses);
792 while ((oadbString = static_cast<TObjString*>(nextBG()))) {
793 tokens = oadbString->String().Tokenize(" ");
794 for (Int_t i = 0; i < tokens->GetEntries(); i++) {
795 TString string = (((TObjString*)tokens->At(i))->String());
796 if (string[0] != '+') continue;
798 if (trigStr.Contains(string.Data())) {
799 TString beamSide = oadb->GetBeamSide(oadbString->String().Data());
800 if (beamSide.Contains("A")) {
801 triggers |= AliAODForwardMult::kA;
802 fHTriggers->Fill(kA+.5);
804 if (beamSide.Contains("C")) {
805 triggers |= AliAODForwardMult::kC;
806 fHTriggers->Fill(kC+.5);
808 if (beamSide.Contains("E")) {
809 triggers |= AliAODForwardMult::kE;
810 fHTriggers->Fill(kE+.5);
816 // Now check - if we have a collision - for offline triggers and
818 if (triggers & AliAODForwardMult::kB) {
819 if (triggers & AliAODForwardMult::kInel)
820 fHTriggers->Fill(kInel);
822 if (triggers & AliAODForwardMult::kInelGt0)
823 fHTriggers->Fill(kInelGt0+.5);
825 if (triggers & AliAODForwardMult::kNSD)
826 fHTriggers->Fill(kNSD+.5);
828 if (triggers & AliAODForwardMult::kV0AND)
829 fHTriggers->Fill(kV0AND+.5);
834 //____________________________________________________________________
836 AliFMDEventInspector::ReadVertex(const AliESDEvent* esd,
842 // Read the vertex information from the ESD event
846 // vz On return, the vertex Z position
849 // @c true on success, @c false otherwise
854 if(fUseFirstPhysicsVertex) {
855 // This is the code used by the 1st physics people
856 const AliESDVertex* vertex = esd->GetPrimaryVertex();
857 if (!vertex || !vertex->GetStatus()) {
859 AliWarning(Form("No primary vertex (%p) or bad status %d",
860 vertex, (vertex ? vertex->GetStatus() : -1)));
864 const AliESDVertex* vertexSPD = esd->GetPrimaryVertexSPD();
865 if (!vertexSPD || !vertexSPD->GetStatus()) {
867 AliWarning(Form("No primary SPD vertex (%p) or bad status %d",
868 vertexSPD, (vertexSPD ? vertexSPD->GetStatus() : -1)));
873 // if vertex is from SPD vertexZ, require more stringent cuts
874 if (vertex->IsFromVertexerZ()) {
875 if (vertex->GetDispersion() > fMaxVzErr ||
876 vertex->GetZRes() > 1.25 * fMaxVzErr) {
878 AliWarning(Form("Dispersion %f > %f or resolution %f > %f",
879 vertex->GetDispersion(), fMaxVzErr,
880 vertex->GetZRes(), 1.25 * fMaxVzErr));
887 if(!vertex->IsFromVertexerZ()) {
893 else { //Use standard SPD vertex (perhaps preferable for Pb+Pb)
896 const AliESDVertex* vertex = esd->GetPrimaryVertexSPD();
899 AliWarning("No SPD vertex found in ESD"); }
903 // Check that enough tracklets contributed
904 if(vertex->GetNContributors() <= 0) {
906 AliWarning(Form("Number of contributors to vertex is %d<=0",
907 vertex->GetNContributors())); }
911 // Check that the uncertainty isn't too large
912 if (vertex->GetZRes() > fMaxVzErr) {
914 AliWarning(Form("Uncertaintity in Z of vertex is too large %f > %f",
915 vertex->GetZRes(), fMaxVzErr)); }
919 // Get the z coordiante
921 const AliESDVertex* vertexXY = esd->GetPrimaryVertex();
923 if(!vertexXY->IsFromVertexerZ()) {
924 vx = vertexXY->GetX();
925 vy = vertexXY->GetY();
931 //____________________________________________________________________
933 AliFMDEventInspector::ReadRunDetails(const AliESDEvent* esd)
936 // Read the collision system, collision energy, and L3 field setting
940 // esd ESD to get information from
943 // true on success, false
945 // AliInfo(Form("Parameters from 1st ESD event: cms=%s, sNN=%f, field=%f",
946 // esd->GetBeamType(), 2*esd->GetBeamEnergy(),
947 // esd->GetMagneticField()));
949 AliForwardUtil::ParseCollisionSystem(esd->GetBeamType());
951 AliForwardUtil::ParseCenterOfMassEnergy(fCollisionSystem,
952 2 * esd->GetBeamEnergy());
954 AliForwardUtil::ParseMagneticField(esd->GetMagneticField());
956 StoreInformation(esd->GetRunNumber());
957 if (fCollisionSystem == AliForwardUtil::kUnknown ||
959 TMath::Abs(fField) > 10)
965 //____________________________________________________________________
967 AliFMDEventInspector::Print(Option_t*) const
974 char ind[gROOT->GetDirLevel()+1];
975 for (Int_t i = 0; i < gROOT->GetDirLevel(); i++) ind[i] = ' ';
976 ind[gROOT->GetDirLevel()] = '\0';
977 TString sNN(AliForwardUtil::CenterOfMassEnergyString(fEnergy));
978 sNN.Strip(TString::kBoth, '0');
979 sNN.ReplaceAll("GeV", " GeV");
980 TString field(AliForwardUtil::MagneticFieldString(fField));
981 field.ReplaceAll("p", "+");
982 field.ReplaceAll("m", "-");
983 field.ReplaceAll("kG", " kG");
985 std::cout << ind << ClassName() << ": " << GetName() << '\n'
986 << ind << " Vertex bins: " << fVtxAxis.GetNbins() << '\n'
987 << ind << " Vertex range: [" << fVtxAxis.GetXmin()
988 << "," << fVtxAxis.GetXmax() << "]\n"
989 << ind << " Low flux cut: " << fLowFluxCut << '\n'
990 << ind << " Max(delta v_z): " << fMaxVzErr << " cm\n"
991 << ind << " Min(nContrib_pileup): " << fMinPileupContrib << '\n'
992 << ind << " Min(v-pileup): " << fMinPileupDistance << '\n'
993 << ind << " System: "
994 << AliForwardUtil::CollisionSystemString(fCollisionSystem) << '\n'
995 << ind << " CMS energy per nucleon: " << sNN << '\n'
996 << ind << " Field: " << field << '\n';
997 if (!fCentAxis) { std::cout << std::flush; return; }
998 Int_t nBin = fCentAxis->GetNbins();
999 std::cout << ind << " Centrality axis: " << nBin << " bins"
1001 for (Int_t i = 0; i < nBin; i++) {
1002 if ((i % 10) == 0) std::cout << '\n' << ind << " ";
1003 std::cout << std::setw(5) << fCentAxis->GetBinLowEdge(i+1) << '-';
1005 std::cout << std::setw(5) << fCentAxis->GetBinUpEdge(nBin) << std::endl;