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>
37 #include "AliMCEvent.h"
38 #include "AliHeader.h"
39 #include "AliGenEventHeader.h"
40 #include "AliCollisionGeometry.h"
42 //====================================================================
43 AliFMDEventInspector::AliFMDEventInspector()
48 fHEventsAcceptedXY(0),
59 fCollisionSystem(kUnknown),
63 fUseFirstPhysicsVertex(true),
66 fMinPileupDistance(0.8),
67 fUseDisplacedVertices(false),
75 //____________________________________________________________________
76 AliFMDEventInspector::AliFMDEventInspector(const char* name)
77 : TNamed("fmdEventInspector", name),
81 fHEventsAcceptedXY(0),
92 fCollisionSystem(kUnknown),
96 fUseFirstPhysicsVertex(true),
99 fMinPileupDistance(0.8),
100 fUseDisplacedVertices(false),
107 // name Name of object
111 //____________________________________________________________________
112 AliFMDEventInspector::AliFMDEventInspector(const AliFMDEventInspector& o)
114 fHEventsTr(o.fHEventsTr),
115 fHEventsTrVtx(o.fHEventsTrVtx),
116 fHEventsAccepted(o.fHEventsAccepted),
117 fHEventsAcceptedXY(o.fHEventsAcceptedXY),
118 fHTriggers(o.fHTriggers),
122 fHCentVsQual(o.fHCentVsQual),
123 fLowFluxCut(o.fLowFluxCut),
124 fMaxVzErr(o.fMaxVzErr),
128 fCollisionSystem(o.fCollisionSystem),
131 fVtxAxis(o.fVtxAxis),
132 fUseFirstPhysicsVertex(o.fUseFirstPhysicsVertex),
133 fUseV0AND(o.fUseV0AND),
134 fMinPileupContrib(o.fMinPileupContrib),
135 fMinPileupDistance(o.fMinPileupDistance),
136 fUseDisplacedVertices(o.fUseDisplacedVertices),
137 fDisplacedVertex(o.fDisplacedVertex)
143 // o Object to copy from
147 //____________________________________________________________________
148 AliFMDEventInspector::~AliFMDEventInspector()
153 if (fList) delete fList;
155 //____________________________________________________________________
156 AliFMDEventInspector&
157 AliFMDEventInspector::operator=(const AliFMDEventInspector& o)
160 // Assignement operator
163 // o Object to assign from
166 // Reference to this object
168 if (&o == this) return *this;
169 TNamed::operator=(o);
170 fHEventsTr = o.fHEventsTr;
171 fHEventsTrVtx = o.fHEventsTrVtx;
172 fHEventsAccepted = o.fHEventsAccepted;
173 fHEventsAcceptedXY = o.fHEventsAcceptedXY;
174 fHTriggers = o.fHTriggers;
178 fHCentVsQual = o.fHCentVsQual;
179 fLowFluxCut = o.fLowFluxCut;
180 fMaxVzErr = o.fMaxVzErr;
182 fList = (o.fList ? new TList : 0);
185 fCollisionSystem = o.fCollisionSystem;
186 fVtxAxis.Set(o.fVtxAxis.GetNbins(), o.fVtxAxis.GetXmin(),
187 o.fVtxAxis.GetXmax());
189 fUseFirstPhysicsVertex = o.fUseFirstPhysicsVertex;
190 fUseV0AND = o.fUseV0AND;
191 fMinPileupContrib = o.fMinPileupContrib;
192 fMinPileupDistance = o.fMinPileupDistance;
193 fUseDisplacedVertices = o.fUseDisplacedVertices;
194 fDisplacedVertex = o.fDisplacedVertex;
196 fList->SetName(GetName());
197 if (fHEventsTr) fList->Add(fHEventsTr);
198 if (fHEventsTrVtx) fList->Add(fHEventsTrVtx);
199 if (fHTriggers) fList->Add(fHTriggers);
200 if (fHType) fList->Add(fHType);
201 if (fHWords) fList->Add(fHWords);
202 if (fHCent) fList->Add(fHCent);
203 if (fHCentVsQual) fList->Add(fHCentVsQual);
208 //____________________________________________________________________
210 AliFMDEventInspector::FetchHistograms(const TList* d,
213 TH1I*& hTriggers) const
216 // Fetch our histograms from the passed list
220 // hEventsTr On return, pointer to histogram, or null
221 // hEventsTrVtx On return, pointer to histogram, or null
222 // hTriggers On return, pointer to histogram, or null
225 // true on success, false otherwise
230 TList* dd = dynamic_cast<TList*>(d->FindObject(GetName()));
231 if (!dd) return kFALSE;
233 hEventsTr = dynamic_cast<TH1I*>(dd->FindObject("nEventsTr"));
234 hEventsTrVtx = dynamic_cast<TH1I*>(dd->FindObject("nEventsTrVtx"));
235 hTriggers = dynamic_cast<TH1I*>(dd->FindObject("triggers"));
237 if (!hEventsTr || !hEventsTrVtx || !hTriggers) return kFALSE;
240 //____________________________________________________________________
242 AliFMDEventInspector::Init(const TAxis& vtxAxis)
245 // Initialize the object
248 // vtxAxis Vertex axis in use
251 // -1.5 -0.5 0.5 1.5 ... 89.5 ... 100.5
252 // ----- 92 number --------- ---- 1 ---
254 for (Int_t i = 0; i < 92; i++) limits[i] = -1.5 + i;
257 fVtxAxis.Set(vtxAxis.GetNbins(), vtxAxis.GetXmin(), vtxAxis.GetXmax());
259 fCentAxis = new TAxis(limits.GetSize()-1, limits.GetArray());
260 fHEventsTr = new TH1I("nEventsTr", "Number of events w/trigger",
261 4*vtxAxis.GetNbins(),
263 2*vtxAxis.GetXmax());
264 fHEventsTr->SetXTitle("v_{z} [cm]");
265 fHEventsTr->SetYTitle("# of events");
266 fHEventsTr->SetFillColor(kRed+1);
267 fHEventsTr->SetFillStyle(3001);
268 fHEventsTr->SetDirectory(0);
269 // fHEventsTr->Sumw2();
270 fList->Add(fHEventsTr);
272 fHEventsTrVtx = static_cast<TH1I*>(fHEventsTr->Clone("nEventsTrVtx"));
273 fHEventsTrVtx->SetTitle("Number of events w/trigger and vertex");
274 fHEventsTrVtx->SetFillColor(kBlue+1);
275 fHEventsTrVtx->SetDirectory(0);
276 // fHEventsTrVtx->Sumw2();
277 fList->Add(fHEventsTrVtx);
279 fHEventsAccepted = new TH1I("nEventsAccepted",
280 "Number of events w/trigger and vertex in range",
281 2*vtxAxis.GetNbins(),
283 2*vtxAxis.GetXmax());
284 fHEventsAccepted->SetXTitle("v_{z} [cm]");
285 fHEventsAccepted->SetYTitle("# of events");
286 fHEventsAccepted->SetFillColor(kGreen+1);
287 fHEventsAccepted->SetFillStyle(3001);
288 fHEventsAccepted->SetDirectory(0);
289 // fHEventsAccepted->Sumw2();
290 fList->Add(fHEventsAccepted);
292 fHEventsAcceptedXY = new TH2D("nEventsAcceptedXY",
293 "XY vertex w/trigger and Z vertex in range",
294 1000,-1,1,1000,-1,1);
296 fHEventsAcceptedXY->SetXTitle("v_{x} [cm]");
297 fHEventsAcceptedXY->SetYTitle("v_{y} [cm]");
298 fHEventsAcceptedXY->SetDirectory(0);
299 // fHEventsAccepted->Sumw2();
300 fList->Add(fHEventsAcceptedXY);
303 fHTriggers = new TH1I("triggers", "Triggers", kOffline+1, 0, kOffline+1);
304 fHTriggers->SetFillColor(kRed+1);
305 fHTriggers->SetFillStyle(3001);
306 fHTriggers->SetStats(0);
307 fHTriggers->SetDirectory(0);
308 fHTriggers->GetXaxis()->SetBinLabel(kInel +1,"INEL");
309 fHTriggers->GetXaxis()->SetBinLabel(kInelGt0+1,"INEL>0");
310 fHTriggers->GetXaxis()->SetBinLabel(kNSD +1,"NSD");
311 fHTriggers->GetXaxis()->SetBinLabel(kV0AND +1,"VOAND");
312 fHTriggers->GetXaxis()->SetBinLabel(kEmpty +1,"Empty");
313 fHTriggers->GetXaxis()->SetBinLabel(kA +1,"A");
314 fHTriggers->GetXaxis()->SetBinLabel(kB +1,"B");
315 fHTriggers->GetXaxis()->SetBinLabel(kC +1,"C");
316 fHTriggers->GetXaxis()->SetBinLabel(kE +1,"E");
317 fHTriggers->GetXaxis()->SetBinLabel(kPileUp +1,"Pileup");
318 fHTriggers->GetXaxis()->SetBinLabel(kMCNSD +1,"NSD_{MC}");
319 fHTriggers->GetXaxis()->SetBinLabel(kOffline+1,"Offline");
320 fList->Add(fHTriggers);
322 fHType = new TH1I("type", Form("Event type (cut: SPD mult>%d)",
323 fLowFluxCut), 2, -.5, 1.5);
324 fHType->SetFillColor(kRed+1);
325 fHType->SetFillStyle(3001);
327 fHType->SetDirectory(0);
328 fHType->GetXaxis()->SetBinLabel(1,"Low-flux");
329 fHType->GetXaxis()->SetBinLabel(2,"High-flux");
333 // This histogram disabled as it causes problems in the merge
334 fHWords = new TH1I("words", "Trigger words seen", 1, 0, 0);
335 fHWords->SetFillColor(kBlue+1);
336 fHWords->SetFillStyle(3001);
337 fHWords->SetStats(0);
338 fHWords->SetDirectory(0);
339 fHWords->SetBit(TH1::kCanRebin);
343 fHCent = new TH1F("cent", "Centrality", limits.GetSize()-1,limits.GetArray());
344 fHCent->SetFillColor(kBlue+1);
345 fHCent->SetFillStyle(3001);
347 fHCent->SetDirectory(0);
348 fHCent->SetXTitle("Centrality [%]");
349 fHCent->SetYTitle("Events");
352 fHCentVsQual = new TH2F("centVsQuality", "Quality vs Centrality",
353 5, 0, 5, limits.GetSize()-1, limits.GetArray());
354 fHCentVsQual->SetXTitle("Quality");
355 fHCentVsQual->SetYTitle("Centrality [%]");
356 fHCentVsQual->SetZTitle("Events");
357 fHCentVsQual->GetXaxis()->SetBinLabel(1, "OK");
358 fHCentVsQual->GetXaxis()->SetBinLabel(2, "Outside v_{z} cut");
359 fHCentVsQual->GetXaxis()->SetBinLabel(3, "V0 vs SPD outlier");
360 fHCentVsQual->GetXaxis()->SetBinLabel(4, "V0 vs TPC outlier");
361 fHCentVsQual->GetXaxis()->SetBinLabel(5, "V0 vs ZDC outlier");
362 fList->Add(fHCentVsQual);
365 //____________________________________________________________________
367 AliFMDEventInspector::StoreInformation(Int_t runNo)
369 // Write TNamed objects to output list containing information about
370 // the running conditions
373 TNamed* sys = new TNamed("sys", "");
374 TNamed* sNN = new TNamed("sNN", "");
375 TNamed* fld = new TNamed("field", "");
376 TNamed* run = new TNamed("runNo", Form("%d", runNo));
377 TNamed* low = new TNamed("lowFlux", Form("%d", fLowFluxCut));
378 TNamed* fpv = new TNamed("fpVtx", Form("%s", fUseFirstPhysicsVertex ? "true" : "false"));
379 TNamed* v0a = new TNamed("v0and", Form("%s", fUseV0AND ? "true" : "false"));
380 TNamed* nCp = new TNamed("nPileup", Form("%d", fMinPileupContrib));
381 sys->SetTitle(AliForwardUtil::CollisionSystemString(fCollisionSystem));
382 sNN->SetTitle(AliForwardUtil::CenterOfMassEnergyString(fEnergy));
383 fld->SetTitle(AliForwardUtil::MagneticFieldString(fField));
384 sys->SetUniqueID(fCollisionSystem);
385 sNN->SetUniqueID(fEnergy);
386 fld->SetUniqueID(fField);
387 run->SetUniqueID(runNo);
388 low->SetUniqueID(fLowFluxCut);
389 fpv->SetUniqueID(fUseFirstPhysicsVertex ? 1 : 0);
390 v0a->SetUniqueID(fUseV0AND ? 1 : 0);
391 nCp->SetUniqueID(fMinPileupContrib);
393 TParameter<Double_t>* dP = new TParameter<Double_t>("dPileup", fMinPileupDistance);
407 //____________________________________________________________________
409 AliFMDEventInspector::DefineOutput(TList* dir)
412 // Define the output histograms. These are put in a sub list of the
413 // passed list. The histograms are merged before the parent task calls
414 // AliAnalysisTaskSE::Terminate
416 // dir Directory to add to
419 fList->SetName(GetName());
423 //____________________________________________________________________
425 AliFMDEventInspector::Process(const AliESDEvent* event,
438 // triggers On return, the triggers fired
439 // lowFlux On return, true if the event is considered a low-flux
440 // event (according to the setting of fLowFluxCut)
441 // ivz On return, the found vertex bin (1-based). A zero
442 // means outside of the defined vertex range
443 // vz On return, the z position of the interaction
444 // cent On return, the centrality - if not available < 0
447 // 0 (or kOk) on success, otherwise a bit mask of error codes
450 // --- Check that we have an event ---------------------------------
452 AliWarning("No ESD event found for input event");
456 // --- Read trigger information from the ESD and store in AOD object
457 if (!ReadTriggers(event, triggers, nClusters)) {
459 AliWarning("Failed to read triggers from ESD"); }
463 // --- Check if this is a high-flux event --------------------------
464 const AliMultiplicity* testmult = event->GetMultiplicity();
467 AliWarning("No central multiplicity object found"); }
470 lowFlux = testmult->GetNumberOfTracklets() < fLowFluxCut;
472 fHType->Fill(lowFlux ? 0 : 1);
474 // --- Read centrality information
477 if (!ReadCentrality(event, cent, qual)) {
479 AliWarning("Failed to get centrality");
482 if (qual == 0) fHCentVsQual->Fill(0., cent);
484 for (UShort_t i = 0; i < 4; i++)
485 if (qual & (1 << i)) fHCentVsQual->Fill(Double_t(i+1), cent);
488 // --- Get the vertex information ----------------------------------
494 Bool_t vzOk = ReadVertex(event, vz,vx,vy);
496 fHEventsTr->Fill(vz);
499 AliWarning("Failed to read vertex from ESD"); }
502 fHEventsTrVtx->Fill(vz);
504 // --- Get the vertex bin ------------------------------------------
505 ivz = fVtxAxis.FindBin(vz);
506 if (ivz <= 0 || ivz > fVtxAxis.GetNbins()) {
508 AliWarning(Form("Vertex @ %f outside of range [%f,%f]",
509 vz, fVtxAxis.GetXmin(), fVtxAxis.GetXmax()));
514 fHEventsAccepted->Fill(vz);
515 fHEventsAcceptedXY->Fill(vx,vy);
517 // --- Check the FMD ESD data --------------------------------------
518 if (!event->GetFMDData()) {
520 AliWarning("No FMD data found in ESD"); }
528 //____________________________________________________________________
530 AliFMDEventInspector::ReadCentrality(const AliESDEvent* esd,
532 UShort_t& qual) const
535 // Read centrality from event
539 // cent On return, the centrality or negative if not found
542 // False on error, true otherwise
546 AliCentrality* centObj = const_cast<AliESDEvent*>(esd)->GetCentrality();
547 if (!centObj) return true;
548 AliAnalysisManager* am = AliAnalysisManager::GetAnalysisManager();
549 Bool_t isMC = am->GetMCtruthEventHandler() != 0;
551 //std::cout<<fUseDisplacedVertices<<" "<<isMC<<std::endl;
552 if(fUseDisplacedVertices && !isMC) {
553 Double_t zvtx = fDisplacedVertex.CheckDisplacedVertex(esd);
555 if(TMath::Abs(zvtx) < 999) {
556 cent = fDisplacedVertex.CalculateDisplacedVertexCent(esd); //centObj->GetCentralityPercentileUnchecked("ZEMvsZDC");
560 else if(fUseDisplacedVertices && isMC) {
563 AliMCEventHandler* mchandler = static_cast<AliMCEventHandler*>(am->GetMCtruthEventHandler());
564 AliMCEvent* mcevent = mchandler->MCEvent();
566 AliHeader* header = mcevent->Header();
567 AliGenEventHeader* genHeader = header->GenEventHeader();
568 AliCollisionGeometry* colGeometry =
569 dynamic_cast<AliCollisionGeometry*>(genHeader);
572 b = colGeometry->ImpactParameter();
573 std::cout<<"Hallo!! "<<b<<std::endl;
575 if(b<3.5 && b >0) cent = 2.5; //0-5%
576 if(b>3.5 && b<4.95) cent = 7.5; //5-10%
577 if(b>4.95 && b<6.98) cent = 15; //10-20%
578 if(b>6.98 && b<8.55) cent = 25; //20-30%
579 if(b>8.55 && b<9.88) cent = 35; //30-40%
580 if(b>9.88 && b<11.04) cent = 45; //40-50%
581 if(b>11.04) cent = 55; //50-60%
586 cent = centObj->GetCentralityPercentile("V0M");
587 qual = centObj->GetQuality();
590 // AliInfo(Form("Got centrality object %p with quality %d",
591 // centObj, centObj->GetQuality()));
593 //cent = centObj->GetCentralityPercentile("V0M");
594 //cent = centObj->GetCentralityPercentile("ZEMvsZDC");
595 //qual = centObj->GetQuality();
600 //____________________________________________________________________
602 AliFMDEventInspector::ReadTriggers(const AliESDEvent* esd, UInt_t& triggers,
606 // Read the trigger information from the ESD event
610 // triggers On return, contains the trigger bits
613 // @c true on success, @c false otherwise
617 // Get the analysis manager - should always be there
618 AliAnalysisManager* am = AliAnalysisManager::GetAnalysisManager();
620 AliWarning("No analysis manager defined!");
624 // Get the input handler - should always be there
625 AliInputEventHandler* ih =
626 static_cast<AliInputEventHandler*>(am->GetInputEventHandler());
628 AliWarning("No input handler");
631 AliPhysicsSelection* ps =
632 static_cast<AliPhysicsSelection*>(ih->GetEventSelection());
634 AliWarning("No physics selection");
637 AliOADBPhysicsSelection* oadb =
638 const_cast<AliOADBPhysicsSelection*>(ps->GetOADBPhysicsSelection());
640 AliWarning("No OADB physics selection object");
644 // Check if this is a collision candidate (MB)
645 // Note, that we should use the value cached in the input
646 // handler rather than calling IsCollisionCandiate directly
647 // on the AliPhysicsSelection obejct. If we called the latter
648 // then the AliPhysicsSelection object would overcount by a
650 Bool_t offline = ih->IsEventSelected() ;
651 Bool_t fastonly = (ih->IsEventSelected() & AliVEvent::kFastOnly);
652 TString trigStr = esd->GetFiredTriggerClasses();
654 //If we have the MC input handler, this must be MC
655 Bool_t isMC = am->GetMCtruthEventHandler() != 0;
657 if(fUseDisplacedVertices && isMC) {
658 AliMCEventHandler* mchandler = static_cast<AliMCEventHandler*>(am->GetMCtruthEventHandler());
659 AliMCEvent* mcevent = mchandler->MCEvent();
660 AliHeader* header = mcevent->Header();
661 AliGenEventHeader* genHeader = header->GenEventHeader();
663 genHeader->PrimaryVertex(vertex);
665 Double_t zvtx = vertex.At(2);
666 if(TMath::Abs(zvtx) > 35)
668 else offline = false;
671 if(fUseDisplacedVertices && !isMC) {
672 Double_t zvtx = fDisplacedVertex.CheckDisplacedVertex(esd);
673 if(TMath::Abs(zvtx) < 999) offline = true;
674 else offline = false;
677 // For the 2.76 TeV p+p run, the FMD ran in the slow partition
678 // so it received no triggers from the fast partition. Therefore
679 // the fast triggers are removed here but not for MC where all
680 // triggers are fast.
681 if(TMath::Abs(fEnergy - 2750.) < 20 &&
682 fCollisionSystem == AliForwardUtil::kPP &&
684 if (fastonly) offline = false;
687 // MUON triggers are not strictly minimum bias (MB) so they are removed (HHD)
689 if(offline && trigStr.Contains("CMUS1")) offline = false;
692 triggers |= AliAODForwardMult::kOffline;
693 triggers |= AliAODForwardMult::kInel;
694 fHTriggers->Fill(kOffline+0.5);
696 // If this is inel, see if we have a tracklet
697 const AliMultiplicity* spdmult = esd->GetMultiplicity();
699 AliWarning("No SPD multiplicity");
702 // Check if we have one or more tracklets
703 // in the range -1 < eta < 1 to set the INEL>0
706 // Also count tracklets as a single cluster
707 Int_t n = spdmult->GetNumberOfTracklets();
708 for (Int_t j = 0; j < n; j++) {
709 if(TMath::Abs(spdmult->GetEta(j)) < 1) {
710 triggers |= AliAODForwardMult::kInelGt0;
714 n = spdmult->GetNumberOfSingleClusters();
715 for (Int_t j = 0; j < n; j++) {
716 Double_t eta = -TMath::Log(TMath::Tan(spdmult->GetThetaSingle(j)/2.));
717 if (TMath::Abs(eta) < 1) nClusters++;
720 if (nClusters > 0) triggers |= AliAODForwardMult::kNClusterGt0;
723 // Analyse some trigger stuff
724 AliTriggerAnalysis ta;
725 if (ta.IsOfflineTriggerFired(esd, AliTriggerAnalysis::kV0AND)) {
726 triggers |= AliAODForwardMult::kV0AND;
728 triggers |= AliAODForwardMult::kNSD;
730 if (ta.IsOfflineTriggerFired(esd, AliTriggerAnalysis::kNSD1))
731 triggers |= AliAODForwardMult::kNSD;
733 // Check for multiple vertices (pile-up) with at least 3
734 // contributors and at least 0.8cm from the primary vertex
735 Bool_t pileup = kFALSE;
736 if(fCollisionSystem == AliForwardUtil::kPP)
737 pileup = esd->IsPileupFromSPD(fMinPileupContrib,fMinPileupDistance);
739 triggers |= AliAODForwardMult::kPileUp;
740 fHTriggers->Fill(kPileUp+.5);
745 //TString trigStr = esd->GetFiredTriggerClasses();
746 // AliWarning(Form("Fired trigger classes: %s", trigStr.Data()));
747 if (fHWords) fHWords->Fill(trigStr.Data(), 1);
749 if (trigStr.Contains("MB1") || trigStr.Contains("MBBG3"))
750 triggers |= AliAOODForwardMult::kB;
751 if (trigStr.Contains("COTA"))
752 triggers |= AliAODForwardMult::kA;
753 if (trigStr.Contains("COTC"))
754 triggers |= AliAODForwardMult::kC;
756 if (trigStr.Contains("CBEAMB-ABCE-NOPF-ALL")) {
757 triggers |= AliAODForwardMult::kEmpty;
758 fHTriggers->Fill(kEmpty+.5);
761 // Check for B triggers
762 if (trigStr.Contains("CINT1B-ABCE-NOPF-ALL") || // Early pp
763 trigStr.Contains("CINT1-B-NOPF-ALLNOTRD") || // Late pp
764 trigStr.Contains("CINT1-B-NOPF-FASTNOTRD") || // Late pp
765 //trigStr.Contains("CMUS1-B-NOPF-MUON") || // Late pp -- HHD 160811
766 trigStr.Contains("CSMBB-ABCE-NOPF-ALL") || // pp
767 trigStr.Contains("CMBACS2-B-NOPF-ALL") || // PbPb
768 // trigStr.Contains("C0SMH-B-NOPF-ALL") || // PbPb - high mult
769 trigStr.Contains("CMBS2A-B-NOPF-ALL") || // PbPb
770 trigStr.Contains("CMBS2C-B-NOPF-ALL") || // PbPb
771 trigStr.Contains("CMBAC-B-NOPF-ALL") || // PbPb
772 // trigStr.Contains("C0SMH-B-NOPF-ALL") || // PbPb - high mult
773 trigStr.Contains("CMBACS2-B-NOPF-ALLNOTRD") // PbPb
774 // trigStr.Contains("C0SMH-B-NOPF-ALLNOTRD") // PbPb - high mult
776 Bool_t bTrigger = kTRUE;
777 if ( trigStr.Contains("CINT1-B-NOPF-FASTNOTRD") &&
778 !trigStr.Contains("CINT1-B-NOPF-ALLNOTRD") &&
779 TMath::Abs(fEnergy - 2750.) < 20 &&
780 fCollisionSystem == AliForwardUtil::kPP)
783 triggers |= AliAODForwardMult::kB;
784 fHTriggers->Fill(kB+.5);
788 // Check for A triggers
789 if (trigStr.Contains("CINT1A-ABCE-NOPF-ALL") || // Early pp
790 trigStr.Contains("CINT1-AC-NOPF-ALLNOTRD") || // Late pp
791 trigStr.Contains("CINT1-AC-NOPF-FASTNOTRD") || // Late pp
792 (trigStr.Contains("CSMBA-ABCE-NOPF-ALL") &&
793 !(triggers & AliAODForwardMult::kB)) || // pp
794 trigStr.Contains("CMBACS2-A-NOPF-ALL") || // PbPb
795 // trigStr.Contains("C0SMH-A-NOPF-ALL") || // PbPb - high mult
796 trigStr.Contains("CMBS2A-A-NOPF-ALL") || // PbPb
797 trigStr.Contains("CMBS2C-A-NOPF-ALL") || // PbPb
798 trigStr.Contains("CMBAC-A-NOPF-ALL") || // PbPb
799 // trigStr.Contains("C0SMH-A-NOPF-ALL") || // PbPb - high mult
800 trigStr.Contains("CMBACS2-A-NOPF-ALLNOTRD") // PbPb
801 // trigStr.Contains("C0SMH-A-NOPF-ALLNOTRD") // PbPb - high mult
803 triggers |= AliAODForwardMult::kA;
804 fHTriggers->Fill(kA+.5);
807 // Check for C triggers
808 if (trigStr.Contains("CINT1C-ABCE-NOPF-ALL") || // Early pp
809 (trigStr.Contains("CSMBC-ABCE-NOPF-ALL") &&
810 !(triggers & AliAODForwardMult::kB)) || // pp
811 trigStr.Contains("CMBACS2-C-NOPF-ALL") || // PbPb
812 // trigStr.Contains("C0SMH-B-NOPF-ALL") || // PbPb - high mult
813 trigStr.Contains("CMBS2A-C-NOPF-ALL") || // PbPb
814 trigStr.Contains("CMBS2C-C-NOPF-ALL") || // PbPb
815 trigStr.Contains("CMBAC-C-NOPF-ALL") || // PbPb
816 // trigStr.Contains("C0SMH-B-NOPF-ALL") || // PbPb - high mult
817 trigStr.Contains("CMBACS2-C-NOPF-ALLNOTRD") // PbPb
818 // trigStr.Contains("C0SMH-B-NOPF-ALLNOTRD") // PbPb - high mult
820 triggers |= AliAODForwardMult::kC;
821 fHTriggers->Fill(kC+.5);
824 // Check for E triggers
825 if (trigStr.Contains("CINT1-E-NOPF-ALL") || // Early pp
826 trigStr.Contains("CINT1-E-NOPF-ALLNOTRD") || // Late pp
827 trigStr.Contains("CINT1-E-NOPF-FASTNOTRD") || // Late pp
828 trigStr.Contains("CMBACS2-E-NOPF-ALL") || // PbPb
829 // trigStr.Contains("C0SMH-B-NOPF-ALL") || // PbPb - high mult
830 trigStr.Contains("CMBS2A-E-NOPF-ALL") || // PbPb
831 trigStr.Contains("CMBS2C-E-NOPF-ALL") || // PbPb
832 trigStr.Contains("CMBAC-E-NOPF-ALL") || // PbPb
833 // trigStr.Contains("C0SMH-B-NOPF-ALL") || // PbPb - high mult
834 trigStr.Contains("CMBACS2-E-NOPF-ALLNOTRD") // PbPb
835 // trigStr.Contains("C0SMH-B-NOPF-ALLNOTRD") // PbPb - high mult
837 triggers |= AliAODForwardMult::kE;
838 fHTriggers->Fill(kE+.5);
842 const TList* collTriggClasses = ps->GetCollisionTriggerClasses();
843 const TList* bgTriggClasses = ps->GetBGTriggerClasses();
845 TIter nextColl(collTriggClasses);
846 TObjString* oadbString = 0;
847 TObjArray* tokens = 0;
848 while ((oadbString = static_cast<TObjString*>(nextColl()))) {
849 tokens = oadbString->String().Tokenize(" ");
850 for (Int_t i = 0; i < tokens->GetEntries(); i++) {
851 TString string = (((TObjString*)tokens->At(i))->String());
852 if (string[0] != '+') continue;
854 if (trigStr.Contains(string.Data())) {
855 TString beamSide = oadb->GetBeamSide(oadbString->String().Data());
856 if (beamSide.EqualTo("B")) {
857 triggers |= AliAODForwardMult::kB;
858 fHTriggers->Fill(kB+.5);
863 TIter nextBG(bgTriggClasses);
864 while ((oadbString = static_cast<TObjString*>(nextBG()))) {
865 tokens = oadbString->String().Tokenize(" ");
866 for (Int_t i = 0; i < tokens->GetEntries(); i++) {
867 TString string = (((TObjString*)tokens->At(i))->String());
868 if (string[0] != '+') continue;
870 if (trigStr.Contains(string.Data())) {
871 TString beamSide = oadb->GetBeamSide(oadbString->String().Data());
872 if (beamSide.Contains("A")) {
873 triggers |= AliAODForwardMult::kA;
874 fHTriggers->Fill(kA+.5);
876 if (beamSide.Contains("C")) {
877 triggers |= AliAODForwardMult::kC;
878 fHTriggers->Fill(kC+.5);
880 if (beamSide.Contains("E")) {
881 triggers |= AliAODForwardMult::kE;
882 fHTriggers->Fill(kE+.5);
888 // Now check - if we have a collision - for offline triggers and
890 if (triggers & AliAODForwardMult::kB) {
891 if (triggers & AliAODForwardMult::kInel)
892 fHTriggers->Fill(kInel);
894 if (triggers & AliAODForwardMult::kInelGt0)
895 fHTriggers->Fill(kInelGt0+.5);
897 if (triggers & AliAODForwardMult::kNSD)
898 fHTriggers->Fill(kNSD+.5);
900 if (triggers & AliAODForwardMult::kV0AND)
901 fHTriggers->Fill(kV0AND+.5);
906 //____________________________________________________________________
908 AliFMDEventInspector::ReadVertex(const AliESDEvent* esd,
914 // Read the vertex information from the ESD event
918 // vz On return, the vertex Z position
921 // @c true on success, @c false otherwise
927 AliAnalysisManager* am = AliAnalysisManager::GetAnalysisManager();
928 Bool_t isMC = am->GetMCtruthEventHandler() != 0;
929 if(fUseDisplacedVertices && isMC) {
931 AliMCEventHandler* mchandler = static_cast<AliMCEventHandler*>(am->GetMCtruthEventHandler());
932 AliMCEvent* mcevent = mchandler->MCEvent();
933 AliHeader* header = mcevent->Header();
934 AliGenEventHeader* genHeader = header->GenEventHeader();
936 genHeader->PrimaryVertex(vertex);
938 Double_t zvtx = vertex.At(2);
939 Double_t ratio = zvtx/37.5;
940 if(ratio > 0) ratio = ratio + 0.5;
941 if(ratio < 0) ratio = ratio - 0.5;
942 Int_t ratioInt = (Int_t)ratio;
943 zvtx = 37.5*((Double_t)ratioInt);
944 if(TMath::Abs(zvtx) < 999) {
951 if(fUseDisplacedVertices && !isMC) {
952 Double_t zvtx = fDisplacedVertex.CheckDisplacedVertex(esd);
954 if(TMath::Abs(zvtx) < 999) {
961 if(fUseFirstPhysicsVertex) {
962 // This is the code used by the 1st physics people
963 const AliESDVertex* vertex = esd->GetPrimaryVertex();
964 if (!vertex || !vertex->GetStatus()) {
966 AliWarning(Form("No primary vertex (%p) or bad status %d",
967 vertex, (vertex ? vertex->GetStatus() : -1)));
971 const AliESDVertex* vertexSPD = esd->GetPrimaryVertexSPD();
972 if (!vertexSPD || !vertexSPD->GetStatus()) {
974 AliWarning(Form("No primary SPD vertex (%p) or bad status %d",
975 vertexSPD, (vertexSPD ? vertexSPD->GetStatus() : -1)));
980 // if vertex is from SPD vertexZ, require more stringent cuts
981 if (vertex->IsFromVertexerZ()) {
982 if (vertex->GetDispersion() > fMaxVzErr ||
983 vertex->GetZRes() > 1.25 * fMaxVzErr) {
985 AliWarning(Form("Dispersion %f > %f or resolution %f > %f",
986 vertex->GetDispersion(), fMaxVzErr,
987 vertex->GetZRes(), 1.25 * fMaxVzErr));
994 if(!vertex->IsFromVertexerZ()) {
1000 else { //Use standard SPD vertex (perhaps preferable for Pb+Pb)
1003 const AliESDVertex* vertex = esd->GetPrimaryVertexSPD();
1006 AliWarning("No SPD vertex found in ESD"); }
1010 // Check that enough tracklets contributed
1011 if(vertex->GetNContributors() <= 0) {
1013 AliWarning(Form("Number of contributors to vertex is %d<=0",
1014 vertex->GetNContributors())); }
1018 // Check that the uncertainty isn't too large
1019 if (vertex->GetZRes() > fMaxVzErr) {
1021 AliWarning(Form("Uncertaintity in Z of vertex is too large %f > %f",
1022 vertex->GetZRes(), fMaxVzErr)); }
1026 // Get the z coordiante
1027 vz = vertex->GetZ();
1028 const AliESDVertex* vertexXY = esd->GetPrimaryVertex();
1030 if(!vertexXY->IsFromVertexerZ()) {
1031 vx = vertexXY->GetX();
1032 vy = vertexXY->GetY();
1038 //____________________________________________________________________
1040 AliFMDEventInspector::ReadRunDetails(const AliESDEvent* esd)
1043 // Read the collision system, collision energy, and L3 field setting
1047 // esd ESD to get information from
1050 // true on success, false
1052 // AliInfo(Form("Parameters from 1st ESD event: cms=%s, sNN=%f, field=%f",
1053 // esd->GetBeamType(), 2*esd->GetBeamEnergy(),
1054 // esd->GetMagneticField()));
1056 AliForwardUtil::ParseCollisionSystem(esd->GetBeamType());
1058 AliForwardUtil::ParseCenterOfMassEnergy(fCollisionSystem,
1059 2 * esd->GetBeamEnergy());
1061 AliForwardUtil::ParseMagneticField(esd->GetMagneticField());
1063 StoreInformation(esd->GetRunNumber());
1064 if (fCollisionSystem == AliForwardUtil::kUnknown ||
1066 TMath::Abs(fField) > 10)
1072 //____________________________________________________________________
1074 AliFMDEventInspector::Print(Option_t*) const
1077 // Print information
1081 char ind[gROOT->GetDirLevel()+1];
1082 for (Int_t i = 0; i < gROOT->GetDirLevel(); i++) ind[i] = ' ';
1083 ind[gROOT->GetDirLevel()] = '\0';
1084 TString sNN(AliForwardUtil::CenterOfMassEnergyString(fEnergy));
1085 sNN.Strip(TString::kBoth, '0');
1086 sNN.ReplaceAll("GeV", " GeV");
1087 TString field(AliForwardUtil::MagneticFieldString(fField));
1088 field.ReplaceAll("p", "+");
1089 field.ReplaceAll("m", "-");
1090 field.ReplaceAll("kG", " kG");
1092 std::cout << ind << ClassName() << ": " << GetName() << '\n'
1093 << ind << " Vertex bins: " << fVtxAxis.GetNbins() << '\n'
1094 << ind << " Vertex range: [" << fVtxAxis.GetXmin()
1095 << "," << fVtxAxis.GetXmax() << "]\n"
1096 << ind << " Low flux cut: " << fLowFluxCut << '\n'
1097 << ind << " Max(delta v_z): " << fMaxVzErr << " cm\n"
1098 << ind << " Min(nContrib_pileup): " << fMinPileupContrib << '\n'
1099 << ind << " Min(v-pileup): " << fMinPileupDistance << '\n'
1100 << ind << " System: "
1101 << AliForwardUtil::CollisionSystemString(fCollisionSystem) << '\n'
1102 << ind << " CMS energy per nucleon: " << sNN << '\n'
1103 << ind << " Field: " << field << '\n';
1104 if (!fCentAxis) { std::cout << std::flush; return; }
1105 Int_t nBin = fCentAxis->GetNbins();
1106 std::cout << ind << " Centrality axis: " << nBin << " bins"
1108 for (Int_t i = 0; i < nBin; i++) {
1109 if ((i % 10) == 0) std::cout << '\n' << ind << " ";
1110 std::cout << std::setw(5) << fCentAxis->GetBinLowEdge(i+1) << '-';
1112 std::cout << std::setw(5) << fCentAxis->GetBinUpEdge(nBin) << std::endl;