]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliDisplay.cxx
Default constructor added.
[u/mrichter/AliRoot.git] / STEER / AliDisplay.cxx
index e7b49b38e82727665dd2dba691b1c2fdfe289386..590998944e0760fff13341a1220111156d6558af 100644 (file)
 
 /*
 $Log$
+Revision 1.17  2001/10/21 18:38:44  hristov
+Several pointers were set to zero in the default constructors to avoid memory management problems
+
+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
 
@@ -59,11 +80,13 @@ Introduction of the Copyright and cvs Log
 #include <TMath.h>
 
 #include "AliRun.h"
+#include "AliStack.h"
 #include "AliDetector.h"
 #include "AliDisplay.h"
 #include "AliPoints.h"
 #include "TParticle.h"
 #include "TGeometry.h"
+#include "AliHeader.h"
 
 static const Float_t kptcutmax  = 2;
 static const Float_t ketacutmax = 1.5;
@@ -78,6 +101,20 @@ AliDisplay::AliDisplay()
   // 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;
+  fTracksToDisplay =0;
+  fNTracksToDisplay =0;
 }
 
 //_____________________________________________________________________________
@@ -193,7 +230,6 @@ AliDisplay::AliDisplay(Int_t size)
    Float_t dxtr     = 0.15;
    Float_t dytr     = 0.45;
    fTrigPad = new TPad("trigger", "range and mode pad",0,0,dxtr,dytr);
-   fTrigPad->SetEditable(kFALSE);
    fTrigPad->Draw();
    fTrigPad->cd();
    fTrigPad->SetFillColor(22);
@@ -259,7 +295,11 @@ AliDisplay::AliDisplay(Int_t size)
    cutaxis->SetTitle("Etacut .  ");
    fEtaSlider->GetListOfPrimitives()->AddFirst(etaaxis);
    fCanvas->cd();
-   
+
+   fTrigPad->SetEditable(kFALSE);
+   fButtons->SetEditable(kFALSE);
+   fTracksToDisplay =0;
+   fNTracksToDisplay =0;   
 
    fCanvas->cd();
    fCanvas->Update();
@@ -299,7 +339,11 @@ void AliDisplay::Copy(AliDisplay &disp) const
 }
 
 //----------------------------------------------------------------------------
-void AliDisplay::ShowTrack(Int_t idx) {
+void AliDisplay::ShowTrack(Int_t idx) 
+{
+  //
+  // Display track idx
+  //
    AliDetector *mTPC=(AliDetector*)gAlice->GetModule("TPC");
    TObjArray *points=mTPC->Points();
    int ntracks=points->GetEntriesFast();
@@ -312,8 +356,9 @@ void AliDisplay::ShowTrack(Int_t idx) {
          pm->Draw("same");
 //       fPad->Update();
 //       fPad->Modified();
-         TClonesArray *particles=gAlice->Particles();
-         TParticle *p = (TParticle*)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->GetPdgCode());
          printf("Parent %d\n",p->GetFirstMother());
@@ -363,7 +408,6 @@ void AliDisplay::DisplayButtons()
 //    Create the user interface buttons
 
    fButtons = new TPad("buttons", "newpad",0,0.45,0.15,1);
-   fButtons->SetEditable(kFALSE);
    fButtons->Draw();
    fButtons->SetFillColor(38);
    fButtons->SetBorderSize(2);
@@ -561,7 +605,7 @@ void AliDisplay::DrawHits()
          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();
@@ -737,6 +781,13 @@ void AliDisplay::ExecuteEvent(Int_t event, Int_t px, Int_t py)
 
 }
  
+
+void AliDisplay::SetTracksToDisplay(Int_t *tracks, Int_t n){
+  //
+  // set tracks to display  - MI
+  fTracksToDisplay = tracks;
+  fNTracksToDisplay = n;
+}
 //___________________________________________
 void AliDisplay::LoadPoints()
 {
@@ -747,14 +798,28 @@ void AliDisplay::LoadPoints()
    TIter next(gAlice->Modules());
    AliModule *module;
    Int_t ntracks = gAlice->GetNtrack();
-   for (Int_t track=0; track<ntracks;track++) {
+   
+   // load only wanted tracks
+   if (fNTracksToDisplay>0){
+     Int_t nprim =  gAlice->Stack()->GetNprimary();
+     for (Int_t track=0; track<fNTracksToDisplay;track++) {
       gAlice->ResetHits();
-      gAlice->TreeH()->GetEvent(track);
+      gAlice->TreeH()->GetEvent(nprim-1-gAlice->GetPrimary(fTracksToDisplay[track]));
       while((module = (AliModule*)next())) {
-         module->LoadPoints(track);
+       module->LoadPoints(nprim-1-gAlice->GetPrimary(fTracksToDisplay[track]));
       }
       next.Reset();
+     }
    }
+   else
+     for (Int_t track=0; track<ntracks;track++) {
+       gAlice->ResetHits();
+       gAlice->TreeH()->GetEvent(track);
+       while((module = (AliModule*)next())) {
+         module->LoadPoints(track);
+       }
+       next.Reset();
+     }
 }
 
 //_____________________________________________________________________________