]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Merge from EVE-dev to HEAD.
authormtadel <mtadel@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 23 May 2006 20:19:59 +0000 (20:19 +0000)
committermtadel <mtadel@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 23 May 2006 20:19:59 +0000 (20:19 +0000)
39 files changed:
EVE/Alieve/.SKEL-ged.cxx
EVE/Alieve/.SKEL-ged.h
EVE/Alieve/ChangeLog
EVE/Alieve/ITSModule.cxx
EVE/Alieve/ITSModule.h
EVE/Alieve/LinkDef.h
EVE/Alieve/TPCData.cxx
EVE/Alieve/TPCData.h
EVE/Alieve/TPCSector2D.cxx
EVE/Alieve/TPCSector2D.h
EVE/Alieve/TPCSector2DEditor.cxx
EVE/Alieve/TPCSector2DEditor.h
EVE/Alieve/TPCSector2DGL.cxx
EVE/Alieve/TPCSector3D.cxx [new file with mode: 0644]
EVE/Alieve/TPCSector3D.h [new file with mode: 0644]
EVE/Alieve/TPCSector3DEditor.cxx [new file with mode: 0644]
EVE/Alieve/TPCSector3DEditor.h [new file with mode: 0644]
EVE/Alieve/TPCSectorData.cxx
EVE/Alieve/TPCSectorData.h
EVE/Alieve/TPCSectorViz.cxx [new file with mode: 0644]
EVE/Alieve/TPCSectorViz.h [new file with mode: 0644]
EVE/Alieve/TPCSectorVizEditor.cxx [new file with mode: 0644]
EVE/Alieve/TPCSectorVizEditor.h [new file with mode: 0644]
EVE/ChangeLog
EVE/Reve/BoxSet.cxx
EVE/Reve/BoxSet.h
EVE/Reve/ChangeLog
EVE/Reve/LinkDef.h
EVE/Reve/RGBrowser.cxx
EVE/Reve/RGTopFrame.cxx
EVE/Reve/RenderElement.cxx
EVE/Reve/RenderElement.h
EVE/Reve/Reve.cxx
EVE/Reve/Reve.h
EVE/alice-macros/region_marker.C [new file with mode: 0644]
EVE/alice-macros/tpc_digits.C
EVE/macros/alieve_init.C
EVE/macros/alieve_loadlibs.C
EVE/test-macros/tpc_sector_raw_test.C [new file with mode: 0644]

index f0fe7e5091da78a7cc87596bd4b3bd5d85794689..52db756ab57a238db80e8ab2729c7198084acdac 100644 (file)
@@ -1,7 +1,7 @@
 // $Header$
 
 #include "CLASS.h"
-#include <Reve/STEM.h>
+#include <Alieve/STEM.h>
 
 #include <TVirtualPad.h>
 #include <TColor.h>
index ab0df9d7a9af307cdd94ab2c031b02efc55f4bfc..1d0f15e5ce0d55e2dd93929926bc79b926a3bd2b 100644 (file)
@@ -26,7 +26,7 @@ public:
 
   // void DoXYZZ();
 
-  ClassDef(CLASS, 1); // Editor for STEM
+  ClassDef(CLASS, 0); // Editor for STEM
 }; // endclass CLASS
 
 }
index 2d08138e87eca794f37312a8c1622e9a47e3de25..39808243320bedd6d999766775558571daf32b6e 100644 (file)
@@ -1,6 +1,79 @@
+2006-05-23  Matevz Tadel  <matevz.tadel@cern.ch>
+
+       EVE-dev
+
+       * TPCSector2D.cxx:
+       Honor fRnrElement in Paint(); it was impossible to disable
+       rendering of 2D sectors.
+
+2006-05-23  Matevz Tadel  <matevz.tadel@cern.ch>
+
+       EVE-dev
+
+       * TPCData.cxx:
+       * TPCData.h:
+       In LoadRaw(AliTPCRawStreamOld&) added protection against repeated
+       data for a given pad; added methods DropAllSectors() and
+       DeleteAllSectors().
+
+       * TPCSectorData.cxx:
+       * TPCSectorData.h:
+       Added method DropData(); in EndPad() return immediately if no data
+       was registered.
+
+       * TPCSector2D.h:
+       * TPCSector2DGL.cxx:
+       * TPCSectorViz.cxx:
+       * TPCSectorViz.h:
+       Increase of rendering time-stamp now done in a virtual function
+       IncRTS(); renamed fFrameCol to fFrameColor; minor cleanup.
+
+       * TPCSector3D.cxx:
+       * TPCSector3D.h:
+       * TPCSector3DEditor.cxx:
+       * TPCSector3DEditor.h:
+       * LinkDef.h:
+       New classes TPCSector3D and TPCSector3DEditor.
+
+       * ITSModule.cxx:
+       * ITSModule.h:
+       Renamed fFrameCol to fFrameColor.
+
+2006-05-19  Matevz Tadel  <matevz.tadel@cern.ch>
+
+       EVE-dev and HEAD
+
+       * TPCData.cxx:
+       * TPCData.h:
+       * TPCSectorData.cxx:
+       * TPCSectorData.h:
+       Add support for automatic pedestal determination and subtraction
+       on per pad basis (for RAW data only). Done with Marian.
+
+       EVE-dev
+
+       * LinkDef.h:
+       * TPCSector2D.cxx:
+       * TPCSector2D.h:
+       * TPCSector2DEditor.cxx:
+       * TPCSector2DEditor.h:
+       * TPCSectorViz.cxx:
+       * TPCSectorViz.h:
+       * TPCSectorVizEditor.cxx:
+       * TPCSectorVizEditor.h:
+       Split TPCSectorViz from TPCSector2D as a base class. TPCSectorViz
+       holds the general parametrs that will also be used by TPCSector3D.
+
+       * TPCSector2DGL.cxx:
+       Use Reve::ColorFromIdx().
+
+       * .SKEL-ged.cxx:
+       * .SKEL-ged.h:
+       Include from Alieve, default class version 0.
+
 2006-05-18  Matevz Tadel  <matevz.tadel@cern.ch>
 
-       EVE-dev branch
+       EVE-dev
 
        * TPCData.cxx:
        * TPCData.h:
@@ -21,7 +94,7 @@
 
 2006-05-18  Matevz Tadel  <matevz.tadel@cern.ch>
 
-       EVE-dev branch
+       EVE-dev
 
        * ITSModule.cxx:
        * TPCSector2D.cxx:
 
 2006-05-18  Matevz Tadel  <matevz.tadel@cern.ch>
 
-       EVE-dev branch
+       EVE-dev
 
        * TPCData.cxx:
        * TPCData.h:
 
 2006-05-17  Matevz Tadel  <matevz.tadel@cern.ch>
 
-       EVE-dev branch
+       EVE-dev
 
        Introduce support for reading of raw TPC data. At the same time
        the TPCSegment* classes have been renamed to TPCSector*.
index 01bed5ca99539f4a7b744b6e6f5da382c8f0ce74..b00cb6f0d3827a338fe530704c17b4b7ba32b859 100644 (file)
@@ -29,8 +29,8 @@ void ITSModule::Init()
 /**************************************************************************/
 
 ITSModule::ITSModule(Int_t id, ITSDigitsInfo* info, Color_t col) :
-  QuadSet(Form("ITS module %d", id)), Reve::RenderElement(fFrameCol),
-  fFrameCol(col)
+  QuadSet(Form("ITS module %d", id)), Reve::RenderElement(fFrameColor),
+  fFrameColor(col)
 {
   Init();
   
@@ -110,7 +110,7 @@ void ITSModule::LoadQuads()
   Bool_t aboveThreshold = false;
 
   // Module frame in xy plane
-  fQuads.push_back(Reve::Quad(fFrameCol));
+  fQuads.push_back(Reve::Quad(fFrameColor));
   Float_t dy = -0.;
   Float_t* p = fQuads.back().vertices;
   p[0] = -x;  p[1] =  dy; p[2]  = -z;
index d91da902cdb198ebf53e72d3674d9e2369efd3ba..618f522eece76824051a1d474f619e2f396d7be2 100644 (file)
@@ -31,11 +31,11 @@ protected:
   Float_t     fDz;
   Float_t     fDy;
 
-  Color_t     fFrameCol;
+  Color_t     fFrameColor;
 
 public:
   ITSModule(const Text_t* n="ITSModule", const Text_t* t=0, Color_t col=2) :
-    QuadSet(n, t), Reve::RenderElement(fFrameCol), fFrameCol(col)
+    QuadSet(n, t), Reve::RenderElement(fFrameColor), fFrameColor(col)
   { Init(); }
   ITSModule(Int_t id, ITSDigitsInfo* info, Color_t col=2);
   virtual ~ITSModule();
index 3c2d67e2b86c1fc8a54b3fc3e1f336b2bd131f1c..9fa66c5c3b1f6b8aeebc945beb277cee8c7ebdcf 100644 (file)
 #pragma link C++ class Alieve::TPCSectorData::RowIterator;
 #pragma link C++ class Alieve::TPCSectorData::SegmentInfo;
 
+#pragma link C++ class Alieve::TPCSectorViz+;
+#pragma link C++ class Alieve::TPCSectorVizEditor+;
 #pragma link C++ class Alieve::TPCSector2D+;
 #pragma link C++ class Alieve::TPCSector2DEditor+;
 #pragma link C++ class Alieve::TPCSector2DGL+;
-
-// Almost ready
-// #pragma link C++ class Alieve::TPCSector3D+;
-// #pragma link C++ class Alieve::TPCSector3DEditor+;
+#pragma link C++ class Alieve::TPCSector3D+;
+#pragma link C++ class Alieve::TPCSector3DEditor+;
index c17b8b899c9d32888cf0ef82e8cfca97b04da9b0..38b81f1a400393c1669429789edb1dbb680cfe53 100644 (file)
@@ -23,6 +23,13 @@ using namespace Alieve;
 // Sectors 0 - 17: +z side, 18 - 35: -z side.
 // No separation of inner/outer segments, use row numbers for addressing.
 //
+// Threshold application and pedestal subtraction can be performed at
+// load time: use SetLoadThreshold(thresh) and SetLoadPedestal(ped).
+//
+// For raw-data (loaded using LoadRaw) pedestals can be calculated
+// automatically per pad. Use SetAutoPedestal(kTRUE) to activate it. 
+// You might still want to set load threshold (default iz zero).
+//
 
 ClassImp(TPCData)
 
@@ -35,7 +42,7 @@ TPCData::TPCData() :
 
 TPCData::~TPCData()
 {
-  // !!!! delete sectors
+  DeleteAllSectors();
 }
 
 /**************************************************************************/
@@ -52,6 +59,22 @@ void TPCData::CreateAllSectors()
     CreateSector(s);
 }
 
+void TPCData::DropAllSectors()
+{
+  for(Int_t s=0; s<36; ++s) {
+    if(fSectors[s] != 0)
+      fSectors[s]->DropData();
+  }
+}
+
+void TPCData::DeleteAllSectors()
+{
+  for(Int_t s=0; s<36; ++s) {
+    delete fSectors[s];
+    fSectors[s] = 0;
+  }
+}
+
 /**************************************************************************/
 
 TPCSectorData* TPCData::GetSectorData(Int_t sector, Bool_t spawnSectors)
