]>
Commit | Line | Data |
---|---|---|
be9ef9f9 | 1 | //////////////////////////////////////////////////////////////////////////////// |
2 | // | |
3 | // This class provides storage for event and track information which | |
4 | // are used for same-event as well as mixed-event analyses in AliFourPion | |
5 | // | |
6 | // authors: Dhevan Gangadharan (dhevan.raja.gangadharan@cern.ch) | |
7 | // | |
8 | //////////////////////////////////////////////////////////////////////////////// | |
9 | ||
10 | #include "AliFourPionEventCollection.h" | |
11 | ||
12 | AliFourPionTrackStruct::AliFourPionTrackStruct(): | |
13 | fStatus(0), | |
14 | fFiltermap(0), | |
15 | fId(0), | |
16 | fPhi(0), | |
17 | fPt(0), | |
18 | fMom(0), | |
19 | fP(), | |
20 | fCharge(0), | |
21 | fEta(0), | |
22 | fMass(0), | |
23 | fDCAXY(0), | |
24 | fDCAZ(0), | |
25 | fDCA(0), | |
26 | fEaccepted(0), | |
27 | fKey(0), | |
28 | fClusterMap(0), | |
29 | fSharedMap(0), | |
30 | fX(), | |
31 | fTOFhit(0), | |
32 | fElectron(0), | |
33 | fMuon(0), | |
34 | fPion(0), | |
35 | fKaon(0), | |
36 | fProton(0), | |
37 | fLabel(0)// MC | |
38 | { | |
39 | //Default constructor | |
40 | } | |
41 | AliFourPionTrackStruct::AliFourPionTrackStruct(const AliFourPionTrackStruct &obj) | |
42 | : fStatus(obj.fStatus), | |
43 | fFiltermap(obj.fFiltermap), | |
44 | fId(obj.fId), | |
45 | fPhi(obj.fPhi), | |
46 | fPt(obj.fPt), | |
47 | fMom(obj.fMom), | |
48 | fP(), | |
49 | fCharge(obj.fCharge), | |
50 | fEta(obj.fEta), | |
51 | fMass(obj.fMass), | |
52 | fDCAXY(obj.fDCAXY), | |
53 | fDCAZ(obj.fDCAZ), | |
54 | fDCA(obj.fDCA), | |
55 | fEaccepted(obj.fEaccepted), | |
56 | fKey(obj.fKey), | |
57 | fClusterMap(obj.fClusterMap), | |
58 | fSharedMap(obj.fSharedMap), | |
59 | fX(), | |
60 | fTOFhit(obj.fTOFhit), | |
61 | fElectron(obj.fElectron), | |
62 | fMuon(obj.fMuon), | |
63 | fPion(obj.fPion), | |
64 | fKaon(obj.fKaon), | |
65 | fProton(obj.fProton), | |
66 | fLabel(obj.fLabel)// MC | |
67 | { | |
68 | // copy constructor | |
69 | } | |
70 | AliFourPionTrackStruct &AliFourPionTrackStruct::operator=(const AliFourPionTrackStruct &obj) | |
71 | { | |
72 | // Assignment operator | |
73 | if (this == &obj) | |
74 | return *this; | |
75 | ||
76 | fStatus = obj.fStatus; | |
77 | fFiltermap = obj.fFiltermap; | |
78 | fId = obj.fId; | |
79 | fPhi = obj.fPhi; | |
80 | fPt = obj.fPt; | |
81 | fMom = obj.fMom; | |
82 | fP[0] = obj.fP[0]; | |
83 | fP[1] = obj.fP[1]; | |
84 | fP[2] = obj.fP[2]; | |
85 | fCharge = obj.fCharge; | |
86 | fEta = obj.fEta; | |
87 | fMass = obj.fMass; | |
88 | fDCAXY = obj.fDCAXY; | |
89 | fDCAZ = obj.fDCAZ; | |
90 | fDCA = obj.fDCA; | |
91 | fEaccepted = obj.fEaccepted; | |
92 | fKey = obj.fKey; | |
93 | fClusterMap = obj.fClusterMap; | |
94 | fSharedMap = obj.fSharedMap; | |
95 | fX[0] = obj.fX[0]; | |
96 | fX[1] = obj.fX[1]; | |
97 | fX[2] = obj.fX[2]; | |
98 | fTOFhit = obj.fTOFhit; | |
99 | fElectron = obj.fElectron; | |
100 | fMuon = obj.fMuon; | |
101 | fPion = obj.fPion; | |
102 | fKaon = obj.fKaon; | |
103 | fProton = obj.fProton; | |
104 | fLabel = obj.fLabel;// MC | |
105 | ||
106 | return (*this); | |
107 | } | |
108 | AliFourPionTrackStruct::~AliFourPionTrackStruct() | |
109 | { | |
110 | // Destructor | |
111 | } | |
112 | ||
113 | //_____________________________________________________________________________ | |
114 | AliFourPionMCStruct::AliFourPionMCStruct(): | |
115 | fPx(0), | |
116 | fPy(0), | |
117 | fPz(0), | |
118 | fPtot(0), | |
119 | fPdgCode(0), | |
120 | fMotherLabel(0) | |
121 | { | |
122 | // Default constructor | |
123 | } | |
124 | AliFourPionMCStruct::AliFourPionMCStruct(const AliFourPionMCStruct &obj) | |
125 | : fPx(obj.fPx), | |
126 | fPy(obj.fPy), | |
127 | fPz(obj.fPz), | |
128 | fPtot(obj.fPtot), | |
129 | fPdgCode(obj.fPdgCode), | |
130 | fMotherLabel(obj.fMotherLabel) | |
131 | { | |
132 | // copy constructor | |
133 | } | |
134 | AliFourPionMCStruct &AliFourPionMCStruct::operator=(const AliFourPionMCStruct &obj) | |
135 | { | |
136 | // Assignment operator | |
137 | if (this == &obj) | |
138 | return *this; | |
139 | ||
140 | fPx = obj.fPx; | |
141 | fPy = obj.fPy; | |
142 | fPz = obj.fPz; | |
143 | fPtot = obj.fPtot; | |
144 | fPdgCode = obj.fPdgCode; | |
145 | fMotherLabel = obj.fMotherLabel; | |
146 | ||
147 | return (*this); | |
148 | } | |
149 | AliFourPionMCStruct::~AliFourPionMCStruct() | |
150 | { | |
151 | // Destructor | |
152 | } | |
153 | ||
154 | //_____________________________________________________________________________ | |
155 | AliFourPionEventStruct::AliFourPionEventStruct(): | |
156 | fFillStatus(0), | |
157 | fNtracks(0), | |
158 | fMCarraySize(0), | |
159 | fTracks(0), | |
160 | fMCtracks(0) | |
161 | { | |
162 | // Default constructor | |
163 | } | |
164 | AliFourPionEventStruct::AliFourPionEventStruct(const AliFourPionEventStruct &obj) | |
165 | : fFillStatus(obj.fFillStatus), | |
166 | fNtracks(obj.fNtracks), | |
167 | fMCarraySize(obj.fMCarraySize), | |
168 | fTracks(obj.fTracks), | |
169 | fMCtracks(obj.fMCtracks) | |
170 | { | |
171 | // copy constructor | |
172 | } | |
173 | AliFourPionEventStruct &AliFourPionEventStruct::operator=(const AliFourPionEventStruct &obj) | |
174 | { | |
175 | // Assignment operator | |
176 | if (this == &obj) | |
177 | return *this; | |
178 | ||
179 | fFillStatus = obj.fFillStatus; | |
180 | fNtracks = obj.fNtracks; | |
181 | fMCarraySize = obj.fMCarraySize; | |
182 | fTracks = obj.fTracks; | |
183 | fMCtracks = obj.fMCtracks; | |
184 | ||
185 | return (*this); | |
186 | } | |
187 | AliFourPionEventStruct::~AliFourPionEventStruct() | |
188 | { | |
189 | // Destructor | |
190 | if(fTracks) delete fTracks; | |
191 | if(fMCtracks) delete fMCtracks; | |
192 | } | |
193 | ||
194 | //_____________________________________________________________________________ | |
195 | AliFourPionEventCollection::AliFourPionEventCollection(): | |
196 | fFIFO(0), | |
197 | fLimit(0), | |
198 | fMCLimit(0), | |
199 | fEvtStr(0) | |
200 | { | |
201 | // Default constructor | |
202 | } | |
203 | AliFourPionEventCollection::AliFourPionEventCollection(Short_t a, Int_t lim, Int_t mcarraylimit, Bool_t MCcase): | |
204 | fFIFO(0), | |
205 | fLimit(0), | |
206 | fMCLimit(0), | |
207 | fEvtStr(0) | |
208 | { | |
209 | ||
210 | // Main constructor | |
211 | SetBuffSize(a); | |
212 | ||
213 | fEvtStr = new AliFourPionEventStruct[fFIFO]; //allocate pointer array of type particle_event | |
214 | fLimit = lim; | |
215 | fMCLimit = mcarraylimit; | |
216 | ||
217 | for(Int_t ii = 0; ii < fFIFO; ii++){ //Initialize particle table pointers to NULL | |
218 | (fEvtStr + ii)->fNtracks = 0; | |
219 | (fEvtStr + ii)->fFillStatus = 0; | |
220 | (fEvtStr + ii)->fMCarraySize = 0; | |
221 | // | |
222 | (fEvtStr + ii)->fTracks = NULL; | |
223 | (fEvtStr + ii)->fTracks = new AliFourPionTrackStruct[fLimit]; | |
224 | if(MCcase) (fEvtStr + ii)->fMCtracks = new AliFourPionMCStruct[fMCLimit]; | |
225 | ||
226 | } | |
227 | } | |
228 | AliFourPionEventCollection::AliFourPionEventCollection(const AliFourPionEventCollection &obj) | |
229 | : fFIFO(obj.fFIFO), | |
230 | fLimit(obj.fLimit), | |
231 | fMCLimit(obj.fMCLimit), | |
232 | fEvtStr(obj.fEvtStr) | |
233 | { | |
234 | // copy constructor | |
235 | } | |
236 | AliFourPionEventCollection &AliFourPionEventCollection::operator=(const AliFourPionEventCollection &obj) | |
237 | { | |
238 | // Assignment operator | |
239 | if (this == &obj) | |
240 | return *this; | |
241 | ||
242 | fFIFO = obj.fFIFO; | |
243 | fLimit = obj.fLimit; | |
244 | fMCLimit = obj.fMCLimit; | |
245 | fEvtStr = obj.fEvtStr; | |
246 | ||
247 | return (*this); | |
248 | } | |
249 | AliFourPionEventCollection::~AliFourPionEventCollection(){ | |
250 | ||
251 | for(Int_t i = 0; i < fFIFO; i++){ | |
252 | ||
253 | if((fEvtStr + i)->fTracks != NULL){ | |
254 | delete [] (fEvtStr + i)->fTracks; | |
255 | delete [] (fEvtStr + i)->fMCtracks; | |
256 | } | |
257 | ||
258 | } | |
259 | ||
260 | delete [] fEvtStr; | |
261 | //remove histos from heap | |
262 | ||
263 | } | |
264 | ||
265 | ||
266 | //_____________________________________________________________________________ | |
267 | void AliFourPionEventCollection::FIFOShift(){ //Shift elements in FIFO by one and clear last element in FIFO | |
268 | ||
269 | ||
270 | for(UShort_t i=fFIFO-1 ; i > 0; i--){ | |
271 | for(Int_t j=0; j<(fEvtStr + i-1)->fNtracks; j++) (fEvtStr + i)->fTracks[j] = (fEvtStr + i-1)->fTracks[j]; | |
272 | for(Int_t j=0; j<(fEvtStr + i-1)->fMCarraySize; j++) (fEvtStr + i)->fMCtracks[j] = (fEvtStr + i-1)->fMCtracks[j]; | |
273 | ||
274 | (fEvtStr + i)->fFillStatus = (fEvtStr + i-1)->fFillStatus; | |
275 | (fEvtStr + i)->fNtracks = (fEvtStr + i-1)->fNtracks; | |
276 | (fEvtStr + i)->fMCarraySize = (fEvtStr + i-1)->fMCarraySize; | |
277 | ||
278 | }// fifo loop | |
279 | ||
280 | ||
281 | (fEvtStr)->fNtracks=0; | |
282 | (fEvtStr)->fFillStatus=0; | |
283 | (fEvtStr)->fMCarraySize=0; | |
284 | } |