]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGCF/FEMTOSCOPY/K0Analysis/AliFemtoK0EventCollection.cxx
Merge branch 'master' into TPCdev
[u/mrichter/AliRoot.git] / PWGCF / FEMTOSCOPY / K0Analysis / AliFemtoK0EventCollection.cxx
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  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),
46  fPPos(),
47  fPNeg(),
48  fPosXYZ(),
49  fNegXYZ(),
50  fPhi(0),
51  fPhiPsi(0)
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),
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),
75  fPPos(),
76  fPNeg(),
77  fPosXYZ(),
78  fNegXYZ(),
79  fPhi(),
80  fPhiPsi()
81
82 {
83   // copy constructor
84 }
85 //_____________________________________________________________________________
86 AliFemtoK0Particle &AliFemtoK0Particle::operator=(const AliFemtoK0Particle &obj)
87 {
88  //Assignment operator
89  if(this == &obj) return *this;
90
91  fMomentum[0] = obj.fMomentum[0];
92  fMomentum[1] = obj.fMomentum[1];
93  fMomentum[2] = obj.fMomentum[2]; 
94  fPt = obj.fPt;
95  fMass = obj.fMass;
96  fDaughterID1 = obj.fDaughterID1;
97  fDaughterID2 = obj.fDaughterID2;
98  fK0 = obj.fK0;
99  fSideLeft = obj.fSideLeft;
100  fSideRight = obj.fSideRight;
101  fSkipShared = obj.fSkipShared;
102  fV0Dca = obj.fV0Dca;
103  fDDDca = obj.fDDDca;
104  fDecayLength = obj.fDecayLength;
105  fPosDca = obj.fPosDca;
106  fNegDca = obj.fNegDca;
107  fPosPt = obj.fPosPt;
108  fNegPt = obj.fNegPt;
109  fPosPhi = obj.fPosPhi;
110  fNegPhi = obj.fNegPhi;
111  for(int i=0;i<3;i++){
112   fPPos[i] = obj.fPPos[i];
113   fPNeg[i] = obj.fPNeg[i];
114   for(int j=0;j<9;j++){
115    fPosXYZ[j][i] = obj.fPosXYZ[j][i];
116    fNegXYZ[j][i] = obj.fNegXYZ[j][i];
117   }
118  }
119  fPhi = obj.fPhi;
120  fPhiPsi = obj.fPhiPsi;
121  return (*this);
122 }
123 //_____________________________________________________________________________
124 AliFemtoK0Particle::~AliFemtoK0Particle()
125 {
126   // Destructor
127 }
128 //_____________________________________________________________________________
129
130 AliFemtoK0Event::AliFemtoK0Event():
131  fFillStatus(0),
132  fNumV0s(0),
133  fK0Particle(0x0)
134 {
135   //Default constructor
136 }
137 //_____________________________________________________________________________
138 AliFemtoK0Event::AliFemtoK0Event(const AliFemtoK0Event &obj) : 
139  fFillStatus(obj.fFillStatus),
140  fNumV0s(obj.fNumV0s),
141  fK0Particle(obj.fK0Particle)
142 {
143   //Copy constructor
144 }
145 //_____________________________________________________________________________
146 AliFemtoK0Event &AliFemtoK0Event::operator=(const AliFemtoK0Event &obj)
147 {
148  //Assignment operator
149  if(this == &obj) return *this;
150
151  fFillStatus = obj.fFillStatus;
152  fNumV0s = obj.fNumV0s;
153  fK0Particle = obj.fK0Particle;
154
155  return (*this);
156 }
157 //_____________________________________________________________________________
158 AliFemtoK0Event::~AliFemtoK0Event()
159 {
160  //Destructor
161  if(fK0Particle){
162   delete fK0Particle;
163   fK0Particle = NULL;
164  }
165 }
166 //_____________________________________________________________________________
167 AliFemtoK0EventCollection::AliFemtoK0EventCollection() : 
168  fBufferSize(0),
169  fLimit(0),
170  fEvt(0x0)
171 {
172  //Default constructor
173 }
174 //_____________________________________________________________________________
175 AliFemtoK0EventCollection::AliFemtoK0EventCollection(short a, int lim) :
176   fBufferSize(0),
177   fLimit(0),
178   fEvt(0x0)
179 {
180   //maint constructor
181  
182   SetBufferSize(a);
183   
184   fEvt = new AliFemtoK0Event[fBufferSize];  //allocate pointer array of type particle_event
185   fLimit = lim;
186
187   for(int ii = 0; ii < fBufferSize; ii++){   //Initialize particle table pointers to NULL
188     (fEvt + ii)->fK0Particle = NULL;
189     (fEvt + ii)->fNumV0s = 0;
190     (fEvt + ii)->fFillStatus = 0;
191
192     (fEvt + ii)->fK0Particle = new AliFemtoK0Particle[fLimit];
193   }
194 }
195 //_____________________________________________________________________________
196 AliFemtoK0EventCollection::AliFemtoK0EventCollection(const AliFemtoK0EventCollection &obj)
197  : fBufferSize(obj.fBufferSize),
198    fLimit(obj.fLimit),
199    fEvt(obj.fEvt)
200 {
201  //copy constructor
202 }
203 //_____________________________________________________________________________
204 AliFemtoK0EventCollection &AliFemtoK0EventCollection::operator=(const
205 AliFemtoK0EventCollection &obj)
206 {
207  //Assignment operator
208  if(this == &obj) return *this;
209  
210  fBufferSize = obj.fBufferSize;
211  fLimit = obj.fLimit;
212  fEvt = obj.fEvt;
213
214  return (*this);
215 }
216 //_____________________________________________________________________________
217 AliFemtoK0EventCollection::~AliFemtoK0EventCollection()
218 {
219  for(int i =0; i < fBufferSize; i++){
220   if((fEvt + i)->fK0Particle != NULL){
221    delete [] (fEvt + i)->fK0Particle;
222    (fEvt + i)->fK0Particle = NULL;
223   }
224  }
225  
226  delete [] fEvt; fEvt = NULL;
227 }
228 //_____________________________________________________________________________
229 void AliFemtoK0EventCollection::FIFOShift(){ //Shift elements in FIFO by one and clear last element in FIFO 
230   
231   for(unsigned short i=fBufferSize-1 ; i > 0; i--){
232     for(int j=0; j<(fEvt + i-1)->fNumV0s; j++) (fEvt + i)->fK0Particle[j] = (fEvt + i-1)->fK0Particle[j];
233     (fEvt + i)->fFillStatus = (fEvt + i-1)->fFillStatus;
234     (fEvt + i)->fNumV0s = (fEvt + i-1)->fNumV0s;
235   }
236
237   (fEvt)->fNumV0s=0;
238   (fEvt)->fFillStatus=0;
239
240 }