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