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 ?
388 TNamed* v0a = new TNamed("v0and", Form("%s", fUseV0AND ? "true" : "false"));
389 TNamed* nCp = new TNamed("nPileup", Form("%d", fMinPileupContrib));
390 sys->SetTitle(AliForwardUtil::CollisionSystemString(fCollisionSystem));
391 sNN->SetTitle(AliForwardUtil::CenterOfMassEnergyString(fEnergy));
392 fld->SetTitle(AliForwardUtil::MagneticFieldString(fField));
394 TParameter<int>* sys = new TParameter<int>("sys", fCollisionSystem);
395 TParameter<int>* sNN = new TParameter<int>("sNN", fEnergy);
396 TParameter<int>* fld = new TParameter<int>("field", fField);
397 TParameter<int>* run = new TParameter<int>("runNo", runNo);
398 TParameter<int>* low = new TParameter<int>("lowFlux", fLowFluxCut);
399 TParameter<bool>* fpv = new TParameter<bool>("fpVtx",fUseFirstPhysicsVertex);
400 TParameter<bool>* v0a = new TParameter<bool>("v0and",fUseV0AND);
401 TParameter<int>* nCp = new TParameter<int>("nPileUp", fMinPileupContrib);
402 TParameter<Double_t>* dP = new TParameter<Double_t>("dPileup",
405 sys->SetUniqueID(fCollisionSystem);
406 sNN->SetUniqueID(fEnergy);
407 fld->SetUniqueID(fField);
408 run->SetUniqueID(runNo);
409 low->SetUniqueID(fLowFluxCut);
410 fpv->SetUniqueID(fUseFirstPhysicsVertex ? 1 : 0);
411 v0a->SetUniqueID(fUseV0AND ? 1 : 0);
412 nCp->SetUniqueID(fMinPileupContrib);
425 //____________________________________________________________________
427 AliFMDEventInspector::DefineOutput(TList* dir)
430 // Define the output histograms. These are put in a sub list of the
431 // passed list. The histograms are merged before the parent task calls
432 // AliAnalysisTaskSE::Terminate
434 // dir Directory to add to
436 DGUARD(fDebug,1,"Define output from AliFMDEventInspector");
438 fList->SetName(GetName());
442 //____________________________________________________________________
444 AliFMDEventInspector::Process(const AliESDEvent* event,
457 // triggers On return, the triggers fired
458 // lowFlux On return, true if the event is considered a low-flux
459 // event (according to the setting of fLowFluxCut)
460 // ivz On return, the found vertex bin (1-based). A zero
461 // means outside of the defined vertex range
462 // vz On return, the z position of the interaction
463 // cent On return, the centrality - if not available < 0
466 // 0 (or kOk) on success, otherwise a bit mask of error codes
468 DGUARD(fDebug,1,"Process event in AliFMDEventInspector");
470 // --- Check that we have an event ---------------------------------
472 AliWarning("No ESD event found for input event");
476 // --- Read trigger information from the ESD and store in AOD object
477 if (!ReadTriggers(event, triggers, nClusters)) {
479 AliWarning("Failed to read triggers from ESD"); }
483 // --- Check if this is a high-flux event --------------------------
484 const AliMultiplicity* testmult = event->GetMultiplicity();
487 AliWarning("No central multiplicity object found"); }
490 lowFlux = testmult->GetNumberOfTracklets() < fLowFluxCut;
492 fHType->Fill(lowFlux ? 0 : 1);
494 // --- Read centrality information
497 if (!ReadCentrality(event, cent, qual)) {
499 AliWarning("Failed to get centrality");
502 if (qual == 0) fHCentVsQual->Fill(0., cent);
504 for (UShort_t i = 0; i < 4; i++)
505 if (qual & (1 << i)) fHCentVsQual->Fill(Double_t(i+1), cent);
508 // --- Get the vertex information ----------------------------------
514 Bool_t vzOk = ReadVertex(event, vz,vx,vy);
516 fHEventsTr->Fill(vz);
519 AliWarning("Failed to read vertex from ESD"); }
522 fHEventsTrVtx->Fill(vz);
524 // --- Get the vertex bin ------------------------------------------
525 ivz = fVtxAxis.FindBin(vz);
526 if (ivz <= 0 || ivz > fVtxAxis.GetNbins()) {
528 AliWarning(Form("Vertex @ %f outside of range [%f,%f]",
529 vz, fVtxAxis.GetXmin(), fVtxAxis.GetXmax()));
534 fHEventsAccepted->Fill(vz);
535 fHEventsAcceptedXY->Fill(vx,vy);
537 // --- Check the FMD ESD data --------------------------------------
538 if (!event->GetFMDData()) {
540 AliWarning("No FMD data found in ESD"); }
548 //____________________________________________________________________
550 AliFMDEventInspector::ReadCentrality(const AliESDEvent* esd,
552 UShort_t& qual) const
555 // Read centrality from event
559 // cent On return, the centrality or negative if not found
562 // False on error, true otherwise
564 DGUARD(fDebug,2,"Read the centrality in AliFMDEventInspector");
568 AliCentrality* centObj = const_cast<AliESDEvent*>(esd)->GetCentrality();
569 if (!centObj) return true;
570 AliAnalysisManager* am = AliAnalysisManager::GetAnalysisManager();
571 Bool_t isMC = am->GetMCtruthEventHandler() != 0;
573 //std::cout<<fUseDisplacedVertices<<" "<<isMC<<std::endl;
574 if(fUseDisplacedVertices && !isMC) {
575 Double_t zvtx = fDisplacedVertex.CheckDisplacedVertex(esd);
577 if(TMath::Abs(zvtx) < 999) {
578 cent = fDisplacedVertex.CalculateDisplacedVertexCent(esd); //centObj->GetCentralityPercentileUnchecked("ZEMvsZDC");
582 else if(fUseDisplacedVertices && isMC) {
585 AliMCEventHandler* mchandler = static_cast<AliMCEventHandler*>(am->GetMCtruthEventHandler());
586 AliMCEvent* mcevent = mchandler->MCEvent();
588 AliHeader* header = mcevent->Header();
589 AliGenEventHeader* genHeader = header->GenEventHeader();
590 AliCollisionGeometry* colGeometry =
591 dynamic_cast<AliCollisionGeometry*>(genHeader);
594 b = colGeometry->ImpactParameter();
595 std::cout<<"Hallo!! "<<b<<std::endl;
597 if(b<3.5 && b >0) cent = 2.5; //0-5%
598 if(b>3.5 && b<4.95) cent = 7.5; //5-10%
599 if(b>4.95 && b<6.98) cent = 15; //10-20%
600 if(b>6.98 && b<8.55) cent = 25; //20-30%
601 if(b>8.55 && b<9.88) cent = 35; //30-40%
602 if(b>9.88 && b<11.04) cent = 45; //40-50%
603 if(b>11.04) cent = 55; //50-60%
608 cent = centObj->GetCentralityPercentile("V0M");
609 qual = centObj->GetQuality();
612 // AliInfo(Form("Got centrality object %p with quality %d",
613 // centObj, centObj->GetQuality()));
615 //cent = centObj->GetCentralityPercentile("V0M");
616 //cent = centObj->GetCentralityPercentile("ZEMvsZDC");
617 //qual = centObj->GetQuality();
622 //____________________________________________________________________
624 AliFMDEventInspector::ReadTriggers(const AliESDEvent* esd, UInt_t& triggers,
628 // Read the trigger information from the ESD event
632 // triggers On return, contains the trigger bits
635 // @c true on success, @c false otherwise
637 DGUARD(fDebug,2,"Read the triggers in AliFMDEventInspector");
640 // Get the analysis manager - should always be there
641 AliAnalysisManager* am = AliAnalysisManager::GetAnalysisManager();
643 AliWarning("No analysis manager defined!");
647 // Get the input handler - should always be there
648 AliInputEventHandler* ih =
649 static_cast<AliInputEventHandler*>(am->GetInputEventHandler());
651 AliWarning("No input handler");
654 AliPhysicsSelection* ps =
655 static_cast<AliPhysicsSelection*>(ih->GetEventSelection());
657 AliWarning("No physics selection");
660 AliOADBPhysicsSelection* oadb =
661 const_cast<AliOADBPhysicsSelection*>(ps->GetOADBPhysicsSelection());
663 AliWarning("No OADB physics selection object");
667 // Check if this is a collision candidate (MB)
668 // Note, that we should use the value cached in the input
669 // handler rather than calling IsCollisionCandiate directly
670 // on the AliPhysicsSelection obejct. If we called the latter
671 // then the AliPhysicsSelection object would overcount by a
673 Bool_t offline = ih->IsEventSelected() ;
674 Bool_t fastonly = (ih->IsEventSelected() & AliVEvent::kFastOnly);
675 TString trigStr = esd->GetFiredTriggerClasses();
677 //If we have the MC input handler, this must be MC
678 Bool_t isMC = am->GetMCtruthEventHandler() != 0;
680 if(fUseDisplacedVertices && isMC) {
681 AliMCEventHandler* mchandler = static_cast<AliMCEventHandler*>(am->GetMCtruthEventHandler());
682 AliMCEvent* mcevent = mchandler->MCEvent();
683 AliHeader* header = mcevent->Header();
684 AliGenEventHeader* genHeader = header->GenEventHeader();
686 genHeader->PrimaryVertex(vertex);
688 Double_t zvtx = vertex.At(2);
689 if(TMath::Abs(zvtx) > 35)
691 else offline = false;
694 if(fUseDisplacedVertices && !isMC) {
695 Double_t zvtx = fDisplacedVertex.CheckDisplacedVertex(esd);
696 if(TMath::Abs(zvtx) < 999) offline = true;
697 else offline = false;
700 // For the 2.76 TeV p+p run, the FMD ran in the slow partition
701 // so it received no triggers from the fast partition. Therefore
702 // the fast triggers are removed here but not for MC where all
703 // triggers are fast.
704 if(TMath::Abs(fEnergy - 2750.) < 20 &&
705 fCollisionSystem == AliForwardUtil::kPP &&
707 if (fastonly) offline = false;
710 // MUON triggers are not strictly minimum bias (MB) so they are removed (HHD)
712 if(offline && trigStr.Contains("CMUS1")) offline = false;
715 triggers |= AliAODForwardMult::kOffline;
716 triggers |= AliAODForwardMult::kInel;
718 AliWarning("Histogram of triggers not defined - has init been called");
721 fHTriggers->Fill(kOffline+0.5);
723 // If this is inel, see if we have a tracklet
724 const AliMultiplicity* spdmult = esd->GetMultiplicity();
726 AliWarning("No SPD multiplicity");
729 // Check if we have one or more tracklets
730 // in the range -1 < eta < 1 to set the INEL>0
733 // Also count tracklets as a single cluster
734 Int_t n = spdmult->GetNumberOfTracklets();
735 for (Int_t j = 0; j < n; j++) {
736 if(TMath::Abs(spdmult->GetEta(j)) < 1) {
737 triggers |= AliAODForwardMult::kInelGt0;
741 n = spdmult->GetNumberOfSingleClusters();
742 for (Int_t j = 0; j < n; j++) {
743 Double_t eta = -TMath::Log(TMath::Tan(spdmult->GetThetaSingle(j)/2.));
744 if (TMath::Abs(eta) < 1) nClusters++;
747 if (nClusters > 0) triggers |= AliAODForwardMult::kNClusterGt0;
750 // Analyse some trigger stuff
751 AliTriggerAnalysis ta;
752 if (ta.IsOfflineTriggerFired(esd, AliTriggerAnalysis::kV0AND)) {
753 triggers |= AliAODForwardMult::kV0AND;
755 triggers |= AliAODForwardMult::kNSD;
757 if (ta.IsOfflineTriggerFired(esd, AliTriggerAnalysis::kNSD1))
758 triggers |= AliAODForwardMult::kNSD;
760 // Check for multiple vertices (pile-up) with at least 3
761 // contributors and at least 0.8cm from the primary vertex
762 Bool_t pileup = kFALSE;
763 if(fCollisionSystem == AliForwardUtil::kPP)
764 pileup = esd->IsPileupFromSPD(fMinPileupContrib,fMinPileupDistance);
766 triggers |= AliAODForwardMult::kPileUp;
767 fHTriggers->Fill(kPileUp+.5);
772 //TString trigStr = esd->GetFiredTriggerClasses();
773 // AliWarning(Form("Fired trigger classes: %s", trigStr.Data()));
774 if (fHWords) fHWords->Fill(trigStr.Data(), 1);
776 if (trigStr.Contains("MB1") || trigStr.Contains("MBBG3"))
777 triggers |= AliAOODForwardMult::kB;
778 if (trigStr.Contains("COTA"))
779 triggers |= AliAODForwardMult::kA;
780 if (trigStr.Contains("COTC"))
781 triggers |= AliAODForwardMult::kC;
783 if (trigStr.Contains("CBEAMB-ABCE-NOPF-ALL")) {
784 triggers |= AliAODForwardMult::kEmpty;
785 fHTriggers->Fill(kEmpty+.5);
788 // Check for B triggers
789 if (trigStr.Contains("CINT1B-ABCE-NOPF-ALL") || // Early pp
790 trigStr.Contains("CINT1-B-NOPF-ALLNOTRD") || // Late pp
791 trigStr.Contains("CINT1-B-NOPF-FASTNOTRD") || // Late pp
792 //trigStr.Contains("CMUS1-B-NOPF-MUON") || // Late pp -- HHD 160811
793 trigStr.Contains("CSMBB-ABCE-NOPF-ALL") || // pp
794 trigStr.Contains("CMBACS2-B-NOPF-ALL") || // PbPb
795 // trigStr.Contains("C0SMH-B-NOPF-ALL") || // PbPb - high mult
796 trigStr.Contains("CMBS2A-B-NOPF-ALL") || // PbPb
797 trigStr.Contains("CMBS2C-B-NOPF-ALL") || // PbPb
798 trigStr.Contains("CMBAC-B-NOPF-ALL") || // PbPb
799 // trigStr.Contains("C0SMH-B-NOPF-ALL") || // PbPb - high mult
800 trigStr.Contains("CMBACS2-B-NOPF-ALLNOTRD") // PbPb
801 // trigStr.Contains("C0SMH-B-NOPF-ALLNOTRD") // PbPb - high mult
803 Bool_t bTrigger = kTRUE;
804 if ( trigStr.Contains("CINT1-B-NOPF-FASTNOTRD") &&
805 !trigStr.Contains("CINT1-B-NOPF-ALLNOTRD") &&
806 TMath::Abs(fEnergy - 2750.) < 20 &&
807 fCollisionSystem == AliForwardUtil::kPP)
810 triggers |= AliAODForwardMult::kB;
811 fHTriggers->Fill(kB+.5);
815 // Check for A triggers
816 if (trigStr.Contains("CINT1A-ABCE-NOPF-ALL") || // Early pp
817 trigStr.Contains("CINT1-AC-NOPF-ALLNOTRD") || // Late pp
818 trigStr.Contains("CINT1-AC-NOPF-FASTNOTRD") || // Late pp
819 (trigStr.Contains("CSMBA-ABCE-NOPF-ALL") &&
820 !(triggers & AliAODForwardMult::kB)) || // pp
821 trigStr.Contains("CMBACS2-A-NOPF-ALL") || // PbPb
822 // trigStr.Contains("C0SMH-A-NOPF-ALL") || // PbPb - high mult
823 trigStr.Contains("CMBS2A-A-NOPF-ALL") || // PbPb
824 trigStr.Contains("CMBS2C-A-NOPF-ALL") || // PbPb
825 trigStr.Contains("CMBAC-A-NOPF-ALL") || // PbPb
826 // trigStr.Contains("C0SMH-A-NOPF-ALL") || // PbPb - high mult
827 trigStr.Contains("CMBACS2-A-NOPF-ALLNOTRD") // PbPb
828 // trigStr.Contains("C0SMH-A-NOPF-ALLNOTRD") // PbPb - high mult
830 triggers |= AliAODForwardMult::kA;
831 fHTriggers->Fill(kA+.5);
834 // Check for C triggers
835 if (trigStr.Contains("CINT1C-ABCE-NOPF-ALL") || // Early pp
836 (trigStr.Contains("CSMBC-ABCE-NOPF-ALL") &&
837 !(triggers & AliAODForwardMult::kB)) || // pp
838 trigStr.Contains("CMBACS2-C-NOPF-ALL") || // PbPb
839 // trigStr.Contains("C0SMH-B-NOPF-ALL") || // PbPb - high mult
840 trigStr.Contains("CMBS2A-C-NOPF-ALL") || // PbPb
841 trigStr.Contains("CMBS2C-C-NOPF-ALL") || // PbPb
842 trigStr.Contains("CMBAC-C-NOPF-ALL") || // PbPb
843 // trigStr.Contains("C0SMH-B-NOPF-ALL") || // PbPb - high mult
844 trigStr.Contains("CMBACS2-C-NOPF-ALLNOTRD") // PbPb
845 // trigStr.Contains("C0SMH-B-NOPF-ALLNOTRD") // PbPb - high mult
847 triggers |= AliAODForwardMult::kC;
848 fHTriggers->Fill(kC+.5);
851 // Check for E triggers
852 if (trigStr.Contains("CINT1-E-NOPF-ALL") || // Early pp
853 trigStr.Contains("CINT1-E-NOPF-ALLNOTRD") || // Late pp
854 trigStr.Contains("CINT1-E-NOPF-FASTNOTRD") || // Late pp
855 trigStr.Contains("CMBACS2-E-NOPF-ALL") || // PbPb
856 // trigStr.Contains("C0SMH-B-NOPF-ALL") || // PbPb - high mult
857 trigStr.Contains("CMBS2A-E-NOPF-ALL") || // PbPb
858 trigStr.Contains("CMBS2C-E-NOPF-ALL") || // PbPb
859 trigStr.Contains("CMBAC-E-NOPF-ALL") || // PbPb
860 // trigStr.Contains("C0SMH-B-NOPF-ALL") || // PbPb - high mult
861 trigStr.Contains("CMBACS2-E-NOPF-ALLNOTRD") // PbPb
862 // trigStr.Contains("C0SMH-B-NOPF-ALLNOTRD") // PbPb - high mult
864 triggers |= AliAODForwardMult::kE;
865 fHTriggers->Fill(kE+.5);
869 const TList* collTriggClasses = ps->GetCollisionTriggerClasses();
870 const TList* bgTriggClasses = ps->GetBGTriggerClasses();
872 TIter nextColl(collTriggClasses);
873 TObjString* oadbString = 0;
874 TObjArray* tokens = 0;
875 while ((oadbString = static_cast<TObjString*>(nextColl()))) {
876 tokens = oadbString->String().Tokenize(" ");
877 for (Int_t i = 0; i < tokens->GetEntries(); i++) {
878 TString string = (((TObjString*)tokens->At(i))->String());
879 if (string[0] != '+') continue;
881 if (trigStr.Contains(string.Data())) {
882 TString beamSide = oadb->GetBeamSide(oadbString->String().Data());
883 if (beamSide.EqualTo("B")) {
884 triggers |= AliAODForwardMult::kB;
885 fHTriggers->Fill(kB+.5);
890 TIter nextBG(bgTriggClasses);
891 while ((oadbString = static_cast<TObjString*>(nextBG()))) {
892 tokens = oadbString->String().Tokenize(" ");
893 for (Int_t i = 0; i < tokens->GetEntries(); i++) {
894 TString string = (((TObjString*)tokens->At(i))->String());
895 if (string[0] != '+') continue;
897 if (trigStr.Contains(string.Data())) {
898 TString beamSide = oadb->GetBeamSide(oadbString->String().Data());
899 if (beamSide.Contains("A")) {
900 triggers |= AliAODForwardMult::kA;
901 fHTriggers->Fill(kA+.5);
903 if (beamSide.Contains("C")) {
904 triggers |= AliAODForwardMult::kC;
905 fHTriggers->Fill(kC+.5);
907 if (beamSide.Contains("E")) {
908 triggers |= AliAODForwardMult::kE;
909 fHTriggers->Fill(kE+.5);
915 // Now check - if we have a collision - for offline triggers and
917 if (triggers & AliAODForwardMult::kB) {
918 if (triggers & AliAODForwardMult::kInel)
919 fHTriggers->Fill(kInel);
921 if (triggers & AliAODForwardMult::kInelGt0)
922 fHTriggers->Fill(kInelGt0+.5);
924 if (triggers & AliAODForwardMult::kNSD)
925 fHTriggers->Fill(kNSD+.5);
927 if (triggers & AliAODForwardMult::kV0AND)
928 fHTriggers->Fill(kV0AND+.5);
933 //____________________________________________________________________
935 AliFMDEventInspector::ReadVertex(const AliESDEvent* esd,
941 // Read the vertex information from the ESD event
945 // vz On return, the vertex Z position
948 // @c true on success, @c false otherwise
950 DGUARD(fDebug,2,"Read the vertex in AliFMDEventInspector");
955 AliAnalysisManager* am = AliAnalysisManager::GetAnalysisManager();
956 Bool_t isMC = am->GetMCtruthEventHandler() != 0;
957 if(fUseDisplacedVertices && isMC) {
959 AliMCEventHandler* mchandler = static_cast<AliMCEventHandler*>(am->GetMCtruthEventHandler());
960 AliMCEvent* mcevent = mchandler->MCEvent();
961 AliHeader* header = mcevent->Header();
962 AliGenEventHeader* genHeader = header->GenEventHeader();
964 genHeader->PrimaryVertex(vertex);
966 Double_t zvtx = vertex.At(2);
967 Double_t ratio = zvtx/37.5;
968 if(ratio > 0) ratio = ratio + 0.5;
969 if(ratio < 0) ratio = ratio - 0.5;
970 Int_t ratioInt = (Int_t)ratio;
971 zvtx = 37.5*((Double_t)ratioInt);
972 if(TMath::Abs(zvtx) < 999) {
979 if(fUseDisplacedVertices && !isMC) {
980 Double_t zvtx = fDisplacedVertex.CheckDisplacedVertex(esd);
982 if(TMath::Abs(zvtx) < 999) {
989 if(fUseFirstPhysicsVertex) {
990 // This is the code used by the 1st physics people
991 const AliESDVertex* vertex = esd->GetPrimaryVertex();
992 if (!vertex || !vertex->GetStatus()) {
994 AliWarning(Form("No primary vertex (%p) or bad status %d",
995 vertex, (vertex ? vertex->GetStatus() : -1)));
999 const AliESDVertex* vertexSPD = esd->GetPrimaryVertexSPD();
1000 if (!vertexSPD || !vertexSPD->GetStatus()) {
1002 AliWarning(Form("No primary SPD vertex (%p) or bad status %d",
1003 vertexSPD, (vertexSPD ? vertexSPD->GetStatus() : -1)));
1008 // if vertex is from SPD vertexZ, require more stringent cuts
1009 if (vertex->IsFromVertexerZ()) {
1010 if (vertex->GetDispersion() > fMaxVzErr ||
1011 vertex->GetZRes() > 1.25 * fMaxVzErr) {
1013 AliWarning(Form("Dispersion %f > %f or resolution %f > %f",
1014 vertex->GetDispersion(), fMaxVzErr,
1015 vertex->GetZRes(), 1.25 * fMaxVzErr));
1020 vz = vertex->GetZ();
1022 if(!vertex->IsFromVertexerZ()) {
1023 vx = vertex->GetX();
1024 vy = vertex->GetY();
1028 else { //Use standard SPD vertex (perhaps preferable for Pb+Pb)
1031 const AliESDVertex* vertex = esd->GetPrimaryVertexSPD();
1034 AliWarning("No SPD vertex found in ESD"); }
1038 // Check that enough tracklets contributed
1039 if(vertex->GetNContributors() <= 0) {
1041 AliWarning(Form("Number of contributors to vertex is %d<=0",
1042 vertex->GetNContributors())); }
1046 // Check that the uncertainty isn't too large
1047 if (vertex->GetZRes() > fMaxVzErr) {
1049 AliWarning(Form("Uncertaintity in Z of vertex is too large %f > %f",
1050 vertex->GetZRes(), fMaxVzErr)); }
1054 // Get the z coordiante
1055 vz = vertex->GetZ();
1056 const AliESDVertex* vertexXY = esd->GetPrimaryVertex();
1058 if(!vertexXY->IsFromVertexerZ()) {
1059 vx = vertexXY->GetX();
1060 vy = vertexXY->GetY();
1066 //____________________________________________________________________
1068 AliFMDEventInspector::ReadRunDetails(const AliESDEvent* esd)
1071 // Read the collision system, collision energy, and L3 field setting
1075 // esd ESD to get information from
1078 // true on success, false
1080 // AliInfo(Form("Parameters from 1st ESD event: cms=%s, sNN=%f, field=%f",
1081 // esd->GetBeamType(), 2*esd->GetBeamEnergy(),
1082 // esd->GetMagneticField()));
1083 DGUARD(fDebug,2,"Read the run details in AliFMDEventInspector");
1085 AliForwardUtil::ParseCollisionSystem(esd->GetBeamType());
1087 AliForwardUtil::ParseCenterOfMassEnergy(fCollisionSystem,
1088 2 * esd->GetBeamEnergy());
1090 AliForwardUtil::ParseMagneticField(esd->GetMagneticField());
1092 StoreInformation(esd->GetRunNumber());
1093 if (fCollisionSystem == AliForwardUtil::kUnknown ||
1095 TMath::Abs(fField) > 10)
1101 //____________________________________________________________________
1103 AliFMDEventInspector::Print(Option_t*) const
1106 // Print information
1110 char ind[gROOT->GetDirLevel()+1];
1111 for (Int_t i = 0; i < gROOT->GetDirLevel(); i++) ind[i] = ' ';
1112 ind[gROOT->GetDirLevel()] = '\0';
1113 TString sNN(AliForwardUtil::CenterOfMassEnergyString(fEnergy));
1114 sNN.Strip(TString::kBoth, '0');
1115 sNN.ReplaceAll("GeV", " GeV");
1116 TString field(AliForwardUtil::MagneticFieldString(fField));
1117 field.ReplaceAll("p", "+");
1118 field.ReplaceAll("m", "-");
1119 field.ReplaceAll("kG", " kG");
1121 std::cout << ind << ClassName() << ": " << GetName() << '\n'
1122 << ind << " Vertex bins: " << fVtxAxis.GetNbins() << '\n'
1123 << ind << " Vertex range: [" << fVtxAxis.GetXmin()
1124 << "," << fVtxAxis.GetXmax() << "]\n"
1125 << ind << " Low flux cut: " << fLowFluxCut << '\n'
1126 << ind << " Max(delta v_z): " << fMaxVzErr << " cm\n"
1127 << ind << " Min(nContrib_pileup): " << fMinPileupContrib << '\n'
1128 << ind << " Min(v-pileup): " << fMinPileupDistance << '\n'
1129 << ind << " System: "
1130 << AliForwardUtil::CollisionSystemString(fCollisionSystem) << '\n'
1131 << ind << " CMS energy per nucleon: " << sNN << '\n'
1132 << ind << " Field: " << field << '\n';
1133 if (!fCentAxis) { std::cout << std::flush; return; }
1134 Int_t nBin = fCentAxis->GetNbins();
1135 std::cout << ind << " Centrality axis: " << nBin << " bins"
1137 for (Int_t i = 0; i < nBin; i++) {
1138 if ((i % 10) == 0) std::cout << '\n' << ind << " ";
1139 std::cout << std::setw(5) << fCentAxis->GetBinLowEdge(i+1) << '-';
1141 std::cout << std::setw(5) << fCentAxis->GetBinUpEdge(nBin) << std::endl;