]>
Commit | Line | Data |
---|---|---|
78d7c6d3 | 1 | #include "AliTrackPoints.h" |
a5556ea5 | 2 | //_________________________________ |
3 | //////////////////////////////////////////////////////////// | |
4 | // // | |
5 | // class AliTrackPoints // | |
6 | // // | |
7 | // used by Anti-Merging cut // | |
8 | // contains set of poits the lay on track trajectory // | |
9 | // according to reconstructed track parameters - // | |
10 | // NOT CLUSTERS POSITIONS!!! // | |
11 | // Anti-Merging cut is applied only on tracks coming from // | |
12 | // different events (that are use to fill deniminators) // | |
13 | // // | |
14 | //////////////////////////////////////////////////////////// | |
15 | ||
16 | #include <TClonesArray.h> | |
17 | #include <TFile.h> | |
18 | #include <TMath.h> | |
19 | ||
20 | #include "AliESDtrack.h" | |
a5556ea5 | 21 | #include "AliTPCtrack.h" |
22 | #include "AliTrackReference.h" | |
78d7c6d3 | 23 | #include "AliITStrackV2.h" |
a5556ea5 | 24 | |
25 | ClassImp(AliTrackPoints) | |
26 | ||
27 | Int_t AliTrackPoints::fgDebug = 0; | |
78d7c6d3 | 28 | |
a5556ea5 | 29 | AliTrackPoints::AliTrackPoints(): |
30 | fN(0), | |
31 | fX(0x0), | |
32 | fY(0x0), | |
33 | fZ(0x0) | |
34 | { | |
35 | //constructor | |
36 | } | |
37 | /***************************************************************/ | |
38 | ||
78d7c6d3 | 39 | AliTrackPoints::AliTrackPoints(AliTrackPoints::ETypes type, AliESDtrack* track): |
40 | fN(0), | |
41 | fX(0x0), | |
42 | fY(0x0), | |
43 | fZ(0x0) | |
44 | { | |
45 | //constructor | |
46 | switch (type) | |
47 | { | |
48 | case kITS: | |
49 | //Used only in non-id analysis | |
50 | fN = 6; | |
51 | fX = new Float_t[fN]; | |
52 | fY = new Float_t[fN]; | |
53 | fZ = new Float_t[fN]; | |
54 | MakeITSPoints(track); | |
55 | break; | |
56 | ||
57 | default: | |
58 | Info("AliTrackPoints","Not recognized type"); | |
59 | } | |
60 | ||
61 | } | |
62 | /***************************************************************/ | |
63 | ||
a5556ea5 | 64 | AliTrackPoints::AliTrackPoints(Int_t n, AliESDtrack* track, Float_t mf, Float_t dr, Float_t r0): |
65 | fN(n), | |
66 | fX(new Float_t[fN]), | |
67 | fY(new Float_t[fN]), | |
68 | fZ(new Float_t[fN]) | |
69 | { | |
70 | //constructor | |
71 | //mf - magnetic field in kG - needed to calculated curvature out of Pt | |
72 | //r0 - starting radius | |
73 | //dr - calculate points every dr cm, default every 30cm | |
74 | if (track == 0x0) | |
75 | { | |
76 | Error("AliTrackPoints","ESD track is null"); | |
77 | fN = 0; | |
78 | delete [] fX; | |
79 | delete [] fY; | |
80 | delete [] fZ; | |
81 | fX = fY = fZ = 0x0; | |
82 | return; | |
83 | } | |
84 | ||
85 | if ( ((track->GetStatus() & AliESDtrack::kTPCrefit) == kFALSE)&& | |
86 | ((track->GetStatus() & AliESDtrack::kTPCin) == kFALSE) ) | |
87 | { | |
88 | //could happend: its stand alone tracking | |
89 | if (GetDebug() > 3) | |
90 | Warning("AliTrackPoints","This ESD track does not contain TPC information"); | |
91 | ||
92 | fN = 0; | |
93 | delete [] fX; | |
94 | delete [] fY; | |
95 | delete [] fZ; | |
96 | fX = fY = fZ = 0x0; | |
97 | ||
98 | return; | |
99 | } | |
100 | ||
101 | Double_t x; | |
102 | Double_t par[5]; | |
103 | track->GetInnerExternalParameters(x,par); //get properties of the track | |
104 | if (par[4] == 0) | |
105 | { | |
106 | Error("AliTrackPoints","This ESD track seem not to contain TPC information (curv is 0)"); | |
107 | return; | |
108 | } | |
109 | ||
110 | if (mf == 0.0) | |
111 | { | |
112 | Error("AliTrackPoints","Zero Magnetic field passed as parameter."); | |
113 | return; | |
114 | } | |
115 | ||
116 | Double_t alpha = track->GetInnerAlpha(); | |
117 | Double_t cc = 1000./0.299792458/mf;//conversion constant | |
118 | Double_t c=par[4]/cc; | |
119 | ||
120 | MakePoints(dr,r0,x,par,c,alpha); | |
121 | ||
122 | } | |
123 | /***************************************************************/ | |
124 | ||
125 | AliTrackPoints::AliTrackPoints(Int_t n, AliTPCtrack* track, Float_t dr, Float_t r0): | |
126 | fN(n), | |
127 | fX(new Float_t[fN]), | |
128 | fY(new Float_t[fN]), | |
129 | fZ(new Float_t[fN]) | |
130 | { | |
131 | //constructor | |
132 | //r0 starting radius | |
133 | //dr - calculate points every dr cm, default every 30cm | |
134 | if (track == 0x0) | |
135 | { | |
136 | Error("AliTrackPoints","TPC track is null"); | |
137 | fN = 0; | |
138 | delete [] fX; | |
139 | delete [] fY; | |
140 | delete [] fZ; | |
141 | fX = fY = fZ = 0x0; | |
142 | return; | |
143 | } | |
144 | track->PropagateTo(r0); | |
145 | ||
146 | //* This formation is now fixed in the following way: * | |
147 | //* external param0: local Y-coordinate of a track (cm) * | |
148 | //* external param1: local Z-coordinate of a track (cm) * | |
149 | //* external param2: local sine of the track momentum azimuth angle * | |
150 | //* external param3: tangent of the track momentum dip angle * | |
151 | //* external param4: 1/pt (1/(GeV/c)) * | |
152 | ||
153 | Double_t x = 0; | |
154 | Double_t par[5]; | |
155 | track->GetExternalParameters(x,par); //get properties of the track | |
156 | ||
157 | Double_t alpha = track->GetAlpha(); | |
158 | Double_t c=track->GetC(); | |
159 | MakePoints(dr,r0,x,par,c,alpha); | |
160 | } | |
78d7c6d3 | 161 | /***************************************************************/ |
162 | ||
163 | AliTrackPoints::~AliTrackPoints() | |
164 | { | |
165 | //destructor | |
166 | delete [] fX; | |
167 | delete [] fY; | |
168 | delete [] fZ; | |
169 | } | |
170 | /***************************************************************/ | |
a5556ea5 | 171 | |
172 | void AliTrackPoints::MakePoints( Float_t dr, Float_t r0, Double_t x, Double_t* par, Double_t c, Double_t alpha) | |
173 | { | |
174 | //Calculates points starting at radius r0 | |
175 | //spacing every dr (in radial direction) | |
176 | // according to track parameters | |
177 | // x - position in sector local reference frame. x i parallel to R and sector is symmetric with respect to x | |
178 | // par - track external parameters; array with 5 elements; look at AliTPCtrack.h or AliESDtrack.h for their meaning | |
179 | // c - track curvature | |
180 | // alpha - sector's rotation angle (phi) == angle needed for local to global transformation | |
181 | ||
182 | Double_t y = par[0]; | |
183 | Double_t z0 = par[1]; | |
184 | ||
185 | Double_t phi0local = TMath::ATan2(y,x); | |
186 | Double_t phi0global = phi0local + alpha; | |
187 | ||
188 | if (phi0local<0) phi0local+=2*TMath::Pi(); | |
189 | if (phi0local>=2.*TMath::Pi()) phi0local-=2*TMath::Pi(); | |
190 | ||
191 | if (phi0global<0) phi0global+=2*TMath::Pi(); | |
192 | if (phi0global>=2.*TMath::Pi()) phi0global-=2*TMath::Pi(); | |
193 | ||
194 | Double_t r = TMath::Hypot(x,y); | |
195 | ||
196 | ||
197 | if (GetDebug() > 9) | |
198 | Info("AliTrackPoints","Radius0 %f, Real Radius %f",r0,r); | |
199 | ||
200 | if (GetDebug() > 5) | |
201 | Info("AliTrackPoints","Phi Global at first padraw %f, Phi locat %f",phi0global,phi0local); | |
202 | ||
203 | Double_t eta = x*c - par[2] ;//par[2] = fX*C - eta; eta==fP2 ; C==fP4 | |
204 | ||
205 | //this calculattions are assuming new (current) model | |
206 | Double_t tmp = par[2]; | |
207 | tmp = 1. - tmp*tmp; | |
208 | tmp = c*y + TMath::Sqrt(tmp); | |
209 | Double_t dca=(TMath::Hypot(eta,tmp) - 1. )/TMath::Abs(c); | |
210 | ||
211 | //Here is old model Cold=Cnew/2. | |
212 | Double_t dcasq = dca*dca; | |
213 | Double_t c2 = c/2.; | |
214 | Double_t cst1 = (1.+c2*dca)*dca;//first constant | |
215 | Double_t cst2 = 1. + 2.*c2*dca;//second constant | |
216 | ||
217 | Double_t factorPhi0 = TMath::ASin((c2*r + cst1/r)/cst2); | |
218 | Double_t factorZ0 = TMath::ASin(c2*TMath::Sqrt((r*r-dcasq)/cst2))*par[3]/c2; | |
219 | ||
220 | for(Int_t i = 0; i<fN; i++) | |
221 | { | |
222 | Double_t rc = r0 + i*dr; | |
223 | Double_t ftmp = (c2*rc + cst1/rc)/cst2; | |
224 | if (ftmp > 1.0) | |
225 | { | |
226 | if (GetDebug() > 1) | |
227 | Warning("AliTrackPoints","ASin argument > 1 %f:",ftmp); | |
228 | ftmp=1.0; | |
229 | } | |
230 | else if (ftmp < -1.0) | |
231 | { | |
232 | if (GetDebug() > 1) | |
233 | Warning("AliTrackPoints","ASin argument < -1 %f:",ftmp); | |
234 | ftmp=-1.0; | |
235 | } | |
236 | ||
237 | Double_t factorPhi = TMath::ASin( ftmp );//factor phi od rc | |
238 | Double_t phi = phi0global + factorPhi - factorPhi0; | |
239 | ||
240 | ftmp = (rc*rc-dcasq)/cst2; | |
241 | if (ftmp < 0.0) | |
242 | { | |
243 | if (GetDebug() > 1) | |
244 | Warning("AliTrackPoints","Sqrt argument < 0: %f",ftmp); | |
245 | ftmp=0.0; | |
246 | } | |
247 | ||
248 | ftmp = c2*TMath::Sqrt(ftmp); | |
249 | if (ftmp > 1.0) | |
250 | { | |
251 | if (GetDebug() > 1) | |
252 | Warning("AliTrackPoints","ASin argument > 1: %f",ftmp); | |
253 | ftmp=1.0; | |
254 | } | |
255 | else if (ftmp < -1.0) | |
256 | { | |
257 | if (GetDebug() > 1) | |
258 | Warning("AliTrackPoints","ASin argument < -1: %f",ftmp); | |
259 | ftmp=-1.0; | |
260 | } | |
261 | Double_t factorZ = TMath::ASin(ftmp)*par[3]/c2; | |
262 | fZ[i] = z0 + factorZ - factorZ0; | |
263 | fX[i] = rc*TMath::Cos(phi); | |
264 | fY[i] = rc*TMath::Sin(phi); | |
265 | ||
266 | if ( GetDebug() > 2 ) | |
267 | { | |
268 | Info("AliTrackPoints","X %f Y %f Z %f R asked %f R obtained %f", | |
269 | fX[i],fY[i],fZ[i],rc,TMath::Hypot(fX[i],fY[i])); | |
270 | } | |
271 | } | |
272 | } | |
273 | /***************************************************************/ | |
274 | ||
78d7c6d3 | 275 | void AliTrackPoints::MakeITSPoints(AliESDtrack* track) |
a5556ea5 | 276 | { |
78d7c6d3 | 277 | //Calculates points in ITS |
278 | // z=R*Pz/Pt | |
279 | AliITStrackV2 itstrack(*track,kTRUE); | |
280 | Double_t x,y,z; | |
281 | static const Double_t r[6] = {4.0, 7.0, 14.9, 23.8, 39.1, 43.6}; | |
282 | for (Int_t i = 0; i < 6; i++) | |
283 | { | |
284 | itstrack.GetGlobalXYZat(r[i],x,y,z); | |
285 | fX[i] = x; | |
286 | fY[i] = y; | |
287 | fZ[i] = z; | |
288 | // Info("MakeITSPoints","X %f Y %f Z %f R asked %f R obtained %f", | |
289 | // fX[i],fY[i],fZ[i],r[i],TMath::Hypot(fX[i],fY[i])); | |
290 | } | |
291 | ||
a5556ea5 | 292 | } |
a5556ea5 | 293 | |
78d7c6d3 | 294 | /***************************************************************/ |
a5556ea5 | 295 | void AliTrackPoints::PositionAt(Int_t n, Float_t &x,Float_t &y,Float_t &z) |
296 | { | |
297 | //returns position at point n | |
298 | if ((n<0) || (n>fN)) | |
299 | { | |
300 | Error("PositionAt","Point %d out of range",n); | |
301 | return; | |
302 | } | |
303 | ||
304 | x = fX[n]; | |
305 | y = fY[n]; | |
306 | z = fZ[n]; | |
307 | if ( GetDebug() > 1 ) | |
308 | { | |
309 | Info("AliTrackPoints","n %d; X %f; Y %f; Z %f",n,x,y,z); | |
310 | } | |
311 | } | |
312 | /***************************************************************/ | |
313 | ||
78d7c6d3 | 314 | void AliTrackPoints::Move(Float_t x, Float_t y, Float_t z) |
315 | { | |
316 | //Moves all points about vector | |
317 | for (Int_t i = 0; i<fN; i++) | |
318 | { | |
319 | fX[i]+=x; | |
320 | fY[i]+=y; | |
321 | fZ[i]+=z; | |
322 | } | |
323 | } | |
324 | /***************************************************************/ | |
325 | ||
a5556ea5 | 326 | Double_t AliTrackPoints::AvarageDistance(const AliTrackPoints& tr) |
327 | { | |
328 | //returns the aritmethic avarage distance between two tracks | |
329 | // Info("AvarageDistance","Entered"); | |
330 | if ( (fN <= 0) || (tr.fN <=0) ) | |
331 | { | |
332 | if (GetDebug()) Warning("AvarageDistance","One of tracks is empty"); | |
333 | return -1; | |
334 | } | |
335 | ||
336 | if (fN != tr.fN) | |
337 | { | |
338 | Warning("AvarageDistance","Number of points is not equal"); | |
339 | return -1; | |
340 | } | |
341 | ||
342 | Double_t sum = 0; | |
343 | for (Int_t i = 0; i<fN; i++) | |
344 | { | |
345 | if (GetDebug()>9) | |
346 | { | |
347 | // Float_t r1sq = fX[i]*fX[i]+fY[i]*fY[i]; | |
348 | // Float_t r2sq = tr.fX[i]*tr.fX[i]+tr.fY[i]*tr.fY[i]; | |
349 | Float_t r1sq = TMath::Hypot(fX[i],fY[i]); | |
350 | Float_t r2sq = TMath::Hypot(tr.fX[i],tr.fY[i]); | |
351 | Info("AvarageDistance","radii: %f %f",r1sq,r2sq); | |
352 | } | |
353 | ||
354 | ||
355 | Double_t dx = fX[i]-tr.fX[i]; | |
356 | Double_t dy = fY[i]-tr.fY[i]; | |
357 | Double_t dz = fZ[i]-tr.fZ[i]; | |
358 | sum+=TMath::Sqrt(dx*dx + dy*dy + dz*dz); | |
359 | ||
360 | if (GetDebug()>1) | |
361 | { | |
362 | Info("AvarageDistance","Diff: x ,y z: %f , %f, %f",dx,dy,dz); | |
363 | Info("AvarageDistance","xxyyzz %f %f %f %f %f %f", | |
364 | fX[i],tr.fX[i],fY[i],tr.fY[i],fZ[i],tr.fZ[i]); | |
365 | } | |
366 | } | |
367 | ||
368 | Double_t retval = sum/((Double_t)fN); | |
369 | if ( GetDebug() ) | |
370 | { | |
371 | Info("AvarageDistance","Avarage distance is %f.",retval); | |
372 | } | |
373 | return retval; | |
374 | } | |
375 | /***************************************************************/ | |
376 | /***************************************************************/ | |
377 | /***************************************************************/ | |
378 | /***************************************************************/ | |
379 | /***************************************************************/ | |
380 | /***************************************************************/ | |
381 | ||
382 | #include "AliRun.h" | |
383 | #include "AliESD.h" | |
384 | #include "AliRunLoader.h" | |
385 | #include "AliTPCtrack.h" | |
386 | #include "TTree.h" | |
387 | #include "TBranch.h" | |
388 | #include "TH2D.h" | |
389 | #include "TCanvas.h" | |
390 | #include "AliMagF.h" | |
391 | ||
392 | ||
393 | ||
394 | ||
78d7c6d3 | 395 | void AliTrackPoints::Testesd(Int_t entr,const char* fname ) |
a5556ea5 | 396 | { |
a5556ea5 | 397 | delete gAlice; |
398 | gAlice = 0x0; | |
399 | AliRunLoader* rl = AliRunLoader::Open(); | |
400 | rl->LoadgAlice(); | |
401 | ||
402 | Float_t mf = rl->GetAliRun()->Field()->SolenoidField(); | |
403 | ||
404 | ||
405 | TFile* fFile = TFile::Open(fname); | |
406 | ||
407 | if (fFile == 0x0) | |
408 | { | |
409 | printf("testesd: There is no suche a ESD file\n"); | |
410 | return; | |
411 | } | |
412 | AliESD* esd = dynamic_cast<AliESD*>(fFile->Get("0")); | |
413 | AliESDtrack *t = esd->GetTrack(entr); | |
414 | if (t == 0x0) | |
415 | { | |
416 | ::Error("testesd","Can not get track %d",entr); | |
417 | return; | |
418 | } | |
419 | ||
420 | ||
421 | Int_t N = 170; | |
422 | AliTrackPoints* tp = new AliTrackPoints(N,t,mf,1.); | |
423 | ||
424 | Float_t xmin = -250; | |
425 | Float_t xmax = 250; | |
426 | ||
427 | Float_t ymin = -250; | |
428 | Float_t ymax = 250; | |
429 | ||
430 | Float_t zmin = -250; | |
431 | Float_t zmax = 250; | |
432 | ||
433 | TH2D* hxy = new TH2D("hxy","hxy",1000,xmin,xmax,1000,ymin,ymax); | |
434 | TH2D* hxyt = new TH2D("hxyt","hxyt",1000,xmin,xmax,1000,ymin,ymax); | |
435 | TH2D* hxyTR = new TH2D("hxyTR","hxyTR",1000,xmin,xmax,1000,ymin,ymax); | |
436 | ||
437 | TH2D* hxz = new TH2D("hxz","hxz",1000,xmin,xmax,1000,zmin,zmax); | |
438 | TH2D* hxzt = new TH2D("hxzt","hxzt",1000,xmin,xmax,1000,zmin,zmax); | |
439 | TH2D* hxzTR = new TH2D("hxzTR","hxzTR",1000,xmin,xmax,1000,zmin,zmax); | |
440 | ||
441 | hxyt->SetDirectory(0x0); | |
442 | hxy->SetDirectory(0x0); | |
443 | hxyTR->SetDirectory(0x0); | |
444 | ||
445 | hxzt->SetDirectory(0x0); | |
446 | hxz->SetDirectory(0x0); | |
447 | hxzTR->SetDirectory(0x0); | |
448 | ||
449 | Float_t x,y,z; | |
450 | ||
451 | for (Int_t i = 0;i<N;i++) | |
452 | { | |
453 | Double_t r = 84.1+i; | |
454 | tp->PositionAt(i,x,y,z); | |
455 | hxy->Fill(x,y); | |
456 | hxz->Fill(x,z); | |
457 | printf("Rdemanded %f\n",r); | |
458 | printf("tpx %f tpy %f tpz %f Rt =%f\n", x,y,z,TMath::Hypot(x,y)); | |
459 | ||
460 | } | |
461 | ||
462 | rl->LoadTrackRefs(); | |
463 | TTree* treeTR = rl->TreeTR(); | |
464 | TBranch* b = treeTR->GetBranch("TPC"); | |
465 | ||
466 | TClonesArray* trackrefs = new TClonesArray("AliTrackReference", 100); | |
467 | AliTrackReference* tref; | |
468 | b->SetAddress(&trackrefs); | |
469 | ||
470 | Int_t tlab = TMath::Abs(t->GetLabel()); | |
471 | ||
472 | Int_t netr = (Int_t)treeTR->GetEntries(); | |
473 | printf("Found %d entries in TR tree\n",netr); | |
474 | ||
475 | for (Int_t e = 0; e < netr; e++) | |
476 | { | |
477 | treeTR->GetEntry(e); | |
478 | tref = (AliTrackReference*)trackrefs->At(0); | |
479 | if (tref == 0x0) continue; | |
480 | if (tref->GetTrack() != tlab) continue; | |
481 | ||
482 | printf("Found %d entries in TR array\n",trackrefs->GetEntries()); | |
483 | ||
484 | for (Int_t i = 0; i < trackrefs->GetEntries(); i++) | |
485 | { | |
486 | tref = (AliTrackReference*)trackrefs->At(i); | |
487 | if (tref->GetTrack() != tlab) continue; | |
488 | x = tref->X(); | |
489 | y = tref->Y(); | |
490 | z = tref->Z(); | |
491 | printf("Track Ref: x %f y %f z %f\n",tref->X(),tref->Y(),tref->Z()); | |
492 | ||
493 | hxzTR->Fill(x,z); | |
494 | hxyTR->Fill(x,y); | |
495 | for (Int_t j = 1; j < 10; j++) | |
496 | { | |
497 | hxyTR->Fill(x, y+j*0.1); | |
498 | hxyTR->Fill(x, y-j*0.1); | |
499 | hxyTR->Fill(x+j*0.1,y); | |
500 | hxyTR->Fill(x-j*0.1,y); | |
501 | ||
502 | hxzTR->Fill(x,z-j*0.1); | |
503 | hxzTR->Fill(x,z+j*0.1); | |
504 | hxzTR->Fill(x-j*0.1,z); | |
505 | hxzTR->Fill(x+j*0.1,z); | |
506 | } | |
507 | } | |
508 | break; | |
509 | } | |
510 | hxy->Draw(""); | |
511 | // hxzt->Draw("same"); | |
512 | hxyTR->Draw("same"); | |
513 | ||
514 | delete rl; | |
515 | } | |
516 | ||
517 | /***************************************************************/ | |
518 | /***************************************************************/ | |
519 | /***************************************************************/ | |
520 | ||
78d7c6d3 | 521 | void AliTrackPoints::Testtpc(Int_t entr) |
a5556ea5 | 522 | { |
a5556ea5 | 523 | delete gAlice; |
524 | gAlice = 0x0; | |
525 | AliRunLoader* rl = AliRunLoader::Open(); | |
526 | AliLoader* l = rl->GetLoader("TPCLoader"); | |
527 | rl->LoadgAlice(); | |
528 | AliKalmanTrack::SetConvConst(100/0.299792458/0.2/rl->GetAliRun()->Field()->Factor()); | |
529 | l->LoadTracks(); | |
530 | AliTPCtrack* t = new AliTPCtrack(); | |
531 | TBranch* b=l->TreeT()->GetBranch("tracks"); | |
532 | b->SetAddress(&t); | |
533 | l->TreeT()->GetEntry(entr); | |
534 | Int_t N = 160; | |
535 | AliTrackPoints* tp = new AliTrackPoints(N,t,1.); | |
536 | ||
537 | Float_t xmin = -250; | |
538 | Float_t xmax = 250; | |
539 | ||
540 | Float_t ymin = -250; | |
541 | Float_t ymax = 250; | |
542 | ||
543 | Float_t zmin = -250; | |
544 | Float_t zmax = 250; | |
545 | ||
546 | TH2D* hxy = new TH2D("hxy","hxy",1000,xmin,xmax,1000,ymin,ymax); | |
547 | TH2D* hxyt = new TH2D("hxyt","hxyt",1000,xmin,xmax,1000,ymin,ymax); | |
548 | TH2D* hxyTR = new TH2D("hxyTR","hxyTR",1000,xmin,xmax,1000,ymin,ymax); | |
549 | ||
550 | TH2D* hxz = new TH2D("hxz","hxz",1000,xmin,xmax,1000,zmin,zmax); | |
551 | TH2D* hxzt = new TH2D("hxzt","hxzt",1000,xmin,xmax,1000,zmin,zmax); | |
552 | TH2D* hxzTR = new TH2D("hxzTR","hxzTR",1000,xmin,xmax,1000,zmin,zmax); | |
553 | ||
554 | hxyt->SetDirectory(0x0); | |
555 | hxy->SetDirectory(0x0); | |
556 | hxyTR->SetDirectory(0x0); | |
557 | ||
558 | hxzt->SetDirectory(0x0); | |
559 | hxz->SetDirectory(0x0); | |
560 | hxzTR->SetDirectory(0x0); | |
561 | ||
562 | Float_t x,y,z; | |
563 | ||
564 | for (Int_t i = 0;i<N;i++) | |
565 | { | |
566 | Double_t r = 84.1+i; | |
567 | tp->PositionAt(i,x,y,z); | |
568 | hxy->Fill(x,y); | |
569 | hxz->Fill(x,z); | |
570 | printf("Rdemanded %f\n",r); | |
571 | printf("tpx %f tpy %f tpz %f Rt =%f\n", x,y,z,TMath::Hypot(x,y)); | |
572 | ||
573 | //BUT they are local!!!! | |
574 | t->PropagateTo(r); | |
575 | // Double_t phi = t->Phi(); | |
576 | Double_t rl = TMath::Hypot(t->GetX(),t->GetY());//real radius | |
577 | ||
578 | Double_t alpha = t->GetAlpha(); | |
579 | Double_t salpha = TMath::Sin(alpha); | |
580 | Double_t calpha = TMath::Cos(alpha); | |
581 | x = t->GetX()*calpha - t->GetY()*salpha; | |
582 | y = t->GetX()*salpha + t->GetY()*calpha; | |
583 | z = t->GetZ(); | |
584 | ||
585 | printf("tx %f ty %f tz %f Rt = %f R from XY %f\n",x,y,z,TMath::Hypot(x,y),rl); | |
586 | ||
587 | printf("tpz - tz %f\n",z-t->GetZ()); | |
588 | printf("\n"); | |
589 | hxyt->Fill(x,y); | |
590 | hxzt->Fill(x,z); | |
591 | ||
592 | } | |
593 | ||
594 | rl->LoadTrackRefs(); | |
595 | TTree* treeTR = rl->TreeTR(); | |
596 | b = treeTR->GetBranch("TPC"); | |
597 | ||
598 | TClonesArray* trackrefs = new TClonesArray("AliTrackReference", 100); | |
599 | AliTrackReference* tref; | |
600 | b->SetAddress(&trackrefs); | |
601 | ||
602 | Int_t tlab = TMath::Abs(t->GetLabel()); | |
603 | ||
604 | Int_t netr = (Int_t)treeTR->GetEntries(); | |
605 | printf("Found %d entries in TR tree\n",netr); | |
606 | ||
607 | for (Int_t e = 0; e < netr; e++) | |
608 | { | |
609 | treeTR->GetEntry(e); | |
610 | tref = (AliTrackReference*)trackrefs->At(0); | |
611 | if (tref == 0x0) continue; | |
612 | if (tref->GetTrack() != tlab) continue; | |
613 | ||
614 | printf("Found %d entries in TR array\n",trackrefs->GetEntries()); | |
615 | ||
616 | for (Int_t i = 0; i < trackrefs->GetEntries(); i++) | |
617 | { | |
618 | tref = (AliTrackReference*)trackrefs->At(i); | |
619 | if (tref->GetTrack() != tlab) continue; | |
620 | x = tref->X(); | |
621 | y = tref->Y(); | |
622 | z = tref->Z(); | |
623 | printf("Track Ref: x %f y %f z %f\n",tref->X(),tref->Y(),tref->Z()); | |
624 | ||
625 | hxzTR->Fill(x,z); | |
626 | hxyTR->Fill(x,y); | |
627 | for (Int_t j = 1; j < 10; j++) | |
628 | { | |
629 | hxyTR->Fill(x, y+j*0.1); | |
630 | hxyTR->Fill(x, y-j*0.1); | |
631 | hxyTR->Fill(x+j*0.1,y); | |
632 | hxyTR->Fill(x-j*0.1,y); | |
633 | ||
634 | hxzTR->Fill(x,z-j*0.1); | |
635 | hxzTR->Fill(x,z+j*0.1); | |
636 | hxzTR->Fill(x-j*0.1,z); | |
637 | hxzTR->Fill(x+j*0.1,z); | |
638 | } | |
639 | } | |
640 | break; | |
641 | } | |
642 | hxz->Draw(""); | |
643 | // hxzt->Draw("same"); | |
644 | hxzTR->Draw("same"); | |
645 | ||
646 | delete rl; | |
647 | } | |
78d7c6d3 | 648 |