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