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