]>
Commit | Line | Data |
---|---|---|
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> |
0841bd02 | 34 | #include <TObjArray.h> |
08048cd3 | 35 | #include <TGeoManager.h> |
36 | #include <TTree.h> | |
37 | #include <TFile.h> | |
38 | #include <TH2F.h> | |
571dda3d | 39 | |
5c7c93fa | 40 | #include "AliGeomManager.h" |
0e46b9ae | 41 | #include "AliESDtrack.h" |
af885e0f | 42 | #include "AliESDEvent.h" |
10d100d4 | 43 | #include "AliESDpid.h" |
d076c8d5 | 44 | #include "AliLog.h" |
0e46b9ae | 45 | #include "AliTrackPointArray.h" |
5c7c93fa | 46 | #include "AliCDBManager.h" |
596a855f | 47 | |
10d100d4 | 48 | //#include "AliTOFpidESD.h" |
e0ddb533 | 49 | #include "AliTOFRecoParam.h" |
3a646035 | 50 | #include "AliTOFReconstructor.h" |
571dda3d | 51 | #include "AliTOFcluster.h" |
ba66add8 | 52 | #include "AliTOFGeometry.h" |
571dda3d | 53 | #include "AliTOFtracker.h" |
0e46b9ae | 54 | #include "AliTOFtrack.h" |
571dda3d | 55 | |
0e46b9ae | 56 | extern TGeoManager *gGeoManager; |
5480a4f2 | 57 | //extern TROOT *gROOT; |
d4754572 | 58 | |
de60fa8a | 59 | |
596a855f | 60 | ClassImp(AliTOFtracker) |
61 | ||
74ea065c | 62 | //_____________________________________________________________________________ |
e0ddb533 | 63 | AliTOFtracker::AliTOFtracker(): |
f31a249f | 64 | fkRecoParam(0x0), |
e0ddb533 | 65 | fGeom(0x0), |
58d8d9a3 | 66 | fN(0), |
67 | fNseeds(0), | |
68 | fNseedsTOF(0), | |
69 | fngoodmatch(0), | |
70 | fnbadmatch(0), | |
71 | fnunmatch(0), | |
72 | fnmatch(0), | |
9d802709 | 73 | fTracks(new TClonesArray("AliTOFtrack")), |
de60fa8a | 74 | fSeeds(new TObjArray(100)), |
75 | fTOFtrackPoints(new TObjArray(10)), | |
5664c6ed | 76 | fHDigClusMap(0x0), |
77 | fHDigNClus(0x0), | |
78 | fHDigClusTime(0x0), | |
79 | fHDigClusToT(0x0), | |
80 | fHRecNClus(0x0), | |
81 | fHRecDist(0x0), | |
82 | fHRecSigYVsP(0x0), | |
83 | fHRecSigZVsP(0x0), | |
84 | fHRecSigYVsPWin(0x0), | |
85 | fHRecSigZVsPWin(0x0), | |
86 | fCalTree(0x0), | |
87 | fIch(-1), | |
88 | fToT(-1.), | |
89 | fTime(-1.), | |
90 | fExpTimePi(-1.), | |
91 | fExpTimeKa(-1.), | |
115179c6 | 92 | fExpTimePr(-1.), |
93 | fNTOFmatched(0) | |
78c25bbc | 94 | { |
74ea065c | 95 | //AliTOFtracker main Ctor |
1d834a1e | 96 | |
78c25bbc | 97 | for (Int_t ii=0; ii<kMaxCluster; ii++) fClusters[ii]=0x0; |
3a646035 | 98 | |
78c25bbc | 99 | // Getting the geometry |
100 | fGeom = new AliTOFGeometry(); | |
101 | ||
102 | InitCheckHists(); | |
3a646035 | 103 | |
7aeeaf38 | 104 | } |
5664c6ed | 105 | //_____________________________________________________________________________ |
106 | AliTOFtracker::~AliTOFtracker() { | |
107 | // | |
108 | // Dtor | |
109 | // | |
e0ddb533 | 110 | |
5664c6ed | 111 | SaveCheckHists(); |
e0ddb533 | 112 | |
5d456bcd | 113 | if(!(AliCDBManager::Instance()->GetCacheFlag())){ |
f31a249f | 114 | delete fkRecoParam; |
5d456bcd | 115 | } |
e0ddb533 | 116 | delete fGeom; |
5664c6ed | 117 | delete fHDigClusMap; |
118 | delete fHDigNClus; | |
119 | delete fHDigClusTime; | |
120 | delete fHDigClusToT; | |
121 | delete fHRecNClus; | |
122 | delete fHRecDist; | |
123 | delete fHRecSigYVsP; | |
124 | delete fHRecSigZVsP; | |
125 | delete fHRecSigYVsPWin; | |
126 | delete fHRecSigZVsPWin; | |
127 | delete fCalTree; | |
9d802709 | 128 | if (fTracks){ |
129 | fTracks->Delete(); | |
130 | delete fTracks; | |
131 | fTracks=0x0; | |
132 | } | |
133 | if (fSeeds){ | |
134 | fSeeds->Delete(); | |
135 | delete fSeeds; | |
136 | fSeeds=0x0; | |
137 | } | |
de60fa8a | 138 | if (fTOFtrackPoints){ |
139 | fTOFtrackPoints->Delete(); | |
140 | delete fTOFtrackPoints; | |
141 | fTOFtrackPoints=0x0; | |
142 | } | |
9d802709 | 143 | |
7e96dc55 | 144 | for (Int_t ii=0; ii<kMaxCluster; ii++) |
145 | if (fClusters[ii]) fClusters[ii]->Delete(); | |
1d834a1e | 146 | |
115179c6 | 147 | for(Int_t i=0; i< 20000;i++){ |
148 | if(fClusterESD[i]){ | |
149 | delete fClusterESD[i]; | |
150 | fClusterESD[i] = NULL; | |
151 | } | |
152 | } | |
153 | ||
154 | ||
5664c6ed | 155 | } |
74ea065c | 156 | //_____________________________________________________________________________ |
10d100d4 | 157 | void AliTOFtracker::GetPidSettings(AliESDpid *esdPID) { |
158 | // | |
159 | // Sets TOF resolution from RecoParams | |
160 | // | |
f31a249f | 161 | if (fkRecoParam) |
162 | esdPID->GetTOFResponse().SetTimeResolution(fkRecoParam->GetTimeResolution()); | |
10d100d4 | 163 | else |
f31a249f | 164 | AliWarning("fkRecoParam not yet set; cannot set PID settings"); |
10d100d4 | 165 | } |
166 | //_____________________________________________________________________________ | |
f31a249f | 167 | Int_t AliTOFtracker::PropagateBack(AliESDEvent * const event) { |
74ea065c | 168 | // |
169 | // Gets seeds from ESD event and Match with TOF Clusters | |
170 | // | |
171 | ||
115179c6 | 172 | if(fNTOFmatched==0) |
173 | event->SetTOFcluster(1,fClusterESD); | |
174 | ||
175 | if (fN==0) { | |
176 | AliInfo("No TOF recPoints to be matched with reconstructed tracks"); | |
177 | return 0; | |
178 | } | |
179 | ||
3a646035 | 180 | // initialize RecoParam for current event |
bafe290d | 181 | AliDebug(1,"Initializing params for TOF"); |
3a646035 | 182 | |
f31a249f | 183 | fkRecoParam = AliTOFReconstructor::GetRecoParam(); // instantiate reco param from STEER... |
90b234fe | 184 | |
f31a249f | 185 | if (fkRecoParam == 0x0) { |
3a646035 | 186 | AliFatal("No Reco Param found for TOF!!!"); |
187 | } | |
f31a249f | 188 | //fkRecoParam->Dump(); |
189 | //if(fkRecoParam->GetApplyPbPbCuts())fkRecoParam=fkRecoParam->GetPbPbparam(); | |
190 | //fkRecoParam->PrintParameters(); | |
191 | ||
74ea065c | 192 | //Initialise some counters |
193 | ||
194 | fNseeds=0; | |
195 | fNseedsTOF=0; | |
196 | fngoodmatch=0; | |
197 | fnbadmatch=0; | |
198 | fnunmatch=0; | |
199 | fnmatch=0; | |
200 | ||
201 | Int_t ntrk=event->GetNumberOfTracks(); | |
202 | fNseeds = ntrk; | |
74ea065c | 203 | |
204 | ||
205 | //Load ESD tracks into a local Array of ESD Seeds | |
0841bd02 | 206 | for (Int_t i=0; i<fNseeds; i++) |
207 | fSeeds->AddLast(event->GetTrack(i)); | |
74ea065c | 208 | |
209 | //Prepare ESD tracks candidates for TOF Matching | |
210 | CollectESD(); | |
211 | ||
115179c6 | 212 | if (fNseeds==0 || fNseedsTOF==0) { |
213 | AliInfo("No seeds to try TOF match"); | |
214 | return 0 ; | |
215 | } | |
216 | ||
74ea065c | 217 | //First Step with Strict Matching Criterion |
115179c6 | 218 | MatchTracks(0); |
74ea065c | 219 | |
220 | //Second Step with Looser Matching Criterion | |
115179c6 | 221 | MatchTracks(1); |
222 | ||
223 | //Third Step without kTOFout flag (just to update clusters) | |
224 | MatchTracks(2); | |
225 | ||
226 | event->SetTOFcluster(fNTOFmatched,fClusterESD); | |
227 | ||
228 | if (fNTOFmatched==0) { | |
229 | AliInfo("No TOF recPoints to be matched with reconstructed tracks"); | |
230 | return 0; | |
231 | } | |
74ea065c | 232 | |
8a06b2a0 | 233 | AliInfo(Form("Number of matched tracks = %d (good = %d, bad = %d)",fnmatch,fngoodmatch,fnbadmatch)); |
74ea065c | 234 | |
235 | //Update the matched ESD tracks | |
236 | ||
237 | for (Int_t i=0; i<ntrk; i++) { | |
238 | AliESDtrack *t=event->GetTrack(i); | |
0841bd02 | 239 | AliESDtrack *seed =(AliESDtrack*)fSeeds->At(i); |
ff826920 | 240 | |
af61c656 | 241 | if ( (seed->GetStatus()&AliESDtrack::kTOFin)!=0 ) { |
242 | t->SetStatus(AliESDtrack::kTOFin); | |
243 | //if(seed->GetTOFsignal()>0){ | |
244 | if ( (seed->GetStatus()&AliESDtrack::kTOFout)!=0 ) { | |
245 | t->SetStatus(AliESDtrack::kTOFout); | |
246 | t->SetTOFsignal(seed->GetTOFsignal()); | |
247 | t->SetTOFcluster(seed->GetTOFcluster()); | |
248 | t->SetTOFsignalToT(seed->GetTOFsignalToT()); | |
249 | t->SetTOFsignalRaw(seed->GetTOFsignalRaw()); | |
250 | t->SetTOFsignalDz(seed->GetTOFsignalDz()); | |
46d7d82e | 251 | t->SetTOFsignalDx(seed->GetTOFsignalDx()); |
8b441e14 | 252 | t->SetTOFDeltaBC(seed->GetTOFDeltaBC()); |
253 | t->SetTOFL0L1(seed->GetTOFL0L1()); | |
af61c656 | 254 | t->SetTOFCalChannel(seed->GetTOFCalChannel()); |
255 | Int_t tlab[3]; seed->GetTOFLabel(tlab); | |
256 | t->SetTOFLabel(tlab); | |
257 | ||
0841bd02 | 258 | Double_t alphaA = (Double_t)t->GetAlpha(); |
259 | Double_t xA = (Double_t)t->GetX(); | |
260 | Double_t yA = (Double_t)t->GetY(); | |
261 | Double_t zA = (Double_t)t->GetZ(); | |
262 | Double_t p1A = (Double_t)t->GetSnp(); | |
263 | Double_t p2A = (Double_t)t->GetTgl(); | |
264 | Double_t p3A = (Double_t)t->GetSigned1Pt(); | |
265 | const Double_t *covA = (Double_t*)t->GetCovariance(); | |
e81ea7b6 | 266 | |
267 | // Make attention, please: | |
268 | // AliESDtrack::fTOFInfo array does not be stored in the AliESDs.root file | |
269 | // it is there only for a check during the reconstruction step. | |
270 | Float_t info[10]; seed->GetTOFInfo(info); | |
24322e5c | 271 | t->SetTOFInfo(info); |
e81ea7b6 | 272 | AliDebug(3,Form(" distance=%f; residual in the pad reference frame: dX=%f, dZ=%f", info[0],info[1],info[2])); |
273 | ||
274 | // Check done: | |
275 | // by calling the AliESDtrack::UpdateTrackParams, | |
276 | // the current track parameters are changed | |
277 | // and it could cause refit problems. | |
278 | // We need to update only the following track parameters: | |
279 | // the track length and expected times. | |
280 | // Removed AliESDtrack::UpdateTrackParams call | |
281 | // Called AliESDtrack::SetIntegratedTimes(...) and | |
282 | // AliESDtrack::SetIntegratedLength() routines. | |
283 | /* | |
284 | AliTOFtrack *track = new AliTOFtrack(*seed); | |
285 | t->UpdateTrackParams(track,AliESDtrack::kTOFout); // to be checked - AdC | |
286 | delete track; | |
115179c6 | 287 | Double_t time[AliPID::kSPECIESC]; t->GetIntegratedTimes(time); |
e81ea7b6 | 288 | */ |
289 | ||
115179c6 | 290 | Double_t time[AliPID::kSPECIESC]; seed->GetIntegratedTimes(time); |
e81ea7b6 | 291 | t->SetIntegratedTimes(time); |
292 | ||
293 | Double_t length = seed->GetIntegratedLength(); | |
294 | t->SetIntegratedLength(length); | |
295 | ||
0841bd02 | 296 | Double_t alphaB = (Double_t)t->GetAlpha(); |
297 | Double_t xB = (Double_t)t->GetX(); | |
298 | Double_t yB = (Double_t)t->GetY(); | |
299 | Double_t zB = (Double_t)t->GetZ(); | |
300 | Double_t p1B = (Double_t)t->GetSnp(); | |
301 | Double_t p2B = (Double_t)t->GetTgl(); | |
302 | Double_t p3B = (Double_t)t->GetSigned1Pt(); | |
303 | const Double_t *covB = (Double_t*)t->GetCovariance(); | |
115179c6 | 304 | AliDebug(3,"Track params -now(before)-:"); |
305 | AliDebug(3,Form(" X: %f(%f), Y: %f(%f), Z: %f(%f) --- alpha: %f(%f)", | |
e81ea7b6 | 306 | xB,xA, |
307 | yB,yA, | |
308 | zB,zA, | |
309 | alphaB,alphaA)); | |
115179c6 | 310 | AliDebug(3,Form(" p1: %f(%f), p2: %f(%f), p3: %f(%f)", |
e81ea7b6 | 311 | p1B,p1A, |
312 | p2B,p2A, | |
313 | p3B,p3A)); | |
115179c6 | 314 | AliDebug(3,Form(" cov1: %f(%f), cov2: %f(%f), cov3: %f(%f)" |
e81ea7b6 | 315 | " cov4: %f(%f), cov5: %f(%f), cov6: %f(%f)" |
316 | " cov7: %f(%f), cov8: %f(%f), cov9: %f(%f)" | |
317 | " cov10: %f(%f), cov11: %f(%f), cov12: %f(%f)" | |
318 | " cov13: %f(%f), cov14: %f(%f), cov15: %f(%f)", | |
319 | covB[0],covA[0], | |
320 | covB[1],covA[1], | |
321 | covB[2],covA[2], | |
322 | covB[3],covA[3], | |
323 | covB[4],covA[4], | |
324 | covB[5],covA[5], | |
325 | covB[6],covA[6], | |
326 | covB[7],covA[7], | |
327 | covB[8],covA[8], | |
328 | covB[9],covA[9], | |
329 | covB[10],covA[10], | |
330 | covB[11],covA[11], | |
331 | covB[12],covA[12], | |
332 | covB[13],covA[13], | |
333 | covB[14],covA[14] | |
334 | )); | |
115179c6 | 335 | AliDebug(2,Form(" TOF params: %6d %f %f %f %f %f %6d %3d %f", |
af61c656 | 336 | i, |
337 | t->GetTOFsignalRaw(), | |
338 | t->GetTOFsignal(), | |
339 | t->GetTOFsignalToT(), | |
340 | t->GetTOFsignalDz(), | |
46d7d82e | 341 | t->GetTOFsignalDx(), |
af61c656 | 342 | t->GetTOFCalChannel(), |
343 | t->GetTOFcluster(), | |
115179c6 | 344 | t->GetIntegratedLength())); |
345 | AliDebug(2,Form(" %f %f %f %f %f %f %f %f %f", | |
346 | time[0], time[1], time[2], time[3], time[4], time[5], time[6], time[7], time[8])); | |
af61c656 | 347 | } |
74ea065c | 348 | } |
349 | } | |
350 | ||
115179c6 | 351 | if(fNTOFmatched){ |
352 | Int_t *matchmap = new Int_t[fNTOFmatched]; | |
353 | event->SetTOFcluster(fNTOFmatched,fClusterESD,matchmap); | |
354 | for (Int_t i=0; i<ntrk; i++) { // remapping after TOF matching selection | |
355 | AliESDtrack *t=event->GetTrack(i); | |
356 | t->ReMapTOFcluster(fNTOFmatched,matchmap); | |
357 | } | |
358 | ||
359 | delete[] matchmap; | |
360 | } | |
361 | ||
74ea065c | 362 | //Make TOF PID |
10d100d4 | 363 | // Now done in AliESDpid |
364 | // fPid->MakePID(event,timeZero); | |
74ea065c | 365 | |
de60fa8a | 366 | fSeeds->Clear(); |
1d834a1e | 367 | //fTracks->Delete(); |
368 | fTracks->Clear(); | |
74ea065c | 369 | return 0; |
370 | ||
371 | } | |
372 | //_________________________________________________________________________ | |
373 | void AliTOFtracker::CollectESD() { | |
374 | //prepare the set of ESD tracks to be matched to clusters in TOF | |
5478df1f | 375 | |
376 | Int_t seedsTOF1=0; | |
78c25bbc | 377 | Int_t seedsTOF3=0; |
5478df1f | 378 | Int_t seedsTOF2=0; |
74ea065c | 379 | |
74ea065c | 380 | TClonesArray &aTOFTrack = *fTracks; |
381 | for (Int_t i=0; i<fNseeds; i++) { | |
382 | ||
0841bd02 | 383 | AliESDtrack *t =(AliESDtrack*)fSeeds->At(i); |
74ea065c | 384 | if ((t->GetStatus()&AliESDtrack::kTPCout)==0)continue; |
385 | ||
56da420e | 386 | AliTOFtrack *track = new AliTOFtrack(*t); // New |
af61c656 | 387 | Float_t x = (Float_t)track->GetX(); //New |
388 | ||
78c25bbc | 389 | // TRD 'good' tracks |
390 | if ( ( (t->GetStatus()&AliESDtrack::kTRDout)!=0 ) ) { | |
af61c656 | 391 | |
78c25bbc | 392 | AliDebug(1,Form(" Before propagation till inner TOF radius, ESDtrackLength=%f, TOFtrackLength=%f",t->GetIntegratedLength(),track->GetIntegratedLength())); |
393 | ||
394 | // TRD 'good' tracks, already propagated at 371 cm | |
395 | if( x >= AliTOFGeometry::Rmin() ) { | |
396 | ||
397 | if ( track->PropagateToInnerTOF() ) { | |
398 | ||
399 | AliDebug(1,Form(" TRD propagated track till rho = %fcm." | |
400 | " And then the track has been propagated till rho = %fcm.", | |
401 | x, (Float_t)track->GetX())); | |
402 | ||
403 | track->SetSeedIndex(i); | |
404 | t->UpdateTrackParams(track,AliESDtrack::kTOFin); | |
405 | new(aTOFTrack[fNseedsTOF]) AliTOFtrack(*track); | |
406 | fNseedsTOF++; | |
407 | seedsTOF1++; | |
408 | ||
409 | AliDebug(1,Form(" After propagation till inner TOF radius, ESDtrackLength=%f, TOFtrackLength=%f",t->GetIntegratedLength(),track->GetIntegratedLength())); | |
410 | } | |
411 | delete track; | |
af61c656 | 412 | |
af61c656 | 413 | } |
78c25bbc | 414 | else { // TRD 'good' tracks, propagated rho<371cm |
415 | ||
416 | if ( track->PropagateToInnerTOF() ) { | |
417 | ||
418 | AliDebug(1,Form(" TRD propagated track till rho = %fcm." | |
419 | " And then the track has been propagated till rho = %fcm.", | |
420 | x, (Float_t)track->GetX())); | |
421 | ||
422 | track->SetSeedIndex(i); | |
423 | t->UpdateTrackParams(track,AliESDtrack::kTOFin); | |
424 | new(aTOFTrack[fNseedsTOF]) AliTOFtrack(*track); | |
425 | fNseedsTOF++; | |
426 | seedsTOF3++; | |
427 | ||
428 | AliDebug(1,Form(" After propagation till inner TOF radius, ESDtrackLength=%f, TOFtrackLength=%f",t->GetIntegratedLength(),track->GetIntegratedLength())); | |
429 | } | |
430 | delete track; | |
431 | ||
432 | } | |
433 | //delete track; | |
74ea065c | 434 | } |
435 | ||
78c25bbc | 436 | else { // Propagate the rest of TPCbp |
437 | ||
438 | AliDebug(1,Form(" Before propagation till inner TOF radius, ESDtrackLength=%f, TOFtrackLength=%f",t->GetIntegratedLength(),track->GetIntegratedLength())); | |
439 | ||
af61c656 | 440 | if ( track->PropagateToInnerTOF() ) { |
441 | ||
442 | AliDebug(1,Form(" TPC propagated track till rho = %fcm." | |
443 | " And then the track has been propagated till rho = %fcm.", | |
444 | x, (Float_t)track->GetX())); | |
445 | ||
74ea065c | 446 | track->SetSeedIndex(i); |
af61c656 | 447 | t->UpdateTrackParams(track,AliESDtrack::kTOFin); |
74ea065c | 448 | new(aTOFTrack[fNseedsTOF]) AliTOFtrack(*track); |
449 | fNseedsTOF++; | |
5478df1f | 450 | seedsTOF2++; |
78c25bbc | 451 | |
452 | AliDebug(1,Form(" After propagation till inner TOF radius, ESDtrackLength=%f, TOFtrackLength=%f",t->GetIntegratedLength(),track->GetIntegratedLength())); | |
74ea065c | 453 | } |
454 | delete track; | |
455 | } | |
456 | } | |
457 | ||
78c25bbc | 458 | AliInfo(Form("Number of TOF seeds = %d (kTRDout371 = %d, kTRDoutLess371 = %d, !kTRDout = %d)",fNseedsTOF,seedsTOF1,seedsTOF3,seedsTOF2)); |
7b61cd9c | 459 | |
74ea065c | 460 | // Sort according uncertainties on track position |
461 | fTracks->Sort(); | |
462 | ||
463 | } | |
78c25bbc | 464 | |
74ea065c | 465 | //_________________________________________________________________________ |
115179c6 | 466 | void AliTOFtracker::MatchTracks( Int_t mLastStep){ |
74ea065c | 467 | |
e0ddb533 | 468 | // Parameters used/regulating the reconstruction |
469 | ||
78c25bbc | 470 | //static Float_t corrLen=0.;//0.75; |
471 | static Float_t detDepth=18.; | |
d01bf4f4 | 472 | static Float_t padDepth=0.5; |
e0ddb533 | 473 | |
6819758a | 474 | const Float_t kSpeedOfLight= 2.99792458e-2; // speed of light [cm/ps] |
f2524833 | 475 | const Float_t kTimeOffset = 0.; // time offset for tracking algorithm [ps] |
6819758a | 476 | |
ba66add8 | 477 | Float_t dY=AliTOFGeometry::XPad(); |
478 | Float_t dZ=AliTOFGeometry::ZPad(); | |
e0ddb533 | 479 | |
f31a249f | 480 | Float_t sensRadius = fkRecoParam->GetSensRadius(); |
481 | Float_t stepSize = fkRecoParam->GetStepSize(); | |
78c25bbc | 482 | Float_t scaleFact = fkRecoParam->GetWindowScaleFact(); |
f31a249f | 483 | Float_t dyMax=fkRecoParam->GetWindowSizeMaxY(); |
484 | Float_t dzMax=fkRecoParam->GetWindowSizeMaxZ(); | |
485 | Float_t dCut=fkRecoParam->GetDistanceCut(); | |
78c25bbc | 486 | if (dCut==3. && fNseedsTOF<=10) { |
487 | dCut=10.; | |
488 | AliInfo(Form("Matching window=%f, since low multiplicity event (fNseedsTOF=%d)", | |
489 | dCut, fNseedsTOF)); | |
490 | } | |
115179c6 | 491 | if(mLastStep == 2) |
492 | dCut=10.; | |
493 | ||
494 | ||
f31a249f | 495 | Double_t maxChi2=fkRecoParam->GetMaxChi2TRD(); |
496 | Bool_t timeWalkCorr = fkRecoParam->GetTimeWalkCorr(); | |
a838421b | 497 | if(!mLastStep){ |
115179c6 | 498 | AliDebug(1,"++++++++++++++TOF Reconstruction Parameters:++++++++++++"); |
a838421b | 499 | AliDebug(1,Form("TOF sens radius: %f",sensRadius)); |
500 | AliDebug(1,Form("TOF step size: %f",stepSize)); | |
501 | AliDebug(1,Form("TOF Window scale factor: %f",scaleFact)); | |
502 | AliDebug(1,Form("TOF Window max dy: %f",dyMax)); | |
503 | AliDebug(1,Form("TOF Window max dz: %f",dzMax)); | |
504 | AliDebug(1,Form("TOF distance Cut: %f",dCut)); | |
505 | AliDebug(1,Form("TOF Max Chi2: %f",maxChi2)); | |
506 | AliDebug(1,Form("Time Walk Correction? : %d",timeWalkCorr)); | |
507 | } | |
74ea065c | 508 | |
53884c34 | 509 | //Match ESD tracks to clusters in TOF |
a533f541 | 510 | |
e0ddb533 | 511 | // Get the number of propagation steps |
e0ddb533 | 512 | Int_t nSteps=(Int_t)(detDepth/stepSize); |
78c25bbc | 513 | AliDebug(1,Form(" Number of steps to be done %d",nSteps)); |
7bf28302 | 514 | |
115179c6 | 515 | AliDebug(1,"++++++++++++++++++++++++++++++++++++++++++++++++++++++++"); |
516 | ||
7bf28302 | 517 | //PH Arrays (moved outside of the loop) |
518 | Float_t * trackPos[4]; | |
519 | for (Int_t ii=0; ii<4; ii++) trackPos[ii] = new Float_t[nSteps]; | |
128563f6 | 520 | Int_t * clind = new Int_t[fN]; |
74ea065c | 521 | |
53884c34 | 522 | // Some init |
53884c34 | 523 | const Int_t kNclusterMax = 1000; // related to fN value |
de60fa8a | 524 | TGeoHMatrix global[kNclusterMax]; |
525 | ||
af61c656 | 526 | //The matching loop |
c0545837 | 527 | for (Int_t iseed=0; iseed<fNseedsTOF; iseed++) { |
74ea065c | 528 | |
48b634ff | 529 | fTOFtrackPoints->Delete(); |
de60fa8a | 530 | |
53884c34 | 531 | for (Int_t ii=0; ii<kNclusterMax; ii++) |
532 | global[ii] = 0x0; | |
c0545837 | 533 | AliTOFtrack *track =(AliTOFtrack*)fTracks->UncheckedAt(iseed); |
0841bd02 | 534 | AliESDtrack *t =(AliESDtrack*)fSeeds->At(track->GetSeedIndex()); |
af61c656 | 535 | //if ( t->GetTOFsignal()>0. ) continue; |
115179c6 | 536 | if ( ((t->GetStatus()&AliESDtrack::kTOFout)!=0 ) && mLastStep < 2) continue; |
de60fa8a | 537 | AliTOFtrack *trackTOFin = new AliTOFtrack(*track); |
74ea065c | 538 | |
74ea065c | 539 | // Determine a window around the track |
74ea065c | 540 | Double_t x,par[5]; |
541 | trackTOFin->GetExternalParameters(x,par); | |
542 | Double_t cov[15]; | |
543 | trackTOFin->GetExternalCovariance(cov); | |
6c94f330 | 544 | |
53884c34 | 545 | if (cov[0]<0. || cov[2]<0.) { |
546 | AliWarning(Form("Very strange track (%d)! At least one of its covariance matrix diagonal elements is negative!",iseed)); | |
ecd795d8 | 547 | //delete trackTOFin; |
548 | //continue; | |
53884c34 | 549 | } |
550 | ||
74ea065c | 551 | Double_t dphi= |
e0ddb533 | 552 | scaleFact* |
ecd795d8 | 553 | ((5*TMath::Sqrt(TMath::Abs(cov[0])) + 0.5*dY + 2.5*TMath::Abs(par[2]))/sensRadius); |
74ea065c | 554 | Double_t dz= |
e0ddb533 | 555 | scaleFact* |
ecd795d8 | 556 | (5*TMath::Sqrt(TMath::Abs(cov[2])) + 0.5*dZ + 2.5*TMath::Abs(par[3])); |
6c94f330 | 557 | |
74ea065c | 558 | Double_t phi=TMath::ATan2(par[0],x) + trackTOFin->GetAlpha(); |
559 | if (phi<-TMath::Pi())phi+=2*TMath::Pi(); | |
560 | if (phi>=TMath::Pi())phi-=2*TMath::Pi(); | |
561 | Double_t z=par[1]; | |
562 | ||
c0545837 | 563 | //upper limit on window's size. |
de60fa8a | 564 | if (dz> dzMax) dz=dzMax; |
565 | if (dphi*sensRadius> dyMax) dphi=dyMax/sensRadius; | |
c0545837 | 566 | |
567 | ||
74ea065c | 568 | // find the clusters in the window of the track |
de60fa8a | 569 | Int_t nc=0; |
74ea065c | 570 | for (Int_t k=FindClusterIndex(z-dz); k<fN; k++) { |
7b61cd9c | 571 | |
53884c34 | 572 | if (nc>=kNclusterMax) { |
573 | AliWarning("No more matchable clusters can be stored! Please, increase the corresponding vectors size."); | |
574 | break; | |
575 | } | |
576 | ||
74ea065c | 577 | AliTOFcluster *c=fClusters[k]; |
578 | if (c->GetZ() > z+dz) break; | |
115179c6 | 579 | if (c->IsUsed() && mLastStep < 2) continue; |
17149e6b | 580 | if (!c->GetStatus()) { |
53884c34 | 581 | AliDebug(1,"Cluster in channel declared bad!"); |
582 | continue; // skip bad channels as declared in OCDB | |
17149e6b | 583 | } |
7b61cd9c | 584 | |
74ea065c | 585 | Double_t dph=TMath::Abs(c->GetPhi()-phi); |
586 | if (dph>TMath::Pi()) dph-=2.*TMath::Pi(); | |
9b49e4c9 | 587 | if (TMath::Abs(dph)>dphi) continue; |
ba66add8 | 588 | |
6c94f330 | 589 | Double_t yc=(c->GetPhi() - trackTOFin->GetAlpha())*c->GetR(); |
590 | Double_t p[2]={yc, c->GetZ()}; | |
3c609b5c | 591 | Double_t cov2[3]= {dY*dY/12., 0., dZ*dZ/12.}; |
592 | if (trackTOFin->AliExternalTrackParam::GetPredictedChi2(p,cov2) > maxChi2)continue; | |
6c94f330 | 593 | |
128563f6 | 594 | clind[nc] = k; |
de40f9c1 | 595 | Char_t path[200]; |
c0545837 | 596 | Int_t ind[5]; |
128563f6 | 597 | ind[0]=c->GetDetInd(0); |
598 | ind[1]=c->GetDetInd(1); | |
599 | ind[2]=c->GetDetInd(2); | |
600 | ind[3]=c->GetDetInd(3); | |
601 | ind[4]=c->GetDetInd(4); | |
c0545837 | 602 | fGeom->GetVolumePath(ind,path); |
603 | gGeoManager->cd(path); | |
604 | global[nc] = *gGeoManager->GetCurrentMatrix(); | |
74ea065c | 605 | nc++; |
606 | } | |
607 | ||
78c25bbc | 608 | if (nc == 0 ) { |
115179c6 | 609 | AliDebug(1,Form("No available clusters for the track number %d",iseed)); |
78c25bbc | 610 | fnunmatch++; |
611 | delete trackTOFin; | |
612 | continue; | |
613 | } | |
614 | ||
115179c6 | 615 | AliDebug(1,Form(" Number of available TOF clusters for the track number %d: %d",iseed,nc)); |
616 | ||
74ea065c | 617 | //start fine propagation |
618 | ||
619 | Int_t nStepsDone = 0; | |
620 | for( Int_t istep=0; istep<nSteps; istep++){ | |
621 | ||
78c25bbc | 622 | // First of all, propagate the track... |
623 | Float_t xs = AliTOFGeometry::RinTOF()+istep*stepSize; | |
9a4d9088 | 624 | if (!(trackTOFin->PropagateTo(xs))) break; |
74ea065c | 625 | |
78c25bbc | 626 | // ...and then, if necessary, rotate the track |
627 | Double_t ymax = xs*TMath::Tan(0.5*AliTOFGeometry::GetAlpha()); | |
628 | Double_t ysect = trackTOFin->GetY(); | |
74ea065c | 629 | if (ysect > ymax) { |
9a4d9088 | 630 | if (!(trackTOFin->Rotate(AliTOFGeometry::GetAlpha()))) break; |
74ea065c | 631 | } else if (ysect <-ymax) { |
9a4d9088 | 632 | if (!(trackTOFin->Rotate(-AliTOFGeometry::GetAlpha()))) break; |
74ea065c | 633 | } |
634 | ||
74ea065c | 635 | nStepsDone++; |
115179c6 | 636 | AliDebug(3,Form(" current step %d (%d) - nStepsDone=%d",istep,nSteps,nStepsDone)); |
74ea065c | 637 | |
638 | // store the running point (Globalrf) - fine propagation | |
639 | ||
6c94f330 | 640 | Double_t r[3]; |
641 | trackTOFin->GetXYZ(r); | |
78c25bbc | 642 | trackPos[0][nStepsDone-1]= (Float_t) r[0]; |
643 | trackPos[1][nStepsDone-1]= (Float_t) r[1]; | |
644 | trackPos[2][nStepsDone-1]= (Float_t) r[2]; | |
645 | trackPos[3][nStepsDone-1]= trackTOFin->GetIntegratedLength(); | |
74ea065c | 646 | } |
647 | ||
648 | ||
78c25bbc | 649 | #if 0 |
650 | /*****************/ | |
651 | /**** OLD CODE ***/ | |
652 | /*****************/ | |
653 | ||
74ea065c | 654 | Int_t nfound = 0; |
d01bf4f4 | 655 | Bool_t accept = kFALSE; |
6819758a | 656 | Bool_t isInside = kFALSE; |
74ea065c | 657 | for (Int_t istep=0; istep<nStepsDone; istep++) { |
658 | ||
53884c34 | 659 | Float_t ctrackPos[3]; |
ff826920 | 660 | ctrackPos[0] = trackPos[0][istep]; |
661 | ctrackPos[1] = trackPos[1][istep]; | |
662 | ctrackPos[2] = trackPos[2][istep]; | |
74ea065c | 663 | |
664 | //now see whether the track matches any of the TOF clusters | |
665 | ||
524da123 | 666 | Float_t dist3d[3]; |
ff826920 | 667 | accept = kFALSE; |
668 | for (Int_t i=0; i<nc; i++) { | |
8104fec9 | 669 | isInside = fGeom->IsInsideThePad((TGeoHMatrix*)(&global[i]),ctrackPos,dist3d); |
d01bf4f4 | 670 | |
6819758a | 671 | if ( mLastStep ) { |
672 | Float_t yLoc = dist3d[1]; | |
673 | Float_t rLoc = TMath::Sqrt(dist3d[0]*dist3d[0]+dist3d[2]*dist3d[2]); | |
674 | accept = (TMath::Abs(yLoc)<padDepth*0.5 && rLoc<dCut); | |
115179c6 | 675 | AliDebug(3," I am in the case mLastStep==kTRUE "); |
d01bf4f4 | 676 | } |
ff826920 | 677 | else { |
d01bf4f4 | 678 | accept = isInside; |
679 | } | |
ff826920 | 680 | if (accept) { |
6819758a | 681 | |
de60fa8a | 682 | fTOFtrackPoints->AddLast(new AliTOFtrackPoint(clind[i], |
683 | TMath::Sqrt(dist3d[0]*dist3d[0] + dist3d[1]*dist3d[1] + dist3d[2]*dist3d[2]), | |
78c25bbc | 684 | dist3d[2],dist3d[0],dist3d[1], |
685 | AliTOFGeometry::RinTOF()+istep*stepSize,trackPos[3][istep])); | |
de60fa8a | 686 | |
115179c6 | 687 | AliDebug(3,Form(" dist3dLoc[0] = %f, dist3dLoc[1] = %f, dist3dLoc[2] = %f ",dist3d[0],dist3d[1],dist3d[2])); |
74ea065c | 688 | nfound++; |
d01bf4f4 | 689 | if(accept &&!mLastStep)break; |
74ea065c | 690 | }//end if accept |
524da123 | 691 | |
74ea065c | 692 | } //end for on the clusters |
d01bf4f4 | 693 | if(accept &&!mLastStep)break; |
74ea065c | 694 | } //end for on the steps |
695 | ||
78c25bbc | 696 | /*****************/ |
697 | /**** OLD CODE ***/ | |
698 | /*****************/ | |
699 | #endif | |
700 | ||
78c25bbc | 701 | if ( nStepsDone == 0 ) { |
115179c6 | 702 | AliDebug(1,Form(" No track points for the track number %d",iseed)); |
78c25bbc | 703 | fnunmatch++; |
704 | delete trackTOFin; | |
705 | continue; | |
706 | } | |
707 | ||
115179c6 | 708 | AliDebug(2,Form(" Number of steps done for the track number %d: %d",iseed,nStepsDone)); |
709 | ||
78c25bbc | 710 | /*****************/ |
711 | /**** NEW CODE ***/ | |
712 | /*****************/ | |
713 | ||
115179c6 | 714 | Int_t *isClusterMatchable = NULL; |
715 | if(nc){ | |
716 | isClusterMatchable = new Int_t[nc]; | |
717 | for (Int_t i=0; i<nc; i++) isClusterMatchable[i] = kFALSE; | |
718 | } | |
719 | ||
78c25bbc | 720 | Int_t nfound = 0; |
721 | Bool_t accept = kFALSE; | |
722 | Bool_t isInside = kFALSE; | |
723 | for (Int_t istep=0; istep<nStepsDone; istep++) { | |
724 | ||
725 | Bool_t gotInsideCluster = kFALSE; | |
726 | Int_t trackInsideCluster = -1; | |
727 | ||
728 | Float_t ctrackPos[3]; | |
729 | ctrackPos[0] = trackPos[0][istep]; | |
730 | ctrackPos[1] = trackPos[1][istep]; | |
731 | ctrackPos[2] = trackPos[2][istep]; | |
732 | ||
733 | //now see whether the track matches any of the TOF clusters | |
734 | ||
735 | Float_t dist3d[3]={0.,0.,0.}; | |
736 | accept = kFALSE; | |
737 | for (Int_t i=0; i<nc; i++) { | |
738 | ||
739 | // ***** NEW ***** | |
740 | /* check whether track was inside another cluster | |
741 | * and in case inhibit this cluster. | |
742 | * this will allow to only go on and add track points for | |
743 | * that cluster where the track got inside first */ | |
744 | if (gotInsideCluster && trackInsideCluster != i) { | |
115179c6 | 745 | AliDebug(3,Form(" A - istep=%d ~ %d %d ~ nfound=%d",istep,trackInsideCluster,i,nfound)); |
78c25bbc | 746 | continue; |
747 | } | |
115179c6 | 748 | AliDebug(3,Form(" B - istep=%d ~ %d %d ~ nfound=%d",istep,trackInsideCluster,i,nfound)); |
78c25bbc | 749 | |
750 | /* check whether track is inside this cluster */ | |
751 | for (Int_t hh=0; hh<3; hh++) dist3d[hh]=0.; | |
752 | isInside = fGeom->IsInsideThePad((TGeoHMatrix*)(&global[i]),ctrackPos,dist3d); | |
753 | ||
754 | // ***** NEW ***** | |
755 | /* if track is inside this cluster set flags which will then | |
756 | * inhibit to add track points for the other clusters */ | |
757 | if (isInside) { | |
758 | gotInsideCluster = kTRUE; | |
759 | trackInsideCluster = i; | |
760 | } | |
761 | ||
762 | if ( mLastStep ) { | |
763 | Float_t yLoc = dist3d[1]; | |
764 | Float_t rLoc = TMath::Sqrt(dist3d[0]*dist3d[0]+dist3d[2]*dist3d[2]); | |
765 | accept = (TMath::Abs(yLoc)<padDepth*0.5 && rLoc<dCut); | |
115179c6 | 766 | AliDebug(3," I am in the case mLastStep==kTRUE "); |
78c25bbc | 767 | } |
768 | ||
769 | //***** NEW ***** | |
770 | /* add point everytime that: | |
771 | * - the track is inside the cluster | |
772 | * - the track got inside the cluster, even when it eventually exited the cluster | |
773 | * - the tracks is within dCut from the cluster | |
774 | */ | |
775 | if (accept || isInside || gotInsideCluster) { | |
776 | ||
777 | fTOFtrackPoints->AddLast(new AliTOFtrackPoint(clind[i], | |
778 | TMath::Sqrt(dist3d[0]*dist3d[0] + dist3d[1]*dist3d[1] + dist3d[2]*dist3d[2]), | |
779 | dist3d[2],dist3d[0],dist3d[1], | |
780 | AliTOFGeometry::RinTOF()+istep*stepSize,trackPos[3][istep])); | |
781 | ||
782 | AliDebug(2,Form(" dist3dLoc[0] = %f, dist3dLoc[1] = %f, dist3dLoc[2] = %f ",dist3d[0],dist3d[1],dist3d[2])); | |
783 | nfound++; | |
784 | ||
115179c6 | 785 | AliDebug(3,Form(" C - istep=%d ~ %d %d ~ nfound=%d",istep,trackInsideCluster,i,nfound)); |
78c25bbc | 786 | |
115179c6 | 787 | |
788 | if(clind[i] < 20000 && mLastStep==2 && !isClusterMatchable[i]){ // add TOF clusters to the track | |
789 | isClusterMatchable[i] = kTRUE; | |
790 | ||
791 | //Tracking info | |
792 | Double_t mom=t->GetP(); | |
793 | AliDebug(3,Form(" Momentum for track %d -> %f", iseed,mom)); | |
794 | Double_t time[AliPID::kSPECIESC]; | |
795 | // read from old structure (the one used by TPC in reco) | |
796 | for(Int_t isp=0;isp<AliPID::kSPECIESC;isp++){ | |
797 | time[isp] = t->GetIntegratedTimesOld(isp); // in ps | |
798 | Double_t mass=AliPID::ParticleMass(isp); | |
799 | Double_t momz = mom*AliPID::ParticleCharge(isp); | |
800 | time[isp]+=(trackPos[3][istep]-trackPos[3][0])/kSpeedOfLight*TMath::Sqrt(momz*momz+mass*mass)/momz; | |
801 | //time[isp]+=(trackPos[3][istep]-trackPos[3][0])/kSpeedOfLight*TMath::Sqrt(mom*mom+mass*mass)/mom; | |
802 | } | |
803 | ||
804 | if(!fClusterESD[clind[i]]->Update(t->GetID(),dist3d[1],dist3d[0],dist3d[2],trackPos[3][istep],time))//x,y,z -> tracking RF | |
805 | t->AddTOFcluster(clind[i]); | |
806 | } | |
807 | ||
78c25bbc | 808 | // ***** NEW ***** |
809 | /* do not break loop in any case | |
810 | * if the track got inside a cluster all other clusters | |
811 | * are inhibited */ | |
812 | // if(accept &&!mLastStep)break; | |
813 | ||
814 | }//end if accept | |
815 | ||
816 | } //end for on the clusters | |
817 | ||
818 | // ***** NEW ***** | |
819 | /* do not break loop in any case | |
820 | * if the track got inside a cluster all other clusters | |
821 | * are inhibited but we want to go on adding track points */ | |
822 | // if(accept &&!mLastStep)break; | |
823 | ||
824 | } //end for on the steps | |
115179c6 | 825 | if(nc) delete[] isClusterMatchable; |
78c25bbc | 826 | |
74ea065c | 827 | if (nfound == 0 ) { |
115179c6 | 828 | AliDebug(1,Form("No track points for the track number %d",iseed)); |
74ea065c | 829 | fnunmatch++; |
7bf28302 | 830 | delete trackTOFin; |
74ea065c | 831 | continue; |
832 | } | |
833 | ||
115179c6 | 834 | AliDebug(1,Form(" Number of track points for the track number %d: %d",iseed,nfound)); |
835 | ||
74ea065c | 836 | // now choose the cluster to be matched with the track. |
837 | ||
90b234fe | 838 | Int_t idclus=-1; |
74ea065c | 839 | Float_t recL = 0.; |
840 | Float_t xpos=0.; | |
841 | Float_t mindist=1000.; | |
e0ddb533 | 842 | Float_t mindistZ=0.; |
24322e5c | 843 | Float_t mindistY=0.; |
78c25bbc | 844 | Float_t mindistX=stepSize; |
845 | for (Int_t iclus= 0; iclus<nfound;iclus++) { | |
de60fa8a | 846 | AliTOFtrackPoint *matchableTOFcluster = (AliTOFtrackPoint*)fTOFtrackPoints->At(iclus); |
78c25bbc | 847 | //if ( matchableTOFcluster->Distance()<mindist ) { |
848 | if ( TMath::Abs(matchableTOFcluster->DistanceX())<TMath::Abs(mindistX) && | |
849 | TMath::Abs(matchableTOFcluster->DistanceX())<=stepSize ) { | |
de60fa8a | 850 | mindist = matchableTOFcluster->Distance(); |
78c25bbc | 851 | mindistZ = matchableTOFcluster->DistanceZ(); // Z distance in the |
852 | // RF of the hit pad | |
853 | // closest to the | |
854 | // reconstructed | |
855 | // track | |
de60fa8a | 856 | mindistY = matchableTOFcluster->DistanceY(); // Y distance in the |
857 | // RF of the hit pad | |
858 | // closest to the | |
859 | // reconstructed | |
860 | // track | |
78c25bbc | 861 | mindistX = matchableTOFcluster->DistanceX(); // X distance in the |
862 | // RF of the hit pad | |
863 | // closest to the | |
864 | // reconstructed | |
865 | // track | |
866 | xpos = matchableTOFcluster->PropRadius(); | |
de60fa8a | 867 | idclus = matchableTOFcluster->Index(); |
78c25bbc | 868 | recL = matchableTOFcluster->Length();// + corrLen*0.5; |
869 | ||
115179c6 | 870 | AliDebug(2,Form(" %d(%d) --- %f (%f, %f, %f), step=%f -- idclus=%d --- seed=%d, trackId=%d, trackLab=%d", iclus,nfound, |
78c25bbc | 871 | mindist,mindistX,mindistY,mindistZ,stepSize,idclus,iseed,track->GetSeedIndex(),track->GetLabel())); |
872 | ||
74ea065c | 873 | } |
de60fa8a | 874 | } // loop on found TOF track points |
74ea065c | 875 | |
78c25bbc | 876 | if (TMath::Abs(mindistX)>stepSize && idclus!=-1) { |
115179c6 | 877 | AliInfo(Form(" %d - not matched --- but idclus=%d, trackId=%d, trackLab=%d",iseed, |
78c25bbc | 878 | idclus,track->GetSeedIndex(),track->GetLabel())); |
879 | idclus=-1; | |
880 | } | |
881 | ||
1d834a1e | 882 | if (idclus==-1) { |
883 | AliDebug(1,Form("Reconstructed track %d doesn't match any TOF cluster", iseed)); | |
78c25bbc | 884 | fnunmatch++; |
1d834a1e | 885 | delete trackTOFin; |
886 | continue; | |
887 | } | |
d01bf4f4 | 888 | |
115179c6 | 889 | AliDebug(1,Form(" %d - matched",iseed)); |
78c25bbc | 890 | |
891 | fnmatch++; | |
892 | ||
74ea065c | 893 | AliTOFcluster *c=fClusters[idclus]; |
de60fa8a | 894 | |
115179c6 | 895 | AliDebug(3, Form("%7d %7d %10d %10d %10d %10d %7d", |
32ead898 | 896 | iseed, |
3a646035 | 897 | fnmatch-1, |
32ead898 | 898 | TMath::Abs(trackTOFin->GetLabel()), |
899 | c->GetLabel(0), c->GetLabel(1), c->GetLabel(2), | |
900 | idclus)); // AdC | |
901 | ||
e0ddb533 | 902 | c->Use(); |
74ea065c | 903 | |
904 | // Track length correction for matching Step 2 | |
78c25bbc | 905 | /* |
de60fa8a | 906 | if (mLastStep) { |
907 | Float_t rc = TMath::Sqrt(c->GetR()*c->GetR() + c->GetZ()*c->GetZ()); | |
908 | Float_t rt = TMath::Sqrt(trackPos[0][70]*trackPos[0][70] | |
909 | +trackPos[1][70]*trackPos[1][70] | |
910 | +trackPos[2][70]*trackPos[2][70]); | |
911 | Float_t dlt=rc-rt; | |
74ea065c | 912 | recL=trackPos[3][70]+dlt; |
de60fa8a | 913 | } |
78c25bbc | 914 | */ |
74ea065c | 915 | if ( |
916 | (c->GetLabel(0)==TMath::Abs(trackTOFin->GetLabel())) | |
917 | || | |
918 | (c->GetLabel(1)==TMath::Abs(trackTOFin->GetLabel())) | |
919 | || | |
920 | (c->GetLabel(2)==TMath::Abs(trackTOFin->GetLabel())) | |
921 | ) { | |
922 | fngoodmatch++; | |
d3c7bfac | 923 | |
6819758a | 924 | AliDebug(2,Form(" track label good %5d",trackTOFin->GetLabel())); |
d3c7bfac | 925 | |
74ea065c | 926 | } |
53884c34 | 927 | else { |
74ea065c | 928 | fnbadmatch++; |
d3c7bfac | 929 | |
6819758a | 930 | AliDebug(2,Form(" track label bad %5d",trackTOFin->GetLabel())); |
d3c7bfac | 931 | |
74ea065c | 932 | } |
933 | ||
934 | delete trackTOFin; | |
935 | ||
a533f541 | 936 | // Store quantities to be used in the TOF Calibration |
ba66add8 | 937 | Float_t tToT=AliTOFGeometry::ToTBinWidth()*c->GetToT()*1E-3; // in ns |
7aeeaf38 | 938 | t->SetTOFsignalToT(tToT); |
6819758a | 939 | Float_t rawTime=AliTOFGeometry::TdcBinWidth()*c->GetTDCRAW()+kTimeOffset; // RAW time,in ps |
d321691a | 940 | t->SetTOFsignalRaw(rawTime); |
941 | t->SetTOFsignalDz(mindistZ); | |
46d7d82e | 942 | t->SetTOFsignalDx(mindistY); |
8b441e14 | 943 | t->SetTOFDeltaBC(c->GetDeltaBC()); |
944 | t->SetTOFL0L1(c->GetL0L1Latency()); | |
6819758a | 945 | |
24322e5c | 946 | Float_t info[10] = {mindist,mindistY,mindistZ, |
947 | 0.,0.,0.,0.,0.,0.,0.}; | |
948 | t->SetTOFInfo(info); | |
115179c6 | 949 | AliDebug(3,Form(" distance=%f; residual in the pad reference frame: dX=%f, dZ=%f", info[0],info[1],info[2])); |
24322e5c | 950 | |
951 | ||
a533f541 | 952 | Int_t ind[5]; |
953 | ind[0]=c->GetDetInd(0); | |
954 | ind[1]=c->GetDetInd(1); | |
955 | ind[2]=c->GetDetInd(2); | |
956 | ind[3]=c->GetDetInd(3); | |
957 | ind[4]=c->GetDetInd(4); | |
ba66add8 | 958 | Int_t calindex = AliTOFGeometry::GetIndex(ind); |
a533f541 | 959 | t->SetTOFCalChannel(calindex); |
11c7ff68 | 960 | |
961 | // keep track of the track labels in the matched cluster | |
962 | Int_t tlab[3]; | |
963 | tlab[0]=c->GetLabel(0); | |
964 | tlab[1]=c->GetLabel(1); | |
965 | tlab[2]=c->GetLabel(2); | |
115179c6 | 966 | AliDebug(3,Form(" tdc time of the matched track %6d = ",c->GetTDC())); |
6819758a | 967 | Double_t tof=AliTOFGeometry::TdcBinWidth()*c->GetTDC()+kTimeOffset; // in ps |
115179c6 | 968 | AliDebug(3,Form(" tof time of the matched track: %f = ",tof)); |
5478df1f | 969 | Double_t tofcorr=tof; |
970 | if(timeWalkCorr)tofcorr=CorrectTimeWalk(mindistZ,tof); | |
115179c6 | 971 | AliDebug(3,Form(" tof time of the matched track, after TW corr: %f = ",tofcorr)); |
5478df1f | 972 | //Set TOF time signal and pointer to the matched cluster |
973 | t->SetTOFsignal(tofcorr); | |
ee77ad87 | 974 | t->SetTOFcluster(idclus); // pointing to the recPoints tree |
5478df1f | 975 | |
115179c6 | 976 | AliDebug(3,Form(" Setting TOF raw time: %f, z distance: %f corrected time: %f ",rawTime,mindistZ,tofcorr)); |
6819758a | 977 | |
5478df1f | 978 | //Tracking info |
115179c6 | 979 | Double_t time[AliPID::kSPECIESC]; |
980 | // read from old structure (the one used by TPC in reco) | |
981 | for(Int_t isp=0;isp<AliPID::kSPECIESC;isp++){ | |
982 | time[isp] = t->GetIntegratedTimesOld(isp); // in ps | |
983 | } | |
74ea065c | 984 | Double_t mom=t->GetP(); |
115179c6 | 985 | AliDebug(3,Form(" Momentum for track %d -> %f", iseed,mom)); |
986 | for (Int_t j=0;j<AliPID::kSPECIESC;j++) { | |
304864ab | 987 | Double_t mass=AliPID::ParticleMass(j); |
115179c6 | 988 | Double_t momz = mom*AliPID::ParticleCharge(j); |
989 | time[j]+=(recL-trackPos[3][0])/kSpeedOfLight*TMath::Sqrt(momz*momz+mass*mass)/momz; | |
990 | //time[j]+=(recL-trackPos[3][0])/kSpeedOfLight*TMath::Sqrt(mom*mom+mass*mass)/mom; | |
74ea065c | 991 | } |
992 | ||
993 | AliTOFtrack *trackTOFout = new AliTOFtrack(*t); | |
9a4d9088 | 994 | if (!(trackTOFout->PropagateTo(xpos))) { |
995 | delete trackTOFout; | |
996 | continue; | |
997 | } | |
77a9ea9a | 998 | |
78c25bbc | 999 | // If necessary, rotate the track |
1000 | Double_t yATxposMax=xpos*TMath::Tan(0.5*AliTOFGeometry::GetAlpha()); | |
1001 | Double_t yATxpos=trackTOFout->GetY(); | |
1002 | if (yATxpos > yATxposMax) { | |
9a4d9088 | 1003 | if (!(trackTOFout->Rotate(AliTOFGeometry::GetAlpha()))) { |
1004 | delete trackTOFout; | |
1005 | continue; | |
1006 | } | |
78c25bbc | 1007 | } else if (yATxpos < -yATxposMax) { |
9a4d9088 | 1008 | if (!(trackTOFout->Rotate(-AliTOFGeometry::GetAlpha()))) { |
1009 | delete trackTOFout; | |
1010 | continue; | |
1011 | } | |
78c25bbc | 1012 | } |
1013 | ||
115179c6 | 1014 | // Fill the track residual histograms and update track only if in the first two step (0 and 1) |
1015 | if(mLastStep < 2){ | |
1016 | FillResiduals(trackTOFout,c,kFALSE); | |
77a9ea9a | 1017 | |
115179c6 | 1018 | t->UpdateTrackParams(trackTOFout,AliESDtrack::kTOFout); |
5478df1f | 1019 | |
115179c6 | 1020 | // don't update old structure with TOF info |
1021 | // t->SetIntegratedLength(recL); | |
1022 | // t->SetIntegratedTimes(time); | |
1023 | // t->SetTOFLabel(tlab); | |
5478df1f | 1024 | |
115179c6 | 1025 | // add tof cluster to the track also for step 2 |
1026 | if(idclus < 20000){ | |
1027 | fClusterESD[idclus]->Update(t->GetID(),mindistY,mindist,mindistZ,recL,time);//x,y,z -> tracking RF | |
1028 | ||
1029 | t->AddTOFcluster(idclus); | |
1030 | } | |
1031 | else{ | |
1032 | AliInfo("Too many TOF clusters matched with tracks (> 20000)"); | |
1033 | } | |
1034 | ||
1035 | } | |
5664c6ed | 1036 | // Fill Reco-QA histos for Reconstruction |
1037 | fHRecNClus->Fill(nc); | |
1038 | fHRecDist->Fill(mindist); | |
38c767fa | 1039 | if (cov[0]>=0.) |
1040 | fHRecSigYVsP->Fill(mom,TMath::Sqrt(cov[0])); | |
1041 | else | |
57bd70af | 1042 | fHRecSigYVsP->Fill(mom,-TMath::Sqrt(-cov[0])); |
38c767fa | 1043 | if (cov[2]>=0.) |
1044 | fHRecSigZVsP->Fill(mom,TMath::Sqrt(cov[2])); | |
1045 | else | |
57bd70af | 1046 | fHRecSigZVsP->Fill(mom,-TMath::Sqrt(-cov[2])); |
e0ddb533 | 1047 | fHRecSigYVsPWin->Fill(mom,dphi*sensRadius); |
5664c6ed | 1048 | fHRecSigZVsPWin->Fill(mom,dz); |
1049 | ||
1050 | // Fill Tree for on-the-fly offline Calibration | |
1051 | ||
53884c34 | 1052 | if ( !((t->GetStatus() & AliESDtrack::kTIME)==0 ) ) { |
5664c6ed | 1053 | fIch=calindex; |
1054 | fToT=tToT; | |
5478df1f | 1055 | fTime=rawTime; |
5664c6ed | 1056 | fExpTimePi=time[2]; |
1057 | fExpTimeKa=time[3]; | |
1058 | fExpTimePr=time[4]; | |
1059 | fCalTree->Fill(); | |
1060 | } | |
74ea065c | 1061 | delete trackTOFout; |
1062 | } | |
de60fa8a | 1063 | |
115179c6 | 1064 | |
7bf28302 | 1065 | for (Int_t ii=0; ii<4; ii++) delete [] trackPos[ii]; |
128563f6 | 1066 | delete [] clind; |
ba66add8 | 1067 | |
74ea065c | 1068 | } |
1069 | //_________________________________________________________________________ | |
7b61cd9c | 1070 | Int_t AliTOFtracker::LoadClusters(TTree *cTree) { |
74ea065c | 1071 | //-------------------------------------------------------------------- |
1072 | //This function loads the TOF clusters | |
1073 | //-------------------------------------------------------------------- | |
1074 | ||
ba66add8 | 1075 | Int_t npadX = AliTOFGeometry::NpadX(); |
1076 | Int_t npadZ = AliTOFGeometry::NpadZ(); | |
1077 | Int_t nStripA = AliTOFGeometry::NStripA(); | |
1078 | Int_t nStripB = AliTOFGeometry::NStripB(); | |
1079 | Int_t nStripC = AliTOFGeometry::NStripC(); | |
5664c6ed | 1080 | |
7b61cd9c | 1081 | TBranch *branch=cTree->GetBranch("TOF"); |
74ea065c | 1082 | if (!branch) { |
7b61cd9c | 1083 | AliError("can't get the branch with the TOF clusters !"); |
74ea065c | 1084 | return 1; |
1085 | } | |
1086 | ||
9d802709 | 1087 | static TClonesArray dummy("AliTOFcluster",10000); |
1088 | dummy.Clear(); | |
1089 | TClonesArray *clusters=&dummy; | |
7b61cd9c | 1090 | branch->SetAddress(&clusters); |
74ea065c | 1091 | |
7b61cd9c | 1092 | cTree->GetEvent(0); |
1093 | Int_t nc=clusters->GetEntriesFast(); | |
5664c6ed | 1094 | fHDigNClus->Fill(nc); |
1095 | ||
7b61cd9c | 1096 | AliInfo(Form("Number of clusters: %d",nc)); |
74ea065c | 1097 | |
115179c6 | 1098 | fNTOFmatched = 0; |
1099 | for(Int_t i=0; i< 20000;i++){ | |
1100 | if(fClusterESD[i]){ | |
1101 | delete fClusterESD[i]; | |
1102 | fClusterESD[i] = NULL; | |
1103 | } | |
1104 | } | |
1105 | ||
7b61cd9c | 1106 | for (Int_t i=0; i<nc; i++) { |
1107 | AliTOFcluster *c=(AliTOFcluster*)clusters->UncheckedAt(i); | |
16a2e36a | 1108 | //PH fClusters[i]=new AliTOFcluster(*c); fN++; |
1109 | fClusters[i]=c; fN++; | |
5664c6ed | 1110 | |
1111 | // Fill Digits QA histos | |
1112 | ||
1113 | Int_t isector = c->GetDetInd(0); | |
1114 | Int_t iplate = c->GetDetInd(1); | |
1115 | Int_t istrip = c->GetDetInd(2); | |
1116 | Int_t ipadX = c->GetDetInd(4); | |
1117 | Int_t ipadZ = c->GetDetInd(3); | |
1118 | ||
ba66add8 | 1119 | Float_t time =(AliTOFGeometry::TdcBinWidth()*c->GetTDC())*1E-3; // in ns |
1120 | Float_t tot = (AliTOFGeometry::TdcBinWidth()*c->GetToT())*1E-3;//in ns | |
115179c6 | 1121 | |
1122 | Int_t ind[5]; | |
1123 | ind[0]=isector; | |
1124 | ind[1]=iplate; | |
1125 | ind[2]=istrip; | |
1126 | ind[3]=ipadX; | |
1127 | ind[4]=ipadZ; | |
1128 | ||
1129 | Int_t calindex = AliTOFGeometry::GetIndex(ind); | |
1130 | Int_t tofLabels[3]={c->GetLabel(0),c->GetLabel(1),c->GetLabel(2)}; | |
5664c6ed | 1131 | |
1132 | Int_t stripOffset = 0; | |
1133 | switch (iplate) { | |
1134 | case 0: | |
1135 | stripOffset = 0; | |
1136 | break; | |
1137 | case 1: | |
1138 | stripOffset = nStripC; | |
1139 | break; | |
1140 | case 2: | |
1141 | stripOffset = nStripC+nStripB; | |
1142 | break; | |
1143 | case 3: | |
1144 | stripOffset = nStripC+nStripB+nStripA; | |
1145 | break; | |
1146 | case 4: | |
1147 | stripOffset = nStripC+nStripB+nStripA+nStripB; | |
1148 | break; | |
1149 | default: | |
1150 | AliError(Form("Wrong plate number in TOF (%d) !",iplate)); | |
1151 | break; | |
1152 | }; | |
1153 | Int_t zindex=npadZ*(istrip+stripOffset)+(ipadZ+1); | |
1154 | Int_t phiindex=npadX*isector+ipadX+1; | |
1155 | fHDigClusMap->Fill(zindex,phiindex); | |
1156 | fHDigClusTime->Fill(time); | |
1157 | fHDigClusToT->Fill(tot); | |
1158 | ||
115179c6 | 1159 | if(fNTOFmatched < 20000){ |
1160 | fClusterESD[fNTOFmatched] = new AliESDTOFcluster(i,calindex, | |
1161 | AliTOFGeometry::TdcBinWidth()*c->GetTDC()/*ps*/, | |
1162 | AliTOFGeometry::TdcBinWidth()*c->GetTDCRAW()/*ps*/, | |
1163 | AliTOFGeometry::ToTBinWidth()*c->GetToT()*1E-3/*ns*/, | |
1164 | tofLabels, | |
1165 | c->GetDeltaBC(),c->GetL0L1Latency(), | |
1166 | c->GetStatus(),c->GetZ(),c->GetPhi(),c->GetR()); | |
1167 | fNTOFmatched++; | |
1168 | } | |
1169 | ||
7b61cd9c | 1170 | } |
74ea065c | 1171 | |
74ea065c | 1172 | |
115179c6 | 1173 | if(fNTOFmatched == 0) |
1174 | fClusterESD[0] = new AliESDTOFcluster(); | |
1175 | ||
74ea065c | 1176 | return 0; |
1177 | } | |
1178 | //_________________________________________________________________________ | |
1179 | void AliTOFtracker::UnloadClusters() { | |
1180 | //-------------------------------------------------------------------- | |
1181 | //This function unloads TOF clusters | |
1182 | //-------------------------------------------------------------------- | |
7b61cd9c | 1183 | for (Int_t i=0; i<fN; i++) { |
16a2e36a | 1184 | //PH delete fClusters[i]; |
7b61cd9c | 1185 | fClusters[i] = 0x0; |
74ea065c | 1186 | } |
7b61cd9c | 1187 | fN=0; |
74ea065c | 1188 | } |
1189 | ||
1190 | //_________________________________________________________________________ | |
1191 | Int_t AliTOFtracker::FindClusterIndex(Double_t z) const { | |
1192 | //-------------------------------------------------------------------- | |
1193 | // This function returns the index of the nearest cluster | |
1194 | //-------------------------------------------------------------------- | |
1195 | if (fN==0) return 0; | |
1196 | if (z <= fClusters[0]->GetZ()) return 0; | |
1197 | if (z > fClusters[fN-1]->GetZ()) return fN; | |
1198 | Int_t b=0, e=fN-1, m=(b+e)/2; | |
1199 | for (; b<e; m=(b+e)/2) { | |
1200 | if (z > fClusters[m]->GetZ()) b=m+1; | |
1201 | else e=m; | |
1202 | } | |
1203 | return m; | |
1204 | } | |
d4754572 | 1205 | |
1206 | //_________________________________________________________________________ | |
1207 | Bool_t AliTOFtracker::GetTrackPoint(Int_t index, AliTrackPoint& p) const | |
1208 | { | |
1209 | // Get track space point with index i | |
1210 | // Coordinates are in the global system | |
1211 | AliTOFcluster *cl = fClusters[index]; | |
1212 | Float_t xyz[3]; | |
1213 | xyz[0] = cl->GetR()*TMath::Cos(cl->GetPhi()); | |
1214 | xyz[1] = cl->GetR()*TMath::Sin(cl->GetPhi()); | |
1215 | xyz[2] = cl->GetZ(); | |
468f26c6 | 1216 | Float_t phiangle = (Int_t(cl->GetPhi()*TMath::RadToDeg()/20.)+0.5)*20.*TMath::DegToRad(); |
1217 | Float_t sinphi = TMath::Sin(phiangle), cosphi = TMath::Cos(phiangle); | |
ba66add8 | 1218 | Float_t tiltangle = AliTOFGeometry::GetAngles(cl->GetDetInd(1),cl->GetDetInd(2))*TMath::DegToRad(); |
468f26c6 | 1219 | Float_t sinth = TMath::Sin(tiltangle), costh = TMath::Cos(tiltangle); |
ba66add8 | 1220 | Float_t sigmay2 = AliTOFGeometry::XPad()*AliTOFGeometry::XPad()/12.; |
1221 | Float_t sigmaz2 = AliTOFGeometry::ZPad()*AliTOFGeometry::ZPad()/12.; | |
468f26c6 | 1222 | Float_t cov[6]; |
1223 | cov[0] = sinphi*sinphi*sigmay2 + cosphi*cosphi*sinth*sinth*sigmaz2; | |
1224 | cov[1] = -sinphi*cosphi*sigmay2 + sinphi*cosphi*sinth*sinth*sigmaz2; | |
1225 | cov[2] = -cosphi*sinth*costh*sigmaz2; | |
1226 | cov[3] = cosphi*cosphi*sigmay2 + sinphi*sinphi*sinth*sinth*sigmaz2; | |
1227 | cov[4] = -sinphi*sinth*costh*sigmaz2; | |
1228 | cov[5] = costh*costh*sigmaz2; | |
1229 | p.SetXYZ(xyz[0],xyz[1],xyz[2],cov); | |
d4754572 | 1230 | |
1231 | // Detector numbering scheme | |
ba66add8 | 1232 | Int_t nSector = AliTOFGeometry::NSectors(); |
1233 | Int_t nPlate = AliTOFGeometry::NPlates(); | |
1234 | Int_t nStripA = AliTOFGeometry::NStripA(); | |
1235 | Int_t nStripB = AliTOFGeometry::NStripB(); | |
1236 | Int_t nStripC = AliTOFGeometry::NStripC(); | |
d4754572 | 1237 | |
1238 | Int_t isector = cl->GetDetInd(0); | |
1239 | if (isector >= nSector) | |
1240 | AliError(Form("Wrong sector number in TOF (%d) !",isector)); | |
1241 | Int_t iplate = cl->GetDetInd(1); | |
1242 | if (iplate >= nPlate) | |
1243 | AliError(Form("Wrong plate number in TOF (%d) !",iplate)); | |
1244 | Int_t istrip = cl->GetDetInd(2); | |
1245 | ||
1246 | Int_t stripOffset = 0; | |
1247 | switch (iplate) { | |
1248 | case 0: | |
1249 | stripOffset = 0; | |
1250 | break; | |
1251 | case 1: | |
1252 | stripOffset = nStripC; | |
1253 | break; | |
1254 | case 2: | |
1255 | stripOffset = nStripC+nStripB; | |
1256 | break; | |
1257 | case 3: | |
1258 | stripOffset = nStripC+nStripB+nStripA; | |
1259 | break; | |
1260 | case 4: | |
1261 | stripOffset = nStripC+nStripB+nStripA+nStripB; | |
1262 | break; | |
1263 | default: | |
1264 | AliError(Form("Wrong plate number in TOF (%d) !",iplate)); | |
1265 | break; | |
1266 | }; | |
1267 | ||
1268 | Int_t idet = (2*(nStripC+nStripB)+nStripA)*isector + | |
1269 | stripOffset + | |
1270 | istrip; | |
ae079791 | 1271 | UShort_t volid = AliGeomManager::LayerToVolUID(AliGeomManager::kTOF,idet); |
d4754572 | 1272 | p.SetVolumeID((UShort_t)volid); |
1273 | return kTRUE; | |
1274 | } | |
5664c6ed | 1275 | //_________________________________________________________________________ |
1276 | void AliTOFtracker::InitCheckHists() { | |
1277 | ||
1278 | //Init histos for Digits/Reco QA and Calibration | |
1279 | ||
1280 | ||
0366f10f | 1281 | TDirectory *dir = gDirectory; |
1282 | TFile *logFileTOF = 0; | |
1283 | ||
1284 | TSeqCollection *list = gROOT->GetListOfFiles(); | |
1285 | int n = list->GetEntries(); | |
1286 | Bool_t isThere=kFALSE; | |
1287 | for(int i=0; i<n; i++) { | |
1288 | logFileTOF = (TFile*)list->At(i); | |
1289 | if (strstr(logFileTOF->GetName(), "TOFQA.root")){ | |
1290 | isThere=kTRUE; | |
1291 | break; | |
1292 | } | |
1293 | } | |
1294 | ||
1295 | if(!isThere)logFileTOF = new TFile( "TOFQA.root","RECREATE"); | |
1296 | logFileTOF->cd(); | |
1297 | ||
5664c6ed | 1298 | fCalTree = new TTree("CalTree", "Tree for TOF calibration"); |
1299 | fCalTree->Branch("TOFchannelindex",&fIch,"iTOFch/I"); | |
1300 | fCalTree->Branch("ToT",&fToT,"TOFToT/F"); | |
1301 | fCalTree->Branch("TOFtime",&fTime,"TOFtime/F"); | |
1302 | fCalTree->Branch("PionExpTime",&fExpTimePi,"PiExpTime/F"); | |
1303 | fCalTree->Branch("KaonExpTime",&fExpTimeKa,"KaExpTime/F"); | |
1304 | fCalTree->Branch("ProtonExpTime",&fExpTimePr,"PrExpTime/F"); | |
1305 | ||
1306 | //Digits "QA" | |
1307 | fHDigClusMap = new TH2F("TOFDig_ClusMap", "",182,0.5,182.5,864, 0.5,864.5); | |
1308 | fHDigNClus = new TH1F("TOFDig_NClus", "",200,0.5,200.5); | |
1309 | fHDigClusTime = new TH1F("TOFDig_ClusTime", "",2000,0.,200.); | |
1310 | fHDigClusToT = new TH1F("TOFDig_ClusToT", "",500,0.,100); | |
1311 | ||
1312 | //Reco "QA" | |
1313 | fHRecNClus =new TH1F("TOFRec_NClusW", "",50,0.5,50.5); | |
1314 | fHRecDist=new TH1F("TOFRec_Dist", "",50,0.5,10.5); | |
1315 | fHRecSigYVsP=new TH2F("TOFDig_SigYVsP", "",40,0.,4.,100, 0.,5.); | |
1316 | fHRecSigZVsP=new TH2F("TOFDig_SigZVsP", "",40,0.,4.,100, 0.,5.); | |
1317 | fHRecSigYVsPWin=new TH2F("TOFDig_SigYVsPWin", "",40,0.,4.,100, 0.,50.); | |
1318 | fHRecSigZVsPWin=new TH2F("TOFDig_SigZVsPWin", "",40,0.,4.,100, 0.,50.); | |
0366f10f | 1319 | |
1320 | dir->cd(); | |
1321 | ||
5664c6ed | 1322 | } |
1323 | ||
1324 | //_________________________________________________________________________ | |
1325 | void AliTOFtracker::SaveCheckHists() { | |
1326 | ||
1327 | //write histos for Digits/Reco QA and Calibration | |
1328 | ||
1329 | TDirectory *dir = gDirectory; | |
5664c6ed | 1330 | TFile *logFileTOF = 0; |
1331 | ||
1332 | TSeqCollection *list = gROOT->GetListOfFiles(); | |
d200609f | 1333 | int n = list->GetEntries(); |
5664c6ed | 1334 | Bool_t isThere=kFALSE; |
d200609f | 1335 | for(int i=0; i<n; i++) { |
5664c6ed | 1336 | logFileTOF = (TFile*)list->At(i); |
1337 | if (strstr(logFileTOF->GetName(), "TOFQA.root")){ | |
1338 | isThere=kTRUE; | |
1339 | break; | |
1340 | } | |
1341 | } | |
1342 | ||
0366f10f | 1343 | if(!isThere) { |
1344 | AliError(Form("File TOFQA.root not found!! not wring histograms....")); | |
1345 | return; | |
1346 | } | |
5664c6ed | 1347 | logFileTOF->cd(); |
1348 | fHDigClusMap->Write(fHDigClusMap->GetName(), TObject::kOverwrite); | |
1349 | fHDigNClus->Write(fHDigNClus->GetName(), TObject::kOverwrite); | |
1350 | fHDigClusTime->Write(fHDigClusTime->GetName(), TObject::kOverwrite); | |
1351 | fHDigClusToT->Write(fHDigClusToT->GetName(), TObject::kOverwrite); | |
1352 | fHRecNClus->Write(fHRecNClus->GetName(), TObject::kOverwrite); | |
1353 | fHRecDist->Write(fHRecDist->GetName(), TObject::kOverwrite); | |
1354 | fHRecSigYVsP->Write(fHRecSigYVsP->GetName(), TObject::kOverwrite); | |
1355 | fHRecSigZVsP->Write(fHRecSigZVsP->GetName(), TObject::kOverwrite); | |
1356 | fHRecSigYVsPWin->Write(fHRecSigYVsPWin->GetName(), TObject::kOverwrite); | |
1357 | fHRecSigZVsPWin->Write(fHRecSigZVsPWin->GetName(), TObject::kOverwrite); | |
1358 | fCalTree->Write(fCalTree->GetName(),TObject::kOverwrite); | |
1359 | logFileTOF->Flush(); | |
1360 | ||
1361 | dir->cd(); | |
1362 | } | |
e0ddb533 | 1363 | //_________________________________________________________________________ |
f31a249f | 1364 | Float_t AliTOFtracker::CorrectTimeWalk( Float_t dist, Float_t tof) const { |
e0ddb533 | 1365 | |
1366 | //dummy, for the moment | |
1367 | Float_t tofcorr=0.; | |
ba66add8 | 1368 | if(dist<AliTOFGeometry::ZPad()*0.5){ |
e0ddb533 | 1369 | tofcorr=tof; |
1370 | //place here the actual correction | |
1371 | }else{ | |
1372 | tofcorr=tof; | |
1373 | } | |
1374 | return tofcorr; | |
1375 | } | |
1376 | //_________________________________________________________________________ | |
128563f6 | 1377 | |
1378 | void AliTOFtracker::FillClusterArray(TObjArray* arr) const | |
1379 | { | |
1380 | // | |
1381 | // Returns the TOF cluster array | |
1382 | // | |
1383 | ||
1384 | if (fN==0) | |
1385 | arr = 0x0; | |
1386 | else | |
1387 | for (Int_t i=0; i<fN; ++i) arr->Add(fClusters[i]); | |
1388 | ||
1389 | } | |
ff826920 | 1390 | //_________________________________________________________________________ |
1391 |