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: AliTOFClusterFinder.cxx,v $
18 Revision 1.31 2007/11/24 14:53:19 zampolli
19 Status flag implemented as UChar_t
21 Revision 1.30 2007/10/04 13:08:52 arcelli
22 updates to comply with AliTOFGeometryV5 becoming AliTOFGeometry
24 Revision 1.29 2007/10/03 10:42:33 arcelli
25 updates to handle new AliTOFcluster, inheriting form AliCluster3D
27 Revision 1.28 2007/05/31 16:06:05 arcelli
28 move instance of AliRawStream outside loop on DDL
30 Revision 1.27 2007/05/02 16:31:49 arcelli
31 Add methods to handle single event reconstruction. retrieval of Calib
32 info moved to AliTOFReconstructor ctor, and passed via a pointer to
35 Revision 1.26 2007/04/30 19:02:24 arcelli
36 hopefully the last refinements for correct type conversion in calibration
38 Revision 1.25 2007/04/30 15:22:17 arcelli
39 Change TOF digit Time, Tot etc to int type
41 Revision 1.24 2007/04/27 11:19:31 arcelli
42 updates for the new decoder
44 Revision 1.23 2007/04/23 16:51:39 decaro
45 Digits-to-raw_data conversion: correction for a more real description
46 (A.De Caro, R.Preghenella)
48 Revision 1.22 2007/04/19 17:26:32 arcelli
49 Fix a bug (add some debug printout
51 Revision 1.21 2007/04/18 17:28:12 arcelli
52 Set the ToT bin width to the one actually used...
54 Revision 1.20 2007/03/09 09:57:23 arcelli
55 Remove a forgotten include of Riostrem
57 Revision 1.19 2007/03/08 15:41:20 arcelli
58 set uncorrected times when filling RecPoints
60 Revision 1.18 2007/03/06 16:31:20 arcelli
61 Add Uncorrected TOF Time signal
63 Revision 1.17 2007/02/28 18:09:11 arcelli
64 Add protection against failed retrieval of the CDB cal object,
65 now Reconstruction exits with AliFatal
67 Revision 1.16 2007/02/20 15:57:00 decaro
68 Raw data update: to read the TOF raw data defined in UNPACKED mode
71 Revision 0.03 2005/07/28 A. De Caro
72 Implement public method
73 Raw2Digits(Int_t, AliRawReader *)
74 to convert digits from raw data in MC digits
77 Revision 0.02 2005/07/27 A. De Caro
78 Implement public method
79 Digits2RecPoint(Int_t)
80 to convert digits in clusters
82 Revision 0.02 2005/07/26 A. De Caro
83 Implement private methods
84 InsertCluster(AliTOFcluster *)
85 FindClusterIndex(Double_t)
86 originally implemented in AliTOFtracker
87 by S. Arcelli and C. Zampolli
89 Revision 0.01 2005/07/25 A. De Caro
90 Implement public methods
91 Digits2RecPoint(AliRawReader *, TTree *)
92 Digits2RecPoint(Int_t, AliRawReader *)
93 to convert raw data in clusters
96 ////////////////////////////////////////////////////////////////
98 // Class for TOF cluster finder //
100 // Starting from Raw Data, create rec points, //
101 // fill TreeR for TOF, //
102 // write TOF.RecPoints.root file //
104 ////////////////////////////////////////////////////////////////
106 #include "Riostream.h"
108 #include "TClonesArray.h"
109 #include "TStopwatch.h"
111 //#include <TGeoManager.h>
112 #include <TGeoMatrix.h>
113 //#include <TGeoPhysicalNode.h>
116 #include "AliLoader.h"
118 #include "AliRawReader.h"
119 #include "AliRunLoader.h"
120 //#include "AliAlignObj.h"
121 #include <AliGeomManager.h>
123 #include "AliTOFcalib.h"
124 #include "AliTOFChannelOnlineArray.h"
125 #include "AliTOFChannelOnlineStatusArray.h"
126 #include "AliTOFChannelOffline.h"
127 #include "AliTOFClusterFinder.h"
128 #include "AliTOFcluster.h"
129 #include "AliTOFdigit.h"
130 #include "AliTOFGeometry.h"
131 #include "AliTOFrawData.h"
133 #include "AliTOFDeltaBCOffset.h"
134 #include "AliTOFCTPLatency.h"
135 #include "AliTOFRunParams.h"
137 //extern TFile *gFile;
139 ClassImp(AliTOFClusterFinder)
141 AliTOFClusterFinder::AliTOFClusterFinder(AliTOFcalib *calib):
142 TTask("AliTOFClusterFinder",""),
147 fDigits(new TClonesArray("AliTOFdigit", 4000)),
148 fRecPoints(new TClonesArray("AliTOFcluster", 4000)),
149 fNumberOfTofClusters(0),
153 fTOFRawStream(AliTOFRawStream())
159 TString validity = (TString)fTOFcalib->GetOfflineValidity();
160 if (validity.CompareTo("valid")==0) {
161 AliInfo(Form(" validity = %s - Using offline calibration parameters",validity.Data()));
163 AliInfo(Form(" validity = %s - Using online calibration parameters",validity.Data()));
168 //______________________________________________________________________________
170 AliTOFClusterFinder::AliTOFClusterFinder(AliRunLoader* runLoader, AliTOFcalib *calib):
171 TTask("AliTOFClusterFinder",""),
172 fRunLoader(runLoader),
173 fTOFLoader(runLoader->GetLoader("TOFLoader")),
176 fDigits(new TClonesArray("AliTOFdigit", 4000)),
177 fRecPoints(new TClonesArray("AliTOFcluster", 4000)),
178 fNumberOfTofClusters(0),
182 fTOFRawStream(AliTOFRawStream())
188 TString validity = (TString)fTOFcalib->GetOfflineValidity();
189 if (validity.CompareTo("valid")==0) {
190 AliInfo(Form(" validity = %s - Using offline calibration parameters",validity.Data()));
192 AliInfo(Form(" validity = %s - Using online calibration parameters",validity.Data()));
197 //------------------------------------------------------------------------
198 AliTOFClusterFinder::AliTOFClusterFinder(const AliTOFClusterFinder &source) :
204 fDigits(source.fDigits),
205 fRecPoints(source.fRecPoints),
206 fNumberOfTofClusters(0),
208 fDecoderVersion(source.fDecoderVersion),
209 fTOFcalib(source.fTOFcalib),
210 fTOFRawStream(source.fTOFRawStream)
215 //------------------------------------------------------------------------
216 AliTOFClusterFinder& AliTOFClusterFinder::operator=(const AliTOFClusterFinder &source)
223 TTask::operator=(source);
224 fDigits=source.fDigits;
225 fRecPoints=source.fRecPoints;
226 fVerbose=source.fVerbose;
227 fDecoderVersion=source.fDecoderVersion;
228 fTOFcalib=source.fTOFcalib;
229 fTOFRawStream=source.fTOFRawStream;
233 //______________________________________________________________________________
235 AliTOFClusterFinder::~AliTOFClusterFinder()
250 fRecPoints->Delete();
255 if (fTofClusters || fNumberOfTofClusters) {
256 for (Int_t ii=0; ii<fNumberOfTofClusters; ii++)
257 if (fTofClusters[ii]) fTofClusters[ii]->Delete();
258 fNumberOfTofClusters=0;
262 //______________________________________________________________________________
264 void AliTOFClusterFinder::Digits2RecPoints(Int_t iEvent)
267 // Converts digits to recpoints for TOF
270 TStopwatch stopwatch;
275 fRunLoader->GetEvent(iEvent);
277 fTreeD = fTOFLoader->TreeD();
280 AliFatal("AliTOFClusterFinder: Can not get TreeD");
284 fTreeD->GetBranch("TOF")->SetAutoDelete(kFALSE);
285 fTreeD->SetBranchAddress("TOF",&fDigits);
289 fTreeR = fTOFLoader->TreeR();
292 fTOFLoader->MakeTree("R");
293 fTreeR = fTOFLoader->TreeR();
296 Int_t bufsize = 32000;
297 fTreeR->Branch("TOF", &fRecPoints, bufsize);
300 Int_t nDigits = fDigits->GetEntriesFast();
301 AliDebug(2,Form("Number of TOF digits: %d",nDigits));
304 Int_t dig[5]={-1,-1,-1,-1,-1}; //cluster detector indeces
305 Int_t parTOF[7]={0,0,0,0,0,0,0}; //The TOF signal parameters
306 Bool_t status=kTRUE; // assume all sim channels ok in the beginning...
307 for (ii=0; ii<nDigits; ii++) {
308 AliTOFdigit *d = (AliTOFdigit*)fDigits->UncheckedAt(ii);
309 dig[0]=d->GetSector();
310 dig[1]=d->GetPlate();
311 dig[2]=d->GetStrip();
315 /* check valid index */
316 if (dig[0]==-1||dig[1]==-1||dig[2]==-1||dig[3]==-1||dig[4]==-1) continue;
318 // Do not reconstruct anything in the holes
319 if (dig[0]==13 || dig[0]==14 || dig[0]==15 ) { // sectors with holes
320 if (dig[1]==2) { // plate with holes
326 AliDebug(2,Form(" %2d %1d %2d %1d %2d ",dig[0],dig[1],dig[2],dig[3],dig[4]));
328 parTOF[0] = d->GetTdc(); //the TDC signal
329 parTOF[1] = d->GetToT(); //the ToT signal
330 parTOF[2] = d->GetAdc(); // the adc charge
331 parTOF[3] = d->GetTdcND(); // non decalibrated sim time
332 parTOF[4] = d->GetTdc(); // raw time, == Tdc time for the moment
333 parTOF[5] = 0; // deltaBC
334 parTOF[6] = 0; // L0-L1 latency
337 UShort_t volIdClus=GetClusterVolIndex(dig);
338 GetClusterPars(dig, posClus,covClus);
339 AliTOFcluster *tofCluster = new AliTOFcluster(volIdClus,posClus[0],posClus[1],posClus[2],covClus[0],covClus[1],covClus[2],covClus[3],covClus[4],covClus[5],d->GetTracks(),dig,parTOF,status,ii);
340 InsertCluster(tofCluster);
344 AliDebug(1,Form("Number of found clusters: %d for event: %d", fNumberOfTofClusters, iEvent));
352 fTOFLoader = fRunLoader->GetLoader("TOFLoader");
353 fTOFLoader->WriteRecPoints("OVERWRITE");
355 AliDebug(1,Form("Execution time to read TOF digits and to write TOF clusters : R:%.4fs C:%.4fs",
356 stopwatch.RealTime(),stopwatch.CpuTime()));
357 if (inholes) AliWarning(Form("Clusters in the TOF holes: %d",inholes));
361 //______________________________________________________________________________
363 void AliTOFClusterFinder::Digits2RecPoints(TTree* digitsTree, TTree* clusterTree)
366 // Converts digits to recpoints for TOF
369 TStopwatch stopwatch;
374 if (digitsTree == 0x0)
376 AliFatal("AliTOFClusterFinder: Can not get TreeD");
380 digitsTree->GetBranch("TOF")->SetAutoDelete(kFALSE);
381 digitsTree->SetBranchAddress("TOF",&fDigits);
384 Int_t bufsize = 32000;
385 clusterTree->Branch("TOF", &fRecPoints, bufsize);
387 digitsTree->GetEvent(0);
388 Int_t nDigits = fDigits->GetEntriesFast();
389 AliDebug(2,Form("Number of TOF digits: %d",nDigits));
392 Int_t dig[5]={-1,-1,-1,-1,-1}; //cluster detector indeces
393 Int_t parTOF[7]={0,0,0,0,0,0,0}; //The TOF signal parameters
394 Bool_t status=kTRUE; // assume all sim channels ok in the beginning...
395 for (ii=0; ii<nDigits; ii++) {
396 AliTOFdigit *d = (AliTOFdigit*)fDigits->UncheckedAt(ii);
397 dig[0]=d->GetSector();
398 dig[1]=d->GetPlate();
399 dig[2]=d->GetStrip();
403 /* check valid index */
404 if (dig[0]==-1||dig[1]==-1||dig[2]==-1||dig[3]==-1||dig[4]==-1) continue;
406 // Do not reconstruct anything in the holes
407 if (dig[0]==13 || dig[0]==14 || dig[0]==15 ) { // sectors with holes
408 if (dig[1]==2) { // plate with holes
414 // AliDebug(2,Form(" %2d %1d %2d %1d %2d ",dig[0],dig[1],dig[2],dig[3],dig[4]));
416 parTOF[0] = d->GetTdc(); //the TDC signal
417 parTOF[1] = d->GetToT(); //the ToT signal
418 parTOF[2] = d->GetAdc(); // the adc charge
419 parTOF[3] = d->GetTdcND(); // non decalibrated sim time
420 parTOF[4] = d->GetTdc(); // raw time, == Tdc time for the moment
421 parTOF[5] = 0; // deltaBC
422 parTOF[6] = 0; // L0-L1 latency
426 UShort_t volIdClus=GetClusterVolIndex(dig);
427 GetClusterPars(dig,posClus,covClus);
428 AliTOFcluster *tofCluster = new AliTOFcluster(volIdClus,posClus[0],posClus[1],posClus[2],covClus[0],covClus[1],covClus[2],covClus[3],covClus[4],covClus[5],d->GetTracks(),dig,parTOF,status,ii);
429 InsertCluster(tofCluster);
433 AliDebug(1,Form("Number of found clusters: %d", fNumberOfTofClusters));
441 AliDebug(1,Form("Execution time to read TOF digits and to write TOF clusters : R:%.4fs C:%.4fs",
442 stopwatch.RealTime(),stopwatch.CpuTime()));
443 if (inholes) AliWarning(Form("Clusters in the TOF holes: %d",inholes));
446 //______________________________________________________________________________
448 void AliTOFClusterFinder::Digits2RecPoints(AliRawReader *rawReader,
452 // Converts RAW data to recpoints for TOF
455 TStopwatch stopwatch;
460 const Int_t kDDL = AliDAQ::NumberOfDdls("TOF");
464 Int_t bufsize = 32000;
465 clustersTree->Branch("TOF", &fRecPoints, bufsize);
467 TClonesArray * clonesRawData;
470 Int_t detectorIndex[5];
474 if (fVerbose==2) ftxt.open("TOFdigitsRead.txt",ios::app);
476 fTOFRawStream.Clear();
477 fTOFRawStream.SetRawReader(rawReader);
479 if (fDecoderVersion == 1) {
480 AliInfo("Using New Decoder");
482 else if (fDecoderVersion == 2) {
483 AliInfo("Using Enhanced Decoder");
486 AliInfo("Using Old Decoder");
490 for (indexDDL = 0; indexDDL < kDDL; indexDDL++) {
493 if (fDecoderVersion == 1) {
494 fTOFRawStream.LoadRawDataBuffers(indexDDL,fVerbose);
496 else if (fDecoderVersion == 2) {
497 fTOFRawStream.LoadRawDataBuffersV2(indexDDL,fVerbose);
500 fTOFRawStream.LoadRawData(indexDDL);
503 clonesRawData = (TClonesArray*)fTOFRawStream.GetRawData();
505 for (Int_t iRawData = 0; iRawData<clonesRawData->GetEntriesFast(); iRawData++) {
507 AliTOFrawData *tofRawDatum = (AliTOFrawData*)clonesRawData->UncheckedAt(iRawData);
509 //if (tofRawDatum->GetTOT()==-1 || tofRawDatum->GetTOF()==-1) continue;
510 if (tofRawDatum->GetTOF()==-1) continue;
513 if (indexDDL<10) ftxt << " " << indexDDL;
514 else ftxt << " " << indexDDL;
515 if (tofRawDatum->GetTRM()<10) ftxt << " " << tofRawDatum->GetTRM();
516 else ftxt << " " << tofRawDatum->GetTRM();
517 ftxt << " " << tofRawDatum->GetTRMchain();
518 if (tofRawDatum->GetTDC()<10) ftxt << " " << tofRawDatum->GetTDC();
519 else ftxt << " " << tofRawDatum->GetTDC();
520 ftxt << " " << tofRawDatum->GetTDCchannel();
523 fTOFRawStream.EquipmentId2VolumeId(indexDDL, tofRawDatum->GetTRM(), tofRawDatum->GetTRMchain(),
524 tofRawDatum->GetTDC(), tofRawDatum->GetTDCchannel(), detectorIndex);
525 dummy = detectorIndex[3];
526 detectorIndex[3] = detectorIndex[4];
527 detectorIndex[4] = dummy;
530 if (detectorIndex[0]<10) ftxt << " -> " << detectorIndex[0];
531 else ftxt << " -> " << detectorIndex[0];
532 ftxt << " " << detectorIndex[1];
533 if (detectorIndex[2]<10) ftxt << " " << detectorIndex[2];
534 else ftxt << " " << detectorIndex[2];
535 ftxt << " " << detectorIndex[3];
536 if (detectorIndex[4]<10) ftxt << " " << detectorIndex[4];
537 else ftxt << " " << detectorIndex[4];
540 /* check valid index */
541 if (detectorIndex[0]==-1||detectorIndex[1]==-1||detectorIndex[2]==-1||detectorIndex[3]==-1||detectorIndex[4]==-1) continue;
543 // Do not reconstruct anything in the holes
544 if (detectorIndex[0]==13 || detectorIndex[0]==14 || detectorIndex[0]==15 ) { // sectors with holes
545 if (detectorIndex[1]==2) { // plate with holes
551 parTOF[0] = tofRawDatum->GetTOF(); //TDC
552 parTOF[1] = tofRawDatum->GetTOT(); // TOT
553 parTOF[2] = tofRawDatum->GetTOT(); //ADC==TOF
554 parTOF[3] = 0;//raw data: no track of undecalib sim time
555 parTOF[4] = tofRawDatum->GetTOF(); // RAW time
556 parTOF[5] = tofRawDatum->GetDeltaBC(); // deltaBC
557 parTOF[6] = tofRawDatum->GetL0L1Latency(); // L0-L1 latency
560 UShort_t volIdClus=GetClusterVolIndex(detectorIndex);
561 Int_t lab[3]={-1,-1,-1};
563 GetClusterPars(detectorIndex,posClus,covClus);
564 AliTOFcluster *tofCluster = new AliTOFcluster(volIdClus,posClus[0],posClus[1],posClus[2],covClus[0],covClus[1],covClus[2],covClus[3],covClus[4],covClus[5],lab,detectorIndex,parTOF,status,-1);
565 InsertCluster(tofCluster);
568 if (parTOF[1]<10)ftxt << " " << parTOF[1];
569 else if (parTOF[1]>=10 && parTOF[1]<100) ftxt << " " << parTOF[1];
570 else ftxt << " " << parTOF[1];
571 if (parTOF[0]<10) ftxt << " " << parTOF[0] << endl;
572 else if (parTOF[0]>=10 && parTOF[0]<100) ftxt << " " << parTOF[0] << endl;
573 else if (parTOF[0]>=100 && parTOF[0]<1000) ftxt << " " << parTOF[0] << endl;
574 else ftxt << " " << parTOF[3] << endl;
577 } // closed loop on TOF raw data per current DDL file
579 clonesRawData->Clear("C");
581 } // closed loop on DDL index
583 if (fVerbose==2) ftxt.close();
585 AliDebug(1,Form("Number of found clusters: %d", fNumberOfTofClusters));
587 CalibrateRecPoint(rawReader->GetTimestamp());
590 clustersTree->Fill();
594 AliDebug(1, Form("Execution time to read TOF raw data and to write TOF clusters : R:%.4fs C:%.4fs",
595 stopwatch.RealTime(),stopwatch.CpuTime()));
596 if (inholes) AliWarning(Form("Clusters in the TOF holes: %d",inholes));
599 //______________________________________________________________________________
601 void AliTOFClusterFinder::Digits2RecPoints(Int_t iEvent, AliRawReader *rawReader)
604 // Converts RAW data to recpoints for TOF
607 TStopwatch stopwatch;
612 const Int_t kDDL = AliDAQ::NumberOfDdls("TOF");
614 fRunLoader->GetEvent(iEvent);
616 AliDebug(2,Form(" Event number %2d ", iEvent));
618 fTreeR = fTOFLoader->TreeR();
621 fTOFLoader->MakeTree("R");
622 fTreeR = fTOFLoader->TreeR();
625 Int_t bufsize = 32000;
626 fTreeR->Branch("TOF", &fRecPoints, bufsize);
628 TClonesArray * clonesRawData;
632 Int_t detectorIndex[5] = {-1, -1, -1, -1, -1};
635 if (fVerbose==2) ftxt.open("TOFdigitsRead.txt",ios::app);
637 fTOFRawStream.Clear();
638 fTOFRawStream.SetRawReader(rawReader);
640 if (fDecoderVersion == 1) {
641 AliInfo("Using New Decoder");
643 else if (fDecoderVersion == 2) {
644 AliInfo("Using Enhanced Decoder");
647 AliInfo("Using Old Decoder");
651 for (indexDDL = 0; indexDDL < kDDL; indexDDL++) {
654 if (fDecoderVersion == 1) {
655 fTOFRawStream.LoadRawDataBuffers(indexDDL,fVerbose);
657 else if (fDecoderVersion == 2) {
658 fTOFRawStream.LoadRawDataBuffersV2(indexDDL,fVerbose);
661 fTOFRawStream.LoadRawData(indexDDL);
664 clonesRawData = (TClonesArray*)fTOFRawStream.GetRawData();
666 for (Int_t iRawData = 0; iRawData<clonesRawData->GetEntriesFast(); iRawData++) {
668 AliTOFrawData *tofRawDatum = (AliTOFrawData*)clonesRawData->UncheckedAt(iRawData);
670 //if (tofRawDatum->GetTOT()==-1 || tofRawDatum->GetTOF()==-1) continue;
671 if (tofRawDatum->GetTOF()==-1) continue;
674 if (indexDDL<10) ftxt << " " << indexDDL;
675 else ftxt << " " << indexDDL;
676 if (tofRawDatum->GetTRM()<10) ftxt << " " << tofRawDatum->GetTRM();
677 else ftxt << " " << tofRawDatum->GetTRM();
678 ftxt << " " << tofRawDatum->GetTRMchain();
679 if (tofRawDatum->GetTDC()<10) ftxt << " " << tofRawDatum->GetTDC();
680 else ftxt << " " << tofRawDatum->GetTDC();
681 ftxt << " " << tofRawDatum->GetTDCchannel();
684 fTOFRawStream.EquipmentId2VolumeId(indexDDL, tofRawDatum->GetTRM(), tofRawDatum->GetTRMchain(),
685 tofRawDatum->GetTDC(), tofRawDatum->GetTDCchannel(), detectorIndex);
686 dummy = detectorIndex[3];
687 detectorIndex[3] = detectorIndex[4];
688 detectorIndex[4] = dummy;
691 if (detectorIndex[0]<10) ftxt << " -> " << detectorIndex[0];
692 else ftxt << " -> " << detectorIndex[0];
693 ftxt << " " << detectorIndex[1];
694 if (detectorIndex[2]<10) ftxt << " " << detectorIndex[2];
695 else ftxt << " " << detectorIndex[2];
696 ftxt << " " << detectorIndex[3];
697 if (detectorIndex[4]<10) ftxt << " " << detectorIndex[4];
698 else ftxt << " " << detectorIndex[4];
701 /* check valid index */
702 if (detectorIndex[0]==-1||detectorIndex[1]==-1||detectorIndex[2]==-1||detectorIndex[3]==-1||detectorIndex[4]==-1) continue;
704 // Do not reconstruct anything in the holes
705 if (detectorIndex[0]==13 || detectorIndex[0]==14 || detectorIndex[0]==15 ) { // sectors with holes
706 if (detectorIndex[1]==2) { // plate with holes
712 parTOF[0] = tofRawDatum->GetTOF(); // TDC
713 parTOF[1] = tofRawDatum->GetTOT(); // TOT
714 parTOF[2] = tofRawDatum->GetTOT(); // raw data have ADC=TOT
715 parTOF[3] = 0; //raw data: no track of the undecalib sim time
716 parTOF[4] = tofRawDatum->GetTOF(); // Raw time == TDC
717 parTOF[5] = tofRawDatum->GetDeltaBC(); // deltaBC
718 parTOF[6] = tofRawDatum->GetL0L1Latency(); // L0-L1 latency
721 UShort_t volIdClus=GetClusterVolIndex(detectorIndex);
722 Int_t lab[3]={-1,-1,-1};
724 GetClusterPars(detectorIndex,posClus,covClus);
725 AliTOFcluster *tofCluster = new AliTOFcluster(volIdClus,posClus[0],posClus[1],posClus[2],covClus[0],covClus[1],covClus[2],covClus[3],covClus[4],covClus[5],lab,detectorIndex,parTOF,status,-1);
726 InsertCluster(tofCluster);
729 if (parTOF[1]<10)ftxt << " " << parTOF[1];
730 else if (parTOF[1]>=10 && parTOF[1]<100) ftxt << " " << parTOF[1];
731 else ftxt << " " << parTOF[1];
732 if (parTOF[0]<10) ftxt << " " << parTOF[0] << endl;
733 else if (parTOF[0]>=10 && parTOF[0]<100) ftxt << " " << parTOF[0] << endl;
734 else if (parTOF[0]>=100 && parTOF[0]<1000) ftxt << " " << parTOF[0] << endl;
735 else ftxt << " " << parTOF[3] << endl;
738 } // closed loop on TOF raw data per current DDL file
740 clonesRawData->Clear("C");
742 } // closed loop on DDL index
744 if (fVerbose==2) ftxt.close();
746 AliDebug(1,Form("Number of found clusters: %d for event: %d", fNumberOfTofClusters, iEvent));
748 CalibrateRecPoint(rawReader->GetTimestamp());
754 fTOFLoader = fRunLoader->GetLoader("TOFLoader");
755 fTOFLoader->WriteRecPoints("OVERWRITE");
757 AliDebug(1, Form("Execution time to read TOF raw data and to write TOF clusters : R:%.4fs C:%.4fs",
758 stopwatch.RealTime(),stopwatch.CpuTime()));
759 if (inholes) AliWarning(Form("Clusters in the TOF holes: %d",inholes));
762 //______________________________________________________________________________
764 void AliTOFClusterFinder::Raw2Digits(Int_t iEvent, AliRawReader *rawReader)
767 // Converts RAW data to MC digits for TOF
769 // (temporary solution)
772 TStopwatch stopwatch;
775 const Int_t kDDL = AliTOFGeometry::NDDL()*AliTOFGeometry::NSectors();
777 fRunLoader->GetEvent(iEvent);
779 fTreeD = fTOFLoader->TreeD();
782 AliInfo("TreeD re-creation");
784 fTOFLoader->MakeTree("D");
785 fTreeD = fTOFLoader->TreeD();
788 Int_t bufsize = 32000;
790 fTreeD->Branch("TOF", &fDigits, bufsize);
792 fRunLoader->GetEvent(iEvent);
794 AliDebug(2,Form(" Event number %2d ", iEvent));
796 TClonesArray * clonesRawData;
800 Int_t detectorIndex[5];
803 fTOFRawStream.Clear();
804 fTOFRawStream.SetRawReader(rawReader);
806 if (fDecoderVersion == 1) {
807 AliInfo("Using New Decoder");
809 else if (fDecoderVersion == 2) {
810 AliInfo("Using Enhanced Decoder");
813 AliInfo("Using Old Decoder");
817 for (indexDDL = 0; indexDDL < kDDL; indexDDL++) {
820 if (fDecoderVersion == 1) {
821 fTOFRawStream.LoadRawDataBuffers(indexDDL,fVerbose);
823 else if (fDecoderVersion == 2) {
824 fTOFRawStream.LoadRawDataBuffersV2(indexDDL,fVerbose);
827 fTOFRawStream.LoadRawData(indexDDL);
830 clonesRawData = (TClonesArray*)fTOFRawStream.GetRawData();
832 for (Int_t iRawData = 0; iRawData<clonesRawData->GetEntriesFast(); iRawData++) {
834 AliTOFrawData *tofRawDatum = (AliTOFrawData*)clonesRawData->UncheckedAt(iRawData);
836 //if (!tofRawDatum->GetTOT() || !tofRawDatum->GetTOF()) continue;
837 if (tofRawDatum->GetTOF()==-1) continue;
839 fTOFRawStream.EquipmentId2VolumeId(indexDDL, tofRawDatum->GetTRM(), tofRawDatum->GetTRMchain(),
840 tofRawDatum->GetTDC(), tofRawDatum->GetTDCchannel(), detectorIndex);
841 dummy = detectorIndex[3];
842 detectorIndex[3] = detectorIndex[4];
843 detectorIndex[4] = dummy;
845 digit[0] = fTOFRawStream.GetTofBin();
846 digit[1] = fTOFRawStream.GetToTbin();
847 digit[2] = fTOFRawStream.GetToTbin();
850 Int_t tracknum[3]={-1,-1,-1};
852 TClonesArray &aDigits = *fDigits;
853 Int_t last=fDigits->GetEntriesFast();
854 new (aDigits[last]) AliTOFdigit(tracknum, detectorIndex, digit);
858 clonesRawData->Clear("C");
864 fTOFLoader = fRunLoader->GetLoader("TOFLoader");
865 fTOFLoader->WriteDigits("OVERWRITE");
867 AliDebug(1, Form("Execution time to read TOF raw data and to write TOF clusters : R:%.2fs C:%.2fs",
868 stopwatch.RealTime(),stopwatch.CpuTime()));
872 //______________________________________________________________________________
874 void AliTOFClusterFinder::Raw2Digits(AliRawReader *rawReader, TTree* digitsTree)
877 // Converts RAW data to MC digits for TOF for the current event
881 TStopwatch stopwatch;
884 const Int_t kDDL = AliTOFGeometry::NDDL()*AliTOFGeometry::NSectors();
888 AliError("No input digits Tree");
892 Int_t bufsize = 32000;
893 digitsTree->Branch("TOF", &fDigits, bufsize);
895 TClonesArray * clonesRawData;
898 Int_t detectorIndex[5];
901 fTOFRawStream.Clear();
902 fTOFRawStream.SetRawReader(rawReader);
904 if (fDecoderVersion == 1) {
905 AliInfo("Using New Decoder");
907 else if (fDecoderVersion == 2) {
908 AliInfo("Using Enhanced Decoder");
911 AliInfo("Using Old Decoder");
915 for (indexDDL = 0; indexDDL < kDDL; indexDDL++) {
918 if (fDecoderVersion == 1) {
919 fTOFRawStream.LoadRawDataBuffers(indexDDL,fVerbose);
921 else if (fDecoderVersion == 2) {
922 fTOFRawStream.LoadRawDataBuffersV2(indexDDL,fVerbose);
925 fTOFRawStream.LoadRawData(indexDDL);
928 clonesRawData = (TClonesArray*)fTOFRawStream.GetRawData();
930 for (Int_t iRawData = 0; iRawData<clonesRawData->GetEntriesFast(); iRawData++) {
932 AliTOFrawData *tofRawDatum = (AliTOFrawData*)clonesRawData->UncheckedAt(iRawData);
934 //if (!tofRawDatum->GetTOT() || !tofRawDatum->GetTOF()) continue;
935 if (tofRawDatum->GetTOF()==-1) continue;
937 fTOFRawStream.EquipmentId2VolumeId(indexDDL, tofRawDatum->GetTRM(), tofRawDatum->GetTRMchain(),
938 tofRawDatum->GetTDC(), tofRawDatum->GetTDCchannel(), detectorIndex);
939 dummy = detectorIndex[3];
940 detectorIndex[3] = detectorIndex[4];
941 detectorIndex[4] = dummy;
943 digit[0] = fTOFRawStream.GetTofBin();
944 digit[1] = fTOFRawStream.GetToTbin();
945 digit[2] = fTOFRawStream.GetToTbin();
948 Int_t tracknum[3]={-1,-1,-1};
950 TClonesArray &aDigits = *fDigits;
951 Int_t last=fDigits->GetEntriesFast();
952 new (aDigits[last]) AliTOFdigit(tracknum, detectorIndex, digit);
956 clonesRawData->Clear("C");
962 AliDebug(1, Form("Got %d digits: ", fDigits->GetEntries()));
963 AliDebug(1, Form("Execution time to read TOF raw data and fill TOF digit tree : R:%.2fs C:%.2fs",
964 stopwatch.RealTime(),stopwatch.CpuTime()));
967 //______________________________________________________________________________
969 Int_t AliTOFClusterFinder::InsertCluster(AliTOFcluster *tofCluster) {
970 //---------------------------------------------------------------------------//
971 // This function adds a TOF cluster to the array of TOF clusters sorted in Z //
972 //---------------------------------------------------------------------------//
973 if (fNumberOfTofClusters==kTofMaxCluster) {
974 AliError("Too many clusters !");
978 if (fNumberOfTofClusters==0) {
979 fTofClusters[fNumberOfTofClusters++] = tofCluster;
983 Int_t ii = FindClusterIndex(tofCluster->GetZ());
984 memmove(fTofClusters+ii+1 ,fTofClusters+ii,(fNumberOfTofClusters-ii)*sizeof(AliTOFcluster*));
985 fTofClusters[ii] = tofCluster;
986 fNumberOfTofClusters++;
991 //_________________________________________________________________________
993 Int_t AliTOFClusterFinder::FindClusterIndex(Double_t z) const {
994 //--------------------------------------------------------------------
995 // This function returns the index of the nearest cluster in z
996 //--------------------------------------------------------------------
997 if (fNumberOfTofClusters==0) return 0;
998 if (z <= fTofClusters[0]->GetZ()) return 0;
999 if (z > fTofClusters[fNumberOfTofClusters-1]->GetZ()) return fNumberOfTofClusters;
1000 Int_t b = 0, e = fNumberOfTofClusters-1, m = (b+e)/2;
1001 for (; b<e; m=(b+e)/2) {
1002 if (z > fTofClusters[m]->GetZ()) b=m+1;
1009 //_________________________________________________________________________
1011 void AliTOFClusterFinder::FillRecPoint()
1014 // Copy the global array of AliTOFcluster, i.e. fTofClusters (sorted
1015 // in Z) in the global TClonesArray of AliTOFcluster,
1021 Int_t detectorIndex[5];
1023 Int_t trackLabels[3];
1024 Int_t digitIndex = -1;
1025 Bool_t status=kTRUE;
1027 TClonesArray &lRecPoints = *fRecPoints;
1029 for (ii=0; ii<fNumberOfTofClusters; ii++) {
1031 digitIndex = fTofClusters[ii]->GetIndex();
1032 for(jj=0; jj<5; jj++) detectorIndex[jj] = fTofClusters[ii]->GetDetInd(jj);
1033 for(jj=0; jj<3; jj++) trackLabels[jj] = fTofClusters[ii]->GetLabel(jj);
1034 parTOF[0] = fTofClusters[ii]->GetTDC(); // TDC
1035 parTOF[1] = fTofClusters[ii]->GetToT(); // TOT
1036 parTOF[2] = fTofClusters[ii]->GetADC(); // ADC=TOT
1037 parTOF[3] = fTofClusters[ii]->GetTDCND(); // TDCND
1038 parTOF[4] = fTofClusters[ii]->GetTDCRAW();//RAW
1039 parTOF[5] = fTofClusters[ii]->GetDeltaBC();//deltaBC
1040 parTOF[6] = fTofClusters[ii]->GetL0L1Latency();//L0-L1 latency
1041 status=fTofClusters[ii]->GetStatus();
1042 Double_t posClus[3];
1043 Double_t covClus[6];
1044 UShort_t volIdClus=GetClusterVolIndex(detectorIndex);
1045 GetClusterPars(detectorIndex,posClus,covClus);
1046 new(lRecPoints[ii]) AliTOFcluster(volIdClus,posClus[0],posClus[1],posClus[2],covClus[0],covClus[1],covClus[2],covClus[3],covClus[4],covClus[5],trackLabels,detectorIndex, parTOF,status,digitIndex);
1048 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",
1049 ii, volIdClus, posClus[0], posClus[1], posClus[2],
1050 fTofClusters[ii]->GetSigmaX2(),
1051 fTofClusters[ii]->GetSigmaXY(),
1052 fTofClusters[ii]->GetSigmaXZ(),
1053 fTofClusters[ii]->GetSigmaY2(),
1054 fTofClusters[ii]->GetSigmaYZ(),
1055 fTofClusters[ii]->GetSigmaZ2(),
1056 trackLabels[0], trackLabels[1], trackLabels[2],
1057 detectorIndex[0], detectorIndex[1], detectorIndex[2], detectorIndex[3], detectorIndex[4],
1058 parTOF[0], parTOF[1], parTOF[2], parTOF[3], parTOF[4],
1059 status, digitIndex));
1061 } // loop on clusters
1065 //_________________________________________________________________________
1068 * OLD CALIBRATE REC POINTS FUNCTION
1072 void AliTOFClusterFinder::CalibrateRecPoint(UInt_t timestamp)
1075 // Copy the global array of AliTOFcluster, i.e. fTofClusters (sorted
1076 // in Z) in the global TClonesArray of AliTOFcluster,
1082 Int_t detectorIndex[5];
1083 Int_t digitIndex = -1;
1087 Float_t tdcLatencyWindow;
1088 AliDebug(1," Calibrating TOF Clusters");
1090 AliTOFChannelOnlineArray *calDelay = fTOFcalib->GetTOFOnlineDelay();
1091 AliTOFChannelOnlineStatusArray *calStatus = fTOFcalib->GetTOFOnlineStatus();
1092 TObjArray *calTOFArrayOffline = fTOFcalib->GetTOFCalArrayOffline();
1094 AliTOFDeltaBCOffset *deltaBCOffsetObj = fTOFcalib->GetDeltaBCOffset();
1095 Int_t deltaBCOffset = deltaBCOffsetObj->GetDeltaBCOffset();
1096 AliTOFCTPLatency *ctpLatencyObj = fTOFcalib->GetCTPLatency();
1097 Float_t ctpLatency = ctpLatencyObj->GetCTPLatency();
1098 AliTOFRunParams *runParamsObj = fTOFcalib->GetRunParams();
1099 Float_t t0 = runParamsObj->EvalT0(timestamp);
1101 TString validity = (TString)fTOFcalib->GetOfflineValidity();
1102 Int_t calibration = -1;
1103 if (validity.CompareTo("valid")==0) {
1104 //AliInfo(Form(" validity = %s - Using offline calibration parameters",validity.Data()));
1107 //AliInfo(Form(" validity = %s - Using online calibration parameters",validity.Data()));
1111 for (ii=0; ii<fNumberOfTofClusters; ii++) {
1112 digitIndex = fTofClusters[ii]->GetIndex();
1113 for(jj=0; jj<5; jj++) detectorIndex[jj] = fTofClusters[ii]->GetDetInd(jj);
1115 Int_t index = AliTOFGeometry::GetIndex(detectorIndex);
1117 UChar_t statusPulser=calStatus->GetPulserStatus(index);
1118 UChar_t statusNoise=calStatus->GetNoiseStatus(index);
1119 UChar_t statusHW=calStatus->GetHWStatus(index);
1120 UChar_t status=calStatus->GetStatus(index);
1121 tdcLatencyWindow = calStatus->GetLatencyWindow(index) * 1.e3; /* ns -> ps */
1123 //check the status, also unknown is fine!!!!!!!
1125 AliDebug(2, Form(" Status for channel %d = %d",index, (Int_t)status));
1126 if((statusPulser & AliTOFChannelOnlineStatusArray::kTOFPulserBad)==(AliTOFChannelOnlineStatusArray::kTOFPulserBad)||(statusNoise & AliTOFChannelOnlineStatusArray::kTOFNoiseBad)==(AliTOFChannelOnlineStatusArray::kTOFNoiseBad)||(statusHW & AliTOFChannelOnlineStatusArray::kTOFHWBad)==(AliTOFChannelOnlineStatusArray::kTOFHWBad)){
1127 AliDebug(2, Form(" Bad Status for channel %d",index));
1128 fTofClusters[ii]->SetStatus(kFALSE); //odd convention, to avoid conflict with calibration objects currently in the db (temporary solution).
1131 AliDebug(2, Form(" Good Status for channel %d",index));
1133 // Get Rough channel online equalization
1134 Double_t roughDelay=(Double_t)calDelay->GetDelay(index); // in ns
1135 AliDebug(2,Form(" channel delay (ns) = %f", roughDelay));
1136 // Get Refined channel offline calibration parameters
1137 if (calibration ==1){
1138 AliTOFChannelOffline * calChannelOffline = (AliTOFChannelOffline*)calTOFArrayOffline->At(index);
1140 for (Int_t j = 0; j<6; j++){
1141 par[j]=(Double_t)calChannelOffline->GetSlewPar(j);
1143 AliDebug(2,Form(" Calib Pars = %f, %f, %f, %f, %f, %f ",par[0],par[1],par[2],par[3],par[4],par[5]));
1144 AliDebug(2,Form(" The ToT and Time, uncorr (counts) = %d , %d", fTofClusters[ii]->GetToT(),fTofClusters[ii]->GetTDC()));
1145 tToT = (Double_t)(fTofClusters[ii]->GetToT()*AliTOFGeometry::ToTBinWidth());
1146 tToT*=1.E-3; //ToT in ns
1148 /* check TOT limits and set new TOT in case */
1149 if (tToT < AliTOFGeometry::SlewTOTMin()) tToT = AliTOFGeometry::SlewTOTMin();
1150 if (tToT > AliTOFGeometry::SlewTOTMax()) tToT = AliTOFGeometry::SlewTOTMax();
1152 AliDebug(2,Form(" The ToT and Time, uncorr (ns)= %e, %e",fTofClusters[ii]->GetTDC()*AliTOFGeometry::TdcBinWidth()*1.E-3,tToT));
1153 timeCorr=par[0]+par[1]*tToT+par[2]*tToT*tToT+par[3]*tToT*tToT*tToT+par[4]*tToT*tToT*tToT*tToT+par[5]*tToT*tToT*tToT*tToT*tToT; // the time correction (ns)
1156 timeCorr = roughDelay; // correction in ns
1158 AliDebug(2,Form(" The ToT and Time, uncorr (ns)= %e, %e",fTofClusters[ii]->GetTDC()*AliTOFGeometry::TdcBinWidth()*1.E-3,fTofClusters[ii]->GetToT()*AliTOFGeometry::ToTBinWidth()));
1159 AliDebug(2,Form(" The time correction (ns) = %f", timeCorr));
1160 timeCorr=(Double_t)(fTofClusters[ii]->GetTDC())*AliTOFGeometry::TdcBinWidth()*1.E-3-timeCorr;//redefine the time
1162 AliDebug(2,Form(" The channel time, corr (ps)= %e",timeCorr ));
1164 /* here timeCorr should be already corrected for calibration.
1165 * we now go into further corrections keeping in mind that timeCorr
1168 * the following corrections are performed in this way:
1170 * time = timeRaw - deltaBC + L0L1Latency + CTPLatency - TDCLatencyWindow - T0
1174 AliDebug(2, Form("applying further corrections (DeltaBC): DeltaBC=%d (BC bins), DeltaBCoffset=%d (BC bins)", fTofClusters[ii]->GetDeltaBC(), deltaBCOffset));
1175 AliDebug(2, Form("applying further corrections (L0L1Latency): L0L1Latency=%d (BC bins)", fTofClusters[ii]->GetL0L1Latency()));
1176 AliDebug(2, Form("applying further corrections (CTPLatency): CTPLatency=%f (ps)", ctpLatency));
1177 AliDebug(2, Form("applying further corrections (TDCLatencyWindow): TDCLatencyWindow=%f (ps)", tdcLatencyWindow));
1178 AliDebug(2, Form("applying further corrections (T0): T0=%f (ps)", t0));
1180 /* deltaBC correction (inhibited for the time being) */
1181 // timeCorr -= (fTofClusters[ii]->GetDeltaBC() - deltaBCOffset) * AliTOFGeometry::BunchCrossingBinWidth();
1182 /* L0L1-latency correction */
1183 timeCorr += fTofClusters[ii]->GetL0L1Latency() * AliTOFGeometry::BunchCrossingBinWidth();
1184 /* CTP-latency correction (from OCDB) */
1185 timeCorr += ctpLatency;
1186 /* TDC latency-window correction (from OCDB) */
1187 timeCorr -= tdcLatencyWindow;
1188 /* T0 correction (from OCDB) */
1192 * end of furhter corrections
1195 tdcCorr=(Int_t)(timeCorr/AliTOFGeometry::TdcBinWidth()); //the corrected time (tdc counts)
1196 fTofClusters[ii]->SetTDC(tdcCorr);
1197 } // loop on clusters
1202 //_________________________________________________________________________
1204 void AliTOFClusterFinder::CalibrateRecPoint(UInt_t timestamp)
1207 // Copy the global array of AliTOFcluster, i.e. fTofClusters (sorted
1208 // in Z) in the global TClonesArray of AliTOFcluster,
1212 Int_t detectorIndex[5];
1213 Double_t time, tot, corr;
1214 Int_t deltaBC, l0l1, tdcBin;
1215 for (Int_t ii = 0; ii < fNumberOfTofClusters; ii++) {
1216 for(Int_t jj = 0; jj < 5; jj++) detectorIndex[jj] = fTofClusters[ii]->GetDetInd(jj);
1218 Int_t index = AliTOFGeometry::GetIndex(detectorIndex);
1220 /* check channel enabled */
1221 if (!fTOFcalib->IsChannelEnabled(index)) fTofClusters[ii]->SetStatus(kFALSE);
1223 /* get cluster info */
1224 time = fTofClusters[ii]->GetTDC() * AliTOFGeometry::TdcBinWidth(); /* ps */
1225 tot = fTofClusters[ii]->GetToT() * AliTOFGeometry::ToTBinWidth() * 1.e-3; /* ns */
1226 deltaBC = fTofClusters[ii]->GetDeltaBC();
1227 l0l1 = fTofClusters[ii]->GetL0L1Latency();
1229 /* get correction */
1230 corr = fTOFcalib->GetTimeCorrection(index, tot, deltaBC, l0l1, timestamp); /* ps */
1231 AliDebug(2, Form("calibrate index %d: time=%f (ps) tot=%f (ns) deltaBC=%d l0l1=%d timestamp=%d corr=%f (ps)", index, time, tot, deltaBC, l0l1, timestamp, corr));
1233 /* apply time correction */
1236 /* convert in TDC bins and set cluster */
1237 //tdcBin = (Int_t)(time / AliTOFGeometry::TdcBinWidth()); //the corrected time (tdc counts)
1238 tdcBin = TMath::Nint(time / AliTOFGeometry::TdcBinWidth()); //the corrected time (tdc counts)
1239 fTofClusters[ii]->SetTDC(tdcBin);
1241 } // loop on clusters
1245 //______________________________________________________________________________
1247 void AliTOFClusterFinder::ResetRecpoint()
1250 // Clear the list of reconstructed points
1253 fNumberOfTofClusters = 0;
1254 if (fRecPoints) fRecPoints->Clear();
1257 //______________________________________________________________________________
1259 void AliTOFClusterFinder::Load()
1262 // Load TOF.Digits.root and TOF.RecPoints.root files
1265 fTOFLoader->LoadDigits("READ");
1266 fTOFLoader->LoadRecPoints("recreate");
1269 //______________________________________________________________________________
1271 void AliTOFClusterFinder::LoadClusters()
1274 // Load TOF.RecPoints.root file
1277 fTOFLoader->LoadRecPoints("recreate");
1280 //______________________________________________________________________________
1282 void AliTOFClusterFinder::UnLoad()
1285 // Unload TOF.Digits.root and TOF.RecPoints.root files
1288 fTOFLoader->UnloadDigits();
1289 fTOFLoader->UnloadRecPoints();
1292 //______________________________________________________________________________
1294 void AliTOFClusterFinder::UnLoadClusters()
1297 // Unload TOF.RecPoints.root file
1300 fTOFLoader->UnloadRecPoints();
1303 //-------------------------------------------------------------------------
1304 UShort_t AliTOFClusterFinder::GetClusterVolIndex(const Int_t * const ind) const {
1306 //First of all get the volume ID to retrieve the l2t transformation...
1308 // Detector numbering scheme
1315 Int_t isector =ind[0];
1316 if (isector >= nSector)
1317 AliError(Form("Wrong sector number in TOF (%d) !",isector));
1318 Int_t iplate = ind[1];
1319 if (iplate >= nPlate)
1320 AliError(Form("Wrong plate number in TOF (%d) !",iplate));
1321 Int_t istrip = ind[2];
1323 Int_t stripOffset = 0;
1329 stripOffset = nStripC;
1332 stripOffset = nStripC+nStripB;
1335 stripOffset = nStripC+nStripB+nStripA;
1338 stripOffset = nStripC+nStripB+nStripA+nStripB;
1341 AliError(Form("Wrong plate number in TOF (%d) !",iplate));
1345 Int_t index= (2*(nStripC+nStripB)+nStripA)*isector +
1349 UShort_t volIndex = AliGeomManager::LayerToVolUID(AliGeomManager::kTOF,index);
1353 //-------------------------------------------------------------------------
1354 void AliTOFClusterFinder::GetClusterPars(Int_t *ind, Double_t* pos,Double_t* cov) const {
1356 //First of all get the volume ID to retrieve the l2t transformation...
1358 UShort_t volIndex = GetClusterVolIndex(ind);
1361 //we now go in the system of the strip: determine the local coordinates
1364 // 47---------------------------------------------------0 ^ z
1365 // | | | | | | | | | | | | | | | | | | | | | | | | | | | 1 |
1366 // ----------------------------------------------------- | y going outwards
1367 // | | | | | | | | | | | | | | | | | | | | | | | | | | | 0 | par[0]=0;
1369 // ----------------------------------------------------- |
1370 // x <-----------------------------------------------------
1373 Float_t localX = (ind[4]-23.5)*AliTOFGeometry::XPad();
1375 Float_t localZ = (ind[3]- 0.5)*AliTOFGeometry::ZPad();
1377 Float_t localX = (ind[4]-AliTOFGeometry::NpadX()/2)*AliTOFGeometry::XPad()+AliTOFGeometry::XPad()/2.;
1379 Float_t localZ = (ind[3]-AliTOFGeometry::NpadZ()/2)*AliTOFGeometry::ZPad()+AliTOFGeometry::ZPad()/2.;
1380 //move to the tracking ref system
1387 const TGeoHMatrix *l2t= AliGeomManager::GetTracking2LocalMatrix(volIndex);
1388 // Get The position in the track ref system
1390 l2t->MasterToLocal(lpos,tpos);
1395 //Get The cluster covariance in the track ref system
1398 //cluster covariance in the local system:
1403 lcov[0] = AliTOFGeometry::XPad()*AliTOFGeometry::XPad()/12.;
1411 lcov[8] = AliTOFGeometry::ZPad()*AliTOFGeometry::ZPad()/12.;
1413 //cluster covariance in the tracking system:
1415 m.SetRotation(lcov);
1417 m.MultiplyLeft(&l2t->Inverse());
1418 Double_t *tcov = m.GetRotationMatrix();
1419 cov[0] = tcov[0]; cov[1] = tcov[1]; cov[2] = tcov[2];
1420 cov[3] = tcov[4]; cov[4] = tcov[5];