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.6 2001/01/26 21:50:43 morsch
19 Use access functions to AliMUONHit member data.
21 Revision 1.5 2001/01/26 20:00:53 hristov
22 Major upgrade of AliRoot code
24 Revision 1.4 2000/12/21 22:14:38 morsch
25 Clean-up of coding rule violations.
27 Revision 1.3 2000/12/21 17:51:54 morsch
28 RN3 violations corrected
30 Revision 1.2 2000/11/23 10:09:39 gosset
31 Bug correction in AliMUONRecoDisplay.
33 Copyright, Revision 1.6 2001/01/26 21:50:43 morsch
34 Copyright, Use access functions to AliMUONHit member data.
36 Copyright, Revision 1.5 2001/01/26 20:00:53 hristov
37 Copyright, Major upgrade of AliRoot code
39 Copyright, Revision 1.4 2000/12/21 22:14:38 morsch
40 Copyright, Clean-up of coding rule violations.
42 Copyright, Revision 1.3 2000/12/21 17:51:54 morsch
43 Copyright, RN3 violations corrected
44 Copyright,, $Id$, comments at the right place for automatic documentation,
45 in AliMUONRecoEvent and AliMUONRecoDisplay
49 //Authors: Mihaela Gheata, Andrei Gheata 09/10/00
50 //////////////////////////////////////////////////////////////////////
52 // AliMUONRecoDisplay //
54 // This class subclasses AliDisplay and provides display of //
55 // reconstructed tracks with following functionality : //
56 // - front/top/side/3D display of MUON reconstructed tracks //
58 // - context menu activated when the main pad is right-clicked //
59 // The context menu contains following functions : //
60 // * SetDrawHits() - switches on or off Geant hits ; //
61 // * CutMomentum() - displays only tracks within Pmin - Pmax //
62 // * ListTracks() - prints ID and momentum info. for all //
63 // tracks within momentum range Pmin,Pmax ; //
64 // * Highlight() - shows only one selected reco. track //
65 // and its best matching Geant track; //
66 // * UnHighlight() - self explaining; //
67 // * RecoEfficiency() - compute reco. efficiency for all events//
68 // from galice.root file; also fake track percentage; make //
69 // plots for momentum precision //
70 // * XYPlot() - make X-Y plots of reconstructed and //
71 // generated tracks in all chambers //
73 // Starting : generate and reconstruct events, then use the //
74 // MUONrecodisplay.C macro //
76 //////////////////////////////////////////////////////////////////////
80 #include <TClonesArray.h>
81 #include "AliMUONRecoEvent.h"
82 #include "AliMUONRecoDisplay.h"
83 #include "AliHeader.h"
85 #include <AliPoints.h>
88 #include <TGeometry.h>
90 ClassImp(AliMUONRecoDisplay)
92 //-------------------------------------------------------------------
93 AliMUONRecoDisplay::AliMUONRecoDisplay(Int_t nevent)
96 //************ Constructor of the reco. event display**********
97 // get reconstructed event from file
98 fFile = new TFile("tree_reco.root");
100 cout << "File tree_reco.root not found\n";
101 gApplication->Terminate(0);
104 fTree = (TTree *) fFile->Get("TreeRecoEvent");
106 cout << "Tree of reconstructed events not found on file. Abort.\n";
107 gApplication->Terminate(0);
111 TBranch *branch = fTree->GetBranch("Event");
112 branch->SetAddress(&fEvReco);
114 fEvGen = new AliMUONRecoEvent();
116 TFile *galiceFile = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
118 if (nevent > gAlice->TreeE()->GetEntries() - 1) {
119 cout << "Event number out of range !\n";
120 gApplication->Terminate(0);
122 gAlice->GetEvent(nevent);
136 //-------------------------------------------------------------------
137 AliMUONRecoDisplay::~AliMUONRecoDisplay()
139 // Destructor of display object
141 fPolyRecoList->Delete();
142 delete fPolyRecoList;
145 fPolyGenList->Delete();
150 //-------------------------------------------------------------------
151 Bool_t AliMUONRecoDisplay::Event(Int_t nevent)
153 // Go to event nevent
155 for (Int_t entry=0; entry<fTree->GetEntries(); entry++) {
156 fTree->GetEntry(entry);
157 if (fEvReco->GetNoEvent() == nevent) return kTRUE;
159 cout << "Event number " << nevent << " empty\n";
171 //-------------------------------------------------------------------
172 void AliMUONRecoDisplay::MapEvent(Int_t nevent)
174 // get generated event (nevent) from galice.root and corresponding
175 // reconstructed event from tree_reco.root;
176 cout << "mapping event " << nevent << endl;
180 // check if the event is not empty and make fEvReco to point to it
181 fEmpty = !Event(nevent);
184 // cout << "failed to load reco event ! Correct this.\n";
185 // gApplication->Terminate(0);
188 fRecoTracks = fEvReco->TracksPtr();
189 fPolyRecoList = MakePolyLines3D(fRecoTracks);
190 // clear previous event
191 if (fEvGen) fEvGen->Clear();
192 fEvGen->SetNoEvent(nevent);
193 // get list of particles
194 // connect MUON module
195 AliDetector *pMUON = gAlice->GetDetector("MUON");
197 cout << "MUON module not present.\n";
198 gApplication->Terminate(0);
200 // get the number of generated tracks
201 Int_t ntracks = (Int_t)gAlice->TreeH()->GetEntries();
202 // Fill the fEvGen object
203 AliMUONRecoTrack *gtrack = 0;
208 for (Int_t track=0; track<ntracks; track++) {
209 hit = (AliMUONHit *) pMUON->FirstHit(track);
211 particle = gAlice->Particle(hit->Track());
212 if (IsReconstructible(track) && TMath::Abs(particle->GetPdgCode())==13) {
213 gtrack = fEvGen->AddEmptyTrack();
214 gtrack->SetSign(TMath::Sign((Int_t)1, -particle->GetPdgCode()));
216 for (ch=0; ch<10; ch++) gtrack->SetHitPosition(ch,0,0,0);
218 for (AliMUONHit *muonHit=(AliMUONHit*)pMUON->FirstHit(track);
220 muonHit=(AliMUONHit*)pMUON->NextHit()) {
221 ch = muonHit->Chamber() - 1;
222 if (ch<0 || ch>9) continue;
223 gtrack->SetHitPosition(ch, muonHit->X(), muonHit->Y(), muonHit->Z());
224 gtrack->SetMomReconstr(particle->Px(), particle->Py(), particle->Pz());
225 gtrack->SetVertexPos(particle->Vz());
226 gtrack->SetChi2r(0.0);
230 fGenTracks = fEvGen->TracksPtr();
231 fPolyGenList = MakePolyLines3D(fGenTracks);
233 //-------------------------------------------------------------------
234 void AliMUONRecoDisplay::XYPlot()
236 // Plot reco. tracks hits in all chambers for current event:
237 // - open blue squares : generated muons that were reconstructed accurate
238 // - open cyan squares : generated muons that were not reconstructed
239 // - filled green circles : reco. tracks (accurate)
240 // - filled red squares : fake tracks
242 Double_t kMaxRadius[10];
243 kMaxRadius[0] = kMaxRadius[1] = 91.5;
244 kMaxRadius[2] = kMaxRadius[3] = 122.5;
245 kMaxRadius[4] = kMaxRadius[5] = 158.3;
246 kMaxRadius[6] = kMaxRadius[7] = 260.0;
247 kMaxRadius[8] = kMaxRadius[9] = 260.0;
249 TH2F *xygenFound[10];
251 TH2F *xyrecoGood[10];
252 TH2F *xyrecoFake[10];
257 TPad *pad = (TPad*)gROOT->GetSelectedPad();
258 TCanvas *canvas = new TCanvas("xy", "Reconstruction efficiency");
268 // Define histograms for x-y plots
269 for (ch=0; ch<10; ch++) {
270 xygenFound[ch] = new TH2F("xygen_found","",50,-kMaxRadius[ch],kMaxRadius[ch],50,-kMaxRadius[ch],kMaxRadius[ch]);
271 xygenLost[ch] = new TH2F("xygen_lost","",50,-kMaxRadius[ch],kMaxRadius[ch],50,-kMaxRadius[ch],kMaxRadius[ch]);
272 xyrecoGood[ch] = new TH2F("xyreco_good","",50,-kMaxRadius[ch],kMaxRadius[ch],50,-kMaxRadius[ch],kMaxRadius[ch]);
273 xyrecoFake[ch] = new TH2F("xyreco_fake","",50,-kMaxRadius[ch],kMaxRadius[ch],50,-kMaxRadius[ch],kMaxRadius[ch]);
275 // find list of matching tracks
276 fPrinted = kTRUE; // no need to print
277 for (index=0; index<fRecoTracks->GetEntriesFast(); index++) {
278 matches[index] = GetBestMatch(index);
281 for (index=0; index<fGenTracks->GetEntriesFast(); index++) { // GEANT
282 Bool_t wasreconst = kFALSE;
283 for (Int_t i=0; i<fRecoTracks->GetEntriesFast(); i++) {
284 if (matches[i] == index) {
289 AliMUONRecoTrack *current = (AliMUONRecoTrack*)fGenTracks->UncheckedAt(index);
290 for (ch=0; ch<10; ch++) {
291 x = current->GetPosX(ch);
292 y = current->GetPosY(ch);
293 r = TMath::Sqrt(x*x +y*y);
296 xygenFound[ch]->Fill(x,y);
297 } else {xygenLost[ch]->Fill(x,y);}
301 for (index=0; index<fRecoTracks->GetEntriesFast(); index++) { // reco
302 AliMUONRecoTrack *current = (AliMUONRecoTrack*)fRecoTracks->UncheckedAt(index);
303 for (ch=0; ch<10; ch++) {
304 x = current->GetPosX(ch);
305 y = current->GetPosY(ch);
306 r = TMath::Sqrt(x*x +y*y);
308 if (matches[index] >= 0) {
309 xyrecoGood[ch]->Fill(x,y);
310 } else {xyrecoFake[ch]->Fill(x,y);}
315 for (ch=0; ch<10; ch++) {
317 xygenFound[ch]->SetMarkerColor(kBlue);
318 xygenFound[ch]->SetMarkerStyle(4);
319 xygenFound[ch]->SetMarkerSize(0.5);
320 xygenFound[ch]->SetStats(kFALSE);
321 xygenFound[ch]->Draw();
322 xygenLost[ch]->SetMarkerColor(kCyan);
323 xygenLost[ch]->SetMarkerStyle(4);
324 xygenLost[ch]->SetMarkerSize(0.5);
325 xygenLost[ch]->SetStats(kFALSE);
326 xygenLost[ch]->Draw("SAME");
327 xyrecoGood[ch]->SetMarkerColor(kGreen);
328 xyrecoGood[ch]->SetMarkerStyle(20);
329 xyrecoGood[ch]->SetMarkerSize(0.4);
330 xyrecoGood[ch]->SetStats(kFALSE);
331 xyrecoGood[ch]->Draw("SAME");
332 xyrecoFake[ch]->SetMarkerColor(kRed);
333 xyrecoFake[ch]->SetMarkerStyle(20);
334 xyrecoFake[ch]->SetMarkerSize(0.5);
335 xyrecoFake[ch]->SetStats(kFALSE);
336 xyrecoFake[ch]->Draw("SAME");
338 canvas->SetTitle("y vs. x for simulated and reconstructed tracks");
342 //-------------------------------------------------------------------
343 void AliMUONRecoDisplay::RecoEfficiency(Int_t first, Int_t last)
345 // Loop selected reconstructed events, compute efficiency as total number of
346 // reconstructed tracks (accurate) over total number of generated
347 // reconstructible muons. Make histogram for momentum precision and profile
348 // of mean momentum precision versus total momentum (generated)
349 Int_t nevents = (Int_t)gAlice->TreeE()->GetEntries();
350 if (last > nevents) last = nevents - 1;
351 if (first < 0) first = 0;
352 nevents = last - first + 1;
355 Float_t generated=0, found=0, fake=0; // number of generated/found/fake tracks
356 Double_t pgen, preco, dP; // dP=preco-pgen
357 AliMUONRecoTrack *rtrack, *gtrack; // generated/reco. current tracks
358 fPrinted = kTRUE; // no need to print
359 Int_t currentEvent = gAlice->GetHeader()->GetEvent();
361 TH1F *pReso = new TH1F("Momentum precision", "dP = Prec - Pgen", 100, -5.0, 5.0);
362 pReso->SetXTitle("dP [GeV/c]");
363 pReso->SetYTitle("dN/dP");
365 TProfile *dPp = new TProfile("", "dP vs. P", 50, 0, 100, 0, 5);
366 dPp->SetXTitle("P [GeV/c]");
367 dPp->SetYTitle("<dP> [GeV/c]");
369 TPad *pad = (TPad*)gROOT->GetSelectedPad();
370 TCanvas *canvas = new TCanvas("c", "Reconstruction efficiency");
375 for (Int_t event=first; event<=last; event++) {
376 // get the reco. & gen. events
377 TFile *galiceFile = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
379 gAlice->GetEvent(event);
386 generated += fGenTracks->GetEntriesFast();
388 for (track=0; track<fRecoTracks->GetEntriesFast(); track++) {
389 rtrack = (AliMUONRecoTrack*)fRecoTracks->UncheckedAt(track);
391 // find correspondent generated track
392 Int_t ind = GetBestMatch(track);
394 gtrack = (AliMUONRecoTrack*)fGenTracks->UncheckedAt(ind);
399 dPp->Fill(pgen, TMath::Abs(dP));
405 efficiency = found/generated;
406 cout << "=================================================================\n";
407 cout << "|| Reconstruction efficiency and momentum precision ||\n";
408 cout << "=================================================================\n";
409 cout << "Number of events processed " << nevents << endl;
410 cout << "Total number of reconstructible muons : " << (Int_t)generated << endl;
411 cout << "RECONSTRUCTION EFFICIENCY : " << efficiency*100 << " %" << endl;
412 cout << "Fake track rate : " << 100*fake/generated << " %" << endl;
413 cout << "Momentum precision fit : \n" << endl;
415 cout << "=================================================================\n";
422 ShowNextEvent(currentEvent-last);
425 //-------------------------------------------------------------------
426 void AliMUONRecoDisplay::ShowNextEvent(Int_t delta)
428 // overwritten from AliDisplay in order to get also mapping of next event
429 TFile *galiceFile = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
433 Int_t currentEvent = gAlice->GetHeader()->GetEvent();
434 Int_t newEvent = currentEvent + delta;
435 if (newEvent<0 || newEvent>(gAlice->TreeE()->GetEntries() - 1)) return;
436 Int_t nparticles = gAlice->GetEvent(newEvent);
437 cout << "Event : " << newEvent << " with " << nparticles << " particles\n";
438 if (!gAlice->TreeH()) return;
445 if (gROOT->GetListOfCanvases()->FindObject("xy")) XYPlot();
447 //-------------------------------------------------------------------
448 Bool_t AliMUONRecoDisplay::IsReconstructible(Int_t track)
450 // true if at least three hits in first 2 stations, 3 in last 2 stations
451 // and one in station 3
452 if (fEmpty) return kFALSE;
453 AliDetector *pMUON = gAlice->GetDetector("MUON");
456 for (ch=0; ch<10; ch++) chHit[ch] = kFALSE;
458 for (AliMUONHit *muonHit=(AliMUONHit*)pMUON->FirstHit(track);
460 muonHit=(AliMUONHit*)pMUON->NextHit()) {
461 ch = muonHit->Chamber() - 1;
462 if (ch<0 || ch>9) continue;
466 for (ch=0; ch<4; ch++) nhits += (chHit[ch])?1:0;
467 if (nhits < 3) return kFALSE;
469 for (ch=4; ch<6; ch++) nhits+= (chHit[ch])?1:0;
470 if (nhits < 1) return kFALSE;
472 for (ch=7; ch<10; ch++) nhits+= (chHit[ch])?1:0;
473 if (nhits < 3) return kFALSE;
477 //-------------------------------------------------------------------
478 void AliMUONRecoDisplay::DrawView(Float_t theta, Float_t phi, Float_t psi)
480 // ovewritten from base class to change the range for MUON
481 gPad->SetCursor(kWatch);
482 gPad->SetFillColor(1);
486 TView *view = new TView(1);
487 Float_t range = fRrange*fRangeSlider->GetMaximum();
488 view->SetRange(-range, -range, 0, range, range, 5*range);
493 // Display Alice geometry
494 gAlice->GetGeometry()->Draw("same");
495 //Loop on all detectors to add their products to the pad
497 // add itself to the list (last)
500 view->SetView(phi, theta, psi, iret);
502 //-------------------------------------------------------------------
503 void AliMUONRecoDisplay::SetDrawHits(Bool_t hits)
505 // Turns on/off Geant hits drawing
510 //-------------------------------------------------------------------
511 void AliMUONRecoDisplay::CutMomentum(Double_t min, Double_t max)
513 // Define momentum cut for displayed reconstructed tracks
516 if (fHighlited >= 0) UnHighlight();
520 //-------------------------------------------------------------------
521 Int_t AliMUONRecoDisplay::GetBestMatch(Int_t indr, Float_t tolerance)
523 // Find the index of best Geant track matching a reconstructed track : track
524 // with maximum number of compatible hits (within tolerance*sigma bending and
525 // non-bending resolution) and minimum number of fake hits;
526 // If no match is found within a given tolerance, the method is called recursively
527 // with increasing tolerance, until tolerance = 10;
528 if (fEmpty) return -1;
529 if (indr<0 || indr>=fRecoTracks->GetEntriesFast()) return -1;
530 AliMUONRecoTrack *rtrack = (AliMUONRecoTrack*)fRecoTracks->UncheckedAt(indr);
531 AliMUONRecoTrack *gtrack = 0;
532 Int_t bestMatch = -1;
533 Int_t maxNcompat = 0;
534 Int_t minNfakes = 10;
535 Double_t xrhit,yrhit,radius,xghit,yghit,dX,dY;
536 // loop over all Geant tracks
537 for (Int_t indg=0; indg<fGenTracks->GetEntriesFast(); indg++) {
538 gtrack = (AliMUONRecoTrack*)fGenTracks->UncheckedAt(indg);
539 if (!gtrack) continue;
540 Int_t ncompat = 0; // number of compat. hits for this track
541 Int_t nfake = 0; // number of fakes
542 // loop chambers to find compatible hits
543 for (Int_t ch=0; ch<10; ch++) {
544 xrhit = rtrack->GetPosX(ch);
545 yrhit = rtrack->GetPosY(ch);
546 radius = TMath::Sqrt(xrhit*xrhit + yrhit*yrhit);
547 if (radius<10) continue; // skip null hits
548 xghit = gtrack->GetPosX(ch);
549 yghit = gtrack->GetPosY(ch);
550 dX = TMath::Abs(xghit-xrhit);
551 dY = TMath::Abs(yghit-yrhit);
552 if (dX<tolerance*0.144 && dY<tolerance*0.01) {// within tol*sigma resolution
554 continue; // compatible hit
555 } else nfake++; // fake hit
557 if (ncompat && ncompat>=maxNcompat && nfake<minNfakes) { // this is best matching
558 maxNcompat = ncompat;
563 if (bestMatch<0 && tolerance<=9.) bestMatch = GetBestMatch(indr, tolerance+=1);
565 rtrack = (AliMUONRecoTrack*)fRecoTracks->UncheckedAt(indr);
566 Int_t sign = rtrack->GetSign();
567 cout << "Reconstructed track : " << indr << "(" << sign << ")" << endl;
569 printf("Best matching Geant track within %i*sgm : %i\n", (Int_t)tolerance, bestMatch);
571 gtrack = (AliMUONRecoTrack*)fGenTracks->UncheckedAt(bestMatch);
574 cout << "-----------------------------------------------------------------\n";
581 //-------------------------------------------------------------------
582 void AliMUONRecoDisplay::Highlight(Int_t track)
584 // Highlight the specified track
586 if (fHighlited >=0) UnHighlight();
587 if (track<0 || track>fPolyRecoList->GetEntries()) return;
588 TPolyLine3D *line = (TPolyLine3D*)fPolyRecoList->UncheckedAt(track);
589 line->SetLineColor(kYellow);
590 line->SetLineWidth(1);
592 // DrawView(15,-45,135);
597 //-------------------------------------------------------------------
598 void AliMUONRecoDisplay::UnHighlight()
600 // Unhighlight a previous highlighted track
601 if (fHighlited < 0 || fEmpty) return; // nothing to do
602 TPolyLine3D *line = (TPolyLine3D*)fPolyRecoList->UncheckedAt(fHighlited);
603 line->SetLineColor(kRed);
604 line->SetLineWidth(1);
611 //-------------------------------------------------------------------
612 void AliMUONRecoDisplay::DrawHits()
614 // Draw hits for all ALICE detectors. Overwrites the DrawHits() method of the
615 // base class for reco. track drawing
617 Float_t cutmin, cutmax, etamin, etamax, pmom, smin, smax, eta, theta, r;
618 const Float_t kptcutmax = 2;
619 const Float_t ketacutmax = 1.5;
627 smax = fCutSlider->GetMaximum();
628 smin = fCutSlider->GetMinimum();
629 cutmin = kptcutmax*smin;
630 if (smax < 0.98) cutmax = kptcutmax*smax;
631 else cutmax = 100000;
634 smax = fEtaSlider->GetMaximum();
635 smin = fEtaSlider->GetMinimum();
636 etamin = ketacutmax*(2*smin-1);
637 etamax = ketacutmax*(2*smax-1);
638 if (smin < 0.02) etamin = -1000;
639 if (smax > 0.98) etamax = 1000;
641 TIter next(gAlice->Modules());
645 // draw hits in all modules
646 while((module = (AliModule*)next())) {
647 if (!module->IsActive()) continue;
648 points = module->Points();
649 if (!points) continue;
650 ntracks = points->GetEntriesFast();
651 for (track=0;track<ntracks;track++) {
652 pm = (AliPoints*)points->UncheckedAt(track);
654 particle = pm->GetParticle();
655 if (!particle) continue;
656 pmom = particle->P();
657 if (pmom < cutmin) continue;
658 if (pmom > cutmax) continue;
659 // as a first approximation, take eta of first point
661 r = TMath::Sqrt(pxyz[0]*pxyz[0] + pxyz[1]*pxyz[1]);
662 theta = TMath::ATan2(r,TMath::Abs(pxyz[2]));
663 if(theta) eta = -TMath::Log(TMath::Tan(0.5*theta)); else eta = 1e10;
664 if (pxyz[2] < 0) eta = -eta;
665 if (eta < etamin || eta > etamax) continue;
667 fHitsCuts += pm->GetN();
671 // draw reconstructed tracks
673 TPolyLine3D *line, *gline;
676 AliMUONRecoTrack *rtrack;
678 if (fHighlited >= 0) {
679 line = (TPolyLine3D*)fPolyRecoList->UncheckedAt(fHighlited);
682 bestMatch = GetBestMatch(fHighlited);
684 gline = (TPolyLine3D*)fPolyGenList->UncheckedAt(bestMatch);
685 gline->SetLineColor(kRed);
686 gline->SetLineWidth(2);
687 gline->SetLineStyle(2);
691 for (track=0; track<fPolyRecoList->GetEntries(); track++) {
692 rtrack = (AliMUONRecoTrack*)fRecoTracks->UncheckedAt(track);
693 px = rtrack->GetMomReconstr(0);
694 py = rtrack->GetMomReconstr(1);
695 pz = rtrack->GetMomReconstr(2);
697 if (p>fMinMomentum && p<fMaxMomentum) {
698 line = (TPolyLine3D*)fPolyRecoList->UncheckedAt(track);
705 //-------------------------------------------------------------------
706 void AliMUONRecoDisplay::ListTracks()
708 // List momentum information of all reconstructed traccks within fPmin and fPmax
709 // cuts, as well as their best matching Geant tracks
711 cout << "================================================================\n";
712 printf("Reconstructed tracks with momentum in range : %g , %g [GeV/c]\n",
713 fMinMomentum, fMaxMomentum);
714 cout << "----------------------------------------------------------------\n";
715 AliMUONRecoTrack *rtrack;
718 for (Int_t ind=0; ind<fRecoTracks->GetEntries(); ind++) {
719 rtrack = (AliMUONRecoTrack*)fRecoTracks->UncheckedAt(ind);
721 if (p>fMinMomentum && p<fMaxMomentum) {
724 sign = rtrack->GetSign();
727 cout << "================================================================\n";
730 //-------------------------------------------------------------------
731 TClonesArray* AliMUONRecoDisplay::MakePolyLines3D(TClonesArray *tracklist)
733 // Makes the list of polylines3D corresponding to the list of tracks
734 if (fEmpty) return 0;
735 if (tracklist!=fRecoTracks && tracklist!=fGenTracks) return 0;
736 Bool_t reco = (tracklist==fRecoTracks)?kTRUE:kFALSE;
737 // make sure there is no other list in memory
740 fPolyRecoList->Delete();
741 delete fPolyRecoList;
746 fPolyGenList->Delete();
751 if (!tracklist->GetEntries()) return 0;
753 AliMUONRecoTrack* track = 0;
754 TClonesArray *polyLines3D = new TClonesArray("TPolyLine3D",1000);
755 TClonesArray &polylist = *polyLines3D;
756 TPolyLine3D *polyline = 0;
759 for (Int_t i=0; i<tracklist->GetEntries(); i++) {
760 track = (AliMUONRecoTrack*)tracklist->UncheckedAt(i);
763 polyline = new(polylist[i]) TPolyLine3D(2,"");
764 polyline->SetLineColor(kRed);
765 polyline->SetLineWidth(1);
766 polyline->SetNextPoint(0,0,track->GetVertexPos()); // vertex point
767 // loop chambers to fill TPolyLine3D objects
768 for (ch=0; ch<10; ch++) {
769 x = track->GetPosX(ch);
770 y = track->GetPosY(ch);
771 r = TMath::Sqrt(x*x + y*y);
772 if (r < 10) continue;
773 z = track->GetPosZ(ch);
774 polyline->SetNextPoint(x,y,z);
780 //-------------------------------------------------------------------
781 void AliMUONRecoDisplay::PolyLineInfo(TClonesArray *line3Dlist)
783 // Prints information (x, y, z coordinates) for all constructed polylines
786 TPolyLine3D *polyline = 0;
787 for(Int_t trackIndex=0; trackIndex<line3Dlist->GetEntries(); trackIndex++) {
788 polyline = (TPolyLine3D*)line3Dlist->UncheckedAt(trackIndex);
790 Float_t *pl = polyline->GetP();
791 for (Int_t i=0; i<polyline->GetN() ;i++) {
792 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]);