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), |
34 | fXPos(), |
35 | fXNeg(), |
36 | fPPos(), |
37 | fPNeg(), |
38 | fCovPos(), |
39 | fCovNeg() |
40 | { |
41 | //Default constructor |
42 | } |
43 | //_____________________________________________________________________________ |
44 | AliFemtoK0Particle::AliFemtoK0Particle(const AliFemtoK0Particle &obj) : |
45 | fMomentum(), |
46 | fPt(obj.fPt), |
47 | fMass(obj.fMass), |
48 | fDaughterID1(obj.fDaughterID1), |
49 | fDaughterID2(obj.fDaughterID2), |
50 | fK0(obj.fK0), |
51 | fXPos(), |
52 | fXNeg(), |
53 | fPPos(), |
54 | fPNeg(), |
55 | fCovPos(), |
56 | fCovNeg() |
57 | { |
58 | // copy constructor |
59 | } |
60 | //_____________________________________________________________________________ |
61 | AliFemtoK0Particle &AliFemtoK0Particle::operator=(const AliFemtoK0Particle &obj) |
62 | { |
63 | //Assignment operator |
64 | if(this == &obj) return *this; |
65 | |
66 | fMomentum[0] = obj.fMomentum[0]; |
67 | fMomentum[1] = obj.fMomentum[1]; |
68 | fMomentum[2] = obj.fMomentum[2]; |
69 | fPt = obj.fPt; |
70 | fMass = obj.fMass; |
71 | fDaughterID1 = obj.fDaughterID1; |
72 | fDaughterID2 = obj.fDaughterID2; |
73 | fK0 = obj.fK0; |
74 | fXPos[0] = obj.fXPos[0]; |
75 | fXPos[1] = obj.fXPos[1]; |
76 | fXPos[2] = obj.fXPos[2]; |
77 | fXNeg[0] = obj.fXNeg[0]; |
78 | fXNeg[1] = obj.fXNeg[1]; |
79 | fXNeg[2] = obj.fXNeg[2]; |
80 | fPPos[0] = obj.fPPos[0]; |
81 | fPPos[1] = obj.fPPos[1]; |
82 | fPPos[2] = obj.fPPos[2]; |
83 | fPNeg[0] = obj.fPNeg[0]; |
84 | fPNeg[1] = obj.fPNeg[1]; |
85 | fPNeg[2] = obj.fPNeg[2]; |
86 | fCovPos[0] = obj.fCovPos[0]; fCovPos[1] = obj.fCovPos[1]; fCovPos[2] = obj.fCovPos[2]; |
87 | fCovPos[3] = obj.fCovPos[3]; fCovPos[4] = obj.fCovPos[4]; fCovPos[5] = obj.fCovPos[5]; |
88 | fCovPos[6] = obj.fCovPos[6]; fCovPos[7] = obj.fCovPos[7]; fCovPos[8] = obj.fCovPos[8]; |
89 | fCovPos[9] = obj.fCovPos[9]; fCovPos[10] = obj.fCovPos[10]; fCovPos[11] = obj.fCovPos[11]; |
90 | fCovPos[12] = obj.fCovPos[12]; fCovPos[13] = obj.fCovPos[13]; fCovPos[14] = obj.fCovPos[14]; |
91 | fCovPos[17] = obj.fCovPos[17]; fCovPos[17] = obj.fCovPos[17]; fCovPos[17] = obj.fCovPos[17]; |
92 | fCovPos[18] = obj.fCovPos[18]; fCovPos[19] = obj.fCovPos[19]; fCovPos[20] = obj.fCovPos[20]; |
93 | fCovNeg[0] = obj.fCovNeg[0]; fCovNeg[1] = obj.fCovNeg[1]; fCovNeg[2] = obj.fCovNeg[2]; |
94 | fCovNeg[3] = obj.fCovNeg[3]; fCovNeg[4] = obj.fCovNeg[4]; fCovNeg[5] = obj.fCovNeg[5]; |
95 | fCovNeg[6] = obj.fCovNeg[6]; fCovNeg[7] = obj.fCovNeg[7]; fCovNeg[8] = obj.fCovNeg[8]; |
96 | fCovNeg[9] = obj.fCovNeg[9]; fCovNeg[10] = obj.fCovNeg[10]; fCovNeg[11] = obj.fCovNeg[11]; |
97 | fCovNeg[12] = obj.fCovNeg[12]; fCovNeg[13] = obj.fCovNeg[13]; fCovNeg[14] = obj.fCovNeg[14]; |
98 | fCovNeg[17] = obj.fCovNeg[17]; fCovNeg[17] = obj.fCovNeg[17]; fCovNeg[17] = obj.fCovNeg[17]; |
99 | fCovNeg[18] = obj.fCovNeg[18]; fCovNeg[19] = obj.fCovNeg[19]; fCovNeg[20] = obj.fCovNeg[20]; |
100 | |
101 | return (*this); |
102 | } |
103 | //_____________________________________________________________________________ |
104 | AliFemtoK0Particle::~AliFemtoK0Particle() |
105 | { |
106 | // Destructor |
107 | } |
108 | //_____________________________________________________________________________ |
109 | |
110 | AliFemtoK0Event::AliFemtoK0Event(): |
111 | fFillStatus(0), |
112 | fNumV0s(0), |
113 | fK0Particle(0x0) |
114 | { |
115 | //Default constructor |
116 | } |
117 | //_____________________________________________________________________________ |
118 | AliFemtoK0Event::AliFemtoK0Event(const AliFemtoK0Event &obj) : |
119 | fFillStatus(obj.fFillStatus), |
120 | fNumV0s(obj.fNumV0s), |
121 | fK0Particle(obj.fK0Particle) |
122 | { |
123 | //Copy constructor |
124 | } |
125 | //_____________________________________________________________________________ |
126 | AliFemtoK0Event &AliFemtoK0Event::operator=(const AliFemtoK0Event &obj) |
127 | { |
128 | //Assignment operator |
129 | if(this == &obj) return *this; |
130 | |
131 | fFillStatus = obj.fFillStatus; |
132 | fNumV0s = obj.fNumV0s; |
133 | fK0Particle = obj.fK0Particle; |
134 | |
135 | return (*this); |
136 | } |
137 | //_____________________________________________________________________________ |
138 | AliFemtoK0Event::~AliFemtoK0Event() |
139 | { |
140 | //Destructor |
141 | if(fK0Particle) delete fK0Particle; |
142 | } |
143 | |
144 | //_____________________________________________________________________________ |
145 | AliFemtoK0EventCollection::AliFemtoK0EventCollection() : |
146 | fBufferSize(0), |
147 | fLimit(0), |
148 | fEvt(0x0) |
149 | { |
150 | //Default constructor |
151 | } |
152 | //_____________________________________________________________________________ |
153 | AliFemtoK0EventCollection::AliFemtoK0EventCollection(short a, int lim) : |
154 | fBufferSize(0), |
155 | fLimit(0), |
156 | fEvt(0x0) |
157 | { |
158 | //maint constructor |
159 | |
160 | SetBufferSize(a); |
161 | |
162 | fEvt = new AliFemtoK0Event[fBufferSize]; //allocate pointer array of type particle_event |
163 | fLimit = lim; |
164 | |
165 | for(int ii = 0; ii < fBufferSize; ii++){ //Initialize particle table pointers to NULL |
166 | (fEvt + ii)->fK0Particle = NULL; |
167 | (fEvt + ii)->fNumV0s = 0; |
168 | (fEvt + ii)->fFillStatus = 0; |
169 | |
170 | (fEvt + ii)->fK0Particle = new AliFemtoK0Particle[fLimit]; |
171 | } |
172 | } |
173 | //_____________________________________________________________________________ |
174 | AliFemtoK0EventCollection::AliFemtoK0EventCollection(const AliFemtoK0EventCollection &obj) |
175 | : fBufferSize(obj.fBufferSize), |
176 | fLimit(obj.fLimit), |
177 | fEvt(obj.fEvt) |
178 | { |
179 | //copy constructor |
180 | } |
181 | //_____________________________________________________________________________ |
182 | AliFemtoK0EventCollection &AliFemtoK0EventCollection::operator=(const |
183 | AliFemtoK0EventCollection &obj) |
184 | { |
185 | //Assignment operator |
186 | if(this == &obj) return *this; |
187 | |
188 | fBufferSize = obj.fBufferSize; |
189 | fLimit = obj.fLimit; |
190 | fEvt = obj.fEvt; |
191 | |
192 | return (*this); |
193 | } |
194 | //_____________________________________________________________________________ |
195 | AliFemtoK0EventCollection::~AliFemtoK0EventCollection() |
196 | { |
197 | for(int i =0; i < fBufferSize; i++){ |
198 | if((fEvt + i)->fK0Particle != NULL){ |
199 | delete [] (fEvt + i)->fK0Particle; |
200 | } |
201 | } |
202 | |
203 | delete [] fEvt; |
204 | } |
205 | //_____________________________________________________________________________ |
206 | void AliFemtoK0EventCollection::FIFOShift(){ //Shift elements in FIFO by one and clear last element in FIFO |
207 | |
208 | for(unsigned short i=fBufferSize-1 ; i > 0; i--){ |
209 | for(int j=0; j<(fEvt + i-1)->fNumV0s; j++) (fEvt + i)->fK0Particle[j] = (fEvt + i-1)->fK0Particle[j]; |
210 | (fEvt + i)->fFillStatus = (fEvt + i-1)->fFillStatus; |
211 | (fEvt + i)->fNumV0s = (fEvt + i-1)->fNumV0s; |
212 | } |
213 | |
214 | (fEvt)->fNumV0s=0; |
215 | (fEvt)->fFillStatus=0; |
216 | |
217 | } |
218 | |