@@ -185,8 +208,10 @@ void TPCData::LoadRaw(AliTPCRawStreamOld& input, Bool_t spawnSectors, Bool_t war
   static const Exc_t eH("TPCData::LoadRaw ");
 
   Int_t   sector = -1, row = -1, pad = -1, rowOffset = 0;
-  Short_t time, signal;
-  Bool_t  inFill = kFALSE;
+  Short_t time,  signal;
+  Bool_t  inFill   = kFALSE;
+  Short_t lastTime = 9999;
+  Bool_t  lastTimeWarn = kFALSE;
   TPCSectorData* secData = 0;
 
   while (input.Next()) {
@@ -224,11 +249,21 @@ void TPCData::LoadRaw(AliTPCRawStreamOld& input, Bool_t spawnSectors, Bool_t war
       }
 
       secData->BeginPad(row, pad, kTRUE);
-      inFill = kTRUE;
+      inFill   = kTRUE;
+      lastTime = 1024;  lastTimeWarn = kFALSE;
     }
 
     time   = input.GetTime();
     signal = input.GetSignal();
+    if(time >= lastTime) {
+      if(lastTimeWarn == kFALSE) {
+        Warning(eH.Data(), "time out of order (row=%d, pad=%d, time=%d, lastTime=%d).",
+                row, pad, time, lastTime);
+        lastTimeWarn = kTRUE;
+      }
+      continue;
+    }
+    lastTime = time;
     if(fAutoPedestal) {
       secData->RegisterData(time, signal);
     } else {
index 26b7372715ecc8be0fb6263a4634396cd4799161..d187f60ea3025b6782c64190e4afbe3476be1e1b 100644 (file)
@@ -32,6 +32,8 @@ public:
 
   void CreateSector(Int_t sector);
   void CreateAllSectors();
+  void DropAllSectors();
+  void DeleteAllSectors();
 
   TPCSectorData* GetSectorData(Int_t sector, Bool_t spawnSectors=kFALSE);
 
index c8dceb2e40819e3b2c14123d091a1b1b4b03de1d..a6d95c1a187337ab05a8d7965dbdf0d856b96bea 100644 (file)
@@ -7,60 +7,43 @@
 
 #include <AliTPCParam.h>
 
+#include <TBuffer3D.h>
+#include <TBuffer3DTypes.h>
+#include <TVirtualPad.h>
+#include <TVirtualViewer3D.h>
+
 using namespace Reve;
 using namespace Alieve;
 using namespace std;
 
+//______________________________________________________________________
+// TPCSector2D
+//
+// Displays TPC raw-data in 2D.
+//
+// fShowMax: true  - display maximum value for given time interval
+//           false - display integral
+// fAverage: only available when fShowMax = false; divide by time window width
+//
+// fUseTexture: use OpenGL textures to display data (fast rendering,
+//   updates take the same time)
+//
+
 ClassImp(TPCSector2D)
 
 /**************************************************************************/
 
-void TPCSector2D::Init()
-{
-  fTPCData   = 0;
-
-  fSectorID  = 0;
-  fShowMax   = kTRUE;
-  fAverage   = kFALSE;
-  fMinTime   = 0;
-  fMaxTime   = 450;
-  fThreshold = 5;
-  fMaxVal    = 80;
-
-  fRnrInn    = kTRUE;
-  fRnrOut1   = kTRUE;
-  fRnrOut2   = kTRUE;
+TPCSector2D::TPCSector2D(const Text_t* n, const Text_t* t) :
+  TPCSectorViz(n,t),
 
-  fRnrFrame   = kTRUE;
-  fUseTexture = kTRUE;
+  fShowMax (kTRUE),
+  fAverage (kFALSE),
 
-  fTrans      = kFALSE;
-}
+  fUseTexture (kTRUE)
+{}
 
 TPCSector2D::~TPCSector2D()
-{
-  if(fTPCData) fTPCData->DecRefCount();
-}
-
-/**************************************************************************/
-
-void TPCSector2D::SetDataSource(TPCData* data)
-{
-  if(data == fTPCData) return;
-  if(fTPCData) fTPCData->DecRefCount();
-  fTPCData = data;
-  if(fTPCData) fTPCData->IncRefCount();
-  ++fRTS;
-}
-
-void TPCSector2D::SetSectorID(Int_t segment)
-{
-  if(segment < 0 ) segment = 0;
-  if(segment > 35) segment = 35;
-  fSectorID = segment;
-  SetName(Form("TPCSector2D %d", fSectorID));
-  ++fRTS;
-}
+{}
 
 /**************************************************************************/
 
@@ -81,33 +64,11 @@ void TPCSector2D::ComputeBBox()
 
 /**************************************************************************/
 
-void TPCSector2D::SetTrans(Bool_t trans) 
-{
-  fTrans = trans;
-  if(fTrans) {
-    for (Int_t k = 0; k< 16; k++)
-      fMatrix[k] = 0.;
-
-    Float_t c = TMath::Cos((fSectorID + 0.5)*20*TMath::Pi()/180 - TMath::Pi()/2);
-    Float_t s = TMath::Sin((fSectorID + 0.5)*20*TMath::Pi()/180 - TMath::Pi()/2);
-    Float_t z = TPCSectorData::GetParam().GetZLength();
-    if(fSectorID >= 18) z = -z;
-  
-    // column major
-    fMatrix[0]  = -c;
-    fMatrix[1]  = -s;
-    fMatrix[4]  = -s;
-    fMatrix[5]  =  c;
-    fMatrix[10] = -1;
-    fMatrix[14] =  z;
-    fMatrix[15] =  1;
-  }
-}
-
-/**************************************************************************/
-
 void TPCSector2D::Paint(Option_t* )
 {
+  if(fRnrElement == kFALSE)
+    return;
+
   TBuffer3D buffer(TBuffer3DTypes::kGeneric);
 
   // Section kCore
index a1e83967dc3aff4dea468acbdb284c4976706cda..be384ec185b67eae71453bff4a5f1300c6565bee 100644 (file)
@@ -3,87 +3,37 @@
 #ifndef ALIEVE_TPCSector2D_H
 #define ALIEVE_TPCSector2D_H
 
-#include <Reve/RenderElement.h>
-
-#include <TNamed.h> 
-#include <TBuffer3D.h>
-#include <TBuffer3DTypes.h>
-#include <TGeometry.h>
-#include <TVirtualPad.h>
-#include <TVirtualViewer3D.h>
-#include <TAtt3D.h>
-#include <TAttBBox.h>
+#include "TPCSectorViz.h"
 
 
 namespace Alieve {
 
-class TPCData;
-
 class TPCSector2DEditor;
 class TPCSector2DGL;
 
-class TPCSector2D : public TNamed, public TAtt3D, public TAttBBox, public Reve::RenderElement
+class TPCSector2D : public TPCSectorViz
 {
   friend class TPCSector2DGL;
   friend class TPCSector2DEditor;
 
-private:
-  void Init();
-
 protected:
-  TPCData*    fTPCData; 
-
-  // These change data representation:
-  Int_t       fSectorID; 
   Bool_t      fShowMax;
   Bool_t      fAverage;
-  Int_t       fMinTime;     
-  Int_t       fMaxTime;
-  Short_t     fThreshold;
-  Int_t       fMaxVal;
-
-  Bool_t      fRnrInn;
-  Bool_t      fRnrOut1;
-  Bool_t      fRnrOut2;
 
-  Bool_t      fRnrFrame;
   Bool_t      fUseTexture;
-  Color_t     fFrameCol;
-
-  Double_t    fMatrix[16];
-  Bool_t      fTrans;
-  UInt_t      fRTS;       //! Rendering TimeStamp
 
 public:
-  TPCSector2D(const Text_t* n="TPCSector2D", const Text_t* t=0, Color_t col=2) : 
-    TNamed(n,t), Reve::RenderElement(fFrameCol), fFrameCol(col), fRTS(1)
-  { Init(); }
-
+  TPCSector2D(const Text_t* n="TPCSector2D", const Text_t* t=0);
   virtual ~TPCSector2D();
 
-  void SetDataSource(TPCData* data);
-  virtual void SetSectorID(Int_t id);
-
-  void SetRnrInn(Bool_t r)  { fRnrInn = r; ++fRTS; }
-  void SetRnrOut1(Bool_t r) { fRnrOut1 = r; ++fRTS; }
-  void SetRnrOut2(Bool_t r) { fRnrOut2 = r; ++fRTS; }
-
-  void SetShowMax(Bool_t sm)  { fShowMax  = sm; ++fRTS; }
-  void SetAverage(Bool_t avg) { fAverage  = avg; ++fRTS; }
-  void SetMinTime(Int_t mt)   { fMinTime  = mt; ++fRTS; }
-  void SetMaxTime(Int_t mt)   { fMaxTime  = mt; ++fRTS; }
-  void SetThreshold(Short_t t) { fThreshold =  t; ++fRTS; }
-  void SetMaxVal(Int_t mv)    { fMaxVal   = mv; ++fRTS; }
+  void SetShowMax(Bool_t sm)  { fShowMax  = sm;  IncRTS(); }
+  void SetAverage(Bool_t avg) { fAverage  = avg; IncRTS(); }
 
   virtual void ComputeBBox();
 
   virtual void Paint(Option_t* option="");
 
-  virtual void SetTrans(Bool_t t);
-
-  virtual Bool_t CanEditMainColor()  { return true; }
-
-  ClassDef(TPCSector2D, 1);
+  ClassDef(TPCSector2D, 1); // Visualization of TPC raw-data in 2D
 }; // endclass TPCSector2D
 
 }
index 0aace9afbc249398f604c968b754512c235057fb..fa7d1d902d0eacda6cf63d536b66659eeffa2631 100644 (file)
@@ -43,65 +43,6 @@ ClassImp(TPCSector2DEditor)
   fUseTexture->Connect
     ("Toggled(Bool_t)","Alieve::TPCSector2DEditor", this, "DoUseTexture()");
 
-  {
-    TGHorizontalFrame* f = new TGHorizontalFrame(this);
-    TGLabel *l = new TGLabel(f, "SectorID:");
-    f->AddFrame(l, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 3, 2, 1, 1));
-
-    fSectorID = new TGNumberEntry(f, 0., 6, -1, 
-                                 TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative,
-                                 TGNumberFormat::kNELLimitMinMax, 0, 35);
-
-    fSectorID->GetNumberEntry()->SetToolTipText("0-17 +z plate 18-35 -z plate");
-    f->AddFrame(fSectorID, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
-    fSectorID->Associate(this);
-    fSectorID->Connect("ValueSet(Long_t)",
-                      "Alieve::TPCSector2DEditor", this, "DoSectorID()");
-
-    AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
-  }
-  {
-    TGHorizontalFrame* f = new TGHorizontalFrame(this);
-
-    fRnrInn = new TGCheckButton(f, "Inner");
-    f->AddFrame(fRnrInn, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
-    fRnrInn->Connect("Toggled(Bool_t)","Alieve::TPCSector2DEditor", this, "DoRnrInn()");
-
-    fRnrOut1 = new TGCheckButton(f, "Outer 1");
-    f->AddFrame(fRnrOut1, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
-    fRnrOut1->Connect("Toggled(Bool_t)","Alieve::TPCSector2DEditor", this, "DoRnrOut1()");
-
-    fRnrOut2 = new TGCheckButton(f, "Outer 2");
-    f->AddFrame(fRnrOut2, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
-    fRnrOut2->Connect("Toggled(Bool_t)","Alieve::TPCSector2DEditor", this, "DoRnrOut2()");
-
-    AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
-  }
-  {
-    TGHorizontalFrame* f = new TGHorizontalFrame(this);
-    fThresholdLabel = new TGLabel(f, "Threshold [XXX]:");
-    f->AddFrame(fThresholdLabel, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 3, 2, 1, 1));
-
-    fThreshold = new TGHSlider(f, 150);
-    fThreshold->SetRange(0,149);
-    fThreshold->Associate(this);
-    f->AddFrame(fThreshold, new TGLayoutHints(kLHintsLeft, 0, 5));
-    fThreshold->Connect("PositionChanged(Int_t)",
-                       "Alieve::TPCSector2DEditor", this, "DoThreshold()");
-    AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
-  }
-  {
-    TGHorizontalFrame* f = new TGHorizontalFrame(this);
-    fMaxValLabel = new TGLabel(f, "MaxValue [XXX]:");
-    f->AddFrame(fMaxValLabel, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 3, 2, 1, 1));
-    fMaxVal = new TGHSlider(f, 150);
-    fMaxVal->SetRange(0,299);
-    fMaxVal->Associate(this);
-    f->AddFrame(fMaxVal, new TGLayoutHints(kLHintsLeft, 0, 5));
-    fMaxVal->Connect("PositionChanged(Int_t)",
-                    "Alieve::TPCSector2DEditor", this, "DoMaxVal()");
-    AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
-  }
   {
     TGHorizontalFrame* f = new TGHorizontalFrame(this);
     fShowMax = new TGCheckButton(f, "ShowMax");
@@ -113,40 +54,7 @@ ClassImp(TPCSector2DEditor)
     AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
   }
 
-  {
-    TGVerticalFrame* vf = new TGVerticalFrame(this);
-    
-    TGHorizontalFrame* f = new TGHorizontalFrame(vf);
-
-    TGLabel *l = new TGLabel(f, "Time Range:");
-    f->AddFrame(l, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 1, 2, 1, 1));
-
-    fMinTime = new TGNumberEntry(f, 0., 6, -1, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative,
-                                TGNumberFormat::kNELLimitMinMax, 0, 1023);
-    fMinTime->GetNumberEntry()->SetToolTipText("MinTime");
-    f->AddFrame(fMinTime, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
-    fMinTime->Associate(this);
-    fMinTime->Connect("ValueSet(Long_t)", "Alieve::TPCSector2DEditor", this, "DoMinTime()");
-
-    fMaxTime = new TGNumberEntry(f, 0., 6, -1, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative,
-                                TGNumberFormat::kNELLimitMinMax, 0, 1023);
-    fMaxTime->GetNumberEntry()->SetToolTipText("MaxTime");
-    f->AddFrame(fMaxTime, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
-    fMaxTime->Associate(this);
-    fMaxTime->Connect("ValueSet(Long_t)", "Alieve::TPCSector2DEditor", this, "DoMaxTime()");
-
-    vf->AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
-
-    fTime = new TGDoubleHSlider(vf);
-    fTime->SetRange(0, 1023);
-    fTime->Resize(250, 20);
-    vf->AddFrame(fTime);//, new TGLayoutHints(kLHintsLeft, 0, 5));
-    fTime->Connect("PositionChanged()", "Alieve::TPCSector2DEditor",
-                  this, "DoTime()");
-
-    AddFrame(vf, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
-  }
-  // What is this crap?
+  // Register the editor.
   TClass *cl = TPCSector2DEditor::Class();
   TGedElement *ge = new TGedElement;
   ge->fGedFrame = this;
@@ -174,73 +82,16 @@ void TPCSector2DEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t )
 
   fM = dynamic_cast<TPCSector2D*>(fModel);
 
-  fUseTexture->SetState(fM->fUseTexture ? kButtonDown : kButtonUp);
-  fSectorID->SetNumber(fM->fSectorID);
-  fRnrInn->SetState(fM->fRnrInn   ? kButtonDown : kButtonUp);
-  fRnrOut1->SetState(fM->fRnrOut1 ? kButtonDown : kButtonUp);
-  fRnrOut2->SetState(fM->fRnrOut2 ? kButtonDown : kButtonUp);
-  fThresholdLabel->SetText(Form("Threshold [%3d]:", fM->fThreshold));
-  fThreshold->SetPosition(fM->fThreshold);
-
-  fMaxValLabel->SetText(Form("MaxValue [%3d]:", fM->fMaxVal));
-  fMaxVal->SetPosition(fM->fMaxVal);
-  fMinTime->SetNumber(fM->fMinTime);
-  fMaxTime->SetNumber(fM->fMaxTime);
-  fTime->SetPosition(fM->fMinTime, fM->fMaxTime);
-
   fShowMax->SetState(fM->fShowMax ? kButtonDown : kButtonUp);
   SetupAverage();
 
+  fUseTexture->SetState(fM->fUseTexture ? kButtonDown : kButtonUp);
+
   SetActive();
 }
 
 /**************************************************************************/
 
-void TPCSector2DEditor::DoUseTexture()
-{
-  fM->fUseTexture = fUseTexture->IsOn();
-  Update();
-}
-
-void TPCSector2DEditor::DoSectorID()
-{
-  fM->SetSectorID((Int_t) fSectorID->GetNumber());
-  Update();
-}
-
-void TPCSector2DEditor::DoRnrInn()
-{
-  fM->SetRnrInn(fRnrInn->IsOn());
-  Update();
-}
-
-void TPCSector2DEditor::DoRnrOut1()
-{
-  fM->SetRnrOut1(fRnrOut1->IsOn());
-  Update();
-}
-
-void TPCSector2DEditor::DoRnrOut2()
-{
-  fM->SetRnrOut2(fRnrOut2->IsOn());
-  Update();
-}
-
-
-void TPCSector2DEditor::DoThreshold()
-{
-  fM->SetThreshold((Short_t) fThreshold->GetPosition());
-  fThresholdLabel->SetText(Form("Threshold [%3d]:", fM->fThreshold));
-  Update();
-}
-
-void TPCSector2DEditor::DoMaxVal()
-{
-  fM->SetMaxVal((Int_t) fMaxVal->GetPosition());
-  fMaxValLabel->SetText(Form("MaxValue [%3d]:", fM->fMaxVal));
-  Update();
-}
-
 void TPCSector2DEditor::DoShowMax()
 {
   fM->SetShowMax(fShowMax->IsOn());
@@ -264,37 +115,10 @@ void TPCSector2DEditor::SetupAverage()
   }
 }
 
-void TPCSector2DEditor::DoMinTime()
-{
-  Int_t minTime = (Int_t) fMinTime->GetNumber();
-  if(minTime > fM->fMaxTime) {
-    minTime = fM->fMaxTime;
-    fMinTime->SetNumber(minTime);
-  }
-  fM->SetMinTime(minTime);
-  fTime->SetPosition(minTime, fM->fMaxTime);
-  Update();
-}
+/**************************************************************************/
 
-void TPCSector2DEditor::DoMaxTime()
+void TPCSector2DEditor::DoUseTexture()
 {
-  Int_t maxTime = (Int_t) fMaxTime->GetNumber();
-  if(maxTime < fM->fMinTime) {
-    maxTime = fM->fMinTime;
-    fMaxTime->SetNumber(maxTime);
-  }
-  fM->SetMaxTime(maxTime);
-  fTime->SetPosition(fM->fMinTime, maxTime);
-  Update();
-}
-
-void TPCSector2DEditor::DoTime()
-{ 
-  Int_t min = (Int_t) TMath::Nint(fTime->GetMinPosition());
-  Int_t max = (Int_t) TMath::Nint(fTime->GetMaxPosition());
-  fM->SetMinTime(min);
-  fM->SetMaxTime(max);
-  fMinTime->SetNumber(min);
-  fMaxTime->SetNumber(max);
+  fM->fUseTexture = fUseTexture->IsOn();
   Update();
 }
index eae4633aa668dc2d42b97e118330528a6a167f3a..32a9c5294cb4ec74a929e2b83f7acfb38066dd17 100644 (file)
@@ -11,6 +11,7 @@ class TGColorSelect;
 class TGDoubleHSlider;
 class TGHSlider;
 
+
 namespace Alieve {
 
 class TPCSector2D;
@@ -20,51 +21,23 @@ class TPCSector2DEditor : public TGedFrame
 protected:
   TPCSector2D* fM; // fModel dynamic-casted to TPCSector2DEditor
 
-  TGCheckButton*   fUseTexture;
-
-  TGNumberEntry*   fSectorID;
-
-  TGCheckButton*   fRnrInn;
-  TGCheckButton*   fRnrOut1;
-  TGCheckButton*   fRnrOut2;
-
-  TGLabel*         fThresholdLabel;
-  TGLabel*         fMaxValLabel;
-  TGHSlider*       fThreshold;
-  TGHSlider*       fMaxVal;
-
   TGCheckButton*   fShowMax;
   TGCheckButton*   fAverage;
 
-  TGNumberEntry*   fMinTime;
-  TGNumberEntry*   fMaxTime;
-  TGDoubleHSlider* fTime;
+  TGCheckButton*   fUseTexture;
 
 public:
   TPCSector2DEditor(const TGWindow* p, Int_t id, Int_t width = 170, Int_t height = 30, UInt_t options = kChildFrame, Pixel_t back = GetDefaultFrameBackground());
   ~TPCSector2DEditor();
 
   virtual void SetModel(TVirtualPad* pad, TObject* obj, Int_t event);
-  virtual Bool_t CanEditMainColor()  { return true; }
 
-  // void DoXYZZ();
-  void DoUseTexture();
-
-  void DoSectorID();
-
-  void DoRnrInn();
-  void DoRnrOut1();
-  void DoRnrOut2();
-
-  void DoThreshold();
-  void DoMaxVal();
   void DoShowMax();
   void DoAverage();
   void SetupAverage();
-  void DoMinTime();
-  void DoMaxTime();
-  void DoTime();
+
+  void DoUseTexture();
+
   ClassDef(TPCSector2DEditor, 0); // Editor for TPCSector2D
 }; // endclass TPCSector2DEditor
 
index f5bce4d0c9288add840177599322319ee645c4a6..6350b595a6697d6d5c9eb3cd9c1559b3f0644054 100644 (file)
@@ -4,8 +4,6 @@
 
 #include <Alieve/TPCData.h>
 
-#include <TStyle.h>
-#include <TColor.h>
 #include <TStopwatch.h>
 
 #include <GL/gl.h>
@@ -56,28 +54,6 @@ void TPCSector2DGL::SetBBox()
 
 /**************************************************************************/
 
-void TPCSector2DGL::SetCol(Float_t z, UChar_t* pixel) const
-{
-  Int_t n_col = gStyle->GetNumberOfColors();
-
-  Int_t ci = gStyle->GetColorPalette
-    (TMath::Min(n_col - 1,
-                Int_t((n_col*(z - fSector->fThreshold))/(fSector->fMaxVal - fSector->fThreshold))));
-
-  TColor* c = gROOT->GetColor(ci);
-
-  if(c) {
-    //    UChar_t *x = (UChar_t*) &c;
-    pixel[0] = (UChar_t)(255*c->GetRed());
-    pixel[1] = (UChar_t)(255*c->GetGreen());
-    pixel[2] = (UChar_t)(255*c->GetBlue());
-    pixel[3] = 255;
-  }
-}
-
-/**************************************************************************/
-
 void TPCSector2DGL::DirectDraw(const TGLDrawFlags& /*flags*/) const
 {
   // Actual GL drawing.
@@ -201,7 +177,7 @@ void TPCSector2DGL::LoadPadrow(TPCSectorData::RowIterator& iter,
     }
     padVal = TMath::Min(padVal, fSector->fMaxVal);
     if(padVal > fSector->fThreshold)
-      SetCol(padVal, img_pos);
+      fSector->SetupColor(padVal, img_pos);
     img_pos += 4;
   }
 }
@@ -221,7 +197,7 @@ void TPCSector2DGL::CreateTexture() const
   rowOff[0] = 0;
   rowOff[1] = rowOff[2] = -TPCSectorData::GetSeg(1).GetFirstRow();
   colOff[0] = colOff[2] = 0;
-  colOff[1] =  TPCSectorData::GetSeg(0).GetNMaxPads();
+  colOff[1] = TPCSectorData::GetSeg(0).GetNMaxPads();
   isOn[0] = fSector->fRnrInn;
   isOn[1] = fSector->fRnrOut1;
   isOn[2] = fSector->fRnrOut2;
@@ -337,15 +313,9 @@ void TPCSector2DGL::TraceStepsDown(const TPCSectorData::SegmentInfo& s)
 
 void TPCSector2DGL::DisplayFrame() const
 {
-  TColor* c = gROOT->GetColor(fSector->fFrameCol);
-  if(c == 0) return; 
-
-  // x[0] = (UChar_t)(255*c->GetRed());  x[1] = (UChar_t)(255*c->GetGreen());
-  // x[2] = (UChar_t)(255*c->GetBlue()); x[3] = 255;
-
-  glColor3ub((UChar_t)(255*c->GetRed()), 
-             (UChar_t)(255*c->GetGreen()),
-             (UChar_t)(255*c->GetBlue()));
+  UChar_t col[4];
+  ColorFromIdx(fSector->fFrameColor, col);
+  glColor4ubv(col);
 
   glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
   if(fSector->fRnrInn) {
diff --git a/EVE/Alieve/TPCSector3D.cxx b/EVE/Alieve/TPCSector3D.cxx
new file mode 100644 (file)
index 0000000..ac63114
--- /dev/null
@@ -0,0 +1,170 @@
+// $Header$
+
+#include "TPCSector3D.h"
+#include <Alieve/TPCSectorData.h>
+
+using namespace Reve;
+using namespace Alieve;
+
+//______________________________________________________________________
+// TPCSector3D
+//
+
+ClassImp(TPCSector3D)
+
+TPCSector3D::TPCSector3D(const Text_t* n, const Text_t* t) :
+  TPCSectorViz(n, t),
+
+  fBoxSet    (n, t),
+  fDriftVel  (1),
+  fZStep     (250.0/450)
+{
+  fRnrFrame = false;
+  MakeFrameBox();
+  ComputeBBox();
+}
+
+TPCSector3D::~TPCSector3D()
+{}
+
+/**************************************************************************/
+
+UInt_t TPCSector3D::IncRTS()
+{
+  UpdateBoxes();
+  return ++fRTS;
+}
+
+void TPCSector3D::SetRnrFrame(Bool_t rf)
+{
+  if(fRnrFrame != rf) {
+    fRnrFrame = rf;
+    IncRTS();
+  }
+}
+
+/**************************************************************************/
+
+void TPCSector3D::ComputeBBox()
+{
+  const TPCSectorData::SegmentInfo&  iSeg = TPCSectorData::GetInnSeg();
+  const TPCSectorData::SegmentInfo& o2Seg = TPCSectorData::GetOut2Seg();
+
+  bbox_init();
+  Float_t w = o2Seg.GetNMaxPads()*o2Seg.GetPadWidth()/2;
+  fBBox[0] = -w;
+  fBBox[1] =  w;
+  fBBox[2] =  iSeg.GetRLow();
+  fBBox[3] =  o2Seg.GetRLow() + o2Seg.GetNRows()*o2Seg.GetPadHeight();
+  fBBox[4] = -0.5;
+  fBBox[5] =  250.5;
+  dynamic_cast<TAttBBox&>(fBoxSet) = dynamic_cast<TAttBBox&>(*this);
+}
+
+void TPCSector3D::Paint(Option_t* option)
+{
+  if(fRnrElement)
+    fBoxSet.Paint(option);
+}
+
+/**************************************************************************/
+
+void TPCSector3D::MakeFrameBox()
+{
+  const TPCSectorData::SegmentInfo&  iSeg = TPCSectorData::GetInnSeg();
+  const TPCSectorData::SegmentInfo& o2Seg = TPCSectorData::GetOut2Seg();
+
+  Float_t x1, x2, y1, y2, D;
+  x1 = 0.5*TPCSectorData::GetNPadsInRow(0)*iSeg.GetPadWidth();
+  x2 = 0.5*o2Seg.GetNMaxPads()*o2Seg.GetPadWidth();
+  y1 = iSeg.GetRLow();
+  y2 = o2Seg.GetRLow() + o2Seg.GetNRows()*o2Seg.GetPadHeight();
+  D  = 0.5*fZStep;
+
+  ColorFromIdx(fFrameColor, fFrameBox.color);
+  Float_t* p = fFrameBox.vertices;
+  // bottom
+  p[0] = -x1;  p[1] = y1;  p[2] = -D;  p += 3;
+  p[0] =  x1;  p[1] = y1;  p[2] = -D;  p += 3;
+  p[0] =  x2;  p[1] = y2;  p[2] = -D;  p += 3;
+  p[0] = -x2;  p[1] = y2;  p[2] = -D;  p += 3;
+  // top
+  p[0] = -x1;  p[1] = y1;  p[2] =  D;  p += 3;
+  p[0] =  x1;  p[1] = y1;  p[2] =  D;  p += 3;
+  p[0] =  x2;  p[1] = y2;  p[2] =  D;  p += 3;
+  p[0] = -x2;  p[1] = y2;  p[2] =  D;  p += 3;
+}
+
+/**************************************************************************/
+
+void TPCSector3D::LoadPadrow(TPCSectorData::RowIterator& iter,
+                             Float_t xs, Float_t ys, Float_t pw, Float_t ph) 
+{
+  Short_t pad, time, val;
+  Float_t x0, x1, z0, z1;
+  Float_t ye = ys + ph;
+
+  while (iter.NextPad()) {
+    pad = iter.Pad();
+    while (iter.Next()) {
+      time = iter.Time();
+      val  = iter.Signal();
+
+      if(val <= fThreshold || time < fMinTime || time > fMaxTime)
+       continue;
+
+      fBoxSet.fBoxes.push_back(Reve::Box());
+      SetupColor(val, fBoxSet.fBoxes.back().color);
+      x0 = xs + pad*pw;
+      x1 = x0 + pw;
+      z0 = fZStep*time/fDriftVel;
+      z1 = z0 + fZStep/fDriftVel;
+      Float_t* p = fBoxSet.fBoxes.back().vertices; 
+      // front
+      p[0] = x0;  p[1] = ys;  p[2] = z0;  p += 3;
+      p[0] = x1;  p[1] = ys;  p[2] = z0;  p += 3;
+      p[0] = x1;  p[1] = ye;  p[2] = z0;  p += 3;
+      p[0] = x0;  p[1] = ye;  p[2] = z0;  p += 3;
+      // back
+      z0 += fZStep;
+      p[0] = x0;  p[1] = ys;  p[2] = z0;  p += 3;
+      p[0] = x1;  p[1] = ys;  p[2] = z0;  p += 3;
+      p[0] = x1;  p[1] = ye;  p[2] = z0;  p += 3;
+      p[0] = x0;  p[1] = ye;  p[2] = z0;
+    }
+  }
+}
+
+void TPCSector3D::UpdateBoxes()
+{
+  // Populate parent class Reve::BoxSet with digit information.
+
+  // printf("TPCSector3D update boxes\n");
+
+  fBoxSet.ClearSet();
+
+  TPCSectorData* data = GetSectorData();
+  if (data != 0) {
+    Bool_t isOn[3];
+    isOn[0] = fRnrInn;
+    isOn[1] = fRnrOut1;
+    isOn[2] = fRnrOut2;
+
+    // Loop over 3 main segments
+    for (Int_t sId = 0; sId <= 2; ++sId) {
+      if(isOn[sId] == kFALSE)
+        continue;
+      const TPCSectorData::SegmentInfo& sInfo = TPCSectorData::GetSeg(sId);
+      Float_t sy = sInfo.GetRLow();
+      for (Int_t row=sInfo.GetFirstRow(); row<=sInfo.GetLastRow(); ++row) {
+        TPCSectorData::RowIterator i = data->MakeRowIterator(row);
+        Float_t sx = -0.5*TPCSectorData::GetNPadsInRow(row)*sInfo.GetPadWidth();
+        LoadPadrow(i, sx, sy, sInfo.GetPadWidth(), sInfo.GetPadHeight());
+        sy += sInfo.GetPadHeight();
+      }
+    }
+  }
+
+  if(fRnrFrame)
+    fBoxSet.fBoxes.push_back(fFrameBox);
+}
diff --git a/EVE/Alieve/TPCSector3D.h b/EVE/Alieve/TPCSector3D.h
new file mode 100644 (file)
index 0000000..ec42869
--- /dev/null
@@ -0,0 +1,48 @@
+// $Header$
+
+#ifndef ALIEVE_TPCSector3D_H
+#define ALIEVE_TPCSector3D_H
+
+#include <Alieve/TPCSectorViz.h>
+#include <Alieve/TPCSectorData.h>
+#include <Reve/BoxSet.h>
+
+
+namespace Alieve {
+
+class TPCSector3D: public TPCSectorViz
+{
+  friend class TPCSector3DEditor;
+
+protected:
+  void MakeFrameBox();
+  void LoadPadrow(TPCSectorData::RowIterator& iter,
+                  Float_t sx, Float_t sy, Float_t pw, Float_t ph);
+  void UpdateBoxes();
+
+
+  Reve::BoxSet fBoxSet;
+  Reve::Box    fFrameBox;
+  Float_t      fDriftVel;
+  Float_t      fZStep;
+
+public:
+  TPCSector3D(const Text_t* n="TPCSector3D", const Text_t* t=0);
+  virtual ~TPCSector3D();
+
+  virtual UInt_t IncRTS();
+
+  void SetDriftVel(Float_t v) { fDriftVel = v; IncRTS(); }
+  void SetZStep(Float_t step) { fZStep = step; IncRTS(); }
+
+  virtual void SetRnrFrame(Bool_t rf);
+
+  virtual void ComputeBBox();
+  virtual void Paint(Option_t* option="");
+
+  ClassDef(TPCSector3D, 1);
+}; // endclass TPCSector3D
+
+}
+
+#endif
diff --git a/EVE/Alieve/TPCSector3DEditor.cxx b/EVE/Alieve/TPCSector3DEditor.cxx
new file mode 100644 (file)
index 0000000..508084f
--- /dev/null
@@ -0,0 +1,97 @@
+// $Header$
+
+#include "TPCSector3DEditor.h"
+#include <Alieve/TPCSector3D.h>
+
+#include <TVirtualPad.h>
+#include <TColor.h>
+
+#include <TGLabel.h>
+#include <TGButton.h>
+#include <TGNumberEntry.h>
+#include <TGColorSelect.h>
+#include <TGSlider.h>
+#include <TGDoubleSlider.h>
+
+using namespace Reve;
+using namespace Alieve;
+
+//______________________________________________________________________
+// TPCSector3DEditor
+//
+
+ClassImp(TPCSector3DEditor)
+
+TPCSector3DEditor::TPCSector3DEditor(const TGWindow *p, Int_t id, Int_t width, Int_t height,
+                                     UInt_t options, Pixel_t back) :
+  TGedFrame(p, id, width, height, options | kVerticalFrame, back)
+{
+  fM = 0;
+  MakeTitle("TPCSector3D");
+
+  fRnrFrame = new TGCheckButton(this, "ShowFrame");
+  AddFrame(fRnrFrame, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
+  fRnrFrame->Connect
+    ("Toggled(Bool_t)","Alieve::TPCSector3DEditor", this, "DoRnrFrame()");
+
+  {
+    TGHorizontalFrame* f = new TGHorizontalFrame(this);
+    TGLabel *l = new TGLabel(f, "Drift Velocity factor:");
+    f->AddFrame(l, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 25, 2, 1, 1));
+    fDriftVel = new TGNumberEntry(f, 0., 6, -1,
+                       TGNumberFormat::kNESRealOne, TGNumberFormat::kNEAPositive,
+                       TGNumberFormat::kNELLimitMinMax, 0.001, 1000.0);
+    fDriftVel->GetNumberEntry()->SetToolTipText("Drift velocity factor.");
+    f->AddFrame(fDriftVel, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
+    fDriftVel->Associate(f);
+    fDriftVel->Connect("ValueSet(Long_t)", "Alieve::TPCSector3DEditor", this, "DoDriftVel()");
+    AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
+  }
+
+  // Register the editor.
+  TClass *cl = TPCSector3D::Class();
+  TGedElement *ge = new TGedElement;
+  ge->fGedFrame = this;
+  ge->fCanvas = 0;
+  cl->GetEditorList()->Add(ge);
+}
+
+TPCSector3DEditor::~TPCSector3DEditor()
+{}
+
+/**************************************************************************/
+
+void TPCSector3DEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t /*event*/)
+{
+  fModel = 0;
+  fPad   = 0;
+
+  if (!obj || !obj->InheritsFrom(TPCSector3D::Class()) || obj->InheritsFrom(TVirtualPad::Class())) {
+    SetActive(kFALSE);
+    return;
+  }
+
+  fModel = obj;
+  fPad   = pad;
+
+  fM = dynamic_cast<TPCSector3D*>(fModel);
+
+  fRnrFrame->SetState(fM->fRnrFrame ? kButtonDown : kButtonUp);
+  fDriftVel->SetNumber(fM->fDriftVel);
+
+  SetActive();
+}
+
+/**************************************************************************/
+
+void TPCSector3DEditor::DoRnrFrame()
+{
+  fM->SetRnrFrame(fRnrFrame->IsOn());
+  Update();
+}
+
+void TPCSector3DEditor::DoDriftVel()
+{
+  fM->SetDriftVel((Float_t) fDriftVel->GetNumber());
+  Update();
+}
diff --git a/EVE/Alieve/TPCSector3DEditor.h b/EVE/Alieve/TPCSector3DEditor.h
new file mode 100644 (file)
index 0000000..ce24257
--- /dev/null
@@ -0,0 +1,40 @@
+// $Header$
+
+#ifndef ALIEVE_TPCSector3DEditor_H
+#define ALIEVE_TPCSector3DEditor_H
+
+#include <Alieve/TPCSector2DEditor.h>
+
+class TGCheckButton;
+class TGNumberEntry;
+class TGColorSelect;
+
+namespace Alieve {
+
+class TPCSector3D;
+
+class TPCSector3DEditor : public TGedFrame
+{
+protected:
+  TPCSector3D* fM; // fModel dynamic-casted to TPCSector3DEditor
+
+  TGCheckButton*   fRnrFrame;
+  TGNumberEntry*   fDriftVel;
+
+
+public:
+  TPCSector3DEditor(const TGWindow* p, Int_t id, Int_t width=170, Int_t height=30,
+                   UInt_t options=kChildFrame, Pixel_t back=GetDefaultFrameBackground());  
+  virtual ~TPCSector3DEditor();
+
+  virtual void SetModel(TVirtualPad* pad, TObject* obj, Int_t event);
+
+  void DoRnrFrame();
+  void DoDriftVel();
+
+  ClassDef(TPCSector3DEditor, 0); // Editor for TPCSector3D
+}; // endclass TPCSector3DEditor
+
+}
+
+#endif
index 4bff842117a6991959ab44ee1e42f7f491630eec..184b884153ff0621dac9d4bdcd01a9b372c45528 100644 (file)
@@ -170,6 +170,15 @@ TPCSectorData::~TPCSectorData()
     delete [] *b;
 }
 
+void TPCSectorData::DropData()
+{
+  fPads.assign(fgNAllPads, PadData());
+  for(std::vector<Short_t*>::iterator b=fBlocks.begin(); b!=fBlocks.end(); ++b)
+    delete [] *b;
+  fBlocks.clear();
+  fBlockPos = fBlockSize; // Enforce creation of a new block.
+}
+
 /**************************************************************************/
 
 void TPCSectorData::Print(Option_t* /*opt*/) const
@@ -191,6 +200,9 @@ void TPCSectorData::BeginPad(Int_t row, Int_t pad, Bool_t reverseTime)
     fCurrentPos  = 0;
     fCurrentStep = 2;
   }
+  //printf("begpad for row=%d pad=%d\n  buf=%p pos=%d step=%d\n",
+  //     fCurrentRow, fCurrentPad,
+  //     fPadBuffer, fCurrentPos, fCurrentStep);
 }
 
 void TPCSectorData::EndPad(Bool_t autoPedestal, Short_t threshold)
@@ -204,6 +216,12 @@ void TPCSectorData::EndPad(Bool_t autoPedestal, Short_t threshold)
     end = fPadBuffer + 2048;
   }
 
