]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliDisplay.cxx
Fixed bug in version number of AliITSpListItem and removed delete[] for
[u/mrichter/AliRoot.git] / STEER / AliDisplay.cxx
index 517fb5a4c7791ec500b8f975f423cf8a7c0c7cf3..3cc8877329e05bd61a34c1d4a0d52902275cd087 100644 (file)
@@ -1,3 +1,58 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/*
+$Log$
+Revision 1.16  2001/07/25 15:23:50  hristov
+Changes needed to run with Root 3.01 (R.Brun)
+
+Revision 1.15  2001/05/16 14:57:22  alibrary
+New files for folders and Stack
+
+Revision 1.14  2001/01/26 19:58:48  hristov
+Major upgrade of AliRoot code
+
+Revision 1.13  2000/12/21 15:30:18  fca
+Correcting coding convention violations
+
+Revision 1.12  2000/12/12 13:18:59  hristov
+Protection against FPE
+
+Revision 1.11  2000/11/30 07:12:48  alibrary
+Introducing new Rndm and QA classes
+
+Revision 1.10  2000/10/02 21:28:14  fca
+Removal of useless dependecies via forward declarations
+
+Revision 1.9  2000/07/13 16:19:09  fca
+Mainly coding conventions + some small bug fixes
+
+Revision 1.8  2000/07/11 18:24:59  fca
+Coding convention corrections + few minor bug fixes
+
+Revision 1.7  1999/11/10 07:37:06  fca
+Pads do not inherit editability from canvas any more
+
+Revision 1.6  1999/11/09 07:38:52  fca
+Changes for compatibility with version 2.23 of ROOT
+
+Revision 1.5  1999/09/29 09:24:29  fca
+Introduction of the Copyright and cvs Log
+
+*/
+
 
 //////////////////////////////////////////////////////////////////////////
 //                                                                      //
 //                                                                      //
 //////////////////////////////////////////////////////////////////////////
 
-#include <TROOT.h>
 #include <TTree.h>
 #include <TButton.h>
 #include <TCanvas.h>
 #include <TView.h>
-#include <TText.h>
-#include <TPolyMarker3D.h>
 #include <TPaveLabel.h>
 #include <TPaveText.h>
-#include <TList.h>
 #include <TDiamond.h>
-#include <TNode.h>
 #include <TArc.h>
-#include <TTUBE.h>
 #include <TSlider.h>
 #include <TSliderBox.h>
 #include <TGaxis.h>
-#include <TGXW.h>
+#include <TVirtualX.h>
 #include <TMath.h>
-#include <X3DBuffer.h>
 
 #include "AliRun.h"
 #include "AliDetector.h"
 #include "AliDisplay.h"
 #include "AliPoints.h"
-#include "GParticle.h"
+#include "TParticle.h"
+#include "TGeometry.h"
+#include "AliHeader.h"
 
-const Float_t ptcutmax  = 2;
-const Float_t etacutmax = 1.5;
+static const Float_t kptcutmax  = 2;
+static const Float_t ketacutmax = 1.5;
 
 ClassImp(AliDisplay)
 
@@ -43,7 +93,22 @@ ClassImp(AliDisplay)
 //_____________________________________________________________________________
 AliDisplay::AliDisplay()
 {
-   fCanvas = 0;
+  //
+  // Default constructor
+  //
+  fCanvas = 0;
+  fTrigPad = 0;
+  fCutPad = 0;
+  fEtaPad = 0;
+  fButtons = 0;
+  fPad = 0;
+  fCutSlider = 0;
+  fEtaSlider = 0;
+  fRangeSlider = 0;
+  fPickButton = 0;
+  fZoomButton = 0;
+  fArcButton = 0;
+  fFruits = 0;
 }
 
 //_____________________________________________________________________________
@@ -142,7 +207,6 @@ AliDisplay::AliDisplay(Int_t size)
    if (ysize < 100) ysize = 750;
    Int_t xsize = Int_t(size*830./ysize);
    fCanvas = new TCanvas("Canvas", "ALICE Event Display",14,47,xsize,ysize);
