]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TOF/AliTOFtracker.cxx
Changes requested in report #61429: PID: Separating response functions from ESD ...
[u/mrichter/AliRoot.git] / TOF / AliTOFtracker.cxx
CommitLineData
596a855f 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 **************************************************************************/
0e46b9ae 15
16//--------------------------------------------------------------------//
17// //
18// AliTOFtracker Class //
19// Task: Perform association of the ESD tracks to TOF Clusters //
20// and Update ESD track with associated TOF Cluster parameters //
21// //
22// -- Authors : S. Arcelli, C. Zampolli (Bologna University and INFN) //
23// -- Contacts: Annalisa.De.Caro@cern.ch //
24// -- : Chiara.Zampolli@bo.infn.it //
25// -- : Silvia.Arcelli@bo.infn.it //
26// //
27//--------------------------------------------------------------------//
28
08048cd3 29#include <Rtypes.h>
30#include <TROOT.h>
571dda3d 31
5c7c93fa 32#include <TSeqCollection.h>
08048cd3 33#include <TClonesArray.h>
34#include <TGeoManager.h>
35#include <TTree.h>
36#include <TFile.h>
37#include <TH2F.h>
571dda3d 38
5c7c93fa 39#include "AliGeomManager.h"
0e46b9ae 40#include "AliESDtrack.h"
af885e0f 41#include "AliESDEvent.h"
10d100d4 42#include "AliESDpid.h"
d076c8d5 43#include "AliLog.h"
0e46b9ae 44#include "AliTrackPointArray.h"
5c7c93fa 45#include "AliCDBManager.h"
596a855f 46
10d100d4 47//#include "AliTOFpidESD.h"
e0ddb533 48#include "AliTOFRecoParam.h"
3a646035 49#include "AliTOFReconstructor.h"
571dda3d 50#include "AliTOFcluster.h"
ba66add8 51#include "AliTOFGeometry.h"
571dda3d 52#include "AliTOFtracker.h"
0e46b9ae 53#include "AliTOFtrack.h"
571dda3d 54
0e46b9ae 55extern TGeoManager *gGeoManager;
d200609f 56extern TROOT *gROOT;
d4754572 57
596a855f 58ClassImp(AliTOFtracker)
59
74ea065c 60//_____________________________________________________________________________
e0ddb533 61AliTOFtracker::AliTOFtracker():
62 fRecoParam(0x0),
63 fGeom(0x0),
58d8d9a3 64 fN(0),
65 fNseeds(0),
66 fNseedsTOF(0),
67 fngoodmatch(0),
68 fnbadmatch(0),
69 fnunmatch(0),
70 fnmatch(0),
9d802709 71 fTracks(new TClonesArray("AliTOFtrack")),
72 fSeeds(new TClonesArray("AliESDtrack")),
5664c6ed 73 fHDigClusMap(0x0),
74 fHDigNClus(0x0),
75 fHDigClusTime(0x0),
76 fHDigClusToT(0x0),
77 fHRecNClus(0x0),
78 fHRecDist(0x0),
79 fHRecSigYVsP(0x0),
80 fHRecSigZVsP(0x0),
81 fHRecSigYVsPWin(0x0),
82 fHRecSigZVsPWin(0x0),
83 fCalTree(0x0),
84 fIch(-1),
85 fToT(-1.),
86 fTime(-1.),
87 fExpTimePi(-1.),
88 fExpTimeKa(-1.),
89 fExpTimePr(-1.)
58d8d9a3 90 {
74ea065c 91 //AliTOFtracker main Ctor
e0ddb533 92
91219c0b 93 // Gettimg the geometry
ba66add8 94 fGeom= new AliTOFGeometry();
3a646035 95
e0ddb533 96 InitCheckHists();
3a646035 97
7aeeaf38 98}
5664c6ed 99//_____________________________________________________________________________
100AliTOFtracker::~AliTOFtracker() {
101 //
102 // Dtor
103 //
e0ddb533 104
5664c6ed 105 SaveCheckHists();
e0ddb533 106
5d456bcd 107 if(!(AliCDBManager::Instance()->GetCacheFlag())){
108 delete fRecoParam;
109 }
e0ddb533 110 delete fGeom;
5664c6ed 111 delete fHDigClusMap;
112 delete fHDigNClus;
113 delete fHDigClusTime;
114 delete fHDigClusToT;
115 delete fHRecNClus;
116 delete fHRecDist;
117 delete fHRecSigYVsP;
118 delete fHRecSigZVsP;
119 delete fHRecSigYVsPWin;
120 delete fHRecSigZVsPWin;
121 delete fCalTree;
9d802709 122 if (fTracks){
123 fTracks->Delete();
124 delete fTracks;
125 fTracks=0x0;
126 }
127 if (fSeeds){
128 fSeeds->Delete();
129 delete fSeeds;
130 fSeeds=0x0;
131 }
132
5664c6ed 133}
74ea065c 134//_____________________________________________________________________________
10d100d4 135void AliTOFtracker::GetPidSettings(AliESDpid *esdPID) {
136 //
137 // Sets TOF resolution from RecoParams
138 //
139 if (fRecoParam)
140 esdPID->GetTOFResponse().SetTimeResolution(fRecoParam->GetTimeResolution());
141 else
142 AliWarning("fRecoParam not yet set; cannot set PID settings");
143}
144//_____________________________________________________________________________
af885e0f 145Int_t AliTOFtracker::PropagateBack(AliESDEvent* event) {
74ea065c 146 //
147 // Gets seeds from ESD event and Match with TOF Clusters
148 //
149
3a646035 150 // initialize RecoParam for current event
bafe290d 151 AliDebug(1,"Initializing params for TOF");
3a646035 152
153 fRecoParam = AliTOFReconstructor::GetRecoParam(); // instantiate reco param from STEER...
90b234fe 154
3a646035 155 if (fRecoParam == 0x0) {
156 AliFatal("No Reco Param found for TOF!!!");
157 }
158 //fRecoParam->Dump();
a825d829 159 //if(fRecoParam->GetApplyPbPbCuts())fRecoParam=fRecoParam->GetPbPbparam();
90b234fe 160 //fRecoParam->PrintParameters();
161
74ea065c 162 //Initialise some counters
163
164 fNseeds=0;
165 fNseedsTOF=0;
166 fngoodmatch=0;
167 fnbadmatch=0;
168 fnunmatch=0;
169 fnmatch=0;
170
171 Int_t ntrk=event->GetNumberOfTracks();
172 fNseeds = ntrk;
74ea065c 173 TClonesArray &aESDTrack = *fSeeds;
174
175
176 //Load ESD tracks into a local Array of ESD Seeds
177
178 for (Int_t i=0; i<fNseeds; i++) {
179 AliESDtrack *t=event->GetTrack(i);
180 new(aESDTrack[i]) AliESDtrack(*t);
181 }
182
183 //Prepare ESD tracks candidates for TOF Matching
184 CollectESD();
185
186 //First Step with Strict Matching Criterion
187 MatchTracks(kFALSE);
188
189 //Second Step with Looser Matching Criterion
190 MatchTracks(kTRUE);
191
8a06b2a0 192 AliInfo(Form("Number of matched tracks = %d (good = %d, bad = %d)",fnmatch,fngoodmatch,fnbadmatch));
74ea065c 193
194 //Update the matched ESD tracks
195
196 for (Int_t i=0; i<ntrk; i++) {
197 AliESDtrack *t=event->GetTrack(i);
198 AliESDtrack *seed =(AliESDtrack*)fSeeds->UncheckedAt(i);
ff826920 199
af61c656 200 if ( (seed->GetStatus()&AliESDtrack::kTOFin)!=0 ) {
201 t->SetStatus(AliESDtrack::kTOFin);
202 //if(seed->GetTOFsignal()>0){
203 if ( (seed->GetStatus()&AliESDtrack::kTOFout)!=0 ) {
204 t->SetStatus(AliESDtrack::kTOFout);
205 t->SetTOFsignal(seed->GetTOFsignal());
206 t->SetTOFcluster(seed->GetTOFcluster());
207 t->SetTOFsignalToT(seed->GetTOFsignalToT());
208 t->SetTOFsignalRaw(seed->GetTOFsignalRaw());
209 t->SetTOFsignalDz(seed->GetTOFsignalDz());
46d7d82e 210 t->SetTOFsignalDx(seed->GetTOFsignalDx());
af61c656 211 t->SetTOFCalChannel(seed->GetTOFCalChannel());
212 Int_t tlab[3]; seed->GetTOFLabel(tlab);
213 t->SetTOFLabel(tlab);
214
e81ea7b6 215 Double_t alphaA = dynamic_cast<AliExternalTrackParam*>(t)->GetAlpha();
216 Double_t xA = dynamic_cast<AliExternalTrackParam*>(t)->GetX();
217 Double_t yA = dynamic_cast<AliExternalTrackParam*>(t)->GetY();
218 Double_t zA = dynamic_cast<AliExternalTrackParam*>(t)->GetZ();
219 Double_t p1A = dynamic_cast<AliExternalTrackParam*>(t)->GetSnp();
220 Double_t p2A = dynamic_cast<AliExternalTrackParam*>(t)->GetTgl();
221 Double_t p3A = dynamic_cast<AliExternalTrackParam*>(t)->GetSigned1Pt();
222 const Double_t *covA = dynamic_cast<AliExternalTrackParam*>(t)->GetCovariance();
223
224 // Make attention, please:
225 // AliESDtrack::fTOFInfo array does not be stored in the AliESDs.root file
226 // it is there only for a check during the reconstruction step.
227 Float_t info[10]; seed->GetTOFInfo(info);
24322e5c 228 t->SetTOFInfo(info);
e81ea7b6 229 AliDebug(3,Form(" distance=%f; residual in the pad reference frame: dX=%f, dZ=%f", info[0],info[1],info[2]));
230
231 // Check done:
232 // by calling the AliESDtrack::UpdateTrackParams,
233 // the current track parameters are changed
234 // and it could cause refit problems.
235 // We need to update only the following track parameters:
236 // the track length and expected times.
237 // Removed AliESDtrack::UpdateTrackParams call
238 // Called AliESDtrack::SetIntegratedTimes(...) and
239 // AliESDtrack::SetIntegratedLength() routines.
240 /*
241 AliTOFtrack *track = new AliTOFtrack(*seed);
242 t->UpdateTrackParams(track,AliESDtrack::kTOFout); // to be checked - AdC
243 delete track;
244 Double_t time[10]; t->GetIntegratedTimes(time);
245 */
246
247 Double_t time[10]; seed->GetIntegratedTimes(time);
248 t->SetIntegratedTimes(time);
249
250 Double_t length = seed->GetIntegratedLength();
251 t->SetIntegratedLength(length);
252
253 Double_t alphaB = dynamic_cast<AliExternalTrackParam*>(t)->GetAlpha();
254 Double_t xB = dynamic_cast<AliExternalTrackParam*>(t)->GetX();
255 Double_t yB = dynamic_cast<AliExternalTrackParam*>(t)->GetY();
256 Double_t zB = dynamic_cast<AliExternalTrackParam*>(t)->GetZ();
257 Double_t p1B = dynamic_cast<AliExternalTrackParam*>(t)->GetSnp();
258 Double_t p2B = dynamic_cast<AliExternalTrackParam*>(t)->GetTgl();
259 Double_t p3B = dynamic_cast<AliExternalTrackParam*>(t)->GetSigned1Pt();
260 const Double_t *covB = dynamic_cast<AliExternalTrackParam*>(t)->GetCovariance();
261 AliDebug(2,"Track params -now(before)-:");
262 AliDebug(2,Form(" X: %f(%f), Y: %f(%f), Z: %f(%f) --- alpha: %f(%f)",
263 xB,xA,
264 yB,yA,
265 zB,zA,
266 alphaB,alphaA));
267 AliDebug(2,Form(" p1: %f(%f), p2: %f(%f), p3: %f(%f)",
268 p1B,p1A,
269 p2B,p2A,
270 p3B,p3A));
271 AliDebug(2,Form(" cov1: %f(%f), cov2: %f(%f), cov3: %f(%f)"
272 " cov4: %f(%f), cov5: %f(%f), cov6: %f(%f)"
273 " cov7: %f(%f), cov8: %f(%f), cov9: %f(%f)"
274 " cov10: %f(%f), cov11: %f(%f), cov12: %f(%f)"
275 " cov13: %f(%f), cov14: %f(%f), cov15: %f(%f)",
276 covB[0],covA[0],
277 covB[1],covA[1],
278 covB[2],covA[2],
279 covB[3],covA[3],
280 covB[4],covA[4],
281 covB[5],covA[5],
282 covB[6],covA[6],
283 covB[7],covA[7],
284 covB[8],covA[8],
285 covB[9],covA[9],
286 covB[10],covA[10],
287 covB[11],covA[11],
288 covB[12],covA[12],
289 covB[13],covA[13],
290 covB[14],covA[14]
291 ));
292 AliDebug(3,Form(" TOF params: %6d %f %f %f %f %f %6d %3d %f %f %f %f %f %f",
af61c656 293 i,
294 t->GetTOFsignalRaw(),
295 t->GetTOFsignal(),
296 t->GetTOFsignalToT(),
297 t->GetTOFsignalDz(),
46d7d82e 298 t->GetTOFsignalDx(),
af61c656 299 t->GetTOFCalChannel(),
300 t->GetTOFcluster(),
301 t->GetIntegratedLength(),
302 time[0], time[1], time[2], time[3], time[4]
303 )
304 );
305 }
74ea065c 306 }
307 }
308
74ea065c 309 //Make TOF PID
10d100d4 310 // Now done in AliESDpid
311 // fPid->MakePID(event,timeZero);
74ea065c 312
9d802709 313 fSeeds->Clear();
314 fTracks->Clear();
74ea065c 315 return 0;
316
317}
318//_________________________________________________________________________
319void AliTOFtracker::CollectESD() {
320 //prepare the set of ESD tracks to be matched to clusters in TOF
5478df1f 321
322 Int_t seedsTOF1=0;
323 Int_t seedsTOF2=0;
74ea065c 324
74ea065c 325 TClonesArray &aTOFTrack = *fTracks;
326 for (Int_t i=0; i<fNseeds; i++) {
327
328 AliESDtrack *t =(AliESDtrack*)fSeeds->UncheckedAt(i);
329 if ((t->GetStatus()&AliESDtrack::kTPCout)==0)continue;
330
56da420e 331 AliTOFtrack *track = new AliTOFtrack(*t); // New
af61c656 332 Float_t x = (Float_t)track->GetX(); //New
333
334 // TRD 'good' tracks, already propagated at 371 cm
335 if ( ( (t->GetStatus()&AliESDtrack::kTRDout)!=0 ) &&
336 ( x >= AliTOFGeometry::Rmin() ) ) {
337 if ( track->PropagateToInnerTOF() ) {
338
339 AliDebug(1,Form(" TRD propagated track till rho = %fcm."
340 " And then the track has been propagated till rho = %fcm.",
341 x, (Float_t)track->GetX()));
342
343 track->SetSeedIndex(i);
344 t->UpdateTrackParams(track,AliESDtrack::kTOFin);
345 new(aTOFTrack[fNseedsTOF]) AliTOFtrack(*track);
346 fNseedsTOF++;
347 seedsTOF1++;
348 }
74ea065c 349 delete track;
350 }
351
352 // Propagate the rest of TPCbp
74ea065c 353 else {
af61c656 354 if ( track->PropagateToInnerTOF() ) {
355
356 AliDebug(1,Form(" TPC propagated track till rho = %fcm."
357 " And then the track has been propagated till rho = %fcm.",
358 x, (Float_t)track->GetX()));
359
74ea065c 360 track->SetSeedIndex(i);
af61c656 361 t->UpdateTrackParams(track,AliESDtrack::kTOFin);
74ea065c 362 new(aTOFTrack[fNseedsTOF]) AliTOFtrack(*track);
363 fNseedsTOF++;
5478df1f 364 seedsTOF2++;
74ea065c 365 }
366 delete track;
367 }
368 }
369
8a06b2a0 370 AliInfo(Form("Number of TOF seeds = %d (Type 1 = %d, Type 2 = %d)",fNseedsTOF,seedsTOF1,seedsTOF2));
7b61cd9c 371
74ea065c 372 // Sort according uncertainties on track position
373 fTracks->Sort();
374
375}
376//_________________________________________________________________________
377void AliTOFtracker::MatchTracks( Bool_t mLastStep){
378
e0ddb533 379
380 // Parameters used/regulating the reconstruction
381
382 static Float_t corrLen=0.75;
383 static Float_t detDepth=15.3;
d01bf4f4 384 static Float_t padDepth=0.5;
e0ddb533 385
6819758a 386 const Float_t kSpeedOfLight= 2.99792458e-2; // speed of light [cm/ps]
387 const Float_t kTimeOffset = 32.; // time offset for tracking algorithm [ps]
388
ba66add8 389 Float_t dY=AliTOFGeometry::XPad();
390 Float_t dZ=AliTOFGeometry::ZPad();
e0ddb533 391
392 Float_t sensRadius = fRecoParam->GetSensRadius();
393 Float_t stepSize = fRecoParam->GetStepSize();
394 Float_t scaleFact = fRecoParam->GetWindowScaleFact();
395 Float_t dyMax=fRecoParam->GetWindowSizeMaxY();
396 Float_t dzMax=fRecoParam->GetWindowSizeMaxZ();
397 Float_t dCut=fRecoParam->GetDistanceCut();
ac359ffe 398 Double_t maxChi2=fRecoParam->GetMaxChi2TRD();
e0ddb533 399 Bool_t timeWalkCorr = fRecoParam->GetTimeWalkCorr();
a838421b 400 if(!mLastStep){
401 AliDebug(1,"++++++++++++++TOF Reconstruction Parameters:++++++++++++ \n");
402 AliDebug(1,Form("TOF sens radius: %f",sensRadius));
403 AliDebug(1,Form("TOF step size: %f",stepSize));
404 AliDebug(1,Form("TOF Window scale factor: %f",scaleFact));
405 AliDebug(1,Form("TOF Window max dy: %f",dyMax));
406 AliDebug(1,Form("TOF Window max dz: %f",dzMax));
407 AliDebug(1,Form("TOF distance Cut: %f",dCut));
408 AliDebug(1,Form("TOF Max Chi2: %f",maxChi2));
409 AliDebug(1,Form("Time Walk Correction? : %d",timeWalkCorr));
410 }
74ea065c 411
53884c34 412 //Match ESD tracks to clusters in TOF
a533f541 413
e0ddb533 414 // Get the number of propagation steps
e0ddb533 415 Int_t nSteps=(Int_t)(detDepth/stepSize);
7bf28302 416
417 //PH Arrays (moved outside of the loop)
418 Float_t * trackPos[4];
419 for (Int_t ii=0; ii<4; ii++) trackPos[ii] = new Float_t[nSteps];
128563f6 420 Int_t * clind = new Int_t[fN];
74ea065c 421
53884c34 422 // Some init
423 const Int_t kNfoundMax = 10000; // related to nSteps value
424 Int_t index[kNfoundMax];
425 Float_t dist[kNfoundMax];
426 Float_t distZ[kNfoundMax];
24322e5c 427 Float_t distY[kNfoundMax]; // delta(rhoXphi) // AdC
53884c34 428 Float_t cxpos[kNfoundMax];
429 Float_t crecL[kNfoundMax];
430 const Int_t kNclusterMax = 1000; // related to fN value
431 TGeoHMatrix global[kNclusterMax];
432
af61c656 433 //The matching loop
c0545837 434 for (Int_t iseed=0; iseed<fNseedsTOF; iseed++) {
74ea065c 435
53884c34 436 for (Int_t ii=0; ii<kNfoundMax; ii++) {
437 index[ii] = -1;
438 dist[ii] = 9999.;
439 distZ[ii] = 9999.;
24322e5c 440 distY[ii] = 9999.;
53884c34 441 cxpos[ii] = 9999.;
442 crecL[ii] = 0.;
443 }
444 for (Int_t ii=0; ii<kNclusterMax; ii++)
445 global[ii] = 0x0;
446
c0545837 447 AliTOFtrack *track =(AliTOFtrack*)fTracks->UncheckedAt(iseed);
74ea065c 448 AliESDtrack *t =(AliESDtrack*)fSeeds->UncheckedAt(track->GetSeedIndex());
af61c656 449 //if ( t->GetTOFsignal()>0. ) continue;
450 if ( (t->GetStatus()&AliESDtrack::kTOFout)!=0 ) continue;
74ea065c 451 AliTOFtrack *trackTOFin =new AliTOFtrack(*track);
74ea065c 452
74ea065c 453 // Determine a window around the track
74ea065c 454 Double_t x,par[5];
455 trackTOFin->GetExternalParameters(x,par);
456 Double_t cov[15];
457 trackTOFin->GetExternalCovariance(cov);
6c94f330 458
53884c34 459 if (cov[0]<0. || cov[2]<0.) {
460 AliWarning(Form("Very strange track (%d)! At least one of its covariance matrix diagonal elements is negative!",iseed));
ecd795d8 461 //delete trackTOFin;
462 //continue;
53884c34 463 }
464
74ea065c 465 Double_t dphi=
e0ddb533 466 scaleFact*
ecd795d8 467 ((5*TMath::Sqrt(TMath::Abs(cov[0])) + 0.5*dY + 2.5*TMath::Abs(par[2]))/sensRadius);
74ea065c 468 Double_t dz=
e0ddb533 469 scaleFact*
ecd795d8 470 (5*TMath::Sqrt(TMath::Abs(cov[2])) + 0.5*dZ + 2.5*TMath::Abs(par[3]));
6c94f330 471
74ea065c 472 Double_t phi=TMath::ATan2(par[0],x) + trackTOFin->GetAlpha();
473 if (phi<-TMath::Pi())phi+=2*TMath::Pi();
474 if (phi>=TMath::Pi())phi-=2*TMath::Pi();
475 Double_t z=par[1];
476
c0545837 477 //upper limit on window's size.
478
e0ddb533 479 if(dz> dzMax) dz=dzMax;
480 if(dphi*sensRadius> dyMax) dphi=dyMax/sensRadius;
c0545837 481
482
74ea065c 483 Int_t nc=0;
7b61cd9c 484
74ea065c 485 // find the clusters in the window of the track
486
487 for (Int_t k=FindClusterIndex(z-dz); k<fN; k++) {
7b61cd9c 488
53884c34 489 if (nc>=kNclusterMax) {
490 AliWarning("No more matchable clusters can be stored! Please, increase the corresponding vectors size.");
491 break;
492 }
493
74ea065c 494 AliTOFcluster *c=fClusters[k];
495 if (c->GetZ() > z+dz) break;
496 if (c->IsUsed()) continue;
11c7ff68 497
17149e6b 498 if (!c->GetStatus()) {
53884c34 499 AliDebug(1,"Cluster in channel declared bad!");
500 continue; // skip bad channels as declared in OCDB
17149e6b 501 }
7b61cd9c 502
74ea065c 503 Double_t dph=TMath::Abs(c->GetPhi()-phi);
504 if (dph>TMath::Pi()) dph-=2.*TMath::Pi();
9b49e4c9 505 if (TMath::Abs(dph)>dphi) continue;
ba66add8 506
6c94f330 507 Double_t yc=(c->GetPhi() - trackTOFin->GetAlpha())*c->GetR();
508 Double_t p[2]={yc, c->GetZ()};
3c609b5c 509 Double_t cov2[3]= {dY*dY/12., 0., dZ*dZ/12.};
510 if (trackTOFin->AliExternalTrackParam::GetPredictedChi2(p,cov2) > maxChi2)continue;
6c94f330 511
128563f6 512 clind[nc] = k;
c0545837 513 Char_t path[100];
514 Int_t ind[5];
128563f6 515 ind[0]=c->GetDetInd(0);
516 ind[1]=c->GetDetInd(1);
517 ind[2]=c->GetDetInd(2);
518 ind[3]=c->GetDetInd(3);
519 ind[4]=c->GetDetInd(4);
c0545837 520 fGeom->GetVolumePath(ind,path);
521 gGeoManager->cd(path);
522 global[nc] = *gGeoManager->GetCurrentMatrix();
74ea065c 523 nc++;
524 }
525
53884c34 526 AliDebug(1,Form(" Number of matchable TOF clusters for the track number %d: %d",iseed,nc));
527
74ea065c 528 //start fine propagation
529
530 Int_t nStepsDone = 0;
531 for( Int_t istep=0; istep<nSteps; istep++){
532
ba66add8 533 Float_t xs=AliTOFGeometry::RinTOF()+istep*0.1;
534 Double_t ymax=xs*TMath::Tan(0.5*AliTOFGeometry::GetAlpha());
74ea065c 535
536 Bool_t skip=kFALSE;
537 Double_t ysect=trackTOFin->GetYat(xs,skip);
6c94f330 538 if (skip) break;
74ea065c 539 if (ysect > ymax) {
ba66add8 540 if (!trackTOFin->Rotate(AliTOFGeometry::GetAlpha())) {
74ea065c 541 break;
542 }
543 } else if (ysect <-ymax) {
13c769b4 544 if (!trackTOFin->Rotate(-AliTOFGeometry::GetAlpha())) {
74ea065c 545 break;
546 }
547 }
548
549 if(!trackTOFin->PropagateTo(xs)) {
550 break;
551 }
552
553 nStepsDone++;
554
555 // store the running point (Globalrf) - fine propagation
556
6c94f330 557 Double_t r[3];
558 trackTOFin->GetXYZ(r);
559 trackPos[0][istep]= (Float_t) r[0];
560 trackPos[1][istep]= (Float_t) r[1];
561 trackPos[2][istep]= (Float_t) r[2];
74ea065c 562 trackPos[3][istep]= trackTOFin->GetIntegratedLength();
563 }
564
565
566 Int_t nfound = 0;
d01bf4f4 567 Bool_t accept = kFALSE;
6819758a 568 Bool_t isInside = kFALSE;
74ea065c 569 for (Int_t istep=0; istep<nStepsDone; istep++) {
570
53884c34 571 if (nfound>=kNfoundMax) {
572 AliWarning("No more track positions can be stored! Please, increase the corresponding vectors size.");
573 break;
574 }
74ea065c 575
53884c34 576 Float_t ctrackPos[3];
ff826920 577 ctrackPos[0] = trackPos[0][istep];
578 ctrackPos[1] = trackPos[1][istep];
579 ctrackPos[2] = trackPos[2][istep];
74ea065c 580
581 //now see whether the track matches any of the TOF clusters
582
524da123 583 Float_t dist3d[3];
ff826920 584 accept = kFALSE;
585 for (Int_t i=0; i<nc; i++) {
524da123 586 isInside = fGeom->IsInsideThePad(global[i],ctrackPos,dist3d);
d01bf4f4 587
6819758a 588 if ( mLastStep ) {
589 Float_t yLoc = dist3d[1];
590 Float_t rLoc = TMath::Sqrt(dist3d[0]*dist3d[0]+dist3d[2]*dist3d[2]);
591 accept = (TMath::Abs(yLoc)<padDepth*0.5 && rLoc<dCut);
592 AliDebug(2," I am in the case mLastStep==kTRUE ");
d01bf4f4 593 }
ff826920 594 else {
d01bf4f4 595 accept = isInside;
596 }
ff826920 597 if (accept) {
6819758a 598
599 dist[nfound] = TMath::Sqrt(dist3d[0]*dist3d[0] +
600 dist3d[1]*dist3d[1] +
601 dist3d[2]*dist3d[2]);
53884c34 602 AliDebug(2,Form(" dist3dLoc[0] = %f, dist3dLoc[1] = %f, dist3dLoc[2] = %f ",
6819758a 603 dist3d[0],dist3d[1],dist3d[2]));
604 distZ[nfound] = dist3d[2]; // Z distance in the RF of the
605 // hit pad closest to the
606 // reconstructed track
24322e5c 607 distY[nfound] = dist3d[0]; // X distance in the RF of the
608 // hit pad closest to the
609 // reconstructed track
610 // It corresponds to Y coordinate
611 // in tracking RF
612
6819758a 613
24322e5c 614 AliDebug(2,Form(" dist3dLoc[0] = %f --- distY[%d] = %f",
615 dist3d[0],nfound,distY[nfound]));
53884c34 616 AliDebug(2,Form(" dist3dLoc[2] = %f --- distZ[%d] = %f",
6819758a 617 dist3d[2],nfound,distZ[nfound]));
618
24322e5c 619
ff826920 620 crecL[nfound] = trackPos[3][istep];
621 index[nfound] = clind[i]; // store cluster id
622 cxpos[nfound] = AliTOFGeometry::RinTOF()+istep*0.1; //store prop.radius
74ea065c 623 nfound++;
d01bf4f4 624 if(accept &&!mLastStep)break;
74ea065c 625 }//end if accept
524da123 626
74ea065c 627 } //end for on the clusters
d01bf4f4 628 if(accept &&!mLastStep)break;
74ea065c 629 } //end for on the steps
630
53884c34 631 AliDebug(1,Form(" Number of track points for the track number %d: %d",iseed,nfound));
9b49e4c9 632
633
74ea065c 634 if (nfound == 0 ) {
635 fnunmatch++;
7bf28302 636 delete trackTOFin;
74ea065c 637 continue;
638 }
639
640 fnmatch++;
641
642 // now choose the cluster to be matched with the track.
643
90b234fe 644 Int_t idclus=-1;
74ea065c 645 Float_t recL = 0.;
646 Float_t xpos=0.;
647 Float_t mindist=1000.;
e0ddb533 648 Float_t mindistZ=0.;
24322e5c 649 Float_t mindistY=0.;
74ea065c 650 for (Int_t iclus= 0; iclus<nfound;iclus++){
651 if (dist[iclus]< mindist){
652 mindist = dist[iclus];
6819758a 653 mindistZ = distZ[iclus]; // Z distance in the RF of the hit
654 // pad closest to the reconstructed
655 // track
24322e5c 656 mindistY = distY[iclus]; // Y distance in the RF of the hit
657 // pad closest to the reconstructed
658 // track
74ea065c 659 xpos = cxpos[iclus];
660 idclus =index[iclus];
e0ddb533 661 recL=crecL[iclus]+corrLen*0.5;
74ea065c 662 }
663 }
664
d01bf4f4 665
74ea065c 666 AliTOFcluster *c=fClusters[idclus];
6819758a 667 /*
668 Float_t tiltangle = AliTOFGeometry::GetAngles(c->GetDetInd(1),c->GetDetInd(2))*TMath::DegToRad();
669 Float_t localCheck=-mindistZ;
670 localCheck/=TMath::Cos(tiltangle); // Z (tracking/ALICE RF) component of
671 // the distance between the
672 // reconstructed track and the
673 // TOF closest cluster
674 */
675 AliDebug(2, Form("%7d %7d %10d %10d %10d %10d %7d",
32ead898 676 iseed,
3a646035 677 fnmatch-1,
32ead898 678 TMath::Abs(trackTOFin->GetLabel()),
679 c->GetLabel(0), c->GetLabel(1), c->GetLabel(2),
680 idclus)); // AdC
681
e0ddb533 682 c->Use();
74ea065c 683
684 // Track length correction for matching Step 2
685
686 if(mLastStep){
687 Float_t rc=TMath::Sqrt(c->GetR()*c->GetR() + c->GetZ()*c->GetZ());
688 Float_t rt=TMath::Sqrt(trackPos[0][70]*trackPos[0][70]
689 +trackPos[1][70]*trackPos[1][70]
690 +trackPos[2][70]*trackPos[2][70]);
691 Float_t dlt=rc-rt;
692 recL=trackPos[3][70]+dlt;
693 }
694
695 if (
696 (c->GetLabel(0)==TMath::Abs(trackTOFin->GetLabel()))
697 ||
698 (c->GetLabel(1)==TMath::Abs(trackTOFin->GetLabel()))
699 ||
700 (c->GetLabel(2)==TMath::Abs(trackTOFin->GetLabel()))
701 ) {
702 fngoodmatch++;
d3c7bfac 703
6819758a 704 AliDebug(2,Form(" track label good %5d",trackTOFin->GetLabel()));
d3c7bfac 705
74ea065c 706 }
53884c34 707 else {
74ea065c 708 fnbadmatch++;
d3c7bfac 709
6819758a 710 AliDebug(2,Form(" track label bad %5d",trackTOFin->GetLabel()));
d3c7bfac 711
74ea065c 712 }
713
714 delete trackTOFin;
715
a533f541 716 // Store quantities to be used in the TOF Calibration
ba66add8 717 Float_t tToT=AliTOFGeometry::ToTBinWidth()*c->GetToT()*1E-3; // in ns
7aeeaf38 718 t->SetTOFsignalToT(tToT);
6819758a 719 Float_t rawTime=AliTOFGeometry::TdcBinWidth()*c->GetTDCRAW()+kTimeOffset; // RAW time,in ps
d321691a 720 t->SetTOFsignalRaw(rawTime);
721 t->SetTOFsignalDz(mindistZ);
46d7d82e 722 t->SetTOFsignalDx(mindistY);
6819758a 723
24322e5c 724 Float_t info[10] = {mindist,mindistY,mindistZ,
725 0.,0.,0.,0.,0.,0.,0.};
726 t->SetTOFInfo(info);
727 AliDebug(2,Form(" distance=%f; residual in the pad reference frame: dX=%f, dZ=%f", info[0],info[1],info[2]));
728
729
a533f541 730 Int_t ind[5];
731 ind[0]=c->GetDetInd(0);
732 ind[1]=c->GetDetInd(1);
733 ind[2]=c->GetDetInd(2);
734 ind[3]=c->GetDetInd(3);
735 ind[4]=c->GetDetInd(4);
ba66add8 736 Int_t calindex = AliTOFGeometry::GetIndex(ind);
a533f541 737 t->SetTOFCalChannel(calindex);
11c7ff68 738
739 // keep track of the track labels in the matched cluster
740 Int_t tlab[3];
741 tlab[0]=c->GetLabel(0);
742 tlab[1]=c->GetLabel(1);
743 tlab[2]=c->GetLabel(2);
6819758a 744 AliDebug(2,Form(" tdc time of the matched track %6d = ",c->GetTDC()));
745 Double_t tof=AliTOFGeometry::TdcBinWidth()*c->GetTDC()+kTimeOffset; // in ps
5478df1f 746 AliDebug(2,Form(" tof time of the matched track: %f = ",tof));
5478df1f 747 Double_t tofcorr=tof;
748 if(timeWalkCorr)tofcorr=CorrectTimeWalk(mindistZ,tof);
749 AliDebug(2,Form(" tof time of the matched track, after TW corr: %f = ",tofcorr));
750 //Set TOF time signal and pointer to the matched cluster
751 t->SetTOFsignal(tofcorr);
ee77ad87 752 t->SetTOFcluster(idclus); // pointing to the recPoints tree
5478df1f 753
6819758a 754 AliDebug(2,Form(" Setting TOF raw time: %f, z distance: %f corrected time: %f ",rawTime,mindistZ,tofcorr));
755
5478df1f 756 //Tracking info
6819758a 757 Double_t time[AliPID::kSPECIES]; t->GetIntegratedTimes(time); // in ps
74ea065c 758 Double_t mom=t->GetP();
53884c34 759 AliDebug(2,Form(" Momentum for track %d -> %f", iseed,mom));
760 for (Int_t j=0;j<AliPID::kSPECIES;j++) {
304864ab 761 Double_t mass=AliPID::ParticleMass(j);
6819758a 762 time[j]+=(recL-trackPos[3][0])/kSpeedOfLight*TMath::Sqrt(mom*mom+mass*mass)/mom;
74ea065c 763 }
764
765 AliTOFtrack *trackTOFout = new AliTOFtrack(*t);
766 trackTOFout->PropagateTo(xpos);
77a9ea9a 767
768 // Fill the track residual histograms.
769 FillResiduals(trackTOFout,c,kFALSE);
770
af61c656 771 t->UpdateTrackParams(trackTOFout,AliESDtrack::kTOFout);
74ea065c 772 t->SetIntegratedLength(recL);
773 t->SetIntegratedTimes(time);
11c7ff68 774 t->SetTOFLabel(tlab);
5478df1f 775
776
5664c6ed 777 // Fill Reco-QA histos for Reconstruction
778 fHRecNClus->Fill(nc);
779 fHRecDist->Fill(mindist);
780 fHRecSigYVsP->Fill(mom,TMath::Sqrt(cov[0]));
781 fHRecSigZVsP->Fill(mom,TMath::Sqrt(cov[2]));
e0ddb533 782 fHRecSigYVsPWin->Fill(mom,dphi*sensRadius);
5664c6ed 783 fHRecSigZVsPWin->Fill(mom,dz);
784
785 // Fill Tree for on-the-fly offline Calibration
786
53884c34 787 if ( !((t->GetStatus() & AliESDtrack::kTIME)==0 ) ) {
5664c6ed 788 fIch=calindex;
789 fToT=tToT;
5478df1f 790 fTime=rawTime;
5664c6ed 791 fExpTimePi=time[2];
792 fExpTimeKa=time[3];
793 fExpTimePr=time[4];
794 fCalTree->Fill();
795 }
74ea065c 796 delete trackTOFout;
797 }
7bf28302 798 for (Int_t ii=0; ii<4; ii++) delete [] trackPos[ii];
128563f6 799 delete [] clind;
ba66add8 800
74ea065c 801}
802//_________________________________________________________________________
7b61cd9c 803Int_t AliTOFtracker::LoadClusters(TTree *cTree) {
74ea065c 804 //--------------------------------------------------------------------
805 //This function loads the TOF clusters
806 //--------------------------------------------------------------------
807
ba66add8 808 Int_t npadX = AliTOFGeometry::NpadX();
809 Int_t npadZ = AliTOFGeometry::NpadZ();
810 Int_t nStripA = AliTOFGeometry::NStripA();
811 Int_t nStripB = AliTOFGeometry::NStripB();
812 Int_t nStripC = AliTOFGeometry::NStripC();
5664c6ed 813
7b61cd9c 814 TBranch *branch=cTree->GetBranch("TOF");
74ea065c 815 if (!branch) {
7b61cd9c 816 AliError("can't get the branch with the TOF clusters !");
74ea065c 817 return 1;
818 }
819
9d802709 820 static TClonesArray dummy("AliTOFcluster",10000);
821 dummy.Clear();
822 TClonesArray *clusters=&dummy;
7b61cd9c 823 branch->SetAddress(&clusters);
74ea065c 824
7b61cd9c 825 cTree->GetEvent(0);
826 Int_t nc=clusters->GetEntriesFast();
5664c6ed 827 fHDigNClus->Fill(nc);
828
7b61cd9c 829 AliInfo(Form("Number of clusters: %d",nc));
74ea065c 830
7b61cd9c 831 for (Int_t i=0; i<nc; i++) {
832 AliTOFcluster *c=(AliTOFcluster*)clusters->UncheckedAt(i);
16a2e36a 833//PH fClusters[i]=new AliTOFcluster(*c); fN++;
834 fClusters[i]=c; fN++;
5664c6ed 835
836 // Fill Digits QA histos
837
838 Int_t isector = c->GetDetInd(0);
839 Int_t iplate = c->GetDetInd(1);
840 Int_t istrip = c->GetDetInd(2);
841 Int_t ipadX = c->GetDetInd(4);
842 Int_t ipadZ = c->GetDetInd(3);
843
ba66add8 844 Float_t time =(AliTOFGeometry::TdcBinWidth()*c->GetTDC())*1E-3; // in ns
845 Float_t tot = (AliTOFGeometry::TdcBinWidth()*c->GetToT())*1E-3;//in ns
5664c6ed 846
847 Int_t stripOffset = 0;
848 switch (iplate) {
849 case 0:
850 stripOffset = 0;
851 break;
852 case 1:
853 stripOffset = nStripC;
854 break;
855 case 2:
856 stripOffset = nStripC+nStripB;
857 break;
858 case 3:
859 stripOffset = nStripC+nStripB+nStripA;
860 break;
861 case 4:
862 stripOffset = nStripC+nStripB+nStripA+nStripB;
863 break;
864 default:
865 AliError(Form("Wrong plate number in TOF (%d) !",iplate));
866 break;
867 };
868 Int_t zindex=npadZ*(istrip+stripOffset)+(ipadZ+1);
869 Int_t phiindex=npadX*isector+ipadX+1;
870 fHDigClusMap->Fill(zindex,phiindex);
871 fHDigClusTime->Fill(time);
872 fHDigClusToT->Fill(tot);
873
7b61cd9c 874 }
74ea065c 875
74ea065c 876
877 return 0;
878}
879//_________________________________________________________________________
880void AliTOFtracker::UnloadClusters() {
881 //--------------------------------------------------------------------
882 //This function unloads TOF clusters
883 //--------------------------------------------------------------------
7b61cd9c 884 for (Int_t i=0; i<fN; i++) {
16a2e36a 885//PH delete fClusters[i];
7b61cd9c 886 fClusters[i] = 0x0;
74ea065c 887 }
7b61cd9c 888 fN=0;
74ea065c 889}
890
891//_________________________________________________________________________
892Int_t AliTOFtracker::FindClusterIndex(Double_t z) const {
893 //--------------------------------------------------------------------
894 // This function returns the index of the nearest cluster
895 //--------------------------------------------------------------------
896 if (fN==0) return 0;
897 if (z <= fClusters[0]->GetZ()) return 0;
898 if (z > fClusters[fN-1]->GetZ()) return fN;
899 Int_t b=0, e=fN-1, m=(b+e)/2;
900 for (; b<e; m=(b+e)/2) {
901 if (z > fClusters[m]->GetZ()) b=m+1;
902 else e=m;
903 }
904 return m;
905}
d4754572 906
907//_________________________________________________________________________
908Bool_t AliTOFtracker::GetTrackPoint(Int_t index, AliTrackPoint& p) const
909{
910 // Get track space point with index i
911 // Coordinates are in the global system
912 AliTOFcluster *cl = fClusters[index];
913 Float_t xyz[3];
914 xyz[0] = cl->GetR()*TMath::Cos(cl->GetPhi());
915 xyz[1] = cl->GetR()*TMath::Sin(cl->GetPhi());
916 xyz[2] = cl->GetZ();
468f26c6 917 Float_t phiangle = (Int_t(cl->GetPhi()*TMath::RadToDeg()/20.)+0.5)*20.*TMath::DegToRad();
918 Float_t sinphi = TMath::Sin(phiangle), cosphi = TMath::Cos(phiangle);
ba66add8 919 Float_t tiltangle = AliTOFGeometry::GetAngles(cl->GetDetInd(1),cl->GetDetInd(2))*TMath::DegToRad();
468f26c6 920 Float_t sinth = TMath::Sin(tiltangle), costh = TMath::Cos(tiltangle);
ba66add8 921 Float_t sigmay2 = AliTOFGeometry::XPad()*AliTOFGeometry::XPad()/12.;
922 Float_t sigmaz2 = AliTOFGeometry::ZPad()*AliTOFGeometry::ZPad()/12.;
468f26c6 923 Float_t cov[6];
924 cov[0] = sinphi*sinphi*sigmay2 + cosphi*cosphi*sinth*sinth*sigmaz2;
925 cov[1] = -sinphi*cosphi*sigmay2 + sinphi*cosphi*sinth*sinth*sigmaz2;
926 cov[2] = -cosphi*sinth*costh*sigmaz2;
927 cov[3] = cosphi*cosphi*sigmay2 + sinphi*sinphi*sinth*sinth*sigmaz2;
928 cov[4] = -sinphi*sinth*costh*sigmaz2;
929 cov[5] = costh*costh*sigmaz2;
930 p.SetXYZ(xyz[0],xyz[1],xyz[2],cov);
d4754572 931
932 // Detector numbering scheme
ba66add8 933 Int_t nSector = AliTOFGeometry::NSectors();
934 Int_t nPlate = AliTOFGeometry::NPlates();
935 Int_t nStripA = AliTOFGeometry::NStripA();
936 Int_t nStripB = AliTOFGeometry::NStripB();
937 Int_t nStripC = AliTOFGeometry::NStripC();
d4754572 938
939 Int_t isector = cl->GetDetInd(0);
940 if (isector >= nSector)
941 AliError(Form("Wrong sector number in TOF (%d) !",isector));
942 Int_t iplate = cl->GetDetInd(1);
943 if (iplate >= nPlate)
944 AliError(Form("Wrong plate number in TOF (%d) !",iplate));
945 Int_t istrip = cl->GetDetInd(2);
946
947 Int_t stripOffset = 0;
948 switch (iplate) {
949 case 0:
950 stripOffset = 0;
951 break;
952 case 1:
953 stripOffset = nStripC;
954 break;
955 case 2:
956 stripOffset = nStripC+nStripB;
957 break;
958 case 3:
959 stripOffset = nStripC+nStripB+nStripA;
960 break;
961 case 4:
962 stripOffset = nStripC+nStripB+nStripA+nStripB;
963 break;
964 default:
965 AliError(Form("Wrong plate number in TOF (%d) !",iplate));
966 break;
967 };
968
969 Int_t idet = (2*(nStripC+nStripB)+nStripA)*isector +
970 stripOffset +
971 istrip;
ae079791 972 UShort_t volid = AliGeomManager::LayerToVolUID(AliGeomManager::kTOF,idet);
d4754572 973 p.SetVolumeID((UShort_t)volid);
974 return kTRUE;
975}
5664c6ed 976//_________________________________________________________________________
977void AliTOFtracker::InitCheckHists() {
978
979 //Init histos for Digits/Reco QA and Calibration
980
981
0366f10f 982 TDirectory *dir = gDirectory;
983 TFile *logFileTOF = 0;
984
985 TSeqCollection *list = gROOT->GetListOfFiles();
986 int n = list->GetEntries();
987 Bool_t isThere=kFALSE;
988 for(int i=0; i<n; i++) {
989 logFileTOF = (TFile*)list->At(i);
990 if (strstr(logFileTOF->GetName(), "TOFQA.root")){
991 isThere=kTRUE;
992 break;
993 }
994 }
995
996 if(!isThere)logFileTOF = new TFile( "TOFQA.root","RECREATE");
997 logFileTOF->cd();
998
5664c6ed 999 fCalTree = new TTree("CalTree", "Tree for TOF calibration");
1000 fCalTree->Branch("TOFchannelindex",&fIch,"iTOFch/I");
1001 fCalTree->Branch("ToT",&fToT,"TOFToT/F");
1002 fCalTree->Branch("TOFtime",&fTime,"TOFtime/F");
1003 fCalTree->Branch("PionExpTime",&fExpTimePi,"PiExpTime/F");
1004 fCalTree->Branch("KaonExpTime",&fExpTimeKa,"KaExpTime/F");
1005 fCalTree->Branch("ProtonExpTime",&fExpTimePr,"PrExpTime/F");
1006
1007 //Digits "QA"
1008 fHDigClusMap = new TH2F("TOFDig_ClusMap", "",182,0.5,182.5,864, 0.5,864.5);
1009 fHDigNClus = new TH1F("TOFDig_NClus", "",200,0.5,200.5);
1010 fHDigClusTime = new TH1F("TOFDig_ClusTime", "",2000,0.,200.);
1011 fHDigClusToT = new TH1F("TOFDig_ClusToT", "",500,0.,100);
1012
1013 //Reco "QA"
1014 fHRecNClus =new TH1F("TOFRec_NClusW", "",50,0.5,50.5);
1015 fHRecDist=new TH1F("TOFRec_Dist", "",50,0.5,10.5);
1016 fHRecSigYVsP=new TH2F("TOFDig_SigYVsP", "",40,0.,4.,100, 0.,5.);
1017 fHRecSigZVsP=new TH2F("TOFDig_SigZVsP", "",40,0.,4.,100, 0.,5.);
1018 fHRecSigYVsPWin=new TH2F("TOFDig_SigYVsPWin", "",40,0.,4.,100, 0.,50.);
1019 fHRecSigZVsPWin=new TH2F("TOFDig_SigZVsPWin", "",40,0.,4.,100, 0.,50.);
0366f10f 1020
1021 dir->cd();
1022
5664c6ed 1023}
1024
1025//_________________________________________________________________________
1026void AliTOFtracker::SaveCheckHists() {
1027
1028 //write histos for Digits/Reco QA and Calibration
1029
1030 TDirectory *dir = gDirectory;
5664c6ed 1031 TFile *logFileTOF = 0;
1032
1033 TSeqCollection *list = gROOT->GetListOfFiles();
d200609f 1034 int n = list->GetEntries();
5664c6ed 1035 Bool_t isThere=kFALSE;
d200609f 1036 for(int i=0; i<n; i++) {
5664c6ed 1037 logFileTOF = (TFile*)list->At(i);
1038 if (strstr(logFileTOF->GetName(), "TOFQA.root")){
1039 isThere=kTRUE;
1040 break;
1041 }
1042 }
1043
0366f10f 1044 if(!isThere) {
1045 AliError(Form("File TOFQA.root not found!! not wring histograms...."));
1046 return;
1047 }
5664c6ed 1048 logFileTOF->cd();
1049 fHDigClusMap->Write(fHDigClusMap->GetName(), TObject::kOverwrite);
1050 fHDigNClus->Write(fHDigNClus->GetName(), TObject::kOverwrite);
1051 fHDigClusTime->Write(fHDigClusTime->GetName(), TObject::kOverwrite);
1052 fHDigClusToT->Write(fHDigClusToT->GetName(), TObject::kOverwrite);
1053 fHRecNClus->Write(fHRecNClus->GetName(), TObject::kOverwrite);
1054 fHRecDist->Write(fHRecDist->GetName(), TObject::kOverwrite);
1055 fHRecSigYVsP->Write(fHRecSigYVsP->GetName(), TObject::kOverwrite);
1056 fHRecSigZVsP->Write(fHRecSigZVsP->GetName(), TObject::kOverwrite);
1057 fHRecSigYVsPWin->Write(fHRecSigYVsPWin->GetName(), TObject::kOverwrite);
1058 fHRecSigZVsPWin->Write(fHRecSigZVsPWin->GetName(), TObject::kOverwrite);
1059 fCalTree->Write(fCalTree->GetName(),TObject::kOverwrite);
1060 logFileTOF->Flush();
1061
1062 dir->cd();
1063 }
e0ddb533 1064//_________________________________________________________________________
1065Float_t AliTOFtracker::CorrectTimeWalk( Float_t dist, Float_t tof) {
1066
1067 //dummy, for the moment
1068 Float_t tofcorr=0.;
ba66add8 1069 if(dist<AliTOFGeometry::ZPad()*0.5){
e0ddb533 1070 tofcorr=tof;
1071 //place here the actual correction
1072 }else{
1073 tofcorr=tof;
1074 }
1075 return tofcorr;
1076}
1077//_________________________________________________________________________
128563f6 1078
1079void AliTOFtracker::FillClusterArray(TObjArray* arr) const
1080{
1081 //
1082 // Returns the TOF cluster array
1083 //
1084
1085 if (fN==0)
1086 arr = 0x0;
1087 else
1088 for (Int_t i=0; i<fN; ++i) arr->Add(fClusters[i]);
1089
1090}
ff826920 1091//_________________________________________________________________________
1092