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 //Authors: Mihaela Gheata, Andrei Gheata 09/10/00
19 //////////////////////////////////////////////////////////////////////
21 // AliMUONRecoDisplay //
23 // This class subclasses AliDisplay and provides display of //
24 // reconstructed tracks with following functionality : //
25 // - front/top/side/3D display of MUON reconstructed tracks //
27 // - context menu activated when the main pad is right-clicked //
28 // The context menu contains following functions : //
29 // * SetDrawHits() - switches on or off Geant hits ; //
30 // * CutMomentum() - displays only tracks within Pmin - Pmax //
31 // * ListTracks() - prints ID and momentum info. for all //
32 // tracks within momentum range Pmin,Pmax ; //
33 // * Highlight() - shows only one selected reco. track //
34 // and its best matching Geant track; //
35 // * UnHighlight() - self explaining; //
36 // * RecoEfficiency() - compute reco. efficiency for all events//
37 // from galice.root file; also fake track percentage; make //
38 // plots for momentum precision //
39 // * XYPlot() - make X-Y plots of reconstructed and //
40 // generated tracks in all chambers //
42 // Starting : generate and reconstruct events, then use the //
43 // MUONrecodisplay.C macro //
45 //////////////////////////////////////////////////////////////////////
47 #include <Riostream.h>
51 #include <TClonesArray.h>
52 #include <TGeometry.h>
54 #include <TGeometry.h>
58 #include <AliConfig.h>
59 #include <AliHeader.h>
60 #include <AliPoints.h>
62 #include "AliMUONRecoEvent.h"
63 #include "AliMUONRecoDisplay.h"
65 ClassImp(AliMUONRecoDisplay)
67 //-------------------------------------------------------------------
68 AliMUONRecoDisplay::AliMUONRecoDisplay(Int_t nevent)
71 //************ Constructor of the reco. event display**********
72 // get reconstructed event from file
73 fFile = new TFile("tree_reco.root");
75 cout << "File tree_reco.root not found\n";
76 gApplication->Terminate(0);
79 fTree = (TTree *) fFile->Get("TreeRecoEvent");
81 cout << "Tree of reconstructed events not found on file. Abort.\n";
82 gApplication->Terminate(0);
86 TBranch *branch = fTree->GetBranch("Event");
87 branch->SetAddress(&fEvReco);
89 fEvGen = new AliMUONRecoEvent();
91 TFile *galiceFile = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
93 if (nevent > gAlice->TreeE()->GetEntries() - 1) {
94 cout << "Event number out of range !\n";
95 gApplication->Terminate(0);
97 gAlice->GetEvent(nevent);
111 //-------------------------------------------------------------------
112 AliMUONRecoDisplay::~AliMUONRecoDisplay()
114 // Destructor of display object
116 fPolyRecoList->Delete();
117 delete fPolyRecoList;
120 fPolyGenList->Delete();
125 //-------------------------------------------------------------------
126 Bool_t AliMUONRecoDisplay::Event(Int_t nevent)
128 // Go to event nevent
130 for (Int_t entry=0; entry<fTree->GetEntries(); entry++) {
131 fTree->GetEntry(entry);
132 if (fEvReco->GetNoEvent() == nevent) return kTRUE;
134 cout << "Event number " << nevent << " empty\n";
146 //-------------------------------------------------------------------
147 void AliMUONRecoDisplay::MapEvent(Int_t nevent)
149 // get generated event (nevent) from galice.root and corresponding
150 // reconstructed event from tree_reco.root;
151 cout << "mapping event " << nevent << endl;
155 // check if the event is not empty and make fEvReco to point to it
156 fEmpty = !Event(nevent);
159 // cout << "failed to load reco event ! Correct this.\n";
160 // gApplication->Terminate(0);
163 fRecoTracks = fEvReco->TracksPtr();
164 fPolyRecoList = MakePolyLines3D(fRecoTracks);
165 // clear previous event
166 if (fEvGen) fEvGen->Clear();
167 fEvGen->SetNoEvent(nevent);
168 // get list of particles
169 // connect MUON module
170 AliDetector *pMUON = gAlice->GetDetector("MUON");
172 cout << "MUON module not present.\n";
173 gApplication->Terminate(0);
175 // get the number of generated tracks
176 Int_t ntracks = (Int_t)pMUON->TreeH()->GetEntries();
177 // Fill the fEvGen object
178 AliMUONRecoTrack *gtrack = 0;
183 for (Int_t track=0; track<ntracks; track++) {
184 hit = (AliMUONHit *) pMUON->FirstHit(track);
186 particle = gAlice->Particle(hit->Track());
187 if (IsReconstructible(track) && TMath::Abs(particle->GetPdgCode())==13) {
188 gtrack = fEvGen->AddEmptyTrack();
189 gtrack->SetSign(TMath::Sign((Int_t)1, -particle->GetPdgCode()));
191 for (ch=0; ch<10; ch++) gtrack->SetHitPosition(ch,0,0,0);
193 for (AliMUONHit *muonHit=(AliMUONHit*)pMUON->FirstHit(track);
195 muonHit=(AliMUONHit*)pMUON->NextHit()) {
196 ch = muonHit->Chamber() - 1;
197 if (ch<0 || ch>9) continue;
198 gtrack->SetHitPosition(ch, muonHit->X(), muonHit->Y(), muonHit->Z());
199 gtrack->SetMomReconstr(particle->Px(), particle->Py(), particle->Pz());
200 gtrack->SetVertexPos(particle->Vz());
201 gtrack->SetChi2r(0.0);
205 fGenTracks = fEvGen->TracksPtr();
206 fPolyGenList = MakePolyLines3D(fGenTracks);
208 //-------------------------------------------------------------------
209 void AliMUONRecoDisplay::XYPlot()
211 // Plot reco. tracks hits in all chambers for current event:
212 // - open blue squares : generated muons that were reconstructed accurate
213 // - open cyan squares : generated muons that were not reconstructed
214 // - filled green circles : reco. tracks (accurate)
215 // - filled red squares : fake tracks
217 Double_t kMaxRadius[10];
218 kMaxRadius[0] = kMaxRadius[1] = 91.5;
219 kMaxRadius[2] = kMaxRadius[3] = 122.5;
220 kMaxRadius[4] = kMaxRadius[5] = 158.3;
221 kMaxRadius[6] = kMaxRadius[7] = 260.0;
222 kMaxRadius[8] = kMaxRadius[9] = 260.0;
224 TH2F *xygenFound[10];
226 TH2F *xyrecoGood[10];
227 TH2F *xyrecoFake[10];
232 TPad *pad = (TPad*)gROOT->GetSelectedPad();
233 TCanvas *canvas = new TCanvas("xy", "Reconstruction efficiency");
243 // Define histograms for x-y plots
244 for (ch=0; ch<10; ch++) {
245 xygenFound[ch] = new TH2F("xygen_found","",50,-kMaxRadius[ch],kMaxRadius[ch],50,-kMaxRadius[ch],kMaxRadius[ch]);
246 xygenLost[ch] = new TH2F("xygen_lost","",50,-kMaxRadius[ch],kMaxRadius[ch],50,-kMaxRadius[ch],kMaxRadius[ch]);
247 xyrecoGood[ch] = new TH2F("xyreco_good","",50,-kMaxRadius[ch],kMaxRadius[ch],50,-kMaxRadius[ch],kMaxRadius[ch]);
248 xyrecoFake[ch] = new TH2F("xyreco_fake","",50,-kMaxRadius[ch],kMaxRadius[ch],50,-kMaxRadius[ch],kMaxRadius[ch]);
250 // find list of matching tracks
251 fPrinted = kTRUE; // no need to print
252 for (index=0; index<fRecoTracks->GetEntriesFast(); index++) {
253 matches[index] = GetBestMatch(index);
256 for (index=0; index<fGenTracks->GetEntriesFast(); index++) { // GEANT
257 Bool_t wasreconst = kFALSE;
258 for (Int_t i=0; i<fRecoTracks->GetEntriesFast(); i++) {
259 if (matches[i] == index) {
264 AliMUONRecoTrack *current = (AliMUONRecoTrack*)fGenTracks->UncheckedAt(index);
265 for (ch=0; ch<10; ch++) {
266 x = current->GetPosX(ch);
267 y = current->GetPosY(ch);
268 r = TMath::Sqrt(x*x +y*y);
271 xygenFound[ch]->Fill(x,y);
272 } else {xygenLost[ch]->Fill(x,y);}
276 for (index=0; index<fRecoTracks->GetEntriesFast(); index++) { // reco
277 AliMUONRecoTrack *current = (AliMUONRecoTrack*)fRecoTracks->UncheckedAt(index);
278 for (ch=0; ch<10; ch++) {
279 x = current->GetPosX(ch);
280 y = current->GetPosY(ch);
281 r = TMath::Sqrt(x*x +y*y);
283 if (matches[index] >= 0) {
284 xyrecoGood[ch]->Fill(x,y);
285 } else {xyrecoFake[ch]->Fill(x,y);}
290 for (ch=0; ch<10; ch++) {
292 xygenFound[ch]->SetMarkerColor(kBlue);
293 xygenFound[ch]->SetMarkerStyle(4);
294 xygenFound[ch]->SetMarkerSize(0.5);
295 xygenFound[ch]->SetStats(kFALSE);
296 xygenFound[ch]->Draw();
297 xygenLost[ch]->SetMarkerColor(kCyan);
298 xygenLost[ch]->SetMarkerStyle(4);
299 xygenLost[ch]->SetMarkerSize(0.5);
300 xygenLost[ch]->SetStats(kFALSE);
301 xygenLost[ch]->Draw("SAME");
302 xyrecoGood[ch]->SetMarkerColor(kGreen);
303 xyrecoGood[ch]->SetMarkerStyle(20);
304 xyrecoGood[ch]->SetMarkerSize(0.4);
305 xyrecoGood[ch]->SetStats(kFALSE);
306 xyrecoGood[ch]->Draw("SAME");
307 xyrecoFake[ch]->SetMarkerColor(kRed);
308 xyrecoFake[ch]->SetMarkerStyle(20);
309 xyrecoFake[ch]->SetMarkerSize(0.5);
310 xyrecoFake[ch]->SetStats(kFALSE);
311 xyrecoFake[ch]->Draw("SAME");
313 canvas->SetTitle("y vs. x for simulated and reconstructed tracks");
317 //-------------------------------------------------------------------
318 void AliMUONRecoDisplay::RecoEfficiency(Int_t first, Int_t last)
320 // Loop selected reconstructed events, compute efficiency as total number of
321 // reconstructed tracks (accurate) over total number of generated
322 // reconstructible muons. Make histogram for momentum precision and profile
323 // of mean momentum precision versus total momentum (generated)
324 Int_t nevents = (Int_t)gAlice->TreeE()->GetEntries();
325 if (last > nevents) last = nevents - 1;
326 if (first < 0) first = 0;
327 nevents = last - first + 1;
330 Float_t generated=0, found=0, fake=0; // number of generated/found/fake tracks
331 Double_t pgen, preco, dP; // dP=preco-pgen
332 AliMUONRecoTrack *rtrack, *gtrack; // generated/reco. current tracks
333 fPrinted = kTRUE; // no need to print
334 Int_t currentEvent = gAlice->GetHeader()->GetEvent();
336 TH1F *pReso = new TH1F("Momentum precision", "dP = Prec - Pgen", 100, -5.0, 5.0);
337 pReso->SetXTitle("dP [GeV/c]");
338 pReso->SetYTitle("dN/dP");
340 TProfile *dPp = new TProfile("", "dP vs. P", 50, 0, 100, 0, 5);
341 dPp->SetXTitle("P [GeV/c]");
342 dPp->SetYTitle("<dP> [GeV/c]");
344 TPad *pad = (TPad*)gROOT->GetSelectedPad();
345 TCanvas *canvas = new TCanvas("c", "Reconstruction efficiency");
350 for (Int_t event=first; event<=last; event++) {
351 // get the reco. & gen. events
352 TFile *galiceFile = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
354 gAlice->GetEvent(event);
361 generated += fGenTracks->GetEntriesFast();
363 for (track=0; track<fRecoTracks->GetEntriesFast(); track++) {
364 rtrack = (AliMUONRecoTrack*)fRecoTracks->UncheckedAt(track);
366 // find correspondent generated track
367 Int_t ind = GetBestMatch(track);
369 gtrack = (AliMUONRecoTrack*)fGenTracks->UncheckedAt(ind);
374 dPp->Fill(pgen, TMath::Abs(dP));
380 efficiency = found/generated;
381 cout << "=================================================================\n";
382 cout << "|| Reconstruction efficiency and momentum precision ||\n";
383 cout << "=================================================================\n";
384 cout << "Number of events processed " << nevents << endl;
385 cout << "Total number of reconstructible muons : " << (Int_t)generated << endl;
386 cout << "RECONSTRUCTION EFFICIENCY : " << efficiency*100 << " %" << endl;
387 cout << "Fake track rate : " << 100*fake/generated << " %" << endl;
388 cout << "Momentum precision fit : \n" << endl;
390 cout << "=================================================================\n";
397 ShowNextEvent(currentEvent-last);
400 //-------------------------------------------------------------------
401 void AliMUONRecoDisplay::ShowNextEvent(Int_t delta)
403 // overwritten from AliDisplay in order to get also mapping of next event
404 TFile *galiceFile = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
408 Int_t currentEvent = gAlice->GetHeader()->GetEvent();
409 Int_t newEvent = currentEvent + delta;
410 if (newEvent<0 || newEvent>(gAlice->TreeE()->GetEntries() - 1)) return;
411 Int_t nparticles = gAlice->GetEvent(newEvent);
412 cout << "Event : " << newEvent << " with " << nparticles << " particles\n";
414 /******************************************************************/
415 AliConfig* config = AliConfig::Instance();
416 TFolder* topfold = (TFolder*)config->GetTopFolder();
419 Error("Exec","Can not get Alice top folder");
422 TString fmdfoldname(config->GetDataFolderName()+"/"+"MUON");
423 TFolder* fmdfold = (TFolder*)topfold->FindObject(fmdfoldname);
426 Error("Exec","Can not get MUON folder");
429 TTree* treeH = dynamic_cast<TTree*>(fmdfold->FindObject("TreeH"));
432 Error("Exec","Can not get TreeH");
435 /******************************************************************/
442 if (gROOT->GetListOfCanvases()->FindObject("xy")) XYPlot();
444 //-------------------------------------------------------------------
445 Bool_t AliMUONRecoDisplay::IsReconstructible(Int_t track)
447 // true if at least three hits in first 2 stations, 3 in last 2 stations
448 // and one in station 3
449 if (fEmpty) return kFALSE;
450 AliDetector *pMUON = gAlice->GetDetector("MUON");
453 for (ch=0; ch<10; ch++) chHit[ch] = kFALSE;
455 for (AliMUONHit *muonHit=(AliMUONHit*)pMUON->FirstHit(track);
457 muonHit=(AliMUONHit*)pMUON->NextHit()) {
458 ch = muonHit->Chamber() - 1;
459 if (ch<0 || ch>9) continue;
463 for (ch=0; ch<4; ch++) nhits += (chHit[ch])?1:0;
464 if (nhits < 3) return kFALSE;
466 for (ch=4; ch<6; ch++) nhits+= (chHit[ch])?1:0;
467 if (nhits < 1) return kFALSE;
469 for (ch=7; ch<10; ch++) nhits+= (chHit[ch])?1:0;
470 if (nhits < 3) return kFALSE;
474 //-------------------------------------------------------------------
475 void AliMUONRecoDisplay::DrawView(Float_t theta, Float_t phi, Float_t psi)
477 // ovewritten from base class to change the range for MUON
478 gPad->SetCursor(kWatch);
479 gPad->SetFillColor(1);
483 TView *view = new TView(1);
484 Float_t range = fRrange*fRangeSlider->GetMaximum();
485 view->SetRange(-range, -range, 0, range, range, 5*range);
490 // Display Alice geometry
491 gAlice->GetGeometry()->Draw("same");
492 //Loop on all detectors to add their products to the pad
494 // add itself to the list (last)
497 view->SetView(phi, theta, psi, iret);
499 //-------------------------------------------------------------------
500 void AliMUONRecoDisplay::SetDrawHits(Bool_t hits)
502 // Turns on/off Geant hits drawing
507 //-------------------------------------------------------------------
508 void AliMUONRecoDisplay::CutMomentum(Double_t min, Double_t max)
510 // Define momentum cut for displayed reconstructed tracks
513 if (fHighlited >= 0) UnHighlight();
517 //-------------------------------------------------------------------
518 Int_t AliMUONRecoDisplay::GetBestMatch(Int_t indr, Float_t tolerance)
520 // Find the index of best Geant track matching a reconstructed track : track
521 // with maximum number of compatible hits (within tolerance*sigma bending and
522 // non-bending resolution) and minimum number of fake hits;
523 // If no match is found within a given tolerance, the method is called recursively
524 // with increasing tolerance, until tolerance = 10;
525 if (fEmpty) return -1;
526 if (indr<0 || indr>=fRecoTracks->GetEntriesFast()) return -1;
527 AliMUONRecoTrack *rtrack = (AliMUONRecoTrack*)fRecoTracks->UncheckedAt(indr);
528 AliMUONRecoTrack *gtrack = 0;
529 Int_t bestMatch = -1;
530 Int_t maxNcompat = 0;
531 Int_t minNfakes = 10;
532 Double_t xrhit,yrhit,radius,xghit,yghit,dX,dY;
533 // loop over all Geant tracks
534 for (Int_t indg=0; indg<fGenTracks->GetEntriesFast(); indg++) {
535 gtrack = (AliMUONRecoTrack*)fGenTracks->UncheckedAt(indg);
536 if (!gtrack) continue;
537 Int_t ncompat = 0; // number of compat. hits for this track
538 Int_t nfake = 0; // number of fakes
539 // loop chambers to find compatible hits
540 for (Int_t ch=0; ch<10; ch++) {
541 xrhit = rtrack->GetPosX(ch);
542 yrhit = rtrack->GetPosY(ch);
543 radius = TMath::Sqrt(xrhit*xrhit + yrhit*yrhit);
544 if (radius<10) continue; // skip null hits
545 xghit = gtrack->GetPosX(ch);
546 yghit = gtrack->GetPosY(ch);
547 dX = TMath::Abs(xghit-xrhit);
548 dY = TMath::Abs(yghit-yrhit);
549 if (dX<tolerance*0.144 && dY<tolerance*0.01) {// within tol*sigma resolution
551 continue; // compatible hit
552 } else nfake++; // fake hit
554 if (ncompat && ncompat>=maxNcompat && nfake<minNfakes) { // this is best matching
555 maxNcompat = ncompat;
560 if (bestMatch<0 && tolerance<=9.) bestMatch = GetBestMatch(indr, tolerance+=1);
562 rtrack = (AliMUONRecoTrack*)fRecoTracks->UncheckedAt(indr);
563 Int_t sign = rtrack->GetSign();
564 cout << "Reconstructed track : " << indr << "(" << sign << ")" << endl;
566 printf("Best matching Geant track within %i*sgm : %i\n", (Int_t)tolerance, bestMatch);
568 gtrack = (AliMUONRecoTrack*)fGenTracks->UncheckedAt(bestMatch);
571 cout << "-----------------------------------------------------------------\n";
578 //-------------------------------------------------------------------
579 void AliMUONRecoDisplay::Highlight(Int_t track)
581 // Highlight the specified track
583 if (fHighlited >=0) UnHighlight();
584 if (track<0 || track>fPolyRecoList->GetEntries()) return;
585 TPolyLine3D *line = (TPolyLine3D*)fPolyRecoList->UncheckedAt(track);
586 line->SetLineColor(kYellow);
587 line->SetLineWidth(1);
589 // DrawView(15,-45,135);
594 //-------------------------------------------------------------------
595 void AliMUONRecoDisplay::UnHighlight()
597 // Unhighlight a previous highlighted track
598 if (fHighlited < 0 || fEmpty) return; // nothing to do
599 TPolyLine3D *line = (TPolyLine3D*)fPolyRecoList->UncheckedAt(fHighlited);
600 line->SetLineColor(kRed);
601 line->SetLineWidth(1);
608 //-------------------------------------------------------------------
609 void AliMUONRecoDisplay::DrawHits()
611 // Draw hits for all ALICE detectors. Overwrites the DrawHits() method of the
612 // base class for reco. track drawing
614 Float_t cutmin, cutmax, etamin, etamax, pmom, smin, smax, eta, theta, r;
615 const Float_t kptcutmax = 2;
616 const Float_t ketacutmax = 1.5;
624 smax = fCutSlider->GetMaximum();
625 smin = fCutSlider->GetMinimum();
626 cutmin = kptcutmax*smin;
627 if (smax < 0.98) cutmax = kptcutmax*smax;
628 else cutmax = 100000;
631 smax = fEtaSlider->GetMaximum();
632 smin = fEtaSlider->GetMinimum();
633 etamin = ketacutmax*(2*smin-1);
634 etamax = ketacutmax*(2*smax-1);
635 if (smin < 0.02) etamin = -1000;
636 if (smax > 0.98) etamax = 1000;
638 TIter next(gAlice->Modules());
642 // draw hits in all modules
643 while((module = (AliModule*)next())) {
644 if (!module->IsActive()) continue;
645 points = module->Points();
646 if (!points) continue;
647 ntracks = points->GetEntriesFast();
648 for (track=0;track<ntracks;track++) {
649 pm = (AliPoints*)points->UncheckedAt(track);
651 particle = pm->GetParticle();
652 if (!particle) continue;
653 pmom = particle->P();
654 if (pmom < cutmin) continue;
655 if (pmom > cutmax) continue;
656 // as a first approximation, take eta of first point
658 r = TMath::Sqrt(pxyz[0]*pxyz[0] + pxyz[1]*pxyz[1]);
659 theta = TMath::ATan2(r,TMath::Abs(pxyz[2]));
660 if(theta) eta = -TMath::Log(TMath::Tan(0.5*theta)); else eta = 1e10;
661 if (pxyz[2] < 0) eta = -eta;
662 if (eta < etamin || eta > etamax) continue;
664 fHitsCuts += pm->GetN();
668 // draw reconstructed tracks
670 TPolyLine3D *line, *gline;
673 AliMUONRecoTrack *rtrack;
675 if (fHighlited >= 0) {
676 line = (TPolyLine3D*)fPolyRecoList->UncheckedAt(fHighlited);
679 bestMatch = GetBestMatch(fHighlited);
681 gline = (TPolyLine3D*)fPolyGenList->UncheckedAt(bestMatch);
682 gline->SetLineColor(kRed);
683 gline->SetLineWidth(2);
684 gline->SetLineStyle(2);
688 for (track=0; track<fPolyRecoList->GetEntries(); track++) {
689 rtrack = (AliMUONRecoTrack*)fRecoTracks->UncheckedAt(track);
690 px = rtrack->GetMomReconstr(0);
691 py = rtrack->GetMomReconstr(1);
692 pz = rtrack->GetMomReconstr(2);
694 if (p>fMinMomentum && p<fMaxMomentum) {
695 line = (TPolyLine3D*)fPolyRecoList->UncheckedAt(track);
702 //-------------------------------------------------------------------
703 void AliMUONRecoDisplay::ListTracks()
705 // List momentum information of all reconstructed traccks within fPmin and fPmax
706 // cuts, as well as their best matching Geant tracks
708 cout << "================================================================\n";
709 printf("Reconstructed tracks with momentum in range : %g , %g [GeV/c]\n",
710 fMinMomentum, fMaxMomentum);
711 cout << "----------------------------------------------------------------\n";
712 AliMUONRecoTrack *rtrack;
715 for (Int_t ind=0; ind<fRecoTracks->GetEntries(); ind++) {
716 rtrack = (AliMUONRecoTrack*)fRecoTracks->UncheckedAt(ind);
718 if (p>fMinMomentum && p<fMaxMomentum) {
721 sign = rtrack->GetSign();
724 cout << "================================================================\n";
727 //-------------------------------------------------------------------
728 TClonesArray* AliMUONRecoDisplay::MakePolyLines3D(TClonesArray *tracklist)
730 // Makes the list of polylines3D corresponding to the list of tracks
731 if (fEmpty) return 0;
732 if (tracklist!=fRecoTracks && tracklist!=fGenTracks) return 0;
733 Bool_t reco = (tracklist==fRecoTracks)?kTRUE:kFALSE;
734 // make sure there is no other list in memory
737 fPolyRecoList->Delete();
738 delete fPolyRecoList;
743 fPolyGenList->Delete();
748 if (!tracklist->GetEntries()) return 0;
750 AliMUONRecoTrack* track = 0;
751 TClonesArray *polyLines3D = new TClonesArray("TPolyLine3D",1000);
752 TClonesArray &polylist = *polyLines3D;
753 TPolyLine3D *polyline = 0;
756 for (Int_t i=0; i<tracklist->GetEntries(); i++) {
757 track = (AliMUONRecoTrack*)tracklist->UncheckedAt(i);
760 polyline = new(polylist[i]) TPolyLine3D(2,"");
761 polyline->SetLineColor(kRed);
762 polyline->SetLineWidth(1);
763 polyline->SetNextPoint(0,0,track->GetVertexPos()); // vertex point
764 // loop chambers to fill TPolyLine3D objects
765 for (ch=0; ch<10; ch++) {
766 x = track->GetPosX(ch);
767 y = track->GetPosY(ch);
768 r = TMath::Sqrt(x*x + y*y);
769 if (r < 10) continue;
770 z = track->GetPosZ(ch);
771 polyline->SetNextPoint(x,y,z);
777 //-------------------------------------------------------------------
778 void AliMUONRecoDisplay::PolyLineInfo(TClonesArray *line3Dlist)
780 // Prints information (x, y, z coordinates) for all constructed polylines
783 TPolyLine3D *polyline = 0;
784 for(Int_t trackIndex=0; trackIndex<line3Dlist->GetEntries(); trackIndex++) {
785 polyline = (TPolyLine3D*)line3Dlist->UncheckedAt(trackIndex);
787 Float_t *pl = polyline->GetP();
788 for (Int_t i=0; i<polyline->GetN() ;i++) {
789 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]);