-   fCanvas->SetEditable(kIsNotEditable);
    fCanvas->ToggleEventStatus();
    
    // Create main display pad
@@ -192,13 +256,13 @@ AliDisplay::AliDisplay(Int_t size)
    fCutPad->SetFillColor(22);
    fCutPad->SetBorderSize(2);
    fCutSlider   = new TSlider("pcut","Momentum cut",0,0,1,1);
-   fCutSlider->SetRange(fPTcut/ptcutmax,1);
+   fCutSlider->SetRange(fPTcut/kptcutmax,1);
    fCutSlider->SetObject(this);
    fCutSlider->SetFillColor(45);
    TSliderBox *sbox = (TSliderBox*)fCutSlider->GetListOfPrimitives()->First();
    sbox->SetFillColor(46);
    fCutSlider->cd();
-   TGaxis *cutaxis = new TGaxis(0.02,0.8,0.98,0.8,0,ptcutmax,510,"");
+   TGaxis *cutaxis = new TGaxis(0.02,0.8,0.98,0.8,0,kptcutmax,510,"");
    cutaxis->SetLabelSize(0.5);
    cutaxis->SetTitleSize(0.6);
    cutaxis->SetTitleOffset(0.5);
@@ -218,13 +282,16 @@ AliDisplay::AliDisplay(Int_t size)
    TSliderBox *sbox2 = (TSliderBox*)fEtaSlider->GetListOfPrimitives()->First();
    sbox2->SetFillColor(46);
    fEtaSlider->cd();
-   TGaxis *etaaxis = new TGaxis(0.9,0.02,0.9,0.98,-etacutmax,etacutmax,510,"");
+   TGaxis *etaaxis = new TGaxis(0.9,0.02,0.9,0.98,-ketacutmax,ketacutmax,510,"");
    etaaxis->SetLabelSize(0.5);
    etaaxis->SetTitleSize(0.6);
    etaaxis->SetTitleOffset(0.2);
    cutaxis->SetTitle("Etacut .  ");
    fEtaSlider->GetListOfPrimitives()->AddFirst(etaaxis);
    fCanvas->cd();
+
+   fTrigPad->SetEditable(kFALSE);
+   fButtons->SetEditable(kFALSE);
    
 
    fCanvas->cd();
@@ -232,9 +299,21 @@ AliDisplay::AliDisplay(Int_t size)
 }
 
 
+//_____________________________________________________________________________
+AliDisplay::AliDisplay(const AliDisplay &disp)
+{
+  //
+  // Copy constructor
+  //
+  disp.Copy(*this);
+}
+
 //_____________________________________________________________________________
 AliDisplay::~AliDisplay()
 {
+  //
+  // Destructor
+  //
 }
 
 //_____________________________________________________________________________
@@ -243,10 +322,23 @@ void AliDisplay::Clear(Option_t *)
 //    Delete graphics temporary objects
 }
 
+//_____________________________________________________________________________
+void AliDisplay::Copy(AliDisplay &disp) const
+{
+  //
+  // Copy *this onto disp -- not implemented
+  //
+  Fatal("Copy","Not implemented~\n");
+}
+
 //----------------------------------------------------------------------------
