]>
Commit | Line | Data |
---|---|---|
a5556ea5 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, 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 | // | |
20 | // base class for AOD containers | |
21 | // | |
22 | ///////////////////////////////////////////////////////////// | |
23 | ||
24 | #include <TParticle.h> | |
25 | #include "AliAOD.h" | |
26 | ||
afa8b37b | 27 | #include "AliAODParticle.h" |
a5556ea5 | 28 | |
29 | ClassImp(AliAOD) | |
30 | ||
31 | /**************************************************************************/ | |
32 | ||
33 | void AliAOD::AddParticle(TParticle* part, Int_t idx) | |
34 | { | |
35 | //Adds TParticle to event | |
36 | if (part == 0x0) | |
37 | { | |
38 | Error("AddParticle(TParticle*,Int_t)","pointer to particle is NULL"); | |
39 | return; | |
40 | } | |
afa8b37b | 41 | AddParticle( new AliAODParticle(*part,idx) ); |
a5556ea5 | 42 | } |
43 | /**************************************************************************/ | |
44 | ||
45 | void AliAOD::AddParticle(Int_t pdg, Int_t idx, | |
46 | Double_t px, Double_t py, Double_t pz, Double_t etot, | |
47 | Double_t vx, Double_t vy, Double_t vz, Double_t time) | |
48 | { | |
49 | //adds particle to event | |
afa8b37b | 50 | AddParticle(new AliAODParticle(pdg,idx,px,py,pz,etot,vx,vy,vz,time)); |
a5556ea5 | 51 | } |
52 | /**************************************************************************/ | |
53 | ||
54 | void AliAOD::SwapParticles(Int_t i, Int_t j) | |
55 | { | |
56 | //swaps particles positions; used by AliHBTEvent::Blend | |
57 | if ( (i<0) || (i>=GetNumberOfParticles()) ) return; | |
58 | if ( (j<0) || (j>=GetNumberOfParticles()) ) return; | |
59 | ||
afa8b37b | 60 | AliVAODParticle* tmp = (AliVAODParticle*)fParticles.At(i); |
a5556ea5 | 61 | fParticles.AddAt(fParticles.At(j),i); |
62 | fParticles.AddAt(tmp,j); | |
63 | } | |
64 | /**************************************************************************/ | |
65 | ||
66 | void AliAOD::Reset() | |
67 | { | |
68 | //deletes all particles from the event | |
69 | for(Int_t i =0; i<GetNumberOfParticles(); i++) | |
70 | { | |
71 | for (Int_t j = i+1; j<GetNumberOfParticles(); j++) | |
72 | if ( fParticles.At(j) == fParticles.At(i) ) fParticles.RemoveAt(j); | |
73 | delete fParticles.RemoveAt(i); | |
74 | } | |
75 | // fRandomized = kFALSE; | |
76 | } |