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),
73 DGUARD(fDebug,0,"Default CTOR of AliFMDEventInspector");
76 //____________________________________________________________________
77 AliFMDEventInspector::AliFMDEventInspector(const char* name)
78 : TNamed("fmdEventInspector", name),
82 fHEventsAcceptedXY(0),
93 fCollisionSystem(kUnknown),
97 fUseFirstPhysicsVertex(true),
100 fMinPileupDistance(0.8),
101 fUseDisplacedVertices(false),
108 // name Name of object
110 DGUARD(fDebug,0,"Named CTOR of AliFMDEventInspector: %s", name);
113 //____________________________________________________________________
114 AliFMDEventInspector::AliFMDEventInspector(const AliFMDEventInspector& o)
116 fHEventsTr(o.fHEventsTr),
117 fHEventsTrVtx(o.fHEventsTrVtx),
118 fHEventsAccepted(o.fHEventsAccepted),
119 fHEventsAcceptedXY(o.fHEventsAcceptedXY),
120 fHTriggers(o.fHTriggers),
124 fHCentVsQual(o.fHCentVsQual),
125 fLowFluxCut(o.fLowFluxCut),
126 fMaxVzErr(o.fMaxVzErr),
130 fCollisionSystem(o.fCollisionSystem),
133 fVtxAxis(o.fVtxAxis),
134 fUseFirstPhysicsVertex(o.fUseFirstPhysicsVertex),
135 fUseV0AND(o.fUseV0AND),
136 fMinPileupContrib(o.fMinPileupContrib),
137 fMinPileupDistance(o.fMinPileupDistance),
138 fUseDisplacedVertices(o.fUseDisplacedVertices),
139 fDisplacedVertex(o.fDisplacedVertex)
145 // o Object to copy from
147 DGUARD(fDebug,0,"Copy CTOR of AliFMDEventInspector");
150 //____________________________________________________________________
151 AliFMDEventInspector::~AliFMDEventInspector()
156 if (fList) delete fList;
158 //____________________________________________________________________
159 AliFMDEventInspector&
160 AliFMDEventInspector::operator=(const AliFMDEventInspector& o)
163 // Assignement operator
166 // o Object to assign from
169 // Reference to this object
171 DGUARD(fDebug,3,"Assignment of AliFMDEventInspector");
172 if (&o == this) return *this;
173 TNamed::operator=(o);
174 fHEventsTr = o.fHEventsTr;
175 fHEventsTrVtx = o.fHEventsTrVtx;
176 fHEventsAccepted = o.fHEventsAccepted;
177 fHEventsAcceptedXY = o.fHEventsAcceptedXY;
178 fHTriggers = o.fHTriggers;
182 fHCentVsQual = o.fHCentVsQual;
183 fLowFluxCut = o.fLowFluxCut;
184 fMaxVzErr = o.fMaxVzErr;
186 fList = (o.fList ? new TList : 0);
189 fCollisionSystem = o.fCollisionSystem;
190 fVtxAxis.Set(o.fVtxAxis.GetNbins(), o.fVtxAxis.GetXmin(),
191 o.fVtxAxis.GetXmax());
193 fUseFirstPhysicsVertex = o.fUseFirstPhysicsVertex;
194 fUseV0AND = o.fUseV0AND;
195 fMinPileupContrib = o.fMinPileupContrib;
196 fMinPileupDistance = o.fMinPileupDistance;
197 fUseDisplacedVertices = o.fUseDisplacedVertices;
198 fDisplacedVertex = o.fDisplacedVertex;
200 fList->SetName(GetName());
201 if (fHEventsTr) fList->Add(fHEventsTr);
202 if (fHEventsTrVtx) fList->Add(fHEventsTrVtx);
203 if (fHTriggers) fList->Add(fHTriggers);
204 if (fHType) fList->Add(fHType);
205 if (fHWords) fList->Add(fHWords);
206 if (fHCent) fList->Add(fHCent);
207 if (fHCentVsQual) fList->Add(fHCentVsQual);
212 //____________________________________________________________________
214 AliFMDEventInspector::FetchHistograms(const TList* d,
217 TH1I*& hTriggers) const
220 // Fetch our histograms from the passed list
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
229 // true on success, false otherwise
231 DGUARD(fDebug,3,"Fetch histograms in AliFMDEventInspector");
235 TList* dd = dynamic_cast<TList*>(d->FindObject(GetName()));
236 if (!dd) return kFALSE;
238 hEventsTr = dynamic_cast<TH1I*>(dd->FindObject("nEventsTr"));
239 hEventsTrVtx = dynamic_cast<TH1I*>(dd->FindObject("nEventsTrVtx"));
240 hTriggers = dynamic_cast<TH1I*>(dd->FindObject("triggers"));
242 if (!hEventsTr || !hEventsTrVtx || !hTriggers) return kFALSE;
245 //____________________________________________________________________
247 AliFMDEventInspector::Init(const TAxis& vtxAxis)
250 // Initialize the object
253 // vtxAxis Vertex axis in use
255 DGUARD(fDebug,1,"Initialize in AliFMDEventInspector");
257 // -1.5 -0.5 0.5 1.5 ... 89.5 ... 100.5
258 // ----- 92 number --------- ---- 1 ---
260 for (Int_t i = 0; i < 92; i++) limits[i] = -1.5 + i;
263 fVtxAxis.Set(vtxAxis.GetNbins(), vtxAxis.GetXmin(), vtxAxis.GetXmax());
265 fCentAxis = new TAxis(limits.GetSize()-1, limits.GetArray());
266 fHEventsTr = new TH1I("nEventsTr", "Number of events w/trigger",
267 4*vtxAxis.GetNbins(),
269 2*vtxAxis.GetXmax());
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);
278 fHEventsTrVtx = static_cast<TH1I*>(fHEventsTr->Clone("nEventsTrVtx"));
279 fHEventsTrVtx->SetTitle("Number of events w/trigger and vertex");
280 fHEventsTrVtx->SetFillColor(kBlue+1);
281 fHEventsTrVtx->SetDirectory(0);
282 // fHEventsTrVtx->Sumw2();
283 fList->Add(fHEventsTrVtx);
285 fHEventsAccepted = new TH1I("nEventsAccepted",
286 "Number of events w/trigger and vertex in range",
287 2*vtxAxis.GetNbins(),
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);
298 fHEventsAcceptedXY = new TH2D("nEventsAcceptedXY",
299 "XY vertex w/trigger and Z vertex in range",
300 1000,-1,1,1000,-1,1);
302 fHEventsAcceptedXY->SetXTitle("v_{x} [cm]");
303 fHEventsAcceptedXY->SetYTitle("v_{y} [cm]");
304 fHEventsAcceptedXY->SetDirectory(0);
305 // fHEventsAccepted->Sumw2();
306 fList->Add(fHEventsAcceptedXY);
309 fHTriggers = new TH1I("triggers", "Triggers", kOffline+1, 0, kOffline+1);
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");
317 fHTriggers->GetXaxis()->SetBinLabel(kV0AND +1,"VOAND");
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");
323 fHTriggers->GetXaxis()->SetBinLabel(kPileUp +1,"Pileup");
324 fHTriggers->GetXaxis()->SetBinLabel(kMCNSD +1,"NSD_{MC}");
325 fHTriggers->GetXaxis()->SetBinLabel(kOffline+1,"Offline");
326 fList->Add(fHTriggers);
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);
333 fHType->SetDirectory(0);
334 fHType->GetXaxis()->SetBinLabel(1,"Low-flux");
335 fHType->GetXaxis()->SetBinLabel(2,"High-flux");
339 // This histogram disabled as it causes problems in the merge
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);
349 fHCent = new TH1F("cent", "Centrality", limits.GetSize()-1,limits.GetArray());
350 fHCent->SetFillColor(kBlue+1);
351 fHCent->SetFillStyle(3001);
353 fHCent->SetDirectory(0);
354 fHCent->SetXTitle("Centrality [%]");
355 fHCent->SetYTitle("Events");
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);
371 //____________________________________________________________________
373 AliFMDEventInspector::StoreInformation(Int_t runNo)
375 // Write TNamed objects to output list containing information about
376 // the running conditions
377 DGUARD(fDebug,2,"Store information from AliFMDEventInspector");
381 TNamed* sys = new TNamed("sys", "");
382 TNamed* sNN = new TNamed("sNN", "");
383 TNamed* fld = new TNamed("field", "");
384 TNamed* run = new TNamed("runNo", Form("%d", runNo));
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));
389 sys->SetTitle(AliForwardUtil::CollisionSystemString(fCollisionSystem));
390 sNN->SetTitle(AliForwardUtil::CenterOfMassEnergyString(fEnergy));
391 fld->SetTitle(AliForwardUtil::MagneticFieldString(fField));
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);
403 sys->SetUniqueID(fCollisionSystem);
404 sNN->SetUniqueID(fEnergy);
405 fld->SetUniqueID(fField);
406 run->SetUniqueID(runNo);
407 low->SetUniqueID(fLowFluxCut);
408 fpv->SetUniqueID(fUseFirstPhysicsVertex ? 1 : 0);
409 v0a->SetUniqueID(fUseV0AND ? 1 : 0);
410 nCp->SetUniqueID(fMinPileupContrib);
412 TParameter<Double_t>* dP = new TParameter<Double_t>("dPileup", fMinPileupDistance);
426 //____________________________________________________________________
428 AliFMDEventInspector::DefineOutput(TList* dir)
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
435 // dir Directory to add to
437 DGUARD(fDebug,1,"Define output from AliFMDEventInspector");
439 fList->SetName(GetName());
443 //____________________________________________________________________
445 AliFMDEventInspector::Process(const AliESDEvent* 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
464 // cent On return, the centrality - if not available < 0
467 // 0 (or kOk) on success, otherwise a bit mask of error codes
469 DGUARD(fDebug,1,"Process event in AliFMDEventInspector");
471 // --- Check that we have an event ---------------------------------
473 AliWarning("No ESD event found for input event");
477 // --- Read trigger information from the ESD and store in AOD object
478 if (!ReadTriggers(event, triggers, nClusters)) {
480 AliWarning("Failed to read triggers from ESD"); }
484 // --- Check if this is a high-flux event --------------------------
485 const AliMultiplicity* testmult = event->GetMultiplicity();
488 AliWarning("No central multiplicity object found"); }
491 lowFlux = testmult->GetNumberOfTracklets() < fLowFluxCut;
493 fHType->Fill(lowFlux ? 0 : 1);
495 // --- Read centrality information
498 if (!ReadCentrality(event, cent, qual)) {
500 AliWarning("Failed to get centrality");
503 if (qual == 0) fHCentVsQual->Fill(0., cent);
505 for (UShort_t i = 0; i < 4; i++)
506 if (qual & (1 << i)) fHCentVsQual->Fill(Double_t(i+1), cent);
509 // --- Get the vertex information ----------------------------------
515 Bool_t vzOk = ReadVertex(event, vz,vx,vy);
517 fHEventsTr->Fill(vz);
520 AliWarning("Failed to read vertex from ESD"); }
523 fHEventsTrVtx->Fill(vz);
525 // --- Get the vertex bin ------------------------------------------
526 ivz = fVtxAxis.FindBin(vz);
527 if (ivz <= 0 || ivz > fVtxAxis.GetNbins()) {
529 AliWarning(Form("Vertex @ %f outside of range [%f,%f]",
530 vz, fVtxAxis.GetXmin(), fVtxAxis.GetXmax()));
535 fHEventsAccepted->Fill(vz);
536 fHEventsAcceptedXY->Fill(vx,vy);
538 // --- Check the FMD ESD data --------------------------------------
539 if (!event->GetFMDData()) {
541 AliWarning("No FMD data found in ESD"); }
549 //____________________________________________________________________
551 AliFMDEventInspector::ReadCentrality(const AliESDEvent* esd,
553 UShort_t& qual) const
556 // Read centrality from event
560 // cent On return, the centrality or negative if not found
563 // False on error, true otherwise
565 DGUARD(fDebug,2,"Read the centrality in AliFMDEventInspector");
569 AliCentrality* centObj = const_cast<AliESDEvent*>(esd)->GetCentrality();
570 if (!centObj) return true;
571 AliAnalysisManager* am = AliAnalysisManager::GetAnalysisManager();
572 Bool_t isMC = am->GetMCtruthEventHandler() != 0;
574 //std::cout<<fUseDisplacedVertices<<" "<<isMC<<std::endl;
575 if(fUseDisplacedVertices && !isMC) {
576 Double_t zvtx = fDisplacedVertex.CheckDisplacedVertex(esd);
578 if(TMath::Abs(zvtx) < 999) {
579 cent = fDisplacedVertex.CalculateDisplacedVertexCent(esd); //centObj->GetCentralityPercentileUnchecked("ZEMvsZDC");
583 else if(fUseDisplacedVertices && isMC) {
586 AliMCEventHandler* mchandler = static_cast<AliMCEventHandler*>(am->GetMCtruthEventHandler());
587 AliMCEvent* mcevent = mchandler->MCEvent();
589 AliHeader* header = mcevent->Header();
590 AliGenEventHeader* genHeader = header->GenEventHeader();
591 AliCollisionGeometry* colGeometry =
592 dynamic_cast<AliCollisionGeometry*>(genHeader);
595 b = colGeometry->ImpactParameter();
596 std::cout<<"Hallo!! "<<b<<std::endl;
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%
609 cent = centObj->GetCentralityPercentile("V0M");
610 qual = centObj->GetQuality();
613 // AliInfo(Form("Got centrality object %p with quality %d",
614 // centObj, centObj->GetQuality()));
616 //cent = centObj->GetCentralityPercentile("V0M");
617 //cent = centObj->GetCentralityPercentile("ZEMvsZDC");
618 //qual = centObj->GetQuality();
623 //____________________________________________________________________
625 AliFMDEventInspector::ReadTriggers(const AliESDEvent* esd, UInt_t& triggers,
629 // Read the trigger information from the ESD event
633 // triggers On return, contains the trigger bits
636 // @c true on success, @c false otherwise
638 DGUARD(fDebug,2,"Read the triggers in AliFMDEventInspector");
641 // Get the analysis manager - should always be there
642 AliAnalysisManager* am = AliAnalysisManager::GetAnalysisManager();
644 AliWarning("No analysis manager defined!");
648 // Get the input handler - should always be there
649 AliInputEventHandler* ih =
650 static_cast<AliInputEventHandler*>(am->GetInputEventHandler());
652 AliWarning("No input handler");
655 AliPhysicsSelection* ps =
656 static_cast<AliPhysicsSelection*>(ih->GetEventSelection());
658 AliWarning("No physics selection");
661 AliOADBPhysicsSelection* oadb =
662 const_cast<AliOADBPhysicsSelection*>(ps->GetOADBPhysicsSelection());
664 AliWarning("No OADB physics selection object");
668 // Check if this is a collision candidate (MB)
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
674 Bool_t offline = ih->IsEventSelected() ;
675 Bool_t fastonly = (ih->IsEventSelected() & AliVEvent::kFastOnly);
676 TString trigStr = esd->GetFiredTriggerClasses();
678 //If we have the MC input handler, this must be MC
679 Bool_t isMC = am->GetMCtruthEventHandler() != 0;
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();
687 genHeader->PrimaryVertex(vertex);
689 Double_t zvtx = vertex.At(2);
690 if(TMath::Abs(zvtx) > 35)
692 else offline = false;
695 if(fUseDisplacedVertices && !isMC) {
696 Double_t zvtx = fDisplacedVertex.CheckDisplacedVertex(esd);
697 if(TMath::Abs(zvtx) < 999) offline = true;
698 else offline = false;
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.
705 if(TMath::Abs(fEnergy - 2750.) < 20 &&
706 fCollisionSystem == AliForwardUtil::kPP &&
708 if (fastonly) offline = false;
711 // MUON triggers are not strictly minimum bias (MB) so they are removed (HHD)
713 if(offline && trigStr.Contains("CMUS1")) offline = false;
716 triggers |= AliAODForwardMult::kOffline;
717 triggers |= AliAODForwardMult::kInel;
719 AliWarning("Histogram of triggers not defined - has init been called");
722 fHTriggers->Fill(kOffline+0.5);
724 // If this is inel, see if we have a tracklet
725 const AliMultiplicity* spdmult = esd->GetMultiplicity();
727 AliWarning("No SPD multiplicity");
730 // Check if we have one or more tracklets
731 // in the range -1 < eta < 1 to set the INEL>0
734 // Also count tracklets as a single cluster
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;
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++;
748 if (nClusters > 0) triggers |= AliAODForwardMult::kNClusterGt0;
751 // Analyse some trigger stuff
752 AliTriggerAnalysis ta;
753 if (ta.IsOfflineTriggerFired(esd, AliTriggerAnalysis::kV0AND)) {
754 triggers |= AliAODForwardMult::kV0AND;
756 triggers |= AliAODForwardMult::kNSD;
758 if (ta.IsOfflineTriggerFired(esd, AliTriggerAnalysis::kNSD1))
759 triggers |= AliAODForwardMult::kNSD;
761 // Check for multiple vertices (pile-up) with at least 3
762 // contributors and at least 0.8cm from the primary vertex
763 Bool_t pileup = kFALSE;
764 if(fCollisionSystem == AliForwardUtil::kPP)
765 pileup = esd->IsPileupFromSPD(fMinPileupContrib,fMinPileupDistance);
767 triggers |= AliAODForwardMult::kPileUp;
768 fHTriggers->Fill(kPileUp+.5);
773 //TString trigStr = esd->GetFiredTriggerClasses();
774 // AliWarning(Form("Fired trigger classes: %s", trigStr.Data()));
775 if (fHWords) fHWords->Fill(trigStr.Data(), 1);
777 if (trigStr.Contains("MB1") || trigStr.Contains("MBBG3"))
778 triggers |= AliAOODForwardMult::kB;
779 if (trigStr.Contains("COTA"))
780 triggers |= AliAODForwardMult::kA;
781 if (trigStr.Contains("COTC"))
782 triggers |= AliAODForwardMult::kC;
784 if (trigStr.Contains("CBEAMB-ABCE-NOPF-ALL")) {
785 triggers |= AliAODForwardMult::kEmpty;
786 fHTriggers->Fill(kEmpty+.5);
789 // Check for B triggers
790 if (trigStr.Contains("CINT1B-ABCE-NOPF-ALL") || // Early pp
791 trigStr.Contains("CINT1-B-NOPF-ALLNOTRD") || // Late pp
792 trigStr.Contains("CINT1-B-NOPF-FASTNOTRD") || // Late pp
793 //trigStr.Contains("CMUS1-B-NOPF-MUON") || // Late pp -- HHD 160811
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
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)
811 triggers |= AliAODForwardMult::kB;
812 fHTriggers->Fill(kB+.5);
816 // Check for A triggers
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
820 (trigStr.Contains("CSMBA-ABCE-NOPF-ALL") &&
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
828 trigStr.Contains("CMBACS2-A-NOPF-ALLNOTRD") // PbPb
829 // trigStr.Contains("C0SMH-A-NOPF-ALLNOTRD") // PbPb - high mult
831 triggers |= AliAODForwardMult::kA;
832 fHTriggers->Fill(kA+.5);
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
848 triggers |= AliAODForwardMult::kC;
849 fHTriggers->Fill(kC+.5);
852 // Check for E triggers
853 if (trigStr.Contains("CINT1-E-NOPF-ALL") || // Early pp
854 trigStr.Contains("CINT1-E-NOPF-ALLNOTRD") || // Late pp
855 trigStr.Contains("CINT1-E-NOPF-FASTNOTRD") || // Late pp
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
865 triggers |= AliAODForwardMult::kE;
866 fHTriggers->Fill(kE+.5);
870 const TList* collTriggClasses = ps->GetCollisionTriggerClasses();
871 const TList* bgTriggClasses = ps->GetBGTriggerClasses();
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;
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);
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;
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);
904 if (beamSide.Contains("C")) {
905 triggers |= AliAODForwardMult::kC;
906 fHTriggers->Fill(kC+.5);
908 if (beamSide.Contains("E")) {
909 triggers |= AliAODForwardMult::kE;
910 fHTriggers->Fill(kE+.5);
916 // Now check - if we have a collision - for offline triggers and
918 if (triggers & AliAODForwardMult::kB) {
919 if (triggers & AliAODForwardMult::kInel)
920 fHTriggers->Fill(kInel);
922 if (triggers & AliAODForwardMult::kInelGt0)
923 fHTriggers->Fill(kInelGt0+.5);
925 if (triggers & AliAODForwardMult::kNSD)
926 fHTriggers->Fill(kNSD+.5);
928 if (triggers & AliAODForwardMult::kV0AND)
929 fHTriggers->Fill(kV0AND+.5);
934 //____________________________________________________________________
936 AliFMDEventInspector::ReadVertex(const AliESDEvent* esd,
942 // Read the vertex information from the ESD event
946 // vz On return, the vertex Z position
949 // @c true on success, @c false otherwise
951 DGUARD(fDebug,2,"Read the vertex in AliFMDEventInspector");
956 AliAnalysisManager* am = AliAnalysisManager::GetAnalysisManager();
957 Bool_t isMC = am->GetMCtruthEventHandler() != 0;
958 if(fUseDisplacedVertices && isMC) {
960 AliMCEventHandler* mchandler = static_cast<AliMCEventHandler*>(am->GetMCtruthEventHandler());
961 AliMCEvent* mcevent = mchandler->MCEvent();
962 AliHeader* header = mcevent->Header();
963 AliGenEventHeader* genHeader = header->GenEventHeader();
965 genHeader->PrimaryVertex(vertex);
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) {
980 if(fUseDisplacedVertices && !isMC) {
981 Double_t zvtx = fDisplacedVertex.CheckDisplacedVertex(esd);
983 if(TMath::Abs(zvtx) < 999) {
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()) {
995 AliWarning(Form("No primary vertex (%p) or bad status %d",
996 vertex, (vertex ? vertex->GetStatus() : -1)));
1000 const AliESDVertex* vertexSPD = esd->GetPrimaryVertexSPD();
1001 if (!vertexSPD || !vertexSPD->GetStatus()) {
1003 AliWarning(Form("No primary SPD vertex (%p) or bad status %d",
1004 vertexSPD, (vertexSPD ? vertexSPD->GetStatus() : -1)));
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) {
1014 AliWarning(Form("Dispersion %f > %f or resolution %f > %f",
1015 vertex->GetDispersion(), fMaxVzErr,
1016 vertex->GetZRes(), 1.25 * fMaxVzErr));
1021 vz = vertex->GetZ();
1023 if(!vertex->IsFromVertexerZ()) {
1024 vx = vertex->GetX();
1025 vy = vertex->GetY();
1029 else { //Use standard SPD vertex (perhaps preferable for Pb+Pb)
1032 const AliESDVertex* vertex = esd->GetPrimaryVertexSPD();
1035 AliWarning("No SPD vertex found in ESD"); }
1039 // Check that enough tracklets contributed
1040 if(vertex->GetNContributors() <= 0) {
1042 AliWarning(Form("Number of contributors to vertex is %d<=0",
1043 vertex->GetNContributors())); }
1047 // Check that the uncertainty isn't too large
1048 if (vertex->GetZRes() > fMaxVzErr) {
1050 AliWarning(Form("Uncertaintity in Z of vertex is too large %f > %f",
1051 vertex->GetZRes(), fMaxVzErr)); }
1055 // Get the z coordiante
1056 vz = vertex->GetZ();
1057 const AliESDVertex* vertexXY = esd->GetPrimaryVertex();
1059 if(!vertexXY->IsFromVertexerZ()) {
1060 vx = vertexXY->GetX();
1061 vy = vertexXY->GetY();
1067 //____________________________________________________________________
1069 AliFMDEventInspector::ReadRunDetails(const AliESDEvent* esd)
1072 // Read the collision system, collision energy, and L3 field setting
1076 // esd ESD to get information from
1079 // true on success, false
1081 // AliInfo(Form("Parameters from 1st ESD event: cms=%s, sNN=%f, field=%f",
1082 // esd->GetBeamType(), 2*esd->GetBeamEnergy(),
1083 // esd->GetMagneticField()));
1084 DGUARD(fDebug,2,"Read the run details in AliFMDEventInspector");
1086 AliForwardUtil::ParseCollisionSystem(esd->GetBeamType());
1088 AliForwardUtil::ParseCenterOfMassEnergy(fCollisionSystem,
1089 2 * esd->GetBeamEnergy());
1091 AliForwardUtil::ParseMagneticField(esd->GetMagneticField());
1093 StoreInformation(esd->GetRunNumber());
1094 if (fCollisionSystem == AliForwardUtil::kUnknown ||
1096 TMath::Abs(fField) > 10)
1102 //____________________________________________________________________
1104 AliFMDEventInspector::Print(Option_t*) const
1107 // Print information
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");
1122 std::cout << ind << ClassName() << ": " << GetName() << '\n'
1123 << ind << " Vertex bins: " << fVtxAxis.GetNbins() << '\n'
1124 << ind << " Vertex range: [" << fVtxAxis.GetXmin()
1125 << "," << fVtxAxis.GetXmax() << "]\n"
1126 << ind << " Low flux cut: " << fLowFluxCut << '\n'
1127 << ind << " Max(delta v_z): " << fMaxVzErr << " cm\n"
1128 << ind << " Min(nContrib_pileup): " << fMinPileupContrib << '\n'
1129 << ind << " Min(v-pileup): " << fMinPileupDistance << '\n'
1130 << ind << " System: "
1131 << AliForwardUtil::CollisionSystemString(fCollisionSystem) << '\n'
1132 << ind << " CMS energy per nucleon: " << sNN << '\n'
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"
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) << '-';
1142 std::cout << std::setw(5) << fCentAxis->GetBinUpEdge(nBin) << std::endl;