]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EVE/alice-macros/tpc_digits.C
From Mario: minor change according to the new ID volumes (now go from 0 to 59).
[u/mrichter/AliRoot.git] / EVE / alice-macros / tpc_digits.C
index 377b7990b4ec422fb3ead36f540cc4766e2f5000..a2666314cd34489159ac2d28b596457a8663ab56 100644 (file)
@@ -7,38 +7,19 @@
  * full copyright notice.                                                 *
  **************************************************************************/
 
-#include "TGLViewer.h"
-
-namespace Alieve {
-class AliEveTPCData;
-class AliEveEventManager;
-}
-
-AliEveTPCData* g_tpc_data = 0;
-AliEveEventManager*   g_tpc_last_event = 0;
-
 void tpc_digits(Int_t mode=1)
 {
-  if (g_tpc_data == 0 || g_tpc_last_event != gEvent) {
-    AliRunLoader* rl =  AliEveEventManager::AssertRunLoader();
-    rl->LoadDigits("TPC");
-    TTree* dt = rl->GetTreeD("TPC", false);
-
-    g_tpc_data = new AliEveTPCData;
-    g_tpc_data->LoadDigits(dt, kTRUE); // Create all present sectors.
-
-    g_tpc_last_event = gEvent;
+  AliRunLoader* rl =  AliEveEventManager::AssertRunLoader();
+  rl->LoadDigits("TPC");
+  TTree* dt = rl->GetTreeD("TPC", false);
+  if (dt == 0)
+  {
+    throw TEveException("tpc_digits Can not access digits tree.");
   }
 
-  // Viewport limits.
-  /*
-  Float_t left, right, top, bottom;
-  right  = di->fOut2Seg.fNMaxPads* di->fOut2Seg.fPadWidth;
-  left   = -right;
-  bottom = di->fInnSeg.fRlow;
-  top    = bottom + di->fOut2Seg.fRlow +
-    di->fOut2Seg.fNRows*di->fOut2Seg.fPadLength - di->fInnSeg.fRlow;
-  */
+  AliEveTPCData *x = new AliEveTPCData;
+
+  x->LoadDigits(dt, kTRUE); // Create all present sectors.
 
   gStyle->SetPalette(1, 0);
   Color_t col = 36;
@@ -48,11 +29,11 @@ void tpc_digits(Int_t mode=1)
   case 0: { // Display a single sector
     AliEveTPCSector2D* s = new AliEveTPCSector2D();
     s->SetFrameColor(col);
-    s->SetDataSource(g_tpc_data);
+    s->SetDataSource(x);
     gEve->AddElement(s);
     gEve->Redraw3D();
 
-    //TGLViewer* cam = gEve->GetGLViewer();
+    //TGLViewer* cam = gEve->GetDefaultGLViewer();
     //cam->SetCurrentCamera(TGLViewer::kCameraOrthoXOY) ;
     //cam->SetOrthoCamera(TGLViewer::kCameraOrthoXOY, 2*left, 2*right, 2*top, bottom);
     //printf("%f %f %f %f\n", left, right, top, bottom);
@@ -65,31 +46,33 @@ void tpc_digits(Int_t mode=1)
     {
       TEveElementList* l = new TEveElementList("TPC plate 1");
       l->SetTitle("TPC Plate");
-      l->SetMainColor(Color_t(col));
+      l->SetMainColor(col);
       gEve->AddElement(l);
 
-      for(Int_t i = 0; i<18; i++) {
+      for (Int_t i = 0; i<18; i++)
+      {
        AliEveTPCSector2D* s = new AliEveTPCSector2D(Form("AliEveTPCSector2D %d", i));
        s->SetSectorID(i);
-       s->SetDataSource(g_tpc_data);
+       s->SetDataSource(x);
        s->SetFrameColor(col);
        s->SetAutoTrans(kTRUE);
-       gEve->AddElement(s, l);
+       l->AddElement(s);
       }
     }
     {
       TEveElementList* l = new TEveElementList("TPC plate 2");
       l->SetTitle("TPC Plate");
-      l->SetMainColor(Color_t(col));
+      l->SetMainColor(col);
 
       gEve->AddElement(l);
-      for(Int_t i = 18; i<36; i++) {
+      for (Int_t i = 18; i<36; i++)
+      {
        AliEveTPCSector2D* s = new AliEveTPCSector2D(Form("AliEveTPCSector2D %d", i));
        s->SetSectorID(i);
-       s->SetDataSource(g_tpc_data);
+       s->SetDataSource(x);
        s->SetFrameColor(col);
        s->SetAutoTrans(kTRUE);
-       gEve->AddElement(s, l);
+       l->AddElement(s);
       }
     }
     gEve->EnableRedraw();
@@ -100,7 +83,7 @@ void tpc_digits(Int_t mode=1)
   case 2 : { // Display a single sector in 3D
     AliEveTPCSector3D* s = new AliEveTPCSector3D();
     s->SetFrameColor(col);
-    s->SetDataSource(g_tpc_data);
+    s->SetDataSource(x);
     gEve->AddElement(s);
     gEve->Redraw3D();
     break;
@@ -111,31 +94,33 @@ void tpc_digits(Int_t mode=1)
     {
       TEveElementList* l = new TEveElementList("TPC plate 1");
       l->SetTitle("TPC Plate");
-      l->SetMainColor(Color_t(col));
+      l->SetMainColor(col);
       gEve->AddElement(l);
 
-      for(Int_t i = 0; i<18; i++) {
+      for (Int_t i = 0; i<18; i++)
+      {
        AliEveTPCSector3D* s = new AliEveTPCSector3D(Form("AliEveTPCSector3D %d", i));
        s->SetSectorID(i);
-       s->SetDataSource(g_tpc_data);
+       s->SetDataSource(x);
        s->SetFrameColor(col);
        s->SetAutoTrans(kTRUE);
-       gEve->AddElement(s, l);
+       l->AddElement(s);
       }
     }
     {
       TEveElementList* l = new TEveElementList("TPC plate 2");
       l->SetTitle("TPC Plate");
-      l->SetMainColor(Color_t(col));
+      l->SetMainColor(col);
 
       gEve->AddElement(l);
-      for(Int_t i = 18; i<36; i++) {
+      for (Int_t i = 18; i<36; i++)
+      {
        AliEveTPCSector3D* s = new AliEveTPCSector3D(Form("AliEveTPCSector3D %d", i));
        s->SetSectorID(i);
-       s->SetDataSource(g_tpc_data);
+       s->SetDataSource(x);
        s->SetFrameColor(col);
        s->SetAutoTrans(kTRUE);
-       gEve->AddElement(s, l);
+       l->AddElement(s);
       }
     }
     gEve->EnableRedraw();
@@ -152,16 +137,17 @@ void tpc_digits_2drange(Int_t start, Int_t end)
   if (start <  0)  start = 0;
   if (end   > 35)  end   = 35;
 
-  if (g_tpc_data == 0 || g_tpc_last_event != gEvent) {
-    AliRunLoader* rl =  AliEveEventManager::AssertRunLoader();
-    rl->LoadDigits("TPC");
-    TTree* dt = rl->GetTreeD("TPC", false);
+  AliRunLoader* rl =  AliEveEventManager::AssertRunLoader();
+  rl->LoadDigits("TPC");
+  TTree* dt = rl->GetTreeD("TPC", false);
+  if (dt == 0)
+  {
+    throw TEveException("tpc_digits Can not access digits tree.");
+  }
 
-    g_tpc_data = new AliEveTPCData;
-    g_tpc_data->LoadDigits(dt, kTRUE); // Create all present sectors.
+  AliEveTPCData *x = new AliEveTPCData;
 
-    g_tpc_last_event = gEvent;
-  }
+  x->LoadDigits(dt, kTRUE); // Create all present sectors.
 
   gStyle->SetPalette(1, 0);
   Color_t col = 36;
@@ -169,13 +155,14 @@ void tpc_digits_2drange(Int_t start, Int_t end)
   gEve->DisableRedraw();
   {
     TEveElementList* l = new TEveElementList("TPC sectors");
-    l->SetMainColor(Color_t(col));
+    l->SetMainColor(col);
     gEve->AddElement(l);
 
-    for(Int_t i=start; i<=end; i++) {
+    for (Int_t i=start; i<=end; i++)
+    {
       AliEveTPCSector2D* s = new AliEveTPCSector2D();
       s->SetSectorID(i);
-      s->SetDataSource(g_tpc_data);
+      s->SetDataSource(x);
       s->SetFrameColor(col);
       s->SetAutoTrans(kTRUE);
       gEve->AddElement(s, l);