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.11 2001/02/27 15:21:34 jbarbosa
19 Transition to SDigits.
21 Revision 1.10 2001/02/13 20:18:48 jbarbosa
22 Corrected some more positioning of points. Changes in LoadDigits to accomodate the new IO.
24 Revision 1.9 2000/11/01 15:33:11 jbarbosa
25 Updated to handle both reconstruction algorithms.
27 Revision 1.8 2000/10/03 21:44:09 morsch
28 Use AliSegmentation and AliHit abstract base classes.
30 Revision 1.7 2000/10/02 21:28:12 fca
31 Removal of useless dependecies via forward declarations
33 Revision 1.6 2000/10/02 15:46:38 jbarbosa
34 Fixed forward declarations.
36 Revision 1.5 2000/06/30 16:49:34 dibari
37 Different call for ring drawing.
39 Revision 1.4 2000/06/12 15:21:08 jbarbosa
42 Revision 1.3 2000/06/09 14:52:08 jbarbosa
43 New tentative ellipse drawing routine
45 Revision 1.1 2000/04/19 13:07:45 morsch
46 Digits, clusters and reconstruction results added.
51 //////////////////////////////////////////////////////////////////////////
55 // Utility class to display ALICE outline, tracks, hits,.. //
57 //////////////////////////////////////////////////////////////////////////
66 #include <TPolyMarker3D.h>
69 #include <TPolyMarker.h>
70 #include <TPaveLabel.h>
71 #include <TPaveText.h>
78 #include <TGeometry.h>
79 #include <TSliderBox.h>
81 #include <TVirtualX.h>
84 #include <X3DBuffer.h>
85 #include <TParticle.h>
89 #include "AliDetector.h"
91 #include "AliRICHConst.h"
92 #include "AliRICHDisplay.h"
93 #include "AliRICHPoints.h"
95 #include "AliRICHHit.h"
96 #include "AliRICHCerenkov.h"
97 #include "AliRICHSDigit.h"
98 #include "AliRICHDigit.h"
99 #include "AliRICHRawCluster.h"
100 #include "AliRICHRecHit1D.h"
101 #include "AliRICHRecHit3D.h"
102 #include "AliRICHEllipse.h"
104 ClassImp(AliRICHDisplay)
107 //____________________________________________________________________________
108 AliRICHDisplay::AliRICHDisplay()
111 // default constructor
121 //_____________________________________________________________________________
122 AliRICHDisplay::AliRICHDisplay(Int_t size)
124 // Create an event display object.
125 // A canvas named "edisplay" is created with a vertical size in pixels
127 // A QUICK Overview of the Event Display functions
128 // ===============================================
130 // The event display can ve invoked by executing the macro "display.C"
131 // A canvas like in the picture below will appear.
133 // On the left side of the canvas, the following buttons appear:
134 // *Next* to move to the next event
135 // *Previous* to move to the previous event
137 // *Pick* Select this option to be able to point on a track with the
138 // mouse. Once on the track, use the right button to select
139 // an action. For example, select SetMarkerAttributes to
140 // change the marker type/color/size for the track.
141 // *Zoom* Select this option (default) if you want to zoom.
142 // To zoom, simply select the selected area with the left button.
143 // *UnZoom* To revert to the previous picture size.
145 // slider R On the left side, the vertical slider can be used to
146 // set the default picture size.
148 // When you are in Zoom mode, you can click on the black part of the canvas
149 // to select special options with the right mouse button.
152 // When you are in pick mode, you can "Inspect" the object pointed by the mouse.
153 // When you are on a track, select the menu item "InspectParticle"
154 // to display the current particle attributes.
156 // You can activate the Root browser by selecting the Inspect menu
157 // in the canvas tool bar menu. Then select "Start Browser"
158 // This will open a new canvas with the browser. At this point, you may want
159 // to display some histograms (from the Trees). Go to the "File" menu
160 // of the browser and click on "New canvas".
161 // In the browser, click on item "ROOT files" in the left pane.
162 // Click on galice.root.
164 // Click on TPC for example
165 // Click on any variable (eg TPC.fX) to histogram the variable.
167 // If you are lost, you can click on HELP in any Root canvas or browser.
170 <img src="gif/AliRICHDisplay.gif">
177 gAlice->SetDisplay(this);
179 // Initialize display default parameters
182 // Set front view by default
189 fDrawClusters = kTRUE;
191 fDrawRecHits = kTRUE;
202 // Create display canvas
204 if (ysize < 100) ysize = 750;
205 Int_t xsize = Int_t(size*830./ysize);
206 fCanvas = new TCanvas("Canvas", "RICH Clusters Display",14,47,xsize,ysize);
207 fCanvas->ToggleEventStatus();
209 // Create main display pad
210 fPad = new TPad("viewpad", "RICH display",0.15,0,0.9,1);
213 fPad->SetFillColor(1);
214 fPad->SetBorderSize(2);
219 fColPad = new TPad("colpad", "Colors pad",0.9,0,1,1);
222 fColPad->SetFillColor(19);
223 fColPad->SetBorderSize(2);
229 // Create user interface control pad
233 // Create Range and mode pad
236 fTrigPad = new TPad("trigger", "range and mode pad",0,0,dxtr,dytr);
237 fTrigPad->SetEditable(kFALSE);
240 fTrigPad->SetFillColor(22);
241 fTrigPad->SetBorderSize(2);
242 fRangeSlider = new TSlider("range","range",0.7,0.42,0.9,0.98);
243 fRangeSlider->SetObject(this);
244 char pickmode[] = "gAlice->Display()->SetPickMode()";
246 fPickButton = new TButton("Pick",pickmode,0.05,0.32,0.65,0.32+db);
247 fPickButton->SetFillColor(38);
249 char zoommode[] = "gAlice->Display()->SetZoomMode()";
250 fZoomButton = new TButton("Zoom",zoommode,0.05,0.21,0.65,0.21+db);
251 fZoomButton->SetFillColor(38);
253 fArcButton = new TArc(.8,fZoomButton->GetYlowNDC()+0.5*db,0.33*db);
254 fArcButton->SetFillColor(kGreen);
256 char butUnzoom[] = "gAlice->Display()->UnZoom()";
257 TButton *button = new TButton("UnZoom",butUnzoom,0.05,0.05,0.95,0.15);
258 button->SetFillColor(38);
260 AppendPad(); // append display object as last object to force selection
267 //_____________________________________________________________________________
268 AliRICHDisplay::~AliRICHDisplay()
270 // Delete space point structure
271 if (fPoints) fPoints->Delete();
275 if (fPhits) fPhits->Delete();
279 if (fRpoints) fRpoints->Delete();
283 if (fRecpoints) fRecpoints->Delete();
287 if (fPCerenkovs) fPCerenkovs->Delete();
292 //_____________________________________________________________________________
293 void AliRICHDisplay::Clear(Option_t *)
295 // Delete graphics temporary objects
298 //_____________________________________________________________________________
299 void AliRICHDisplay::DisplayButtons()
301 // Create the user interface buttons
304 fButtons = new TPad("buttons", "newpad",0,0.45,0.15,1);
305 fButtons->SetEditable(kFALSE);
307 fButtons->SetFillColor(38);
308 fButtons->SetBorderSize(2);
311 // Int_t butcolor = 33;
312 Float_t dbutton = 0.08;
319 char but1[] = "gAlice->Display()->ShowNextEvent(1)";
320 button = new TButton("Next",but1,x0,y-dbutton,x1,y);
321 button->SetFillColor(38);
325 char but2[] = "gAlice->Display()->ShowNextEvent(-1)";
326 button = new TButton("Previous",but2,x0,y-dbutton,x1,y);
327 button->SetFillColor(38);
331 char but7[] = "gAlice->Display()->DrawViewGL()";
332 button = new TButton("OpenGL",but7,x0,y-dbutton,x1,y);
333 button->SetFillColor(38);
337 char but8[] = "gAlice->Display()->DrawViewX3D()";
338 button = new TButton("X3D",but8,x0,y-dbutton,x1,y);
339 button->SetFillColor(38);
343 TDiamond *diamond = new TDiamond(0.05,0.015,0.95,0.22);
344 diamond->SetFillColor(50);
345 diamond->SetTextAlign(22);
346 diamond->SetTextColor(5);
347 diamond->SetTextSize(0.11);
349 diamond->AddText(".. ");
350 diamond->AddText("ROOT");
351 diamond->AddText("RICH");
352 diamond->AddText("... ");
353 diamond->AddText(" ");
356 //_____________________________________________________________________________
357 void AliRICHDisplay::CreateColors()
359 // Create the colors palette used to display clusters
374 new TColor(color,r,g,b);
384 new TColor(color,r,g,b);
394 new TColor(color,r,g,b);
404 new TColor(color,r,g,b);
414 new TColor(color,r,g,b);
421 //_____________________________________________________________________________
422 void AliRICHDisplay::DisplayColorScale()
425 // Draw the color scale in the RICH display canvas
429 Float_t xlow, ylow, xup, yup, hs;
430 Float_t x1, y1, x2, y2;
434 gPad->SetFillColor(0);
436 gPad->Range(x1,y1,x2,y2);
437 TText *text = new TText(0,0,"");
438 text->SetTextFont(61);
439 text->SetTextSize(0.03);
440 text->SetTextAlign(22);
444 //*-* draw colortable boxes
445 hs = (y2-y1)/Float_t(22);
449 ylow = y1 + hs*(Float_t(i));
450 yup = y1 + hs*(Float_t(i+1));
452 Double_t logscale=Double_t(i+1)*(TMath::Log(adc_satm)/22);
453 Int_t scale=(Int_t)TMath::Exp(logscale);
454 sprintf(label,"%d",scale);
455 box = new TBox(xlow, ylow, xup, yup);
456 box->SetFillColor(color);
458 text->DrawText(xup+4, 0.5*(ylow+yup),label);
462 //______________________________________________________________________________
463 Int_t AliRICHDisplay::DistancetoPrimitive(Int_t px, Int_t)
465 // Compute distance from point px,py to objects in event
467 gPad->SetCursor(kCross);
469 if (gPad == fTrigPad) return 9999;
471 const Int_t kBig = 9999;
473 Float_t xmin = gPad->GetX1();
474 Float_t xmax = gPad->GetX2();
475 Float_t dx = 0.02*(xmax - xmin);
476 Float_t x = gPad->AbsPixeltoX(px);
477 if (x < xmin+dx || x > xmax-dx) return dist;
478 if (fZoomMode) return 0;
482 //_____________________________________________________________________________
483 void AliRICHDisplay::Draw(Option_t *)
485 // Display current event
489 DrawView(fTheta, fPhi, fPsi); // see how to draw PGON+inner frames
491 // Display the event number and title
496 //_____________________________________________________________________________
497 void AliRICHDisplay::DrawCoG()
499 // Draw hits for RICH chambers
501 if (!fDrawCoG) return;
503 for (Int_t chamber=0;chamber<kNCH;chamber++) {
512 ncog = points->GetEntriesFast();
513 for (icog=0; icog < ncog; icog++) {
514 pm = (AliRICHPoints*)points->UncheckedAt(icog);
520 void AliRICHDisplay::DrawRecHits()
522 // Draw rec hits for RICH chambers
524 if (!fDrawRecHits) return;
526 for (Int_t chamber=0;chamber<kNCH;chamber++) {
527 LoadRecHits(chamber,1);
535 nrec = points->GetEntriesFast();
536 //printf("Nrec %d\n",nrec);
537 for (irec=0; irec < nrec; irec++) {
538 pm = (AliRICHPoints*)points->UncheckedAt(irec);
544 //_____________________________________________________________________________
546 void AliRICHDisplay::DrawCerenkovs()
548 // Draw cerenkovs hits for RICH chambers
550 LoadCerenkovs(fChamber);
551 //printf("\nDrawCerenkovs\n");
553 Int_t ntracks, track;
558 cpoints = fPCerenkovs;
559 //printf ("Cpoints: %p",cpoints);
560 if (!cpoints) return;
561 ntracks = cpoints->GetEntriesFast();
562 //printf("DrawCerenkovs - ntracks %d \n",ntracks);
563 for (track=0;track<ntracks;track++) {
564 pm = (AliRICHPoints*)cpoints->UncheckedAt(track);
567 fHitsCuts += pm->GetN();
571 //_____________________________________________________________________________
573 void AliRICHDisplay::DrawClusters()
575 // Draw clusterss for RICH chambers
577 Int_t ndigits, digit;
584 ndigits = points->GetEntriesFast();
585 for (digit=0;digit<ndigits;digit++){
586 pm = (AliRICHPoints*)points->UncheckedAt(digit);
591 for (Int_t im=0;im<3;im++) {
592 TMarker3DBox *marker=pm->GetMarker(im);
596 fClustersCuts +=pm->GetN();
600 //_____________________________________________________________________________
601 void AliRICHDisplay::DrawHits()
603 // Draw hits for RICH chambers
607 Int_t ntracks, track;
614 // ntracks = points->GetEntriesFast();
615 ntracks = fPhits->GetEntriesFast();
617 //printf("DrawHits - ntracks %d \n",ntracks);
618 for (track=0;track<ntracks;track++) {
619 pm = (AliRICHPoints*)fPhits->UncheckedAt(track);
622 fHitsCuts += pm->GetN();
627 //_____________________________________________________________________________
628 void AliRICHDisplay::DrawTitle(Option_t *option)
630 // Draw the event title
632 Float_t xmin = gPad->GetX1();
633 Float_t xmax = gPad->GetX2();
634 Float_t ymin = gPad->GetY1();
635 Float_t ymax = gPad->GetY2();
636 Float_t dx = xmax-xmin;
637 Float_t dy = ymax-ymin;
639 if (strlen(option) == 0) {
640 TPaveText *title = new TPaveText(xmin +0.01*dx, ymax-0.09*dy, xmin +0.5*dx, ymax-0.01*dy);
641 title->SetBit(kCanDelete);
642 title->SetFillColor(42);
645 sprintf(ptitle,"Alice event: %d, Run:%d",
646 gAlice->GetHeader()->GetEvent(), gAlice->GetHeader()->GetRun());
647 title->AddText(ptitle);
648 Int_t nparticles = gAlice->Particles()->GetEntriesFast();
649 sprintf(ptitle,"Nparticles = %d Nhits = %d Npads fired = %d",
650 nparticles, fHitsCuts,fClustersCuts);
651 title->AddText(ptitle);
654 new TPaveLabel(xmin +0.01*dx, ymax-0.07*dy, xmin +0.2*dx, ymax-0.01*dy,option);
655 label->SetBit(kCanDelete);
656 label->SetFillColor(42);
661 //_____________________________________________________________________________
662 void AliRICHDisplay::DrawView(Float_t theta, Float_t phi, Float_t psi)
664 // Draw a view of RICH clusters
666 gPad->SetCursor(kWatch);
667 gPad->SetFillColor(1);
671 TView *view = new TView(1);
672 Float_t range = fRrange*fRangeSlider->GetMaximum();
673 view->SetRange(-range,-range,-range,range, range, range);
680 //Display RICH Chamber Geometry
681 gAlice->GetGeometry()->Draw("same");
683 //add clusters to the pad
689 //printf("Calling DrawCoG\n");
691 //printf("Calling DrawRecHits\n");
694 /*for (Int_t i=0;i<7;i++)
697 // add itself to the list (must be last)
700 view->SetView(phi, theta, psi, iret);
703 //______________________________________________________________________________
704 void AliRICHDisplay::ExecuteEvent(Int_t event, Int_t px, Int_t py)
706 // Execute action corresponding to the mouse event
708 static Float_t x0, y0, x1, y1;
710 static Int_t pxold, pyold;
711 static Int_t px0, py0;
712 static Int_t linedrawn;
715 if (px == 0 && py == 0) { //when called by sliders
716 if (event == kButton1Up) {
721 if (!fZoomMode && gPad->GetView()) {
722 gPad->GetView()->ExecuteRotateView(event, px, py);
726 // something to zoom ?
727 gPad->SetCursor(kCross);
732 gVirtualX->SetLineColor(-1);
733 gPad->TAttLine::Modify(); //Change line attributes only if necessary
734 x0 = gPad->AbsPixeltoX(px);
735 y0 = gPad->AbsPixeltoY(py);
737 pxold = px; pyold = py;
742 if (linedrawn) gVirtualX->DrawBox(px0, py0, pxold, pyold, TVirtualX::kHollow);
746 gVirtualX->DrawBox(px0, py0, pxold, pyold, TVirtualX::kHollow);
750 gPad->GetCanvas()->FeedbackMode(kFALSE);
751 if (px == px0) return;
752 if (py == py0) return;
753 x1 = gPad->AbsPixeltoX(px);
754 y1 = gPad->AbsPixeltoY(py);
756 if (x1 < x0) {temp = x0; x0 = x1; x1 = temp;}
757 if (y1 < y0) {temp = y0; y0 = y1; y1 = temp;}
758 gPad->Range(x0,y0,x1,y1);
759 if (fZooms < kMAXZOOM-1) {
761 fZoomX0[fZooms] = x0;
762 fZoomY0[fZooms] = y0;
763 fZoomX1[fZooms] = x1;
764 fZoomY1[fZooms] = y1;
766 gPad->Modified(kTRUE);
771 //___________________________________________
772 void AliRICHDisplay::LoadCoG(Int_t chamber, Int_t cathode)
774 // Read raw clusters info and store x,y,z info in arrays fRpoints
775 // Loop on all detectors
777 if (chamber > 6) return;
779 //printf("Entering LoadCoG\n");
782 AliRICH *pRICH = (AliRICH*)gAlice->GetModule("RICH");
783 AliRICHChamber* iChamber;
785 TClonesArray *pRICHrawclust = pRICH->RawClustAddress(chamber);
786 //printf ("Chamber:%d has adress:%p\n", chamber, pRICHrawclust );
787 if (pRICHrawclust == 0) return;
789 pRICH->ResetRawClusters();
792 Int_t nent=(Int_t)gAlice->TreeR()->GetEntries();
793 gAlice->TreeR()->GetEvent(nent-1+cathode-1);
794 Int_t nrawcl = pRICHrawclust->GetEntriesFast();
795 //printf ("nrawcl:%d\n",nrawcl);
796 if (nrawcl == 0) return;
797 if (fRpoints == 0) fRpoints = new TObjArray(nrawcl);
799 iChamber = &(pRICH->Chamber(chamber));
800 AliRICHRawCluster *mRaw;
801 AliRICHPoints *points = 0;
803 //loop over all raw clusters and store their position
804 points = new AliRICHPoints(nrawcl);
805 for (Int_t iraw=0;iraw<nrawcl;iraw++) {
806 mRaw = (AliRICHRawCluster*)pRICHrawclust->UncheckedAt(iraw);
807 fRpoints->AddAt(points,iraw);
808 points->SetMarkerColor(3);
809 points->SetMarkerStyle(3);
810 points->SetMarkerSize(1.);
811 points->SetParticle(-1);
812 points->SetHitIndex(-1);
813 points->SetTrackIndex(-1);
814 points->SetDigitIndex(-1);
815 Float_t vectorLoc[3]={mRaw->fX,-5,mRaw->fY};
816 Float_t vectorGlob[3];
817 iChamber->LocaltoGlobal(vectorLoc,vectorGlob);
818 points->SetPoint(iraw,vectorGlob[0],vectorGlob[1],vectorGlob[2]);
821 //___________________________________________
822 void AliRICHDisplay::LoadRecHits(Int_t chamber, Int_t cathode)
824 // Read rec. hits info
825 // Loop on all detectors
827 if (chamber > 6) return;
829 ///printf("Entering LoadRecHits\n");
832 AliRICH *pRICH = (AliRICH*)gAlice->GetModule("RICH");
833 AliRICHChamber* iChamber;
835 TClonesArray *pRICHrechits1D = pRICH->RecHitsAddress1D(chamber);
836 //printf ("Chamber:%d\n", chamber);
837 if (pRICHrechits1D != 0)
840 //RICH->ResetRecHits();
843 Int_t nent1D=(Int_t)gAlice->TreeR()->GetEntries();
844 gAlice->TreeR()->GetEvent(nent1D-1+cathode-1);
845 Int_t nrechits1D = pRICHrechits1D->GetEntriesFast();
846 //printf ("nrechits1D:%d\n",nrechits1D);
849 if (fRecpoints == 0) fRecpoints = new TObjArray(50);
851 iChamber = &(pRICH->Chamber(chamber));
852 AliRICHRecHit1D *mRec1D;
853 AliRICHPoints *points1D = 0;
854 //AliRICHEllipse *ellipse = 0;
856 //loop over all rechits and store their position
858 points1D = new AliRICHPoints(nrechits1D);
859 for (Int_t irec=0;irec<nrechits1D;irec++) {
860 mRec1D = (AliRICHRecHit1D*)pRICHrechits1D->UncheckedAt(irec);
861 fRecpoints->AddAt(points1D,irec);
862 points1D->SetMarkerColor(38);
863 points1D->SetMarkerStyle(8);
864 points1D->SetMarkerSize(1.);
865 points1D->SetParticle(-1);
866 points1D->SetHitIndex(-1);
867 points1D->SetTrackIndex(-1);
868 points1D->SetDigitIndex(-1);
869 Float_t vectorLoc[3]={mRec1D->fX,-5,mRec1D->fY};
870 Float_t vectorGlob[3];
871 iChamber->LocaltoGlobal(vectorLoc,vectorGlob);
872 points1D->SetPoint(irec,vectorGlob[0],vectorGlob[1],vectorGlob[2]);
873 //Float_t theta = iChamber->GetRotMatrix()->GetTheta();
874 //Float_t phi = iChamber->GetRotMatrix()->GetPhi();
875 //ellipse=new TEllipse(vectorGlob[0],vectorGlob[2],10,10,0,360,phi);
876 //printf("Generating ellipse %d\n",irec);
877 AliRICHEllipse *ellipse=new AliRICHEllipse(mRec1D->fX,mRec1D->fY,mRec1D->fOmega,mRec1D->fTheta,mRec1D->fPhi,mRec1D->fEmissPoint);
878 ellipse->CerenkovRingDrawing(chamber,irec);
879 //ellipse->SetFillStyle(1001);
880 ellipse->SetMarkerColor(38);
882 //marker->SetRefObject((TObject*)points1D);
883 //points1D->Set3DMarker(0, marker);
888 TClonesArray *pRICHrechits3D = pRICH->RecHitsAddress3D(chamber);
889 //printf ("Chamber:%d\n", chamber);
890 if (pRICHrechits3D != 0)
893 //RICH->ResetRecHits();
896 Int_t nent3D=(Int_t)gAlice->TreeR()->GetEntries();
897 gAlice->TreeR()->GetEvent(nent3D-1+cathode-1);
898 Int_t nrechits3D = pRICHrechits3D->GetEntriesFast();
899 //printf ("nrechits3D:%d\n",nrechits3D);
902 if (fRecpoints == 0) fRecpoints = new TObjArray(50);
904 iChamber = &(pRICH->Chamber(chamber));
905 AliRICHRecHit3D *mRec3D;
906 AliRICHPoints *points3D = 0;
907 //AliRICHEllipse *ellipse = 0;
909 //loop over all rechits and store their position
911 points3D = new AliRICHPoints(nrechits3D);
912 for (Int_t irec=0;irec<nrechits3D;irec++) {
913 mRec3D = (AliRICHRecHit3D*)pRICHrechits3D->UncheckedAt(irec);
914 fRecpoints->AddAt(points3D,irec);
915 points3D->SetMarkerColor(42);
916 points3D->SetMarkerStyle(8);
917 points3D->SetMarkerSize(1.);
918 points3D->SetParticle(-1);
919 points3D->SetHitIndex(-1);
920 points3D->SetTrackIndex(-1);
921 points3D->SetDigitIndex(-1);
922 Float_t vectorLoc[3]={mRec3D->fX,-5,mRec3D->fY};
923 Float_t vectorGlob[3];
924 iChamber->LocaltoGlobal(vectorLoc,vectorGlob);
925 points3D->SetPoint(irec,vectorGlob[0],vectorGlob[1],vectorGlob[2]);
926 //Float_t theta = iChamber->GetRotMatrix()->GetTheta();
927 //Float_t phi = iChamber->GetRotMatrix()->GetPhi();
928 //ellipse=new TEllipse(vectorGlob[0],vectorGlob[2],10,10,0,360,phi);
929 //printf("Generating ellipse %d\n",irec);
930 AliRICHEllipse *ellipse=new AliRICHEllipse(mRec3D->fX,mRec3D->fY,mRec3D->fOmega,mRec3D->fTheta,mRec3D->fPhi,0.75);
931 ellipse->CerenkovRingDrawing(chamber,irec);
932 //ellipse->SetFillStyle(1001);
933 ellipse->SetMarkerColor(42);
935 //marker->SetRefObject((TObject*)points3D);
936 //points3D->Set3DMarker(0, marker);
941 //___________________________________________
942 void AliRICHDisplay::LoadDigits()
944 // Read digits info and store x,y,z info in arrays fPoints
945 // Loop on all detectors
948 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
949 AliRICHChamber* iChamber;
950 AliSegmentation* segmentation;
954 //printf("Entering LoadDigits\n");
959 for (ich=0; ich<kNCH; ich++) {
960 TClonesArray *pRICHdigits = pRICH->DigitsAddress(ich);
961 //printf ("Chamber:%d has adress:%p\n", ich, pRICHdigits );
962 if (pRICHdigits == 0) continue;
963 gAlice->ResetDigits();
964 gAlice->TreeD()->GetEvent(0);
965 Int_t ndigits = pRICHdigits->GetEntriesFast();
966 //printf("ndigits:%d\n",ndigits);
970 if (fPoints == 0) fPoints = new TObjArray(nAllDigits);
972 for (ich=0; ich<kNCH; ich++) {
973 TClonesArray *pRICHdigits = pRICH->DigitsAddress(ich);
974 if (pRICHdigits == 0) continue;
975 gAlice->ResetDigits();
976 gAlice->TreeD()->GetEvent(0);
977 Int_t ndigits = pRICHdigits->GetEntriesFast();
978 if (ndigits == 0) continue;
979 iChamber = &(pRICH->Chamber(ich));
980 segmentation=iChamber->GetSegmentationModel();
981 Float_t dpx = segmentation->Dpx();
982 Float_t dpy = segmentation->Dpy();
984 //printf("Dpx:%d, Dpy:%d\n",dpx,dpy);
987 AliRICHPoints *points = 0;
988 TMarker3DBox *marker = 0;
990 //loop over all digits and store their position
993 for (Int_t digit=0;digit<ndigits;digit++) {
994 mdig = (AliRICHDigit*)pRICHdigits->UncheckedAt(digit);
995 points = new AliRICHPoints(npoints);
996 fPoints->AddAt(points,counter);
998 Int_t charge=mdig->fSignal;
999 Int_t index=Int_t(TMath::Log(charge)/(TMath::Log(adc_satm)/22));
1000 Int_t color=701+index;
1001 if (color>722) color=722;
1002 points->SetMarkerColor(color);
1003 points->SetMarkerStyle(21);
1004 points->SetMarkerSize(0.5);
1005 Float_t xpad, ypad, zpad;
1006 segmentation->GetPadC(mdig->fPadX, mdig->fPadY,xpad, ypad, zpad);
1007 Float_t vectorLoc[3]={xpad,-5,ypad};
1008 Float_t vectorGlob[3];
1009 iChamber->LocaltoGlobal(vectorLoc,vectorGlob);
1010 points->SetParticle(-1);
1011 points->SetHitIndex(-1);
1012 points->SetTrackIndex(-1);
1013 points->SetDigitIndex(digit);
1014 points->SetPoint(0,vectorGlob[0],vectorGlob[1],vectorGlob[2]);
1016 segmentation->GetPadC(mdig->fPadX, mdig->fPadY, xpad, ypad, zpad);
1017 Float_t theta = iChamber->GetRotMatrix()->GetTheta();
1018 Float_t phi = iChamber->GetRotMatrix()->GetPhi();
1019 marker=new TMarker3DBox(vectorGlob[0],vectorGlob[1],vectorGlob[2],
1020 dpy/2,0,dpx/2,theta,phi);
1021 marker->SetLineColor(2);
1022 marker->SetFillStyle(1001);
1023 marker->SetFillColor(color);
1024 marker->SetRefObject((TObject*)points);
1025 points->Set3DMarker(0, marker);
1026 } // loop over digits
1027 } // loop over chambers
1032 //___________________________________________
1033 void AliRICHDisplay::LoadHits(Int_t chamber)
1035 // Read hits info and store x,y,z info in arrays fPhits
1036 // Loop on all detectors
1042 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
1043 AliRICHChamber* iChamber;
1045 iChamber = &(pRICH->Chamber(chamber-1));
1046 Int_t ntracks = (Int_t)gAlice->TreeH()->GetEntries();
1049 if (fPhits == 0) fPhits = new TObjArray(ntracks);
1050 //TVector *xp = new TVector(1000);
1051 //TVector *yp = new TVector(1000);
1052 //TVector *zp = new TVector(1000);
1053 //TVector *ptrk = new TVector(1000);
1054 //TVector *phit = new TVector(1000);
1056 for (track=0; track<ntracks;track++) {
1057 gAlice->ResetHits();
1058 gAlice->TreeH()->GetEvent(track);
1059 TClonesArray *pRICHhits = pRICH->Hits();
1060 if (pRICHhits == 0) return;
1061 Int_t nhits = pRICHhits->GetEntriesFast();
1065 fPhits = new TObjArray(nAllHits);
1068 for (track=0; track<ntracks;track++) {
1069 gAlice->ResetHits();
1070 gAlice->TreeH()->GetEvent(track);
1071 TClonesArray *pRICHhits = pRICH->Hits();
1072 if (pRICHhits == 0) return;
1073 Int_t nhits = pRICHhits->GetEntriesFast();
1074 if (nhits == 0) continue;
1076 AliRICHPoints *points = 0;
1077 for (Int_t hit=0;hit<nhits;hit++) {
1078 points = new AliRICHPoints(1);
1079 fPhits->AddAt(points,npoints);
1080 mHit = (AliRICHHit*)pRICHhits->UncheckedAt(hit);
1081 TParticle *current = (TParticle*)gAlice->Particle(mHit->Track());
1082 if (current->GetPdgCode() == 50000050) {
1083 points->SetMarkerColor(kBlue);
1084 } else if (current->GetPdgCode() == 50000051) {
1085 points->SetMarkerColor(kYellow);
1087 points->SetMarkerColor(kRed);
1089 points->SetMarkerStyle(5);
1090 points->SetMarkerSize(1.);
1091 points->SetParticle(mHit->Track());
1092 points->SetHitIndex(hit);
1093 points->SetTrackIndex(track);
1094 points->SetDigitIndex(-1);
1095 points->SetPoint(hit,mHit->X(), mHit->Y(), mHit->Z());
1101 //_____________________________________________________________________________
1103 void AliRICHDisplay::LoadCerenkovs(Int_t chamber)
1105 // Read cerenkov hits info and store x,y,z info in array fPCerenkovs
1106 // Loop on all detectors
1111 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
1112 AliRICHChamber* iChamber;
1114 iChamber = &(pRICH->Chamber(chamber-1));
1116 pRICH->SetTreeAddress();
1117 Int_t ntracks = (Int_t)gAlice->TreeH()->GetEntries();
1119 if (fPCerenkovs == 0) fPCerenkovs = new TObjArray(ntracks);
1120 TVector *xp = new TVector(1000);
1121 TVector *yp = new TVector(1000);
1122 TVector *zp = new TVector(1000);
1123 TVector *ptrk = new TVector(1000);
1124 TVector *phit = new TVector(1000);
1125 for (Int_t track=0; track<ntracks;track++) {
1126 gAlice->ResetHits();
1127 gAlice->TreeH()->GetEvent(track);
1128 TClonesArray *pRICHCerenkovs = pRICH->Cerenkovs();
1129 if (pRICHCerenkovs == 0) return;
1130 Int_t nhits = pRICHCerenkovs->GetEntriesFast();
1131 if (nhits == 0) continue;
1132 AliRICHCerenkov *mCerenkov;
1133 AliRICHPoints *cpoints = 0;
1137 //Display Cerenkov hits in blue
1139 for (Int_t hit=0;hit<nhits;hit++) {
1140 mCerenkov = (AliRICHCerenkov*)pRICHCerenkovs->UncheckedAt(hit);
1141 (*xp)(npoints)=mCerenkov->X();
1142 (*yp)(npoints)=mCerenkov->Y();
1143 (*zp)(npoints)=mCerenkov->Z();
1144 (*ptrk)(npoints)=Float_t(mCerenkov->GetTrack());
1145 (*phit)(npoints)=Float_t(hit);
1148 if (npoints == 0) continue;
1149 cpoints = new AliRICHPoints(npoints);
1150 for (Int_t p=0;p<npoints;p++) {
1151 cpoints->SetMarkerColor(kBlue);
1152 cpoints->SetMarkerStyle(5);
1153 cpoints->SetMarkerSize(1.);
1154 cpoints->SetParticle(Int_t((*ptrk)(p)));
1155 cpoints->SetHitIndex(Int_t((*phit)(p)));
1156 cpoints->SetTrackIndex(track);
1157 cpoints->SetDigitIndex(-1);
1158 cpoints->SetPoint(p,(*xp)(p),(*yp)(p),(*zp)(p));
1164 fPCerenkovs->AddAt(cpoints,track);
1168 //_____________________________________________________________________________
1169 void AliRICHDisplay::Paint(Option_t *)
1171 // Paint miscellaneous items
1175 //_____________________________________________________________________________
1176 void AliRICHDisplay::SetPickMode()
1183 fArcButton->SetY1(fPickButton->GetYlowNDC()+0.5*fPickButton->GetHNDC());
1184 fTrigPad->Modified();
1187 //_____________________________________________________________________________
1188 void AliRICHDisplay::SetZoomMode()
1195 fArcButton->SetY1(fZoomButton->GetYlowNDC()+0.5*fZoomButton->GetHNDC());
1196 fTrigPad->Modified();
1199 //_____________________________________________________________________________
1200 void AliRICHDisplay::SetChamberAndCathode(Int_t chamber, Int_t cathode)
1202 // Set chamber and cathode number
1206 //printf("SetChamberAndCathode - fChamber fCathode %d %d\n",fChamber,fCathode);
1213 //_____________________________________________________________________________
1214 void AliRICHDisplay::SetRange(Float_t rrange, Float_t zrange)
1216 // Set view range along R and Z
1225 //_____________________________________________________________________________
1226 void AliRICHDisplay::SetView(Float_t theta, Float_t phi, Float_t psi)
1228 // change viewing angles for current event
1236 TView *view = gPad->GetView();
1237 if (view) view->SetView(fPhi, fTheta, fPsi, iret);
1243 //_____________________________________________________________________________
1244 void AliRICHDisplay::ShowNextEvent(Int_t delta)
1246 // Display (current event_number+delta)
1247 // delta = 1 shown next event
1248 // delta = -1 show previous event
1252 Int_t currentEvent = gAlice->GetHeader()->GetEvent();
1253 Int_t newEvent = currentEvent + delta;
1254 gAlice->GetEvent(newEvent);
1255 if (!gAlice->TreeD()) return;
1265 //______________________________________________________________________________
1266 void AliRICHDisplay::UnZoom()
1269 // Return to previous zoom factor
1271 if (fZooms <= 0) return;
1273 TPad *pad = (TPad*)gPad->GetPadSave();
1274 pad->Range(fZoomX0[fZooms],fZoomY0[fZooms], fZoomX1[fZooms],fZoomY1[fZooms]);
1278 //_____________________________________________________________________________
1279 void AliRICHDisplay::ResetPoints()
1282 // Reset array of points
1290 //_____________________________________________________________________________
1291 void AliRICHDisplay::ResetRpoints()
1294 // Reset array of points
1302 //_____________________________________________________________________________
1303 void AliRICHDisplay::ResetRecpoints()
1306 // Reset array of points
1309 fRecpoints->Delete();
1314 //_____________________________________________________________________________
1315 void AliRICHDisplay::ResetPhits()
1318 // Reset array of points
1326 //_____________________________________________________________________________
1327 void AliRICHDisplay::ResetPCerenkovs()
1330 // Reset array of points
1333 fPCerenkovs->Delete();
1339 //_____________________________________________________________________________
1341 void AliRICHDisplay::DrawViewGL()
1343 // Draw current view using OPENGL
1345 TPad *pad = (TPad*)gPad->GetPadSave();
1347 TView *view = pad->GetView();
1352 //_____________________________________________________________________________
1353 void AliRICHDisplay::DrawViewX3D()
1355 // Draw current view using X3D
1357 TPad *pad = (TPad*)gPad->GetPadSave();
1359 TView *view = pad->GetView();