]> git.uio.no Git - u/mrichter/AliRoot.git/blob - RICH/AliRICHDisplay.cxx
removed a cout
[u/mrichter/AliRoot.git] / RICH / AliRICHDisplay.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
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  **************************************************************************/
15
16 /*
17   $Log$
18   Revision 1.13  2001/05/10 12:35:16  jbarbosa
19   Removed hit display, added rec. ring properties.
20
21   Revision 1.12  2001/03/14 18:15:03  jbarbosa
22   Changes to adapt to new IO.
23   Removed verbose output.
24
25   Revision 1.11  2001/02/27 15:21:34  jbarbosa
26   Transition to SDigits.
27
28   Revision 1.10  2001/02/13 20:18:48  jbarbosa
29   Corrected some more positioning of points. Changes in LoadDigits to accomodate the new IO.
30
31   Revision 1.9  2000/11/01 15:33:11  jbarbosa
32   Updated to handle both reconstruction algorithms.
33
34   Revision 1.8  2000/10/03 21:44:09  morsch
35   Use AliSegmentation and AliHit abstract base classes.
36
37   Revision 1.7  2000/10/02 21:28:12  fca
38   Removal of useless dependecies via forward declarations
39
40   Revision 1.6  2000/10/02 15:46:38  jbarbosa
41   Fixed forward declarations.
42
43   Revision 1.5  2000/06/30 16:49:34  dibari
44   Different call for ring drawing.
45
46   Revision 1.4  2000/06/12 15:21:08  jbarbosa
47   Cleaned up version.
48
49   Revision 1.3  2000/06/09 14:52:08  jbarbosa
50   New tentative ellipse drawing routine
51
52   Revision 1.1  2000/04/19 13:07:45  morsch
53   Digits, clusters and reconstruction results added.
54
55 */
56
57
58 //////////////////////////////////////////////////////////////////////////
59 //                                                                      //
60 // AliDisplay                                                           //
61 //                                                                      //
62 // Utility class to display ALICE outline, tracks, hits,..              //
63 //                                                                      //
64 //////////////////////////////////////////////////////////////////////////
65
66 #include <TROOT.h>
67 #include <TTree.h>
68 #include <TButton.h>
69 #include <TColor.h>
70 #include <TCanvas.h>
71 #include <TView.h>
72 #include <TText.h>
73 #include <TPolyMarker3D.h>
74 #include <TAtt3D.h>
75 #include <TAttLine.h>
76 #include <TPolyMarker.h>
77 #include <TPaveLabel.h>
78 #include <TPaveText.h>
79 #include <TList.h>
80 #include <TDiamond.h>
81 #include <TNode.h>
82 #include <TArc.h>
83 #include <TTUBE.h>
84 #include <TSlider.h>
85 #include <TGeometry.h>
86 #include <TSliderBox.h>
87 #include <TGaxis.h>
88 #include <TVirtualX.h>
89 #include <TMath.h>
90 #include <TRandom.h>
91 #include <X3DBuffer.h>
92 #include <TParticle.h>
93
94 #include "AliRun.h"
95 #include "AliPDG.h"
96 #include "AliDetector.h"
97 #include "AliRICH.h"
98 #include "AliRICHConst.h"
99 #include "AliRICHDisplay.h"
100 #include "AliRICHPoints.h"
101 #include "AliHeader.h"
102
103 #include "AliRICHHit.h"
104 #include "AliRICHCerenkov.h"
105 #include "AliRICHSDigit.h"
106 #include "AliRICHDigit.h"
107 #include "AliRICHRawCluster.h"
108 #include "AliRICHRecHit1D.h"
109 #include "AliRICHRecHit3D.h"
110 #include "AliRICHEllipse.h"
111
112 ClassImp(AliRICHDisplay)
113     
114
115 //____________________________________________________________________________
116 AliRICHDisplay::AliRICHDisplay()
117
118
119 // default constructor
120
121     fPoints = 0;
122     fPhits = 0;
123     fPCerenkovs = 0;
124     fCanvas = 0;
125     fRpoints = 0;
126     fRecpoints = 0; 
127 }
128
129 //_____________________________________________________________________________
130 AliRICHDisplay::AliRICHDisplay(Int_t size)
131 {
132 // Create an event display object.
133 // A canvas named "edisplay" is created with a vertical size in pixels
134 //
135 //    A QUICK Overview of the Event Display functions
136 //    ===============================================
137 //
138 //  The event display can ve invoked by executing the macro "display.C"
139 // A canvas like in the picture below will appear.
140 //
141 //  On the left side of the canvas, the following buttons appear:
142 //   *Next*       to move to the next event
143 //   *Previous*   to move to the previous event
144
145 //   *Pick*       Select this option to be able to point on a track with the
146 //                mouse. Once on the track, use the right button to select
147 //                an action. For example, select SetMarkerAttributes to
148 //                change the marker type/color/size for the track.
149 //   *Zoom*       Select this option (default) if you want to zoom.
150 //                To zoom, simply select the selected area with the left button.
151 //   *UnZoom*     To revert to the previous picture size.
152 //
153 //   slider R     On the left side, the vertical slider can be used to
154 //                set the default picture size.
155 //
156 //    When you are in Zoom mode, you can click on the black part of the canvas
157 //  to select special options with the right mouse button.
158
159 //
160 //  When you are in pick mode, you can "Inspect" the object pointed by the mouse.
161 //  When you are on a track, select the menu item "InspectParticle"
162 //  to display the current particle attributes.
163 //
164 //  You can activate the Root browser by selecting the Inspect menu
165 //  in the canvas tool bar menu. Then select "Start Browser"
166 //  This will open a new canvas with the browser. At this point, you may want
167 //  to display some histograms (from the Trees). Go to the "File" menu
168 //  of the browser and click on "New canvas".
169 //  In the browser, click on item "ROOT files" in the left pane.
170 //  Click on galice.root.
171 //  Click on TH
172 //  Click on TPC for example
173 //  Click on any variable (eg TPC.fX) to histogram the variable.
174 //
175 //   If you are lost, you can click on HELP in any Root canvas or browser.
176 //Begin_Html
177 /*
178   <img src="gif/AliRICHDisplay.gif">
179 */
180 //End_Html
181     
182     
183     fPad = 0;
184     
185     gAlice->SetDisplay(this);
186     
187     // Initialize display default parameters
188     SetRange();
189     
190     // Set front view by default
191     fTheta = 90;
192     fPhi   = 90;
193     fPsi   = 0;
194     fChamber = 1;
195     fCathode = 1;
196     //   fRzone   = 1.e10;
197     fDrawClusters  = kTRUE;
198     fDrawCoG       = kTRUE;
199     fDrawRecHits   = kTRUE;
200     fZoomMode      = 1;
201     fZooms         = 0;
202     fClustersCuts  = 0;
203     fPoints        = 0;
204     fPCerenkovs    = 0;
205     fPhits         = 0;
206     fRpoints       = 0;   
207     fRecpoints       = 0;
208     // Create colors
209     CreateColors();
210     // Create display canvas
211     Int_t ysize = size;
212     if (ysize < 100) ysize = 750;
213     Int_t xsize = Int_t(size*830./ysize);
214     fCanvas = new TCanvas("Canvas", "RICH Clusters Display",14,47,xsize,ysize);
215     fCanvas->ToggleEventStatus();
216     
217     // Create main display pad
218     fPad = new TPad("viewpad", "RICH display",0.15,0,0.9,1);
219     fPad->Draw();
220     fPad->Modified();
221     fPad->SetFillColor(1);
222     fPad->SetBorderSize(2);
223     
224     fCanvas->cd();
225     
226     // Create colors pad
227     fColPad = new TPad("colpad", "Colors pad",0.9,0,1,1);
228     fColPad->Draw();
229     fColPad->Modified();
230     fColPad->SetFillColor(19);
231     fColPad->SetBorderSize(2);
232     fColPad->cd();
233     DisplayColorScale();
234     
235     fCanvas->cd();
236     
237     // Create user interface control pad
238     DisplayButtons();
239     fCanvas->cd();
240     
241     // Create Range and mode pad
242     Float_t dxtr     = 0.15;
243     Float_t dytr     = 0.45;
244     fTrigPad = new TPad("trigger", "range and mode pad",0,0,dxtr,dytr);
245     fTrigPad->SetEditable(kFALSE);
246     fTrigPad->Draw();
247     fTrigPad->cd();
248     fTrigPad->SetFillColor(22);
249     fTrigPad->SetBorderSize(2);
250     fRangeSlider = new TSlider("range","range",0.7,0.42,0.9,0.98);
251     fRangeSlider->SetObject(this);
252     char pickmode[] = "gAlice->Display()->SetPickMode()";
253     Float_t db = 0.09;
254     fPickButton = new TButton("Pick",pickmode,0.05,0.32,0.65,0.32+db);
255     fPickButton->SetFillColor(38);
256     fPickButton->Draw();
257     char zoommode[] = "gAlice->Display()->SetZoomMode()";
258     fZoomButton = new TButton("Zoom",zoommode,0.05,0.21,0.65,0.21+db);
259     fZoomButton->SetFillColor(38);
260     fZoomButton->Draw();
261     fArcButton = new TArc(.8,fZoomButton->GetYlowNDC()+0.5*db,0.33*db);
262     fArcButton->SetFillColor(kGreen);
263     fArcButton->Draw();
264     char butUnzoom[] = "gAlice->Display()->UnZoom()";
265     TButton *button = new TButton("UnZoom",butUnzoom,0.05,0.05,0.95,0.15);
266     button->SetFillColor(38);
267     button->Draw();
268     AppendPad(); // append display object as last object to force selection
269     
270     fCanvas->cd();
271     fCanvas->Update();
272 }
273
274
275 //_____________________________________________________________________________
276 AliRICHDisplay::~AliRICHDisplay()
277 {
278     // Delete space point structure
279     if (fPoints) fPoints->Delete();
280     delete fPoints;
281     fPoints     = 0;
282     //
283     if (fPhits) fPhits->Delete();
284     delete fPhits;
285     fPhits     = 0;
286     //
287     if (fRpoints) fRpoints->Delete();
288     delete fRpoints;
289     fRpoints     = 0;
290     //
291     if (fRecpoints) fRecpoints->Delete();
292     delete fRecpoints;
293     fRecpoints     = 0;
294     //
295     if (fPCerenkovs) fPCerenkovs->Delete();
296     delete fPCerenkovs;
297     fPCerenkovs     = 0;
298 }
299
300 //_____________________________________________________________________________
301 void AliRICHDisplay::Clear(Option_t *)
302 {
303 //    Delete graphics temporary objects
304 }
305
306 //_____________________________________________________________________________
307 void AliRICHDisplay::DisplayButtons()
308 {
309 //    Create the user interface buttons
310     
311     
312     fButtons = new TPad("buttons", "newpad",0,0.45,0.15,1);
313     fButtons->SetEditable(kFALSE);
314     fButtons->Draw();
315     fButtons->SetFillColor(38);
316     fButtons->SetBorderSize(2);
317     fButtons->cd();
318     
319     //   Int_t butcolor = 33;
320     Float_t dbutton = 0.08;
321     Float_t y  = 0.96;
322     Float_t dy = 0.014;
323     Float_t x0 = 0.05;
324     Float_t x1 = 0.95;
325     
326     TButton *button;
327     char but1[] = "gAlice->Display()->ShowNextEvent(1)";
328     button = new TButton("Next",but1,x0,y-dbutton,x1,y);
329     button->SetFillColor(38);
330     button->Draw();
331     
332     y -= dbutton +dy;
333     char but2[] = "gAlice->Display()->ShowNextEvent(-1)";
334     button = new TButton("Previous",but2,x0,y-dbutton,x1,y);
335     button->SetFillColor(38);
336     button->Draw();
337
338     y -= dbutton +dy;
339     char but7[] = "gAlice->Display()->DrawViewGL()";
340     button = new TButton("OpenGL",but7,x0,y-dbutton,x1,y);
341     button->SetFillColor(38);
342     button->Draw();
343     
344     y -= dbutton +dy;
345     char but8[] = "gAlice->Display()->DrawViewX3D()";
346     button = new TButton("X3D",but8,x0,y-dbutton,x1,y);
347     button->SetFillColor(38);
348     button->Draw();
349     
350     // display logo
351     TDiamond *diamond = new TDiamond(0.05,0.015,0.95,0.22);
352     diamond->SetFillColor(50);
353     diamond->SetTextAlign(22);
354     diamond->SetTextColor(5);
355     diamond->SetTextSize(0.11);
356     diamond->Draw();
357     diamond->AddText(".. ");
358     diamond->AddText("ROOT");
359     diamond->AddText("RICH");
360     diamond->AddText("... ");
361     diamond->AddText(" ");
362 }
363
364 //_____________________________________________________________________________
365 void AliRICHDisplay::CreateColors()
366 {
367 //    Create the colors palette used to display clusters
368     
369     Int_t k,i;
370     Int_t color;
371     Float_t r,g,b;
372     
373     for (k=1;k<=5;k++) {
374         switch(k) {
375         case 1:
376             for (i=1;i<=5;i++) {
377                 r=1.;
378                 g=i*0.2;  
379                 b=0.;
380                 color=i;
381                 color=700+23-color;
382                 new TColor(color,r,g,b);
383             } 
384             break;
385         case 2:
386             for (i=1;i<=4;i++) {
387                 r=1.1-i*0.2;
388                 g=1.;  
389                 b=0.;
390                 color=i+5;
391                 color=700+23-color;
392                 new TColor(color,r,g,b);
393             } 
394             break;
395     case 3:
396         for (i=1;i<=4;i++) {
397             r=0.;
398             g=1.;  
399             b=i*0.2+0.2;
400             color=i+9;
401             color=700+23-color;
402             new TColor(color,r,g,b);
403         } 
404         break;
405         case 4:
406             for (i=1;i<=4;i++) {
407                 r=0.;
408                 g=1.1-i*0.2;  
409                 b=1.;
410                 color=i+13;
411                 color=700+23-color;
412                 new TColor(color,r,g,b);
413             } 
414             break;
415         case 5:
416             for (i=1;i<=5;i++) {
417                 r=i*0.2;
418                 g=0.;  
419                 b=1.;
420                 color=i+17;
421                 color=700+23-color;
422                 new TColor(color,r,g,b);
423             } 
424             break;
425         }
426     }
427 }
428
429 //_____________________________________________________________________________
430 void AliRICHDisplay::DisplayColorScale()
431 {
432
433 // Draw the color scale in the RICH display canvas
434     
435     Int_t i;
436     Int_t color;
437     Float_t xlow, ylow, xup, yup, hs;
438     Float_t x1, y1, x2, y2;
439     x1 = y1 = 0;
440     x2 = y2 = 20;
441     
442     gPad->SetFillColor(0);
443     gPad->Clear();
444     gPad->Range(x1,y1,x2,y2);
445     TText *text = new TText(0,0,"");
446     text->SetTextFont(61);
447     text->SetTextSize(0.03);
448     text->SetTextAlign(22);
449     
450     TBox *box;
451     char label[8];
452 //*-* draw colortable boxes
453     hs = (y2-y1)/Float_t(22);
454     xlow=x1+1;
455     xup=x2-9;
456     for (i=0;i<22;i++) {
457         ylow = y1 + hs*(Float_t(i));
458         yup  = y1 + hs*(Float_t(i+1));
459         color = 701+i;
460         Double_t logscale=Double_t(i+1)*(TMath::Log(adc_satm)/22);
461         Int_t scale=(Int_t)TMath::Exp(logscale);
462         sprintf(label,"%d",scale);
463         box = new TBox(xlow, ylow, xup, yup);
464         box->SetFillColor(color);
465         box->Draw();
466         text->DrawText(xup+4, 0.5*(ylow+yup),label);
467     }
468 }
469
470 //______________________________________________________________________________
471 Int_t AliRICHDisplay::DistancetoPrimitive(Int_t px, Int_t)
472 {
473 // Compute distance from point px,py to objects in event
474     
475     gPad->SetCursor(kCross);
476     
477     if (gPad == fTrigPad) return 9999;
478     
479     const Int_t kBig = 9999;
480     Int_t dist   = kBig;
481     Float_t xmin = gPad->GetX1();
482     Float_t xmax = gPad->GetX2();
483     Float_t dx   = 0.02*(xmax - xmin);
484     Float_t x    = gPad->AbsPixeltoX(px);
485     if (x < xmin+dx || x > xmax-dx) return dist;
486     if (fZoomMode) return 0;
487     else           return 7;
488 }
489
490 //_____________________________________________________________________________
491 void AliRICHDisplay::Draw(Option_t *)
492 {
493 //    Display current event
494
495     fPad->cd();
496     
497     DrawView(fTheta, fPhi, fPsi);      // see how to draw PGON+inner frames
498     
499     // Display the event number and title
500     fPad->cd();
501     DrawTitle();
502 }
503
504 //_____________________________________________________________________________
505 void AliRICHDisplay::DrawCoG()
506 {
507 //    Draw hits for RICH chambers
508
509     if (!fDrawCoG) return;
510     ResetRpoints();
511     for (Int_t chamber=0;chamber<kNCH;chamber++) {
512         LoadCoG(chamber,1);
513     }
514     
515     Int_t ncog, icog;
516     TObjArray *points;
517     AliRICHPoints *pm;
518     points = fRpoints;
519     if (!points) return;
520     ncog = points->GetEntriesFast();
521     for (icog=0; icog < ncog; icog++) {
522         pm = (AliRICHPoints*)points->UncheckedAt(icog);
523         if (!pm) continue;
524         pm->Draw();
525     }
526 }
527
528 void AliRICHDisplay::DrawRecHits()
529 {
530 //    Draw rec hits for RICH chambers
531
532     if (!fDrawRecHits) return;
533     //ResetRecpoints();
534     for (Int_t chamber=0;chamber<kNCH;chamber++) {
535         LoadRecHits(chamber,1);
536     }
537     
538     Int_t nrec, irec;
539     TObjArray *points;
540     AliRICHPoints *pm;
541     points = fRecpoints;
542     if (!points) return;
543     nrec = points->GetEntriesFast();
544     //printf("Nrec %d\n",nrec);
545     for (irec=0; irec < nrec; irec++) {
546         pm = (AliRICHPoints*)points->UncheckedAt(irec);
547         if (!pm) continue;
548         pm->Draw();
549     }
550 }
551
552 //_____________________________________________________________________________
553
554 void AliRICHDisplay::DrawCerenkovs()
555 {
556 //    Draw cerenkovs hits for RICH chambers
557     
558     LoadCerenkovs(fChamber);
559     //printf("\nDrawCerenkovs\n");
560     
561     Int_t ntracks, track;
562     TObjArray *cpoints;
563     AliRICHPoints *pm;
564     
565     fHitsCuts = 0;
566     cpoints = fPCerenkovs;
567     //printf ("Cpoints: %p",cpoints);
568     if (!cpoints) return;
569     ntracks = cpoints->GetEntriesFast();
570     //printf("DrawCerenkovs - ntracks %d \n",ntracks);
571     for (track=0;track<ntracks;track++) {
572         pm = (AliRICHPoints*)cpoints->UncheckedAt(track);
573         if (!pm) continue;
574         pm->Draw();
575         fHitsCuts += pm->GetN();
576     }
577 }
578
579 //_____________________________________________________________________________
580
581 void AliRICHDisplay::DrawClusters()
582 {
583 //    Draw clusterss for RICH chambers
584     
585     Int_t ndigits, digit;
586     TObjArray *points;
587     AliRICHPoints *pm;
588     
589     fClustersCuts = 0;
590     points = fPoints;
591     if (!points) return;
592     ndigits = points->GetEntriesFast();
593     for (digit=0;digit<ndigits;digit++){
594         pm = (AliRICHPoints*)points->UncheckedAt(digit);
595         if (!pm) continue;
596         pm->Draw();
597         Float_t *pxyz;
598         pxyz=pm->GetP();
599         for (Int_t im=0;im<3;im++) {
600             TMarker3DBox *marker=pm->GetMarker(im);
601             if (marker)
602                 marker->Draw();
603         }
604         fClustersCuts +=pm->GetN();
605     }
606 }
607
608 //_____________________________________________________________________________
609 void AliRICHDisplay::DrawHits()
610 {
611 //    Draw hits for RICH chambers
612     
613     LoadHits(fChamber);
614     
615     Int_t ntracks, track;
616     TObjArray *points;
617     AliRICHPoints *pm;
618     
619     fHitsCuts = 0;
620     points = Phits();
621     if (!fPhits) return;
622 //    ntracks = points->GetEntriesFast();
623     ntracks = fPhits->GetEntriesFast();
624     
625     //printf("DrawHits - ntracks %d \n",ntracks);
626     for (track=0;track<ntracks;track++) {
627         pm = (AliRICHPoints*)fPhits->UncheckedAt(track);
628         if (!pm) continue;
629         pm->Draw();
630         fHitsCuts += pm->GetN();
631     }
632 }
633
634
635 //_____________________________________________________________________________
636 void AliRICHDisplay::DrawTitle(Option_t *option)
637 {
638 //    Draw the event title
639     
640     Float_t xmin = gPad->GetX1();
641     Float_t xmax = gPad->GetX2();
642     Float_t ymin = gPad->GetY1();
643     Float_t ymax = gPad->GetY2();
644     Float_t dx   = xmax-xmin;
645     Float_t dy   = ymax-ymin;
646     
647     if (strlen(option) == 0) {
648         TPaveText *title = new TPaveText(xmin +0.01*dx, ymax-0.09*dy, xmin +0.5*dx, ymax-0.01*dy);
649         title->SetBit(kCanDelete);
650         title->SetFillColor(42);
651         title->Draw();
652         char ptitle[100];
653         sprintf(ptitle,"Alice event: %d, Run:%d",
654                 gAlice->GetHeader()->GetEvent(), gAlice->GetHeader()->GetRun());
655         title->AddText(ptitle);
656         Int_t nparticles = gAlice->Particles()->GetEntriesFast();
657         sprintf(ptitle,"Nparticles = %d Nhits = %d Npads fired = %d",
658                 nparticles, fHitsCuts,fClustersCuts);
659         title->AddText(ptitle);
660     } else {
661         TPaveLabel *label = 
662             new TPaveLabel(xmin +0.01*dx, ymax-0.07*dy, xmin +0.2*dx, ymax-0.01*dy,option);
663         label->SetBit(kCanDelete);
664         label->SetFillColor(42);
665         label->Draw();
666     }
667 }
668
669 //_____________________________________________________________________________
670 void AliRICHDisplay::DrawView(Float_t theta, Float_t phi, Float_t psi)
671 {
672 //    Draw a view of RICH clusters
673     
674    gPad->SetCursor(kWatch);
675    gPad->SetFillColor(1);
676    gPad->Clear();
677    
678    Int_t iret;
679    TView *view = new TView(1);
680    Float_t range = fRrange*fRangeSlider->GetMaximum();
681    view->SetRange(-range,-range,-range,range, range, range);
682    fZoomX0[0] = -1;
683    fZoomY0[0] = -1;
684    fZoomX1[0] =  1;
685    fZoomY1[0] =  1;
686    fZooms = 0;
687    
688    //Display RICH Chamber Geometry
689    gAlice->GetGeometry()->Draw("same");
690    
691    //add clusters to the pad
692    DrawClusters();
693    //DrawHits();
694 //   DrawCerenkovs();
695    if (gAlice->TreeR())
696      {
697        //printf("Calling DrawCoG\n");
698        DrawCoG();
699        //printf("Calling DrawRecHits\n");
700        DrawRecHits();
701      }
702    /*for (Int_t i=0;i<7;i++)
703      LoadRecHits(i,1);*/
704    
705    // add itself to the list (must be last)
706    AppendPad();
707    
708    view->SetView(phi, theta, psi, iret);
709 }
710
711 //______________________________________________________________________________
712 void AliRICHDisplay::ExecuteEvent(Int_t event, Int_t px, Int_t py)
713 {
714 //  Execute action corresponding to the mouse event
715     
716     static Float_t x0, y0, x1, y1;
717     
718    static Int_t pxold, pyold;
719    static Int_t px0, py0;
720    static Int_t linedrawn;
721    Float_t temp;
722    
723    if (px == 0 && py == 0) { //when called by sliders
724        if (event == kButton1Up) {
725          printf("Drawing event %d\n",event);
726          Draw();
727        }
728        return;
729    }
730    if (!fZoomMode && gPad->GetView()) {
731        gPad->GetView()->ExecuteRotateView(event, px, py);
732        return;
733    }
734
735    // something to zoom ?
736    gPad->SetCursor(kCross);
737    
738    switch (event) {
739        
740    case kButton1Down:
741        gVirtualX->SetLineColor(-1);
742        gPad->TAttLine::Modify();  //Change line attributes only if necessary
743        x0 = gPad->AbsPixeltoX(px);
744        y0 = gPad->AbsPixeltoY(py);
745        px0   = px; py0   = py;
746        pxold = px; pyold = py;
747        linedrawn = 0;
748        return;
749        
750    case kButton1Motion:
751        if (linedrawn) gVirtualX->DrawBox(px0, py0, pxold, pyold, TVirtualX::kHollow);
752        pxold = px;
753        pyold = py;
754        linedrawn = 1;
755        gVirtualX->DrawBox(px0, py0, pxold, pyold, TVirtualX::kHollow);
756        return;
757        
758    case kButton1Up:
759        gPad->GetCanvas()->FeedbackMode(kFALSE);
760        if (px == px0) return;
761        if (py == py0) return;
762        x1 = gPad->AbsPixeltoX(px);
763        y1 = gPad->AbsPixeltoY(py);
764        
765        if (x1 < x0) {temp = x0; x0 = x1; x1 = temp;}
766        if (y1 < y0) {temp = y0; y0 = y1; y1 = temp;}
767        gPad->Range(x0,y0,x1,y1);
768        if (fZooms < kMAXZOOM-1) {
769            fZooms++;
770            fZoomX0[fZooms] = x0;
771            fZoomY0[fZooms] = y0;
772            fZoomX1[fZooms] = x1;
773            fZoomY1[fZooms] = y1;
774        }
775        gPad->Modified(kTRUE);
776        return;
777    }
778    
779 }
780 //___________________________________________
781 void AliRICHDisplay::LoadCoG(Int_t chamber, Int_t cathode)
782 {
783 // Read raw clusters info and store x,y,z info in arrays fRpoints
784 // Loop on all detectors
785
786    if (chamber > 6) return;
787
788    //printf("Entering LoadCoG\n");
789
790
791    AliRICH *pRICH  = (AliRICH*)gAlice->GetModule("RICH");
792    AliRICHChamber*  iChamber;
793
794    TClonesArray *pRICHrawclust  = pRICH->RawClustAddress(chamber);
795    //printf ("Chamber:%d has adress:%p\n", chamber, pRICHrawclust );
796    if (pRICHrawclust == 0) return;
797
798    pRICH->ResetRawClusters();
799
800
801    Int_t nent=(Int_t)gAlice->TreeR()->GetEntries();
802    gAlice->TreeR()->GetEvent(nent-1+cathode-1);
803    Int_t nrawcl = pRICHrawclust->GetEntriesFast();
804    //printf ("nrawcl:%d\n",nrawcl);
805    if (nrawcl == 0) return;
806    if (fRpoints == 0) fRpoints = new TObjArray(nrawcl);
807    
808    iChamber = &(pRICH->Chamber(chamber));
809    AliRICHRawCluster  *mRaw;
810    AliRICHPoints *points = 0;
811    //
812    //loop over all raw clusters and store their position
813    points = new AliRICHPoints(nrawcl);
814    for (Int_t iraw=0;iraw<nrawcl;iraw++) {
815        mRaw   = (AliRICHRawCluster*)pRICHrawclust->UncheckedAt(iraw);
816        fRpoints->AddAt(points,iraw);
817        points->SetMarkerColor(3);
818        points->SetMarkerStyle(3);
819        points->SetMarkerSize(1.);
820        points->SetParticle(-1);
821        points->SetHitIndex(-1);
822        points->SetTrackIndex(-1);
823        points->SetDigitIndex(-1);
824        Float_t  vectorLoc[3]={mRaw->fX,5,mRaw->fY};
825        Float_t  vectorGlob[3];
826        iChamber->LocaltoGlobal(vectorLoc,vectorGlob);
827        points->SetPoint(iraw,vectorGlob[0],vectorGlob[1],vectorGlob[2]);
828    }
829 }
830 //___________________________________________
831 void AliRICHDisplay::LoadRecHits(Int_t chamber, Int_t cathode)
832 {
833 // Read rec. hits info 
834 // Loop on all detectors
835
836    if (chamber > 6) return;
837
838    ///printf("Entering LoadRecHits\n");
839
840
841    AliRICH *pRICH  = (AliRICH*)gAlice->GetModule("RICH");
842    AliRICHChamber*  iChamber;
843
844    TClonesArray *pRICHrechits1D  = pRICH->RecHitsAddress1D(chamber);
845    //printf ("Chamber:%d\n", chamber);
846    if (pRICHrechits1D != 0)
847      {
848
849        //RICH->ResetRecHits();
850
851
852        Int_t nent1D=(Int_t)gAlice->TreeR()->GetEntries();
853        gAlice->TreeR()->GetEvent(nent1D-1+cathode-1);
854        Int_t nrechits1D = pRICHrechits1D->GetEntriesFast();
855        //printf ("nrechits1D:%d\n",nrechits1D);
856        if (nrechits1D != 0)
857          {
858            if (fRecpoints == 0) fRecpoints = new TObjArray(50);
859            
860            iChamber = &(pRICH->Chamber(chamber));
861            AliRICHRecHit1D  *mRec1D;
862            AliRICHPoints *points1D = 0;
863            //AliRICHEllipse *ellipse = 0;
864            //
865            //loop over all rechits and store their position  
866            
867            points1D = new AliRICHPoints(nrechits1D);
868            for (Int_t irec=0;irec<nrechits1D;irec++) {
869              mRec1D   = (AliRICHRecHit1D*)pRICHrechits1D->UncheckedAt(irec);
870              fRecpoints->AddAt(points1D,irec);
871              points1D->SetMarkerColor(38);
872              points1D->SetMarkerStyle(8);
873              points1D->SetMarkerSize(1.);
874              points1D->SetParticle(-1);
875              points1D->SetHitIndex(-1);
876              points1D->SetTrackIndex(-1);
877              points1D->SetDigitIndex(-1);
878              Float_t  vectorLoc[3]={mRec1D->fX,5,mRec1D->fY};
879              Float_t  vectorGlob[3];
880              iChamber->LocaltoGlobal(vectorLoc,vectorGlob);
881              points1D->SetPoint(irec,vectorGlob[0],vectorGlob[1],vectorGlob[2]);
882              //Float_t theta = iChamber->GetRotMatrix()->GetTheta();
883              //Float_t phi   = iChamber->GetRotMatrix()->GetPhi();         
884              //ellipse=new TEllipse(vectorGlob[0],vectorGlob[2],10,10,0,360,phi);
885              //printf("Generating ellipse %d\n",irec);
886              AliRICHEllipse *ellipse=new AliRICHEllipse(mRec1D->fX,mRec1D->fY,mRec1D->fOmega,mRec1D->fTheta,mRec1D->fPhi,mRec1D->fEmissPoint);
887              printf("Ring at x:%f, y:%f - Omega:%f rad, theta:%3.1f deg, phi:%3.1f deg\n",mRec1D->fX,mRec1D->fY,mRec1D->fOmega,mRec1D->fTheta*180/TMath::Pi(),mRec1D->fPhi*180/TMath::Pi());
888              printf("fEmissPoint:%f\n",mRec1D->fEmissPoint);
889              ellipse->CerenkovRingDrawing(chamber,irec);
890              //ellipse->SetFillStyle(1001);
891              ellipse->SetMarkerColor(38);
892              ellipse->Draw();
893              //marker->SetRefObject((TObject*)points1D);
894              //points1D->Set3DMarker(0, marker); 
895            }
896          }
897      }
898
899    TClonesArray *pRICHrechits3D  = pRICH->RecHitsAddress3D(chamber);
900    //printf ("Chamber:%d\n", chamber);
901    if (pRICHrechits3D != 0)
902      {
903        
904        //RICH->ResetRecHits();
905        
906        
907        Int_t nent3D=(Int_t)gAlice->TreeR()->GetEntries();
908        gAlice->TreeR()->GetEvent(nent3D-1+cathode-1);
909        Int_t nrechits3D = pRICHrechits3D->GetEntriesFast();
910        //printf ("nrechits3D:%d\n",nrechits3D);
911        if (nrechits3D != 0)
912          {
913            if (fRecpoints == 0) fRecpoints = new TObjArray(50);
914            
915            iChamber = &(pRICH->Chamber(chamber));
916            AliRICHRecHit3D  *mRec3D;
917            AliRICHPoints *points3D = 0;
918            //AliRICHEllipse *ellipse = 0;
919            //
920            //loop over all rechits and store their position  
921            
922            points3D = new AliRICHPoints(nrechits3D);
923            for (Int_t irec=0;irec<nrechits3D;irec++) {
924              mRec3D   = (AliRICHRecHit3D*)pRICHrechits3D->UncheckedAt(irec);
925              fRecpoints->AddAt(points3D,irec);
926              points3D->SetMarkerColor(42);
927              points3D->SetMarkerStyle(8);
928              points3D->SetMarkerSize(1.);
929              points3D->SetParticle(-1);
930              points3D->SetHitIndex(-1);
931              points3D->SetTrackIndex(-1);
932              points3D->SetDigitIndex(-1);
933              Float_t  vectorLoc[3]={mRec3D->fX,5,mRec3D->fY};
934              Float_t  vectorGlob[3];
935              iChamber->LocaltoGlobal(vectorLoc,vectorGlob);
936              points3D->SetPoint(irec,vectorGlob[0],vectorGlob[1],vectorGlob[2]);
937              //Float_t theta = iChamber->GetRotMatrix()->GetTheta();
938              //Float_t phi   = iChamber->GetRotMatrix()->GetPhi();         
939              //ellipse=new TEllipse(vectorGlob[0],vectorGlob[2],10,10,0,360,phi);
940              //printf("Generating ellipse %d\n",irec);
941              AliRICHEllipse *ellipse=new AliRICHEllipse(mRec3D->fX,mRec3D->fY,mRec3D->fOmega,mRec3D->fTheta,mRec3D->fPhi,0.75);
942              printf("Ring at x:%f, y:%f - Omega:%f rad, theta:%3.1f deg, phi:%3.1f deg\n",mRec3D->fX,mRec3D->fY,mRec3D->fOmega,mRec3D->fTheta*180/TMath::Pi(),mRec3D->fPhi*180/TMath::Pi());
943              ellipse->CerenkovRingDrawing(chamber,irec);
944              //ellipse->SetFillStyle(1001);
945              ellipse->SetMarkerColor(42);
946              ellipse->Draw();
947              //marker->SetRefObject((TObject*)points3D);
948              //points3D->Set3DMarker(0, marker); 
949            }
950          }
951      }
952 }
953 //___________________________________________
954 void AliRICHDisplay::LoadDigits()
955 {
956 // Read digits info and store x,y,z info in arrays fPoints
957 // Loop on all detectors
958     
959    ResetPoints();
960    AliRICH *pRICH  = (AliRICH*)gAlice->GetDetector("RICH");
961    AliRICHChamber*       iChamber;
962    AliSegmentation*      segmentation;
963    Int_t nAllDigits=0;
964    Int_t ich;
965
966    //printf("Entering LoadDigits\n");
967
968    if (gAlice->TreeD())
969      {
970    
971        for (ich=0; ich<kNCH; ich++) {
972          TClonesArray *pRICHdigits  = pRICH->DigitsAddress(ich);
973          //printf ("Chamber:%d has adress:%p\n", ich, pRICHdigits );
974          if (pRICHdigits == 0) continue;
975          gAlice->ResetDigits();
976          gAlice->TreeD()->GetEvent(0);
977          Int_t ndigits = pRICHdigits->GetEntriesFast();
978          //printf("ndigits:%d\n",ndigits);
979          nAllDigits+=ndigits;
980        }
981        
982        if (fPoints == 0) fPoints = new TObjArray(nAllDigits);   
983        Int_t counter=0;
984        for (ich=0; ich<kNCH; ich++) {
985          TClonesArray *pRICHdigits  = pRICH->DigitsAddress(ich);
986          if (pRICHdigits == 0) continue;
987          gAlice->ResetDigits();
988          gAlice->TreeD()->GetEvent(0);
989          Int_t ndigits = pRICHdigits->GetEntriesFast();
990          if (ndigits == 0) continue;
991          iChamber = &(pRICH->Chamber(ich));
992          segmentation=iChamber->GetSegmentationModel();
993          Float_t dpx  = segmentation->Dpx();
994          Float_t dpy  = segmentation->Dpy();
995          
996          //printf("Dpx:%d, Dpy:%d\n",dpx,dpy);
997          
998          AliRICHDigit  *mdig;
999          AliRICHPoints *points = 0;
1000          TMarker3DBox  *marker = 0;
1001          //
1002          //loop over all digits and store their position
1003          Int_t npoints=1;
1004          
1005          for (Int_t digit=0;digit<ndigits;digit++) {
1006            mdig    = (AliRICHDigit*)pRICHdigits->UncheckedAt(digit);
1007            points = new AliRICHPoints(npoints);
1008            fPoints->AddAt(points,counter);
1009            counter++;
1010            Int_t charge=mdig->fSignal;
1011            Int_t index=Int_t(TMath::Log(charge)/(TMath::Log(adc_satm)/22));
1012            Int_t color=701+index;
1013            if (color>722) color=722;
1014            points->SetMarkerColor(color);
1015            points->SetMarkerStyle(21);
1016            points->SetMarkerSize(0.5);
1017            Float_t xpad, ypad, zpad;
1018            segmentation->GetPadC(mdig->fPadX, mdig->fPadY,xpad, ypad, zpad);
1019            Float_t vectorLoc[3]={xpad,5,ypad};
1020            Float_t  vectorGlob[3];
1021            iChamber->LocaltoGlobal(vectorLoc,vectorGlob);
1022            points->SetParticle(-1);
1023            points->SetHitIndex(-1);
1024            points->SetTrackIndex(-1);
1025            points->SetDigitIndex(digit);
1026            points->SetPoint(0,vectorGlob[0],vectorGlob[1],vectorGlob[2]);
1027            //printf("Y position (digit): %f\n", vectorGlob[1]);
1028            
1029            segmentation->GetPadC(mdig->fPadX, mdig->fPadY, xpad, ypad, zpad);
1030            Float_t theta = iChamber->GetRotMatrix()->GetTheta();
1031            Float_t phi   = iChamber->GetRotMatrix()->GetPhi();     
1032            marker=new TMarker3DBox(vectorGlob[0],vectorGlob[1],vectorGlob[2],
1033                                    dpy/2,0,dpx/2,theta,phi);
1034            marker->SetLineColor(2);
1035            marker->SetFillStyle(1001);
1036            marker->SetFillColor(color);
1037            marker->SetRefObject((TObject*)points);
1038            points->Set3DMarker(0, marker);
1039          } // loop over digits
1040        } // loop over chambers 
1041      } //if TreeD
1042 }
1043
1044
1045 //___________________________________________
1046 void AliRICHDisplay::LoadHits(Int_t chamber)
1047 {
1048 // Read hits info and store x,y,z info in arrays fPhits
1049 // Loop on all detectors
1050     
1051     
1052     fChamber=chamber; 
1053     ResetPhits();
1054     
1055     AliRICH *pRICH  = (AliRICH*)gAlice->GetDetector("RICH");
1056     AliRICHChamber*  iChamber;
1057     
1058     iChamber = &(pRICH->Chamber(chamber-1));
1059     Int_t ntracks = (Int_t)gAlice->TreeH()->GetEntries();
1060     Int_t track;
1061     
1062     if (fPhits == 0) fPhits = new TObjArray(ntracks);
1063     //TVector *xp = new TVector(1000);
1064     //TVector *yp = new TVector(1000);
1065     //TVector *zp = new TVector(1000);
1066     //TVector *ptrk = new TVector(1000);
1067     //TVector *phit = new TVector(1000);
1068     Int_t nAllHits=0;
1069     for (track=0; track<ntracks;track++) {
1070         gAlice->ResetHits();
1071         gAlice->TreeH()->GetEvent(track);
1072         TClonesArray *pRICHhits  = pRICH->Hits();
1073         if (pRICHhits == 0) return;
1074         Int_t nhits = pRICHhits->GetEntriesFast();
1075         nAllHits+=nhits;
1076     }
1077
1078     fPhits = new TObjArray(nAllHits);
1079
1080     Int_t npoints=0;
1081     for (track=0; track<ntracks;track++) {
1082         gAlice->ResetHits();
1083         gAlice->TreeH()->GetEvent(track);
1084         TClonesArray *pRICHhits  = pRICH->Hits();
1085         if (pRICHhits == 0) return;
1086         Int_t nhits = pRICHhits->GetEntriesFast();
1087         if (nhits == 0) continue;
1088         AliRICHHit *mHit;
1089         AliRICHPoints *points = 0;
1090         for (Int_t hit=0;hit<nhits;hit++) {
1091             points = new AliRICHPoints(1);
1092             fPhits->AddAt(points,npoints);
1093             mHit = (AliRICHHit*)pRICHhits->UncheckedAt(hit);
1094             TParticle *current = (TParticle*)gAlice->Particle(mHit->Track());
1095             if (current->GetPdgCode() == 50000050) {
1096                 points->SetMarkerColor(kBlue);
1097             } else if (current->GetPdgCode() == 50000051) {
1098                 points->SetMarkerColor(kYellow);
1099             } else {
1100                 points->SetMarkerColor(kRed);
1101             }
1102             points->SetMarkerStyle(5);
1103             points->SetMarkerSize(1.);
1104             points->SetParticle(mHit->Track());
1105             points->SetHitIndex(hit);
1106             points->SetTrackIndex(track);
1107             points->SetDigitIndex(-1);
1108             points->SetPoint(hit,mHit->X(), mHit->Y(), mHit->Z());
1109             //printf("Y position: %f\n", mHit->Y());
1110             npoints++;
1111         }
1112     }
1113 }
1114
1115 //_____________________________________________________________________________
1116
1117 void AliRICHDisplay::LoadCerenkovs(Int_t chamber)
1118 {
1119 // Read cerenkov hits info and store x,y,z info in array fPCerenkovs
1120 // Loop on all detectors
1121     
1122     fChamber=chamber; 
1123     ResetPCerenkovs();
1124     
1125     AliRICH *pRICH  = (AliRICH*)gAlice->GetDetector("RICH");
1126     AliRICHChamber*  iChamber;
1127     
1128     iChamber = &(pRICH->Chamber(chamber-1));
1129     
1130     pRICH->SetTreeAddress();
1131     Int_t ntracks = (Int_t)gAlice->TreeH()->GetEntries();
1132     
1133     if (fPCerenkovs == 0) fPCerenkovs = new TObjArray(ntracks);
1134     TVector *xp = new TVector(1000);
1135     TVector *yp = new TVector(1000);
1136     TVector *zp = new TVector(1000);
1137     TVector *ptrk = new TVector(1000);
1138     TVector *phit = new TVector(1000);
1139     for (Int_t track=0; track<ntracks;track++) {
1140         gAlice->ResetHits();
1141         gAlice->TreeH()->GetEvent(track);
1142         TClonesArray *pRICHCerenkovs  = pRICH->Cerenkovs();
1143         if (pRICHCerenkovs == 0) return;
1144         Int_t nhits = pRICHCerenkovs->GetEntriesFast();
1145         if (nhits == 0) continue;
1146         AliRICHCerenkov *mCerenkov;
1147         AliRICHPoints *cpoints = 0;
1148         Int_t npoints=0;
1149         
1150         
1151 //Display Cerenkov hits in blue
1152         
1153         for (Int_t hit=0;hit<nhits;hit++) {
1154             mCerenkov = (AliRICHCerenkov*)pRICHCerenkovs->UncheckedAt(hit);
1155             (*xp)(npoints)=mCerenkov->X();
1156             (*yp)(npoints)=mCerenkov->Y();
1157             (*zp)(npoints)=mCerenkov->Z();
1158             (*ptrk)(npoints)=Float_t(mCerenkov->GetTrack());
1159             (*phit)(npoints)=Float_t(hit);
1160             npoints++;
1161         }
1162         if (npoints == 0) continue;
1163         cpoints = new AliRICHPoints(npoints);
1164         for (Int_t p=0;p<npoints;p++) {
1165             cpoints->SetMarkerColor(kBlue);
1166             cpoints->SetMarkerStyle(5);
1167             cpoints->SetMarkerSize(1.);
1168             cpoints->SetParticle(Int_t((*ptrk)(p)));
1169             cpoints->SetHitIndex(Int_t((*phit)(p)));
1170             cpoints->SetTrackIndex(track);
1171             cpoints->SetDigitIndex(-1);
1172             cpoints->SetPoint(p,(*xp)(p),(*yp)(p),(*zp)(p));
1173         }
1174         xp->Zero();
1175         yp->Zero();
1176         ptrk->Zero();
1177         phit->Zero();
1178         fPCerenkovs->AddAt(cpoints,track);
1179     }
1180 }
1181
1182 //_____________________________________________________________________________
1183 void AliRICHDisplay::Paint(Option_t *)
1184 {
1185 //    Paint miscellaneous items
1186
1187 }
1188
1189 //_____________________________________________________________________________
1190 void AliRICHDisplay::SetPickMode()
1191 {
1192
1193 // Toggle pick mode
1194
1195     fZoomMode = 0;
1196     
1197     fArcButton->SetY1(fPickButton->GetYlowNDC()+0.5*fPickButton->GetHNDC());
1198     fTrigPad->Modified();
1199 }
1200
1201 //_____________________________________________________________________________
1202 void AliRICHDisplay::SetZoomMode()
1203 {
1204
1205 // Toggle Zoom mode
1206
1207     fZoomMode = 1;
1208     
1209     fArcButton->SetY1(fZoomButton->GetYlowNDC()+0.5*fZoomButton->GetHNDC());
1210     fTrigPad->Modified();
1211 }
1212
1213 //_____________________________________________________________________________
1214 void AliRICHDisplay::SetChamberAndCathode(Int_t chamber, Int_t cathode)
1215 {
1216 // Set chamber and cathode number
1217     fChamber = chamber;
1218     fCathode = cathode;
1219     
1220     //printf("SetChamberAndCathode - fChamber fCathode %d %d\n",fChamber,fCathode);
1221     if (!fPad) return;
1222     fPad->Clear();
1223     LoadDigits();
1224     Draw();
1225 }
1226
1227 //_____________________________________________________________________________
1228 void AliRICHDisplay::SetRange(Float_t rrange, Float_t zrange)
1229 {
1230 // Set view range along R and Z
1231     fRrange = rrange;
1232     fZrange = zrange;
1233     
1234    if (!fPad) return;
1235    fPad->Clear();
1236    Draw();
1237 }
1238
1239 //_____________________________________________________________________________
1240 void AliRICHDisplay::SetView(Float_t theta, Float_t phi, Float_t psi)
1241 {
1242 //  change viewing angles for current event
1243     
1244     fPad->cd();
1245     fPhi   = phi;
1246     fTheta = theta;
1247     fPsi   = psi;
1248     Int_t iret = 0;
1249     
1250     TView *view = gPad->GetView();
1251     if (view) view->SetView(fPhi, fTheta, fPsi, iret);
1252     else      Draw();
1253     
1254     gPad->Modified();
1255 }
1256
1257 //_____________________________________________________________________________
1258 void AliRICHDisplay::ShowNextEvent(Int_t delta)
1259 {
1260 //  Display (current event_number+delta)
1261 //    delta =  1  shown next event
1262 //    delta = -1 show previous event
1263     
1264     if (delta) {
1265         gAlice->Clear();
1266         Int_t currentEvent = gAlice->GetHeader()->GetEvent();
1267         Int_t newEvent     = currentEvent + delta;
1268         gAlice->GetEvent(newEvent);
1269         if (!gAlice->TreeD()) return; 
1270     }
1271     LoadDigits();
1272     DrawClusters();
1273     fPad->cd(); 
1274     Draw();
1275
1276   
1277 }
1278
1279 //______________________________________________________________________________
1280 void AliRICHDisplay::UnZoom()
1281 {
1282
1283 // Return to previous zoom factor
1284
1285     if (fZooms <= 0) return;
1286     fZooms--;
1287     TPad *pad = (TPad*)gPad->GetPadSave();
1288     pad->Range(fZoomX0[fZooms],fZoomY0[fZooms], fZoomX1[fZooms],fZoomY1[fZooms]);
1289     pad->Modified();
1290 }
1291
1292 //_____________________________________________________________________________
1293 void AliRICHDisplay::ResetPoints()
1294 {
1295     //
1296     // Reset array of points
1297     //
1298     if (fPoints) {
1299         fPoints->Delete();
1300         delete fPoints;
1301         fPoints = 0;
1302   }
1303 }
1304 //_____________________________________________________________________________
1305 void AliRICHDisplay::ResetRpoints()
1306 {
1307   //
1308   // Reset array of points
1309   //
1310   if (fRpoints) {
1311     fRpoints->Delete();
1312     delete fRpoints;
1313     fRpoints = 0;
1314   }
1315 }
1316 //_____________________________________________________________________________
1317 void AliRICHDisplay::ResetRecpoints()
1318 {
1319   //
1320   // Reset array of points
1321   //
1322   if (fRecpoints) {
1323     fRecpoints->Delete();
1324     delete fRecpoints;
1325     fRecpoints = 0;
1326   }
1327 }
1328 //_____________________________________________________________________________
1329 void AliRICHDisplay::ResetPhits()
1330 {
1331     //
1332     // Reset array of points
1333     //
1334     if (fPhits) {
1335         fPhits->Delete();
1336         delete fPhits;
1337         fPhits = 0;
1338     }
1339 }
1340 //_____________________________________________________________________________
1341 void AliRICHDisplay::ResetPCerenkovs()
1342 {
1343     //
1344     // Reset array of points
1345     //
1346     if (fPCerenkovs) {
1347         fPCerenkovs->Delete();
1348         delete fPCerenkovs;
1349         fPCerenkovs = 0;
1350     }
1351 }
1352
1353 //_____________________________________________________________________________
1354
1355 void AliRICHDisplay::DrawViewGL()
1356 {
1357 //    Draw current view using OPENGL
1358
1359    TPad *pad = (TPad*)gPad->GetPadSave();
1360    pad->cd();
1361    TView *view = pad->GetView();
1362    if (!view) return;
1363    pad->x3d("OPENGL");
1364 }
1365
1366 //_____________________________________________________________________________
1367 void AliRICHDisplay::DrawViewX3D()
1368 {
1369 //    Draw current view using X3D
1370
1371    TPad *pad = (TPad*)gPad->GetPadSave();
1372    pad->cd();
1373    TView *view = pad->GetView();
1374    if (!view) return;
1375    pad->x3d();
1376 }