1 /**************************************************************************
2 * Copyright(c) 1998-2007, 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 **************************************************************************/
18 //-------------------------------------------------------------------------
20 // Author: Markus Oldenburg, CERN
21 //-------------------------------------------------------------------------
26 #include <TFriendElement.h>
27 #include <TProcessID.h>
28 #include <TCollection.h>
29 #include "Riostream.h"
30 #include "AliAODEvent.h"
31 #include "AliAODHeader.h"
32 #include "AliAODTrack.h"
33 #include "AliAODDimuon.h"
37 // definition of std AOD member names
38 const char* AliAODEvent::fAODListName[kAODListN] = {"header",
62 //______________________________________________________________________________
63 AliAODEvent::AliAODEvent() :
91 // default constructor
92 if (TClass::IsCallingNew() != TClass::kDummyNew) fAODObjects = new TList();
95 //______________________________________________________________________________
96 AliAODEvent::AliAODEvent(const AliAODEvent& aod):
98 fAODObjects(new TList()),
101 fHeader(new AliAODHeader(*aod.fHeader)),
102 fTracks(new TClonesArray(*aod.fTracks)),
103 fVertices(new TClonesArray(*aod.fVertices)),
104 fV0s(new TClonesArray(*aod.fV0s)),
105 fCascades(new TClonesArray(*aod.fCascades)),
106 fTracklets(new AliAODTracklets(*aod.fTracklets)),
107 fJets(new TClonesArray(*aod.fJets)),
108 fEmcalCells(new AliAODCaloCells(*aod.fEmcalCells)),
109 fPhosCells(new AliAODCaloCells(*aod.fPhosCells)),
110 fCaloClusters(new TClonesArray(*aod.fCaloClusters)),
111 fEMCALTrigger(new AliAODCaloTrigger(*aod.fEMCALTrigger)),
112 fPHOSTrigger(new AliAODCaloTrigger(*aod.fPHOSTrigger)),
113 fFmdClusters(new TClonesArray(*aod.fFmdClusters)),
114 fPmdClusters(new TClonesArray(*aod.fPmdClusters)),
115 fDimuons(new TClonesArray(*aod.fDimuons)),
116 fAODTZERO(new AliAODTZERO(*aod.fAODTZERO)),
117 fAODVZERO(new AliAODVZERO(*aod.fAODVZERO)),
118 fAODZDC(new AliAODZDC(*aod.fAODZDC)),
119 fTOFHeader(new AliTOFHeader(*aod.fTOFHeader))
121 ,fAODMFT(new AliAODMFT(*aod.fAODMFT))
127 AddObject(fVertices);
129 AddObject(fCascades);
130 AddObject(fTracklets);
132 AddObject(fEmcalCells);
133 AddObject(fPhosCells);
134 AddObject(fCaloClusters);
135 AddObject(fEMCALTrigger);
136 AddObject(fPHOSTrigger);
137 AddObject(fFmdClusters);
138 AddObject(fPmdClusters);
140 AddObject(fAODTZERO);
141 AddObject(fAODVZERO);
143 AddObject(fTOFHeader);
145 AddObject(fAODVZERO);
147 fConnected = aod.fConnected;
152 //______________________________________________________________________________
153 AliAODEvent & AliAODEvent::operator=(const AliAODEvent& aod) {
155 // Assignment operator
157 if(&aod == this) return *this;
158 AliVEvent::operator=(aod);
160 // This assumes that the list is already created
161 // and that the virtual void Copy(Tobject&) function
162 // is correctly implemented in the derived class
163 // otherwise only TObject::Copy() will be used
165 if((fAODObjects->GetSize()==0)&&(aod.fAODObjects->GetSize()>=kAODListN)){
166 // We cover the case that we do not yet have the
167 // standard content but the source has it
171 // Here we have the standard content without user additions, but the content is
172 // not matching the aod source.
174 // Iterate the list of source objects
175 TIter next(aod.GetList());
178 while ((its = next())) {
179 name = its->GetName();
180 // Check if we have this object type in out list
181 TObject *mine = fAODObjects->FindObject(name);
183 // We have to create the same type of object.
184 TClass* pClass=TClass::GetClass(its->ClassName());
186 AliWarning(Form("Can not find class description for entry %s (%s)\n",
187 its->ClassName(), name.Data()));
190 mine=(TObject*)pClass->New();
192 // not in this: can be added to list
193 AliWarning(Form("%s:%d Could not find %s for copying \n",
194 (char*)__FILE__,__LINE__,name.Data()));
197 if(mine->InheritsFrom("TNamed")) {
198 ((TNamed*)mine)->SetName(name);
199 } else if(mine->InheritsFrom("TCollection")){
200 if(mine->InheritsFrom("TClonesArray")) {
201 TClonesArray *itscl = dynamic_cast<TClonesArray*>(its);
203 AliWarning(Form("Class description for entry %s (%s) not TClonesArray\n",
204 its->ClassName(), name.Data()));
208 dynamic_cast<TClonesArray*>(mine)->SetClass(itscl->GetClass(), itscl->GetSize());
210 dynamic_cast<TCollection*>(mine)->SetName(name);
212 AliDebug(1, Form("adding object %s of type %s", mine->GetName(), mine->ClassName()));
215 // Now we have an object of the same type and name, but different content.
216 if(!its->InheritsFrom("TCollection")){
217 // simple objects (do they have a Copy method that calls operator= ?)
219 } else if (its->InheritsFrom("TClonesArray")) {
220 // Create or expand the tclonesarray pointers
221 // so we can directly copy to the object
222 TClonesArray *its_tca = (TClonesArray*)its;
223 TClonesArray *mine_tca = (TClonesArray*)mine;
224 // this leaves the capacity of the TClonesArray the same
225 // except for a factor of 2 increase when size > capacity
226 // does not release any memory occupied by the tca
227 Int_t its_entries = its_tca->GetEntriesFast();
228 mine_tca->ExpandCreate(its_entries);
229 for(int i=0; i<its_entries; i++){
231 TObject *mine_tca_obj = mine_tca->At(i);
232 TObject *its_tca_obj = its_tca->At(i);
233 // no need to delete first
234 // pointers within the class should be handled by Copy()...
235 // Can there be Empty slots?
236 its_tca_obj->Copy(*mine_tca_obj);
239 AliWarning(Form("%s:%d cannot copy TCollection \n",
240 (char*)__FILE__,__LINE__));
243 fConnected = aod.fConnected;
248 //______________________________________________________________________________
249 AliAODEvent::~AliAODEvent()
255 // fAODObjects->Delete("slow");
260 //______________________________________________________________________________
261 void AliAODEvent::AddObject(TObject* obj)
263 // Add an object to the list of objects.
264 // Please be aware that in order to increase performance you should
265 // refrain from using TObjArrays (if possible). Use TClonesArrays, instead.
267 // if ( !fAODObjects ) {
268 // fAODObjects = new TList();
269 // fAODObjects->SetOwner();
271 if ( !fAODObjects->FindObject(obj) )
273 fAODObjects->AddLast(obj);
277 //______________________________________________________________________________
278 void AliAODEvent::RemoveObject(TObject* obj)
280 // Removes an object from the list of objects.
282 fAODObjects->Remove(obj);
285 //______________________________________________________________________________
286 TObject *AliAODEvent::FindListObject(const char *objName) const
288 // Return the pointer to the object with the given name.
290 return fAODObjects->FindObject(objName);
293 //______________________________________________________________________________
294 void AliAODEvent::CreateStdContent()
296 // create the standard AOD content and set pointers
298 // create standard objects and add them to the TList of objects
299 AddObject(new AliAODHeader());
300 AddObject(new TClonesArray("AliAODTrack", 0));
301 AddObject(new TClonesArray("AliAODVertex", 0));
302 AddObject(new TClonesArray("AliAODv0", 0));
303 AddObject(new TClonesArray("AliAODcascade", 0));
304 AddObject(new AliAODTracklets());
305 AddObject(new TClonesArray("AliAODJet", 0));
306 AddObject(new AliAODCaloCells());
307 AddObject(new AliAODCaloCells());
308 AddObject(new TClonesArray("AliAODCaloCluster", 0));
309 AddObject(new AliAODCaloTrigger()); // EMCAL
310 AddObject(new AliAODCaloTrigger()); // PHOS
311 AddObject(new TClonesArray("AliAODFmdCluster", 0));
312 AddObject(new TClonesArray("AliAODPmdCluster", 0));
313 AddObject(new TClonesArray("AliAODDimuon", 0));
314 AddObject(new AliAODTZERO());
315 AddObject(new AliAODVZERO());
316 AddObject(new AliAODZDC());
317 AddObject(new AliTOFHeader());
319 AddObject(new AliAODMFT());
324 // read back pointers
330 void AliAODEvent::MakeEntriesReferencable()
332 // Make all entries referencable in a subsequent process
334 TIter next(fAODObjects);
336 while ((obj = next()))
338 if(obj->InheritsFrom("TCollection"))
340 AssignIDtoCollection((TCollection*)obj);
345 //______________________________________________________________________________
346 void AliAODEvent::SetStdNames()
348 // introduce the standard naming
350 if(fAODObjects->GetEntries()==kAODListN){
351 for(int i = 0;i < fAODObjects->GetEntries();i++){
352 TObject *fObj = fAODObjects->At(i);
353 if(fObj->InheritsFrom("TNamed")){
354 ((TNamed*)fObj)->SetName(fAODListName[i]);
356 else if(fObj->InheritsFrom("TClonesArray")){
357 ((TClonesArray*)fObj)->SetName(fAODListName[i]);
362 printf("%s:%d SetStdNames() Wrong number of Std Entries \n",(char*)__FILE__,__LINE__);
366 void AliAODEvent::CreateStdFolders()
368 // Create the standard folder structure
369 if(fAODFolder)delete fAODFolder;
370 fAODFolder = gROOT->GetRootFolder()->AddFolder("AOD", "AOD");
371 if(fAODObjects->GetEntries()==kAODListN){
372 for(int i = 0;i < fAODObjects->GetEntries();i++){
373 TObject *fObj = fAODObjects->At(i);
374 if(fObj->InheritsFrom("TClonesArray")){
375 fAODFolder->AddFolder(fAODListName[i], fAODListName[i], (TCollection*) fObj);
377 fAODFolder->AddFolder(fAODListName[i], fAODListName[i], 0);
382 printf("%s:%d CreateStdFolders() Wrong number of Std Entries \n",(char*)__FILE__,__LINE__);
386 //______________________________________________________________________________
387 void AliAODEvent::GetStdContent()
389 // set pointers for standard content
391 fHeader = (AliAODHeader*)fAODObjects->FindObject("header");
392 fTracks = (TClonesArray*)fAODObjects->FindObject("tracks");
393 fVertices = (TClonesArray*)fAODObjects->FindObject("vertices");
394 fV0s = (TClonesArray*)fAODObjects->FindObject("v0s");
395 fCascades = (TClonesArray*)fAODObjects->FindObject("cascades");
396 fTracklets = (AliAODTracklets*)fAODObjects->FindObject("tracklets");
397 fJets = (TClonesArray*)fAODObjects->FindObject("jets");
398 fEmcalCells = (AliAODCaloCells*)fAODObjects->FindObject("emcalCells");
399 fPhosCells = (AliAODCaloCells*)fAODObjects->FindObject("phosCells");
400 fCaloClusters = (TClonesArray*)fAODObjects->FindObject("caloClusters");
401 fEMCALTrigger = (AliAODCaloTrigger*)fAODObjects->FindObject("emcalTrigger");
402 fPHOSTrigger = (AliAODCaloTrigger*)fAODObjects->FindObject("phosTrigger");
403 fFmdClusters = (TClonesArray*)fAODObjects->FindObject("fmdClusters");
404 fPmdClusters = (TClonesArray*)fAODObjects->FindObject("pmdClusters");
405 fDimuons = (TClonesArray*)fAODObjects->FindObject("dimuons");
406 fAODTZERO = (AliAODTZERO*)fAODObjects->FindObject("AliAODTZERO");
407 fAODVZERO = (AliAODVZERO*)fAODObjects->FindObject("AliAODVZERO");
408 fAODZDC = (AliAODZDC*)fAODObjects->FindObject("AliAODZDC");
409 fTOFHeader = (AliTOFHeader*)fAODObjects->FindObject("AliTOFHeader");
411 fAODMFT = (AliAODMFT*)fAODObjects->FindObject("AliAODMFT");
415 //______________________________________________________________________________
416 void AliAODEvent::ResetStd(Int_t trkArrSize,
419 Int_t cascadeArrSize,
427 // deletes content of standard arrays and resets size
430 if (trkArrSize > fTracks->GetSize())
431 fTracks->Expand(trkArrSize);
435 if (vtxArrSize > fVertices->GetSize())
436 fVertices->Expand(vtxArrSize);
440 if (v0ArrSize > fV0s->GetSize())
441 fV0s->Expand(v0ArrSize);
445 if (cascadeArrSize > fCascades->GetSize())
446 fCascades->Expand(cascadeArrSize);
450 if (jetSize > fJets->GetSize())
451 fJets->Expand(jetSize);
454 fCaloClusters->Delete();
455 if (caloClusSize > fCaloClusters->GetSize())
456 fCaloClusters->Expand(caloClusSize);
459 fFmdClusters->Delete();
460 if (fmdClusSize > fFmdClusters->GetSize())
461 fFmdClusters->Expand(fmdClusSize);
464 fPmdClusters->Delete();
465 if (pmdClusSize > fPmdClusters->GetSize())
466 fPmdClusters->Expand(pmdClusSize);
470 if (dimuonArrSize > fDimuons->GetSize())
471 fDimuons->Expand(dimuonArrSize);
474 fTracklets->DeleteContainer();
476 fPhosCells->DeleteContainer();
478 fEmcalCells->DeleteContainer();
481 fEMCALTrigger->DeAllocate();
483 fPHOSTrigger->DeAllocate();
487 void AliAODEvent::ClearStd()
489 // clears the standard arrays
495 fVertices ->Delete();
499 fCascades ->Delete();
501 fTracklets ->DeleteContainer();
505 fEmcalCells ->DeleteContainer();
507 fPhosCells ->DeleteContainer();
509 fCaloClusters ->Delete();
511 fFmdClusters ->Clear();
513 fPmdClusters ->Clear();
518 fEMCALTrigger->DeAllocate();
520 fPHOSTrigger->DeAllocate();
523 //_________________________________________________________________
524 Int_t AliAODEvent::GetPHOSClusters(TRefArray *clusters) const
526 // fills the provided TRefArray with all found phos clusters
530 AliAODCaloCluster *cl = 0;
531 Bool_t first = kTRUE;
532 for (Int_t i = 0; i < GetNumberOfCaloClusters() ; i++) {
533 if ( (cl = GetCaloCluster(i)) ) {
536 new (clusters) TRefArray(TProcessID::GetProcessWithUID(cl));
540 //printf("IsPHOS cluster %d, E %2.3f Size: %d \n",i,cl->E(),clusters->GetEntriesFast());
544 return clusters->GetEntriesFast();
547 //_________________________________________________________________
548 Int_t AliAODEvent::GetEMCALClusters(TRefArray *clusters) const
550 // fills the provided TRefArray with all found emcal clusters
553 AliAODCaloCluster *cl = 0;
554 Bool_t first = kTRUE;
555 for (Int_t i = 0; i < GetNumberOfCaloClusters(); i++) {
556 if ( (cl = GetCaloCluster(i)) ) {
559 new (clusters) TRefArray(TProcessID::GetProcessWithUID(cl));
563 //printf("IsEMCal cluster %d, E %2.3f Size: %d \n",i,cl->E(),clusters->GetEntriesFast());
567 return clusters->GetEntriesFast();
571 //______________________________________________________________________________
572 Int_t AliAODEvent::GetMuonTracks(TRefArray *muonTracks) const
574 // fills the provided TRefArray with all found muon tracks
578 AliAODTrack *track = 0;
579 for (Int_t iTrack = 0; iTrack < GetNTracks(); iTrack++) {
580 track = GetTrack(iTrack);
581 if (track->IsMuonTrack()) {
582 muonTracks->Add(track);
586 return muonTracks->GetEntriesFast();
590 //______________________________________________________________________________
591 Int_t AliAODEvent::GetNumberOfMuonTracks() const
593 // get number of muon tracks
595 for (Int_t iTrack = 0; iTrack < GetNTracks(); iTrack++) {
596 if ((GetTrack(iTrack))->IsMuonTrack()) {
604 //______________________________________________________________________________
605 void AliAODEvent::ReadFromTree(TTree *tree, Option_t* opt /*= ""*/)
607 // Connects aod event to tree
610 AliWarning("Zero Pointer to Tree \n");
614 if(!tree->GetTree())tree->LoadTree(0);
616 // Try to find AliAODEvent
617 AliAODEvent *aodEvent = 0;
618 aodEvent = (AliAODEvent*)tree->GetTree()->GetUserInfo()->FindObject("AliAODEvent");
620 // This event is connected to the tree by definition, just say so
621 aodEvent->SetConnected();
622 // Check if already connected to tree
623 TList* connectedList = (TList*) (tree->GetUserInfo()->FindObject("AODObjectsConnectedToTree"));
624 if (connectedList && (!strcmp(opt, "reconnect"))) {
625 // If connected use the connected list of objects
626 if (fAODObjects != connectedList) {
628 fAODObjects = connectedList;
635 // prevent a memory leak when reading back the TList
636 // if (!(strcmp(opt, "reconnect"))) fAODObjects->Delete();
638 // create a new TList from the UserInfo TList...
639 // copy constructor does not work...
640 // fAODObjects = (TList*)(aodEvent->GetList()->Clone());
641 fAODObjects = (TList*)aodEvent->GetList();
642 fAODObjects->SetOwner(kTRUE);
643 if(fAODObjects->GetEntries()<kAODListN)
645 AliWarning(Form("AliAODEvent::ReadFromTree() TList contains less than the standard contents %d < %d"
646 " That might be fine though (at least for filtered AODs)",fAODObjects->GetEntries(),kAODListN));
649 // Let's find out whether we have friends
650 TList* friendL = tree->GetTree()->GetListOfFriends();
655 while ((fe = (TFriendElement*)next())){
656 aodEvent = (AliAODEvent*)(fe->GetTree()->GetUserInfo()->FindObject("AliAODEvent"));
658 printf("No UserInfo on tree \n");
661 // TList* objL = (TList*)(aodEvent->GetList()->Clone());
662 TList* objL = (TList*)aodEvent->GetList();
663 printf("Get list of object from tree %d !!\n", objL->GetEntries());
664 TIter nextobject(objL);
666 while((obj = nextobject()))
668 printf("Adding object from friend %s !\n", obj->GetName());
669 fAODObjects->Add(obj);
670 } // object "branch" loop
674 // set the branch addresses
675 TIter next(fAODObjects);
677 while((el=(TNamed*)next())){
678 TString bname(el->GetName());
679 // check if branch exists under this Name
680 TBranch *br = tree->GetTree()->GetBranch(bname.Data());
682 tree->SetBranchAddress(bname.Data(),fAODObjects->GetObjectRef(el));
684 br = tree->GetBranch(Form("%s.",bname.Data()));
686 tree->SetBranchAddress(Form("%s.",bname.Data()),fAODObjects->GetObjectRef(el));
689 printf("%s %d AliAODEvent::ReadFromTree() No Branch found with Name %s. \n",
690 (char*)__FILE__,__LINE__,bname.Data());
695 // when reading back we are not owner of the list
696 // must not delete it
697 fAODObjects->SetOwner(kTRUE);
698 fAODObjects->SetName("AODObjectsConnectedToTree");
699 // we are not owner of the list objects
700 // must not delete it
701 tree->GetUserInfo()->Add(fAODObjects);
705 // we can't get the list from the user data, create standard content
706 // and set it by hand
708 TIter next(fAODObjects);
710 while((el=(TNamed*)next())){
711 TString bname(el->GetName());
712 tree->SetBranchAddress(bname.Data(),fAODObjects->GetObjectRef(el));
715 // when reading back we are not owner of the list
716 // must not delete it
717 fAODObjects->SetOwner(kTRUE);
720 //______________________________________________________________________________
721 Int_t AliAODEvent::GetNumberOfPileupVerticesSPD() const{
722 // count number of SPD pileup vertices
723 Int_t nVertices=GetNumberOfVertices();
724 Int_t nPileupVertices=0;
725 for(Int_t iVert=0; iVert<nVertices; iVert++){
726 AliAODVertex *v=GetVertex(iVert);
727 if(v->GetType()==AliAODVertex::kPileupSPD) nPileupVertices++;
729 return nPileupVertices;
731 //______________________________________________________________________________
732 Int_t AliAODEvent::GetNumberOfPileupVerticesTracks() const{
733 // count number of track pileup vertices
734 Int_t nVertices=GetNumberOfVertices();
735 Int_t nPileupVertices=0;
736 for(Int_t iVert=0; iVert<nVertices; iVert++){
737 AliAODVertex *v=GetVertex(iVert);
738 if(v->GetType()==AliAODVertex::kPileupTracks) nPileupVertices++;
740 return nPileupVertices;
742 //______________________________________________________________________________
743 AliAODVertex* AliAODEvent::GetPrimaryVertexSPD() const{
744 // Get SPD primary vertex
745 Int_t nVertices=GetNumberOfVertices();
746 for(Int_t iVert=0; iVert<nVertices; iVert++){
747 AliAODVertex *v=GetVertex(iVert);
748 if(v->GetType()==AliAODVertex::kMainSPD) return v;
752 //______________________________________________________________________________
753 AliAODVertex* AliAODEvent::GetPileupVertexSPD(Int_t iV) const{
754 // Get pile-up vertex iV
755 Int_t nVertices=GetNumberOfVertices();
757 for(Int_t iVert=0; iVert<nVertices; iVert++){
758 AliAODVertex *v=GetVertex(iVert);
759 if(v->GetType()==AliAODVertex::kPileupSPD){
760 if(counter==iV) return v;
766 //______________________________________________________________________________
767 AliAODVertex* AliAODEvent::GetPileupVertexTracks(Int_t iV) const{
768 // Get pile-up vertex iV
769 Int_t nVertices=GetNumberOfVertices();
771 for(Int_t iVert=0; iVert<nVertices; iVert++){
772 AliAODVertex *v=GetVertex(iVert);
773 if(v->GetType()==AliAODVertex::kPileupTracks){
774 if(counter==iV) return v;
780 //______________________________________________________________________________
781 Bool_t AliAODEvent::IsPileupFromSPD(Int_t minContributors,
783 Double_t nSigmaZdist,
784 Double_t nSigmaDiamXY,
785 Double_t nSigmaDiamZ) const{
787 // This function checks if there was a pile up
788 // reconstructed with SPD
790 AliAODVertex *mainV=GetPrimaryVertexSPD();
791 if(!mainV) return kFALSE;
792 Int_t nc1=mainV->GetNContributors();
793 if(nc1<1) return kFALSE;
794 Int_t nPileVert=GetNumberOfPileupVerticesSPD();
795 if(nPileVert==0) return kFALSE;
796 Int_t nVertices=GetNumberOfVertices();
798 for(Int_t iVert=0; iVert<nVertices; iVert++){
799 AliAODVertex *pv=GetVertex(iVert);
800 if(pv->GetType()!=AliAODVertex::kPileupSPD) continue;
801 Int_t nc2=pv->GetNContributors();
802 if(nc2>=minContributors){
803 Double_t z1=mainV->GetZ();
804 Double_t z2=pv->GetZ();
805 Double_t distZ=TMath::Abs(z2-z1);
806 Double_t distZdiam=TMath::Abs(z2-GetDiamondZ());
807 Double_t cutZdiam=nSigmaDiamZ*TMath::Sqrt(GetSigma2DiamondZ());
808 if(GetSigma2DiamondZ()<0.0001)cutZdiam=99999.; //protection for missing z diamond information
809 if(distZ>minZdist && distZdiam<cutZdiam){
810 Double_t x2=pv->GetX();
811 Double_t y2=pv->GetY();
812 Double_t distXdiam=TMath::Abs(x2-GetDiamondX());
813 Double_t distYdiam=TMath::Abs(y2-GetDiamondY());
814 Double_t cov1[6],cov2[6];
815 mainV->GetCovarianceMatrix(cov1);
816 pv->GetCovarianceMatrix(cov2);
817 Double_t errxDist=TMath::Sqrt(cov2[0]+GetSigma2DiamondX());
818 Double_t erryDist=TMath::Sqrt(cov2[2]+GetSigma2DiamondY());
819 Double_t errzDist=TMath::Sqrt(cov1[5]+cov2[5]);
820 Double_t cutXdiam=nSigmaDiamXY*errxDist;
821 if(GetSigma2DiamondX()<0.0001)cutXdiam=99999.; //protection for missing diamond information
822 Double_t cutYdiam=nSigmaDiamXY*erryDist;
823 if(GetSigma2DiamondY()<0.0001)cutYdiam=99999.; //protection for missing diamond information
824 if( (distXdiam<cutXdiam) && (distYdiam<cutYdiam) && (distZ>nSigmaZdist*errzDist) ){
833 //______________________________________________________________________________
834 void AliAODEvent::Print(Option_t *) const
836 // Print the names of the all branches
837 TIter next(fAODObjects);
839 Printf(">>>>> AOD Content <<<<<");
840 while((el=(TNamed*)next())){
841 Printf(">> %s ",el->GetName());
843 Printf(">>>>> <<<<<");
848 void AliAODEvent::AssignIDtoCollection(const TCollection* col)
850 // Static method which assigns a ID to each object in a collection
851 // In this way the objects are marked as referenced and written with
852 // an ID. This has the advantage that TRefs to this objects can be
853 // written by a subsequent process.
856 while ((obj = next()))
857 TProcessID::AssignID(obj);
860 Bool_t AliAODEvent::IsPileupFromSPDInMultBins() const {
861 Int_t nTracklets=GetTracklets()->GetNumberOfTracklets();
862 if(nTracklets<20) return IsPileupFromSPD(3,0.8);
863 else if(nTracklets<50) return IsPileupFromSPD(4,0.8);
864 else return IsPileupFromSPD(5,0.8);
867 Float_t AliAODEvent::GetVZEROEqMultiplicity(Int_t i) const
869 // Get VZERO Multiplicity for channel i
870 // Themethod uses the equalization factors
871 // stored in the ESD-run object in order to
872 // get equal multiplicities within a VZERO rins (1/8 of VZERO)
873 if (!fAODVZERO || !fHeader) return -1;
876 Float_t factorSum = 0;
877 for(Int_t j = 8*ring; j < (8*ring+8); ++j) {
878 factorSum += fHeader->GetVZEROEqFactors(j);
880 Float_t factor = fHeader->GetVZEROEqFactors(i)*8./factorSum;
882 return (fAODVZERO->GetMultiplicity(i)/factor);
885 //------------------------------------------------------------
886 void AliAODEvent::SetTOFHeader(const AliTOFHeader *header)
889 // Set the TOF event_time
894 //fTOFHeader->SetName(fgkESDListName[kTOFHeader]);
897 // for analysis of reconstructed events
898 // when this information is not avaliable
899 fTOFHeader = new AliTOFHeader(*header);
900 //AddObject(fTOFHeader);