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