1 /***************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
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
24 Revision 0.01 2008/05/10 A. De Caro
27 /////////////////////////////////////////
29 // Class for TOF cluster finder (V1) //
31 // Input data: Raw Data or Digits; //
32 // Output data: Digits or Rec Points //
34 /////////////////////////////////////////
36 #include "Riostream.h"
38 #include "TClonesArray.h"
39 #include "TStopwatch.h"
41 #include "TGeoMatrix.h"
46 #include "AliRawReader.h"
47 #include "AliRunLoader.h"
48 #include "AliGeomManager.h"
50 #include "AliTOFcalib.h"
51 #include "AliTOFChannelOnlineArray.h"
52 #include "AliTOFChannelOnlineStatusArray.h"
53 #include "AliTOFChannelOffline.h"
54 #include "AliTOFClusterFinderV1.h"
55 #include "AliTOFcluster.h"
56 #include "AliTOFdigit.h"
57 #include "AliTOFDigitMap.h"
58 #include "AliTOFrawData.h"
59 #include "AliTOFReconstructor.h"
60 #include "AliTOFRecoParam.h"
62 ClassImp(AliTOFClusterFinderV1)
64 //_____________________________________________________________________________
65 AliTOFClusterFinderV1::AliTOFClusterFinderV1(AliTOFcalib *calib):
67 fDigits(new TClonesArray("AliTOFdigit", 4000)),
68 fRecPoints(new TClonesArray("AliTOFcluster", 4000)),
69 fNumberOfTofClusters(0),
70 fNumberOfTofDigits(0),
75 fTOFdigitMap(new AliTOFDigitMap()),
76 fTOFGeometry(new AliTOFGeometry()),
78 fTOFRawStream(AliTOFRawStream())
83 const AliTOFRecoParam *recoParam = AliTOFReconstructor::GetRecoParam(); // instantiate reco param from STEER...
84 fMaxDeltaTime = recoParam->GetMaxDeltaTime();
87 //_____________________________________________________________________________
88 AliTOFClusterFinderV1::AliTOFClusterFinderV1(AliRunLoader* runLoader, AliTOFcalib *calib):
89 fRunLoader(runLoader),
90 fDigits(new TClonesArray("AliTOFdigit", 4000)),
91 fRecPoints(new TClonesArray("AliTOFcluster", 4000)),
92 fNumberOfTofClusters(0),
93 fNumberOfTofDigits(0),
98 fTOFdigitMap(new AliTOFDigitMap()),
99 fTOFGeometry(new AliTOFGeometry()),
101 fTOFRawStream(AliTOFRawStream())
106 const AliTOFRecoParam *recoParam = AliTOFReconstructor::GetRecoParam(); // instantiate reco param from STEER...
107 fMaxDeltaTime = recoParam->GetMaxDeltaTime();
110 //_____________________________________________________________________________
112 AliTOFClusterFinderV1::AliTOFClusterFinderV1(const AliTOFClusterFinderV1 &source)
115 fDigits(source.fDigits),
116 fRecPoints(source.fRecPoints),
117 fNumberOfTofClusters(0),
118 fNumberOfTofDigits(0),
121 fDecoderVersion(source.fDecoderVersion),
122 fTOFcalib(source.fTOFcalib),
123 fTOFdigitMap(new AliTOFDigitMap()),
124 fTOFGeometry(new AliTOFGeometry()),
125 fTOFdigits(source.fTOFdigits),
126 fTOFRawStream(source.fTOFRawStream)
131 //_____________________________________________________________________________
133 AliTOFClusterFinderV1& AliTOFClusterFinderV1::operator=(const AliTOFClusterFinderV1 &source)
140 TObject::operator=(source);
141 fDigits=source.fDigits;
142 fRecPoints=source.fRecPoints;
143 fVerbose=source.fVerbose;
144 fDecoderVersion=source.fDecoderVersion;
145 fTOFcalib=source.fTOFcalib;
146 fTOFdigitMap=source.fTOFdigitMap;
147 fTOFGeometry=source.fTOFGeometry;
148 fTOFdigits=source.fTOFdigits;
149 fTOFRawStream=source.fTOFRawStream;
153 //_____________________________________________________________________________
155 AliTOFClusterFinderV1::~AliTOFClusterFinderV1()
170 fRecPoints->Delete();
182 //_____________________________________________________________________________
184 void AliTOFClusterFinderV1::Digits2RecPoints(TTree* digitsTree, TTree* clusterTree)
187 // Converts digits to recPoints for TOF
190 TStopwatch stopwatch;
195 TClonesArray &aDigits = *fDigits;
197 if (digitsTree == 0x0)
198 AliFatal("Can not get TreeD for TOF");
200 TBranch *branch = digitsTree->GetBranch("TOF");
202 AliError("Can not get branch with the TOF digits !");
206 TClonesArray staticDigits("AliTOFdigit",10000);
207 staticDigits.Clear();
208 TClonesArray *digits = &staticDigits;
209 branch->SetAddress(&digits);
210 digitsTree->GetEvent(0);
211 AliInfo(Form("Number of TOF digits: %d", digits->GetEntriesFast()));
213 AliTOFdigit *tofDigit;
216 Int_t detectorIndex[5];
217 for (jj=0; jj<5; jj++) detectorIndex[jj] = -1;
219 for (jj=0; jj<4; jj++) info[jj] = -1;
225 Bool_t status = kTRUE;
227 AliInfo(" Calibrating TOF Digits: ");
228 TString validity = (TString)fTOFcalib->GetOfflineValidity();
229 AliInfo(Form(" validity = %s", validity.Data()));
230 if (validity.CompareTo("valid")==0) {
231 AliInfo(" ...using offline calibration parameters");
234 AliInfo(" ...using online calibration parameters");
238 for (ii=0; ii<digits->GetEntriesFast(); ii++) {
239 tofDigit = (AliTOFdigit*)digits->UncheckedAt(ii);
240 detectorIndex[0] = tofDigit->GetSector();
241 detectorIndex[1] = tofDigit->GetPlate();
242 detectorIndex[2] = tofDigit->GetStrip();
243 detectorIndex[3] = tofDigit->GetPadz();
244 detectorIndex[4] = tofDigit->GetPadx();
246 if (detectorIndex[0]==13 || detectorIndex[0]==14 || detectorIndex[0]==15 ) { // sectors with holes
247 if (detectorIndex[1]==2) { // plate with holes
253 status = MakeSlewingCorrection(detectorIndex, tofDigit->GetToT(), tofDigit->GetTdc(), tdcCorr);
255 for (jj=0; jj<4; jj++) info[jj] = -1;
256 info[0] = tdcCorr;//tofDigit->GetTdc();
257 info[1] = tofDigit->GetAdc();
258 info[2] = tofDigit->GetToT();
259 info[3] = tofDigit->GetTdcND();//tofDigit->GetTdc();//
260 tracks = tofDigit->GetTracks();
262 dummy = detectorIndex[3];
263 detectorIndex[3] = detectorIndex[4];//padx
264 detectorIndex[4] = dummy;//padz
265 last = fDigits->GetEntriesFast();
266 new (aDigits[last]) AliTOFdigit(tracks, detectorIndex, info);
267 if (status) fTOFdigitMap->AddDigit(detectorIndex, last);
269 AliDebug(2, Form(" Digits reading %2d -> %2d %1d %2d %1d %2d (%d, %d, %d)",
271 detectorIndex[0], detectorIndex[1], detectorIndex[2], detectorIndex[3], detectorIndex[4],
272 info[0], info[1], info[3]));
276 fNumberOfTofDigits = fDigits->GetEntriesFast();
280 Int_t bufsize = 32000;
281 clusterTree->Branch("TOF", &fRecPoints, bufsize);
286 AliInfo(Form("Number of found clusters: %d", fNumberOfTofClusters));
290 fTOFdigitMap->Clear();
294 AliInfo(Form("Execution time to read TOF digits and to write TOF clusters : R:%.4fs C:%.4fs",
295 stopwatch.RealTime(),stopwatch.CpuTime()));
297 if (inholes) AliWarning(Form("Clusters in the TOF holes: %d",inholes));
300 //_____________________________________________________________________________
302 void AliTOFClusterFinderV1::Digits2RecPoints(AliRawReader *rawReader, TTree *clustersTree)
305 // Converts raw data to recPoints for TOF
308 TStopwatch stopwatch;
312 AliDebug(2, "TreeD re-creation");
313 //TTree *digitsTree = new TTree();
314 //Raw2Digits(rawReader, digitsTree);
316 Raw2Digits(rawReader, fTOFdigits);
318 AliDebug(2,Form("Number of TOF digits: %d", fNumberOfTofDigits));
321 Int_t bufsize = 32000;
322 clustersTree->Branch("TOF", &fRecPoints, bufsize);
325 clustersTree->Fill();
327 AliInfo(Form("Number of found clusters: %d", fNumberOfTofClusters));
331 fTOFdigitMap->Clear();
335 AliInfo(Form("Execution time to read TOF raw data and to write TOF clusters : R:%.4fs C:%.4fs",
336 stopwatch.RealTime(),stopwatch.CpuTime()));
340 //_____________________________________________________________________________
342 void AliTOFClusterFinderV1::Raw2Digits(AliRawReader *rawReader, TTree* digitsTree)
345 // Converts raw data to digits for TOF
348 TStopwatch stopwatch;
353 const Int_t kMaxNumberOfTracksPerDigit = 3;
354 const Int_t kDDL = AliDAQ::NumberOfDdls("TOF");
356 digitsTree->Branch("TOF", &fDigits);
357 TClonesArray &aDigits = *fDigits;
359 fTOFRawStream.Clear();
360 fTOFRawStream.SetRawReader(rawReader);
363 if (fVerbose==2) ftxt.open("TOFdigitsRead.txt",ios::app);
365 TClonesArray staticRawData("AliTOFrawData",10000);
366 staticRawData.Clear();
367 TClonesArray * clonesRawData = &staticRawData;
370 Int_t detectorIndex[5] = {-1, -1, -1, -1, -1};
372 Int_t tracks[kMaxNumberOfTracksPerDigit];
373 for (Int_t ii=0; ii<kMaxNumberOfTracksPerDigit; ii++)
378 Bool_t status = kTRUE;
380 AliInfo(" Calibrating TOF Digits: ");
381 TString validity = (TString)fTOFcalib->GetOfflineValidity();
382 AliInfo(Form(" validity = %s", validity.Data()));
383 if (validity.CompareTo("valid")==0) {
384 AliInfo(" ...using offline calibration parameters");
387 AliInfo(" ...using online calibration parameters");
392 for (indexDDL=0; indexDDL<kDDL; indexDDL++) {
395 if (fDecoderVersion) {
396 AliInfo("Using New Decoder \n");
397 fTOFRawStream.LoadRawDataBuffers(indexDDL,fVerbose);
399 else fTOFRawStream.LoadRawData(indexDDL);
401 clonesRawData = (TClonesArray*)fTOFRawStream.GetRawData();
402 if (clonesRawData->GetEntriesFast()!=0) AliInfo(Form(" TOF raw data number = %3d", clonesRawData->GetEntriesFast()));
403 for (iRawData = 0; iRawData<clonesRawData->GetEntriesFast(); iRawData++) {
405 AliTOFrawData *tofRawDatum = (AliTOFrawData*)clonesRawData->UncheckedAt(iRawData);
407 //if (tofRawDatum->GetTOT()==-1 || tofRawDatum->GetTOF()==-1) continue;
408 if (tofRawDatum->GetTOF()==-1) continue;
410 fTOFRawStream.EquipmentId2VolumeId(indexDDL, tofRawDatum->GetTRM(), tofRawDatum->GetTRMchain(),
411 tofRawDatum->GetTDC(), tofRawDatum->GetTDCchannel(), detectorIndex);
414 dummy = detectorIndex[3];
415 detectorIndex[3] = detectorIndex[4];//padz
416 detectorIndex[4] = dummy;//padx
417 status = MakeSlewingCorrection(detectorIndex, tofRawDatum->GetTOT(), tofRawDatum->GetTOF(), tdcCorr);
420 digit[1] = tofRawDatum->GetTOT();
421 digit[2] = tofRawDatum->GetTOT();
422 digit[3] = -1;//tofRawDatum->GetTOF(); //tofND
424 dummy = detectorIndex[3];
425 detectorIndex[3] = detectorIndex[4];//padx
426 detectorIndex[4] = dummy;//padz
428 // Do not reconstruct anything in the holes
429 if (detectorIndex[0]==13 || detectorIndex[0]==14 || detectorIndex[0]==15 ) { // sectors with holes
430 if (detectorIndex[1]==2) { // plate with holes
436 last = fDigits->GetEntriesFast();
437 new (aDigits[last]) AliTOFdigit(tracks, detectorIndex, digit);
438 if (status) fTOFdigitMap->AddDigit(detectorIndex, last);
441 if (indexDDL<10) ftxt << " " << indexDDL;
442 else ftxt << " " << indexDDL;
443 if (tofRawDatum->GetTRM()<10) ftxt << " " << tofRawDatum->GetTRM();
444 else ftxt << " " << tofRawDatum->GetTRM();
445 ftxt << " " << tofRawDatum->GetTRMchain();
446 if (tofRawDatum->GetTDC()<10) ftxt << " " << tofRawDatum->GetTDC();
447 else ftxt << " " << tofRawDatum->GetTDC();
448 ftxt << " " << tofRawDatum->GetTDCchannel();
450 if (detectorIndex[0]<10) ftxt << " -> " << detectorIndex[0];
451 else ftxt << " -> " << detectorIndex[0];
452 ftxt << " " << detectorIndex[1];
453 if (detectorIndex[2]<10) ftxt << " " << detectorIndex[2];
454 else ftxt << " " << detectorIndex[2];
455 ftxt << " " << detectorIndex[4];
456 if (detectorIndex[4]<10) ftxt << " " << detectorIndex[3];
457 else ftxt << " " << detectorIndex[3];
459 if (digit[1]<10)ftxt << " " << digit[1];
460 else if (digit[1]>=10 && digit[1]<100) ftxt << " " << digit[1];
461 else ftxt << " " << digit[1];
462 if (digit[0]<10) ftxt << " " << digit[0] << endl;
463 else if (digit[0]>=10 && digit[0]<100) ftxt << " " << digit[0] << endl;
464 else if (digit[0]>=100 && digit[0]<1000) ftxt << " " << digit[0] << endl;
465 else ftxt << " " << digit[3] << endl;
468 AliDebug(2, Form(" Raw data reading %2d -> %2d %1d %2d %1d %2d (%d, %d, %d)",
470 detectorIndex[0], detectorIndex[1], detectorIndex[2], detectorIndex[4], detectorIndex[3],
471 digit[0], digit[1], digit[3]));
475 clonesRawData->Clear();
479 if (fVerbose==2) ftxt.close();
483 fNumberOfTofDigits = fDigits->GetEntries();
485 AliDebug(1, Form("Got %d TOF digits", fNumberOfTofDigits));
486 AliDebug(1, Form("Execution time to read TOF raw data and fill TOF digit tree : R:%.2fs C:%.2fs",
487 stopwatch.RealTime(),stopwatch.CpuTime()));
489 if (inholes) AliWarning(Form("Clusters in the TOF holes: %d",inholes));
492 //_____________________________________________________________________________
494 void AliTOFClusterFinderV1::FillRecPoint()
497 // Fill the global TClonesArray of AliTOFcluster objects,
506 for(Int_t iPlate=AliTOFGeometry::NPlates()-1; iPlate>=0; iPlate--) {
507 for(Int_t iStrip=AliTOFGeometry::NStrip(iPlate)-1; iStrip>=0; iStrip--) {
508 //for (Int_t iSector=AliTOFGeometry::NSectors()-1; iSector>=0; iSector--) {
509 for (Int_t iSector=0; iSector<AliTOFGeometry::NSectors(); iSector++) {
511 if (!(fTOFdigitMap->StripDigitCheck(iSector,iPlate,iStrip))) continue;
512 FindClustersWithoutTOT(iSector, iPlate, iStrip); // clusters coming from digits without TOT measurement
515 if (!(fTOFdigitMap->StripDigitCheck(iSector,iPlate,iStrip))) continue;
516 FindClustersPerStrip(iSector, iPlate, iStrip, 4); // 4 pads clusters
517 if (!(fTOFdigitMap->StripDigitCheck(iSector,iPlate,iStrip))) continue;
519 dummy4_1 = fNumberOfTofClusters;
520 FindClustersPerStrip(iSector, iPlate, iStrip, 4); // 4 pads clusters
521 if (fNumberOfTofClusters!=dummy4_1)
522 AliDebug(2, Form(" (4): n1= %5d, n2 = %5", dummy4_1, fNumberOfTofClusters));
525 if (!(fTOFdigitMap->StripDigitCheck(iSector,iPlate,iStrip))) continue;
526 FindClustersPerStrip(iSector, iPlate, iStrip, 3); // 3 pads clusters
527 if (!(fTOFdigitMap->StripDigitCheck(iSector,iPlate,iStrip))) continue;
529 dummy3_1 = fNumberOfTofClusters;
530 FindClustersPerStrip(iSector, iPlate, iStrip, 3); // 3 pads clusters
531 if (fNumberOfTofClusters!=dummy3_1)
532 AliDebug(2, Form(" (3): n1= %5d, n2 = %5", dummy3_1, fNumberOfTofClusters));
535 if (!(fTOFdigitMap->StripDigitCheck(iSector,iPlate,iStrip))) continue;
536 FindClustersPerStrip(iSector, iPlate, iStrip, 2); // 2 pads clusters
537 if (!(fTOFdigitMap->StripDigitCheck(iSector,iPlate,iStrip))) continue;
539 dummy2_1 = fNumberOfTofClusters;
540 FindClustersPerStrip(iSector, iPlate, iStrip, 2); // 2 pads clusters
541 if (fNumberOfTofClusters!=dummy2_1)
542 AliDebug(2, Form(" (2): n1= %5d, n2 =%5", dummy2_1, fNumberOfTofClusters));
545 if (!(fTOFdigitMap->StripDigitCheck(iSector,iPlate,iStrip))) continue;
546 dummy = fNumberOfTofClusters;
547 FindClusters34(iSector, iPlate, iStrip); // 3 pads clusters between 4 hit pads
548 if (fNumberOfTofClusters!=dummy)
549 AliDebug(2, Form(" (3 between 4): n1 = %5d, n2 = %5d", fNumberOfTofClusters, dummy));
552 if (!(fTOFdigitMap->StripDigitCheck(iSector,iPlate,iStrip))) continue;
553 dummy = fNumberOfTofClusters;
554 FindClusters23(iSector, iPlate, iStrip); // 2 pads clusters between 3 hit pads
555 if (fNumberOfTofClusters!=dummy)
556 AliDebug(2, Form(" (2 between 3): n1 = %5d, n2 = %5d", fNumberOfTofClusters, dummy));
558 if (!(fTOFdigitMap->StripDigitCheck(iSector,iPlate,iStrip))) continue;
559 dummy = fNumberOfTofClusters;
560 FindClusters24(iSector, iPlate, iStrip); // 2 pads clusters between 4 hit pads
561 if (fNumberOfTofClusters!=dummy)
562 AliDebug(2, Form(" (2 between 4): n1 = %5d, n2 = %5d", fNumberOfTofClusters, dummy));
565 if (!(fTOFdigitMap->StripDigitCheck(iSector,iPlate,iStrip))) continue;
566 dummy = fNumberOfTofClusters;
567 FindOnePadClusterPerStrip(iSector, iPlate, iStrip); // 1 pad clusters
568 if (fNumberOfTofClusters!=dummy)
569 AliDebug(2,Form(" (1): n1 = %5d, n2 = %5d", fNumberOfTofClusters, dummy));
571 if (fTOFdigitMap->DigitInStrip(iSector,iPlate,iStrip)>0)
572 AliDebug(2, Form(" (1): number of clusters = %5d (remaining digit %2d), -%2d %1d %2d-",
573 fNumberOfTofClusters, fTOFdigitMap->DigitInStrip(iSector,iPlate,iStrip),
574 iSector, iPlate, iStrip));
581 TClonesArray &lRecPoints = *fRecPoints;
585 Int_t detectorIndex[5];
586 for (jj=0; jj<5; jj++) detectorIndex[jj] = -1;
588 for (jj=0; jj<5; jj++) parTOF[jj] = -1;
589 Int_t trackLabels[3];
590 for (jj=0; jj<3; jj++) trackLabels[jj] = -1;
591 Int_t digitIndex = -1;
592 Bool_t status = kTRUE;
594 for (ii=0; ii<3; ii++) posClus[ii] = 0.;
595 //Float_t covClus[6];
596 //for (ii=0; ii<6; ii++) covClus[ii] = 0.;
599 for (ii=0; ii<fNumberOfTofClusters; ii++) {
601 digitIndex = fTofClusters[ii]->GetIndex();
602 for(jj=0; jj<5; jj++) detectorIndex[jj] = fTofClusters[ii]->GetDetInd(jj);
603 volIdClus = fTOFGeometry->GetAliSensVolIndex(detectorIndex[0],detectorIndex[1],detectorIndex[2]);
604 //volIdClus = GetClusterVolIndex(detectorIndex);
605 for(jj=0; jj<3; jj++) trackLabels[jj] = fTofClusters[ii]->GetLabel(jj);
606 parTOF[0] = fTofClusters[ii]->GetTDC(); // TDC
607 parTOF[1] = fTofClusters[ii]->GetToT(); // TOT
608 parTOF[2] = fTofClusters[ii]->GetADC(); // ADC=TOT
609 parTOF[3] = fTofClusters[ii]->GetTDCND(); // TDCND
610 parTOF[4] = fTofClusters[ii]->GetTDCRAW();//RAW
611 status = fTofClusters[ii]->GetStatus();
613 posClus[0] = fTofClusters[ii]->GetX();
614 posClus[1] = fTofClusters[ii]->GetY();
615 posClus[2] = fTofClusters[ii]->GetZ();
617 //for (jj=0; jj<6; jj++) covClus[jj] = 0.;
618 //((AliCluster*)fTofClusters[ii])->GetGlobalCov(covClus);
620 new(lRecPoints[ii]) AliTOFcluster(volIdClus, (Double_t)posClus[0], (Double_t)posClus[1], (Double_t)posClus[2],
621 (Double_t)(fTofClusters[ii]->GetSigmaX2()),
622 (Double_t)(fTofClusters[ii]->GetSigmaXY()),
623 (Double_t)(fTofClusters[ii]->GetSigmaXZ()),
624 (Double_t)(fTofClusters[ii]->GetSigmaY2()),
625 (Double_t)(fTofClusters[ii]->GetSigmaYZ()),
626 (Double_t)(fTofClusters[ii]->GetSigmaZ2()),
627 //(Double_t)covClus[0], (Double_t)covClus[1], (Double_t)covClus[2],
628 //(Double_t)covClus[3], (Double_t)covClus[4], (Double_t)covClus[5],
629 trackLabels, detectorIndex, parTOF, status, digitIndex);
631 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",
632 ii, volIdClus, posClus[0], posClus[1], posClus[2],
633 fTofClusters[ii]->GetSigmaX2(),
634 fTofClusters[ii]->GetSigmaXY(),
635 fTofClusters[ii]->GetSigmaXZ(),
636 fTofClusters[ii]->GetSigmaY2(),
637 fTofClusters[ii]->GetSigmaYZ(),
638 fTofClusters[ii]->GetSigmaZ2(),
639 trackLabels[0], trackLabels[1], trackLabels[2],
640 detectorIndex[0], detectorIndex[1], detectorIndex[2], detectorIndex[3], detectorIndex[4],
641 parTOF[0], parTOF[1], parTOF[2], parTOF[3], parTOF[4],
642 status, digitIndex));
647 for (Int_t iSector=0; iSector<AliTOFGeometry::NSectors(); iSector++)
648 for(Int_t iPlate=0; iPlate<AliTOFGeometry::NPlates(); iPlate++) {
649 for(Int_t iStrip=0; iStrip<AliTOFGeometry::NStrip(iPlate); iStrip++) {
650 if (!(fTOFdigitMap->StripDigitCheck(iSector,iPlate,iStrip))) continue;
651 AliDebug(2, Form(" END %2d %1d %2d %5d",
652 iSector, iPlate, iStrip, fTOFdigitMap->DigitInStrip(iSector,iPlate,iStrip)));
657 //_____________________________________________________________________________
659 void AliTOFClusterFinderV1::FindOnePadClusterPerStrip(Int_t nSector,
664 // This function searches the isolated digits (stored in the fDigits object),
665 // to perform clusters (stored in the fTofClusters array).
666 // This research has been made by checking the fTOFdigitMap object,
667 // filled at digits/raw-data reading time.
670 const Int_t kMaxNumberOfTracksPerDigit = 3;
671 const Int_t kMaxNumberOfDigitsPerVolume = 3;
675 Int_t det[5] = {nSector,nPlate,nStrip,-1,-1};//sector,plate,strip,padZ,padX
676 Int_t vol[5] = {nSector,nPlate,nStrip,-1,-1};//sector,plate,strip,padX,padZ
677 UShort_t volIdClus = 0;
680 for (jj=0; jj<3; jj++) pos[jj] = 0.;
682 for (jj=0; jj<3; jj++) posClus[jj] = 0.;
685 for (jj=0; jj<6; jj++) covClus[jj] = 0.;
688 for (jj=0; jj<5; jj++) parTOF[jj] = 0;
690 Bool_t status = kTRUE; //assume all sim channels ok in the beginning...
692 Int_t tracks[kMaxNumberOfTracksPerDigit];
693 for (jj=0; jj<3; jj++) tracks[jj] = -1;
695 Int_t dummyCounter=-1;
697 AliTOFdigit *digitInteresting;
701 for (iPadX=0; iPadX<AliTOFGeometry::NpadX(); iPadX++) {
702 for (iPadZ=0; iPadZ<AliTOFGeometry::NpadZ(); iPadZ++) {
703 vol[4] = iPadZ , vol[3] = iPadX;
705 AliDebug(3, Form(" %1d %2d\n", iPadZ, iPadX));
707 if (fTOFdigitMap->GetNumberOfDigits(vol)==0) continue;
709 for(Int_t digIndex=0; digIndex<kMaxNumberOfDigitsPerVolume; digIndex++) {
710 if (fTOFdigitMap->GetDigitIndex(vol,digIndex)<0) continue;
711 digitInteresting = (AliTOFdigit*)fDigits->UncheckedAt(fTOFdigitMap->GetDigitIndex(vol,digIndex));
713 AliDebug(2, Form(" %3d %5d %2d %1d %2d %1d %2d %d %d %d %5d %5d %5d %5d",
714 fTOFdigitMap->GetNumberOfDigits(vol), digIndex,
715 vol[0], vol[1], vol[2] ,vol[4], vol[3],
716 digitInteresting->GetTdc(), digitInteresting->GetAdc(),
717 digitInteresting->GetToT(),
718 fTOFdigitMap->GetDigitIndex(vol,digIndex),
719 digitInteresting->GetTrack(0), digitInteresting->GetTrack(1), digitInteresting->GetTrack(2)));
721 det[3] = vol[4]; // padz
722 det[4] = vol[3]; // padx
723 fTOFGeometry->GetPosPar(det,pos);
724 AliDebug(1,Form(" %f %f %f", pos[0], pos[1], pos[2]));
727 for (jj=0; jj<3; jj++) posClus[jj] = pos[jj];
729 parTOF[0] = Int_t(digitInteresting->GetTdc());
730 parTOF[1] = Int_t(digitInteresting->GetToT());
731 parTOF[2] = Int_t(digitInteresting->GetAdc());
732 parTOF[3] = Int_t(digitInteresting->GetTdcND());
733 parTOF[4] = Int_t(digitInteresting->GetTdc());
735 volIdClus = fTOFGeometry->GetAliSensVolIndex(det[0],det[1],det[2]);
736 //volIdClus = GetClusterVolIndex(det);
738 for (jj=0; jj<6; jj++) covClus[jj] = 0.;
739 GetClusterPars(det, posClus, covClus);
741 // To fill the track index array
743 for (jj=0; jj<kMaxNumberOfTracksPerDigit; jj++) tracks[jj] = -1;
744 for (jj=0; jj<kMaxNumberOfTracksPerDigit; jj++) { // three is the max number of tracks associated to one digit
745 if (digitInteresting->GetTrack(jj)==-1) continue;
748 tracks[dummyCounter] = digitInteresting->GetTrack(jj);
752 AliTOFcluster *tofCluster =
753 new AliTOFcluster(volIdClus, posClus[0], posClus[1], posClus[2],
754 covClus[0], covClus[1], covClus[2], covClus[3], covClus[4], covClus[5],
755 tracks, det, parTOF, status, fTOFdigitMap->GetDigitIndex(vol,digIndex));
756 InsertCluster(tofCluster);
758 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",
759 volIdClus, posClus[0], posClus[1], posClus[2],
760 covClus[0], covClus[1], covClus[2], covClus[3], covClus[4], covClus[5],
761 tracks[0], tracks[1], tracks[2],
762 det[0], det[1], det[2], det[3], det[4],
763 parTOF[0], parTOF[1], parTOF[2], parTOF[3], parTOF[4],
764 status, fTOFdigitMap->GetDigitIndex(vol,digIndex)));
766 AliDebug(2, Form(" %f %f %f", pos[0], pos[1], pos[2]));
767 AliDebug(2, Form(" %d %d", parTOF[0], parTOF[2]));
769 fTOFdigitMap->ResetDigit(vol, digIndex);
777 //_____________________________________________________________________________
779 void AliTOFClusterFinderV1::FindClustersWithoutTOT(Int_t nSector,
784 // This function searches the isolated digits without TOT
785 // measurement (stored in the fDigits object), to perform clusters
786 // (stored in the fTofClusters array). This research has been made
787 // by checking the fTOFdigitMap object, filled at digits/raw-data
791 const Int_t kMaxNumberOfTracksPerDigit = 3;
792 const Int_t kMaxNumberOfDigitsPerVolume = 3;
796 Int_t det[5] = {nSector,nPlate,nStrip,-1,-1};//sector,plate,strip,padZ,padX
797 Int_t vol[5] = {nSector,nPlate,nStrip,-1,-1};//sector,plate,strip,padX,padZ
798 UShort_t volIdClus = 0;
801 for (jj=0; jj<3; jj++) pos[jj] = 0.;
803 for (jj=0; jj<3; jj++) posClus[jj] = 0.;
806 for (jj=0; jj<6; jj++) covClus[jj] = 0.;
809 for (jj=0; jj<5; jj++) parTOF[jj] = 0;
811 Bool_t status = kTRUE; //assume all sim channels ok in the beginning...
812 Int_t tracks[kMaxNumberOfTracksPerDigit];
813 for (jj=0; jj<3; jj++) tracks[jj] = -1;
815 Int_t dummyCounter=-1;
817 AliTOFdigit *digitInteresting;
821 for (iPadX=0; iPadX<AliTOFGeometry::NpadX(); iPadX++) {
822 for (iPadZ=0; iPadZ<AliTOFGeometry::NpadZ(); iPadZ++) {
823 vol[4] = iPadZ , vol[3] = iPadX;
825 AliDebug(3, Form(" %1d %2d\n", iPadZ, iPadX));
827 if (fTOFdigitMap->GetNumberOfDigits(vol)==0) continue;
829 for(Int_t digIndex=0; digIndex<kMaxNumberOfDigitsPerVolume; digIndex++) {
830 if (fTOFdigitMap->GetDigitIndex(vol,digIndex)<0) continue;
831 digitInteresting = (AliTOFdigit*)fDigits->UncheckedAt(fTOFdigitMap->GetDigitIndex(vol,digIndex));
832 if (digitInteresting->GetToT()>0) continue; // AdC
834 AliDebug(2, Form(" %3d %5d %2d %1d %2d %1d %2d %d %d %d %5d %5d %5d %5d",
835 fTOFdigitMap->GetNumberOfDigits(vol), digIndex,
836 vol[0], vol[1], vol[2] ,vol[4], vol[3],
837 digitInteresting->GetTdc(), digitInteresting->GetAdc(),
838 digitInteresting->GetToT(),
839 fTOFdigitMap->GetDigitIndex(vol,digIndex),
840 digitInteresting->GetTrack(0), digitInteresting->GetTrack(1), digitInteresting->GetTrack(2)));
842 det[3] = vol[4]; // padz
843 det[4] = vol[3]; // padx
844 fTOFGeometry->GetPosPar(det,pos);
845 AliDebug(1,Form(" %f %f %f", pos[0], pos[1], pos[2]));
848 for (jj=0; jj<3; jj++) posClus[jj] = pos[jj];
850 parTOF[0] = Int_t(digitInteresting->GetTdc());
851 parTOF[1] = Int_t(digitInteresting->GetToT());
852 parTOF[2] = Int_t(digitInteresting->GetAdc());
853 parTOF[3] = Int_t(digitInteresting->GetTdcND());
854 parTOF[4] = Int_t(digitInteresting->GetTdc());
856 volIdClus = fTOFGeometry->GetAliSensVolIndex(det[0],det[1],det[2]);
857 //volIdClus = GetClusterVolIndex(det);
859 for (jj=0; jj<6; jj++) covClus[jj] = 0.;
860 GetClusterPars(det, posClus, covClus);
862 // To fill the track index array
864 for (jj=0; jj<kMaxNumberOfTracksPerDigit; jj++) tracks[jj] = -1;
865 for (jj=0; jj<kMaxNumberOfTracksPerDigit; jj++) { // three is the max number of tracks associated to one digit
866 if (digitInteresting->GetTrack(jj)==-1) continue;
869 tracks[dummyCounter] = digitInteresting->GetTrack(jj);
873 AliTOFcluster *tofCluster =
874 new AliTOFcluster(volIdClus, posClus[0], posClus[1], posClus[2],
875 covClus[0], covClus[1], covClus[2], covClus[3], covClus[4], covClus[5],
876 tracks, det, parTOF, status, fTOFdigitMap->GetDigitIndex(vol,digIndex));
877 InsertCluster(tofCluster);
879 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",
880 volIdClus, posClus[0], posClus[1], posClus[2],
881 covClus[0], covClus[1], covClus[2], covClus[3], covClus[4], covClus[5],
882 tracks[0], tracks[1], tracks[2],
883 det[0], det[1], det[2], det[3], det[4],
884 parTOF[0], parTOF[1], parTOF[2], parTOF[3], parTOF[4],
885 status, fTOFdigitMap->GetDigitIndex(vol,digIndex)));
887 AliDebug(2, Form(" %f %f %f", pos[0], pos[1], pos[2]));
888 AliDebug(2, Form(" %d %d", parTOF[0], parTOF[2]));
890 fTOFdigitMap->ResetDigit(vol, digIndex);
898 //_____________________________________________________________________________
900 void AliTOFClusterFinderV1::FindClusters34(Int_t nSector,
905 // This function searches the neighbouring digits (stored in the fDigits object),
906 // to perform clusters (stored in the fTofClusters array).
908 // This research has been made by checking the fTOFdigitMap object,
909 // filled at digits/raw-data reading time.
912 const Int_t kMaxNumberOfInterestingPads = 4;
913 const Int_t kMaxNumberOfTracksPerDigit = 3;
914 const Int_t kMaxNumberOfDigitsPerVolume = 3;
918 Int_t digitsInVolumeIndices[kMaxNumberOfDigitsPerVolume];
919 for (ii=0; ii<kMaxNumberOfDigitsPerVolume; ii++)
920 digitsInVolumeIndices[ii] = -1;
922 Int_t vol[5] = {nSector,nPlate,nStrip,-1,-1};
924 Float_t pos[3] = {0.,0.,0.};
927 Int_t interestingPadX[kMaxNumberOfInterestingPads];
928 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingPadX[jj] = -1;
929 Int_t interestingPadZ[kMaxNumberOfInterestingPads];
930 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingPadZ[jj] = -1;
931 Double_t interestingTOT[kMaxNumberOfInterestingPads];
932 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingTOT[jj] = 0;
933 Double_t interestingADC[kMaxNumberOfInterestingPads];
934 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingADC[jj] = 0;
935 Double_t interestingTOF[kMaxNumberOfInterestingPads];
936 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingTOF[jj] = 0;
937 Double_t interestingWeight[kMaxNumberOfInterestingPads];
938 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingWeight[jj] = 0;
940 Float_t interestingX[kMaxNumberOfInterestingPads];
941 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingX[jj] = 0;
942 Float_t interestingY[kMaxNumberOfInterestingPads];
943 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingY[jj] = 0;
944 Float_t interestingZ[kMaxNumberOfInterestingPads];
945 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingZ[jj] = 0;
947 Float_t interDigit[kMaxNumberOfInterestingPads];
948 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interDigit[jj] = 0;
950 Int_t padsCluster[11];
951 padsCluster[0] = nSector;
952 padsCluster[1] = nPlate;
953 padsCluster[2] = nStrip;
954 for (jj=3; jj<11; jj++) padsCluster[jj] = -1;
956 Int_t interestingCounter=-1;
957 Int_t digitIndexLocal=-1; // AdC
963 for (jj=0; jj<5; jj++) parTOF[jj] = 0;
965 for (jj=0; jj<3; jj++) posClus[jj] = 0.;
967 for (jj=0; jj<5; jj++) det[jj] = -1;
969 for (jj=0; jj<3; jj++) posF[jj] = 0.;
970 UShort_t volIdClus = 0;
971 Bool_t check = kFALSE;
972 Bool_t status = kTRUE; //assume all sim channels ok in the beginning...
974 for (jj=0; jj<6; jj++) covClus[jj] = 0.;
975 Int_t tracks[kMaxNumberOfTracksPerDigit];
976 for (jj=0; jj<3; jj++) tracks[jj] = -1;
977 Int_t dummyCounter=-1;
978 Bool_t alreadyStored = kFALSE;
980 AliTOFselectedDigit ***selectedDigit = new AliTOFselectedDigit**[kMaxNumberOfInterestingPads];
981 for (ii=0; ii<kMaxNumberOfInterestingPads; ii++)
982 selectedDigit[ii] = new AliTOFselectedDigit*[kMaxNumberOfDigitsPerVolume];
984 for (ii=0; ii<kMaxNumberOfInterestingPads; ii++)
985 for (jj=0; jj<kMaxNumberOfDigitsPerVolume; jj++) selectedDigit[ii][jj] = 0x0;
987 AliTOFdigit *digitInteresting;
989 for (iPad=0; iPad<AliTOFGeometry::NpadZ()*AliTOFGeometry::NpadX()-3; iPad+=2) {
991 iPadZ = iPad%AliTOFGeometry::NpadZ(); //iPad%2;
992 iPadX = iPad/AliTOFGeometry::NpadZ(); //iPad/2;
994 AliDebug(3, Form("%2d %1d %2d\n", iPad, iPadZ, iPadX));
1001 interestingCounter=-1;
1003 vol[4] = iPadZ , vol[3] = iPadX;
1004 if (fTOFdigitMap->GetNumberOfDigits(vol)>0)
1005 interestingCounter++;
1007 vol[4] = iPadZ, vol[3] = iPadX+1;
1008 if (fTOFdigitMap->GetNumberOfDigits(vol)>0)
1009 interestingCounter++;
1011 vol[4] = AliTOFGeometry::NpadZ()-(iPadZ+1), vol[3] = iPadX;
1012 if (fTOFdigitMap->GetNumberOfDigits(vol)>0)
1013 interestingCounter++;
1015 vol[4] = AliTOFGeometry::NpadZ()-(iPadZ+1), vol[3] = iPadX+1;
1016 if (fTOFdigitMap->GetNumberOfDigits(vol)>0)
1017 interestingCounter++;
1019 if (interestingCounter+1!=4) continue; // the hit pads have to be 4
1020 else interestingCounter=-1;
1023 for (ii=0; ii<kMaxNumberOfInterestingPads; ii++)
1024 for (jj=0; jj<kMaxNumberOfDigitsPerVolume; jj++)
1025 selectedDigit[ii][jj] = 0x0;
1028 vol[4] = iPadZ, vol[3] = iPadX;
1030 if (fTOFdigitMap->GetNumberOfDigits(vol)>0) {
1031 interestingCounter++;
1032 for (ii=0; ii<kMaxNumberOfDigitsPerVolume; ii++)
1033 digitsInVolumeIndices[ii] = -1;
1034 fTOFdigitMap->GetDigitIndex(vol, digitsInVolumeIndices);
1035 digitIndexLocal=-1; // AdC
1036 for(Int_t digIndex=0; digIndex<kMaxNumberOfDigitsPerVolume; digIndex++) {
1037 if (digitsInVolumeIndices[digIndex]<0) continue;
1038 digitInteresting = (AliTOFdigit*)fDigits->UncheckedAt(digitsInVolumeIndices[digIndex]);
1039 if (digitInteresting->GetToT()<=0) continue; // AdC
1040 digitIndexLocal++; // AdC
1042 AliDebug(1,Form(" %2d %1d %2d %1d %2d %f %f %f %f %5d %5d %5d %5d",
1043 vol[0], vol[1], vol[2] ,vol[4], vol[3],
1044 digitInteresting->GetTdc(), digitInteresting->GetAdc(),
1045 digitInteresting->GetToT(), digitInteresting->GetToT()*digitInteresting->GetToT(),
1046 digitsInVolumeIndices[digIndex],
1047 digitInteresting->GetTrack(0), digitInteresting->GetTrack(1), digitInteresting->GetTrack(2)));
1050 selectedDigit[interestingCounter][digitIndexLocal] = new // AdC
1051 AliTOFselectedDigit(vol, digitInteresting->GetTdc(),
1052 digitInteresting->GetAdc(), digitInteresting->GetToT(),
1053 digitInteresting->GetToT()*digitInteresting->GetToT(),
1054 digitsInVolumeIndices[digIndex],
1055 digitInteresting->GetTracks());
1057 if (digitIndexLocal==-1) interestingCounter--; // AdC
1061 vol[4] = iPadZ, vol[3] = iPadX+1;
1063 if (fTOFdigitMap->GetNumberOfDigits(vol)>0) {
1064 interestingCounter++;
1065 for (ii=0; ii<kMaxNumberOfDigitsPerVolume; ii++)
1066 digitsInVolumeIndices[ii] = -1;
1067 fTOFdigitMap->GetDigitIndex(vol, digitsInVolumeIndices);
1068 digitIndexLocal=-1; // AdC
1069 for(Int_t digIndex=0; digIndex<kMaxNumberOfDigitsPerVolume; digIndex++) {
1070 if (digitsInVolumeIndices[digIndex]<0) continue;
1071 digitInteresting = (AliTOFdigit*)fDigits->UncheckedAt(digitsInVolumeIndices[digIndex]);
1072 if (digitInteresting->GetToT()<=0) continue; // AdC
1073 digitIndexLocal++; // AdC
1075 AliDebug(1,Form(" %2d %1d %2d %1d %2d %f %f %f %f %5d %5d %5d %5d",
1076 vol[0], vol[1], vol[2] ,vol[4], vol[3],
1077 digitInteresting->GetTdc(), digitInteresting->GetAdc(),
1078 digitInteresting->GetToT(), digitInteresting->GetToT()*digitInteresting->GetToT(),
1079 digitsInVolumeIndices[digIndex],
1080 digitInteresting->GetTrack(0), digitInteresting->GetTrack(1), digitInteresting->GetTrack(2)));
1083 selectedDigit[interestingCounter][digitIndexLocal] = new // AdC
1084 AliTOFselectedDigit(vol, digitInteresting->GetTdc(),
1085 digitInteresting->GetAdc(), digitInteresting->GetToT(),
1086 digitInteresting->GetToT()*digitInteresting->GetToT(),
1087 digitsInVolumeIndices[digIndex],
1088 digitInteresting->GetTracks());
1090 if (digitIndexLocal==-1) interestingCounter--; // AdC
1094 vol[4] = AliTOFGeometry::NpadZ()-(iPadZ+1), vol[3] = iPadX;
1096 if (fTOFdigitMap->GetNumberOfDigits(vol)>0) {
1097 interestingCounter++;
1098 for (ii=0; ii<kMaxNumberOfDigitsPerVolume; ii++)
1099 digitsInVolumeIndices[ii] = -1;
1100 fTOFdigitMap->GetDigitIndex(vol, digitsInVolumeIndices);
1101 digitIndexLocal=-1; // AdC
1102 for(Int_t digIndex=0; digIndex<kMaxNumberOfDigitsPerVolume; digIndex++) {
1103 if (digitsInVolumeIndices[digIndex]<0) continue;
1104 digitInteresting = (AliTOFdigit*)fDigits->UncheckedAt(digitsInVolumeIndices[digIndex]);
1105 if (digitInteresting->GetToT()<=0) continue; // AdC
1106 digitIndexLocal++; // AdC
1108 AliDebug(1,Form(" %2d %1d %2d %1d %2d %f %f %f %f %5d %5d %5d %5d",
1109 vol[0], vol[1], vol[2] ,vol[4], vol[3],
1110 digitInteresting->GetTdc(), digitInteresting->GetAdc(),
1111 digitInteresting->GetToT(), digitInteresting->GetToT()*digitInteresting->GetToT(),
1112 digitsInVolumeIndices[digIndex],
1113 digitInteresting->GetTrack(0), digitInteresting->GetTrack(1), digitInteresting->GetTrack(2)));
1116 selectedDigit[interestingCounter][digitIndexLocal] = new // AdC
1117 AliTOFselectedDigit(vol, digitInteresting->GetTdc(),
1118 digitInteresting->GetAdc(), digitInteresting->GetToT(),
1119 digitInteresting->GetToT()*digitInteresting->GetToT(),
1120 digitsInVolumeIndices[digIndex],
1121 digitInteresting->GetTracks());
1123 if (digitIndexLocal==-1) interestingCounter--; // AdC
1127 vol[4] = AliTOFGeometry::NpadZ()-(iPadZ+1), vol[3] = iPadX+1;
1129 if (fTOFdigitMap->GetNumberOfDigits(vol)>0) {
1130 interestingCounter++;
1131 for (ii=0; ii<kMaxNumberOfDigitsPerVolume; ii++)
1132 digitsInVolumeIndices[ii] = -1;
1133 fTOFdigitMap->GetDigitIndex(vol, digitsInVolumeIndices);
1135 for(Int_t digIndex=0; digIndex<kMaxNumberOfDigitsPerVolume; digIndex++) {
1136 if (digitsInVolumeIndices[digIndex]<0) continue;
1137 digitInteresting = (AliTOFdigit*)fDigits->UncheckedAt(digitsInVolumeIndices[digIndex]);
1138 if (digitInteresting->GetToT()<=0) continue; // AdC
1139 digitIndexLocal++; // AdC
1141 AliDebug(1,Form(" %2d %1d %2d %1d %2d %f %f %f %f %5d %5d %5d %5d",
1142 vol[0], vol[1], vol[2] ,vol[4], vol[3],
1143 digitInteresting->GetTdc(), digitInteresting->GetAdc(),
1144 digitInteresting->GetToT(), digitInteresting->GetToT()*digitInteresting->GetToT(),
1145 digitsInVolumeIndices[digIndex],
1146 digitInteresting->GetTrack(0), digitInteresting->GetTrack(1), digitInteresting->GetTrack(2)));
1148 selectedDigit[interestingCounter][digitIndexLocal] = new // AdC
1149 AliTOFselectedDigit(vol, digitInteresting->GetTdc(),
1150 digitInteresting->GetAdc(), digitInteresting->GetToT(),
1151 digitInteresting->GetToT()*digitInteresting->GetToT(),
1152 digitsInVolumeIndices[digIndex],
1153 digitInteresting->GetTracks());
1155 if (digitIndexLocal==-1) interestingCounter--; // AdC
1158 AliDebug(1,Form(" e adesso %1d", interestingCounter+1));
1160 for (Int_t adesso1=0; adesso1<interestingCounter+1; adesso1++) {
1161 for (Int_t firstIndex=0; firstIndex<kMaxNumberOfDigitsPerVolume; firstIndex++) {
1162 if (selectedDigit[adesso1][firstIndex]==0x0) continue;
1164 for (Int_t adesso2=adesso1+1; adesso2<interestingCounter+1; adesso2++) {
1165 for (Int_t secondIndex=0; secondIndex<kMaxNumberOfDigitsPerVolume; secondIndex++) {
1166 if (selectedDigit[adesso2][secondIndex]==0x0) continue;
1168 for (Int_t adesso3=adesso2+1; adesso3<interestingCounter+1; adesso3++) {
1169 for (Int_t thirdIndex=0; thirdIndex<kMaxNumberOfDigitsPerVolume; thirdIndex++) {
1170 if (selectedDigit[adesso3][thirdIndex]==0x0) continue;
1173 if (TMath::Abs(selectedDigit[adesso1][firstIndex]->GetTDC()-selectedDigit[adesso2][secondIndex]->GetTDC())>fMaxDeltaTime
1175 TMath::Abs(selectedDigit[adesso1][firstIndex]->GetTDC()-selectedDigit[adesso3][thirdIndex]->GetTDC())>fMaxDeltaTime
1177 TMath::Abs(selectedDigit[adesso2][secondIndex]->GetTDC()-selectedDigit[adesso3][thirdIndex]->GetTDC())>fMaxDeltaTime) continue;
1179 interestingTOF[0] = selectedDigit[adesso1][firstIndex]->GetTDC();
1180 interestingTOT[0] = selectedDigit[adesso1][firstIndex]->GetTOT();
1181 interestingADC[0] = selectedDigit[adesso1][firstIndex]->GetADC();
1182 interestingWeight[0] = selectedDigit[adesso1][firstIndex]->GetWeight();
1183 Int_t vol1[5]; for(jj=0; jj<5; jj++) vol1[jj] = selectedDigit[adesso1][firstIndex]->GetDetectorIndex(jj);
1184 AliDebug(1,Form(" %2d %1d %2d %1d %2d", vol1[0], vol1[1], vol1[2], vol1[4], vol1[3]));
1185 Int_t volDum = vol1[3];
1188 fTOFGeometry->GetPosPar(vol1,pos);
1189 interestingX[0] = pos[0];
1190 interestingY[0] = pos[1];
1191 interestingZ[0] = pos[2];
1193 interestingTOF[1] = selectedDigit[adesso2][secondIndex]->GetTDC();
1194 interestingTOT[1] = selectedDigit[adesso2][secondIndex]->GetTOT();
1195 interestingADC[1] = selectedDigit[adesso2][secondIndex]->GetADC();
1196 interestingWeight[1] = selectedDigit[adesso2][secondIndex]->GetWeight();
1197 Int_t vol2[5]; for(jj=0; jj<5; jj++) vol2[jj] = selectedDigit[adesso2][secondIndex]->GetDetectorIndex(jj);
1198 AliDebug(1,Form(" %2d %1d %2d %1d %2d", vol2[0], vol2[1], vol2[2], vol2[4], vol2[3]));
1202 fTOFGeometry->GetPosPar(vol2,pos);
1203 interestingX[1] = pos[0];
1204 interestingY[1] = pos[1];
1205 interestingZ[1] = pos[2];
1207 interestingTOF[2] = selectedDigit[adesso3][thirdIndex]->GetTDC();
1208 interestingTOT[2] = selectedDigit[adesso3][thirdIndex]->GetTOT();
1209 interestingADC[2] = selectedDigit[adesso3][thirdIndex]->GetADC();
1210 interestingWeight[2] = selectedDigit[adesso3][thirdIndex]->GetWeight();
1211 Int_t vol3[5]; for(jj=0; jj<5; jj++) vol3[jj] = selectedDigit[adesso3][thirdIndex]->GetDetectorIndex(jj);
1212 AliDebug(1,Form(" %2d %1d %2d %1d %2d", vol3[0], vol3[1], vol3[2], vol3[4], vol3[3]));
1216 fTOFGeometry->GetPosPar(vol3,pos);
1217 interestingX[2] = pos[0];
1218 interestingY[2] = pos[1];
1219 interestingZ[2] = pos[2];
1222 AverageCalculations(3, interestingX, interestingY, interestingZ,
1223 interestingTOF, interestingTOT, interestingADC,
1225 parTOF, posClus, check);
1228 for (jj=0; jj<5; jj++) det[jj] = -1;
1229 for (jj=0; jj<3; jj++) posF[jj] = posClus[jj];
1230 fTOFGeometry->GetDetID(posF, det);
1232 volIdClus = fTOFGeometry->GetAliSensVolIndex(det[0],det[1],det[2]);
1233 //volIdClus = GetClusterVolIndex(det);
1235 for (jj=3; jj<11; jj++) padsCluster[jj] = -1;
1236 padsCluster[3] = selectedDigit[adesso1][firstIndex]->GetDetectorIndex(4);
1237 padsCluster[4] = selectedDigit[adesso1][firstIndex]->GetDetectorIndex(3);
1238 padsCluster[5] = selectedDigit[adesso2][secondIndex]->GetDetectorIndex(4);
1239 padsCluster[6] = selectedDigit[adesso2][secondIndex]->GetDetectorIndex(3);
1240 padsCluster[7] = selectedDigit[adesso3][thirdIndex]->GetDetectorIndex(4);
1241 padsCluster[8] = selectedDigit[adesso3][thirdIndex]->GetDetectorIndex(3);
1243 for (jj=0; jj<6; jj++) covClus[jj] = 0.;
1244 Int_t ** indDet = new Int_t*[3];
1245 for (jj=0; jj<3; jj++) indDet[jj] = new Int_t [5];
1246 for (jj=0; jj<3; jj++) indDet[jj][0] = nSector;
1247 for (jj=0; jj<3; jj++) indDet[jj][1] = nPlate;
1248 for (jj=0; jj<3; jj++) indDet[jj][2] = nStrip;
1249 for (jj=0; jj<3; jj++) indDet[jj][3] = padsCluster[2*jj+3];
1250 for (jj=0; jj<3; jj++) indDet[jj][4] = padsCluster[2*jj+1+3];
1251 GetClusterPars(/*check,*/ 3, indDet, interestingWeight, posClus, covClus);
1252 for (jj=0; jj<3; jj++) delete [] indDet[jj];
1254 // To fill the track index array
1256 for (jj=0; jj<kMaxNumberOfTracksPerDigit; jj++) tracks[jj] = -1;
1257 for (Int_t kk=0; kk<kMaxNumberOfTracksPerDigit; kk++) { // three is the max number of tracks associated to one digit
1258 if (selectedDigit[adesso1][firstIndex]->GetTrackLabel(kk)==-1) continue;
1261 tracks[dummyCounter] = selectedDigit[adesso1][firstIndex]->GetTrackLabel(kk);
1264 for (Int_t kk=0; kk<kMaxNumberOfTracksPerDigit; kk++) { // three is the max number of tracks associated to one digit
1265 if (selectedDigit[adesso2][secondIndex]->GetTrackLabel(kk)==-1) continue;
1268 alreadyStored = kFALSE;
1269 for (jj=0; jj<dummyCounter+1; jj++)
1270 alreadyStored = alreadyStored || (tracks[jj]!=-1 && tracks[jj]==selectedDigit[adesso2][secondIndex]->GetTrackLabel(kk));
1272 if (alreadyStored) continue;
1273 if (dummyCounter==2) { // three is the max number of tracks associated to one cluster
1274 AliWarning(" Siamo al limite!");
1279 tracks[dummyCounter] = selectedDigit[adesso2][secondIndex]->GetTrackLabel(kk);
1284 for (Int_t kk=0; kk<kMaxNumberOfTracksPerDigit; kk++) { // three is the max number of tracks associated to one digit
1285 if (selectedDigit[adesso3][thirdIndex]->GetTrackLabel(kk)==-1) continue;
1288 alreadyStored = kFALSE;
1289 for (jj=0; jj<dummyCounter+1; jj++)
1290 alreadyStored = alreadyStored || (tracks[jj]!=-1 && tracks[jj]==selectedDigit[adesso3][thirdIndex]->GetTrackLabel(kk));
1292 if (alreadyStored) continue;
1293 if (dummyCounter==2) { // three is the max number of tracks associated to one cluster
1294 AliWarning(" Siamo al limite!");
1299 tracks[dummyCounter] = selectedDigit[adesso3][thirdIndex]->GetTrackLabel(kk);
1306 AliTOFcluster *tofCluster =
1307 new AliTOFcluster(volIdClus, posClus[0], posClus[1], posClus[2],
1308 covClus[0], covClus[1], covClus[2], covClus[3], covClus[4], covClus[5],
1309 tracks, det, parTOF, status, selectedDigit[adesso1][firstIndex]->GetIndex()); // to be updated
1310 InsertCluster(tofCluster);
1312 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",
1313 volIdClus, posClus[0], posClus[1], posClus[2],
1314 covClus[0], covClus[1], covClus[2], covClus[3], covClus[4], covClus[5],
1315 tracks[0], tracks[1], tracks[2],
1316 det[0], det[1], det[2], det[3], det[4],
1317 parTOF[0], parTOF[1], parTOF[2], parTOF[3], parTOF[4],
1318 status, selectedDigit[adesso1][firstIndex]->GetIndex()));
1324 fTOFdigitMap->ResetDigitNumber(vol1,selectedDigit[adesso1][firstIndex]->GetIndex());
1328 fTOFdigitMap->ResetDigitNumber(vol2,selectedDigit[adesso2][secondIndex]->GetIndex());
1332 fTOFdigitMap->ResetDigitNumber(vol3,selectedDigit[adesso3][thirdIndex]->GetIndex());
1335 } // close loop on third digit
1336 } // close loop on adesso3
1338 } // close loop on second digit
1339 } // close loop on adesso2
1341 } // close loop on first digit
1342 } // close loop on adesso1
1344 for (ii=0; ii<kMaxNumberOfInterestingPads; ii++)
1345 for (jj=0; jj<kMaxNumberOfDigitsPerVolume; jj++)
1346 selectedDigit[ii][jj] = 0x0;
1350 for (ii=0; ii<kMaxNumberOfInterestingPads; ii++)
1351 for (jj=0; jj<kMaxNumberOfDigitsPerVolume; jj++) {
1352 delete selectedDigit[ii][jj];
1353 selectedDigit[ii][jj] = 0x0;
1358 //_____________________________________________________________________________
1360 void AliTOFClusterFinderV1::FindClusters23(Int_t nSector,
1365 // This function searches the neighbouring digits (stored in the fDigits object),
1366 // to perform clusters (stored in the fTofClusters array).
1368 // This research has been made by checking the fTOFdigitMap object,
1369 // filled at digits/raw-data reading time.
1372 const Int_t kMaxNumberOfInterestingPads = 4;
1373 const Int_t kMaxNumberOfTracksPerDigit = 3;
1374 const Int_t kMaxNumberOfDigitsPerVolume = 3;
1378 Int_t digitsInVolumeIndices[kMaxNumberOfDigitsPerVolume];
1379 for (ii=0; ii<kMaxNumberOfDigitsPerVolume; ii++)
1380 digitsInVolumeIndices[ii] = -1;
1382 Int_t vol[5] = {nSector,nPlate,nStrip,-1,-1};
1384 Float_t pos[3] = {0.,0.,0.};
1387 Int_t interestingPadX[kMaxNumberOfInterestingPads];
1388 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingPadX[jj] = -1;
1389 Int_t interestingPadZ[kMaxNumberOfInterestingPads];
1390 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingPadZ[jj] = -1;
1391 Double_t interestingTOT[kMaxNumberOfInterestingPads];
1392 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingTOT[jj] = 0;
1393 Double_t interestingADC[kMaxNumberOfInterestingPads];
1394 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingADC[jj] = 0;
1395 Double_t interestingTOF[kMaxNumberOfInterestingPads];
1396 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingTOF[jj] = 0;
1397 Double_t interestingWeight[kMaxNumberOfInterestingPads];
1398 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingWeight[jj] = 0;
1400 Float_t interestingX[kMaxNumberOfInterestingPads];
1401 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingX[jj] = 0;
1402 Float_t interestingY[kMaxNumberOfInterestingPads];
1403 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingY[jj] = 0;
1404 Float_t interestingZ[kMaxNumberOfInterestingPads];
1405 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingZ[jj] = 0;
1407 Float_t interDigit[kMaxNumberOfInterestingPads];
1408 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interDigit[jj] = 0;
1410 Int_t padsCluster[11];
1411 padsCluster[0] = nSector;
1412 padsCluster[1] = nPlate;
1413 padsCluster[2] = nStrip;
1414 for (jj=3; jj<11; jj++) padsCluster[jj] = -1;
1416 Int_t interestingCounter=-1;
1417 Int_t digitIndexLocal = -1;
1422 Bool_t check = kFALSE;
1424 for (jj=0; jj<5; jj++) parTOF[jj] = 0;
1425 Double_t posClus[3];
1426 for (jj=0; jj<3; jj++) posClus[jj] = 0.;
1428 for (jj=0; jj<5; jj++) det[jj] = -1;
1430 for (jj=0; jj<3; jj++) posF[jj] = 0.;
1431 UShort_t volIdClus = 0;
1432 Bool_t status = kTRUE; //assume all sim channels ok in the beginning...
1433 Double_t covClus[6];
1434 for (jj=0; jj<6; jj++) covClus[jj] = 0.;
1435 Int_t tracks[kMaxNumberOfTracksPerDigit];
1436 for (jj=0; jj<3; jj++) tracks[jj] = -1;
1437 Int_t dummyCounter=-1;
1438 Bool_t alreadyStored = kFALSE;
1440 AliTOFselectedDigit ***selectedDigit = new AliTOFselectedDigit**[kMaxNumberOfInterestingPads];
1441 for (ii=0; ii<kMaxNumberOfInterestingPads; ii++)
1442 selectedDigit[ii] = new AliTOFselectedDigit*[kMaxNumberOfDigitsPerVolume];
1444 for (ii=0; ii<kMaxNumberOfInterestingPads; ii++)
1445 for (jj=0; jj<kMaxNumberOfDigitsPerVolume; jj++) selectedDigit[ii][jj] = 0x0;
1447 AliTOFdigit *digitInteresting;
1449 for (iPad=0; iPad<AliTOFGeometry::NpadZ()*AliTOFGeometry::NpadX()-3; iPad+=2) {
1451 iPadZ = iPad%AliTOFGeometry::NpadZ(); //iPad%2;
1452 iPadX = iPad/AliTOFGeometry::NpadZ(); //iPad/2;
1454 AliDebug(3, Form("%2d %1d %2d\n", iPad, iPadZ, iPadX));
1461 interestingCounter=-1;
1463 vol[4] = iPadZ , vol[3] = iPadX;
1464 if (fTOFdigitMap->GetNumberOfDigits(vol)>0)
1465 interestingCounter++;
1467 vol[4] = iPadZ, vol[3] = iPadX+1;
1468 if (fTOFdigitMap->GetNumberOfDigits(vol)>0)
1469 interestingCounter++;
1471 vol[4] = AliTOFGeometry::NpadZ()-(iPadZ+1), vol[3] = iPadX;
1472 if (fTOFdigitMap->GetNumberOfDigits(vol)>0)
1473 interestingCounter++;
1475 vol[4] = AliTOFGeometry::NpadZ()-(iPadZ+1), vol[3] = iPadX+1;
1476 if (fTOFdigitMap->GetNumberOfDigits(vol)>0)
1477 interestingCounter++;
1479 if (interestingCounter+1!=3) continue; // the hit pads have to be 3
1480 else interestingCounter=-1;
1483 for (ii=0; ii<kMaxNumberOfInterestingPads; ii++)
1484 for (jj=0; jj<kMaxNumberOfDigitsPerVolume; jj++)
1485 selectedDigit[ii][jj] = 0x0;
1488 vol[4] = iPadZ, vol[3] = iPadX;
1490 if (fTOFdigitMap->GetNumberOfDigits(vol)>0) {
1491 interestingCounter++;
1492 for (ii=0; ii<kMaxNumberOfDigitsPerVolume; ii++)
1493 digitsInVolumeIndices[ii] = -1;
1494 fTOFdigitMap->GetDigitIndex(vol, digitsInVolumeIndices);
1496 for(Int_t digIndex=0; digIndex<kMaxNumberOfDigitsPerVolume; digIndex++) {
1497 if (digitsInVolumeIndices[digIndex]<0) continue;
1498 digitInteresting = (AliTOFdigit*)fDigits->UncheckedAt(digitsInVolumeIndices[digIndex]);
1499 if (digitInteresting->GetToT()<=0) continue; // AdC
1500 digitIndexLocal++; // AdC
1502 AliDebug(1,Form(" %2d %1d %2d %1d %2d %f %f %f %f %5d %5d %5d %5d",
1503 vol[0], vol[1], vol[2] ,vol[4], vol[3],
1504 digitInteresting->GetTdc(), digitInteresting->GetAdc(),
1505 digitInteresting->GetToT(), digitInteresting->GetToT()*digitInteresting->GetToT(),
1506 digitsInVolumeIndices[digIndex],
1507 digitInteresting->GetTrack(0), digitInteresting->GetTrack(1), digitInteresting->GetTrack(2)));
1509 selectedDigit[interestingCounter][digitIndexLocal] = new // AdC
1510 AliTOFselectedDigit(vol, digitInteresting->GetTdc(),
1511 digitInteresting->GetAdc(), digitInteresting->GetToT(),
1512 digitInteresting->GetToT()*digitInteresting->GetToT(),
1513 digitsInVolumeIndices[digIndex],
1514 digitInteresting->GetTracks());
1516 if (digitIndexLocal==-1) interestingCounter--; // AdC
1520 vol[4] = iPadZ, vol[3] = iPadX+1;
1522 if (fTOFdigitMap->GetNumberOfDigits(vol)>0) {
1523 interestingCounter++;
1524 for (ii=0; ii<kMaxNumberOfDigitsPerVolume; ii++)
1525 digitsInVolumeIndices[ii] = -1;
1526 fTOFdigitMap->GetDigitIndex(vol, digitsInVolumeIndices);
1527 digitIndexLocal=-1; // AdC
1528 for(Int_t digIndex=0; digIndex<kMaxNumberOfDigitsPerVolume; digIndex++) {
1529 if (digitsInVolumeIndices[digIndex]<0) continue;
1530 digitInteresting = (AliTOFdigit*)fDigits->UncheckedAt(digitsInVolumeIndices[digIndex]);
1531 if (digitInteresting->GetToT()<=0) continue; // AdC
1532 digitIndexLocal++; // AdC
1534 AliDebug(1,Form(" %2d %1d %2d %1d %2d %f %f %f %f %5d %5d %5d %5d",
1535 vol[0], vol[1], vol[2] ,vol[4], vol[3],
1536 digitInteresting->GetTdc(), digitInteresting->GetAdc(),
1537 digitInteresting->GetToT(), digitInteresting->GetToT()*digitInteresting->GetToT(),
1538 digitsInVolumeIndices[digIndex],
1539 digitInteresting->GetTrack(0), digitInteresting->GetTrack(1), digitInteresting->GetTrack(2)));
1541 selectedDigit[interestingCounter][digitIndexLocal] = new // AdC
1542 AliTOFselectedDigit(vol, digitInteresting->GetTdc(),
1543 digitInteresting->GetAdc(), digitInteresting->GetToT(),
1544 digitInteresting->GetToT()*digitInteresting->GetToT(),
1545 digitsInVolumeIndices[digIndex],
1546 digitInteresting->GetTracks());
1548 if (digitIndexLocal==-1) interestingCounter--; // AdC
1552 vol[4] = AliTOFGeometry::NpadZ()-(iPadZ+1), vol[3] = iPadX;
1554 if (fTOFdigitMap->GetNumberOfDigits(vol)>0) {
1555 interestingCounter++;
1556 for (ii=0; ii<kMaxNumberOfDigitsPerVolume; ii++)
1557 digitsInVolumeIndices[ii] = -1;
1558 fTOFdigitMap->GetDigitIndex(vol, digitsInVolumeIndices);
1559 digitIndexLocal=-1; // AdC
1560 for(Int_t digIndex=0; digIndex<kMaxNumberOfDigitsPerVolume; digIndex++) {
1561 if (digitsInVolumeIndices[digIndex]<0) continue;
1562 digitInteresting = (AliTOFdigit*)fDigits->UncheckedAt(digitsInVolumeIndices[digIndex]);
1563 if (digitInteresting->GetToT()<=0) continue; // AdC
1564 digitIndexLocal++; // AdC
1566 AliDebug(1,Form(" %2d %1d %2d %1d %2d %f %f %f %f %5d %5d %5d %5d",
1567 vol[0], vol[1], vol[2] ,vol[4], vol[3],
1568 digitInteresting->GetTdc(), digitInteresting->GetAdc(),
1569 digitInteresting->GetToT(), digitInteresting->GetToT()*digitInteresting->GetToT(),
1570 digitsInVolumeIndices[digIndex],
1571 digitInteresting->GetTrack(0), digitInteresting->GetTrack(1), digitInteresting->GetTrack(2)));
1573 selectedDigit[interestingCounter][digitIndexLocal] = new // AdC
1574 AliTOFselectedDigit(vol, digitInteresting->GetTdc(),
1575 digitInteresting->GetAdc(), digitInteresting->GetToT(),
1576 digitInteresting->GetToT()*digitInteresting->GetToT(),
1577 digitsInVolumeIndices[digIndex],
1578 digitInteresting->GetTracks());
1580 if (digitIndexLocal==-1) interestingCounter--; // AdC
1584 vol[4] = AliTOFGeometry::NpadZ()-(iPadZ+1), vol[3] = iPadX+1;
1586 if (fTOFdigitMap->GetNumberOfDigits(vol)>0) {
1587 interestingCounter++;
1588 for (ii=0; ii<kMaxNumberOfDigitsPerVolume; ii++)
1589 digitsInVolumeIndices[ii] = -1;
1590 fTOFdigitMap->GetDigitIndex(vol, digitsInVolumeIndices);
1591 digitIndexLocal=-1; // AdC
1592 for(Int_t digIndex=0; digIndex<kMaxNumberOfDigitsPerVolume; digIndex++) {
1593 if (digitsInVolumeIndices[digIndex]<0) continue;
1594 digitInteresting = (AliTOFdigit*)fDigits->UncheckedAt(digitsInVolumeIndices[digIndex]);
1595 if (digitInteresting->GetToT()<=0) continue; // AdC
1596 digitIndexLocal++; // AdC
1598 AliDebug(1,Form(" %2d %1d %2d %1d %2d %f %f %f %f %5d %5d %5d %5d",
1599 vol[0], vol[1], vol[2] ,vol[4], vol[3],
1600 digitInteresting->GetTdc(), digitInteresting->GetAdc(),
1601 digitInteresting->GetToT(), digitInteresting->GetToT()*digitInteresting->GetToT(),
1602 digitsInVolumeIndices[digIndex],
1603 digitInteresting->GetTrack(0), digitInteresting->GetTrack(1), digitInteresting->GetTrack(2)));
1605 selectedDigit[interestingCounter][digitIndexLocal] = new // AdC
1606 AliTOFselectedDigit(vol, digitInteresting->GetTdc(),
1607 digitInteresting->GetAdc(), digitInteresting->GetToT(),
1608 digitInteresting->GetToT()*digitInteresting->GetToT(),
1609 digitsInVolumeIndices[digIndex],
1610 digitInteresting->GetTracks());
1612 if (digitIndexLocal==-1) interestingCounter--; // AdC
1615 AliDebug(1,Form(" e adesso %1d", interestingCounter+1));
1617 for (Int_t adesso1=0; adesso1<interestingCounter+1; adesso1++) {
1618 for (Int_t firstIndex=0; firstIndex<kMaxNumberOfDigitsPerVolume; firstIndex++) {
1619 if (selectedDigit[adesso1][firstIndex]==0x0) continue;
1621 for (Int_t adesso2=adesso1+1; adesso2<interestingCounter+1; adesso2++) {
1622 for (Int_t secondIndex=0; secondIndex<kMaxNumberOfDigitsPerVolume; secondIndex++) {
1623 if (selectedDigit[adesso2][secondIndex]==0x0) continue;
1625 if (TMath::Abs(selectedDigit[adesso1][firstIndex]->GetTDC()-selectedDigit[adesso2][secondIndex]->GetTDC())>fMaxDeltaTime) continue;
1627 interestingTOF[0] = selectedDigit[adesso1][firstIndex]->GetTDC();
1628 interestingTOT[0] = selectedDigit[adesso1][firstIndex]->GetTOT();
1629 interestingADC[0] = selectedDigit[adesso1][firstIndex]->GetADC();
1630 interestingWeight[0] = selectedDigit[adesso1][firstIndex]->GetWeight();
1631 Int_t vol1[5]; for(jj=0; jj<5; jj++) vol1[jj] = selectedDigit[adesso1][firstIndex]->GetDetectorIndex(jj);
1632 AliDebug(1,Form(" %2d %1d %2d %1d %2d", vol1[0], vol1[1], vol1[2], vol1[4], vol1[3]));
1633 Int_t volDum = vol1[3];
1636 fTOFGeometry->GetPosPar(vol1,pos);
1637 interestingX[0] = pos[0];
1638 interestingY[0] = pos[1];
1639 interestingZ[0] = pos[2];
1641 interestingTOF[1] = selectedDigit[adesso2][secondIndex]->GetTDC();
1642 interestingTOT[1] = selectedDigit[adesso2][secondIndex]->GetTOT();
1643 interestingADC[1] = selectedDigit[adesso2][secondIndex]->GetADC();
1644 interestingWeight[1] = selectedDigit[adesso2][secondIndex]->GetWeight();
1645 Int_t vol2[5]; for(jj=0; jj<5; jj++) vol2[jj] = selectedDigit[adesso2][secondIndex]->GetDetectorIndex(jj);
1646 AliDebug(1,Form(" %2d %1d %2d %1d %2d", vol2[0], vol2[1], vol2[2], vol2[4], vol2[3]));
1650 fTOFGeometry->GetPosPar(vol2,pos);
1651 interestingX[1] = pos[0];
1652 interestingY[1] = pos[1];
1653 interestingZ[1] = pos[2];
1655 AverageCalculations(2, interestingX, interestingY, interestingZ,
1656 interestingTOF, interestingTOT, interestingADC,
1658 parTOF, posClus, check);
1660 for (jj=0; jj<5; jj++) det[jj] = -1;
1661 for (jj=0; jj<3; jj++) posF[jj] = posClus[jj];
1662 fTOFGeometry->GetDetID(posF, det);
1664 volIdClus = fTOFGeometry->GetAliSensVolIndex(det[0],det[1],det[2]);
1665 //volIdClus = GetClusterVolIndex(det);
1667 for (jj=3; jj<11; jj++) padsCluster[jj] = -1;
1668 padsCluster[3] = selectedDigit[adesso1][firstIndex]->GetDetectorIndex(4);
1669 padsCluster[4] = selectedDigit[adesso1][firstIndex]->GetDetectorIndex(3);
1670 padsCluster[5] = selectedDigit[adesso2][secondIndex]->GetDetectorIndex(4);
1671 padsCluster[6] = selectedDigit[adesso2][secondIndex]->GetDetectorIndex(3);
1673 for (jj=0; jj<6; jj++) covClus[jj] = 0.;
1674 Int_t ** indDet = new Int_t*[2];
1675 for (jj=0; jj<2; jj++) indDet[jj] = new Int_t [5];
1676 for (jj=0; jj<2; jj++) indDet[jj][0] = nSector;
1677 for (jj=0; jj<2; jj++) indDet[jj][1] = nPlate;
1678 for (jj=0; jj<2; jj++) indDet[jj][2] = nStrip;
1679 for (jj=0; jj<2; jj++) indDet[jj][3] = padsCluster[2*jj+3];
1680 for (jj=0; jj<2; jj++) indDet[jj][4] = padsCluster[2*jj+1+3];
1681 GetClusterPars(/*check,*/ 2, indDet, interestingWeight, posClus, covClus);
1682 for (jj=0; jj<2; jj++) delete [] indDet[jj];
1684 // To fill the track index array
1686 for (jj=0; jj<kMaxNumberOfTracksPerDigit; jj++) tracks[jj] = -1;
1687 for (Int_t kk=0; kk<kMaxNumberOfTracksPerDigit; kk++) { // three is the max number of tracks associated to one digit
1688 if (selectedDigit[adesso1][firstIndex]->GetTrackLabel(kk)==-1) continue;
1691 tracks[dummyCounter] = selectedDigit[adesso1][firstIndex]->GetTrackLabel(kk);
1694 for (Int_t kk=0; kk<kMaxNumberOfTracksPerDigit; kk++) { // three is the max number of tracks associated to one digit
1695 if (selectedDigit[adesso2][secondIndex]->GetTrackLabel(kk)==-1) continue;
1698 alreadyStored = kFALSE;
1699 for (jj=0; jj<dummyCounter+1; jj++)
1700 alreadyStored = alreadyStored || (tracks[jj]!=-1 && tracks[jj]==selectedDigit[adesso2][secondIndex]->GetTrackLabel(kk));
1702 if (alreadyStored) continue;
1703 if (dummyCounter==2) { // three is the max number of tracks associated to one cluster
1704 AliWarning(" Siamo al limite!");
1709 tracks[dummyCounter] = selectedDigit[adesso2][secondIndex]->GetTrackLabel(kk);
1716 AliTOFcluster *tofCluster =
1717 new AliTOFcluster(volIdClus, posClus[0], posClus[1], posClus[2],
1718 covClus[0], covClus[1], covClus[2], covClus[3], covClus[4], covClus[5],
1719 tracks, det, parTOF, status, selectedDigit[adesso1][firstIndex]->GetIndex()); // to be updated
1720 InsertCluster(tofCluster);
1722 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",
1723 volIdClus, posClus[0], posClus[1], posClus[2],
1724 covClus[0], covClus[1], covClus[2], covClus[3], covClus[4], covClus[5],
1725 tracks[0], tracks[1], tracks[2],
1726 det[0], det[1], det[2], det[3], det[4],
1727 parTOF[0], parTOF[1], parTOF[2], parTOF[3], parTOF[4],
1728 status, selectedDigit[adesso1][firstIndex]->GetIndex()));
1733 fTOFdigitMap->ResetDigitNumber(vol1,selectedDigit[adesso1][firstIndex]->GetIndex());
1737 fTOFdigitMap->ResetDigitNumber(vol2,selectedDigit[adesso2][secondIndex]->GetIndex());
1740 } // close loop on second digit
1741 } // close loop on adesso2
1743 } // close loop on first digit
1744 } // close loop on adesso1
1746 for (ii=0; ii<kMaxNumberOfInterestingPads; ii++)
1747 for (jj=0; jj<kMaxNumberOfDigitsPerVolume; jj++)
1748 selectedDigit[ii][jj] = 0x0;
1752 for (ii=0; ii<kMaxNumberOfInterestingPads; ii++)
1753 for (jj=0; jj<kMaxNumberOfDigitsPerVolume; jj++) {
1754 delete selectedDigit[ii][jj];
1755 selectedDigit[ii][jj] = 0x0;
1760 //_____________________________________________________________________________
1762 void AliTOFClusterFinderV1::FindClusters24(Int_t nSector,
1767 // This function searches the neighbouring digits (stored in the fDigits object),
1768 // to perform clusters (stored in the fTofClusters array).
1770 // This research has been made by checking the fTOFdigitMap object,
1771 // filled at digits/raw-data reading time.
1774 const Int_t kMaxNumberOfInterestingPads = 4;
1775 const Int_t kMaxNumberOfTracksPerDigit = 3;
1776 const Int_t kMaxNumberOfDigitsPerVolume = 3;
1780 Int_t digitsInVolumeIndices[kMaxNumberOfDigitsPerVolume];
1781 for (ii=0; ii<kMaxNumberOfDigitsPerVolume; ii++)
1782 digitsInVolumeIndices[ii] = -1;
1784 Int_t vol[5] = {nSector,nPlate,nStrip,-1,-1};
1786 Float_t pos[3] = {0.,0.,0.};
1789 Int_t interestingPadX[kMaxNumberOfInterestingPads];
1790 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingPadX[jj] = -1;
1791 Int_t interestingPadZ[kMaxNumberOfInterestingPads];
1792 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingPadZ[jj] = -1;
1793 Double_t interestingTOT[kMaxNumberOfInterestingPads];
1794 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingTOT[jj] = 0;
1795 Double_t interestingADC[kMaxNumberOfInterestingPads];
1796 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingADC[jj] = 0;
1797 Double_t interestingTOF[kMaxNumberOfInterestingPads];
1798 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingTOF[jj] = 0;
1799 Double_t interestingWeight[kMaxNumberOfInterestingPads];
1800 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingWeight[jj] = 0;
1802 Float_t interestingX[kMaxNumberOfInterestingPads];
1803 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingX[jj] = 0;
1804 Float_t interestingY[kMaxNumberOfInterestingPads];
1805 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingY[jj] = 0;
1806 Float_t interestingZ[kMaxNumberOfInterestingPads];
1807 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingZ[jj] = 0;
1809 Float_t interDigit[kMaxNumberOfInterestingPads];
1810 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interDigit[jj] = 0;
1812 Int_t padsCluster[11];
1813 padsCluster[0] = nSector;
1814 padsCluster[1] = nPlate;
1815 padsCluster[2] = nStrip;
1816 for (jj=3; jj<11; jj++) padsCluster[jj] = -1;
1818 Int_t interestingCounter=-1;
1819 Int_t digitIndexLocal = -1;
1824 Bool_t check = kFALSE;
1826 for (jj=0; jj<5; jj++) parTOF[jj] = 0;
1827 Double_t posClus[3];
1828 for (jj=0; jj<3; jj++) posClus[jj] = 0.;
1830 for (jj=0; jj<5; jj++) det[jj] = -1;
1832 for (jj=0; jj<3; jj++) posF[jj] = 0.;
1833 UShort_t volIdClus = 0;
1834 Bool_t status = kTRUE; //assume all sim channels ok in the beginning...
1835 Double_t covClus[6];
1836 for (jj=0; jj<6; jj++) covClus[jj] = 0.;
1837 Int_t tracks[kMaxNumberOfTracksPerDigit];
1838 for (jj=0; jj<3; jj++) tracks[jj] = -1;
1839 Int_t dummyCounter=-1;
1840 Bool_t alreadyStored = kFALSE;
1842 AliTOFselectedDigit ***selectedDigit = new AliTOFselectedDigit**[kMaxNumberOfInterestingPads];
1843 for (ii=0; ii<kMaxNumberOfInterestingPads; ii++)
1844 selectedDigit[ii] = new AliTOFselectedDigit*[kMaxNumberOfDigitsPerVolume];
1846 for (ii=0; ii<kMaxNumberOfInterestingPads; ii++)
1847 for (jj=0; jj<kMaxNumberOfDigitsPerVolume; jj++) selectedDigit[ii][jj] = 0x0;
1849 AliTOFdigit *digitInteresting;
1851 for (iPad=0; iPad<AliTOFGeometry::NpadZ()*AliTOFGeometry::NpadX()-3; iPad+=2) {
1853 iPadZ = iPad%AliTOFGeometry::NpadZ(); //iPad%2;
1854 iPadX = iPad/AliTOFGeometry::NpadZ(); //iPad/2;
1856 AliDebug(3, Form("%2d %1d %2d\n", iPad, iPadZ, iPadX));
1863 interestingCounter=-1;
1865 vol[4] = iPadZ , vol[3] = iPadX;
1866 if (fTOFdigitMap->GetNumberOfDigits(vol)>0)
1867 interestingCounter++;
1869 vol[4] = iPadZ, vol[3] = iPadX+1;
1870 if (fTOFdigitMap->GetNumberOfDigits(vol)>0)
1871 interestingCounter++;
1873 vol[4] = AliTOFGeometry::NpadZ()-(iPadZ+1), vol[3] = iPadX;
1874 if (fTOFdigitMap->GetNumberOfDigits(vol)>0)
1875 interestingCounter++;
1877 vol[4] = AliTOFGeometry::NpadZ()-(iPadZ+1), vol[3] = iPadX+1;
1878 if (fTOFdigitMap->GetNumberOfDigits(vol)>0)
1879 interestingCounter++;
1881 if (interestingCounter+1!=4) continue; // the hit pads have to be 4
1882 else interestingCounter=-1;
1885 for (ii=0; ii<kMaxNumberOfInterestingPads; ii++)
1886 for (jj=0; jj<kMaxNumberOfDigitsPerVolume; jj++)
1887 selectedDigit[ii][jj] = 0x0;
1890 vol[4] = iPadZ, vol[3] = iPadX;
1892 if (fTOFdigitMap->GetNumberOfDigits(vol)>0) {
1893 interestingCounter++;
1894 for (ii=0; ii<kMaxNumberOfDigitsPerVolume; ii++)
1895 digitsInVolumeIndices[ii] = -1;
1896 fTOFdigitMap->GetDigitIndex(vol, digitsInVolumeIndices);
1897 digitIndexLocal=-1; // AdC
1898 for(Int_t digIndex=0; digIndex<kMaxNumberOfDigitsPerVolume; digIndex++) {
1899 if (digitsInVolumeIndices[digIndex]<0) continue;
1900 digitInteresting = (AliTOFdigit*)fDigits->UncheckedAt(digitsInVolumeIndices[digIndex]);
1901 if (digitInteresting->GetToT()<=0) continue; // AdC
1902 digitIndexLocal++; // AdC
1904 AliDebug(1,Form(" %2d %1d %2d %1d %2d %f %f %f %f %5d %5d %5d %5d",
1905 vol[0], vol[1], vol[2] ,vol[4], vol[3],
1906 digitInteresting->GetTdc(), digitInteresting->GetAdc(),
1907 digitInteresting->GetToT(), digitInteresting->GetToT()*digitInteresting->GetToT(),
1908 digitsInVolumeIndices[digIndex],
1909 digitInteresting->GetTrack(0), digitInteresting->GetTrack(1), digitInteresting->GetTrack(2)));
1911 selectedDigit[interestingCounter][digitIndexLocal] = new // AdC
1912 AliTOFselectedDigit(vol, digitInteresting->GetTdc(),
1913 digitInteresting->GetAdc(), digitInteresting->GetToT(),
1914 digitInteresting->GetToT()*digitInteresting->GetToT(),
1915 digitsInVolumeIndices[digIndex],
1916 digitInteresting->GetTracks());
1918 if (digitIndexLocal==-1) interestingCounter--; // AdC
1922 vol[4] = iPadZ, vol[3] = iPadX+1;
1924 if (fTOFdigitMap->GetNumberOfDigits(vol)>0) {
1925 interestingCounter++;
1926 for (ii=0; ii<kMaxNumberOfDigitsPerVolume; ii++)
1927 digitsInVolumeIndices[ii] = -1;
1928 fTOFdigitMap->GetDigitIndex(vol, digitsInVolumeIndices);
1929 digitIndexLocal=-1; // AdC
1930 for(Int_t digIndex=0; digIndex<kMaxNumberOfDigitsPerVolume; digIndex++) {
1931 if (digitsInVolumeIndices[digIndex]<0) continue;
1932 digitInteresting = (AliTOFdigit*)fDigits->UncheckedAt(digitsInVolumeIndices[digIndex]);
1933 if (digitInteresting->GetToT()<=0) continue; // AdC
1934 digitIndexLocal++; // AdC
1936 AliDebug(1,Form(" %2d %1d %2d %1d %2d %f %f %f %f %5d %5d %5d %5d",
1937 vol[0], vol[1], vol[2] ,vol[4], vol[3],
1938 digitInteresting->GetTdc(), digitInteresting->GetAdc(),
1939 digitInteresting->GetToT(), digitInteresting->GetToT()*digitInteresting->GetToT(),
1940 digitsInVolumeIndices[digIndex],
1941 digitInteresting->GetTrack(0), digitInteresting->GetTrack(1), digitInteresting->GetTrack(2)));
1943 selectedDigit[interestingCounter][digitIndexLocal] = new // AdC
1944 AliTOFselectedDigit(vol, digitInteresting->GetTdc(),
1945 digitInteresting->GetAdc(), digitInteresting->GetToT(),
1946 digitInteresting->GetToT()*digitInteresting->GetToT(),
1947 digitsInVolumeIndices[digIndex],
1948 digitInteresting->GetTracks());
1950 if (digitIndexLocal==-1) interestingCounter--; // AdC
1954 vol[4] = AliTOFGeometry::NpadZ()-(iPadZ+1), vol[3] = iPadX;
1956 if (fTOFdigitMap->GetNumberOfDigits(vol)>0) {
1957 interestingCounter++;
1958 for (ii=0; ii<kMaxNumberOfDigitsPerVolume; ii++)
1959 digitsInVolumeIndices[ii] = -1;
1960 fTOFdigitMap->GetDigitIndex(vol, digitsInVolumeIndices);
1961 digitIndexLocal=-1; // AdC
1962 for(Int_t digIndex=0; digIndex<kMaxNumberOfDigitsPerVolume; digIndex++) {
1963 if (digitsInVolumeIndices[digIndex]<0) continue;
1964 digitInteresting = (AliTOFdigit*)fDigits->UncheckedAt(digitsInVolumeIndices[digIndex]);
1965 if (digitInteresting->GetToT()<=0) continue; // AdC
1966 digitIndexLocal++; // AdC
1968 AliDebug(1,Form(" %2d %1d %2d %1d %2d %f %f %f %f %5d %5d %5d %5d",
1969 vol[0], vol[1], vol[2] ,vol[4], vol[3],
1970 digitInteresting->GetTdc(), digitInteresting->GetAdc(),
1971 digitInteresting->GetToT(), digitInteresting->GetToT()*digitInteresting->GetToT(),
1972 digitsInVolumeIndices[digIndex],
1973 digitInteresting->GetTrack(0), digitInteresting->GetTrack(1), digitInteresting->GetTrack(2)));
1975 selectedDigit[interestingCounter][digitIndexLocal] = new // AdC
1976 AliTOFselectedDigit(vol, digitInteresting->GetTdc(),
1977 digitInteresting->GetAdc(), digitInteresting->GetToT(),
1978 digitInteresting->GetToT()*digitInteresting->GetToT(),
1979 digitsInVolumeIndices[digIndex],
1980 digitInteresting->GetTracks());
1982 if (digitIndexLocal==-1) interestingCounter--; // AdC
1986 vol[4] = AliTOFGeometry::NpadZ()-(iPadZ+1), vol[3] = iPadX+1;
1988 if (fTOFdigitMap->GetNumberOfDigits(vol)>0) {
1989 interestingCounter++;
1990 for (ii=0; ii<kMaxNumberOfDigitsPerVolume; ii++)
1991 digitsInVolumeIndices[ii] = -1;
1992 fTOFdigitMap->GetDigitIndex(vol, digitsInVolumeIndices);
1993 digitIndexLocal=-1; // AdC
1994 for(Int_t digIndex=0; digIndex<kMaxNumberOfDigitsPerVolume; digIndex++) {
1995 if (digitsInVolumeIndices[digIndex]<0) continue;
1996 digitInteresting = (AliTOFdigit*)fDigits->UncheckedAt(digitsInVolumeIndices[digIndex]);
1997 if (digitInteresting->GetToT()<=0) continue; // AdC
1998 digitIndexLocal++; // AdC
2000 AliDebug(1,Form(" %2d %1d %2d %1d %2d %f %f %f %f %5d %5d %5d %5d",
2001 vol[0], vol[1], vol[2] ,vol[4], vol[3],
2002 digitInteresting->GetTdc(), digitInteresting->GetAdc(),
2003 digitInteresting->GetToT(), digitInteresting->GetToT()*digitInteresting->GetToT(),
2004 digitsInVolumeIndices[digIndex],
2005 digitInteresting->GetTrack(0), digitInteresting->GetTrack(1), digitInteresting->GetTrack(2)));
2007 selectedDigit[interestingCounter][digitIndexLocal] = new // AdC
2008 AliTOFselectedDigit(vol, digitInteresting->GetTdc(),
2009 digitInteresting->GetAdc(), digitInteresting->GetToT(),
2010 digitInteresting->GetToT()*digitInteresting->GetToT(),
2011 digitsInVolumeIndices[digIndex],
2012 digitInteresting->GetTracks());
2014 if (digitIndexLocal==-1) interestingCounter--; // AdC
2017 AliDebug(1,Form(" e adesso %1d", interestingCounter+1));
2019 for (Int_t adesso1=0; adesso1<interestingCounter+1; adesso1++) {
2020 for (Int_t firstIndex=0; firstIndex<kMaxNumberOfDigitsPerVolume; firstIndex++) {
2021 if (selectedDigit[adesso1][firstIndex]==0x0) continue;
2023 for (Int_t adesso2=adesso1+1; adesso2<interestingCounter+1; adesso2++) {
2024 for (Int_t secondIndex=0; secondIndex<kMaxNumberOfDigitsPerVolume; secondIndex++) {
2025 if (selectedDigit[adesso2][secondIndex]==0x0) continue;
2027 if (TMath::Abs(selectedDigit[adesso1][firstIndex]->GetTDC()-selectedDigit[adesso2][secondIndex]->GetTDC())>fMaxDeltaTime) continue;
2029 interestingTOF[0] = selectedDigit[adesso1][firstIndex]->GetTDC();
2030 interestingTOT[0] = selectedDigit[adesso1][firstIndex]->GetTOT();
2031 interestingADC[0] = selectedDigit[adesso1][firstIndex]->GetADC();
2032 interestingWeight[0] = selectedDigit[adesso1][firstIndex]->GetWeight();
2033 Int_t vol1[5]; for(jj=0; jj<5; jj++) vol1[jj] = selectedDigit[adesso1][firstIndex]->GetDetectorIndex(jj);
2034 AliDebug(1,Form(" %2d %1d %2d %1d %2d", vol1[0], vol1[1], vol1[2], vol1[4], vol1[3]));
2035 Int_t volDum = vol1[3];
2038 fTOFGeometry->GetPosPar(vol1,pos);
2039 interestingX[0] = pos[0];
2040 interestingY[0] = pos[1];
2041 interestingZ[0] = pos[2];
2043 interestingTOF[1] = selectedDigit[adesso2][secondIndex]->GetTDC();
2044 interestingTOT[1] = selectedDigit[adesso2][secondIndex]->GetTOT();
2045 interestingADC[1] = selectedDigit[adesso2][secondIndex]->GetADC();
2046 interestingWeight[1] = selectedDigit[adesso2][secondIndex]->GetWeight();
2047 Int_t vol2[5]; for(jj=0; jj<5; jj++) vol2[jj] = selectedDigit[adesso2][secondIndex]->GetDetectorIndex(jj);
2048 AliDebug(1,Form(" %2d %1d %2d %1d %2d", vol2[0], vol2[1], vol2[2], vol2[4], vol2[3]));
2052 fTOFGeometry->GetPosPar(vol2,pos);
2053 interestingX[1] = pos[0];
2054 interestingY[1] = pos[1];
2055 interestingZ[1] = pos[2];
2058 AverageCalculations(2, interestingX, interestingY, interestingZ,
2059 interestingTOF, interestingTOT, interestingADC,
2061 parTOF, posClus, check);
2063 for (jj=0; jj<5; jj++) det[jj] = -1;
2064 for (jj=0; jj<3; jj++) posF[jj] = posClus[jj];
2065 fTOFGeometry->GetDetID(posF, det);
2067 volIdClus = fTOFGeometry->GetAliSensVolIndex(det[0],det[1],det[2]);
2068 //volIdClus = GetClusterVolIndex(det);
2070 for (jj=3; jj<11; jj++) padsCluster[jj] = -1;
2071 padsCluster[3] = selectedDigit[adesso1][firstIndex]->GetDetectorIndex(4);
2072 padsCluster[4] = selectedDigit[adesso1][firstIndex]->GetDetectorIndex(3);
2073 padsCluster[5] = selectedDigit[adesso2][secondIndex]->GetDetectorIndex(4);
2074 padsCluster[6] = selectedDigit[adesso2][secondIndex]->GetDetectorIndex(3);
2076 for (jj=0; jj<6; jj++) covClus[jj] = 0.;
2077 Int_t ** indDet = new Int_t*[2];
2078 for (jj=0; jj<2; jj++) indDet[jj] = new Int_t [5];
2079 for (jj=0; jj<2; jj++) indDet[jj][0] = nSector;
2080 for (jj=0; jj<2; jj++) indDet[jj][1] = nPlate;
2081 for (jj=0; jj<2; jj++) indDet[jj][2] = nStrip;
2082 for (jj=0; jj<2; jj++) indDet[jj][3] = padsCluster[2*jj+3];
2083 for (jj=0; jj<2; jj++) indDet[jj][4] = padsCluster[2*jj+1+3];
2084 GetClusterPars(/*check,*/ 2, indDet, interestingWeight, posClus, covClus);
2085 for (jj=0; jj<2; jj++) delete [] indDet[jj];
2087 // To fill the track index array
2089 for (jj=0; jj<kMaxNumberOfTracksPerDigit; jj++) tracks[jj] = -1;
2090 for (Int_t kk=0; kk<kMaxNumberOfTracksPerDigit; kk++) { // three is the max number of tracks associated to one digit
2091 if (selectedDigit[adesso1][firstIndex]->GetTrackLabel(kk)==-1) continue;
2094 tracks[dummyCounter] = selectedDigit[adesso1][firstIndex]->GetTrackLabel(kk);
2097 for (Int_t kk=0; kk<kMaxNumberOfTracksPerDigit; kk++) { // three is the max number of tracks associated to one digit
2098 if (selectedDigit[adesso2][secondIndex]->GetTrackLabel(kk)==-1) continue;
2101 alreadyStored = kFALSE;
2102 for (jj=0; jj<dummyCounter+1; jj++)
2103 alreadyStored = alreadyStored || (tracks[jj]!=-1 && tracks[jj]==selectedDigit[adesso2][secondIndex]->GetTrackLabel(kk));
2105 if (alreadyStored) continue;
2106 if (dummyCounter==2) { // three is the max number of tracks associated to one cluster
2107 AliWarning(" Siamo al limite!");
2112 tracks[dummyCounter] = selectedDigit[adesso2][secondIndex]->GetTrackLabel(kk);
2119 AliTOFcluster *tofCluster =
2120 new AliTOFcluster(volIdClus, posClus[0], posClus[1], posClus[2],
2121 covClus[0], covClus[1], covClus[2], covClus[3], covClus[4], covClus[5],
2122 tracks, det, parTOF, status, selectedDigit[adesso1][firstIndex]->GetIndex()); // to be updated
2123 InsertCluster(tofCluster);
2125 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",
2126 volIdClus, posClus[0], posClus[1], posClus[2],
2127 covClus[0], covClus[1], covClus[2], covClus[3], covClus[4], covClus[5],
2128 tracks[0], tracks[1], tracks[2],
2129 det[0], det[1], det[2], det[3], det[4],
2130 parTOF[0], parTOF[1], parTOF[2], parTOF[3], parTOF[4],
2131 status, selectedDigit[adesso1][firstIndex]->GetIndex()));
2136 fTOFdigitMap->ResetDigitNumber(vol1,selectedDigit[adesso1][firstIndex]->GetIndex());
2140 fTOFdigitMap->ResetDigitNumber(vol2,selectedDigit[adesso2][secondIndex]->GetIndex());
2143 } // close loop on second digit
2144 } // close loop on adesso2
2146 } // close loop on first digit
2147 } // close loop on adesso1
2149 for (ii=0; ii<kMaxNumberOfInterestingPads; ii++)
2150 for (jj=0; jj<kMaxNumberOfDigitsPerVolume; jj++)
2151 selectedDigit[ii][jj] = 0x0;
2155 for (ii=0; ii<kMaxNumberOfInterestingPads; ii++)
2156 for (jj=0; jj<kMaxNumberOfDigitsPerVolume; jj++) {
2157 delete selectedDigit[ii][jj];
2158 selectedDigit[ii][jj] = 0x0;
2163 //_____________________________________________________________________________
2165 void AliTOFClusterFinderV1::FindClustersPerStrip(Int_t nSector,
2171 // This function searches the neighbouring digits (stored in the fDigits object),
2172 // to perform clusters (stored in the fTofClusters array).
2174 // Each strip is read four times:
2175 // - 1st time: it searches possible clusters formed by four
2176 // neighbouring digits;
2177 // - 2nd time: it searches possible clusters formed by three
2178 // neighbouring digits;
2179 // - 3rd time: it searches possible clusters formed by two
2180 // neighbouring digits;
2181 // - 4th time: the remaining isolated digits have been transformed
2183 // This research has been made by checking the fTOFdigitMap object,
2184 // filled at digits/raw-data reading time.
2187 const Int_t kMaxNumberOfInterestingPads = 4;
2188 const Int_t kMaxNumberOfTracksPerDigit = 3;
2189 const Int_t kMaxNumberOfDigitsPerVolume = 3;
2193 Int_t digitsInVolumeIndices[kMaxNumberOfDigitsPerVolume];
2194 for (ii=0; ii<kMaxNumberOfDigitsPerVolume; ii++)
2195 digitsInVolumeIndices[ii] = -1;
2197 Int_t vol[5] = {nSector,nPlate,nStrip,-1,-1};
2199 Float_t pos[3] = {0.,0.,0.};
2202 Int_t interestingPadX[kMaxNumberOfInterestingPads];
2203 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingPadX[jj] = -1;
2204 Int_t interestingPadZ[kMaxNumberOfInterestingPads];
2205 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingPadZ[jj] = -1;
2206 Double_t interestingTOT[kMaxNumberOfInterestingPads];
2207 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingTOT[jj] = 0;
2208 Double_t interestingADC[kMaxNumberOfInterestingPads];
2209 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingADC[jj] = 0;
2210 Double_t interestingTOF[kMaxNumberOfInterestingPads];
2211 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingTOF[jj] = 0;
2212 Double_t interestingWeight[kMaxNumberOfInterestingPads];
2213 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingWeight[jj] = 0;
2215 Float_t interestingX[kMaxNumberOfInterestingPads];
2216 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingX[jj] = 0;
2217 Float_t interestingY[kMaxNumberOfInterestingPads];
2218 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingY[jj] = 0;
2219 Float_t interestingZ[kMaxNumberOfInterestingPads];
2220 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingZ[jj] = 0;
2222 Float_t interDigit[kMaxNumberOfInterestingPads];
2223 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interDigit[jj] = 0;
2225 Int_t padsCluster[11];
2226 padsCluster[0] = nSector;
2227 padsCluster[1] = nPlate;
2228 padsCluster[2] = nStrip;
2229 for (jj=3; jj<11; jj++) padsCluster[jj] = -1;
2231 Int_t interestingCounter=-1;
2232 Int_t digitIndexLocal = -1;
2237 Bool_t check = kFALSE;
2239 for (jj=0; jj<5; jj++) parTOF[jj] = 0;
2240 Double_t posClus[3];
2241 for (jj=0; jj<3; jj++) posClus[jj] = 0.;
2243 for (jj=0; jj<5; jj++) det[jj] = -1;
2245 for (jj=0; jj<3; jj++) posF[jj] = 0.;
2246 UShort_t volIdClus = 0;
2247 Bool_t status = kTRUE; //assume all sim channels ok in the beginning...
2248 Double_t covClus[6];
2249 for (jj=0; jj<6; jj++) covClus[jj] = 0.;
2250 Int_t tracks[kMaxNumberOfTracksPerDigit];
2251 for (jj=0; jj<3; jj++) tracks[jj] = -1;
2252 Int_t dummyCounter=-1;
2253 Bool_t alreadyStored = kFALSE;
2255 AliTOFselectedDigit ***selectedDigit = new AliTOFselectedDigit**[kMaxNumberOfInterestingPads];
2256 for (ii=0; ii<kMaxNumberOfInterestingPads; ii++)
2257 selectedDigit[ii] = new AliTOFselectedDigit*[kMaxNumberOfDigitsPerVolume];
2259 for (ii=0; ii<kMaxNumberOfInterestingPads; ii++)
2260 for (jj=0; jj<kMaxNumberOfDigitsPerVolume; jj++) selectedDigit[ii][jj] = 0x0;
2262 AliTOFdigit *digitInteresting;
2266 for (iPad=0; iPad<AliTOFGeometry::NpadZ()*AliTOFGeometry::NpadX()-3; iPad+=2) {
2268 iPadZ = iPad%AliTOFGeometry::NpadZ(); //iPad%2;
2269 iPadX = iPad/AliTOFGeometry::NpadZ(); //iPad/2;
2271 AliDebug(3, Form("%2d %1d %2d\n", iPad, iPadZ, iPadX));
2278 interestingCounter=-1;
2280 vol[4] = iPadZ , vol[3] = iPadX;
2281 if (fTOFdigitMap->GetNumberOfDigits(vol)>0)
2282 interestingCounter++;
2284 vol[4] = iPadZ, vol[3] = iPadX+1;
2285 if (fTOFdigitMap->GetNumberOfDigits(vol)>0)
2286 interestingCounter++;
2288 vol[4] = AliTOFGeometry::NpadZ()-(iPadZ+1), vol[3] = iPadX;
2289 if (fTOFdigitMap->GetNumberOfDigits(vol)>0)
2290 interestingCounter++;
2292 vol[4] = AliTOFGeometry::NpadZ()-(iPadZ+1), vol[3] = iPadX+1;
2293 if (fTOFdigitMap->GetNumberOfDigits(vol)>0)
2294 interestingCounter++;
2296 if (interestingCounter!=group) continue;
2297 else interestingCounter=-1;
2300 for (ii=0; ii<kMaxNumberOfInterestingPads; ii++)
2301 for (jj=0; jj<kMaxNumberOfDigitsPerVolume; jj++)
2302 selectedDigit[ii][jj] = 0x0;
2305 vol[4] = iPadZ, vol[3] = iPadX;
2307 if (fTOFdigitMap->GetNumberOfDigits(vol)>0) {
2308 interestingCounter++;
2309 for (ii=0; ii<kMaxNumberOfDigitsPerVolume; ii++)
2310 digitsInVolumeIndices[ii] = -1;
2311 fTOFdigitMap->GetDigitIndex(vol, digitsInVolumeIndices);
2312 digitIndexLocal=-1; // AdC
2313 for(Int_t digIndex=0; digIndex<kMaxNumberOfDigitsPerVolume; digIndex++) {
2314 if (digitsInVolumeIndices[digIndex]<0) continue;
2315 digitInteresting = (AliTOFdigit*)fDigits->UncheckedAt(digitsInVolumeIndices[digIndex]);
2316 if (digitInteresting->GetToT()<=0) continue; // AdC
2317 digitIndexLocal++; // AdC
2319 AliDebug(1,Form(" %2d %1d %2d %1d %2d %d %d %d %d %5d %5d %5d %5d",
2320 vol[0], vol[1], vol[2] ,vol[4], vol[3],
2321 digitInteresting->GetTdc(), digitInteresting->GetAdc(),
2322 digitInteresting->GetToT(), digitInteresting->GetToT()*digitInteresting->GetToT(),
2323 digitsInVolumeIndices[digIndex],
2324 digitInteresting->GetTrack(0), digitInteresting->GetTrack(1), digitInteresting->GetTrack(2)));
2325 AliDebug(1,Form(" to try %d %d ",digIndex, interestingCounter));
2327 selectedDigit[interestingCounter][digitIndexLocal] = new // AdC
2328 AliTOFselectedDigit(vol, digitInteresting->GetTdc(),
2329 digitInteresting->GetAdc(), digitInteresting->GetToT(),
2330 digitInteresting->GetToT()*digitInteresting->GetToT(),
2331 digitsInVolumeIndices[digIndex],
2332 digitInteresting->GetTracks());
2334 if (digitIndexLocal==-1) interestingCounter--; // AdC
2338 vol[4] = iPadZ, vol[3] = iPadX+1;
2340 if (fTOFdigitMap->GetNumberOfDigits(vol)>0) {
2341 interestingCounter++;
2342 for (ii=0; ii<kMaxNumberOfDigitsPerVolume; ii++)
2343 digitsInVolumeIndices[ii] = -1;
2344 fTOFdigitMap->GetDigitIndex(vol, digitsInVolumeIndices);
2345 digitIndexLocal=-1; // AdC
2346 for(Int_t digIndex=0; digIndex<kMaxNumberOfDigitsPerVolume; digIndex++) {
2347 if (digitsInVolumeIndices[digIndex]<0) continue;
2348 digitInteresting = (AliTOFdigit*)fDigits->UncheckedAt(digitsInVolumeIndices[digIndex]);
2349 if (digitInteresting->GetToT()<=0) continue; // AdC
2350 digitIndexLocal++; // AdC
2352 AliDebug(1,Form(" %2d %1d %2d %1d %2d %d %d %d %d %5d %5d %5d %5d",
2353 vol[0], vol[1], vol[2] ,vol[4], vol[3],
2354 digitInteresting->GetTdc(), digitInteresting->GetAdc(),
2355 digitInteresting->GetToT(), digitInteresting->GetToT()*digitInteresting->GetToT(),
2356 digitsInVolumeIndices[digIndex],
2357 digitInteresting->GetTrack(0), digitInteresting->GetTrack(1), digitInteresting->GetTrack(2)));
2358 AliDebug(1,Form(" to try %d %d ",digIndex, interestingCounter));
2360 selectedDigit[interestingCounter][digitIndexLocal] = new // AdC
2361 AliTOFselectedDigit(vol, digitInteresting->GetTdc(),
2362 digitInteresting->GetAdc(), digitInteresting->GetToT(),
2363 digitInteresting->GetToT()*digitInteresting->GetToT(),
2364 digitsInVolumeIndices[digIndex],
2365 digitInteresting->GetTracks());
2367 if (digitIndexLocal==-1) interestingCounter--; // AdC
2371 vol[4] = AliTOFGeometry::NpadZ()-(iPadZ+1), vol[3] = iPadX;
2373 if (fTOFdigitMap->GetNumberOfDigits(vol)>0) {
2374 interestingCounter++;
2375 for (ii=0; ii<kMaxNumberOfDigitsPerVolume; ii++)
2376 digitsInVolumeIndices[ii] = -1;
2377 fTOFdigitMap->GetDigitIndex(vol, digitsInVolumeIndices);
2378 digitIndexLocal=-1; // AdC
2379 for(Int_t digIndex=0; digIndex<kMaxNumberOfDigitsPerVolume; digIndex++) {
2380 if (digitsInVolumeIndices[digIndex]<0) continue;
2381 digitInteresting = (AliTOFdigit*)fDigits->UncheckedAt(digitsInVolumeIndices[digIndex]);
2382 if (digitInteresting->GetToT()<=0) continue; // AdC
2383 digitIndexLocal++; // AdC
2385 AliDebug(1,Form(" %2d %1d %2d %1d %2d %d %d %d %d %5d %5d %5d %5d",
2386 vol[0], vol[1], vol[2] ,vol[4], vol[3],
2387 digitInteresting->GetTdc(), digitInteresting->GetAdc(),
2388 digitInteresting->GetToT(), digitInteresting->GetToT()*digitInteresting->GetToT(),
2389 digitsInVolumeIndices[digIndex],
2390 digitInteresting->GetTrack(0), digitInteresting->GetTrack(1), digitInteresting->GetTrack(2)));
2391 AliDebug(1,Form(" to try %d %d ",digIndex, interestingCounter));
2393 selectedDigit[interestingCounter][digitIndexLocal] = new // AdC
2394 AliTOFselectedDigit(vol, digitInteresting->GetTdc(),
2395 digitInteresting->GetAdc(), digitInteresting->GetToT(),
2396 digitInteresting->GetToT()*digitInteresting->GetToT(),
2397 digitsInVolumeIndices[digIndex],
2398 digitInteresting->GetTracks());
2400 if (digitIndexLocal==-1) interestingCounter--; // AdC
2404 vol[4] = AliTOFGeometry::NpadZ()-(iPadZ+1), vol[3] = iPadX+1;
2406 if (fTOFdigitMap->GetNumberOfDigits(vol)>0) {
2407 interestingCounter++;
2408 for (ii=0; ii<kMaxNumberOfDigitsPerVolume; ii++)
2409 digitsInVolumeIndices[ii] = -1;
2410 fTOFdigitMap->GetDigitIndex(vol, digitsInVolumeIndices);
2411 digitIndexLocal=-1; // AdC
2412 for(Int_t digIndex=0; digIndex<kMaxNumberOfDigitsPerVolume; digIndex++) {
2413 if (digitsInVolumeIndices[digIndex]<0) continue;
2414 digitInteresting = (AliTOFdigit*)fDigits->UncheckedAt(digitsInVolumeIndices[digIndex]);
2415 if (digitInteresting->GetToT()<=0) continue; // AdC
2416 digitIndexLocal++; // AdC
2418 AliDebug(1,Form(" %2d %1d %2d %1d %2d %d %d %d %d %5d %5d %5d %5d",
2419 vol[0], vol[1], vol[2] ,vol[4], vol[3],
2420 digitInteresting->GetTdc(), digitInteresting->GetAdc(),
2421 digitInteresting->GetToT(), digitInteresting->GetToT()*digitInteresting->GetToT(),
2422 digitsInVolumeIndices[digIndex],
2423 digitInteresting->GetTrack(0), digitInteresting->GetTrack(1), digitInteresting->GetTrack(2)));
2424 AliDebug(1,Form(" to try %d %d ",digIndex, interestingCounter));
2426 selectedDigit[interestingCounter][digitIndexLocal] = new // AdC
2427 AliTOFselectedDigit(vol, digitInteresting->GetTdc(),
2428 digitInteresting->GetAdc(), digitInteresting->GetToT(),
2429 digitInteresting->GetToT()*digitInteresting->GetToT(),
2430 digitsInVolumeIndices[digIndex],
2431 digitInteresting->GetTracks());
2433 if (digitIndexLocal==-1) interestingCounter--; // AdC
2436 AliDebug(1,Form(" e adesso %1d", interestingCounter+1));
2438 switch(interestingCounter+1) {
2442 for (Int_t adesso1=0; adesso1<interestingCounter+1; adesso1++) {
2443 for (Int_t firstIndex=0; firstIndex<kMaxNumberOfDigitsPerVolume; firstIndex++) {
2444 if (selectedDigit[adesso1][firstIndex]==0x0) continue;
2446 for (Int_t adesso2=adesso1+1; adesso2<interestingCounter+1; adesso2++) {
2447 for (Int_t secondIndex=0; secondIndex<kMaxNumberOfDigitsPerVolume; secondIndex++) {
2448 if (selectedDigit[adesso2][secondIndex]==0x0) continue;
2450 if (TMath::Abs(selectedDigit[adesso1][firstIndex]->GetTDC()-selectedDigit[adesso2][secondIndex]->GetTDC())>fMaxDeltaTime) continue;
2452 AliDebug(1, Form(" %1d %1d (0x%x) %1d %1d (0x%x)", adesso1, firstIndex,selectedDigit[adesso1][firstIndex],
2453 adesso2, secondIndex,selectedDigit[adesso2][secondIndex]));
2455 interestingTOF[0] = selectedDigit[adesso1][firstIndex]->GetTDC();
2456 interestingTOT[0] = selectedDigit[adesso1][firstIndex]->GetTOT();
2457 interestingADC[0] = selectedDigit[adesso1][firstIndex]->GetADC();
2458 interestingWeight[0] = selectedDigit[adesso1][firstIndex]->GetWeight();
2459 Int_t vol1[5]; for(jj=0; jj<5; jj++) vol1[jj] = selectedDigit[adesso1][firstIndex]->GetDetectorIndex(jj);
2460 AliDebug(1,Form(" %2d %1d %2d %1d %2d", vol1[0], vol1[1], vol1[2], vol1[4], vol1[3]));
2461 Int_t volDum = vol1[3];
2464 fTOFGeometry->GetPosPar(vol1,pos);
2465 AliDebug(1,Form(" %f %f %f", pos[0], pos[1], pos[2]));
2466 interestingX[0] = pos[0];
2467 interestingY[0] = pos[1];
2468 interestingZ[0] = pos[2];
2470 interestingTOF[1] = selectedDigit[adesso2][secondIndex]->GetTDC();
2471 interestingTOT[1] = selectedDigit[adesso2][secondIndex]->GetTOT();
2472 interestingADC[1] = selectedDigit[adesso2][secondIndex]->GetADC();
2473 interestingWeight[1] = selectedDigit[adesso2][secondIndex]->GetWeight();
2474 Int_t vol2[5]; for(jj=0; jj<5; jj++) vol2[jj] = selectedDigit[adesso2][secondIndex]->GetDetectorIndex(jj);
2475 AliDebug(1,Form(" %2d %1d %2d %1d %2d", vol2[0], vol2[1], vol2[2], vol2[4], vol2[3]));
2479 fTOFGeometry->GetPosPar(vol2,pos);
2480 AliDebug(1,Form(" %f %f %f", pos[0], pos[1], pos[2]));
2481 interestingX[1] = pos[0];
2482 interestingY[1] = pos[1];
2483 interestingZ[1] = pos[2];
2486 AverageCalculations(interestingCounter+1,
2487 interestingX, interestingY, interestingZ,
2488 interestingTOF, interestingTOT, interestingADC,
2490 parTOF, posClus, check);
2492 for (jj=0; jj<5; jj++) det[jj] = -1;
2493 for (jj=0; jj<3; jj++) posF[jj] = posClus[jj];
2495 AliDebug(1,Form(" %f %f %f", posF[0], posF[1], posF[2]));
2496 fTOFGeometry->GetDetID(posF, det);
2497 AliDebug(1,Form(" %2d %1d %2d %1d %2d", det[0], det[1], det[2], det[3], det[4]));
2499 volIdClus = fTOFGeometry->GetAliSensVolIndex(det[0],det[1],det[2]);
2500 //volIdClus = GetClusterVolIndex(det);
2502 for (jj=3; jj<11; jj++) padsCluster[jj] = -1;
2503 padsCluster[3] = selectedDigit[adesso1][firstIndex]->GetDetectorIndex(4);
2504 padsCluster[4] = selectedDigit[adesso1][firstIndex]->GetDetectorIndex(3);
2505 padsCluster[5] = selectedDigit[adesso2][secondIndex]->GetDetectorIndex(4);
2506 padsCluster[6] = selectedDigit[adesso2][secondIndex]->GetDetectorIndex(3);
2508 for (jj=0; jj<6; jj++) covClus[jj] = 0.;
2509 Int_t ** indDet = new Int_t*[interestingCounter+1];
2510 for (jj=0; jj<interestingCounter+1; jj++) indDet[jj] = new Int_t [5];
2511 for (jj=0; jj<interestingCounter+1; jj++) indDet[jj][0] = nSector;
2512 for (jj=0; jj<interestingCounter+1; jj++) indDet[jj][1] = nPlate;
2513 for (jj=0; jj<interestingCounter+1; jj++) indDet[jj][2] = nStrip;
2514 for (jj=0; jj<interestingCounter+1; jj++) indDet[jj][3] = padsCluster[2*jj+3];
2515 for (jj=0; jj<interestingCounter+1; jj++) indDet[jj][4] = padsCluster[2*jj+1+3];
2516 GetClusterPars(/*check,*/ interestingCounter+1, indDet, interestingWeight, posClus, covClus);
2517 for (jj=0; jj<interestingCounter+1; jj++) delete [] indDet[jj];
2519 // To fill the track index array
2521 for (jj=0; jj<kMaxNumberOfTracksPerDigit; jj++) tracks[jj] = -1;
2522 for (Int_t kk=0; kk<kMaxNumberOfTracksPerDigit; kk++) { // three is the max number of tracks associated to one digit
2523 if (selectedDigit[adesso1][firstIndex]->GetTrackLabel(kk)==-1) continue;
2526 tracks[dummyCounter] = selectedDigit[adesso1][firstIndex]->GetTrackLabel(kk);
2529 for (Int_t kk=0; kk<kMaxNumberOfTracksPerDigit; kk++) { // three is the max number of tracks associated to one digit
2530 if (selectedDigit[adesso2][secondIndex]->GetTrackLabel(kk)==-1) continue;
2533 alreadyStored = kFALSE;
2534 for (jj=0; jj<dummyCounter+1; jj++)
2535 alreadyStored = alreadyStored || (tracks[jj]!=-1 && tracks[jj]==selectedDigit[adesso2][secondIndex]->GetTrackLabel(kk));
2537 if (alreadyStored) continue;
2538 if (dummyCounter==2) { // three is the max number of tracks associated to one cluster
2539 AliWarning(" Siamo al limite!");
2544 tracks[dummyCounter] = selectedDigit[adesso2][secondIndex]->GetTrackLabel(kk);
2551 AliTOFcluster *tofCluster =
2552 new AliTOFcluster(volIdClus, posClus[0], posClus[1], posClus[2],
2553 covClus[0], covClus[1], covClus[2], covClus[3], covClus[4], covClus[5],
2554 tracks, det, parTOF, status, selectedDigit[adesso1][firstIndex]->GetIndex()); //to updated
2555 InsertCluster(tofCluster);
2557 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",
2558 volIdClus, posClus[0], posClus[1], posClus[2],
2559 covClus[0], covClus[1], covClus[2], covClus[3], covClus[4], covClus[5],
2560 tracks[0], tracks[1], tracks[2],
2561 det[0], det[1], det[2], det[3], det[4],
2562 parTOF[0], parTOF[1], parTOF[2], parTOF[3], parTOF[4],
2563 status, selectedDigit[adesso1][firstIndex]->GetIndex()));
2568 fTOFdigitMap->ResetDigitNumber(vol1,selectedDigit[adesso1][firstIndex]->GetIndex());
2572 fTOFdigitMap->ResetDigitNumber(vol2,selectedDigit[adesso2][secondIndex]->GetIndex());
2575 } // close loop on second digit
2576 } // close loop on adesso2
2578 } // close loop on first digit
2579 } // close loop on adesso1
2586 for (Int_t adesso1=0; adesso1<interestingCounter+1; adesso1++) {
2587 for (Int_t firstIndex=0; firstIndex<kMaxNumberOfDigitsPerVolume; firstIndex++) {
2588 if (selectedDigit[adesso1][firstIndex]==0x0) continue;
2590 for (Int_t adesso2=adesso1+1; adesso2<interestingCounter+1; adesso2++) {
2591 for (Int_t secondIndex=0; secondIndex<kMaxNumberOfDigitsPerVolume; secondIndex++) {
2592 if (selectedDigit[adesso2][secondIndex]==0x0) continue;
2594 for (Int_t adesso3=adesso2+1; adesso3<interestingCounter+1; adesso3++) {
2595 for (Int_t thirdIndex=0; thirdIndex<kMaxNumberOfDigitsPerVolume; thirdIndex++) {
2596 if (selectedDigit[adesso3][thirdIndex]==0x0) continue;
2599 if (TMath::Abs(selectedDigit[adesso1][firstIndex]->GetTDC()-selectedDigit[adesso2][secondIndex]->GetTDC())>fMaxDeltaTime
2601 TMath::Abs(selectedDigit[adesso1][firstIndex]->GetTDC()-selectedDigit[adesso3][thirdIndex]->GetTDC())>fMaxDeltaTime
2603 TMath::Abs(selectedDigit[adesso2][secondIndex]->GetTDC()-selectedDigit[adesso3][thirdIndex]->GetTDC())>fMaxDeltaTime) continue;
2605 interestingTOF[0] = selectedDigit[adesso1][firstIndex]->GetTDC();
2606 interestingTOT[0] = selectedDigit[adesso1][firstIndex]->GetTOT();
2607 interestingADC[0] = selectedDigit[adesso1][firstIndex]->GetADC();
2608 interestingWeight[0] = selectedDigit[adesso1][firstIndex]->GetWeight();
2609 Int_t vol1[5]; for(jj=0; jj<5; jj++) vol1[jj] = selectedDigit[adesso1][firstIndex]->GetDetectorIndex(jj);
2610 AliDebug(1,Form(" %2d %1d %2d %1d %2d", vol1[0], vol1[1], vol1[2], vol1[4], vol1[3]));
2611 Int_t volDum = vol1[3];
2614 fTOFGeometry->GetPosPar(vol1,pos);
2615 interestingX[0] = pos[0];
2616 interestingY[0] = pos[1];
2617 interestingZ[0] = pos[2];
2619 interestingTOF[1] = selectedDigit[adesso2][secondIndex]->GetTDC();
2620 interestingTOT[1] = selectedDigit[adesso2][secondIndex]->GetTOT();
2621 interestingADC[1] = selectedDigit[adesso2][secondIndex]->GetADC();
2622 interestingWeight[1] = selectedDigit[adesso2][secondIndex]->GetWeight();
2623 Int_t vol2[5]; for(jj=0; jj<5; jj++) vol2[jj] = selectedDigit[adesso2][secondIndex]->GetDetectorIndex(jj);
2624 AliDebug(1,Form(" %2d %1d %2d %1d %2d", vol2[0], vol2[1], vol2[2], vol2[4], vol2[3]));
2628 fTOFGeometry->GetPosPar(vol2,pos);
2629 interestingX[1] = pos[0];
2630 interestingY[1] = pos[1];
2631 interestingZ[1] = pos[2];
2633 interestingTOF[2] = selectedDigit[adesso3][thirdIndex]->GetTDC();
2634 interestingTOT[2] = selectedDigit[adesso3][thirdIndex]->GetTOT();
2635 interestingADC[2] = selectedDigit[adesso3][thirdIndex]->GetADC();
2636 interestingWeight[2] = selectedDigit[adesso3][thirdIndex]->GetWeight();
2637 Int_t vol3[5]; for(jj=0; jj<5; jj++) vol3[jj] = selectedDigit[adesso3][thirdIndex]->GetDetectorIndex(jj);
2638 AliDebug(1,Form(" %2d %1d %2d %1d %2d", vol3[0], vol3[1], vol3[2], vol3[4], vol3[3]));
2642 fTOFGeometry->GetPosPar(vol3,pos);
2643 interestingX[2] = pos[0];
2644 interestingY[2] = pos[1];
2645 interestingZ[2] = pos[2];
2648 AverageCalculations(interestingCounter+1,
2649 interestingX, interestingY, interestingZ,
2650 interestingTOF, interestingTOT, interestingADC,
2652 parTOF, posClus, check);
2654 for (jj=0; jj<5; jj++) det[jj] = -1;
2655 for (jj=0; jj<3; jj++) posF[jj] = posClus[jj];
2656 fTOFGeometry->GetDetID(posF, det);
2658 volIdClus = fTOFGeometry->GetAliSensVolIndex(det[0],det[1],det[2]);
2659 //volIdClus = GetClusterVolIndex(det);
2661 for (jj=3; jj<11; jj++) padsCluster[jj] = -1;
2662 padsCluster[3] = selectedDigit[adesso1][firstIndex]->GetDetectorIndex(4);
2663 padsCluster[4] = selectedDigit[adesso1][firstIndex]->GetDetectorIndex(3);
2664 padsCluster[5] = selectedDigit[adesso2][secondIndex]->GetDetectorIndex(4);
2665 padsCluster[6] = selectedDigit[adesso2][secondIndex]->GetDetectorIndex(3);
2666 padsCluster[7] = selectedDigit[adesso3][thirdIndex]->GetDetectorIndex(4);
2667 padsCluster[8] = selectedDigit[adesso3][thirdIndex]->GetDetectorIndex(3);
2669 for (jj=0; jj<6; jj++) covClus[jj] = 0.;
2670 Int_t ** indDet = new Int_t*[interestingCounter+1];
2671 for (jj=0; jj<interestingCounter+1; jj++) indDet[jj] = new Int_t [5];
2672 for (jj=0; jj<interestingCounter+1; jj++) indDet[jj][0] = nSector;
2673 for (jj=0; jj<interestingCounter+1; jj++) indDet[jj][1] = nPlate;
2674 for (jj=0; jj<interestingCounter+1; jj++) indDet[jj][2] = nStrip;
2675 for (jj=0; jj<interestingCounter+1; jj++) indDet[jj][3] = padsCluster[2*jj+3];
2676 for (jj=0; jj<interestingCounter+1; jj++) indDet[jj][4] = padsCluster[2*jj+1+3];
2677 GetClusterPars(/*check,*/ interestingCounter+1, indDet, interestingWeight, posClus, covClus);
2678 for (jj=0; jj<interestingCounter+1; jj++) delete [] indDet[jj];
2680 // To fill the track index array
2682 for (jj=0; jj<kMaxNumberOfTracksPerDigit; jj++) tracks[jj] = -1;
2683 for (Int_t kk=0; kk<kMaxNumberOfTracksPerDigit; kk++) { // three is the max number of tracks associated to one digit
2684 if (selectedDigit[adesso1][firstIndex]->GetTrackLabel(kk)==-1) continue;
2687 tracks[dummyCounter] = selectedDigit[adesso1][firstIndex]->GetTrackLabel(kk);
2690 for (Int_t kk=0; kk<kMaxNumberOfTracksPerDigit; kk++) { // three is the max number of tracks associated to one digit
2691 if (selectedDigit[adesso2][secondIndex]->GetTrackLabel(kk)==-1) continue;
2694 alreadyStored = kFALSE;
2695 for (jj=0; jj<dummyCounter+1; jj++)
2696 alreadyStored = alreadyStored || (tracks[jj]!=-1 && tracks[jj]==selectedDigit[adesso2][secondIndex]->GetTrackLabel(kk));
2698 if (alreadyStored) continue;
2699 if (dummyCounter==2) { // three is the max number of tracks associated to one cluster
2700 AliWarning(" Siamo al limite!");
2705 tracks[dummyCounter] = selectedDigit[adesso2][secondIndex]->GetTrackLabel(kk);
2710 for (Int_t kk=0; kk<kMaxNumberOfTracksPerDigit; kk++) { // three is the max number of tracks associated to one digit
2711 if (selectedDigit[adesso3][thirdIndex]->GetTrackLabel(kk)==-1) continue;
2714 alreadyStored = kFALSE;
2715 for (jj=0; jj<dummyCounter+1; jj++)
2716 alreadyStored = alreadyStored || (tracks[jj]!=-1 && tracks[jj]==selectedDigit[adesso3][thirdIndex]->GetTrackLabel(kk));
2718 if (alreadyStored) continue;
2719 if (dummyCounter==2) { // three is the max number of tracks associated to one cluster
2720 AliWarning(" Siamo al limite!");
2725 tracks[dummyCounter] = selectedDigit[adesso3][thirdIndex]->GetTrackLabel(kk);
2732 AliTOFcluster *tofCluster =
2733 new AliTOFcluster(volIdClus, posClus[0], posClus[1], posClus[2],
2734 covClus[0], covClus[1], covClus[2], covClus[3], covClus[4], covClus[5],
2735 tracks, det, parTOF, status, selectedDigit[adesso1][firstIndex]->GetIndex()); // to be updated
2736 InsertCluster(tofCluster);
2738 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",
2739 volIdClus, posClus[0], posClus[1], posClus[2],
2740 covClus[0], covClus[1], covClus[2], covClus[3], covClus[4], covClus[5],
2741 tracks[0], tracks[1], tracks[2],
2742 det[0], det[1], det[2], det[3], det[4],
2743 parTOF[0], parTOF[1], parTOF[2], parTOF[3], parTOF[4],
2744 status, selectedDigit[adesso1][firstIndex]->GetIndex()));
2749 fTOFdigitMap->ResetDigitNumber(vol1,selectedDigit[adesso1][firstIndex]->GetIndex());
2753 fTOFdigitMap->ResetDigitNumber(vol2,selectedDigit[adesso2][secondIndex]->GetIndex());
2757 fTOFdigitMap->ResetDigitNumber(vol3,selectedDigit[adesso3][thirdIndex]->GetIndex());
2760 } // close loop on third digit
2761 } // close loop on adesso3
2763 } // close loop on second digit
2764 } // close loop on adesso2
2766 } // close loop on first digit
2767 } // close loop on adesso1
2775 for (Int_t firstIndex=0; firstIndex<kMaxNumberOfDigitsPerVolume; firstIndex++) {
2776 if (selectedDigit[adesso1][firstIndex]==0x0) continue;
2779 for (Int_t secondIndex=0; secondIndex<kMaxNumberOfDigitsPerVolume; secondIndex++) {
2780 if (selectedDigit[adesso2][secondIndex]==0x0) continue;
2783 for (Int_t thirdIndex=0; thirdIndex<kMaxNumberOfDigitsPerVolume; thirdIndex++) {
2784 if (selectedDigit[adesso3][thirdIndex]==0x0) continue;
2787 for (Int_t fourthIndex=0; fourthIndex<kMaxNumberOfDigitsPerVolume; fourthIndex++) {
2788 if (selectedDigit[adesso4][fourthIndex]==0x0) continue;
2791 if (TMath::Abs(selectedDigit[adesso1][firstIndex]->GetTDC()-selectedDigit[adesso2][secondIndex]->GetTDC())>fMaxDeltaTime
2793 TMath::Abs(selectedDigit[adesso1][firstIndex]->GetTDC()-selectedDigit[adesso3][thirdIndex]->GetTDC())>fMaxDeltaTime
2795 TMath::Abs(selectedDigit[adesso1][firstIndex]->GetTDC()-selectedDigit[adesso4][fourthIndex]->GetTDC())>fMaxDeltaTime
2797 TMath::Abs(selectedDigit[adesso2][secondIndex]->GetTDC()-selectedDigit[adesso3][thirdIndex]->GetTDC())>fMaxDeltaTime
2799 TMath::Abs(selectedDigit[adesso2][secondIndex]->GetTDC()-selectedDigit[adesso4][fourthIndex]->GetTDC())>fMaxDeltaTime
2801 TMath::Abs(selectedDigit[adesso3][thirdIndex]->GetTDC()-selectedDigit[adesso4][fourthIndex]->GetTDC())>fMaxDeltaTime) continue;
2803 interestingTOF[0] = selectedDigit[adesso1][firstIndex]->GetTDC();
2804 interestingTOT[0] = selectedDigit[adesso1][firstIndex]->GetTOT();
2805 interestingADC[0] = selectedDigit[adesso1][firstIndex]->GetADC();
2806 interestingWeight[0] = selectedDigit[adesso1][firstIndex]->GetWeight();
2807 Int_t vol1[5]; for(jj=0; jj<5; jj++) vol1[jj] = selectedDigit[adesso1][firstIndex]->GetDetectorIndex(jj);
2808 AliDebug(1,Form(" %2d %1d %2d %1d %2d", vol1[0], vol1[1], vol1[2], vol1[4], vol1[3]));
2809 Int_t volDum = vol1[3];
2812 fTOFGeometry->GetPosPar(vol1,pos);
2813 interestingX[0] = pos[0];
2814 interestingY[0] = pos[1];
2815 interestingZ[0] = pos[2];
2817 interestingTOF[1] = selectedDigit[adesso2][secondIndex]->GetTDC();
2818 interestingTOT[1] = selectedDigit[adesso2][secondIndex]->GetTOT();
2819 interestingADC[1] = selectedDigit[adesso2][secondIndex]->GetADC();
2820 interestingWeight[1] = selectedDigit[adesso2][secondIndex]->GetWeight();
2821 Int_t vol2[5]; for(jj=0; jj<5; jj++) vol2[jj] = selectedDigit[adesso2][secondIndex]->GetDetectorIndex(jj);
2822 AliDebug(1,Form(" %2d %1d %2d %1d %2d", vol2[0], vol2[1], vol2[2], vol2[4], vol2[3]));
2826 fTOFGeometry->GetPosPar(vol2,pos);
2827 interestingX[1] = pos[0];
2828 interestingY[1] = pos[1];
2829 interestingZ[1] = pos[2];
2831 interestingTOF[2] = selectedDigit[adesso3][thirdIndex]->GetTDC();
2832 interestingTOT[2] = selectedDigit[adesso3][thirdIndex]->GetTOT();
2833 interestingADC[2] = selectedDigit[adesso3][thirdIndex]->GetADC();
2834 interestingWeight[2] = selectedDigit[adesso3][thirdIndex]->GetWeight();
2835 Int_t vol3[5]; for(jj=0; jj<5; jj++) vol3[jj] = selectedDigit[adesso3][thirdIndex]->GetDetectorIndex(jj);
2836 AliDebug(1,Form(" %2d %1d %2d %1d %2d", vol3[0], vol3[1], vol3[2], vol3[4], vol3[3]));
2840 fTOFGeometry->GetPosPar(vol3,pos);
2841 interestingX[2] = pos[0];
2842 interestingY[2] = pos[1];
2843 interestingZ[2] = pos[2];
2845 interestingTOF[3] = selectedDigit[adesso4][fourthIndex]->GetTDC();
2846 interestingTOT[3] = selectedDigit[adesso4][fourthIndex]->GetTOT();
2847 interestingADC[3] = selectedDigit[adesso4][fourthIndex]->GetADC();
2848 interestingWeight[3] = selectedDigit[adesso4][fourthIndex]->GetWeight();
2849 Int_t vol4[5]; for(jj=0; jj<5; jj++) vol4[jj] = selectedDigit[adesso4][fourthIndex]->GetDetectorIndex(jj);
2850 AliDebug(1,Form(" %2d %1d %2d %1d %2d", vol4[0], vol4[1], vol4[2], vol4[4], vol4[3]));
2854 fTOFGeometry->GetPosPar(vol4,pos);
2855 interestingX[3] = pos[0];
2856 interestingY[3] = pos[1];
2857 interestingZ[3] = pos[2];
2860 AverageCalculations(interestingCounter+1,
2861 interestingX, interestingY, interestingZ,
2862 interestingTOF, interestingTOT, interestingADC,
2864 parTOF, posClus, check);
2866 for (jj=0; jj<5; jj++) det[jj] = -1;
2867 for (jj=0; jj<3; jj++) posF[jj] = posClus[jj];
2868 fTOFGeometry->GetDetID(posF, det);
2870 volIdClus = fTOFGeometry->GetAliSensVolIndex(det[0],det[1],det[2]);
2871 //volIdClus = GetClusterVolIndex(det);
2873 for (jj=3; jj<11; jj++) padsCluster[jj] = -1;
2874 padsCluster[3] = selectedDigit[adesso1][firstIndex]->GetDetectorIndex(4);
2875 padsCluster[4] = selectedDigit[adesso1][firstIndex]->GetDetectorIndex(3);
2876 padsCluster[5] = selectedDigit[adesso2][secondIndex]->GetDetectorIndex(4);
2877 padsCluster[6] = selectedDigit[adesso2][secondIndex]->GetDetectorIndex(3);
2878 padsCluster[7] = selectedDigit[adesso3][thirdIndex]->GetDetectorIndex(4);
2879 padsCluster[8] = selectedDigit[adesso3][thirdIndex]->GetDetectorIndex(3);
2880 padsCluster[9] = selectedDigit[adesso4][fourthIndex]->GetDetectorIndex(4);
2881 padsCluster[10] = selectedDigit[adesso4][fourthIndex]->GetDetectorIndex(3);
2883 for (jj=0; jj<6; jj++) covClus[jj] = 0.;
2884 Int_t ** indDet = new Int_t*[interestingCounter+1];
2885 for (jj=0; jj<interestingCounter+1; jj++) indDet[jj] = new Int_t [5];
2886 for (jj=0; jj<interestingCounter+1; jj++) indDet[jj][0] = nSector;
2887 for (jj=0; jj<interestingCounter+1; jj++) indDet[jj][1] = nPlate;
2888 for (jj=0; jj<interestingCounter+1; jj++) indDet[jj][2] = nStrip;
2889 for (jj=0; jj<interestingCounter+1; jj++) indDet[jj][3] = padsCluster[2*jj+3];
2890 for (jj=0; jj<interestingCounter+1; jj++) indDet[jj][4] = padsCluster[2*jj+1+3];
2891 GetClusterPars(/*check,*/ interestingCounter+1, indDet, interestingWeight, posClus, covClus);
2892 for (jj=0; jj<interestingCounter+1; jj++) delete [] indDet[jj];
2894 // To fill the track index array
2896 for (jj=0; jj<kMaxNumberOfTracksPerDigit; jj++) tracks[jj] = -1;
2897 for (Int_t kk=0; kk<kMaxNumberOfTracksPerDigit; kk++) { // three is the max number of tracks associated to one digit
2898 if (selectedDigit[adesso1][firstIndex]->GetTrackLabel(kk)==-1) continue;
2901 tracks[dummyCounter] = selectedDigit[adesso1][firstIndex]->GetTrackLabel(kk);
2904 for (Int_t kk=0; kk<kMaxNumberOfTracksPerDigit; kk++) { // three is the max number of tracks associated to one digit
2905 if (selectedDigit[adesso2][secondIndex]->GetTrackLabel(kk)==-1) continue;
2908 alreadyStored = kFALSE;
2909 for (jj=0; jj<dummyCounter+1; jj++)
2910 alreadyStored = alreadyStored || (tracks[jj]!=-1 && tracks[jj]==selectedDigit[adesso2][secondIndex]->GetTrackLabel(kk));
2912 if (alreadyStored) continue;
2913 if (dummyCounter==2) { // three is the max number of tracks associated to one cluster
2914 AliWarning(" Siamo al limite!");
2919 tracks[dummyCounter] = selectedDigit[adesso2][secondIndex]->GetTrackLabel(kk);
2924 for (Int_t kk=0; kk<kMaxNumberOfTracksPerDigit; kk++) { // three is the max number of tracks associated to one digit
2925 if (selectedDigit[adesso3][thirdIndex]->GetTrackLabel(kk)==-1) continue;
2928 alreadyStored = kFALSE;
2929 for (jj=0; jj<dummyCounter+1; jj++)
2930 alreadyStored = alreadyStored || (tracks[jj]!=-1 && tracks[jj]==selectedDigit[adesso3][thirdIndex]->GetTrackLabel(kk));
2932 if (alreadyStored) continue;
2933 if (dummyCounter==2) { // three is the max number of tracks associated to one cluster
2934 AliWarning(" Siamo al limite!");
2939 tracks[dummyCounter] = selectedDigit[adesso3][thirdIndex]->GetTrackLabel(kk);
2944 for (Int_t kk=0; kk<kMaxNumberOfTracksPerDigit; kk++) { // three is the max number of tracks associated to one digit
2945 if (selectedDigit[adesso4][fourthIndex]->GetTrackLabel(kk)==-1) continue;
2948 alreadyStored = kFALSE;
2949 for (jj=0; jj<dummyCounter+1; jj++)
2950 alreadyStored = alreadyStored || (tracks[jj]!=-1 && tracks[jj]==selectedDigit[adesso4][fourthIndex]->GetTrackLabel(kk));
2952 if (alreadyStored) continue;
2953 if (dummyCounter==2) { // three is the max number of tracks associated to one cluster
2954 AliWarning(" Siamo al limite!");
2959 tracks[dummyCounter] = selectedDigit[adesso4][fourthIndex]->GetTrackLabel(kk);
2966 AliTOFcluster *tofCluster =
2967 new AliTOFcluster(volIdClus, posClus[0], posClus[1], posClus[2],
2968 covClus[0], covClus[1], covClus[2], covClus[3], covClus[4], covClus[5],
2969 tracks, det, parTOF, status, selectedDigit[adesso1][firstIndex]->GetIndex()); // to be updated
2970 InsertCluster(tofCluster);
2972 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",
2973 volIdClus, posClus[0], posClus[1], posClus[2],
2974 covClus[0], covClus[1], covClus[2], covClus[3], covClus[4], covClus[5],
2975 tracks[0], tracks[1], tracks[2],
2976 det[0], det[1], det[2], det[3], det[4],
2977 parTOF[0], parTOF[1], parTOF[2], parTOF[3], parTOF[4],
2978 status, selectedDigit[adesso1][firstIndex]->GetIndex()));
2983 fTOFdigitMap->ResetDigitNumber(vol1,selectedDigit[adesso1][firstIndex]->GetIndex());
2987 fTOFdigitMap->ResetDigitNumber(vol2,selectedDigit[adesso2][secondIndex]->GetIndex());
2991 fTOFdigitMap->ResetDigitNumber(vol3,selectedDigit[adesso3][thirdIndex]->GetIndex());
2995 fTOFdigitMap->ResetDigitNumber(vol4,selectedDigit[adesso4][fourthIndex]->GetIndex());
2998 } // close loop on fourth digit
3000 } // close loop on third digit
3002 } // close loop on second digit
3004 } // close loop on first digit
3010 for (ii=0; ii<kMaxNumberOfInterestingPads; ii++)
3011 for (jj=0; jj<kMaxNumberOfDigitsPerVolume; jj++)
3012 selectedDigit[ii][jj] = 0x0;
3016 for (ii=0; ii<kMaxNumberOfInterestingPads; ii++)
3017 for (jj=0; jj<kMaxNumberOfDigitsPerVolume; jj++) {
3018 delete selectedDigit[ii][jj];
3019 selectedDigit[ii][jj] = 0x0;
3023 //_____________________________________________________________________________
3025 Int_t AliTOFClusterFinderV1::InsertCluster(AliTOFcluster *tofCluster)
3028 // This function adds a TOF cluster to the array of TOF clusters
3029 // sorted in Z, i.e. fTofClusters
3032 if (fNumberOfTofClusters==kTofMaxCluster) {
3033 AliError("Too many clusters !");
3037 if (fNumberOfTofClusters==0) {
3038 fTofClusters[fNumberOfTofClusters++] = tofCluster;
3042 Int_t ii = FindClusterIndex(tofCluster->GetZ());
3043 memmove(fTofClusters+ii+1 ,fTofClusters+ii,(fNumberOfTofClusters-ii)*sizeof(AliTOFcluster*));
3044 fTofClusters[ii] = tofCluster;
3045 fNumberOfTofClusters++;
3050 //_____________________________________________________________________________
3052 Int_t AliTOFClusterFinderV1::FindClusterIndex(Double_t z) const
3055 // This function returns the index of the nearest cluster in z
3058 if (fNumberOfTofClusters==0) return 0;
3059 if (z <= fTofClusters[0]->GetZ()) return 0;
3060 if (z > fTofClusters[fNumberOfTofClusters-1]->GetZ()) return fNumberOfTofClusters;
3061 Int_t b = 0, e = fNumberOfTofClusters-1, m = (b+e)/2;
3062 for (; b<e; m=(b+e)/2) {
3063 if (z > fTofClusters[m]->GetZ()) b=m+1;
3070 //_____________________________________________________________________________
3072 void AliTOFClusterFinderV1::ResetRecpoint()
3075 // Clear the list of reconstructed points
3078 fNumberOfTofClusters = 0;
3079 if (fRecPoints) fRecPoints->Clear();
3082 //_____________________________________________________________________________
3084 void AliTOFClusterFinderV1::ResetDigits()
3087 // Clear the list of digits
3090 fNumberOfTofDigits = 0;
3091 if (fDigits) fDigits->Clear();
3094 //_____________________________________________________________________________
3095 //UShort_t AliTOFClusterFinderV1::GetClusterVolIndex(Int_t *ind) const
3098 // Get the volume ID to retrieve the l2t transformation
3101 // Detector numbering scheme
3103 Int_t nSector = AliTOFGeometry::NSectors();
3104 Int_t nPlate = AliTOFGeometry::NPlates();
3105 Int_t nStripA = AliTOFGeometry::NStripA();
3106 Int_t nStripB = AliTOFGeometry::NStripB();
3107 Int_t nStripC = AliTOFGeometry::NStripC();
3109 Int_t isector =ind[0];
3110 if (isector >= nSector)
3111 AliError(Form("Wrong sector number in TOF (%d) !", isector));
3112 Int_t iplate = ind[1];
3113 if (iplate >= nPlate)
3114 AliError(Form("Wrong plate number in TOF (%d) !", iplate));
3115 Int_t istrip = ind[2];
3117 Int_t stripOffset = 0;
3123 stripOffset = nStripC;
3126 stripOffset = nStripC+nStripB;
3129 stripOffset = nStripC+nStripB+nStripA;
3132 stripOffset = nStripC+nStripB+nStripA+nStripB;
3135 AliError(Form("Wrong plate number in TOF (%d) !", iplate));
3139 Int_t index= (2*(nStripC+nStripB)+nStripA)*isector +
3143 UShort_t volIndex = AliGeomManager::LayerToVolUID(AliGeomManager::kTOF, index);
3148 //_____________________________________________________________________________
3150 void AliTOFClusterFinderV1::GetClusterPars(Int_t *ind, Double_t* pos, Double_t* cov) const
3153 // Starting from the volume indices (ind[5]), for a cluster coming from
3154 // a isolated digits, this function returns:
3155 // the cluster position (pos),
3156 // the cluster covariance matrix elements (cov)
3160 //we now go in the system of the strip: determine the local coordinates
3163 // 47---------------------------------------------------0 ^ z
3164 // | | | | | | | | | | | | | | | | | | | | | | | | | | | 1 |
3165 // ----------------------------------------------------- | y going outwards
3166 // | | | | | | | | | | | | | | | | | | | | | | | | | | | 0 | par[0]=0;
3168 // ----------------------------------------------------- |
3169 // x <-----------------------------------------------------
3171 //move to the tracking ref system
3172 Double_t lpos[3] = { (ind[4]-23.5)*AliTOFGeometry::XPad(),
3174 (ind[3]- 0.5)*AliTOFGeometry::ZPad() };
3175 AliDebug(1, Form(" %f %f %f", lpos[0], lpos[1], lpos[2]));
3178 UShort_t volIndex = fTOFGeometry->GetAliSensVolIndex(ind[0],ind[1],ind[2]);
3179 //UShort_t volIndex = GetClusterVolIndex(ind);
3180 const TGeoHMatrix *l2t = AliGeomManager::GetTracking2LocalMatrix(volIndex);
3182 // Get the position in the track ref system
3184 l2t->MasterToLocal(lpos,tpos);
3189 //Get the cluster covariance in the track ref system
3191 for (Int_t ii=0; ii<9; ii++) lcov[ii] = 0.;
3193 //cluster covariance in the local system:
3198 lcov[4] = 0.42*0.42/3.;
3199 // = ( 5*0.025 (gas gaps thikness)
3200 // + 4*0.040 (internal glasses thickness)
3201 // + 0.5*0.160 (internl PCB)
3202 // + 1*0.055 (external red glass))
3205 lcov[0] = 0.499678;//AliTOFGeometry::XPad()*AliTOFGeometry::XPad()/12.;
3206 lcov[8] = 0.992429;//AliTOFGeometry::ZPad()*AliTOFGeometry::ZPad()/12.;
3208 //cluster covariance in the tracking system:
3210 m.SetRotation(lcov);
3212 m.MultiplyLeft(&l2t->Inverse());
3213 Double_t *tcov = m.GetRotationMatrix();
3214 cov[0] = tcov[0]; cov[1] = tcov[1]; cov[2] = tcov[2];
3215 cov[3] = tcov[4]; cov[4] = tcov[5]; cov[5] = tcov[8];
3220 //_____________________________________________________________________________
3222 void AliTOFClusterFinderV1::GetClusterPars(/*Bool_t check,*/ Int_t counter,
3223 Int_t **ind, Double_t *weight,
3224 Double_t *pos, Double_t *cov) const
3228 // the volumes indices (ind[counter][5]), for a
3229 // cluster coming from a collection of 'counter'
3231 // the volumes weights (weight[counter]), -controlled
3232 // by the 'check' variable control-, for a cluster
3233 // coming from a collection of 'counter' digits,
3234 // the cluster position (pos),
3235 // this function returns:
3236 // the covariance matrix elements (cov) for the found cluster
3240 // we now go in the system of the strip: determine the local coordinates
3242 // 47---------------------------------------------------0 ^ z
3243 // | | | | | | | | | | | | | | | | | | | | | | | | | | | 1 |
3244 // ----------------------------------------------------- | y going outwards
3245 // | | | | | | | | | | | | | | | | | | | | | | | | | | | 0 | par[0]=0;
3247 // ----------------------------------------------------- |
3248 // x <-----------------------------------------------------
3250 for (Int_t ii=0; ii<counter; ii++)
3251 AliDebug(1, Form(" %2d %2d %1d %2d %1d %2d ",
3252 ii, ind[ii][0], ind[ii][1], ind[ii][2], ind[ii][3], ind[ii][4]));
3254 Float_t posF[3]; for (Int_t ii=0; ii<3; ii++) posF[ii] = (Float_t)pos[ii];
3255 AliDebug(1, Form(" %f %f %f", pos[0], pos[1], pos[2]));
3257 Int_t detClus[5] = {-1, -1, -1, -1, -1};
3258 fTOFGeometry->GetDetID(posF, detClus);
3261 UShort_t volIndex = fTOFGeometry->GetAliSensVolIndex(detClus[0],detClus[1],detClus[2]);
3262 //UShort_t volIndex = GetClusterVolIndex(detClus);
3263 AliDebug(1, Form(" %2d %1d %2d %1d %2d %7i",
3264 detClus[0], detClus[1], detClus[2], detClus[3], detClus[4], volIndex));
3266 // Get the position in the TOF strip ref system
3267 const TGeoHMatrix *alice2strip = AliGeomManager::GetOrigGlobalMatrix(volIndex);
3268 Double_t ppos[3] = {-1, -1, -1};
3269 alice2strip->MasterToLocal(pos,ppos);
3270 AliDebug(1, Form(" %f %f %f", ppos[0], ppos[1], ppos[2]));
3273 // Get the position in the tracking ref system
3274 const TGeoHMatrix *g2l = AliGeomManager::GetTracking2LocalMatrix(volIndex);
3275 Double_t lpos[3] = {-1, -1, -1};
3276 g2l->MasterToLocal(ppos,lpos);
3277 AliDebug(1, Form(" %f %f %f", lpos[0], lpos[1], lpos[2]));
3278 for (Int_t ii=0; ii<3; ii++) pos[ii] = lpos[ii];
3280 //Get the cluster covariance in the track ref system
3282 for (Int_t ii=0; ii<9; ii++) lcov[ii] = 0.;
3284 //cluster covariance in the local system:
3289 // Evaluation of the ovariance matrix elements
3290 TOFclusterError(/*check,*/ counter, ind, weight, ppos, lcov);
3292 AliDebug(1, Form("lcov[0] = %f, lcov[8] = %f", lcov[0], lcov[8]));
3294 //cluster covariance in the tracking system:
3296 m.SetRotation(lcov);
3298 m.MultiplyLeft(&g2l->Inverse());
3299 Double_t *tcov = m.GetRotationMatrix();
3300 cov[0] = tcov[0]; cov[1] = tcov[1]; cov[2] = tcov[2];
3301 cov[3] = tcov[4]; cov[4] = tcov[5]; cov[5] = tcov[8];
3306 //_____________________________________________________________________________
3308 void AliTOFClusterFinderV1::TOFclusterError(/*Bool_t check,*/ Int_t counter,
3309 Int_t **ind, Double_t *weight,
3310 Double_t ppos[], Double_t lcov[]) const
3316 //lcov[4] = 0.42*0.42/3.; // cm2
3317 // = ( 5*0.025 (gas gaps thikness)
3318 // + 4*0.040 (internal glasses thickness)
3319 // + 0.5*0.160 (internl PCB)
3320 // + 1*0.055 (external red glass))
3323 Float_t *delta2X = new Float_t[counter];
3324 for (Int_t ii=0; ii<counter; ii++)
3326 ((ind[ii][4]-23.5)*AliTOFGeometry::XPad() - ppos[0])*((ind[ii][4]-23.5)*AliTOFGeometry::XPad() - ppos[0]);
3328 Float_t *delta2Z = new Float_t[counter];
3329 for (Int_t ii=0; ii<counter; ii++)
3331 ((ind[ii][3]- 0.5)*AliTOFGeometry::ZPad() - ppos[2])*((ind[ii][3]- 0.5)*AliTOFGeometry::ZPad() - ppos[2]);
3333 for (Int_t ii=0; ii<counter; ii++)
3334 AliDebug(1, Form("x[%d] = %f, z[%d] = %f, weight[%d] = %f",
3335 ii, (ind[ii][4]-23.5)*AliTOFGeometry::XPad(),
3336 ii, (ind[ii][3]- 0.5)*AliTOFGeometry::ZPad(),
3339 AliDebug(1, Form("xMean = %f, zMean = %f",ppos[0], ppos[2]));
3347 if (ind[0][3]==ind[1][3] && TMath::Abs(ind[0][4]-ind[1][4])==1) { //
3349 lcov[8] = 1.02039; // cm2
3350 lcov[0] = 0.0379409; // cm2
3353 lcov[0] = 0.5*0.5; // cm2
3355 if (weight[0]==weight[1])
3356 lcov[0] = 0.0379409; // cm2
3358 lcov[0] = TMath::Mean(counter, delta2X, weight); // cm2
3364 else if (ind[0][4]==ind[1][4] && TMath::Abs(ind[0][3]-ind[1][3])==1) {//
3366 lcov[0] = 0.505499; // cm2
3367 lcov[8] = 0.0422046; // cm2
3370 lcov[8] = 0.5*0.5; // cm2
3372 if (weight[0]==weight[1])
3373 lcov[8] = 0.0422046; // cm2
3375 lcov[8] = TMath::Mean(counter, delta2Z, weight); // cm2
3384 lcov[0] = 0.0290677; // cm2
3385 lcov[8] = 0.0569726; // cm2
3388 lcov[0] = 0.5*0.5; // cm2
3389 lcov[8] = 0.5*0.5; // cm2
3392 if (weight[0]==weight[1] && weight[0]==weight[2]) {
3393 lcov[0] = 0.0290677; // cm2
3394 lcov[8] = 0.0569726; // cm2
3397 lcov[0] = TMath::Mean(counter, delta2X, weight); // cm2
3398 lcov[8] = TMath::Mean(counter, delta2Z, weight); // cm2
3407 lcov[0] = 0.0223807; // cm2
3408 lcov[8] = 0.0438662; // cm2
3411 lcov[0] = 0.5*0.5; // cm2
3412 lcov[8] = 0.5*0.5; // cm2
3415 if (weight[0]==weight[1] && weight[0]==weight[2] && weight[0]==weight[3]) {
3416 lcov[0] = 0.0223807; // cm2
3417 lcov[8] = 0.0438662; // cm2
3420 lcov[0] = TMath::Mean(counter, delta2X, weight); // cm2
3421 lcov[8] = TMath::Mean(counter, delta2Z, weight); // cm2
3435 //_____________________________________________________________________________
3437 Bool_t AliTOFClusterFinderV1::MakeSlewingCorrection(Int_t *detectorIndex,
3443 // This funtion makes the following:
3445 // - if at least one of the three status (Pulser/Noise/HW) is
3446 // bad, is sets the status of electronic channel, corresponding to the
3447 // volume identified by detectorIndex, as kFALSE;
3448 // - if offline calibration is in the valid status, it performs the
3449 // slewing correction. In particular, by taking into account:
3450 // * the measured tot and tof values (tofDigitToT and tofDigitTdc,
3452 // * the six parameters of 5th order polynomial used
3453 // to fit the tofVStot scatter plot,
3454 // it returns the corrected tof value, i.e. tdcCorr value.
3457 Bool_t output = kTRUE;
3462 //AliInfo(" Calibrating TOF Digits: ");
3464 AliTOFChannelOnlineArray *calDelay = fTOFcalib->GetTOFOnlineDelay();
3465 AliTOFChannelOnlineStatusArray *calStatus = fTOFcalib->GetTOFOnlineStatus();
3467 TObjArray *calTOFArrayOffline = fTOFcalib->GetTOFCalArrayOffline();
3469 Int_t index = AliTOFGeometry::GetIndex(detectorIndex);
3471 UChar_t statusPulser = calStatus->GetPulserStatus(index);
3472 UChar_t statusNoise = calStatus->GetNoiseStatus(index);
3473 UChar_t statusHW = calStatus->GetHWStatus(index);
3474 UChar_t status = calStatus->GetStatus(index);
3476 //check the status, also unknown is fine!!!!!!!
3478 AliDebug(2, Form(" Status for channel %d = %d",index, (Int_t)status));
3479 if((statusPulser & AliTOFChannelOnlineStatusArray::kTOFPulserBad)==(AliTOFChannelOnlineStatusArray::kTOFPulserBad)||(statusNoise & AliTOFChannelOnlineStatusArray::kTOFNoiseBad)==(AliTOFChannelOnlineStatusArray::kTOFNoiseBad)||(statusHW & AliTOFChannelOnlineStatusArray::kTOFHWBad)==(AliTOFChannelOnlineStatusArray::kTOFHWBad)){
3480 AliDebug(2, Form(" Bad Status for channel %d",index));
3481 //fTofClusters[ii]->SetStatus(kFALSE); //odd convention, to avoid conflict with calibration objects currently in the db (temporary solution).
3485 AliDebug(2, Form(" Good Status for channel %d",index));
3487 // Get Rough channel online equalization
3488 Double_t roughDelay = (Double_t)calDelay->GetDelay(index); // in ns
3489 AliDebug(2,Form(" channel delay (ns) = %f", roughDelay));
3490 // Get Refined channel offline calibration parameters
3491 TString validity = (TString)fTOFcalib->GetOfflineValidity();
3492 if (validity.CompareTo("valid")==0) {
3493 AliTOFChannelOffline * calChannelOffline = (AliTOFChannelOffline*)calTOFArrayOffline->At(index);
3495 for (jj = 0; jj<6; jj++)
3496 par[jj] = (Double_t)calChannelOffline->GetSlewPar(jj);
3498 AliDebug(2,Form(" Calib Pars = %f, %f, %f, %f, %f, %f ",par[0],par[1],par[2],par[3],par[4],par[5]));
3499 AliDebug(2,Form(" The ToT and Time, uncorr (counts) = %d , %d", tofDigitToT, tofDigitTdc));
3500 Double_t tToT = (Double_t)(tofDigitToT*AliTOFGeometry::ToTBinWidth());
3501 tToT*=1.E-3; //ToT in ns
3502 AliDebug(2,Form(" The ToT and Time, uncorr (ns)= %e, %e",tofDigitTdc*AliTOFGeometry::TdcBinWidth()*1.E-3,tToT));
3503 timeCorr = par[0] + tToT*(par[1] + tToT*(par[2] + tToT*(par[3] + tToT*(par[4] + tToT*par[5])))); // the time correction (ns)
3506 timeCorr = roughDelay; // correction in ns
3508 AliDebug(2,Form(" The ToT and Time, uncorr (ns)= %e, %e",tofDigitTdc*AliTOFGeometry::TdcBinWidth()*1.E-3,tofDigitToT*AliTOFGeometry::ToTBinWidth()));
3509 AliDebug(2,Form(" The time correction (ns) = %f", timeCorr));
3510 timeCorr = (Double_t)(tofDigitTdc)*AliTOFGeometry::TdcBinWidth()*1.E-3-timeCorr;//redefine the time
3512 AliDebug(2,Form(" The channel time, corr (ps)= %e",timeCorr ));
3513 tdcCorr = (Int_t)(timeCorr/AliTOFGeometry::TdcBinWidth()); //the corrected time (tdc counts)
3518 //______________________________________________________________________________
3520 void AliTOFClusterFinderV1::Digits2RecPoints(Int_t iEvent)
3523 // Converts digits to recpoints for TOF
3526 TStopwatch stopwatch;
3529 fRunLoader->GetEvent(iEvent);
3531 AliLoader *localTOFLoader = (AliLoader*)fRunLoader->GetLoader("TOFLoader");
3533 TTree * localTreeD = (TTree*)localTOFLoader->TreeD();
3534 if (localTreeD == 0x0)
3535 AliFatal("Can not get TreeD");
3537 TBranch *branch = localTreeD->GetBranch("TOF");
3539 AliError("Can't get the branch with the TOF digits !");
3543 TTree *localTreeR = (TTree*)localTOFLoader->TreeR();
3544 if (localTreeR == 0x0)
3546 localTOFLoader->MakeTree("R");
3547 localTreeR = localTOFLoader->TreeR();
3550 Digits2RecPoints(localTreeD, localTreeR);
3552 //localTOFLoader = fRunLoader->GetLoader("TOFLoader");
3553 localTOFLoader->WriteRecPoints("OVERWRITE");
3555 AliDebug(1, Form("Execution time to read TOF digits and to write TOF clusters for the event number %d: R:%.4fs C:%.4fs",
3556 iEvent, stopwatch.RealTime(),stopwatch.CpuTime()));
3559 //______________________________________________________________________________
3561 void AliTOFClusterFinderV1::Digits2RecPoints(Int_t iEvent, AliRawReader *rawReader)
3564 // Converts RAW data to recpoints for TOF
3567 TStopwatch stopwatch;
3570 fRunLoader->GetEvent(iEvent);
3572 AliDebug(2,Form(" Event number %2d ", iEvent));
3574 AliLoader *localTOFLoader = (AliLoader*)fRunLoader->GetLoader("TOFLoader");
3576 TTree *localTreeR = localTOFLoader->TreeR();
3578 if (localTreeR == 0x0){
3579 localTOFLoader->MakeTree("R");
3580 localTreeR = localTOFLoader->TreeR();
3583 Digits2RecPoints(rawReader, localTreeR);
3585 AliDebug(1, Form("Execution time to read TOF raw data and to write TOF clusters for the event number %d: R:%.4fs C:%.4fs",
3586 iEvent, stopwatch.RealTime(),stopwatch.CpuTime()));
3589 //______________________________________________________________________________
3591 void AliTOFClusterFinderV1::Raw2Digits(Int_t iEvent, AliRawReader *rawReader)
3594 // Converts RAW data to MC digits for TOF
3598 TStopwatch stopwatch;
3601 fRunLoader->GetEvent(iEvent);
3603 AliDebug(2,Form(" Event number %2d ", iEvent));
3605 AliLoader *localTOFLoader = (AliLoader*)fRunLoader->GetLoader("TOFLoader");
3607 TTree *localTreeD = localTOFLoader->TreeD();
3609 if (localTreeD == 0x0){
3610 localTOFLoader->MakeTree("D");
3611 localTreeD = localTOFLoader->TreeD();
3614 Raw2Digits(rawReader, localTreeD);
3616 AliDebug(1, Form("Execution time to read TOF raw data and to write TOF clusters for the event number %d: R:%.4fs C:%.4fs",
3617 iEvent, stopwatch.RealTime(),stopwatch.CpuTime()));
3620 //______________________________________________________________________________
3622 void AliTOFClusterFinderV1::AverageCalculations(Int_t number, Float_t *interestingX,
3623 Float_t *interestingY, Float_t *interestingZ,
3624 Double_t *interestingTOF, Double_t *interestingTOT,
3625 Double_t *interestingADC, Double_t *interestingWeight,
3626 Int_t *parTOF, Double_t *posClus, Bool_t &check)
3632 Double_t tofAverage = 0.;
3633 Double_t totAverage = 0.;
3634 Double_t adcAverage = 0.;
3638 for (ii=number-1; ii>=0; ii--) check=check||(interestingWeight[ii]==0 || interestingWeight[ii]==-1);
3642 posClus[0] = TMath::Mean(number, interestingX);
3643 posClus[1] = TMath::Mean(number, interestingY);
3644 posClus[2] = TMath::Mean(number, interestingZ);
3645 tofAverage = TMath::Mean(number, interestingTOF);
3646 totAverage = TMath::Mean(number, interestingTOT);
3647 adcAverage = TMath::Mean(number, interestingADC);
3652 posClus[0] = TMath::Mean(number, interestingX, interestingWeight);
3653 posClus[1] = TMath::Mean(number, interestingY, interestingWeight);
3654 posClus[2] = TMath::Mean(number, interestingZ, interestingWeight);
3655 tofAverage = TMath::Mean(number, interestingTOF, interestingWeight);
3656 totAverage = TMath::Mean(number, interestingTOT, interestingWeight);
3657 adcAverage = TMath::Mean(number, interestingADC, interestingWeight);
3661 parTOF[0] = Int_t(tofAverage);
3662 parTOF[1] = Int_t(totAverage);
3663 parTOF[2] = Int_t(adcAverage);
3664 parTOF[3] = Int_t(tofAverage);//tofND
3665 parTOF[4] = Int_t(tofAverage);//tofRAW