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