1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 Revision 1.3 2000/12/21 17:51:54 morsch
19 RN3 violations corrected
21 Revision 1.2 2000/11/23 10:09:39 gosset
22 Bug correction in AliMUONRecoDisplay.
24 Copyright, Revision 1.3 2000/12/21 17:51:54 morsch
25 Copyright, RN3 violations corrected
26 Copyright,, $Id$, comments at the right place for automatic documentation,
27 in AliMUONRecoEvent and AliMUONRecoDisplay
31 //Authors: Mihaela Gheata, Andrei Gheata 09/10/00
32 //////////////////////////////////////////////////////////////////////
34 // AliMUONRecoDisplay //
36 // This class subclasses AliDisplay and provides display of //
37 // reconstructed tracks with following functionality : //
38 // - front/top/side/3D display of MUON reconstructed tracks //
40 // - context menu activated when the main pad is right-clicked //
41 // The context menu contains following functions : //
42 // * SetDrawHits() - switches on or off Geant hits ; //
43 // * CutMomentum() - displays only tracks within Pmin - Pmax //
44 // * ListTracks() - prints ID and momentum info. for all //
45 // tracks within momentum range Pmin,Pmax ; //
46 // * Highlight() - shows only one selected reco. track //
47 // and its best matching Geant track; //
48 // * UnHighlight() - self explaining; //
49 // * RecoEfficiency() - compute reco. efficiency for all events//
50 // from galice.root file; also fake track percentage; make //
51 // plots for momentum precision //
52 // * XYPlot() - make X-Y plots of reconstructed and //
53 // generated tracks in all chambers //
55 // Starting : generate and reconstruct events, then use the //
56 // MUONrecodisplay.C macro //
58 //////////////////////////////////////////////////////////////////////
62 #include <TClonesArray.h>
63 #include "AliMUONRecoEvent.h"
64 #include "AliMUONRecoDisplay.h"
66 #include <AliPoints.h>
69 #include <TGeometry.h>
71 ClassImp(AliMUONRecoDisplay)
73 //-------------------------------------------------------------------
74 AliMUONRecoDisplay::AliMUONRecoDisplay(Int_t nevent)
77 //************ Constructor of the reco. event display**********
78 // get reconstructed event from file
79 fFile = new TFile("tree_reco.root");
81 cout << "File tree_reco.root not found\n";
82 gApplication->Terminate(0);
85 fTree = (TTree *) fFile->Get("TreeRecoEvent");
87 cout << "Tree of reconstructed events not found on file. Abort.\n";
88 gApplication->Terminate(0);
92 TBranch *branch = fTree->GetBranch("Event");
93 branch->SetAddress(&fEvReco);
95 fEvGen = new AliMUONRecoEvent();
97 TFile *galiceFile = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
99 if (nevent > gAlice->TreeE()->GetEntries() - 1) {
100 cout << "Event number out of range !\n";
101 gApplication->Terminate(0);
103 gAlice->GetEvent(nevent);
117 //-------------------------------------------------------------------
118 AliMUONRecoDisplay::~AliMUONRecoDisplay()
120 // Destructor of display object
122 fPolyRecoList->Delete();
123 delete fPolyRecoList;
126 fPolyGenList->Delete();
131 //-------------------------------------------------------------------
132 Bool_t AliMUONRecoDisplay::Event(Int_t nevent)
134 // Go to event nevent
136 for (Int_t entry=0; entry<fTree->GetEntries(); entry++) {
137 fTree->GetEntry(entry);
138 if (fEvReco->GetNoEvent() == nevent) return kTRUE;
140 cout << "Event number " << nevent << " empty\n";
152 //-------------------------------------------------------------------
153 void AliMUONRecoDisplay::MapEvent(Int_t nevent)
155 // get generated event (nevent) from galice.root and corresponding
156 // reconstructed event from tree_reco.root;
157 cout << "mapping event " << nevent << endl;
161 // check if the event is not empty and make fEvReco to point to it
162 fEmpty = !Event(nevent);
165 // cout << "failed to load reco event ! Correct this.\n";
166 // gApplication->Terminate(0);
169 fRecoTracks = fEvReco->TracksPtr();
170 fPolyRecoList = MakePolyLines3D(fRecoTracks);
171 // clear previous event
172 if (fEvGen) fEvGen->Clear();
173 fEvGen->SetNoEvent(nevent);
174 // get list of particles
175 TClonesArray *particles = gAlice->Particles();
176 // connect MUON module
177 AliDetector *pMUON = gAlice->GetDetector("MUON");
179 cout << "MUON module not present.\n";
180 gApplication->Terminate(0);
182 // get the number of generated tracks
183 Int_t ntracks = (Int_t)gAlice->TreeH()->GetEntries();
184 // Fill the fEvGen object
185 AliMUONRecoTrack *gtrack = 0;
190 for (Int_t track=0; track<ntracks; track++) {
191 hit = (AliMUONHit *) pMUON->FirstHit(track);
193 particle = (TParticle *) particles->UncheckedAt(hit->Track());
194 if (IsReconstructible(track) && TMath::Abs(particle->GetPdgCode())==13) {
195 gtrack = fEvGen->AddEmptyTrack();
196 gtrack->SetSign(TMath::Sign((Int_t)1, -particle->GetPdgCode()));
198 for (ch=0; ch<10; ch++) gtrack->SetHitPosition(ch,0,0,0);
200 for (AliMUONHit *muonHit=(AliMUONHit*)pMUON->FirstHit(track);
202 muonHit=(AliMUONHit*)pMUON->NextHit()) {
203 ch = muonHit->fChamber - 1;
204 if (ch<0 || ch>9) continue;
205 gtrack->SetHitPosition(ch, muonHit->X(), muonHit->Y(), muonHit->Z());
206 gtrack->SetMomReconstr(particle->Px(), particle->Py(), particle->Pz());
207 gtrack->SetVertexPos(particle->Vz());
208 gtrack->SetChi2r(0.0);
212 fGenTracks = fEvGen->TracksPtr();
213 fPolyGenList = MakePolyLines3D(fGenTracks);
215 //-------------------------------------------------------------------
216 void AliMUONRecoDisplay::XYPlot()
218 // Plot reco. tracks hits in all chambers for current event:
219 // - open blue squares : generated muons that were reconstructed accurate
220 // - open cyan squares : generated muons that were not reconstructed
221 // - filled green circles : reco. tracks (accurate)
222 // - filled red squares : fake tracks
224 Double_t kMaxRadius[10];
225 kMaxRadius[0] = kMaxRadius[1] = 91.5;
226 kMaxRadius[2] = kMaxRadius[3] = 122.5;
227 kMaxRadius[4] = kMaxRadius[5] = 158.3;
228 kMaxRadius[6] = kMaxRadius[7] = 260.0;
229 kMaxRadius[8] = kMaxRadius[9] = 260.0;
231 TH2F *xygenFound[10];
233 TH2F *xyrecoGood[10];
234 TH2F *xyrecoFake[10];
239 TPad *pad = (TPad*)gROOT->GetSelectedPad();
240 TCanvas *canvas = new TCanvas("xy", "Reconstruction efficiency");
250 // Define histograms for x-y plots
251 for (ch=0; ch<10; ch++) {
252 xygenFound[ch] = new TH2F("xygen_found","",50,-kMaxRadius[ch],kMaxRadius[ch],50,-kMaxRadius[ch],kMaxRadius[ch]);
253 xygenLost[ch] = new TH2F("xygen_lost","",50,-kMaxRadius[ch],kMaxRadius[ch],50,-kMaxRadius[ch],kMaxRadius[ch]);
254 xyrecoGood[ch] = new TH2F("xyreco_good","",50,-kMaxRadius[ch],kMaxRadius[ch],50,-kMaxRadius[ch],kMaxRadius[ch]);
255 xyrecoFake[ch] = new TH2F("xyreco_fake","",50,-kMaxRadius[ch],kMaxRadius[ch],50,-kMaxRadius[ch],kMaxRadius[ch]);
257 // find list of matching tracks
258 fPrinted = kTRUE; // no need to print
259 for (index=0; index<fRecoTracks->GetEntriesFast(); index++) {
260 matches[index] = GetBestMatch(index);
263 for (index=0; index<fGenTracks->GetEntriesFast(); index++) { // GEANT
264 Bool_t wasreconst = kFALSE;
265 for (Int_t i=0; i<fRecoTracks->GetEntriesFast(); i++) {
266 if (matches[i] == index) {
271 AliMUONRecoTrack *current = (AliMUONRecoTrack*)fGenTracks->UncheckedAt(index);
272 for (ch=0; ch<10; ch++) {
273 x = current->GetPosX(ch);
274 y = current->GetPosY(ch);
275 r = TMath::Sqrt(x*x +y*y);
278 xygenFound[ch]->Fill(x,y);
279 } else {xygenLost[ch]->Fill(x,y);}
283 for (index=0; index<fRecoTracks->GetEntriesFast(); index++) { // reco
284 AliMUONRecoTrack *current = (AliMUONRecoTrack*)fRecoTracks->UncheckedAt(index);
285 for (ch=0; ch<10; ch++) {
286 x = current->GetPosX(ch);
287 y = current->GetPosY(ch);
288 r = TMath::Sqrt(x*x +y*y);
290 if (matches[index] >= 0) {
291 xyrecoGood[ch]->Fill(x,y);
292 } else {xyrecoFake[ch]->Fill(x,y);}
297 for (ch=0; ch<10; ch++) {
299 xygenFound[ch]->SetMarkerColor(kBlue);
300 xygenFound[ch]->SetMarkerStyle(4);
301 xygenFound[ch]->SetMarkerSize(0.5);
302 xygenFound[ch]->SetStats(kFALSE);
303 xygenFound[ch]->Draw();
304 xygenLost[ch]->SetMarkerColor(kCyan);
305 xygenLost[ch]->SetMarkerStyle(4);
306 xygenLost[ch]->SetMarkerSize(0.5);
307 xygenLost[ch]->SetStats(kFALSE);
308 xygenLost[ch]->Draw("SAME");
309 xyrecoGood[ch]->SetMarkerColor(kGreen);
310 xyrecoGood[ch]->SetMarkerStyle(20);
311 xyrecoGood[ch]->SetMarkerSize(0.4);
312 xyrecoGood[ch]->SetStats(kFALSE);
313 xyrecoGood[ch]->Draw("SAME");
314 xyrecoFake[ch]->SetMarkerColor(kRed);
315 xyrecoFake[ch]->SetMarkerStyle(20);
316 xyrecoFake[ch]->SetMarkerSize(0.5);
317 xyrecoFake[ch]->SetStats(kFALSE);
318 xyrecoFake[ch]->Draw("SAME");
320 canvas->SetTitle("y vs. x for simulated and reconstructed tracks");
324 //-------------------------------------------------------------------
325 void AliMUONRecoDisplay::RecoEfficiency(Int_t first, Int_t last)
327 // Loop selected reconstructed events, compute efficiency as total number of
328 // reconstructed tracks (accurate) over total number of generated
329 // reconstructible muons. Make histogram for momentum precision and profile
330 // of mean momentum precision versus total momentum (generated)
331 Int_t nevents = (Int_t)gAlice->TreeE()->GetEntries();
332 if (last > nevents) last = nevents - 1;
333 if (first < 0) first = 0;
334 nevents = last - first + 1;
337 Float_t generated=0, found=0, fake=0; // number of generated/found/fake tracks
338 Double_t pgen, preco, dP; // dP=preco-pgen
339 AliMUONRecoTrack *rtrack, *gtrack; // generated/reco. current tracks
340 fPrinted = kTRUE; // no need to print
341 Int_t currentEvent = gAlice->GetHeader()->GetEvent();
343 TH1F *pReso = new TH1F("Momentum precision", "dP = Prec - Pgen", 100, -5.0, 5.0);
344 pReso->SetXTitle("dP [GeV/c]");
345 pReso->SetYTitle("dN/dP");
347 TProfile *dPp = new TProfile("", "dP vs. P", 50, 0, 100, 0, 5);
348 dPp->SetXTitle("P [GeV/c]");
349 dPp->SetYTitle("<dP> [GeV/c]");
351 TPad *pad = (TPad*)gROOT->GetSelectedPad();
352 TCanvas *canvas = new TCanvas("c", "Reconstruction efficiency");
357 for (Int_t event=first; event<=last; event++) {
358 // get the reco. & gen. events
359 TFile *galiceFile = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
361 gAlice->GetEvent(event);
368 generated += fGenTracks->GetEntriesFast();
370 for (track=0; track<fRecoTracks->GetEntriesFast(); track++) {
371 rtrack = (AliMUONRecoTrack*)fRecoTracks->UncheckedAt(track);
373 // find correspondent generated track
374 Int_t ind = GetBestMatch(track);
376 gtrack = (AliMUONRecoTrack*)fGenTracks->UncheckedAt(ind);
381 dPp->Fill(pgen, TMath::Abs(dP));
387 efficiency = found/generated;
388 cout << "=================================================================\n";
389 cout << "|| Reconstruction efficiency and momentum precision ||\n";
390 cout << "=================================================================\n";
391 cout << "Number of events processed " << nevents << endl;
392 cout << "Total number of reconstructible muons : " << (Int_t)generated << endl;
393 cout << "RECONSTRUCTION EFFICIENCY : " << efficiency*100 << " %" << endl;
394 cout << "Fake track rate : " << 100*fake/generated << " %" << endl;
395 cout << "Momentum precision fit : \n" << endl;
397 cout << "=================================================================\n";
404 ShowNextEvent(currentEvent-last);
407 //-------------------------------------------------------------------
408 void AliMUONRecoDisplay::ShowNextEvent(Int_t delta)
410 // overwritten from AliDisplay in order to get also mapping of next event
411 TFile *galiceFile = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
415 Int_t currentEvent = gAlice->GetHeader()->GetEvent();
416 Int_t newEvent = currentEvent + delta;
417 if (newEvent<0 || newEvent>(gAlice->TreeE()->GetEntries() - 1)) return;
418 Int_t nparticles = gAlice->GetEvent(newEvent);
419 cout << "Event : " << newEvent << " with " << nparticles << " particles\n";
420 if (!gAlice->TreeH()) return;
427 if (gROOT->GetListOfCanvases()->FindObject("xy")) XYPlot();
429 //-------------------------------------------------------------------
430 Bool_t AliMUONRecoDisplay::IsReconstructible(Int_t track)
432 // true if at least three hits in first 2 stations, 3 in last 2 stations
433 // and one in station 3
434 if (fEmpty) return kFALSE;
435 AliDetector *pMUON = gAlice->GetDetector("MUON");
438 for (ch=0; ch<10; ch++) chHit[ch] = kFALSE;
440 for (AliMUONHit *muonHit=(AliMUONHit*)pMUON->FirstHit(track);
442 muonHit=(AliMUONHit*)pMUON->NextHit()) {
443 ch = muonHit->fChamber - 1;
444 if (ch<0 || ch>9) continue;
448 for (ch=0; ch<4; ch++) nhits += (chHit[ch])?1:0;
449 if (nhits < 3) return kFALSE;
451 for (ch=4; ch<6; ch++) nhits+= (chHit[ch])?1:0;
452 if (nhits < 1) return kFALSE;
454 for (ch=7; ch<10; ch++) nhits+= (chHit[ch])?1:0;
455 if (nhits < 3) return kFALSE;
459 //-------------------------------------------------------------------
460 void AliMUONRecoDisplay::DrawView(Float_t theta, Float_t phi, Float_t psi)
462 // ovewritten from base class to change the range for MUON
463 gPad->SetCursor(kWatch);
464 gPad->SetFillColor(1);
468 TView *view = new TView(1);
469 Float_t range = fRrange*fRangeSlider->GetMaximum();
470 view->SetRange(-range, -range, 0, range, range, 5*range);
475 // Display Alice geometry
476 gAlice->GetGeometry()->Draw("same");
477 //Loop on all detectors to add their products to the pad
479 // add itself to the list (last)
482 view->SetView(phi, theta, psi, iret);
484 //-------------------------------------------------------------------
485 void AliMUONRecoDisplay::SetDrawHits(Bool_t hits)
487 // Turns on/off Geant hits drawing
492 //-------------------------------------------------------------------
493 void AliMUONRecoDisplay::CutMomentum(Double_t min, Double_t max)
495 // Define momentum cut for displayed reconstructed tracks
498 if (fHighlited >= 0) UnHighlight();
502 //-------------------------------------------------------------------
503 Int_t AliMUONRecoDisplay::GetBestMatch(Int_t indr, Float_t tolerance)
505 // Find the index of best Geant track matching a reconstructed track : track
506 // with maximum number of compatible hits (within tolerance*sigma bending and
507 // non-bending resolution) and minimum number of fake hits;
508 // If no match is found within a given tolerance, the method is called recursively
509 // with increasing tolerance, until tolerance = 10;
510 if (fEmpty) return -1;
511 if (indr<0 || indr>=fRecoTracks->GetEntriesFast()) return -1;
512 AliMUONRecoTrack *rtrack = (AliMUONRecoTrack*)fRecoTracks->UncheckedAt(indr);
513 AliMUONRecoTrack *gtrack = 0;
514 Int_t bestMatch = -1;
515 Int_t maxNcompat = 0;
516 Int_t minNfakes = 10;
517 Double_t xrhit,yrhit,radius,xghit,yghit,dX,dY;
518 // loop over all Geant tracks
519 for (Int_t indg=0; indg<fGenTracks->GetEntriesFast(); indg++) {
520 gtrack = (AliMUONRecoTrack*)fGenTracks->UncheckedAt(indg);
521 if (!gtrack) continue;
522 Int_t ncompat = 0; // number of compat. hits for this track
523 Int_t nfake = 0; // number of fakes
524 // loop chambers to find compatible hits
525 for (Int_t ch=0; ch<10; ch++) {
526 xrhit = rtrack->GetPosX(ch);
527 yrhit = rtrack->GetPosY(ch);
528 radius = TMath::Sqrt(xrhit*xrhit + yrhit*yrhit);
529 if (radius<10) continue; // skip null hits
530 xghit = gtrack->GetPosX(ch);
531 yghit = gtrack->GetPosY(ch);
532 dX = TMath::Abs(xghit-xrhit);
533 dY = TMath::Abs(yghit-yrhit);
534 if (dX<tolerance*0.144 && dY<tolerance*0.01) {// within tol*sigma resolution
536 continue; // compatible hit
537 } else nfake++; // fake hit
539 if (ncompat && ncompat>=maxNcompat && nfake<minNfakes) { // this is best matching
540 maxNcompat = ncompat;
545 if (bestMatch<0 && tolerance<=9.) bestMatch = GetBestMatch(indr, tolerance+=1);
547 rtrack = (AliMUONRecoTrack*)fRecoTracks->UncheckedAt(indr);
548 Int_t sign = rtrack->GetSign();
549 cout << "Reconstructed track : " << indr << "(" << sign << ")" << endl;
551 printf("Best matching Geant track within %i*sgm : %i\n", (Int_t)tolerance, bestMatch);
553 gtrack = (AliMUONRecoTrack*)fGenTracks->UncheckedAt(bestMatch);
556 cout << "-----------------------------------------------------------------\n";
563 //-------------------------------------------------------------------
564 void AliMUONRecoDisplay::Highlight(Int_t track)
566 // Highlight the specified track
568 if (fHighlited >=0) UnHighlight();
569 if (track<0 || track>fPolyRecoList->GetEntries()) return;
570 TPolyLine3D *line = (TPolyLine3D*)fPolyRecoList->UncheckedAt(track);
571 line->SetLineColor(kYellow);
572 line->SetLineWidth(1);
574 // DrawView(15,-45,135);
579 //-------------------------------------------------------------------
580 void AliMUONRecoDisplay::UnHighlight()
582 // Unhighlight a previous highlighted track
583 if (fHighlited < 0 || fEmpty) return; // nothing to do
584 TPolyLine3D *line = (TPolyLine3D*)fPolyRecoList->UncheckedAt(fHighlited);
585 line->SetLineColor(kRed);
586 line->SetLineWidth(1);
593 //-------------------------------------------------------------------
594 void AliMUONRecoDisplay::DrawHits()
596 // Draw hits for all ALICE detectors. Overwrites the DrawHits() method of the
597 // base class for reco. track drawing
599 Float_t cutmin, cutmax, etamin, etamax, pmom, smin, smax, eta, theta, r;
600 const Float_t kptcutmax = 2;
601 const Float_t ketacutmax = 1.5;
609 smax = fCutSlider->GetMaximum();
610 smin = fCutSlider->GetMinimum();
611 cutmin = kptcutmax*smin;
612 if (smax < 0.98) cutmax = kptcutmax*smax;
613 else cutmax = 100000;
616 smax = fEtaSlider->GetMaximum();
617 smin = fEtaSlider->GetMinimum();
618 etamin = ketacutmax*(2*smin-1);
619 etamax = ketacutmax*(2*smax-1);
620 if (smin < 0.02) etamin = -1000;
621 if (smax > 0.98) etamax = 1000;
623 TIter next(gAlice->Modules());
627 // draw hits in all modules
628 while((module = (AliModule*)next())) {
629 if (!module->IsActive()) continue;
630 points = module->Points();
631 if (!points) continue;
632 ntracks = points->GetEntriesFast();
633 for (track=0;track<ntracks;track++) {
634 pm = (AliPoints*)points->UncheckedAt(track);
636 particle = pm->GetParticle();
637 if (!particle) continue;
638 pmom = particle->P();
639 if (pmom < cutmin) continue;
640 if (pmom > cutmax) continue;
641 // as a first approximation, take eta of first point
643 r = TMath::Sqrt(pxyz[0]*pxyz[0] + pxyz[1]*pxyz[1]);
644 theta = TMath::ATan2(r,TMath::Abs(pxyz[2]));
645 if(theta) eta = -TMath::Log(TMath::Tan(0.5*theta)); else eta = 1e10;
646 if (pxyz[2] < 0) eta = -eta;
647 if (eta < etamin || eta > etamax) continue;
649 fHitsCuts += pm->GetN();
653 // draw reconstructed tracks
655 TPolyLine3D *line, *gline;
658 AliMUONRecoTrack *rtrack;
660 if (fHighlited >= 0) {
661 line = (TPolyLine3D*)fPolyRecoList->UncheckedAt(fHighlited);
664 bestMatch = GetBestMatch(fHighlited);
666 gline = (TPolyLine3D*)fPolyGenList->UncheckedAt(bestMatch);
667 gline->SetLineColor(kRed);
668 gline->SetLineWidth(2);
669 gline->SetLineStyle(2);
673 for (track=0; track<fPolyRecoList->GetEntries(); track++) {
674 rtrack = (AliMUONRecoTrack*)fRecoTracks->UncheckedAt(track);
675 px = rtrack->GetMomReconstr(0);
676 py = rtrack->GetMomReconstr(1);
677 pz = rtrack->GetMomReconstr(2);
679 if (p>fMinMomentum && p<fMaxMomentum) {
680 line = (TPolyLine3D*)fPolyRecoList->UncheckedAt(track);
687 //-------------------------------------------------------------------
688 void AliMUONRecoDisplay::ListTracks()
690 // List momentum information of all reconstructed traccks within fPmin and fPmax
691 // cuts, as well as their best matching Geant tracks
693 cout << "================================================================\n";
694 printf("Reconstructed tracks with momentum in range : %g , %g [GeV/c]\n",
695 fMinMomentum, fMaxMomentum);
696 cout << "----------------------------------------------------------------\n";
697 AliMUONRecoTrack *rtrack;
700 for (Int_t ind=0; ind<fRecoTracks->GetEntries(); ind++) {
701 rtrack = (AliMUONRecoTrack*)fRecoTracks->UncheckedAt(ind);
703 if (p>fMinMomentum && p<fMaxMomentum) {
706 sign = rtrack->GetSign();
709 cout << "================================================================\n";
712 //-------------------------------------------------------------------
713 TClonesArray* AliMUONRecoDisplay::MakePolyLines3D(TClonesArray *tracklist)
715 // Makes the list of polylines3D corresponding to the list of tracks
716 if (fEmpty) return 0;
717 if (tracklist!=fRecoTracks && tracklist!=fGenTracks) return 0;
718 Bool_t reco = (tracklist==fRecoTracks)?kTRUE:kFALSE;
719 // make sure there is no other list in memory
722 fPolyRecoList->Delete();
723 delete fPolyRecoList;
728 fPolyGenList->Delete();
733 if (!tracklist->GetEntries()) return 0;
735 AliMUONRecoTrack* track = 0;
736 TClonesArray *polyLines3D = new TClonesArray("TPolyLine3D",1000);
737 TClonesArray &polylist = *polyLines3D;
738 TPolyLine3D *polyline = 0;
741 for (Int_t i=0; i<tracklist->GetEntries(); i++) {
742 track = (AliMUONRecoTrack*)tracklist->UncheckedAt(i);
745 polyline = new(polylist[i]) TPolyLine3D(2,"");
746 polyline->SetLineColor(kRed);
747 polyline->SetLineWidth(1);
748 polyline->SetNextPoint(0,0,track->GetVertexPos()); // vertex point
749 // loop chambers to fill TPolyLine3D objects
750 for (ch=0; ch<10; ch++) {
751 x = track->GetPosX(ch);
752 y = track->GetPosY(ch);
753 r = TMath::Sqrt(x*x + y*y);
754 if (r < 10) continue;
755 z = track->GetPosZ(ch);
756 polyline->SetNextPoint(x,y,z);
762 //-------------------------------------------------------------------
763 void AliMUONRecoDisplay::PolyLineInfo(TClonesArray *line3Dlist)
765 // Prints information (x, y, z coordinates) for all constructed polylines
768 TPolyLine3D *polyline = 0;
769 for(Int_t trackIndex=0; trackIndex<line3Dlist->GetEntries(); trackIndex++) {
770 polyline = (TPolyLine3D*)line3Dlist->UncheckedAt(trackIndex);
772 Float_t *pl = polyline->GetP();
773 for (Int_t i=0; i<polyline->GetN() ;i++) {
774 printf(" x[%d]=%g, y[%d]=%g, z[%d]=%g\n",i,pl[3*i],i,pl[3*i+1],i,pl[3*i+2]);