1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 Revision 1.8 2000/10/03 21:44:09 morsch
19 Use AliSegmentation and AliHit abstract base classes.
21 Revision 1.7 2000/10/02 21:28:12 fca
22 Removal of useless dependecies via forward declarations
24 Revision 1.6 2000/10/02 15:46:38 jbarbosa
25 Fixed forward declarations.
27 Revision 1.5 2000/06/30 16:49:34 dibari
28 Different call for ring drawing.
30 Revision 1.4 2000/06/12 15:21:08 jbarbosa
33 Revision 1.3 2000/06/09 14:52:08 jbarbosa
34 New tentative ellipse drawing routine
36 Revision 1.1 2000/04/19 13:07:45 morsch
37 Digits, clusters and reconstruction results added.
42 //////////////////////////////////////////////////////////////////////////
46 // Utility class to display ALICE outline, tracks, hits,.. //
48 //////////////////////////////////////////////////////////////////////////
57 #include <TPolyMarker3D.h>
60 #include <TPolyMarker.h>
61 #include <TPaveLabel.h>
62 #include <TPaveText.h>
69 #include <TGeometry.h>
70 #include <TSliderBox.h>
72 #include <TVirtualX.h>
75 #include <X3DBuffer.h>
76 #include <TParticle.h>
80 #include "AliDetector.h"
82 #include "AliRICHConst.h"
83 #include "AliRICHDisplay.h"
84 #include "AliRICHPoints.h"
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"
95 ClassImp(AliRICHDisplay)
98 //____________________________________________________________________________
99 AliRICHDisplay::AliRICHDisplay()
102 // default constructor
112 //_____________________________________________________________________________
113 AliRICHDisplay::AliRICHDisplay(Int_t size)
115 // Create an event display object.
116 // A canvas named "edisplay" is created with a vertical size in pixels
118 // A QUICK Overview of the Event Display functions
119 // ===============================================
121 // The event display can ve invoked by executing the macro "display.C"
122 // A canvas like in the picture below will appear.
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
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.
136 // slider R On the left side, the vertical slider can be used to
137 // set the default picture size.
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.
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.
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.
155 // Click on TPC for example
156 // Click on any variable (eg TPC.fX) to histogram the variable.
158 // If you are lost, you can click on HELP in any Root canvas or browser.
161 <img src="gif/AliRICHDisplay.gif">
168 gAlice->SetDisplay(this);
170 // Initialize display default parameters
173 // Set front view by default
180 fDrawClusters = kTRUE;
182 fDrawRecHits = kTRUE;
193 // Create display canvas
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();
200 // Create main display pad
201 fPad = new TPad("viewpad", "RICH display",0.15,0,0.9,1);
204 fPad->SetFillColor(1);
205 fPad->SetBorderSize(2);
210 fColPad = new TPad("colpad", "Colors pad",0.9,0,1,1);
213 fColPad->SetFillColor(19);
214 fColPad->SetBorderSize(2);
220 // Create user interface control pad
224 // Create Range and mode pad
227 fTrigPad = new TPad("trigger", "range and mode pad",0,0,dxtr,dytr);
228 fTrigPad->SetEditable(kFALSE);
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()";
237 fPickButton = new TButton("Pick",pickmode,0.05,0.32,0.65,0.32+db);
238 fPickButton->SetFillColor(38);
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);
244 fArcButton = new TArc(.8,fZoomButton->GetYlowNDC()+0.5*db,0.33*db);
245 fArcButton->SetFillColor(kGreen);
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);
251 AppendPad(); // append display object as last object to force selection
258 //_____________________________________________________________________________
259 AliRICHDisplay::~AliRICHDisplay()
261 // Delete space point structure
262 if (fPoints) fPoints->Delete();
266 if (fPhits) fPhits->Delete();
270 if (fRpoints) fRpoints->Delete();
274 if (fRecpoints) fRecpoints->Delete();
278 if (fPCerenkovs) fPCerenkovs->Delete();
283 //_____________________________________________________________________________
284 void AliRICHDisplay::Clear(Option_t *)
286 // Delete graphics temporary objects
289 //_____________________________________________________________________________
290 void AliRICHDisplay::DisplayButtons()
292 // Create the user interface buttons
295 fButtons = new TPad("buttons", "newpad",0,0.45,0.15,1);
296 fButtons->SetEditable(kFALSE);
298 fButtons->SetFillColor(38);
299 fButtons->SetBorderSize(2);
302 // Int_t butcolor = 33;
303 Float_t dbutton = 0.08;
310 char but1[] = "gAlice->Display()->ShowNextEvent(1)";
311 button = new TButton("Next",but1,x0,y-dbutton,x1,y);
312 button->SetFillColor(38);
316 char but2[] = "gAlice->Display()->ShowNextEvent(-1)";
317 button = new TButton("Previous",but2,x0,y-dbutton,x1,y);
318 button->SetFillColor(38);
322 char but7[] = "gAlice->Display()->DrawViewGL()";
323 button = new TButton("OpenGL",but7,x0,y-dbutton,x1,y);
324 button->SetFillColor(38);
328 char but8[] = "gAlice->Display()->DrawViewX3D()";
329 button = new TButton("X3D",but8,x0,y-dbutton,x1,y);
330 button->SetFillColor(38);
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);
340 diamond->AddText(".. ");
341 diamond->AddText("ROOT");
342 diamond->AddText("RICH");
343 diamond->AddText("... ");
344 diamond->AddText(" ");
347 //_____________________________________________________________________________
348 void AliRICHDisplay::CreateColors()
350 // Create the colors palette used to display clusters
365 new TColor(color,r,g,b);
375 new TColor(color,r,g,b);
385 new TColor(color,r,g,b);
395 new TColor(color,r,g,b);
405 new TColor(color,r,g,b);
412 //_____________________________________________________________________________
413 void AliRICHDisplay::DisplayColorScale()
416 // Draw the color scale in the RICH display canvas
420 Float_t xlow, ylow, xup, yup, hs;
421 Float_t x1, y1, x2, y2;
425 gPad->SetFillColor(0);
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);
435 //*-* draw colortable boxes
436 hs = (y2-y1)/Float_t(22);
440 ylow = y1 + hs*(Float_t(i));
441 yup = y1 + hs*(Float_t(i+1));
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);
449 text->DrawText(xup+4, 0.5*(ylow+yup),label);
453 //______________________________________________________________________________
454 Int_t AliRICHDisplay::DistancetoPrimitive(Int_t px, Int_t)
456 // Compute distance from point px,py to objects in event
458 gPad->SetCursor(kCross);
460 if (gPad == fTrigPad) return 9999;
462 const Int_t kBig = 9999;
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;
473 //_____________________________________________________________________________
474 void AliRICHDisplay::Draw(Option_t *)
476 // Display current event
480 DrawView(fTheta, fPhi, fPsi); // see how to draw PGON+inner frames
482 // Display the event number and title
487 //_____________________________________________________________________________
488 void AliRICHDisplay::DrawCoG()
490 // Draw hits for RICH chambers
492 if (!fDrawCoG) return;
494 for (Int_t chamber=0;chamber<kNCH;chamber++) {
503 ncog = points->GetEntriesFast();
504 for (icog=0; icog < ncog; icog++) {
505 pm = (AliRICHPoints*)points->UncheckedAt(icog);
511 void AliRICHDisplay::DrawRecHits()
513 // Draw rec hits for RICH chambers
515 if (!fDrawRecHits) return;
517 for (Int_t chamber=0;chamber<kNCH;chamber++) {
518 LoadRecHits(chamber,1);
526 nrec = points->GetEntriesFast();
527 printf("Nrec %d\n",nrec);
528 for (irec=0; irec < nrec; irec++) {
529 pm = (AliRICHPoints*)points->UncheckedAt(irec);
535 //_____________________________________________________________________________
537 void AliRICHDisplay::DrawCerenkovs()
539 // Draw cerenkovs hits for RICH chambers
541 LoadCerenkovs(fChamber);
542 //printf("\nDrawCerenkovs\n");
544 Int_t ntracks, track;
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);
558 fHitsCuts += pm->GetN();
562 //_____________________________________________________________________________
564 void AliRICHDisplay::DrawClusters()
566 // Draw clusterss for RICH chambers
568 Int_t ndigits, digit;
575 ndigits = points->GetEntriesFast();
576 for (digit=0;digit<ndigits;digit++){
577 pm = (AliRICHPoints*)points->UncheckedAt(digit);
582 for (Int_t im=0;im<3;im++) {
583 TMarker3DBox *marker=pm->GetMarker(im);
587 fClustersCuts +=pm->GetN();
591 //_____________________________________________________________________________
592 void AliRICHDisplay::DrawHits()
594 // Draw hits for RICH chambers
598 Int_t ntracks, track;
605 // ntracks = points->GetEntriesFast();
606 ntracks = fPhits->GetEntriesFast();
608 //printf("DrawHits - ntracks %d \n",ntracks);
609 for (track=0;track<ntracks;track++) {
610 pm = (AliRICHPoints*)fPhits->UncheckedAt(track);
613 fHitsCuts += pm->GetN();
618 //_____________________________________________________________________________
619 void AliRICHDisplay::DrawTitle(Option_t *option)
621 // Draw the event title
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;
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);
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);
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);
652 //_____________________________________________________________________________
653 void AliRICHDisplay::DrawView(Float_t theta, Float_t phi, Float_t psi)
655 // Draw a view of RICH clusters
657 gPad->SetCursor(kWatch);
658 gPad->SetFillColor(1);
662 TView *view = new TView(1);
663 Float_t range = fRrange*fRangeSlider->GetMaximum();
664 view->SetRange(-range,-range,-range,range, range, range);
671 //Display RICH Chamber Geometry
672 gAlice->GetGeometry()->Draw("same");
674 //add clusters to the pad
678 printf("Calling DrawCoG\n");
680 printf("Calling DrawRecHits\n");
682 /*for (Int_t i=0;i<7;i++)
685 // add itself to the list (must be last)
688 view->SetView(phi, theta, psi, iret);
691 //______________________________________________________________________________
692 void AliRICHDisplay::ExecuteEvent(Int_t event, Int_t px, Int_t py)
694 // Execute action corresponding to the mouse event
696 static Float_t x0, y0, x1, y1;
698 static Int_t pxold, pyold;
699 static Int_t px0, py0;
700 static Int_t linedrawn;
703 if (px == 0 && py == 0) { //when called by sliders
704 if (event == kButton1Up) {
709 if (!fZoomMode && gPad->GetView()) {
710 gPad->GetView()->ExecuteRotateView(event, px, py);
714 // something to zoom ?
715 gPad->SetCursor(kCross);
720 gVirtualX->SetLineColor(-1);
721 gPad->TAttLine::Modify(); //Change line attributes only if necessary
722 x0 = gPad->AbsPixeltoX(px);
723 y0 = gPad->AbsPixeltoY(py);
725 pxold = px; pyold = py;
730 if (linedrawn) gVirtualX->DrawBox(px0, py0, pxold, pyold, TVirtualX::kHollow);
734 gVirtualX->DrawBox(px0, py0, pxold, pyold, TVirtualX::kHollow);
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);
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) {
749 fZoomX0[fZooms] = x0;
750 fZoomY0[fZooms] = y0;
751 fZoomX1[fZooms] = x1;
752 fZoomY1[fZooms] = y1;
754 gPad->Modified(kTRUE);
759 //___________________________________________
760 void AliRICHDisplay::LoadCoG(Int_t chamber, Int_t cathode)
762 // Read raw clusters info and store x,y,z info in arrays fRpoints
763 // Loop on all detectors
765 if (chamber > 6) return;
767 printf("Entering LoadCoG\n");
770 AliRICH *pRICH = (AliRICH*)gAlice->GetModule("RICH");
771 AliRICHChamber* iChamber;
773 TClonesArray *pRICHrawclust = pRICH->RawClustAddress(chamber);
774 printf ("Chamber:%d has adress:%p\n", chamber, pRICHrawclust );
775 if (pRICHrawclust == 0) return;
777 pRICH->ResetRawClusters();
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);
787 iChamber = &(pRICH->Chamber(chamber));
788 AliRICHRawCluster *mRaw;
789 AliRICHPoints *points = 0;
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]);
809 //___________________________________________
810 void AliRICHDisplay::LoadRecHits(Int_t chamber, Int_t cathode)
812 // Read rec. hits info
813 // Loop on all detectors
815 if (chamber > 6) return;
817 printf("Entering LoadRecHits\n");
820 AliRICH *pRICH = (AliRICH*)gAlice->GetModule("RICH");
821 AliRICHChamber* iChamber;
823 TClonesArray *pRICHrechits1D = pRICH->RecHitsAddress1D(chamber);
824 printf ("Chamber:%d\n", chamber);
825 if (pRICHrechits1D != 0)
828 //RICH->ResetRecHits();
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);
837 if (fRecpoints == 0) fRecpoints = new TObjArray(50);
839 iChamber = &(pRICH->Chamber(chamber));
840 AliRICHRecHit1D *mRec1D;
841 AliRICHPoints *points1D = 0;
842 //AliRICHEllipse *ellipse = 0;
844 //loop over all rechits and store their position
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);
870 //marker->SetRefObject((TObject*)points1D);
871 //points1D->Set3DMarker(0, marker);
876 TClonesArray *pRICHrechits3D = pRICH->RecHitsAddress3D(chamber);
877 printf ("Chamber:%d\n", chamber);
878 if (pRICHrechits3D != 0)
881 //RICH->ResetRecHits();
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);
890 if (fRecpoints == 0) fRecpoints = new TObjArray(50);
892 iChamber = &(pRICH->Chamber(chamber));
893 AliRICHRecHit3D *mRec3D;
894 AliRICHPoints *points3D = 0;
895 //AliRICHEllipse *ellipse = 0;
897 //loop over all rechits and store their position
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);
923 //marker->SetRefObject((TObject*)points3D);
924 //points3D->Set3DMarker(0, marker);
929 //___________________________________________
930 void AliRICHDisplay::LoadDigits()
932 // Read digits info and store x,y,z info in arrays fPoints
933 // Loop on all detectors
936 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
937 AliRICHChamber* iChamber;
938 AliSegmentation* segmentation;
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();
950 if (fPoints == 0) fPoints = new TObjArray(nAllDigits);
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();
964 //printf("Dpx:%d, Dpy:%d\n",dpx,dpy);
967 AliRICHPoints *points = 0;
968 TMarker3DBox *marker = 0;
970 //loop over all digits and store their position
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);
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]);
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
1011 //___________________________________________
1012 void AliRICHDisplay::LoadHits(Int_t chamber)
1014 // Read hits info and store x,y,z info in arrays fPhits
1015 // Loop on all detectors
1021 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
1022 AliRICHChamber* iChamber;
1024 iChamber = &(pRICH->Chamber(chamber-1));
1025 Int_t ntracks = (Int_t)gAlice->TreeH()->GetEntries();
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);
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();
1044 fPhits = new TObjArray(nAllHits);
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;
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);
1067 points->SetMarkerColor(kRed);
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());
1081 //_____________________________________________________________________________
1083 void AliRICHDisplay::LoadCerenkovs(Int_t chamber)
1085 // Read cerenkov hits info and store x,y,z info in array fPCerenkovs
1086 // Loop on all detectors
1091 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
1092 AliRICHChamber* iChamber;
1094 iChamber = &(pRICH->Chamber(chamber-1));
1096 pRICH->SetTreeAddress();
1097 Int_t ntracks = (Int_t)gAlice->TreeH()->GetEntries();
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;
1117 //Display Cerenkov hits in blue
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);
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));
1144 fPCerenkovs->AddAt(cpoints,track);
1148 //_____________________________________________________________________________
1149 void AliRICHDisplay::Paint(Option_t *)
1151 // Paint miscellaneous items
1155 //_____________________________________________________________________________
1156 void AliRICHDisplay::SetPickMode()
1163 fArcButton->SetY1(fPickButton->GetYlowNDC()+0.5*fPickButton->GetHNDC());
1164 fTrigPad->Modified();
1167 //_____________________________________________________________________________
1168 void AliRICHDisplay::SetZoomMode()
1175 fArcButton->SetY1(fZoomButton->GetYlowNDC()+0.5*fZoomButton->GetHNDC());
1176 fTrigPad->Modified();
1179 //_____________________________________________________________________________
1180 void AliRICHDisplay::SetChamberAndCathode(Int_t chamber, Int_t cathode)
1182 // Set chamber and cathode number
1186 printf("SetChamberAndCathode - fChamber fCathode %d %d\n",fChamber,fCathode);
1193 //_____________________________________________________________________________
1194 void AliRICHDisplay::SetRange(Float_t rrange, Float_t zrange)
1196 // Set view range along R and Z
1205 //_____________________________________________________________________________
1206 void AliRICHDisplay::SetView(Float_t theta, Float_t phi, Float_t psi)
1208 // change viewing angles for current event
1216 TView *view = gPad->GetView();
1217 if (view) view->SetView(fPhi, fTheta, fPsi, iret);
1223 //_____________________________________________________________________________
1224 void AliRICHDisplay::ShowNextEvent(Int_t delta)
1226 // Display (current event_number+delta)
1227 // delta = 1 shown next event
1228 // delta = -1 show previous event
1232 Int_t currentEvent = gAlice->GetHeader()->GetEvent();
1233 Int_t newEvent = currentEvent + delta;
1234 gAlice->GetEvent(newEvent);
1235 if (!gAlice->TreeD()) return;
1245 //______________________________________________________________________________
1246 void AliRICHDisplay::UnZoom()
1249 // Return to previous zoom factor
1251 if (fZooms <= 0) return;
1253 TPad *pad = (TPad*)gPad->GetPadSave();
1254 pad->Range(fZoomX0[fZooms],fZoomY0[fZooms], fZoomX1[fZooms],fZoomY1[fZooms]);
1258 //_____________________________________________________________________________
1259 void AliRICHDisplay::ResetPoints()
1262 // Reset array of points
1270 //_____________________________________________________________________________
1271 void AliRICHDisplay::ResetRpoints()
1274 // Reset array of points
1282 //_____________________________________________________________________________
1283 void AliRICHDisplay::ResetRecpoints()
1286 // Reset array of points
1289 fRecpoints->Delete();
1294 //_____________________________________________________________________________
1295 void AliRICHDisplay::ResetPhits()
1298 // Reset array of points
1306 //_____________________________________________________________________________
1307 void AliRICHDisplay::ResetPCerenkovs()
1310 // Reset array of points
1313 fPCerenkovs->Delete();
1319 //_____________________________________________________________________________
1321 void AliRICHDisplay::DrawViewGL()
1323 // Draw current view using OPENGL
1325 TPad *pad = (TPad*)gPad->GetPadSave();
1327 TView *view = pad->GetView();
1332 //_____________________________________________________________________________
1333 void AliRICHDisplay::DrawViewX3D()
1335 // Draw current view using X3D
1337 TPad *pad = (TPad*)gPad->GetPadSave();
1339 TView *view = pad->GetView();