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.4 2000/06/12 15:21:08 jbarbosa
21 Revision 1.3 2000/06/09 14:52:08 jbarbosa
22 New tentative ellipse drawing routine
24 Revision 1.1 2000/04/19 13:07:45 morsch
25 Digits, clusters and reconstruction results added.
30 //////////////////////////////////////////////////////////////////////////
34 // Utility class to display ALICE outline, tracks, hits,.. //
36 //////////////////////////////////////////////////////////////////////////
45 #include <TPolyMarker3D.h>
46 #include <TPolyMarker.h>
47 #include <TPaveLabel.h>
48 #include <TPaveText.h>
55 #include <TSliderBox.h>
57 #include <TVirtualX.h>
60 #include <X3DBuffer.h>
61 #include <TParticle.h>
65 #include "AliDetector.h"
67 #include "AliRICHConst.h"
68 #include "AliRICHDisplay.h"
69 #include "AliRICHPoints.h"
71 #include "AliRICHHit.h"
72 #include "AliRICHCerenkov.h"
73 #include "AliRICHPadHit.h"
74 #include "AliRICHDigit.h"
75 #include "AliRICHRawCluster.h"
76 #include "AliRICHRecHit.h"
77 #include "AliRICHEllipse.h"
79 ClassImp(AliRICHDisplay)
82 //____________________________________________________________________________
83 AliRICHDisplay::AliRICHDisplay()
86 // default constructor
96 //_____________________________________________________________________________
97 AliRICHDisplay::AliRICHDisplay(Int_t size)
99 // Create an event display object.
100 // A canvas named "edisplay" is created with a vertical size in pixels
102 // A QUICK Overview of the Event Display functions
103 // ===============================================
105 // The event display can ve invoked by executing the macro "display.C"
106 // A canvas like in the picture below will appear.
108 // On the left side of the canvas, the following buttons appear:
109 // *Next* to move to the next event
110 // *Previous* to move to the previous event
112 // *Pick* Select this option to be able to point on a track with the
113 // mouse. Once on the track, use the right button to select
114 // an action. For example, select SetMarkerAttributes to
115 // change the marker type/color/size for the track.
116 // *Zoom* Select this option (default) if you want to zoom.
117 // To zoom, simply select the selected area with the left button.
118 // *UnZoom* To revert to the previous picture size.
120 // slider R On the left side, the vertical slider can be used to
121 // set the default picture size.
123 // When you are in Zoom mode, you can click on the black part of the canvas
124 // to select special options with the right mouse button.
127 // When you are in pick mode, you can "Inspect" the object pointed by the mouse.
128 // When you are on a track, select the menu item "InspectParticle"
129 // to display the current particle attributes.
131 // You can activate the Root browser by selecting the Inspect menu
132 // in the canvas tool bar menu. Then select "Start Browser"
133 // This will open a new canvas with the browser. At this point, you may want
134 // to display some histograms (from the Trees). Go to the "File" menu
135 // of the browser and click on "New canvas".
136 // In the browser, click on item "ROOT files" in the left pane.
137 // Click on galice.root.
139 // Click on TPC for example
140 // Click on any variable (eg TPC.fX) to histogram the variable.
142 // If you are lost, you can click on HELP in any Root canvas or browser.
145 <img src="gif/AliRICHDisplay.gif">
152 gAlice->SetDisplay(this);
154 // Initialize display default parameters
157 // Set front view by default
164 fDrawClusters = kTRUE;
166 fDrawRecHits = kTRUE;
177 // Create display canvas
179 if (ysize < 100) ysize = 750;
180 Int_t xsize = Int_t(size*830./ysize);
181 fCanvas = new TCanvas("Canvas", "RICH Clusters Display",14,47,xsize,ysize);
182 fCanvas->ToggleEventStatus();
184 // Create main display pad
185 fPad = new TPad("viewpad", "RICH display",0.15,0,0.9,1);
188 fPad->SetFillColor(1);
189 fPad->SetBorderSize(2);
194 fColPad = new TPad("colpad", "Colors pad",0.9,0,1,1);
197 fColPad->SetFillColor(19);
198 fColPad->SetBorderSize(2);
204 // Create user interface control pad
208 // Create Range and mode pad
211 fTrigPad = new TPad("trigger", "range and mode pad",0,0,dxtr,dytr);
212 fTrigPad->SetEditable(kFALSE);
215 fTrigPad->SetFillColor(22);
216 fTrigPad->SetBorderSize(2);
217 fRangeSlider = new TSlider("range","range",0.7,0.42,0.9,0.98);
218 fRangeSlider->SetObject(this);
219 char pickmode[] = "gAlice->Display()->SetPickMode()";
221 fPickButton = new TButton("Pick",pickmode,0.05,0.32,0.65,0.32+db);
222 fPickButton->SetFillColor(38);
224 char zoommode[] = "gAlice->Display()->SetZoomMode()";
225 fZoomButton = new TButton("Zoom",zoommode,0.05,0.21,0.65,0.21+db);
226 fZoomButton->SetFillColor(38);
228 fArcButton = new TArc(.8,fZoomButton->GetYlowNDC()+0.5*db,0.33*db);
229 fArcButton->SetFillColor(kGreen);
231 char butUnzoom[] = "gAlice->Display()->UnZoom()";
232 TButton *button = new TButton("UnZoom",butUnzoom,0.05,0.05,0.95,0.15);
233 button->SetFillColor(38);
235 AppendPad(); // append display object as last object to force selection
242 //_____________________________________________________________________________
243 AliRICHDisplay::~AliRICHDisplay()
245 // Delete space point structure
246 if (fPoints) fPoints->Delete();
250 if (fPhits) fPhits->Delete();
254 if (fRpoints) fRpoints->Delete();
258 if (fRecpoints) fRecpoints->Delete();
262 if (fPCerenkovs) fPCerenkovs->Delete();
267 //_____________________________________________________________________________
268 void AliRICHDisplay::Clear(Option_t *)
270 // Delete graphics temporary objects
273 //_____________________________________________________________________________
274 void AliRICHDisplay::DisplayButtons()
276 // Create the user interface buttons
279 fButtons = new TPad("buttons", "newpad",0,0.45,0.15,1);
280 fButtons->SetEditable(kFALSE);
282 fButtons->SetFillColor(38);
283 fButtons->SetBorderSize(2);
286 // Int_t butcolor = 33;
287 Float_t dbutton = 0.08;
294 char but1[] = "gAlice->Display()->ShowNextEvent(1)";
295 button = new TButton("Next",but1,x0,y-dbutton,x1,y);
296 button->SetFillColor(38);
300 char but2[] = "gAlice->Display()->ShowNextEvent(-1)";
301 button = new TButton("Previous",but2,x0,y-dbutton,x1,y);
302 button->SetFillColor(38);
306 char but7[] = "gAlice->Display()->DrawViewGL()";
307 button = new TButton("OpenGL",but7,x0,y-dbutton,x1,y);
308 button->SetFillColor(38);
312 char but8[] = "gAlice->Display()->DrawViewX3D()";
313 button = new TButton("X3D",but8,x0,y-dbutton,x1,y);
314 button->SetFillColor(38);
318 TDiamond *diamond = new TDiamond(0.05,0.015,0.95,0.22);
319 diamond->SetFillColor(50);
320 diamond->SetTextAlign(22);
321 diamond->SetTextColor(5);
322 diamond->SetTextSize(0.11);
324 diamond->AddText(".. ");
325 diamond->AddText("ROOT");
326 diamond->AddText("RICH");
327 diamond->AddText("... ");
328 diamond->AddText(" ");
331 //_____________________________________________________________________________
332 void AliRICHDisplay::CreateColors()
334 // Create the colors palette used to display clusters
349 new TColor(color,r,g,b);
359 new TColor(color,r,g,b);
369 new TColor(color,r,g,b);
379 new TColor(color,r,g,b);
389 new TColor(color,r,g,b);
396 //_____________________________________________________________________________
397 void AliRICHDisplay::DisplayColorScale()
400 // Draw the color scale in the RICH display canvas
404 Float_t xlow, ylow, xup, yup, hs;
405 Float_t x1, y1, x2, y2;
409 gPad->SetFillColor(0);
411 gPad->Range(x1,y1,x2,y2);
412 TText *text = new TText(0,0,"");
413 text->SetTextFont(61);
414 text->SetTextSize(0.03);
415 text->SetTextAlign(22);
419 //*-* draw colortable boxes
420 hs = (y2-y1)/Float_t(22);
424 ylow = y1 + hs*(Float_t(i));
425 yup = y1 + hs*(Float_t(i+1));
427 Double_t logscale=Double_t(i+1)*(TMath::Log(adc_satm)/22);
428 Int_t scale=(Int_t)TMath::Exp(logscale);
429 sprintf(label,"%d",scale);
430 box = new TBox(xlow, ylow, xup, yup);
431 box->SetFillColor(color);
433 text->DrawText(xup+4, 0.5*(ylow+yup),label);
437 //______________________________________________________________________________
438 Int_t AliRICHDisplay::DistancetoPrimitive(Int_t px, Int_t)
440 // Compute distance from point px,py to objects in event
442 gPad->SetCursor(kCross);
444 if (gPad == fTrigPad) return 9999;
446 const Int_t kBig = 9999;
448 Float_t xmin = gPad->GetX1();
449 Float_t xmax = gPad->GetX2();
450 Float_t dx = 0.02*(xmax - xmin);
451 Float_t x = gPad->AbsPixeltoX(px);
452 if (x < xmin+dx || x > xmax-dx) return dist;
453 if (fZoomMode) return 0;
457 //_____________________________________________________________________________
458 void AliRICHDisplay::Draw(Option_t *)
460 // Display current event
464 DrawView(fTheta, fPhi, fPsi); // see how to draw PGON+inner frames
466 // Display the event number and title
471 //_____________________________________________________________________________
472 void AliRICHDisplay::DrawCoG()
474 // Draw hits for RICH chambers
476 if (!fDrawCoG) return;
478 for (Int_t chamber=0;chamber<kNCH;chamber++) {
487 ncog = points->GetEntriesFast();
488 for (icog=0; icog < ncog; icog++) {
489 pm = (AliRICHPoints*)points->UncheckedAt(icog);
495 void AliRICHDisplay::DrawRecHits()
497 // Draw rec hits for RICH chambers
499 if (!fDrawRecHits) return;
501 for (Int_t chamber=0;chamber<kNCH;chamber++) {
502 LoadRecHits(chamber,1);
510 nrec = points->GetEntriesFast();
511 printf("Nrec %d\n",nrec);
512 for (irec=0; irec < nrec; irec++) {
513 pm = (AliRICHPoints*)points->UncheckedAt(irec);
519 //_____________________________________________________________________________
521 void AliRICHDisplay::DrawCerenkovs()
523 // Draw cerenkovs hits for RICH chambers
525 LoadCerenkovs(fChamber);
526 //printf("\nDrawCerenkovs\n");
528 Int_t ntracks, track;
533 cpoints = fPCerenkovs;
534 //printf ("Cpoints: %p",cpoints);
535 if (!cpoints) return;
536 ntracks = cpoints->GetEntriesFast();
537 //printf("DrawCerenkovs - ntracks %d \n",ntracks);
538 for (track=0;track<ntracks;track++) {
539 pm = (AliRICHPoints*)cpoints->UncheckedAt(track);
542 fHitsCuts += pm->GetN();
546 //_____________________________________________________________________________
548 void AliRICHDisplay::DrawClusters()
550 // Draw clusterss for RICH chambers
552 Int_t ndigits, digit;
559 ndigits = points->GetEntriesFast();
560 for (digit=0;digit<ndigits;digit++){
561 pm = (AliRICHPoints*)points->UncheckedAt(digit);
566 for (Int_t im=0;im<3;im++) {
567 TMarker3DBox *marker=pm->GetMarker(im);
571 fClustersCuts +=pm->GetN();
575 //_____________________________________________________________________________
576 void AliRICHDisplay::DrawHits()
578 // Draw hits for RICH chambers
582 Int_t ntracks, track;
589 // ntracks = points->GetEntriesFast();
590 ntracks = fPhits->GetEntriesFast();
592 //printf("DrawHits - ntracks %d \n",ntracks);
593 for (track=0;track<ntracks;track++) {
594 pm = (AliRICHPoints*)fPhits->UncheckedAt(track);
597 fHitsCuts += pm->GetN();
602 //_____________________________________________________________________________
603 void AliRICHDisplay::DrawTitle(Option_t *option)
605 // Draw the event title
607 Float_t xmin = gPad->GetX1();
608 Float_t xmax = gPad->GetX2();
609 Float_t ymin = gPad->GetY1();
610 Float_t ymax = gPad->GetY2();
611 Float_t dx = xmax-xmin;
612 Float_t dy = ymax-ymin;
614 if (strlen(option) == 0) {
615 TPaveText *title = new TPaveText(xmin +0.01*dx, ymax-0.09*dy, xmin +0.5*dx, ymax-0.01*dy);
616 title->SetBit(kCanDelete);
617 title->SetFillColor(42);
620 sprintf(ptitle,"Alice event: %d, Run:%d",
621 gAlice->GetHeader()->GetEvent(), gAlice->GetHeader()->GetRun());
622 title->AddText(ptitle);
623 Int_t nparticles = gAlice->Particles()->GetEntriesFast();
624 sprintf(ptitle,"Nparticles = %d Nhits = %d Npads fired = %d",
625 nparticles, fHitsCuts,fClustersCuts);
626 title->AddText(ptitle);
629 new TPaveLabel(xmin +0.01*dx, ymax-0.07*dy, xmin +0.2*dx, ymax-0.01*dy,option);
630 label->SetBit(kCanDelete);
631 label->SetFillColor(42);
636 //_____________________________________________________________________________
637 void AliRICHDisplay::DrawView(Float_t theta, Float_t phi, Float_t psi)
639 // Draw a view of RICH clusters
641 gPad->SetCursor(kWatch);
642 gPad->SetFillColor(1);
646 TView *view = new TView(1);
647 Float_t range = fRrange*fRangeSlider->GetMaximum();
648 view->SetRange(-range,-range,-range,range, range, range);
655 //Display RICH Chamber Geometry
656 gAlice->GetGeometry()->Draw("same");
658 //add clusters to the pad
662 printf("Calling DrawCoG\n");
664 printf("Calling DrawRecHits\n");
666 /*for (Int_t i=0;i<7;i++)
669 // add itself to the list (must be last)
672 view->SetView(phi, theta, psi, iret);
675 //______________________________________________________________________________
676 void AliRICHDisplay::ExecuteEvent(Int_t event, Int_t px, Int_t py)
678 // Execute action corresponding to the mouse event
680 static Float_t x0, y0, x1, y1;
682 static Int_t pxold, pyold;
683 static Int_t px0, py0;
684 static Int_t linedrawn;
687 if (px == 0 && py == 0) { //when called by sliders
688 if (event == kButton1Up) {
693 if (!fZoomMode && gPad->GetView()) {
694 gPad->GetView()->ExecuteRotateView(event, px, py);
698 // something to zoom ?
699 gPad->SetCursor(kCross);
704 gVirtualX->SetLineColor(-1);
705 gPad->TAttLine::Modify(); //Change line attributes only if necessary
706 x0 = gPad->AbsPixeltoX(px);
707 y0 = gPad->AbsPixeltoY(py);
709 pxold = px; pyold = py;
714 if (linedrawn) gVirtualX->DrawBox(px0, py0, pxold, pyold, TVirtualX::kHollow);
718 gVirtualX->DrawBox(px0, py0, pxold, pyold, TVirtualX::kHollow);
722 gPad->GetCanvas()->FeedbackMode(kFALSE);
723 if (px == px0) return;
724 if (py == py0) return;
725 x1 = gPad->AbsPixeltoX(px);
726 y1 = gPad->AbsPixeltoY(py);
728 if (x1 < x0) {temp = x0; x0 = x1; x1 = temp;}
729 if (y1 < y0) {temp = y0; y0 = y1; y1 = temp;}
730 gPad->Range(x0,y0,x1,y1);
731 if (fZooms < kMAXZOOM-1) {
733 fZoomX0[fZooms] = x0;
734 fZoomY0[fZooms] = y0;
735 fZoomX1[fZooms] = x1;
736 fZoomY1[fZooms] = y1;
738 gPad->Modified(kTRUE);
743 //___________________________________________
744 void AliRICHDisplay::LoadCoG(Int_t chamber, Int_t cathode)
746 // Read raw clusters info and store x,y,z info in arrays fRpoints
747 // Loop on all detectors
749 if (chamber > 6) return;
751 printf("Entering LoadCoG\n");
754 AliRICH *pRICH = (AliRICH*)gAlice->GetModule("RICH");
755 AliRICHChamber* iChamber;
757 TClonesArray *pRICHrawclust = pRICH->RawClustAddress(chamber);
758 printf ("Chamber:%d has adress:%p\n", chamber, pRICHrawclust );
759 if (pRICHrawclust == 0) return;
761 pRICH->ResetRawClusters();
764 Int_t nent=(Int_t)gAlice->TreeR()->GetEntries();
765 gAlice->TreeR()->GetEvent(nent-1+cathode-1);
766 Int_t nrawcl = pRICHrawclust->GetEntriesFast();
767 printf ("nrawcl:%d\n",nrawcl);
768 if (nrawcl == 0) return;
769 if (fRpoints == 0) fRpoints = new TObjArray(nrawcl);
771 iChamber = &(pRICH->Chamber(chamber));
772 AliRICHRawCluster *mRaw;
773 AliRICHPoints *points = 0;
775 //loop over all raw clusters and store their position
776 points = new AliRICHPoints(nrawcl);
777 for (Int_t iraw=0;iraw<nrawcl;iraw++) {
778 mRaw = (AliRICHRawCluster*)pRICHrawclust->UncheckedAt(iraw);
779 fRpoints->AddAt(points,iraw);
780 points->SetMarkerColor(3);
781 points->SetMarkerStyle(3);
782 points->SetMarkerSize(1.);
783 points->SetParticle(-1);
784 points->SetHitIndex(-1);
785 points->SetTrackIndex(-1);
786 points->SetDigitIndex(-1);
787 Float_t vectorLoc[3]={mRaw->fX,6.276,mRaw->fY};
788 Float_t vectorGlob[3];
789 iChamber->LocaltoGlobal(vectorLoc,vectorGlob);
790 points->SetPoint(iraw,vectorGlob[0],vectorGlob[1],vectorGlob[2]);
793 //___________________________________________
794 void AliRICHDisplay::LoadRecHits(Int_t chamber, Int_t cathode)
796 // Read rec. hits info
797 // Loop on all detectors
799 if (chamber > 6) return;
801 printf("Entering LoadRecHits\n");
804 AliRICH *pRICH = (AliRICH*)gAlice->GetModule("RICH");
805 AliRICHChamber* iChamber;
807 TClonesArray *pRICHrechits = pRICH->RecHitsAddress(chamber);
808 printf ("Chamber:%d\n", chamber);
809 if (pRICHrechits == 0) return;
811 //RICH->ResetRecHits();
814 Int_t nent=(Int_t)gAlice->TreeR()->GetEntries();
815 gAlice->TreeR()->GetEvent(nent-1+cathode-1);
816 Int_t nrechits = pRICHrechits->GetEntriesFast();
817 printf ("nrechits:%d\n",nrechits);
818 if (nrechits == 0) return;
819 if (fRecpoints == 0) fRecpoints = new TObjArray(50);
821 iChamber = &(pRICH->Chamber(chamber));
823 AliRICHPoints *points = 0;
824 //AliRICHEllipse *ellipse = 0;
826 //loop over all rechits and store their position
828 points = new AliRICHPoints(nrechits);
829 for (Int_t irec=0;irec<nrechits;irec++) {
830 mRec = (AliRICHRecHit*)pRICHrechits->UncheckedAt(irec);
831 fRecpoints->AddAt(points,irec);
832 points->SetMarkerColor(38);
833 points->SetMarkerStyle(8);
834 points->SetMarkerSize(1.);
835 points->SetParticle(-1);
836 points->SetHitIndex(-1);
837 points->SetTrackIndex(-1);
838 points->SetDigitIndex(-1);
839 Float_t vectorLoc[3]={mRec->fX,6.276,mRec->fY};
840 Float_t vectorGlob[3];
841 iChamber->LocaltoGlobal(vectorLoc,vectorGlob);
842 points->SetPoint(irec,vectorGlob[0],vectorGlob[1],vectorGlob[2]);
843 //Float_t theta = iChamber->GetRotMatrix()->GetTheta();
844 //Float_t phi = iChamber->GetRotMatrix()->GetPhi();
845 //ellipse=new TEllipse(vectorGlob[0],vectorGlob[2],10,10,0,360,phi);
846 printf("Generating ellipse %d\n",irec);
847 AliRICHEllipse *ellipse=new AliRICHEllipse(mRec->fX,mRec->fY,mRec->fOmega,mRec->fTheta,mRec->fPhi,mRec->fEmissPoint);
848 ellipse->CerenkovRingDrawing(chamber,irec);
849 //ellipse->SetFillStyle(1001);
850 ellipse->SetMarkerColor(38);
852 //marker->SetRefObject((TObject*)points);
853 //points->Set3DMarker(0, marker);
856 //___________________________________________
857 void AliRICHDisplay::LoadDigits()
859 // Read digits info and store x,y,z info in arrays fPoints
860 // Loop on all detectors
863 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
864 AliRICHChamber* iChamber;
865 AliRICHSegmentation* segmentation;
869 for (ich=0; ich<kNCH; ich++) {
870 TClonesArray *pRICHdigits = pRICH->DigitsAddress(ich);
871 if (pRICHdigits == 0) continue;
872 gAlice->ResetDigits();
873 gAlice->TreeD()->GetEvent(1);
874 Int_t ndigits = pRICHdigits->GetEntriesFast();
877 if (fPoints == 0) fPoints = new TObjArray(nAllDigits);
879 for (ich=0; ich<kNCH; ich++) {
880 TClonesArray *pRICHdigits = pRICH->DigitsAddress(ich);
881 if (pRICHdigits == 0) continue;
882 gAlice->ResetDigits();
883 gAlice->TreeD()->GetEvent(1);
884 Int_t ndigits = pRICHdigits->GetEntriesFast();
885 if (ndigits == 0) continue;
886 iChamber = &(pRICH->Chamber(ich));
887 segmentation=iChamber->GetSegmentationModel();
888 Float_t dpx = segmentation->Dpx();
889 Float_t dpy = segmentation->Dpy();
891 //printf("Dpx:%d, Dpy:%d\n",dpx,dpy);
894 AliRICHPoints *points = 0;
895 TMarker3DBox *marker = 0;
897 //loop over all digits and store their position
900 for (Int_t digit=0;digit<ndigits;digit++) {
901 mdig = (AliRICHDigit*)pRICHdigits->UncheckedAt(digit);
902 points = new AliRICHPoints(npoints);
903 fPoints->AddAt(points,counter);
905 Int_t charge=mdig->fSignal;
906 Int_t index=Int_t(TMath::Log(charge)/(TMath::Log(adc_satm)/22));
907 Int_t color=701+index;
908 if (color>722) color=722;
909 points->SetMarkerColor(color);
910 points->SetMarkerStyle(21);
911 points->SetMarkerSize(0.5);
913 segmentation->GetPadCxy(mdig->fPadX, mdig->fPadY,xpad, ypad);
914 Float_t vectorLoc[3]={xpad,6.276,ypad};
915 Float_t vectorGlob[3];
916 iChamber->LocaltoGlobal(vectorLoc,vectorGlob);
917 points->SetParticle(-1);
918 points->SetHitIndex(-1);
919 points->SetTrackIndex(-1);
920 points->SetDigitIndex(digit);
921 points->SetPoint(0,vectorGlob[0],vectorGlob[1],vectorGlob[2]);
923 segmentation->GetPadCxy(mdig->fPadX, mdig->fPadY, xpad, ypad);
924 Float_t theta = iChamber->GetRotMatrix()->GetTheta();
925 Float_t phi = iChamber->GetRotMatrix()->GetPhi();
926 marker=new TMarker3DBox(vectorGlob[0],vectorGlob[1],vectorGlob[2],
927 dpy/2,0,dpx/2,theta,phi);
928 marker->SetLineColor(2);
929 marker->SetFillStyle(1001);
930 marker->SetFillColor(color);
931 marker->SetRefObject((TObject*)points);
932 points->Set3DMarker(0, marker);
933 } // loop over digits
934 } // loop over chambers
938 //___________________________________________
939 void AliRICHDisplay::LoadHits(Int_t chamber)
941 // Read hits info and store x,y,z info in arrays fPhits
942 // Loop on all detectors
948 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
949 AliRICHChamber* iChamber;
951 iChamber = &(pRICH->Chamber(chamber-1));
952 Int_t ntracks = (Int_t)gAlice->TreeH()->GetEntries();
955 if (fPhits == 0) fPhits = new TObjArray(ntracks);
956 //TVector *xp = new TVector(1000);
957 //TVector *yp = new TVector(1000);
958 //TVector *zp = new TVector(1000);
959 //TVector *ptrk = new TVector(1000);
960 //TVector *phit = new TVector(1000);
962 for (track=0; track<ntracks;track++) {
964 gAlice->TreeH()->GetEvent(track);
965 TClonesArray *pRICHhits = pRICH->Hits();
966 if (pRICHhits == 0) return;
967 Int_t nhits = pRICHhits->GetEntriesFast();
971 fPhits = new TObjArray(nAllHits);
974 for (track=0; track<ntracks;track++) {
976 gAlice->TreeH()->GetEvent(track);
977 TClonesArray *pRICHhits = pRICH->Hits();
978 if (pRICHhits == 0) return;
979 Int_t nhits = pRICHhits->GetEntriesFast();
980 if (nhits == 0) continue;
982 AliRICHPoints *points = 0;
983 for (Int_t hit=0;hit<nhits;hit++) {
984 points = new AliRICHPoints(1);
985 fPhits->AddAt(points,npoints);
986 mHit = (AliRICHHit*)pRICHhits->UncheckedAt(hit);
988 (TParticle*)(*gAlice->Particles())[mHit->fTrack];
989 if (current->GetPdgCode() == 50000050) {
990 points->SetMarkerColor(kBlue);
991 } else if (current->GetPdgCode() == 50000051) {
992 points->SetMarkerColor(kYellow);
994 points->SetMarkerColor(kRed);
996 points->SetMarkerStyle(5);
997 points->SetMarkerSize(1.);
998 points->SetParticle(mHit->fTrack);
999 points->SetHitIndex(hit);
1000 points->SetTrackIndex(track);
1001 points->SetDigitIndex(-1);
1002 points->SetPoint(hit,mHit->fX, mHit->fY, mHit->fZ);
1008 //_____________________________________________________________________________
1010 void AliRICHDisplay::LoadCerenkovs(Int_t chamber)
1012 // Read cerenkov hits info and store x,y,z info in array fPCerenkovs
1013 // Loop on all detectors
1018 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
1019 AliRICHChamber* iChamber;
1021 iChamber = &(pRICH->Chamber(chamber-1));
1023 pRICH->SetTreeAddress();
1024 Int_t ntracks = (Int_t)gAlice->TreeH()->GetEntries();
1026 if (fPCerenkovs == 0) fPCerenkovs = new TObjArray(ntracks);
1027 TVector *xp = new TVector(1000);
1028 TVector *yp = new TVector(1000);
1029 TVector *zp = new TVector(1000);
1030 TVector *ptrk = new TVector(1000);
1031 TVector *phit = new TVector(1000);
1032 for (Int_t track=0; track<ntracks;track++) {
1033 gAlice->ResetHits();
1034 gAlice->TreeH()->GetEvent(track);
1035 TClonesArray *pRICHCerenkovs = pRICH->Cerenkovs();
1036 if (pRICHCerenkovs == 0) return;
1037 Int_t nhits = pRICHCerenkovs->GetEntriesFast();
1038 if (nhits == 0) continue;
1039 AliRICHCerenkov *mCerenkov;
1040 AliRICHPoints *cpoints = 0;
1044 //Display Cerenkov hits in blue
1046 for (Int_t hit=0;hit<nhits;hit++) {
1047 mCerenkov = (AliRICHCerenkov*)pRICHCerenkovs->UncheckedAt(hit);
1048 (*xp)(npoints)=mCerenkov->fX;
1049 (*yp)(npoints)=mCerenkov->fY;
1050 (*zp)(npoints)=mCerenkov->fZ;
1051 (*ptrk)(npoints)=Float_t(mCerenkov->GetTrack());
1052 (*phit)(npoints)=Float_t(hit);
1055 if (npoints == 0) continue;
1056 cpoints = new AliRICHPoints(npoints);
1057 for (Int_t p=0;p<npoints;p++) {
1058 cpoints->SetMarkerColor(kBlue);
1059 cpoints->SetMarkerStyle(5);
1060 cpoints->SetMarkerSize(1.);
1061 cpoints->SetParticle(Int_t((*ptrk)(p)));
1062 cpoints->SetHitIndex(Int_t((*phit)(p)));
1063 cpoints->SetTrackIndex(track);
1064 cpoints->SetDigitIndex(-1);
1065 cpoints->SetPoint(p,(*xp)(p),(*yp)(p),(*zp)(p));
1071 fPCerenkovs->AddAt(cpoints,track);
1075 //_____________________________________________________________________________
1076 void AliRICHDisplay::Paint(Option_t *)
1078 // Paint miscellaneous items
1082 //_____________________________________________________________________________
1083 void AliRICHDisplay::SetPickMode()
1090 fArcButton->SetY1(fPickButton->GetYlowNDC()+0.5*fPickButton->GetHNDC());
1091 fTrigPad->Modified();
1094 //_____________________________________________________________________________
1095 void AliRICHDisplay::SetZoomMode()
1102 fArcButton->SetY1(fZoomButton->GetYlowNDC()+0.5*fZoomButton->GetHNDC());
1103 fTrigPad->Modified();
1106 //_____________________________________________________________________________
1107 void AliRICHDisplay::SetChamberAndCathode(Int_t chamber, Int_t cathode)
1109 // Set chamber and cathode number
1113 printf("SetChamberAndCathode - fChamber fCathode %d %d\n",fChamber,fCathode);
1120 //_____________________________________________________________________________
1121 void AliRICHDisplay::SetRange(Float_t rrange, Float_t zrange)
1123 // Set view range along R and Z
1132 //_____________________________________________________________________________
1133 void AliRICHDisplay::SetView(Float_t theta, Float_t phi, Float_t psi)
1135 // change viewing angles for current event
1143 TView *view = gPad->GetView();
1144 if (view) view->SetView(fPhi, fTheta, fPsi, iret);
1150 //_____________________________________________________________________________
1151 void AliRICHDisplay::ShowNextEvent(Int_t delta)
1153 // Display (current event_number+delta)
1154 // delta = 1 shown next event
1155 // delta = -1 show previous event
1159 Int_t currentEvent = gAlice->GetHeader()->GetEvent();
1160 Int_t newEvent = currentEvent + delta;
1161 gAlice->GetEvent(newEvent);
1162 if (!gAlice->TreeD()) return;
1172 //______________________________________________________________________________
1173 void AliRICHDisplay::UnZoom()
1176 // Return to previous zoom factor
1178 if (fZooms <= 0) return;
1180 TPad *pad = (TPad*)gPad->GetPadSave();
1181 pad->Range(fZoomX0[fZooms],fZoomY0[fZooms], fZoomX1[fZooms],fZoomY1[fZooms]);
1185 //_____________________________________________________________________________
1186 void AliRICHDisplay::ResetPoints()
1189 // Reset array of points
1197 //_____________________________________________________________________________
1198 void AliRICHDisplay::ResetRpoints()
1201 // Reset array of points
1209 //_____________________________________________________________________________
1210 void AliRICHDisplay::ResetRecpoints()
1213 // Reset array of points
1216 fRecpoints->Delete();
1221 //_____________________________________________________________________________
1222 void AliRICHDisplay::ResetPhits()
1225 // Reset array of points
1233 //_____________________________________________________________________________
1234 void AliRICHDisplay::ResetPCerenkovs()
1237 // Reset array of points
1240 fPCerenkovs->Delete();
1246 //_____________________________________________________________________________
1248 void AliRICHDisplay::DrawViewGL()
1250 // Draw current view using OPENGL
1252 TPad *pad = (TPad*)gPad->GetPadSave();
1254 TView *view = pad->GetView();
1259 //_____________________________________________________________________________
1260 void AliRICHDisplay::DrawViewX3D()
1262 // Draw current view using X3D
1264 TPad *pad = (TPad*)gPad->GetPadSave();
1266 TView *view = pad->GetView();