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"
41 #include "AliVVZERO.h"
43 //====================================================================
44 AliFMDEventInspector::AliFMDEventInspector()
49 fHEventsAcceptedXY(0),
61 fCollisionSystem(kUnknown),
65 fUseFirstPhysicsVertex(true),
68 fMinPileupDistance(0.8),
69 fUseDisplacedVertices(false),
77 DGUARD(fDebug,1,"Default CTOR of AliFMDEventInspector");
80 //____________________________________________________________________
81 AliFMDEventInspector::AliFMDEventInspector(const char* name)
82 : TNamed("fmdEventInspector", name),
86 fHEventsAcceptedXY(0),
98 fCollisionSystem(kUnknown),
102 fUseFirstPhysicsVertex(true),
104 fMinPileupContrib(3),
105 fMinPileupDistance(0.8),
106 fUseDisplacedVertices(false),
115 // name Name of object
117 DGUARD(fDebug,1,"Named CTOR of AliFMDEventInspector: %s", name);
120 //____________________________________________________________________
121 AliFMDEventInspector::AliFMDEventInspector(const AliFMDEventInspector& o)
123 fHEventsTr(o.fHEventsTr),
124 fHEventsTrVtx(o.fHEventsTrVtx),
125 fHEventsAccepted(o.fHEventsAccepted),
126 fHEventsAcceptedXY(o.fHEventsAcceptedXY),
127 fHTriggers(o.fHTriggers),
131 fHCentVsQual(o.fHCentVsQual),
132 fHStatus(o.fHStatus),
133 fLowFluxCut(o.fLowFluxCut),
134 fMaxVzErr(o.fMaxVzErr),
138 fCollisionSystem(o.fCollisionSystem),
141 fVtxAxis(o.fVtxAxis),
142 fUseFirstPhysicsVertex(o.fUseFirstPhysicsVertex),
143 fUseV0AND(o.fUseV0AND),
144 fMinPileupContrib(o.fMinPileupContrib),
145 fMinPileupDistance(o.fMinPileupDistance),
146 fUseDisplacedVertices(o.fUseDisplacedVertices),
147 fDisplacedVertex(o.fDisplacedVertex),
155 // o Object to copy from
157 DGUARD(fDebug,1,"Copy CTOR of AliFMDEventInspector");
160 //____________________________________________________________________
161 AliFMDEventInspector::~AliFMDEventInspector()
166 DGUARD(fDebug,1,"DTOR of AliFMDEventInspector");
167 // if (fList) delete fList;
169 //____________________________________________________________________
170 AliFMDEventInspector&
171 AliFMDEventInspector::operator=(const AliFMDEventInspector& o)
174 // Assignement operator
177 // o Object to assign from
180 // Reference to this object
182 DGUARD(fDebug,3,"Assignment of AliFMDEventInspector");
183 if (&o == this) return *this;
184 TNamed::operator=(o);
185 fHEventsTr = o.fHEventsTr;
186 fHEventsTrVtx = o.fHEventsTrVtx;
187 fHEventsAccepted = o.fHEventsAccepted;
188 fHEventsAcceptedXY = o.fHEventsAcceptedXY;
189 fHTriggers = o.fHTriggers;
193 fHCentVsQual = o.fHCentVsQual;
194 fHStatus = o.fHStatus;
195 fLowFluxCut = o.fLowFluxCut;
196 fMaxVzErr = o.fMaxVzErr;
198 fList = (o.fList ? new TList : 0);
201 fCollisionSystem = o.fCollisionSystem;
202 fVtxAxis.Set(o.fVtxAxis.GetNbins(), o.fVtxAxis.GetXmin(),
203 o.fVtxAxis.GetXmax());
205 fUseFirstPhysicsVertex = o.fUseFirstPhysicsVertex;
206 fUseV0AND = o.fUseV0AND;
207 fMinPileupContrib = o.fMinPileupContrib;
208 fMinPileupDistance = o.fMinPileupDistance;
209 fUseDisplacedVertices = o.fUseDisplacedVertices;
210 fDisplacedVertex = o.fDisplacedVertex;
212 fList->SetName(GetName());
213 if (fHEventsTr) fList->Add(fHEventsTr);
214 if (fHEventsTrVtx) fList->Add(fHEventsTrVtx);
215 if (fHTriggers) fList->Add(fHTriggers);
216 if (fHType) fList->Add(fHType);
217 if (fHWords) fList->Add(fHWords);
218 if (fHCent) fList->Add(fHCent);
219 if (fHCentVsQual) fList->Add(fHCentVsQual);
220 if (fHStatus) fList->Add(fHStatus);
225 //____________________________________________________________________
227 AliFMDEventInspector::FetchHistograms(const TList* d,
230 TH1I*& hTriggers) const
233 // Fetch our histograms from the passed list
237 // hEventsTr On return, pointer to histogram, or null
238 // hEventsTrVtx On return, pointer to histogram, or null
239 // hTriggers On return, pointer to histogram, or null
242 // true on success, false otherwise
244 DGUARD(fDebug,3,"Fetch histograms in AliFMDEventInspector");
248 TList* dd = dynamic_cast<TList*>(d->FindObject(GetName()));
249 if (!dd) return kFALSE;
251 hEventsTr = dynamic_cast<TH1I*>(dd->FindObject("nEventsTr"));
252 hEventsTrVtx = dynamic_cast<TH1I*>(dd->FindObject("nEventsTrVtx"));
253 hTriggers = dynamic_cast<TH1I*>(dd->FindObject("triggers"));
255 if (!hEventsTr || !hEventsTrVtx || !hTriggers) return kFALSE;
258 //____________________________________________________________________
260 AliFMDEventInspector::CacheConfiguredTriggerClasses(TList& cache,
261 const TList* classes,
262 AliOADBPhysicsSelection* o)
264 TIter nextClass(classes);
265 TObjString* trigClass = 0;
266 // Loop over all trigger classes. Trigger classes have the format
268 // class := positive_words SPACE(s) negative_words
276 while ((trigClass = static_cast<TObjString*>(nextClass()))) {
277 // Tokenize on space to get positive and negative parts
278 TString side = o->GetBeamSide(trigClass->String());
279 TObjArray* parts = trigClass->String().Tokenize(" ");
280 TObjString* part = 0;
281 TIter nextPart(parts);
282 while ((part = static_cast<TObjString*>(nextPart()))) {
283 // We only care about the positive ones
284 if (part->GetName()[0] != '+') continue;
285 part->String().Remove(0,1);
287 // Tokenize on a comma to get the words
288 TObjArray* words = part->String().Tokenize(",");
289 TObjString* word = 0;
290 TIter nextWord(words);
291 while ((word = static_cast<TObjString*>(nextWord()))) {
292 TNamed* store = new TNamed(word->String(), side);
294 DMSG(fDebug,3,"Caching %s trigger word %s",
295 store->GetTitle(), store->GetName());
303 //____________________________________________________________________
305 AliFMDEventInspector::Init(const TAxis& vtxAxis)
308 // Initialize the object - this is called on the first seen event.
311 // vtxAxis Vertex axis in use
313 DGUARD(fDebug,1,"Initialize in AliFMDEventInspector");
315 AliAnalysisManager* am = AliAnalysisManager::GetAnalysisManager();
317 // Get the input handler - should always be there
318 AliInputEventHandler* ih =
319 static_cast<AliInputEventHandler*>(am->GetInputEventHandler());
321 AliWarning("No input handler");
324 // Get the physics selection - should always be there
325 AliPhysicsSelection* ps =
326 static_cast<AliPhysicsSelection*>(ih->GetEventSelection());
328 AliWarning("No physics selection");
331 // Get the configured triggers
332 AliOADBPhysicsSelection* oadb =
333 const_cast<AliOADBPhysicsSelection*>(ps->GetOADBPhysicsSelection());
335 AliWarning("No OADB physics selection object");
338 // Get the configured trigger words from the physics selection
339 const TList* collTriggClasses = ps->GetCollisionTriggerClasses();
340 const TList* bgTriggClasses = ps->GetBGTriggerClasses();
341 if (!collTriggClasses) {
342 AliWarning("No configured collision trigger classes");
345 if (!bgTriggClasses) {
346 AliWarning("No configured background trigger classes");
349 CacheConfiguredTriggerClasses(fCollWords, collTriggClasses, oadb);
350 CacheConfiguredTriggerClasses(fBgWords, bgTriggClasses, oadb);
355 // -1.5 -0.5 0.5 1.5 ... 89.5 ... 100.5
356 // ----- 92 number --------- ---- 1 ---
358 for (Int_t i = 0; i < 92; i++) limits[i] = -1.5 + i;
361 fVtxAxis.Set(vtxAxis.GetNbins(), vtxAxis.GetXmin(), vtxAxis.GetXmax());
363 fCentAxis = new TAxis(limits.GetSize()-1, limits.GetArray());
364 fHEventsTr = new TH1I("nEventsTr", "Number of events w/trigger",
365 4*vtxAxis.GetNbins(),
367 2*vtxAxis.GetXmax());
368 fHEventsTr->SetXTitle("v_{z} [cm]");
369 fHEventsTr->SetYTitle("# of events");
370 fHEventsTr->SetFillColor(kRed+1);
371 fHEventsTr->SetFillStyle(3001);
372 fHEventsTr->SetDirectory(0);
373 // fHEventsTr->Sumw2();
374 fList->Add(fHEventsTr);
376 fHEventsTrVtx = static_cast<TH1I*>(fHEventsTr->Clone("nEventsTrVtx"));
377 fHEventsTrVtx->SetTitle("Number of events w/trigger and vertex");
378 fHEventsTrVtx->SetFillColor(kBlue+1);
379 fHEventsTrVtx->SetDirectory(0);
380 // fHEventsTrVtx->Sumw2();
381 fList->Add(fHEventsTrVtx);
383 fHEventsAccepted = new TH1I("nEventsAccepted",
384 "Number of events w/trigger and vertex in range",
385 2*vtxAxis.GetNbins(),
387 2*vtxAxis.GetXmax());
388 fHEventsAccepted->SetXTitle("v_{z} [cm]");
389 fHEventsAccepted->SetYTitle("# of events");
390 fHEventsAccepted->SetFillColor(kGreen+1);
391 fHEventsAccepted->SetFillStyle(3001);
392 fHEventsAccepted->SetDirectory(0);
393 // fHEventsAccepted->Sumw2();
394 fList->Add(fHEventsAccepted);
396 fHEventsAcceptedXY = new TH2D("nEventsAcceptedXY",
397 "XY vertex w/trigger and Z vertex in range",
398 1000,-1,1,1000,-1,1);
400 fHEventsAcceptedXY->SetXTitle("v_{x} [cm]");
401 fHEventsAcceptedXY->SetYTitle("v_{y} [cm]");
402 fHEventsAcceptedXY->SetDirectory(0);
403 // fHEventsAccepted->Sumw2();
404 fList->Add(fHEventsAcceptedXY);
407 fHTriggers = new TH1I("triggers", "Triggers", kOffline+1, 0, kOffline+1);
408 fHTriggers->SetFillColor(kRed+1);
409 fHTriggers->SetFillStyle(3001);
410 fHTriggers->SetStats(0);
411 fHTriggers->SetDirectory(0);
412 fHTriggers->GetXaxis()->SetBinLabel(kInel +1,"INEL");
413 fHTriggers->GetXaxis()->SetBinLabel(kInelGt0+1,"INEL>0");
414 fHTriggers->GetXaxis()->SetBinLabel(kNSD +1,"NSD");
415 fHTriggers->GetXaxis()->SetBinLabel(kV0AND +1,"VOAND");
416 fHTriggers->GetXaxis()->SetBinLabel(kEmpty +1,"Empty");
417 fHTriggers->GetXaxis()->SetBinLabel(kA +1,"A");
418 fHTriggers->GetXaxis()->SetBinLabel(kB +1,"B");
419 fHTriggers->GetXaxis()->SetBinLabel(kC +1,"C");
420 fHTriggers->GetXaxis()->SetBinLabel(kE +1,"E");
421 fHTriggers->GetXaxis()->SetBinLabel(kPileUp +1,"Pileup");
422 fHTriggers->GetXaxis()->SetBinLabel(kMCNSD +1,"NSD_{MC}");
423 fHTriggers->GetXaxis()->SetBinLabel(kOffline+1,"Offline");
424 fList->Add(fHTriggers);
426 fHType = new TH1I("type", Form("Event type (cut: SPD mult>%d)",
427 fLowFluxCut), 2, -.5, 1.5);
428 fHType->SetFillColor(kRed+1);
429 fHType->SetFillStyle(3001);
431 fHType->SetDirectory(0);
432 fHType->GetXaxis()->SetBinLabel(1,"Low-flux");
433 fHType->GetXaxis()->SetBinLabel(2,"High-flux");
437 // This histogram disabled as it causes problems in the merge
438 fHWords = new TH1I("words", "Trigger words seen", 1, 0, 0);
439 fHWords->SetFillColor(kBlue+1);
440 fHWords->SetFillStyle(3001);
441 fHWords->SetStats(0);
442 fHWords->SetDirectory(0);
443 fHWords->SetBit(TH1::kCanRebin);
447 fHCent = new TH1F("cent", "Centrality", limits.GetSize()-1,limits.GetArray());
448 fHCent->SetFillColor(kBlue+1);
449 fHCent->SetFillStyle(3001);
451 fHCent->SetDirectory(0);
452 fHCent->SetXTitle("Centrality [%]");
453 fHCent->SetYTitle("Events");
456 fHCentVsQual = new TH2F("centVsQuality", "Quality vs Centrality",
457 5, 0, 5, limits.GetSize()-1, limits.GetArray());
458 fHCentVsQual->SetXTitle("Quality");
459 fHCentVsQual->SetYTitle("Centrality [%]");
460 fHCentVsQual->SetZTitle("Events");
461 fHCentVsQual->GetXaxis()->SetBinLabel(1, "OK");
462 fHCentVsQual->GetXaxis()->SetBinLabel(2, "Outside v_{z} cut");
463 fHCentVsQual->GetXaxis()->SetBinLabel(3, "V0 vs SPD outlier");
464 fHCentVsQual->GetXaxis()->SetBinLabel(4, "V0 vs TPC outlier");
465 fHCentVsQual->GetXaxis()->SetBinLabel(5, "V0 vs ZDC outlier");
466 fList->Add(fHCentVsQual);
468 fHStatus = new TH1I("status", "Status", 7, 1, 8);
469 fHStatus->SetFillColor(kRed+1);
470 fHStatus->SetFillStyle(3001);
471 fHStatus->SetStats(0);
472 fHStatus->SetDirectory(0);
473 fHStatus->GetXaxis()->SetBinLabel(1, "OK");
474 fHStatus->GetXaxis()->SetBinLabel(2, "No event");
475 fHStatus->GetXaxis()->SetBinLabel(3, "No triggers");
476 fHStatus->GetXaxis()->SetBinLabel(4, "No SPD");
477 fHStatus->GetXaxis()->SetBinLabel(5, "No FMD");
478 fHStatus->GetXaxis()->SetBinLabel(6, "No vertex");
479 fHStatus->GetXaxis()->SetBinLabel(7, "Bad vertex");
480 fList->Add(fHStatus);
483 //____________________________________________________________________
485 AliFMDEventInspector::StoreInformation(Int_t runNo)
487 // Write TNamed objects to output list containing information about
488 // the running conditions
489 DGUARD(fDebug,2,"Store information from AliFMDEventInspector");
493 fList->Add(AliForwardUtil::MakeParameter("sys", fCollisionSystem));
494 fList->Add(AliForwardUtil::MakeParameter("sNN", fEnergy));
495 fList->Add(AliForwardUtil::MakeParameter("field", fField));
496 fList->Add(AliForwardUtil::MakeParameter("runNo", runNo));
497 fList->Add(AliForwardUtil::MakeParameter("lowFlux", fLowFluxCut));
498 fList->Add(AliForwardUtil::MakeParameter("fpVtx",fUseFirstPhysicsVertex));
499 fList->Add(AliForwardUtil::MakeParameter("v0and",fUseV0AND));
500 fList->Add(AliForwardUtil::MakeParameter("nPileUp", fMinPileupContrib));
501 fList->Add(AliForwardUtil::MakeParameter("dPileup", fMinPileupDistance));
504 //____________________________________________________________________
506 AliFMDEventInspector::DefineOutput(TList* dir)
509 // Define the output histograms. These are put in a sub list of the
510 // passed list. The histograms are merged before the parent task calls
511 // AliAnalysisTaskSE::Terminate
513 // dir Directory to add to
515 DGUARD(fDebug,1,"Define output from AliFMDEventInspector");
517 fList->SetName(GetName());
522 //____________________________________________________________________
524 AliFMDEventInspector::Process(const AliESDEvent* event,
537 // triggers On return, the triggers fired
538 // lowFlux On return, true if the event is considered a low-flux
539 // event (according to the setting of fLowFluxCut)
540 // ivz On return, the found vertex bin (1-based). A zero
541 // means outside of the defined vertex range
542 // vz On return, the z position of the interaction
543 // cent On return, the centrality - if not available < 0
546 // 0 (or kOk) on success, otherwise a bit mask of error codes
548 DGUARD(fDebug,1,"Process event in AliFMDEventInspector");
550 // --- Check that we have an event ---------------------------------
552 AliWarning("No ESD event found for input event");
557 // --- Read trigger information from the ESD and store in AOD object
558 if (!ReadTriggers(*event, triggers, nClusters)) {
560 AliWarning("Failed to read triggers from ESD"); }
565 // --- Check if this is a high-flux event --------------------------
566 const AliMultiplicity* testmult = event->GetMultiplicity();
569 AliWarning("No central multiplicity object found"); }
572 lowFlux = testmult->GetNumberOfTracklets() < fLowFluxCut;
574 fHType->Fill(lowFlux ? 0 : 1);
576 // --- Process satellite event information is requested ------------
577 if (fUseDisplacedVertices) {
578 if (!fDisplacedVertex.Process(event))
579 AliWarning("Failed to process satellite event");
582 // --- Read centrality information
585 if (!ReadCentrality(*event, cent, qual)) {
587 AliWarning("Failed to get centrality");
590 if (qual == 0) fHCentVsQual->Fill(0., cent);
592 for (UShort_t i = 0; i < 4; i++)
593 if (qual & (1 << i)) fHCentVsQual->Fill(Double_t(i+1), cent);
596 // --- Get the vertex information ----------------------------------
601 Bool_t vzOk = ReadVertex(*event, vz,vx,vy);
603 fHEventsTr->Fill(vz);
606 AliWarning("Failed to read vertex from ESD"); }
610 fHEventsTrVtx->Fill(vz);
612 // --- Get the vertex bin ------------------------------------------
613 ivz = fVtxAxis.FindBin(vz);
614 if (ivz <= 0 || ivz > fVtxAxis.GetNbins()) {
616 AliWarning(Form("Vertex @ %f outside of range [%f,%f]",
617 vz, fVtxAxis.GetXmin(), fVtxAxis.GetXmax()));
623 fHEventsAccepted->Fill(vz);
624 fHEventsAcceptedXY->Fill(vx,vy);
626 // --- Check the FMD ESD data --------------------------------------
627 if (!event->GetFMDData()) {
629 AliWarning("No FMD data found in ESD"); }
638 //____________________________________________________________________
640 AliFMDEventInspector::ReadCentrality(const AliESDEvent& esd,
642 UShort_t& qual) const
645 // Read centrality from event
649 // cent On return, the centrality or negative if not found
652 // False on error, true otherwise
654 DGUARD(fDebug,2,"Read the centrality in AliFMDEventInspector");
656 if(fUseDisplacedVertices) {
657 Double_t zvtx = fDisplacedVertex.GetVertexZ();
659 if(TMath::Abs(zvtx) < 999) {
660 cent = fDisplacedVertex.GetCentralityPercentile();
668 AliCentrality* centObj = const_cast<AliESDEvent&>(esd).GetCentrality();
669 if (!centObj) return true;
671 cent = centObj->GetCentralityPercentile("V0M");
672 qual = centObj->GetQuality();
677 //____________________________________________________________________
679 AliFMDEventInspector::CheckpAExtraV0(const AliESDEvent& esd) const
681 if (fCollisionSystem != AliForwardUtil::kPPb) return true;
683 AliVVZERO* esdV0 = esd.GetVZEROData();
684 if ((esdV0->GetV0ADecision()!=1) || (esdV0->GetV0CDecision()!=1))
689 //____________________________________________________________________
691 AliFMDEventInspector::ReadTriggers(const AliESDEvent& esd, UInt_t& triggers,
695 // Read the trigger information from the ESD event
699 // triggers On return, contains the trigger bits
702 // @c true on success, @c false otherwise
704 DGUARD(fDebug,2,"Read the triggers in AliFMDEventInspector");
707 // Get the analysis manager - should always be there
708 AliAnalysisManager* am = AliAnalysisManager::GetAnalysisManager();
709 DMSG(fDebug,10,"Got analysis manager %p", am);
711 AliWarning("No analysis manager defined!");
715 // Get the input handler - should always be there
716 AliInputEventHandler* ih =
717 static_cast<AliInputEventHandler*>(am->GetInputEventHandler());
718 DMSG(fDebug,10,"Got input handler %p", ih);
720 AliWarning("No input handler");
724 // Check if this is a collision candidate (MB)
725 // Note, that we should use the value cached in the input
726 // handler rather than calling IsCollisionCandiate directly
727 // on the AliPhysicsSelection obejct. If we called the latter
728 // then the AliPhysicsSelection object would overcount by a
730 Bool_t offline = ih->IsEventSelected();
731 Bool_t fastonly = (ih->IsEventSelected() & AliVEvent::kFastOnly);
732 TString trigStr = esd.GetFiredTriggerClasses();
734 if (fHWords) fHWords->Fill(trigStr.Data(), 1);
736 if(fUseDisplacedVertices) {
737 DMSG(fDebug,3,"Using displaced vertex stuff");
738 if (TMath::Abs(fDisplacedVertex.GetVertexZ()) >= 999) offline = false;
741 if (CheckFastPartition(fastonly)) offline = false;
742 if (offline && CheckCosmics(trigStr)) offline = false;
743 // if (!CheckpAExtraV0(esd)) offline = false;
745 DMSG(fDebug,2,"Event is %striggered by off-line", offline ? "" : "NOT ");
748 triggers |= AliAODForwardMult::kOffline;
749 triggers |= AliAODForwardMult::kInel;
751 AliWarning("Histogram of triggers not defined - has init been called");
754 fHTriggers->Fill(kOffline+0.5);
756 CheckINELGT0(esd, nClusters, triggers);
759 CheckNSD(esd,triggers);
760 if (CheckPileup(esd, triggers)) fHTriggers->Fill(kPileUp+.5);
761 if (CheckEmpty(trigStr, triggers)) fHTriggers->Fill(kEmpty+.5);
763 CheckWords(esd, triggers);
765 // Now check - if we have a collision - for offline triggers and
767 if (triggers & AliAODForwardMult::kB) {
768 fHTriggers->Fill(kB+.5);
769 if (triggers & AliAODForwardMult::kInel)
770 fHTriggers->Fill(kInel);
772 if (triggers & AliAODForwardMult::kInelGt0)
773 fHTriggers->Fill(kInelGt0+.5);
775 if (triggers & AliAODForwardMult::kNSD)
776 fHTriggers->Fill(kNSD+.5);
778 if (triggers & AliAODForwardMult::kV0AND)
779 fHTriggers->Fill(kV0AND+.5);
781 if (triggers & AliAODForwardMult::kA) fHTriggers->Fill(kA+.5);
782 if (triggers & AliAODForwardMult::kC) fHTriggers->Fill(kC+.5);
783 if (triggers & AliAODForwardMult::kE) fHTriggers->Fill(kE+.5);
788 //____________________________________________________________________
790 AliFMDEventInspector::CheckFastPartition(bool fastonly) const
792 // For the 2.76 TeV p+p run, the FMD ran in the slow partition
793 // so it received no triggers from the fast partition. Therefore
794 // the fast triggers are removed here but not for MC where all
795 // triggers are fast.
796 if (TMath::Abs(fEnergy - 2750.) > 20) return false;
797 if (fCollisionSystem != AliForwardUtil::kPP) return false;
799 DMSG(fDebug,1,"Fast trigger in pp @ sqrt(s)=2.76TeV removed");
804 //____________________________________________________________________
806 AliFMDEventInspector::CheckCosmics(const TString& trigStr) const
808 // MUON triggers are not strictly minimum bias (MB) so they are
810 if(trigStr.Contains("CMUS1")) {
811 DMSG(fDebug,1,"Cosmic trigger ins't min-bias, removed");
817 //____________________________________________________________________
819 AliFMDEventInspector::CheckINELGT0(const AliESDEvent& esd,
821 UInt_t& triggers) const
825 // If this is inel, see if we have a tracklet
826 const AliMultiplicity* spdmult = esd.GetMultiplicity();
828 AliWarning("No SPD multiplicity");
832 // Check if we have one or more tracklets
833 // in the range -1 < eta < 1 to set the INEL>0
836 // Also count tracklets as a single cluster
837 Int_t n = spdmult->GetNumberOfTracklets();
838 for (Int_t j = 0; j < n; j++) {
839 if(TMath::Abs(spdmult->GetEta(j)) < 1) {
840 triggers |= AliAODForwardMult::kInelGt0;
844 n = spdmult->GetNumberOfSingleClusters();
845 for (Int_t j = 0; j < n; j++) {
846 Double_t eta = -TMath::Log(TMath::Tan(spdmult->GetThetaSingle(j)/2.));
847 if (TMath::Abs(eta) < 1) nClusters++;
849 if (nClusters > 0) triggers |= AliAODForwardMult::kNClusterGt0;
851 return triggers & AliAODForwardMult::kNClusterGt0;
854 //____________________________________________________________________
856 AliFMDEventInspector::CheckNSD(const AliESDEvent& esd, UInt_t& triggers) const
858 // Analyse some trigger stuff
859 AliTriggerAnalysis ta;
860 if (ta.IsOfflineTriggerFired(&esd, AliTriggerAnalysis::kV0AND)) {
861 triggers |= AliAODForwardMult::kV0AND;
863 triggers |= AliAODForwardMult::kNSD;
865 if (ta.IsOfflineTriggerFired(&esd, AliTriggerAnalysis::kNSD1))
866 triggers |= AliAODForwardMult::kNSD;
867 return triggers & AliAODForwardMult::kNSD;
869 //____________________________________________________________________
871 AliFMDEventInspector::CheckPileup(const AliESDEvent& esd,
872 UInt_t& triggers) const
874 // Check for multiple vertices (pile-up) with at least 3
875 // contributors and at least 0.8cm from the primary vertex
876 if(fCollisionSystem != AliForwardUtil::kPP) return false;
878 Bool_t pileup = esd.IsPileupFromSPD(fMinPileupContrib,fMinPileupDistance);
879 if (pileup) triggers |= AliAODForwardMult::kPileUp;
883 //____________________________________________________________________
885 AliFMDEventInspector::CheckEmpty(const TString& trigStr, UInt_t& triggers) const
887 if (trigStr.Contains("CBEAMB-ABCE-NOPF-ALL")) {
888 triggers |= AliAODForwardMult::kEmpty;
893 //____________________________________________________________________
895 AliFMDEventInspector::CheckWords(const AliESDEvent& esd, UInt_t& triggers) const
898 TIter nextColl(&fCollWords);
899 while ((word = nextColl())) {
900 DMSG(fDebug,10,"Checking if %s trigger %s is fired",
901 word->GetTitle(), word->GetName());
902 if (!esd.IsTriggerClassFired(word->GetName())) continue;
904 TString beamSide = word->GetTitle();
905 DMSG(fDebug,10,"Found it - this is a %s trigger", beamSide.Data());
907 if (!beamSide.EqualTo("B")) continue;
908 triggers |= AliAODForwardMult::kB;
909 break; // No more to do here
911 TIter nextBg(&fBgWords);
912 UInt_t all = (AliAODForwardMult::kA |
913 AliAODForwardMult::kC |
914 AliAODForwardMult::kE);
915 while ((word = nextBg())) {
916 DMSG(fDebug,10,"Checking if %s trigger %s is fired",
917 word->GetTitle(), word->GetName());
918 if (!esd.IsTriggerClassFired(word->GetName())) continue;
920 TString beamSide = word->GetTitle();
921 DMSG(fDebug,10,"Found it - this is a %s trigger", beamSide.Data());
923 if (beamSide.Contains("A")) triggers |= AliAODForwardMult::kA;
924 if (beamSide.Contains("C")) triggers |= AliAODForwardMult::kC;
925 if (beamSide.Contains("E")) triggers |= AliAODForwardMult::kE;
927 if ((triggers & all) == all) break; // No more to do
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 if(fUseDisplacedVertices) {
956 Double_t zvtx = fDisplacedVertex.GetVertexZ();
958 if(TMath::Abs(zvtx) < 999) {
965 if(fUseFirstPhysicsVertex) return CheckPWGUDVertex(esd, vz, vx, vy);
968 return CheckVertex(esd, vz, vx, vy);
971 //____________________________________________________________________
973 AliFMDEventInspector::CheckPWGUDVertex(const AliESDEvent& esd,
978 // This is the code used by the 1st physics people
979 const AliESDVertex* vertex = esd.GetPrimaryVertex();
980 if (!vertex || !vertex->GetStatus()) {
981 DMSG(fDebug,2,"No primary vertex (%p) or bad status %d",
982 vertex, (vertex ? vertex->GetStatus() : -1));
985 const AliESDVertex* vertexSPD = esd.GetPrimaryVertexSPD();
986 if (!vertexSPD || !vertexSPD->GetStatus()) {
987 DMSG(fDebug,2,"No primary SPD vertex (%p) or bad status %d",
988 vertexSPD, (vertexSPD ? vertexSPD->GetStatus() : -1));
992 // if vertex is from SPD vertexZ, require more stringent cuts
993 if (vertex->IsFromVertexerZ()) {
994 if (vertex->GetDispersion() > fMaxVzErr ||
995 vertex->GetZRes() > 1.25 * fMaxVzErr) {
996 DMSG(fDebug,2,"Dispersion %f > %f or resolution %f > %f",
997 vertex->GetDispersion(), fMaxVzErr,
998 vertex->GetZRes(), 1.25 * fMaxVzErr);
1002 vz = vertex->GetZ();
1004 if(!vertex->IsFromVertexerZ()) {
1005 vx = vertex->GetX();
1006 vy = vertex->GetY();
1010 //____________________________________________________________________
1012 AliFMDEventInspector::CheckVertex(const AliESDEvent& esd,
1017 // Use standard SPD vertex (perhaps preferable for Pb+Pb)
1019 const AliESDVertex* vertex = esd.GetPrimaryVertexSPD();
1022 AliWarning("No SPD vertex found in ESD"); }
1026 // Check that enough tracklets contributed
1027 if(vertex->GetNContributors() <= 0) {
1028 DMSG(fDebug,2,"Number of contributors to vertex is %d<=0",
1029 vertex->GetNContributors());
1033 // Check that the uncertainty isn't too large
1034 if (vertex->GetZRes() > fMaxVzErr) {
1035 DMSG(fDebug,2,"Uncertaintity in Z of vertex is too large %f > %f",
1036 vertex->GetZRes(), fMaxVzErr);
1040 // Get the z coordiante
1041 vz = vertex->GetZ();
1042 const AliESDVertex* vertexXY = esd.GetPrimaryVertex();
1044 if(!vertexXY->IsFromVertexerZ()) {
1045 vx = vertexXY->GetX();
1046 vy = vertexXY->GetY();
1051 //____________________________________________________________________
1053 AliFMDEventInspector::ReadRunDetails(const AliESDEvent* esd)
1056 // Read the collision system, collision energy, and L3 field setting
1060 // esd ESD to get information from
1063 // true on success, false
1065 // AliInfo(Form("Parameters from 1st ESD event: cms=%s, sNN=%f, field=%f",
1066 // esd->GetBeamType(), 2*esd->GetBeamEnergy(),
1067 // esd->GetMagneticField()));
1068 DGUARD(fDebug,2,"Read the run details in AliFMDEventInspector");
1069 const char* sys = esd->GetBeamType();
1070 Float_t cms = 2 * esd->GetBeamEnergy();
1071 Float_t fld = esd->GetMagneticField();
1072 fCollisionSystem = AliForwardUtil::ParseCollisionSystem(sys);
1073 fEnergy = AliForwardUtil::ParseCenterOfMassEnergy(fCollisionSystem,
1075 fField = AliForwardUtil::ParseMagneticField(fld);
1077 StoreInformation(esd->GetRunNumber());
1078 if (fCollisionSystem == AliForwardUtil::kUnknown) {
1079 AliWarningF("Unknown collision system: %s - please check", sys);
1083 AliWarningF("Unknown CMS energy: %f (%d) - please check", cms, fEnergy);
1086 if (TMath::Abs(fField) > 10) {
1087 AliWarningF("Unknown L3 field setting: %f (%d) - please check", fld,fField);
1095 //____________________________________________________________________
1097 AliFMDEventInspector::CodeString(UInt_t code)
1101 if (code & kNoEvent) s.Append("NOEVENT ");
1102 if (code & kNoTriggers) s.Append("NOTRIGGERS ");
1103 if (code & kNoSPD) s.Append("NOSPD ");
1104 if (code & kNoFMD) s.Append("NOFMD ");
1105 if (code & kNoVertex) s.Append("NOVERTEX ");
1106 if (code & kBadVertex) s.Append("BADVERTEX ");
1109 //____________________________________________________________________
1111 AliFMDEventInspector::Print(Option_t*) const
1114 // Print information
1118 char ind[gROOT->GetDirLevel()+1];
1119 for (Int_t i = 0; i < gROOT->GetDirLevel(); i++) ind[i] = ' ';
1120 ind[gROOT->GetDirLevel()] = '\0';
1121 TString sNN(AliForwardUtil::CenterOfMassEnergyString(fEnergy));
1122 sNN.Strip(TString::kBoth, '0');
1123 sNN.ReplaceAll("GeV", " GeV");
1124 TString field(AliForwardUtil::MagneticFieldString(fField));
1125 field.ReplaceAll("p", "+");
1126 field.ReplaceAll("m", "-");
1127 field.ReplaceAll("kG", " kG");
1129 std::cout << std::boolalpha
1130 << ind << ClassName() << ": " << GetName() << '\n'
1131 << ind << " Vertex bins: " << fVtxAxis.GetNbins() << '\n'
1132 << ind << " Vertex range: [" << fVtxAxis.GetXmin()
1133 << "," << fVtxAxis.GetXmax() << "]\n"
1134 << ind << " Low flux cut: " << fLowFluxCut << '\n'
1135 << ind << " Max(delta v_z): " << fMaxVzErr << " cm\n"
1136 << ind << " Min(nContrib_pileup): " << fMinPileupContrib << '\n'
1137 << ind << " Min(v-pileup): " << fMinPileupDistance << '\n'
1138 << ind << " System: "
1139 << AliForwardUtil::CollisionSystemString(fCollisionSystem) << '\n'
1140 << ind << " CMS energy per nucleon: " << sNN << '\n'
1141 << ind << " Field: " << field << '\n'
1142 << ind << " Satellite events: " << fUseDisplacedVertices
1143 << "\n" << std::noboolalpha;
1144 if (!fCentAxis) { std::cout << std::flush; return; }
1145 Int_t nBin = fCentAxis->GetNbins();
1146 std::cout << ind << " Centrality axis: " << nBin << " bins"
1148 for (Int_t i = 0; i < nBin; i++) {
1149 if ((i % 10) == 0) std::cout << '\n' << ind << " ";
1150 std::cout << std::setw(5) << fCentAxis->GetBinLowEdge(i+1) << '-';
1152 std::cout << std::setw(5) << fCentAxis->GetBinUpEdge(nBin) << std::endl;