1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
16 /* $Id: AliESDEvent.cxx 64008 2013-08-28 13:09:59Z hristov $ */
18 //-----------------------------------------------------------------
19 // Implementation of the AliESDEvent class
20 // This is the class to deal with during the physics analysis of data.
21 // It also ensures the backward compatibility with the old ESD format.
23 AliESDEvent *ev= new AliESDEvent();
24 ev->ReadFromTree(esdTree);
26 for (Int_t i=0; i<nev; i++) {
28 if(ev->GetAliESDOld())ev->CopyFromOldESD();
30 // The AliESDInputHandler does this automatically for you
32 // Origin: Christian Klein-Boesing, CERN, Christian.Klein-Boesing@cern.ch
33 //-----------------------------------------------------------------
36 #include "TRefArray.h"
39 #include <TInterpreter.h>
41 #include "AliESDEvent.h"
42 #include "AliESDfriend.h"
43 #include "AliESDVZERO.h"
44 #include "AliESDFMD.h"
46 #include "AliESDMuonTrack.h"
47 #include "AliESDMuonCluster.h"
48 #include "AliESDMuonPad.h"
49 #include "AliESDPmdTrack.h"
50 #include "AliESDTrdTrack.h"
51 #include "AliESDVertex.h"
52 #include "AliESDcascade.h"
53 #include "AliESDPmdTrack.h"
54 #include "AliESDTrdTrigger.h"
55 #include "AliESDTrdTrack.h"
56 #include "AliESDTrdTracklet.h"
57 #include "AliESDVertex.h"
58 #include "AliVertexerTracks.h"
59 #include "AliESDcascade.h"
60 #include "AliESDkink.h"
61 #include "AliESDtrack.h"
62 #include "AliESDHLTtrack.h"
63 #include "AliESDCaloCluster.h"
64 #include "AliESDCaloCells.h"
66 #include "AliESDFMD.h"
67 #include "AliESDVZERO.h"
68 #include "AliMultiplicity.h"
69 #include "AliRawDataErrorLog.h"
71 #include "AliESDACORDE.h"
73 #include "AliESDHLTDecision.h"
74 #include "AliCentrality.h"
75 #include "AliESDCosmicTrack.h"
76 #include "AliTriggerConfiguration.h"
77 #include "AliTriggerClass.h"
78 #include "AliTriggerCluster.h"
80 #include "AliESDMFT.h"
82 #include "AliEventplane.h"
89 // here we define the names, some classes are no TNamed, therefore the classnames
91 const char* AliESDEvent::fgkESDListName[kESDListN] = {"AliESDRun",
119 "AliRawDataErrorLogs",
129 //______________________________________________________________________________
130 AliESDEvent::AliESDEvent():
132 fESDObjects(new TList()),
148 fSPDPileupVertices(0),
149 fTrkPileupVertices(0),
161 fEMCALCells(0), fPHOSCells(0),
164 fOldMuonStructure(kFALSE),
172 fDetectorStatus(0xFFFFFFFF),
173 fDAQDetectorPattern(0xFFFF),
174 fDAQAttributes(0xFFFF)
180 //______________________________________________________________________________
181 AliESDEvent::AliESDEvent(const AliESDEvent& esd):
183 fESDObjects(new TList()),
184 fESDRun(new AliESDRun(*esd.fESDRun)),
185 fHeader(new AliESDHeader(*esd.fHeader)),
186 fESDZDC(new AliESDZDC(*esd.fESDZDC)),
187 fESDFMD(new AliESDFMD(*esd.fESDFMD)),
188 fESDVZERO(new AliESDVZERO(*esd.fESDVZERO)),
189 fESDTZERO(new AliESDTZERO(*esd.fESDTZERO)),
190 fTPCVertex(new AliESDVertex(*esd.fTPCVertex)),
191 fSPDVertex(new AliESDVertex(*esd.fSPDVertex)),
192 fPrimaryVertex(new AliESDVertex(*esd.fPrimaryVertex)),
193 fSPDMult(new AliMultiplicity(*esd.fSPDMult)),
194 fPHOSTrigger(new AliESDCaloTrigger(*esd.fPHOSTrigger)),
195 fEMCALTrigger(new AliESDCaloTrigger(*esd.fEMCALTrigger)),
196 fESDACORDE(new AliESDACORDE(*esd.fESDACORDE)),
197 fESDAD(new AliESDAD(*esd.fESDAD)),
198 fTrdTrigger(new AliESDTrdTrigger(*esd.fTrdTrigger)),
199 fSPDPileupVertices(new TClonesArray(*esd.fSPDPileupVertices)),
200 fTrkPileupVertices(new TClonesArray(*esd.fTrkPileupVertices)),
201 fTracks(new TClonesArray(*esd.fTracks)),
202 fMuonTracks(new TClonesArray(*esd.fMuonTracks)),
203 fMuonClusters(new TClonesArray(*esd.fMuonClusters)),
204 fMuonPads(new TClonesArray(*esd.fMuonPads)),
205 fPmdTracks(new TClonesArray(*esd.fPmdTracks)),
206 fTrdTracks(new TClonesArray(*esd.fTrdTracks)),
207 fTrdTracklets(new TClonesArray(*esd.fTrdTracklets)),
208 fV0s(new TClonesArray(*esd.fV0s)),
209 fCascades(new TClonesArray(*esd.fCascades)),
210 fKinks(new TClonesArray(*esd.fKinks)),
211 fCaloClusters(new TClonesArray(*esd.fCaloClusters)),
212 fEMCALCells(new AliESDCaloCells(*esd.fEMCALCells)),
213 fPHOSCells(new AliESDCaloCells(*esd.fPHOSCells)),
214 fCosmicTracks(new TClonesArray(*esd.fCosmicTracks)),
215 fErrorLogs(new TClonesArray(*esd.fErrorLogs)),
216 fOldMuonStructure(esd.fOldMuonStructure),
217 fESDOld(esd.fESDOld ? new AliESD(*esd.fESDOld) : 0),
218 fESDFriendOld(esd.fESDFriendOld ? new AliESDfriend(*esd.fESDFriendOld) : 0),
219 fConnected(esd.fConnected),
220 fUseOwnList(esd.fUseOwnList),
221 fTOFHeader(new AliTOFHeader(*esd.fTOFHeader)),
222 fCentrality(new AliCentrality(*esd.fCentrality)),
223 fEventplane(new AliEventplane(*esd.fEventplane)),
224 fDetectorStatus(esd.fDetectorStatus),
225 fDAQDetectorPattern(esd.fDAQDetectorPattern),
226 fDAQAttributes(esd.fDAQAttributes)
228 // , fESDMFT(new AliESDMFT(*esd.fESDMFT))
233 printf("copying ESD event...\n"); // AU
234 // CKB init in the constructor list and only add here ...
239 AddObject(fESDVZERO);
240 AddObject(fESDTZERO);
241 AddObject(fTPCVertex);
242 AddObject(fSPDVertex);
243 AddObject(fPrimaryVertex);
245 AddObject(fPHOSTrigger);
246 AddObject(fEMCALTrigger);
247 AddObject(fTrdTrigger);
248 AddObject(fSPDPileupVertices);
249 AddObject(fTrkPileupVertices);
251 AddObject(fMuonTracks);
252 AddObject(fPmdTracks);
253 AddObject(fTrdTracks);
254 AddObject(fTrdTracklets);
256 AddObject(fCascades);
258 AddObject(fCaloClusters);
259 AddObject(fEMCALCells);
260 AddObject(fPHOSCells);
261 AddObject(fCosmicTracks);
262 AddObject(fErrorLogs);
263 AddObject(fESDACORDE);
265 AddObject(fTOFHeader);
266 AddObject(fMuonClusters);
267 AddObject(fMuonPads);
269 // AddObject(fESDMFT);
275 //______________________________________________________________________________
276 AliESDEvent & AliESDEvent::operator=(const AliESDEvent& source) {
278 // Assignment operator
280 if(&source == this) return *this;
281 AliVEvent::operator=(source);
283 // This assumes that the list is already created
284 // and that the virtual void Copy(Tobject&) function
285 // is correctly implemented in the derived class
286 // otherwise only TObject::Copy() will be used
290 if((fESDObjects->GetSize()==0)&&(source.fESDObjects->GetSize()>=kESDListN)){
291 // We cover the case that we do not yet have the
292 // standard content but the source has it
296 TIter next(source.GetList());
299 while ((its = next())) {
300 name.Form("%s", its->GetName());
301 TObject *mine = fESDObjects->FindObject(name.Data());
303 TClass* pClass=TClass::GetClass(its->ClassName());
305 AliWarning(Form("Can not find class description for entry %s (%s)\n",
306 its->ClassName(), name.Data()));
310 mine=(TObject*)pClass->New();
312 // not in this: can be added to list
313 AliWarning(Form("%s:%d Could not find %s for copying \n",
314 (char*)__FILE__,__LINE__,name.Data()));
317 if(mine->InheritsFrom("TNamed")){
318 ((TNamed*)mine)->SetName(name);
320 else if(mine->InheritsFrom("TCollection")){
321 if(mine->InheritsFrom("TClonesArray")) {
322 TClonesArray* tcits = dynamic_cast<TClonesArray*>(its);
324 dynamic_cast<TClonesArray*>(mine)->SetClass(tcits->GetClass());
326 dynamic_cast<TCollection*>(mine)->SetName(name);
328 AliDebug(1, Form("adding object %s of type %s", mine->GetName(), mine->ClassName()));
332 if(!its->InheritsFrom("TCollection")){
336 else if(its->InheritsFrom("TClonesArray")){
337 // Create or expand the tclonesarray pointers
338 // so we can directly copy to the object
339 TClonesArray *itstca = (TClonesArray*)its;
340 TClonesArray *minetca = (TClonesArray*)mine;
342 // this leaves the capacity of the TClonesArray the same
343 // except for a factor of 2 increase when size > capacity
344 // does not release any memory occupied by the tca
345 minetca->ExpandCreate(itstca->GetEntriesFast());
346 for(int i = 0;i < itstca->GetEntriesFast();++i){
348 TObject *minetcaobj = minetca->At(i);
349 TObject *itstcaobj = itstca->At(i);
350 // no need to delete first
351 // pointers within the class should be handled by Copy()...
352 // Can there be Empty slots?
353 itstcaobj->Copy(*minetcaobj);
357 AliWarning(Form("%s:%d cannot copy TCollection \n",
358 (char*)__FILE__,__LINE__));
362 fOldMuonStructure = source.fOldMuonStructure;
364 fCentrality = source.fCentrality;
365 fEventplane = source.fEventplane;
367 fConnected = source.fConnected;
368 fUseOwnList = source.fUseOwnList;
370 fDetectorStatus = source.fDetectorStatus;
371 fDAQDetectorPattern = source.fDAQDetectorPattern;
372 fDAQAttributes = source.fDAQAttributes;
378 //______________________________________________________________________________
379 AliESDEvent::~AliESDEvent()
382 // Standard destructor
385 // everthing on the list gets deleted automatically
388 if(fESDObjects&&!fConnected)
393 if (fCentrality) delete fCentrality;
394 if (fEventplane) delete fEventplane;
398 void AliESDEvent::Copy(TObject &obj) const {
400 // interface to TOBject::Copy
401 // Copies the content of this into obj!
402 // bascially obj = *this
404 if(this==&obj)return;
405 AliESDEvent *robj = dynamic_cast<AliESDEvent*>(&obj);
406 if(!robj)return; // not an AliESEvent
411 //______________________________________________________________________________
412 void AliESDEvent::Reset()
416 // Std content + Non std content
418 // Reset the standard contents
420 fDetectorStatus = 0xFFFFFFFF;
421 fDAQDetectorPattern = 0xFFFF;
422 fDAQAttributes = 0xFFFF;
423 // reset for the old data without AliESDEvent...
424 if(fESDOld)fESDOld->Reset();
426 fESDFriendOld->~AliESDfriend();
427 new (fESDFriendOld) AliESDfriend();
431 if(fESDObjects->GetSize()>kESDListN){
432 // we have non std content
433 // this also covers esdfriends
434 for(int i = kESDListN;i < fESDObjects->GetSize();++i){
435 TObject *pObject = fESDObjects->At(i);
437 if(pObject->InheritsFrom(TClonesArray::Class())){
438 ((TClonesArray*)pObject)->Delete();
440 else if(!pObject->InheritsFrom(TCollection::Class())){
441 TClass *pClass = TClass::GetClass(pObject->ClassName());
442 if (pClass && pClass->GetListOfMethods()->FindObject("Clear")) {
443 AliDebug(1, Form("Clear for object %s class %s", pObject->GetName(), pObject->ClassName()));
447 AliDebug(1, Form("ResetWithPlacementNew for object %s class %s", pObject->GetName(), pObject->ClassName()));
448 ResetWithPlacementNew(pObject);
452 AliWarning(Form("No reset for %s \n",
453 pObject->ClassName()));
460 Bool_t AliESDEvent::ResetWithPlacementNew(TObject *pObject){
462 // funtion to reset using the already allocated space
464 Long_t dtoronly = TObject::GetDtorOnly();
465 TClass *pClass = TClass::GetClass(pObject->ClassName());
466 TObject::SetDtorOnly(pObject);
468 // Recreate with placement new
469 pClass->New(pObject);
470 // Restore the state.
471 TObject::SetDtorOnly((void*)dtoronly);
475 void AliESDEvent::ResetStdContent()
477 // Reset the standard contents
478 if(fESDRun) fESDRun->Reset();
479 if(fHeader) fHeader->Reset();
480 if(fCentrality) fCentrality->Reset();
481 if(fEventplane) fEventplane->Reset();
482 if(fESDZDC) fESDZDC->Reset();
487 // reset by callin d'to /c'tor keep the pointer
488 fESDVZERO->~AliESDVZERO();
489 new (fESDVZERO) AliESDVZERO();
492 fESDACORDE->~AliESDACORDE();
493 new (fESDACORDE) AliESDACORDE();
498 new (fESDAD) AliESDAD();
502 if(fESDTZERO) fESDTZERO->Reset();
503 // CKB no clear/reset implemented
505 fTPCVertex->~AliESDVertex();
506 new (fTPCVertex) AliESDVertex();
507 fTPCVertex->SetName(fgkESDListName[kTPCVertex]);
510 fSPDVertex->~AliESDVertex();
511 new (fSPDVertex) AliESDVertex();
512 fSPDVertex->SetName(fgkESDListName[kSPDVertex]);
515 fPrimaryVertex->~AliESDVertex();
516 new (fPrimaryVertex) AliESDVertex();
517 fPrimaryVertex->SetName(fgkESDListName[kPrimaryVertex]);
520 fSPDMult->~AliMultiplicity();
521 new (fSPDMult) AliMultiplicity();
524 fTOFHeader->~AliTOFHeader();
525 new (fTOFHeader) AliTOFHeader();
526 //fTOFHeader->SetName(fgkESDListName[kTOFHeader]);
529 fTrdTrigger->~AliESDTrdTrigger();
530 new (fTrdTrigger) AliESDTrdTrigger();
534 // fESDMFT->~AliESDMFT();
535 // new (fESDMFT) AliESDMFT();
539 if(fPHOSTrigger)fPHOSTrigger->DeAllocate();
540 if(fEMCALTrigger)fEMCALTrigger->DeAllocate();
541 if(fSPDPileupVertices)fSPDPileupVertices->Delete();
542 if(fTrkPileupVertices)fTrkPileupVertices->Delete();
543 if(fTracks)fTracks->Delete();
544 if(fMuonTracks)fMuonTracks->Clear("C");
545 if(fMuonClusters)fMuonClusters->Clear("C");
546 if(fMuonPads)fMuonPads->Clear("C");
547 if(fPmdTracks)fPmdTracks->Delete();
548 if(fTrdTracks)fTrdTracks->Delete();
549 if(fTrdTracklets)fTrdTracklets->Delete();
550 if(fV0s)fV0s->Delete();
551 if(fCascades)fCascades->Delete();
552 if(fKinks)fKinks->Delete();
553 if(fCaloClusters)fCaloClusters->Delete();
554 if(fPHOSCells)fPHOSCells->DeleteContainer();
555 if(fEMCALCells)fEMCALCells->DeleteContainer();
556 if(fCosmicTracks)fCosmicTracks->Delete();
557 if(fErrorLogs) fErrorLogs->Delete();
559 // don't reset fconnected fConnected and the list
564 Int_t AliESDEvent::AddV0(const AliESDv0 *v) {
568 TClonesArray &fv = *fV0s;
569 Int_t idx=fV0s->GetEntriesFast();
570 new(fv[idx]) AliESDv0(*v);
574 //______________________________________________________________________________
575 Bool_t AliESDEvent::IsDetectorInTriggerCluster(TString detector, AliTriggerConfiguration* trigConf) const {
576 // Check if a given detector was read-out in the analyzed event
577 const TObjArray& classesArray=trigConf->GetClasses();
578 ULong64_t trigMask=GetTriggerMask();
579 Int_t nclasses = classesArray.GetEntriesFast();
580 for(Int_t iclass=0; iclass < nclasses; iclass++ ) {
581 AliTriggerClass* trclass = (AliTriggerClass*)classesArray.At(iclass);
582 Int_t classMask=trclass->GetMask();
583 if(trigMask & classMask){
584 TString detList=trclass->GetCluster()->GetDetectorsInCluster();
585 if(detList.Contains(detector.Data())){
592 //______________________________________________________________________________
593 void AliESDEvent::Print(Option_t *) const
596 // Print header information of the event
598 printf("ESD run information\n");
599 printf("Event # in file %d Bunch crossing # %d Orbit # %d Period # %d Run # %d Trigger %lld Magnetic field %f \n",
600 GetEventNumberInFile(),
601 GetBunchCrossNumber(),
606 GetMagneticField() );
608 printf("Vertex: (%.4f +- %.4f, %.4f +- %.4f, %.4f +- %.4f) cm\n",
609 fPrimaryVertex->GetXv(), fPrimaryVertex->GetXRes(),
610 fPrimaryVertex->GetYv(), fPrimaryVertex->GetYRes(),
611 fPrimaryVertex->GetZv(), fPrimaryVertex->GetZRes());
612 printf("Mean vertex in RUN: X=%.4f Y=%.4f Z=%.4f cm\n",
613 GetDiamondX(),GetDiamondY(),GetDiamondZ());
615 printf("SPD Multiplicity. Number of tracklets %d \n",
616 fSPDMult->GetNumberOfTracklets());
617 printf("Number of pileup primary vertices reconstructed with SPD %d\n",
618 GetNumberOfPileupVerticesSPD());
619 printf("Number of pileup primary vertices reconstructed using the tracks %d\n",
620 GetNumberOfPileupVerticesTracks());
621 printf("Number of tracks: \n");
622 printf(" charged %d\n", GetNumberOfTracks());
623 printf(" muon %d\n", GetNumberOfMuonTracks());
624 printf(" pmd %d\n", GetNumberOfPmdTracks());
625 printf(" trd %d\n", GetNumberOfTrdTracks());
626 printf(" trd trkl %d\n", GetNumberOfTrdTracklets());
627 printf(" v0 %d\n", GetNumberOfV0s());
628 printf(" cascades %d\n", GetNumberOfCascades());
629 printf(" kinks %d\n", GetNumberOfKinks());
630 if(fPHOSCells)printf(" PHOSCells %d\n", fPHOSCells->GetNumberOfCells());
631 else printf(" PHOSCells not in the Event\n");
632 if(fEMCALCells)printf(" EMCALCells %d\n", fEMCALCells->GetNumberOfCells());
633 else printf(" EMCALCells not in the Event\n");
634 printf(" CaloClusters %d\n", GetNumberOfCaloClusters());
635 printf(" FMD %s\n", (fESDFMD ? "yes" : "no"));
636 printf(" VZERO %s\n", (fESDVZERO ? "yes" : "no"));
637 printf(" muClusters %d\n", fMuonClusters ? fMuonClusters->GetEntriesFast() : 0);
638 printf(" muPad %d\n", fMuonPads ? fMuonPads->GetEntriesFast() : 0);
639 if (fCosmicTracks) printf(" Cosmics %d\n", GetNumberOfCosmicTracks());
641 //printf(" MFT %s\n", (fESDMFT ? "yes" : "no"));
645 TObject* pHLTDecision=GetHLTTriggerDecision();
646 printf("HLT trigger decision: %s\n", pHLTDecision?pHLTDecision->GetOption():"not available");
647 if (pHLTDecision) pHLTDecision->Print("compact");
652 void AliESDEvent::SetESDfriend(const AliESDfriend *ev) const {
654 // Attaches the complementary info to the ESD
658 // to be sure that we set the tracks also
659 // in case of old esds
660 // if(fESDOld)CopyFromOldESD();
662 Int_t ntrk=ev->GetNumberOfTracks();
664 for (Int_t i=0; i<ntrk; i++) {
665 const AliESDfriendTrack *f=ev->GetTrack(i);
666 if (!f) {AliFatal(Form("NULL pointer for ESD track %d",i));}
667 GetTrack(i)->SetFriendTrack(f);
671 Bool_t AliESDEvent::RemoveKink(Int_t rm) const {
672 // ---------------------------------------------------------
673 // Remove a kink candidate and references to it from ESD,
674 // if this candidate does not come from a reconstructed decay
675 // Not yet implemented...
676 // ---------------------------------------------------------
677 Int_t last=GetNumberOfKinks()-1;
678 if ((rm<0)||(rm>last)) return kFALSE;
683 Bool_t AliESDEvent::RemoveV0(Int_t rm) const {
684 // ---------------------------------------------------------
685 // Remove a V0 candidate and references to it from ESD,
686 // if this candidate does not come from a reconstructed decay
687 // ---------------------------------------------------------
688 Int_t last=GetNumberOfV0s()-1;
689 if ((rm<0)||(rm>last)) return kFALSE;
691 AliESDv0 *v0=GetV0(rm);
692 Int_t idxP=v0->GetPindex(), idxN=v0->GetNindex();
695 Int_t lastIdxP=v0->GetPindex(), lastIdxN=v0->GetNindex();
699 // Check if this V0 comes from a reconstructed decay
700 Int_t ncs=GetNumberOfCascades();
701 for (Int_t n=0; n<ncs; n++) {
702 AliESDcascade *cs=GetCascade(n);
704 Int_t csIdxP=cs->GetPindex();
705 Int_t csIdxN=cs->GetNindex();
708 if (idxN==csIdxN) return kFALSE;
710 if (csIdxP==lastIdxP)
711 if (csIdxN==lastIdxN) used++;
714 //Replace the removed V0 with the last V0
715 TClonesArray &a=*fV0s;
716 delete a.RemoveAt(rm);
718 if (rm==last) return kTRUE;
720 //v0 is pointing to the last V0 candidate...
721 new (a[rm]) AliESDv0(*v0);
722 delete a.RemoveAt(last);
724 if (!used) return kTRUE;
727 // Remap the indices of the daughters of reconstructed decays
728 for (Int_t n=0; n<ncs; n++) {
729 AliESDcascade *cs=GetCascade(n);
732 Int_t csIdxP=cs->GetPindex();
733 Int_t csIdxN=cs->GetNindex();
735 if (csIdxP==lastIdxP)
736 if (csIdxN==lastIdxN) {
737 cs->AliESDv0::SetIndex(1,idxP);
738 cs->AliESDv0::SetIndex(0,idxN);
740 if (!used) return kTRUE;
747 Bool_t AliESDEvent::RemoveTrack(Int_t rm) const {
748 // ---------------------------------------------------------
749 // Remove a track and references to it from ESD,
750 // if this track does not come from a reconstructed decay
751 // ---------------------------------------------------------
752 Int_t last=GetNumberOfTracks()-1;
753 if ((rm<0)||(rm>last)) return kFALSE;
757 // Check if this track comes from the reconstructed primary vertices
758 if (fTPCVertex && fTPCVertex->GetStatus()) {
759 UShort_t *primIdx=fTPCVertex->GetIndices();
760 Int_t n=fTPCVertex->GetNIndices();
762 Int_t idx=Int_t(primIdx[n]);
763 if (rm==idx) return kFALSE;
764 if (idx==last) used++;
767 if (fPrimaryVertex && fPrimaryVertex->GetStatus()) {
768 UShort_t *primIdx=fPrimaryVertex->GetIndices();
769 Int_t n=fPrimaryVertex->GetNIndices();
771 Int_t idx=Int_t(primIdx[n]);
772 if (rm==idx) return kFALSE;
773 if (idx==last) used++;
777 // Check if this track comes from a reconstructed decay
778 Int_t nv0=GetNumberOfV0s();
779 for (Int_t n=0; n<nv0; n++) {
780 AliESDv0 *v0=GetV0(n);
782 Int_t idx=v0->GetNindex();
783 if (rm==idx) return kFALSE;
784 if (idx==last) used++;
787 if (rm==idx) return kFALSE;
788 if (idx==last) used++;
791 Int_t ncs=GetNumberOfCascades();
792 for (Int_t n=0; n<ncs; n++) {
793 AliESDcascade *cs=GetCascade(n);
795 Int_t idx=cs->GetIndex();
796 if (rm==idx) return kFALSE;
797 if (idx==last) used++;
801 if (rm==idx) return kFALSE;
802 if (idx==last) used++;
805 if (rm==idx) return kFALSE;
806 if (idx==last) used++;
809 Int_t nkn=GetNumberOfKinks();
810 for (Int_t n=0; n<nkn; n++) {
811 AliESDkink *kn=GetKink(n);
813 Int_t idx=kn->GetIndex(0);
814 if (rm==idx) return kFALSE;
815 if (idx==last) used++;
818 if (rm==idx) return kFALSE;
819 if (idx==last) used++;
822 // Check if this track is associated with a CaloCluster
823 Int_t ncl=GetNumberOfCaloClusters();
824 for (Int_t n=0; n<ncl; n++) {
825 AliESDCaloCluster *cluster=GetCaloCluster(n);
826 TArrayI *arr=cluster->GetTracksMatched();
827 Int_t s=arr->GetSize();
829 Int_t idx=arr->At(s);
830 if (rm==idx) return kFALSE;
831 if (idx==last) used++;
837 //Replace the removed track with the last track
838 TClonesArray &a=*fTracks;
839 delete a.RemoveAt(rm);
841 if (rm==last) return kTRUE;
843 AliESDtrack *t=GetTrack(last);
844 if (!t) {AliFatal(Form("NULL pointer for ESD track %d",last));}
846 new (a[rm]) AliESDtrack(*t);
847 delete a.RemoveAt(last);
850 if (!used) return kTRUE;
853 // Remap the indices of the tracks used for the primary vertex reconstruction
854 if (fTPCVertex && fTPCVertex->GetStatus()) {
855 UShort_t *primIdx=fTPCVertex->GetIndices();
856 Int_t n=fTPCVertex->GetNIndices();
858 Int_t idx=Int_t(primIdx[n]);
860 primIdx[n]=Short_t(rm);
862 if (!used) return kTRUE;
866 if (fPrimaryVertex && fPrimaryVertex->GetStatus()) {
867 UShort_t *primIdx=fPrimaryVertex->GetIndices();
868 Int_t n=fPrimaryVertex->GetNIndices();
870 Int_t idx=Int_t(primIdx[n]);
872 primIdx[n]=Short_t(rm);
874 if (!used) return kTRUE;
879 // Remap the indices of the daughters of reconstructed decays
880 for (Int_t n=0; n<nv0; n++) {
881 AliESDv0 *v0=GetV0(n);
882 if (v0->GetIndex(0)==last) {
885 if (!used) return kTRUE;
887 if (v0->GetIndex(1)==last) {
890 if (!used) return kTRUE;
894 for (Int_t n=0; n<ncs; n++) {
895 AliESDcascade *cs=GetCascade(n);
896 if (cs->GetIndex()==last) {
899 if (!used) return kTRUE;
902 if (v0->GetIndex(0)==last) {
905 if (!used) return kTRUE;
907 if (v0->GetIndex(1)==last) {
910 if (!used) return kTRUE;
914 for (Int_t n=0; n<nkn; n++) {
915 AliESDkink *kn=GetKink(n);
916 if (kn->GetIndex(0)==last) {
919 if (!used) return kTRUE;
921 if (kn->GetIndex(1)==last) {
924 if (!used) return kTRUE;
928 // Remap the indices of the tracks accosicated with CaloClusters
929 for (Int_t n=0; n<ncl; n++) {
930 AliESDCaloCluster *cluster=GetCaloCluster(n);
931 TArrayI *arr=cluster->GetTracksMatched();
932 Int_t s=arr->GetSize();
934 Int_t idx=arr->At(s);
938 if (!used) return kTRUE;
947 Bool_t AliESDEvent::Clean(Float_t *cleanPars) {
949 // Remove the data which are not needed for the physics analysis.
951 // 1) Cleaning the V0 candidates
952 // ---------------------------
953 // If the cosine of the V0 pointing angle "csp" and
954 // the DCA between the daughter tracks "dca" does not satisfy
957 // csp > cleanPars[1] + dca/cleanPars[0]*(1.- cleanPars[1])
959 // an attempt to remove this V0 candidate from ESD is made.
961 // The V0 candidate gets removed if it does not belong to any
962 // recosntructed cascade decay
964 // 12.11.2007, optimal values: cleanPars[0]=0.5, cleanPars[1]=0.999
966 // 2) Cleaning the tracks
967 // ----------------------
968 // If track's transverse parameter is larger than cleanPars[2]
970 // track's longitudinal parameter is larger than cleanPars[3]
971 // an attempt to remove this track from ESD is made.
973 // The track gets removed if it does not come
974 // from a reconstructed decay
978 Float_t dcaMax=cleanPars[0];
979 Float_t cspMin=cleanPars[1];
981 Int_t nV0s=GetNumberOfV0s();
982 for (Int_t i=nV0s-1; i>=0; i--) {
983 AliESDv0 *v0=GetV0(i);
985 Float_t dca=v0->GetDcaV0Daughters();
986 Float_t csp=v0->GetV0CosineOfPointingAngle();
987 Float_t cspcut=cspMin + dca/dcaMax*(1.-cspMin);
988 if (csp > cspcut) continue;
989 if (RemoveV0(i)) rc=kTRUE;
993 Float_t dmax=cleanPars[2], zmax=cleanPars[3];
995 const AliESDVertex *vertex=GetPrimaryVertexSPD();
996 Bool_t vtxOK=vertex->GetStatus();
998 Int_t nTracks=GetNumberOfTracks();
999 for (Int_t i=nTracks-1; i>=0; i--) {
1000 AliESDtrack *track=GetTrack(i);
1001 if (!track) {AliFatal(Form("NULL pointer for ESD track %d",i));}
1002 Float_t xy,z; track->GetImpactParameters(xy,z);
1003 if ((TMath::Abs(xy) > dmax) || (vtxOK && (TMath::Abs(z) > zmax))) {
1004 if (RemoveTrack(i)) rc=kTRUE;
1011 Char_t AliESDEvent::AddPileupVertexSPD(const AliESDVertex *vtx)
1013 // Add a pileup primary vertex reconstructed with SPD
1014 TClonesArray &ftr = *fSPDPileupVertices;
1015 Char_t n=Char_t(ftr.GetEntriesFast());
1016 AliESDVertex *vertex = new(ftr[n]) AliESDVertex(*vtx);
1021 Char_t AliESDEvent::AddPileupVertexTracks(const AliESDVertex *vtx)
1023 // Add a pileup primary vertex reconstructed with SPD
1024 TClonesArray &ftr = *fTrkPileupVertices;
1025 Char_t n=Char_t(ftr.GetEntriesFast());
1026 AliESDVertex *vertex = new(ftr[n]) AliESDVertex(*vtx);
1031 Int_t AliESDEvent::AddTrack(const AliESDtrack *t)
1034 TClonesArray &ftr = *fTracks;
1035 AliESDtrack * track = new(ftr[fTracks->GetEntriesFast()])AliESDtrack(*t);
1036 track->SetID(fTracks->GetEntriesFast()-1);
1037 return track->GetID();
1040 AliESDtrack* AliESDEvent::NewTrack()
1043 TClonesArray &ftr = *fTracks;
1044 AliESDtrack * track = new(ftr[fTracks->GetEntriesFast()])AliESDtrack();
1045 track->SetID(fTracks->GetEntriesFast()-1);
1049 //______________________________________________________________________________
1050 Bool_t AliESDEvent::MoveMuonObjects()
1052 // move MUON clusters and pads to the new ESD structure in needed.
1053 // to ensure backward compatibility
1055 if (!fOldMuonStructure) return kTRUE;
1057 if (!fMuonTracks || !fMuonClusters || !fMuonPads) return kFALSE;
1059 Bool_t reset = kTRUE;
1060 Bool_t containTrackerData = kFALSE;
1061 for (Int_t i = 0; i < fMuonTracks->GetEntriesFast(); i++) {
1063 AliESDMuonTrack *track = (AliESDMuonTrack*) fMuonTracks->UncheckedAt(i);
1065 if (track->ContainTrackerData()) containTrackerData = kTRUE;
1068 if (!track->IsOldTrack()) continue;
1070 // remove objects connected to previous event if needed
1072 if (fMuonClusters->GetEntriesFast() > 0) fMuonClusters->Clear("C");
1073 if (fMuonPads->GetEntriesFast() > 0) fMuonPads->Clear("C");
1077 track->MoveClustersToESD(*this);
1081 // remove objects connected to previous event if needed
1082 if (!containTrackerData) {
1083 if (fMuonClusters->GetEntriesFast() > 0) fMuonClusters->Clear("C");
1084 if (fMuonPads->GetEntriesFast() > 0) fMuonPads->Clear("C");
1090 //______________________________________________________________________________
1091 AliESDMuonTrack* AliESDEvent::GetMuonTrack(Int_t i)
1093 // get the MUON track at the position i in the internal array of track
1094 if (!fMuonTracks) return 0x0;
1095 if (!MoveMuonObjects()) return 0x0;
1096 AliESDMuonTrack *track = (AliESDMuonTrack*) fMuonTracks->UncheckedAt(i);
1097 track->SetESDEvent(this);
1101 //______________________________________________________________________________
1102 void AliESDEvent::AddMuonTrack(const AliESDMuonTrack *t)
1105 TClonesArray &fmu = *fMuonTracks;
1106 AliESDMuonTrack *track = new(fmu[fMuonTracks->GetEntriesFast()]) AliESDMuonTrack(*t);
1107 track->MoveClustersToESD(*this);
1110 //______________________________________________________________________________
1111 AliESDMuonTrack* AliESDEvent::NewMuonTrack()
1113 // create a new MUON track at the end of the internal array of track
1114 TClonesArray &fmu = *fMuonTracks;
1115 return new(fmu[fMuonTracks->GetEntriesFast()]) AliESDMuonTrack();
1118 //______________________________________________________________________________
1119 Int_t AliESDEvent::GetNumberOfMuonClusters()
1121 // get the number of MUON clusters
1122 if (!fMuonClusters) return 0;
1123 if (!MoveMuonObjects()) return 0;
1124 return fMuonClusters->GetEntriesFast();
1127 //______________________________________________________________________________
1128 AliESDMuonCluster* AliESDEvent::GetMuonCluster(Int_t i)
1130 // get the MUON cluster at the position i in the internal array of cluster
1131 if (!fMuonClusters) return 0x0;
1132 if (!MoveMuonObjects()) return 0x0;
1133 return (AliESDMuonCluster*) fMuonClusters->UncheckedAt(i);
1136 //______________________________________________________________________________
1137 AliESDMuonCluster* AliESDEvent::FindMuonCluster(UInt_t clusterId)
1139 // find the MUON cluster with this Id in the internal array of cluster
1140 if (!fMuonClusters) return 0x0;
1141 if (!MoveMuonObjects()) return 0x0;
1142 for (Int_t i = 0; i < fMuonClusters->GetEntriesFast(); i++) {
1143 AliESDMuonCluster *cluster = (AliESDMuonCluster*) fMuonClusters->UncheckedAt(i);
1144 if (cluster->GetUniqueID() == clusterId) return cluster;
1149 //______________________________________________________________________________
1150 AliESDMuonCluster* AliESDEvent::NewMuonCluster()
1152 // create a new MUON cluster at the end of the internal array of cluster
1153 TClonesArray &fmu = *fMuonClusters;
1154 return new(fmu[fMuonClusters->GetEntriesFast()]) AliESDMuonCluster();
1157 //______________________________________________________________________________
1158 Int_t AliESDEvent::GetNumberOfMuonPads()
1160 // get the number of MUON pads
1161 if (!fMuonPads) return 0;
1162 if (!MoveMuonObjects()) return 0;
1163 return fMuonPads->GetEntriesFast();
1166 //______________________________________________________________________________
1167 AliESDMuonPad* AliESDEvent::GetMuonPad(Int_t i)
1169 // get the MUON pad at the position i in the internal array of pad
1170 if (!fMuonPads) return 0x0;
1171 if (!MoveMuonObjects()) return 0x0;
1172 return (AliESDMuonPad*) fMuonPads->UncheckedAt(i);
1175 //______________________________________________________________________________
1176 AliESDMuonPad* AliESDEvent::FindMuonPad(UInt_t padId)
1178 // find the MUON pad with this Id in the internal array of pad
1179 if (!fMuonPads) return 0x0;
1180 if (!MoveMuonObjects()) return 0x0;
1181 for (Int_t i = 0; i < fMuonPads->GetEntriesFast(); i++) {
1182 AliESDMuonPad *pad = (AliESDMuonPad*) fMuonPads->UncheckedAt(i);
1183 if (pad->GetUniqueID() == padId) return pad;
1188 //______________________________________________________________________________
1189 AliESDMuonPad* AliESDEvent::NewMuonPad()
1191 // create a new MUON pad at the end of the internal array of pad
1192 TClonesArray &fmu = *fMuonPads;
1193 return new(fmu[fMuonPads->GetEntriesFast()]) AliESDMuonPad();
1196 void AliESDEvent::AddPmdTrack(const AliESDPmdTrack *t)
1198 TClonesArray &fpmd = *fPmdTracks;
1199 new(fpmd[fPmdTracks->GetEntriesFast()]) AliESDPmdTrack(*t);
1202 void AliESDEvent::SetTrdTrigger(const AliESDTrdTrigger *t)
1207 void AliESDEvent::AddTrdTrack(const AliESDTrdTrack *t)
1209 TClonesArray &ftrd = *fTrdTracks;
1210 new(ftrd[fTrdTracks->GetEntriesFast()]) AliESDTrdTrack(*t);
1213 void AliESDEvent::AddTrdTracklet(const AliESDTrdTracklet *trkl)
1215 new ((*fTrdTracklets)[fTrdTracklets->GetEntriesFast()]) AliESDTrdTracklet(*trkl);
1218 void AliESDEvent::AddTrdTracklet(UInt_t trackletWord, Short_t hcid, Int_t label)
1220 new ((*fTrdTracklets)[fTrdTracklets->GetEntriesFast()]) AliESDTrdTracklet(trackletWord, hcid, label);
1223 Int_t AliESDEvent::AddKink(const AliESDkink *c)
1226 TClonesArray &fk = *fKinks;
1227 AliESDkink * kink = new(fk[fKinks->GetEntriesFast()]) AliESDkink(*c);
1228 kink->SetID(fKinks->GetEntriesFast()); // CKB different from the other imps..
1229 return fKinks->GetEntriesFast()-1;
1233 void AliESDEvent::AddCascade(const AliESDcascade *c)
1235 TClonesArray &fc = *fCascades;
1236 new(fc[fCascades->GetEntriesFast()]) AliESDcascade(*c);
1239 void AliESDEvent::AddCosmicTrack(const AliESDCosmicTrack *t)
1241 TClonesArray &ft = *fCosmicTracks;
1242 new(ft[fCosmicTracks->GetEntriesFast()]) AliESDCosmicTrack(*t);
1246 Int_t AliESDEvent::AddCaloCluster(const AliESDCaloCluster *c)
1249 TClonesArray &fc = *fCaloClusters;
1250 AliESDCaloCluster *clus = new(fc[fCaloClusters->GetEntriesFast()]) AliESDCaloCluster(*c);
1251 clus->SetID(fCaloClusters->GetEntriesFast()-1);
1252 return fCaloClusters->GetEntriesFast()-1;
1256 void AliESDEvent::AddRawDataErrorLog(const AliRawDataErrorLog *log) const {
1257 TClonesArray &errlogs = *fErrorLogs;
1258 new(errlogs[errlogs.GetEntriesFast()]) AliRawDataErrorLog(*log);
1261 void AliESDEvent::SetZDCData(const AliESDZDC * obj)
1263 // use already allocated space
1268 void AliESDEvent::SetPrimaryVertexTPC(const AliESDVertex *vertex)
1270 // Set the TPC vertex
1271 // use already allocated space
1273 *fTPCVertex = *vertex;
1274 fTPCVertex->SetName(fgkESDListName[kTPCVertex]);
1278 void AliESDEvent::SetPrimaryVertexSPD(const AliESDVertex *vertex)
1280 // Set the SPD vertex
1281 // use already allocated space
1283 *fSPDVertex = *vertex;
1284 fSPDVertex->SetName(fgkESDListName[kSPDVertex]);
1288 void AliESDEvent::SetPrimaryVertexTracks(const AliESDVertex *vertex)
1290 // Set the primary vertex reconstructed using he ESD tracks.
1291 // use already allocated space
1293 *fPrimaryVertex = *vertex;
1294 fPrimaryVertex->SetName(fgkESDListName[kPrimaryVertex]);
1298 const AliESDVertex * AliESDEvent::GetPrimaryVertex() const
1301 // Get the "best" available reconstructed primary vertex.
1304 if (fPrimaryVertex->GetStatus()) return fPrimaryVertex;
1307 if (fSPDVertex->GetStatus()) return fSPDVertex;
1309 if(fTPCVertex) return fTPCVertex;
1311 AliWarning("No primary vertex available. Returning the \"default\"...");
1315 AliESDVertex * AliESDEvent::PrimaryVertexTracksUnconstrained() const
1318 // Removes diamond constraint from fPrimaryVertex (reconstructed with tracks)
1319 // Returns a AliESDVertex which has to be deleted by the user
1321 if(!fPrimaryVertex) {
1322 AliWarning("No primary vertex from tracks available.");
1325 if(!fPrimaryVertex->GetStatus()) {
1326 AliWarning("No primary vertex from tracks available.");
1330 AliVertexerTracks vertexer(GetMagneticField());
1331 Float_t diamondxyz[3]={(Float_t)GetDiamondX(),(Float_t)GetDiamondY(),0.};
1332 Float_t diamondcovxy[3]; GetDiamondCovXY(diamondcovxy);
1333 Float_t diamondcov[6]={diamondcovxy[0],diamondcovxy[1],diamondcovxy[2],0.,0.,7.};
1334 AliESDVertex *vertex =
1335 (AliESDVertex*)vertexer.RemoveConstraintFromVertex(fPrimaryVertex,diamondxyz,diamondcov);
1340 void AliESDEvent::SetMultiplicity(const AliMultiplicity *mul)
1342 // Set the SPD Multiplicity
1349 void AliESDEvent::SetFMDData(AliESDFMD * obj)
1351 // use already allocated space
1357 void AliESDEvent::SetVZEROData(const AliESDVZERO * obj)
1359 // use already allocated space
1364 void AliESDEvent::SetTZEROData(const AliESDTZERO * obj)
1366 // use already allocated space
1372 //void AliESDEvent::SetMFTData(AliESDMFT * obj)
1379 void AliESDEvent::SetACORDEData(AliESDACORDE * obj)
1385 void AliESDEvent::SetADData(AliESDAD * obj)
1393 void AliESDEvent::GetESDfriend(AliESDfriend *ev) const
1396 // Extracts the complementary info from the ESD
1400 Int_t ntrk=GetNumberOfTracks();
1402 for (Int_t i=0; i<ntrk; i++) {
1403 AliESDtrack *t=GetTrack(i);
1404 if (!t) {AliFatal(Form("NULL pointer for ESD track %d",i));}
1405 const AliESDfriendTrack *f=t->GetFriendTrack();
1408 t->ReleaseESDfriendTrack();// Not to have two copies of "friendTrack"
1412 AliESDfriend *fr = (AliESDfriend*)(const_cast<AliESDEvent*>(this)->FindListObject("AliESDfriend"));
1413 if (fr) ev->SetVZEROfriend(fr->GetVZEROfriend());
1416 void AliESDEvent::AddObject(TObject* obj)
1418 // Add an object to the list of object.
1419 // Please be aware that in order to increase performance you should
1420 // refrain from using TObjArrays (if possible). Use TClonesArrays, instead.
1421 fESDObjects->SetOwner(kTRUE);
1422 fESDObjects->AddLast(obj);
1426 void AliESDEvent::GetStdContent()
1428 // set pointers for standard content
1429 // get by name much safer and not a big overhead since not called very often
1431 fESDRun = (AliESDRun*)fESDObjects->FindObject(fgkESDListName[kESDRun]);
1432 fHeader = (AliESDHeader*)fESDObjects->FindObject(fgkESDListName[kHeader]);
1433 fESDZDC = (AliESDZDC*)fESDObjects->FindObject(fgkESDListName[kESDZDC]);
1434 fESDFMD = (AliESDFMD*)fESDObjects->FindObject(fgkESDListName[kESDFMD]);
1435 fESDVZERO = (AliESDVZERO*)fESDObjects->FindObject(fgkESDListName[kESDVZERO]);
1436 fESDTZERO = (AliESDTZERO*)fESDObjects->FindObject(fgkESDListName[kESDTZERO]);
1437 fTPCVertex = (AliESDVertex*)fESDObjects->FindObject(fgkESDListName[kTPCVertex]);
1438 fSPDVertex = (AliESDVertex*)fESDObjects->FindObject(fgkESDListName[kSPDVertex]);
1439 fPrimaryVertex = (AliESDVertex*)fESDObjects->FindObject(fgkESDListName[kPrimaryVertex]);
1440 fSPDMult = (AliMultiplicity*)fESDObjects->FindObject(fgkESDListName[kSPDMult]);
1441 fPHOSTrigger = (AliESDCaloTrigger*)fESDObjects->FindObject(fgkESDListName[kPHOSTrigger]);
1442 fEMCALTrigger = (AliESDCaloTrigger*)fESDObjects->FindObject(fgkESDListName[kEMCALTrigger]);
1443 fSPDPileupVertices = (TClonesArray*)fESDObjects->FindObject(fgkESDListName[kSPDPileupVertices]);
1444 fTrkPileupVertices = (TClonesArray*)fESDObjects->FindObject(fgkESDListName[kTrkPileupVertices]);
1445 fTracks = (TClonesArray*)fESDObjects->FindObject(fgkESDListName[kTracks]);
1446 fMuonTracks = (TClonesArray*)fESDObjects->FindObject(fgkESDListName[kMuonTracks]);
1447 fMuonClusters = (TClonesArray*)fESDObjects->FindObject(fgkESDListName[kMuonClusters]);
1448 fMuonPads = (TClonesArray*)fESDObjects->FindObject(fgkESDListName[kMuonPads]);
1449 fPmdTracks = (TClonesArray*)fESDObjects->FindObject(fgkESDListName[kPmdTracks]);
1450 fTrdTrigger = (AliESDTrdTrigger*)fESDObjects->FindObject(fgkESDListName[kTrdTrigger]);
1451 fTrdTracks = (TClonesArray*)fESDObjects->FindObject(fgkESDListName[kTrdTracks]);
1452 fTrdTracklets = (TClonesArray*)fESDObjects->FindObject(fgkESDListName[kTrdTracklets]);
1453 fV0s = (TClonesArray*)fESDObjects->FindObject(fgkESDListName[kV0s]);
1454 fCascades = (TClonesArray*)fESDObjects->FindObject(fgkESDListName[kCascades]);
1455 fKinks = (TClonesArray*)fESDObjects->FindObject(fgkESDListName[kKinks]);
1456 fCaloClusters = (TClonesArray*)fESDObjects->FindObject(fgkESDListName[kCaloClusters]);
1457 fEMCALCells = (AliESDCaloCells*)fESDObjects->FindObject(fgkESDListName[kEMCALCells]);
1458 fPHOSCells = (AliESDCaloCells*)fESDObjects->FindObject(fgkESDListName[kPHOSCells]);
1459 fErrorLogs = (TClonesArray*)fESDObjects->FindObject(fgkESDListName[kErrorLogs]);
1460 fESDACORDE = (AliESDACORDE*)fESDObjects->FindObject(fgkESDListName[kESDACORDE]);
1461 fESDAD = (AliESDAD*)fESDObjects->FindObject(fgkESDListName[kESDAD]);
1462 fTOFHeader = (AliTOFHeader*)fESDObjects->FindObject(fgkESDListName[kTOFHeader]);
1463 fCosmicTracks = (TClonesArray*)fESDObjects->FindObject(fgkESDListName[kCosmicTracks]);
1465 // fESDMFT = (AliESDMFT*)fESDObjects->FindObject(fgkESDListName[kESDMFT]);
1469 void AliESDEvent::SetStdNames(){
1470 // Set the names of the standard contents
1472 if(fESDObjects->GetEntries()>=kESDListN){
1473 for(int i = 0;i < fESDObjects->GetEntries() && i<kESDListN;i++){
1474 TObject *fObj = fESDObjects->At(i);
1475 if(fObj->InheritsFrom("TNamed")){
1476 ((TNamed*)fObj)->SetName(fgkESDListName[i]);
1478 else if(fObj->InheritsFrom("TClonesArray")){
1479 ((TClonesArray*)fObj)->SetName(fgkESDListName[i]);
1484 AliWarning("Std Entries missing");
1489 void AliESDEvent::CreateStdContent(Bool_t bUseThisList){
1490 fUseOwnList = bUseThisList;
1494 void AliESDEvent::CreateStdContent()
1496 // create the standard AOD content and set pointers
1498 // create standard objects and add them to the TList of objects
1499 AddObject(new AliESDRun());
1500 AddObject(new AliESDHeader());
1501 AddObject(new AliESDZDC());
1502 AddObject(new AliESDFMD());
1503 AddObject(new AliESDVZERO());
1504 AddObject(new AliESDTZERO());
1505 AddObject(new AliESDVertex());
1506 AddObject(new AliESDVertex());
1507 AddObject(new AliESDVertex());
1508 AddObject(new AliMultiplicity());
1509 AddObject(new AliESDCaloTrigger());
1510 AddObject(new AliESDCaloTrigger());
1511 AddObject(new TClonesArray("AliESDVertex",0));
1512 AddObject(new TClonesArray("AliESDVertex",0));
1513 AddObject(new TClonesArray("AliESDtrack",0));
1514 AddObject(new TClonesArray("AliESDMuonTrack",0));
1515 AddObject(new TClonesArray("AliESDMuonCluster",0));
1516 AddObject(new TClonesArray("AliESDMuonPad",0));
1517 AddObject(new TClonesArray("AliESDPmdTrack",0));
1518 AddObject(new AliESDTrdTrigger());
1519 AddObject(new TClonesArray("AliESDTrdTrack",0));
1520 AddObject(new TClonesArray("AliESDTrdTracklet",0));
1521 AddObject(new TClonesArray("AliESDv0",0));
1522 AddObject(new TClonesArray("AliESDcascade",0));
1523 AddObject(new TClonesArray("AliESDkink",0));
1524 AddObject(new TClonesArray("AliESDCaloCluster",0));
1525 AddObject(new AliESDCaloCells());
1526 AddObject(new AliESDCaloCells());
1527 AddObject(new TClonesArray("AliRawDataErrorLog",0));
1528 AddObject(new AliESDACORDE());
1529 AddObject(new AliESDAD());
1530 AddObject(new AliTOFHeader());
1531 AddObject(new TClonesArray("AliESDCosmicTrack",0));
1533 //AddObject(new AliESDMFT());
1536 // check the order of the indices against enum...
1540 // read back pointers
1544 void AliESDEvent::CompleteStdContent()
1546 // Create missing standard objects and add them to the TList of objects
1548 // Add cosmic tracks for cases where esd files were created
1549 // before adding them to the std content
1550 if (!fESDObjects->FindObject(fgkESDListName[kCosmicTracks])) {
1551 TClonesArray* cosmics = new TClonesArray("AliESDCosmicTrack",0);
1552 fESDObjects->AddAt(cosmics, kCosmicTracks);
1553 fESDObjects->SetOwner(kTRUE);
1555 // Add new MUON containers if missing (for backward compatibility)
1556 if (!fESDObjects->FindObject(fgkESDListName[kMuonClusters])) {
1557 TClonesArray* muonClusters = new TClonesArray("AliESDMuonCluster",0);
1558 muonClusters->SetName(fgkESDListName[kMuonClusters]);
1559 fESDObjects->AddAt(muonClusters, kMuonClusters);
1560 fESDObjects->SetOwner(kTRUE);
1562 if (!fESDObjects->FindObject(fgkESDListName[kMuonPads])) {
1563 TClonesArray* muonPads = new TClonesArray("AliESDMuonPad",0);
1564 muonPads->SetName(fgkESDListName[kMuonPads]);
1565 fESDObjects->AddAt(muonPads, kMuonPads);
1566 fESDObjects->SetOwner(kTRUE);
1570 TObject* AliESDEvent::FindListObject(const char *name) const {
1572 // Find object with name "name" in the list of branches
1575 return fESDObjects->FindObject(name);
1580 Int_t AliESDEvent::GetPHOSClusters(TRefArray *clusters) const
1582 // fills the provided TRefArray with all found phos clusters
1586 AliESDCaloCluster *cl = 0;
1587 for (Int_t i = 0; i < GetNumberOfCaloClusters(); i++) {
1589 if ( (cl = GetCaloCluster(i)) ) {
1592 AliDebug(1,Form("IsPHOS cluster %d Size: %d \n",i,clusters->GetEntriesFast()));
1596 return clusters->GetEntriesFast();
1599 Int_t AliESDEvent::GetEMCALClusters(TRefArray *clusters) const
1601 // fills the provided TRefArray with all found emcal clusters
1605 AliESDCaloCluster *cl = 0;
1606 for (Int_t i = 0; i < GetNumberOfCaloClusters(); i++) {
1608 if ( (cl = GetCaloCluster(i)) ) {
1611 AliDebug(1,Form("IsEMCAL cluster %d Size: %d \n",i,clusters->GetEntriesFast()));
1615 return clusters->GetEntriesFast();
1618 void AliESDEvent::WriteToTree(TTree* tree) const {
1619 // Book the branches as in TTree::Branch(TCollection*)
1620 // but add a "." at the end of top level branches which are
1621 // not a TClonesArray
1625 TIter next(fESDObjects);
1626 const Int_t kSplitlevel = 99; // default value in TTree::Branch()
1627 const Int_t kBufsize = 32000; // default value in TTree::Branch()
1630 while ((obj = next())) {
1631 branchname.Form("%s", obj->GetName());
1632 if(branchname.CompareTo("AliESDfriend")==0)branchname = "ESDfriend.";
1633 if ((kSplitlevel > 1) && !obj->InheritsFrom(TClonesArray::Class())) {
1634 if(!branchname.EndsWith("."))branchname += ".";
1636 if (!tree->FindBranch(branchname)) {
1637 // For the custom streamer to be called splitlevel
1638 // has to be negative, only needed for HLT
1639 Int_t splitLevel = (TString(obj->ClassName()) == "AliHLTGlobalTriggerDecision") ? -1 : kSplitlevel - 1;
1640 tree->Bronch(branchname, obj->ClassName(), fESDObjects->GetObjectRef(obj),kBufsize, splitLevel);
1643 tree->Branch("fDetectorStatus",(void*)&fDetectorStatus,"fDetectorStatus/l");
1644 tree->Branch("fDAQDetectorPattern",(void*)&fDAQDetectorPattern,"fDAQDetectorPattern/i");
1645 tree->Branch("fDAQAttributes",(void*)&fDAQAttributes,"fDAQAttributes/i");
1649 void AliESDEvent::ReadFromTree(TTree *tree, Option_t* opt){
1651 // Connect the ESDEvent to a tree
1654 AliWarning("AliESDEvent::ReadFromTree() Zero Pointer to Tree \n");
1658 if(!tree->GetTree())tree->LoadTree(0);
1660 // if we find the "ESD" branch on the tree we do have the old structure
1661 if(tree->GetBranch("ESD")) {
1662 fOldMuonStructure = kFALSE;
1663 char ** address = (char **)(tree->GetBranch("ESD")->GetAddress());
1664 // do we have the friend branch
1665 TBranch * esdFB = tree->GetBranch("ESDfriend.");
1666 char ** addressF = 0;
1667 if(esdFB)addressF = (char **)(esdFB->GetAddress());
1669 AliInfo("AliESDEvent::ReadFromTree() Reading old Tree");
1670 tree->SetBranchAddress("ESD", &fESDOld);
1672 tree->SetBranchAddress("ESDfriend.",&fESDFriendOld);
1675 AliInfo("AliESDEvent::ReadFromTree() Reading old Tree");
1676 AliInfo("Branch already connected. Using existing branch address.");
1677 fESDOld = (AliESD*) (*address);
1678 // addressF can still be 0, since branch needs to switched on
1679 if(addressF)fESDFriendOld = (AliESDfriend*) (*addressF);
1682 // have already connected the old ESD structure... ?
1683 // reuse also the pointer of the AlliESDEvent
1684 // otherwise create new ones
1685 TList* connectedList = (TList*) (tree->GetUserInfo()->FindObject("ESDObjectsConnectedToTree"));
1688 // If connected use the connected list of objects
1689 if(fESDObjects!= connectedList){
1690 // protect when called twice
1691 fESDObjects->Delete();
1692 fESDObjects = connectedList;
1697 // The pointer to the friend changes when called twice via InitIO
1698 // since AliESDEvent is deleted
1699 TObject* oldf = FindListObject("AliESDfriend");
1702 newf = (TObject*)*addressF;
1704 if(newf!=0&&oldf!=newf){
1705 // remove the old reference
1706 // Should we also delete it? Or is this handled in TTree I/O
1707 // since it is created by the first SetBranchAddress
1708 fESDObjects->Remove(oldf);
1710 fESDObjects->Add(newf);
1717 CreateStdContent(); // create for copy
1718 // if we have the esdfriend add it, so we always can access it via the userinfo
1719 if(fESDFriendOld)AddObject(fESDFriendOld);
1720 // we are not owner of the list objects
1721 // must not delete it
1722 fESDObjects->SetOwner(kTRUE);
1723 fESDObjects->SetName("ESDObjectsConnectedToTree");
1724 tree->GetUserInfo()->Add(fESDObjects);
1732 // Try to find AliESDEvent
1733 AliESDEvent *esdEvent = 0;
1734 esdEvent = (AliESDEvent*)tree->GetTree()->GetUserInfo()->FindObject("AliESDEvent");
1736 // Check if already connected to tree
1738 TList* connectedList = (TList*) (tree->GetUserInfo()->FindObject("ESDObjectsConnectedToTree"));
1741 if (connectedList && (strcmp(opt, "reconnect"))) {
1742 // If connected use the connected list if objects
1743 fESDObjects->Delete();
1744 fESDObjects = connectedList;
1745 tree->SetBranchAddress("fDetectorStatus",&fDetectorStatus); //PH probably redundant
1746 tree->SetBranchAddress("fDAQDetectorPattern",&fDAQDetectorPattern);
1747 tree->SetBranchAddress("fDAQAttributes",&fDAQAttributes);
1749 fOldMuonStructure = fESDObjects->TestBit(BIT(23));
1755 // prevent a memory leak when reading back the TList
1756 // if (!(strcmp(opt, "reconnect"))) fESDObjects->Delete();
1759 // create a new TList from the UserInfo TList...
1760 // copy constructor does not work...
1761 fESDObjects = (TList*)(esdEvent->GetList()->Clone());
1762 fESDObjects->SetOwner(kTRUE);
1764 else if ( fESDObjects->GetEntries()==0){
1765 // at least create the std content if we want to read to our list
1770 // we only need new things in the list if we do no already have it..
1771 // TODO just add new entries
1772 CompleteStdContent();
1774 if(fESDObjects->GetEntries()<kESDListN){
1775 AliWarning(Form("AliESDEvent::ReadFromTree() TList contains less than the standard contents %d < %d \n",
1776 fESDObjects->GetEntries(),kESDListN));
1778 // set the branch addresses
1779 fOldMuonStructure = kFALSE;
1780 TIter next(fESDObjects);
1782 while((el=(TNamed*)next())){
1783 TString bname(el->GetName());
1784 if(bname.CompareTo("AliESDfriend")==0)
1786 // AliESDfriend does not have a name ...
1787 TBranch *br = tree->GetBranch("ESDfriend.");
1788 if (br) tree->SetBranchAddress("ESDfriend.",fESDObjects->GetObjectRef(el));
1791 // check if branch exists under this Name
1792 TBranch *br = tree->GetBranch(bname.Data());
1794 tree->SetBranchAddress(bname.Data(),fESDObjects->GetObjectRef(el));
1797 br = tree->GetBranch(Form("%s.",bname.Data()));
1799 tree->SetBranchAddress(Form("%s.",bname.Data()),fESDObjects->GetObjectRef(el));
1802 AliWarning(Form("AliESDEvent::ReadFromTree() No Branch found with Name %s or %s.",bname.Data(),bname.Data()));
1803 if (bname == fgkESDListName[kMuonClusters]) {
1804 fOldMuonStructure = kTRUE;
1811 tree->SetBranchAddress("fDetectorStatus",&fDetectorStatus);
1812 tree->SetBranchAddress("fDAQDetectorPattern",&fDAQDetectorPattern);
1813 tree->SetBranchAddress("fDAQAttributes",&fDAQAttributes);
1815 // when reading back we are not owner of the list
1816 // must not delete it
1817 fESDObjects->SetOwner(kTRUE);
1818 fESDObjects->SetName("ESDObjectsConnectedToTree");
1819 fESDObjects->SetBit(BIT(23), fOldMuonStructure);
1820 // we are not owner of the list objects
1821 // must not delete it
1822 tree->GetUserInfo()->Add(fESDObjects);
1823 tree->GetUserInfo()->SetOwner(kFALSE);
1827 // we can't get the list from the user data, create standard content
1828 // and set it by hand (no ESDfriend at the moment
1830 fOldMuonStructure = kFALSE;
1831 TIter next(fESDObjects);
1833 while((el=(TNamed*)next())){
1834 TString bname(el->GetName());
1835 TBranch *br = tree->GetBranch(bname.Data());
1837 tree->SetBranchAddress(bname.Data(),fESDObjects->GetObjectRef(el));
1840 br = tree->GetBranch(Form("%s.",bname.Data()));
1842 tree->SetBranchAddress(Form("%s.",bname.Data()),fESDObjects->GetObjectRef(el));
1844 else if (bname == fgkESDListName[kMuonClusters]) {
1845 fOldMuonStructure = kTRUE;
1849 tree->SetBranchAddress("fDetectorStatus",&fDetectorStatus);
1850 tree->SetBranchAddress("fDAQDetectorPattern",&fDAQDetectorPattern);
1851 tree->SetBranchAddress("fDAQAttributes",&fDAQAttributes);
1853 // when reading back we are not owner of the list
1854 // must not delete it
1855 fESDObjects->SetOwner(kTRUE);
1860 void AliESDEvent::CopyFromOldESD()
1862 // Method which copies over everthing from the old esd structure to the
1867 SetRunNumber(fESDOld->GetRunNumber());
1868 SetPeriodNumber(fESDOld->GetPeriodNumber());
1869 SetMagneticField(fESDOld->GetMagneticField());
1871 // leave out diamond ...
1872 // SetDiamond(const AliESDVertex *vertex) { fESDRun->SetDiamond(vertex);}
1875 SetTriggerMask(fESDOld->GetTriggerMask());
1876 SetOrbitNumber(fESDOld->GetOrbitNumber());
1877 SetTimeStamp(fESDOld->GetTimeStamp());
1878 SetEventType(fESDOld->GetEventType());
1879 SetEventNumberInFile(fESDOld->GetEventNumberInFile());
1880 SetBunchCrossNumber(fESDOld->GetBunchCrossNumber());
1881 SetTriggerCluster(fESDOld->GetTriggerCluster());
1885 SetZDC(fESDOld->GetZDCN1Energy(),
1886 fESDOld->GetZDCP1Energy(),
1887 fESDOld->GetZDCEMEnergy(),
1889 fESDOld->GetZDCN2Energy(),
1890 fESDOld->GetZDCP2Energy(),
1891 fESDOld->GetZDCParticipants(),
1901 if(fESDOld->GetFMDData())SetFMDData(fESDOld->GetFMDData());
1905 SetT0zVertex(fESDOld->GetT0zVertex());
1906 SetT0(fESDOld->GetT0());
1910 if (fESDOld->GetVZEROData()) SetVZEROData(fESDOld->GetVZEROData());
1912 if(fESDOld->GetVertex())SetPrimaryVertexSPD(fESDOld->GetVertex());
1914 if(fESDOld->GetPrimaryVertex())SetPrimaryVertexTracks(fESDOld->GetPrimaryVertex());
1916 if(fESDOld->GetMultiplicity())SetMultiplicity(fESDOld->GetMultiplicity());
1918 for(int i = 0;i<fESDOld->GetNumberOfTracks();i++){
1919 AddTrack(fESDOld->GetTrack(i));
1922 for(int i = 0;i<fESDOld->GetNumberOfMuonTracks();i++){
1923 AddMuonTrack(fESDOld->GetMuonTrack(i));
1926 for(int i = 0;i<fESDOld->GetNumberOfPmdTracks();i++){
1927 AddPmdTrack(fESDOld->GetPmdTrack(i));
1930 for(int i = 0;i<fESDOld->GetNumberOfTrdTracks();i++){
1931 AddTrdTrack(fESDOld->GetTrdTrack(i));
1934 for(int i = 0;i<fESDOld->GetNumberOfV0s();i++){
1935 AddV0(fESDOld->GetV0(i));
1938 for(int i = 0;i<fESDOld->GetNumberOfCascades();i++){
1939 AddCascade(fESDOld->GetCascade(i));
1942 for(int i = 0;i<fESDOld->GetNumberOfKinks();i++){
1943 AddKink(fESDOld->GetKink(i));
1947 for(int i = 0;i<fESDOld->GetNumberOfCaloClusters();i++){
1948 AddCaloCluster(fESDOld->GetCaloCluster(i));
1953 // if (fESDOld->GetMFTData()) SetMFTData(fESDOld->GetMFTData());
1959 Bool_t AliESDEvent::IsEventSelected(const char *trigExpr) const
1961 // Check if the event satisfies the trigger
1962 // selection expression trigExpr.
1963 // trigExpr can be any logical expression
1964 // of the trigger classes defined in AliESDRun
1965 // In case of wrong syntax return kTRUE.
1967 TString expr(trigExpr);
1968 if (expr.IsNull()) return kTRUE;
1970 ULong64_t mask = GetTriggerMask();
1971 for(Int_t itrig = 0; itrig < AliESDRun::kNTriggerClasses; itrig++) {
1972 if (mask & (1ull << itrig)) {
1973 expr.ReplaceAll(GetESDRun()->GetTriggerClass(itrig),"1");
1976 expr.ReplaceAll(GetESDRun()->GetTriggerClass(itrig),"0");
1981 if ((gROOT->ProcessLineFast(expr.Data(),&error) == 0) &&
1982 (error == TInterpreter::kNoError)) {
1990 TObject* AliESDEvent::GetHLTTriggerDecision() const
1992 // get the HLT trigger decission object
1994 // cast away const'nes because the FindListObject method
1996 AliESDEvent* pNonConst=const_cast<AliESDEvent*>(this);
1997 return pNonConst->FindListObject("HLTGlobalTrigger");
2000 TString AliESDEvent::GetHLTTriggerDescription() const
2002 // get the HLT trigger decission description
2003 TString description;
2004 TObject* pDecision=GetHLTTriggerDecision();
2006 description=pDecision->GetTitle();
2012 Bool_t AliESDEvent::IsHLTTriggerFired(const char* name) const
2014 // get the HLT trigger decission description
2015 TObject* pDecision=GetHLTTriggerDecision();
2016 if (!pDecision) return kFALSE;
2018 Option_t* option=pDecision->GetOption();
2019 if (option==NULL || *option!='1') return kFALSE;
2022 TString description=GetHLTTriggerDescription();
2023 Int_t index=description.Index(name);
2024 if (index<0) return kFALSE;
2025 index+=strlen(name);
2026 if (index>=description.Length()) return kFALSE;
2027 if (description[index]!=0 && description[index]!=' ') return kFALSE;
2032 //______________________________________________________________________________
2033 Bool_t AliESDEvent::IsPileupFromSPD(Int_t minContributors,
2035 Double_t nSigmaZdist,
2036 Double_t nSigmaDiamXY,
2037 Double_t nSigmaDiamZ) const{
2039 // This function checks if there was a pile up
2040 // reconstructed with SPD
2042 Int_t nc1=fSPDVertex->GetNContributors();
2043 if(nc1<1) return kFALSE;
2044 Int_t nPileVert=GetNumberOfPileupVerticesSPD();
2045 if(nPileVert==0) return kFALSE;
2047 for(Int_t i=0; i<nPileVert;i++){
2048 const AliESDVertex* pv=GetPileupVertexSPD(i);
2049 Int_t nc2=pv->GetNContributors();
2050 if(nc2>=minContributors){
2051 Double_t z1=fSPDVertex->GetZ();
2052 Double_t z2=pv->GetZ();
2053 Double_t distZ=TMath::Abs(z2-z1);
2054 Double_t distZdiam=TMath::Abs(z2-GetDiamondZ());
2055 Double_t cutZdiam=nSigmaDiamZ*TMath::Sqrt(GetSigma2DiamondZ());
2056 if(GetSigma2DiamondZ()<0.0001)cutZdiam=99999.; //protection for missing z diamond information
2057 if(distZ>minZdist && distZdiam<cutZdiam){
2058 Double_t x2=pv->GetX();
2059 Double_t y2=pv->GetY();
2060 Double_t distXdiam=TMath::Abs(x2-GetDiamondX());
2061 Double_t distYdiam=TMath::Abs(y2-GetDiamondY());
2062 Double_t cov1[6],cov2[6];
2063 fSPDVertex->GetCovarianceMatrix(cov1);
2064 pv->GetCovarianceMatrix(cov2);
2065 Double_t errxDist=TMath::Sqrt(cov2[0]+GetSigma2DiamondX());
2066 Double_t erryDist=TMath::Sqrt(cov2[2]+GetSigma2DiamondY());
2067 Double_t errzDist=TMath::Sqrt(cov1[5]+cov2[5]);
2068 Double_t cutXdiam=nSigmaDiamXY*errxDist;
2069 if(GetSigma2DiamondX()<0.0001)cutXdiam=99999.; //protection for missing diamond information
2070 Double_t cutYdiam=nSigmaDiamXY*erryDist;
2071 if(GetSigma2DiamondY()<0.0001)cutYdiam=99999.; //protection for missing diamond information
2072 if( (distXdiam<cutXdiam) && (distYdiam<cutYdiam) && (distZ>nSigmaZdist*errzDist) ){
2081 //______________________________________________________________________________
2082 void AliESDEvent::EstimateMultiplicity(Int_t &tracklets, Int_t &trITSTPC, Int_t &trITSSApure, Double_t eta, Bool_t useDCAFlag,Bool_t useV0Flag) const
2085 // calculates 3 estimators for the multiplicity in the -eta:eta range
2086 // tracklets : using SPD tracklets only
2087 // trITSTPC : using TPC/ITS + complementary ITS SA tracks + tracklets from clusters not used by tracks
2088 // trITSSApure : using ITS standalone tracks + tracklets from clusters not used by tracks
2089 // if useDCAFlag is true: account for the ESDtrack flag marking the tracks with large DCA
2090 // if useV0Flag is true: account for the ESDtrack flag marking conversion and K0's V0s
2092 AliWarning("This obsolete method will be eliminated soon. Use AliESDtrackCuts::GetReferenceMultiplicity");
2094 tracklets = trITSSApure = trITSTPC = 0;
2095 int ntr = fSPDMult ? fSPDMult->GetNumberOfTracklets() : 0;
2098 for (int itr=ntr;itr--;) {
2099 if (TMath::Abs(fSPDMult->GetEta(itr))>eta) continue;
2101 if (fSPDMult->FreeClustersTracklet(itr,0)) trITSTPC++; // not used in ITS/TPC or ITS_SA track
2102 if (fSPDMult->FreeClustersTracklet(itr,1)) trITSSApure++; // not used in ITS_SA_Pure track
2105 // count real tracks
2106 ntr = GetNumberOfTracks();
2107 for (int itr=ntr;itr--;) {
2108 AliESDtrack *t = GetTrack(itr);
2109 if (!t) {AliFatal(Form("NULL pointer for ESD track %d",itr));}
2110 if (TMath::Abs(t->Eta())>eta) continue;
2111 if (!t->IsOn(AliESDtrack::kITSin)) continue;
2112 if (useDCAFlag && t->IsOn(AliESDtrack::kMultSec)) continue;
2113 if (useV0Flag && t->IsOn(AliESDtrack::kMultInV0)) continue;
2114 if (t->IsOn(AliESDtrack::kITSpureSA)) trITSSApure++;
2120 Bool_t AliESDEvent::IsPileupFromSPDInMultBins() const {
2121 Int_t nTracklets=GetMultiplicity()->GetNumberOfTracklets();
2122 if(nTracklets<20) return IsPileupFromSPD(3,0.8);
2123 else if(nTracklets<50) return IsPileupFromSPD(4,0.8);
2124 else return IsPileupFromSPD(5,0.8);
2127 void AliESDEvent::SetTOFHeader(const AliTOFHeader *header)
2130 // Set the TOF event_time
2134 *fTOFHeader=*header;
2135 //fTOFHeader->SetName(fgkESDListName[kTOFHeader]);
2138 // for analysis of reconstructed events
2139 // when this information is not avaliable
2140 fTOFHeader = new AliTOFHeader(*header);
2141 //AddObject(fTOFHeader);
2146 AliCentrality* AliESDEvent::GetCentrality()
2148 if (!fCentrality) fCentrality = new AliCentrality();
2152 AliEventplane* AliESDEvent::GetEventplane()
2154 if (!fEventplane) fEventplane = new AliEventplane();
2158 Float_t AliESDEvent::GetVZEROEqMultiplicity(Int_t i) const
2160 // Get VZERO Multiplicity for channel i
2161 // Themethod uses the equalization factors
2162 // stored in the ESD-run object in order to
2163 // get equal multiplicities within a VZERO rins (1/8 of VZERO)
2164 if (!fESDVZERO || !fESDRun) return -1;
2167 Float_t factorSum = 0;
2168 for(Int_t j = 8*ring; j < (8*ring+8); ++j) {
2169 factorSum += fESDRun->GetVZEROEqFactors(j);
2171 Float_t factor = fESDRun->GetVZEROEqFactors(i)*8./factorSum;
2173 return (fESDVZERO->GetMultiplicity(i)/factor);