]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EVE/Alieve/TPCSectorVizEditor.cxx
Remove MCTrackRef class.
[u/mrichter/AliRoot.git] / EVE / Alieve / TPCSectorVizEditor.cxx
index 9a41be6a3f5e9de81fa952d2e777484e4ceaf629..4a14a5b4b99f1229c12625fdea407d3415cb1b27 100644 (file)
@@ -4,6 +4,7 @@
 #include <Alieve/TPCSectorViz.h>
 
 #include <Reve/RGValuators.h>
+#include <Reve/ZTransEditor.h>
 
 #include <TVirtualPad.h>
 #include <TColor.h>
@@ -24,15 +25,30 @@ using namespace Alieve;
 
 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);
@@ -42,11 +58,11 @@ TPCSectorVizEditor::TPCSectorVizEditor(const TGWindow *p, Int_t id, Int_t width,
   fSectorID->SetToolTip("0-17 +z plate; 18-35 -z plate");
   fSectorID->Connect("ValueSet(Double_t)",
                     "Alieve::TPCSectorVizEditor", this, "DoSectorID()");
-  // Reuse sectorID for transformation button
-  fTrans = new TGCheckButton(fSectorID, "Trans");
-  fTrans->SetToolTipText("Translate to true position");
-  fSectorID->AddFrame(fTrans, new TGLayoutHints(kLHintsLeft, 12, 0, 1, 0));
-  fTrans->Connect("Toggled(Bool_t)","Alieve::TPCSectorVizEditor", this, "DoTrans()");
+  // 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));
 
   {
@@ -72,7 +88,7 @@ TPCSectorVizEditor::TPCSectorVizEditor(const TGWindow *p, Int_t id, Int_t width,
   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));
@@ -82,7 +98,7 @@ TPCSectorVizEditor::TPCSectorVizEditor(const TGWindow *p, Int_t id, Int_t width,
   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));
@@ -96,14 +112,6 @@ TPCSectorVizEditor::TPCSectorVizEditor(const TGWindow *p, Int_t id, Int_t width,
   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()
@@ -111,23 +119,14 @@ TPCSectorVizEditor::~TPCSectorVizEditor()
 
 /**************************************************************************/
 
-void TPCSectorVizEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t /*event*/)
+void TPCSectorVizEditor::SetModel(TObject* obj)
 {
-  fModel = 0;
-  fPad   = 0;
+  fM = dynamic_cast<TPCSectorViz*>(obj);
 
-  if (!obj || !obj->InheritsFrom(TPCSectorViz::Class()) || obj->InheritsFrom(TVirtualPad::Class())) {
-    SetActive(kFALSE);
-    return;
-  }
-
-  fModel = obj;
-  fPad   = pad;
-
-  fM = dynamic_cast<TPCSectorViz*>(fModel);
+  fHMTrans->SetDataFromTrans(&fM->fHMTrans);
 
   fSectorID->SetValue(fM->fSectorID);
-  fTrans->SetState(fM->fTrans  ? kButtonDown : kButtonUp);
+  fAutoTrans->SetState(fM->fAutoTrans  ? kButtonDown : kButtonUp);
 
   fRnrInn ->SetState(fM->fRnrInn  ? kButtonDown : kButtonUp);
   fRnrOut1->SetState(fM->fRnrOut1 ? kButtonDown : kButtonUp);
@@ -137,8 +136,6 @@ void TPCSectorVizEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t /*event*
   fMaxVal->SetValue(fM->fMaxVal);
 
   fTime->SetValues(fM->fMinTime, fM->fMaxTime);
-
-  SetActive();
 }
 
 /**************************************************************************/
@@ -149,9 +146,9 @@ void TPCSectorVizEditor::DoSectorID()
   Update();
 }
 
-void TPCSectorVizEditor::DoTrans()
+void TPCSectorVizEditor::DoAutoTrans()
 {
-  fM->SetTrans(fTrans->IsOn());
+  fM->SetAutoTrans(fAutoTrans->IsOn());
   Update();
 }
 
@@ -180,12 +177,14 @@ void TPCSectorVizEditor::DoRnrOut2()
 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();
 }