]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/ESD/AliESDTOFcluster.cxx
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / STEER / ESD / AliESDTOFcluster.cxx
CommitLineData
115179c6 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/* $Id: $ */
17
18//_________________________________________________________________________//
19//_________________________________________________________________________//
20
21#include "AliESDTOFcluster.h"
22
23ClassImp(AliESDTOFcluster)
24
25AliESDTOFcluster::AliESDTOFcluster() :
26 AliVTOFcluster(),
27 fNTOFhits(1),
28 fClusterIndex(new TArrayI(1)),
29 fTOFchannel(new TArrayI(1)),
30 fTime(new TArrayF(1)),
31 fTimeRaw(new TArrayF(1)),
32 fTOT(new TArrayF(1)),
33 fTOFlabel(new TArrayI(3)),
34 fDeltaBC(new TArrayI(1)),
35 fL0L1Latency(new TArrayI(1)),
36 fStatus(0),
37 fZ(0),
38 fPhi(0),
39 fR(0),
40 fNmatchableTracks(0),
41 fTrackIndex(new TArrayI(1)),
42 fDx(new TArrayF(1)),
43 fDy(new TArrayF(1)),
44 fDz(new TArrayF(1)),
45 fTrackLength(new TArrayF(1)),
46 fIntegratedTimes(new TArrayD(9))
47{
48 //
49 // default ctor
50 //
51}
52
53AliESDTOFcluster::AliESDTOFcluster(Int_t clusterIndex,Int_t tofChannel,Float_t tofTime,Float_t timeRaw,Float_t tofTot,Int_t label[3],Int_t deltaBC,Int_t l0l1Latency,
54 Bool_t status,Float_t zClu,Float_t phiClu,Float_t rClu,
55 Int_t trackIndex,Float_t dX,Float_t dY,Float_t dZ,Float_t length,Double_t expTimes[9]) :
56 AliVTOFcluster(),
57 fNTOFhits(1),
58 fClusterIndex(new TArrayI(1)),
59 fTOFchannel(new TArrayI(1)),
60 fTime(new TArrayF(1)),
61 fTimeRaw(new TArrayF(1)),
62 fTOT(new TArrayF(1)),
63 fTOFlabel(new TArrayI(3)),
64 fDeltaBC(new TArrayI(1)),
65 fL0L1Latency(new TArrayI(1)),
66 fStatus(status),
67 fZ(zClu),
68 fPhi(phiClu),
69 fR(rClu),
70 fNmatchableTracks(1),
71 fTrackIndex(new TArrayI(1)),
72 fDx(new TArrayF(1)),
73 fDy(new TArrayF(1)),
74 fDz(new TArrayF(1)),
75 fTrackLength(new TArrayF(1)),
76 fIntegratedTimes(new TArrayD(9))
77{
78 //
79 // Constructor of AliESDTOFcluster object
80 //
81 fClusterIndex->AddAt(clusterIndex,0);
82 fTOFchannel->AddAt(tofChannel,0);
83 fTime->AddAt(tofTime,0);
84 fTimeRaw->AddAt(timeRaw,0);
85 fTOT->AddAt(tofTot,0);
86 fTOFlabel->AddAt(label[0],0);
87 fTOFlabel->AddAt(label[1],1);
88 fTOFlabel->AddAt(label[2],2);
89 fDeltaBC->AddAt(deltaBC,0);
90 fL0L1Latency->AddAt(l0l1Latency,0);
91 fTrackIndex->AddAt(trackIndex,0);
92 fDx->AddAt(dX,0);
93 fDy->AddAt(dY,0);
94 fDz->AddAt(dZ,0);
95 fTrackLength->AddAt(length,0);
96 for (Int_t ii=0; ii<9; ii++) fIntegratedTimes->AddAt(expTimes[ii],ii);
97
98}
99
100AliESDTOFcluster::AliESDTOFcluster(Int_t clusterIndex,Int_t tofChannel,Float_t tofTime,Float_t timeRaw,Float_t tofTot,Int_t label[3],Int_t deltaBC,Int_t l0l1Latency,
101 Bool_t status,Float_t zClu,Float_t phiClu,Float_t rClu) :
102 AliVTOFcluster(),
103 fNTOFhits(1),
104 fClusterIndex(new TArrayI(1)),
105 fTOFchannel(new TArrayI(1)),
106 fTime(new TArrayF(1)),
107 fTimeRaw(new TArrayF(1)),
108 fTOT(new TArrayF(1)),
109 fTOFlabel(new TArrayI(3)),
110 fDeltaBC(new TArrayI(1)),
111 fL0L1Latency(new TArrayI(1)),
112 fStatus(status),
113 fZ(zClu),
114 fPhi(phiClu),
115 fR(rClu),
116 fNmatchableTracks(0),
117 fTrackIndex(new TArrayI(1)),
118 fDx(new TArrayF(1)),
119 fDy(new TArrayF(1)),
120 fDz(new TArrayF(1)),
121 fTrackLength(new TArrayF(1)),
122 fIntegratedTimes(new TArrayD(9))
123{
124 //
125 // Constructor of AliESDTOFcluster object
126 //
127 fClusterIndex->AddAt(clusterIndex,0);
128 fTOFchannel->AddAt(tofChannel,0);
129 fTime->AddAt(tofTime,0);
130 fTimeRaw->AddAt(timeRaw,0);
131 fTOT->AddAt(tofTot,0);
132 fTOFlabel->AddAt(label[0],0);
133 fTOFlabel->AddAt(label[1],1);
134 fTOFlabel->AddAt(label[2],2);
135 fDeltaBC->AddAt(deltaBC,0);
136 fL0L1Latency->AddAt(l0l1Latency,0);
137}
138
139AliESDTOFcluster::AliESDTOFcluster(const AliESDTOFcluster & source) :
140 AliVTOFcluster(source),
141 fNTOFhits(source.fNTOFhits),
142 fClusterIndex(new TArrayI(source.fNTOFhits)),
143 fTOFchannel(new TArrayI(source.fNTOFhits)),
144 fTime(new TArrayF(source.fNTOFhits)),
145 fTimeRaw(new TArrayF(source.fNTOFhits)),
146 fTOT(new TArrayF(source.fNTOFhits)),
147 fTOFlabel(new TArrayI(3*source.fNTOFhits)),
148 fDeltaBC(new TArrayI(source.fNTOFhits)),
149 fL0L1Latency(new TArrayI(source.fNTOFhits)),
150 fStatus(source.fStatus),
151 fZ(source.fZ),
152 fPhi(source.fPhi),
153 fR(source.fR),
154 fNmatchableTracks(source.fNmatchableTracks),
155 fTrackIndex(NULL),
156 fDx(NULL),
157 fDy(NULL),
158 fDz(NULL),
159 fTrackLength(NULL),
160 fIntegratedTimes(NULL)
161{
162 //
163 // copy ctor for AliESDTOFcluster object
164 //
165
166 printf("Copy constructor (matchable tracks = %i)\n",fNmatchableTracks);
167
168 for(Int_t i=0;i < source.fNTOFhits;i++){
169 fClusterIndex->AddAt((*source.fClusterIndex)[i],i);
170 fTOFchannel->AddAt((*source.fTOFchannel)[i],i);
171 fTime->AddAt((*source.fTime)[i],i);
172 fTimeRaw->AddAt((*source.fTimeRaw)[i],i);
173 fTOT->AddAt((*source.fTOT)[i],i);
174 fTOFlabel->AddAt((*source.fTOFlabel)[0+3*i],0+3*i);
175 fTOFlabel->AddAt((*source.fTOFlabel)[1+3*i],1+3*i);
176 fTOFlabel->AddAt((*source.fTOFlabel)[2+3*i],2+3*i);
177 fDeltaBC->AddAt((*source.fDeltaBC)[i],i);
178 fL0L1Latency->AddAt((*source.fL0L1Latency)[i],i);
179 }
180
181 if (fNmatchableTracks>0) {
182 fTrackIndex = new TArrayI(fNmatchableTracks);
183 fDx = new TArrayF(fNmatchableTracks);
184 fDy = new TArrayF(fNmatchableTracks);
185 fDz = new TArrayF(fNmatchableTracks);
186 fTrackLength = new TArrayF(fNmatchableTracks);
187 fIntegratedTimes = new TArrayD(fNmatchableTracks*9);
188 for(Int_t i=0;i<fNmatchableTracks;i++) {
189 (*fTrackIndex)[i]=source.fTrackIndex->At(i);
190 (*fDx)[i]=source.fDx->At(i);
191 (*fDy)[i]=source.fDy->At(i);
192 (*fDz)[i]=source.fDz->At(i);
193 (*fTrackLength)[i]=source.fTrackLength->At(i);
194 for(Int_t j=0;j<9;j++)
195 (*fIntegratedTimes)[i*9+j]=source.fIntegratedTimes->At(i*9+j);
196 }
197 }
198 else{
199 fTrackIndex = new TArrayI(1);
200 fDx = new TArrayF(1);
201 fDy = new TArrayF(1);
202 fDz = new TArrayF(1);
203 fTrackLength = new TArrayF(1);
204 fIntegratedTimes = new TArrayD(9);
205 }
206
207 printf("END -> Copy constructor\n");
208
209}
210
211AliESDTOFcluster & AliESDTOFcluster::operator=(const AliESDTOFcluster & source)
212{
213 //
214 // copy ctor for AliESDTOFcluster object
215 //
216 if (this == &source) return *this;
217 AliVTOFcluster::operator=(source);
218
219 fNTOFhits = source.fNTOFhits;
220
221 if(fClusterIndex) delete fClusterIndex;
222 if(fTOFchannel->GetArray()) delete fTOFchannel;
223 if(fTime) delete fTime;
224 if(fTimeRaw) delete fTimeRaw;
225 if(fTOT) delete fTOT;
226 if(fTOFlabel) delete fTOFlabel;
227 if(fDeltaBC) delete fDeltaBC;
228 if(fL0L1Latency) delete fL0L1Latency;
229
230 if(fNTOFhits){
231 fClusterIndex = new TArrayI(source.fNTOFhits);
232 fTOFchannel = new TArrayI(source.fNTOFhits);
233 fTime = new TArrayF(source.fNTOFhits);
234 fTimeRaw = new TArrayF(source.fNTOFhits);
235 fTOT = new TArrayF(source.fNTOFhits);
236 fTOFlabel = new TArrayI(3*source.fNTOFhits);
237 fDeltaBC = new TArrayI(source.fNTOFhits);
238 fL0L1Latency = new TArrayI(source.fNTOFhits);
239
240
241 for(Int_t i=0;i < source.fNTOFhits;i++){
242 fClusterIndex->AddAt(source.fClusterIndex->At(i),i);
243 fTOFchannel->AddAt(source.fTOFchannel->At(i),i);
244 fTime->AddAt(source.fTime->At(i),i);
245 fTimeRaw->AddAt(source.fTimeRaw->At(i),i);
246 fTOT->AddAt(source.fTOT->At(i),i);
247 fTOFlabel->AddAt(source.fTOFlabel->At(0+3*i),0+3*i);
248 fTOFlabel->AddAt(source.fTOFlabel->At(1+3*i),1+3*i);
249 fTOFlabel->AddAt(source.fTOFlabel->At(2+3*i),2+3*i);
250 fDeltaBC->AddAt(source.fDeltaBC->At(i),i);
251 fL0L1Latency->AddAt(source.fL0L1Latency->At(i),i);
252 }
253 }
254 else{
255 fClusterIndex = new TArrayI(1);
256 fTOFchannel = new TArrayI(1);
257 fTime = new TArrayF(1);
258 fTimeRaw = new TArrayF(1);
259 fTOT = new TArrayF(1);
260 fTOFlabel = new TArrayI(3);
261 fDeltaBC = new TArrayI(1);
262 fL0L1Latency = new TArrayI(1);
263 }
264
265 fStatus=source.fStatus;
266 fZ=source.fZ;
267 fPhi=source.fPhi;
268 fR=source.fR;
269
270 if(fTrackIndex) delete fTrackIndex;
271 if(fDx) delete fDx;
272 if(fDy) delete fDy;
273 if(fDz) delete fDz;
274 if(fTrackLength) delete fTrackLength;
275 if(fIntegratedTimes) delete fIntegratedTimes;
276
277 fNmatchableTracks=source.fNmatchableTracks;
278
279 if (fNmatchableTracks>0) {
280 fTrackIndex = new TArrayI(fNmatchableTracks);
281 fDx = new TArrayF(fNmatchableTracks);
282 fDy = new TArrayF(fNmatchableTracks);
283 fDz = new TArrayF(fNmatchableTracks);
284 fTrackLength = new TArrayF(fNmatchableTracks);
285 fIntegratedTimes = new TArrayD(fNmatchableTracks*9);
286 for(Int_t i=0;i<fNmatchableTracks;i++) {
287 (*fTrackIndex)[i]=source.fTrackIndex->At(i);
288 (*fDx)[i]=source.fDx->At(i);
289 (*fDy)[i]=source.fDy->At(i);
290 (*fDz)[i]=source.fDz->At(i);
291 (*fTrackLength)[i]=source.fTrackLength->At(i);
292 for(Int_t j=0;j<9;j++)
293 (*fIntegratedTimes)[i*9+j]=source.fIntegratedTimes->At(i*9+j);
294 }
295 } else {
296 fTrackIndex= new TArrayI(1);
297 fDx = new TArrayF(1);
298 fDy = new TArrayF(1);
299 fDz = new TArrayF(1);
300 fTrackLength = new TArrayF(1);
301 fIntegratedTimes = new TArrayD(9);
302 }
303
304 return *this;
305}
306
307Int_t AliESDTOFcluster::Update(Int_t trackIndex,Float_t dX,Float_t dY,Float_t dZ,Float_t length,Double_t expTimes[9])
308{
309
310 if (fNmatchableTracks==0) {
311 fNmatchableTracks++;
312 fTrackIndex = new TArrayI(fNmatchableTracks);
313 fDx = new TArrayF(fNmatchableTracks);
314 fDy = new TArrayF(fNmatchableTracks);
315 fDz = new TArrayF(fNmatchableTracks);
316 fTrackLength = new TArrayF(fNmatchableTracks);
317 fIntegratedTimes = new TArrayD(fNmatchableTracks*9);
318 fTrackIndex->AddAt(trackIndex,fNmatchableTracks-1);
319 fDx->AddAt(dX,fNmatchableTracks-1);
320 fDy->AddAt(dY,fNmatchableTracks-1);
321 fDz->AddAt(dZ,fNmatchableTracks-1);
322 fTrackLength->AddAt(length,fNmatchableTracks-1);
323 for (Int_t ii=0; ii<9; ii++) fIntegratedTimes->AddAt(expTimes[ii],(fNmatchableTracks-1)*9+ii);
324
325 } else {
326 Bool_t updatedOneAlreadyStored = kFALSE;
327 for (Int_t ii=0; ii<fNmatchableTracks; ii++) {
328 if (trackIndex==fTrackIndex->At(ii)) {
329 // evitare di mettere piu' trackPoints della stessa traccia,
330 // scegliere solo quello piu' vicino al piano centrale del pad
331 updatedOneAlreadyStored=kTRUE;
332// if (TMath::Abs(dX)<TMath::Abs(fDx->At(ii))) {
333// fDx->AddAt(dX,ii);
334// fDy->AddAt(dY,ii);
335// fDz->AddAt(dZ,ii);
336// fTrackLength->AddAt(length,ii);
337// for (Int_t jj=0; jj<9; jj++) fIntegratedTimes->AddAt(expTimes[jj],ii*9+jj);
338// }
339 return 1;
340 }
341 }
342 if (!updatedOneAlreadyStored) {
343 fNmatchableTracks++;
344 fTrackIndex->Set(fNmatchableTracks);
345 fDx->Set(fNmatchableTracks);
346 fDy->Set(fNmatchableTracks);
347 fDz->Set(fNmatchableTracks);
348 fTrackLength->Set(fNmatchableTracks);
349 fIntegratedTimes->Set(fNmatchableTracks*9);
350 fTrackIndex->AddAt(trackIndex,fNmatchableTracks-1);
351 fDx->AddAt(dX,fNmatchableTracks-1);
352 fDy->AddAt(dY,fNmatchableTracks-1);
353 fDz->AddAt(dZ,fNmatchableTracks-1);
354 fTrackLength->AddAt(length,fNmatchableTracks-1);
355 for (Int_t jj=0; jj<9; jj++) fIntegratedTimes->AddAt(expTimes[jj],(fNmatchableTracks-1)*9+jj);
356 }
357 }
358 return 0;
359}
360
361AliESDTOFcluster::~AliESDTOFcluster()
362{
363 //
364 // dtr
365 //
366 if(fClusterIndex) delete fClusterIndex;
367 if(fTOFchannel) delete fTOFchannel;
368 if(fTime) delete fTime;
369 if(fTimeRaw) delete fTimeRaw;
370 if(fTOT) delete fTOT;
371 if(fTOFlabel) delete fTOFlabel;
372 if(fDeltaBC) delete fDeltaBC;
373 if(fL0L1Latency) delete fL0L1Latency;
374
375 if (fTrackIndex) delete fTrackIndex;
376 if (fDx) delete fDx;
377 if (fDy) delete fDy;
378 if (fDz) delete fDz;
379 if (fTrackLength) delete fTrackLength;
380 if (fIntegratedTimes) delete fIntegratedTimes;
381
382}
383
384void AliESDTOFcluster::AddTOFhit(Int_t clusterIndex,Int_t tofChannel,Float_t tofTime,Float_t timeRaw,Float_t tofTot,Int_t label[3],Int_t deltaBC,Int_t l0l1Latency, Bool_t status,Float_t zClu,Float_t phiClu,Float_t rClu){
385
386 TArrayI *ClusterIndexOld = fClusterIndex;
387 TArrayI *TOFchannelOld = fTOFchannel;
388 TArrayF *TimeOld = fTime;
389 TArrayF *TimeRawOld = fTimeRaw;
390 TArrayF *TOTOld = fTOT;
391 TArrayI *TOFlabelOld = fTOFlabel;
392 TArrayI *DeltaBCOld = fDeltaBC;
393 TArrayI *L0L1LatencyOld = fL0L1Latency;
394
395 fClusterIndex = new TArrayI(fNTOFhits+1);
396 fTOFchannel = new TArrayI(fNTOFhits+1);
397 fTime = new TArrayF(fNTOFhits+1);
398 fTimeRaw = new TArrayF(fNTOFhits+1);
399 fTOT = new TArrayF(fNTOFhits+1);
400 fTOFlabel = new TArrayI(3*fNTOFhits+3);
401 fDeltaBC = new TArrayI(fNTOFhits+1);
402 fL0L1Latency = new TArrayI(fNTOFhits+1);
403
404 for(Int_t i=0;i < fNTOFhits;i++){
405 fClusterIndex->AddAt(ClusterIndexOld->At(i),i);
406 fTOFchannel->AddAt(TOFchannelOld->At(i),i);
407 fTime->AddAt(TimeOld->At(i),i);
408 fTimeRaw->AddAt(TimeRawOld->At(i),i);
409 fTOT->AddAt(TOTOld->At(i),i);
410 fTOFlabel->AddAt(TOFlabelOld->At(0+3*i),0+3*i);
411 fTOFlabel->AddAt(TOFlabelOld->At(1+3*i),1+3*i);
412 fTOFlabel->AddAt(TOFlabelOld->At(2+3*i),2+3*i);
413 fDeltaBC->AddAt(DeltaBCOld->At(i),i);
414 fL0L1Latency->AddAt(L0L1LatencyOld->At(i),i);
415 }
416
417 if(ClusterIndexOld) delete ClusterIndexOld;
418 if(TOFchannelOld) delete TOFchannelOld;
419 if(TimeOld) delete TimeOld;
420 if(TimeRawOld) delete TimeRawOld;
421 if(TOTOld) delete TOTOld;
422 if(TOFlabelOld) delete TOFlabelOld;
423 if(DeltaBCOld) delete DeltaBCOld;
424 if(L0L1LatencyOld) delete L0L1LatencyOld;
425
426 fClusterIndex->AddAt(clusterIndex,fNTOFhits);
427 fTOFchannel->AddAt(tofChannel,fNTOFhits);
428 fTime->AddAt(tofTime,fNTOFhits);
429 fTimeRaw->AddAt(timeRaw,0);
430 fTOT->AddAt(tofTot,fNTOFhits);
431 fTOFlabel->AddAt(label[0],3*fNTOFhits+0);
432 fTOFlabel->AddAt(label[1],3*fNTOFhits+1);
433 fTOFlabel->AddAt(label[2],3*fNTOFhits+2);
434 fDeltaBC->AddAt(deltaBC,fNTOFhits);
435 fL0L1Latency->AddAt(l0l1Latency,fNTOFhits);
436
437 if(status){
438 fZ = (fZ*fNTOFhits + zClu)/(fNTOFhits+1);
439 fPhi = (fPhi*fNTOFhits + phiClu)/(fNTOFhits+1);
440 fR = (fR*fNTOFhits + rClu)/(fNTOFhits+1);
441 }
442
443 fNTOFhits++;
444}