#include <Alieve/TPCSectorViz.h>
#include <Reve/RGValuators.h>
+#include <Reve/ZTransEditor.h>
#include <TVirtualPad.h>
#include <TColor.h>
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)
+TPCSectorVizEditor::TPCSectorVizEditor(const TGWindow *p,
+ Int_t width, Int_t height,
+ UInt_t options, Pixel_t back) :
+ TGedFrame(p, width, height, options | kVerticalFrame, back),
+ fM(0),
+ fHMTrans (0),
+ fSectorID (0), fAutoTrans (0),
+ fRnrInn (0), fRnrOut1 (0), fRnrOut2(0),
+ fThreshold (0), fMaxVal (0),
+ fTime (0)
{
- fM = 0;
- MakeTitle("TPCSectorViz");
+ fPriority = 40;
Int_t labelW = 60;
+ MakeTitle("Transformation matrix");
+
+ fHMTrans = new ZTransSubEditor(this);
+ fHMTrans->Connect("UseTrans()", "Alieve::TPCSectorVizEditor", this, "Update()");
+ fHMTrans->Connect("TransChanged()", "Alieve::TPCSectorVizEditor", this, "Update()");
+ AddFrame(fHMTrans, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 2, 0, 0, 0));
+
+ MakeTitle("TPCSectorViz");
+
fSectorID = new RGValuator(this, "SectorID", 110, 0);
fSectorID->SetLabelWidth(labelW);
fSectorID->SetShowSlider(kFALSE);
fSectorID->SetToolTip("0-17 +z plate; 18-35 -z plate");
fSectorID->Connect("ValueSet(Double_t)",
"Alieve::TPCSectorVizEditor", this, "DoSectorID()");
+ // Reuse sectorID for auto-transformation button
+ fAutoTrans = new TGCheckButton(fSectorID, "AutoTrans");
+ fAutoTrans->SetToolTipText("Automatically set transformation to true position");
+ fSectorID->AddFrame(fAutoTrans, new TGLayoutHints(kLHintsLeft, 12, 0, 1, 0));
+ fAutoTrans->Connect("Toggled(Bool_t)","Alieve::TPCSectorVizEditor", this, "DoAutoTrans()");
AddFrame(fSectorID, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
{
fThreshold->SetLabelWidth(labelW);
fThreshold->Build();
fThreshold->GetSlider()->SetWidth(120);
- fThreshold->SetLimits(0,149);
+ fThreshold->SetLimits(0,250);
fThreshold->Connect("ValueSet(Double_t)",
"Alieve::TPCSectorVizEditor", this, "DoThreshold()");
AddFrame(fThreshold, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1));
fMaxVal->SetLabelWidth(labelW);
fMaxVal->Build();
fMaxVal->GetSlider()->SetWidth(120);
- fMaxVal->SetLimits(0, 299);
+ fMaxVal->SetLimits(0, 500);
fMaxVal->Connect("ValueSet(Double_t)",
"Alieve::TPCSectorVizEditor", this, "DoMaxVal()");
AddFrame(fMaxVal, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1));
fTime->Connect("ValueSet()",
"Alieve::TPCSectorVizEditor", this, "DoTime()");
AddFrame(fTime, new TGLayoutHints(kLHintsTop, 1, 1, 2, 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*/)
+void TPCSectorVizEditor::SetModel(TObject* obj)
{
- fModel = 0;
- fPad = 0;
-
- if (!obj || !obj->InheritsFrom(TPCSectorViz::Class()) || obj->InheritsFrom(TVirtualPad::Class())) {
- SetActive(kFALSE);
- return;
- }
+ fM = dynamic_cast<TPCSectorViz*>(obj);
- fModel = obj;
- fPad = pad;
-
- fM = dynamic_cast<TPCSectorViz*>(fModel);
+ fHMTrans->SetDataFromTrans(&fM->fHMTrans);
fSectorID->SetValue(fM->fSectorID);
+ fAutoTrans->SetState(fM->fAutoTrans ? kButtonDown : kButtonUp);
fRnrInn ->SetState(fM->fRnrInn ? kButtonDown : kButtonUp);
fRnrOut1->SetState(fM->fRnrOut1 ? kButtonDown : kButtonUp);
fMaxVal->SetValue(fM->fMaxVal);
fTime->SetValues(fM->fMinTime, fM->fMaxTime);
-
- SetActive();
}
/**************************************************************************/
Update();
}
+void TPCSectorVizEditor::DoAutoTrans()
+{
+ fM->SetAutoTrans(fAutoTrans->IsOn());
+ Update();
+}
+
/**************************************************************************/
void TPCSectorVizEditor::DoRnrInn()
void TPCSectorVizEditor::DoThreshold()
{
fM->SetThreshold((Short_t) fThreshold->GetValue());
+ fThreshold->SetValue(fM->fThreshold);
Update();
}
void TPCSectorVizEditor::DoMaxVal()
{
fM->SetMaxVal((Int_t) fMaxVal->GetValue());
+ fMaxVal->SetValue(fM->fMaxVal);
Update();
}