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 AliDebug(1," Calibrating TOF Digits");
228 TString validity = (TString)fTOFcalib->GetOfflineValidity();
229 if (validity.CompareTo("valid")==0) {
230 AliInfo(Form(" validity = %s - Using offline calibration parameters", validity.Data()));
232 AliInfo(Form(" validity = %s - Using online calibration parameters", validity.Data()));
235 for (ii=0; ii<digits->GetEntriesFast(); ii++) {
236 tofDigit = (AliTOFdigit*)digits->UncheckedAt(ii);
237 detectorIndex[0] = tofDigit->GetSector();
238 detectorIndex[1] = tofDigit->GetPlate();
239 detectorIndex[2] = tofDigit->GetStrip();
240 detectorIndex[3] = tofDigit->GetPadz();
241 detectorIndex[4] = tofDigit->GetPadx();
243 if (detectorIndex[0]==13 || detectorIndex[0]==14 || detectorIndex[0]==15 ) { // sectors with holes
244 if (detectorIndex[1]==2) { // plate with holes
250 status = MakeSlewingCorrection(detectorIndex, tofDigit->GetToT(), tofDigit->GetTdc(), tdcCorr);
252 for (jj=0; jj<4; jj++) info[jj] = -1;
253 info[0] = tdcCorr;//tofDigit->GetTdc();
254 info[1] = tofDigit->GetAdc();
255 info[2] = tofDigit->GetToT();
256 info[3] = tofDigit->GetTdcND();//tofDigit->GetTdc();//
257 tracks = tofDigit->GetTracks();
259 dummy = detectorIndex[3];
260 detectorIndex[3] = detectorIndex[4];//padx
261 detectorIndex[4] = dummy;//padz
262 last = fDigits->GetEntriesFast();
263 new (aDigits[last]) AliTOFdigit(tracks, detectorIndex, info);
264 if (status) fTOFdigitMap->AddDigit(detectorIndex, last);
266 AliDebug(2, Form(" Digits reading %2d -> %2d %1d %2d %1d %2d (%d, %d, %d)",
268 detectorIndex[0], detectorIndex[1], detectorIndex[2], detectorIndex[3], detectorIndex[4],
269 info[0], info[1], info[3]));
273 fNumberOfTofDigits = fDigits->GetEntriesFast();
277 Int_t bufsize = 32000;
278 clusterTree->Branch("TOF", &fRecPoints, bufsize);
283 AliInfo(Form("Number of found clusters: %d", fNumberOfTofClusters));
287 fTOFdigitMap->Clear();
291 AliDebug(1,Form("Execution time to read TOF digits and to write TOF clusters : R:%.4fs C:%.4fs",
292 stopwatch.RealTime(),stopwatch.CpuTime()));
294 if (inholes) AliWarning(Form("Clusters in the TOF holes: %d",inholes));
297 //_____________________________________________________________________________
299 void AliTOFClusterFinderV1::Digits2RecPoints(AliRawReader *rawReader, TTree *clustersTree)
302 // Converts raw data to recPoints for TOF
305 TStopwatch stopwatch;
309 AliDebug(2, "TreeD re-creation");
310 //TTree *digitsTree = new TTree();
311 //Raw2Digits(rawReader, digitsTree);
313 Raw2Digits(rawReader, fTOFdigits);
315 AliDebug(2,Form("Number of TOF digits: %d", fNumberOfTofDigits));
318 Int_t bufsize = 32000;
319 clustersTree->Branch("TOF", &fRecPoints, bufsize);
322 clustersTree->Fill();
324 AliInfo(Form("Number of found clusters: %d", fNumberOfTofClusters));
328 fTOFdigitMap->Clear();
332 AliDebug(1,Form("Execution time to read TOF raw data and to write TOF clusters : R:%.4fs C:%.4fs",
333 stopwatch.RealTime(),stopwatch.CpuTime()));
337 //_____________________________________________________________________________
339 void AliTOFClusterFinderV1::Raw2Digits(AliRawReader *rawReader, TTree* digitsTree)
342 // Converts raw data to digits for TOF
345 TStopwatch stopwatch;
350 const Int_t kMaxNumberOfTracksPerDigit = 3;
351 const Int_t kDDL = AliDAQ::NumberOfDdls("TOF");
353 digitsTree->Branch("TOF", &fDigits);
354 TClonesArray &aDigits = *fDigits;
356 fTOFRawStream.Clear();
357 fTOFRawStream.SetRawReader(rawReader);
360 if (fVerbose==2) ftxt.open("TOFdigitsRead.txt",ios::app);
362 TClonesArray staticRawData("AliTOFrawData",10000);
363 staticRawData.Clear();
364 TClonesArray * clonesRawData = &staticRawData;
367 Int_t detectorIndex[5] = {-1, -1, -1, -1, -1};
369 Int_t tracks[kMaxNumberOfTracksPerDigit];
370 for (Int_t ii=0; ii<kMaxNumberOfTracksPerDigit; ii++)
375 Bool_t status = kTRUE;
377 TString validity = (TString)fTOFcalib->GetOfflineValidity();
378 if (validity.CompareTo("valid")==0) {
379 AliInfo(Form(" validity = %s - Using offline calibration parameters", validity.Data()));
381 AliInfo(Form(" validity = %s - Using online calibration parameters", validity.Data()));
384 AliInfo("Using New Decoder");
388 for (indexDDL=0; indexDDL<kDDL; indexDDL++) {
392 fTOFRawStream.LoadRawDataBuffers(indexDDL,fVerbose);
393 else fTOFRawStream.LoadRawData(indexDDL);
395 clonesRawData = (TClonesArray*)fTOFRawStream.GetRawData();
396 if (clonesRawData->GetEntriesFast()!=0) AliInfo(Form(" TOF raw data number = %3d", clonesRawData->GetEntriesFast()));
397 for (iRawData = 0; iRawData<clonesRawData->GetEntriesFast(); iRawData++) {
399 AliTOFrawData *tofRawDatum = (AliTOFrawData*)clonesRawData->UncheckedAt(iRawData);
401 //if (tofRawDatum->GetTOT()==-1 || tofRawDatum->GetTOF()==-1) continue;
402 if (tofRawDatum->GetTOF()==-1) continue;
404 fTOFRawStream.EquipmentId2VolumeId(indexDDL, tofRawDatum->GetTRM(), tofRawDatum->GetTRMchain(),
405 tofRawDatum->GetTDC(), tofRawDatum->GetTDCchannel(), detectorIndex);
408 dummy = detectorIndex[3];
409 detectorIndex[3] = detectorIndex[4];//padz
410 detectorIndex[4] = dummy;//padx
411 status = MakeSlewingCorrection(detectorIndex, tofRawDatum->GetTOT(), tofRawDatum->GetTOF(), tdcCorr);
414 digit[1] = tofRawDatum->GetTOT();
415 digit[2] = tofRawDatum->GetTOT();
416 digit[3] = -1;//tofRawDatum->GetTOF(); //tofND
418 dummy = detectorIndex[3];
419 detectorIndex[3] = detectorIndex[4];//padx
420 detectorIndex[4] = dummy;//padz
422 /* check valid index */
423 if (detectorIndex[0]==-1||detectorIndex[1]==-1||detectorIndex[2]==-1||detectorIndex[3]==-1||detectorIndex[4]==-1) continue;
425 // Do not reconstruct anything in the holes
426 if (detectorIndex[0]==13 || detectorIndex[0]==14 || detectorIndex[0]==15 ) { // sectors with holes
427 if (detectorIndex[1]==2) { // plate with holes
433 last = fDigits->GetEntriesFast();
434 new (aDigits[last]) AliTOFdigit(tracks, detectorIndex, digit);
435 if (status) fTOFdigitMap->AddDigit(detectorIndex, last);
438 if (indexDDL<10) ftxt << " " << indexDDL;
439 else ftxt << " " << indexDDL;
440 if (tofRawDatum->GetTRM()<10) ftxt << " " << tofRawDatum->GetTRM();
441 else ftxt << " " << tofRawDatum->GetTRM();
442 ftxt << " " << tofRawDatum->GetTRMchain();
443 if (tofRawDatum->GetTDC()<10) ftxt << " " << tofRawDatum->GetTDC();
444 else ftxt << " " << tofRawDatum->GetTDC();
445 ftxt << " " << tofRawDatum->GetTDCchannel();
447 if (detectorIndex[0]<10) ftxt << " -> " << detectorIndex[0];
448 else ftxt << " -> " << detectorIndex[0];
449 ftxt << " " << detectorIndex[1];
450 if (detectorIndex[2]<10) ftxt << " " << detectorIndex[2];
451 else ftxt << " " << detectorIndex[2];
452 ftxt << " " << detectorIndex[4];
453 if (detectorIndex[4]<10) ftxt << " " << detectorIndex[3];
454 else ftxt << " " << detectorIndex[3];
456 if (digit[1]<10)ftxt << " " << digit[1];
457 else if (digit[1]>=10 && digit[1]<100) ftxt << " " << digit[1];
458 else ftxt << " " << digit[1];
459 if (digit[0]<10) ftxt << " " << digit[0] << endl;
460 else if (digit[0]>=10 && digit[0]<100) ftxt << " " << digit[0] << endl;
461 else if (digit[0]>=100 && digit[0]<1000) ftxt << " " << digit[0] << endl;
462 else ftxt << " " << digit[3] << endl;
465 AliDebug(2, Form(" Raw data reading %2d -> %2d %1d %2d %1d %2d (%d, %d, %d)",
467 detectorIndex[0], detectorIndex[1], detectorIndex[2], detectorIndex[4], detectorIndex[3],
468 digit[0], digit[1], digit[3]));
472 clonesRawData->Clear();
476 if (fVerbose==2) ftxt.close();
480 fNumberOfTofDigits = fDigits->GetEntries();
482 AliDebug(1, Form("Got %d TOF digits", fNumberOfTofDigits));
483 AliDebug(1, Form("Execution time to read TOF raw data and fill TOF digit tree : R:%.2fs C:%.2fs",
484 stopwatch.RealTime(),stopwatch.CpuTime()));
486 if (inholes) AliWarning(Form("Clusters in the TOF holes: %d",inholes));
489 //_____________________________________________________________________________
491 void AliTOFClusterFinderV1::FillRecPoint()
494 // Fill the global TClonesArray of AliTOFcluster objects,
503 for(Int_t iPlate=AliTOFGeometry::NPlates()-1; iPlate>=0; iPlate--) {
504 for(Int_t iStrip=AliTOFGeometry::NStrip(iPlate)-1; iStrip>=0; iStrip--) {
505 //for (Int_t iSector=AliTOFGeometry::NSectors()-1; iSector>=0; iSector--) {
506 for (Int_t iSector=0; iSector<AliTOFGeometry::NSectors(); iSector++) {
508 if (!(fTOFdigitMap->StripDigitCheck(iSector,iPlate,iStrip))) continue;
509 FindClustersWithoutTOT(iSector, iPlate, iStrip); // clusters coming from digits without TOT measurement
512 if (!(fTOFdigitMap->StripDigitCheck(iSector,iPlate,iStrip))) continue;
513 FindClustersPerStrip(iSector, iPlate, iStrip, 4); // 4 pads clusters
514 if (!(fTOFdigitMap->StripDigitCheck(iSector,iPlate,iStrip))) continue;
516 dummy4 = fNumberOfTofClusters;
517 FindClustersPerStrip(iSector, iPlate, iStrip, 4); // 4 pads clusters
518 if (fNumberOfTofClusters!=dummy4)
519 AliDebug(2, Form(" (4): n1= %5d, n2 = %5", dummy4, fNumberOfTofClusters));
522 if (!(fTOFdigitMap->StripDigitCheck(iSector,iPlate,iStrip))) continue;
523 FindClustersPerStrip(iSector, iPlate, iStrip, 3); // 3 pads clusters
524 if (!(fTOFdigitMap->StripDigitCheck(iSector,iPlate,iStrip))) continue;
526 dummy3 = fNumberOfTofClusters;
527 FindClustersPerStrip(iSector, iPlate, iStrip, 3); // 3 pads clusters
528 if (fNumberOfTofClusters!=dummy3)
529 AliDebug(2, Form(" (3): n1= %5d, n2 = %5", dummy3, fNumberOfTofClusters));
532 if (!(fTOFdigitMap->StripDigitCheck(iSector,iPlate,iStrip))) continue;
533 FindClustersPerStrip(iSector, iPlate, iStrip, 2); // 2 pads clusters
534 if (!(fTOFdigitMap->StripDigitCheck(iSector,iPlate,iStrip))) continue;
536 dummy2 = fNumberOfTofClusters;
537 FindClustersPerStrip(iSector, iPlate, iStrip, 2); // 2 pads clusters
538 if (fNumberOfTofClusters!=dummy2)
539 AliDebug(2, Form(" (2): n1= %5d, n2 =%5", dummy2, fNumberOfTofClusters));
542 if (!(fTOFdigitMap->StripDigitCheck(iSector,iPlate,iStrip))) continue;
543 dummy = fNumberOfTofClusters;
544 FindClusters34(iSector, iPlate, iStrip); // 3 pads clusters between 4 hit pads
545 if (fNumberOfTofClusters!=dummy)
546 AliDebug(2, Form(" (3 between 4): n1 = %5d, n2 = %5d", fNumberOfTofClusters, dummy));
549 if (!(fTOFdigitMap->StripDigitCheck(iSector,iPlate,iStrip))) continue;
550 dummy = fNumberOfTofClusters;
551 FindClusters23(iSector, iPlate, iStrip); // 2 pads clusters between 3 hit pads
552 if (fNumberOfTofClusters!=dummy)
553 AliDebug(2, Form(" (2 between 3): n1 = %5d, n2 = %5d", fNumberOfTofClusters, dummy));
555 if (!(fTOFdigitMap->StripDigitCheck(iSector,iPlate,iStrip))) continue;
556 dummy = fNumberOfTofClusters;
557 FindClusters24(iSector, iPlate, iStrip); // 2 pads clusters between 4 hit pads
558 if (fNumberOfTofClusters!=dummy)
559 AliDebug(2, Form(" (2 between 4): n1 = %5d, n2 = %5d", fNumberOfTofClusters, dummy));
562 if (!(fTOFdigitMap->StripDigitCheck(iSector,iPlate,iStrip))) continue;
563 dummy = fNumberOfTofClusters;
564 FindOnePadClusterPerStrip(iSector, iPlate, iStrip); // 1 pad clusters
565 if (fNumberOfTofClusters!=dummy)
566 AliDebug(2,Form(" (1): n1 = %5d, n2 = %5d", fNumberOfTofClusters, dummy));
568 if (fTOFdigitMap->DigitInStrip(iSector,iPlate,iStrip)>0)
569 AliDebug(2, Form(" (1): number of clusters = %5d (remaining digit %2d), -%2d %1d %2d-",
570 fNumberOfTofClusters, fTOFdigitMap->DigitInStrip(iSector,iPlate,iStrip),
571 iSector, iPlate, iStrip));
578 TClonesArray &lRecPoints = *fRecPoints;
582 Int_t detectorIndex[5];
583 for (jj=0; jj<5; jj++) detectorIndex[jj] = -1;
585 for (jj=0; jj<5; jj++) parTOF[jj] = -1;
586 Int_t trackLabels[3];
587 for (jj=0; jj<3; jj++) trackLabels[jj] = -1;
588 Int_t digitIndex = -1;
589 Bool_t status = kTRUE;
591 for (ii=0; ii<3; ii++) posClus[ii] = 0.;
592 //Float_t covClus[6];
593 //for (ii=0; ii<6; ii++) covClus[ii] = 0.;
596 for (ii=0; ii<fNumberOfTofClusters; ii++) {
598 digitIndex = fTofClusters[ii]->GetIndex();
599 for(jj=0; jj<5; jj++) detectorIndex[jj] = fTofClusters[ii]->GetDetInd(jj);
600 volIdClus = fTOFGeometry->GetAliSensVolIndex(detectorIndex[0],detectorIndex[1],detectorIndex[2]);
601 //volIdClus = GetClusterVolIndex(detectorIndex);
602 for(jj=0; jj<3; jj++) trackLabels[jj] = fTofClusters[ii]->GetLabel(jj);
603 parTOF[0] = fTofClusters[ii]->GetTDC(); // TDC
604 parTOF[1] = fTofClusters[ii]->GetToT(); // TOT
605 parTOF[2] = fTofClusters[ii]->GetADC(); // ADC=TOT
606 parTOF[3] = fTofClusters[ii]->GetTDCND(); // TDCND
607 parTOF[4] = fTofClusters[ii]->GetTDCRAW();//RAW
608 status = fTofClusters[ii]->GetStatus();
610 posClus[0] = fTofClusters[ii]->GetX();
611 posClus[1] = fTofClusters[ii]->GetY();
612 posClus[2] = fTofClusters[ii]->GetZ();
614 //for (jj=0; jj<6; jj++) covClus[jj] = 0.;
615 //((AliCluster*)fTofClusters[ii])->GetGlobalCov(covClus);
617 new(lRecPoints[ii]) AliTOFcluster(volIdClus, (Double_t)posClus[0], (Double_t)posClus[1], (Double_t)posClus[2],
618 (Double_t)(fTofClusters[ii]->GetSigmaX2()),
619 (Double_t)(fTofClusters[ii]->GetSigmaXY()),
620 (Double_t)(fTofClusters[ii]->GetSigmaXZ()),
621 (Double_t)(fTofClusters[ii]->GetSigmaY2()),
622 (Double_t)(fTofClusters[ii]->GetSigmaYZ()),
623 (Double_t)(fTofClusters[ii]->GetSigmaZ2()),
624 //(Double_t)covClus[0], (Double_t)covClus[1], (Double_t)covClus[2],
625 //(Double_t)covClus[3], (Double_t)covClus[4], (Double_t)covClus[5],
626 trackLabels, detectorIndex, parTOF, status, digitIndex);
628 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",
629 ii, volIdClus, posClus[0], posClus[1], posClus[2],
630 fTofClusters[ii]->GetSigmaX2(),
631 fTofClusters[ii]->GetSigmaXY(),
632 fTofClusters[ii]->GetSigmaXZ(),
633 fTofClusters[ii]->GetSigmaY2(),
634 fTofClusters[ii]->GetSigmaYZ(),
635 fTofClusters[ii]->GetSigmaZ2(),
636 trackLabels[0], trackLabels[1], trackLabels[2],
637 detectorIndex[0], detectorIndex[1], detectorIndex[2], detectorIndex[3], detectorIndex[4],
638 parTOF[0], parTOF[1], parTOF[2], parTOF[3], parTOF[4],
639 status, digitIndex));
644 for (Int_t iSector=0; iSector<AliTOFGeometry::NSectors(); iSector++)
645 for(Int_t iPlate=0; iPlate<AliTOFGeometry::NPlates(); iPlate++) {
646 for(Int_t iStrip=0; iStrip<AliTOFGeometry::NStrip(iPlate); iStrip++) {
647 if (!(fTOFdigitMap->StripDigitCheck(iSector,iPlate,iStrip))) continue;
648 AliDebug(2, Form(" END %2d %1d %2d %5d",
649 iSector, iPlate, iStrip, fTOFdigitMap->DigitInStrip(iSector,iPlate,iStrip)));
654 //_____________________________________________________________________________
656 void AliTOFClusterFinderV1::FindOnePadClusterPerStrip(Int_t nSector,
661 // This function searches the isolated digits (stored in the fDigits object),
662 // to perform clusters (stored in the fTofClusters array).
663 // This research has been made by checking the fTOFdigitMap object,
664 // filled at digits/raw-data reading time.
667 const Int_t kMaxNumberOfTracksPerDigit = 3;
668 const Int_t kMaxNumberOfDigitsPerVolume = 10;
672 Int_t det[5] = {nSector,nPlate,nStrip,-1,-1};//sector,plate,strip,padZ,padX
673 Int_t vol[5] = {nSector,nPlate,nStrip,-1,-1};//sector,plate,strip,padX,padZ
674 UShort_t volIdClus = 0;
677 for (jj=0; jj<3; jj++) pos[jj] = 0.;
679 for (jj=0; jj<3; jj++) posClus[jj] = 0.;
682 for (jj=0; jj<6; jj++) covClus[jj] = 0.;
685 for (jj=0; jj<5; jj++) parTOF[jj] = 0;
687 Bool_t status = kTRUE; //assume all sim channels ok in the beginning...
689 Int_t tracks[kMaxNumberOfTracksPerDigit];
690 for (jj=0; jj<3; jj++) tracks[jj] = -1;
692 Int_t dummyCounter=-1;
694 AliTOFdigit *digitInteresting;
698 for (iPadX=0; iPadX<AliTOFGeometry::NpadX(); iPadX++) {
699 for (iPadZ=0; iPadZ<AliTOFGeometry::NpadZ(); iPadZ++) {
700 vol[4] = iPadZ , vol[3] = iPadX;
702 AliDebug(3, Form(" %1d %2d\n", iPadZ, iPadX));
704 if (fTOFdigitMap->GetNumberOfDigits(vol)==0) continue;
706 for(Int_t digIndex=0; digIndex<kMaxNumberOfDigitsPerVolume; digIndex++) {
707 if (fTOFdigitMap->GetDigitIndex(vol,digIndex)<0) continue;
708 digitInteresting = (AliTOFdigit*)fDigits->UncheckedAt(fTOFdigitMap->GetDigitIndex(vol,digIndex));
710 AliDebug(2, Form(" %3d %5d %2d %1d %2d %1d %2d %d %d %d %5d %5d %5d %5d",
711 fTOFdigitMap->GetNumberOfDigits(vol), digIndex,
712 vol[0], vol[1], vol[2] ,vol[4], vol[3],
713 digitInteresting->GetTdc(), digitInteresting->GetAdc(),
714 digitInteresting->GetToT(),
715 fTOFdigitMap->GetDigitIndex(vol,digIndex),
716 digitInteresting->GetTrack(0), digitInteresting->GetTrack(1), digitInteresting->GetTrack(2)));
718 det[3] = vol[4]; // padz
719 det[4] = vol[3]; // padx
720 fTOFGeometry->GetPosPar(det,pos);
721 AliDebug(1,Form(" %f %f %f", pos[0], pos[1], pos[2]));
724 for (jj=0; jj<3; jj++) posClus[jj] = pos[jj];
726 parTOF[0] = Int_t(digitInteresting->GetTdc());
727 parTOF[1] = Int_t(digitInteresting->GetToT());
728 parTOF[2] = Int_t(digitInteresting->GetAdc());
729 parTOF[3] = Int_t(digitInteresting->GetTdcND());
730 parTOF[4] = Int_t(digitInteresting->GetTdc());
732 volIdClus = fTOFGeometry->GetAliSensVolIndex(det[0],det[1],det[2]);
733 //volIdClus = GetClusterVolIndex(det);
735 for (jj=0; jj<6; jj++) covClus[jj] = 0.;
736 GetClusterPars(det, posClus, covClus);
738 // To fill the track index array
740 for (jj=0; jj<kMaxNumberOfTracksPerDigit; jj++) tracks[jj] = -1;
741 for (jj=0; jj<kMaxNumberOfTracksPerDigit; jj++) { // three is the max number of tracks associated to one digit
742 if (digitInteresting->GetTrack(jj)==-1) continue;
745 tracks[dummyCounter] = digitInteresting->GetTrack(jj);
749 AliTOFcluster *tofCluster =
750 new AliTOFcluster(volIdClus, posClus[0], posClus[1], posClus[2],
751 covClus[0], covClus[1], covClus[2], covClus[3], covClus[4], covClus[5],
752 tracks, det, parTOF, status, fTOFdigitMap->GetDigitIndex(vol,digIndex));
753 InsertCluster(tofCluster);
755 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",
756 volIdClus, posClus[0], posClus[1], posClus[2],
757 covClus[0], covClus[1], covClus[2], covClus[3], covClus[4], covClus[5],
758 tracks[0], tracks[1], tracks[2],
759 det[0], det[1], det[2], det[3], det[4],
760 parTOF[0], parTOF[1], parTOF[2], parTOF[3], parTOF[4],
761 status, fTOFdigitMap->GetDigitIndex(vol,digIndex)));
763 AliDebug(2, Form(" %f %f %f", pos[0], pos[1], pos[2]));
764 AliDebug(2, Form(" %d %d", parTOF[0], parTOF[2]));
766 fTOFdigitMap->ResetDigit(vol, digIndex);
774 //_____________________________________________________________________________
776 void AliTOFClusterFinderV1::FindClustersWithoutTOT(Int_t nSector,
781 // This function searches the isolated digits without TOT
782 // measurement (stored in the fDigits object), to perform clusters
783 // (stored in the fTofClusters array). This research has been made
784 // by checking the fTOFdigitMap object, filled at digits/raw-data
788 const Int_t kMaxNumberOfTracksPerDigit = 3;
789 const Int_t kMaxNumberOfDigitsPerVolume = 10;
793 Int_t det[5] = {nSector,nPlate,nStrip,-1,-1};//sector,plate,strip,padZ,padX
794 Int_t vol[5] = {nSector,nPlate,nStrip,-1,-1};//sector,plate,strip,padX,padZ
795 UShort_t volIdClus = 0;
798 for (jj=0; jj<3; jj++) pos[jj] = 0.;
800 for (jj=0; jj<3; jj++) posClus[jj] = 0.;
803 for (jj=0; jj<6; jj++) covClus[jj] = 0.;
806 for (jj=0; jj<5; jj++) parTOF[jj] = 0;
808 Bool_t status = kTRUE; //assume all sim channels ok in the beginning...
809 Int_t tracks[kMaxNumberOfTracksPerDigit];
810 for (jj=0; jj<3; jj++) tracks[jj] = -1;
812 Int_t dummyCounter=-1;
814 AliTOFdigit *digitInteresting;
818 for (iPadX=0; iPadX<AliTOFGeometry::NpadX(); iPadX++) {
819 for (iPadZ=0; iPadZ<AliTOFGeometry::NpadZ(); iPadZ++) {
820 vol[4] = iPadZ , vol[3] = iPadX;
822 AliDebug(3, Form(" %1d %2d\n", iPadZ, iPadX));
824 if (fTOFdigitMap->GetNumberOfDigits(vol)==0) continue;
826 for(Int_t digIndex=0; digIndex<kMaxNumberOfDigitsPerVolume; digIndex++) {
827 if (fTOFdigitMap->GetDigitIndex(vol,digIndex)<0) continue;
828 digitInteresting = (AliTOFdigit*)fDigits->UncheckedAt(fTOFdigitMap->GetDigitIndex(vol,digIndex));
829 if (digitInteresting->GetToT()>0) continue; // AdC
831 AliDebug(2, Form(" %3d %5d %2d %1d %2d %1d %2d %d %d %d %5d %5d %5d %5d",
832 fTOFdigitMap->GetNumberOfDigits(vol), digIndex,
833 vol[0], vol[1], vol[2] ,vol[4], vol[3],
834 digitInteresting->GetTdc(), digitInteresting->GetAdc(),
835 digitInteresting->GetToT(),
836 fTOFdigitMap->GetDigitIndex(vol,digIndex),
837 digitInteresting->GetTrack(0), digitInteresting->GetTrack(1), digitInteresting->GetTrack(2)));
839 det[3] = vol[4]; // padz
840 det[4] = vol[3]; // padx
841 fTOFGeometry->GetPosPar(det,pos);
842 AliDebug(1,Form(" %f %f %f", pos[0], pos[1], pos[2]));
845 for (jj=0; jj<3; jj++) posClus[jj] = pos[jj];
847 parTOF[0] = Int_t(digitInteresting->GetTdc());
848 parTOF[1] = Int_t(digitInteresting->GetToT());
849 parTOF[2] = Int_t(digitInteresting->GetAdc());
850 parTOF[3] = Int_t(digitInteresting->GetTdcND());
851 parTOF[4] = Int_t(digitInteresting->GetTdc());
853 volIdClus = fTOFGeometry->GetAliSensVolIndex(det[0],det[1],det[2]);
854 //volIdClus = GetClusterVolIndex(det);
856 for (jj=0; jj<6; jj++) covClus[jj] = 0.;
857 GetClusterPars(det, posClus, covClus);
859 // To fill the track index array
861 for (jj=0; jj<kMaxNumberOfTracksPerDigit; jj++) tracks[jj] = -1;
862 for (jj=0; jj<kMaxNumberOfTracksPerDigit; jj++) { // three is the max number of tracks associated to one digit
863 if (digitInteresting->GetTrack(jj)==-1) continue;
866 tracks[dummyCounter] = digitInteresting->GetTrack(jj);
870 AliTOFcluster *tofCluster =
871 new AliTOFcluster(volIdClus, posClus[0], posClus[1], posClus[2],
872 covClus[0], covClus[1], covClus[2], covClus[3], covClus[4], covClus[5],
873 tracks, det, parTOF, status, fTOFdigitMap->GetDigitIndex(vol,digIndex));
874 InsertCluster(tofCluster);
876 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",
877 volIdClus, posClus[0], posClus[1], posClus[2],
878 covClus[0], covClus[1], covClus[2], covClus[3], covClus[4], covClus[5],
879 tracks[0], tracks[1], tracks[2],
880 det[0], det[1], det[2], det[3], det[4],
881 parTOF[0], parTOF[1], parTOF[2], parTOF[3], parTOF[4],
882 status, fTOFdigitMap->GetDigitIndex(vol,digIndex)));
884 AliDebug(2, Form(" %f %f %f", pos[0], pos[1], pos[2]));
885 AliDebug(2, Form(" %d %d", parTOF[0], parTOF[2]));
887 fTOFdigitMap->ResetDigit(vol, digIndex);
895 //_____________________________________________________________________________
897 void AliTOFClusterFinderV1::FindClusters34(Int_t nSector,
902 // This function searches the neighbouring digits (stored in the fDigits object),
903 // to perform clusters (stored in the fTofClusters array).
905 // This research has been made by checking the fTOFdigitMap object,
906 // filled at digits/raw-data reading time.
909 const Int_t kMaxNumberOfInterestingPads = 4;
910 const Int_t kMaxNumberOfTracksPerDigit = 3;
911 const Int_t kMaxNumberOfDigitsPerVolume = 10;
915 Int_t digitsInVolumeIndices[kMaxNumberOfDigitsPerVolume];
916 for (ii=0; ii<kMaxNumberOfDigitsPerVolume; ii++)
917 digitsInVolumeIndices[ii] = -1;
919 Int_t vol[5] = {nSector,nPlate,nStrip,-1,-1};
921 Float_t pos[3] = {0.,0.,0.};
924 Int_t interestingPadX[kMaxNumberOfInterestingPads];
925 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingPadX[jj] = -1;
926 Int_t interestingPadZ[kMaxNumberOfInterestingPads];
927 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingPadZ[jj] = -1;
928 Double_t interestingTOT[kMaxNumberOfInterestingPads];
929 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingTOT[jj] = 0;
930 Double_t interestingADC[kMaxNumberOfInterestingPads];
931 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingADC[jj] = 0;
932 Double_t interestingTOF[kMaxNumberOfInterestingPads];
933 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingTOF[jj] = 0;
934 Double_t interestingWeight[kMaxNumberOfInterestingPads];
935 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingWeight[jj] = 0;
937 Float_t interestingX[kMaxNumberOfInterestingPads];
938 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingX[jj] = 0;
939 Float_t interestingY[kMaxNumberOfInterestingPads];
940 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingY[jj] = 0;
941 Float_t interestingZ[kMaxNumberOfInterestingPads];
942 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingZ[jj] = 0;
944 Float_t interDigit[kMaxNumberOfInterestingPads];
945 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interDigit[jj] = 0;
947 Int_t padsCluster[11];
948 padsCluster[0] = nSector;
949 padsCluster[1] = nPlate;
950 padsCluster[2] = nStrip;
951 for (jj=3; jj<11; jj++) padsCluster[jj] = -1;
953 Int_t interestingCounter=-1;
954 Int_t digitIndexLocal=-1; // AdC
960 for (jj=0; jj<5; jj++) parTOF[jj] = 0;
962 for (jj=0; jj<3; jj++) posClus[jj] = 0.;
964 for (jj=0; jj<5; jj++) det[jj] = -1;
966 for (jj=0; jj<3; jj++) posF[jj] = 0.;
967 UShort_t volIdClus = 0;
968 Bool_t check = kFALSE;
969 Bool_t status = kTRUE; //assume all sim channels ok in the beginning...
971 for (jj=0; jj<6; jj++) covClus[jj] = 0.;
972 Int_t tracks[kMaxNumberOfTracksPerDigit];
973 for (jj=0; jj<3; jj++) tracks[jj] = -1;
974 Int_t dummyCounter=-1;
975 Bool_t alreadyStored = kFALSE;
977 AliTOFselectedDigit ***selectedDigit = new AliTOFselectedDigit**[kMaxNumberOfInterestingPads];
978 for (ii=0; ii<kMaxNumberOfInterestingPads; ii++)
979 selectedDigit[ii] = new AliTOFselectedDigit*[kMaxNumberOfDigitsPerVolume];
981 for (ii=0; ii<kMaxNumberOfInterestingPads; ii++)
982 for (jj=0; jj<kMaxNumberOfDigitsPerVolume; jj++) selectedDigit[ii][jj] = 0x0;
984 AliTOFdigit *digitInteresting;
986 for (iPad=0; iPad<AliTOFGeometry::NpadZ()*AliTOFGeometry::NpadX()-3; iPad+=2) {
988 iPadZ = iPad%AliTOFGeometry::NpadZ(); //iPad%2;
989 iPadX = iPad/AliTOFGeometry::NpadZ(); //iPad/2;
991 AliDebug(3, Form("%2d %1d %2d\n", iPad, iPadZ, iPadX));
998 interestingCounter=-1;
1000 vol[4] = iPadZ , vol[3] = iPadX;
1001 if (fTOFdigitMap->GetNumberOfDigits(vol)>0)
1002 interestingCounter++;
1004 vol[4] = iPadZ, vol[3] = iPadX+1;
1005 if (fTOFdigitMap->GetNumberOfDigits(vol)>0)
1006 interestingCounter++;
1008 vol[4] = AliTOFGeometry::NpadZ()-(iPadZ+1), vol[3] = iPadX;
1009 if (fTOFdigitMap->GetNumberOfDigits(vol)>0)
1010 interestingCounter++;
1012 vol[4] = AliTOFGeometry::NpadZ()-(iPadZ+1), vol[3] = iPadX+1;
1013 if (fTOFdigitMap->GetNumberOfDigits(vol)>0)
1014 interestingCounter++;
1016 if (interestingCounter+1!=4) continue; // the hit pads have to be 4
1017 else interestingCounter=-1;
1020 for (ii=0; ii<kMaxNumberOfInterestingPads; ii++)
1021 for (jj=0; jj<kMaxNumberOfDigitsPerVolume; jj++)
1022 selectedDigit[ii][jj] = 0x0;
1025 vol[4] = iPadZ, vol[3] = iPadX;
1027 if (fTOFdigitMap->GetNumberOfDigits(vol)>0) {
1028 interestingCounter++;
1029 for (ii=0; ii<kMaxNumberOfDigitsPerVolume; ii++)
1030 digitsInVolumeIndices[ii] = -1;
1031 fTOFdigitMap->GetDigitIndex(vol, digitsInVolumeIndices);
1032 digitIndexLocal=-1; // AdC
1033 for(Int_t digIndex=0; digIndex<kMaxNumberOfDigitsPerVolume; digIndex++) {
1034 if (digitsInVolumeIndices[digIndex]<0) continue;
1035 digitInteresting = (AliTOFdigit*)fDigits->UncheckedAt(digitsInVolumeIndices[digIndex]);
1036 if (digitInteresting->GetToT()<=0) continue; // AdC
1037 digitIndexLocal++; // AdC
1039 AliDebug(1,Form(" %2d %1d %2d %1d %2d %f %f %f %f %5d %5d %5d %5d",
1040 vol[0], vol[1], vol[2] ,vol[4], vol[3],
1041 digitInteresting->GetTdc(), digitInteresting->GetAdc(),
1042 digitInteresting->GetToT(), digitInteresting->GetToT()*digitInteresting->GetToT(),
1043 digitsInVolumeIndices[digIndex],
1044 digitInteresting->GetTrack(0), digitInteresting->GetTrack(1), digitInteresting->GetTrack(2)));
1047 selectedDigit[interestingCounter][digitIndexLocal] = new // AdC
1048 AliTOFselectedDigit(vol, digitInteresting->GetTdc(),
1049 digitInteresting->GetAdc(), digitInteresting->GetToT(),
1050 digitInteresting->GetToT()*digitInteresting->GetToT(),
1051 digitsInVolumeIndices[digIndex],
1052 digitInteresting->GetTracks());
1054 if (digitIndexLocal==-1) interestingCounter--; // AdC
1058 vol[4] = iPadZ, vol[3] = iPadX+1;
1060 if (fTOFdigitMap->GetNumberOfDigits(vol)>0) {
1061 interestingCounter++;
1062 for (ii=0; ii<kMaxNumberOfDigitsPerVolume; ii++)
1063 digitsInVolumeIndices[ii] = -1;
1064 fTOFdigitMap->GetDigitIndex(vol, digitsInVolumeIndices);
1065 digitIndexLocal=-1; // AdC
1066 for(Int_t digIndex=0; digIndex<kMaxNumberOfDigitsPerVolume; digIndex++) {
1067 if (digitsInVolumeIndices[digIndex]<0) continue;
1068 digitInteresting = (AliTOFdigit*)fDigits->UncheckedAt(digitsInVolumeIndices[digIndex]);
1069 if (digitInteresting->GetToT()<=0) continue; // AdC
1070 digitIndexLocal++; // AdC
1072 AliDebug(1,Form(" %2d %1d %2d %1d %2d %f %f %f %f %5d %5d %5d %5d",
1073 vol[0], vol[1], vol[2] ,vol[4], vol[3],
1074 digitInteresting->GetTdc(), digitInteresting->GetAdc(),
1075 digitInteresting->GetToT(), digitInteresting->GetToT()*digitInteresting->GetToT(),
1076 digitsInVolumeIndices[digIndex],
1077 digitInteresting->GetTrack(0), digitInteresting->GetTrack(1), digitInteresting->GetTrack(2)));
1080 selectedDigit[interestingCounter][digitIndexLocal] = new // AdC
1081 AliTOFselectedDigit(vol, digitInteresting->GetTdc(),
1082 digitInteresting->GetAdc(), digitInteresting->GetToT(),
1083 digitInteresting->GetToT()*digitInteresting->GetToT(),
1084 digitsInVolumeIndices[digIndex],
1085 digitInteresting->GetTracks());
1087 if (digitIndexLocal==-1) interestingCounter--; // AdC
1091 vol[4] = AliTOFGeometry::NpadZ()-(iPadZ+1), vol[3] = iPadX;
1093 if (fTOFdigitMap->GetNumberOfDigits(vol)>0) {
1094 interestingCounter++;
1095 for (ii=0; ii<kMaxNumberOfDigitsPerVolume; ii++)
1096 digitsInVolumeIndices[ii] = -1;
1097 fTOFdigitMap->GetDigitIndex(vol, digitsInVolumeIndices);
1098 digitIndexLocal=-1; // AdC
1099 for(Int_t digIndex=0; digIndex<kMaxNumberOfDigitsPerVolume; digIndex++) {
1100 if (digitsInVolumeIndices[digIndex]<0) continue;
1101 digitInteresting = (AliTOFdigit*)fDigits->UncheckedAt(digitsInVolumeIndices[digIndex]);
1102 if (digitInteresting->GetToT()<=0) continue; // AdC
1103 digitIndexLocal++; // AdC
1105 AliDebug(1,Form(" %2d %1d %2d %1d %2d %f %f %f %f %5d %5d %5d %5d",
1106 vol[0], vol[1], vol[2] ,vol[4], vol[3],
1107 digitInteresting->GetTdc(), digitInteresting->GetAdc(),
1108 digitInteresting->GetToT(), digitInteresting->GetToT()*digitInteresting->GetToT(),
1109 digitsInVolumeIndices[digIndex],
1110 digitInteresting->GetTrack(0), digitInteresting->GetTrack(1), digitInteresting->GetTrack(2)));
1113 selectedDigit[interestingCounter][digitIndexLocal] = new // AdC
1114 AliTOFselectedDigit(vol, digitInteresting->GetTdc(),
1115 digitInteresting->GetAdc(), digitInteresting->GetToT(),
1116 digitInteresting->GetToT()*digitInteresting->GetToT(),
1117 digitsInVolumeIndices[digIndex],
1118 digitInteresting->GetTracks());
1120 if (digitIndexLocal==-1) interestingCounter--; // AdC
1124 vol[4] = AliTOFGeometry::NpadZ()-(iPadZ+1), vol[3] = iPadX+1;
1126 if (fTOFdigitMap->GetNumberOfDigits(vol)>0) {
1127 interestingCounter++;
1128 for (ii=0; ii<kMaxNumberOfDigitsPerVolume; ii++)
1129 digitsInVolumeIndices[ii] = -1;
1130 fTOFdigitMap->GetDigitIndex(vol, digitsInVolumeIndices);
1132 for(Int_t digIndex=0; digIndex<kMaxNumberOfDigitsPerVolume; digIndex++) {
1133 if (digitsInVolumeIndices[digIndex]<0) continue;
1134 digitInteresting = (AliTOFdigit*)fDigits->UncheckedAt(digitsInVolumeIndices[digIndex]);
1135 if (digitInteresting->GetToT()<=0) continue; // AdC
1136 digitIndexLocal++; // AdC
1138 AliDebug(1,Form(" %2d %1d %2d %1d %2d %f %f %f %f %5d %5d %5d %5d",
1139 vol[0], vol[1], vol[2] ,vol[4], vol[3],
1140 digitInteresting->GetTdc(), digitInteresting->GetAdc(),
1141 digitInteresting->GetToT(), digitInteresting->GetToT()*digitInteresting->GetToT(),
1142 digitsInVolumeIndices[digIndex],
1143 digitInteresting->GetTrack(0), digitInteresting->GetTrack(1), digitInteresting->GetTrack(2)));
1145 selectedDigit[interestingCounter][digitIndexLocal] = new // AdC
1146 AliTOFselectedDigit(vol, digitInteresting->GetTdc(),
1147 digitInteresting->GetAdc(), digitInteresting->GetToT(),
1148 digitInteresting->GetToT()*digitInteresting->GetToT(),
1149 digitsInVolumeIndices[digIndex],
1150 digitInteresting->GetTracks());
1152 if (digitIndexLocal==-1) interestingCounter--; // AdC
1155 AliDebug(1,Form(" e adesso %1d", interestingCounter+1));
1157 for (Int_t adesso1=0; adesso1<interestingCounter+1; adesso1++) {
1158 for (Int_t firstIndex=0; firstIndex<kMaxNumberOfDigitsPerVolume; firstIndex++) {
1159 if (selectedDigit[adesso1][firstIndex]==0x0) continue;
1161 for (Int_t adesso2=adesso1+1; adesso2<interestingCounter+1; adesso2++) {
1162 for (Int_t secondIndex=0; secondIndex<kMaxNumberOfDigitsPerVolume; secondIndex++) {
1163 if (selectedDigit[adesso2][secondIndex]==0x0) continue;
1165 for (Int_t adesso3=adesso2+1; adesso3<interestingCounter+1; adesso3++) {
1166 for (Int_t thirdIndex=0; thirdIndex<kMaxNumberOfDigitsPerVolume; thirdIndex++) {
1167 if (selectedDigit[adesso3][thirdIndex]==0x0) continue;
1170 if (TMath::Abs(selectedDigit[adesso1][firstIndex]->GetTDC()-selectedDigit[adesso2][secondIndex]->GetTDC())>fMaxDeltaTime
1172 TMath::Abs(selectedDigit[adesso1][firstIndex]->GetTDC()-selectedDigit[adesso3][thirdIndex]->GetTDC())>fMaxDeltaTime
1174 TMath::Abs(selectedDigit[adesso2][secondIndex]->GetTDC()-selectedDigit[adesso3][thirdIndex]->GetTDC())>fMaxDeltaTime) continue;
1176 interestingTOF[0] = selectedDigit[adesso1][firstIndex]->GetTDC();
1177 interestingTOT[0] = selectedDigit[adesso1][firstIndex]->GetTOT();
1178 interestingADC[0] = selectedDigit[adesso1][firstIndex]->GetADC();
1179 interestingWeight[0] = selectedDigit[adesso1][firstIndex]->GetWeight();
1180 Int_t vol1[5]; for(jj=0; jj<5; jj++) vol1[jj] = selectedDigit[adesso1][firstIndex]->GetDetectorIndex(jj);
1181 AliDebug(1,Form(" %2d %1d %2d %1d %2d", vol1[0], vol1[1], vol1[2], vol1[4], vol1[3]));
1182 Int_t volDum = vol1[3];
1185 fTOFGeometry->GetPosPar(vol1,pos);
1186 interestingX[0] = pos[0];
1187 interestingY[0] = pos[1];
1188 interestingZ[0] = pos[2];
1190 interestingTOF[1] = selectedDigit[adesso2][secondIndex]->GetTDC();
1191 interestingTOT[1] = selectedDigit[adesso2][secondIndex]->GetTOT();
1192 interestingADC[1] = selectedDigit[adesso2][secondIndex]->GetADC();
1193 interestingWeight[1] = selectedDigit[adesso2][secondIndex]->GetWeight();
1194 Int_t vol2[5]; for(jj=0; jj<5; jj++) vol2[jj] = selectedDigit[adesso2][secondIndex]->GetDetectorIndex(jj);
1195 AliDebug(1,Form(" %2d %1d %2d %1d %2d", vol2[0], vol2[1], vol2[2], vol2[4], vol2[3]));
1199 fTOFGeometry->GetPosPar(vol2,pos);
1200 interestingX[1] = pos[0];
1201 interestingY[1] = pos[1];
1202 interestingZ[1] = pos[2];
1204 interestingTOF[2] = selectedDigit[adesso3][thirdIndex]->GetTDC();
1205 interestingTOT[2] = selectedDigit[adesso3][thirdIndex]->GetTOT();
1206 interestingADC[2] = selectedDigit[adesso3][thirdIndex]->GetADC();
1207 interestingWeight[2] = selectedDigit[adesso3][thirdIndex]->GetWeight();
1208 Int_t vol3[5]; for(jj=0; jj<5; jj++) vol3[jj] = selectedDigit[adesso3][thirdIndex]->GetDetectorIndex(jj);
1209 AliDebug(1,Form(" %2d %1d %2d %1d %2d", vol3[0], vol3[1], vol3[2], vol3[4], vol3[3]));
1213 fTOFGeometry->GetPosPar(vol3,pos);
1214 interestingX[2] = pos[0];
1215 interestingY[2] = pos[1];
1216 interestingZ[2] = pos[2];
1219 AverageCalculations(3, interestingX, interestingY, interestingZ,
1220 interestingTOF, interestingTOT, interestingADC,
1222 parTOF, posClus, check);
1225 for (jj=0; jj<5; jj++) det[jj] = -1;
1226 for (jj=0; jj<3; jj++) posF[jj] = posClus[jj];
1227 fTOFGeometry->GetDetID(posF, det);
1229 volIdClus = fTOFGeometry->GetAliSensVolIndex(det[0],det[1],det[2]);
1230 //volIdClus = GetClusterVolIndex(det);
1232 for (jj=3; jj<11; jj++) padsCluster[jj] = -1;
1233 padsCluster[3] = selectedDigit[adesso1][firstIndex]->GetDetectorIndex(4);
1234 padsCluster[4] = selectedDigit[adesso1][firstIndex]->GetDetectorIndex(3);
1235 padsCluster[5] = selectedDigit[adesso2][secondIndex]->GetDetectorIndex(4);
1236 padsCluster[6] = selectedDigit[adesso2][secondIndex]->GetDetectorIndex(3);
1237 padsCluster[7] = selectedDigit[adesso3][thirdIndex]->GetDetectorIndex(4);
1238 padsCluster[8] = selectedDigit[adesso3][thirdIndex]->GetDetectorIndex(3);
1240 for (jj=0; jj<6; jj++) covClus[jj] = 0.;
1241 Int_t ** indDet = new Int_t*[3];
1242 for (jj=0; jj<3; jj++) indDet[jj] = new Int_t [5];
1243 for (jj=0; jj<3; jj++) indDet[jj][0] = nSector;
1244 for (jj=0; jj<3; jj++) indDet[jj][1] = nPlate;
1245 for (jj=0; jj<3; jj++) indDet[jj][2] = nStrip;
1246 for (jj=0; jj<3; jj++) indDet[jj][3] = padsCluster[2*jj+3];
1247 for (jj=0; jj<3; jj++) indDet[jj][4] = padsCluster[2*jj+1+3];
1248 GetClusterPars(/*check,*/ 3, indDet, interestingWeight, posClus, covClus);
1249 for (jj=0; jj<3; jj++) delete [] indDet[jj];
1251 // To fill the track index array
1253 for (jj=0; jj<kMaxNumberOfTracksPerDigit; jj++) tracks[jj] = -1;
1254 for (Int_t kk=0; kk<kMaxNumberOfTracksPerDigit; kk++) { // three is the max number of tracks associated to one digit
1255 if (selectedDigit[adesso1][firstIndex]->GetTrackLabel(kk)==-1) continue;
1258 tracks[dummyCounter] = selectedDigit[adesso1][firstIndex]->GetTrackLabel(kk);
1261 for (Int_t kk=0; kk<kMaxNumberOfTracksPerDigit; kk++) { // three is the max number of tracks associated to one digit
1262 if (selectedDigit[adesso2][secondIndex]->GetTrackLabel(kk)==-1) continue;
1265 alreadyStored = kFALSE;
1266 for (jj=0; jj<dummyCounter+1; jj++)
1267 alreadyStored = alreadyStored || (tracks[jj]!=-1 && tracks[jj]==selectedDigit[adesso2][secondIndex]->GetTrackLabel(kk));
1269 if (alreadyStored) continue;
1270 if (dummyCounter==2) { // three is the max number of tracks associated to one cluster
1271 AliWarning(" Siamo al limite!");
1276 tracks[dummyCounter] = selectedDigit[adesso2][secondIndex]->GetTrackLabel(kk);
1281 for (Int_t kk=0; kk<kMaxNumberOfTracksPerDigit; kk++) { // three is the max number of tracks associated to one digit
1282 if (selectedDigit[adesso3][thirdIndex]->GetTrackLabel(kk)==-1) continue;
1285 alreadyStored = kFALSE;
1286 for (jj=0; jj<dummyCounter+1; jj++)
1287 alreadyStored = alreadyStored || (tracks[jj]!=-1 && tracks[jj]==selectedDigit[adesso3][thirdIndex]->GetTrackLabel(kk));
1289 if (alreadyStored) continue;
1290 if (dummyCounter==2) { // three is the max number of tracks associated to one cluster
1291 AliWarning(" Siamo al limite!");
1296 tracks[dummyCounter] = selectedDigit[adesso3][thirdIndex]->GetTrackLabel(kk);
1303 AliTOFcluster *tofCluster =
1304 new AliTOFcluster(volIdClus, posClus[0], posClus[1], posClus[2],
1305 covClus[0], covClus[1], covClus[2], covClus[3], covClus[4], covClus[5],
1306 tracks, det, parTOF, status, selectedDigit[adesso1][firstIndex]->GetIndex()); // to be updated
1307 InsertCluster(tofCluster);
1309 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",
1310 volIdClus, posClus[0], posClus[1], posClus[2],
1311 covClus[0], covClus[1], covClus[2], covClus[3], covClus[4], covClus[5],
1312 tracks[0], tracks[1], tracks[2],
1313 det[0], det[1], det[2], det[3], det[4],
1314 parTOF[0], parTOF[1], parTOF[2], parTOF[3], parTOF[4],
1315 status, selectedDigit[adesso1][firstIndex]->GetIndex()));
1321 fTOFdigitMap->ResetDigitNumber(vol1,selectedDigit[adesso1][firstIndex]->GetIndex());
1325 fTOFdigitMap->ResetDigitNumber(vol2,selectedDigit[adesso2][secondIndex]->GetIndex());
1329 fTOFdigitMap->ResetDigitNumber(vol3,selectedDigit[adesso3][thirdIndex]->GetIndex());
1332 } // close loop on third digit
1333 } // close loop on adesso3
1335 } // close loop on second digit
1336 } // close loop on adesso2
1338 } // close loop on first digit
1339 } // close loop on adesso1
1341 for (ii=0; ii<kMaxNumberOfInterestingPads; ii++)
1342 for (jj=0; jj<kMaxNumberOfDigitsPerVolume; jj++)
1343 selectedDigit[ii][jj] = 0x0;
1347 for (ii=0; ii<kMaxNumberOfInterestingPads; ii++)
1348 for (jj=0; jj<kMaxNumberOfDigitsPerVolume; jj++) {
1349 delete selectedDigit[ii][jj];
1350 selectedDigit[ii][jj] = 0x0;
1355 //_____________________________________________________________________________
1357 void AliTOFClusterFinderV1::FindClusters23(Int_t nSector,
1362 // This function searches the neighbouring digits (stored in the fDigits object),
1363 // to perform clusters (stored in the fTofClusters array).
1365 // This research has been made by checking the fTOFdigitMap object,
1366 // filled at digits/raw-data reading time.
1369 const Int_t kMaxNumberOfInterestingPads = 4;
1370 const Int_t kMaxNumberOfTracksPerDigit = 3;
1371 const Int_t kMaxNumberOfDigitsPerVolume = 10;
1375 Int_t digitsInVolumeIndices[kMaxNumberOfDigitsPerVolume];
1376 for (ii=0; ii<kMaxNumberOfDigitsPerVolume; ii++)
1377 digitsInVolumeIndices[ii] = -1;
1379 Int_t vol[5] = {nSector,nPlate,nStrip,-1,-1};
1381 Float_t pos[3] = {0.,0.,0.};
1384 Int_t interestingPadX[kMaxNumberOfInterestingPads];
1385 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingPadX[jj] = -1;
1386 Int_t interestingPadZ[kMaxNumberOfInterestingPads];
1387 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingPadZ[jj] = -1;
1388 Double_t interestingTOT[kMaxNumberOfInterestingPads];
1389 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingTOT[jj] = 0;
1390 Double_t interestingADC[kMaxNumberOfInterestingPads];
1391 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingADC[jj] = 0;
1392 Double_t interestingTOF[kMaxNumberOfInterestingPads];
1393 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingTOF[jj] = 0;
1394 Double_t interestingWeight[kMaxNumberOfInterestingPads];
1395 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingWeight[jj] = 0;
1397 Float_t interestingX[kMaxNumberOfInterestingPads];
1398 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingX[jj] = 0;
1399 Float_t interestingY[kMaxNumberOfInterestingPads];
1400 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingY[jj] = 0;
1401 Float_t interestingZ[kMaxNumberOfInterestingPads];
1402 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingZ[jj] = 0;
1404 Float_t interDigit[kMaxNumberOfInterestingPads];
1405 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interDigit[jj] = 0;
1407 Int_t padsCluster[11];
1408 padsCluster[0] = nSector;
1409 padsCluster[1] = nPlate;
1410 padsCluster[2] = nStrip;
1411 for (jj=3; jj<11; jj++) padsCluster[jj] = -1;
1413 Int_t interestingCounter=-1;
1414 Int_t digitIndexLocal = -1;
1419 Bool_t check = kFALSE;
1421 for (jj=0; jj<5; jj++) parTOF[jj] = 0;
1422 Double_t posClus[3];
1423 for (jj=0; jj<3; jj++) posClus[jj] = 0.;
1425 for (jj=0; jj<5; jj++) det[jj] = -1;
1427 for (jj=0; jj<3; jj++) posF[jj] = 0.;
1428 UShort_t volIdClus = 0;
1429 Bool_t status = kTRUE; //assume all sim channels ok in the beginning...
1430 Double_t covClus[6];
1431 for (jj=0; jj<6; jj++) covClus[jj] = 0.;
1432 Int_t tracks[kMaxNumberOfTracksPerDigit];
1433 for (jj=0; jj<3; jj++) tracks[jj] = -1;
1434 Int_t dummyCounter=-1;
1435 Bool_t alreadyStored = kFALSE;
1437 AliTOFselectedDigit ***selectedDigit = new AliTOFselectedDigit**[kMaxNumberOfInterestingPads];
1438 for (ii=0; ii<kMaxNumberOfInterestingPads; ii++)
1439 selectedDigit[ii] = new AliTOFselectedDigit*[kMaxNumberOfDigitsPerVolume];
1441 for (ii=0; ii<kMaxNumberOfInterestingPads; ii++)
1442 for (jj=0; jj<kMaxNumberOfDigitsPerVolume; jj++) selectedDigit[ii][jj] = 0x0;
1444 AliTOFdigit *digitInteresting;
1446 for (iPad=0; iPad<AliTOFGeometry::NpadZ()*AliTOFGeometry::NpadX()-3; iPad+=2) {
1448 iPadZ = iPad%AliTOFGeometry::NpadZ(); //iPad%2;
1449 iPadX = iPad/AliTOFGeometry::NpadZ(); //iPad/2;
1451 AliDebug(3, Form("%2d %1d %2d\n", iPad, iPadZ, iPadX));
1458 interestingCounter=-1;
1460 vol[4] = iPadZ , vol[3] = iPadX;
1461 if (fTOFdigitMap->GetNumberOfDigits(vol)>0)
1462 interestingCounter++;
1464 vol[4] = iPadZ, vol[3] = iPadX+1;
1465 if (fTOFdigitMap->GetNumberOfDigits(vol)>0)
1466 interestingCounter++;
1468 vol[4] = AliTOFGeometry::NpadZ()-(iPadZ+1), vol[3] = iPadX;
1469 if (fTOFdigitMap->GetNumberOfDigits(vol)>0)
1470 interestingCounter++;
1472 vol[4] = AliTOFGeometry::NpadZ()-(iPadZ+1), vol[3] = iPadX+1;
1473 if (fTOFdigitMap->GetNumberOfDigits(vol)>0)
1474 interestingCounter++;
1476 if (interestingCounter+1!=3) continue; // the hit pads have to be 3
1477 else interestingCounter=-1;
1480 for (ii=0; ii<kMaxNumberOfInterestingPads; ii++)
1481 for (jj=0; jj<kMaxNumberOfDigitsPerVolume; jj++)
1482 selectedDigit[ii][jj] = 0x0;
1485 vol[4] = iPadZ, vol[3] = iPadX;
1487 if (fTOFdigitMap->GetNumberOfDigits(vol)>0) {
1488 interestingCounter++;
1489 for (ii=0; ii<kMaxNumberOfDigitsPerVolume; ii++)
1490 digitsInVolumeIndices[ii] = -1;
1491 fTOFdigitMap->GetDigitIndex(vol, digitsInVolumeIndices);
1493 for(Int_t digIndex=0; digIndex<kMaxNumberOfDigitsPerVolume; digIndex++) {
1494 if (digitsInVolumeIndices[digIndex]<0) continue;
1495 digitInteresting = (AliTOFdigit*)fDigits->UncheckedAt(digitsInVolumeIndices[digIndex]);
1496 if (digitInteresting->GetToT()<=0) continue; // AdC
1497 digitIndexLocal++; // AdC
1499 AliDebug(1,Form(" %2d %1d %2d %1d %2d %f %f %f %f %5d %5d %5d %5d",
1500 vol[0], vol[1], vol[2] ,vol[4], vol[3],
1501 digitInteresting->GetTdc(), digitInteresting->GetAdc(),
1502 digitInteresting->GetToT(), digitInteresting->GetToT()*digitInteresting->GetToT(),
1503 digitsInVolumeIndices[digIndex],
1504 digitInteresting->GetTrack(0), digitInteresting->GetTrack(1), digitInteresting->GetTrack(2)));
1506 selectedDigit[interestingCounter][digitIndexLocal] = new // AdC
1507 AliTOFselectedDigit(vol, digitInteresting->GetTdc(),
1508 digitInteresting->GetAdc(), digitInteresting->GetToT(),
1509 digitInteresting->GetToT()*digitInteresting->GetToT(),
1510 digitsInVolumeIndices[digIndex],
1511 digitInteresting->GetTracks());
1513 if (digitIndexLocal==-1) interestingCounter--; // AdC
1517 vol[4] = iPadZ, vol[3] = iPadX+1;
1519 if (fTOFdigitMap->GetNumberOfDigits(vol)>0) {
1520 interestingCounter++;
1521 for (ii=0; ii<kMaxNumberOfDigitsPerVolume; ii++)
1522 digitsInVolumeIndices[ii] = -1;
1523 fTOFdigitMap->GetDigitIndex(vol, digitsInVolumeIndices);
1524 digitIndexLocal=-1; // AdC
1525 for(Int_t digIndex=0; digIndex<kMaxNumberOfDigitsPerVolume; digIndex++) {
1526 if (digitsInVolumeIndices[digIndex]<0) continue;
1527 digitInteresting = (AliTOFdigit*)fDigits->UncheckedAt(digitsInVolumeIndices[digIndex]);
1528 if (digitInteresting->GetToT()<=0) continue; // AdC
1529 digitIndexLocal++; // AdC
1531 AliDebug(1,Form(" %2d %1d %2d %1d %2d %f %f %f %f %5d %5d %5d %5d",
1532 vol[0], vol[1], vol[2] ,vol[4], vol[3],
1533 digitInteresting->GetTdc(), digitInteresting->GetAdc(),
1534 digitInteresting->GetToT(), digitInteresting->GetToT()*digitInteresting->GetToT(),
1535 digitsInVolumeIndices[digIndex],
1536 digitInteresting->GetTrack(0), digitInteresting->GetTrack(1), digitInteresting->GetTrack(2)));
1538 selectedDigit[interestingCounter][digitIndexLocal] = new // AdC
1539 AliTOFselectedDigit(vol, digitInteresting->GetTdc(),
1540 digitInteresting->GetAdc(), digitInteresting->GetToT(),
1541 digitInteresting->GetToT()*digitInteresting->GetToT(),
1542 digitsInVolumeIndices[digIndex],
1543 digitInteresting->GetTracks());
1545 if (digitIndexLocal==-1) interestingCounter--; // AdC
1549 vol[4] = AliTOFGeometry::NpadZ()-(iPadZ+1), vol[3] = iPadX;
1551 if (fTOFdigitMap->GetNumberOfDigits(vol)>0) {
1552 interestingCounter++;
1553 for (ii=0; ii<kMaxNumberOfDigitsPerVolume; ii++)
1554 digitsInVolumeIndices[ii] = -1;
1555 fTOFdigitMap->GetDigitIndex(vol, digitsInVolumeIndices);
1556 digitIndexLocal=-1; // AdC
1557 for(Int_t digIndex=0; digIndex<kMaxNumberOfDigitsPerVolume; digIndex++) {
1558 if (digitsInVolumeIndices[digIndex]<0) continue;
1559 digitInteresting = (AliTOFdigit*)fDigits->UncheckedAt(digitsInVolumeIndices[digIndex]);
1560 if (digitInteresting->GetToT()<=0) continue; // AdC
1561 digitIndexLocal++; // AdC
1563 AliDebug(1,Form(" %2d %1d %2d %1d %2d %f %f %f %f %5d %5d %5d %5d",
1564 vol[0], vol[1], vol[2] ,vol[4], vol[3],
1565 digitInteresting->GetTdc(), digitInteresting->GetAdc(),
1566 digitInteresting->GetToT(), digitInteresting->GetToT()*digitInteresting->GetToT(),
1567 digitsInVolumeIndices[digIndex],
1568 digitInteresting->GetTrack(0), digitInteresting->GetTrack(1), digitInteresting->GetTrack(2)));
1570 selectedDigit[interestingCounter][digitIndexLocal] = new // AdC
1571 AliTOFselectedDigit(vol, digitInteresting->GetTdc(),
1572 digitInteresting->GetAdc(), digitInteresting->GetToT(),
1573 digitInteresting->GetToT()*digitInteresting->GetToT(),
1574 digitsInVolumeIndices[digIndex],
1575 digitInteresting->GetTracks());
1577 if (digitIndexLocal==-1) interestingCounter--; // AdC
1581 vol[4] = AliTOFGeometry::NpadZ()-(iPadZ+1), vol[3] = iPadX+1;
1583 if (fTOFdigitMap->GetNumberOfDigits(vol)>0) {
1584 interestingCounter++;
1585 for (ii=0; ii<kMaxNumberOfDigitsPerVolume; ii++)
1586 digitsInVolumeIndices[ii] = -1;
1587 fTOFdigitMap->GetDigitIndex(vol, digitsInVolumeIndices);
1588 digitIndexLocal=-1; // AdC
1589 for(Int_t digIndex=0; digIndex<kMaxNumberOfDigitsPerVolume; digIndex++) {
1590 if (digitsInVolumeIndices[digIndex]<0) continue;
1591 digitInteresting = (AliTOFdigit*)fDigits->UncheckedAt(digitsInVolumeIndices[digIndex]);
1592 if (digitInteresting->GetToT()<=0) continue; // AdC
1593 digitIndexLocal++; // AdC
1595 AliDebug(1,Form(" %2d %1d %2d %1d %2d %f %f %f %f %5d %5d %5d %5d",
1596 vol[0], vol[1], vol[2] ,vol[4], vol[3],
1597 digitInteresting->GetTdc(), digitInteresting->GetAdc(),
1598 digitInteresting->GetToT(), digitInteresting->GetToT()*digitInteresting->GetToT(),
1599 digitsInVolumeIndices[digIndex],
1600 digitInteresting->GetTrack(0), digitInteresting->GetTrack(1), digitInteresting->GetTrack(2)));
1602 selectedDigit[interestingCounter][digitIndexLocal] = new // AdC
1603 AliTOFselectedDigit(vol, digitInteresting->GetTdc(),
1604 digitInteresting->GetAdc(), digitInteresting->GetToT(),
1605 digitInteresting->GetToT()*digitInteresting->GetToT(),
1606 digitsInVolumeIndices[digIndex],
1607 digitInteresting->GetTracks());
1609 if (digitIndexLocal==-1) interestingCounter--; // AdC
1612 AliDebug(1,Form(" e adesso %1d", interestingCounter+1));
1614 for (Int_t adesso1=0; adesso1<interestingCounter+1; adesso1++) {
1615 for (Int_t firstIndex=0; firstIndex<kMaxNumberOfDigitsPerVolume; firstIndex++) {
1616 if (selectedDigit[adesso1][firstIndex]==0x0) continue;
1618 for (Int_t adesso2=adesso1+1; adesso2<interestingCounter+1; adesso2++) {
1619 for (Int_t secondIndex=0; secondIndex<kMaxNumberOfDigitsPerVolume; secondIndex++) {
1620 if (selectedDigit[adesso2][secondIndex]==0x0) continue;
1622 if (TMath::Abs(selectedDigit[adesso1][firstIndex]->GetTDC()-selectedDigit[adesso2][secondIndex]->GetTDC())>fMaxDeltaTime) continue;
1624 interestingTOF[0] = selectedDigit[adesso1][firstIndex]->GetTDC();
1625 interestingTOT[0] = selectedDigit[adesso1][firstIndex]->GetTOT();
1626 interestingADC[0] = selectedDigit[adesso1][firstIndex]->GetADC();
1627 interestingWeight[0] = selectedDigit[adesso1][firstIndex]->GetWeight();
1628 Int_t vol1[5]; for(jj=0; jj<5; jj++) vol1[jj] = selectedDigit[adesso1][firstIndex]->GetDetectorIndex(jj);
1629 AliDebug(1,Form(" %2d %1d %2d %1d %2d", vol1[0], vol1[1], vol1[2], vol1[4], vol1[3]));
1630 Int_t volDum = vol1[3];
1633 fTOFGeometry->GetPosPar(vol1,pos);
1634 interestingX[0] = pos[0];
1635 interestingY[0] = pos[1];
1636 interestingZ[0] = pos[2];
1638 interestingTOF[1] = selectedDigit[adesso2][secondIndex]->GetTDC();
1639 interestingTOT[1] = selectedDigit[adesso2][secondIndex]->GetTOT();
1640 interestingADC[1] = selectedDigit[adesso2][secondIndex]->GetADC();
1641 interestingWeight[1] = selectedDigit[adesso2][secondIndex]->GetWeight();
1642 Int_t vol2[5]; for(jj=0; jj<5; jj++) vol2[jj] = selectedDigit[adesso2][secondIndex]->GetDetectorIndex(jj);
1643 AliDebug(1,Form(" %2d %1d %2d %1d %2d", vol2[0], vol2[1], vol2[2], vol2[4], vol2[3]));
1647 fTOFGeometry->GetPosPar(vol2,pos);
1648 interestingX[1] = pos[0];
1649 interestingY[1] = pos[1];
1650 interestingZ[1] = pos[2];
1652 AverageCalculations(2, interestingX, interestingY, interestingZ,
1653 interestingTOF, interestingTOT, interestingADC,
1655 parTOF, posClus, check);
1657 for (jj=0; jj<5; jj++) det[jj] = -1;
1658 for (jj=0; jj<3; jj++) posF[jj] = posClus[jj];
1659 fTOFGeometry->GetDetID(posF, det);
1661 volIdClus = fTOFGeometry->GetAliSensVolIndex(det[0],det[1],det[2]);
1662 //volIdClus = GetClusterVolIndex(det);
1664 for (jj=3; jj<11; jj++) padsCluster[jj] = -1;
1665 padsCluster[3] = selectedDigit[adesso1][firstIndex]->GetDetectorIndex(4);
1666 padsCluster[4] = selectedDigit[adesso1][firstIndex]->GetDetectorIndex(3);
1667 padsCluster[5] = selectedDigit[adesso2][secondIndex]->GetDetectorIndex(4);
1668 padsCluster[6] = selectedDigit[adesso2][secondIndex]->GetDetectorIndex(3);
1670 for (jj=0; jj<6; jj++) covClus[jj] = 0.;
1671 Int_t ** indDet = new Int_t*[2];
1672 for (jj=0; jj<2; jj++) indDet[jj] = new Int_t [5];
1673 for (jj=0; jj<2; jj++) indDet[jj][0] = nSector;
1674 for (jj=0; jj<2; jj++) indDet[jj][1] = nPlate;
1675 for (jj=0; jj<2; jj++) indDet[jj][2] = nStrip;
1676 for (jj=0; jj<2; jj++) indDet[jj][3] = padsCluster[2*jj+3];
1677 for (jj=0; jj<2; jj++) indDet[jj][4] = padsCluster[2*jj+1+3];
1678 GetClusterPars(/*check,*/ 2, indDet, interestingWeight, posClus, covClus);
1679 for (jj=0; jj<2; jj++) delete [] indDet[jj];
1681 // To fill the track index array
1683 for (jj=0; jj<kMaxNumberOfTracksPerDigit; jj++) tracks[jj] = -1;
1684 for (Int_t kk=0; kk<kMaxNumberOfTracksPerDigit; kk++) { // three is the max number of tracks associated to one digit
1685 if (selectedDigit[adesso1][firstIndex]->GetTrackLabel(kk)==-1) continue;
1688 tracks[dummyCounter] = selectedDigit[adesso1][firstIndex]->GetTrackLabel(kk);
1691 for (Int_t kk=0; kk<kMaxNumberOfTracksPerDigit; kk++) { // three is the max number of tracks associated to one digit
1692 if (selectedDigit[adesso2][secondIndex]->GetTrackLabel(kk)==-1) continue;
1695 alreadyStored = kFALSE;
1696 for (jj=0; jj<dummyCounter+1; jj++)
1697 alreadyStored = alreadyStored || (tracks[jj]!=-1 && tracks[jj]==selectedDigit[adesso2][secondIndex]->GetTrackLabel(kk));
1699 if (alreadyStored) continue;
1700 if (dummyCounter==2) { // three is the max number of tracks associated to one cluster
1701 AliWarning(" Siamo al limite!");
1706 tracks[dummyCounter] = selectedDigit[adesso2][secondIndex]->GetTrackLabel(kk);
1713 AliTOFcluster *tofCluster =
1714 new AliTOFcluster(volIdClus, posClus[0], posClus[1], posClus[2],
1715 covClus[0], covClus[1], covClus[2], covClus[3], covClus[4], covClus[5],
1716 tracks, det, parTOF, status, selectedDigit[adesso1][firstIndex]->GetIndex()); // to be updated
1717 InsertCluster(tofCluster);
1719 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",
1720 volIdClus, posClus[0], posClus[1], posClus[2],
1721 covClus[0], covClus[1], covClus[2], covClus[3], covClus[4], covClus[5],
1722 tracks[0], tracks[1], tracks[2],
1723 det[0], det[1], det[2], det[3], det[4],
1724 parTOF[0], parTOF[1], parTOF[2], parTOF[3], parTOF[4],
1725 status, selectedDigit[adesso1][firstIndex]->GetIndex()));
1730 fTOFdigitMap->ResetDigitNumber(vol1,selectedDigit[adesso1][firstIndex]->GetIndex());
1734 fTOFdigitMap->ResetDigitNumber(vol2,selectedDigit[adesso2][secondIndex]->GetIndex());
1737 } // close loop on second digit
1738 } // close loop on adesso2
1740 } // close loop on first digit
1741 } // close loop on adesso1
1743 for (ii=0; ii<kMaxNumberOfInterestingPads; ii++)
1744 for (jj=0; jj<kMaxNumberOfDigitsPerVolume; jj++)
1745 selectedDigit[ii][jj] = 0x0;
1749 for (ii=0; ii<kMaxNumberOfInterestingPads; ii++)
1750 for (jj=0; jj<kMaxNumberOfDigitsPerVolume; jj++) {
1751 delete selectedDigit[ii][jj];
1752 selectedDigit[ii][jj] = 0x0;
1757 //_____________________________________________________________________________
1759 void AliTOFClusterFinderV1::FindClusters24(Int_t nSector,
1764 // This function searches the neighbouring digits (stored in the fDigits object),
1765 // to perform clusters (stored in the fTofClusters array).
1767 // This research has been made by checking the fTOFdigitMap object,
1768 // filled at digits/raw-data reading time.
1771 const Int_t kMaxNumberOfInterestingPads = 4;
1772 const Int_t kMaxNumberOfTracksPerDigit = 3;
1773 const Int_t kMaxNumberOfDigitsPerVolume = 10;
1777 Int_t digitsInVolumeIndices[kMaxNumberOfDigitsPerVolume];
1778 for (ii=0; ii<kMaxNumberOfDigitsPerVolume; ii++)
1779 digitsInVolumeIndices[ii] = -1;
1781 Int_t vol[5] = {nSector,nPlate,nStrip,-1,-1};
1783 Float_t pos[3] = {0.,0.,0.};
1786 Int_t interestingPadX[kMaxNumberOfInterestingPads];
1787 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingPadX[jj] = -1;
1788 Int_t interestingPadZ[kMaxNumberOfInterestingPads];
1789 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingPadZ[jj] = -1;
1790 Double_t interestingTOT[kMaxNumberOfInterestingPads];
1791 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingTOT[jj] = 0;
1792 Double_t interestingADC[kMaxNumberOfInterestingPads];
1793 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingADC[jj] = 0;
1794 Double_t interestingTOF[kMaxNumberOfInterestingPads];
1795 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingTOF[jj] = 0;
1796 Double_t interestingWeight[kMaxNumberOfInterestingPads];
1797 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingWeight[jj] = 0;
1799 Float_t interestingX[kMaxNumberOfInterestingPads];
1800 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingX[jj] = 0;
1801 Float_t interestingY[kMaxNumberOfInterestingPads];
1802 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingY[jj] = 0;
1803 Float_t interestingZ[kMaxNumberOfInterestingPads];
1804 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingZ[jj] = 0;
1806 Float_t interDigit[kMaxNumberOfInterestingPads];
1807 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interDigit[jj] = 0;
1809 Int_t padsCluster[11];
1810 padsCluster[0] = nSector;
1811 padsCluster[1] = nPlate;
1812 padsCluster[2] = nStrip;
1813 for (jj=3; jj<11; jj++) padsCluster[jj] = -1;
1815 Int_t interestingCounter=-1;
1816 Int_t digitIndexLocal = -1;
1821 Bool_t check = kFALSE;
1823 for (jj=0; jj<5; jj++) parTOF[jj] = 0;
1824 Double_t posClus[3];
1825 for (jj=0; jj<3; jj++) posClus[jj] = 0.;
1827 for (jj=0; jj<5; jj++) det[jj] = -1;
1829 for (jj=0; jj<3; jj++) posF[jj] = 0.;
1830 UShort_t volIdClus = 0;
1831 Bool_t status = kTRUE; //assume all sim channels ok in the beginning...
1832 Double_t covClus[6];
1833 for (jj=0; jj<6; jj++) covClus[jj] = 0.;
1834 Int_t tracks[kMaxNumberOfTracksPerDigit];
1835 for (jj=0; jj<3; jj++) tracks[jj] = -1;
1836 Int_t dummyCounter=-1;
1837 Bool_t alreadyStored = kFALSE;
1839 AliTOFselectedDigit ***selectedDigit = new AliTOFselectedDigit**[kMaxNumberOfInterestingPads];
1840 for (ii=0; ii<kMaxNumberOfInterestingPads; ii++)
1841 selectedDigit[ii] = new AliTOFselectedDigit*[kMaxNumberOfDigitsPerVolume];
1843 for (ii=0; ii<kMaxNumberOfInterestingPads; ii++)
1844 for (jj=0; jj<kMaxNumberOfDigitsPerVolume; jj++) selectedDigit[ii][jj] = 0x0;
1846 AliTOFdigit *digitInteresting;
1848 for (iPad=0; iPad<AliTOFGeometry::NpadZ()*AliTOFGeometry::NpadX()-3; iPad+=2) {
1850 iPadZ = iPad%AliTOFGeometry::NpadZ(); //iPad%2;
1851 iPadX = iPad/AliTOFGeometry::NpadZ(); //iPad/2;
1853 AliDebug(3, Form("%2d %1d %2d\n", iPad, iPadZ, iPadX));
1860 interestingCounter=-1;
1862 vol[4] = iPadZ , vol[3] = iPadX;
1863 if (fTOFdigitMap->GetNumberOfDigits(vol)>0)
1864 interestingCounter++;
1866 vol[4] = iPadZ, vol[3] = iPadX+1;
1867 if (fTOFdigitMap->GetNumberOfDigits(vol)>0)
1868 interestingCounter++;
1870 vol[4] = AliTOFGeometry::NpadZ()-(iPadZ+1), vol[3] = iPadX;
1871 if (fTOFdigitMap->GetNumberOfDigits(vol)>0)
1872 interestingCounter++;
1874 vol[4] = AliTOFGeometry::NpadZ()-(iPadZ+1), vol[3] = iPadX+1;
1875 if (fTOFdigitMap->GetNumberOfDigits(vol)>0)
1876 interestingCounter++;
1878 if (interestingCounter+1!=4) continue; // the hit pads have to be 4
1879 else interestingCounter=-1;
1882 for (ii=0; ii<kMaxNumberOfInterestingPads; ii++)
1883 for (jj=0; jj<kMaxNumberOfDigitsPerVolume; jj++)
1884 selectedDigit[ii][jj] = 0x0;
1887 vol[4] = iPadZ, vol[3] = iPadX;
1889 if (fTOFdigitMap->GetNumberOfDigits(vol)>0) {
1890 interestingCounter++;
1891 for (ii=0; ii<kMaxNumberOfDigitsPerVolume; ii++)
1892 digitsInVolumeIndices[ii] = -1;
1893 fTOFdigitMap->GetDigitIndex(vol, digitsInVolumeIndices);
1894 digitIndexLocal=-1; // AdC
1895 for(Int_t digIndex=0; digIndex<kMaxNumberOfDigitsPerVolume; digIndex++) {
1896 if (digitsInVolumeIndices[digIndex]<0) continue;
1897 digitInteresting = (AliTOFdigit*)fDigits->UncheckedAt(digitsInVolumeIndices[digIndex]);
1898 if (digitInteresting->GetToT()<=0) continue; // AdC
1899 digitIndexLocal++; // AdC
1901 AliDebug(1,Form(" %2d %1d %2d %1d %2d %f %f %f %f %5d %5d %5d %5d",
1902 vol[0], vol[1], vol[2] ,vol[4], vol[3],
1903 digitInteresting->GetTdc(), digitInteresting->GetAdc(),
1904 digitInteresting->GetToT(), digitInteresting->GetToT()*digitInteresting->GetToT(),
1905 digitsInVolumeIndices[digIndex],
1906 digitInteresting->GetTrack(0), digitInteresting->GetTrack(1), digitInteresting->GetTrack(2)));
1908 selectedDigit[interestingCounter][digitIndexLocal] = new // AdC
1909 AliTOFselectedDigit(vol, digitInteresting->GetTdc(),
1910 digitInteresting->GetAdc(), digitInteresting->GetToT(),
1911 digitInteresting->GetToT()*digitInteresting->GetToT(),
1912 digitsInVolumeIndices[digIndex],
1913 digitInteresting->GetTracks());
1915 if (digitIndexLocal==-1) interestingCounter--; // AdC
1919 vol[4] = iPadZ, vol[3] = iPadX+1;
1921 if (fTOFdigitMap->GetNumberOfDigits(vol)>0) {
1922 interestingCounter++;
1923 for (ii=0; ii<kMaxNumberOfDigitsPerVolume; ii++)
1924 digitsInVolumeIndices[ii] = -1;
1925 fTOFdigitMap->GetDigitIndex(vol, digitsInVolumeIndices);
1926 digitIndexLocal=-1; // AdC
1927 for(Int_t digIndex=0; digIndex<kMaxNumberOfDigitsPerVolume; digIndex++) {
1928 if (digitsInVolumeIndices[digIndex]<0) continue;
1929 digitInteresting = (AliTOFdigit*)fDigits->UncheckedAt(digitsInVolumeIndices[digIndex]);
1930 if (digitInteresting->GetToT()<=0) continue; // AdC
1931 digitIndexLocal++; // AdC
1933 AliDebug(1,Form(" %2d %1d %2d %1d %2d %f %f %f %f %5d %5d %5d %5d",
1934 vol[0], vol[1], vol[2] ,vol[4], vol[3],
1935 digitInteresting->GetTdc(), digitInteresting->GetAdc(),
1936 digitInteresting->GetToT(), digitInteresting->GetToT()*digitInteresting->GetToT(),
1937 digitsInVolumeIndices[digIndex],
1938 digitInteresting->GetTrack(0), digitInteresting->GetTrack(1), digitInteresting->GetTrack(2)));
1940 selectedDigit[interestingCounter][digitIndexLocal] = new // AdC
1941 AliTOFselectedDigit(vol, digitInteresting->GetTdc(),
1942 digitInteresting->GetAdc(), digitInteresting->GetToT(),
1943 digitInteresting->GetToT()*digitInteresting->GetToT(),
1944 digitsInVolumeIndices[digIndex],
1945 digitInteresting->GetTracks());
1947 if (digitIndexLocal==-1) interestingCounter--; // AdC
1951 vol[4] = AliTOFGeometry::NpadZ()-(iPadZ+1), vol[3] = iPadX;
1953 if (fTOFdigitMap->GetNumberOfDigits(vol)>0) {
1954 interestingCounter++;
1955 for (ii=0; ii<kMaxNumberOfDigitsPerVolume; ii++)
1956 digitsInVolumeIndices[ii] = -1;
1957 fTOFdigitMap->GetDigitIndex(vol, digitsInVolumeIndices);
1958 digitIndexLocal=-1; // AdC
1959 for(Int_t digIndex=0; digIndex<kMaxNumberOfDigitsPerVolume; digIndex++) {
1960 if (digitsInVolumeIndices[digIndex]<0) continue;
1961 digitInteresting = (AliTOFdigit*)fDigits->UncheckedAt(digitsInVolumeIndices[digIndex]);
1962 if (digitInteresting->GetToT()<=0) continue; // AdC
1963 digitIndexLocal++; // AdC
1965 AliDebug(1,Form(" %2d %1d %2d %1d %2d %f %f %f %f %5d %5d %5d %5d",
1966 vol[0], vol[1], vol[2] ,vol[4], vol[3],
1967 digitInteresting->GetTdc(), digitInteresting->GetAdc(),
1968 digitInteresting->GetToT(), digitInteresting->GetToT()*digitInteresting->GetToT(),
1969 digitsInVolumeIndices[digIndex],
1970 digitInteresting->GetTrack(0), digitInteresting->GetTrack(1), digitInteresting->GetTrack(2)));
1972 selectedDigit[interestingCounter][digitIndexLocal] = new // AdC
1973 AliTOFselectedDigit(vol, digitInteresting->GetTdc(),
1974 digitInteresting->GetAdc(), digitInteresting->GetToT(),
1975 digitInteresting->GetToT()*digitInteresting->GetToT(),
1976 digitsInVolumeIndices[digIndex],
1977 digitInteresting->GetTracks());
1979 if (digitIndexLocal==-1) interestingCounter--; // AdC
1983 vol[4] = AliTOFGeometry::NpadZ()-(iPadZ+1), vol[3] = iPadX+1;
1985 if (fTOFdigitMap->GetNumberOfDigits(vol)>0) {
1986 interestingCounter++;
1987 for (ii=0; ii<kMaxNumberOfDigitsPerVolume; ii++)
1988 digitsInVolumeIndices[ii] = -1;
1989 fTOFdigitMap->GetDigitIndex(vol, digitsInVolumeIndices);
1990 digitIndexLocal=-1; // AdC
1991 for(Int_t digIndex=0; digIndex<kMaxNumberOfDigitsPerVolume; digIndex++) {
1992 if (digitsInVolumeIndices[digIndex]<0) continue;
1993 digitInteresting = (AliTOFdigit*)fDigits->UncheckedAt(digitsInVolumeIndices[digIndex]);
1994 if (digitInteresting->GetToT()<=0) continue; // AdC
1995 digitIndexLocal++; // AdC
1997 AliDebug(1,Form(" %2d %1d %2d %1d %2d %f %f %f %f %5d %5d %5d %5d",
1998 vol[0], vol[1], vol[2] ,vol[4], vol[3],
1999 digitInteresting->GetTdc(), digitInteresting->GetAdc(),
2000 digitInteresting->GetToT(), digitInteresting->GetToT()*digitInteresting->GetToT(),
2001 digitsInVolumeIndices[digIndex],
2002 digitInteresting->GetTrack(0), digitInteresting->GetTrack(1), digitInteresting->GetTrack(2)));
2004 selectedDigit[interestingCounter][digitIndexLocal] = new // AdC
2005 AliTOFselectedDigit(vol, digitInteresting->GetTdc(),
2006 digitInteresting->GetAdc(), digitInteresting->GetToT(),
2007 digitInteresting->GetToT()*digitInteresting->GetToT(),
2008 digitsInVolumeIndices[digIndex],
2009 digitInteresting->GetTracks());
2011 if (digitIndexLocal==-1) interestingCounter--; // AdC
2014 AliDebug(1,Form(" e adesso %1d", interestingCounter+1));
2016 for (Int_t adesso1=0; adesso1<interestingCounter+1; adesso1++) {
2017 for (Int_t firstIndex=0; firstIndex<kMaxNumberOfDigitsPerVolume; firstIndex++) {
2018 if (selectedDigit[adesso1][firstIndex]==0x0) continue;
2020 for (Int_t adesso2=adesso1+1; adesso2<interestingCounter+1; adesso2++) {
2021 for (Int_t secondIndex=0; secondIndex<kMaxNumberOfDigitsPerVolume; secondIndex++) {
2022 if (selectedDigit[adesso2][secondIndex]==0x0) continue;
2024 if (TMath::Abs(selectedDigit[adesso1][firstIndex]->GetTDC()-selectedDigit[adesso2][secondIndex]->GetTDC())>fMaxDeltaTime) continue;
2026 interestingTOF[0] = selectedDigit[adesso1][firstIndex]->GetTDC();
2027 interestingTOT[0] = selectedDigit[adesso1][firstIndex]->GetTOT();
2028 interestingADC[0] = selectedDigit[adesso1][firstIndex]->GetADC();
2029 interestingWeight[0] = selectedDigit[adesso1][firstIndex]->GetWeight();
2030 Int_t vol1[5]; for(jj=0; jj<5; jj++) vol1[jj] = selectedDigit[adesso1][firstIndex]->GetDetectorIndex(jj);
2031 AliDebug(1,Form(" %2d %1d %2d %1d %2d", vol1[0], vol1[1], vol1[2], vol1[4], vol1[3]));
2032 Int_t volDum = vol1[3];
2035 fTOFGeometry->GetPosPar(vol1,pos);
2036 interestingX[0] = pos[0];
2037 interestingY[0] = pos[1];
2038 interestingZ[0] = pos[2];
2040 interestingTOF[1] = selectedDigit[adesso2][secondIndex]->GetTDC();
2041 interestingTOT[1] = selectedDigit[adesso2][secondIndex]->GetTOT();
2042 interestingADC[1] = selectedDigit[adesso2][secondIndex]->GetADC();
2043 interestingWeight[1] = selectedDigit[adesso2][secondIndex]->GetWeight();
2044 Int_t vol2[5]; for(jj=0; jj<5; jj++) vol2[jj] = selectedDigit[adesso2][secondIndex]->GetDetectorIndex(jj);
2045 AliDebug(1,Form(" %2d %1d %2d %1d %2d", vol2[0], vol2[1], vol2[2], vol2[4], vol2[3]));
2049 fTOFGeometry->GetPosPar(vol2,pos);
2050 interestingX[1] = pos[0];
2051 interestingY[1] = pos[1];
2052 interestingZ[1] = pos[2];
2055 AverageCalculations(2, interestingX, interestingY, interestingZ,
2056 interestingTOF, interestingTOT, interestingADC,
2058 parTOF, posClus, check);
2060 for (jj=0; jj<5; jj++) det[jj] = -1;
2061 for (jj=0; jj<3; jj++) posF[jj] = posClus[jj];
2062 fTOFGeometry->GetDetID(posF, det);
2064 volIdClus = fTOFGeometry->GetAliSensVolIndex(det[0],det[1],det[2]);
2065 //volIdClus = GetClusterVolIndex(det);
2067 for (jj=3; jj<11; jj++) padsCluster[jj] = -1;
2068 padsCluster[3] = selectedDigit[adesso1][firstIndex]->GetDetectorIndex(4);
2069 padsCluster[4] = selectedDigit[adesso1][firstIndex]->GetDetectorIndex(3);
2070 padsCluster[5] = selectedDigit[adesso2][secondIndex]->GetDetectorIndex(4);
2071 padsCluster[6] = selectedDigit[adesso2][secondIndex]->GetDetectorIndex(3);
2073 for (jj=0; jj<6; jj++) covClus[jj] = 0.;
2074 Int_t ** indDet = new Int_t*[2];
2075 for (jj=0; jj<2; jj++) indDet[jj] = new Int_t [5];
2076 for (jj=0; jj<2; jj++) indDet[jj][0] = nSector;
2077 for (jj=0; jj<2; jj++) indDet[jj][1] = nPlate;
2078 for (jj=0; jj<2; jj++) indDet[jj][2] = nStrip;
2079 for (jj=0; jj<2; jj++) indDet[jj][3] = padsCluster[2*jj+3];
2080 for (jj=0; jj<2; jj++) indDet[jj][4] = padsCluster[2*jj+1+3];
2081 GetClusterPars(/*check,*/ 2, indDet, interestingWeight, posClus, covClus);
2082 for (jj=0; jj<2; jj++) delete [] indDet[jj];
2084 // To fill the track index array
2086 for (jj=0; jj<kMaxNumberOfTracksPerDigit; jj++) tracks[jj] = -1;
2087 for (Int_t kk=0; kk<kMaxNumberOfTracksPerDigit; kk++) { // three is the max number of tracks associated to one digit
2088 if (selectedDigit[adesso1][firstIndex]->GetTrackLabel(kk)==-1) continue;
2091 tracks[dummyCounter] = selectedDigit[adesso1][firstIndex]->GetTrackLabel(kk);
2094 for (Int_t kk=0; kk<kMaxNumberOfTracksPerDigit; kk++) { // three is the max number of tracks associated to one digit
2095 if (selectedDigit[adesso2][secondIndex]->GetTrackLabel(kk)==-1) continue;
2098 alreadyStored = kFALSE;
2099 for (jj=0; jj<dummyCounter+1; jj++)
2100 alreadyStored = alreadyStored || (tracks[jj]!=-1 && tracks[jj]==selectedDigit[adesso2][secondIndex]->GetTrackLabel(kk));
2102 if (alreadyStored) continue;
2103 if (dummyCounter==2) { // three is the max number of tracks associated to one cluster
2104 AliWarning(" Siamo al limite!");
2109 tracks[dummyCounter] = selectedDigit[adesso2][secondIndex]->GetTrackLabel(kk);
2116 AliTOFcluster *tofCluster =
2117 new AliTOFcluster(volIdClus, posClus[0], posClus[1], posClus[2],
2118 covClus[0], covClus[1], covClus[2], covClus[3], covClus[4], covClus[5],
2119 tracks, det, parTOF, status, selectedDigit[adesso1][firstIndex]->GetIndex()); // to be updated
2120 InsertCluster(tofCluster);
2122 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",
2123 volIdClus, posClus[0], posClus[1], posClus[2],
2124 covClus[0], covClus[1], covClus[2], covClus[3], covClus[4], covClus[5],
2125 tracks[0], tracks[1], tracks[2],
2126 det[0], det[1], det[2], det[3], det[4],
2127 parTOF[0], parTOF[1], parTOF[2], parTOF[3], parTOF[4],
2128 status, selectedDigit[adesso1][firstIndex]->GetIndex()));
2133 fTOFdigitMap->ResetDigitNumber(vol1,selectedDigit[adesso1][firstIndex]->GetIndex());
2137 fTOFdigitMap->ResetDigitNumber(vol2,selectedDigit[adesso2][secondIndex]->GetIndex());
2140 } // close loop on second digit
2141 } // close loop on adesso2
2143 } // close loop on first digit
2144 } // close loop on adesso1
2146 for (ii=0; ii<kMaxNumberOfInterestingPads; ii++)
2147 for (jj=0; jj<kMaxNumberOfDigitsPerVolume; jj++)
2148 selectedDigit[ii][jj] = 0x0;
2152 for (ii=0; ii<kMaxNumberOfInterestingPads; ii++)
2153 for (jj=0; jj<kMaxNumberOfDigitsPerVolume; jj++) {
2154 delete selectedDigit[ii][jj];
2155 selectedDigit[ii][jj] = 0x0;
2160 //_____________________________________________________________________________
2162 void AliTOFClusterFinderV1::FindClustersPerStrip(Int_t nSector,
2168 // This function searches the neighbouring digits (stored in the fDigits object),
2169 // to perform clusters (stored in the fTofClusters array).
2171 // Each strip is read four times:
2172 // - 1st time: it searches possible clusters formed by four
2173 // neighbouring digits;
2174 // - 2nd time: it searches possible clusters formed by three
2175 // neighbouring digits;
2176 // - 3rd time: it searches possible clusters formed by two
2177 // neighbouring digits;
2178 // - 4th time: the remaining isolated digits have been transformed
2180 // This research has been made by checking the fTOFdigitMap object,
2181 // filled at digits/raw-data reading time.
2184 const Int_t kMaxNumberOfInterestingPads = 4;
2185 const Int_t kMaxNumberOfTracksPerDigit = 3;
2186 const Int_t kMaxNumberOfDigitsPerVolume = 10;
2190 Int_t digitsInVolumeIndices[kMaxNumberOfDigitsPerVolume];
2191 for (ii=0; ii<kMaxNumberOfDigitsPerVolume; ii++)
2192 digitsInVolumeIndices[ii] = -1;
2194 Int_t vol[5] = {nSector,nPlate,nStrip,-1,-1};
2196 Float_t pos[3] = {0.,0.,0.};
2199 Int_t interestingPadX[kMaxNumberOfInterestingPads];
2200 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingPadX[jj] = -1;
2201 Int_t interestingPadZ[kMaxNumberOfInterestingPads];
2202 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingPadZ[jj] = -1;
2203 Double_t interestingTOT[kMaxNumberOfInterestingPads];
2204 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingTOT[jj] = 0;
2205 Double_t interestingADC[kMaxNumberOfInterestingPads];
2206 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingADC[jj] = 0;
2207 Double_t interestingTOF[kMaxNumberOfInterestingPads];
2208 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingTOF[jj] = 0;
2209 Double_t interestingWeight[kMaxNumberOfInterestingPads];
2210 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingWeight[jj] = 0;
2212 Float_t interestingX[kMaxNumberOfInterestingPads];
2213 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingX[jj] = 0;
2214 Float_t interestingY[kMaxNumberOfInterestingPads];
2215 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingY[jj] = 0;
2216 Float_t interestingZ[kMaxNumberOfInterestingPads];
2217 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interestingZ[jj] = 0;
2219 Float_t interDigit[kMaxNumberOfInterestingPads];
2220 for (jj=0; jj<kMaxNumberOfInterestingPads; jj++) interDigit[jj] = 0;
2222 Int_t padsCluster[11];
2223 padsCluster[0] = nSector;
2224 padsCluster[1] = nPlate;
2225 padsCluster[2] = nStrip;
2226 for (jj=3; jj<11; jj++) padsCluster[jj] = -1;
2228 Int_t interestingCounter=-1;
2229 Int_t digitIndexLocal = -1;
2234 Bool_t check = kFALSE;
2236 for (jj=0; jj<5; jj++) parTOF[jj] = 0;
2237 Double_t posClus[3];
2238 for (jj=0; jj<3; jj++) posClus[jj] = 0.;
2240 for (jj=0; jj<5; jj++) det[jj] = -1;
2242 for (jj=0; jj<3; jj++) posF[jj] = 0.;
2243 UShort_t volIdClus = 0;
2244 Bool_t status = kTRUE; //assume all sim channels ok in the beginning...
2245 Double_t covClus[6];
2246 for (jj=0; jj<6; jj++) covClus[jj] = 0.;
2247 Int_t tracks[kMaxNumberOfTracksPerDigit];
2248 for (jj=0; jj<3; jj++) tracks[jj] = -1;
2249 Int_t dummyCounter=-1;
2250 Bool_t alreadyStored = kFALSE;
2252 AliTOFselectedDigit ***selectedDigit = new AliTOFselectedDigit**[kMaxNumberOfInterestingPads];
2253 for (ii=0; ii<kMaxNumberOfInterestingPads; ii++)
2254 selectedDigit[ii] = new AliTOFselectedDigit*[kMaxNumberOfDigitsPerVolume];
2256 for (ii=0; ii<kMaxNumberOfInterestingPads; ii++)
2257 for (jj=0; jj<kMaxNumberOfDigitsPerVolume; jj++) selectedDigit[ii][jj] = 0x0;
2259 AliTOFdigit *digitInteresting;
2263 for (iPad=0; iPad<AliTOFGeometry::NpadZ()*AliTOFGeometry::NpadX()-3; iPad+=2) {
2265 iPadZ = iPad%AliTOFGeometry::NpadZ(); //iPad%2;
2266 iPadX = iPad/AliTOFGeometry::NpadZ(); //iPad/2;
2268 AliDebug(3, Form("%2d %1d %2d\n", iPad, iPadZ, iPadX));
2275 interestingCounter=-1;
2277 vol[4] = iPadZ , vol[3] = iPadX;
2278 if (fTOFdigitMap->GetNumberOfDigits(vol)>0)
2279 interestingCounter++;
2281 vol[4] = iPadZ, vol[3] = iPadX+1;
2282 if (fTOFdigitMap->GetNumberOfDigits(vol)>0)
2283 interestingCounter++;
2285 vol[4] = AliTOFGeometry::NpadZ()-(iPadZ+1), vol[3] = iPadX;
2286 if (fTOFdigitMap->GetNumberOfDigits(vol)>0)
2287 interestingCounter++;
2289 vol[4] = AliTOFGeometry::NpadZ()-(iPadZ+1), vol[3] = iPadX+1;
2290 if (fTOFdigitMap->GetNumberOfDigits(vol)>0)
2291 interestingCounter++;
2293 if (interestingCounter!=group) continue;
2294 else interestingCounter=-1;
2297 for (ii=0; ii<kMaxNumberOfInterestingPads; ii++)
2298 for (jj=0; jj<kMaxNumberOfDigitsPerVolume; jj++)
2299 selectedDigit[ii][jj] = 0x0;
2302 vol[4] = iPadZ, vol[3] = iPadX;
2304 if (fTOFdigitMap->GetNumberOfDigits(vol)>0) {
2305 interestingCounter++;
2306 for (ii=0; ii<kMaxNumberOfDigitsPerVolume; ii++)
2307 digitsInVolumeIndices[ii] = -1;
2308 fTOFdigitMap->GetDigitIndex(vol, digitsInVolumeIndices);
2309 digitIndexLocal=-1; // AdC
2310 for(Int_t digIndex=0; digIndex<kMaxNumberOfDigitsPerVolume; digIndex++) {
2311 if (digitsInVolumeIndices[digIndex]<0) continue;
2312 digitInteresting = (AliTOFdigit*)fDigits->UncheckedAt(digitsInVolumeIndices[digIndex]);
2313 if (digitInteresting->GetToT()<=0) continue; // AdC
2314 digitIndexLocal++; // AdC
2316 AliDebug(1,Form(" %2d %1d %2d %1d %2d %d %d %d %d %5d %5d %5d %5d",
2317 vol[0], vol[1], vol[2] ,vol[4], vol[3],
2318 digitInteresting->GetTdc(), digitInteresting->GetAdc(),
2319 digitInteresting->GetToT(), digitInteresting->GetToT()*digitInteresting->GetToT(),
2320 digitsInVolumeIndices[digIndex],
2321 digitInteresting->GetTrack(0), digitInteresting->GetTrack(1), digitInteresting->GetTrack(2)));
2322 AliDebug(1,Form(" to try %d %d ",digIndex, interestingCounter));
2324 selectedDigit[interestingCounter][digitIndexLocal] = new // AdC
2325 AliTOFselectedDigit(vol, digitInteresting->GetTdc(),
2326 digitInteresting->GetAdc(), digitInteresting->GetToT(),
2327 digitInteresting->GetToT()*digitInteresting->GetToT(),
2328 digitsInVolumeIndices[digIndex],
2329 digitInteresting->GetTracks());
2331 if (digitIndexLocal==-1) interestingCounter--; // AdC
2335 vol[4] = iPadZ, vol[3] = iPadX+1;
2337 if (fTOFdigitMap->GetNumberOfDigits(vol)>0) {
2338 interestingCounter++;
2339 for (ii=0; ii<kMaxNumberOfDigitsPerVolume; ii++)
2340 digitsInVolumeIndices[ii] = -1;
2341 fTOFdigitMap->GetDigitIndex(vol, digitsInVolumeIndices);
2342 digitIndexLocal=-1; // AdC
2343 for(Int_t digIndex=0; digIndex<kMaxNumberOfDigitsPerVolume; digIndex++) {
2344 if (digitsInVolumeIndices[digIndex]<0) continue;
2345 digitInteresting = (AliTOFdigit*)fDigits->UncheckedAt(digitsInVolumeIndices[digIndex]);
2346 if (digitInteresting->GetToT()<=0) continue; // AdC
2347 digitIndexLocal++; // AdC
2349 AliDebug(1,Form(" %2d %1d %2d %1d %2d %d %d %d %d %5d %5d %5d %5d",
2350 vol[0], vol[1], vol[2] ,vol[4], vol[3],
2351 digitInteresting->GetTdc(), digitInteresting->GetAdc(),
2352 digitInteresting->GetToT(), digitInteresting->GetToT()*digitInteresting->GetToT(),
2353 digitsInVolumeIndices[digIndex],
2354 digitInteresting->GetTrack(0), digitInteresting->GetTrack(1), digitInteresting->GetTrack(2)));
2355 AliDebug(1,Form(" to try %d %d ",digIndex, interestingCounter));
2357 selectedDigit[interestingCounter][digitIndexLocal] = new // AdC
2358 AliTOFselectedDigit(vol, digitInteresting->GetTdc(),
2359 digitInteresting->GetAdc(), digitInteresting->GetToT(),
2360 digitInteresting->GetToT()*digitInteresting->GetToT(),
2361 digitsInVolumeIndices[digIndex],
2362 digitInteresting->GetTracks());
2364 if (digitIndexLocal==-1) interestingCounter--; // AdC
2368 vol[4] = AliTOFGeometry::NpadZ()-(iPadZ+1), vol[3] = iPadX;
2370 if (fTOFdigitMap->GetNumberOfDigits(vol)>0) {
2371 interestingCounter++;
2372 for (ii=0; ii<kMaxNumberOfDigitsPerVolume; ii++)
2373 digitsInVolumeIndices[ii] = -1;
2374 fTOFdigitMap->GetDigitIndex(vol, digitsInVolumeIndices);
2375 digitIndexLocal=-1; // AdC
2376 for(Int_t digIndex=0; digIndex<kMaxNumberOfDigitsPerVolume; digIndex++) {
2377 if (digitsInVolumeIndices[digIndex]<0) continue;
2378 digitInteresting = (AliTOFdigit*)fDigits->UncheckedAt(digitsInVolumeIndices[digIndex]);
2379 if (digitInteresting->GetToT()<=0) continue; // AdC
2380 digitIndexLocal++; // AdC
2382 AliDebug(1,Form(" %2d %1d %2d %1d %2d %d %d %d %d %5d %5d %5d %5d",
2383 vol[0], vol[1], vol[2] ,vol[4], vol[3],
2384 digitInteresting->GetTdc(), digitInteresting->GetAdc(),
2385 digitInteresting->GetToT(), digitInteresting->GetToT()*digitInteresting->GetToT(),
2386 digitsInVolumeIndices[digIndex],
2387 digitInteresting->GetTrack(0), digitInteresting->GetTrack(1), digitInteresting->GetTrack(2)));
2388 AliDebug(1,Form(" to try %d %d ",digIndex, interestingCounter));
2390 selectedDigit[interestingCounter][digitIndexLocal] = new // AdC
2391 AliTOFselectedDigit(vol, digitInteresting->GetTdc(),
2392 digitInteresting->GetAdc(), digitInteresting->GetToT(),
2393 digitInteresting->GetToT()*digitInteresting->GetToT(),
2394 digitsInVolumeIndices[digIndex],
2395 digitInteresting->GetTracks());
2397 if (digitIndexLocal==-1) interestingCounter--; // AdC
2401 vol[4] = AliTOFGeometry::NpadZ()-(iPadZ+1), vol[3] = iPadX+1;
2403 if (fTOFdigitMap->GetNumberOfDigits(vol)>0) {
2404 interestingCounter++;
2405 for (ii=0; ii<kMaxNumberOfDigitsPerVolume; ii++)
2406 digitsInVolumeIndices[ii] = -1;
2407 fTOFdigitMap->GetDigitIndex(vol, digitsInVolumeIndices);
2408 digitIndexLocal=-1; // AdC
2409 for(Int_t digIndex=0; digIndex<kMaxNumberOfDigitsPerVolume; digIndex++) {
2410 if (digitsInVolumeIndices[digIndex]<0) continue;
2411 digitInteresting = (AliTOFdigit*)fDigits->UncheckedAt(digitsInVolumeIndices[digIndex]);
2412 if (digitInteresting->GetToT()<=0) continue; // AdC
2413 digitIndexLocal++; // AdC
2415 AliDebug(1,Form(" %2d %1d %2d %1d %2d %d %d %d %d %5d %5d %5d %5d",
2416 vol[0], vol[1], vol[2] ,vol[4], vol[3],
2417 digitInteresting->GetTdc(), digitInteresting->GetAdc(),
2418 digitInteresting->GetToT(), digitInteresting->GetToT()*digitInteresting->GetToT(),
2419 digitsInVolumeIndices[digIndex],
2420 digitInteresting->GetTrack(0), digitInteresting->GetTrack(1), digitInteresting->GetTrack(2)));
2421 AliDebug(1,Form(" to try %d %d ",digIndex, interestingCounter));
2423 selectedDigit[interestingCounter][digitIndexLocal] = new // AdC
2424 AliTOFselectedDigit(vol, digitInteresting->GetTdc(),
2425 digitInteresting->GetAdc(), digitInteresting->GetToT(),
2426 digitInteresting->GetToT()*digitInteresting->GetToT(),
2427 digitsInVolumeIndices[digIndex],
2428 digitInteresting->GetTracks());
2430 if (digitIndexLocal==-1) interestingCounter--; // AdC
2433 AliDebug(1,Form(" e adesso %1d", interestingCounter+1));
2435 switch(interestingCounter+1) {
2439 for (Int_t adesso1=0; adesso1<interestingCounter+1; adesso1++) {
2440 for (Int_t firstIndex=0; firstIndex<kMaxNumberOfDigitsPerVolume; firstIndex++) {
2441 if (selectedDigit[adesso1][firstIndex]==0x0) continue;
2443 for (Int_t adesso2=adesso1+1; adesso2<interestingCounter+1; adesso2++) {
2444 for (Int_t secondIndex=0; secondIndex<kMaxNumberOfDigitsPerVolume; secondIndex++) {
2445 if (selectedDigit[adesso2][secondIndex]==0x0) continue;
2447 if (TMath::Abs(selectedDigit[adesso1][firstIndex]->GetTDC()-selectedDigit[adesso2][secondIndex]->GetTDC())>fMaxDeltaTime) continue;
2449 AliDebug(1, Form(" %1d %1d (0x%x) %1d %1d (0x%x)", adesso1, firstIndex,selectedDigit[adesso1][firstIndex],
2450 adesso2, secondIndex,selectedDigit[adesso2][secondIndex]));
2452 interestingTOF[0] = selectedDigit[adesso1][firstIndex]->GetTDC();
2453 interestingTOT[0] = selectedDigit[adesso1][firstIndex]->GetTOT();
2454 interestingADC[0] = selectedDigit[adesso1][firstIndex]->GetADC();
2455 interestingWeight[0] = selectedDigit[adesso1][firstIndex]->GetWeight();
2456 Int_t vol1[5]; for(jj=0; jj<5; jj++) vol1[jj] = selectedDigit[adesso1][firstIndex]->GetDetectorIndex(jj);
2457 AliDebug(1,Form(" %2d %1d %2d %1d %2d", vol1[0], vol1[1], vol1[2], vol1[4], vol1[3]));
2458 Int_t volDum = vol1[3];
2461 fTOFGeometry->GetPosPar(vol1,pos);
2462 AliDebug(1,Form(" %f %f %f", pos[0], pos[1], pos[2]));
2463 interestingX[0] = pos[0];
2464 interestingY[0] = pos[1];
2465 interestingZ[0] = pos[2];
2467 interestingTOF[1] = selectedDigit[adesso2][secondIndex]->GetTDC();
2468 interestingTOT[1] = selectedDigit[adesso2][secondIndex]->GetTOT();
2469 interestingADC[1] = selectedDigit[adesso2][secondIndex]->GetADC();
2470 interestingWeight[1] = selectedDigit[adesso2][secondIndex]->GetWeight();
2471 Int_t vol2[5]; for(jj=0; jj<5; jj++) vol2[jj] = selectedDigit[adesso2][secondIndex]->GetDetectorIndex(jj);
2472 AliDebug(1,Form(" %2d %1d %2d %1d %2d", vol2[0], vol2[1], vol2[2], vol2[4], vol2[3]));
2476 fTOFGeometry->GetPosPar(vol2,pos);
2477 AliDebug(1,Form(" %f %f %f", pos[0], pos[1], pos[2]));
2478 interestingX[1] = pos[0];
2479 interestingY[1] = pos[1];
2480 interestingZ[1] = pos[2];
2483 AverageCalculations(interestingCounter+1,
2484 interestingX, interestingY, interestingZ,
2485 interestingTOF, interestingTOT, interestingADC,
2487 parTOF, posClus, check);
2489 for (jj=0; jj<5; jj++) det[jj] = -1;
2490 for (jj=0; jj<3; jj++) posF[jj] = posClus[jj];
2492 AliDebug(1,Form(" %f %f %f", posF[0], posF[1], posF[2]));
2493 fTOFGeometry->GetDetID(posF, det);
2494 AliDebug(1,Form(" %2d %1d %2d %1d %2d", det[0], det[1], det[2], det[3], det[4]));
2496 volIdClus = fTOFGeometry->GetAliSensVolIndex(det[0],det[1],det[2]);
2497 //volIdClus = GetClusterVolIndex(det);
2499 for (jj=3; jj<11; jj++) padsCluster[jj] = -1;
2500 padsCluster[3] = selectedDigit[adesso1][firstIndex]->GetDetectorIndex(4);
2501 padsCluster[4] = selectedDigit[adesso1][firstIndex]->GetDetectorIndex(3);
2502 padsCluster[5] = selectedDigit[adesso2][secondIndex]->GetDetectorIndex(4);
2503 padsCluster[6] = selectedDigit[adesso2][secondIndex]->GetDetectorIndex(3);
2505 for (jj=0; jj<6; jj++) covClus[jj] = 0.;
2506 Int_t ** indDet = new Int_t*[interestingCounter+1];
2507 for (jj=0; jj<interestingCounter+1; jj++) indDet[jj] = new Int_t [5];
2508 for (jj=0; jj<interestingCounter+1; jj++) indDet[jj][0] = nSector;
2509 for (jj=0; jj<interestingCounter+1; jj++) indDet[jj][1] = nPlate;
2510 for (jj=0; jj<interestingCounter+1; jj++) indDet[jj][2] = nStrip;
2511 for (jj=0; jj<interestingCounter+1; jj++) indDet[jj][3] = padsCluster[2*jj+3];
2512 for (jj=0; jj<interestingCounter+1; jj++) indDet[jj][4] = padsCluster[2*jj+1+3];
2513 GetClusterPars(/*check,*/ interestingCounter+1, indDet, interestingWeight, posClus, covClus);
2514 for (jj=0; jj<interestingCounter+1; jj++) delete [] indDet[jj];
2516 // To fill the track index array
2518 for (jj=0; jj<kMaxNumberOfTracksPerDigit; jj++) tracks[jj] = -1;
2519 for (Int_t kk=0; kk<kMaxNumberOfTracksPerDigit; kk++) { // three is the max number of tracks associated to one digit
2520 if (selectedDigit[adesso1][firstIndex]->GetTrackLabel(kk)==-1) continue;
2523 tracks[dummyCounter] = selectedDigit[adesso1][firstIndex]->GetTrackLabel(kk);
2526 for (Int_t kk=0; kk<kMaxNumberOfTracksPerDigit; kk++) { // three is the max number of tracks associated to one digit
2527 if (selectedDigit[adesso2][secondIndex]->GetTrackLabel(kk)==-1) continue;
2530 alreadyStored = kFALSE;
2531 for (jj=0; jj<dummyCounter+1; jj++)
2532 alreadyStored = alreadyStored || (tracks[jj]!=-1 && tracks[jj]==selectedDigit[adesso2][secondIndex]->GetTrackLabel(kk));
2534 if (alreadyStored) continue;
2535 if (dummyCounter==2) { // three is the max number of tracks associated to one cluster
2536 AliWarning(" Siamo al limite!");
2541 tracks[dummyCounter] = selectedDigit[adesso2][secondIndex]->GetTrackLabel(kk);
2548 AliTOFcluster *tofCluster =
2549 new AliTOFcluster(volIdClus, posClus[0], posClus[1], posClus[2],
2550 covClus[0], covClus[1], covClus[2], covClus[3], covClus[4], covClus[5],
2551 tracks, det, parTOF, status, selectedDigit[adesso1][firstIndex]->GetIndex()); //to updated
2552 InsertCluster(tofCluster);
2554 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",
2555 volIdClus, posClus[0], posClus[1], posClus[2],
2556 covClus[0], covClus[1], covClus[2], covClus[3], covClus[4], covClus[5],
2557 tracks[0], tracks[1], tracks[2],
2558 det[0], det[1], det[2], det[3], det[4],
2559 parTOF[0], parTOF[1], parTOF[2], parTOF[3], parTOF[4],
2560 status, selectedDigit[adesso1][firstIndex]->GetIndex()));
2565 fTOFdigitMap->ResetDigitNumber(vol1,selectedDigit[adesso1][firstIndex]->GetIndex());
2569 fTOFdigitMap->ResetDigitNumber(vol2,selectedDigit[adesso2][secondIndex]->GetIndex());
2572 } // close loop on second digit
2573 } // close loop on adesso2
2575 } // close loop on first digit
2576 } // close loop on adesso1
2583 for (Int_t adesso1=0; adesso1<interestingCounter+1; adesso1++) {
2584 for (Int_t firstIndex=0; firstIndex<kMaxNumberOfDigitsPerVolume; firstIndex++) {
2585 if (selectedDigit[adesso1][firstIndex]==0x0) continue;
2587 for (Int_t adesso2=adesso1+1; adesso2<interestingCounter+1; adesso2++) {
2588 for (Int_t secondIndex=0; secondIndex<kMaxNumberOfDigitsPerVolume; secondIndex++) {
2589 if (selectedDigit[adesso2][secondIndex]==0x0) continue;
2591 for (Int_t adesso3=adesso2+1; adesso3<interestingCounter+1; adesso3++) {
2592 for (Int_t thirdIndex=0; thirdIndex<kMaxNumberOfDigitsPerVolume; thirdIndex++) {
2593 if (selectedDigit[adesso3][thirdIndex]==0x0) continue;
2596 if (TMath::Abs(selectedDigit[adesso1][firstIndex]->GetTDC()-selectedDigit[adesso2][secondIndex]->GetTDC())>fMaxDeltaTime
2598 TMath::Abs(selectedDigit[adesso1][firstIndex]->GetTDC()-selectedDigit[adesso3][thirdIndex]->GetTDC())>fMaxDeltaTime
2600 TMath::Abs(selectedDigit[adesso2][secondIndex]->GetTDC()-selectedDigit[adesso3][thirdIndex]->GetTDC())>fMaxDeltaTime) continue;
2602 interestingTOF[0] = selectedDigit[adesso1][firstIndex]->GetTDC();
2603 interestingTOT[0] = selectedDigit[adesso1][firstIndex]->GetTOT();
2604 interestingADC[0] = selectedDigit[adesso1][firstIndex]->GetADC();
2605 interestingWeight[0] = selectedDigit[adesso1][firstIndex]->GetWeight();
2606 Int_t vol1[5]; for(jj=0; jj<5; jj++) vol1[jj] = selectedDigit[adesso1][firstIndex]->GetDetectorIndex(jj);
2607 AliDebug(1,Form(" %2d %1d %2d %1d %2d", vol1[0], vol1[1], vol1[2], vol1[4], vol1[3]));
2608 Int_t volDum = vol1[3];
2611 fTOFGeometry->GetPosPar(vol1,pos);
2612 interestingX[0] = pos[0];
2613 interestingY[0] = pos[1];
2614 interestingZ[0] = pos[2];
2616 interestingTOF[1] = selectedDigit[adesso2][secondIndex]->GetTDC();
2617 interestingTOT[1] = selectedDigit[adesso2][secondIndex]->GetTOT();
2618 interestingADC[1] = selectedDigit[adesso2][secondIndex]->GetADC();
2619 interestingWeight[1] = selectedDigit[adesso2][secondIndex]->GetWeight();
2620 Int_t vol2[5]; for(jj=0; jj<5; jj++) vol2[jj] = selectedDigit[adesso2][secondIndex]->GetDetectorIndex(jj);
2621 AliDebug(1,Form(" %2d %1d %2d %1d %2d", vol2[0], vol2[1], vol2[2], vol2[4], vol2[3]));
2625 fTOFGeometry->GetPosPar(vol2,pos);
2626 interestingX[1] = pos[0];
2627 interestingY[1] = pos[1];
2628 interestingZ[1] = pos[2];
2630 interestingTOF[2] = selectedDigit[adesso3][thirdIndex]->GetTDC();
2631 interestingTOT[2] = selectedDigit[adesso3][thirdIndex]->GetTOT();
2632 interestingADC[2] = selectedDigit[adesso3][thirdIndex]->GetADC();
2633 interestingWeight[2] = selectedDigit[adesso3][thirdIndex]->GetWeight();
2634 Int_t vol3[5]; for(jj=0; jj<5; jj++) vol3[jj] = selectedDigit[adesso3][thirdIndex]->GetDetectorIndex(jj);
2635 AliDebug(1,Form(" %2d %1d %2d %1d %2d", vol3[0], vol3[1], vol3[2], vol3[4], vol3[3]));
2639 fTOFGeometry->GetPosPar(vol3,pos);
2640 interestingX[2] = pos[0];
2641 interestingY[2] = pos[1];
2642 interestingZ[2] = pos[2];
2645 AverageCalculations(interestingCounter+1,
2646 interestingX, interestingY, interestingZ,
2647 interestingTOF, interestingTOT, interestingADC,
2649 parTOF, posClus, check);
2651 for (jj=0; jj<5; jj++) det[jj] = -1;
2652 for (jj=0; jj<3; jj++) posF[jj] = posClus[jj];
2653 fTOFGeometry->GetDetID(posF, det);
2655 volIdClus = fTOFGeometry->GetAliSensVolIndex(det[0],det[1],det[2]);
2656 //volIdClus = GetClusterVolIndex(det);
2658 for (jj=3; jj<11; jj++) padsCluster[jj] = -1;
2659 padsCluster[3] = selectedDigit[adesso1][firstIndex]->GetDetectorIndex(4);
2660 padsCluster[4] = selectedDigit[adesso1][firstIndex]->GetDetectorIndex(3);
2661 padsCluster[5] = selectedDigit[adesso2][secondIndex]->GetDetectorIndex(4);
2662 padsCluster[6] = selectedDigit[adesso2][secondIndex]->GetDetectorIndex(3);
2663 padsCluster[7] = selectedDigit[adesso3][thirdIndex]->GetDetectorIndex(4);
2664 padsCluster[8] = selectedDigit[adesso3][thirdIndex]->GetDetectorIndex(3);
2666 for (jj=0; jj<6; jj++) covClus[jj] = 0.;
2667 Int_t ** indDet = new Int_t*[interestingCounter+1];
2668 for (jj=0; jj<interestingCounter+1; jj++) indDet[jj] = new Int_t [5];
2669 for (jj=0; jj<interestingCounter+1; jj++) indDet[jj][0] = nSector;
2670 for (jj=0; jj<interestingCounter+1; jj++) indDet[jj][1] = nPlate;
2671 for (jj=0; jj<interestingCounter+1; jj++) indDet[jj][2] = nStrip;
2672 for (jj=0; jj<interestingCounter+1; jj++) indDet[jj][3] = padsCluster[2*jj+3];
2673 for (jj=0; jj<interestingCounter+1; jj++) indDet[jj][4] = padsCluster[2*jj+1+3];
2674 GetClusterPars(/*check,*/ interestingCounter+1, indDet, interestingWeight, posClus, covClus);
2675 for (jj=0; jj<interestingCounter+1; jj++) delete [] indDet[jj];
2677 // To fill the track index array
2679 for (jj=0; jj<kMaxNumberOfTracksPerDigit; jj++) tracks[jj] = -1;
2680 for (Int_t kk=0; kk<kMaxNumberOfTracksPerDigit; kk++) { // three is the max number of tracks associated to one digit
2681 if (selectedDigit[adesso1][firstIndex]->GetTrackLabel(kk)==-1) continue;
2684 tracks[dummyCounter] = selectedDigit[adesso1][firstIndex]->GetTrackLabel(kk);
2687 for (Int_t kk=0; kk<kMaxNumberOfTracksPerDigit; kk++) { // three is the max number of tracks associated to one digit
2688 if (selectedDigit[adesso2][secondIndex]->GetTrackLabel(kk)==-1) continue;
2691 alreadyStored = kFALSE;
2692 for (jj=0; jj<dummyCounter+1; jj++)
2693 alreadyStored = alreadyStored || (tracks[jj]!=-1 && tracks[jj]==selectedDigit[adesso2][secondIndex]->GetTrackLabel(kk));
2695 if (alreadyStored) continue;
2696 if (dummyCounter==2) { // three is the max number of tracks associated to one cluster
2697 AliWarning(" Siamo al limite!");
2702 tracks[dummyCounter] = selectedDigit[adesso2][secondIndex]->GetTrackLabel(kk);
2707 for (Int_t kk=0; kk<kMaxNumberOfTracksPerDigit; kk++) { // three is the max number of tracks associated to one digit
2708 if (selectedDigit[adesso3][thirdIndex]->GetTrackLabel(kk)==-1) continue;
2711 alreadyStored = kFALSE;
2712 for (jj=0; jj<dummyCounter+1; jj++)
2713 alreadyStored = alreadyStored || (tracks[jj]!=-1 && tracks[jj]==selectedDigit[adesso3][thirdIndex]->GetTrackLabel(kk));
2715 if (alreadyStored) continue;
2716 if (dummyCounter==2) { // three is the max number of tracks associated to one cluster
2717 AliWarning(" Siamo al limite!");
2722 tracks[dummyCounter] = selectedDigit[adesso3][thirdIndex]->GetTrackLabel(kk);
2729 AliTOFcluster *tofCluster =
2730 new AliTOFcluster(volIdClus, posClus[0], posClus[1], posClus[2],
2731 covClus[0], covClus[1], covClus[2], covClus[3], covClus[4], covClus[5],
2732 tracks, det, parTOF, status, selectedDigit[adesso1][firstIndex]->GetIndex()); // to be updated
2733 InsertCluster(tofCluster);
2735 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",
2736 volIdClus, posClus[0], posClus[1], posClus[2],
2737 covClus[0], covClus[1], covClus[2], covClus[3], covClus[4], covClus[5],
2738 tracks[0], tracks[1], tracks[2],
2739 det[0], det[1], det[2], det[3], det[4],
2740 parTOF[0], parTOF[1], parTOF[2], parTOF[3], parTOF[4],
2741 status, selectedDigit[adesso1][firstIndex]->GetIndex()));
2746 fTOFdigitMap->ResetDigitNumber(vol1,selectedDigit[adesso1][firstIndex]->GetIndex());
2750 fTOFdigitMap->ResetDigitNumber(vol2,selectedDigit[adesso2][secondIndex]->GetIndex());
2754 fTOFdigitMap->ResetDigitNumber(vol3,selectedDigit[adesso3][thirdIndex]->GetIndex());
2757 } // close loop on third digit
2758 } // close loop on adesso3
2760 } // close loop on second digit
2761 } // close loop on adesso2
2763 } // close loop on first digit
2764 } // close loop on adesso1
2772 for (Int_t firstIndex=0; firstIndex<kMaxNumberOfDigitsPerVolume; firstIndex++) {
2773 if (selectedDigit[adesso1][firstIndex]==0x0) continue;
2776 for (Int_t secondIndex=0; secondIndex<kMaxNumberOfDigitsPerVolume; secondIndex++) {
2777 if (selectedDigit[adesso2][secondIndex]==0x0) continue;
2780 for (Int_t thirdIndex=0; thirdIndex<kMaxNumberOfDigitsPerVolume; thirdIndex++) {
2781 if (selectedDigit[adesso3][thirdIndex]==0x0) continue;
2784 for (Int_t fourthIndex=0; fourthIndex<kMaxNumberOfDigitsPerVolume; fourthIndex++) {
2785 if (selectedDigit[adesso4][fourthIndex]==0x0) continue;
2788 if (TMath::Abs(selectedDigit[adesso1][firstIndex]->GetTDC()-selectedDigit[adesso2][secondIndex]->GetTDC())>fMaxDeltaTime
2790 TMath::Abs(selectedDigit[adesso1][firstIndex]->GetTDC()-selectedDigit[adesso3][thirdIndex]->GetTDC())>fMaxDeltaTime
2792 TMath::Abs(selectedDigit[adesso1][firstIndex]->GetTDC()-selectedDigit[adesso4][fourthIndex]->GetTDC())>fMaxDeltaTime
2794 TMath::Abs(selectedDigit[adesso2][secondIndex]->GetTDC()-selectedDigit[adesso3][thirdIndex]->GetTDC())>fMaxDeltaTime
2796 TMath::Abs(selectedDigit[adesso2][secondIndex]->GetTDC()-selectedDigit[adesso4][fourthIndex]->GetTDC())>fMaxDeltaTime
2798 TMath::Abs(selectedDigit[adesso3][thirdIndex]->GetTDC()-selectedDigit[adesso4][fourthIndex]->GetTDC())>fMaxDeltaTime) continue;
2800 interestingTOF[0] = selectedDigit[adesso1][firstIndex]->GetTDC();
2801 interestingTOT[0] = selectedDigit[adesso1][firstIndex]->GetTOT();
2802 interestingADC[0] = selectedDigit[adesso1][firstIndex]->GetADC();
2803 interestingWeight[0] = selectedDigit[adesso1][firstIndex]->GetWeight();
2804 Int_t vol1[5]; for(jj=0; jj<5; jj++) vol1[jj] = selectedDigit[adesso1][firstIndex]->GetDetectorIndex(jj);
2805 AliDebug(1,Form(" %2d %1d %2d %1d %2d", vol1[0], vol1[1], vol1[2], vol1[4], vol1[3]));
2806 Int_t volDum = vol1[3];
2809 fTOFGeometry->GetPosPar(vol1,pos);
2810 interestingX[0] = pos[0];
2811 interestingY[0] = pos[1];
2812 interestingZ[0] = pos[2];
2814 interestingTOF[1] = selectedDigit[adesso2][secondIndex]->GetTDC();
2815 interestingTOT[1] = selectedDigit[adesso2][secondIndex]->GetTOT();
2816 interestingADC[1] = selectedDigit[adesso2][secondIndex]->GetADC();
2817 interestingWeight[1] = selectedDigit[adesso2][secondIndex]->GetWeight();
2818 Int_t vol2[5]; for(jj=0; jj<5; jj++) vol2[jj] = selectedDigit[adesso2][secondIndex]->GetDetectorIndex(jj);
2819 AliDebug(1,Form(" %2d %1d %2d %1d %2d", vol2[0], vol2[1], vol2[2], vol2[4], vol2[3]));
2823 fTOFGeometry->GetPosPar(vol2,pos);
2824 interestingX[1] = pos[0];
2825 interestingY[1] = pos[1];
2826 interestingZ[1] = pos[2];
2828 interestingTOF[2] = selectedDigit[adesso3][thirdIndex]->GetTDC();
2829 interestingTOT[2] = selectedDigit[adesso3][thirdIndex]->GetTOT();
2830 interestingADC[2] = selectedDigit[adesso3][thirdIndex]->GetADC();
2831 interestingWeight[2] = selectedDigit[adesso3][thirdIndex]->GetWeight();
2832 Int_t vol3[5]; for(jj=0; jj<5; jj++) vol3[jj] = selectedDigit[adesso3][thirdIndex]->GetDetectorIndex(jj);
2833 AliDebug(1,Form(" %2d %1d %2d %1d %2d", vol3[0], vol3[1], vol3[2], vol3[4], vol3[3]));
2837 fTOFGeometry->GetPosPar(vol3,pos);
2838 interestingX[2] = pos[0];
2839 interestingY[2] = pos[1];
2840 interestingZ[2] = pos[2];
2842 interestingTOF[3] = selectedDigit[adesso4][fourthIndex]->GetTDC();
2843 interestingTOT[3] = selectedDigit[adesso4][fourthIndex]->GetTOT();
2844 interestingADC[3] = selectedDigit[adesso4][fourthIndex]->GetADC();
2845 interestingWeight[3] = selectedDigit[adesso4][fourthIndex]->GetWeight();
2846 Int_t vol4[5]; for(jj=0; jj<5; jj++) vol4[jj] = selectedDigit[adesso4][fourthIndex]->GetDetectorIndex(jj);
2847 AliDebug(1,Form(" %2d %1d %2d %1d %2d", vol4[0], vol4[1], vol4[2], vol4[4], vol4[3]));
2851 fTOFGeometry->GetPosPar(vol4,pos);
2852 interestingX[3] = pos[0];
2853 interestingY[3] = pos[1];
2854 interestingZ[3] = pos[2];
2857 AverageCalculations(interestingCounter+1,
2858 interestingX, interestingY, interestingZ,
2859 interestingTOF, interestingTOT, interestingADC,
2861 parTOF, posClus, check);
2863 for (jj=0; jj<5; jj++) det[jj] = -1;
2864 for (jj=0; jj<3; jj++) posF[jj] = posClus[jj];
2865 fTOFGeometry->GetDetID(posF, det);
2867 volIdClus = fTOFGeometry->GetAliSensVolIndex(det[0],det[1],det[2]);
2868 //volIdClus = GetClusterVolIndex(det);
2870 for (jj=3; jj<11; jj++) padsCluster[jj] = -1;
2871 padsCluster[3] = selectedDigit[adesso1][firstIndex]->GetDetectorIndex(4);
2872 padsCluster[4] = selectedDigit[adesso1][firstIndex]->GetDetectorIndex(3);
2873 padsCluster[5] = selectedDigit[adesso2][secondIndex]->GetDetectorIndex(4);
2874 padsCluster[6] = selectedDigit[adesso2][secondIndex]->GetDetectorIndex(3);
2875 padsCluster[7] = selectedDigit[adesso3][thirdIndex]->GetDetectorIndex(4);
2876 padsCluster[8] = selectedDigit[adesso3][thirdIndex]->GetDetectorIndex(3);
2877 padsCluster[9] = selectedDigit[adesso4][fourthIndex]->GetDetectorIndex(4);
2878 padsCluster[10] = selectedDigit[adesso4][fourthIndex]->GetDetectorIndex(3);
2880 for (jj=0; jj<6; jj++) covClus[jj] = 0.;
2881 Int_t ** indDet = new Int_t*[interestingCounter+1];
2882 for (jj=0; jj<interestingCounter+1; jj++) indDet[jj] = new Int_t [5];
2883 for (jj=0; jj<interestingCounter+1; jj++) indDet[jj][0] = nSector;
2884 for (jj=0; jj<interestingCounter+1; jj++) indDet[jj][1] = nPlate;
2885 for (jj=0; jj<interestingCounter+1; jj++) indDet[jj][2] = nStrip;
2886 for (jj=0; jj<interestingCounter+1; jj++) indDet[jj][3] = padsCluster[2*jj+3];
2887 for (jj=0; jj<interestingCounter+1; jj++) indDet[jj][4] = padsCluster[2*jj+1+3];
2888 GetClusterPars(/*check,*/ interestingCounter+1, indDet, interestingWeight, posClus, covClus);
2889 for (jj=0; jj<interestingCounter+1; jj++) delete [] indDet[jj];
2891 // To fill the track index array
2893 for (jj=0; jj<kMaxNumberOfTracksPerDigit; jj++) tracks[jj] = -1;
2894 for (Int_t kk=0; kk<kMaxNumberOfTracksPerDigit; kk++) { // three is the max number of tracks associated to one digit
2895 if (selectedDigit[adesso1][firstIndex]->GetTrackLabel(kk)==-1) continue;
2898 tracks[dummyCounter] = selectedDigit[adesso1][firstIndex]->GetTrackLabel(kk);
2901 for (Int_t kk=0; kk<kMaxNumberOfTracksPerDigit; kk++) { // three is the max number of tracks associated to one digit
2902 if (selectedDigit[adesso2][secondIndex]->GetTrackLabel(kk)==-1) continue;
2905 alreadyStored = kFALSE;
2906 for (jj=0; jj<dummyCounter+1; jj++)
2907 alreadyStored = alreadyStored || (tracks[jj]!=-1 && tracks[jj]==selectedDigit[adesso2][secondIndex]->GetTrackLabel(kk));
2909 if (alreadyStored) continue;
2910 if (dummyCounter==2) { // three is the max number of tracks associated to one cluster
2911 AliWarning(" Siamo al limite!");
2916 tracks[dummyCounter] = selectedDigit[adesso2][secondIndex]->GetTrackLabel(kk);
2921 for (Int_t kk=0; kk<kMaxNumberOfTracksPerDigit; kk++) { // three is the max number of tracks associated to one digit
2922 if (selectedDigit[adesso3][thirdIndex]->GetTrackLabel(kk)==-1) continue;
2925 alreadyStored = kFALSE;
2926 for (jj=0; jj<dummyCounter+1; jj++)
2927 alreadyStored = alreadyStored || (tracks[jj]!=-1 && tracks[jj]==selectedDigit[adesso3][thirdIndex]->GetTrackLabel(kk));
2929 if (alreadyStored) continue;
2930 if (dummyCounter==2) { // three is the max number of tracks associated to one cluster
2931 AliWarning(" Siamo al limite!");
2936 tracks[dummyCounter] = selectedDigit[adesso3][thirdIndex]->GetTrackLabel(kk);
2941 for (Int_t kk=0; kk<kMaxNumberOfTracksPerDigit; kk++) { // three is the max number of tracks associated to one digit
2942 if (selectedDigit[adesso4][fourthIndex]->GetTrackLabel(kk)==-1) continue;
2945 alreadyStored = kFALSE;
2946 for (jj=0; jj<dummyCounter+1; jj++)
2947 alreadyStored = alreadyStored || (tracks[jj]!=-1 && tracks[jj]==selectedDigit[adesso4][fourthIndex]->GetTrackLabel(kk));
2949 if (alreadyStored) continue;
2950 if (dummyCounter==2) { // three is the max number of tracks associated to one cluster
2951 AliWarning(" Siamo al limite!");
2956 tracks[dummyCounter] = selectedDigit[adesso4][fourthIndex]->GetTrackLabel(kk);
2963 AliTOFcluster *tofCluster =
2964 new AliTOFcluster(volIdClus, posClus[0], posClus[1], posClus[2],
2965 covClus[0], covClus[1], covClus[2], covClus[3], covClus[4], covClus[5],
2966 tracks, det, parTOF, status, selectedDigit[adesso1][firstIndex]->GetIndex()); // to be updated
2967 InsertCluster(tofCluster);
2969 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",
2970 volIdClus, posClus[0], posClus[1], posClus[2],
2971 covClus[0], covClus[1], covClus[2], covClus[3], covClus[4], covClus[5],
2972 tracks[0], tracks[1], tracks[2],
2973 det[0], det[1], det[2], det[3], det[4],
2974 parTOF[0], parTOF[1], parTOF[2], parTOF[3], parTOF[4],
2975 status, selectedDigit[adesso1][firstIndex]->GetIndex()));
2980 fTOFdigitMap->ResetDigitNumber(vol1,selectedDigit[adesso1][firstIndex]->GetIndex());
2984 fTOFdigitMap->ResetDigitNumber(vol2,selectedDigit[adesso2][secondIndex]->GetIndex());
2988 fTOFdigitMap->ResetDigitNumber(vol3,selectedDigit[adesso3][thirdIndex]->GetIndex());
2992 fTOFdigitMap->ResetDigitNumber(vol4,selectedDigit[adesso4][fourthIndex]->GetIndex());
2995 } // close loop on fourth digit
2997 } // close loop on third digit
2999 } // close loop on second digit
3001 } // close loop on first digit
3007 for (ii=0; ii<kMaxNumberOfInterestingPads; ii++)
3008 for (jj=0; jj<kMaxNumberOfDigitsPerVolume; jj++)
3009 selectedDigit[ii][jj] = 0x0;
3013 for (ii=0; ii<kMaxNumberOfInterestingPads; ii++)
3014 for (jj=0; jj<kMaxNumberOfDigitsPerVolume; jj++) {
3015 delete selectedDigit[ii][jj];
3016 selectedDigit[ii][jj] = 0x0;
3020 //_____________________________________________________________________________
3022 Int_t AliTOFClusterFinderV1::InsertCluster(AliTOFcluster *tofCluster)
3025 // This function adds a TOF cluster to the array of TOF clusters
3026 // sorted in Z, i.e. fTofClusters
3029 if (fNumberOfTofClusters==kTofMaxCluster) {
3030 AliError("Too many clusters !");
3034 if (fNumberOfTofClusters==0) {
3035 fTofClusters[fNumberOfTofClusters++] = tofCluster;
3039 Int_t ii = FindClusterIndex(tofCluster->GetZ());
3040 memmove(fTofClusters+ii+1 ,fTofClusters+ii,(fNumberOfTofClusters-ii)*sizeof(AliTOFcluster*));
3041 fTofClusters[ii] = tofCluster;
3042 fNumberOfTofClusters++;
3047 //_____________________________________________________________________________
3049 Int_t AliTOFClusterFinderV1::FindClusterIndex(Double_t z) const
3052 // This function returns the index of the nearest cluster in z
3055 if (fNumberOfTofClusters==0) return 0;
3056 if (z <= fTofClusters[0]->GetZ()) return 0;
3057 if (z > fTofClusters[fNumberOfTofClusters-1]->GetZ()) return fNumberOfTofClusters;
3058 Int_t b = 0, e = fNumberOfTofClusters-1, m = (b+e)/2;
3059 for (; b<e; m=(b+e)/2) {
3060 if (z > fTofClusters[m]->GetZ()) b=m+1;
3067 //_____________________________________________________________________________
3069 void AliTOFClusterFinderV1::ResetRecpoint()
3072 // Clear the list of reconstructed points
3075 fNumberOfTofClusters = 0;
3076 if (fRecPoints) fRecPoints->Clear();
3079 //_____________________________________________________________________________
3081 void AliTOFClusterFinderV1::ResetDigits()
3084 // Clear the list of digits
3087 fNumberOfTofDigits = 0;
3088 if (fDigits) fDigits->Clear();
3091 //_____________________________________________________________________________
3092 //UShort_t AliTOFClusterFinderV1::GetClusterVolIndex(Int_t *ind) const
3095 // Get the volume ID to retrieve the l2t transformation
3098 // Detector numbering scheme
3100 Int_t nSector = AliTOFGeometry::NSectors();
3101 Int_t nPlate = AliTOFGeometry::NPlates();
3102 Int_t nStripA = AliTOFGeometry::NStripA();
3103 Int_t nStripB = AliTOFGeometry::NStripB();
3104 Int_t nStripC = AliTOFGeometry::NStripC();
3106 Int_t isector =ind[0];
3107 if (isector >= nSector)
3108 AliError(Form("Wrong sector number in TOF (%d) !", isector));
3109 Int_t iplate = ind[1];
3110 if (iplate >= nPlate)
3111 AliError(Form("Wrong plate number in TOF (%d) !", iplate));
3112 Int_t istrip = ind[2];
3114 Int_t stripOffset = 0;
3120 stripOffset = nStripC;
3123 stripOffset = nStripC+nStripB;
3126 stripOffset = nStripC+nStripB+nStripA;
3129 stripOffset = nStripC+nStripB+nStripA+nStripB;
3132 AliError(Form("Wrong plate number in TOF (%d) !", iplate));
3136 Int_t index= (2*(nStripC+nStripB)+nStripA)*isector +
3140 UShort_t volIndex = AliGeomManager::LayerToVolUID(AliGeomManager::kTOF, index);
3145 //_____________________________________________________________________________
3147 void AliTOFClusterFinderV1::GetClusterPars(Int_t *ind, Double_t* pos, Double_t* cov) const
3150 // Starting from the volume indices (ind[5]), for a cluster coming from
3151 // a isolated digits, this function returns:
3152 // the cluster position (pos),
3153 // the cluster covariance matrix elements (cov)
3157 //we now go in the system of the strip: determine the local coordinates
3160 // 47---------------------------------------------------0 ^ z
3161 // | | | | | | | | | | | | | | | | | | | | | | | | | | | 1 |
3162 // ----------------------------------------------------- | y going outwards
3163 // | | | | | | | | | | | | | | | | | | | | | | | | | | | 0 | par[0]=0;
3165 // ----------------------------------------------------- |
3166 // x <-----------------------------------------------------
3168 //move to the tracking ref system
3169 Double_t lpos[3] = { (ind[4]-23.5)*AliTOFGeometry::XPad(),
3171 (ind[3]- 0.5)*AliTOFGeometry::ZPad() };
3172 AliDebug(1, Form(" %f %f %f", lpos[0], lpos[1], lpos[2]));
3175 UShort_t volIndex = fTOFGeometry->GetAliSensVolIndex(ind[0],ind[1],ind[2]);
3176 //UShort_t volIndex = GetClusterVolIndex(ind);
3177 const TGeoHMatrix *l2t = AliGeomManager::GetTracking2LocalMatrix(volIndex);
3179 // Get the position in the track ref system
3181 l2t->MasterToLocal(lpos,tpos);
3186 //Get the cluster covariance in the track ref system
3188 for (Int_t ii=0; ii<9; ii++) lcov[ii] = 0.;
3190 //cluster covariance in the local system:
3195 lcov[4] = 0.42*0.42/3.;
3196 // = ( 5*0.025 (gas gaps thikness)
3197 // + 4*0.040 (internal glasses thickness)
3198 // + 0.5*0.160 (internl PCB)
3199 // + 1*0.055 (external red glass))
3202 lcov[0] = 0.499678;//AliTOFGeometry::XPad()*AliTOFGeometry::XPad()/12.;
3203 lcov[8] = 0.992429;//AliTOFGeometry::ZPad()*AliTOFGeometry::ZPad()/12.;
3205 //cluster covariance in the tracking system:
3207 m.SetRotation(lcov);
3209 m.MultiplyLeft(&l2t->Inverse());
3210 Double_t *tcov = m.GetRotationMatrix();
3211 cov[0] = tcov[0]; cov[1] = tcov[1]; cov[2] = tcov[2];
3212 cov[3] = tcov[4]; cov[4] = tcov[5]; cov[5] = tcov[8];
3217 //_____________________________________________________________________________
3219 void AliTOFClusterFinderV1::GetClusterPars(/*Bool_t check,*/ Int_t counter,
3220 Int_t **ind, Double_t *weight,
3221 Double_t *pos, Double_t *cov) const
3225 // the volumes indices (ind[counter][5]), for a
3226 // cluster coming from a collection of 'counter'
3228 // the volumes weights (weight[counter]), -controlled
3229 // by the 'check' variable control-, for a cluster
3230 // coming from a collection of 'counter' digits,
3231 // the cluster position (pos),
3232 // this function returns:
3233 // the covariance matrix elements (cov) for the found cluster
3237 // we now go in the system of the strip: determine the local coordinates
3239 // 47---------------------------------------------------0 ^ z
3240 // | | | | | | | | | | | | | | | | | | | | | | | | | | | 1 |
3241 // ----------------------------------------------------- | y going outwards
3242 // | | | | | | | | | | | | | | | | | | | | | | | | | | | 0 | par[0]=0;
3244 // ----------------------------------------------------- |
3245 // x <-----------------------------------------------------
3247 for (Int_t ii=0; ii<counter; ii++)
3248 AliDebug(1, Form(" %2d %2d %1d %2d %1d %2d ",
3249 ii, ind[ii][0], ind[ii][1], ind[ii][2], ind[ii][3], ind[ii][4]));
3251 Float_t posF[3]; for (Int_t ii=0; ii<3; ii++) posF[ii] = (Float_t)pos[ii];
3252 AliDebug(1, Form(" %f %f %f", pos[0], pos[1], pos[2]));
3254 Int_t detClus[5] = {-1, -1, -1, -1, -1};
3255 fTOFGeometry->GetDetID(posF, detClus);
3258 UShort_t volIndex = fTOFGeometry->GetAliSensVolIndex(detClus[0],detClus[1],detClus[2]);
3259 //UShort_t volIndex = GetClusterVolIndex(detClus);
3260 AliDebug(1, Form(" %2d %1d %2d %1d %2d %7i",
3261 detClus[0], detClus[1], detClus[2], detClus[3], detClus[4], volIndex));
3263 // Get the position in the TOF strip ref system
3264 const TGeoHMatrix *alice2strip = AliGeomManager::GetOrigGlobalMatrix(volIndex);
3265 Double_t ppos[3] = {-1, -1, -1};
3266 alice2strip->MasterToLocal(pos,ppos);
3267 AliDebug(1, Form(" %f %f %f", ppos[0], ppos[1], ppos[2]));
3270 // Get the position in the tracking ref system
3271 const TGeoHMatrix *g2l = AliGeomManager::GetTracking2LocalMatrix(volIndex);
3272 Double_t lpos[3] = {-1, -1, -1};
3273 g2l->MasterToLocal(ppos,lpos);
3274 AliDebug(1, Form(" %f %f %f", lpos[0], lpos[1], lpos[2]));
3275 for (Int_t ii=0; ii<3; ii++) pos[ii] = lpos[ii];
3277 //Get the cluster covariance in the track ref system
3279 for (Int_t ii=0; ii<9; ii++) lcov[ii] = 0.;
3281 //cluster covariance in the local system:
3286 // Evaluation of the ovariance matrix elements
3287 TOFclusterError(/*check,*/ counter, ind, weight, ppos, lcov);
3289 AliDebug(1, Form("lcov[0] = %f, lcov[8] = %f", lcov[0], lcov[8]));
3291 //cluster covariance in the tracking system:
3293 m.SetRotation(lcov);
3295 m.MultiplyLeft(&g2l->Inverse());
3296 Double_t *tcov = m.GetRotationMatrix();
3297 cov[0] = tcov[0]; cov[1] = tcov[1]; cov[2] = tcov[2];
3298 cov[3] = tcov[4]; cov[4] = tcov[5]; cov[5] = tcov[8];
3303 //_____________________________________________________________________________
3305 void AliTOFClusterFinderV1::TOFclusterError(/*Bool_t check,*/ Int_t counter,
3306 Int_t **ind, Double_t *weight,
3307 Double_t ppos[], Double_t lcov[]) const
3313 //lcov[4] = 0.42*0.42/3.; // cm2
3314 // = ( 5*0.025 (gas gaps thikness)
3315 // + 4*0.040 (internal glasses thickness)
3316 // + 0.5*0.160 (internl PCB)
3317 // + 1*0.055 (external red glass))
3320 Float_t *delta2X = new Float_t[counter];
3321 for (Int_t ii=0; ii<counter; ii++)
3323 ((ind[ii][4]-23.5)*AliTOFGeometry::XPad() - ppos[0])*((ind[ii][4]-23.5)*AliTOFGeometry::XPad() - ppos[0]);
3325 Float_t *delta2Z = new Float_t[counter];
3326 for (Int_t ii=0; ii<counter; ii++)
3328 ((ind[ii][3]- 0.5)*AliTOFGeometry::ZPad() - ppos[2])*((ind[ii][3]- 0.5)*AliTOFGeometry::ZPad() - ppos[2]);
3330 for (Int_t ii=0; ii<counter; ii++)
3331 AliDebug(1, Form("x[%d] = %f, z[%d] = %f, weight[%d] = %f",
3332 ii, (ind[ii][4]-23.5)*AliTOFGeometry::XPad(),
3333 ii, (ind[ii][3]- 0.5)*AliTOFGeometry::ZPad(),
3336 AliDebug(1, Form("xMean = %f, zMean = %f",ppos[0], ppos[2]));
3344 if (ind[0][3]==ind[1][3] && TMath::Abs(ind[0][4]-ind[1][4])==1) { //
3346 lcov[8] = 1.02039; // cm2
3347 lcov[0] = 0.0379409; // cm2
3350 lcov[0] = 0.5*0.5; // cm2
3352 if (weight[0]==weight[1])
3353 lcov[0] = 0.0379409; // cm2
3355 lcov[0] = TMath::Mean(counter, delta2X, weight); // cm2
3361 else if (ind[0][4]==ind[1][4] && TMath::Abs(ind[0][3]-ind[1][3])==1) {//
3363 lcov[0] = 0.505499; // cm2
3364 lcov[8] = 0.0422046; // cm2
3367 lcov[8] = 0.5*0.5; // cm2
3369 if (weight[0]==weight[1])
3370 lcov[8] = 0.0422046; // cm2
3372 lcov[8] = TMath::Mean(counter, delta2Z, weight); // cm2
3381 lcov[0] = 0.0290677; // cm2
3382 lcov[8] = 0.0569726; // cm2
3385 lcov[0] = 0.5*0.5; // cm2
3386 lcov[8] = 0.5*0.5; // cm2
3389 if (weight[0]==weight[1] && weight[0]==weight[2]) {
3390 lcov[0] = 0.0290677; // cm2
3391 lcov[8] = 0.0569726; // cm2
3394 lcov[0] = TMath::Mean(counter, delta2X, weight); // cm2
3395 lcov[8] = TMath::Mean(counter, delta2Z, weight); // cm2
3404 lcov[0] = 0.0223807; // cm2
3405 lcov[8] = 0.0438662; // cm2
3408 lcov[0] = 0.5*0.5; // cm2
3409 lcov[8] = 0.5*0.5; // cm2
3412 if (weight[0]==weight[1] && weight[0]==weight[2] && weight[0]==weight[3]) {
3413 lcov[0] = 0.0223807; // cm2
3414 lcov[8] = 0.0438662; // cm2
3417 lcov[0] = TMath::Mean(counter, delta2X, weight); // cm2
3418 lcov[8] = TMath::Mean(counter, delta2Z, weight); // cm2
3432 //_____________________________________________________________________________
3434 Bool_t AliTOFClusterFinderV1::MakeSlewingCorrection(Int_t *detectorIndex,
3440 // This funtion makes the following:
3442 // - if at least one of the three status (Pulser/Noise/HW) is
3443 // bad, is sets the status of electronic channel, corresponding to the
3444 // volume identified by detectorIndex, as kFALSE;
3445 // - if offline calibration is in the valid status, it performs the
3446 // slewing correction. In particular, by taking into account:
3447 // * the measured tot and tof values (tofDigitToT and tofDigitTdc,
3449 // * the six parameters of 5th order polynomial used
3450 // to fit the tofVStot scatter plot,
3451 // it returns the corrected tof value, i.e. tdcCorr value.
3454 Bool_t output = kTRUE;
3459 //AliInfo(" Calibrating TOF Digits: ");
3461 AliTOFChannelOnlineArray *calDelay = fTOFcalib->GetTOFOnlineDelay();
3462 AliTOFChannelOnlineStatusArray *calStatus = fTOFcalib->GetTOFOnlineStatus();
3464 TObjArray *calTOFArrayOffline = fTOFcalib->GetTOFCalArrayOffline();
3466 Int_t index = AliTOFGeometry::GetIndex(detectorIndex);
3468 UChar_t statusPulser = calStatus->GetPulserStatus(index);
3469 UChar_t statusNoise = calStatus->GetNoiseStatus(index);
3470 UChar_t statusHW = calStatus->GetHWStatus(index);
3471 UChar_t status = calStatus->GetStatus(index);
3473 //check the status, also unknown is fine!!!!!!!
3475 AliDebug(2, Form(" Status for channel %d = %d",index, (Int_t)status));
3476 if((statusPulser & AliTOFChannelOnlineStatusArray::kTOFPulserBad)==(AliTOFChannelOnlineStatusArray::kTOFPulserBad)||(statusNoise & AliTOFChannelOnlineStatusArray::kTOFNoiseBad)==(AliTOFChannelOnlineStatusArray::kTOFNoiseBad)||(statusHW & AliTOFChannelOnlineStatusArray::kTOFHWBad)==(AliTOFChannelOnlineStatusArray::kTOFHWBad)){
3477 AliDebug(2, Form(" Bad Status for channel %d",index));
3478 //fTofClusters[ii]->SetStatus(kFALSE); //odd convention, to avoid conflict with calibration objects currently in the db (temporary solution).
3482 AliDebug(2, Form(" Good Status for channel %d",index));
3484 // Get Rough channel online equalization
3485 Double_t roughDelay = (Double_t)calDelay->GetDelay(index); // in ns
3486 AliDebug(2,Form(" channel delay (ns) = %f", roughDelay));
3487 // Get Refined channel offline calibration parameters
3488 TString validity = (TString)fTOFcalib->GetOfflineValidity();
3489 if (validity.CompareTo("valid")==0) {
3490 AliTOFChannelOffline * calChannelOffline = (AliTOFChannelOffline*)calTOFArrayOffline->At(index);
3492 for (jj = 0; jj<6; jj++)
3493 par[jj] = (Double_t)calChannelOffline->GetSlewPar(jj);
3495 AliDebug(2,Form(" Calib Pars = %f, %f, %f, %f, %f, %f ",par[0],par[1],par[2],par[3],par[4],par[5]));
3496 AliDebug(2,Form(" The ToT and Time, uncorr (counts) = %d , %d", tofDigitToT, tofDigitTdc));
3497 Double_t tToT = (Double_t)(tofDigitToT*AliTOFGeometry::ToTBinWidth());
3498 tToT*=1.E-3; //ToT in ns
3499 AliDebug(2,Form(" The ToT and Time, uncorr (ns)= %e, %e",tofDigitTdc*AliTOFGeometry::TdcBinWidth()*1.E-3,tToT));
3500 timeCorr = par[0] + tToT*(par[1] + tToT*(par[2] + tToT*(par[3] + tToT*(par[4] + tToT*par[5])))); // the time correction (ns)
3503 timeCorr = roughDelay; // correction in ns
3505 AliDebug(2,Form(" The ToT and Time, uncorr (ns)= %e, %e",tofDigitTdc*AliTOFGeometry::TdcBinWidth()*1.E-3,tofDigitToT*AliTOFGeometry::ToTBinWidth()));
3506 AliDebug(2,Form(" The time correction (ns) = %f", timeCorr));
3507 timeCorr = (Double_t)(tofDigitTdc)*AliTOFGeometry::TdcBinWidth()*1.E-3-timeCorr;//redefine the time
3509 AliDebug(2,Form(" The channel time, corr (ps)= %e",timeCorr ));
3510 tdcCorr = (Int_t)(timeCorr/AliTOFGeometry::TdcBinWidth()); //the corrected time (tdc counts)
3515 //______________________________________________________________________________
3517 void AliTOFClusterFinderV1::Digits2RecPoints(Int_t iEvent)
3520 // Converts digits to recpoints for TOF
3523 TStopwatch stopwatch;
3526 fRunLoader->GetEvent(iEvent);
3528 AliLoader *localTOFLoader = (AliLoader*)fRunLoader->GetLoader("TOFLoader");
3530 TTree * localTreeD = (TTree*)localTOFLoader->TreeD();
3531 if (localTreeD == 0x0)
3532 AliFatal("Can not get TreeD");
3534 TBranch *branch = localTreeD->GetBranch("TOF");
3536 AliError("Can't get the branch with the TOF digits !");
3540 TTree *localTreeR = (TTree*)localTOFLoader->TreeR();
3541 if (localTreeR == 0x0)
3543 localTOFLoader->MakeTree("R");
3544 localTreeR = localTOFLoader->TreeR();
3547 Digits2RecPoints(localTreeD, localTreeR);
3549 //localTOFLoader = fRunLoader->GetLoader("TOFLoader");
3550 localTOFLoader->WriteRecPoints("OVERWRITE");
3552 AliDebug(1, Form("Execution time to read TOF digits and to write TOF clusters for the event number %d: R:%.4fs C:%.4fs",
3553 iEvent, stopwatch.RealTime(),stopwatch.CpuTime()));
3556 //______________________________________________________________________________
3558 void AliTOFClusterFinderV1::Digits2RecPoints(Int_t iEvent, AliRawReader *rawReader)
3561 // Converts RAW data to recpoints for TOF
3564 TStopwatch stopwatch;
3567 fRunLoader->GetEvent(iEvent);
3569 AliDebug(2,Form(" Event number %2d ", iEvent));
3571 AliLoader *localTOFLoader = (AliLoader*)fRunLoader->GetLoader("TOFLoader");
3573 TTree *localTreeR = localTOFLoader->TreeR();
3575 if (localTreeR == 0x0){
3576 localTOFLoader->MakeTree("R");
3577 localTreeR = localTOFLoader->TreeR();
3580 Digits2RecPoints(rawReader, localTreeR);
3582 AliDebug(1, Form("Execution time to read TOF raw data and to write TOF clusters for the event number %d: R:%.4fs C:%.4fs",
3583 iEvent, stopwatch.RealTime(),stopwatch.CpuTime()));
3586 //______________________________________________________________________________
3588 void AliTOFClusterFinderV1::Raw2Digits(Int_t iEvent, AliRawReader *rawReader)
3591 // Converts RAW data to MC digits for TOF
3595 TStopwatch stopwatch;
3598 fRunLoader->GetEvent(iEvent);
3600 AliDebug(2,Form(" Event number %2d ", iEvent));
3602 AliLoader *localTOFLoader = (AliLoader*)fRunLoader->GetLoader("TOFLoader");
3604 TTree *localTreeD = localTOFLoader->TreeD();
3606 if (localTreeD == 0x0){
3607 localTOFLoader->MakeTree("D");
3608 localTreeD = localTOFLoader->TreeD();
3611 Raw2Digits(rawReader, localTreeD);
3613 AliDebug(1, Form("Execution time to read TOF raw data and to write TOF clusters for the event number %d: R:%.4fs C:%.4fs",
3614 iEvent, stopwatch.RealTime(),stopwatch.CpuTime()));
3617 //______________________________________________________________________________
3619 void AliTOFClusterFinderV1::AverageCalculations(Int_t number, Float_t *interestingX,
3620 Float_t *interestingY, Float_t *interestingZ,
3621 Double_t *interestingTOF, Double_t *interestingTOT,
3622 Double_t *interestingADC, Double_t *interestingWeight,
3623 Int_t *parTOF, Double_t *posClus, Bool_t &check)
3626 // Calculates the mean values for cluster position (x,y,z),
3627 // TOF charge and time
3630 Double_t tofAverage = 0.;
3631 Double_t totAverage = 0.;
3632 Double_t adcAverage = 0.;
3636 for (ii=number-1; ii>=0; ii--) check=check||(interestingWeight[ii]==0 || interestingWeight[ii]==-1);
3640 posClus[0] = TMath::Mean(number, interestingX);
3641 posClus[1] = TMath::Mean(number, interestingY);
3642 posClus[2] = TMath::Mean(number, interestingZ);
3643 tofAverage = TMath::Mean(number, interestingTOF);
3644 totAverage = TMath::Mean(number, interestingTOT);
3645 adcAverage = TMath::Mean(number, interestingADC);
3650 posClus[0] = TMath::Mean(number, interestingX, interestingWeight);
3651 posClus[1] = TMath::Mean(number, interestingY, interestingWeight);
3652 posClus[2] = TMath::Mean(number, interestingZ, interestingWeight);
3653 tofAverage = TMath::Mean(number, interestingTOF, interestingWeight);
3654 totAverage = TMath::Mean(number, interestingTOT, interestingWeight);
3655 adcAverage = TMath::Mean(number, interestingADC, interestingWeight);
3659 parTOF[0] = Int_t(tofAverage);
3660 parTOF[1] = Int_t(totAverage);
3661 parTOF[2] = Int_t(adcAverage);
3662 parTOF[3] = Int_t(tofAverage);//tofND
3663 parTOF[4] = Int_t(tofAverage);//tofRAW