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