Line data Source code
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 : $Log: AliTOFClusterFinderV1.cxx,v $
18 : Revision 2009/04/20 A. De Caro
19 : - added two new global variables, called fTOFGeometry and fTOFdigits;
20 : - added a new method, called FindClustersWithoutTOT,
21 : to transform TOF digits with fTOT=0 in one pad clusters;
22 : - update of the covariance matrix elements for the TOF clusters
23 :
24 : Revision 0.01 2008/05/10 A. De Caro
25 : */
26 :
27 : /////////////////////////////////////////
28 : // //
29 : // Class for TOF cluster finder (V1) //
30 : // //
31 : // Input data: Raw Data or Digits; //
32 : // Output data: Digits or Rec Points //
33 : // //
34 : /////////////////////////////////////////
35 :
36 : #include "Riostream.h"
37 :
38 : #include "TClonesArray.h"
39 : #include "TStopwatch.h"
40 : #include "TTree.h"
41 : #include "TGeoMatrix.h"
42 : #include "TString.h"
43 :
44 : #include "AliDAQ.h"
45 : #include "AliLog.h"
46 : #include "AliRawReader.h"
47 : #include "AliLoader.h"
48 : #include "AliRunLoader.h"
49 : #include "AliGeomManager.h"
50 :
51 : #include "AliTOFcalib.h"
52 : #include "AliTOFChannelOnlineArray.h"
53 : #include "AliTOFChannelOnlineStatusArray.h"
54 : #include "AliTOFChannelOffline.h"
55 : #include "AliTOFClusterFinderV1.h"
56 : #include "AliTOFcluster.h"
57 : #include "AliTOFdigit.h"
58 : #include "AliTOFDigitMap.h"
59 : #include "AliTOFrawData.h"
60 : #include "AliTOFReconstructor.h"
61 : #include "AliTOFRecoParam.h"
62 :
63 : using std::endl;
64 : using std::cout;
65 : using std::ofstream;
66 : using std::ios;
67 26 : ClassImp(AliTOFClusterFinderV1)
68 :
69 : //_____________________________________________________________________________
70 : AliTOFClusterFinderV1::AliTOFClusterFinderV1(AliTOFcalib *calib):
71 2 : TTask("AliTOFClusterFinderV1",""),
72 2 : fRunLoader(0),
73 6 : fDigits(new TClonesArray("AliTOFdigit", 4000)),
74 6 : fRecPoints(new TClonesArray("AliTOFcluster", 4000)),
75 2 : fNumberOfTofClusters(0),
76 2 : fNumberOfTofDigits(0),
77 2 : fNumberOfTofTrgPads(0),
78 2 : fkRecoParam(0),//AliTOFReconstructor::GetRecoParam()),
79 2 : fMaxDeltaTime(0),//fkRecoParam->GetMaxDeltaTime()),
80 2 : fVerbose(0),
81 2 : fDecoderVersion(0),
82 2 : fTOFcalib(calib),
83 6 : fTOFdigitMap(new AliTOFDigitMap()),
84 6 : fTOFGeometry(new AliTOFGeometry()),
85 6 : fTOFdigits(new TTree()),
86 2 : fTOFRawStream(AliTOFRawStream()),
87 2 : fCalibrateTOFtimes(1)
88 10 : {
89 : //
90 : // Constructor
91 : //
92 :
93 311112 : for (Int_t ii=0; ii<kTofMaxCluster; ii++) fTofClusters[ii]=0x0;
94 :
95 4 : if (AliTOFReconstructor::GetRecoParam()) {
96 0 : fkRecoParam = AliTOFReconstructor::GetRecoParam();
97 0 : fMaxDeltaTime = fkRecoParam->GetMaxDeltaTime();
98 0 : }
99 : else
100 2 : fMaxDeltaTime = 2;
101 :
102 2 : TString validity = (TString)fTOFcalib->GetOfflineValidity();
103 4 : if (validity.CompareTo("valid")==0) {
104 0 : AliInfo(Form(" validity = %s - Using offline calibration parameters", validity.Data()));
105 : } else {
106 8 : AliInfo(Form(" validity = %s - Using online calibration parameters", validity.Data()));
107 : }
108 :
109 4 : }
110 :
111 : //_____________________________________________________________________________
112 : AliTOFClusterFinderV1::AliTOFClusterFinderV1(AliRunLoader* runLoader, AliTOFcalib *calib):
113 0 : TTask("AliTOFClusterFinderV1",""),
114 0 : fRunLoader(runLoader),
115 0 : fDigits(new TClonesArray("AliTOFdigit", 4000)),
116 0 : fRecPoints(new TClonesArray("AliTOFcluster", 4000)),
117 0 : fNumberOfTofClusters(0),
118 0 : fNumberOfTofDigits(0),
119 0 : fNumberOfTofTrgPads(0),
120 0 : fkRecoParam(0),//AliTOFReconstructor::GetRecoParam()),
121 0 : fMaxDeltaTime(0),//fkRecoParam->GetMaxDeltaTime()),
122 0 : fVerbose(0),
123 0 : fDecoderVersion(0),
124 0 : fTOFcalib(calib),
125 0 : fTOFdigitMap(new AliTOFDigitMap()),
126 0 : fTOFGeometry(new AliTOFGeometry()),
127 0 : fTOFdigits(new TTree()),
128 0 : fTOFRawStream(AliTOFRawStream()),
129 0 : fCalibrateTOFtimes(1)
130 0 : {
131 : //
132 : // Constructor
133 : //
134 :
135 0 : for (Int_t ii=0; ii<kTofMaxCluster; ii++) fTofClusters[ii]=0x0;
136 :
137 0 : if (AliTOFReconstructor::GetRecoParam()) {
138 0 : fkRecoParam = AliTOFReconstructor::GetRecoParam();
139 0 : fMaxDeltaTime = fkRecoParam->GetMaxDeltaTime();
140 0 : }
141 : else
142 0 : fMaxDeltaTime = 2;
143 :
144 0 : TString validity = (TString)fTOFcalib->GetOfflineValidity();
145 0 : if (validity.CompareTo("valid")==0) {
146 0 : AliInfo(Form(" validity = %s - Using offline calibration parameters", validity.Data()));
147 : } else {
148 0 : AliInfo(Form(" validity = %s - Using online calibration parameters", validity.Data()));
149 : }
150 :
151 0 : }
152 : //_____________________________________________________________________________
153 :
154 : AliTOFClusterFinderV1::AliTOFClusterFinderV1(const AliTOFClusterFinderV1 &source)
155 0 : :TTask(source),
156 0 : fRunLoader(0),
157 0 : fDigits(source.fDigits),
158 0 : fRecPoints(source.fRecPoints),
159 0 : fNumberOfTofClusters(0),
160 0 : fNumberOfTofDigits(0),
161 0 : fNumberOfTofTrgPads(0),
162 0 : fkRecoParam(0),//AliTOFReconstructor::GetRecoParam()),
163 0 : fMaxDeltaTime(0),//fkRecoParam->GetMaxDeltaTime()),
164 0 : fVerbose(0),
165 0 : fDecoderVersion(source.fDecoderVersion),
166 0 : fTOFcalib(source.fTOFcalib),
167 0 : fTOFdigitMap(new AliTOFDigitMap()),
168 0 : fTOFGeometry(new AliTOFGeometry()),
169 0 : fTOFdigits(source.fTOFdigits),
170 0 : fTOFRawStream(source.fTOFRawStream),
171 0 : fCalibrateTOFtimes(1)
172 0 : {
173 : // copy constructor
174 :
175 0 : for (Int_t ii=0; ii<kTofMaxCluster; ii++) fTofClusters[ii]=source.fTofClusters[ii];
176 :
177 0 : if (AliTOFReconstructor::GetRecoParam()) {
178 0 : fkRecoParam = AliTOFReconstructor::GetRecoParam();
179 0 : fMaxDeltaTime = fkRecoParam->GetMaxDeltaTime();
180 0 : }
181 : else
182 0 : fMaxDeltaTime = 2;
183 :
184 0 : }
185 : //_____________________________________________________________________________
186 :
187 : AliTOFClusterFinderV1& AliTOFClusterFinderV1::operator=(const AliTOFClusterFinderV1 &source)
188 : {
189 : // ass. op.
190 :
191 0 : if (this == &source)
192 0 : return *this;
193 :
194 0 : TObject::operator=(source);
195 0 : for (Int_t ii=0; ii<kTofMaxCluster; ii++) fTofClusters[ii]=source.fTofClusters[ii];
196 0 : fDigits=source.fDigits;
197 0 : fRecPoints=source.fRecPoints;
198 0 : fNumberOfTofClusters=source.fNumberOfTofClusters;
199 0 : fNumberOfTofTrgPads=source.fNumberOfTofTrgPads;
200 0 : fNumberOfTofDigits=source.fNumberOfTofDigits;
201 0 : fVerbose=source.fVerbose;
202 0 : fDecoderVersion=source.fDecoderVersion;
203 0 : fTOFcalib=source.fTOFcalib;
204 0 : fTOFdigitMap=source.fTOFdigitMap;
205 0 : fTOFGeometry=source.fTOFGeometry;
206 0 : fTOFdigits=source.fTOFdigits;
207 0 : fTOFRawStream=source.fTOFRawStream;
208 0 : fCalibrateTOFtimes=source.fCalibrateTOFtimes;
209 0 : return *this;
210 :
211 0 : }
212 : //_____________________________________________________________________________
213 :
214 : AliTOFClusterFinderV1::~AliTOFClusterFinderV1()
215 12 : {
216 :
217 : //
218 : // Destructor
219 : //
220 :
221 2 : if (fDigits)
222 : {
223 2 : fDigits->Delete();
224 4 : delete fDigits;
225 2 : fDigits=0;
226 2 : }
227 2 : if (fRecPoints)
228 : {
229 2 : fRecPoints->Delete();
230 4 : delete fRecPoints;
231 2 : fRecPoints=0;
232 2 : }
233 :
234 4 : delete fTOFdigitMap;
235 :
236 4 : delete fTOFGeometry;
237 :
238 4 : delete fTOFdigits;
239 :
240 : //if (fTofClusters || fNumberOfTofClusters) {
241 2 : if (fNumberOfTofClusters) {
242 0 : for (Int_t ii=0; ii<fNumberOfTofClusters; ii++)
243 0 : if (fTofClusters[ii]) fTofClusters[ii]->Delete();
244 0 : fNumberOfTofClusters = 0;
245 0 : }
246 :
247 6 : }
248 : //_____________________________________________________________________________
249 :
250 : void AliTOFClusterFinderV1::Digits2RecPoints(TTree* digitsTree, TTree* clusterTree)
251 : {
252 : //
253 : // Converts digits to recPoints for TOF
254 : //
255 :
256 0 : TStopwatch stopwatch;
257 0 : stopwatch.Start();
258 :
259 : Int_t inholes = 0;
260 :
261 0 : ResetRecpoint();
262 :
263 0 : fDigits->Clear();
264 0 : TClonesArray &aDigits = *fDigits;
265 :
266 0 : if (digitsTree == 0x0) {
267 0 : AliFatal("Can not get TreeD for TOF");
268 0 : return;
269 : }
270 :
271 0 : TBranch *branch = digitsTree->GetBranch("TOF");
272 0 : if (!branch) {
273 0 : AliError("Can not get branch with the TOF digits !");
274 0 : return;
275 : }
276 :
277 0 : TClonesArray staticDigits("AliTOFdigit",10000);
278 0 : staticDigits.Clear();
279 0 : TClonesArray *digits = &staticDigits;
280 0 : branch->SetAddress(&digits);
281 0 : digitsTree->GetEvent(0);
282 0 : AliDebug(1,Form("Number of TOF digits: %d", digits->GetEntriesFast()));
283 :
284 : AliTOFdigit *tofDigit;
285 :
286 : Int_t jj = 0;
287 0 : Int_t detectorIndex[5];
288 0 : for (jj=0; jj<5; jj++) detectorIndex[jj] = -1;
289 0 : Int_t info[4];
290 0 : for (jj=0; jj<4; jj++) info[jj] = -1;
291 : Int_t *tracks;
292 0 : Int_t tdcCorr;
293 : Int_t dummy = -1;
294 : Int_t last = -1;
295 :
296 : Bool_t status = kTRUE;
297 :
298 0 : AliDebug(1," Calibrating TOF Digits");
299 : /*
300 : TString validity = (TString)fTOFcalib->GetOfflineValidity();
301 : if (validity.CompareTo("valid")==0) {
302 : AliInfo(Form(" validity = %s - Using offline calibration parameters", validity.Data()));
303 : } else
304 : AliInfo(Form(" validity = %s - Using online calibration parameters", validity.Data()));
305 : */
306 :
307 : Int_t ii = 0;
308 0 : for (ii=0; ii<digits->GetEntriesFast(); ii++) {
309 0 : tofDigit = (AliTOFdigit*)digits->UncheckedAt(ii);
310 0 : detectorIndex[0] = tofDigit->GetSector();
311 0 : detectorIndex[1] = tofDigit->GetPlate();
312 0 : detectorIndex[2] = tofDigit->GetStrip();
313 0 : detectorIndex[3] = tofDigit->GetPadz();
314 0 : detectorIndex[4] = tofDigit->GetPadx();
315 :
316 0 : if (detectorIndex[0]==13 || detectorIndex[0]==14 || detectorIndex[0]==15 ) { // sectors with holes
317 0 : if (detectorIndex[1]==2) { // plate with holes
318 0 : inholes++;
319 0 : continue;
320 : }
321 : }
322 :
323 0 : tdcCorr = tofDigit->GetTdc();
324 0 : status = MakeSlewingCorrection(detectorIndex, tofDigit->GetToT(), tofDigit->GetTdc(), tdcCorr);
325 :
326 0 : for (jj=0; jj<4; jj++) info[jj] = -1;
327 0 : info[0] = tdcCorr;//tofDigit->GetTdc();
328 0 : info[1] = tofDigit->GetAdc();
329 0 : info[2] = tofDigit->GetToT();
330 0 : info[3] = tofDigit->GetTdcND();//tofDigit->GetTdc();//
331 0 : tracks = tofDigit->GetTracks();
332 :
333 0 : dummy = detectorIndex[3];
334 0 : detectorIndex[3] = detectorIndex[4];//padx
335 0 : detectorIndex[4] = dummy;//padz
336 0 : last = fDigits->GetEntriesFast();
337 0 : new (aDigits[last]) AliTOFdigit(tracks, detectorIndex, info);
338 0 : if (status) fTOFdigitMap->AddDigit(detectorIndex, last);
339 :
340 0 : AliDebug(2, Form(" Digits reading %2d -> %2d %1d %2d %1d %2d (%d, %d, %d)",
341 : last,
342 : detectorIndex[0], detectorIndex[1], detectorIndex[2], detectorIndex[3], detectorIndex[4],
343 : info[0], info[1], info[3]));
344 :
345 : }
346 :
347 0 : fNumberOfTofDigits = fDigits->GetEntriesFast();
348 :
349 0 : ResetRecpoint();
350 :
351 : Int_t bufsize = 32000;
352 0 : clusterTree->Branch("TOF", &fRecPoints, bufsize);
353 :
354 0 : FillRecPoint();
355 0 : clusterTree->Fill();
356 :
357 0 : AliDebug(1,Form("Number of found clusters: %d", fNumberOfTofClusters));
358 :
359 : // ResetRecpoint();
360 :
361 0 : fTOFdigitMap->Clear();
362 :
363 0 : ResetDigits();
364 :
365 0 : AliDebug(1,Form("Execution time to read TOF digits and to write TOF clusters : R:%.4fs C:%.4fs",
366 : stopwatch.RealTime(),stopwatch.CpuTime()));
367 :
368 0 : if (inholes) AliWarning(Form("Clusters in the TOF holes: %d",inholes));
369 :
370 0 : }
371 : //_____________________________________________________________________________
372 :
373 : void AliTOFClusterFinderV1::Digits2RecPoints(AliRawReader *rawReader, TTree *clustersTree)
374 : {
375 : //
376 : // Converts raw data to recPoints for TOF
377 : //
378 :
379 0 : TStopwatch stopwatch;
380 0 : stopwatch.Start();
381 :
382 0 : ResetRecpoint();
383 :
384 0 : AliDebug(2, "TreeD re-creation");
385 : //TTree *digitsTree = new TTree();
386 : //Raw2Digits(rawReader, digitsTree);
387 :
388 0 : Raw2Digits(rawReader, fTOFdigits);
389 :
390 0 : AliDebug(1,Form("Number of TOF digits: %d", fNumberOfTofDigits));
391 0 : ResetRecpoint();
392 :
393 : Int_t bufsize = 32000;
394 0 : clustersTree->Branch("TOF", &fRecPoints, bufsize);
395 0 : FillRecPoint();
396 :
397 0 : clustersTree->Fill();
398 :
399 0 : AliDebug(1,Form("Number of found clusters: %d", fNumberOfTofClusters));
400 :
401 : // ResetRecpoint();
402 :
403 0 : fTOFdigitMap->Clear();
404 :
405 0 : ResetDigits();
406 :
407 0 : AliDebug(1,Form("Execution time to read TOF raw data and to write TOF clusters : R:%.4fs C:%.4fs",
408 : stopwatch.RealTime(),stopwatch.CpuTime()));
409 :
410 0 : }
411 :
412 : //_____________________________________________________________________________
413 :
414 : void AliTOFClusterFinderV1::Raw2Digits(AliRawReader *rawReader, TTree* digitsTree)
415 : {
416 : //
417 : // Converts raw data to digits for TOF
418 : //
419 :
420 0 : TStopwatch stopwatch;
421 0 : stopwatch.Start();
422 :
423 : Int_t inholes = 0;
424 :
425 : const Int_t kMaxNumberOfTracksPerDigit = 3;
426 0 : const Int_t kDDL = AliDAQ::NumberOfDdls("TOF");
427 :
428 0 : digitsTree->Branch("TOF", &fDigits);
429 0 : TClonesArray &aDigits = *fDigits;
430 :
431 0 : fTOFRawStream.Clear();
432 0 : fTOFRawStream.SetRawReader(rawReader);
433 :
434 0 : ofstream ftxt;
435 0 : if (fVerbose==2) ftxt.open("TOFdigitsRead.txt",ios::app);
436 :
437 0 : TClonesArray staticRawData("AliTOFrawData",10000);
438 0 : staticRawData.Clear();
439 : TClonesArray * clonesRawData = &staticRawData;
440 :
441 : Int_t dummy = -1;
442 0 : Int_t detectorIndex[5] = {-1, -1, -1, -1, -1};
443 0 : Int_t digit[4];
444 0 : Int_t tracks[kMaxNumberOfTracksPerDigit];
445 0 : for (Int_t ii=0; ii<kMaxNumberOfTracksPerDigit; ii++)
446 0 : tracks[ii] = -1;
447 : Int_t last = -1;
448 0 : Int_t tdcCorr = 0;
449 :
450 : Bool_t status = kTRUE;
451 :
452 : /*
453 : TString validity = (TString)fTOFcalib->GetOfflineValidity();
454 : if (validity.CompareTo("valid")==0) {
455 : AliInfo(Form(" validity = %s - Using offline calibration parameters", validity.Data()));
456 : } else
457 : AliInfo(Form(" validity = %s - Using online calibration parameters", validity.Data()));
458 : */
459 :
460 0 : if (fDecoderVersion)
461 0 : AliInfo("Using New Decoder");
462 :
463 : Int_t indexDDL = 0;
464 : Int_t iRawData = 0;
465 0 : for (indexDDL=0; indexDDL<kDDL; indexDDL++) {
466 :
467 0 : rawReader->Reset();
468 0 : if (fDecoderVersion)
469 0 : fTOFRawStream.LoadRawDataBuffers(indexDDL,fVerbose);
470 0 : else fTOFRawStream.LoadRawData(indexDDL);
471 :
472 0 : clonesRawData = (TClonesArray*)fTOFRawStream.GetRawData();
473 0 : if (clonesRawData->GetEntriesFast()!=0) AliDebug(2,Form(" TOF raw data number = %3d", clonesRawData->GetEntriesFast()));
474 0 : for (iRawData = 0; iRawData<clonesRawData->GetEntriesFast(); iRawData++) {
475 :
476 0 : AliTOFrawData *tofRawDatum = (AliTOFrawData*)clonesRawData->UncheckedAt(iRawData);
477 :
478 : //if (tofRawDatum->GetTOT()==-1 || tofRawDatum->GetTOF()==-1) continue;
479 0 : if (tofRawDatum->GetTOF()==-1) continue;
480 :
481 0 : fTOFRawStream.EquipmentId2VolumeId(indexDDL, tofRawDatum->GetTRM(), tofRawDatum->GetTRMchain(),
482 0 : tofRawDatum->GetTDC(), tofRawDatum->GetTDCchannel(), detectorIndex);
483 :
484 0 : tdcCorr = 0;
485 0 : dummy = detectorIndex[3];
486 0 : detectorIndex[3] = detectorIndex[4];//padz
487 0 : detectorIndex[4] = dummy;//padx
488 :
489 0 : tdcCorr = tofRawDatum->GetTOF();
490 0 : status = MakeSlewingCorrection(detectorIndex, tofRawDatum->GetTOT(), tofRawDatum->GetTOF(), tdcCorr);
491 :
492 0 : digit[0] = tdcCorr;
493 0 : digit[1] = tofRawDatum->GetTOT();
494 0 : digit[2] = tofRawDatum->GetTOT();
495 0 : digit[3] = -1;//tofRawDatum->GetTOF(); //tofND
496 :
497 : // noferini
498 0 : Float_t pos[3];
499 0 : AliTOFGeometry::GetPosPar(detectorIndex, pos);
500 : Float_t length = 0.;
501 0 : for (Int_t ic = 0; ic < 3; ic++) length += pos[ic] * pos[ic];
502 0 : length = TMath::Sqrt(length);
503 0 : Float_t timealligned = tdcCorr*24.4 - length * 0.0333564095198152043; // subtract the minimal time in
504 :
505 0 : if(status && timealligned > -1000 && timealligned < 24000){
506 0 : fNumberOfTofTrgPads++;
507 0 : }
508 :
509 0 : dummy = detectorIndex[3];
510 0 : detectorIndex[3] = detectorIndex[4];//padx
511 0 : detectorIndex[4] = dummy;//padz
512 :
513 : /* check valid index */
514 0 : if (detectorIndex[0]==-1||detectorIndex[1]==-1||detectorIndex[2]==-1||detectorIndex[3]==-1||detectorIndex[4]==-1) continue;
515 :
516 : // Do not reconstruct anything in the holes
517 0 : if (detectorIndex[0]==13 || detectorIndex[0]==14 || detectorIndex[0]==15 ) { // sectors with holes
518 0 : if (detectorIndex[1]==2) { // plate with holes
519 0 : inholes++;
520 0 : continue;
521 : }
522 : }
523 :
524 0 : last = fDigits->GetEntriesFast();
525 0 : new (aDigits[last]) AliTOFdigit(tracks, detectorIndex, digit);
526 0 : if (status) fTOFdigitMap->AddDigit(detectorIndex, last);
527 :
528 :
529 0 : if (fVerbose==2) {
530 0 : if (indexDDL<10) ftxt << " " << indexDDL;
531 0 : else ftxt << " " << indexDDL;
532 0 : if (tofRawDatum->GetTRM()<10) ftxt << " " << tofRawDatum->GetTRM();
533 0 : else ftxt << " " << tofRawDatum->GetTRM();
534 0 : ftxt << " " << tofRawDatum->GetTRMchain();
535 0 : if (tofRawDatum->GetTDC()<10) ftxt << " " << tofRawDatum->GetTDC();
536 0 : else ftxt << " " << tofRawDatum->GetTDC();
537 0 : ftxt << " " << tofRawDatum->GetTDCchannel();
538 :
539 0 : if (detectorIndex[0]<10) ftxt << " -> " << detectorIndex[0];
540 0 : else ftxt << " -> " << detectorIndex[0];
541 0 : ftxt << " " << detectorIndex[1];
542 0 : if (detectorIndex[2]<10) ftxt << " " << detectorIndex[2];
543 0 : else ftxt << " " << detectorIndex[2];
544 0 : ftxt << " " << detectorIndex[4];
545 0 : if (detectorIndex[4]<10) ftxt << " " << detectorIndex[3];
546 0 : else ftxt << " " << detectorIndex[3];
547 :
548 0 : if (digit[1]<10)ftxt << " " << digit[1];
549 0 : else if (digit[1]>=10 && digit[1]<100) ftxt << " " << digit[1];
550 0 : else ftxt << " " << digit[1];
551 0 : if (digit[0]<10) ftxt << " " << digit[0] << endl;
552 0 : else if (digit[0]>=10 && digit[0]<100) ftxt << " " << digit[0] << endl;
553 0 : else if (digit[0]>=100 && digit[0]<1000) ftxt << " " << digit[0] << endl;
554 0 : else ftxt << " " << digit[3] << endl;
555 : }
556 :
557 0 : AliDebug(2, Form(" Raw data reading %2d -> %2d %1d %2d %1d %2d (%d, %d, %d)",
558 : last,
559 : detectorIndex[0], detectorIndex[1], detectorIndex[2], detectorIndex[4], detectorIndex[3],
560 : digit[0], digit[1], digit[3]));
561 :
562 0 : } // while loop
563 :
564 0 : clonesRawData->Clear();
565 :
566 : } // DDL Loop
567 :
568 0 : if (fVerbose==2) ftxt.close();
569 :
570 0 : digitsTree->Fill();
571 :
572 0 : fNumberOfTofDigits = fDigits->GetEntries();
573 :
574 0 : AliDebug(1, Form("Got %d TOF digits", fNumberOfTofDigits));
575 0 : AliDebug(1, Form("Execution time to read TOF raw data and fill TOF digit tree : R:%.2fs C:%.2fs",
576 : stopwatch.RealTime(),stopwatch.CpuTime()));
577 :
578 0 : if (inholes) AliWarning(Form("Clusters in the TOF holes: %d",inholes));
579 :
580 0 : }
581 : //_____________________________________________________________________________
582 :
583 : void AliTOFClusterFinderV1::FillRecPoint()
584 : {
585 : //
586 : // Fill the global TClonesArray of AliTOFcluster objects,
587 : // i.e. fRecPoints
588 : //
589 :
590 : Int_t dummy4 = -1;
591 : Int_t dummy3 = -1;
592 : Int_t dummy2 = -1;
593 : Int_t dummy = -1;
594 :
595 0 : for(Int_t iPlate=AliTOFGeometry::NPlates()-1; iPlate>=0; iPlate--) {
596 0 : for(Int_t iStrip=AliTOFGeometry::NStrip(iPlate)-1; iStrip>=0; iStrip--) {
597 : //for (Int_t iSector=AliTOFGeometry::NSectors()-1; iSector>=0; iSector--) {
598 0 : for (Int_t iSector=0; iSector<AliTOFGeometry::NSectors(); iSector++) {
599 :
600 :
601 0 : if (fTOFdigitMap->StripDigitCheck(iSector,iPlate,iStrip))
602 0 : AliDebug(1,Form(" Number of TOF digits in (%2d,%1d,%2d) -> %d",
603 : iSector,iPlate,iStrip,fTOFdigitMap->FilledCellsInStrip(iSector,iPlate,iStrip)));
604 :
605 0 : if (!(fTOFdigitMap->StripDigitCheck(iSector,iPlate,iStrip))) continue;
606 0 : FindClustersWithoutTOT(iSector, iPlate, iStrip); // clusters coming from digits without TOT measurement
607 :
608 0 : if (fMaxDeltaTime>0) {
609 :
610 0 : if (!(fTOFdigitMap->StripDigitCheck(iSector,iPlate,iStrip))) continue;
611 : //if (fTOFdigitMap->FilledCellsInStrip(iSector,iPlate,iStrip)>=4)
612 0 : FindClustersPerStrip(iSector, iPlate, iStrip, 4); // 4 pads clusters
613 0 : if (!(fTOFdigitMap->StripDigitCheck(iSector,iPlate,iStrip))) continue;
614 :
615 0 : dummy4 = fNumberOfTofClusters;
616 0 : FindClustersPerStrip(iSector, iPlate, iStrip, 4); // 4 pads clusters
617 0 : if (fNumberOfTofClusters!=dummy4)
618 0 : AliDebug(2, Form(" (4): n1= %5d, n2 = %5d", dummy4, fNumberOfTofClusters));
619 :
620 :
621 0 : if (!(fTOFdigitMap->StripDigitCheck(iSector,iPlate,iStrip))) continue;
622 0 : FindClustersPerStrip(iSector, iPlate, iStrip, 3); // 3 pads clusters
623 0 : if (!(fTOFdigitMap->StripDigitCheck(iSector,iPlate,iStrip))) continue;
624 :
625 0 : dummy3 = fNumberOfTofClusters;
626 0 : FindClustersPerStrip(iSector, iPlate, iStrip, 3); // 3 pads clusters
627 0 : if (fNumberOfTofClusters!=dummy3)
628 0 : AliDebug(2, Form(" (3): n1= %5d, n2 = %5d", dummy3, fNumberOfTofClusters));
629 :
630 :
631 0 : if (!(fTOFdigitMap->StripDigitCheck(iSector,iPlate,iStrip))) continue;
632 0 : FindClustersPerStrip(iSector, iPlate, iStrip, 2); // 2 pads clusters
633 0 : if (!(fTOFdigitMap->StripDigitCheck(iSector,iPlate,iStrip))) continue;
634 :
635 0 : dummy2 = fNumberOfTofClusters;
636 0 : FindClustersPerStrip(iSector, iPlate, iStrip, 2); // 2 pads clusters
637 0 : if (fNumberOfTofClusters!=dummy2)
638 0 : AliDebug(2, Form(" (2): n1= %5d, n2 =%5d", dummy2, fNumberOfTofClusters));
639 :
640 :
641 0 : if (!(fTOFdigitMap->StripDigitCheck(iSector,iPlate,iStrip))) continue;
642 0 : dummy = fNumberOfTofClusters;
643 0 : FindClusters34(iSector, iPlate, iStrip); // 3 pads clusters between 4 hit pads
644 0 : if (fNumberOfTofClusters!=dummy)
645 0 : AliDebug(2, Form(" (3 between 4): n1 = %5d, n2 = %5d", fNumberOfTofClusters, dummy));
646 :
647 :
648 0 : if (!(fTOFdigitMap->StripDigitCheck(iSector,iPlate,iStrip))) continue;
649 0 : dummy = fNumberOfTofClusters;
650 0 : FindClusters23(iSector, iPlate, iStrip); // 2 pads clusters between 3 hit pads
651 0 : if (fNumberOfTofClusters!=dummy)
652 0 : AliDebug(2, Form(" (2 between 3): n1 = %5d, n2 = %5d", fNumberOfTofClusters, dummy));
653 :
654 0 : if (!(fTOFdigitMap->StripDigitCheck(iSector,iPlate,iStrip))) continue;
655 0 : dummy = fNumberOfTofClusters;
656 0 : FindClusters24(iSector, iPlate, iStrip); // 2 pads clusters between 4 hit pads
657 0 : if (fNumberOfTofClusters!=dummy)
658 0 : AliDebug(2, Form(" (2 between 4): n1 = %5d, n2 = %5d", fNumberOfTofClusters, dummy));
659 :
660 :
661 0 : if (!(fTOFdigitMap->StripDigitCheck(iSector,iPlate,iStrip))) continue;
662 0 : dummy = fNumberOfTofClusters;
663 0 : FindOnePadClusterPerStrip(iSector, iPlate, iStrip); // 1 pad clusters
664 0 : if (fNumberOfTofClusters!=dummy)
665 0 : AliDebug(2,Form(" (1): n1 = %5d, n2 = %5d", fNumberOfTofClusters, dummy));
666 :
667 0 : if (fTOFdigitMap->DigitInStrip(iSector,iPlate,iStrip)>0)
668 0 : AliDebug(2, Form(" (1): number of clusters = %5d (remaining digit %2d), -%2d %1d %2d-",
669 : fNumberOfTofClusters, fTOFdigitMap->DigitInStrip(iSector,iPlate,iStrip),
670 : iSector, iPlate, iStrip));
671 :
672 : }
673 : else {
674 0 : if (!(fTOFdigitMap->StripDigitCheck(iSector,iPlate,iStrip))) continue;
675 0 : dummy = fNumberOfTofClusters;
676 0 : FindOnePadClusterPerStrip(iSector, iPlate, iStrip); // 1 pad clusters
677 0 : if (fNumberOfTofClusters!=dummy)
678 0 : AliDebug(2,Form(" (1): n1 = %5d, n2 = %5d", fNumberOfTofClusters, dummy));
679 :
680 0 : if (fTOFdigitMap->DigitInStrip(iSector,iPlate,iStrip)>0)
681 0 : AliDebug(2, Form(" (1): number of clusters = %5d (remaining digit %2d), -%2d %1d %2d-",
682 : fNumberOfTofClusters, fTOFdigitMap->DigitInStrip(iSector,iPlate,iStrip),
683 : iSector, iPlate, iStrip));
684 :
685 : }
686 :
687 :
688 : }
689 : }
690 : }
691 :
692 :
693 0 : TClonesArray &lRecPoints = *fRecPoints;
694 :
695 : Int_t ii, jj;
696 :
697 0 : Int_t detectorIndex[5];
698 0 : for (jj=0; jj<5; jj++) detectorIndex[jj] = -1;
699 0 : Int_t parTOF[7];
700 0 : for (jj=0; jj<7; jj++) parTOF[jj] = -1;
701 0 : Int_t trackLabels[3];
702 0 : for (jj=0; jj<3; jj++) trackLabels[jj] = -1;
703 : Int_t digitIndex = -1;
704 : Bool_t status = kTRUE;
705 0 : Float_t posClus[3];
706 0 : for (ii=0; ii<3; ii++) posClus[ii] = 0.;
707 : //Float_t covClus[6];
708 : //for (ii=0; ii<6; ii++) covClus[ii] = 0.;
709 : UShort_t volIdClus;
710 :
711 0 : for (ii=0; ii<fNumberOfTofClusters; ii++) {
712 0 : AliTOFcluster* clOr = fTofClusters[ii];
713 0 : fTofClusters[ii] = 0;
714 0 : digitIndex = clOr->GetIndex();
715 0 : for(jj=0; jj<5; jj++) detectorIndex[jj] = clOr->GetDetInd(jj);
716 0 : volIdClus = fTOFGeometry->GetAliSensVolIndex(detectorIndex[0],detectorIndex[1],detectorIndex[2]);
717 : //volIdClus = GetClusterVolIndex(detectorIndex);
718 0 : for(jj=0; jj<3; jj++) trackLabels[jj] = clOr->GetLabel(jj);
719 0 : parTOF[0] = clOr->GetTDC(); // TDC
720 0 : parTOF[1] = clOr->GetToT(); // TOT
721 0 : parTOF[2] = clOr->GetADC(); // ADC=TOT
722 0 : parTOF[3] = clOr->GetTDCND(); // TDCND
723 0 : parTOF[4] = clOr->GetTDCRAW();//RAW
724 0 : parTOF[5] = 0;
725 0 : parTOF[6] = 0;
726 0 : status = clOr->GetStatus();
727 :
728 0 : posClus[0] = clOr->GetX();
729 0 : posClus[1] = clOr->GetY();
730 0 : posClus[2] = clOr->GetZ();
731 :
732 : //for (jj=0; jj<6; jj++) covClus[jj] = 0.;
733 : //((AliCluster*)clOr)->GetGlobalCov(covClus);
734 :
735 0 : new(lRecPoints[ii]) AliTOFcluster(volIdClus, (Double_t)posClus[0], (Double_t)posClus[1], (Double_t)posClus[2],
736 0 : (Double_t)(clOr->GetSigmaX2()),
737 0 : (Double_t)(clOr->GetSigmaXY()),
738 0 : (Double_t)(clOr->GetSigmaXZ()),
739 0 : (Double_t)(clOr->GetSigmaY2()),
740 0 : (Double_t)(clOr->GetSigmaYZ()),
741 0 : (Double_t)(clOr->GetSigmaZ2()),
742 : //(Double_t)covClus[0], (Double_t)covClus[1], (Double_t)covClus[2],
743 : //(Double_t)covClus[3], (Double_t)covClus[4], (Double_t)covClus[5],
744 0 : trackLabels, detectorIndex, parTOF, status, digitIndex);
745 :
746 0 : AliDebug(2, Form(" %4d %4d %f %f %f %f %f %f %f %f %f %3d %3d %3d %2d %1d %2d %1d %2d %4d %3d %3d %4d %4d %1d %4d",
747 : ii, volIdClus, posClus[0], posClus[1], posClus[2],
748 : clOr->GetSigmaX2(),
749 : clOr->GetSigmaXY(),
750 : clOr->GetSigmaXZ(),
751 : clOr->GetSigmaY2(),
752 : clOr->GetSigmaYZ(),
753 : clOr->GetSigmaZ2(),
754 : trackLabels[0], trackLabels[1], trackLabels[2],
755 : detectorIndex[0], detectorIndex[1], detectorIndex[2], detectorIndex[3], detectorIndex[4],
756 : parTOF[0], parTOF[1], parTOF[2], parTOF[3], parTOF[4],
757 : status, digitIndex));
758 :
759 0 : delete clOr;
760 : }
761 :
762 0 : for (Int_t iSector=0; iSector<AliTOFGeometry::NSectors(); iSector++)
763 0 : for(Int_t iPlate=0; iPlate<AliTOFGeometry::NPlates(); iPlate++) {
764 0 : for(Int_t iStrip=0; iStrip<AliTOFGeometry::NStrip(iPlate); iStrip++) {
765 0 : if (!(fTOFdigitMap->StripDigitCheck(iSector,iPlate,iStrip))) continue;
766 0 : AliDebug(2, Form(" END %2d %1d %2d %5d",
767 : iSector, iPlate, iStrip, fTOFdigitMap->DigitInStrip(iSector,iPlate,iStrip)));
768 : }
769 : }
770 :
771 0 : }
772 : //_____________________________________________________________________________
773 :
774 : void AliTOFClusterFinderV1::FindOnePadClusterPerStrip(Int_t nSector,
775 : Int_t nPlate,
776 : Int_t nStrip)
777 : {
778 : //
779 : // This function searches the isolated digits (stored in the fDigits object),
780 : // to perform clusters (stored in the fTofClusters array).
781 : // This research has been made by checking the fTOFdigitMap object,
782 : // filled at digits/raw-data reading time.
783 : //
784 :
785 : const Int_t kMaxNumberOfTracksPerDigit = 3;
786 : const Int_t kMaxNumberOfDigitsPerVolume = 10;
787 :
788 : Int_t jj = 0;
789 :
790 0 : Int_t det[5] = {nSector,nPlate,nStrip,-1,-1};//sector,plate,strip,padZ,padX
791 0 : Int_t vol[5] = {nSector,nPlate,nStrip,-1,-1};//sector,plate,strip,padX,padZ
792 : UShort_t volIdClus = 0;
793 :
794 0 : Float_t pos[3];
795 0 : for (jj=0; jj<3; jj++) pos[jj] = 0.;
796 0 : Double_t posClus[3];
797 0 : for (jj=0; jj<3; jj++) posClus[jj] = 0.;
798 :
799 0 : Double_t covClus[6];
800 0 : for (jj=0; jj<6; jj++) covClus[jj] = 0.;
801 :
802 0 : Int_t parTOF[7];
803 0 : for (jj=0; jj<7; jj++) parTOF[jj] = 0;
804 :
805 : Bool_t status = kTRUE; //assume all sim channels ok in the beginning...
806 :
807 0 : Int_t tracks[kMaxNumberOfTracksPerDigit];
808 0 : for (jj=0; jj<kMaxNumberOfTracksPerDigit; jj++) tracks[jj] = -1;
809 :
810 : Int_t dummyCounter=-1;
811 :
812 : AliTOFdigit *digitInteresting;
813 :
814 : Int_t iPadX = -1;
815 : Int_t iPadZ = -1;
816 0 : for (iPadX=0; iPadX<AliTOFGeometry::NpadX(); iPadX++) {
817 0 : for (iPadZ=0; iPadZ<AliTOFGeometry::NpadZ(); iPadZ++) {
818 0 : vol[4] = iPadZ , vol[3] = iPadX;
819 :
820 0 : AliDebug(3, Form(" %1d %2d\n", iPadZ, iPadX));
821 :
822 0 : if (fTOFdigitMap->GetNumberOfDigits(vol)==0) continue;
823 :
824 0 : for(Int_t digIndex=0; digIndex<kMaxNumberOfDigitsPerVolume; digIndex++) {
825 0 : if (fTOFdigitMap->GetDigitIndex(vol,digIndex)<0) continue;
826 0 : digitInteresting = (AliTOFdigit*)fDigits->UncheckedAt(fTOFdigitMap->GetDigitIndex(vol,digIndex));
827 :
828 0 : AliDebug(2, Form(" %3d %5d %2d %1d %2d %1d %2d %d %d %d %5d %5d %5d %5d",
829 : fTOFdigitMap->GetNumberOfDigits(vol), digIndex,
830 : vol[0], vol[1], vol[2] ,vol[4], vol[3],
831 : digitInteresting->GetTdc(), digitInteresting->GetAdc(),
832 : digitInteresting->GetToT(),
833 : fTOFdigitMap->GetDigitIndex(vol,digIndex),
834 : digitInteresting->GetTrack(0), digitInteresting->GetTrack(1), digitInteresting->GetTrack(2)));
835 :
836 0 : det[3] = vol[4]; // padz
837 0 : det[4] = vol[3]; // padx
838 0 : fTOFGeometry->GetPosPar(det,pos);
839 0 : AliDebug(1,Form(" %f %f %f", pos[0], pos[1], pos[2]));
840 :
841 : //insert cluster
842 0 : for (jj=0; jj<3; jj++) posClus[jj] = pos[jj];
843 :
844 0 : parTOF[0] = Int_t(digitInteresting->GetTdc());
845 0 : parTOF[1] = Int_t(digitInteresting->GetToT());
846 0 : parTOF[2] = Int_t(digitInteresting->GetAdc());
847 0 : parTOF[3] = Int_t(digitInteresting->GetTdcND());
848 0 : parTOF[4] = Int_t(digitInteresting->GetTdc());
849 0 : parTOF[5] = 0;
850 0 : parTOF[6] = 0;
851 :
852 0 : volIdClus = fTOFGeometry->GetAliSensVolIndex(det[0],det[1],det[2]);
853 : //volIdClus = GetClusterVolIndex(det);
854 :
855 0 : for (jj=0; jj<6; jj++) covClus[jj] = 0.;
856 0 : GetClusterPars(det, posClus, covClus);
857 :
858 : // To fill the track index array
859 : dummyCounter=-1;
860 0 : for (jj=0; jj<kMaxNumberOfTracksPerDigit; jj++) tracks[jj] = -1;
861 0 : for (jj=0; jj<kMaxNumberOfTracksPerDigit; jj++) { // three is the max number of tracks associated to one digit
862 0 : if (digitInteresting->GetTrack(jj)==-1) continue;
863 : else {
864 0 : dummyCounter++;
865 0 : tracks[dummyCounter] = digitInteresting->GetTrack(jj);
866 : }
867 0 : }
868 :
869 : AliTOFcluster *tofCluster =
870 0 : new AliTOFcluster(volIdClus, posClus[0], posClus[1], posClus[2],
871 0 : covClus[0], covClus[1], covClus[2], covClus[3], covClus[4], covClus[5],
872 0 : tracks, det, parTOF, status, fTOFdigitMap->GetDigitIndex(vol,digIndex));
873 0 : InsertCluster(tofCluster);
874 :
875 0 : AliDebug(2, Form(" %4d %f %f %f %f %f %f %f %f %f %3d %3d %3d %2d %1d %2d %1d %2d %4d %3d %3d %4d %4d %1d %4d",
876 : volIdClus, posClus[0], posClus[1], posClus[2],
877 : covClus[0], covClus[1], covClus[2], covClus[3], covClus[4], covClus[5],
878 : tracks[0], tracks[1], tracks[2],
879 : det[0], det[1], det[2], det[3], det[4],
880 : parTOF[0], parTOF[1], parTOF[2], parTOF[3], parTOF[4],
881 : status, fTOFdigitMap->GetDigitIndex(vol,digIndex)));
882 :
883 0 : AliDebug(2, Form(" %f %f %f", pos[0], pos[1], pos[2]));
884 0 : AliDebug(2, Form(" %d %d", parTOF[0], parTOF[2]));
885 :
886 0 : fTOFdigitMap->ResetDigit(vol, digIndex);
887 :
888 0 : }
889 :
890 0 : }
891 : }
892 :
893 0 : }
894 : //_____________________________________________________________________________
895 :
896 : void AliTOFClusterFinderV1::FindClustersWithoutTOT(Int_t nSector,
897 : Int_t nPlate,
898 : Int_t nStrip)
899 : {
900 : //
901 : // This function searches the isolated digits without TOT
902 : // measurement (stored in the fDigits object), to perform clusters
903 : // (stored in the fTofClusters array). This research has been made
904 : // by checking the fTOFdigitMap object, filled at digits/raw-data
905 : // reading time.
906 : //
907 :
908 : const Int_t kMaxNumberOfTracksPerDigit = 3;
909 : const Int_t kMaxNumberOfDigitsPerVolume = 10;
910 :
911 : Int_t jj = 0;
912 :
913 0 : Int_t det[5] = {nSector,nPlate,nStrip,-1,-1};//sector,plate,strip,padZ,padX
914 0 : Int_t vol[5] = {nSector,nPlate,nStrip,-1,-1};//sector,plate,strip,padX,padZ
915 : UShort_t volIdClus = 0;
916 :
917 0 : Float_t pos[3];
918 0 : for (jj=0; jj<3; jj++) pos[jj] = 0.;
919 0 : Double_t posClus[3];
920 0 : for (jj=0; jj<3; jj++) posClus[jj] = 0.;
921 :
922 0 : Double_t covClus[6];
923 0 : for (jj=0; jj<6; jj++) covClus[jj] = 0.;
924 :
925 0 : Int_t parTOF[7];
926 0 : for (jj=0; jj<7; jj++) parTOF[jj] = 0;
927 :
928 : Bool_t status = kTRUE; //assume all sim channels ok in the beginning...
929 0 : Int_t tracks[kMaxNumberOfTracksPerDigit];
930 0 : for (jj=0; jj<kMaxNumberOfTracksPerDigit; jj++) tracks[jj] = -1;
931 :
932 : Int_t dummyCounter=-1;
933 :
934 : AliTOFdigit *digitInteresting;
935 :
936 : Int_t iPadX = -1;
937 : Int_t iPadZ = -1;
938 0 : for (iPadX=0; iPadX<AliTOFGeometry::NpadX(); iPadX++) {
939 0 : for (iPadZ=0; iPadZ<AliTOFGeometry::NpadZ(); iPadZ++) {
940 0 : vol[4] = iPadZ , vol[3] = iPadX;
941 :
942 0 : AliDebug(3, Form(" %1d %2d\n", iPadZ, iPadX));
943 :
944 0 : if (fTOFdigitMap->GetNumberOfDigits(vol)==0) continue;
945 :
946 0 : for(Int_t digIndex=0; digIndex<kMaxNumberOfDigitsPerVolume; digIndex++) {
947 0 : if (fTOFdigitMap->GetDigitIndex(vol,digIndex)<0) continue;
948 0 : digitInteresting = (AliTOFdigit*)fDigits->UncheckedAt(fTOFdigitMap->GetDigitIndex(vol,digIndex));
949 0 : if (digitInteresting->GetToT()>0) continue; // AdC
950 :
951 0 : AliDebug(2, Form(" %3d %5d %2d %1d %2d %1d %2d %d %d %d %5d %5d %5d %5d",
952 : fTOFdigitMap->GetNumberOfDigits(vol), digIndex,
953 : vol[0], vol[1], vol[2] ,vol[4], vol[3],
954 : digitInteresting->GetTdc(), digitInteresting->GetAdc(),
955 : digitInteresting->GetToT(),
956 : fTOFdigitMap->GetDigitIndex(vol,digIndex),
957 : digitInteresting->GetTrack(0), digitInteresting->GetTrack(1), digitInteresting->GetTrack(2)));
958 :
959 0 : det[3] = vol[4]; // padz
960 0 : det[4] = vol[3]; // padx
961 0 : fTOFGeometry->GetPosPar(det,pos);
962 0 : AliDebug(1,Form(" %f %f %f", pos[0], pos[1], pos[2]));
963 :
964 : //insert cluster
965 0 : for (jj=0; jj<3; jj++) posClus[jj] = pos[jj];
966 :
967 0 : parTOF[0] = Int_t(digitInteresting->GetTdc());
968 0 : parTOF[1] = Int_t(digitInteresting->GetToT());
969 0 : parTOF[2] = Int_t(digitInteresting->GetAdc());
970 0 : parTOF[3] = Int_t(digitInteresting->GetTdcND());
971 0 : parTOF[4] = Int_t(digitInteresting->GetTdc());
972 0 : parTOF[5] = 0;
973 0 : parTOF[6] = 0;
974 :
975 0 : volIdClus = fTOFGeometry->GetAliSensVolIndex(det[0],det[1],det[2]);
976 : //volIdClus = GetClusterVolIndex(det);
977 :
978 0 : for (jj=0; jj<6; jj++) covClus[jj] = 0.;
979 0 : GetClusterPars(det, posClus, covClus);
980 :
981 : // To fill the track index array
982 : dummyCounter=-1;
983 0 : for (jj=0; jj<kMaxNumberOfTracksPerDigit; jj++) tracks[jj] = -1;
984 0 : for (jj=0; jj<kMaxNumberOfTracksPerDigit; jj++) { // three is the max number of tracks associated to one digit
985 0 : if (digitInteresting->GetTrack(jj)==-1) continue;
986 : else {
987 0 : dummyCounter++;
988 0 : tracks[dummyCounter] = digitInteresting->GetTrack(jj);
989 : }
990 0 : }
991 :
992 : AliTOFcluster *tofCluster =
993 0 : new AliTOFcluster(volIdClus, posClus[0], posClus[1], posClus[2],
994 0 : covClus[0], covClus[1], covClus[2], covClus[3], covClus[4], covClus[5],
995 0 : tracks, det, parTOF, status, fTOFdigitMap->GetDigitIndex(vol,digIndex));
996 0 : InsertCluster(tofCluster);
997 :
998 0 : AliDebug(2, Form(" %4d %f %f %f %f %f %f %f %f %f %3d %3d %3d %2d %1d %2d %1d %2d %4d %3d %3d %4d %4d %1d %4d",
999 : volIdClus, posClus[0], posClus[1], posClus[2],
1000 : covClus[0], covClus[1], covClus[2], covClus[3], covClus[4], covClus[5],
1001 : tracks[0], tracks[1], tracks[2],
1002 : det[0], det[1], det[2], det[3], det[4],
1003 : parTOF[0], parTOF[1], parTOF[2], parTOF[3], parTOF[4],
1004 : status, fTOFdigitMap->GetDigitIndex(vol,digIndex)));
1005 :
1006 0 : AliDebug(2, Form(" %f %f %f", pos[0], pos[1], pos[2]));
1007 0 : AliDebug(2, Form(" %d %d", parTOF[0], parTOF[2]));
1008 :
1009 0 : fTOFdigitMap->ResetDigit(vol, digIndex);
1010 :
1011 0 : }
1012 :
1013 0 : }
1014 : }
1015 :
1016 0 : }
1017 : //_____________________________________________________________________________
1018 :
1019 : void AliTOFClusterFinderV1::FindClusters34(Int_t nSector,
1020 : Int_t nPlate,
1021 : Int_t nStrip)
1022 : {
1023 : //
1024 : // This function searches the neighbouring digits (stored in the fDigits object),
1025 : // to perform clusters (stored in the fTofClusters array).
1026 : //
1027 : // This research has been made by checking the fTOFdigitMap object,
1028 : // filled at digits/raw-data reading time.
1029 : //
1030 :
1031 : const Int_t kMaxNumberOfInterestingPads = 4;
1032 : const Int_t kMaxNumberOfTracksPerDigit = 3;
1033 : const Int_t kMaxNumberOfDigitsPerVolume = 10;
1034 :
1035 : Int_t ii = 0;
1036 :
1037 0 : Int_t digitsInVolumeIndices[kMaxNumberOfDigitsPerVolume];
1038 0 : for (ii=0; ii<kMaxNumberOfDigitsPerVolume; ii++)
1039 0 : digitsInVolumeIndices[ii] = -1;
1040 :
1041 0 : Int_t vol[5] = {nSector,nPlate,nStrip,-1,-1};
1042 :
1043 0 : Float_t pos[3] = {0.,0.,0.};
1044 :
1045 : Int_t jj = 0;
1046 0 : Int_t interestingPadX[kMaxNumberOfInterestingPads];
1047 0 : for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingPadX[jj] = -1;
1048 0 : Int_t interestingPadZ[kMaxNumberOfInterestingPads];
1049 0 : for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingPadZ[jj] = -1;
1050 0 : Double_t interestingTOT[kMaxNumberOfInterestingPads];
1051 0 : for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingTOT[jj] = 0;
1052 0 : Double_t interestingADC[kMaxNumberOfInterestingPads];
1053 0 : for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingADC[jj] = 0;
1054 0 : Double_t interestingTOF[kMaxNumberOfInterestingPads];
1055 0 : for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingTOF[jj] = 0;
1056 0 : Double_t interestingWeight[kMaxNumberOfInterestingPads];
1057 0 : for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingWeight[jj] = 0;
1058 :
1059 0 : Float_t interestingX[kMaxNumberOfInterestingPads];
1060 0 : for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingX[jj] = 0;
1061 0 : Float_t interestingY[kMaxNumberOfInterestingPads];
1062 0 : for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingY[jj] = 0;
1063 0 : Float_t interestingZ[kMaxNumberOfInterestingPads];
1064 0 : for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingZ[jj] = 0;
1065 :
1066 0 : Float_t interDigit[kMaxNumberOfInterestingPads];
1067 0 : for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interDigit[jj] = 0;
1068 :
1069 0 : Int_t padsCluster[11];
1070 0 : padsCluster[0] = nSector;
1071 0 : padsCluster[1] = nPlate;
1072 0 : padsCluster[2] = nStrip;
1073 0 : for (jj=3; jj<11; jj++) padsCluster[jj] = -1;
1074 :
1075 : Int_t interestingCounter=-1;
1076 : Int_t digitIndexLocal=-1; // AdC
1077 : Int_t iPad = -1;
1078 : Int_t iPadX = -1;
1079 : Int_t iPadZ = -1;
1080 :
1081 0 : Int_t parTOF[7];
1082 0 : for (jj=0; jj<7; jj++) parTOF[jj] = 0;
1083 0 : Double_t posClus[3];
1084 0 : for (jj=0; jj<3; jj++) posClus[jj] = 0.;
1085 0 : Int_t det[5];
1086 0 : for (jj=0; jj<5; jj++) det[jj] = -1;
1087 0 : Float_t posF[3];
1088 0 : for (jj=0; jj<3; jj++) posF[jj] = 0.;
1089 : UShort_t volIdClus = 0;
1090 0 : Bool_t check = kFALSE;
1091 : Bool_t status = kTRUE; //assume all sim channels ok in the beginning...
1092 0 : Double_t covClus[6];
1093 0 : for (jj=0; jj<6; jj++) covClus[jj] = 0.;
1094 0 : Int_t tracks[kMaxNumberOfTracksPerDigit];
1095 0 : for (jj=0; jj<kMaxNumberOfTracksPerDigit; jj++) tracks[jj] = -1;
1096 : Int_t dummyCounter=-1;
1097 : Bool_t alreadyStored = kFALSE;
1098 :
1099 0 : AliTOFselectedDigit ***selectedDigit = new AliTOFselectedDigit**[kMaxNumberOfInterestingPads];
1100 0 : for (ii=0; ii<kMaxNumberOfInterestingPads; ii++)
1101 0 : selectedDigit[ii] = new AliTOFselectedDigit*[kMaxNumberOfDigitsPerVolume];
1102 :
1103 0 : for (ii=0; ii<kMaxNumberOfInterestingPads; ii++)
1104 0 : for (jj=0; jj<kMaxNumberOfDigitsPerVolume; jj++) selectedDigit[ii][jj] = 0x0;
1105 :
1106 : AliTOFdigit *digitInteresting;
1107 :
1108 0 : for (iPad=0; iPad<AliTOFGeometry::NpadZ()*AliTOFGeometry::NpadX()-3; iPad+=2) {
1109 :
1110 0 : iPadZ = iPad%AliTOFGeometry::NpadZ(); //iPad%2;
1111 0 : iPadX = iPad/AliTOFGeometry::NpadZ(); //iPad/2;
1112 :
1113 0 : AliDebug(3, Form("%2d %1d %2d\n", iPad, iPadZ, iPadX));
1114 :
1115 :
1116 :
1117 :
1118 :
1119 :
1120 : interestingCounter=-1;
1121 :
1122 0 : vol[4] = iPadZ , vol[3] = iPadX;
1123 0 : if (fTOFdigitMap->GetNumberOfDigits(vol)>0)
1124 0 : interestingCounter++;
1125 :
1126 0 : vol[4] = iPadZ, vol[3] = iPadX+1;
1127 0 : if (fTOFdigitMap->GetNumberOfDigits(vol)>0)
1128 0 : interestingCounter++;
1129 :
1130 0 : vol[4] = AliTOFGeometry::NpadZ()-(iPadZ+1), vol[3] = iPadX;
1131 0 : if (fTOFdigitMap->GetNumberOfDigits(vol)>0)
1132 0 : interestingCounter++;
1133 :
1134 0 : vol[4] = AliTOFGeometry::NpadZ()-(iPadZ+1), vol[3] = iPadX+1;
1135 0 : if (fTOFdigitMap->GetNumberOfDigits(vol)>0)
1136 0 : interestingCounter++;
1137 :
1138 0 : if (interestingCounter+1!=4) continue; // the hit pads have to be 4
1139 : else interestingCounter=-1;
1140 :
1141 :
1142 0 : for (ii=0; ii<kMaxNumberOfInterestingPads; ii++)
1143 0 : for (jj=0; jj<kMaxNumberOfDigitsPerVolume; jj++)
1144 0 : selectedDigit[ii][jj] = 0x0;
1145 :
1146 :
1147 0 : vol[4] = iPadZ, vol[3] = iPadX;
1148 :
1149 0 : if (fTOFdigitMap->GetNumberOfDigits(vol)>0) {
1150 : interestingCounter++;
1151 0 : for (ii=0; ii<kMaxNumberOfDigitsPerVolume; ii++)
1152 0 : digitsInVolumeIndices[ii] = -1;
1153 0 : fTOFdigitMap->GetDigitIndex(vol, digitsInVolumeIndices);
1154 : digitIndexLocal=-1; // AdC
1155 0 : for(Int_t digIndex=0; digIndex<kMaxNumberOfDigitsPerVolume; digIndex++) {
1156 0 : if (digitsInVolumeIndices[digIndex]<0) continue;
1157 0 : digitInteresting = (AliTOFdigit*)fDigits->UncheckedAt(digitsInVolumeIndices[digIndex]);
1158 0 : if (digitInteresting->GetToT()<=0) continue; // AdC
1159 0 : digitIndexLocal++; // AdC
1160 :
1161 0 : AliDebug(1,Form(" %2d %1d %2d %1d %2d %d %d %d %d %5d %5d %5d %5d",
1162 : vol[0], vol[1], vol[2] ,vol[4], vol[3],
1163 : digitInteresting->GetTdc(), digitInteresting->GetAdc(),
1164 : digitInteresting->GetToT(), digitInteresting->GetToT()*digitInteresting->GetToT(),
1165 : digitsInVolumeIndices[digIndex],
1166 : digitInteresting->GetTrack(0), digitInteresting->GetTrack(1), digitInteresting->GetTrack(2)));
1167 :
1168 :
1169 0 : selectedDigit[interestingCounter][digitIndexLocal] = new // AdC
1170 0 : AliTOFselectedDigit(vol, digitInteresting->GetTdc(),
1171 0 : digitInteresting->GetAdc(), digitInteresting->GetToT(),
1172 0 : digitInteresting->GetToT()*digitInteresting->GetToT(),
1173 0 : digitsInVolumeIndices[digIndex],
1174 0 : digitInteresting->GetTracks());
1175 0 : }
1176 0 : if (digitIndexLocal==-1) interestingCounter--; // AdC
1177 : }
1178 :
1179 :
1180 0 : vol[4] = iPadZ, vol[3] = iPadX+1;
1181 :
1182 0 : if (fTOFdigitMap->GetNumberOfDigits(vol)>0) {
1183 0 : interestingCounter++;
1184 0 : for (ii=0; ii<kMaxNumberOfDigitsPerVolume; ii++)
1185 0 : digitsInVolumeIndices[ii] = -1;
1186 0 : fTOFdigitMap->GetDigitIndex(vol, digitsInVolumeIndices);
1187 : digitIndexLocal=-1; // AdC
1188 0 : for(Int_t digIndex=0; digIndex<kMaxNumberOfDigitsPerVolume; digIndex++) {
1189 0 : if (digitsInVolumeIndices[digIndex]<0) continue;
1190 0 : digitInteresting = (AliTOFdigit*)fDigits->UncheckedAt(digitsInVolumeIndices[digIndex]);
1191 0 : if (digitInteresting->GetToT()<=0) continue; // AdC
1192 0 : digitIndexLocal++; // AdC
1193 :
1194 0 : AliDebug(1,Form(" %2d %1d %2d %1d %2d %d %d %d %d %5d %5d %5d %5d",
1195 : vol[0], vol[1], vol[2] ,vol[4], vol[3],
1196 : digitInteresting->GetTdc(), digitInteresting->GetAdc(),
1197 : digitInteresting->GetToT(), digitInteresting->GetToT()*digitInteresting->GetToT(),
1198 : digitsInVolumeIndices[digIndex],
1199 : digitInteresting->GetTrack(0), digitInteresting->GetTrack(1), digitInteresting->GetTrack(2)));
1200 :
1201 :
1202 0 : selectedDigit[interestingCounter][digitIndexLocal] = new // AdC
1203 0 : AliTOFselectedDigit(vol, digitInteresting->GetTdc(),
1204 0 : digitInteresting->GetAdc(), digitInteresting->GetToT(),
1205 0 : digitInteresting->GetToT()*digitInteresting->GetToT(),
1206 0 : digitsInVolumeIndices[digIndex],
1207 0 : digitInteresting->GetTracks());
1208 0 : }
1209 0 : if (digitIndexLocal==-1) interestingCounter--; // AdC
1210 : }
1211 :
1212 :
1213 0 : vol[4] = AliTOFGeometry::NpadZ()-(iPadZ+1), vol[3] = iPadX;
1214 :
1215 0 : if (fTOFdigitMap->GetNumberOfDigits(vol)>0) {
1216 0 : interestingCounter++;
1217 0 : for (ii=0; ii<kMaxNumberOfDigitsPerVolume; ii++)
1218 0 : digitsInVolumeIndices[ii] = -1;
1219 0 : fTOFdigitMap->GetDigitIndex(vol, digitsInVolumeIndices);
1220 : digitIndexLocal=-1; // AdC
1221 0 : for(Int_t digIndex=0; digIndex<kMaxNumberOfDigitsPerVolume; digIndex++) {
1222 0 : if (digitsInVolumeIndices[digIndex]<0) continue;
1223 0 : digitInteresting = (AliTOFdigit*)fDigits->UncheckedAt(digitsInVolumeIndices[digIndex]);
1224 0 : if (digitInteresting->GetToT()<=0) continue; // AdC
1225 0 : digitIndexLocal++; // AdC
1226 :
1227 0 : AliDebug(1,Form(" %2d %1d %2d %1d %2d %d %d %d %d %5d %5d %5d %5d",
1228 : vol[0], vol[1], vol[2] ,vol[4], vol[3],
1229 : digitInteresting->GetTdc(), digitInteresting->GetAdc(),
1230 : digitInteresting->GetToT(), digitInteresting->GetToT()*digitInteresting->GetToT(),
1231 : digitsInVolumeIndices[digIndex],
1232 : digitInteresting->GetTrack(0), digitInteresting->GetTrack(1), digitInteresting->GetTrack(2)));
1233 :
1234 :
1235 0 : selectedDigit[interestingCounter][digitIndexLocal] = new // AdC
1236 0 : AliTOFselectedDigit(vol, digitInteresting->GetTdc(),
1237 0 : digitInteresting->GetAdc(), digitInteresting->GetToT(),
1238 0 : digitInteresting->GetToT()*digitInteresting->GetToT(),
1239 0 : digitsInVolumeIndices[digIndex],
1240 0 : digitInteresting->GetTracks());
1241 0 : }
1242 0 : if (digitIndexLocal==-1) interestingCounter--; // AdC
1243 : }
1244 :
1245 :
1246 0 : vol[4] = AliTOFGeometry::NpadZ()-(iPadZ+1), vol[3] = iPadX+1;
1247 :
1248 0 : if (fTOFdigitMap->GetNumberOfDigits(vol)>0) {
1249 0 : interestingCounter++;
1250 0 : for (ii=0; ii<kMaxNumberOfDigitsPerVolume; ii++)
1251 0 : digitsInVolumeIndices[ii] = -1;
1252 0 : fTOFdigitMap->GetDigitIndex(vol, digitsInVolumeIndices);
1253 : digitIndexLocal=-1;
1254 0 : for(Int_t digIndex=0; digIndex<kMaxNumberOfDigitsPerVolume; digIndex++) {
1255 0 : if (digitsInVolumeIndices[digIndex]<0) continue;
1256 0 : digitInteresting = (AliTOFdigit*)fDigits->UncheckedAt(digitsInVolumeIndices[digIndex]);
1257 0 : if (digitInteresting->GetToT()<=0) continue; // AdC
1258 0 : digitIndexLocal++; // AdC
1259 :
1260 0 : AliDebug(1,Form(" %2d %1d %2d %1d %2d %d %d %d %d %5d %5d %5d %5d",
1261 : vol[0], vol[1], vol[2] ,vol[4], vol[3],
1262 : digitInteresting->GetTdc(), digitInteresting->GetAdc(),
1263 : digitInteresting->GetToT(), digitInteresting->GetToT()*digitInteresting->GetToT(),
1264 : digitsInVolumeIndices[digIndex],
1265 : digitInteresting->GetTrack(0), digitInteresting->GetTrack(1), digitInteresting->GetTrack(2)));
1266 :
1267 0 : selectedDigit[interestingCounter][digitIndexLocal] = new // AdC
1268 0 : AliTOFselectedDigit(vol, digitInteresting->GetTdc(),
1269 0 : digitInteresting->GetAdc(), digitInteresting->GetToT(),
1270 0 : digitInteresting->GetToT()*digitInteresting->GetToT(),
1271 0 : digitsInVolumeIndices[digIndex],
1272 0 : digitInteresting->GetTracks());
1273 0 : }
1274 0 : if (digitIndexLocal==-1) interestingCounter--; // AdC
1275 : }
1276 :
1277 0 : AliDebug(1,Form(" e adesso %1d", interestingCounter+1));
1278 :
1279 0 : for (Int_t adesso1=0; adesso1<interestingCounter+1; adesso1++) {
1280 0 : for (Int_t firstIndex=0; firstIndex<kMaxNumberOfDigitsPerVolume; firstIndex++) {
1281 0 : if (selectedDigit[adesso1][firstIndex]==0x0) continue;
1282 :
1283 0 : for (Int_t adesso2=adesso1+1; adesso2<interestingCounter+1; adesso2++) {
1284 0 : for (Int_t secondIndex=0; secondIndex<kMaxNumberOfDigitsPerVolume; secondIndex++) {
1285 0 : if (selectedDigit[adesso2][secondIndex]==0x0) continue;
1286 :
1287 0 : for (Int_t adesso3=adesso2+1; adesso3<interestingCounter+1; adesso3++) {
1288 0 : for (Int_t thirdIndex=0; thirdIndex<kMaxNumberOfDigitsPerVolume; thirdIndex++) {
1289 0 : if (selectedDigit[adesso3][thirdIndex]==0x0) continue;
1290 :
1291 :
1292 0 : if (TMath::Abs(selectedDigit[adesso1][firstIndex]->GetTDC()-selectedDigit[adesso2][secondIndex]->GetTDC())>fMaxDeltaTime
1293 0 : ||
1294 0 : TMath::Abs(selectedDigit[adesso1][firstIndex]->GetTDC()-selectedDigit[adesso3][thirdIndex]->GetTDC())>fMaxDeltaTime
1295 0 : ||
1296 0 : TMath::Abs(selectedDigit[adesso2][secondIndex]->GetTDC()-selectedDigit[adesso3][thirdIndex]->GetTDC())>fMaxDeltaTime) continue;
1297 :
1298 0 : interestingTOF[0] = selectedDigit[adesso1][firstIndex]->GetTDC();
1299 0 : interestingTOT[0] = selectedDigit[adesso1][firstIndex]->GetTOT();
1300 0 : interestingADC[0] = selectedDigit[adesso1][firstIndex]->GetADC();
1301 0 : interestingWeight[0] = selectedDigit[adesso1][firstIndex]->GetWeight();
1302 0 : Int_t vol1[5]; for(jj=0; jj<5; jj++) vol1[jj] = selectedDigit[adesso1][firstIndex]->GetDetectorIndex(jj);
1303 0 : AliDebug(1,Form(" %2d %1d %2d %1d %2d", vol1[0], vol1[1], vol1[2], vol1[4], vol1[3]));
1304 0 : Int_t volDum = vol1[3];
1305 0 : vol1[3] = vol1[4];
1306 0 : vol1[4] = volDum;
1307 0 : fTOFGeometry->GetPosPar(vol1,pos);
1308 0 : interestingX[0] = pos[0];
1309 0 : interestingY[0] = pos[1];
1310 0 : interestingZ[0] = pos[2];
1311 :
1312 0 : interestingTOF[1] = selectedDigit[adesso2][secondIndex]->GetTDC();
1313 0 : interestingTOT[1] = selectedDigit[adesso2][secondIndex]->GetTOT();
1314 0 : interestingADC[1] = selectedDigit[adesso2][secondIndex]->GetADC();
1315 0 : interestingWeight[1] = selectedDigit[adesso2][secondIndex]->GetWeight();
1316 0 : Int_t vol2[5]; for(jj=0; jj<5; jj++) vol2[jj] = selectedDigit[adesso2][secondIndex]->GetDetectorIndex(jj);
1317 0 : AliDebug(1,Form(" %2d %1d %2d %1d %2d", vol2[0], vol2[1], vol2[2], vol2[4], vol2[3]));
1318 0 : volDum = vol2[3];
1319 0 : vol2[3] = vol2[4];
1320 0 : vol2[4] = volDum;
1321 0 : fTOFGeometry->GetPosPar(vol2,pos);
1322 0 : interestingX[1] = pos[0];
1323 0 : interestingY[1] = pos[1];
1324 0 : interestingZ[1] = pos[2];
1325 :
1326 0 : interestingTOF[2] = selectedDigit[adesso3][thirdIndex]->GetTDC();
1327 0 : interestingTOT[2] = selectedDigit[adesso3][thirdIndex]->GetTOT();
1328 0 : interestingADC[2] = selectedDigit[adesso3][thirdIndex]->GetADC();
1329 0 : interestingWeight[2] = selectedDigit[adesso3][thirdIndex]->GetWeight();
1330 0 : Int_t vol3[5]; for(jj=0; jj<5; jj++) vol3[jj] = selectedDigit[adesso3][thirdIndex]->GetDetectorIndex(jj);
1331 0 : AliDebug(1,Form(" %2d %1d %2d %1d %2d", vol3[0], vol3[1], vol3[2], vol3[4], vol3[3]));
1332 0 : volDum = vol3[3];
1333 0 : vol3[3] = vol3[4];
1334 0 : vol3[4] = volDum;
1335 0 : fTOFGeometry->GetPosPar(vol3,pos);
1336 0 : interestingX[2] = pos[0];
1337 0 : interestingY[2] = pos[1];
1338 0 : interestingZ[2] = pos[2];
1339 :
1340 :
1341 0 : AverageCalculations(3, interestingX, interestingY, interestingZ,
1342 0 : interestingTOF, interestingTOT, interestingADC,
1343 0 : interestingWeight,
1344 0 : parTOF, posClus, check);
1345 :
1346 :
1347 0 : for (jj=0; jj<5; jj++) det[jj] = -1;
1348 0 : for (jj=0; jj<3; jj++) posF[jj] = posClus[jj];
1349 0 : fTOFGeometry->GetDetID(posF, det);
1350 :
1351 0 : volIdClus = fTOFGeometry->GetAliSensVolIndex(det[0],det[1],det[2]);
1352 : //volIdClus = GetClusterVolIndex(det);
1353 :
1354 0 : for (jj=3; jj<11; jj++) padsCluster[jj] = -1;
1355 0 : padsCluster[3] = selectedDigit[adesso1][firstIndex]->GetDetectorIndex(4);
1356 0 : padsCluster[4] = selectedDigit[adesso1][firstIndex]->GetDetectorIndex(3);
1357 0 : padsCluster[5] = selectedDigit[adesso2][secondIndex]->GetDetectorIndex(4);
1358 0 : padsCluster[6] = selectedDigit[adesso2][secondIndex]->GetDetectorIndex(3);
1359 0 : padsCluster[7] = selectedDigit[adesso3][thirdIndex]->GetDetectorIndex(4);
1360 0 : padsCluster[8] = selectedDigit[adesso3][thirdIndex]->GetDetectorIndex(3);
1361 :
1362 0 : for (jj=0; jj<6; jj++) covClus[jj] = 0.;
1363 0 : Int_t ** indDet = new Int_t*[3];
1364 0 : for (jj=0; jj<3; jj++) indDet[jj] = new Int_t [5];
1365 0 : for (jj=0; jj<3; jj++) indDet[jj][0] = nSector;
1366 0 : for (jj=0; jj<3; jj++) indDet[jj][1] = nPlate;
1367 0 : for (jj=0; jj<3; jj++) indDet[jj][2] = nStrip;
1368 0 : for (jj=0; jj<3; jj++) indDet[jj][3] = padsCluster[2*jj+3];
1369 0 : for (jj=0; jj<3; jj++) indDet[jj][4] = padsCluster[2*jj+1+3];
1370 0 : GetClusterPars(/*check,*/ 3, indDet, interestingWeight, posClus, covClus);
1371 0 : for (jj=0; jj<3; jj++) delete [] indDet[jj];
1372 0 : delete [] indDet;
1373 :
1374 : // To fill the track index array
1375 : dummyCounter=-1;
1376 0 : for (jj=0; jj<kMaxNumberOfTracksPerDigit; jj++) tracks[jj] = -1;
1377 0 : for (Int_t kk=0; kk<kMaxNumberOfTracksPerDigit; kk++) { // three is the max number of tracks associated to one digit
1378 0 : if (selectedDigit[adesso1][firstIndex]->GetTrackLabel(kk)==-1) continue;
1379 : else {
1380 0 : dummyCounter++;
1381 0 : tracks[dummyCounter] = selectedDigit[adesso1][firstIndex]->GetTrackLabel(kk);
1382 : }
1383 0 : }
1384 0 : for (Int_t kk=0; kk<kMaxNumberOfTracksPerDigit; kk++) { // three is the max number of tracks associated to one digit
1385 0 : if (selectedDigit[adesso2][secondIndex]->GetTrackLabel(kk)==-1) continue;
1386 : else {
1387 :
1388 : alreadyStored = kFALSE;
1389 0 : for (jj=0; jj<dummyCounter+1; jj++)
1390 0 : alreadyStored = alreadyStored || (tracks[jj]!=-1 && tracks[jj]==selectedDigit[adesso2][secondIndex]->GetTrackLabel(kk));
1391 :
1392 0 : if (alreadyStored) continue;
1393 0 : if (dummyCounter==2) { // three is the max number of tracks associated to one cluster
1394 0 : AliWarning(" Siamo al limite!");
1395 0 : continue;
1396 : }
1397 :
1398 : dummyCounter++;
1399 0 : tracks[dummyCounter] = selectedDigit[adesso2][secondIndex]->GetTrackLabel(kk);
1400 :
1401 : }
1402 :
1403 0 : }
1404 0 : for (Int_t kk=0; kk<kMaxNumberOfTracksPerDigit; kk++) { // three is the max number of tracks associated to one digit
1405 0 : if (selectedDigit[adesso3][thirdIndex]->GetTrackLabel(kk)==-1) continue;
1406 : else {
1407 :
1408 : alreadyStored = kFALSE;
1409 0 : for (jj=0; jj<dummyCounter+1; jj++)
1410 0 : alreadyStored = alreadyStored || (tracks[jj]!=-1 && tracks[jj]==selectedDigit[adesso3][thirdIndex]->GetTrackLabel(kk));
1411 :
1412 0 : if (alreadyStored) continue;
1413 0 : if (dummyCounter==2) { // three is the max number of tracks associated to one cluster
1414 0 : AliWarning(" Siamo al limite!");
1415 0 : continue;
1416 : }
1417 :
1418 : dummyCounter++;
1419 0 : tracks[dummyCounter] = selectedDigit[adesso3][thirdIndex]->GetTrackLabel(kk);
1420 :
1421 : }
1422 :
1423 0 : }
1424 :
1425 :
1426 : AliTOFcluster *tofCluster =
1427 0 : new AliTOFcluster(volIdClus, posClus[0], posClus[1], posClus[2],
1428 0 : covClus[0], covClus[1], covClus[2], covClus[3], covClus[4], covClus[5],
1429 0 : tracks, det, parTOF, status, selectedDigit[adesso1][firstIndex]->GetIndex()); // to be updated
1430 0 : InsertCluster(tofCluster);
1431 :
1432 0 : AliDebug(2, Form(" %4d %f %f %f %f %f %f %f %f %f %3d %3d %3d %2d %1d %2d %1d %2d %4d %3d %3d %4d %4d %1d %4d",
1433 : volIdClus, posClus[0], posClus[1], posClus[2],
1434 : covClus[0], covClus[1], covClus[2], covClus[3], covClus[4], covClus[5],
1435 : tracks[0], tracks[1], tracks[2],
1436 : det[0], det[1], det[2], det[3], det[4],
1437 : parTOF[0], parTOF[1], parTOF[2], parTOF[3], parTOF[4],
1438 : status, selectedDigit[adesso1][firstIndex]->GetIndex()));
1439 :
1440 :
1441 0 : volDum = vol1[3];
1442 0 : vol1[3] = vol1[4];
1443 0 : vol1[4] = volDum;
1444 0 : fTOFdigitMap->ResetDigitNumber(vol1,selectedDigit[adesso1][firstIndex]->GetIndex());
1445 0 : volDum = vol2[3];
1446 0 : vol2[3] = vol2[4];
1447 0 : vol2[4] = volDum;
1448 0 : fTOFdigitMap->ResetDigitNumber(vol2,selectedDigit[adesso2][secondIndex]->GetIndex());
1449 0 : volDum = vol3[3];
1450 0 : vol3[3] = vol3[4];
1451 0 : vol3[4] = volDum;
1452 0 : fTOFdigitMap->ResetDigitNumber(vol3,selectedDigit[adesso3][thirdIndex]->GetIndex());
1453 :
1454 :
1455 0 : } // close loop on third digit
1456 : } // close loop on adesso3
1457 :
1458 0 : } // close loop on second digit
1459 : } // close loop on adesso2
1460 :
1461 0 : } // close loop on first digit
1462 : } // close loop on adesso1
1463 :
1464 0 : for (ii=0; ii<kMaxNumberOfInterestingPads; ii++)
1465 0 : for (jj=0; jj<kMaxNumberOfDigitsPerVolume; jj++)
1466 0 : selectedDigit[ii][jj] = 0x0;
1467 :
1468 : } // loop on iPad
1469 :
1470 0 : for (ii=0; ii<kMaxNumberOfInterestingPads; ii++) {
1471 0 : for (jj=0; jj<kMaxNumberOfDigitsPerVolume; jj++) {
1472 0 : delete [] selectedDigit[ii][jj];
1473 0 : selectedDigit[ii][jj] = 0x0;
1474 : }
1475 0 : delete [] selectedDigit[ii];
1476 0 : selectedDigit[ii] = 0x0;
1477 : }
1478 0 : delete [] selectedDigit;
1479 : selectedDigit = 0x0;
1480 :
1481 0 : }
1482 : //_____________________________________________________________________________
1483 :
1484 : void AliTOFClusterFinderV1::FindClusters23(Int_t nSector,
1485 : Int_t nPlate,
1486 : Int_t nStrip)
1487 : {
1488 : //
1489 : // This function searches the neighbouring digits (stored in the fDigits object),
1490 : // to perform clusters (stored in the fTofClusters array).
1491 : //
1492 : // This research has been made by checking the fTOFdigitMap object,
1493 : // filled at digits/raw-data reading time.
1494 : //
1495 :
1496 : const Int_t kMaxNumberOfInterestingPads = 4;
1497 : const Int_t kMaxNumberOfTracksPerDigit = 3;
1498 : const Int_t kMaxNumberOfDigitsPerVolume = 10;
1499 :
1500 : Int_t ii = 0;
1501 :
1502 0 : Int_t digitsInVolumeIndices[kMaxNumberOfDigitsPerVolume];
1503 0 : for (ii=0; ii<kMaxNumberOfDigitsPerVolume; ii++)
1504 0 : digitsInVolumeIndices[ii] = -1;
1505 :
1506 0 : Int_t vol[5] = {nSector,nPlate,nStrip,-1,-1};
1507 :
1508 0 : Float_t pos[3] = {0.,0.,0.};
1509 :
1510 : Int_t jj = 0;
1511 0 : Int_t interestingPadX[kMaxNumberOfInterestingPads];
1512 0 : for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingPadX[jj] = -1;
1513 0 : Int_t interestingPadZ[kMaxNumberOfInterestingPads];
1514 0 : for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingPadZ[jj] = -1;
1515 0 : Double_t interestingTOT[kMaxNumberOfInterestingPads];
1516 0 : for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingTOT[jj] = 0;
1517 0 : Double_t interestingADC[kMaxNumberOfInterestingPads];
1518 0 : for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingADC[jj] = 0;
1519 0 : Double_t interestingTOF[kMaxNumberOfInterestingPads];
1520 0 : for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingTOF[jj] = 0;
1521 0 : Double_t interestingWeight[kMaxNumberOfInterestingPads];
1522 0 : for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingWeight[jj] = 0;
1523 :
1524 0 : Float_t interestingX[kMaxNumberOfInterestingPads];
1525 0 : for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingX[jj] = 0;
1526 0 : Float_t interestingY[kMaxNumberOfInterestingPads];
1527 0 : for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingY[jj] = 0;
1528 0 : Float_t interestingZ[kMaxNumberOfInterestingPads];
1529 0 : for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingZ[jj] = 0;
1530 :
1531 0 : Float_t interDigit[kMaxNumberOfInterestingPads];
1532 0 : for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interDigit[jj] = 0;
1533 :
1534 0 : Int_t padsCluster[11];
1535 0 : padsCluster[0] = nSector;
1536 0 : padsCluster[1] = nPlate;
1537 0 : padsCluster[2] = nStrip;
1538 0 : for (jj=3; jj<11; jj++) padsCluster[jj] = -1;
1539 :
1540 : Int_t interestingCounter=-1;
1541 : Int_t digitIndexLocal = -1;
1542 : Int_t iPad = -1;
1543 : Int_t iPadX = -1;
1544 : Int_t iPadZ = -1;
1545 :
1546 0 : Bool_t check = kFALSE;
1547 0 : Int_t parTOF[7];
1548 0 : for (jj=0; jj<7; jj++) parTOF[jj] = 0;
1549 0 : Double_t posClus[3];
1550 0 : for (jj=0; jj<3; jj++) posClus[jj] = 0.;
1551 0 : Int_t det[5];
1552 0 : for (jj=0; jj<5; jj++) det[jj] = -1;
1553 0 : Float_t posF[3];
1554 0 : for (jj=0; jj<3; jj++) posF[jj] = 0.;
1555 : UShort_t volIdClus = 0;
1556 : Bool_t status = kTRUE; //assume all sim channels ok in the beginning...
1557 0 : Double_t covClus[6];
1558 0 : for (jj=0; jj<6; jj++) covClus[jj] = 0.;
1559 0 : Int_t tracks[kMaxNumberOfTracksPerDigit];
1560 0 : for (jj=0; jj<kMaxNumberOfTracksPerDigit; jj++) tracks[jj] = -1;
1561 : Int_t dummyCounter=-1;
1562 : Bool_t alreadyStored = kFALSE;
1563 :
1564 0 : AliTOFselectedDigit ***selectedDigit = new AliTOFselectedDigit**[kMaxNumberOfInterestingPads];
1565 0 : for (ii=0; ii<kMaxNumberOfInterestingPads; ii++)
1566 0 : selectedDigit[ii] = new AliTOFselectedDigit*[kMaxNumberOfDigitsPerVolume];
1567 :
1568 0 : for (ii=0; ii<kMaxNumberOfInterestingPads; ii++)
1569 0 : for (jj=0; jj<kMaxNumberOfDigitsPerVolume; jj++) selectedDigit[ii][jj] = 0x0;
1570 :
1571 : AliTOFdigit *digitInteresting;
1572 :
1573 0 : for (iPad=0; iPad<AliTOFGeometry::NpadZ()*AliTOFGeometry::NpadX()-3; iPad+=2) {
1574 :
1575 0 : iPadZ = iPad%AliTOFGeometry::NpadZ(); //iPad%2;
1576 0 : iPadX = iPad/AliTOFGeometry::NpadZ(); //iPad/2;
1577 :
1578 0 : AliDebug(3, Form("%2d %1d %2d\n", iPad, iPadZ, iPadX));
1579 :
1580 :
1581 :
1582 :
1583 :
1584 :
1585 : interestingCounter=-1;
1586 :
1587 0 : vol[4] = iPadZ , vol[3] = iPadX;
1588 0 : if (fTOFdigitMap->GetNumberOfDigits(vol)>0)
1589 0 : interestingCounter++;
1590 :
1591 0 : vol[4] = iPadZ, vol[3] = iPadX+1;
1592 0 : if (fTOFdigitMap->GetNumberOfDigits(vol)>0)
1593 0 : interestingCounter++;
1594 :
1595 0 : vol[4] = AliTOFGeometry::NpadZ()-(iPadZ+1), vol[3] = iPadX;
1596 0 : if (fTOFdigitMap->GetNumberOfDigits(vol)>0)
1597 0 : interestingCounter++;
1598 :
1599 0 : vol[4] = AliTOFGeometry::NpadZ()-(iPadZ+1), vol[3] = iPadX+1;
1600 0 : if (fTOFdigitMap->GetNumberOfDigits(vol)>0)
1601 0 : interestingCounter++;
1602 :
1603 0 : if (interestingCounter+1!=3) continue; // the hit pads have to be 3
1604 : else interestingCounter=-1;
1605 :
1606 :
1607 0 : for (ii=0; ii<kMaxNumberOfInterestingPads; ii++)
1608 0 : for (jj=0; jj<kMaxNumberOfDigitsPerVolume; jj++)
1609 0 : selectedDigit[ii][jj] = 0x0;
1610 :
1611 :
1612 0 : vol[4] = iPadZ, vol[3] = iPadX;
1613 :
1614 0 : if (fTOFdigitMap->GetNumberOfDigits(vol)>0) {
1615 : interestingCounter++;
1616 0 : for (ii=0; ii<kMaxNumberOfDigitsPerVolume; ii++)
1617 0 : digitsInVolumeIndices[ii] = -1;
1618 0 : fTOFdigitMap->GetDigitIndex(vol, digitsInVolumeIndices);
1619 : digitIndexLocal=-1;
1620 0 : for(Int_t digIndex=0; digIndex<kMaxNumberOfDigitsPerVolume; digIndex++) {
1621 0 : if (digitsInVolumeIndices[digIndex]<0) continue;
1622 0 : digitInteresting = (AliTOFdigit*)fDigits->UncheckedAt(digitsInVolumeIndices[digIndex]);
1623 0 : if (digitInteresting->GetToT()<=0) continue; // AdC
1624 0 : digitIndexLocal++; // AdC
1625 :
1626 0 : AliDebug(1,Form(" %2d %1d %2d %1d %2d %d %d %d %d %5d %5d %5d %5d",
1627 : vol[0], vol[1], vol[2] ,vol[4], vol[3],
1628 : digitInteresting->GetTdc(), digitInteresting->GetAdc(),
1629 : digitInteresting->GetToT(), digitInteresting->GetToT()*digitInteresting->GetToT(),
1630 : digitsInVolumeIndices[digIndex],
1631 : digitInteresting->GetTrack(0), digitInteresting->GetTrack(1), digitInteresting->GetTrack(2)));
1632 :
1633 0 : selectedDigit[interestingCounter][digitIndexLocal] = new // AdC
1634 0 : AliTOFselectedDigit(vol, digitInteresting->GetTdc(),
1635 0 : digitInteresting->GetAdc(), digitInteresting->GetToT(),
1636 0 : digitInteresting->GetToT()*digitInteresting->GetToT(),
1637 0 : digitsInVolumeIndices[digIndex],
1638 0 : digitInteresting->GetTracks());
1639 0 : }
1640 0 : if (digitIndexLocal==-1) interestingCounter--; // AdC
1641 : }
1642 :
1643 :
1644 0 : vol[4] = iPadZ, vol[3] = iPadX+1;
1645 :
1646 0 : if (fTOFdigitMap->GetNumberOfDigits(vol)>0) {
1647 0 : interestingCounter++;
1648 0 : for (ii=0; ii<kMaxNumberOfDigitsPerVolume; ii++)
1649 0 : digitsInVolumeIndices[ii] = -1;
1650 0 : fTOFdigitMap->GetDigitIndex(vol, digitsInVolumeIndices);
1651 : digitIndexLocal=-1; // AdC
1652 0 : for(Int_t digIndex=0; digIndex<kMaxNumberOfDigitsPerVolume; digIndex++) {
1653 0 : if (digitsInVolumeIndices[digIndex]<0) continue;
1654 0 : digitInteresting = (AliTOFdigit*)fDigits->UncheckedAt(digitsInVolumeIndices[digIndex]);
1655 0 : if (digitInteresting->GetToT()<=0) continue; // AdC
1656 0 : digitIndexLocal++; // AdC
1657 :
1658 0 : AliDebug(1,Form(" %2d %1d %2d %1d %2d %d %d %d %d %5d %5d %5d %5d",
1659 : vol[0], vol[1], vol[2] ,vol[4], vol[3],
1660 : digitInteresting->GetTdc(), digitInteresting->GetAdc(),
1661 : digitInteresting->GetToT(), digitInteresting->GetToT()*digitInteresting->GetToT(),
1662 : digitsInVolumeIndices[digIndex],
1663 : digitInteresting->GetTrack(0), digitInteresting->GetTrack(1), digitInteresting->GetTrack(2)));
1664 :
1665 0 : selectedDigit[interestingCounter][digitIndexLocal] = new // AdC
1666 0 : AliTOFselectedDigit(vol, digitInteresting->GetTdc(),
1667 0 : digitInteresting->GetAdc(), digitInteresting->GetToT(),
1668 0 : digitInteresting->GetToT()*digitInteresting->GetToT(),
1669 0 : digitsInVolumeIndices[digIndex],
1670 0 : digitInteresting->GetTracks());
1671 0 : }
1672 0 : if (digitIndexLocal==-1) interestingCounter--; // AdC
1673 : }
1674 :
1675 :
1676 0 : vol[4] = AliTOFGeometry::NpadZ()-(iPadZ+1), vol[3] = iPadX;
1677 :
1678 0 : if (fTOFdigitMap->GetNumberOfDigits(vol)>0) {
1679 0 : interestingCounter++;
1680 0 : for (ii=0; ii<kMaxNumberOfDigitsPerVolume; ii++)
1681 0 : digitsInVolumeIndices[ii] = -1;
1682 0 : fTOFdigitMap->GetDigitIndex(vol, digitsInVolumeIndices);
1683 : digitIndexLocal=-1; // AdC
1684 0 : for(Int_t digIndex=0; digIndex<kMaxNumberOfDigitsPerVolume; digIndex++) {
1685 0 : if (digitsInVolumeIndices[digIndex]<0) continue;
1686 0 : digitInteresting = (AliTOFdigit*)fDigits->UncheckedAt(digitsInVolumeIndices[digIndex]);
1687 0 : if (digitInteresting->GetToT()<=0) continue; // AdC
1688 0 : digitIndexLocal++; // AdC
1689 :
1690 0 : AliDebug(1,Form(" %2d %1d %2d %1d %2d %d %d %d %d %5d %5d %5d %5d",
1691 : vol[0], vol[1], vol[2] ,vol[4], vol[3],
1692 : digitInteresting->GetTdc(), digitInteresting->GetAdc(),
1693 : digitInteresting->GetToT(), digitInteresting->GetToT()*digitInteresting->GetToT(),
1694 : digitsInVolumeIndices[digIndex],
1695 : digitInteresting->GetTrack(0), digitInteresting->GetTrack(1), digitInteresting->GetTrack(2)));
1696 :
1697 0 : selectedDigit[interestingCounter][digitIndexLocal] = new // AdC
1698 0 : AliTOFselectedDigit(vol, digitInteresting->GetTdc(),
1699 0 : digitInteresting->GetAdc(), digitInteresting->GetToT(),
1700 0 : digitInteresting->GetToT()*digitInteresting->GetToT(),
1701 0 : digitsInVolumeIndices[digIndex],
1702 0 : digitInteresting->GetTracks());
1703 0 : }
1704 0 : if (digitIndexLocal==-1) interestingCounter--; // AdC
1705 : }
1706 :
1707 :
1708 0 : vol[4] = AliTOFGeometry::NpadZ()-(iPadZ+1), vol[3] = iPadX+1;
1709 :
1710 0 : if (fTOFdigitMap->GetNumberOfDigits(vol)>0) {
1711 0 : interestingCounter++;
1712 0 : for (ii=0; ii<kMaxNumberOfDigitsPerVolume; ii++)
1713 0 : digitsInVolumeIndices[ii] = -1;
1714 0 : fTOFdigitMap->GetDigitIndex(vol, digitsInVolumeIndices);
1715 : digitIndexLocal=-1; // AdC
1716 0 : for(Int_t digIndex=0; digIndex<kMaxNumberOfDigitsPerVolume; digIndex++) {
1717 0 : if (digitsInVolumeIndices[digIndex]<0) continue;
1718 0 : digitInteresting = (AliTOFdigit*)fDigits->UncheckedAt(digitsInVolumeIndices[digIndex]);
1719 0 : if (digitInteresting->GetToT()<=0) continue; // AdC
1720 0 : digitIndexLocal++; // AdC
1721 :
1722 0 : AliDebug(1,Form(" %2d %1d %2d %1d %2d %d %d %d %d %5d %5d %5d %5d",
1723 : vol[0], vol[1], vol[2] ,vol[4], vol[3],
1724 : digitInteresting->GetTdc(), digitInteresting->GetAdc(),
1725 : digitInteresting->GetToT(), digitInteresting->GetToT()*digitInteresting->GetToT(),
1726 : digitsInVolumeIndices[digIndex],
1727 : digitInteresting->GetTrack(0), digitInteresting->GetTrack(1), digitInteresting->GetTrack(2)));
1728 :
1729 0 : selectedDigit[interestingCounter][digitIndexLocal] = new // AdC
1730 0 : AliTOFselectedDigit(vol, digitInteresting->GetTdc(),
1731 0 : digitInteresting->GetAdc(), digitInteresting->GetToT(),
1732 0 : digitInteresting->GetToT()*digitInteresting->GetToT(),
1733 0 : digitsInVolumeIndices[digIndex],
1734 0 : digitInteresting->GetTracks());
1735 0 : }
1736 0 : if (digitIndexLocal==-1) interestingCounter--; // AdC
1737 : }
1738 :
1739 0 : AliDebug(1,Form(" e adesso %1d", interestingCounter+1));
1740 :
1741 0 : for (Int_t adesso1=0; adesso1<interestingCounter+1; adesso1++) {
1742 0 : for (Int_t firstIndex=0; firstIndex<kMaxNumberOfDigitsPerVolume; firstIndex++) {
1743 0 : if (selectedDigit[adesso1][firstIndex]==0x0) continue;
1744 :
1745 0 : for (Int_t adesso2=adesso1+1; adesso2<interestingCounter+1; adesso2++) {
1746 0 : for (Int_t secondIndex=0; secondIndex<kMaxNumberOfDigitsPerVolume; secondIndex++) {
1747 0 : if (selectedDigit[adesso2][secondIndex]==0x0) continue;
1748 :
1749 0 : if (TMath::Abs(selectedDigit[adesso1][firstIndex]->GetTDC()-selectedDigit[adesso2][secondIndex]->GetTDC())>fMaxDeltaTime) continue;
1750 :
1751 0 : interestingTOF[0] = selectedDigit[adesso1][firstIndex]->GetTDC();
1752 0 : interestingTOT[0] = selectedDigit[adesso1][firstIndex]->GetTOT();
1753 0 : interestingADC[0] = selectedDigit[adesso1][firstIndex]->GetADC();
1754 0 : interestingWeight[0] = selectedDigit[adesso1][firstIndex]->GetWeight();
1755 0 : Int_t vol1[5]; for(jj=0; jj<5; jj++) vol1[jj] = selectedDigit[adesso1][firstIndex]->GetDetectorIndex(jj);
1756 0 : AliDebug(1,Form(" %2d %1d %2d %1d %2d", vol1[0], vol1[1], vol1[2], vol1[4], vol1[3]));
1757 0 : Int_t volDum = vol1[3];
1758 0 : vol1[3] = vol1[4];
1759 0 : vol1[4] = volDum;
1760 0 : fTOFGeometry->GetPosPar(vol1,pos);
1761 0 : interestingX[0] = pos[0];
1762 0 : interestingY[0] = pos[1];
1763 0 : interestingZ[0] = pos[2];
1764 :
1765 0 : interestingTOF[1] = selectedDigit[adesso2][secondIndex]->GetTDC();
1766 0 : interestingTOT[1] = selectedDigit[adesso2][secondIndex]->GetTOT();
1767 0 : interestingADC[1] = selectedDigit[adesso2][secondIndex]->GetADC();
1768 0 : interestingWeight[1] = selectedDigit[adesso2][secondIndex]->GetWeight();
1769 0 : Int_t vol2[5]; for(jj=0; jj<5; jj++) vol2[jj] = selectedDigit[adesso2][secondIndex]->GetDetectorIndex(jj);
1770 0 : AliDebug(1,Form(" %2d %1d %2d %1d %2d", vol2[0], vol2[1], vol2[2], vol2[4], vol2[3]));
1771 0 : volDum = vol2[3];
1772 0 : vol2[3] = vol2[4];
1773 0 : vol2[4] = volDum;
1774 0 : fTOFGeometry->GetPosPar(vol2,pos);
1775 0 : interestingX[1] = pos[0];
1776 0 : interestingY[1] = pos[1];
1777 0 : interestingZ[1] = pos[2];
1778 :
1779 0 : AverageCalculations(2, interestingX, interestingY, interestingZ,
1780 0 : interestingTOF, interestingTOT, interestingADC,
1781 0 : interestingWeight,
1782 0 : parTOF, posClus, check);
1783 :
1784 0 : for (jj=0; jj<5; jj++) det[jj] = -1;
1785 0 : for (jj=0; jj<3; jj++) posF[jj] = posClus[jj];
1786 0 : fTOFGeometry->GetDetID(posF, det);
1787 :
1788 0 : volIdClus = fTOFGeometry->GetAliSensVolIndex(det[0],det[1],det[2]);
1789 : //volIdClus = GetClusterVolIndex(det);
1790 :
1791 0 : for (jj=3; jj<11; jj++) padsCluster[jj] = -1;
1792 0 : padsCluster[3] = selectedDigit[adesso1][firstIndex]->GetDetectorIndex(4);
1793 0 : padsCluster[4] = selectedDigit[adesso1][firstIndex]->GetDetectorIndex(3);
1794 0 : padsCluster[5] = selectedDigit[adesso2][secondIndex]->GetDetectorIndex(4);
1795 0 : padsCluster[6] = selectedDigit[adesso2][secondIndex]->GetDetectorIndex(3);
1796 :
1797 0 : for (jj=0; jj<6; jj++) covClus[jj] = 0.;
1798 0 : Int_t ** indDet = new Int_t*[2];
1799 0 : for (jj=0; jj<2; jj++) indDet[jj] = new Int_t [5];
1800 0 : for (jj=0; jj<2; jj++) indDet[jj][0] = nSector;
1801 0 : for (jj=0; jj<2; jj++) indDet[jj][1] = nPlate;
1802 0 : for (jj=0; jj<2; jj++) indDet[jj][2] = nStrip;
1803 0 : for (jj=0; jj<2; jj++) indDet[jj][3] = padsCluster[2*jj+3];
1804 0 : for (jj=0; jj<2; jj++) indDet[jj][4] = padsCluster[2*jj+1+3];
1805 0 : GetClusterPars(/*check,*/ 2, indDet, interestingWeight, posClus, covClus);
1806 0 : for (jj=0; jj<2; jj++) delete [] indDet[jj];
1807 0 : delete [] indDet;
1808 :
1809 : // To fill the track index array
1810 : dummyCounter=-1;
1811 0 : for (jj=0; jj<kMaxNumberOfTracksPerDigit; jj++) tracks[jj] = -1;
1812 0 : for (Int_t kk=0; kk<kMaxNumberOfTracksPerDigit; kk++) { // three is the max number of tracks associated to one digit
1813 0 : if (selectedDigit[adesso1][firstIndex]->GetTrackLabel(kk)==-1) continue;
1814 : else {
1815 0 : dummyCounter++;
1816 0 : tracks[dummyCounter] = selectedDigit[adesso1][firstIndex]->GetTrackLabel(kk);
1817 : }
1818 0 : }
1819 0 : for (Int_t kk=0; kk<kMaxNumberOfTracksPerDigit; kk++) { // three is the max number of tracks associated to one digit
1820 0 : if (selectedDigit[adesso2][secondIndex]->GetTrackLabel(kk)==-1) continue;
1821 : else {
1822 :
1823 : alreadyStored = kFALSE;
1824 0 : for (jj=0; jj<dummyCounter+1; jj++)
1825 0 : alreadyStored = alreadyStored || (tracks[jj]!=-1 && tracks[jj]==selectedDigit[adesso2][secondIndex]->GetTrackLabel(kk));
1826 :
1827 0 : if (alreadyStored) continue;
1828 0 : if (dummyCounter==2) { // three is the max number of tracks associated to one cluster
1829 0 : AliWarning(" Siamo al limite!");
1830 0 : continue;
1831 : }
1832 :
1833 : dummyCounter++;
1834 0 : tracks[dummyCounter] = selectedDigit[adesso2][secondIndex]->GetTrackLabel(kk);
1835 :
1836 : }
1837 :
1838 0 : }
1839 :
1840 :
1841 : AliTOFcluster *tofCluster =
1842 0 : new AliTOFcluster(volIdClus, posClus[0], posClus[1], posClus[2],
1843 0 : covClus[0], covClus[1], covClus[2], covClus[3], covClus[4], covClus[5],
1844 0 : tracks, det, parTOF, status, selectedDigit[adesso1][firstIndex]->GetIndex()); // to be updated
1845 0 : InsertCluster(tofCluster);
1846 :
1847 0 : AliDebug(2, Form(" %4d %f %f %f %f %f %f %f %f %f %3d %3d %3d %2d %1d %2d %1d %2d %4d %3d %3d %4d %4d %1d %4d",
1848 : volIdClus, posClus[0], posClus[1], posClus[2],
1849 : covClus[0], covClus[1], covClus[2], covClus[3], covClus[4], covClus[5],
1850 : tracks[0], tracks[1], tracks[2],
1851 : det[0], det[1], det[2], det[3], det[4],
1852 : parTOF[0], parTOF[1], parTOF[2], parTOF[3], parTOF[4],
1853 : status, selectedDigit[adesso1][firstIndex]->GetIndex()));
1854 :
1855 0 : volDum = vol1[3];
1856 0 : vol1[3] = vol1[4];
1857 0 : vol1[4] = volDum;
1858 0 : fTOFdigitMap->ResetDigitNumber(vol1,selectedDigit[adesso1][firstIndex]->GetIndex());
1859 0 : volDum = vol2[3];
1860 0 : vol2[3] = vol2[4];
1861 0 : vol2[4] = volDum;
1862 0 : fTOFdigitMap->ResetDigitNumber(vol2,selectedDigit[adesso2][secondIndex]->GetIndex());
1863 :
1864 :
1865 0 : } // close loop on second digit
1866 : } // close loop on adesso2
1867 :
1868 0 : } // close loop on first digit
1869 : } // close loop on adesso1
1870 :
1871 0 : for (ii=0; ii<kMaxNumberOfInterestingPads; ii++)
1872 0 : for (jj=0; jj<kMaxNumberOfDigitsPerVolume; jj++)
1873 0 : selectedDigit[ii][jj] = 0x0;
1874 :
1875 : } // loop on iPad
1876 :
1877 0 : for (ii=0; ii<kMaxNumberOfInterestingPads; ii++) {
1878 0 : for (jj=0; jj<kMaxNumberOfDigitsPerVolume; jj++) {
1879 0 : delete [] selectedDigit[ii][jj];
1880 0 : selectedDigit[ii][jj] = 0x0;
1881 : }
1882 0 : delete [] selectedDigit[ii];
1883 0 : selectedDigit[ii] = 0x0;
1884 : }
1885 0 : delete [] selectedDigit;
1886 : selectedDigit = 0x0;
1887 :
1888 0 : }
1889 : //_____________________________________________________________________________
1890 :
1891 : void AliTOFClusterFinderV1::FindClusters24(Int_t nSector,
1892 : Int_t nPlate,
1893 : Int_t nStrip)
1894 : {
1895 : //
1896 : // This function searches the neighbouring digits (stored in the fDigits object),
1897 : // to perform clusters (stored in the fTofClusters array).
1898 : //
1899 : // This research has been made by checking the fTOFdigitMap object,
1900 : // filled at digits/raw-data reading time.
1901 : //
1902 :
1903 : const Int_t kMaxNumberOfInterestingPads = 4;
1904 : const Int_t kMaxNumberOfTracksPerDigit = 3;
1905 : const Int_t kMaxNumberOfDigitsPerVolume = 10;
1906 :
1907 : Int_t ii = 0;
1908 :
1909 0 : Int_t digitsInVolumeIndices[kMaxNumberOfDigitsPerVolume];
1910 0 : for (ii=0; ii<kMaxNumberOfDigitsPerVolume; ii++)
1911 0 : digitsInVolumeIndices[ii] = -1;
1912 :
1913 0 : Int_t vol[5] = {nSector,nPlate,nStrip,-1,-1};
1914 :
1915 0 : Float_t pos[3] = {0.,0.,0.};
1916 :
1917 : Int_t jj = 0;
1918 0 : Int_t interestingPadX[kMaxNumberOfInterestingPads];
1919 0 : for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingPadX[jj] = -1;
1920 0 : Int_t interestingPadZ[kMaxNumberOfInterestingPads];
1921 0 : for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingPadZ[jj] = -1;
1922 0 : Double_t interestingTOT[kMaxNumberOfInterestingPads];
1923 0 : for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingTOT[jj] = 0;
1924 0 : Double_t interestingADC[kMaxNumberOfInterestingPads];
1925 0 : for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingADC[jj] = 0;
1926 0 : Double_t interestingTOF[kMaxNumberOfInterestingPads];
1927 0 : for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingTOF[jj] = 0;
1928 0 : Double_t interestingWeight[kMaxNumberOfInterestingPads];
1929 0 : for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingWeight[jj] = 0;
1930 :
1931 0 : Float_t interestingX[kMaxNumberOfInterestingPads];
1932 0 : for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingX[jj] = 0;
1933 0 : Float_t interestingY[kMaxNumberOfInterestingPads];
1934 0 : for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingY[jj] = 0;
1935 0 : Float_t interestingZ[kMaxNumberOfInterestingPads];
1936 0 : for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingZ[jj] = 0;
1937 :
1938 0 : Float_t interDigit[kMaxNumberOfInterestingPads];
1939 0 : for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interDigit[jj] = 0;
1940 :
1941 0 : Int_t padsCluster[11];
1942 0 : padsCluster[0] = nSector;
1943 0 : padsCluster[1] = nPlate;
1944 0 : padsCluster[2] = nStrip;
1945 0 : for (jj=3; jj<11; jj++) padsCluster[jj] = -1;
1946 :
1947 : Int_t interestingCounter=-1;
1948 : Int_t digitIndexLocal = -1;
1949 : Int_t iPad = -1;
1950 : Int_t iPadX = -1;
1951 : Int_t iPadZ = -1;
1952 :
1953 0 : Bool_t check = kFALSE;
1954 0 : Int_t parTOF[7];
1955 0 : for (jj=0; jj<7; jj++) parTOF[jj] = 0;
1956 0 : Double_t posClus[3];
1957 0 : for (jj=0; jj<3; jj++) posClus[jj] = 0.;
1958 0 : Int_t det[5];
1959 0 : for (jj=0; jj<5; jj++) det[jj] = -1;
1960 0 : Float_t posF[3];
1961 0 : for (jj=0; jj<3; jj++) posF[jj] = 0.;
1962 : UShort_t volIdClus = 0;
1963 : Bool_t status = kTRUE; //assume all sim channels ok in the beginning...
1964 0 : Double_t covClus[6];
1965 0 : for (jj=0; jj<6; jj++) covClus[jj] = 0.;
1966 0 : Int_t tracks[kMaxNumberOfTracksPerDigit];
1967 0 : for (jj=0; jj<kMaxNumberOfTracksPerDigit; jj++) tracks[jj] = -1;
1968 : Int_t dummyCounter=-1;
1969 : Bool_t alreadyStored = kFALSE;
1970 :
1971 0 : AliTOFselectedDigit ***selectedDigit = new AliTOFselectedDigit**[kMaxNumberOfInterestingPads];
1972 0 : for (ii=0; ii<kMaxNumberOfInterestingPads; ii++)
1973 0 : selectedDigit[ii] = new AliTOFselectedDigit*[kMaxNumberOfDigitsPerVolume];
1974 :
1975 0 : for (ii=0; ii<kMaxNumberOfInterestingPads; ii++)
1976 0 : for (jj=0; jj<kMaxNumberOfDigitsPerVolume; jj++) selectedDigit[ii][jj] = 0x0;
1977 :
1978 : AliTOFdigit *digitInteresting;
1979 :
1980 0 : for (iPad=0; iPad<AliTOFGeometry::NpadZ()*AliTOFGeometry::NpadX()-3; iPad+=2) {
1981 :
1982 0 : iPadZ = iPad%AliTOFGeometry::NpadZ(); //iPad%2;
1983 0 : iPadX = iPad/AliTOFGeometry::NpadZ(); //iPad/2;
1984 :
1985 0 : AliDebug(3, Form("%2d %1d %2d\n", iPad, iPadZ, iPadX));
1986 :
1987 :
1988 :
1989 :
1990 :
1991 :
1992 : interestingCounter=-1;
1993 :
1994 0 : vol[4] = iPadZ , vol[3] = iPadX;
1995 0 : if (fTOFdigitMap->GetNumberOfDigits(vol)>0)
1996 0 : interestingCounter++;
1997 :
1998 0 : vol[4] = iPadZ, vol[3] = iPadX+1;
1999 0 : if (fTOFdigitMap->GetNumberOfDigits(vol)>0)
2000 0 : interestingCounter++;
2001 :
2002 0 : vol[4] = AliTOFGeometry::NpadZ()-(iPadZ+1), vol[3] = iPadX;
2003 0 : if (fTOFdigitMap->GetNumberOfDigits(vol)>0)
2004 0 : interestingCounter++;
2005 :
2006 0 : vol[4] = AliTOFGeometry::NpadZ()-(iPadZ+1), vol[3] = iPadX+1;
2007 0 : if (fTOFdigitMap->GetNumberOfDigits(vol)>0)
2008 0 : interestingCounter++;
2009 :
2010 0 : if (interestingCounter+1!=4) continue; // the hit pads have to be 4
2011 : else interestingCounter=-1;
2012 :
2013 :
2014 0 : for (ii=0; ii<kMaxNumberOfInterestingPads; ii++)
2015 0 : for (jj=0; jj<kMaxNumberOfDigitsPerVolume; jj++)
2016 0 : selectedDigit[ii][jj] = 0x0;
2017 :
2018 :
2019 0 : vol[4] = iPadZ, vol[3] = iPadX;
2020 :
2021 0 : if (fTOFdigitMap->GetNumberOfDigits(vol)>0) {
2022 : interestingCounter++;
2023 0 : for (ii=0; ii<kMaxNumberOfDigitsPerVolume; ii++)
2024 0 : digitsInVolumeIndices[ii] = -1;
2025 0 : fTOFdigitMap->GetDigitIndex(vol, digitsInVolumeIndices);
2026 : digitIndexLocal=-1; // AdC
2027 0 : for(Int_t digIndex=0; digIndex<kMaxNumberOfDigitsPerVolume; digIndex++) {
2028 0 : if (digitsInVolumeIndices[digIndex]<0) continue;
2029 0 : digitInteresting = (AliTOFdigit*)fDigits->UncheckedAt(digitsInVolumeIndices[digIndex]);
2030 0 : if (digitInteresting->GetToT()<=0) continue; // AdC
2031 0 : digitIndexLocal++; // AdC
2032 :
2033 0 : AliDebug(1,Form(" %2d %1d %2d %1d %2d %d %d %d %d %5d %5d %5d %5d",
2034 : vol[0], vol[1], vol[2] ,vol[4], vol[3],
2035 : digitInteresting->GetTdc(), digitInteresting->GetAdc(),
2036 : digitInteresting->GetToT(), digitInteresting->GetToT()*digitInteresting->GetToT(),
2037 : digitsInVolumeIndices[digIndex],
2038 : digitInteresting->GetTrack(0), digitInteresting->GetTrack(1), digitInteresting->GetTrack(2)));
2039 :
2040 0 : selectedDigit[interestingCounter][digitIndexLocal] = new // AdC
2041 0 : AliTOFselectedDigit(vol, digitInteresting->GetTdc(),
2042 0 : digitInteresting->GetAdc(), digitInteresting->GetToT(),
2043 0 : digitInteresting->GetToT()*digitInteresting->GetToT(),
2044 0 : digitsInVolumeIndices[digIndex],
2045 0 : digitInteresting->GetTracks());
2046 0 : }
2047 0 : if (digitIndexLocal==-1) interestingCounter--; // AdC
2048 : }
2049 :
2050 :
2051 0 : vol[4] = iPadZ, vol[3] = iPadX+1;
2052 :
2053 0 : if (fTOFdigitMap->GetNumberOfDigits(vol)>0) {
2054 0 : interestingCounter++;
2055 0 : for (ii=0; ii<kMaxNumberOfDigitsPerVolume; ii++)
2056 0 : digitsInVolumeIndices[ii] = -1;
2057 0 : fTOFdigitMap->GetDigitIndex(vol, digitsInVolumeIndices);
2058 : digitIndexLocal=-1; // AdC
2059 0 : for(Int_t digIndex=0; digIndex<kMaxNumberOfDigitsPerVolume; digIndex++) {
2060 0 : if (digitsInVolumeIndices[digIndex]<0) continue;
2061 0 : digitInteresting = (AliTOFdigit*)fDigits->UncheckedAt(digitsInVolumeIndices[digIndex]);
2062 0 : if (digitInteresting->GetToT()<=0) continue; // AdC
2063 0 : digitIndexLocal++; // AdC
2064 :
2065 0 : AliDebug(1,Form(" %2d %1d %2d %1d %2d %d %d %d %d %5d %5d %5d %5d",
2066 : vol[0], vol[1], vol[2] ,vol[4], vol[3],
2067 : digitInteresting->GetTdc(), digitInteresting->GetAdc(),
2068 : digitInteresting->GetToT(), digitInteresting->GetToT()*digitInteresting->GetToT(),
2069 : digitsInVolumeIndices[digIndex],
2070 : digitInteresting->GetTrack(0), digitInteresting->GetTrack(1), digitInteresting->GetTrack(2)));
2071 :
2072 0 : selectedDigit[interestingCounter][digitIndexLocal] = new // AdC
2073 0 : AliTOFselectedDigit(vol, digitInteresting->GetTdc(),
2074 0 : digitInteresting->GetAdc(), digitInteresting->GetToT(),
2075 0 : digitInteresting->GetToT()*digitInteresting->GetToT(),
2076 0 : digitsInVolumeIndices[digIndex],
2077 0 : digitInteresting->GetTracks());
2078 0 : }
2079 0 : if (digitIndexLocal==-1) interestingCounter--; // AdC
2080 : }
2081 :
2082 :
2083 0 : vol[4] = AliTOFGeometry::NpadZ()-(iPadZ+1), vol[3] = iPadX;
2084 :
2085 0 : if (fTOFdigitMap->GetNumberOfDigits(vol)>0) {
2086 0 : interestingCounter++;
2087 0 : for (ii=0; ii<kMaxNumberOfDigitsPerVolume; ii++)
2088 0 : digitsInVolumeIndices[ii] = -1;
2089 0 : fTOFdigitMap->GetDigitIndex(vol, digitsInVolumeIndices);
2090 : digitIndexLocal=-1; // AdC
2091 0 : for(Int_t digIndex=0; digIndex<kMaxNumberOfDigitsPerVolume; digIndex++) {
2092 0 : if (digitsInVolumeIndices[digIndex]<0) continue;
2093 0 : digitInteresting = (AliTOFdigit*)fDigits->UncheckedAt(digitsInVolumeIndices[digIndex]);
2094 0 : if (digitInteresting->GetToT()<=0) continue; // AdC
2095 0 : digitIndexLocal++; // AdC
2096 :
2097 0 : AliDebug(1,Form(" %2d %1d %2d %1d %2d %d %d %d %d %5d %5d %5d %5d",
2098 : vol[0], vol[1], vol[2] ,vol[4], vol[3],
2099 : digitInteresting->GetTdc(), digitInteresting->GetAdc(),
2100 : digitInteresting->GetToT(), digitInteresting->GetToT()*digitInteresting->GetToT(),
2101 : digitsInVolumeIndices[digIndex],
2102 : digitInteresting->GetTrack(0), digitInteresting->GetTrack(1), digitInteresting->GetTrack(2)));
2103 :
2104 0 : selectedDigit[interestingCounter][digitIndexLocal] = new // AdC
2105 0 : AliTOFselectedDigit(vol, digitInteresting->GetTdc(),
2106 0 : digitInteresting->GetAdc(), digitInteresting->GetToT(),
2107 0 : digitInteresting->GetToT()*digitInteresting->GetToT(),
2108 0 : digitsInVolumeIndices[digIndex],
2109 0 : digitInteresting->GetTracks());
2110 0 : }
2111 0 : if (digitIndexLocal==-1) interestingCounter--; // AdC
2112 : }
2113 :
2114 :
2115 0 : vol[4] = AliTOFGeometry::NpadZ()-(iPadZ+1), vol[3] = iPadX+1;
2116 :
2117 0 : if (fTOFdigitMap->GetNumberOfDigits(vol)>0) {
2118 0 : interestingCounter++;
2119 0 : for (ii=0; ii<kMaxNumberOfDigitsPerVolume; ii++)
2120 0 : digitsInVolumeIndices[ii] = -1;
2121 0 : fTOFdigitMap->GetDigitIndex(vol, digitsInVolumeIndices);
2122 : digitIndexLocal=-1; // AdC
2123 0 : for(Int_t digIndex=0; digIndex<kMaxNumberOfDigitsPerVolume; digIndex++) {
2124 0 : if (digitsInVolumeIndices[digIndex]<0) continue;
2125 0 : digitInteresting = (AliTOFdigit*)fDigits->UncheckedAt(digitsInVolumeIndices[digIndex]);
2126 0 : if (digitInteresting->GetToT()<=0) continue; // AdC
2127 0 : digitIndexLocal++; // AdC
2128 :
2129 0 : AliDebug(1,Form(" %2d %1d %2d %1d %2d %d %d %d %d %5d %5d %5d %5d",
2130 : vol[0], vol[1], vol[2] ,vol[4], vol[3],
2131 : digitInteresting->GetTdc(), digitInteresting->GetAdc(),
2132 : digitInteresting->GetToT(), digitInteresting->GetToT()*digitInteresting->GetToT(),
2133 : digitsInVolumeIndices[digIndex],
2134 : digitInteresting->GetTrack(0), digitInteresting->GetTrack(1), digitInteresting->GetTrack(2)));
2135 :
2136 0 : selectedDigit[interestingCounter][digitIndexLocal] = new // AdC
2137 0 : AliTOFselectedDigit(vol, digitInteresting->GetTdc(),
2138 0 : digitInteresting->GetAdc(), digitInteresting->GetToT(),
2139 0 : digitInteresting->GetToT()*digitInteresting->GetToT(),
2140 0 : digitsInVolumeIndices[digIndex],
2141 0 : digitInteresting->GetTracks());
2142 0 : }
2143 0 : if (digitIndexLocal==-1) interestingCounter--; // AdC
2144 : }
2145 :
2146 0 : AliDebug(1,Form(" e adesso %1d", interestingCounter+1));
2147 :
2148 0 : for (Int_t adesso1=0; adesso1<interestingCounter+1; adesso1++) {
2149 0 : for (Int_t firstIndex=0; firstIndex<kMaxNumberOfDigitsPerVolume; firstIndex++) {
2150 0 : if (selectedDigit[adesso1][firstIndex]==0x0) continue;
2151 :
2152 0 : for (Int_t adesso2=adesso1+1; adesso2<interestingCounter+1; adesso2++) {
2153 0 : for (Int_t secondIndex=0; secondIndex<kMaxNumberOfDigitsPerVolume; secondIndex++) {
2154 0 : if (selectedDigit[adesso2][secondIndex]==0x0) continue;
2155 :
2156 0 : if (TMath::Abs(selectedDigit[adesso1][firstIndex]->GetTDC()-selectedDigit[adesso2][secondIndex]->GetTDC())>fMaxDeltaTime) continue;
2157 :
2158 0 : interestingTOF[0] = selectedDigit[adesso1][firstIndex]->GetTDC();
2159 0 : interestingTOT[0] = selectedDigit[adesso1][firstIndex]->GetTOT();
2160 0 : interestingADC[0] = selectedDigit[adesso1][firstIndex]->GetADC();
2161 0 : interestingWeight[0] = selectedDigit[adesso1][firstIndex]->GetWeight();
2162 0 : Int_t vol1[5]; for(jj=0; jj<5; jj++) vol1[jj] = selectedDigit[adesso1][firstIndex]->GetDetectorIndex(jj);
2163 0 : AliDebug(1,Form(" %2d %1d %2d %1d %2d", vol1[0], vol1[1], vol1[2], vol1[4], vol1[3]));
2164 0 : Int_t volDum = vol1[3];
2165 0 : vol1[3] = vol1[4];
2166 0 : vol1[4] = volDum;
2167 0 : fTOFGeometry->GetPosPar(vol1,pos);
2168 0 : interestingX[0] = pos[0];
2169 0 : interestingY[0] = pos[1];
2170 0 : interestingZ[0] = pos[2];
2171 :
2172 0 : interestingTOF[1] = selectedDigit[adesso2][secondIndex]->GetTDC();
2173 0 : interestingTOT[1] = selectedDigit[adesso2][secondIndex]->GetTOT();
2174 0 : interestingADC[1] = selectedDigit[adesso2][secondIndex]->GetADC();
2175 0 : interestingWeight[1] = selectedDigit[adesso2][secondIndex]->GetWeight();
2176 0 : Int_t vol2[5]; for(jj=0; jj<5; jj++) vol2[jj] = selectedDigit[adesso2][secondIndex]->GetDetectorIndex(jj);
2177 0 : AliDebug(1,Form(" %2d %1d %2d %1d %2d", vol2[0], vol2[1], vol2[2], vol2[4], vol2[3]));
2178 0 : volDum = vol2[3];
2179 0 : vol2[3] = vol2[4];
2180 0 : vol2[4] = volDum;
2181 0 : fTOFGeometry->GetPosPar(vol2,pos);
2182 0 : interestingX[1] = pos[0];
2183 0 : interestingY[1] = pos[1];
2184 0 : interestingZ[1] = pos[2];
2185 :
2186 :
2187 0 : AverageCalculations(2, interestingX, interestingY, interestingZ,
2188 0 : interestingTOF, interestingTOT, interestingADC,
2189 0 : interestingWeight,
2190 0 : parTOF, posClus, check);
2191 :
2192 0 : for (jj=0; jj<5; jj++) det[jj] = -1;
2193 0 : for (jj=0; jj<3; jj++) posF[jj] = posClus[jj];
2194 0 : fTOFGeometry->GetDetID(posF, det);
2195 :
2196 0 : volIdClus = fTOFGeometry->GetAliSensVolIndex(det[0],det[1],det[2]);
2197 : //volIdClus = GetClusterVolIndex(det);
2198 :
2199 0 : for (jj=3; jj<11; jj++) padsCluster[jj] = -1;
2200 0 : padsCluster[3] = selectedDigit[adesso1][firstIndex]->GetDetectorIndex(4);
2201 0 : padsCluster[4] = selectedDigit[adesso1][firstIndex]->GetDetectorIndex(3);
2202 0 : padsCluster[5] = selectedDigit[adesso2][secondIndex]->GetDetectorIndex(4);
2203 0 : padsCluster[6] = selectedDigit[adesso2][secondIndex]->GetDetectorIndex(3);
2204 :
2205 0 : for (jj=0; jj<6; jj++) covClus[jj] = 0.;
2206 0 : Int_t ** indDet = new Int_t*[2];
2207 0 : for (jj=0; jj<2; jj++) indDet[jj] = new Int_t [5];
2208 0 : for (jj=0; jj<2; jj++) indDet[jj][0] = nSector;
2209 0 : for (jj=0; jj<2; jj++) indDet[jj][1] = nPlate;
2210 0 : for (jj=0; jj<2; jj++) indDet[jj][2] = nStrip;
2211 0 : for (jj=0; jj<2; jj++) indDet[jj][3] = padsCluster[2*jj+3];
2212 0 : for (jj=0; jj<2; jj++) indDet[jj][4] = padsCluster[2*jj+1+3];
2213 0 : GetClusterPars(/*check,*/ 2, indDet, interestingWeight, posClus, covClus);
2214 0 : for (jj=0; jj<2; jj++) delete [] indDet[jj];
2215 0 : delete [] indDet;
2216 :
2217 : // To fill the track index array
2218 : dummyCounter=-1;
2219 0 : for (jj=0; jj<kMaxNumberOfTracksPerDigit; jj++) tracks[jj] = -1;
2220 0 : for (Int_t kk=0; kk<kMaxNumberOfTracksPerDigit; kk++) { // three is the max number of tracks associated to one digit
2221 0 : if (selectedDigit[adesso1][firstIndex]->GetTrackLabel(kk)==-1) continue;
2222 : else {
2223 0 : dummyCounter++;
2224 0 : tracks[dummyCounter] = selectedDigit[adesso1][firstIndex]->GetTrackLabel(kk);
2225 : }
2226 0 : }
2227 0 : for (Int_t kk=0; kk<kMaxNumberOfTracksPerDigit; kk++) { // three is the max number of tracks associated to one digit
2228 0 : if (selectedDigit[adesso2][secondIndex]->GetTrackLabel(kk)==-1) continue;
2229 : else {
2230 :
2231 : alreadyStored = kFALSE;
2232 0 : for (jj=0; jj<dummyCounter+1; jj++)
2233 0 : alreadyStored = alreadyStored || (tracks[jj]!=-1 && tracks[jj]==selectedDigit[adesso2][secondIndex]->GetTrackLabel(kk));
2234 :
2235 0 : if (alreadyStored) continue;
2236 0 : if (dummyCounter==2) { // three is the max number of tracks associated to one cluster
2237 0 : AliWarning(" Siamo al limite!");
2238 0 : continue;
2239 : }
2240 :
2241 : dummyCounter++;
2242 0 : tracks[dummyCounter] = selectedDigit[adesso2][secondIndex]->GetTrackLabel(kk);
2243 :
2244 : }
2245 :
2246 0 : }
2247 :
2248 :
2249 : AliTOFcluster *tofCluster =
2250 0 : new AliTOFcluster(volIdClus, posClus[0], posClus[1], posClus[2],
2251 0 : covClus[0], covClus[1], covClus[2], covClus[3], covClus[4], covClus[5],
2252 0 : tracks, det, parTOF, status, selectedDigit[adesso1][firstIndex]->GetIndex()); // to be updated
2253 0 : InsertCluster(tofCluster);
2254 :
2255 0 : AliDebug(2, Form(" %4d %f %f %f %f %f %f %f %f %f %3d %3d %3d %2d %1d %2d %1d %2d %4d %3d %3d %4d %4d %1d %4d",
2256 : volIdClus, posClus[0], posClus[1], posClus[2],
2257 : covClus[0], covClus[1], covClus[2], covClus[3], covClus[4], covClus[5],
2258 : tracks[0], tracks[1], tracks[2],
2259 : det[0], det[1], det[2], det[3], det[4],
2260 : parTOF[0], parTOF[1], parTOF[2], parTOF[3], parTOF[4],
2261 : status, selectedDigit[adesso1][firstIndex]->GetIndex()));
2262 :
2263 0 : volDum = vol1[3];
2264 0 : vol1[3] = vol1[4];
2265 0 : vol1[4] = volDum;
2266 0 : fTOFdigitMap->ResetDigitNumber(vol1,selectedDigit[adesso1][firstIndex]->GetIndex());
2267 0 : volDum = vol2[3];
2268 0 : vol2[3] = vol2[4];
2269 0 : vol2[4] = volDum;
2270 0 : fTOFdigitMap->ResetDigitNumber(vol2,selectedDigit[adesso2][secondIndex]->GetIndex());
2271 :
2272 :
2273 0 : } // close loop on second digit
2274 : } // close loop on adesso2
2275 :
2276 0 : } // close loop on first digit
2277 : } // close loop on adesso1
2278 :
2279 0 : for (ii=0; ii<kMaxNumberOfInterestingPads; ii++)
2280 0 : for (jj=0; jj<kMaxNumberOfDigitsPerVolume; jj++)
2281 0 : selectedDigit[ii][jj] = 0x0;
2282 :
2283 : } // loop on iPad
2284 :
2285 0 : for (ii=0; ii<kMaxNumberOfInterestingPads; ii++) {
2286 0 : for (jj=0; jj<kMaxNumberOfDigitsPerVolume; jj++) {
2287 0 : delete [] selectedDigit[ii][jj];
2288 0 : selectedDigit[ii][jj] = 0x0;
2289 : }
2290 0 : delete [] selectedDigit[ii];
2291 0 : selectedDigit[ii] = 0x0;
2292 : }
2293 0 : delete [] selectedDigit;
2294 : selectedDigit = 0x0;
2295 :
2296 0 : }
2297 : //_____________________________________________________________________________
2298 :
2299 : void AliTOFClusterFinderV1::FindClustersPerStrip(Int_t nSector,
2300 : Int_t nPlate,
2301 : Int_t nStrip,
2302 : Int_t group)
2303 : {
2304 : //
2305 : // This function searches the neighbouring digits (stored in the fDigits object),
2306 : // to perform clusters (stored in the fTofClusters array).
2307 : //
2308 : // Each strip is read four times:
2309 : // - 1st time: it searches possible clusters formed by four
2310 : // neighbouring digits;
2311 : // - 2nd time: it searches possible clusters formed by three
2312 : // neighbouring digits;
2313 : // - 3rd time: it searches possible clusters formed by two
2314 : // neighbouring digits;
2315 : // - 4th time: the remaining isolated digits have been transformed
2316 : // in clusters.
2317 : // This research has been made by checking the fTOFdigitMap object,
2318 : // filled at digits/raw-data reading time.
2319 : //
2320 :
2321 : const Int_t kMaxNumberOfInterestingPads = 4;
2322 : const Int_t kMaxNumberOfTracksPerDigit = 3;
2323 : const Int_t kMaxNumberOfDigitsPerVolume = 10;
2324 :
2325 : Int_t ii = 0;
2326 :
2327 0 : Int_t digitsInVolumeIndices[kMaxNumberOfDigitsPerVolume];
2328 0 : for (ii=0; ii<kMaxNumberOfDigitsPerVolume; ii++)
2329 0 : digitsInVolumeIndices[ii] = -1;
2330 :
2331 0 : Int_t vol[5] = {nSector,nPlate,nStrip,-1,-1};
2332 :
2333 0 : Float_t pos[3] = {0.,0.,0.};
2334 :
2335 : Int_t jj = 0;
2336 0 : Int_t interestingPadX[kMaxNumberOfInterestingPads];
2337 0 : for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingPadX[jj] = -1;
2338 0 : Int_t interestingPadZ[kMaxNumberOfInterestingPads];
2339 0 : for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingPadZ[jj] = -1;
2340 0 : Double_t interestingTOT[kMaxNumberOfInterestingPads];
2341 0 : for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingTOT[jj] = 0;
2342 0 : Double_t interestingADC[kMaxNumberOfInterestingPads];
2343 0 : for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingADC[jj] = 0;
2344 0 : Double_t interestingTOF[kMaxNumberOfInterestingPads];
2345 0 : for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingTOF[jj] = 0;
2346 0 : Double_t interestingWeight[kMaxNumberOfInterestingPads];
2347 0 : for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingWeight[jj] = 0;
2348 :
2349 0 : Float_t interestingX[kMaxNumberOfInterestingPads];
2350 0 : for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingX[jj] = 0;
2351 0 : Float_t interestingY[kMaxNumberOfInterestingPads];
2352 0 : for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingY[jj] = 0;
2353 0 : Float_t interestingZ[kMaxNumberOfInterestingPads];
2354 0 : for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingZ[jj] = 0;
2355 :
2356 0 : Float_t interDigit[kMaxNumberOfInterestingPads];
2357 0 : for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interDigit[jj] = 0;
2358 :
2359 0 : Int_t padsCluster[11];
2360 0 : padsCluster[0] = nSector;
2361 0 : padsCluster[1] = nPlate;
2362 0 : padsCluster[2] = nStrip;
2363 0 : for (jj=3; jj<11; jj++) padsCluster[jj] = -1;
2364 :
2365 : Int_t interestingCounter=-1;
2366 : Int_t digitIndexLocal = -1;
2367 : Int_t iPad = -1;
2368 : Int_t iPadX = -1;
2369 : Int_t iPadZ = -1;
2370 :
2371 0 : Bool_t check = kFALSE;
2372 0 : Int_t parTOF[7];
2373 0 : for (jj=0; jj<7; jj++) parTOF[jj] = 0;
2374 0 : Double_t posClus[3];
2375 0 : for (jj=0; jj<3; jj++) posClus[jj] = 0.;
2376 0 : Int_t det[5];
2377 0 : for (jj=0; jj<5; jj++) det[jj] = -1;
2378 0 : Float_t posF[3];
2379 0 : for (jj=0; jj<3; jj++) posF[jj] = 0.;
2380 : UShort_t volIdClus = 0;
2381 : Bool_t status = kTRUE; //assume all sim channels ok in the beginning...
2382 0 : Double_t covClus[6];
2383 0 : for (jj=0; jj<6; jj++) covClus[jj] = 0.;
2384 0 : Int_t tracks[kMaxNumberOfTracksPerDigit];
2385 0 : for (jj=0; jj<kMaxNumberOfTracksPerDigit; jj++) tracks[jj] = -1;
2386 : Int_t dummyCounter=-1;
2387 : Bool_t alreadyStored = kFALSE;
2388 :
2389 0 : AliTOFselectedDigit ***selectedDigit = new AliTOFselectedDigit**[kMaxNumberOfInterestingPads];
2390 0 : for (ii=0; ii<kMaxNumberOfInterestingPads; ii++)
2391 0 : selectedDigit[ii] = new AliTOFselectedDigit*[kMaxNumberOfDigitsPerVolume];
2392 :
2393 0 : for (ii=0; ii<kMaxNumberOfInterestingPads; ii++)
2394 0 : for (jj=0; jj<kMaxNumberOfDigitsPerVolume; jj++) selectedDigit[ii][jj] = 0x0;
2395 :
2396 : AliTOFdigit *digitInteresting;
2397 :
2398 0 : group = group-1;
2399 :
2400 0 : for (iPad=0; iPad<AliTOFGeometry::NpadZ()*AliTOFGeometry::NpadX()-3; iPad+=2) {
2401 :
2402 0 : iPadZ = iPad%AliTOFGeometry::NpadZ(); //iPad%2;
2403 0 : iPadX = iPad/AliTOFGeometry::NpadZ(); //iPad/2;
2404 :
2405 0 : AliDebug(3, Form("%2d %1d %2d\n", iPad, iPadZ, iPadX));
2406 :
2407 :
2408 :
2409 :
2410 :
2411 :
2412 : interestingCounter=-1;
2413 :
2414 0 : vol[4] = iPadZ , vol[3] = iPadX;
2415 0 : if (fTOFdigitMap->GetNumberOfDigits(vol)>0)
2416 0 : interestingCounter++;
2417 :
2418 0 : vol[4] = iPadZ, vol[3] = iPadX+1;
2419 0 : if (fTOFdigitMap->GetNumberOfDigits(vol)>0)
2420 0 : interestingCounter++;
2421 :
2422 0 : vol[4] = AliTOFGeometry::NpadZ()-(iPadZ+1), vol[3] = iPadX;
2423 0 : if (fTOFdigitMap->GetNumberOfDigits(vol)>0)
2424 0 : interestingCounter++;
2425 :
2426 0 : vol[4] = AliTOFGeometry::NpadZ()-(iPadZ+1), vol[3] = iPadX+1;
2427 0 : if (fTOFdigitMap->GetNumberOfDigits(vol)>0)
2428 0 : interestingCounter++;
2429 :
2430 0 : if (interestingCounter!=group) continue;
2431 : else interestingCounter=-1;
2432 :
2433 :
2434 0 : for (ii=0; ii<kMaxNumberOfInterestingPads; ii++)
2435 0 : for (jj=0; jj<kMaxNumberOfDigitsPerVolume; jj++)
2436 0 : selectedDigit[ii][jj] = 0x0;
2437 :
2438 :
2439 0 : vol[4] = iPadZ, vol[3] = iPadX;
2440 :
2441 0 : if (fTOFdigitMap->GetNumberOfDigits(vol)>0) {
2442 : interestingCounter++;
2443 0 : for (ii=0; ii<kMaxNumberOfDigitsPerVolume; ii++)
2444 0 : digitsInVolumeIndices[ii] = -1;
2445 0 : fTOFdigitMap->GetDigitIndex(vol, digitsInVolumeIndices);
2446 : digitIndexLocal=-1; // AdC
2447 0 : for(Int_t digIndex=0; digIndex<kMaxNumberOfDigitsPerVolume; digIndex++) {
2448 0 : if (digitsInVolumeIndices[digIndex]<0) continue;
2449 0 : digitInteresting = (AliTOFdigit*)fDigits->UncheckedAt(digitsInVolumeIndices[digIndex]);
2450 0 : if (digitInteresting->GetToT()<=0) continue; // AdC
2451 0 : digitIndexLocal++; // AdC
2452 :
2453 0 : AliDebug(1,Form(" %2d %1d %2d %1d %2d %d %d %d %d %5d %5d %5d %5d",
2454 : vol[0], vol[1], vol[2] ,vol[4], vol[3],
2455 : digitInteresting->GetTdc(), digitInteresting->GetAdc(),
2456 : digitInteresting->GetToT(), digitInteresting->GetToT()*digitInteresting->GetToT(),
2457 : digitsInVolumeIndices[digIndex],
2458 : digitInteresting->GetTrack(0), digitInteresting->GetTrack(1), digitInteresting->GetTrack(2)));
2459 0 : AliDebug(1,Form(" to try %d %d ",digIndex, interestingCounter));
2460 :
2461 0 : selectedDigit[interestingCounter][digitIndexLocal] = new // AdC
2462 0 : AliTOFselectedDigit(vol, digitInteresting->GetTdc(),
2463 0 : digitInteresting->GetAdc(), digitInteresting->GetToT(),
2464 0 : digitInteresting->GetToT()*digitInteresting->GetToT(),
2465 0 : digitsInVolumeIndices[digIndex],
2466 0 : digitInteresting->GetTracks());
2467 0 : }
2468 0 : if (digitIndexLocal==-1) interestingCounter--; // AdC
2469 : }
2470 :
2471 :
2472 0 : vol[4] = iPadZ, vol[3] = iPadX+1;
2473 :
2474 0 : if (fTOFdigitMap->GetNumberOfDigits(vol)>0) {
2475 0 : interestingCounter++;
2476 0 : for (ii=0; ii<kMaxNumberOfDigitsPerVolume; ii++)
2477 0 : digitsInVolumeIndices[ii] = -1;
2478 0 : fTOFdigitMap->GetDigitIndex(vol, digitsInVolumeIndices);
2479 : digitIndexLocal=-1; // AdC
2480 0 : for(Int_t digIndex=0; digIndex<kMaxNumberOfDigitsPerVolume; digIndex++) {
2481 0 : if (digitsInVolumeIndices[digIndex]<0) continue;
2482 0 : digitInteresting = (AliTOFdigit*)fDigits->UncheckedAt(digitsInVolumeIndices[digIndex]);
2483 0 : if (digitInteresting->GetToT()<=0) continue; // AdC
2484 0 : digitIndexLocal++; // AdC
2485 :
2486 0 : AliDebug(1,Form(" %2d %1d %2d %1d %2d %d %d %d %d %5d %5d %5d %5d",
2487 : vol[0], vol[1], vol[2] ,vol[4], vol[3],
2488 : digitInteresting->GetTdc(), digitInteresting->GetAdc(),
2489 : digitInteresting->GetToT(), digitInteresting->GetToT()*digitInteresting->GetToT(),
2490 : digitsInVolumeIndices[digIndex],
2491 : digitInteresting->GetTrack(0), digitInteresting->GetTrack(1), digitInteresting->GetTrack(2)));
2492 0 : AliDebug(1,Form(" to try %d %d ",digIndex, interestingCounter));
2493 :
2494 0 : selectedDigit[interestingCounter][digitIndexLocal] = new // AdC
2495 0 : AliTOFselectedDigit(vol, digitInteresting->GetTdc(),
2496 0 : digitInteresting->GetAdc(), digitInteresting->GetToT(),
2497 0 : digitInteresting->GetToT()*digitInteresting->GetToT(),
2498 0 : digitsInVolumeIndices[digIndex],
2499 0 : digitInteresting->GetTracks());
2500 0 : }
2501 0 : if (digitIndexLocal==-1) interestingCounter--; // AdC
2502 : }
2503 :
2504 :
2505 0 : vol[4] = AliTOFGeometry::NpadZ()-(iPadZ+1), vol[3] = iPadX;
2506 :
2507 0 : if (fTOFdigitMap->GetNumberOfDigits(vol)>0) {
2508 0 : interestingCounter++;
2509 0 : for (ii=0; ii<kMaxNumberOfDigitsPerVolume; ii++)
2510 0 : digitsInVolumeIndices[ii] = -1;
2511 0 : fTOFdigitMap->GetDigitIndex(vol, digitsInVolumeIndices);
2512 : digitIndexLocal=-1; // AdC
2513 0 : for(Int_t digIndex=0; digIndex<kMaxNumberOfDigitsPerVolume; digIndex++) {
2514 0 : if (digitsInVolumeIndices[digIndex]<0) continue;
2515 0 : digitInteresting = (AliTOFdigit*)fDigits->UncheckedAt(digitsInVolumeIndices[digIndex]);
2516 0 : if (digitInteresting->GetToT()<=0) continue; // AdC
2517 0 : digitIndexLocal++; // AdC
2518 :
2519 0 : AliDebug(1,Form(" %2d %1d %2d %1d %2d %d %d %d %d %5d %5d %5d %5d",
2520 : vol[0], vol[1], vol[2] ,vol[4], vol[3],
2521 : digitInteresting->GetTdc(), digitInteresting->GetAdc(),
2522 : digitInteresting->GetToT(), digitInteresting->GetToT()*digitInteresting->GetToT(),
2523 : digitsInVolumeIndices[digIndex],
2524 : digitInteresting->GetTrack(0), digitInteresting->GetTrack(1), digitInteresting->GetTrack(2)));
2525 0 : AliDebug(1,Form(" to try %d %d ",digIndex, interestingCounter));
2526 :
2527 0 : selectedDigit[interestingCounter][digitIndexLocal] = new // AdC
2528 0 : AliTOFselectedDigit(vol, digitInteresting->GetTdc(),
2529 0 : digitInteresting->GetAdc(), digitInteresting->GetToT(),
2530 0 : digitInteresting->GetToT()*digitInteresting->GetToT(),
2531 0 : digitsInVolumeIndices[digIndex],
2532 0 : digitInteresting->GetTracks());
2533 0 : }
2534 0 : if (digitIndexLocal==-1) interestingCounter--; // AdC
2535 : }
2536 :
2537 :
2538 0 : vol[4] = AliTOFGeometry::NpadZ()-(iPadZ+1), vol[3] = iPadX+1;
2539 :
2540 0 : if (fTOFdigitMap->GetNumberOfDigits(vol)>0) {
2541 0 : interestingCounter++;
2542 0 : for (ii=0; ii<kMaxNumberOfDigitsPerVolume; ii++)
2543 0 : digitsInVolumeIndices[ii] = -1;
2544 0 : fTOFdigitMap->GetDigitIndex(vol, digitsInVolumeIndices);
2545 : digitIndexLocal=-1; // AdC
2546 0 : for(Int_t digIndex=0; digIndex<kMaxNumberOfDigitsPerVolume; digIndex++) {
2547 0 : if (digitsInVolumeIndices[digIndex]<0) continue;
2548 0 : digitInteresting = (AliTOFdigit*)fDigits->UncheckedAt(digitsInVolumeIndices[digIndex]);
2549 0 : if (digitInteresting->GetToT()<=0) continue; // AdC
2550 0 : digitIndexLocal++; // AdC
2551 :
2552 0 : AliDebug(1,Form(" %2d %1d %2d %1d %2d %d %d %d %d %5d %5d %5d %5d",
2553 : vol[0], vol[1], vol[2] ,vol[4], vol[3],
2554 : digitInteresting->GetTdc(), digitInteresting->GetAdc(),
2555 : digitInteresting->GetToT(), digitInteresting->GetToT()*digitInteresting->GetToT(),
2556 : digitsInVolumeIndices[digIndex],
2557 : digitInteresting->GetTrack(0), digitInteresting->GetTrack(1), digitInteresting->GetTrack(2)));
2558 0 : AliDebug(1,Form(" to try %d %d ",digIndex, interestingCounter));
2559 :
2560 0 : selectedDigit[interestingCounter][digitIndexLocal] = new // AdC
2561 0 : AliTOFselectedDigit(vol, digitInteresting->GetTdc(),
2562 0 : digitInteresting->GetAdc(), digitInteresting->GetToT(),
2563 0 : digitInteresting->GetToT()*digitInteresting->GetToT(),
2564 0 : digitsInVolumeIndices[digIndex],
2565 0 : digitInteresting->GetTracks());
2566 0 : }
2567 0 : if (digitIndexLocal==-1) interestingCounter--; // AdC
2568 : }
2569 :
2570 0 : AliDebug(1,Form(" e adesso %1d", interestingCounter+1));
2571 :
2572 : Int_t adesso1 = -1;
2573 : Int_t adesso2 = -1;
2574 : Int_t adesso3 = -1;
2575 : Int_t adesso4 = -1;
2576 :
2577 0 : switch(interestingCounter+1) {
2578 :
2579 : case 2:
2580 :
2581 : //for (adesso1=0; adesso1<interestingCounter+1; adesso1++) {
2582 : adesso1 = 0;
2583 0 : for (Int_t firstIndex=0; firstIndex<kMaxNumberOfDigitsPerVolume; firstIndex++) {
2584 0 : if (selectedDigit[adesso1][firstIndex]==0x0) continue;
2585 :
2586 : //for (adesso2=adesso1+1; adesso2<interestingCounter+1; adesso2++) {
2587 : adesso2 = 1;
2588 0 : for (Int_t secondIndex=0; secondIndex<kMaxNumberOfDigitsPerVolume; secondIndex++) {
2589 0 : if (selectedDigit[adesso2][secondIndex]==0x0) continue;
2590 :
2591 0 : if (TMath::Abs(selectedDigit[adesso1][firstIndex]->GetTDC()-selectedDigit[adesso2][secondIndex]->GetTDC())>fMaxDeltaTime) {
2592 0 : AliDebug(1,Form(" selD1[%d][%d]->GetTDC()=%d selD2[%d][%d]->GetTDC()=%d -- %d ",
2593 : adesso1,firstIndex,(Int_t)selectedDigit[adesso1][firstIndex]->GetTDC(),
2594 : adesso2,secondIndex,(Int_t)selectedDigit[adesso2][secondIndex]->GetTDC(),
2595 : fMaxDeltaTime));
2596 : continue;
2597 : }
2598 :
2599 0 : AliDebug(1, Form(" %1d %1d (0x%p) %1d %1d (0x%p)", adesso1, firstIndex,selectedDigit[adesso1][firstIndex],
2600 : adesso2, secondIndex,selectedDigit[adesso2][secondIndex]));
2601 :
2602 0 : interestingTOF[0] = selectedDigit[adesso1][firstIndex]->GetTDC();
2603 0 : interestingTOT[0] = selectedDigit[adesso1][firstIndex]->GetTOT();
2604 0 : interestingADC[0] = selectedDigit[adesso1][firstIndex]->GetADC();
2605 0 : interestingWeight[0] = selectedDigit[adesso1][firstIndex]->GetWeight();
2606 0 : Int_t vol1[5]; for(jj=0; jj<5; jj++) vol1[jj] = selectedDigit[adesso1][firstIndex]->GetDetectorIndex(jj);
2607 0 : AliDebug(1,Form(" %2d %1d %2d %1d %2d", vol1[0], vol1[1], vol1[2], vol1[4], vol1[3]));
2608 0 : Int_t volDum = vol1[3];
2609 0 : vol1[3] = vol1[4];
2610 0 : vol1[4] = volDum;
2611 0 : fTOFGeometry->GetPosPar(vol1,pos);
2612 0 : AliDebug(1,Form(" %f %f %f", pos[0], pos[1], pos[2]));
2613 0 : interestingX[0] = pos[0];
2614 0 : interestingY[0] = pos[1];
2615 0 : interestingZ[0] = pos[2];
2616 :
2617 0 : interestingTOF[1] = selectedDigit[adesso2][secondIndex]->GetTDC();
2618 0 : interestingTOT[1] = selectedDigit[adesso2][secondIndex]->GetTOT();
2619 0 : interestingADC[1] = selectedDigit[adesso2][secondIndex]->GetADC();
2620 0 : interestingWeight[1] = selectedDigit[adesso2][secondIndex]->GetWeight();
2621 0 : Int_t vol2[5]; for(jj=0; jj<5; jj++) vol2[jj] = selectedDigit[adesso2][secondIndex]->GetDetectorIndex(jj);
2622 0 : AliDebug(1,Form(" %2d %1d %2d %1d %2d", vol2[0], vol2[1], vol2[2], vol2[4], vol2[3]));
2623 0 : volDum = vol2[3];
2624 0 : vol2[3] = vol2[4];
2625 0 : vol2[4] = volDum;
2626 0 : fTOFGeometry->GetPosPar(vol2,pos);
2627 0 : AliDebug(1,Form(" %f %f %f", pos[0], pos[1], pos[2]));
2628 0 : interestingX[1] = pos[0];
2629 0 : interestingY[1] = pos[1];
2630 0 : interestingZ[1] = pos[2];
2631 :
2632 :
2633 0 : AverageCalculations(interestingCounter+1,
2634 0 : interestingX, interestingY, interestingZ,
2635 0 : interestingTOF, interestingTOT, interestingADC,
2636 0 : interestingWeight,
2637 0 : parTOF, posClus, check);
2638 :
2639 0 : for (jj=0; jj<5; jj++) det[jj] = -1;
2640 0 : for (jj=0; jj<3; jj++) posF[jj] = posClus[jj];
2641 :
2642 0 : AliDebug(1,Form(" %f %f %f", posF[0], posF[1], posF[2]));
2643 0 : fTOFGeometry->GetDetID(posF, det);
2644 0 : AliDebug(1,Form(" %2d %1d %2d %1d %2d", det[0], det[1], det[2], det[3], det[4]));
2645 :
2646 0 : volIdClus = fTOFGeometry->GetAliSensVolIndex(det[0],det[1],det[2]);
2647 : //volIdClus = GetClusterVolIndex(det);
2648 :
2649 0 : for (jj=3; jj<11; jj++) padsCluster[jj] = -1;
2650 0 : padsCluster[3] = selectedDigit[adesso1][firstIndex]->GetDetectorIndex(4);
2651 0 : padsCluster[4] = selectedDigit[adesso1][firstIndex]->GetDetectorIndex(3);
2652 0 : padsCluster[5] = selectedDigit[adesso2][secondIndex]->GetDetectorIndex(4);
2653 0 : padsCluster[6] = selectedDigit[adesso2][secondIndex]->GetDetectorIndex(3);
2654 :
2655 0 : for (jj=0; jj<6; jj++) covClus[jj] = 0.;
2656 0 : Int_t ** indDet = new Int_t*[interestingCounter+1];
2657 0 : for (jj=0; jj<interestingCounter+1; jj++) indDet[jj] = new Int_t [5];
2658 0 : for (jj=0; jj<interestingCounter+1; jj++) indDet[jj][0] = nSector;
2659 0 : for (jj=0; jj<interestingCounter+1; jj++) indDet[jj][1] = nPlate;
2660 0 : for (jj=0; jj<interestingCounter+1; jj++) indDet[jj][2] = nStrip;
2661 0 : for (jj=0; jj<interestingCounter+1; jj++) indDet[jj][3] = padsCluster[2*jj+3];
2662 0 : for (jj=0; jj<interestingCounter+1; jj++) indDet[jj][4] = padsCluster[2*jj+1+3];
2663 0 : GetClusterPars(/*check,*/ interestingCounter+1, indDet, interestingWeight, posClus, covClus);
2664 0 : for (jj=0; jj<interestingCounter+1; jj++) delete [] indDet[jj];
2665 0 : delete [] indDet;
2666 :
2667 : // To fill the track index array
2668 : dummyCounter=-1;
2669 0 : for (jj=0; jj<kMaxNumberOfTracksPerDigit; jj++) tracks[jj] = -1;
2670 0 : for (Int_t kk=0; kk<kMaxNumberOfTracksPerDigit; kk++) { // three is the max number of tracks associated to one digit
2671 0 : if (selectedDigit[adesso1][firstIndex]->GetTrackLabel(kk)==-1) continue;
2672 : else {
2673 0 : dummyCounter++;
2674 0 : tracks[dummyCounter] = selectedDigit[adesso1][firstIndex]->GetTrackLabel(kk);
2675 : }
2676 0 : }
2677 0 : for (Int_t kk=0; kk<kMaxNumberOfTracksPerDigit; kk++) { // three is the max number of tracks associated to one digit
2678 0 : if (selectedDigit[adesso2][secondIndex]->GetTrackLabel(kk)==-1) continue;
2679 : else {
2680 :
2681 : alreadyStored = kFALSE;
2682 0 : for (jj=0; jj<dummyCounter+1; jj++)
2683 0 : alreadyStored = alreadyStored || (tracks[jj]!=-1 && tracks[jj]==selectedDigit[adesso2][secondIndex]->GetTrackLabel(kk));
2684 :
2685 0 : if (alreadyStored) continue;
2686 0 : if (dummyCounter==2) { // three is the max number of tracks associated to one cluster
2687 0 : AliWarning(" Siamo al limite!");
2688 0 : continue;
2689 : }
2690 :
2691 : dummyCounter++;
2692 0 : tracks[dummyCounter] = selectedDigit[adesso2][secondIndex]->GetTrackLabel(kk);
2693 :
2694 : }
2695 :
2696 0 : }
2697 :
2698 :
2699 : AliTOFcluster *tofCluster =
2700 0 : new AliTOFcluster(volIdClus, posClus[0], posClus[1], posClus[2],
2701 0 : covClus[0], covClus[1], covClus[2], covClus[3], covClus[4], covClus[5],
2702 0 : tracks, det, parTOF, status, selectedDigit[adesso1][firstIndex]->GetIndex()); //to updated
2703 0 : InsertCluster(tofCluster);
2704 :
2705 0 : AliDebug(2, Form(" %4d %f %f %f %f %f %f %f %f %f %3d %3d %3d %2d %1d %2d %1d %2d %4d %3d %3d %4d %4d %1d %4d",
2706 : volIdClus, posClus[0], posClus[1], posClus[2],
2707 : covClus[0], covClus[1], covClus[2], covClus[3], covClus[4], covClus[5],
2708 : tracks[0], tracks[1], tracks[2],
2709 : det[0], det[1], det[2], det[3], det[4],
2710 : parTOF[0], parTOF[1], parTOF[2], parTOF[3], parTOF[4],
2711 : status, selectedDigit[adesso1][firstIndex]->GetIndex()));
2712 :
2713 0 : volDum = vol1[3];
2714 0 : vol1[3] = vol1[4];
2715 0 : vol1[4] = volDum;
2716 0 : fTOFdigitMap->ResetDigitNumber(vol1,selectedDigit[adesso1][firstIndex]->GetIndex());
2717 0 : volDum = vol2[3];
2718 0 : vol2[3] = vol2[4];
2719 0 : vol2[4] = volDum;
2720 0 : fTOFdigitMap->ResetDigitNumber(vol2,selectedDigit[adesso2][secondIndex]->GetIndex());
2721 :
2722 :
2723 0 : } // close loop on second digit
2724 : //} // close loop on adesso2
2725 :
2726 0 : } // close loop on first digit
2727 : //} // close loop on adesso1
2728 :
2729 :
2730 0 : break;
2731 :
2732 : case 3:
2733 :
2734 : //for (adesso1=0; adesso1<interestingCounter+1; adesso1++) {
2735 : adesso1 = 0;
2736 0 : for (Int_t firstIndex=0; firstIndex<kMaxNumberOfDigitsPerVolume; firstIndex++) {
2737 0 : if (selectedDigit[adesso1][firstIndex]==0x0) continue;
2738 :
2739 : //for (adesso2=adesso1+1; adesso2<interestingCounter+1; adesso2++) {
2740 : adesso2 = 1;
2741 0 : for (Int_t secondIndex=0; secondIndex<kMaxNumberOfDigitsPerVolume; secondIndex++) {
2742 0 : if (selectedDigit[adesso2][secondIndex]==0x0) continue;
2743 :
2744 : //for (adesso3=adesso2+1; adesso3<interestingCounter+1; adesso3++) {
2745 : adesso3 = 2;
2746 0 : for (Int_t thirdIndex=0; thirdIndex<kMaxNumberOfDigitsPerVolume; thirdIndex++) {
2747 0 : if (selectedDigit[adesso3][thirdIndex]==0x0) continue;
2748 :
2749 :
2750 0 : if (TMath::Abs(selectedDigit[adesso1][firstIndex]->GetTDC()-selectedDigit[adesso2][secondIndex]->GetTDC())>fMaxDeltaTime
2751 0 : ||
2752 0 : TMath::Abs(selectedDigit[adesso1][firstIndex]->GetTDC()-selectedDigit[adesso3][thirdIndex]->GetTDC())>fMaxDeltaTime
2753 0 : ||
2754 0 : TMath::Abs(selectedDigit[adesso2][secondIndex]->GetTDC()-selectedDigit[adesso3][thirdIndex]->GetTDC())>fMaxDeltaTime) continue;
2755 :
2756 0 : interestingTOF[0] = selectedDigit[adesso1][firstIndex]->GetTDC();
2757 0 : interestingTOT[0] = selectedDigit[adesso1][firstIndex]->GetTOT();
2758 0 : interestingADC[0] = selectedDigit[adesso1][firstIndex]->GetADC();
2759 0 : interestingWeight[0] = selectedDigit[adesso1][firstIndex]->GetWeight();
2760 0 : Int_t vol1[5]; for(jj=0; jj<5; jj++) vol1[jj] = selectedDigit[adesso1][firstIndex]->GetDetectorIndex(jj);
2761 0 : AliDebug(1,Form(" %2d %1d %2d %1d %2d", vol1[0], vol1[1], vol1[2], vol1[4], vol1[3]));
2762 0 : Int_t volDum = vol1[3];
2763 0 : vol1[3] = vol1[4];
2764 0 : vol1[4] = volDum;
2765 0 : fTOFGeometry->GetPosPar(vol1,pos);
2766 0 : interestingX[0] = pos[0];
2767 0 : interestingY[0] = pos[1];
2768 0 : interestingZ[0] = pos[2];
2769 :
2770 0 : interestingTOF[1] = selectedDigit[adesso2][secondIndex]->GetTDC();
2771 0 : interestingTOT[1] = selectedDigit[adesso2][secondIndex]->GetTOT();
2772 0 : interestingADC[1] = selectedDigit[adesso2][secondIndex]->GetADC();
2773 0 : interestingWeight[1] = selectedDigit[adesso2][secondIndex]->GetWeight();
2774 0 : Int_t vol2[5]; for(jj=0; jj<5; jj++) vol2[jj] = selectedDigit[adesso2][secondIndex]->GetDetectorIndex(jj);
2775 0 : AliDebug(1,Form(" %2d %1d %2d %1d %2d", vol2[0], vol2[1], vol2[2], vol2[4], vol2[3]));
2776 0 : volDum = vol2[3];
2777 0 : vol2[3] = vol2[4];
2778 0 : vol2[4] = volDum;
2779 0 : fTOFGeometry->GetPosPar(vol2,pos);
2780 0 : interestingX[1] = pos[0];
2781 0 : interestingY[1] = pos[1];
2782 0 : interestingZ[1] = pos[2];
2783 :
2784 0 : interestingTOF[2] = selectedDigit[adesso3][thirdIndex]->GetTDC();
2785 0 : interestingTOT[2] = selectedDigit[adesso3][thirdIndex]->GetTOT();
2786 0 : interestingADC[2] = selectedDigit[adesso3][thirdIndex]->GetADC();
2787 0 : interestingWeight[2] = selectedDigit[adesso3][thirdIndex]->GetWeight();
2788 0 : Int_t vol3[5]; for(jj=0; jj<5; jj++) vol3[jj] = selectedDigit[adesso3][thirdIndex]->GetDetectorIndex(jj);
2789 0 : AliDebug(1,Form(" %2d %1d %2d %1d %2d", vol3[0], vol3[1], vol3[2], vol3[4], vol3[3]));
2790 0 : volDum = vol3[3];
2791 0 : vol3[3] = vol3[4];
2792 0 : vol3[4] = volDum;
2793 0 : fTOFGeometry->GetPosPar(vol3,pos);
2794 0 : interestingX[2] = pos[0];
2795 0 : interestingY[2] = pos[1];
2796 0 : interestingZ[2] = pos[2];
2797 :
2798 :
2799 0 : AverageCalculations(interestingCounter+1,
2800 0 : interestingX, interestingY, interestingZ,
2801 0 : interestingTOF, interestingTOT, interestingADC,
2802 0 : interestingWeight,
2803 0 : parTOF, posClus, check);
2804 :
2805 0 : for (jj=0; jj<5; jj++) det[jj] = -1;
2806 0 : for (jj=0; jj<3; jj++) posF[jj] = posClus[jj];
2807 0 : fTOFGeometry->GetDetID(posF, det);
2808 :
2809 0 : volIdClus = fTOFGeometry->GetAliSensVolIndex(det[0],det[1],det[2]);
2810 : //volIdClus = GetClusterVolIndex(det);
2811 :
2812 0 : for (jj=3; jj<11; jj++) padsCluster[jj] = -1;
2813 0 : padsCluster[3] = selectedDigit[adesso1][firstIndex]->GetDetectorIndex(4);
2814 0 : padsCluster[4] = selectedDigit[adesso1][firstIndex]->GetDetectorIndex(3);
2815 0 : padsCluster[5] = selectedDigit[adesso2][secondIndex]->GetDetectorIndex(4);
2816 0 : padsCluster[6] = selectedDigit[adesso2][secondIndex]->GetDetectorIndex(3);
2817 0 : padsCluster[7] = selectedDigit[adesso3][thirdIndex]->GetDetectorIndex(4);
2818 0 : padsCluster[8] = selectedDigit[adesso3][thirdIndex]->GetDetectorIndex(3);
2819 :
2820 0 : for (jj=0; jj<6; jj++) covClus[jj] = 0.;
2821 0 : Int_t ** indDet = new Int_t*[interestingCounter+1];
2822 0 : for (jj=0; jj<interestingCounter+1; jj++) indDet[jj] = new Int_t [5];
2823 0 : for (jj=0; jj<interestingCounter+1; jj++) indDet[jj][0] = nSector;
2824 0 : for (jj=0; jj<interestingCounter+1; jj++) indDet[jj][1] = nPlate;
2825 0 : for (jj=0; jj<interestingCounter+1; jj++) indDet[jj][2] = nStrip;
2826 0 : for (jj=0; jj<interestingCounter+1; jj++) indDet[jj][3] = padsCluster[2*jj+3];
2827 0 : for (jj=0; jj<interestingCounter+1; jj++) indDet[jj][4] = padsCluster[2*jj+1+3];
2828 0 : GetClusterPars(/*check,*/ interestingCounter+1, indDet, interestingWeight, posClus, covClus);
2829 0 : for (jj=0; jj<interestingCounter+1; jj++) delete [] indDet[jj];
2830 0 : delete [] indDet;
2831 :
2832 :
2833 : // To fill the track index array
2834 : dummyCounter=-1;
2835 0 : for (jj=0; jj<kMaxNumberOfTracksPerDigit; jj++) tracks[jj] = -1;
2836 0 : for (Int_t kk=0; kk<kMaxNumberOfTracksPerDigit; kk++) { // three is the max number of tracks associated to one digit
2837 0 : if (selectedDigit[adesso1][firstIndex]->GetTrackLabel(kk)==-1) continue;
2838 : else {
2839 0 : dummyCounter++;
2840 0 : tracks[dummyCounter] = selectedDigit[adesso1][firstIndex]->GetTrackLabel(kk);
2841 : }
2842 0 : }
2843 0 : for (Int_t kk=0; kk<kMaxNumberOfTracksPerDigit; kk++) { // three is the max number of tracks associated to one digit
2844 0 : if (selectedDigit[adesso2][secondIndex]->GetTrackLabel(kk)==-1) continue;
2845 : else {
2846 :
2847 : alreadyStored = kFALSE;
2848 0 : for (jj=0; jj<dummyCounter+1; jj++)
2849 0 : alreadyStored = alreadyStored || (tracks[jj]!=-1 && tracks[jj]==selectedDigit[adesso2][secondIndex]->GetTrackLabel(kk));
2850 :
2851 0 : if (alreadyStored) continue;
2852 0 : if (dummyCounter==2) { // three is the max number of tracks associated to one cluster
2853 0 : AliWarning(" Siamo al limite!");
2854 0 : continue;
2855 : }
2856 :
2857 : dummyCounter++;
2858 0 : tracks[dummyCounter] = selectedDigit[adesso2][secondIndex]->GetTrackLabel(kk);
2859 :
2860 : }
2861 :
2862 0 : }
2863 0 : for (Int_t kk=0; kk<kMaxNumberOfTracksPerDigit; kk++) { // three is the max number of tracks associated to one digit
2864 0 : if (selectedDigit[adesso3][thirdIndex]->GetTrackLabel(kk)==-1) continue;
2865 : else {
2866 :
2867 : alreadyStored = kFALSE;
2868 0 : for (jj=0; jj<dummyCounter+1; jj++)
2869 0 : alreadyStored = alreadyStored || (tracks[jj]!=-1 && tracks[jj]==selectedDigit[adesso3][thirdIndex]->GetTrackLabel(kk));
2870 :
2871 0 : if (alreadyStored) continue;
2872 0 : if (dummyCounter==2) { // three is the max number of tracks associated to one cluster
2873 0 : AliWarning(" Siamo al limite!");
2874 0 : continue;
2875 : }
2876 :
2877 : dummyCounter++;
2878 0 : tracks[dummyCounter] = selectedDigit[adesso3][thirdIndex]->GetTrackLabel(kk);
2879 :
2880 : }
2881 :
2882 0 : }
2883 :
2884 :
2885 : AliTOFcluster *tofCluster =
2886 0 : new AliTOFcluster(volIdClus, posClus[0], posClus[1], posClus[2],
2887 0 : covClus[0], covClus[1], covClus[2], covClus[3], covClus[4], covClus[5],
2888 0 : tracks, det, parTOF, status, selectedDigit[adesso1][firstIndex]->GetIndex()); // to be updated
2889 0 : InsertCluster(tofCluster);
2890 :
2891 0 : AliDebug(2, Form(" %4d %f %f %f %f %f %f %f %f %f %3d %3d %3d %2d %1d %2d %1d %2d %4d %3d %3d %4d %4d %1d %4d",
2892 : volIdClus, posClus[0], posClus[1], posClus[2],
2893 : covClus[0], covClus[1], covClus[2], covClus[3], covClus[4], covClus[5],
2894 : tracks[0], tracks[1], tracks[2],
2895 : det[0], det[1], det[2], det[3], det[4],
2896 : parTOF[0], parTOF[1], parTOF[2], parTOF[3], parTOF[4],
2897 : status, selectedDigit[adesso1][firstIndex]->GetIndex()));
2898 :
2899 0 : volDum = vol1[3];
2900 0 : vol1[3] = vol1[4];
2901 0 : vol1[4] = volDum;
2902 0 : fTOFdigitMap->ResetDigitNumber(vol1,selectedDigit[adesso1][firstIndex]->GetIndex());
2903 0 : volDum = vol2[3];
2904 0 : vol2[3] = vol2[4];
2905 0 : vol2[4] = volDum;
2906 0 : fTOFdigitMap->ResetDigitNumber(vol2,selectedDigit[adesso2][secondIndex]->GetIndex());
2907 0 : volDum = vol3[3];
2908 0 : vol3[3] = vol3[4];
2909 0 : vol3[4] = volDum;
2910 0 : fTOFdigitMap->ResetDigitNumber(vol3,selectedDigit[adesso3][thirdIndex]->GetIndex());
2911 :
2912 :
2913 0 : } // close loop on third digit
2914 : //} // close loop on adesso3
2915 :
2916 0 : } // close loop on second digit
2917 : //} // close loop on adesso2
2918 :
2919 0 : } // close loop on first digit
2920 : //} // close loop on adesso1
2921 :
2922 :
2923 0 : break;
2924 :
2925 : case 4:
2926 :
2927 : adesso1 = 0;
2928 0 : for (Int_t firstIndex=0; firstIndex<kMaxNumberOfDigitsPerVolume; firstIndex++) {
2929 0 : if (selectedDigit[adesso1][firstIndex]==0x0) continue;
2930 :
2931 : adesso2 = 1;
2932 0 : for (Int_t secondIndex=0; secondIndex<kMaxNumberOfDigitsPerVolume; secondIndex++) {
2933 0 : if (selectedDigit[adesso2][secondIndex]==0x0) continue;
2934 :
2935 : adesso3 = 2;
2936 0 : for (Int_t thirdIndex=0; thirdIndex<kMaxNumberOfDigitsPerVolume; thirdIndex++) {
2937 0 : if (selectedDigit[adesso3][thirdIndex]==0x0) continue;
2938 :
2939 : adesso4 = 3;
2940 0 : for (Int_t fourthIndex=0; fourthIndex<kMaxNumberOfDigitsPerVolume; fourthIndex++) {
2941 0 : if (selectedDigit[adesso4][fourthIndex]==0x0) continue;
2942 :
2943 :
2944 0 : if (TMath::Abs(selectedDigit[adesso1][firstIndex]->GetTDC()-selectedDigit[adesso2][secondIndex]->GetTDC())>fMaxDeltaTime
2945 0 : ||
2946 0 : TMath::Abs(selectedDigit[adesso1][firstIndex]->GetTDC()-selectedDigit[adesso3][thirdIndex]->GetTDC())>fMaxDeltaTime
2947 0 : ||
2948 0 : TMath::Abs(selectedDigit[adesso1][firstIndex]->GetTDC()-selectedDigit[adesso4][fourthIndex]->GetTDC())>fMaxDeltaTime
2949 0 : ||
2950 0 : TMath::Abs(selectedDigit[adesso2][secondIndex]->GetTDC()-selectedDigit[adesso3][thirdIndex]->GetTDC())>fMaxDeltaTime
2951 0 : ||
2952 0 : TMath::Abs(selectedDigit[adesso2][secondIndex]->GetTDC()-selectedDigit[adesso4][fourthIndex]->GetTDC())>fMaxDeltaTime
2953 0 : ||
2954 0 : TMath::Abs(selectedDigit[adesso3][thirdIndex]->GetTDC()-selectedDigit[adesso4][fourthIndex]->GetTDC())>fMaxDeltaTime) continue;
2955 :
2956 0 : interestingTOF[0] = selectedDigit[adesso1][firstIndex]->GetTDC();
2957 0 : interestingTOT[0] = selectedDigit[adesso1][firstIndex]->GetTOT();
2958 0 : interestingADC[0] = selectedDigit[adesso1][firstIndex]->GetADC();
2959 0 : interestingWeight[0] = selectedDigit[adesso1][firstIndex]->GetWeight();
2960 0 : Int_t vol1[5]; for(jj=0; jj<5; jj++) vol1[jj] = selectedDigit[adesso1][firstIndex]->GetDetectorIndex(jj);
2961 0 : AliDebug(1,Form(" %2d %1d %2d %1d %2d", vol1[0], vol1[1], vol1[2], vol1[4], vol1[3]));
2962 0 : Int_t volDum = vol1[3];
2963 0 : vol1[3] = vol1[4];
2964 0 : vol1[4] = volDum;
2965 0 : fTOFGeometry->GetPosPar(vol1,pos);
2966 0 : interestingX[0] = pos[0];
2967 0 : interestingY[0] = pos[1];
2968 0 : interestingZ[0] = pos[2];
2969 :
2970 0 : interestingTOF[1] = selectedDigit[adesso2][secondIndex]->GetTDC();
2971 0 : interestingTOT[1] = selectedDigit[adesso2][secondIndex]->GetTOT();
2972 0 : interestingADC[1] = selectedDigit[adesso2][secondIndex]->GetADC();
2973 0 : interestingWeight[1] = selectedDigit[adesso2][secondIndex]->GetWeight();
2974 0 : Int_t vol2[5]; for(jj=0; jj<5; jj++) vol2[jj] = selectedDigit[adesso2][secondIndex]->GetDetectorIndex(jj);
2975 0 : AliDebug(1,Form(" %2d %1d %2d %1d %2d", vol2[0], vol2[1], vol2[2], vol2[4], vol2[3]));
2976 0 : volDum = vol2[3];
2977 0 : vol2[3] = vol2[4];
2978 0 : vol2[4] = volDum;
2979 0 : fTOFGeometry->GetPosPar(vol2,pos);
2980 0 : interestingX[1] = pos[0];
2981 0 : interestingY[1] = pos[1];
2982 0 : interestingZ[1] = pos[2];
2983 :
2984 0 : interestingTOF[2] = selectedDigit[adesso3][thirdIndex]->GetTDC();
2985 0 : interestingTOT[2] = selectedDigit[adesso3][thirdIndex]->GetTOT();
2986 0 : interestingADC[2] = selectedDigit[adesso3][thirdIndex]->GetADC();
2987 0 : interestingWeight[2] = selectedDigit[adesso3][thirdIndex]->GetWeight();
2988 0 : Int_t vol3[5]; for(jj=0; jj<5; jj++) vol3[jj] = selectedDigit[adesso3][thirdIndex]->GetDetectorIndex(jj);
2989 0 : AliDebug(1,Form(" %2d %1d %2d %1d %2d", vol3[0], vol3[1], vol3[2], vol3[4], vol3[3]));
2990 0 : volDum = vol3[3];
2991 0 : vol3[3] = vol3[4];
2992 0 : vol3[4] = volDum;
2993 0 : fTOFGeometry->GetPosPar(vol3,pos);
2994 0 : interestingX[2] = pos[0];
2995 0 : interestingY[2] = pos[1];
2996 0 : interestingZ[2] = pos[2];
2997 :
2998 0 : interestingTOF[3] = selectedDigit[adesso4][fourthIndex]->GetTDC();
2999 0 : interestingTOT[3] = selectedDigit[adesso4][fourthIndex]->GetTOT();
3000 0 : interestingADC[3] = selectedDigit[adesso4][fourthIndex]->GetADC();
3001 0 : interestingWeight[3] = selectedDigit[adesso4][fourthIndex]->GetWeight();
3002 0 : Int_t vol4[5]; for(jj=0; jj<5; jj++) vol4[jj] = selectedDigit[adesso4][fourthIndex]->GetDetectorIndex(jj);
3003 0 : AliDebug(1,Form(" %2d %1d %2d %1d %2d", vol4[0], vol4[1], vol4[2], vol4[4], vol4[3]));
3004 0 : volDum = vol4[3];
3005 0 : vol4[3] = vol4[4];
3006 0 : vol4[4] = volDum;
3007 0 : fTOFGeometry->GetPosPar(vol4,pos);
3008 0 : interestingX[3] = pos[0];
3009 0 : interestingY[3] = pos[1];
3010 0 : interestingZ[3] = pos[2];
3011 :
3012 :
3013 0 : AverageCalculations(interestingCounter+1,
3014 0 : interestingX, interestingY, interestingZ,
3015 0 : interestingTOF, interestingTOT, interestingADC,
3016 0 : interestingWeight,
3017 0 : parTOF, posClus, check);
3018 :
3019 0 : for (jj=0; jj<5; jj++) det[jj] = -1;
3020 0 : for (jj=0; jj<3; jj++) posF[jj] = posClus[jj];
3021 0 : fTOFGeometry->GetDetID(posF, det);
3022 :
3023 0 : volIdClus = fTOFGeometry->GetAliSensVolIndex(det[0],det[1],det[2]);
3024 : //volIdClus = GetClusterVolIndex(det);
3025 :
3026 0 : for (jj=3; jj<11; jj++) padsCluster[jj] = -1;
3027 0 : padsCluster[3] = selectedDigit[adesso1][firstIndex]->GetDetectorIndex(4);
3028 0 : padsCluster[4] = selectedDigit[adesso1][firstIndex]->GetDetectorIndex(3);
3029 0 : padsCluster[5] = selectedDigit[adesso2][secondIndex]->GetDetectorIndex(4);
3030 0 : padsCluster[6] = selectedDigit[adesso2][secondIndex]->GetDetectorIndex(3);
3031 0 : padsCluster[7] = selectedDigit[adesso3][thirdIndex]->GetDetectorIndex(4);
3032 0 : padsCluster[8] = selectedDigit[adesso3][thirdIndex]->GetDetectorIndex(3);
3033 0 : padsCluster[9] = selectedDigit[adesso4][fourthIndex]->GetDetectorIndex(4);
3034 0 : padsCluster[10] = selectedDigit[adesso4][fourthIndex]->GetDetectorIndex(3);
3035 :
3036 0 : for (jj=0; jj<6; jj++) covClus[jj] = 0.;
3037 0 : Int_t ** indDet = new Int_t*[interestingCounter+1];
3038 0 : for (jj=0; jj<interestingCounter+1; jj++) indDet[jj] = new Int_t [5];
3039 0 : for (jj=0; jj<interestingCounter+1; jj++) indDet[jj][0] = nSector;
3040 0 : for (jj=0; jj<interestingCounter+1; jj++) indDet[jj][1] = nPlate;
3041 0 : for (jj=0; jj<interestingCounter+1; jj++) indDet[jj][2] = nStrip;
3042 0 : for (jj=0; jj<interestingCounter+1; jj++) indDet[jj][3] = padsCluster[2*jj+3];
3043 0 : for (jj=0; jj<interestingCounter+1; jj++) indDet[jj][4] = padsCluster[2*jj+1+3];
3044 0 : GetClusterPars(/*check,*/ interestingCounter+1, indDet, interestingWeight, posClus, covClus);
3045 0 : for (jj=0; jj<interestingCounter+1; jj++) delete [] indDet[jj];
3046 0 : delete [] indDet;
3047 :
3048 : // To fill the track index array
3049 : dummyCounter=-1;
3050 0 : for (jj=0; jj<kMaxNumberOfTracksPerDigit; jj++) tracks[jj] = -1;
3051 0 : for (Int_t kk=0; kk<kMaxNumberOfTracksPerDigit; kk++) { // three is the max number of tracks associated to one digit
3052 0 : if (selectedDigit[adesso1][firstIndex]->GetTrackLabel(kk)==-1) continue;
3053 : else {
3054 0 : dummyCounter++;
3055 0 : tracks[dummyCounter] = selectedDigit[adesso1][firstIndex]->GetTrackLabel(kk);
3056 : }
3057 0 : }
3058 0 : for (Int_t kk=0; kk<kMaxNumberOfTracksPerDigit; kk++) { // three is the max number of tracks associated to one digit
3059 0 : if (selectedDigit[adesso2][secondIndex]->GetTrackLabel(kk)==-1) continue;
3060 : else {
3061 :
3062 : alreadyStored = kFALSE;
3063 0 : for (jj=0; jj<dummyCounter+1; jj++)
3064 0 : alreadyStored = alreadyStored || (tracks[jj]!=-1 && tracks[jj]==selectedDigit[adesso2][secondIndex]->GetTrackLabel(kk));
3065 :
3066 0 : if (alreadyStored) continue;
3067 0 : if (dummyCounter==2) { // three is the max number of tracks associated to one cluster
3068 0 : AliWarning(" Siamo al limite!");
3069 0 : continue;
3070 : }
3071 :
3072 : dummyCounter++;
3073 0 : tracks[dummyCounter] = selectedDigit[adesso2][secondIndex]->GetTrackLabel(kk);
3074 :
3075 : }
3076 :
3077 0 : }
3078 0 : for (Int_t kk=0; kk<kMaxNumberOfTracksPerDigit; kk++) { // three is the max number of tracks associated to one digit
3079 0 : if (selectedDigit[adesso3][thirdIndex]->GetTrackLabel(kk)==-1) continue;
3080 : else {
3081 :
3082 : alreadyStored = kFALSE;
3083 0 : for (jj=0; jj<dummyCounter+1; jj++)
3084 0 : alreadyStored = alreadyStored || (tracks[jj]!=-1 && tracks[jj]==selectedDigit[adesso3][thirdIndex]->GetTrackLabel(kk));
3085 :
3086 0 : if (alreadyStored) continue;
3087 0 : if (dummyCounter==2) { // three is the max number of tracks associated to one cluster
3088 0 : AliWarning(" Siamo al limite!");
3089 0 : continue;
3090 : }
3091 :
3092 : dummyCounter++;
3093 0 : tracks[dummyCounter] = selectedDigit[adesso3][thirdIndex]->GetTrackLabel(kk);
3094 :
3095 : }
3096 :
3097 0 : }
3098 0 : for (Int_t kk=0; kk<kMaxNumberOfTracksPerDigit; kk++) { // three is the max number of tracks associated to one digit
3099 0 : if (selectedDigit[adesso4][fourthIndex]->GetTrackLabel(kk)==-1) continue;
3100 : else {
3101 :
3102 : alreadyStored = kFALSE;
3103 0 : for (jj=0; jj<dummyCounter+1; jj++)
3104 0 : alreadyStored = alreadyStored || (tracks[jj]!=-1 && tracks[jj]==selectedDigit[adesso4][fourthIndex]->GetTrackLabel(kk));
3105 :
3106 0 : if (alreadyStored) continue;
3107 0 : if (dummyCounter==2) { // three is the max number of tracks associated to one cluster
3108 0 : AliWarning(" Siamo al limite!");
3109 0 : continue;
3110 : }
3111 :
3112 : dummyCounter++;
3113 0 : tracks[dummyCounter] = selectedDigit[adesso4][fourthIndex]->GetTrackLabel(kk);
3114 :
3115 : }
3116 :
3117 0 : }
3118 :
3119 :
3120 : AliTOFcluster *tofCluster =
3121 0 : new AliTOFcluster(volIdClus, posClus[0], posClus[1], posClus[2],
3122 0 : covClus[0], covClus[1], covClus[2], covClus[3], covClus[4], covClus[5],
3123 0 : tracks, det, parTOF, status, selectedDigit[adesso1][firstIndex]->GetIndex()); // to be updated
3124 0 : InsertCluster(tofCluster);
3125 :
3126 0 : AliDebug(2, Form(" %4d %f %f %f %f %f %f %f %f %f %3d %3d %3d %2d %1d %2d %1d %2d %4d %3d %3d %4d %4d %1d %4d",
3127 : volIdClus, posClus[0], posClus[1], posClus[2],
3128 : covClus[0], covClus[1], covClus[2], covClus[3], covClus[4], covClus[5],
3129 : tracks[0], tracks[1], tracks[2],
3130 : det[0], det[1], det[2], det[3], det[4],
3131 : parTOF[0], parTOF[1], parTOF[2], parTOF[3], parTOF[4],
3132 : status, selectedDigit[adesso1][firstIndex]->GetIndex()));
3133 :
3134 0 : volDum = vol1[3];
3135 0 : vol1[3] = vol1[4];
3136 0 : vol1[4] = volDum;
3137 0 : fTOFdigitMap->ResetDigitNumber(vol1,selectedDigit[adesso1][firstIndex]->GetIndex());
3138 0 : volDum = vol2[3];
3139 0 : vol2[3] = vol2[4];
3140 0 : vol2[4] = volDum;
3141 0 : fTOFdigitMap->ResetDigitNumber(vol2,selectedDigit[adesso2][secondIndex]->GetIndex());
3142 0 : volDum = vol3[3];
3143 0 : vol3[3] = vol3[4];
3144 0 : vol3[4] = volDum;
3145 0 : fTOFdigitMap->ResetDigitNumber(vol3,selectedDigit[adesso3][thirdIndex]->GetIndex());
3146 0 : volDum = vol4[3];
3147 0 : vol4[3] = vol4[4];
3148 0 : vol4[4] = volDum;
3149 0 : fTOFdigitMap->ResetDigitNumber(vol4,selectedDigit[adesso4][fourthIndex]->GetIndex());
3150 :
3151 :
3152 0 : } // close loop on fourth digit
3153 :
3154 0 : } // close loop on third digit
3155 :
3156 0 : } // close loop on second digit
3157 :
3158 0 : } // close loop on first digit
3159 :
3160 0 : break;
3161 :
3162 : }
3163 :
3164 0 : for (ii=0; ii<kMaxNumberOfInterestingPads; ii++)
3165 0 : for (jj=0; jj<kMaxNumberOfDigitsPerVolume; jj++)
3166 0 : selectedDigit[ii][jj] = 0x0;
3167 :
3168 0 : } // loop on iPad
3169 :
3170 0 : for (ii=0; ii<kMaxNumberOfInterestingPads; ii++) {
3171 0 : for (jj=0; jj<kMaxNumberOfDigitsPerVolume; jj++) {
3172 0 : delete [] selectedDigit[ii][jj];
3173 0 : selectedDigit[ii][jj] = 0x0;
3174 : }
3175 0 : delete [] selectedDigit[ii];
3176 0 : selectedDigit[ii] = 0x0;
3177 : }
3178 0 : delete [] selectedDigit;
3179 : selectedDigit = 0x0;
3180 :
3181 0 : }
3182 : //_____________________________________________________________________________
3183 :
3184 : Int_t AliTOFClusterFinderV1::InsertCluster(AliTOFcluster *tofCluster)
3185 : {
3186 : //
3187 : // This function adds a TOF cluster to the array of TOF clusters
3188 : // sorted in Z, i.e. fTofClusters
3189 : //
3190 :
3191 0 : if (fNumberOfTofClusters==kTofMaxCluster) {
3192 0 : AliError("Too many clusters !");
3193 0 : return 1;
3194 : }
3195 :
3196 0 : if (fNumberOfTofClusters==0) {
3197 0 : fTofClusters[fNumberOfTofClusters++] = tofCluster;
3198 0 : return 0;
3199 : }
3200 :
3201 0 : Int_t ii = FindClusterIndex(tofCluster->GetZ());
3202 0 : memmove(fTofClusters+ii+1 ,fTofClusters+ii,(fNumberOfTofClusters-ii)*sizeof(AliTOFcluster*));
3203 0 : fTofClusters[ii] = tofCluster;
3204 0 : fNumberOfTofClusters++;
3205 :
3206 : return 0;
3207 :
3208 0 : }
3209 : //_____________________________________________________________________________
3210 :
3211 : Int_t AliTOFClusterFinderV1::FindClusterIndex(Double_t z) const
3212 : {
3213 : //
3214 : // This function returns the index of the nearest cluster in z
3215 : //
3216 :
3217 0 : if (fNumberOfTofClusters==0) return 0;
3218 0 : if (z <= fTofClusters[0]->GetZ()) return 0;
3219 0 : if (z > fTofClusters[fNumberOfTofClusters-1]->GetZ()) return fNumberOfTofClusters;
3220 0 : Int_t b = 0, e = fNumberOfTofClusters-1, m = (b+e)/2;
3221 0 : for (; b<e; m=(b+e)/2) {
3222 0 : if (z > fTofClusters[m]->GetZ()) b=m+1;
3223 : else e=m;
3224 : }
3225 :
3226 : return m;
3227 :
3228 0 : }
3229 : //_____________________________________________________________________________
3230 :
3231 : void AliTOFClusterFinderV1::ResetRecpoint()
3232 : {
3233 : //
3234 : // Clear the list of reconstructed points
3235 : //
3236 :
3237 16 : fNumberOfTofClusters = 0;
3238 8 : fNumberOfTofTrgPads = 0;
3239 16 : if (fRecPoints) fRecPoints->Clear();
3240 :
3241 8 : }
3242 : //_____________________________________________________________________________
3243 :
3244 : void AliTOFClusterFinderV1::ResetDigits()
3245 : {
3246 : //
3247 : // Clear the list of digits
3248 : //
3249 :
3250 16 : fNumberOfTofDigits = 0;
3251 8 : fNumberOfTofTrgPads = 0;
3252 16 : if (fDigits) fDigits->Clear();
3253 :
3254 8 : }
3255 : //_____________________________________________________________________________
3256 : //UShort_t AliTOFClusterFinderV1::GetClusterVolIndex(Int_t *ind) const
3257 : //{
3258 : //
3259 : // Get the volume ID to retrieve the l2t transformation
3260 : //
3261 :
3262 : // Detector numbering scheme
3263 : /*
3264 : Int_t nSector = AliTOFGeometry::NSectors();
3265 : Int_t nPlate = AliTOFGeometry::NPlates();
3266 : Int_t nStripA = AliTOFGeometry::NStripA();
3267 : Int_t nStripB = AliTOFGeometry::NStripB();
3268 : Int_t nStripC = AliTOFGeometry::NStripC();
3269 :
3270 : Int_t isector =ind[0];
3271 : if (isector >= nSector)
3272 : AliError(Form("Wrong sector number in TOF (%d) !", isector));
3273 : Int_t iplate = ind[1];
3274 : if (iplate >= nPlate)
3275 : AliError(Form("Wrong plate number in TOF (%d) !", iplate));
3276 : Int_t istrip = ind[2];
3277 :
3278 : Int_t stripOffset = 0;
3279 : switch (iplate) {
3280 : case 0:
3281 : stripOffset = 0;
3282 : break;
3283 : case 1:
3284 : stripOffset = nStripC;
3285 : break;
3286 : case 2:
3287 : stripOffset = nStripC+nStripB;
3288 : break;
3289 : case 3:
3290 : stripOffset = nStripC+nStripB+nStripA;
3291 : break;
3292 : case 4:
3293 : stripOffset = nStripC+nStripB+nStripA+nStripB;
3294 : break;
3295 : default:
3296 : AliError(Form("Wrong plate number in TOF (%d) !", iplate));
3297 : break;
3298 : };
3299 :
3300 : Int_t index= (2*(nStripC+nStripB)+nStripA)*isector +
3301 : stripOffset +
3302 : istrip;
3303 :
3304 : UShort_t volIndex = AliGeomManager::LayerToVolUID(AliGeomManager::kTOF, index);
3305 : return volIndex;
3306 :
3307 : }
3308 : */
3309 : //_____________________________________________________________________________
3310 :
3311 : void AliTOFClusterFinderV1::GetClusterPars(Int_t *ind, Double_t* pos, Double_t* cov) const
3312 : {
3313 : //
3314 : // Starting from the volume indices (ind[5]), for a cluster coming from
3315 : // a isolated digits, this function returns:
3316 : // the cluster position (pos),
3317 : // the cluster covariance matrix elements (cov)
3318 : //
3319 :
3320 : //
3321 : //we now go in the system of the strip: determine the local coordinates
3322 : //
3323 : //
3324 : // 47---------------------------------------------------0 ^ z
3325 : // | | | | | | | | | | | | | | | | | | | | | | | | | | | 1 |
3326 : // ----------------------------------------------------- | y going outwards
3327 : // | | | | | | | | | | | | | | | | | | | | | | | | | | | 0 | par[0]=0;
3328 :
3329 : // ----------------------------------------------------- |
3330 : // x <-----------------------------------------------------
3331 :
3332 : //move to the tracking ref system
3333 0 : Double_t lpos[3] = { (ind[4]-23.5)*AliTOFGeometry::XPad(),
3334 : 0.,
3335 0 : (ind[3]- 0.5)*AliTOFGeometry::ZPad() };
3336 0 : AliDebug(1, Form(" %f %f %f", lpos[0], lpos[1], lpos[2]));
3337 :
3338 : // Volume ID
3339 0 : UShort_t volIndex = fTOFGeometry->GetAliSensVolIndex(ind[0],ind[1],ind[2]);
3340 : //UShort_t volIndex = GetClusterVolIndex(ind);
3341 0 : const TGeoHMatrix *l2t = AliGeomManager::GetTracking2LocalMatrix(volIndex);
3342 :
3343 : // Get the position in the track ref system
3344 0 : Double_t tpos[3];
3345 0 : l2t->MasterToLocal(lpos,tpos);
3346 0 : pos[0] = tpos[0];
3347 0 : pos[1] = tpos[1];
3348 0 : pos[2] = tpos[2];
3349 :
3350 : //Get the cluster covariance in the track ref system
3351 0 : Double_t lcov[9];
3352 0 : for (Int_t ii=0; ii<9; ii++) lcov[ii] = 0.;
3353 :
3354 : //cluster covariance in the local system:
3355 : // sx2 0 0
3356 : // 0 0 0
3357 : // 0 0 sz2
3358 : /*
3359 : lcov[4] = 0.42*0.42/3.;
3360 : // = ( 5*0.025 (gas gaps thikness)
3361 : // + 4*0.040 (internal glasses thickness)
3362 : // + 0.5*0.160 (internl PCB)
3363 : // + 1*0.055 (external red glass))
3364 : */
3365 :
3366 0 : lcov[0] = 0.499678;//AliTOFGeometry::XPad()*AliTOFGeometry::XPad()/12.;
3367 0 : lcov[8] = 0.992429;//AliTOFGeometry::ZPad()*AliTOFGeometry::ZPad()/12.;
3368 :
3369 : //cluster covariance in the tracking system:
3370 0 : TGeoHMatrix m;
3371 0 : m.SetRotation(lcov);
3372 0 : m.Multiply(l2t);
3373 0 : m.MultiplyLeft(&l2t->Inverse());
3374 0 : Double_t *tcov = m.GetRotationMatrix();
3375 0 : cov[0] = tcov[0]; cov[1] = tcov[1]; cov[2] = tcov[2];
3376 0 : cov[3] = tcov[4]; cov[4] = tcov[5]; cov[5] = tcov[8];
3377 :
3378 : return;
3379 :
3380 0 : }
3381 : //_____________________________________________________________________________
3382 :
3383 : void AliTOFClusterFinderV1::GetClusterPars(/*Bool_t check,*/ Int_t counter,
3384 : Int_t **ind, Double_t *weight,
3385 : Double_t *pos, Double_t *cov) const
3386 : {
3387 : //
3388 : // Starting from:
3389 : // the volumes indices (ind[counter][5]), for a
3390 : // cluster coming from a collection of 'counter'
3391 : // digits,
3392 : // the volumes weights (weight[counter]), -controlled
3393 : // by the 'check' variable control-, for a cluster
3394 : // coming from a collection of 'counter' digits,
3395 : // the cluster position (pos),
3396 : // this function returns:
3397 : // the covariance matrix elements (cov) for the found cluster
3398 : //
3399 :
3400 : //
3401 : // we now go in the system of the strip: determine the local coordinates
3402 : //
3403 : // 47---------------------------------------------------0 ^ z
3404 : // | | | | | | | | | | | | | | | | | | | | | | | | | | | 1 |
3405 : // ----------------------------------------------------- | y going outwards
3406 : // | | | | | | | | | | | | | | | | | | | | | | | | | | | 0 | par[0]=0;
3407 :
3408 : // ----------------------------------------------------- |
3409 : // x <-----------------------------------------------------
3410 :
3411 0 : for (Int_t ii=0; ii<counter; ii++)
3412 0 : AliDebug(1, Form(" %2d %2d %1d %2d %1d %2d ",
3413 : ii, ind[ii][0], ind[ii][1], ind[ii][2], ind[ii][3], ind[ii][4]));
3414 :
3415 0 : Float_t posF[3]; for (Int_t ii=0; ii<3; ii++) posF[ii] = (Float_t)pos[ii];
3416 0 : AliDebug(1, Form(" %f %f %f", pos[0], pos[1], pos[2]));
3417 :
3418 0 : Int_t detClus[5] = {-1, -1, -1, -1, -1};
3419 0 : fTOFGeometry->GetDetID(posF, detClus);
3420 :
3421 : // Volume ID
3422 0 : UShort_t volIndex = fTOFGeometry->GetAliSensVolIndex(detClus[0],detClus[1],detClus[2]);
3423 : //UShort_t volIndex = GetClusterVolIndex(detClus);
3424 0 : AliDebug(1, Form(" %2d %1d %2d %1d %2d %7i",
3425 : detClus[0], detClus[1], detClus[2], detClus[3], detClus[4], volIndex));
3426 :
3427 : // Get the position in the TOF strip ref system
3428 0 : const TGeoHMatrix *alice2strip = AliGeomManager::GetOrigGlobalMatrix(volIndex);
3429 0 : Double_t ppos[3] = {-1, -1, -1};
3430 0 : alice2strip->MasterToLocal(pos,ppos);
3431 0 : AliDebug(1, Form(" %f %f %f", ppos[0], ppos[1], ppos[2]));
3432 :
3433 :
3434 : // Get the position in the tracking ref system
3435 0 : const TGeoHMatrix *g2l = AliGeomManager::GetTracking2LocalMatrix(volIndex);
3436 0 : Double_t lpos[3] = {-1, -1, -1};
3437 0 : g2l->MasterToLocal(ppos,lpos);
3438 0 : AliDebug(1, Form(" %f %f %f", lpos[0], lpos[1], lpos[2]));
3439 0 : for (Int_t ii=0; ii<3; ii++) pos[ii] = lpos[ii];
3440 :
3441 : //Get the cluster covariance in the track ref system
3442 0 : Double_t lcov[9];
3443 0 : for (Int_t ii=0; ii<9; ii++) lcov[ii] = 0.;
3444 :
3445 : //cluster covariance in the local system:
3446 : // sx2 0 0
3447 : // 0 0 0
3448 : // 0 0 sz2
3449 :
3450 : // Evaluation of the ovariance matrix elements
3451 0 : TOFclusterError(/*check,*/ counter, ind, weight, ppos, lcov);
3452 :
3453 0 : AliDebug(1, Form("lcov[0] = %f, lcov[8] = %f", lcov[0], lcov[8]));
3454 :
3455 : //cluster covariance in the tracking system:
3456 0 : TGeoHMatrix m;
3457 0 : m.SetRotation(lcov);
3458 0 : m.Multiply(g2l);
3459 0 : m.MultiplyLeft(&g2l->Inverse());
3460 0 : Double_t *tcov = m.GetRotationMatrix();
3461 0 : cov[0] = tcov[0]; cov[1] = tcov[1]; cov[2] = tcov[2];
3462 0 : cov[3] = tcov[4]; cov[4] = tcov[5]; cov[5] = tcov[8];
3463 :
3464 : return;
3465 :
3466 0 : }
3467 : //_____________________________________________________________________________
3468 :
3469 : void AliTOFClusterFinderV1::TOFclusterError(/*Bool_t check,*/ Int_t counter,
3470 : Int_t **ind, Double_t *weight,
3471 : Double_t ppos[], Double_t lcov[]) const
3472 : {
3473 : //
3474 : //
3475 : //
3476 :
3477 : //lcov[4] = 0.42*0.42/3.; // cm2
3478 : // = ( 5*0.025 (gas gaps thikness)
3479 : // + 4*0.040 (internal glasses thickness)
3480 : // + 0.5*0.160 (internl PCB)
3481 : // + 1*0.055 (external red glass))
3482 :
3483 :
3484 0 : Float_t *delta2X = new Float_t[counter];
3485 0 : for (Int_t ii=0; ii<counter; ii++)
3486 0 : delta2X[ii] =
3487 0 : ((ind[ii][4]-23.5)*AliTOFGeometry::XPad() - ppos[0])*((ind[ii][4]-23.5)*AliTOFGeometry::XPad() - ppos[0]);
3488 :
3489 0 : Float_t *delta2Z = new Float_t[counter];
3490 0 : for (Int_t ii=0; ii<counter; ii++)
3491 0 : delta2Z[ii] =
3492 0 : ((ind[ii][3]- 0.5)*AliTOFGeometry::ZPad() - ppos[2])*((ind[ii][3]- 0.5)*AliTOFGeometry::ZPad() - ppos[2]);
3493 :
3494 0 : for (Int_t ii=0; ii<counter; ii++)
3495 0 : AliDebug(1, Form("x[%d] = %f, z[%d] = %f, weight[%d] = %f",
3496 : ii, (ind[ii][4]-23.5)*AliTOFGeometry::XPad(),
3497 : ii, (ind[ii][3]- 0.5)*AliTOFGeometry::ZPad(),
3498 : ii, weight[ii]
3499 : ));
3500 0 : AliDebug(1, Form("xMean = %f, zMean = %f",ppos[0], ppos[2]));
3501 :
3502 :
3503 0 : switch (counter)
3504 : {
3505 :
3506 : case 2:
3507 :
3508 0 : if (ind[0][3]==ind[1][3] && TMath::Abs(ind[0][4]-ind[1][4])==1) { //
3509 :
3510 0 : lcov[8] = 1.02039; // cm2
3511 0 : lcov[0] = 0.0379409; // cm2
3512 : /*
3513 : if (check)
3514 : lcov[0] = 0.5*0.5; // cm2
3515 : else {
3516 : if (weight[0]==weight[1])
3517 : lcov[0] = 0.0379409; // cm2
3518 : else
3519 : lcov[0] = TMath::Mean(counter, delta2X, weight); // cm2
3520 : }
3521 : */
3522 :
3523 0 : }
3524 :
3525 0 : else if (ind[0][4]==ind[1][4] && TMath::Abs(ind[0][3]-ind[1][3])==1) {//
3526 :
3527 0 : lcov[0] = 0.505499; // cm2
3528 0 : lcov[8] = 0.0422046; // cm2
3529 : /*
3530 : if (check)
3531 : lcov[8] = 0.5*0.5; // cm2
3532 : else {
3533 : if (weight[0]==weight[1])
3534 : lcov[8] = 0.0422046; // cm2
3535 : else
3536 : lcov[8] = TMath::Mean(counter, delta2Z, weight); // cm2
3537 : }
3538 : */
3539 :
3540 0 : }
3541 :
3542 : break;
3543 :
3544 : case 3:
3545 0 : lcov[0] = 0.0290677; // cm2
3546 0 : lcov[8] = 0.0569726; // cm2
3547 : /*
3548 : if (check) {
3549 : lcov[0] = 0.5*0.5; // cm2
3550 : lcov[8] = 0.5*0.5; // cm2
3551 : }
3552 : else {
3553 : if (weight[0]==weight[1] && weight[0]==weight[2]) {
3554 : lcov[0] = 0.0290677; // cm2
3555 : lcov[8] = 0.0569726; // cm2
3556 : }
3557 : else {
3558 : lcov[0] = TMath::Mean(counter, delta2X, weight); // cm2
3559 : lcov[8] = TMath::Mean(counter, delta2Z, weight); // cm2
3560 : }
3561 :
3562 : }
3563 : */
3564 :
3565 0 : break;
3566 :
3567 : case 4:
3568 0 : lcov[0] = 0.0223807; // cm2
3569 0 : lcov[8] = 0.0438662; // cm2
3570 : /*
3571 : if (check) {
3572 : lcov[0] = 0.5*0.5; // cm2
3573 : lcov[8] = 0.5*0.5; // cm2
3574 : }
3575 : else {
3576 : if (weight[0]==weight[1] && weight[0]==weight[2] && weight[0]==weight[3]) {
3577 : lcov[0] = 0.0223807; // cm2
3578 : lcov[8] = 0.0438662; // cm2
3579 : }
3580 : else {
3581 : lcov[0] = TMath::Mean(counter, delta2X, weight); // cm2
3582 : lcov[8] = TMath::Mean(counter, delta2Z, weight); // cm2
3583 : }
3584 :
3585 : }
3586 : */
3587 :
3588 0 : break;
3589 :
3590 : }
3591 :
3592 0 : delete [] delta2Z;
3593 0 : delete [] delta2X;
3594 :
3595 0 : }
3596 : //_____________________________________________________________________________
3597 :
3598 : Bool_t AliTOFClusterFinderV1::MakeSlewingCorrection(Int_t *detectorIndex,
3599 : Int_t tofDigitToT,
3600 : Int_t tofDigitTdc,
3601 : Int_t &tdcCorr)
3602 : {
3603 : //
3604 : // This funtion makes the following:
3605 : //
3606 : // - if at least one of the three status (Pulser/Noise/HW) is
3607 : // bad, is sets the status of electronic channel, corresponding to the
3608 : // volume identified by detectorIndex, as kFALSE;
3609 : // - if offline calibration is in the valid status, it performs the
3610 : // slewing correction. In particular, by taking into account:
3611 : // * the measured tot and tof values (tofDigitToT and tofDigitTdc,
3612 : // respectively);
3613 : // * the six parameters of 5th order polynomial used
3614 : // to fit the tofVStot scatter plot,
3615 : // it returns the corrected tof value, i.e. tdcCorr value.
3616 : //
3617 :
3618 : Bool_t output = kTRUE;
3619 :
3620 : Double_t timeCorr;
3621 : Int_t jj;
3622 :
3623 : //AliInfo(" Calibrating TOF Digits: ");
3624 :
3625 0 : AliTOFChannelOnlineArray *calDelay = fTOFcalib->GetTOFOnlineDelay();
3626 0 : AliTOFChannelOnlineStatusArray *calStatus = fTOFcalib->GetTOFOnlineStatus();
3627 :
3628 0 : TObjArray *calTOFArrayOffline = fTOFcalib->GetTOFCalArrayOffline();
3629 :
3630 0 : Int_t index = AliTOFGeometry::GetIndex(detectorIndex);
3631 :
3632 0 : UChar_t statusPulser = calStatus->GetPulserStatus(index);
3633 0 : UChar_t statusNoise = calStatus->GetNoiseStatus(index);
3634 0 : UChar_t statusHW = calStatus->GetHWStatus(index);
3635 0 : UChar_t status = calStatus->GetStatus(index);
3636 :
3637 : //check the status, also unknown is fine!!!!!!!
3638 :
3639 0 : AliDebug(2, Form(" Status for channel %d = %d",index, (Int_t)status));
3640 0 : if((statusPulser & AliTOFChannelOnlineStatusArray::kTOFPulserBad)==(AliTOFChannelOnlineStatusArray::kTOFPulserBad)||(statusNoise & AliTOFChannelOnlineStatusArray::kTOFNoiseBad)==(AliTOFChannelOnlineStatusArray::kTOFNoiseBad)||(statusHW & AliTOFChannelOnlineStatusArray::kTOFHWBad)==(AliTOFChannelOnlineStatusArray::kTOFHWBad)){
3641 0 : AliDebug(2, Form(" Bad Status for channel %d",index));
3642 : //fTofClusters[ii]->SetStatus(kFALSE); //odd convention, to avoid conflict with calibration objects currently in the db (temporary solution).
3643 : output = kFALSE;
3644 0 : }
3645 : else
3646 0 : AliDebug(2, Form(" Good Status for channel %d",index));
3647 :
3648 :
3649 0 : if (fCalibrateTOFtimes) { // AdC
3650 :
3651 : // Get Rough channel online equalization
3652 0 : Double_t roughDelay = (Double_t)calDelay->GetDelay(index); // in ns
3653 0 : AliDebug(2,Form(" channel delay (ns) = %f", roughDelay));
3654 : // Get Refined channel offline calibration parameters
3655 0 : TString validity = (TString)fTOFcalib->GetOfflineValidity();
3656 0 : if (validity.CompareTo("valid")==0) {
3657 0 : AliTOFChannelOffline * calChannelOffline = (AliTOFChannelOffline*)calTOFArrayOffline->At(index);
3658 0 : Double_t par[6];
3659 0 : for (jj = 0; jj<6; jj++)
3660 0 : par[jj] = (Double_t)calChannelOffline->GetSlewPar(jj);
3661 :
3662 0 : AliDebug(2,Form(" Calib Pars = %f, %f, %f, %f, %f, %f ",par[0],par[1],par[2],par[3],par[4],par[5]));
3663 0 : AliDebug(2,Form(" The ToT and Time, uncorr (counts) = %d , %d", tofDigitToT, tofDigitTdc));
3664 0 : Double_t tToT = (Double_t)(tofDigitToT*AliTOFGeometry::ToTBinWidth());
3665 0 : tToT*=1.E-3; //ToT in ns
3666 0 : AliDebug(2,Form(" The ToT and Time, uncorr (ns)= %e, %e",tofDigitTdc*AliTOFGeometry::TdcBinWidth()*1.E-3,tToT));
3667 0 : timeCorr = par[0] + tToT*(par[1] + tToT*(par[2] + tToT*(par[3] + tToT*(par[4] + tToT*par[5])))); // the time correction (ns)
3668 0 : }
3669 : else
3670 : timeCorr = roughDelay; // correction in ns
3671 :
3672 0 : AliDebug(2,Form(" The ToT and Time, uncorr (ns)= %e, %e",tofDigitTdc*AliTOFGeometry::TdcBinWidth()*1.E-3,tofDigitToT*AliTOFGeometry::ToTBinWidth()));
3673 0 : AliDebug(2,Form(" The time correction (ns) = %f", timeCorr));
3674 0 : timeCorr = (Double_t)(tofDigitTdc)*AliTOFGeometry::TdcBinWidth()*1.E-3-timeCorr;//redefine the time
3675 0 : timeCorr *= 1.E3;
3676 0 : AliDebug(2,Form(" The channel time, corr (ps)= %e",timeCorr ));
3677 : //tdcCorr = (Int_t)(timeCorr/AliTOFGeometry::TdcBinWidth()); //the corrected time (tdc counts)
3678 0 : tdcCorr = TMath::Nint(timeCorr/AliTOFGeometry::TdcBinWidth()); //the corrected time (tdc counts)
3679 :
3680 0 : } // AdC
3681 :
3682 0 : return output;
3683 :
3684 0 : }
3685 : //______________________________________________________________________________
3686 :
3687 : void AliTOFClusterFinderV1::Digits2RecPoints(Int_t iEvent)
3688 : {
3689 : //
3690 : // Converts digits to recpoints for TOF
3691 : //
3692 :
3693 0 : TStopwatch stopwatch;
3694 0 : stopwatch.Start();
3695 :
3696 0 : fRunLoader->GetEvent(iEvent);
3697 :
3698 0 : AliLoader *localTOFLoader = (AliLoader*)fRunLoader->GetLoader("TOFLoader");
3699 :
3700 0 : TTree * localTreeD = (TTree*)localTOFLoader->TreeD();
3701 0 : if (localTreeD == 0x0) {
3702 0 : AliFatal("Can not get TreeD");
3703 0 : return;
3704 : }
3705 :
3706 0 : TBranch *branch = localTreeD->GetBranch("TOF");
3707 0 : if (!branch) {
3708 0 : AliError("Can't get the branch with the TOF digits !");
3709 0 : return;
3710 : }
3711 :
3712 0 : TTree *localTreeR = (TTree*)localTOFLoader->TreeR();
3713 0 : if (localTreeR == 0x0)
3714 : {
3715 0 : localTOFLoader->MakeTree("R");
3716 0 : localTreeR = localTOFLoader->TreeR();
3717 0 : }
3718 :
3719 0 : Digits2RecPoints(localTreeD, localTreeR);
3720 :
3721 : //localTOFLoader = fRunLoader->GetLoader("TOFLoader");
3722 0 : localTOFLoader->WriteRecPoints("OVERWRITE");
3723 :
3724 0 : AliDebug(1, Form("Execution time to read TOF digits and to write TOF clusters for the event number %d: R:%.4fs C:%.4fs",
3725 : iEvent, stopwatch.RealTime(),stopwatch.CpuTime()));
3726 :
3727 0 : }
3728 : //______________________________________________________________________________
3729 :
3730 : void AliTOFClusterFinderV1::Digits2RecPoints(Int_t iEvent, AliRawReader *rawReader)
3731 : {
3732 : //
3733 : // Converts RAW data to recpoints for TOF
3734 : //
3735 :
3736 0 : TStopwatch stopwatch;
3737 0 : stopwatch.Start();
3738 :
3739 0 : fRunLoader->GetEvent(iEvent);
3740 :
3741 0 : AliDebug(2,Form(" Event number %2d ", iEvent));
3742 :
3743 0 : AliLoader *localTOFLoader = (AliLoader*)fRunLoader->GetLoader("TOFLoader");
3744 :
3745 0 : TTree *localTreeR = localTOFLoader->TreeR();
3746 :
3747 0 : if (localTreeR == 0x0){
3748 0 : localTOFLoader->MakeTree("R");
3749 0 : localTreeR = localTOFLoader->TreeR();
3750 0 : }
3751 :
3752 0 : Digits2RecPoints(rawReader, localTreeR);
3753 :
3754 0 : AliDebug(1, Form("Execution time to read TOF raw data and to write TOF clusters for the event number %d: R:%.4fs C:%.4fs",
3755 : iEvent, stopwatch.RealTime(),stopwatch.CpuTime()));
3756 :
3757 0 : }
3758 : //______________________________________________________________________________
3759 :
3760 : void AliTOFClusterFinderV1::Raw2Digits(Int_t iEvent, AliRawReader *rawReader)
3761 : {
3762 : //
3763 : // Converts RAW data to MC digits for TOF
3764 : //
3765 :
3766 :
3767 0 : TStopwatch stopwatch;
3768 0 : stopwatch.Start();
3769 :
3770 0 : fRunLoader->GetEvent(iEvent);
3771 :
3772 0 : AliDebug(2,Form(" Event number %2d ", iEvent));
3773 :
3774 0 : AliLoader *localTOFLoader = (AliLoader*)fRunLoader->GetLoader("TOFLoader");
3775 :
3776 0 : TTree *localTreeD = localTOFLoader->TreeD();
3777 :
3778 0 : if (localTreeD == 0x0){
3779 0 : localTOFLoader->MakeTree("D");
3780 0 : localTreeD = localTOFLoader->TreeD();
3781 0 : }
3782 :
3783 0 : Raw2Digits(rawReader, localTreeD);
3784 :
3785 0 : AliDebug(1, Form("Execution time to read TOF raw data and to write TOF clusters for the event number %d: R:%.4fs C:%.4fs",
3786 : iEvent, stopwatch.RealTime(),stopwatch.CpuTime()));
3787 :
3788 0 : }
3789 : //______________________________________________________________________________
3790 :
3791 : void AliTOFClusterFinderV1::AverageCalculations(Int_t number, Float_t *interestingX,
3792 : Float_t *interestingY, Float_t *interestingZ,
3793 : Double_t *interestingTOF, Double_t *interestingTOT,
3794 : Double_t *interestingADC, Double_t *interestingWeight,
3795 : Int_t *parTOF, Double_t *posClus, Bool_t &check)
3796 : {
3797 : //
3798 : // Calculates the mean values for cluster position (x,y,z),
3799 : // TOF charge and time
3800 : //
3801 :
3802 : Double_t tofAverage = 0.;
3803 : Double_t totAverage = 0.;
3804 : Double_t adcAverage = 0.;
3805 :
3806 0 : check = kFALSE;
3807 : Int_t ii=-1;
3808 0 : for (ii=number-1; ii>=0; ii--) check=check||(interestingWeight[ii]==0 || interestingWeight[ii]==-1);
3809 :
3810 0 : if (check) {
3811 :
3812 0 : posClus[0] = TMath::Mean(number, interestingX);
3813 0 : posClus[1] = TMath::Mean(number, interestingY);
3814 0 : posClus[2] = TMath::Mean(number, interestingZ);
3815 0 : tofAverage = TMath::Mean(number, interestingTOF);
3816 0 : totAverage = TMath::Mean(number, interestingTOT);
3817 0 : adcAverage = TMath::Mean(number, interestingADC);
3818 :
3819 0 : }
3820 : else {
3821 :
3822 0 : posClus[0] = TMath::Mean(number, interestingX, interestingWeight);
3823 0 : posClus[1] = TMath::Mean(number, interestingY, interestingWeight);
3824 0 : posClus[2] = TMath::Mean(number, interestingZ, interestingWeight);
3825 0 : tofAverage = TMath::Mean(number, interestingTOF, interestingWeight);
3826 0 : totAverage = TMath::Mean(number, interestingTOT, interestingWeight);
3827 0 : adcAverage = TMath::Mean(number, interestingADC, interestingWeight);
3828 :
3829 : }
3830 :
3831 0 : parTOF[0] = Int_t(tofAverage);
3832 0 : parTOF[1] = Int_t(totAverage);
3833 0 : parTOF[2] = Int_t(adcAverage);
3834 0 : parTOF[3] = Int_t(tofAverage);//tofND
3835 0 : parTOF[4] = Int_t(tofAverage);//tofRAW
3836 0 : parTOF[5] = 0;
3837 0 : parTOF[6] = 0;
3838 :
3839 0 : }
|