-void AliDisplay::ShowTrack(Int_t idx) {
-   AliDetector *TPC=(AliDetector*)gAlice->GetModule("TPC");
-   TObjArray *points=TPC->Points();
+void AliDisplay::ShowTrack(Int_t idx) 
+{
+  //
+  // Display track idx
+  //
+   AliDetector *mTPC=(AliDetector*)gAlice->GetModule("TPC");
+   TObjArray *points=mTPC->Points();
    int ntracks=points->GetEntriesFast();
    for (int track=0;track<ntracks;track++) {
       AliPoints *pm = (AliPoints*)points->UncheckedAt(track);
@@ -257,13 +349,14 @@ void AliDisplay::ShowTrack(Int_t idx) {
          pm->Draw("same");
 //       fPad->Update();
 //       fPad->Modified();
-         TClonesArray *particles=gAlice->Particles();
-         GParticle *p = (GParticle*)particles->UncheckedAt(idx);
+        //         TClonesArray *particles=gAlice->Particles();
+        //         TParticle *p = (TParticle*)particles->UncheckedAt(idx);
+        TParticle *p = gAlice->Particle(idx);
          printf("\nTrack index %d\n",idx);
-         printf("Particle ID %d\n",p->GetKF());
-         printf("Parent %d\n",p->GetParent());
-         printf("First child %d\n",p->GetFirstChild());
-         printf("Px,Py,Pz %f %f %f\n",p->GetPx(),p->GetPy(),p->GetPz());
+         printf("Particle ID %d\n",p->GetPdgCode());
+         printf("Parent %d\n",p->GetFirstMother());
+         printf("First child %d\n",p->GetFirstDaughter());
+         printf("Px,Py,Pz %f %f %f\n",p->Px(),p->Py(),p->Pz());
          return;
       }
    }
@@ -271,8 +364,11 @@ void AliDisplay::ShowTrack(Int_t idx) {
 
 //----------------------------------------------------------------------------
 void AliDisplay::HideTrack(Int_t idx) {
-   AliDetector *TPC=(AliDetector*)gAlice->GetModule("TPC");
-   TObjArray *points=TPC->Points();
+  //
+  // Hide track on display
+  //
+   AliDetector *mTPC=(AliDetector*)gAlice->GetModule("TPC");
+   TObjArray *points=mTPC->Points();
    int ntracks=points->GetEntriesFast();
    for (int track=0;track<ntracks;track++) {
       AliPoints *pm = (AliPoints*)points->UncheckedAt(track);
@@ -390,8 +486,8 @@ Int_t AliDisplay::DistancetoPrimitive(Int_t px, Int_t)
    if (gPad == fCutPad)  return 9999;
    if (gPad == fEtaPad)  return 9999;
 
-   const Int_t big = 9999;
-   Int_t dist   = big;
+   const Int_t kbig = 9999;
+   Int_t dist   = kbig;
    Float_t xmin = gPad->GetX1();
    Float_t xmax = gPad->GetX2();
    Float_t dx   = 0.02*(xmax - xmin);
@@ -463,22 +559,22 @@ void AliDisplay::DrawHits()
    Float_t cutmin, cutmax, etamin, etamax, pmom, smin, smax, eta, theta, r;
    Float_t *pxyz;
    Int_t ntracks,track;
-   GParticle *particle;
+   TParticle *particle;
    TObjArray *points;
    AliPoints *pm;
       
    //Get cut slider
    smax   = fCutSlider->GetMaximum();
    smin   = fCutSlider->GetMinimum();
-   cutmin = ptcutmax*smin;
-   if (smax < 0.98) cutmax = ptcutmax*smax;
+   cutmin = kptcutmax*smin;
+   if (smax < 0.98) cutmax = kptcutmax*smax;
    else             cutmax = 100000;
    
    //Get eta slider
    smax   = fEtaSlider->GetMaximum();
    smin   = fEtaSlider->GetMinimum();
-   etamin = etacutmax*(2*smin-1);
-   etamax = etacutmax*(2*smax-1);
+   etamin = ketacutmax*(2*smin-1);
+   etamax = ketacutmax*(2*smax-1);
    if (smin < 0.02) etamin = -1000;
    if (smax > 0.98) etamax =  1000;
       
@@ -495,14 +591,14 @@ void AliDisplay::DrawHits()
          if (!pm) continue;
          particle = pm->GetParticle();
          if (!particle) continue;
-         pmom = particle->GetMomentum();
+         pmom = particle->P();
          if (pmom < cutmin) continue;
          if (pmom > cutmax) continue;
          // as a first approximation, take eta of first point
          pxyz  = pm->GetP();
          r     = TMath::Sqrt(pxyz[0]*pxyz[0] + pxyz[1]*pxyz[1]);
          theta = TMath::ATan2(r,TMath::Abs(pxyz[2]));
-         if(theta) eta = -TMath::Log(TMath::Tan(0.5*theta)); else eta = 1e10;
+         if(theta) eta = -TMath::Log(TMath::Abs(TMath::Tan(0.5*theta))); else eta = 1e10;
          if (pxyz[2] < 0) eta = -eta;
          if (eta < etamin || eta > etamax) continue;
          pm->Draw();
@@ -638,7 +734,7 @@ void AliDisplay::ExecuteEvent(Int_t event, Int_t px, Int_t py)
    switch (event) {
 
    case kButton1Down:
-      gGXW->SetLineColor(-1);
+      gVirtualX->SetLineColor(-1);
       gPad->TAttLine::Modify();  //Change line attributes only if necessary
       x0 = gPad->AbsPixeltoX(px);
       y0 = gPad->AbsPixeltoY(py);
@@ -648,11 +744,11 @@ void AliDisplay::ExecuteEvent(Int_t event, Int_t px, Int_t py)
       return;
 
    case kButton1Motion:
-      if (linedrawn) gGXW->DrawBox(px0, py0, pxold, pyold, TGXW::kHollow);
+      if (linedrawn) gVirtualX->DrawBox(px0, py0, pxold, pyold, TVirtualX::kHollow);
       pxold = px;
       pyold = py;
       linedrawn = 1;
-      gGXW->DrawBox(px0, py0, pxold, pyold, TGXW::kHollow);
+      gVirtualX->DrawBox(px0, py0, pxold, pyold, TVirtualX::kHollow);
       return;
 
    case kButton1Up:
@@ -708,6 +804,9 @@ void AliDisplay::Paint(Option_t *)
 //_____________________________________________________________________________
 void AliDisplay::SetPickMode()
 {
+  //
+  // Set Pick Mode -- disable zoom
+  //
    fZoomMode = 0;
 
    fArcButton->SetY1(fPickButton->GetYlowNDC()+0.5*fPickButton->GetHNDC());
@@ -717,6 +816,9 @@ void AliDisplay::SetPickMode()
 //_____________________________________________________________________________
 void AliDisplay::SetZoomMode()
 {
+  //
+  // Set Zoom Mode -- disable pick
+  //
    fZoomMode = 1;
 
    fArcButton->SetY1(fZoomButton->GetYlowNDC()+0.5*fZoomButton->GetHNDC());
@@ -726,6 +828,9 @@ void AliDisplay::SetZoomMode()
 //_____________________________________________________________________________
 void AliDisplay::SetPTcut(Float_t ptcut)
 {
+  //
+  // Set Pt Cut
+  //
    fPTcut = ptcut;
 
    if (!fPad) return;
@@ -773,9 +878,9 @@ void AliDisplay::ShowNextEvent(Int_t delta)
 
   if (delta) {
      gAlice->Clear();
-     Int_t current_event = gAlice->GetHeader()->GetEvent();
-     Int_t new_event     = current_event + delta;
-     gAlice->GetEvent(new_event);
+     Int_t currentEvent = gAlice->GetHeader()->GetEvent();
+     Int_t newEvent     = currentEvent + delta;
+     gAlice->GetEvent(newEvent);
      if (!gAlice->TreeH()) return; 
    }
   LoadPoints();
@@ -786,9 +891,22 @@ void AliDisplay::ShowNextEvent(Int_t delta)
 //______________________________________________________________________________
 void AliDisplay::UnZoom()
 {
-   if (fZooms <= 0) return;
-   fZooms--;
-   TPad *pad = (TPad*)gPad->GetPadSave();
-   pad->Range(fZoomX0[fZooms],fZoomY0[fZooms], fZoomX1[fZooms],fZoomY1[fZooms]);
-   pad->Modified();
+  //
+  // Resets ZOOM 
+  //
+  if (fZooms <= 0) return;
+  fZooms--;
+  TPad *pad = (TPad*)gPad->GetPadSave();
+  pad->Range(fZoomX0[fZooms],fZoomY0[fZooms], fZoomX1[fZooms],fZoomY1[fZooms]);
+  pad->Modified();
+}
+
+//_____________________________________________________________________________
+AliDisplay & AliDisplay::operator=(const AliDisplay &disp)
+{
+  //
+  // Assignment operator
+  //
+  disp.Copy(*this);
+  return (*this);
 }