]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliAODEvent.cxx
Add the possibiloity to save cut settings in the ROOT file
[u/mrichter/AliRoot.git] / STEER / AliAODEvent.cxx
CommitLineData
df9db588 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
27ClassImp(AliAODEvent)
28
29//______________________________________________________________________________
30AliAODEvent::AliAODEvent() :
31 fAODObjects(new TList()),
32 fHeader((AliAODHeader*)fAODObjects->At(0)),
33 fTracks((TClonesArray*)fAODObjects->At(1)),
34 fVertices((TClonesArray*)fAODObjects->At(2)),
a9255000 35 fClusters((TClonesArray*)fAODObjects->At(3)),
df9db588 36 fJets((TClonesArray*)fAODObjects->At(4))
37{
38 // default constructor
39}
40
41//______________________________________________________________________________
42AliAODEvent::~AliAODEvent()
43{
44 // destructor
45
46 delete fAODObjects;
47}
48
49//______________________________________________________________________________
50void 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//______________________________________________________________________________
60TObject *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//______________________________________________________________________________
68void 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));
a9255000 76 AddObject(new TClonesArray("AliAODCluster", 0));
df9db588 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");
31fd97b2 85 fClusters->SetName("clusters");
df9db588 86 fJets->SetName("jets");
87
88}
89
90//______________________________________________________________________________
91void 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);
a9255000 98 fClusters = (TClonesArray*)fAODObjects->At(3);
df9db588 99 fJets = (TClonesArray*)fAODObjects->At(4);
100}
101
102//______________________________________________________________________________
103void 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
fb41236c 115//______________________________________________________________________________
116Int_t AliAODEvent::GetMuonTracks(TRefArray *muonTracks) const
117{
118 // fills the provided TRefArray with all found muon tracks
df9db588 119
fb41236c 120 muonTracks->Clear();
df9db588 121
fb41236c 122 AliAODTrack *track = 0;
123 for (Int_t iTrack = 0; iTrack < GetNTracks(); iTrack++) {
124 if ((track = GetTrack(iTrack))->GetMostProbablePID() == AliAODTrack::kMuon) {
125 muonTracks->Add(track);
126 }
127 }
128
129 return muonTracks->GetSize();
130}