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 //////////////////////////////////////////////////////////////////////////
22 // Utility class to display ALICE outline, tracks, hits,.. //
24 //////////////////////////////////////////////////////////////////////////
33 #include <TPolyMarker3D.h>
36 #include <TPolyMarker.h>
37 #include <TPaveLabel.h>
38 #include <TPaveText.h>
45 #include <TGeometry.h>
46 #include <TSliderBox.h>
48 #include <TVirtualX.h>
51 #include <X3DBuffer.h>
52 #include <TParticle.h>
56 #include "AliDetector.h"
58 #include "AliRICHConst.h"
59 #include "AliRICHDisplay.h"
60 #include "AliRICHPoints.h"
61 #include "AliHeader.h"
63 #include "AliRICHSDigit.h"
64 #include "AliRICHDigit.h"
65 #include "AliRICHRawCluster.h"
66 #include "AliRICHRecHit1D.h"
69 ClassImp(AliRICHDisplay)
72 //____________________________________________________________________________
73 AliRICHDisplay::AliRICHDisplay()
76 // default constructor
86 //_____________________________________________________________________________
87 AliRICHDisplay::AliRICHDisplay(Int_t size)
89 // Create an event display object.
90 // A canvas named "edisplay" is created with a vertical size in pixels
92 // A QUICK Overview of the Event Display functions
93 // ===============================================
95 // The event display can ve invoked by executing the macro "display.C"
96 // A canvas like in the picture below will appear.
98 // On the left side of the canvas, the following buttons appear:
99 // *Next* to move to the next event
100 // *Previous* to move to the previous event
102 // *Pick* Select this option to be able to point on a track with the
103 // mouse. Once on the track, use the right button to select
104 // an action. For example, select SetMarkerAttributes to
105 // change the marker type/color/size for the track.
106 // *Zoom* Select this option (default) if you want to zoom.
107 // To zoom, simply select the selected area with the left button.
108 // *UnZoom* To revert to the previous picture size.
110 // slider R On the left side, the vertical slider can be used to
111 // set the default picture size.
113 // When you are in Zoom mode, you can click on the black part of the canvas
114 // to select special options with the right mouse button.
117 // When you are in pick mode, you can "Inspect" the object pointed by the mouse.
118 // When you are on a track, select the menu item "InspectParticle"
119 // to display the current particle attributes.
121 // You can activate the Root browser by selecting the Inspect menu
122 // in the canvas tool bar menu. Then select "Start Browser"
123 // This will open a new canvas with the browser. At this point, you may want
124 // to display some histograms (from the Trees). Go to the "File" menu
125 // of the browser and click on "New canvas".
126 // In the browser, click on item "ROOT files" in the left pane.
127 // Click on galice.root.
129 // Click on TPC for example
130 // Click on any variable (eg TPC.fX) to histogram the variable.
132 // If you are lost, you can click on HELP in any Root canvas or browser.
135 <img src="gif/AliRICHDisplay.gif">
142 gAlice->SetDisplay(this);
144 // Initialize display default parameters
147 // Set front view by default
148 fTheta = 90; //inclined HMPID
149 fPhi = 30; //inclined HMPID
150 //fTheta = 90; //normal HMPID
151 //fPhi = 90; //normal HMPID
156 fDrawClusters = kTRUE;
158 fDrawRecHits = kTRUE;
169 // Create display canvas
171 if (ysize < 100) ysize = 750;
172 Int_t xsize = Int_t(size*830./ysize);
173 fCanvas = new TCanvas("Canvas", "RICH Clusters Display",14,47,xsize,ysize);
174 fCanvas->ToggleEventStatus();
176 // Create main display pad
177 fPad = new TPad("viewpad", "RICH display",0.15,0,0.9,1);
180 fPad->SetFillColor(1);
181 fPad->SetBorderSize(2);
186 fColPad = new TPad("colpad", "Colors pad",0.9,0,1,1);
189 fColPad->SetFillColor(19);
190 fColPad->SetBorderSize(2);
196 // Create user interface control pad
200 // Create Range and mode pad
203 fTrigPad = new TPad("trigger", "range and mode pad",0,0,dxtr,dytr);
206 fTrigPad->SetFillColor(22);
207 fTrigPad->SetBorderSize(2);
208 fRangeSlider = new TSlider("range","range",0.7,0.42,0.9,0.98);
209 fRangeSlider->SetObject(this);
210 char pickmode[] = "gAlice->Display()->SetPickMode()";
212 fPickButton = new TButton("Pick",pickmode,0.05,0.32,0.65,0.32+db);
213 fPickButton->SetFillColor(38);
215 char zoommode[] = "gAlice->Display()->SetZoomMode()";
216 fZoomButton = new TButton("Zoom",zoommode,0.05,0.21,0.65,0.21+db);
217 fZoomButton->SetFillColor(38);
219 fArcButton = new TArc(.8,fZoomButton->GetYlowNDC()+0.5*db,0.33*db);
220 fArcButton->SetFillColor(kGreen);
222 char butUnzoom[] = "gAlice->Display()->UnZoom()";
223 TButton *button = new TButton("UnZoom",butUnzoom,0.05,0.05,0.95,0.15);
224 button->SetFillColor(38);
226 AppendPad(); // append display object as last object to force selection
228 fTrigPad->SetEditable(kFALSE);
229 fButtons->SetEditable(kFALSE);
235 //_____________________________________________________________________________
236 AliRICHDisplay::~AliRICHDisplay()
238 // Delete space point structure
239 if (fPoints) fPoints->Delete();
243 if (fPhits) fPhits->Delete();
247 if (fRpoints) fRpoints->Delete();
251 if (fRecpoints) fRecpoints->Delete();
255 if (fPCerenkovs) fPCerenkovs->Delete();
260 //_____________________________________________________________________________
261 void AliRICHDisplay::Clear(Option_t *)
263 // Delete graphics temporary objects
266 //_____________________________________________________________________________
267 void AliRICHDisplay::DisplayButtons()
269 // Create the user interface buttons
272 fButtons = new TPad("buttons", "newpad",0,0.45,0.15,1);
274 fButtons->SetFillColor(38);
275 fButtons->SetBorderSize(2);
278 // Int_t butcolor = 33;
279 Float_t dbutton = 0.08;
286 char but1[] = "gAlice->Display()->ShowNextEvent(1)";
287 button = new TButton("Next",but1,x0,y-dbutton,x1,y);
288 button->SetFillColor(38);
292 char but2[] = "gAlice->Display()->ShowNextEvent(-1)";
293 button = new TButton("Previous",but2,x0,y-dbutton,x1,y);
294 button->SetFillColor(38);
298 char but7[] = "gAlice->Display()->DrawViewGL()";
299 button = new TButton("OpenGL",but7,x0,y-dbutton,x1,y);
300 button->SetFillColor(38);
304 char but8[] = "gAlice->Display()->DrawViewX3D()";
305 button = new TButton("X3D",but8,x0,y-dbutton,x1,y);
306 button->SetFillColor(38);
310 TDiamond *diamond = new TDiamond(0.05,0.015,0.95,0.22);
311 diamond->SetFillColor(50);
312 diamond->SetTextAlign(22);
313 diamond->SetTextColor(5);
314 diamond->SetTextSize(0.11);
316 diamond->AddText(".. ");
317 diamond->AddText("ROOT");
318 diamond->AddText("RICH");
319 diamond->AddText("... ");
320 diamond->AddText(" ");
323 //_____________________________________________________________________________
324 void AliRICHDisplay::CreateColors()
326 // Create the colors palette used to display clusters
341 new TColor(color,r,g,b);
351 new TColor(color,r,g,b);
361 new TColor(color,r,g,b);
371 new TColor(color,r,g,b);
381 new TColor(color,r,g,b);
388 //_____________________________________________________________________________
389 void AliRICHDisplay::DisplayColorScale()
392 // Draw the color scale in the RICH display canvas
396 Float_t xlow, ylow, xup, yup, hs;
397 Float_t x1, y1, x2, y2;
401 gPad->SetFillColor(0);
403 gPad->Range(x1,y1,x2,y2);
404 TText *text = new TText(0,0,"");
405 text->SetTextFont(61);
406 text->SetTextSize(0.2);
407 text->SetTextAlign(22);
411 //*-* draw colortable boxes
412 hs = (y2-y1)/Float_t(22);
416 ylow = y1 + hs*(Float_t(i));
417 yup = y1 + hs*(Float_t(i+1));
419 Double_t logscale=Double_t(i+1)*(TMath::Log(kadc_satm)/22);
420 Int_t scale=(Int_t)TMath::Exp(logscale);
421 sprintf(label,"%d",scale);
422 box = new TBox(xlow, ylow, xup, yup);
423 box->SetFillColor(color);
425 text->DrawText(xup+4, 0.5*(ylow+yup),label);
429 //______________________________________________________________________________
430 Int_t AliRICHDisplay::DistancetoPrimitive(Int_t px, Int_t)
432 // Compute distance from point px,py to objects in event
434 gPad->SetCursor(kCross);
436 if (gPad == fTrigPad) return 9999;
438 const Int_t kBig = 9999;
440 Float_t xmin = gPad->GetX1();
441 Float_t xmax = gPad->GetX2();
442 Float_t dx = 0.02*(xmax - xmin);
443 Float_t x = gPad->AbsPixeltoX(px);
444 if (x < xmin+dx || x > xmax-dx) return dist;
445 if (fZoomMode) return 0;
449 //_____________________________________________________________________________
450 void AliRICHDisplay::Draw(Option_t *)
452 // Display current event
456 DrawView(fTheta, fPhi, fPsi); // see how to draw PGON+inner frames
458 // Display the event number and title
463 //_____________________________________________________________________________
464 void AliRICHDisplay::DrawCoG()
466 // Draw hits for RICH chambers
468 if (!fDrawCoG) return;
470 for (Int_t chamber=0;chamber<kNCH;chamber++) {
479 ncog = points->GetEntriesFast();
480 for (icog=0; icog < ncog; icog++) {
481 pm = (AliRICHPoints*)points->UncheckedAt(icog);
487 void AliRICHDisplay::DrawRecHits()
489 // Draw rec hits for RICH chambers
491 if (!fDrawRecHits) return;
493 for (Int_t chamber=0;chamber<kNCH;chamber++) {
494 LoadRecHits(chamber,1);
502 nrec = points->GetEntriesFast();
503 //printf("Nrec %d\n",nrec);
504 for (irec=0; irec < nrec; irec++) {
505 pm = (AliRICHPoints*)points->UncheckedAt(irec);
511 //_____________________________________________________________________________
513 void AliRICHDisplay::DrawCerenkovs()
515 // Draw cerenkovs hits for RICH chambers
517 LoadCerenkovs(fChamber);
518 //printf("\nDrawCerenkovs\n");
520 Int_t ntracks, track;
525 cpoints = fPCerenkovs;
526 //printf ("Cpoints: %p",cpoints);
527 if (!cpoints) return;
528 ntracks = cpoints->GetEntriesFast();
529 //printf("DrawCerenkovs - ntracks %d \n",ntracks);
530 for (track=0;track<ntracks;track++) {
531 pm = (AliRICHPoints*)cpoints->UncheckedAt(track);
534 fHitsCuts += pm->GetN();
538 //_____________________________________________________________________________
540 void AliRICHDisplay::DrawClusters()
542 // Draw clusterss for RICH chambers
544 Int_t ndigits, digit;
551 ndigits = points->GetEntriesFast();
552 for (digit=0;digit<ndigits;digit++){
553 pm = (AliRICHPoints*)points->UncheckedAt(digit);
558 for (Int_t im=0;im<3;im++) {
559 TMarker3DBox *marker=pm->GetMarker(im);
563 fClustersCuts +=pm->GetN();
567 //_____________________________________________________________________________
568 void AliRICHDisplay::DrawHits()
570 // Draw hits for RICH chambers
574 Int_t ntracks, track;
581 // ntracks = points->GetEntriesFast();
582 ntracks = fPhits->GetEntriesFast();
584 //printf("DrawHits - ntracks %d \n",ntracks);
585 for (track=0;track<ntracks;track++) {
586 pm = (AliRICHPoints*)fPhits->UncheckedAt(track);
589 fHitsCuts += pm->GetN();
594 //_____________________________________________________________________________
595 void AliRICHDisplay::DrawTitle(Option_t *option)
597 // Draw the event title
599 Float_t xmin = gPad->GetX1();
600 Float_t xmax = gPad->GetX2();
601 Float_t ymin = gPad->GetY1();
602 Float_t ymax = gPad->GetY2();
603 Float_t dx = xmax-xmin;
604 Float_t dy = ymax-ymin;
606 if (strlen(option) == 0) {
607 TPaveText *title = new TPaveText(xmin +0.01*dx, ymax-0.09*dy, xmin +0.5*dx, ymax-0.01*dy);
608 title->SetBit(kCanDelete);
609 title->SetFillColor(42);
612 sprintf(ptitle,"Alice event: %d, Run:%d",
613 gAlice->GetHeader()->GetEvent(), gAlice->GetHeader()->GetRun());
614 title->AddText(ptitle);
615 Int_t nparticles = gAlice->GetMCApp()->Particles()->GetEntriesFast();
616 sprintf(ptitle,"Nparticles = %d Nhits = %d Npads fired = %d",
617 nparticles, fHitsCuts,fClustersCuts);
618 title->AddText(ptitle);
621 new TPaveLabel(xmin +0.01*dx, ymax-0.07*dy, xmin +0.2*dx, ymax-0.01*dy,option);
622 label->SetBit(kCanDelete);
623 label->SetFillColor(42);
628 //_____________________________________________________________________________
629 void AliRICHDisplay::DrawView(Float_t theta, Float_t phi, Float_t psi)
631 // Draw a view of RICH clusters
633 gPad->SetCursor(kWatch);
634 gPad->SetFillColor(1);
638 TView *view = new TView(1);
639 Float_t range = fRrange*fRangeSlider->GetMaximum();
640 view->SetRange(-range,-range,-range,range, range, range);
647 //Display RICH Chamber Geometry
648 gAlice->GetGeometry()->Draw("same");
650 //add clusters to the pad
656 //printf("Calling DrawCoG\n");
658 //printf("Calling DrawRecHits\n");
661 /*for (Int_t i=0;i<7;i++)
664 // add itself to the list (must be last)
667 view->SetView(phi, theta, psi, iret);
670 //______________________________________________________________________________
671 void AliRICHDisplay::ExecuteEvent(Int_t event, Int_t px, Int_t py)
673 // Execute action corresponding to the mouse event
675 static Float_t x0, y0, x1, y1;
677 static Int_t pxold, pyold;
678 static Int_t px0, py0;
679 static Int_t linedrawn;
682 if (px == 0 && py == 0) { //when called by sliders
683 if (event == kButton1Up) {
684 printf("Drawing event %d\n",event);
689 if (!fZoomMode && gPad->GetView()) {
690 gPad->GetView()->ExecuteRotateView(event, px, py);
694 // something to zoom ?
695 gPad->SetCursor(kCross);
700 gVirtualX->SetLineColor(-1);
701 gPad->TAttLine::Modify(); //Change line attributes only if necessary
702 x0 = gPad->AbsPixeltoX(px);
703 y0 = gPad->AbsPixeltoY(py);
705 pxold = px; pyold = py;
710 if (linedrawn) gVirtualX->DrawBox(px0, py0, pxold, pyold, TVirtualX::kHollow);
714 gVirtualX->DrawBox(px0, py0, pxold, pyold, TVirtualX::kHollow);
718 gPad->GetCanvas()->FeedbackMode(kFALSE);
719 if (px == px0) return;
720 if (py == py0) return;
721 x1 = gPad->AbsPixeltoX(px);
722 y1 = gPad->AbsPixeltoY(py);
724 if (x1 < x0) {temp = x0; x0 = x1; x1 = temp;}
725 if (y1 < y0) {temp = y0; y0 = y1; y1 = temp;}
726 gPad->Range(x0,y0,x1,y1);
727 if (fZooms < kMAXZOOM-1) {
729 fZoomX0[fZooms] = x0;
730 fZoomY0[fZooms] = y0;
731 fZoomX1[fZooms] = x1;
732 fZoomY1[fZooms] = y1;
734 gPad->Modified(kTRUE);
739 //___________________________________________
740 void AliRICHDisplay::LoadCoG(Int_t chamber, Int_t cathode)
742 // Read raw clusters info and store x,y,z info in arrays fRpoints
743 // Loop on all detectors
745 if (chamber > 6) return;
747 //printf("Entering LoadCoG\n");
750 AliRICH *pRICH = (AliRICH*)gAlice->GetModule("RICH");
751 AliRICHChamber* iChamber;
753 TClonesArray *pRICHrawclust = pRICH->RawClustAddress(chamber);
754 //printf ("Chamber:%d has adress:%p\n", chamber, pRICHrawclust );
755 if (pRICHrawclust == 0) return;
757 pRICH->ResetRawClusters();
760 Int_t nent=(Int_t)gAlice->TreeR()->GetEntries();
761 gAlice->TreeR()->GetEvent(nent-1+cathode-1);
762 Int_t nrawcl = pRICHrawclust->GetEntriesFast();
763 //printf ("nrawcl:%d\n",nrawcl);
764 if (nrawcl == 0) return;
765 if (fRpoints == 0) fRpoints = new TObjArray(nrawcl);
767 iChamber = &(pRICH->Chamber(chamber));
768 AliRICHRawCluster *mRaw;
769 AliRICHPoints *points = 0;
771 //loop over all raw clusters and store their position
772 points = new AliRICHPoints(nrawcl);
773 for (Int_t iraw=0;iraw<nrawcl;iraw++) {
774 mRaw = (AliRICHRawCluster*)pRICHrawclust->UncheckedAt(iraw);
775 fRpoints->AddAt(points,iraw);
776 points->SetMarkerColor(3);
777 points->SetMarkerStyle(3);
778 points->SetMarkerSize(1.);
779 points->SetParticle(-1);
780 points->SetHitIndex(-1);
781 points->SetTrackIndex(-1);
782 points->SetDigitIndex(-1);
783 Float_t vectorLoc[3]={mRaw->fX,5,mRaw->fY};
784 Float_t vectorGlob[3];
785 iChamber->LocaltoGlobal(vectorLoc,vectorGlob);
786 points->SetPoint(iraw,vectorGlob[0],vectorGlob[1],vectorGlob[2]);
789 //___________________________________________
790 void AliRICHDisplay::LoadRecHits(Int_t chamber, Int_t cathode)
792 // Read rec. hits info
793 // Loop on all detectors
795 if (chamber > 6) return;
797 ///printf("Entering LoadRecHits\n");
800 AliRICH *pRICH = (AliRICH*)gAlice->GetModule("RICH");
801 AliRICHChamber* iChamber;
803 TClonesArray *pRICHrechits1D = pRICH->RecHitsAddress1D(chamber);
804 //printf ("Chamber:%d\n", chamber);
805 if (pRICHrechits1D != 0)
808 //RICH->ResetRecHits();
811 Int_t nent1D=(Int_t)gAlice->TreeR()->GetEntries();
812 gAlice->TreeR()->GetEvent(nent1D-1+cathode-1);
813 Int_t nrechits1D = pRICHrechits1D->GetEntriesFast();
814 //printf ("nrechits1D:%d\n",nrechits1D);
817 if (fRecpoints == 0) fRecpoints = new TObjArray(50);
819 iChamber = &(pRICH->Chamber(chamber));
820 AliRICHRecHit1D *mRec1D;
821 AliRICHPoints *points1D = 0;
822 //loop over all rechits and store their position
824 points1D = new AliRICHPoints(nrechits1D);
825 for (Int_t irec=0;irec<nrechits1D;irec++) {
826 mRec1D = (AliRICHRecHit1D*)pRICHrechits1D->UncheckedAt(irec);
827 fRecpoints->AddAt(points1D,irec);
828 points1D->SetMarkerColor(38);
829 points1D->SetMarkerStyle(8);
830 points1D->SetMarkerSize(.5);
831 points1D->SetParticle(-1);
832 points1D->SetHitIndex(-1);
833 points1D->SetTrackIndex(-1);
834 points1D->SetDigitIndex(-1);
835 Float_t vectorLoc[3]={mRec1D->fX,5,mRec1D->fY};
836 Float_t vectorGlob[3];
837 iChamber->LocaltoGlobal(vectorLoc,vectorGlob);
838 points1D->SetPoint(irec,vectorGlob[0],vectorGlob[1],vectorGlob[2]);
844 //___________________________________________
845 void AliRICHDisplay::LoadDigits()
847 // Read digits info and store x,y,z info in arrays fPoints
848 // Loop on all detectors
851 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
852 AliRICHChamber* iChamber;
853 AliSegmentation* segmentation;
857 //printf("Entering LoadDigits\n");
862 for (ich=0; ich<kNCH; ich++) {
863 TClonesArray *pRICHdigits = pRICH->DigitsAddress(ich);
864 //printf ("Chamber:%d has adress:%p\n", ich, pRICHdigits );
865 if (pRICHdigits == 0) continue;
866 gAlice->ResetDigits();
867 gAlice->TreeD()->GetEvent(0);
868 Int_t ndigits = pRICHdigits->GetEntriesFast();
869 //printf("ndigits:%d\n",ndigits);
873 if (fPoints == 0) fPoints = new TObjArray(nAllDigits);
875 for (ich=0; ich<kNCH; ich++) {
876 TClonesArray *pRICHdigits = pRICH->DigitsAddress(ich);
877 if (pRICHdigits == 0) continue;
878 gAlice->ResetDigits();
879 gAlice->TreeD()->GetEvent(0);
880 Int_t ndigits = pRICHdigits->GetEntriesFast();
881 if (ndigits == 0) continue;
882 iChamber = &(pRICH->Chamber(ich));
883 segmentation=iChamber->GetSegmentationModel();
884 Float_t dpx = segmentation->Dpx();
885 Float_t dpy = segmentation->Dpy();
887 //printf("Dpx:%d, Dpy:%d\n",dpx,dpy);
890 AliRICHPoints *points = 0;
891 TMarker3DBox *marker = 0;
893 //loop over all digits and store their position
896 for (Int_t digit=0;digit<ndigits;digit++) {
897 mdig = (AliRICHDigit*)pRICHdigits->UncheckedAt(digit);
898 points = new AliRICHPoints(npoints);
899 fPoints->AddAt(points,counter);
901 Int_t charge=mdig->Signal();
902 Int_t index=Int_t(TMath::Log(charge)/(TMath::Log(kadc_satm)/22));
903 Int_t color=701+index;
904 if (color>722) color=722;
905 points->SetMarkerColor(color);
906 points->SetMarkerStyle(21);
907 points->SetMarkerSize(0.5);
908 Float_t xpad, ypad, zpad;
909 segmentation->GetPadC(mdig->PadX(), mdig->PadY(),xpad, ypad, zpad);
910 Float_t vectorLoc[3]={xpad,5,ypad};
911 Float_t vectorGlob[3];
912 iChamber->LocaltoGlobal(vectorLoc,vectorGlob);
913 points->SetParticle(-1);
914 points->SetHitIndex(-1);
915 points->SetTrackIndex(-1);
916 points->SetDigitIndex(digit);
917 points->SetPoint(0,vectorGlob[0],vectorGlob[1],vectorGlob[2]);
918 //printf("Y position (digit): %f\n", vectorGlob[1]);
920 segmentation->GetPadC(mdig->PadX(), mdig->PadY(), xpad, ypad, zpad);
921 Float_t theta = iChamber->GetRotMatrix()->GetTheta();
922 Float_t phi = iChamber->GetRotMatrix()->GetPhi();
923 marker=new TMarker3DBox(vectorGlob[0],vectorGlob[1],vectorGlob[2],
924 dpy/2,0,dpx/2,theta,phi);
925 marker->SetLineColor(2);
926 marker->SetFillStyle(1001);
927 marker->SetFillColor(color);
928 marker->SetRefObject((TObject*)points);
929 points->Set3DMarker(0, marker);
930 } // loop over digits
931 } // loop over chambers
936 //___________________________________________
937 void AliRICHDisplay::LoadHits(Int_t chamber)
939 // Read hits info and store x,y,z info in arrays fPhits
940 // Loop on all detectors
946 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
947 AliRICHChamber* iChamber;
949 iChamber = &(pRICH->Chamber(chamber-1));
950 Int_t ntracks = (Int_t)pRICH->TreeH()->GetEntries();
953 if (fPhits == 0) fPhits = new TObjArray(ntracks);
954 //TVector *xp = new TVector(1000);
955 //TVector *yp = new TVector(1000);
956 //TVector *zp = new TVector(1000);
957 //TVector *ptrk = new TVector(1000);
958 //TVector *phit = new TVector(1000);
960 for (track=0; track<ntracks;track++) {
962 pRICH->TreeH()->GetEvent(track);
963 TClonesArray *pRICHhits = pRICH->Hits();
964 if (pRICHhits == 0) return;
965 Int_t nhits = pRICHhits->GetEntriesFast();
969 fPhits = new TObjArray(nAllHits);
972 for (track=0; track<ntracks;track++) {
974 pRICH->TreeH()->GetEvent(track);
975 TClonesArray *pRICHhits = pRICH->Hits();
976 if (pRICHhits == 0) return;
977 Int_t nhits = pRICHhits->GetEntriesFast();
978 if (nhits == 0) continue;
980 AliRICHPoints *points = 0;
981 for (Int_t hit=0;hit<nhits;hit++) {
982 points = new AliRICHPoints(1);
983 fPhits->AddAt(points,npoints);
984 mHit = (AliRICHhit*)pRICHhits->UncheckedAt(hit);
985 TParticle *current = (TParticle*)gAlice->GetMCApp()->Particle(mHit->Track());
986 if (current->GetPdgCode() == 50000050) {
987 points->SetMarkerColor(kBlue);
988 } else if (current->GetPdgCode() == 50000051) {
989 points->SetMarkerColor(kYellow);
991 points->SetMarkerColor(kRed);
993 points->SetMarkerStyle(5);
994 points->SetMarkerSize(1.);
995 points->SetParticle(mHit->Track());
996 points->SetHitIndex(hit);
997 points->SetTrackIndex(track);
998 points->SetDigitIndex(-1);
999 points->SetPoint(0,mHit->X(), mHit->Y(), mHit->Z());
1005 //_____________________________________________________________________________
1007 void AliRICHDisplay::LoadCerenkovs(Int_t chamber)
1009 // Read cerenkov hits info and store x,y,z info in array fPCerenkovs
1010 // Loop on all detectors
1015 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
1016 AliRICHChamber* iChamber;
1018 iChamber = &(pRICH->Chamber(chamber-1));
1020 pRICH->SetTreeAddress();
1021 Int_t ntracks = (Int_t)pRICH->TreeH()->GetEntries();
1023 if (fPCerenkovs == 0) fPCerenkovs = new TObjArray(ntracks);
1024 TVector *xp = new TVector(1000);
1025 TVector *yp = new TVector(1000);
1026 TVector *zp = new TVector(1000);
1027 TVector *ptrk = new TVector(1000);
1028 TVector *phit = new TVector(1000);
1029 for (Int_t track=0; track<ntracks;track++) {
1030 gAlice->ResetHits();
1031 pRICH->TreeH()->GetEvent(track);
1032 TClonesArray *pRICHCerenkovs = pRICH->Cerenkovs();
1033 if (pRICHCerenkovs == 0) return;
1034 Int_t nhits = pRICHCerenkovs->GetEntriesFast();
1035 if (nhits == 0) continue;
1036 AliRICHCerenkov *mCerenkov;
1037 AliRICHPoints *cpoints = 0;
1041 //Display Cerenkov hits in blue
1043 for (Int_t hit=0;hit<nhits;hit++) {
1044 mCerenkov = (AliRICHCerenkov*)pRICHCerenkovs->UncheckedAt(hit);
1045 (*xp)(npoints)=mCerenkov->X();
1046 (*yp)(npoints)=mCerenkov->Y();
1047 (*zp)(npoints)=mCerenkov->Z();
1048 (*ptrk)(npoints)=Float_t(mCerenkov->GetTrack());
1049 (*phit)(npoints)=Float_t(hit);
1052 if (npoints == 0) continue;
1053 cpoints = new AliRICHPoints(npoints);
1054 for (Int_t p=0;p<npoints;p++) {
1055 cpoints->SetMarkerColor(kBlue);
1056 cpoints->SetMarkerStyle(5);
1057 cpoints->SetMarkerSize(1.);
1058 cpoints->SetParticle(Int_t((*ptrk)(p)));
1059 cpoints->SetHitIndex(Int_t((*phit)(p)));
1060 cpoints->SetTrackIndex(track);
1061 cpoints->SetDigitIndex(-1);
1062 cpoints->SetPoint(p,(*xp)(p),(*yp)(p),(*zp)(p));
1068 fPCerenkovs->AddAt(cpoints,track);
1072 //_____________________________________________________________________________
1073 void AliRICHDisplay::Paint(Option_t *)
1075 // Paint miscellaneous items
1079 //_____________________________________________________________________________
1080 void AliRICHDisplay::SetPickMode()
1087 fArcButton->SetY1(fPickButton->GetYlowNDC()+0.5*fPickButton->GetHNDC());
1088 fTrigPad->Modified();
1091 //_____________________________________________________________________________
1092 void AliRICHDisplay::SetZoomMode()
1099 fArcButton->SetY1(fZoomButton->GetYlowNDC()+0.5*fZoomButton->GetHNDC());
1100 fTrigPad->Modified();
1103 //_____________________________________________________________________________
1104 void AliRICHDisplay::SetChamberAndCathode(Int_t chamber, Int_t cathode)
1106 // Set chamber and cathode number
1110 //printf("SetChamberAndCathode - fChamber fCathode %d %d\n",fChamber,fCathode);
1117 //_____________________________________________________________________________
1118 void AliRICHDisplay::SetRange(Float_t rrange, Float_t zrange)
1120 // Set view range along R and Z
1129 //_____________________________________________________________________________
1130 void AliRICHDisplay::SetView(Float_t theta, Float_t phi, Float_t psi)
1132 // change viewing angles for current event
1140 TView *view = gPad->GetView();
1141 if (view) view->SetView(fPhi, fTheta, fPsi, iret);
1147 //_____________________________________________________________________________
1148 void AliRICHDisplay::ShowNextEvent(Int_t delta)
1150 // Display (current event_number+delta)
1151 // delta = 1 shown next event
1152 // delta = -1 show previous event
1156 Int_t currentEvent = gAlice->GetHeader()->GetEvent();
1157 Int_t newEvent = currentEvent + delta;
1158 gAlice->GetEvent(newEvent);
1159 if (!gAlice->TreeD()) return;
1169 //______________________________________________________________________________
1170 void AliRICHDisplay::UnZoom()
1173 // Return to previous zoom factor
1175 if (fZooms <= 0) return;
1177 TPad *pad = (TPad*)gPad->GetPadSave();
1178 pad->Range(fZoomX0[fZooms],fZoomY0[fZooms], fZoomX1[fZooms],fZoomY1[fZooms]);
1182 //_____________________________________________________________________________
1183 void AliRICHDisplay::ResetPoints()
1186 // Reset array of points
1194 //_____________________________________________________________________________
1195 void AliRICHDisplay::ResetRpoints()
1198 // Reset array of points
1206 //_____________________________________________________________________________
1207 void AliRICHDisplay::ResetRecpoints()
1210 // Reset array of points
1213 fRecpoints->Delete();
1218 //_____________________________________________________________________________
1219 void AliRICHDisplay::ResetPhits()
1222 // Reset array of points
1230 //_____________________________________________________________________________
1231 void AliRICHDisplay::ResetPCerenkovs()
1234 // Reset array of points
1237 fPCerenkovs->Delete();
1243 //_____________________________________________________________________________
1245 void AliRICHDisplay::DrawViewGL()
1247 // Draw current view using OPENGL
1249 TPad *pad = (TPad*)gPad->GetPadSave();
1251 TView *view = pad->GetView();
1256 //_____________________________________________________________________________
1257 void AliRICHDisplay::DrawViewX3D()
1259 // Draw current view using X3D
1261 TPad *pad = (TPad*)gPad->GetPadSave();
1263 TView *view = pad->GetView();