]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliAODEvent.cxx
- Renaming fEventNumber (and the associated getters/setters) to
[u/mrichter/AliRoot.git] / STEER / AliAODEvent.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
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  **************************************************************************/
15
16 /* $Id$ */
17
18 //-------------------------------------------------------------------------
19 //     AOD base class
20 //     Author: Markus Oldenburg, CERN
21 //-------------------------------------------------------------------------
22
23 #include "AliAODEvent.h"
24 #include "AliAODHeader.h"
25 #include "AliAODTrack.h"
26
27 ClassImp(AliAODEvent)
28
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))
37 {
38   // default constructor
39 }
40
41 //______________________________________________________________________________
42 AliAODEvent::~AliAODEvent() 
43 {
44   // destructor
45
46   delete fAODObjects;
47 }
48
49 //______________________________________________________________________________
50 void AliAODEvent::AddObject(TObject* obj) 
51 {
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.
55   
56   fAODObjects->AddLast(obj);
57 }
58
59 //______________________________________________________________________________
60 TObject *AliAODEvent::GetObject(const char *objName) const 
61 {
62   // Return the pointer to the object with the given name.
63
64   return fAODObjects->FindObject(objName);
65 }
66
67 //______________________________________________________________________________
68 void AliAODEvent::CreateStdContent() 
69 {
70   // create the standard AOD content and set pointers
71
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));
78
79   // read back pointers
80   GetStdContent();
81
82   // set names
83   fTracks->SetName("tracks");
84   fVertices->SetName("vertices");
85   fClusters->SetName("clusters");
86   fJets->SetName("jets");
87
88 }
89
90 //______________________________________________________________________________
91 void AliAODEvent::GetStdContent() const
92 {
93   // set pointers for standard content
94
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);
100 }
101
102 //______________________________________________________________________________
103 void AliAODEvent::ResetStd(Int_t trkArrSize, Int_t vtxArrSize)
104 {
105   // deletes content of standard arrays and resets size
106   fTracks->Delete();
107   if (trkArrSize > fTracks->GetSize()) 
108     fTracks->Expand(trkArrSize);
109
110   fVertices->Delete();
111   if (vtxArrSize > fVertices->GetSize()) 
112     fVertices->Expand(vtxArrSize);
113 }
114
115
116