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