Fix in IsSecondaryFromWeakDecay (to properly account pions and muons decays). From...
[u/mrichter/AliRoot.git] / PWGCF / FEMTOSCOPY / K0Analysis / AliFemtoK0EventCollection.cxx
CommitLineData
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
27AliFemtoK0Particle::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 fPPos(),
47 fPNeg(),
fae797ad 48 fPosXYZ(),
49 fNegXYZ()
0da241a9 50{
51 //Default constructor
52}
53//_____________________________________________________________________________
54AliFemtoK0Particle::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),
cc64ee13 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),
0da241a9 73 fPPos(),
74 fPNeg(),
fae797ad 75 fPosXYZ(),
76 fNegXYZ()
77
0da241a9 78{
79 // copy constructor
80}
81//_____________________________________________________________________________
82AliFemtoK0Particle &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;
cc64ee13 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;
fae797ad 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 }
0da241a9 115 return (*this);
116}
117//_____________________________________________________________________________
118AliFemtoK0Particle::~AliFemtoK0Particle()
119{
120 // Destructor
121}
122//_____________________________________________________________________________
123
124AliFemtoK0Event::AliFemtoK0Event():
125 fFillStatus(0),
126 fNumV0s(0),
127 fK0Particle(0x0)
128{
129 //Default constructor
130}
131//_____________________________________________________________________________
132AliFemtoK0Event::AliFemtoK0Event(const AliFemtoK0Event &obj) :
133 fFillStatus(obj.fFillStatus),
134 fNumV0s(obj.fNumV0s),
135 fK0Particle(obj.fK0Particle)
136{
137 //Copy constructor
138}
139//_____________________________________________________________________________
140AliFemtoK0Event &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//_____________________________________________________________________________
152AliFemtoK0Event::~AliFemtoK0Event()
153{
154 //Destructor
155 if(fK0Particle) delete fK0Particle;
156}
157
158//_____________________________________________________________________________
159AliFemtoK0EventCollection::AliFemtoK0EventCollection() :
160 fBufferSize(0),
161 fLimit(0),
162 fEvt(0x0)
163{
164 //Default constructor
165}
166//_____________________________________________________________________________
167AliFemtoK0EventCollection::AliFemtoK0EventCollection(short a, int lim) :
168 fBufferSize(0),
169 fLimit(0),
170 fEvt(0x0)
171{
172 //maint constructor
173
174 SetBufferSize(a);
175
176 fEvt = new AliFemtoK0Event[fBufferSize]; //allocate pointer array of type particle_event
177 fLimit = lim;
178
179 for(int ii = 0; ii < fBufferSize; ii++){ //Initialize particle table pointers to NULL
180 (fEvt + ii)->fK0Particle = NULL;
181 (fEvt + ii)->fNumV0s = 0;
182 (fEvt + ii)->fFillStatus = 0;
183
184 (fEvt + ii)->fK0Particle = new AliFemtoK0Particle[fLimit];
185 }
186}
187//_____________________________________________________________________________
188AliFemtoK0EventCollection::AliFemtoK0EventCollection(const AliFemtoK0EventCollection &obj)
189 : fBufferSize(obj.fBufferSize),
190 fLimit(obj.fLimit),
191 fEvt(obj.fEvt)
192{
193 //copy constructor
194}
195//_____________________________________________________________________________
196AliFemtoK0EventCollection &AliFemtoK0EventCollection::operator=(const
197AliFemtoK0EventCollection &obj)
198{
199 //Assignment operator
200 if(this == &obj) return *this;
201
202 fBufferSize = obj.fBufferSize;
203 fLimit = obj.fLimit;
204 fEvt = obj.fEvt;
205
206 return (*this);
207}
208//_____________________________________________________________________________
209AliFemtoK0EventCollection::~AliFemtoK0EventCollection()
210{
211 for(int i =0; i < fBufferSize; i++){
212 if((fEvt + i)->fK0Particle != NULL){
213 delete [] (fEvt + i)->fK0Particle;
214 }
215 }
216
217 delete [] fEvt;
218}
219//_____________________________________________________________________________
220void AliFemtoK0EventCollection::FIFOShift(){ //Shift elements in FIFO by one and clear last element in FIFO
221
222 for(unsigned short i=fBufferSize-1 ; i > 0; i--){
223 for(int j=0; j<(fEvt + i-1)->fNumV0s; j++) (fEvt + i)->fK0Particle[j] = (fEvt + i-1)->fK0Particle[j];
224 (fEvt + i)->fFillStatus = (fEvt + i-1)->fFillStatus;
225 (fEvt + i)->fNumV0s = (fEvt + i-1)->fNumV0s;
226 }
227
228 (fEvt)->fNumV0s=0;
229 (fEvt)->fFillStatus=0;
230
231}
232