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