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 //-------------------------------------------------------------------------
23 #include "AliAODEvent.h"
24 #include "AliAODHeader.h"
25 #include "AliAODTrack.h"
29 //______________________________________________________________________________
30 AliAODEvent::AliAODEvent() :
31 fAODObjects(new TList()),
32 fHeader((AliAODHeader*)fAODObjects->At(0)),
33 fTracks((TClonesArray*)fAODObjects->At(1)),
34 fVertices((TClonesArray*)fAODObjects->At(2)),
35 fClusters((TClonesArray*)fAODObjects->At(3)),
36 fJets((TClonesArray*)fAODObjects->At(4))
38 // default constructor
41 //______________________________________________________________________________
42 AliAODEvent::~AliAODEvent()
49 //______________________________________________________________________________
50 void AliAODEvent::AddObject(TObject* obj)
52 // Add an object to the list of object.
53 // Please be aware that in order to increase performance you should
54 // refrain from using TObjArrays (if possible). Use TClonesArrays, instead.
56 fAODObjects->AddLast(obj);
59 //______________________________________________________________________________
60 TObject *AliAODEvent::GetObject(const char *objName) const
62 // Return the pointer to the object with the given name.
64 return fAODObjects->FindObject(objName);
67 //______________________________________________________________________________
68 void AliAODEvent::CreateStdContent()
70 // create the standard AOD content and set pointers
72 // create standard objects and add them to the TList of objects
73 AddObject(new AliAODHeader());
74 AddObject(new TClonesArray("AliAODTrack", 0));
75 AddObject(new TClonesArray("AliAODVertex", 0));
76 AddObject(new TClonesArray("AliAODCluster", 0));
77 AddObject(new TClonesArray("AliAODJet", 0));
83 fTracks->SetName("tracks");
84 fVertices->SetName("vertices");
85 fClusters->SetName("neutrals");
86 fJets->SetName("jets");
90 //______________________________________________________________________________
91 void AliAODEvent::GetStdContent() const
93 // set pointers for standard content
95 fHeader = (AliAODHeader*)fAODObjects->At(0);
96 fTracks = (TClonesArray*)fAODObjects->At(1);
97 fVertices = (TClonesArray*)fAODObjects->At(2);
98 fClusters = (TClonesArray*)fAODObjects->At(3);
99 fJets = (TClonesArray*)fAODObjects->At(4);
102 //______________________________________________________________________________
103 void AliAODEvent::ResetStd(Int_t trkArrSize, Int_t vtxArrSize)
105 // deletes content of standard arrays and resets size
107 if (trkArrSize > fTracks->GetSize())
108 fTracks->Expand(trkArrSize);
111 if (vtxArrSize > fVertices->GetSize())
112 fVertices->Expand(vtxArrSize);