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.7 2000/10/02 21:28:12 fca
19 Removal of useless dependecies via forward declarations
21 Revision 1.6 2000/10/02 15:46:38 jbarbosa
22 Fixed forward declarations.
24 Revision 1.5 2000/06/30 16:49:34 dibari
25 Different call for ring drawing.
27 Revision 1.4 2000/06/12 15:21:08 jbarbosa
30 Revision 1.3 2000/06/09 14:52:08 jbarbosa
31 New tentative ellipse drawing routine
33 Revision 1.1 2000/04/19 13:07:45 morsch
34 Digits, clusters and reconstruction results added.
39 //////////////////////////////////////////////////////////////////////////
43 // Utility class to display ALICE outline, tracks, hits,.. //
45 //////////////////////////////////////////////////////////////////////////
54 #include <TPolyMarker3D.h>
57 #include <TPolyMarker.h>
58 #include <TPaveLabel.h>
59 #include <TPaveText.h>
66 #include <TGeometry.h>
67 #include <TSliderBox.h>
69 #include <TVirtualX.h>
72 #include <X3DBuffer.h>
73 #include <TParticle.h>
77 #include "AliDetector.h"
79 #include "AliRICHConst.h"
80 #include "AliRICHDisplay.h"
81 #include "AliRICHPoints.h"
83 #include "AliRICHHit.h"
84 #include "AliRICHCerenkov.h"
85 #include "AliRICHPadHit.h"
86 #include "AliRICHDigit.h"
87 #include "AliRICHRawCluster.h"
88 #include "AliRICHRecHit.h"
89 #include "AliRICHEllipse.h"
91 ClassImp(AliRICHDisplay)
94 //____________________________________________________________________________
95 AliRICHDisplay::AliRICHDisplay()
98 // default constructor
108 //_____________________________________________________________________________
109 AliRICHDisplay::AliRICHDisplay(Int_t size)
111 // Create an event display object.
112 // A canvas named "edisplay" is created with a vertical size in pixels
114 // A QUICK Overview of the Event Display functions
115 // ===============================================
117 // The event display can ve invoked by executing the macro "display.C"
118 // A canvas like in the picture below will appear.
120 // On the left side of the canvas, the following buttons appear:
121 // *Next* to move to the next event
122 // *Previous* to move to the previous event
124 // *Pick* Select this option to be able to point on a track with the
125 // mouse. Once on the track, use the right button to select
126 // an action. For example, select SetMarkerAttributes to
127 // change the marker type/color/size for the track.
128 // *Zoom* Select this option (default) if you want to zoom.
129 // To zoom, simply select the selected area with the left button.
130 // *UnZoom* To revert to the previous picture size.
132 // slider R On the left side, the vertical slider can be used to
133 // set the default picture size.
135 // When you are in Zoom mode, you can click on the black part of the canvas
136 // to select special options with the right mouse button.
139 // When you are in pick mode, you can "Inspect" the object pointed by the mouse.
140 // When you are on a track, select the menu item "InspectParticle"
141 // to display the current particle attributes.
143 // You can activate the Root browser by selecting the Inspect menu
144 // in the canvas tool bar menu. Then select "Start Browser"
145 // This will open a new canvas with the browser. At this point, you may want
146 // to display some histograms (from the Trees). Go to the "File" menu
147 // of the browser and click on "New canvas".
148 // In the browser, click on item "ROOT files" in the left pane.
149 // Click on galice.root.
151 // Click on TPC for example
152 // Click on any variable (eg TPC.fX) to histogram the variable.
154 // If you are lost, you can click on HELP in any Root canvas or browser.
157 <img src="gif/AliRICHDisplay.gif">
164 gAlice->SetDisplay(this);
166 // Initialize display default parameters
169 // Set front view by default
176 fDrawClusters = kTRUE;
178 fDrawRecHits = kTRUE;
189 // Create display canvas
191 if (ysize < 100) ysize = 750;
192 Int_t xsize = Int_t(size*830./ysize);
193 fCanvas = new TCanvas("Canvas", "RICH Clusters Display",14,47,xsize,ysize);
194 fCanvas->ToggleEventStatus();
196 // Create main display pad
197 fPad = new TPad("viewpad", "RICH display",0.15,0,0.9,1);
200 fPad->SetFillColor(1);
201 fPad->SetBorderSize(2);
206 fColPad = new TPad("colpad", "Colors pad",0.9,0,1,1);
209 fColPad->SetFillColor(19);
210 fColPad->SetBorderSize(2);
216 // Create user interface control pad
220 // Create Range and mode pad
223 fTrigPad = new TPad("trigger", "range and mode pad",0,0,dxtr,dytr);
224 fTrigPad->SetEditable(kFALSE);
227 fTrigPad->SetFillColor(22);
228 fTrigPad->SetBorderSize(2);
229 fRangeSlider = new TSlider("range","range",0.7,0.42,0.9,0.98);
230 fRangeSlider->SetObject(this);
231 char pickmode[] = "gAlice->Display()->SetPickMode()";
233 fPickButton = new TButton("Pick",pickmode,0.05,0.32,0.65,0.32+db);
234 fPickButton->SetFillColor(38);
236 char zoommode[] = "gAlice->Display()->SetZoomMode()";
237 fZoomButton = new TButton("Zoom",zoommode,0.05,0.21,0.65,0.21+db);
238 fZoomButton->SetFillColor(38);
240 fArcButton = new TArc(.8,fZoomButton->GetYlowNDC()+0.5*db,0.33*db);
241 fArcButton->SetFillColor(kGreen);
243 char butUnzoom[] = "gAlice->Display()->UnZoom()";
244 TButton *button = new TButton("UnZoom",butUnzoom,0.05,0.05,0.95,0.15);
245 button->SetFillColor(38);
247 AppendPad(); // append display object as last object to force selection
254 //_____________________________________________________________________________
255 AliRICHDisplay::~AliRICHDisplay()
257 // Delete space point structure
258 if (fPoints) fPoints->Delete();
262 if (fPhits) fPhits->Delete();
266 if (fRpoints) fRpoints->Delete();
270 if (fRecpoints) fRecpoints->Delete();
274 if (fPCerenkovs) fPCerenkovs->Delete();
279 //_____________________________________________________________________________
280 void AliRICHDisplay::Clear(Option_t *)
282 // Delete graphics temporary objects
285 //_____________________________________________________________________________
286 void AliRICHDisplay::DisplayButtons()
288 // Create the user interface buttons
291 fButtons = new TPad("buttons", "newpad",0,0.45,0.15,1);
292 fButtons->SetEditable(kFALSE);
294 fButtons->SetFillColor(38);
295 fButtons->SetBorderSize(2);
298 // Int_t butcolor = 33;
299 Float_t dbutton = 0.08;
306 char but1[] = "gAlice->Display()->ShowNextEvent(1)";
307 button = new TButton("Next",but1,x0,y-dbutton,x1,y);
308 button->SetFillColor(38);
312 char but2[] = "gAlice->Display()->ShowNextEvent(-1)";
313 button = new TButton("Previous",but2,x0,y-dbutton,x1,y);
314 button->SetFillColor(38);
318 char but7[] = "gAlice->Display()->DrawViewGL()";
319 button = new TButton("OpenGL",but7,x0,y-dbutton,x1,y);
320 button->SetFillColor(38);
324 char but8[] = "gAlice->Display()->DrawViewX3D()";
325 button = new TButton("X3D",but8,x0,y-dbutton,x1,y);
326 button->SetFillColor(38);
330 TDiamond *diamond = new TDiamond(0.05,0.015,0.95,0.22);
331 diamond->SetFillColor(50);
332 diamond->SetTextAlign(22);
333 diamond->SetTextColor(5);
334 diamond->SetTextSize(0.11);
336 diamond->AddText(".. ");
337 diamond->AddText("ROOT");
338 diamond->AddText("RICH");
339 diamond->AddText("... ");
340 diamond->AddText(" ");
343 //_____________________________________________________________________________
344 void AliRICHDisplay::CreateColors()
346 // Create the colors palette used to display clusters
361 new TColor(color,r,g,b);
371 new TColor(color,r,g,b);
381 new TColor(color,r,g,b);
391 new TColor(color,r,g,b);
401 new TColor(color,r,g,b);
408 //_____________________________________________________________________________
409 void AliRICHDisplay::DisplayColorScale()
412 // Draw the color scale in the RICH display canvas
416 Float_t xlow, ylow, xup, yup, hs;
417 Float_t x1, y1, x2, y2;
421 gPad->SetFillColor(0);
423 gPad->Range(x1,y1,x2,y2);
424 TText *text = new TText(0,0,"");
425 text->SetTextFont(61);
426 text->SetTextSize(0.03);
427 text->SetTextAlign(22);
431 //*-* draw colortable boxes
432 hs = (y2-y1)/Float_t(22);
436 ylow = y1 + hs*(Float_t(i));
437 yup = y1 + hs*(Float_t(i+1));
439 Double_t logscale=Double_t(i+1)*(TMath::Log(adc_satm)/22);
440 Int_t scale=(Int_t)TMath::Exp(logscale);
441 sprintf(label,"%d",scale);
442 box = new TBox(xlow, ylow, xup, yup);
443 box->SetFillColor(color);
445 text->DrawText(xup+4, 0.5*(ylow+yup),label);
449 //______________________________________________________________________________
450 Int_t AliRICHDisplay::DistancetoPrimitive(Int_t px, Int_t)
452 // Compute distance from point px,py to objects in event
454 gPad->SetCursor(kCross);
456 if (gPad == fTrigPad) return 9999;
458 const Int_t kBig = 9999;
460 Float_t xmin = gPad->GetX1();
461 Float_t xmax = gPad->GetX2();
462 Float_t dx = 0.02*(xmax - xmin);
463 Float_t x = gPad->AbsPixeltoX(px);
464 if (x < xmin+dx || x > xmax-dx) return dist;
465 if (fZoomMode) return 0;
469 //_____________________________________________________________________________
470 void AliRICHDisplay::Draw(Option_t *)
472 // Display current event
476 DrawView(fTheta, fPhi, fPsi); // see how to draw PGON+inner frames
478 // Display the event number and title
483 //_____________________________________________________________________________
484 void AliRICHDisplay::DrawCoG()
486 // Draw hits for RICH chambers
488 if (!fDrawCoG) return;
490 for (Int_t chamber=0;chamber<kNCH;chamber++) {
499 ncog = points->GetEntriesFast();
500 for (icog=0; icog < ncog; icog++) {
501 pm = (AliRICHPoints*)points->UncheckedAt(icog);
507 void AliRICHDisplay::DrawRecHits()
509 // Draw rec hits for RICH chambers
511 if (!fDrawRecHits) return;
513 for (Int_t chamber=0;chamber<kNCH;chamber++) {
514 LoadRecHits(chamber,1);
522 nrec = points->GetEntriesFast();
523 printf("Nrec %d\n",nrec);
524 for (irec=0; irec < nrec; irec++) {
525 pm = (AliRICHPoints*)points->UncheckedAt(irec);
531 //_____________________________________________________________________________
533 void AliRICHDisplay::DrawCerenkovs()
535 // Draw cerenkovs hits for RICH chambers
537 LoadCerenkovs(fChamber);
538 //printf("\nDrawCerenkovs\n");
540 Int_t ntracks, track;
545 cpoints = fPCerenkovs;
546 //printf ("Cpoints: %p",cpoints);
547 if (!cpoints) return;
548 ntracks = cpoints->GetEntriesFast();
549 //printf("DrawCerenkovs - ntracks %d \n",ntracks);
550 for (track=0;track<ntracks;track++) {
551 pm = (AliRICHPoints*)cpoints->UncheckedAt(track);
554 fHitsCuts += pm->GetN();
558 //_____________________________________________________________________________
560 void AliRICHDisplay::DrawClusters()
562 // Draw clusterss for RICH chambers
564 Int_t ndigits, digit;
571 ndigits = points->GetEntriesFast();
572 for (digit=0;digit<ndigits;digit++){
573 pm = (AliRICHPoints*)points->UncheckedAt(digit);
578 for (Int_t im=0;im<3;im++) {
579 TMarker3DBox *marker=pm->GetMarker(im);
583 fClustersCuts +=pm->GetN();
587 //_____________________________________________________________________________
588 void AliRICHDisplay::DrawHits()
590 // Draw hits for RICH chambers
594 Int_t ntracks, track;
601 // ntracks = points->GetEntriesFast();
602 ntracks = fPhits->GetEntriesFast();
604 //printf("DrawHits - ntracks %d \n",ntracks);
605 for (track=0;track<ntracks;track++) {
606 pm = (AliRICHPoints*)fPhits->UncheckedAt(track);
609 fHitsCuts += pm->GetN();
614 //_____________________________________________________________________________
615 void AliRICHDisplay::DrawTitle(Option_t *option)
617 // Draw the event title
619 Float_t xmin = gPad->GetX1();
620 Float_t xmax = gPad->GetX2();
621 Float_t ymin = gPad->GetY1();
622 Float_t ymax = gPad->GetY2();
623 Float_t dx = xmax-xmin;
624 Float_t dy = ymax-ymin;
626 if (strlen(option) == 0) {
627 TPaveText *title = new TPaveText(xmin +0.01*dx, ymax-0.09*dy, xmin +0.5*dx, ymax-0.01*dy);
628 title->SetBit(kCanDelete);
629 title->SetFillColor(42);
632 sprintf(ptitle,"Alice event: %d, Run:%d",
633 gAlice->GetHeader()->GetEvent(), gAlice->GetHeader()->GetRun());
634 title->AddText(ptitle);
635 Int_t nparticles = gAlice->Particles()->GetEntriesFast();
636 sprintf(ptitle,"Nparticles = %d Nhits = %d Npads fired = %d",
637 nparticles, fHitsCuts,fClustersCuts);
638 title->AddText(ptitle);
641 new TPaveLabel(xmin +0.01*dx, ymax-0.07*dy, xmin +0.2*dx, ymax-0.01*dy,option);
642 label->SetBit(kCanDelete);
643 label->SetFillColor(42);
648 //_____________________________________________________________________________
649 void AliRICHDisplay::DrawView(Float_t theta, Float_t phi, Float_t psi)
651 // Draw a view of RICH clusters
653 gPad->SetCursor(kWatch);
654 gPad->SetFillColor(1);
658 TView *view = new TView(1);
659 Float_t range = fRrange*fRangeSlider->GetMaximum();
660 view->SetRange(-range,-range,-range,range, range, range);
667 //Display RICH Chamber Geometry
668 gAlice->GetGeometry()->Draw("same");
670 //add clusters to the pad
674 printf("Calling DrawCoG\n");
676 printf("Calling DrawRecHits\n");
678 /*for (Int_t i=0;i<7;i++)
681 // add itself to the list (must be last)
684 view->SetView(phi, theta, psi, iret);
687 //______________________________________________________________________________
688 void AliRICHDisplay::ExecuteEvent(Int_t event, Int_t px, Int_t py)
690 // Execute action corresponding to the mouse event
692 static Float_t x0, y0, x1, y1;
694 static Int_t pxold, pyold;
695 static Int_t px0, py0;
696 static Int_t linedrawn;
699 if (px == 0 && py == 0) { //when called by sliders
700 if (event == kButton1Up) {
705 if (!fZoomMode && gPad->GetView()) {
706 gPad->GetView()->ExecuteRotateView(event, px, py);
710 // something to zoom ?
711 gPad->SetCursor(kCross);
716 gVirtualX->SetLineColor(-1);
717 gPad->TAttLine::Modify(); //Change line attributes only if necessary
718 x0 = gPad->AbsPixeltoX(px);
719 y0 = gPad->AbsPixeltoY(py);
721 pxold = px; pyold = py;
726 if (linedrawn) gVirtualX->DrawBox(px0, py0, pxold, pyold, TVirtualX::kHollow);
730 gVirtualX->DrawBox(px0, py0, pxold, pyold, TVirtualX::kHollow);
734 gPad->GetCanvas()->FeedbackMode(kFALSE);
735 if (px == px0) return;
736 if (py == py0) return;
737 x1 = gPad->AbsPixeltoX(px);
738 y1 = gPad->AbsPixeltoY(py);
740 if (x1 < x0) {temp = x0; x0 = x1; x1 = temp;}
741 if (y1 < y0) {temp = y0; y0 = y1; y1 = temp;}
742 gPad->Range(x0,y0,x1,y1);
743 if (fZooms < kMAXZOOM-1) {
745 fZoomX0[fZooms] = x0;
746 fZoomY0[fZooms] = y0;
747 fZoomX1[fZooms] = x1;
748 fZoomY1[fZooms] = y1;
750 gPad->Modified(kTRUE);
755 //___________________________________________
756 void AliRICHDisplay::LoadCoG(Int_t chamber, Int_t cathode)
758 // Read raw clusters info and store x,y,z info in arrays fRpoints
759 // Loop on all detectors
761 if (chamber > 6) return;
763 printf("Entering LoadCoG\n");
766 AliRICH *pRICH = (AliRICH*)gAlice->GetModule("RICH");
767 AliRICHChamber* iChamber;
769 TClonesArray *pRICHrawclust = pRICH->RawClustAddress(chamber);
770 printf ("Chamber:%d has adress:%p\n", chamber, pRICHrawclust );
771 if (pRICHrawclust == 0) return;
773 pRICH->ResetRawClusters();
776 Int_t nent=(Int_t)gAlice->TreeR()->GetEntries();
777 gAlice->TreeR()->GetEvent(nent-1+cathode-1);
778 Int_t nrawcl = pRICHrawclust->GetEntriesFast();
779 printf ("nrawcl:%d\n",nrawcl);
780 if (nrawcl == 0) return;
781 if (fRpoints == 0) fRpoints = new TObjArray(nrawcl);
783 iChamber = &(pRICH->Chamber(chamber));
784 AliRICHRawCluster *mRaw;
785 AliRICHPoints *points = 0;
787 //loop over all raw clusters and store their position
788 points = new AliRICHPoints(nrawcl);
789 for (Int_t iraw=0;iraw<nrawcl;iraw++) {
790 mRaw = (AliRICHRawCluster*)pRICHrawclust->UncheckedAt(iraw);
791 fRpoints->AddAt(points,iraw);
792 points->SetMarkerColor(3);
793 points->SetMarkerStyle(3);
794 points->SetMarkerSize(1.);
795 points->SetParticle(-1);
796 points->SetHitIndex(-1);
797 points->SetTrackIndex(-1);
798 points->SetDigitIndex(-1);
799 Float_t vectorLoc[3]={mRaw->fX,6.276,mRaw->fY};
800 Float_t vectorGlob[3];
801 iChamber->LocaltoGlobal(vectorLoc,vectorGlob);
802 points->SetPoint(iraw,vectorGlob[0],vectorGlob[1],vectorGlob[2]);
805 //___________________________________________
806 void AliRICHDisplay::LoadRecHits(Int_t chamber, Int_t cathode)
808 // Read rec. hits info
809 // Loop on all detectors
811 if (chamber > 6) return;
813 printf("Entering LoadRecHits\n");
816 AliRICH *pRICH = (AliRICH*)gAlice->GetModule("RICH");
817 AliRICHChamber* iChamber;
819 TClonesArray *pRICHrechits = pRICH->RecHitsAddress(chamber);
820 printf ("Chamber:%d\n", chamber);
821 if (pRICHrechits == 0) return;
823 //RICH->ResetRecHits();
826 Int_t nent=(Int_t)gAlice->TreeR()->GetEntries();
827 gAlice->TreeR()->GetEvent(nent-1+cathode-1);
828 Int_t nrechits = pRICHrechits->GetEntriesFast();
829 printf ("nrechits:%d\n",nrechits);
830 if (nrechits == 0) return;
831 if (fRecpoints == 0) fRecpoints = new TObjArray(50);
833 iChamber = &(pRICH->Chamber(chamber));
835 AliRICHPoints *points = 0;
836 //AliRICHEllipse *ellipse = 0;
838 //loop over all rechits and store their position
840 points = new AliRICHPoints(nrechits);
841 for (Int_t irec=0;irec<nrechits;irec++) {
842 mRec = (AliRICHRecHit*)pRICHrechits->UncheckedAt(irec);
843 fRecpoints->AddAt(points,irec);
844 points->SetMarkerColor(38);
845 points->SetMarkerStyle(8);
846 points->SetMarkerSize(1.);
847 points->SetParticle(-1);
848 points->SetHitIndex(-1);
849 points->SetTrackIndex(-1);
850 points->SetDigitIndex(-1);
851 Float_t vectorLoc[3]={mRec->fX,6.276,mRec->fY};
852 Float_t vectorGlob[3];
853 iChamber->LocaltoGlobal(vectorLoc,vectorGlob);
854 points->SetPoint(irec,vectorGlob[0],vectorGlob[1],vectorGlob[2]);
855 //Float_t theta = iChamber->GetRotMatrix()->GetTheta();
856 //Float_t phi = iChamber->GetRotMatrix()->GetPhi();
857 //ellipse=new TEllipse(vectorGlob[0],vectorGlob[2],10,10,0,360,phi);
858 printf("Generating ellipse %d\n",irec);
859 AliRICHEllipse *ellipse=new AliRICHEllipse(mRec->fX,mRec->fY,mRec->fOmega,mRec->fTheta,mRec->fPhi,mRec->fEmissPoint);
860 ellipse->CerenkovRingDrawing(chamber,irec);
861 //ellipse->SetFillStyle(1001);
862 ellipse->SetMarkerColor(38);
864 //marker->SetRefObject((TObject*)points);
865 //points->Set3DMarker(0, marker);
868 //___________________________________________
869 void AliRICHDisplay::LoadDigits()
871 // Read digits info and store x,y,z info in arrays fPoints
872 // Loop on all detectors
875 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
876 AliRICHChamber* iChamber;
877 AliSegmentation* segmentation;
881 for (ich=0; ich<kNCH; ich++) {
882 TClonesArray *pRICHdigits = pRICH->DigitsAddress(ich);
883 if (pRICHdigits == 0) continue;
884 gAlice->ResetDigits();
885 gAlice->TreeD()->GetEvent(1);
886 Int_t ndigits = pRICHdigits->GetEntriesFast();
889 if (fPoints == 0) fPoints = new TObjArray(nAllDigits);
891 for (ich=0; ich<kNCH; ich++) {
892 TClonesArray *pRICHdigits = pRICH->DigitsAddress(ich);
893 if (pRICHdigits == 0) continue;
894 gAlice->ResetDigits();
895 gAlice->TreeD()->GetEvent(1);
896 Int_t ndigits = pRICHdigits->GetEntriesFast();
897 if (ndigits == 0) continue;
898 iChamber = &(pRICH->Chamber(ich));
899 segmentation=iChamber->GetSegmentationModel();
900 Float_t dpx = segmentation->Dpx();
901 Float_t dpy = segmentation->Dpy();
903 //printf("Dpx:%d, Dpy:%d\n",dpx,dpy);
906 AliRICHPoints *points = 0;
907 TMarker3DBox *marker = 0;
909 //loop over all digits and store their position
912 for (Int_t digit=0;digit<ndigits;digit++) {
913 mdig = (AliRICHDigit*)pRICHdigits->UncheckedAt(digit);
914 points = new AliRICHPoints(npoints);
915 fPoints->AddAt(points,counter);
917 Int_t charge=mdig->fSignal;
918 Int_t index=Int_t(TMath::Log(charge)/(TMath::Log(adc_satm)/22));
919 Int_t color=701+index;
920 if (color>722) color=722;
921 points->SetMarkerColor(color);
922 points->SetMarkerStyle(21);
923 points->SetMarkerSize(0.5);
924 Float_t xpad, ypad, zpad;
925 segmentation->GetPadC(mdig->fPadX, mdig->fPadY,xpad, ypad, zpad);
926 Float_t vectorLoc[3]={xpad,6.276,ypad};
927 Float_t vectorGlob[3];
928 iChamber->LocaltoGlobal(vectorLoc,vectorGlob);
929 points->SetParticle(-1);
930 points->SetHitIndex(-1);
931 points->SetTrackIndex(-1);
932 points->SetDigitIndex(digit);
933 points->SetPoint(0,vectorGlob[0],vectorGlob[1],vectorGlob[2]);
935 segmentation->GetPadC(mdig->fPadX, mdig->fPadY, xpad, ypad, zpad);
936 Float_t theta = iChamber->GetRotMatrix()->GetTheta();
937 Float_t phi = iChamber->GetRotMatrix()->GetPhi();
938 marker=new TMarker3DBox(vectorGlob[0],vectorGlob[1],vectorGlob[2],
939 dpy/2,0,dpx/2,theta,phi);
940 marker->SetLineColor(2);
941 marker->SetFillStyle(1001);
942 marker->SetFillColor(color);
943 marker->SetRefObject((TObject*)points);
944 points->Set3DMarker(0, marker);
945 } // loop over digits
946 } // loop over chambers
950 //___________________________________________
951 void AliRICHDisplay::LoadHits(Int_t chamber)
953 // Read hits info and store x,y,z info in arrays fPhits
954 // Loop on all detectors
960 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
961 AliRICHChamber* iChamber;
963 iChamber = &(pRICH->Chamber(chamber-1));
964 Int_t ntracks = (Int_t)gAlice->TreeH()->GetEntries();
967 if (fPhits == 0) fPhits = new TObjArray(ntracks);
968 //TVector *xp = new TVector(1000);
969 //TVector *yp = new TVector(1000);
970 //TVector *zp = new TVector(1000);
971 //TVector *ptrk = new TVector(1000);
972 //TVector *phit = new TVector(1000);
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();
983 fPhits = new TObjArray(nAllHits);
986 for (track=0; track<ntracks;track++) {
988 gAlice->TreeH()->GetEvent(track);
989 TClonesArray *pRICHhits = pRICH->Hits();
990 if (pRICHhits == 0) return;
991 Int_t nhits = pRICHhits->GetEntriesFast();
992 if (nhits == 0) continue;
994 AliRICHPoints *points = 0;
995 for (Int_t hit=0;hit<nhits;hit++) {
996 points = new AliRICHPoints(1);
997 fPhits->AddAt(points,npoints);
998 mHit = (AliRICHHit*)pRICHhits->UncheckedAt(hit);
1000 (TParticle*)(*gAlice->Particles())[mHit->Track()];
1001 if (current->GetPdgCode() == 50000050) {
1002 points->SetMarkerColor(kBlue);
1003 } else if (current->GetPdgCode() == 50000051) {
1004 points->SetMarkerColor(kYellow);
1006 points->SetMarkerColor(kRed);
1008 points->SetMarkerStyle(5);
1009 points->SetMarkerSize(1.);
1010 points->SetParticle(mHit->Track());
1011 points->SetHitIndex(hit);
1012 points->SetTrackIndex(track);
1013 points->SetDigitIndex(-1);
1014 points->SetPoint(hit,mHit->X(), mHit->Y(), mHit->Z());
1020 //_____________________________________________________________________________
1022 void AliRICHDisplay::LoadCerenkovs(Int_t chamber)
1024 // Read cerenkov hits info and store x,y,z info in array fPCerenkovs
1025 // Loop on all detectors
1030 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
1031 AliRICHChamber* iChamber;
1033 iChamber = &(pRICH->Chamber(chamber-1));
1035 pRICH->SetTreeAddress();
1036 Int_t ntracks = (Int_t)gAlice->TreeH()->GetEntries();
1038 if (fPCerenkovs == 0) fPCerenkovs = new TObjArray(ntracks);
1039 TVector *xp = new TVector(1000);
1040 TVector *yp = new TVector(1000);
1041 TVector *zp = new TVector(1000);
1042 TVector *ptrk = new TVector(1000);
1043 TVector *phit = new TVector(1000);
1044 for (Int_t track=0; track<ntracks;track++) {
1045 gAlice->ResetHits();
1046 gAlice->TreeH()->GetEvent(track);
1047 TClonesArray *pRICHCerenkovs = pRICH->Cerenkovs();
1048 if (pRICHCerenkovs == 0) return;
1049 Int_t nhits = pRICHCerenkovs->GetEntriesFast();
1050 if (nhits == 0) continue;
1051 AliRICHCerenkov *mCerenkov;
1052 AliRICHPoints *cpoints = 0;
1056 //Display Cerenkov hits in blue
1058 for (Int_t hit=0;hit<nhits;hit++) {
1059 mCerenkov = (AliRICHCerenkov*)pRICHCerenkovs->UncheckedAt(hit);
1060 (*xp)(npoints)=mCerenkov->X();
1061 (*yp)(npoints)=mCerenkov->Y();
1062 (*zp)(npoints)=mCerenkov->Z();
1063 (*ptrk)(npoints)=Float_t(mCerenkov->GetTrack());
1064 (*phit)(npoints)=Float_t(hit);
1067 if (npoints == 0) continue;
1068 cpoints = new AliRICHPoints(npoints);
1069 for (Int_t p=0;p<npoints;p++) {
1070 cpoints->SetMarkerColor(kBlue);
1071 cpoints->SetMarkerStyle(5);
1072 cpoints->SetMarkerSize(1.);
1073 cpoints->SetParticle(Int_t((*ptrk)(p)));
1074 cpoints->SetHitIndex(Int_t((*phit)(p)));
1075 cpoints->SetTrackIndex(track);
1076 cpoints->SetDigitIndex(-1);
1077 cpoints->SetPoint(p,(*xp)(p),(*yp)(p),(*zp)(p));
1083 fPCerenkovs->AddAt(cpoints,track);
1087 //_____________________________________________________________________________
1088 void AliRICHDisplay::Paint(Option_t *)
1090 // Paint miscellaneous items
1094 //_____________________________________________________________________________
1095 void AliRICHDisplay::SetPickMode()
1102 fArcButton->SetY1(fPickButton->GetYlowNDC()+0.5*fPickButton->GetHNDC());
1103 fTrigPad->Modified();
1106 //_____________________________________________________________________________
1107 void AliRICHDisplay::SetZoomMode()
1114 fArcButton->SetY1(fZoomButton->GetYlowNDC()+0.5*fZoomButton->GetHNDC());
1115 fTrigPad->Modified();
1118 //_____________________________________________________________________________
1119 void AliRICHDisplay::SetChamberAndCathode(Int_t chamber, Int_t cathode)
1121 // Set chamber and cathode number
1125 printf("SetChamberAndCathode - fChamber fCathode %d %d\n",fChamber,fCathode);
1132 //_____________________________________________________________________________
1133 void AliRICHDisplay::SetRange(Float_t rrange, Float_t zrange)
1135 // Set view range along R and Z
1144 //_____________________________________________________________________________
1145 void AliRICHDisplay::SetView(Float_t theta, Float_t phi, Float_t psi)
1147 // change viewing angles for current event
1155 TView *view = gPad->GetView();
1156 if (view) view->SetView(fPhi, fTheta, fPsi, iret);
1162 //_____________________________________________________________________________
1163 void AliRICHDisplay::ShowNextEvent(Int_t delta)
1165 // Display (current event_number+delta)
1166 // delta = 1 shown next event
1167 // delta = -1 show previous event
1171 Int_t currentEvent = gAlice->GetHeader()->GetEvent();
1172 Int_t newEvent = currentEvent + delta;
1173 gAlice->GetEvent(newEvent);
1174 if (!gAlice->TreeD()) return;
1184 //______________________________________________________________________________
1185 void AliRICHDisplay::UnZoom()
1188 // Return to previous zoom factor
1190 if (fZooms <= 0) return;
1192 TPad *pad = (TPad*)gPad->GetPadSave();
1193 pad->Range(fZoomX0[fZooms],fZoomY0[fZooms], fZoomX1[fZooms],fZoomY1[fZooms]);
1197 //_____________________________________________________________________________
1198 void AliRICHDisplay::ResetPoints()
1201 // Reset array of points
1209 //_____________________________________________________________________________
1210 void AliRICHDisplay::ResetRpoints()
1213 // Reset array of points
1221 //_____________________________________________________________________________
1222 void AliRICHDisplay::ResetRecpoints()
1225 // Reset array of points
1228 fRecpoints->Delete();
1233 //_____________________________________________________________________________
1234 void AliRICHDisplay::ResetPhits()
1237 // Reset array of points
1245 //_____________________________________________________________________________
1246 void AliRICHDisplay::ResetPCerenkovs()
1249 // Reset array of points
1252 fPCerenkovs->Delete();
1258 //_____________________________________________________________________________
1260 void AliRICHDisplay::DrawViewGL()
1262 // Draw current view using OPENGL
1264 TPad *pad = (TPad*)gPad->GetPadSave();
1266 TView *view = pad->GetView();
1271 //_____________________________________________________________________________
1272 void AliRICHDisplay::DrawViewX3D()
1274 // Draw current view using X3D
1276 TPad *pad = (TPad*)gPad->GetPadSave();
1278 TView *view = pad->GetView();