// $Header$
#include "CLASS.h"
-#include <Reve/STEM.h>
+#include <Alieve/STEM.h>
#include <TVirtualPad.h>
#include <TColor.h>
// void DoXYZZ();
- ClassDef(CLASS, 1); // Editor for STEM
+ ClassDef(CLASS, 0); // Editor for STEM
}; // endclass CLASS
}
+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:
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*.
/**************************************************************************/
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();
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;
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();
#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+;
// 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)
TPCData::~TPCData()
{
- // !!!! delete sectors
+ DeleteAllSectors();
}
/**************************************************************************/
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)
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()) {
}
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 {
void CreateSector(Int_t sector);
void CreateAllSectors();
+ void DropAllSectors();
+ void DeleteAllSectors();
TPCSectorData* GetSectorData(Int_t sector, Bool_t spawnSectors=kFALSE);
#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;
-}
+{}
/**************************************************************************/
/**************************************************************************/
-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
#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
}
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");
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;
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());
}
}
-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();
}
class TGDoubleHSlider;
class TGHSlider;
+
namespace Alieve {
class TPCSector2D;
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
#include <Alieve/TPCData.h>
-#include <TStyle.h>
-#include <TColor.h>
#include <TStopwatch.h>
#include <GL/gl.h>
/**************************************************************************/
-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.
}
padVal = TMath::Min(padVal, fSector->fMaxVal);
if(padVal > fSector->fThreshold)
- SetCol(padVal, img_pos);
+ fSector->SetupColor(padVal, img_pos);
img_pos += 4;
}
}
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;
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) {
--- /dev/null
+// $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);
+}
--- /dev/null
+// $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
--- /dev/null
+// $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();
+}
--- /dev/null
+// $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
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
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)
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;
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);
--- /dev/null
+// $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);
+}
--- /dev/null
+// $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
--- /dev/null
+// $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();
+}
--- /dev/null
+// $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
+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
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
2006-05-17 Matevz Tadel <matevz.tadel@cern.ch>
- EVE-dev branch
+ EVE-dev
* alice-macros/tpc_digits.C:
Use new TPCData classes.
#include <TRandom.h>
#include <TBuffer3D.h>
#include <TBuffer3DTypes.h>
-#include <TGeometry.h>
#include <TVirtualPad.h>
#include <TVirtualViewer3D.h>
ClassImp(BoxSet)
-void BoxSet::Init()
-{
- fTrans = false;
- bbox_init();
-}
+BoxSet::BoxSet(const Text_t* n, const Text_t* t) :
+ TNamed(n, t),
+ fTrans(kFALSE)
+{}
/**************************************************************************/
{
friend class BoxSetGL;
-private:
- void Init();
-
protected:
Double_t fMatrix[16];
Bool_t fTrans;
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(); }
+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
// 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+;
//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) {
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).
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);
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;
vol->SetTransparency(char(rv.GetNumber()));
}
-
TGFrameElement* fel;
TList* list = fDisplayFrame->GetList();
TIter nextin(list);
// 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());
}
{
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")){
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);
fHistoCanvas = ecanvas4->GetCanvas();
fHistoCanvas->SetBorderMode(0);
-
fV2->AddFrame(fDisplayFrame, fL0);
AddFrame(fMainFrame, fL0);
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);
}
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,
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 ");
// Here could route rnr-element to several browsers/pads.
TGListTreeItem* newitem =
- rnr_element->AddIntoListTree(GetListTree(), GetGlobalTreeItem());
+ rnr_element->AddIntoListTree(GetListTree(), parent);
NotifyBrowser();
return newitem;
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);
}
/**************************************************************************/
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));
FullUpdate();
}
}
+
/**************************************************************************/
void RenderElement::SetMainColor(Color_t color)
/**************************************************************************/
/**************************************************************************/
+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,
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; }
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
/**************************************************************************/
}
}
+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);
+}
+
/**************************************************************************/
/**************************************************************************/
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);
/**************************************************************************/
/**************************************************************************/
--- /dev/null
+// $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);
+}
*/
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);
}
case 1: { // Display all sectors
-
gReve->DisableRedraw();
{
Reve::RenderElementList* l = new Reve::RenderElementList("TPC plate 1");
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);
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);
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
}
new TBrowser;
+ Reve::AssertMacro("region_marker.C");
+
// Open event
Alieve::Event::Initialize(use_runloader, use_esd);
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");
--- /dev/null
+// $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);
+ }
+}