]>
Commit | Line | Data |
---|---|---|
3513afb7 | 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 | // Debug event | |
17 | // the tree is represented as reduced events | |
18 | // | |
19 | // Authors: | |
20 | // M.Fasel <M.Fasel@gsi.de> | |
21 | // | |
22 | ||
23 | #include "TObjArray.h" | |
24 | #include "AliHFEreducedTrack.h" | |
25 | #include "AliHFEreducedMCParticle.h" | |
26 | #include "AliHFEreducedEvent.h" | |
27 | ||
28 | ClassImp(AliHFEreducedEvent) | |
29 | ||
30 | //_______________________________________ | |
31 | AliHFEreducedEvent::AliHFEreducedEvent(): | |
32 | TObject(), | |
33 | fTracks(NULL), | |
34 | fMCparticles(NULL), | |
35 | fNtracks(0), | |
36 | fNmcparticles(0), | |
37 | fRunNumber(0), | |
38 | fTrigger(0), | |
3513afb7 | 39 | fSPDMultiplicity(0) |
40 | { | |
41 | // | |
42 | // Default constructor | |
43 | // | |
44 | fTracks = new TObjArray; | |
45 | fTracks->SetOwner(); | |
46 | fMCparticles = new TObjArray; | |
47 | fMCparticles->SetOwner(); | |
4437a0d2 | 48 | memset(fCentrality, 0, sizeof(Float_t) * kCentBuff); |
3513afb7 | 49 | memset(fV0Multiplicity, 0, sizeof(Float_t) * 2); |
50 | memset(fZDCEnergy, 0, sizeof(Float_t) * 4); | |
7e695443 | 51 | memset(fVX, 0, sizeof(Float_t)*2); |
52 | memset(fVY, 0, sizeof(Float_t)*2); | |
53 | memset(fVZ, 0, sizeof(Float_t)*2); | |
54 | memset(fNContrib, 0, sizeof(Int_t) * 2); | |
55 | memset(fVertexResolution, 0, sizeof(Float_t)*2); | |
3513afb7 | 56 | } |
57 | ||
58 | //_______________________________________ | |
59 | AliHFEreducedEvent::AliHFEreducedEvent(const AliHFEreducedEvent &ref): | |
60 | TObject(ref), | |
61 | fTracks(NULL), | |
62 | fMCparticles(NULL), | |
63 | fNtracks(ref.fNtracks), | |
64 | fNmcparticles(ref.fNmcparticles), | |
65 | fRunNumber(ref.fRunNumber), | |
66 | fTrigger(ref.fTrigger), | |
3513afb7 | 67 | fSPDMultiplicity(ref.fSPDMultiplicity) |
68 | { | |
69 | // | |
70 | // Copy constructor | |
71 | // | |
72 | fTracks = new TObjArray; | |
73 | fTracks->SetOwner(); | |
74 | for(int itrk = 0; itrk < ref.GetNumberOfTracks(); itrk++) | |
75 | fTracks->Add(new AliHFEreducedTrack(*(ref.GetTrack(itrk)))); | |
76 | fMCparticles = new TObjArray; | |
77 | fMCparticles->SetOwner(); | |
78 | for(int iprt = 0; iprt < ref.GetNumberOfMCParticles(); iprt++) | |
79 | fMCparticles->Add(new AliHFEreducedMCParticle(*(ref.GetMCParticle(iprt)))); | |
4437a0d2 | 80 | memcpy(fCentrality, ref.fCentrality, sizeof(Float_t) * kCentBuff); |
3513afb7 | 81 | memcpy(fV0Multiplicity, ref.fV0Multiplicity, sizeof(Float_t) * 2); |
82 | memcpy(fZDCEnergy, ref.fZDCEnergy, sizeof(Float_t) *4); | |
7e695443 | 83 | memcpy(fVX, ref.fVX, sizeof(Float_t)*2); |
84 | memcpy(fVY, ref.fVY, sizeof(Float_t)*2); | |
85 | memcpy(fVZ, ref.fVZ, sizeof(Float_t)*2); | |
86 | memcpy(fVertexResolution, ref.fVertexResolution, sizeof(Float_t)*2); | |
87 | memcpy(fNContrib, ref.fNContrib, sizeof(Int_t) * 2); | |
3513afb7 | 88 | } |
89 | ||
90 | //_______________________________________ | |
91 | AliHFEreducedEvent &AliHFEreducedEvent::operator=(const AliHFEreducedEvent &ref){ | |
92 | // | |
93 | // Assignment operator | |
94 | // | |
95 | if(&ref != this){ | |
96 | TObject::operator=(ref); | |
97 | fTracks->SetOwner(); | |
98 | fTracks->Clear(); | |
99 | for(int itrk = 0; itrk < ref.GetNumberOfTracks(); itrk++) | |
100 | fTracks->Add(new AliHFEreducedTrack(*(ref.GetTrack(itrk)))); | |
101 | fMCparticles->Clear(); | |
102 | fMCparticles->SetOwner(); | |
103 | for(int iprt = 0; iprt < ref.GetNumberOfMCParticles(); iprt++) | |
104 | fMCparticles->Add(new AliHFEreducedMCParticle(*(ref.GetMCParticle(iprt)))); | |
105 | fNtracks = ref.fNtracks; | |
106 | fNmcparticles = ref.fNmcparticles; | |
107 | fRunNumber = ref.fRunNumber; | |
108 | fTrigger = ref.fTrigger; | |
7e695443 | 109 | memcpy(fVX, ref.fVX, sizeof(Float_t)*2); |
110 | memcpy(fVY, ref.fVY, sizeof(Float_t)*2); | |
111 | memcpy(fVZ, ref.fVZ, sizeof(Float_t)*2); | |
112 | memcpy(fNContrib, ref.fNContrib, sizeof(Int_t) * 2); | |
113 | memcpy(fVertexResolution, ref.fVertexResolution, sizeof(Float_t)*2); | |
3513afb7 | 114 | fSPDMultiplicity = ref.fSPDMultiplicity; |
4437a0d2 | 115 | memcpy(fCentrality, ref.fCentrality, sizeof(Float_t) * kCentBuff); |
3513afb7 | 116 | memcpy(fV0Multiplicity, ref.fV0Multiplicity, sizeof(Float_t) * 2); |
117 | memcpy(fZDCEnergy, ref.fZDCEnergy, sizeof(Float_t) *4); | |
118 | } | |
119 | return *this; | |
120 | } | |
121 | ||
122 | //_______________________________________ | |
123 | AliHFEreducedEvent::~AliHFEreducedEvent(){ | |
124 | // | |
125 | // Destructor: Clear tracks an MC particles | |
126 | // | |
127 | delete fTracks; | |
128 | delete fMCparticles; | |
129 | } | |
130 | ||
131 | //_______________________________________ | |
132 | void AliHFEreducedEvent::AddTrack(const AliHFEreducedTrack *track){ | |
133 | // | |
134 | // Add track to the event | |
135 | // | |
136 | fTracks->Add(new AliHFEreducedTrack(*track)); | |
137 | fNtracks++; | |
138 | } | |
139 | ||
140 | //_______________________________________ | |
141 | const AliHFEreducedTrack *AliHFEreducedEvent::GetTrack(Int_t itrk) const { | |
142 | // | |
143 | // Get Track | |
144 | // | |
145 | if(itrk < 0 || itrk >= fNtracks) return NULL; | |
146 | return dynamic_cast<const AliHFEreducedTrack *>(fTracks->At(itrk)); | |
147 | } | |
148 | ||
149 | //_______________________________________ | |
150 | void AliHFEreducedEvent::AddMCParticle(const AliHFEreducedMCParticle *track){ | |
151 | // | |
152 | // Add MC particle to the Event | |
153 | // | |
154 | fMCparticles->Add(new AliHFEreducedMCParticle(*track)); | |
155 | fNmcparticles++; | |
156 | } | |
157 | ||
158 | //_______________________________________ | |
159 | const AliHFEreducedMCParticle *AliHFEreducedEvent::GetMCParticle(Int_t itrk) const { | |
160 | // | |
161 | // Get MC particle | |
162 | // | |
163 | if(itrk < 0 || itrk >= fNmcparticles) return NULL; | |
164 | return dynamic_cast<const AliHFEreducedMCParticle *>(fMCparticles->At(itrk)); | |
165 | } |