0da241a9 |
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 | //////////////////////////////////////////////////////////////////////////////// |
17 | // |
18 | // These classes provide storage for event and track information which |
19 | // are used for same-event and mixed-event analyses in AliFemtoK0Analysis. |
20 | // |
21 | // authors: Dhevan Gangadharan (dhevan.raja.gangadharan@cern.ch) |
22 | // Matthew Steinpreis (matthew.steinpreis@cern.ch) |
23 | //////////////////////////////////////////////////////////////////////////////// |
24 | |
25 | #include "AliFemtoK0EventCollection.h" |
26 | |
27 | AliFemtoK0Particle::AliFemtoK0Particle() : |
28 | fMomentum(), |
29 | fPt(0), |
30 | fMass(0), |
31 | fDaughterID1(0), |
32 | fDaughterID2(0), |
33 | fK0(0), |
cc64ee13 |
34 | fSideLeft(0), |
35 | fSideRight(0), |
36 | fSkipShared(0), |
37 | fV0Dca(0), |
38 | fDDDca(0), |
39 | fDecayLength(0), |
40 | fPosDca(0), |
41 | fNegDca(0), |
42 | fPosPt(0), |
43 | fNegPt(0), |
44 | fPosPhi(0), |
45 | fNegPhi(0), |
0da241a9 |
46 | fXPos(), |
47 | fXNeg(), |
48 | fPPos(), |
49 | fPNeg(), |
50 | fCovPos(), |
51 | fCovNeg() |
52 | { |
53 | //Default constructor |
54 | } |
55 | //_____________________________________________________________________________ |
56 | AliFemtoK0Particle::AliFemtoK0Particle(const AliFemtoK0Particle &obj) : |
57 | fMomentum(), |
58 | fPt(obj.fPt), |
59 | fMass(obj.fMass), |
60 | fDaughterID1(obj.fDaughterID1), |
61 | fDaughterID2(obj.fDaughterID2), |
62 | fK0(obj.fK0), |
cc64ee13 |
63 | fSideLeft(obj.fSideLeft), |
64 | fSideRight(obj.fSideRight), |
65 | fSkipShared(obj.fSkipShared), |
66 | fV0Dca(obj.fV0Dca), |
67 | fDDDca(obj.fDDDca), |
68 | fDecayLength(obj.fDecayLength), |
69 | fPosDca(obj.fPosDca), |
70 | fNegDca(obj.fNegDca), |
71 | fPosPt(obj.fPosPt), |
72 | fNegPt(obj.fNegPt), |
73 | fPosPhi(obj.fPosPhi), |
74 | fNegPhi(obj.fNegPhi), |
0da241a9 |
75 | fXPos(), |
76 | fXNeg(), |
77 | fPPos(), |
78 | fPNeg(), |
79 | fCovPos(), |
80 | fCovNeg() |
81 | { |
82 | // copy constructor |
83 | } |
84 | //_____________________________________________________________________________ |
85 | AliFemtoK0Particle &AliFemtoK0Particle::operator=(const AliFemtoK0Particle &obj) |
86 | { |
87 | //Assignment operator |
88 | if(this == &obj) return *this; |
89 | |
90 | fMomentum[0] = obj.fMomentum[0]; |
91 | fMomentum[1] = obj.fMomentum[1]; |
92 | fMomentum[2] = obj.fMomentum[2]; |
93 | fPt = obj.fPt; |
94 | fMass = obj.fMass; |
95 | fDaughterID1 = obj.fDaughterID1; |
96 | fDaughterID2 = obj.fDaughterID2; |
97 | fK0 = obj.fK0; |
cc64ee13 |
98 | fSideLeft = obj.fSideLeft; |
99 | fSideRight = obj.fSideRight; |
100 | fSkipShared = obj.fSkipShared; |
101 | fV0Dca = obj.fV0Dca; |
102 | fDDDca = obj.fDDDca; |
103 | fDecayLength = obj.fDecayLength; |
104 | fPosDca = obj.fPosDca; |
105 | fNegDca = obj.fNegDca; |
106 | fPosPt = obj.fPosPt; |
107 | fNegPt = obj.fNegPt; |
108 | fPosPhi = obj.fPosPhi; |
109 | fNegPhi = obj.fNegPhi; |
0da241a9 |
110 | fXPos[0] = obj.fXPos[0]; |
111 | fXPos[1] = obj.fXPos[1]; |
112 | fXPos[2] = obj.fXPos[2]; |
113 | fXNeg[0] = obj.fXNeg[0]; |
114 | fXNeg[1] = obj.fXNeg[1]; |
115 | fXNeg[2] = obj.fXNeg[2]; |
116 | fPPos[0] = obj.fPPos[0]; |
117 | fPPos[1] = obj.fPPos[1]; |
118 | fPPos[2] = obj.fPPos[2]; |
119 | fPNeg[0] = obj.fPNeg[0]; |
120 | fPNeg[1] = obj.fPNeg[1]; |
121 | fPNeg[2] = obj.fPNeg[2]; |
122 | fCovPos[0] = obj.fCovPos[0]; fCovPos[1] = obj.fCovPos[1]; fCovPos[2] = obj.fCovPos[2]; |
123 | fCovPos[3] = obj.fCovPos[3]; fCovPos[4] = obj.fCovPos[4]; fCovPos[5] = obj.fCovPos[5]; |
124 | fCovPos[6] = obj.fCovPos[6]; fCovPos[7] = obj.fCovPos[7]; fCovPos[8] = obj.fCovPos[8]; |
125 | fCovPos[9] = obj.fCovPos[9]; fCovPos[10] = obj.fCovPos[10]; fCovPos[11] = obj.fCovPos[11]; |
126 | fCovPos[12] = obj.fCovPos[12]; fCovPos[13] = obj.fCovPos[13]; fCovPos[14] = obj.fCovPos[14]; |
127 | fCovPos[17] = obj.fCovPos[17]; fCovPos[17] = obj.fCovPos[17]; fCovPos[17] = obj.fCovPos[17]; |
128 | fCovPos[18] = obj.fCovPos[18]; fCovPos[19] = obj.fCovPos[19]; fCovPos[20] = obj.fCovPos[20]; |
129 | fCovNeg[0] = obj.fCovNeg[0]; fCovNeg[1] = obj.fCovNeg[1]; fCovNeg[2] = obj.fCovNeg[2]; |
130 | fCovNeg[3] = obj.fCovNeg[3]; fCovNeg[4] = obj.fCovNeg[4]; fCovNeg[5] = obj.fCovNeg[5]; |
131 | fCovNeg[6] = obj.fCovNeg[6]; fCovNeg[7] = obj.fCovNeg[7]; fCovNeg[8] = obj.fCovNeg[8]; |
132 | fCovNeg[9] = obj.fCovNeg[9]; fCovNeg[10] = obj.fCovNeg[10]; fCovNeg[11] = obj.fCovNeg[11]; |
133 | fCovNeg[12] = obj.fCovNeg[12]; fCovNeg[13] = obj.fCovNeg[13]; fCovNeg[14] = obj.fCovNeg[14]; |
134 | fCovNeg[17] = obj.fCovNeg[17]; fCovNeg[17] = obj.fCovNeg[17]; fCovNeg[17] = obj.fCovNeg[17]; |
135 | fCovNeg[18] = obj.fCovNeg[18]; fCovNeg[19] = obj.fCovNeg[19]; fCovNeg[20] = obj.fCovNeg[20]; |
136 | |
137 | return (*this); |
138 | } |
139 | //_____________________________________________________________________________ |
140 | AliFemtoK0Particle::~AliFemtoK0Particle() |
141 | { |
142 | // Destructor |
143 | } |
144 | //_____________________________________________________________________________ |
145 | |
146 | AliFemtoK0Event::AliFemtoK0Event(): |
147 | fFillStatus(0), |
148 | fNumV0s(0), |
149 | fK0Particle(0x0) |
150 | { |
151 | //Default constructor |
152 | } |
153 | //_____________________________________________________________________________ |
154 | AliFemtoK0Event::AliFemtoK0Event(const AliFemtoK0Event &obj) : |
155 | fFillStatus(obj.fFillStatus), |
156 | fNumV0s(obj.fNumV0s), |
157 | fK0Particle(obj.fK0Particle) |
158 | { |
159 | //Copy constructor |
160 | } |
161 | //_____________________________________________________________________________ |
162 | AliFemtoK0Event &AliFemtoK0Event::operator=(const AliFemtoK0Event &obj) |
163 | { |
164 | //Assignment operator |
165 | if(this == &obj) return *this; |
166 | |
167 | fFillStatus = obj.fFillStatus; |
168 | fNumV0s = obj.fNumV0s; |
169 | fK0Particle = obj.fK0Particle; |
170 | |
171 | return (*this); |
172 | } |
173 | //_____________________________________________________________________________ |
174 | AliFemtoK0Event::~AliFemtoK0Event() |
175 | { |
176 | //Destructor |
177 | if(fK0Particle) delete fK0Particle; |
178 | } |
179 | |
180 | //_____________________________________________________________________________ |
181 | AliFemtoK0EventCollection::AliFemtoK0EventCollection() : |
182 | fBufferSize(0), |
183 | fLimit(0), |
184 | fEvt(0x0) |
185 | { |
186 | //Default constructor |
187 | } |
188 | //_____________________________________________________________________________ |
189 | AliFemtoK0EventCollection::AliFemtoK0EventCollection(short a, int lim) : |
190 | fBufferSize(0), |
191 | fLimit(0), |
192 | fEvt(0x0) |
193 | { |
194 | //maint constructor |
195 | |
196 | SetBufferSize(a); |
197 | |
198 | fEvt = new AliFemtoK0Event[fBufferSize]; //allocate pointer array of type particle_event |
199 | fLimit = lim; |
200 | |
201 | for(int ii = 0; ii < fBufferSize; ii++){ //Initialize particle table pointers to NULL |
202 | (fEvt + ii)->fK0Particle = NULL; |
203 | (fEvt + ii)->fNumV0s = 0; |
204 | (fEvt + ii)->fFillStatus = 0; |
205 | |
206 | (fEvt + ii)->fK0Particle = new AliFemtoK0Particle[fLimit]; |
207 | } |
208 | } |
209 | //_____________________________________________________________________________ |
210 | AliFemtoK0EventCollection::AliFemtoK0EventCollection(const AliFemtoK0EventCollection &obj) |
211 | : fBufferSize(obj.fBufferSize), |
212 | fLimit(obj.fLimit), |
213 | fEvt(obj.fEvt) |
214 | { |
215 | //copy constructor |
216 | } |
217 | //_____________________________________________________________________________ |
218 | AliFemtoK0EventCollection &AliFemtoK0EventCollection::operator=(const |
219 | AliFemtoK0EventCollection &obj) |
220 | { |
221 | //Assignment operator |
222 | if(this == &obj) return *this; |
223 | |
224 | fBufferSize = obj.fBufferSize; |
225 | fLimit = obj.fLimit; |
226 | fEvt = obj.fEvt; |
227 | |
228 | return (*this); |
229 | } |
230 | //_____________________________________________________________________________ |
231 | AliFemtoK0EventCollection::~AliFemtoK0EventCollection() |
232 | { |
233 | for(int i =0; i < fBufferSize; i++){ |
234 | if((fEvt + i)->fK0Particle != NULL){ |
235 | delete [] (fEvt + i)->fK0Particle; |
236 | } |
237 | } |
238 | |
239 | delete [] fEvt; |
240 | } |
241 | //_____________________________________________________________________________ |
242 | void AliFemtoK0EventCollection::FIFOShift(){ //Shift elements in FIFO by one and clear last element in FIFO |
243 | |
244 | for(unsigned short i=fBufferSize-1 ; i > 0; i--){ |
245 | for(int j=0; j<(fEvt + i-1)->fNumV0s; j++) (fEvt + i)->fK0Particle[j] = (fEvt + i-1)->fK0Particle[j]; |
246 | (fEvt + i)->fFillStatus = (fEvt + i-1)->fFillStatus; |
247 | (fEvt + i)->fNumV0s = (fEvt + i-1)->fNumV0s; |
248 | } |
249 | |
250 | (fEvt)->fNumV0s=0; |
251 | (fEvt)->fFillStatus=0; |
252 | |
253 | } |
254 | |