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 **************************************************************************/
18 /////////////////////////////////////////////////////////////
20 // base class for AOD containers
22 /////////////////////////////////////////////////////////////
24 #include <TParticle.h>
26 #include "AliAODParticle.h"
27 #include "AliTrackPoints.h"
33 fIsRandomized(kFALSE),
42 /**************************************************************************/
44 void AliAOD::AddParticle(TParticle* part, Int_t idx)
46 //Adds TParticle to event
49 Error("AddParticle(TParticle*,Int_t)","pointer to particle is NULL");
52 AddParticle( new AliAODParticle(*part,idx) );
54 /**************************************************************************/
56 void AliAOD::AddParticle(Int_t pdg, Int_t idx,
57 Double_t px, Double_t py, Double_t pz, Double_t etot,
58 Double_t vx, Double_t vy, Double_t vz, Double_t time)
60 //adds particle to event
61 AddParticle(new AliAODParticle(pdg,idx,px,py,pz,etot,vx,vy,vz,time));
63 /**************************************************************************/
65 void AliAOD::SwapParticles(Int_t i, Int_t j)
67 //swaps particles positions; used by AliHBTEvent::Blend
68 if ( (i<0) || (i>=GetNumberOfParticles()) ) return;
69 if ( (j<0) || (j>=GetNumberOfParticles()) ) return;
71 AliVAODParticle* tmp = (AliVAODParticle*)fParticles.At(i);
72 fParticles.AddAt(fParticles.At(j),i);
73 fParticles.AddAt(tmp,j);
75 /**************************************************************************/
79 //deletes all particles from the event
80 for(Int_t i =0; i<GetNumberOfParticles(); i++)
82 for (Int_t j = i+1; j<GetNumberOfParticles(); j++)
83 if ( fParticles.At(j) == fParticles.At(i) ) fParticles.RemoveAt(j);
84 delete fParticles.RemoveAt(i);
86 // fRandomized = kFALSE;
88 /**************************************************************************/
90 void AliAOD::GetPrimaryVertex(Double_t&x, Double_t&y, Double_t&z)
92 //returns positions of the primary vertex
97 /**************************************************************************/
99 void AliAOD::SetPrimaryVertex(Double_t x, Double_t y, Double_t z)
101 //Sets positions of the primary vertex
106 /**************************************************************************/
108 Int_t AliAOD::GetNumberOfCharged(Double_t etamin, Double_t etamax) const
110 //reurns number of charged particles within given pseudorapidity range
112 Int_t npart = fParticles.GetEntries();
113 for (Int_t i = 0; i < npart; i++)
115 AliVAODParticle* p = (AliVAODParticle*)fParticles.At(i);
116 Double_t eta = p->Eta();
117 if ( (eta < etamin) || (eta > etamax) ) continue;
118 if (p->Charge() != 0.0) n++;
122 /**************************************************************************/
124 void AliAOD::Move(Double_t x, Double_t y, Double_t z)
126 //moves all spacial coordinates about this vector
129 // and whatever will be added to AOD and AOD particles that is a space coordinate
131 fPrimaryVertexX += x;
132 fPrimaryVertexY += y;
133 fPrimaryVertexZ += z;
135 Int_t npart = fParticles.GetEntries();
136 for (Int_t i = 0; i < npart; i++)
138 AliVAODParticle* p = (AliVAODParticle*)fParticles.At(i);
139 AliTrackPoints* tp = p->GetTPCTrackPoints();
140 if (tp) tp->Move(x,y,z);
141 tp = p->GetITSTrackPoints();
142 if (tp) tp->Move(x,y,z);