]>
Commit | Line | Data |
---|---|---|
9e44b53d | 1 | #include <string.h> |
32e449be | 2 | #include "AliMultiplicity.h" |
d325d83f | 3 | #include "AliLog.h" |
32e449be | 4 | |
5 | ClassImp(AliMultiplicity) | |
6 | ||
7 | //______________________________________________________________________ | |
fe12e09c | 8 | AliMultiplicity::AliMultiplicity(): |
9 | TObject(), | |
10 | fNtracks(0), | |
cd888a89 | 11 | fNsingle(0), |
12 | fLabels(0), | |
0939e22a | 13 | fLabelsL2(0), |
fe12e09c | 14 | fTh(0), |
15 | fPhi(0), | |
fa9ed8e9 | 16 | fDeltTh(0), |
968e8539 | 17 | fDeltPhi(0), |
968e8539 | 18 | fThsingle(0), |
ff44c37c | 19 | fPhisingle(0), |
d7c5c1e4 | 20 | fLabelssingle(0), |
adc4b00f | 21 | fFastOrFiredChips(1200), |
ab37e14c | 22 | fClusterFiredChips(1200) |
fe12e09c | 23 | { |
32e449be | 24 | // Default Constructor |
ab37e14c | 25 | fFiredChips[0] = 0; |
26 | fFiredChips[1] = 0; | |
d325d83f | 27 | for(Int_t ilayer = 0; ilayer < 6; ilayer++)fITSClusters[ilayer] = 0; |
32e449be | 28 | } |
29 | ||
30 | //______________________________________________________________________ | |
d7c5c1e4 | 31 | AliMultiplicity::AliMultiplicity(Int_t ntr, Float_t *th, Float_t *ph, Float_t *dth, Float_t *dph, Int_t *labels, Int_t* labelsL2, Int_t ns, Float_t *ts, Float_t *ps, Int_t *labelss, Short_t nfcL1, Short_t nfcL2, const TBits & fFastOr): |
fe12e09c | 32 | TObject(), |
33 | fNtracks(ntr), | |
cd888a89 | 34 | fNsingle(ns), |
35 | fLabels(0), | |
0939e22a | 36 | fLabelsL2(0), |
fe12e09c | 37 | fTh(0), |
38 | fPhi(0), | |
fa9ed8e9 | 39 | fDeltTh(0), |
968e8539 | 40 | fDeltPhi(0), |
968e8539 | 41 | fThsingle(0), |
ff44c37c | 42 | fPhisingle(0), |
d7c5c1e4 | 43 | fLabelssingle(0), |
adc4b00f | 44 | fFastOrFiredChips(1200), |
ab37e14c | 45 | fClusterFiredChips(1200) |
fe12e09c | 46 | { |
32e449be | 47 | // Standard constructor |
32e449be | 48 | if(ntr>0){ |
59ea252e | 49 | fLabels = new Int_t[ntr]; |
0939e22a | 50 | fLabelsL2 = new Int_t[ntr]; |
cd888a89 | 51 | fTh = new Double_t [ntr]; |
52 | fPhi = new Double_t [ntr]; | |
fa9ed8e9 | 53 | fDeltTh = new Double_t [ntr]; |
cd888a89 | 54 | fDeltPhi = new Double_t [ntr]; |
32e449be | 55 | for(Int_t i=0;i<fNtracks;i++){ |
fa9ed8e9 | 56 | fTh[i]=th[i]; |
32e449be | 57 | fPhi[i]=ph[i]; |
fa9ed8e9 | 58 | fDeltTh[i]=dth[i]; |
59 | fDeltPhi[i]=dph[i]; | |
59ea252e | 60 | fLabels[i] = labels[i]; |
0939e22a | 61 | fLabelsL2[i] = labelsL2[i]; |
32e449be | 62 | } |
63 | } | |
968e8539 | 64 | if(ns>0){ |
cd888a89 | 65 | fThsingle = new Double_t [ns]; |
66 | fPhisingle = new Double_t [ns]; | |
d7c5c1e4 | 67 | fLabelssingle = new Int_t [ns]; |
968e8539 | 68 | for(Int_t i=0;i<fNsingle;i++){ |
69 | fThsingle[i]=ts[i]; | |
70 | fPhisingle[i]=ps[i]; | |
d7c5c1e4 | 71 | fLabelssingle[i]=labelss[i]; |
968e8539 | 72 | } |
73 | } | |
ab37e14c | 74 | fFiredChips[0] = nfcL1; |
75 | fFiredChips[1] = nfcL2; | |
ff44c37c | 76 | fFastOrFiredChips = fFastOr; |
d325d83f | 77 | for(Int_t ilayer = 0; ilayer < 6; ilayer++)fITSClusters[ilayer] = 0; |
32e449be | 78 | } |
79 | ||
1f9831ab | 80 | //______________________________________________________________________ |
81 | AliMultiplicity::AliMultiplicity(Int_t ntr, Int_t ns, Short_t nfcL1, Short_t nfcL2, const TBits & fFastOr) : | |
82 | TObject(), | |
83 | fNtracks(ntr), | |
84 | fNsingle(ns), | |
85 | fLabels(0), | |
86 | fLabelsL2(0), | |
87 | fTh(0), | |
88 | fPhi(0), | |
89 | fDeltTh(0), | |
90 | fDeltPhi(0), | |
91 | fThsingle(0), | |
92 | fPhisingle(0), | |
d7c5c1e4 | 93 | fLabelssingle(0), |
1f9831ab | 94 | fFastOrFiredChips(1200), |
95 | fClusterFiredChips(1200) | |
96 | { | |
97 | // Standard constructor to create the arrays w/o filling | |
98 | if(ntr>0){ | |
99 | fLabels = new Int_t[ntr]; | |
100 | fLabelsL2 = new Int_t[ntr]; | |
101 | fTh = new Double_t [ntr]; | |
102 | fPhi = new Double_t [ntr]; | |
103 | fDeltTh = new Double_t [ntr]; | |
104 | fDeltPhi = new Double_t [ntr]; | |
105 | for(Int_t i=fNtracks;i--;){ | |
106 | fTh[i]=fPhi[i]=fDeltTh[i]=fDeltPhi[i] = 0; | |
107 | fLabels[i] = fLabelsL2[i] = 0; | |
108 | } | |
109 | } | |
110 | if(ns>0){ | |
111 | fThsingle = new Double_t [ns]; | |
112 | fPhisingle = new Double_t [ns]; | |
d7c5c1e4 | 113 | fLabelssingle = new Int_t [ns]; |
114 | for(Int_t i=fNsingle;i--;) fThsingle[i] = fPhisingle[i] = fLabelssingle[i] = 0; | |
1f9831ab | 115 | } |
116 | fFiredChips[0] = nfcL1; | |
117 | fFiredChips[1] = nfcL2; | |
118 | fFastOrFiredChips = fFastOr; | |
119 | for(Int_t ilayer=6;ilayer--;) fITSClusters[ilayer] = 0; | |
120 | } | |
121 | ||
32e449be | 122 | //______________________________________________________________________ |
fe12e09c | 123 | AliMultiplicity::AliMultiplicity(const AliMultiplicity& m): |
124 | TObject(m), | |
125 | fNtracks(m.fNtracks), | |
cd888a89 | 126 | fNsingle(m.fNsingle), |
127 | fLabels(0), | |
0939e22a | 128 | fLabelsL2(0), |
fe12e09c | 129 | fTh(0), |
130 | fPhi(0), | |
fa9ed8e9 | 131 | fDeltTh(0), |
968e8539 | 132 | fDeltPhi(0), |
968e8539 | 133 | fThsingle(0), |
ff44c37c | 134 | fPhisingle(0), |
d7c5c1e4 | 135 | fLabelssingle(0), |
adc4b00f | 136 | fFastOrFiredChips(1200), |
ab37e14c | 137 | fClusterFiredChips(1200) |
fe12e09c | 138 | { |
32e449be | 139 | // copy constructor |
32e449be | 140 | Duplicate(m); |
32e449be | 141 | } |
142 | ||
143 | //______________________________________________________________________ | |
144 | AliMultiplicity &AliMultiplicity::operator=(const AliMultiplicity& m){ | |
145 | // assignment operator | |
146 | if(this == &m)return *this; | |
147 | ((TObject *)this)->operator=(m); | |
148 | ||
316c6cd9 | 149 | if(fTh)delete [] fTh;fTh = 0; |
150 | if(fPhi)delete [] fPhi;fPhi = 0; | |
fa9ed8e9 | 151 | if(fDeltTh)delete [] fDeltTh;fDeltTh= 0; |
316c6cd9 | 152 | if(fDeltPhi)delete [] fDeltPhi;fDeltPhi = 0; |
153 | if(fLabels)delete [] fLabels;fLabels = 0; | |
0939e22a | 154 | if(fLabelsL2)delete [] fLabelsL2;fLabelsL2 = 0; |
316c6cd9 | 155 | if(fThsingle)delete [] fThsingle;fThsingle = 0; |
156 | if(fPhisingle)delete [] fPhisingle;fPhisingle = 0; | |
d7c5c1e4 | 157 | if(fLabelssingle)delete [] fLabelssingle;fLabelssingle = 0; |
32e449be | 158 | Duplicate(m); |
159 | ||
160 | return *this; | |
161 | } | |
162 | ||
732a24fe | 163 | void AliMultiplicity::Copy(TObject &obj) const { |
164 | ||
165 | // this overwrites the virtual TOBject::Copy() | |
166 | // to allow run time copying without casting | |
167 | // in AliESDEvent | |
168 | ||
169 | if(this==&obj)return; | |
170 | AliMultiplicity *robj = dynamic_cast<AliMultiplicity*>(&obj); | |
171 | if(!robj)return; // not an AliMultiplicity | |
172 | *robj = *this; | |
173 | ||
174 | } | |
175 | ||
176 | ||
32e449be | 177 | //______________________________________________________________________ |
178 | void AliMultiplicity::Duplicate(const AliMultiplicity& m){ | |
179 | // used by copy constructor and assignment operator | |
180 | fNtracks = m.fNtracks; | |
181 | if(fNtracks>0){ | |
cd888a89 | 182 | fTh = new Double_t[fNtracks]; |
183 | fPhi = new Double_t[fNtracks]; | |
fa9ed8e9 | 184 | fDeltTh = new Double_t[fNtracks]; |
cd888a89 | 185 | fDeltPhi = new Double_t[fNtracks]; |
59ea252e | 186 | fLabels = new Int_t[fNtracks]; |
0939e22a | 187 | fLabelsL2 = new Int_t[fNtracks]; |
32e449be | 188 | } |
189 | else { | |
190 | fTh = 0; | |
191 | fPhi = 0; | |
fa9ed8e9 | 192 | fDeltTh = 0; |
32e449be | 193 | fDeltPhi = 0; |
59ea252e | 194 | fLabels = 0; |
0939e22a | 195 | fLabelsL2 = 0; |
32e449be | 196 | } |
968e8539 | 197 | fNsingle = m.fNsingle; |
198 | if(fNsingle>0){ | |
cd888a89 | 199 | fThsingle = new Double_t[fNsingle]; |
200 | fPhisingle = new Double_t[fNsingle]; | |
d7c5c1e4 | 201 | fLabelssingle = new Int_t[fNsingle]; |
968e8539 | 202 | } |
203 | else { | |
204 | fThsingle = 0; | |
205 | fPhisingle = 0; | |
d7c5c1e4 | 206 | fLabelssingle = 0; |
968e8539 | 207 | } |
cd888a89 | 208 | if(m.fTh)memcpy(fTh,m.fTh,fNtracks*sizeof(Double_t)); |
209 | if(m.fPhi)memcpy(fPhi,m.fPhi,fNtracks*sizeof(Double_t)); | |
fa9ed8e9 | 210 | if(m.fDeltTh)memcpy(fDeltTh,m.fDeltTh,fNtracks*sizeof(Double_t)); |
cd888a89 | 211 | if(m.fDeltPhi)memcpy(fDeltPhi,m.fDeltPhi,fNtracks*sizeof(Double_t)); |
212 | if(m.fLabels)memcpy(fLabels,m.fLabels,fNtracks*sizeof(Int_t)); | |
0939e22a | 213 | if(m.fLabelsL2)memcpy(fLabelsL2,m.fLabelsL2,fNtracks*sizeof(Int_t)); |
cd888a89 | 214 | if(m.fThsingle)memcpy(fThsingle,m.fThsingle,fNsingle*sizeof(Double_t)); |
215 | if(m.fPhisingle)memcpy(fPhisingle,m.fPhisingle,fNsingle*sizeof(Double_t)); | |
d7c5c1e4 | 216 | if(m.fLabelssingle)memcpy(fLabelssingle,m.fLabelssingle,fNsingle*sizeof(Int_t)); |
ab37e14c | 217 | fFiredChips[0] = m.fFiredChips[0]; |
218 | fFiredChips[1] = m.fFiredChips[1]; | |
d325d83f | 219 | for(Int_t ilayer = 0; ilayer < 6; ilayer++){ |
220 | fITSClusters[ilayer] = m.fITSClusters[ilayer]; | |
221 | } | |
222 | ||
1f9831ab | 223 | fUsedClusT[0] = m.fUsedClusT[0]; |
224 | fUsedClusT[1] = m.fUsedClusT[1]; | |
225 | fUsedClusS[0] = m.fUsedClusS[0]; | |
226 | fUsedClusS[1] = m.fUsedClusS[1]; | |
d325d83f | 227 | |
ff44c37c | 228 | fFastOrFiredChips = m.fFastOrFiredChips; |
ab37e14c | 229 | fClusterFiredChips = m.fClusterFiredChips; |
32e449be | 230 | } |
231 | ||
232 | //______________________________________________________________________ | |
233 | AliMultiplicity::~AliMultiplicity(){ | |
234 | // Destructor | |
316c6cd9 | 235 | if(fTh)delete [] fTh;fTh = 0; |
236 | if(fPhi)delete [] fPhi;fPhi = 0; | |
fa9ed8e9 | 237 | if(fDeltTh)delete [] fDeltTh;fDeltTh = 0; |
316c6cd9 | 238 | if(fDeltPhi)delete [] fDeltPhi;fDeltPhi = 0; |
239 | if(fLabels)delete [] fLabels;fLabels = 0; | |
0939e22a | 240 | if(fLabelsL2)delete [] fLabelsL2;fLabelsL2 = 0; |
316c6cd9 | 241 | if(fThsingle)delete [] fThsingle;fThsingle = 0; |
242 | if(fPhisingle)delete [] fPhisingle;fPhisingle = 0; | |
d7c5c1e4 | 243 | if(fLabelssingle)delete [] fLabelssingle;fLabelssingle = 0; |
32e449be | 244 | } |
56258350 | 245 | |
1f9831ab | 246 | //______________________________________________________________________ |
247 | void AliMultiplicity::Clear(Option_t*) | |
248 | { | |
249 | // reset all | |
250 | TObject::Clear(); | |
251 | if(fTh)delete [] fTh;fTh = 0; | |
252 | if(fPhi)delete [] fPhi;fPhi = 0; | |
253 | if(fDeltTh)delete [] fDeltTh;fDeltTh = 0; | |
254 | if(fDeltPhi)delete [] fDeltPhi;fDeltPhi = 0; | |
255 | if(fLabels)delete [] fLabels;fLabels = 0; | |
256 | if(fLabelsL2)delete [] fLabelsL2;fLabelsL2 = 0; | |
257 | if(fThsingle)delete [] fThsingle;fThsingle = 0; | |
258 | if(fPhisingle)delete [] fPhisingle;fPhisingle = 0; | |
d7c5c1e4 | 259 | if(fLabelssingle)delete [] fLabelssingle;fLabelssingle = 0; |
1f9831ab | 260 | fNtracks = fNsingle = 0; |
261 | for (int i=6;i--;) fITSClusters[0] = 0; | |
262 | fFiredChips[0] = fFiredChips[1] = 0; | |
263 | fFastOrFiredChips.ResetAllBits(kTRUE); | |
264 | fClusterFiredChips.ResetAllBits(kTRUE); | |
265 | fUsedClusT[0].ResetAllBits(kTRUE); | |
266 | fUsedClusT[1].ResetAllBits(kTRUE); | |
267 | fUsedClusS[0].ResetAllBits(kTRUE); | |
268 | fUsedClusS[1].ResetAllBits(kTRUE); | |
269 | // | |
270 | } | |
271 | ||
56258350 | 272 | //______________________________________________________________________ |
273 | void AliMultiplicity::SetLabel(Int_t i, Int_t layer, Int_t label) | |
274 | { | |
275 | if(i>=0 && i<fNtracks) { | |
276 | if (layer == 0) { | |
277 | fLabels[i] = label; | |
278 | return; | |
279 | } else if (layer == 1) { | |
280 | if (fLabelsL2) { | |
281 | fLabelsL2[i] = label; | |
282 | return; | |
283 | } | |
284 | } | |
285 | } | |
286 | Error("SetLabel","Invalid track number %d or layer %d",i,layer); | |
287 | } | |
d325d83f | 288 | |
d7c5c1e4 | 289 | //______________________________________________________________________ |
290 | void AliMultiplicity::SetLabelSingle(Int_t i, Int_t label) | |
291 | { | |
292 | if(i>=0 && i<fNsingle) { | |
293 | if (fLabelssingle) { | |
294 | fLabelssingle[i] = label; | |
295 | return; | |
296 | } | |
297 | } | |
298 | Error("SetLabelSingle","Invalid single cluster number %d",i); | |
299 | } | |
300 | ||
d325d83f | 301 | //______________________________________________________________________ |
302 | UInt_t AliMultiplicity::GetNumberOfITSClusters(Int_t layMin, Int_t layMax) const { | |
303 | ||
304 | if(layMax < layMin) { | |
305 | AliError("layer min > layer max"); | |
306 | return 0; | |
307 | } | |
308 | if(layMin < 0) { | |
309 | AliError("layer min < 0"); | |
310 | return 0; | |
311 | } | |
312 | if(layMax < 0) { | |
313 | AliError("layer max > 0"); | |
314 | return 0; | |
315 | } | |
316 | ||
317 | Int_t sum=0; | |
318 | for (Int_t i=layMin; i<=layMax; i++) sum+=fITSClusters[i]; | |
319 | return sum; | |
320 | ||
321 | } | |
1f9831ab | 322 | |
323 | //______________________________________________________________________ | |
324 | void AliMultiplicity::SetTrackletData(Int_t id, const Float_t* tlet, UInt_t bits) | |
325 | { | |
326 | // fill tracklet data | |
327 | if (id>=fNtracks) {AliError(Form("Number of declared tracklets %d < %d",fNtracks,id)); return;} | |
328 | fTh[id] = tlet[0]; | |
329 | fPhi[id] = tlet[1]; | |
330 | fDeltPhi[id] = tlet[2]; | |
331 | fDeltTh[id] = tlet[3]; | |
332 | fLabels[id] = Int_t(tlet[4]); | |
333 | fLabelsL2[id] = Int_t(tlet[5]); | |
334 | if (bits&BIT(0)) fUsedClusT[0].SetBitNumber(id); | |
335 | if (bits&BIT(1)) fUsedClusT[1].SetBitNumber(id); | |
336 | // | |
337 | } | |
338 | ||
339 | //______________________________________________________________________ | |
340 | void AliMultiplicity::SetSingleClusterData(Int_t id, const Float_t* scl, UInt_t bits) | |
341 | { | |
342 | // fill single cluster data | |
343 | if (id>=fNsingle) {AliError(Form("Number of declared singles %d < %d",fNsingle,id)); return;} | |
344 | fThsingle[id] = scl[0]; | |
345 | fPhisingle[id] = scl[1]; | |
d7c5c1e4 | 346 | fLabelssingle[id] = scl[2]; |
1f9831ab | 347 | if (bits&BIT(0)) fUsedClusS[0].SetBitNumber(id); |
348 | if (bits&BIT(1)) fUsedClusS[1].SetBitNumber(id); | |
349 | // | |
350 | } | |
351 | ||
352 | //______________________________________________________________________ | |
353 | void AliMultiplicity::CompactBits() | |
354 | { | |
355 | // sqeeze bit contrainers to minimum | |
356 | fFastOrFiredChips.Compact(); | |
357 | fClusterFiredChips.Compact(); | |
358 | fUsedClusT[0].Compact(); | |
359 | fUsedClusT[1].Compact(); | |
360 | fUsedClusS[0].Compact(); | |
361 | fUsedClusS[1].Compact(); | |
362 | } | |
363 | ||
364 | //______________________________________________________________________ | |
365 | void AliMultiplicity::Print(Option_t *opt) const | |
366 | { | |
367 | ||
368 | printf("N.tracklets: %4d N.singles: %4d\n",fNtracks,fNsingle); | |
369 | TString opts = opt; opts.ToLower(); | |
370 | if (opts.Contains("t")) { | |
371 | for (int i=0;i<fNtracks;i++) | |
372 | printf("T#%3d| Th:%+6.3f Phi:%+6.3f DTh:%+6.3f DPhi:%+6.3f L1:%4d L2:%4d U0:%d U1:%d\n", | |
373 | i,fTh[i],fPhi[i],fDeltTh[i],fDeltPhi[i],fLabels[i],fLabelsL2[i], | |
374 | FreeClustersTracklet(i,0),FreeClustersTracklet(i,1)); | |
375 | } | |
376 | if (opts.Contains("s")) { | |
377 | for (int i=0;i<fNsingle;i++) | |
d7c5c1e4 | 378 | printf("S#%3d| Th:%+6.3f Phi:%+6.3f L:%4d U0:%d U1:%d\n", |
379 | i,fThsingle[i],fPhisingle[i],fLabelssingle[i], | |
1f9831ab | 380 | FreeClustersTracklet(i,0),FreeClustersTracklet(i,1)); |
381 | } | |
382 | // | |
383 | } |