+  //printf("endpad for row=%d pad=%d\n  buf=%p beg=%p end=%p pos=%d step=%d\n",
+  //     fCurrentRow, fCurrentPad,
+  //     fPadBuffer, beg, end, fCurrentPos, fCurrentStep);
+  if(beg >= end)
+    return;
+
   if(autoPedestal) {
     Short_t array[1024];
     Short_t* val;
index d43b1de61dfe7c0560d536c38d895fbbc19a0fdb..0a1b36691111da8338180c2d0ece030d0a79e2c6 100644 (file)
@@ -149,6 +149,8 @@ public:
   TPCSectorData(Int_t sector, Int_t bsize=65536);
   virtual ~TPCSectorData();
 
+  void DropData();
+
   virtual void Print(Option_t* opt="") const;
 
   void BeginPad(Int_t row, Int_t pad, Bool_t reverseTime=kFALSE);
diff --git a/EVE/Alieve/TPCSectorViz.cxx b/EVE/Alieve/TPCSectorViz.cxx
new file mode 100644 (file)
index 0000000..69d7604
--- /dev/null
@@ -0,0 +1,118 @@
+// $Header$
+
+#include "TPCSectorViz.h"
+
+#include <Alieve/TPCData.h>
+#include <Alieve/TPCSectorData.h>
+#include <AliTPCParam.h>
+
+#include <TStyle.h>
+#include <TColor.h>
+
+using namespace Reve;
+using namespace Alieve;
+
+//______________________________________________________________________
+// TPCSectorViz
+//
+// Base class for TPC raw-data visualization.
+// See TPCSector2D and TPCSector3D for concrete implementations.
+
+ClassImp(TPCSectorViz)
+
+/**************************************************************************/
+
+TPCSectorViz::TPCSectorViz(const Text_t* n, const Text_t* t) :
+  TNamed(n, t),
+  Reve::RenderElement(fFrameColor),
+
+  fTPCData  (0),
+  fSectorID (0),
+
+  fMinTime   (0),
+  fMaxTime   (450),
+  fThreshold (5),
+  fMaxVal    (80),
+
+  fRnrInn   (kTRUE),
+  fRnrOut1  (kTRUE),
+  fRnrOut2  (kTRUE),
+
+  fFrameColor ((Color_t) 4),
+  fRnrFrame (kTRUE),
+  fTrans    (kFALSE),
+  fRTS      (1)
+{}
+
+TPCSectorViz::~TPCSectorViz()
+{
+  if(fTPCData) fTPCData->DecRefCount();
+}
+
+/**************************************************************************/
+
+//UInt_t TPCSectorViz::IncRTS()
+//{
+//  return ++fRTS;
+//}
+
+
+void TPCSectorViz::SetDataSource(TPCData* data)
+{
+  if(data == fTPCData) return;
+  if(fTPCData) fTPCData->DecRefCount();
+  fTPCData = data;
+  if(fTPCData) fTPCData->IncRefCount();
+  IncRTS();
+}
+
+void TPCSectorViz::SetSectorID(Int_t segment)
+{
+  if(segment < 0 ) segment = 0;
+  if(segment > 35) segment = 35;
+  fSectorID = segment;
+  IncRTS();
+}
+
+TPCSectorData* TPCSectorViz::GetSectorData() const
+{
+  return fTPCData ? fTPCData->GetSectorData(fSectorID) : 0;
+}
+
+/**************************************************************************/
+
+void TPCSectorViz::SetTrans(Bool_t trans) 
+{
+  fTrans = trans;
+  if(fTrans) {
+    for (Int_t k=0; k<16; ++k)
+      fMatrix[k] = 0.;
+
+    using namespace TMath;
+    Float_t c = Cos((fSectorID + 0.5)*20*Pi()/180 - PiOver2());
+    Float_t s = Sin((fSectorID + 0.5)*20*Pi()/180 - PiOver2());
+    Float_t z = TPCSectorData::GetParam().GetZLength();
+    if(fSectorID >= 18) z = -z;
+  
+    // column major
+    fMatrix[0]  = -c;
+    fMatrix[1]  = -s;
+    fMatrix[4]  = -s;
+    fMatrix[5]  =  c;
+    fMatrix[10] = -1;
+    fMatrix[14] =  z;
+    fMatrix[15] =  1;
+  }
+}
+
+/**************************************************************************/
+
+void TPCSectorViz::SetupColor(Int_t val, UChar_t* pixel) const
+{
+  using namespace TMath;
+  Float_t div  = Max(1, fMaxVal - fThreshold);
+  Int_t   nCol = gStyle->GetNumberOfColors();
+  Int_t   cBin = (Int_t) Nint(nCol*(val - fThreshold)/div);
+
+  ColorFromIdx(gStyle->GetColorPalette(Min(nCol - 1, cBin)), pixel);
+}
diff --git a/EVE/Alieve/TPCSectorViz.h b/EVE/Alieve/TPCSectorViz.h
new file mode 100644 (file)
index 0000000..3d237af
--- /dev/null
@@ -0,0 +1,85 @@
+// $Header$
+
+#ifndef ALIEVE_TPCSectorViz_H
+#define ALIEVE_TPCSectorViz_H
+
+#include <Reve/RenderElement.h>
+
+#include <TNamed.h> 
+#include <TAtt3D.h>
+#include <TAttBBox.h>
+
+
+namespace Alieve {
+
+class TPCData; class TPCSectorData;
+
+class TPCSectorVizEditor;
+class TPCSector2D;  class TPCSector2DEditor;  class TPCSector2DGL;
+class TPCSector3D;  class TPCSector3DEditor;  class TPCSector3DGL;
+
+class TPCSectorViz : public TNamed, public TAtt3D, public TAttBBox,
+                     public Reve::RenderElement
+{
+  friend class TPCSectorVizEditor;
+  friend class TPCSector2D;
+  friend class TPCSector2DEditor;
+  friend class TPCSector2DGL;
+  friend class TPCSector3D;
+  friend class TPCSector3DEditor;
+  friend class TPCSector3DGL;
+
+protected:
+  TPCData*    fTPCData; 
+  Int_t       fSectorID;
+
+  Int_t       fMinTime;     
+  Int_t       fMaxTime;
+  Short_t     fThreshold;
+  Int_t       fMaxVal;
+
+  Bool_t      fRnrInn;
+  Bool_t      fRnrOut1;
+  Bool_t      fRnrOut2;
+
+  Color_t     fFrameColor;
+  Bool_t      fRnrFrame;
+  Bool_t      fTrans;
+  Double_t    fMatrix[16];
+  UInt_t      fRTS;       //! Rendering TimeStamp
+
+  void SetupColor(Int_t val, UChar_t* pix) const;
+
+public:
+  TPCSectorViz(const Text_t* n="TPCSectorViz", const Text_t* t=0);
+  virtual ~TPCSectorViz();
+
+  virtual UInt_t IncRTS()           { return ++fRTS; }
+  virtual Bool_t CanEditMainColor() { return true; }
+
+  void SetDataSource(TPCData* data);
+  void SetSectorID(Int_t id);
+
+  TPCData*       GetData()     const { return fTPCData; }
+  Int_t          GetSectorID() const { return fSectorID; }
+  TPCSectorData* GetSectorData() const;
+
+  void SetMinTime(Int_t mt)    { fMinTime   = mt; IncRTS(); }
+  void SetMaxTime(Int_t mt)    { fMaxTime   = mt; IncRTS(); }
+  void SetThreshold(Short_t t) { fThreshold =  t; IncRTS(); }
+  void SetMaxVal(Int_t mv)     { fMaxVal    = mv; IncRTS(); }
+
+  void SetRnrInn(Bool_t r)     { fRnrInn  = r; IncRTS(); }
+  void SetRnrOut1(Bool_t r)    { fRnrOut1 = r; IncRTS(); }
+  void SetRnrOut2(Bool_t r)    { fRnrOut2 = r; IncRTS(); }
+
+  void SetFrameColor(Color_t col)     { fFrameColor = col; IncRTS(); }
+  virtual void SetRnrFrame(Bool_t rf) { fRnrFrame = rf;  IncRTS(); }
+  void SetTrans(Bool_t t);
+
+  ClassDef(TPCSectorViz, 1); // Base-class for TPC raw-data visualization
+}; // endclass TPCSectorViz
+
+}
+
+#endif
diff --git a/EVE/Alieve/TPCSectorVizEditor.cxx b/EVE/Alieve/TPCSectorVizEditor.cxx
new file mode 100644 (file)
index 0000000..4813b91
--- /dev/null
@@ -0,0 +1,248 @@
+// $Header$
+
+#include "TPCSectorVizEditor.h"
+#include <Alieve/TPCSectorViz.h>
+
+#include <TVirtualPad.h>
+#include <TColor.h>
+
+#include <TGLabel.h>
+#include <TGButton.h>
+#include <TGNumberEntry.h>
+#include <TGColorSelect.h>
+#include <TGSlider.h>
+#include <TGDoubleSlider.h>
+
+using namespace Reve;
+using namespace Alieve;
+
+//______________________________________________________________________
+// TPCSectorVizEditor
+//
+
+ClassImp(TPCSectorVizEditor)
+
+TPCSectorVizEditor::TPCSectorVizEditor(const TGWindow *p, Int_t id, Int_t width, Int_t height,
+            UInt_t options, Pixel_t back) :
+  TGedFrame(p, id, width, height, options | kVerticalFrame, back)
+{
+  fM = 0;
+  MakeTitle("TPCSectorViz");
+
+  {
+    TGHorizontalFrame* f = new TGHorizontalFrame(this);
+    TGLabel *l = new TGLabel(f, "SectorID:");
+    f->AddFrame(l, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 3, 2, 1, 1));
+
+    fSectorID = new TGNumberEntry(f, 0., 6, -1, 
+                                 TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative,
+                                 TGNumberFormat::kNELLimitMinMax, 0, 35);
+
+    fSectorID->GetNumberEntry()->SetToolTipText("0-17 +z plate 18-35 -z plate");
+    f->AddFrame(fSectorID, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
+    fSectorID->Associate(this);
+    fSectorID->Connect("ValueSet(Long_t)",
+                      "Alieve::TPCSectorVizEditor", this, "DoSectorID()");
+
+    AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
+  }
+  {
+    TGHorizontalFrame* f = new TGHorizontalFrame(this);
+
+    fRnrInn = new TGCheckButton(f, "Inner");
+    f->AddFrame(fRnrInn, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
+    fRnrInn->Connect("Toggled(Bool_t)","Alieve::TPCSectorVizEditor", this, "DoRnrInn()");
+
+    fRnrOut1 = new TGCheckButton(f, "Outer 1");
+    f->AddFrame(fRnrOut1, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
+    fRnrOut1->Connect("Toggled(Bool_t)","Alieve::TPCSectorVizEditor", this, "DoRnrOut1()");
+
+    fRnrOut2 = new TGCheckButton(f, "Outer 2");
+    f->AddFrame(fRnrOut2, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
+    fRnrOut2->Connect("Toggled(Bool_t)","Alieve::TPCSectorVizEditor", this, "DoRnrOut2()");
+
+    AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
+  }
+  {
+    TGHorizontalFrame* f = new TGHorizontalFrame(this);
+    fThresholdLabel = new TGLabel(f, "Threshold [XXX]:");
+    f->AddFrame(fThresholdLabel, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 3, 2, 1, 1));
+
+    fThreshold = new TGHSlider(f, 150);
+    fThreshold->SetRange(0,149);
+    fThreshold->Associate(this);
+    f->AddFrame(fThreshold, new TGLayoutHints(kLHintsLeft, 0, 5));
+    fThreshold->Connect("PositionChanged(Int_t)",
+                       "Alieve::TPCSectorVizEditor", this, "DoThreshold()");
+    AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
+  }
+  {
+    TGHorizontalFrame* f = new TGHorizontalFrame(this);
+    fMaxValLabel = new TGLabel(f, "MaxValue [XXX]:");
+    f->AddFrame(fMaxValLabel, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 3, 2, 1, 1));
+    fMaxVal = new TGHSlider(f, 150);
+    fMaxVal->SetRange(0,299);
+    fMaxVal->Associate(this);
+    f->AddFrame(fMaxVal, new TGLayoutHints(kLHintsLeft, 0, 5));
+    fMaxVal->Connect("PositionChanged(Int_t)",
+                    "Alieve::TPCSectorVizEditor", this, "DoMaxVal()");
+    AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
+  }
+  {
+    TGVerticalFrame* vf = new TGVerticalFrame(this);
+    
+    TGHorizontalFrame* f = new TGHorizontalFrame(vf);
+
+    TGLabel *l = new TGLabel(f, "Time Range:");
+    f->AddFrame(l, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 1, 2, 1, 1));
+
+    fMinTime = new TGNumberEntry(f, 0., 6, -1, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative,
+                                TGNumberFormat::kNELLimitMinMax, 0, 1023);
+    fMinTime->GetNumberEntry()->SetToolTipText("MinTime");
+    f->AddFrame(fMinTime, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
+    fMinTime->Associate(this);
+    fMinTime->Connect("ValueSet(Long_t)", "Alieve::TPCSectorVizEditor", this, "DoMinTime()");
+
+    fMaxTime = new TGNumberEntry(f, 0., 6, -1, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative,
+                                TGNumberFormat::kNELLimitMinMax, 0, 1023);
+    fMaxTime->GetNumberEntry()->SetToolTipText("MaxTime");
+    f->AddFrame(fMaxTime, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
+    fMaxTime->Associate(this);
+    fMaxTime->Connect("ValueSet(Long_t)", "Alieve::TPCSectorVizEditor", this, "DoMaxTime()");
+
+    vf->AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
+
+    fTime = new TGDoubleHSlider(vf);
+    fTime->SetRange(0, 1023);
+    fTime->Resize(250, 20);
+    vf->AddFrame(fTime);//, new TGLayoutHints(kLHintsLeft, 0, 5));
+    fTime->Connect("PositionChanged()", "Alieve::TPCSectorVizEditor",
+                  this, "DoTime()");
+
+    AddFrame(vf, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
+  }
+
+  // Register the editor.
+  TClass *cl = TPCSectorViz::Class();
+  TGedElement *ge = new TGedElement;
+  ge->fGedFrame = this;
+  ge->fCanvas = 0;
+  cl->GetEditorList()->Add(ge);
+}
+
+TPCSectorVizEditor::~TPCSectorVizEditor()
+{}
+
+/**************************************************************************/
+
+void TPCSectorVizEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t /*event*/)
+{
+  fModel = 0;
+  fPad   = 0;
+
+  if (!obj || !obj->InheritsFrom(TPCSectorViz::Class()) || obj->InheritsFrom(TVirtualPad::Class())) {
+    SetActive(kFALSE);
+    return;
+  }
+
+  fModel = obj;
+  fPad   = pad;
+
+  fM = dynamic_cast<TPCSectorViz*>(fModel);
+
+  fSectorID->SetNumber(fM->fSectorID);
+  fRnrInn->SetState(fM->fRnrInn   ? kButtonDown : kButtonUp);
+  fRnrOut1->SetState(fM->fRnrOut1 ? kButtonDown : kButtonUp);
+  fRnrOut2->SetState(fM->fRnrOut2 ? kButtonDown : kButtonUp);
+  fThresholdLabel->SetText(Form("Threshold [%3d]:", fM->fThreshold));
+  fThreshold->SetPosition(fM->fThreshold);
+
+  fMaxValLabel->SetText(Form("MaxValue [%3d]:", fM->fMaxVal));
+  fMaxVal->SetPosition(fM->fMaxVal);
+  fMinTime->SetNumber(fM->fMinTime);
+  fMaxTime->SetNumber(fM->fMaxTime);
+  fTime->SetPosition(fM->fMinTime, fM->fMaxTime);
+
+  SetActive();
+}
+
+/**************************************************************************/
+
+void TPCSectorVizEditor::DoSectorID()
+{
+  fM->SetSectorID((Int_t) fSectorID->GetNumber());
+  Update();
+}
+
+/**************************************************************************/
+
+void TPCSectorVizEditor::DoRnrInn()
+{
+  fM->SetRnrInn(fRnrInn->IsOn());
+  Update();
+}
+
+void TPCSectorVizEditor::DoRnrOut1()
+{
+  fM->SetRnrOut1(fRnrOut1->IsOn());
+  Update();
+}
+
+void TPCSectorVizEditor::DoRnrOut2()
+{
+  fM->SetRnrOut2(fRnrOut2->IsOn());
+  Update();
+}
+
+/**************************************************************************/
+
+void TPCSectorVizEditor::DoThreshold()
+{
+  fM->SetThreshold((Short_t) fThreshold->GetPosition());
+  fThresholdLabel->SetText(Form("Threshold [%3d]:", fM->fThreshold));
+  Update();
+}
+
+void TPCSectorVizEditor::DoMaxVal()
+{
+  fM->SetMaxVal((Int_t) fMaxVal->GetPosition());
+  fMaxValLabel->SetText(Form("MaxValue [%3d]:", fM->fMaxVal));
+  Update();
+}
+
+/**************************************************************************/
+
+void TPCSectorVizEditor::DoMinTime()
+{
+  Int_t minTime = (Int_t) fMinTime->GetNumber();
+  if(minTime > fM->fMaxTime) {
+    minTime = fM->fMaxTime;
+    fMinTime->SetNumber(minTime);
+  }
+  fM->SetMinTime(minTime);
+  fTime->SetPosition(minTime, fM->fMaxTime);
+  Update();
+}
+
+void TPCSectorVizEditor::DoMaxTime()
+{
+  Int_t maxTime = (Int_t) fMaxTime->GetNumber();
+  if(maxTime < fM->fMinTime) {
+    maxTime = fM->fMinTime;
+    fMaxTime->SetNumber(maxTime);
+  }
+  fM->SetMaxTime(maxTime);
+  fTime->SetPosition(fM->fMinTime, maxTime);
+  Update();
+}
+
+void TPCSectorVizEditor::DoTime()
+{ 
+  Int_t min = (Int_t) TMath::Nint(fTime->GetMinPosition());
+  Int_t max = (Int_t) TMath::Nint(fTime->GetMaxPosition());
+  fM->SetMinTime(min);
+  fM->SetMaxTime(max);
+  fMinTime->SetNumber(min);
+  fMaxTime->SetNumber(max);
+  Update();
+}
diff --git a/EVE/Alieve/TPCSectorVizEditor.h b/EVE/Alieve/TPCSectorVizEditor.h
new file mode 100644 (file)
index 0000000..87fd1b2
--- /dev/null
@@ -0,0 +1,63 @@
+// $Header$
+
+#ifndef ALIEVE_TPCSectorVizEditor_H
+#define ALIEVE_TPCSectorVizEditor_H
+
+#include <TGedFrame.h>
+
+class TGCheckButton;
+class TGNumberEntry;
+class TGColorSelect;
+class TGDoubleHSlider;
+class TGHSlider;
+
+
+namespace Alieve {
+
+class TPCSectorViz;
+
+class TPCSectorVizEditor : public TGedFrame
+{
+protected:
+  TPCSectorViz* fM; // fModel dynamic-casted to TPCSectorVizEditor
+
+  TGNumberEntry*   fSectorID;
+
+  TGCheckButton*   fRnrInn;
+  TGCheckButton*   fRnrOut1;
+  TGCheckButton*   fRnrOut2;
+
+  TGLabel*         fThresholdLabel;
+  TGLabel*         fMaxValLabel;
+  TGHSlider*       fThreshold;
+  TGHSlider*       fMaxVal;
+
+  TGNumberEntry*   fMinTime;
+  TGNumberEntry*   fMaxTime;
+  TGDoubleHSlider* fTime;
+
+public:
+  TPCSectorVizEditor(const TGWindow* p, Int_t id, Int_t width = 170, Int_t height = 30, UInt_t options = kChildFrame, Pixel_t back = GetDefaultFrameBackground());
+  ~TPCSectorVizEditor();
+
+  virtual void SetModel(TVirtualPad* pad, TObject* obj, Int_t event);
+
+  void DoSectorID();
+
+  void DoRnrInn();
+  void DoRnrOut1();
+  void DoRnrOut2();
+
+  void DoThreshold();
+  void DoMaxVal();
+
+  void DoMinTime();
+  void DoMaxTime();
+  void DoTime();
+  ClassDef(TPCSectorVizEditor, 0); // Editor for TPCSectorViz
+}; // endclass TPCSectorVizEditor
+
+}
+
+#endif
index e00361b7fde046b4ef489e68f4d282ff0a1d3b19..89efd64d8b39487afcf8f96cc0408407df95e6a6 100644 (file)
@@ -1,3 +1,39 @@
+2006-05-23  Matevz Tadel  <matevz.tadel@cern.ch>
+
+       Merged EVE-dev to HEAD. Re-tagged EVE-dev (EVE-dev-after-merge) and
+       EVE's HEAD (EVE-head-after-merge).
+
+2006-05-23  Matevz Tadel  <matevz.tadel@cern.ch>
+
+       EVE-dev
+
+       * alice-macros/region_marker.C:
+       New file: allow users to mark a given region (like primary
+       vertex); demonstrate usage of RenderElementObjPtr.
+
+       * alice-macros/tpc_digits.C:
+       Use new conventions for TPCSectorViz classes; added a mode for 3D
+       sector visualization.
+
+       * macros/alieve_init.C:
+       Execute macro region_marker.C during startup (the origin
+       marker removed from RGTopFrame).
+
+       * test-macros/tpc_sector_raw_test.C:
+       Clean-up, added function next_event() and display of 3D data.
+
+2006-05-19  Matevz Tadel  <matevz.tadel@cern.ch>
+
+       EVE-dev and HEAD
+
+       * test-macros/tpc_sector_raw_test.C:
+       Use automatic pedestal determination by default.
+
+       EVE-dev
+
+       * macros/alieve_loadlibs.C:
+       MUON libraries now load OK.
+
 2006-05-18  Matevz Tadel  <matevz.tadel@cern.ch>
 
        Merged EVE-dev to HEAD. Tagged EVE-dev (EVE-dev-after-merge) and
@@ -6,7 +42,7 @@
 
 2006-05-18  Matevz Tadel  <matevz.tadel@cern.ch>
 
-       EVE-dev branch
+       EVE-dev
 
        * macros/alieve_loadlibs.C:
        Commented out loading of libg2c as it breaks things at other
@@ -14,7 +50,7 @@
 
 2006-05-17  Matevz Tadel  <matevz.tadel@cern.ch>
 
-       EVE-dev branch
+       EVE-dev
 
        * alice-macros/tpc_digits.C:
        Use new TPCData classes.
index c8e55ad4c2310ba306b71ae8923a52fa44e87dcb..a30064eb5a652dcfd7fd570199377ea29e568754 100644 (file)
@@ -4,7 +4,6 @@
 #include <TRandom.h>
 #include <TBuffer3D.h>
 #include <TBuffer3DTypes.h>
-#include <TGeometry.h>
 #include <TVirtualPad.h>
 #include <TVirtualViewer3D.h>
 
@@ -44,11 +43,10 @@ Box::Box(TRandom& rnd, Float_t origin, Float_t size)
 
 ClassImp(BoxSet)
 
-void BoxSet::Init()
-{
-  fTrans = false;
-  bbox_init();
-}
+BoxSet::BoxSet(const Text_t* n, const Text_t* t) :
+  TNamed(n, t),
+  fTrans(kFALSE)
+{}
 
 /**************************************************************************/
 
index 2bae501f94b70adf4a23556247d5fd83f896db30..7ac2118c67cc81a2de599fa5722a7421a8d5b7ac 100644 (file)
@@ -37,9 +37,6 @@ class BoxSet: public TNamed, public TAtt3D, public TAttBBox
 {
   friend class BoxSetGL;
 
-private:
-  void Init();
-
 protected:
   Double_t          fMatrix[16];
   Bool_t            fTrans;
@@ -47,8 +44,7 @@ protected:
 public:
   std::vector<Box>  fBoxes;
 
-  BoxSet(const Text_t* n="BoxSet", const Text_t* t="") : TNamed(n, t)
-  { Init(); }
+  BoxSet(const Text_t* n="BoxSet", const Text_t* t="");
   virtual ~BoxSet() {}
 
   void ClearSet() { fBoxes.clear(); }
index c64714de8298603116e01f65173ff9fda6cbe110..06dd5276e08bd667041569e168020b57782d9f55 100644 (file)
@@ -1,3 +1,43 @@
+2006-05-23  Matevz Tadel  <matevz.tadel@cern.ch>
+
+       EVE-dev branch
+
+       * RGBrowser.cxx:
+       * RGTopFrame.cxx:
+       Use RenderElement* as user-data of list-tree entries (it was
+       TObject* before).
+
+       * LinkDef.h:
+       * RenderElement.cxx:
+       * RenderElement.h:
+       Added class RenderElementObjPtr to allow display and control of
+       pure TObjects (see alice-macros/region_marker.C for an
+       example). This is not perfect as there is no way to get
+       color-change updates from the editor (can fix this when i get
+       control over TGedEditor::Update()). RenderElement::GetObject() is
+       now virtual.
+
+       * Reve.cxx:
+       * Reve.h:
+       Added function FindColorVar() to allow RenderElementObjPtr objects
+       to peek into appropriate color.
+
+2006-05-23  Matevz Tadel  <matevz.tadel@cern.ch>
+
+       EVE-dev branch
+
+       * BoxSet.cxx:
+       * BoxSet.h:
+       Do not initialize bbox in ctor. Moved ctor to cxx file, removed
+       Init().
+
+       * RGBrowser.cxx:
+       * RGBrowser.h:
+       Fix for editor window not appearing under some window
+       managers. For me it was working OK under fvwm and KDE (any focus
+       policy) but not at all under Gnome. This fixed my gnome problem
+       but it's quite likely the problem is not completely solved.
+
 2006-05-18  Matevz Tadel  <matevz.tadel@cern.ch>
 
        EVE-dev branch
index b10ecbdcb155b44d326148bb2375216192cd55ea..0b1df5d7cffc812c81aa586a7bae09582cf5e1a5 100644 (file)
@@ -47,6 +47,7 @@
 // RenderElement
 #pragma link C++ class Reve::RenderElement+;
 #pragma link C++ class Reve::RenderElement::ListTreeInfo+;
+#pragma link C++ class Reve::RenderElementObjPtr+;
 #pragma link C++ class Reve::RenderElementListBase+;
 #pragma link C++ class Reve::RenderElementList+;
 
index c2272ec268ecdb647798c253ffadcb6f3622ce23..baed0caa24fd45f57fd22bba37636fb38927b08d 100644 (file)
@@ -213,7 +213,16 @@ void RGBrowser::ItemClicked(TGListTreeItem *item, Int_t btn, Int_t x, Int_t y)
   //printf("ItemClicked item %s List %d btn=%d, x=%d, y=%d\n",
   //  item->GetText(),fDisplayFrame->GetList()->GetEntries(), btn, x, y);
 
-  TObject* obj = (TObject*)item->GetUserData();
+  RenderElement* re = (RenderElement*)item->GetUserData();
+  if(re == 0) return;
+  TObject* obj = re->GetObject();
+
+  // A pathetic hack to get at least a bit of color coordination
+  // for RenderElementObjPtr.
+  if(item->GetColor() != re->GetMainColor()) {
+    item->SetColor(re->GetMainColor());
+    fListTree->GetClient()->NeedRedraw(fListTree);
+  }
 
   if(btn == 3) {
     if (obj) {
@@ -222,10 +231,7 @@ void RGBrowser::ItemClicked(TGListTreeItem *item, Int_t btn, Int_t x, Int_t y)
     return;
   }
 
-  {
-    RenderElement* re = dynamic_cast<RenderElement*>(obj);
-    gReve->EditRenderElement(re);
-  }
+  gReve->EditRenderElement(re);
 
   // This only available in classic look.
   // Still working but slowly drifting towards obscurity (4.2006).
@@ -237,13 +243,15 @@ void RGBrowser::DbClickListItem(TGListTreeItem* item, Int_t btn)
   static const Exc_t eH("RGBrowser::DbClickListItem ");
 
   printf("dbclick item %s\n", item->GetText());
-  TObject* obj = (TObject*)item->GetUserData();
+  RenderElement* re = (RenderElement*)item->GetUserData();
+  if(re == 0) return;
+  TObject* obj = re->GetObject();
 
   if (obj) {
     // ListTreeHighlight(item);
 
     {
-      RenderElementListBase* rel = dynamic_cast<RenderElementListBase*>(obj);
+      RenderElementListBase* rel = dynamic_cast<RenderElementListBase*>(re);
       if(rel != 0) {
        Int_t ni = rel->ExpandIntoListTree(fListTree, item);
        printf("%s expanded by %d\n", eH.Data(), ni);
@@ -322,7 +330,8 @@ void RGBrowser::DisplayChildren(TGListTreeItem *item, Int_t btn)
     fDisplayFrame->AddFrame(b2, lh);
     x += wW;
 
-    TObject* obj = reinterpret_cast<TObject*>(child->GetUserData());
+    RenderElement* re = (RenderElement*)child->GetUserData();
+    TObject* obj = re->GetObject();
     if(obj != 0) {
       TGXYLayoutHints* lh;
 
@@ -519,7 +528,6 @@ void RGBrowser::SetTransparency(Long_t )
     vol->SetTransparency(char(rv.GetNumber()));
   }
 
   TGFrameElement* fel;
   TList* list = fDisplayFrame->GetList();
   TIter nextin(list);
@@ -528,7 +536,8 @@ void RGBrowser::SetTransparency(Long_t )
     // printf("RGBrowser::SetTransparency %s  in fDisplayFrame\n", fel->fFrame->GetName());
     cw = dynamic_cast<ReveValuator*>(fel->fFrame);
     if(cw) {
-      TGeoVolume* v = dynamic_cast<TGeoVolume*>((TObject*)cw->GetUserData());
+
+      TGeoVolume* v = dynamic_cast<TGeoVolume*>((RenderElement*)cw->GetUserData());
       if(v) {
        cw->SetNumber(v->GetTransparency());
       }
@@ -642,7 +651,8 @@ void RGBrowser::UpdateListItems(TGListTreeItem* item, Int_t )
 {
   if (item->GetUserData()) {
     // ListTreeHighlight(item);
-    TObject* obj = (TObject *) item->GetUserData();
+    RenderElement* re = (RenderElement*)item->GetUserData();
+    TObject* obj = re->GetObject();
 
     // geometry tree
     if(obj->IsA()->InheritsFrom("TGeoNode")){
index 201d3ba3d10618ac1b5f49c4a417a799b782a8b7..d7f417187e7eb94f51545d12e64fae13a140e7be 100644 (file)
@@ -122,27 +122,8 @@ RGTopFrame::RGTopFrame(const TGWindow *p, UInt_t w, UInt_t h, LookType_e look)
   fEmbeddedCanvas3->GetCanvas()->SetBorderMode(0);
   fCC = fEmbeddedCanvas3->GetCanvas();
   // fCC->SetFillColor(1);
-
-  { // Workaround for empty scene.
-    TPolyMarker3D* bugmark = new TPolyMarker3D(8);
-    // bugmark->SetMarkerStyle(2);
-    // bugmark->SetMarkerColor(1);
-    const Float_t a = 10.0;
-    bugmark->SetPoint(0, a, a,a);
-    bugmark->SetPoint(1, a, -a,a);
-    bugmark->SetPoint(2, -a, -a,a);
-    bugmark->SetPoint(3, -a, a,a);
-
-    bugmark->SetPoint(4, a, a,-a);
-    bugmark->SetPoint(5, a, -a,-a);
-    bugmark->SetPoint(6, -a, a,-a);
-    bugmark->SetPoint(7, -a, -a,-a);
-    bugmark->Draw();
-  }
-
   Reve::PopPad();
 
-
   // histo canvas
   TGCompositeFrame* frame4 = fDisplayFrame->AddTab("HistoCanvas");
   TRootEmbeddedCanvas* ecanvas4 = new TRootEmbeddedCanvas("HistoCanvas", frame4, 580, 360);
@@ -150,7 +131,6 @@ RGTopFrame::RGTopFrame(const TGWindow *p, UInt_t w, UInt_t h, LookType_e look)
   fHistoCanvas =  ecanvas4->GetCanvas();
   fHistoCanvas->SetBorderMode(0);
 
-
   fV2->AddFrame(fDisplayFrame, fL0);
   AddFrame(fMainFrame, fL0);
    
@@ -244,7 +224,7 @@ void RGTopFrame::EditRenderElement(RenderElement* rnr_element)
   static const Exc_t eH("RGTopFrame::EditRenderElement ");
 
   TObject* tobj = 0;
-  if(rnr_element) tobj = dynamic_cast<TObject*>(rnr_element);
+  if(rnr_element) tobj = rnr_element->GetObject();
   fEditor->DisplayObject(tobj);
 }
 
@@ -299,25 +279,16 @@ int RGTopFrame::SpawnGuiAndRun(int argc, char **argv)
 
 TGListTreeItem* RGTopFrame::AddEvent(TObject* event)
 {
-  fCurrentEvent    = event;
-  fCurrentEventLTI = GetListTree()->AddItem(0, event->GetName());
-  fCurrentEventLTI->SetUserData(event);
-  fCurrentEventLTI->SetTipText(event->GetTitle());
+  fCurrentEvent = event;
+  RenderElementObjPtr* rnrEv = new RenderElementObjPtr(event);
+  fCurrentEventLTI = rnrEv->AddIntoListTree(GetListTree(), 0);
   GetListTree()->OpenItem(fCurrentEventLTI);
   return fCurrentEventLTI;
 }
 
 TGListTreeItem* RGTopFrame::AddRenderElement(RenderElement* rnr_element)
 {
-  static const Exc_t eH("RGTopFrame::AddGlobalRenderElement ");
-
-  // Here could route rnr-element to several browsers/pads.
-
-  TGListTreeItem* newitem =
-    rnr_element->AddIntoListTree(GetListTree(), GetEventTreeItem());
-  NotifyBrowser();
-
-  return newitem;
+  return AddRenderElement(GetEventTreeItem(), rnr_element);
 }
 
 TGListTreeItem* RGTopFrame::AddRenderElement(TGListTreeItem* parent,
@@ -336,10 +307,10 @@ TGListTreeItem* RGTopFrame::AddRenderElement(TGListTreeItem* parent,
 
 TGListTreeItem* RGTopFrame::AddGlobalRenderElement(RenderElement* rnr_element)
 {
-  return AddGlobalRenderElement(GetEventTreeItem(), rnr_element);
+  return AddGlobalRenderElement(GetGlobalTreeItem(), rnr_element);
 }
 
-TGListTreeItem* RGTopFrame::AddGlobalRenderElement(TGListTreeItem* ,
+TGListTreeItem* RGTopFrame::AddGlobalRenderElement(TGListTreeItem* parent,
                                                   RenderElement* rnr_element)
 {
   static const Exc_t eH("RGTopFrame::AddGlobalRenderElement ");
@@ -347,7 +318,7 @@ TGListTreeItem* RGTopFrame::AddGlobalRenderElement(TGListTreeItem* ,
   // Here could route rnr-element to several browsers/pads.
 
   TGListTreeItem* newitem =
-    rnr_element->AddIntoListTree(GetListTree(), GetGlobalTreeItem());
+    rnr_element->AddIntoListTree(GetListTree(), parent);
   NotifyBrowser();
 
   return newitem;
@@ -368,10 +339,11 @@ void RGTopFrame::DrawRenderElement(RenderElement* rnr_element, TVirtualPad* pad)
 
 void RGTopFrame::RenderElementChecked(TObject* obj, Bool_t state)
 {
-  RenderElement* rnr_element = dynamic_cast<RenderElement*>(obj);
-  // printf("Checked %p %p %d\n", obj, rnr_element, state);
-  if(rnr_element)
-    rnr_element->SetRnrElement(state);
+  // Item's user-data is blindly casted into TObject.
+  // We recast it blindly back into the render element.
+
+  RenderElement* rnrEl = (RenderElement*) obj;
+  rnrEl->SetRnrElement(state);
 }
 
 /**************************************************************************/
index ae1ac13703b373fe49df76c60c804b2e83283d44..b34ee1b989ceb00094000ccb8d275a8b78d7bbbc 100644 (file)
@@ -46,11 +46,11 @@ TGListTreeItem* RenderElement::AddIntoListTree(TGListTree* ltree,
   static const Exc_t eH("RenderElement::AddIntoListTree ");
 
   TObject* tobj = GetObject(eH);
-  TGListTreeItem* item = ltree->AddItem(parent, tobj->GetName(), tobj,
-                                        0, 0, kTRUE);
+  Bool_t colorp = fMainColorPtr != 0;
+  TGListTreeItem* item = ltree->AddItem(parent, tobj->GetName(), this,
+                                        0, 0, colorp);
   item->CheckItem(GetRnrElement());
-  item->SetColor(GetMainColor());
-  // printf("%s setting title for %s, '%s'\n", eH.Data(), tobj->GetName(), tobj->GetTitle());
+  if(colorp) item->SetColor(GetMainColor());
   item->SetTipText(tobj->GetTitle());
 
   fItems.insert(ListTreeInfo(ltree, item));
@@ -119,6 +119,7 @@ void RenderElement::SetRnrElement(Bool_t rnr)
     FullUpdate();
   }
 }
+
 /**************************************************************************/
 
 void RenderElement::SetMainColor(Color_t color)
@@ -137,6 +138,48 @@ void RenderElement::SetMainColorByPixel(Pixel_t pixel)
 /**************************************************************************/
 /**************************************************************************/
 
+ClassImp(RenderElementObjPtr)
+
+RenderElementObjPtr::RenderElementObjPtr(TObject* obj) :
+  RenderElement(),
+  fObject(obj)  
+{}
+
+RenderElementObjPtr::RenderElementObjPtr(TObject* obj, Color_t& mainColor) :
+  RenderElement(mainColor),
+  fObject(obj)  
+{}
+
+RenderElementObjPtr::~RenderElementObjPtr()
+{
+  delete fObject;
+}
+
+/**************************************************************************/
+
+TObject* RenderElementObjPtr::GetObject(Reve::Exc_t eh)
+{
+  if(fObject == 0)
+    throw(eh + "fObject not set.");
+  return fObject;
+}
+
+void RenderElementObjPtr::SetRnrElement(Bool_t rnr)
+{
+  if(rnr != fRnrElement) {
+    fRnrElement = rnr;
+    if(rnr) {
+      gReve->GetCC()->GetListOfPrimitives()->Add(fObject);
+    } else {
+      gReve->GetCC()->GetListOfPrimitives()->Remove(fObject);
+    }
+    FullUpdate();
+  }
+}
+
+/**************************************************************************/
+/**************************************************************************/
+
 ClassImp(RenderElementListBase)
 
 Int_t RenderElementListBase::ExpandIntoListTree(TGListTree* ltree,
index e84de0f951bb13d9dd272ad68a95b4a58a63ac0c..2f3c6137670ad471ea0b4745042dd916948a4377 100644 (file)
@@ -54,7 +54,7 @@ public:
   RenderElement(Color_t& main_color);
   virtual ~RenderElement() {}
 
-  TObject* GetObject(Reve::Exc_t eh="RenderElement::GetObject ");
+  virtual TObject* GetObject(Reve::Exc_t eh="RenderElement::GetObject ");
 
   /*
     TRef&    GetSource() { return fSource; }
@@ -86,7 +86,26 @@ public:
           void    SetMainColorByPixel(Pixel_t pixel);
 
   ClassDef(RenderElement, 1);
-}; // endclass Reve
+}; // endclass RenderElement
+
+/**************************************************************************/
+
+class RenderElementObjPtr : public RenderElement
+{
+protected:
+  TObject* fObject;
+
+public:
+  RenderElementObjPtr(TObject* obj);
+  RenderElementObjPtr(TObject* obj, Color_t& mainColor);
+  virtual ~RenderElementObjPtr();
+
+  virtual TObject* GetObject(Reve::Exc_t eh="RenderElementObjPtr::GetObject ");
+
+  virtual void SetRnrElement(Bool_t rnr);
+
+  ClassDef(RenderElementObjPtr, 1);
+}; // endclass RenderElementObjPtr
 
 /**************************************************************************/
 
index ab242490cd329c3cfa2770ed19e7b6ad0552b87a..324d62f935346a43955ac4ce4c8c734cd52d6963 100644 (file)
@@ -45,6 +45,16 @@ void ColorFromIdx(Color_t ci, UChar_t* col)
   }
 }
 
+Color_t* FindColorVar(TObject* obj, const Text_t* varname)
+{
+  static const Exc_t eH("Reve::FindColorVar");
+
+  Int_t off = obj->IsA()->GetDataMemberOffset(varname);
+  if(off == 0)
+    throw(eH + "could not find member '" + varname + "' in class " + obj->IsA()->GetName() + ".");
+  return (Color_t*) (((char*)obj) + off);
+}
+
 /**************************************************************************/
 /**************************************************************************/
 
index 21bea4276dc02ca50b3646ae110631c75522b97f..b0dd95238cfe521f490490f7d94335f74f2a7dfc 100644 (file)
@@ -38,7 +38,8 @@ Exc_t operator+(const Exc_t &s1, const char    *s2);
 
 void WarnCaller(const TString& warning);
 
-void ColorFromIdx(Color_t ci, UChar_t* col);
+void     ColorFromIdx(Color_t ci, UChar_t* col);
+Color_t* FindColorVar(TObject* obj, const Text_t* varname);
 
 /**************************************************************************/
 /**************************************************************************/
diff --git a/EVE/alice-macros/region_marker.C b/EVE/alice-macros/region_marker.C
new file mode 100644 (file)
index 0000000..05d46d5
--- /dev/null
@@ -0,0 +1,24 @@
+// $Header
+
+void region_marker(Float_t a=10, Float_t x=0, Float_t y=0, Float_t z=0)
+{
+  TPolyMarker3D* mark = new TPolyMarker3D(8);
+  mark->SetName("Origin marker");
+  mark->SetMarkerStyle(3);
+  mark->SetMarkerColor(6);
+  mark->SetPoint(0, x+a, y+a, z+a);
+  mark->SetPoint(1, x+a, y-a, z+a);
+  mark->SetPoint(2, x-a, y-a, z+a);
+  mark->SetPoint(3, x-a, y+a, z+a);
+
+  mark->SetPoint(4, x+a, y+a, z-a);
+  mark->SetPoint(5, x+a, y-a, z-a);
+  mark->SetPoint(6, x-a, y+a, z-a);
+  mark->SetPoint(7, x-a, y-a, z-a);
+
+  using namespace Reve;
+  Color_t* colp = FindColorVar(mark, "fMarkerColor");
+  RenderElementObjPtr* rnrEl = new RenderElementObjPtr(mark, *colp);
+  gReve->AddGlobalRenderElement(rnrEl);
+  gReve->DrawRenderElement(rnrEl);
+}
index 514aab181273404c492a068ad5d8405b9c03c3fc..b6cea032eb96f3cc104bdc114eafb8d3969c406d 100644 (file)
@@ -34,22 +34,17 @@ void tpc_digits(Int_t mode=0)
   */
 
   gStyle->SetPalette(1, 0);
-  UInt_t col = 36;
+  Color_t col = 36;
 
   switch(mode) {
 
   case 0: { // Display a single sector
-   
-    gReve->DisableRedraw();
-  
     Alieve::TPCSector2D* s = new Alieve::TPCSector2D();
+    s->SetFrameColor(col);
     s->SetDataSource(g_tpc_data);
-    s->SetMainColor(Color_t(col));
     gReve->AddRenderElement(s);
     gReve->DrawRenderElement(s);
 
-    gReve->EnableRedraw();
-
     TGLViewer* cam = dynamic_cast<TGLViewer*>(gReve->GetCC()->GetViewer3D());
     //cam->SetCurrentCamera(TGLViewer::kCameraOrthoXOY) ;
     //cam->SetOrthoCamera(TGLViewer::kCameraOrthoXOY, 2*left, 2*right, 2*top, bottom); 
@@ -59,7 +54,6 @@ void tpc_digits(Int_t mode=0)
   }
 
   case 1: { // Display all sectors
-
     gReve->DisableRedraw();
     {
       Reve::RenderElementList* l = new Reve::RenderElementList("TPC plate 1");
@@ -69,9 +63,9 @@ void tpc_digits(Int_t mode=0)
       
       for(Int_t i = 0; i<18; i++) {
        Alieve::TPCSector2D* s = new Alieve::TPCSector2D();
-       s->SetSegmentID(i);
+       s->SetSectorID(i);
        s->SetDataSource(g_tpc_data);
-       s->SetMainColor(Color_t(col));
+       s->SetFrameColor(col);
        s->SetTrans(true);
        l->AddElement(s);
        gReve->AddRenderElement(ti, s);
@@ -86,9 +80,9 @@ void tpc_digits(Int_t mode=0)
       TGListTreeItem *ti = gReve->AddRenderElement(l);
       for(Int_t i = 18; i<36; i++) {
        Alieve::TPCSector2D* s = new Alieve::TPCSector2D();
-       s->SetSegmentID(i);
+       s->SetSectorID(i);
        s->SetDataSource(g_tpc_data);
-       s->SetMainColor(Color_t(col));
+       s->SetFrameColor(col);
        s->SetTrans(true);
        l->AddElement(s);
        gReve->AddRenderElement(ti, s);
@@ -100,22 +94,14 @@ void tpc_digits(Int_t mode=0)
     break;
   }
 
-    /* // Almost ready ...
   case 2 : { // Display a single sector in 3D
-    Reve::RenderElementList* l = new Reve::RenderElementList("TPC Drift");
-    l->SetTitle("TPC Segment Drift");
-    l->SetMainColor(Color_t(col));
-    TGListTreeItem *ti = gReve->AddRenderElement(l);
-  
-    Alieve::TPCSector3D* = new Alieve::TPCSector3D(di, 0);
-    s->SetMainColor(Color_t(col));
-    l->AddElement(s);
-    gReve->AddRenderElement(ti, s);
-    gReve->DrawRenderElement(l);
-    gReve->EnableRedraw();
+    Alieve::TPCSector3D* s = new Alieve::TPCSector3D();
+    s->SetFrameColor(col);
+    s->SetDataSource(g_tpc_data);
+    gReve->AddRenderElement(s);
+    gReve->DrawRenderElement(s);
     break;
   }
-    */
 
   } // switch
 }
index 7192d6ee4b42ec9c679db8fed6c3c1fe7cd18c42..62f52b14ae76c2020cbf0913a922415041585300 100644 (file)
@@ -43,6 +43,8 @@ void alieve_init(const Text_t* path=".", Int_t event=0,
 
   new TBrowser;
 
+  Reve::AssertMacro("region_marker.C");
+
   // Open event
 
   Alieve::Event::Initialize(use_runloader, use_esd);
index bb58526fb24272b75b878681a1b9370a5003182f..94caacd217debb885590dfab3544a20e8e789465 100644 (file)
@@ -46,9 +46,10 @@ void alieve_loadlibs ()
   gSystem->Load("libPHOSrec");
   gSystem->Load("libMUONmapping");
   gSystem->Load("libMUONgeometry");
-  //gSystem->Load("libMUONbase");
-  //gSystem->Load("libMUONsim");
-  //gSystem->Load("libMUONrec");
+  gSystem->Load("libMUONbase");
+  gSystem->Load("libMUONrec");
+  gSystem->Load("libMUONraw");
+  gSystem->Load("libMUONsim");
   gSystem->Load("libFMDbase");
   gSystem->Load("libFMDsim");
   gSystem->Load("libFMDrec");
diff --git a/EVE/test-macros/tpc_sector_raw_test.C b/EVE/test-macros/tpc_sector_raw_test.C
new file mode 100644 (file)
index 0000000..1616337
--- /dev/null
@@ -0,0 +1,119 @@
+// $Header$
+
+// Functions to read rootified raw-data from TPC sector test.
+//
+// Use tpc_sector_raw_test("filename.root") for initialization,
+// next_event() to advance along the data stream.
+// When there is no more data ROOT will crash.
+
+class AliRawReaderRoot;
+
+namespace Alieve {
+class TPCData;
+class TPCSector2D;
+class TPCSector3D;
+}
+
+using namespace Alieve;
+
+TPCData*     x = 0;
+TPCSector2D* s = 0;
+TPCSector3D* t = 0;
+
+AliRawReaderRoot* reader = 0;
+Int_t             event  = -1;
+
+void tpc_sector_raw_test(const char *file = "", Int_t ievent = 0)
+{
+  // gROOT->Macro("alieve_loadlibs.C");
+  // Only sub-set of ALICE libraries is needed:
+  gSystem->Load("libESD");
+  gSystem->Load("libSTEER");
+  gSystem->Load("libRAWData");
+  gSystem->Load("libTPCbase");
+  gSystem->Load("libTPCrec");
+  gSystem->Load("libTPCsim");
+  // ALICE visualization
+  gSystem->Load("libAlieve");
+
+  gStyle->SetPalette(1, 0);
+
+  reader = new AliRawReaderRoot(file);
+  reader->RequireHeader(kFALSE);
+  reader->Reset();
+  for(Int_t i=0; i<ievent; ++i, ++event)
+    reader->NextEvennt();
+
+  x = new TPCData;
+  //x->SetLoadPedestal(5);
+  x->SetLoadThreshold(5);
+  x->SetAutoPedestal(kTRUE);
+
+  s = new TPCSector2D();
+  // s->SetSectorID(0);  // 0 is default
+  // s->SetTrans(kTRUE); // place on proper 3D coordinates
+  s->SetDataSource(x);
+  s->SetFrameColor(36);
+  gReve->AddRenderElement(s);
+  gReve->DrawRenderElement(s);
+
+  t = new TPCSector3D();
+  // t->SetSectorID(0);
+  // t->SetTrans(kTRUE);
+  t->SetDataSource(x);
+  t->SetMaxTime(1023);
+  t->SetDriftVel(2.273);
+  gReve->AddRenderElement(t);
+  gReve->DrawRenderElement(t);
+
+  next_event();
+}
+
+void next_event()
+{
+  reader->NextEvent();
+  ++event;
+
+  printf("Now loading event %d\n", event);
+  AliTPCRawStreamOld input(reader);
+  reader->SelectEquipment(-1);
+  x->LoadRaw(input, kTRUE, kTRUE);
+
+  printf("Updating scene\n");
+  s->IncRTS();
+  t->IncRTS();
+  gReve->Redraw3D();
+}
+
+void tpc_raw_pad_dump(Int_t s, Int_t r, Int_t p)
+{
+  reader->Reset();
+  reader->NextEvent();
+
+  if(r >= TPCSectorData::GetInnSeg().GetNRows()) {
+    r -=  TPCSectorData::GetInnSeg().GetNRows();
+    s += 36;
+  }
+
+  // AliTPCRawStream input(reader);
+  AliTPCRawStreamOld input(reader);
+  reader->SelectEquipment(-1);
+
+  Int_t sector = input.GetSector();
+  Int_t row    = input.GetRow();
+
+  while (input.Next()) {
+    if (input.IsNewRow()) {
+      sector = input.GetSector();
+      row    = input.GetRow();
+    }
+    if(sector != s || row != r) continue;
+
+    Int_t signal = input.GetSignal();
+    Int_t pad    = input.GetPad();
+    Int_t time   = input.GetTime();
+
+    if(pad == p)
+      printf("%d %d\n", time, signal);
+  }
+}