]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TOF/AliTOFClusterFinder.cxx
moved component registration to agent; added component configuration/initialization...
[u/mrichter/AliRoot.git] / TOF / AliTOFClusterFinder.cxx
CommitLineData
d08a92dd 1/***************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16/*
15ec34b9 17$Log$
98f5acd7 18Revision 1.30 2007/10/04 13:08:52 arcelli
19updates to comply with AliTOFGeometryV5 becoming AliTOFGeometry
20
ba66add8 21Revision 1.29 2007/10/03 10:42:33 arcelli
22updates to handle new AliTOFcluster, inheriting form AliCluster3D
23
ac359ffe 24Revision 1.28 2007/05/31 16:06:05 arcelli
25move instance of AliRawStream outside loop on DDL
26
ef58b2af 27Revision 1.27 2007/05/02 16:31:49 arcelli
28Add methods to handle single event reconstruction. retrieval of Calib info moved to AliTOFReconstructor ctor, and passed via a pointer to AliTOFcalib
29
94f5f8f2 30Revision 1.26 2007/04/30 19:02:24 arcelli
31hopefully the last refinements for correct type conversion in calibration
32
a33fec85 33Revision 1.25 2007/04/30 15:22:17 arcelli
34Change TOF digit Time, Tot etc to int type
35
bf33f8f0 36Revision 1.24 2007/04/27 11:19:31 arcelli
37updates for the new decoder
38
7813bb1a 39Revision 1.23 2007/04/23 16:51:39 decaro
40Digits-to-raw_data conversion: correction for a more real description (A.De Caro, R.Preghenella)
41
515faf5d 42Revision 1.22 2007/04/19 17:26:32 arcelli
43Fix a bug (add some debug printout
44
0451c2e6 45Revision 1.21 2007/04/18 17:28:12 arcelli
46Set the ToT bin width to the one actually used...
47
605370db 48Revision 1.20 2007/03/09 09:57:23 arcelli
49 Remove a forgotten include of Riostrem
50
c77771e2 51Revision 1.19 2007/03/08 15:41:20 arcelli
52set uncorrected times when filling RecPoints
53
3432ebfa 54Revision 1.18 2007/03/06 16:31:20 arcelli
55Add Uncorrected TOF Time signal
56
aa5476d8 57Revision 1.17 2007/02/28 18:09:11 arcelli
58Add protection against failed retrieval of the CDB cal object, now Reconstruction exits with AliFatal
59
a1cab04c 60Revision 1.16 2007/02/20 15:57:00 decaro
61Raw data update: to read the TOF raw data defined in UNPACKED mode
62
d08a92dd 63
64Revision 0.03 2005/07/28 A. De Caro
65 Implement public method
66 Raw2Digits(Int_t, AliRawReader *)
67 to convert digits from raw data in MC digits
68 (temporary solution)
69
70Revision 0.02 2005/07/27 A. De Caro
71 Implement public method
72 Digits2RecPoint(Int_t)
73 to convert digits in clusters
74
75Revision 0.02 2005/07/26 A. De Caro
76 Implement private methods
77 InsertCluster(AliTOFcluster *)
78 FindClusterIndex(Double_t)
79 originally implemented in AliTOFtracker
80 by S. Arcelli and C. Zampolli
81
82Revision 0.01 2005/07/25 A. De Caro
83 Implement public methods
84 Digits2RecPoint(AliRawReader *, TTree *)
85 Digits2RecPoint(Int_t, AliRawReader *)
86 to convert raw data in clusters
87 */
88
89////////////////////////////////////////////////////////////////
90// //
91// Class for TOF cluster finder //
92// //
93// Starting from Raw Data, create rec points, //
94// fill TreeR for TOF, //
95// write TOF.RecPoints.root file //
96// //
97////////////////////////////////////////////////////////////////
98
15ec34b9 99
0e46b9ae 100#include "TClonesArray.h"
515faf5d 101#include "TStopwatch.h"
0e46b9ae 102#include "TTree.h"
ac359ffe 103#include <TGeoManager.h>
104#include <AliGeomManager.h>
105#include <TGeoMatrix.h>
106#include <TGeoPhysicalNode.h>
107#include "AliAlignObj.h"
d08a92dd 108
d0eb8f39 109#include "AliDAQ.h"
0e46b9ae 110#include "AliLoader.h"
d08a92dd 111#include "AliLog.h"
0e46b9ae 112#include "AliRawReader.h"
d08a92dd 113#include "AliRunLoader.h"
d08a92dd 114
15ec34b9 115#include "AliTOFcalib.h"
ba66add8 116#include "AliTOFChannelOnline.h"
117#include "AliTOFChannelOffline.h"
d08a92dd 118#include "AliTOFClusterFinder.h"
0e46b9ae 119#include "AliTOFcluster.h"
120#include "AliTOFdigit.h"
0e46b9ae 121#include "AliTOFGeometry.h"
15ec34b9 122#include "AliTOFrawData.h"
0e46b9ae 123#include "AliTOFRawStream.h"
3432ebfa 124#include "Riostream.h"
0e46b9ae 125
15ec34b9 126//extern TFile *gFile;
d08a92dd 127
128ClassImp(AliTOFClusterFinder)
129
94f5f8f2 130AliTOFClusterFinder::AliTOFClusterFinder(AliTOFcalib *calib):
d08a92dd 131 fRunLoader(0),
132 fTOFLoader(0),
133 fTreeD(0),
134 fTreeR(0),
135 fDigits(new TClonesArray("AliTOFdigit", 4000)),
136 fRecPoints(new TClonesArray("AliTOFcluster", 4000)),
15ec34b9 137 fNumberOfTofClusters(0),
7813bb1a 138 fVerbose(0),
94f5f8f2 139 fDecoderVersion(0),
140 fTOFcalib(calib)
d08a92dd 141{
142//
143// Constructor
144//
145
d08a92dd 146}
147//______________________________________________________________________________
148
94f5f8f2 149AliTOFClusterFinder::AliTOFClusterFinder(AliRunLoader* runLoader, AliTOFcalib *calib):
d08a92dd 150 fRunLoader(runLoader),
151 fTOFLoader(runLoader->GetLoader("TOFLoader")),
152 fTreeD(0),
153 fTreeR(0),
154 fDigits(new TClonesArray("AliTOFdigit", 4000)),
155 fRecPoints(new TClonesArray("AliTOFcluster", 4000)),
15ec34b9 156 fNumberOfTofClusters(0),
7813bb1a 157 fVerbose(0),
94f5f8f2 158 fDecoderVersion(0),
159 fTOFcalib(calib)
d08a92dd 160{
161//
162// Constructor
163//
164
7aeeaf38 165}
166
167//------------------------------------------------------------------------
168AliTOFClusterFinder::AliTOFClusterFinder(const AliTOFClusterFinder &source)
58d8d9a3 169 :TObject(),
170 fRunLoader(0),
171 fTOFLoader(0),
172 fTreeD(0),
173 fTreeR(0),
58d8d9a3 174 fDigits(new TClonesArray("AliTOFdigit", 4000)),
175 fRecPoints(new TClonesArray("AliTOFcluster", 4000)),
15ec34b9 176 fNumberOfTofClusters(0),
94f5f8f2 177 fVerbose(0),
178 fDecoderVersion(0),
179 fTOFcalib(0)
7aeeaf38 180{
181 // copy constructor
182 this->fDigits=source.fDigits;
183 this->fRecPoints=source.fRecPoints;
7813bb1a 184 this->fDecoderVersion=source.fDecoderVersion;
94f5f8f2 185 this->fTOFcalib=source.fTOFcalib;
7aeeaf38 186
187}
188
189//------------------------------------------------------------------------
d0eb8f39 190AliTOFClusterFinder& AliTOFClusterFinder::operator=(const AliTOFClusterFinder &source)
7aeeaf38 191{
192 // ass. op.
193 this->fDigits=source.fDigits;
194 this->fRecPoints=source.fRecPoints;
15ec34b9 195 this->fVerbose=source.fVerbose;
7813bb1a 196 this->fDecoderVersion=source.fDecoderVersion;
94f5f8f2 197 this->fTOFcalib=source.fTOFcalib;
7aeeaf38 198 return *this;
199
d08a92dd 200}
201//______________________________________________________________________________
202
203AliTOFClusterFinder::~AliTOFClusterFinder()
204{
205
206 //
207 // Destructor
208 //
209
210 if (fDigits)
211 {
212 fDigits->Delete();
213 delete fDigits;
214 fDigits=0;
215 }
216 if (fRecPoints)
217 {
218 fRecPoints->Delete();
219 delete fRecPoints;
220 fRecPoints=0;
221 }
222
d08a92dd 223}
224//______________________________________________________________________________
225
226void AliTOFClusterFinder::Digits2RecPoints(Int_t iEvent)
227{
228 //
229 // Converts digits to recpoints for TOF
230 //
231
515faf5d 232 TStopwatch stopwatch;
233 stopwatch.Start();
234
d08a92dd 235 fRunLoader->GetEvent(iEvent);
236
237 fTreeD = fTOFLoader->TreeD();
238 if (fTreeD == 0x0)
239 {
240 AliFatal("AliTOFClusterFinder: Can not get TreeD");
241 }
242
243 TBranch *branch = fTreeD->GetBranch("TOF");
244 if (!branch) {
245 AliError("can't get the branch with the TOF digits !");
246 return;
247 }
248
15ec34b9 249 TClonesArray *digits = new TClonesArray("AliTOFdigit",10000);
d08a92dd 250 branch->SetAddress(&digits);
251
252 ResetRecpoint();
253
254 fTreeR = fTOFLoader->TreeR();
255 if (fTreeR == 0x0)
256 {
257 fTOFLoader->MakeTree("R");
258 fTreeR = fTOFLoader->TreeR();
259 }
260
261 Int_t bufsize = 32000;
262 fTreeR->Branch("TOF", &fRecPoints, bufsize);
263
264 fTreeD->GetEvent(0);
265 Int_t nDigits = digits->GetEntriesFast();
266 AliDebug(2,Form("Number of TOF digits: %d",nDigits));
267
ac359ffe 268 Int_t ii;
bf33f8f0 269 Int_t dig[5]; //cluster detector indeces
bf33f8f0 270 Int_t parTOF[5]; //The TOF signal parameters
271 Bool_t status=kTRUE; // assume all sim channels ok in the beginning...
d08a92dd 272 for (ii=0; ii<nDigits; ii++) {
273 AliTOFdigit *d = (AliTOFdigit*)digits->UncheckedAt(ii);
274 dig[0]=d->GetSector();
275 dig[1]=d->GetPlate();
276 dig[2]=d->GetStrip();
277 dig[3]=d->GetPadz();
278 dig[4]=d->GetPadx();
279
bf33f8f0 280 // AliDebug(2,Form(" %2i %1i %2i %1i %2i ",dig[0],dig[1],dig[2],dig[3],dig[4]));
d0eb8f39 281
bf33f8f0 282 parTOF[0] = d->GetTdc(); //the TDC signal
283 parTOF[1] = d->GetToT(); //the ToT signal
284 parTOF[2] = d->GetAdc(); // the adc charge
285 parTOF[3] = d->GetTdcND(); // non decalibrated sim time
286 parTOF[4] = d->GetTdc(); // raw time, == Tdc time for the moment
ac359ffe 287 Double_t posClus[3];
288 Double_t covClus[6];
289 UShort_t volIdClus=GetClusterVolIndex(dig);
290 GetClusterPars(dig, posClus,covClus);
291 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);
d08a92dd 292 InsertCluster(tofCluster);
293
294 }
295
94f5f8f2 296 AliInfo(Form("Number of found clusters: %i for event: %i", fNumberOfTofClusters, iEvent));
d08a92dd 297
37879eed 298 CalibrateRecPoint();
d08a92dd 299 FillRecPoint();
300
301 fTreeR->Fill();
302 ResetRecpoint();
303
304 fTOFLoader = fRunLoader->GetLoader("TOFLoader");
305 fTOFLoader->WriteRecPoints("OVERWRITE");
306
515faf5d 307 AliInfo(Form("Execution time to read TOF digits and to write TOF clusters : R:%.4fs C:%.4fs",
308 stopwatch.RealTime(),stopwatch.CpuTime()));
309
94f5f8f2 310 digits->Delete();
311 delete digits;
312}
313
314//______________________________________________________________________________
315
316void AliTOFClusterFinder::Digits2RecPoints(TTree* digitsTree, TTree* clusterTree)
317{
318 //
319 // Converts digits to recpoints for TOF
320 //
321
322 TStopwatch stopwatch;
323 stopwatch.Start();
324
325 /// fRunLoader->GetEvent(iEvent);
326
327 if (digitsTree == 0x0)
328 {
329 AliFatal("AliTOFClusterFinder: Can not get TreeD");
330 }
331
332 TBranch *branch = digitsTree->GetBranch("TOF");
333 if (!branch) {
334 AliError("can't get the branch with the TOF digits !");
335 return;
336 }
337
338 TClonesArray *digits = new TClonesArray("AliTOFdigit",10000);
339 branch->SetAddress(&digits);
340
341 ResetRecpoint();
342
343 fTreeR=clusterTree;
344 Int_t bufsize = 32000;
345 fTreeR->Branch("TOF", &fRecPoints, bufsize);
346
347 digitsTree->GetEvent(0);
348 Int_t nDigits = digits->GetEntriesFast();
349 AliDebug(2,Form("Number of TOF digits: %d",nDigits));
350
ac359ffe 351 Int_t ii;
94f5f8f2 352 Int_t dig[5]; //cluster detector indeces
94f5f8f2 353 Int_t parTOF[5]; //The TOF signal parameters
354 Bool_t status=kTRUE; // assume all sim channels ok in the beginning...
355 for (ii=0; ii<nDigits; ii++) {
356 AliTOFdigit *d = (AliTOFdigit*)digits->UncheckedAt(ii);
357 dig[0]=d->GetSector();
358 dig[1]=d->GetPlate();
359 dig[2]=d->GetStrip();
360 dig[3]=d->GetPadz();
361 dig[4]=d->GetPadx();
362
363 // AliDebug(2,Form(" %2i %1i %2i %1i %2i ",dig[0],dig[1],dig[2],dig[3],dig[4]));
364
94f5f8f2 365 parTOF[0] = d->GetTdc(); //the TDC signal
366 parTOF[1] = d->GetToT(); //the ToT signal
367 parTOF[2] = d->GetAdc(); // the adc charge
368 parTOF[3] = d->GetTdcND(); // non decalibrated sim time
369 parTOF[4] = d->GetTdc(); // raw time, == Tdc time for the moment
ac359ffe 370
371 Double_t posClus[3];
372 Double_t covClus[6];
373 UShort_t volIdClus=GetClusterVolIndex(dig);
374 GetClusterPars(dig,posClus,covClus);
375 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);
94f5f8f2 376 InsertCluster(tofCluster);
377
378 }
379
380 AliInfo(Form("Number of found clusters: %i", fNumberOfTofClusters));
381
382 CalibrateRecPoint();
383 FillRecPoint();
384
385 clusterTree->Fill();
386 ResetRecpoint();
387
388 AliInfo(Form("Execution time to read TOF digits and to write TOF clusters : R:%.4fs C:%.4fs",
389 stopwatch.RealTime(),stopwatch.CpuTime()));
390
391 digits->Delete();
392 delete digits;
d08a92dd 393}
394//______________________________________________________________________________
395
396void AliTOFClusterFinder::Digits2RecPoints(AliRawReader *rawReader,
397 TTree *clustersTree)
398{
399 //
400 // Converts RAW data to recpoints for TOF
401 //
402
515faf5d 403 TStopwatch stopwatch;
404 stopwatch.Start();
405
d0eb8f39 406 //const Int_t kDDL = fTOFGeometry->NDDL()*fTOFGeometry->NSectors();
407 const Int_t kDDL = AliDAQ::NumberOfDdls("TOF");
d08a92dd 408
409 ResetRecpoint();
410
411 Int_t bufsize = 32000;
412 clustersTree->Branch("TOF", &fRecPoints, bufsize);
413
15ec34b9 414 TClonesArray * clonesRawData;
415
15ec34b9 416 Int_t dummy = -1;
d08a92dd 417
418 Int_t detectorIndex[5];
bf33f8f0 419 Int_t parTOF[5];
d08a92dd 420
15ec34b9 421 ofstream ftxt;
422 if (fVerbose==2) ftxt.open("TOFdigitsRead.txt",ios::app);
423
ef58b2af 424 AliTOFRawStream tofInput(rawReader);
425
15ec34b9 426 Int_t indexDDL = 0;
427 for (indexDDL = 0; indexDDL < kDDL; indexDDL++) {
428
429 rawReader->Reset();
7813bb1a 430 if (fDecoderVersion) {
431 AliInfo("Using New Decoder \n");
432 tofInput.LoadRawDataBuffers(indexDDL,fVerbose);
433 }
434 else tofInput.LoadRawData(indexDDL);
15ec34b9 435
436 clonesRawData = (TClonesArray*)tofInput.GetRawData();
437
438 for (Int_t iRawData = 0; iRawData<clonesRawData->GetEntriesFast(); iRawData++) {
439
440 AliTOFrawData *tofRawDatum = (AliTOFrawData*)clonesRawData->UncheckedAt(iRawData);
441
442 if (tofRawDatum->GetTOT()==-1 || tofRawDatum->GetTOF()==-1) continue;
443
444 if (fVerbose==2) {
445 if (indexDDL<10) ftxt << " " << indexDDL;
446 else ftxt << " " << indexDDL;
447 if (tofRawDatum->GetTRM()<10) ftxt << " " << tofRawDatum->GetTRM();
448 else ftxt << " " << tofRawDatum->GetTRM();
449 ftxt << " " << tofRawDatum->GetTRMchain();
450 if (tofRawDatum->GetTDC()<10) ftxt << " " << tofRawDatum->GetTDC();
451 else ftxt << " " << tofRawDatum->GetTDC();
452 ftxt << " " << tofRawDatum->GetTDCchannel();
453 }
454
455 tofInput.EquipmentId2VolumeId(indexDDL, tofRawDatum->GetTRM(), tofRawDatum->GetTRMchain(),
456 tofRawDatum->GetTDC(), tofRawDatum->GetTDCchannel(), detectorIndex);
457 dummy = detectorIndex[3];
458 detectorIndex[3] = detectorIndex[4];
459 detectorIndex[4] = dummy;
460
461 if (fVerbose==2) {
462 if (detectorIndex[0]<10) ftxt << " -> " << detectorIndex[0];
463 else ftxt << " -> " << detectorIndex[0];
464 ftxt << " " << detectorIndex[1];
465 if (detectorIndex[2]<10) ftxt << " " << detectorIndex[2];
466 else ftxt << " " << detectorIndex[2];
467 ftxt << " " << detectorIndex[3];
468 if (detectorIndex[4]<10) ftxt << " " << detectorIndex[4];
469 else ftxt << " " << detectorIndex[4];
470 }
471
bf33f8f0 472 parTOF[0] = tofRawDatum->GetTOF(); //TDC
473 parTOF[1] = tofRawDatum->GetTOT(); // TOT
474 parTOF[2] = tofRawDatum->GetTOT(); //ADC==TOF
475 parTOF[3] = -1;//raw data: no track of undecalib sim time
476 parTOF[4] = tofRawDatum->GetTOF(); // RAW time
ac359ffe 477 Double_t posClus[3];
478 Double_t covClus[6];
479 UShort_t volIdClus=GetClusterVolIndex(detectorIndex);
480 Int_t lab[3]={-1,-1,-1};
481 Bool_t status=kTRUE;
482 GetClusterPars(detectorIndex,posClus,covClus);
483 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);
15ec34b9 484 InsertCluster(tofCluster);
485
486 if (fVerbose==2) {
bf33f8f0 487 if (parTOF[1]<10)ftxt << " " << parTOF[1];
488 else if (parTOF[1]>=10 && parTOF[1]<100) ftxt << " " << parTOF[1];
489 else ftxt << " " << parTOF[1];
490 if (parTOF[0]<10) ftxt << " " << parTOF[0] << endl;
491 else if (parTOF[0]>=10 && parTOF[0]<100) ftxt << " " << parTOF[0] << endl;
492 else if (parTOF[0]>=100 && parTOF[0]<1000) ftxt << " " << parTOF[0] << endl;
493 else ftxt << " " << parTOF[3] << endl;
15ec34b9 494 }
495
496 } // closed loop on TOF raw data per current DDL file
497
498 clonesRawData->Clear();
499
500 } // closed loop on DDL index
501
15ec34b9 502 if (fVerbose==2) ftxt.close();
d08a92dd 503
504 AliInfo(Form("Number of found clusters: %i", fNumberOfTofClusters));
505
37879eed 506 CalibrateRecPoint();
d08a92dd 507 FillRecPoint();
508
509 clustersTree->Fill();
37879eed 510
d08a92dd 511 ResetRecpoint();
512
515faf5d 513 AliDebug(1, Form("Execution time to read TOF raw data and to write TOF clusters : R:%.4fs C:%.4fs",
514 stopwatch.RealTime(),stopwatch.CpuTime()));
515
d08a92dd 516}
517//______________________________________________________________________________
518
519void AliTOFClusterFinder::Digits2RecPoints(Int_t iEvent, AliRawReader *rawReader)
520{
521 //
522 // Converts RAW data to recpoints for TOF
523 //
524
515faf5d 525 TStopwatch stopwatch;
526 stopwatch.Start();
527
d0eb8f39 528 //const Int_t kDDL = fTOFGeometry->NDDL()*fTOFGeometry->NSectors();
529 const Int_t kDDL = AliDAQ::NumberOfDdls("TOF");
d08a92dd 530
531 fRunLoader->GetEvent(iEvent);
532
533 AliDebug(2,Form(" Event number %2i ", iEvent));
534
535 fTreeR = fTOFLoader->TreeR();
536
537 if (fTreeR == 0x0){
538 fTOFLoader->MakeTree("R");
539 fTreeR = fTOFLoader->TreeR();
540 }
541
542 Int_t bufsize = 32000;
543 fTreeR->Branch("TOF", &fRecPoints, bufsize);
544
15ec34b9 545 TClonesArray * clonesRawData;
546
15ec34b9 547 Int_t dummy = -1;
d08a92dd 548
d0eb8f39 549 Int_t detectorIndex[5] = {-1, -1, -1, -1, -1};
bf33f8f0 550 Int_t parTOF[5];
15ec34b9 551 ofstream ftxt;
552 if (fVerbose==2) ftxt.open("TOFdigitsRead.txt",ios::app);
553
ef58b2af 554 AliTOFRawStream tofInput(rawReader);
555
15ec34b9 556 Int_t indexDDL = 0;
d08a92dd 557 for (indexDDL = 0; indexDDL < kDDL; indexDDL++) {
558
559 rawReader->Reset();
7813bb1a 560 if (fDecoderVersion) {
561 AliInfo("Using New Decoder \n");
562 tofInput.LoadRawDataBuffers(indexDDL,fVerbose);
563 }
564 else tofInput.LoadRawData(indexDDL);
15ec34b9 565
566 clonesRawData = (TClonesArray*)tofInput.GetRawData();
567
568 for (Int_t iRawData = 0; iRawData<clonesRawData->GetEntriesFast(); iRawData++) {
569
570 AliTOFrawData *tofRawDatum = (AliTOFrawData*)clonesRawData->UncheckedAt(iRawData);
571
572 if (tofRawDatum->GetTOT()==-1 || tofRawDatum->GetTOF()==-1) continue;
573
574 if (fVerbose==2) {
575 if (indexDDL<10) ftxt << " " << indexDDL;
576 else ftxt << " " << indexDDL;
577 if (tofRawDatum->GetTRM()<10) ftxt << " " << tofRawDatum->GetTRM();
578 else ftxt << " " << tofRawDatum->GetTRM();
579 ftxt << " " << tofRawDatum->GetTRMchain();
580 if (tofRawDatum->GetTDC()<10) ftxt << " " << tofRawDatum->GetTDC();
581 else ftxt << " " << tofRawDatum->GetTDC();
582 ftxt << " " << tofRawDatum->GetTDCchannel();
583 }
584
585 tofInput.EquipmentId2VolumeId(indexDDL, tofRawDatum->GetTRM(), tofRawDatum->GetTRMchain(),
586 tofRawDatum->GetTDC(), tofRawDatum->GetTDCchannel(), detectorIndex);
587 dummy = detectorIndex[3];
588 detectorIndex[3] = detectorIndex[4];
589 detectorIndex[4] = dummy;
590
591 if (fVerbose==2) {
592 if (detectorIndex[0]<10) ftxt << " -> " << detectorIndex[0];
593 else ftxt << " -> " << detectorIndex[0];
594 ftxt << " " << detectorIndex[1];
595 if (detectorIndex[2]<10) ftxt << " " << detectorIndex[2];
596 else ftxt << " " << detectorIndex[2];
597 ftxt << " " << detectorIndex[3];
598 if (detectorIndex[4]<10) ftxt << " " << detectorIndex[4];
599 else ftxt << " " << detectorIndex[4];
600 }
d0eb8f39 601
bf33f8f0 602 parTOF[0] = tofRawDatum->GetTOF(); // TDC
603 parTOF[1] = tofRawDatum->GetTOT(); // TOT
604 parTOF[2] = tofRawDatum->GetTOT(); // raw data have ADC=TOT
605 parTOF[3] = -1; //raw data: no track of the undecalib sim time
606 parTOF[4] = tofRawDatum->GetTOF(); // Raw time == TDC
ac359ffe 607 Double_t posClus[3];
608 Double_t covClus[6];
609 UShort_t volIdClus=GetClusterVolIndex(detectorIndex);
610 Int_t lab[3]={-1,-1,-1};
611 Bool_t status=kTRUE;
612 GetClusterPars(detectorIndex,posClus,covClus);
613 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);
d08a92dd 614 InsertCluster(tofCluster);
615
15ec34b9 616 if (fVerbose==2) {
bf33f8f0 617 if (parTOF[1]<10)ftxt << " " << parTOF[1];
618 else if (parTOF[1]>=10 && parTOF[1]<100) ftxt << " " << parTOF[1];
619 else ftxt << " " << parTOF[1];
620 if (parTOF[0]<10) ftxt << " " << parTOF[0] << endl;
621 else if (parTOF[0]>=10 && parTOF[0]<100) ftxt << " " << parTOF[0] << endl;
622 else if (parTOF[0]>=100 && parTOF[0]<1000) ftxt << " " << parTOF[0] << endl;
623 else ftxt << " " << parTOF[3] << endl;
15ec34b9 624 }
d08a92dd 625
15ec34b9 626 } // closed loop on TOF raw data per current DDL file
627
628 clonesRawData->Clear();
629
630 } // closed loop on DDL index
631
632 if (fVerbose==2) ftxt.close();
d08a92dd 633
94f5f8f2 634 AliInfo(Form("Number of found clusters: %i for event: %i", fNumberOfTofClusters, iEvent));
d08a92dd 635
37879eed 636 CalibrateRecPoint();
d08a92dd 637 FillRecPoint();
638
639 fTreeR->Fill();
640 ResetRecpoint();
641
642 fTOFLoader = fRunLoader->GetLoader("TOFLoader");
643 fTOFLoader->WriteRecPoints("OVERWRITE");
644
515faf5d 645 AliDebug(1, Form("Execution time to read TOF raw data and to write TOF clusters : R:%.4fs C:%.4fs",
646 stopwatch.RealTime(),stopwatch.CpuTime()));
647
d08a92dd 648}
649//______________________________________________________________________________
650
651void AliTOFClusterFinder::Raw2Digits(Int_t iEvent, AliRawReader *rawReader)
652{
653 //
654 // Converts RAW data to MC digits for TOF
655 //
656 // (temporary solution)
657 //
658
515faf5d 659 TStopwatch stopwatch;
660 stopwatch.Start();
661
15ec34b9 662 //const Int_t kDDL = fTOFGeometry->NDDL()*fTOFGeometry->NSectors();
ba66add8 663 const Int_t kDDL = AliTOFGeometry::NDDL()*AliTOFGeometry::NSectors();
15ec34b9 664
d08a92dd 665 fRunLoader->GetEvent(iEvent);
666
667 fTreeD = fTOFLoader->TreeD();
668 if (fTreeD)
669 {
d0eb8f39 670 AliInfo("TreeD re-creation");
d08a92dd 671 fTreeD = 0x0;
672 fTOFLoader->MakeTree("D");
673 fTreeD = fTOFLoader->TreeD();
674 }
675
15ec34b9 676 TClonesArray *tofDigits = new TClonesArray("AliTOFdigit",10000);
d08a92dd 677 Int_t bufsize = 32000;
678 fTreeD->Branch("TOF", &tofDigits, bufsize);
679
d08a92dd 680 fRunLoader->GetEvent(iEvent);
681
682 AliDebug(2,Form(" Event number %2i ", iEvent));
683
15ec34b9 684 TClonesArray * clonesRawData;
685
686 Int_t dummy = -1;
d08a92dd 687
688 Int_t detectorIndex[5];
bf33f8f0 689 Int_t digit[4];
d08a92dd 690
ef58b2af 691 AliTOFRawStream tofInput(rawReader);
692
15ec34b9 693 Int_t indexDDL = 0;
d08a92dd 694 for (indexDDL = 0; indexDDL < kDDL; indexDDL++) {
695
696 rawReader->Reset();
7813bb1a 697 if (fDecoderVersion) {
698 AliInfo("Using New Decoder \n");
699 tofInput.LoadRawDataBuffers(indexDDL,fVerbose);
700 }
701 else tofInput.LoadRawData(indexDDL);
d08a92dd 702
15ec34b9 703 clonesRawData = (TClonesArray*)tofInput.GetRawData();
d08a92dd 704
15ec34b9 705 for (Int_t iRawData = 0; iRawData<clonesRawData->GetEntriesFast(); iRawData++) {
d0eb8f39 706
15ec34b9 707 AliTOFrawData *tofRawDatum = (AliTOFrawData*)clonesRawData->UncheckedAt(iRawData);
d0eb8f39 708
15ec34b9 709 if (!tofRawDatum->GetTOT() || !tofRawDatum->GetTOF()) continue;
710
711 tofInput.EquipmentId2VolumeId(indexDDL, tofRawDatum->GetTRM(), tofRawDatum->GetTRMchain(),
712 tofRawDatum->GetTDC(), tofRawDatum->GetTDCchannel(), detectorIndex);
713 dummy = detectorIndex[3];
714 detectorIndex[3] = detectorIndex[4];
715 detectorIndex[4] = dummy;
d0eb8f39 716
bf33f8f0 717 digit[0] = tofInput.GetTofBin();
718 digit[1] = tofInput.GetToTbin();
719 digit[2] = tofInput.GetToTbin();
720 digit[3] = -1;
d08a92dd 721
722 Int_t tracknum[3]={-1,-1,-1};
723
724 TClonesArray &aDigits = *tofDigits;
725 Int_t last=tofDigits->GetEntriesFast();
726 new (aDigits[last]) AliTOFdigit(tracknum, detectorIndex, digit);
727
728 } // while loop
729
15ec34b9 730 clonesRawData->Clear();
731
d08a92dd 732 } // DDL Loop
733
734 fTreeD->Fill();
735
736 fTOFLoader = fRunLoader->GetLoader("TOFLoader");
737 fTOFLoader->WriteDigits("OVERWRITE");
738
515faf5d 739 AliDebug(1, Form("Execution time to read TOF raw data and to write TOF clusters : R:%.2fs C:%.2fs",
740 stopwatch.RealTime(),stopwatch.CpuTime()));
741
94f5f8f2 742}
743
744//______________________________________________________________________________
745
746void AliTOFClusterFinder::Raw2Digits(AliRawReader *rawReader, TTree* digitsTree)
747{
748 //
749 // Converts RAW data to MC digits for TOF for the current event
750 //
751 //
752
753 TStopwatch stopwatch;
754 stopwatch.Start();
755
ba66add8 756 const Int_t kDDL = AliTOFGeometry::NDDL()*AliTOFGeometry::NSectors();
94f5f8f2 757
758 if (!digitsTree)
759 {
760 AliError("No input digits Tree");
761 return;
762 }
763
764 TClonesArray *tofDigits = new TClonesArray("AliTOFdigit",10000);
765 Int_t bufsize = 32000;
766 digitsTree->Branch("TOF", &tofDigits, bufsize);
767
768 /// fRunLoader->GetEvent(iEvent);
769
770 /// AliDebug(2,Form(" Event number %2i ", iEvent));
771
772 TClonesArray * clonesRawData;
773
774 Int_t dummy = -1;
775
776 Int_t detectorIndex[5];
777 Int_t digit[4];
778
ef58b2af 779 AliTOFRawStream tofInput(rawReader);
780
94f5f8f2 781 Int_t indexDDL = 0;
782 for (indexDDL = 0; indexDDL < kDDL; indexDDL++) {
783
784 rawReader->Reset();
94f5f8f2 785 if (fDecoderVersion) {
786 AliInfo("Using New Decoder \n");
787 tofInput.LoadRawDataBuffers(indexDDL,fVerbose);
788 }
789 else tofInput.LoadRawData(indexDDL);
790
791 clonesRawData = (TClonesArray*)tofInput.GetRawData();
792
793 for (Int_t iRawData = 0; iRawData<clonesRawData->GetEntriesFast(); iRawData++) {
794
795 AliTOFrawData *tofRawDatum = (AliTOFrawData*)clonesRawData->UncheckedAt(iRawData);
796
797 if (!tofRawDatum->GetTOT() || !tofRawDatum->GetTOF()) continue;
798
799 tofInput.EquipmentId2VolumeId(indexDDL, tofRawDatum->GetTRM(), tofRawDatum->GetTRMchain(),
800 tofRawDatum->GetTDC(), tofRawDatum->GetTDCchannel(), detectorIndex);
801 dummy = detectorIndex[3];
802 detectorIndex[3] = detectorIndex[4];
803 detectorIndex[4] = dummy;
804
805 digit[0] = tofInput.GetTofBin();
806 digit[1] = tofInput.GetToTbin();
807 digit[2] = tofInput.GetToTbin();
808 digit[3] = -1;
809
810 Int_t tracknum[3]={-1,-1,-1};
811
812 TClonesArray &aDigits = *tofDigits;
813 Int_t last=tofDigits->GetEntriesFast();
814 new (aDigits[last]) AliTOFdigit(tracknum, detectorIndex, digit);
815
816 } // while loop
817
818 clonesRawData->Clear();
819
820 } // DDL Loop
821
822 digitsTree->Fill();
823
824 AliDebug(1, Form("Got %d digits: ", tofDigits->GetEntries()));
825 AliDebug(1, Form("Execution time to read TOF raw data and fill TOF digit tree : R:%.2fs C:%.2fs",
826 stopwatch.RealTime(),stopwatch.CpuTime()));
827
d08a92dd 828}
829//______________________________________________________________________________
830
831Int_t AliTOFClusterFinder::InsertCluster(AliTOFcluster *tofCluster) {
832 //---------------------------------------------------------------------------//
833 // This function adds a TOF cluster to the array of TOF clusters sorted in Z //
834 //---------------------------------------------------------------------------//
835 if (fNumberOfTofClusters==kTofMaxCluster) {
836 AliError("Too many clusters !");
837 return 1;
838 }
839
840 if (fNumberOfTofClusters==0) {
841 fTofClusters[fNumberOfTofClusters++] = tofCluster;
842 return 0;
843 }
844
845 Int_t ii = FindClusterIndex(tofCluster->GetZ());
846 memmove(fTofClusters+ii+1 ,fTofClusters+ii,(fNumberOfTofClusters-ii)*sizeof(AliTOFcluster*));
847 fTofClusters[ii] = tofCluster;
848 fNumberOfTofClusters++;
849
850 return 0;
851
852}
853//_________________________________________________________________________
854
855Int_t AliTOFClusterFinder::FindClusterIndex(Double_t z) const {
856 //--------------------------------------------------------------------
ac359ffe 857 // This function returns the index of the nearest cluster in z
d08a92dd 858 //--------------------------------------------------------------------
859 if (fNumberOfTofClusters==0) return 0;
860 if (z <= fTofClusters[0]->GetZ()) return 0;
861 if (z > fTofClusters[fNumberOfTofClusters-1]->GetZ()) return fNumberOfTofClusters;
862 Int_t b = 0, e = fNumberOfTofClusters-1, m = (b+e)/2;
863 for (; b<e; m=(b+e)/2) {
864 if (z > fTofClusters[m]->GetZ()) b=m+1;
865 else e=m;
866 }
867
868 return m;
869
870}
871//_________________________________________________________________________
872
873void AliTOFClusterFinder::FillRecPoint()
874{
875 //
876 // Copy the global array of AliTOFcluster, i.e. fTofClusters (sorted
877 // in Z) in the global TClonesArray of AliTOFcluster,
878 // i.e. fRecPoints.
879 //
880
881 Int_t ii, jj;
882
883 Int_t detectorIndex[5];
bf33f8f0 884 Int_t parTOF[5];
d08a92dd 885 Int_t trackLabels[3];
886 Int_t digitIndex = -1;
bf33f8f0 887 Bool_t status=kTRUE;
d08a92dd 888
889 TClonesArray &lRecPoints = *fRecPoints;
890
891 for (ii=0; ii<fNumberOfTofClusters; ii++) {
892
893 digitIndex = fTofClusters[ii]->GetIndex();
894 for(jj=0; jj<5; jj++) detectorIndex[jj] = fTofClusters[ii]->GetDetInd(jj);
895 for(jj=0; jj<3; jj++) trackLabels[jj] = fTofClusters[ii]->GetLabel(jj);
bf33f8f0 896 parTOF[0] = fTofClusters[ii]->GetTDC(); // TDC
897 parTOF[1] = fTofClusters[ii]->GetToT(); // TOT
898 parTOF[2] = fTofClusters[ii]->GetADC(); // ADC=TOT
899 parTOF[3] = fTofClusters[ii]->GetTDCND(); // TDCND
900 parTOF[4] = fTofClusters[ii]->GetTDCRAW();//RAW
901 status=fTofClusters[ii]->GetStatus();
ac359ffe 902 Double_t posClus[3];
903 Double_t covClus[6];
904 UShort_t volIdClus=GetClusterVolIndex(detectorIndex);
905 GetClusterPars(detectorIndex,posClus,covClus);
906 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);
d08a92dd 907
908 } // loop on clusters
909
910}
37879eed 911
912//_________________________________________________________________________
913void AliTOFClusterFinder::CalibrateRecPoint()
914{
915 //
916 // Copy the global array of AliTOFcluster, i.e. fTofClusters (sorted
917 // in Z) in the global TClonesArray of AliTOFcluster,
918 // i.e. fRecPoints.
919 //
920
921 Int_t ii, jj;
922
923 Int_t detectorIndex[5];
924 Int_t digitIndex = -1;
a33fec85 925 Double_t tToT;
926 Double_t timeCorr;
bf33f8f0 927 Int_t tdcCorr;
37879eed 928 AliInfo(" Calibrating TOF Clusters: ")
a1cab04c 929
ba66add8 930 TObjArray *calTOFArrayOnline = fTOFcalib->GetTOFCalArrayOnline();
931 TObjArray *calTOFArrayOffline = fTOFcalib->GetTOFCalArrayOffline();
932 TString validity = (TString)fTOFcalib->GetOfflineValidity();
933 AliInfo(Form(" validity = %s",validity.Data()));
934 Int_t calibration = -1;
935 if (validity.CompareTo("valid")==0) {
936 AliInfo(" Using offline calibration parameters");
937 calibration = 1;
938 }
939 else {
940 AliInfo(" Using online calibration parameters");
941 calibration = 0 ;
942 }
37879eed 943 for (ii=0; ii<fNumberOfTofClusters; ii++) {
944 digitIndex = fTofClusters[ii]->GetIndex();
945 for(jj=0; jj<5; jj++) detectorIndex[jj] = fTofClusters[ii]->GetDetInd(jj);
946
ba66add8 947 Int_t index = AliTOFGeometry::GetIndex(detectorIndex);
37879eed 948
ba66add8 949 AliTOFChannelOnline * calChannelOnline = (AliTOFChannelOnline* )calTOFArrayOnline->At(index);
58d8d9a3 950
951 // Get channel status
98f5acd7 952 UChar_t status=calChannelOnline->GetStatus();
953 if((status & AliTOFChannelOnline::kTOFOnlineOk)!=(AliTOFChannelOnline::kTOFOnlineOk))fTofClusters[ii]->SetStatus(kFALSE); //odd convention, to avoid conflict with calibration objects currently in the db (temporary solution).
58d8d9a3 954 // Get Rough channel online equalization
ba66add8 955 Double_t roughDelay=(Double_t)calChannelOnline->GetDelay(); // in ns
956 AliDebug(2,Form(" channel delay (ns) = %f", roughDelay));
58d8d9a3 957 // Get Refined channel offline calibration parameters
ba66add8 958 if (calibration ==1){
959 AliTOFChannelOffline * calChannelOffline = (AliTOFChannelOffline*)calTOFArrayOffline->At(index);
960 Double_t par[6];
961 for (Int_t j = 0; j<6; j++){
962 par[j]=(Double_t)calChannelOffline->GetSlewPar(j);
963 }
bf33f8f0 964 AliDebug(2,Form(" Calib Pars = %f, %f, %f, %f, %f, %f ",par[0],par[1],par[2],par[3],par[4],par[5]));
ba66add8 965 AliDebug(2,Form(" The ToT and Time, uncorr (counts) = %i , %i", fTofClusters[ii]->GetToT(),fTofClusters[ii]->GetTDC()));
966 tToT = (Double_t)(fTofClusters[ii]->GetToT()*AliTOFGeometry::ToTBinWidth());
967 tToT*=1.E-3; //ToT in ns
968 AliDebug(2,Form(" The ToT and Time, uncorr (ns)= %e, %e",fTofClusters[ii]->GetTDC()*AliTOFGeometry::TdcBinWidth()*1.E-3,tToT));
969 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)
970 }
971 else {
972 timeCorr = roughDelay; // correction in ns
973 }
974 AliDebug(2,Form(" The ToT and Time, uncorr (ns)= %e, %e",fTofClusters[ii]->GetTDC()*AliTOFGeometry::TdcBinWidth()*1.E-3,fTofClusters[ii]->GetToT()*AliTOFGeometry::ToTBinWidth()));
bf33f8f0 975 AliDebug(2,Form(" The time correction (ns) = %f", timeCorr));
a33fec85 976 timeCorr=(Double_t)(fTofClusters[ii]->GetTDC())*AliTOFGeometry::TdcBinWidth()*1.E-3-timeCorr;//redefine the time
977 timeCorr*=1.E3;
978 AliDebug(2,Form(" The channel time, corr (ps)= %e",timeCorr ));
979 tdcCorr=(Int_t)(timeCorr/AliTOFGeometry::TdcBinWidth()); //the corrected time (tdc counts)
340693af 980 fTofClusters[ii]->SetTDC(tdcCorr);
37879eed 981 } // loop on clusters
982
37879eed 983}
d08a92dd 984//______________________________________________________________________________
985
986void AliTOFClusterFinder::ResetRecpoint()
987{
988 //
989 // Clear the list of reconstructed points
990 //
991
992 fNumberOfTofClusters = 0;
993 if (fRecPoints) fRecPoints->Clear();
994
995}
996//______________________________________________________________________________
997
998void AliTOFClusterFinder::Load()
999{
1000 //
1001 // Load TOF.Digits.root and TOF.RecPoints.root files
1002 //
1003
1004 fTOFLoader->LoadDigits("READ");
1005 fTOFLoader->LoadRecPoints("recreate");
1006
1007}
1008//______________________________________________________________________________
1009
1010void AliTOFClusterFinder::LoadClusters()
1011{
1012 //
1013 // Load TOF.RecPoints.root file
1014 //
1015
1016 fTOFLoader->LoadRecPoints("recreate");
1017
1018}
1019//______________________________________________________________________________
1020
1021void AliTOFClusterFinder::UnLoad()
1022{
1023 //
1024 // Unload TOF.Digits.root and TOF.RecPoints.root files
1025 //
1026
1027 fTOFLoader->UnloadDigits();
1028 fTOFLoader->UnloadRecPoints();
1029
1030}
1031//______________________________________________________________________________
1032
1033void AliTOFClusterFinder::UnLoadClusters()
1034{
1035 //
1036 // Unload TOF.RecPoints.root file
1037 //
1038
1039 fTOFLoader->UnloadRecPoints();
1040
1041}
ac359ffe 1042//-------------------------------------------------------------------------
1043UShort_t AliTOFClusterFinder::GetClusterVolIndex(Int_t *ind) const {
1044
1045 //First of all get the volume ID to retrieve the l2t transformation...
1046 //
1047 // Detector numbering scheme
1048 Int_t nSector = 18;
1049 Int_t nPlate = 5;
1050 Int_t nStripA = 15;
1051 Int_t nStripB = 19;
1052 Int_t nStripC = 19;
1053
1054 Int_t isector =ind[0];
1055 if (isector >= nSector)
1056 AliError(Form("Wrong sector number in TOF (%d) !",isector));
1057 Int_t iplate = ind[1];
1058 if (iplate >= nPlate)
1059 AliError(Form("Wrong plate number in TOF (%d) !",iplate));
1060 Int_t istrip = ind[2];
1061
1062 Int_t stripOffset = 0;
1063 switch (iplate) {
1064 case 0:
1065 stripOffset = 0;
1066 break;
1067 case 1:
1068 stripOffset = nStripC;
1069 break;
1070 case 2:
1071 stripOffset = nStripC+nStripB;
1072 break;
1073 case 3:
1074 stripOffset = nStripC+nStripB+nStripA;
1075 break;
1076 case 4:
1077 stripOffset = nStripC+nStripB+nStripA+nStripB;
1078 break;
1079 default:
1080 AliError(Form("Wrong plate number in TOF (%d) !",iplate));
1081 break;
1082 };
1083
1084 Int_t index= (2*(nStripC+nStripB)+nStripA)*isector +
1085 stripOffset +
1086 istrip;
1087
1088 UShort_t volIndex = AliGeomManager::LayerToVolUID(AliGeomManager::kTOF,index);
1089 return volIndex;
1090}
1091//
1092//-------------------------------------------------------------------------
1093void AliTOFClusterFinder::GetClusterPars(Int_t *ind, Double_t* pos,Double_t* cov) const {
1094
1095 //First of all get the volume ID to retrieve the l2t transformation...
1096 //
1097 UShort_t volIndex = GetClusterVolIndex(ind);
1098 //
1099 //
1100 //we now go in the system of the strip: determine the local coordinates
1101 //
1102 //
1103 // 47---------------------------------------------------0 ^ z
1104 // | | | | | | | | | | | | | | | | | | | | | | | | | | | 1 |
1105 // ----------------------------------------------------- | y going outwards
1106 // | | | | | | | | | | | | | | | | | | | | | | | | | | | 0 | par[0]=0;
1107
1108 // ----------------------------------------------------- |
1109 // x <-----------------------------------------------------
1110
1111 Float_t localX=(ind[4]-23.5)*2.5;
1112 Float_t localY=0;
1113 Float_t localZ=(ind[3]-0.5)*3.5;
1114
1115 //move to the tracking ref system
1116
1117 Double_t lpos[3];
1118 lpos[0]=localX;
1119 lpos[1]=localY;
1120 lpos[2]=localZ;
1121
1122 const TGeoHMatrix *l2t= AliGeomManager::GetTracking2LocalMatrix(volIndex);
1123 // Get The position in the track ref system
1124 Double_t tpos[3];
1125 l2t->MasterToLocal(lpos,tpos);
1126 pos[0]=tpos[0];
1127 pos[1]=tpos[1];
1128 pos[2]=tpos[2];
1129
1130 //Get The cluster covariance in the track ref system
1131 Double_t lcov[9];
1132
1133 //cluster covariance in the local system:
1134 // sx2 0 0
1135 // 0 0 0
1136 // 0 0 sz2
1137
1138 lcov[0]=2.5*2.5/12.;
1139 lcov[1]=0;
1140 lcov[2]=0;
1141 lcov[3]=0;
1142 lcov[4]=0;
1143 lcov[5]=0;
1144 lcov[6]=0;
1145 lcov[7]=0;
1146 lcov[8]=3.5*3.5/12.;
1147
1148 //cluster covariance in the tracking system:
1149 TGeoHMatrix m;
1150 m.SetRotation(lcov);
1151 m.Multiply(l2t);
1152 m.MultiplyLeft(&l2t->Inverse());
1153 Double_t *tcov = m.GetRotationMatrix();
1154 cov[0] = tcov[0]; cov[1] = tcov[1]; cov[2] = tcov[2];
1155 cov[3] = tcov[4]; cov[4] = tcov[5];
1156 cov[5] = tcov[8];
1157
1158 return;
1159
1160}