Added interface to load-time threshold/(auto)pedestal settings.
authormtadel <mtadel@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 5 Dec 2006 20:15:26 +0000 (20:15 +0000)
committermtadel <mtadel@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 5 Dec 2006 20:15:26 +0000 (20:15 +0000)
EVE/Alieve/TPCLoaderEditor.cxx
EVE/Alieve/TPCLoaderEditor.h

index 1a3add6..20f31d5 100644 (file)
@@ -2,6 +2,7 @@
 
 #include "TPCLoaderEditor.h"
 #include <Alieve/TPCLoader.h>
+#include <Alieve/TPCData.h>
 #include <Reve/RGTopFrame.h>
 #include <Reve/RGValuators.h>
 
@@ -25,26 +26,35 @@ using namespace Alieve;
 
 ClassImp(TPCLoaderEditor)
 
-TPCLoaderEditor::TPCLoaderEditor(const TGWindow *p,
-                                 Int_t width, Int_t height,
-                                UInt_t options, Pixel_t back) :
-  TGedFrame(p, width, height, options | kVerticalFrame, back),
+  TPCLoaderEditor::TPCLoaderEditor(const TGWindow *p,
+                                  Int_t width, Int_t height,
+                                  UInt_t options, Pixel_t back) :
+    TGedFrame(p, width, height, options | kVerticalFrame, back),
 
-  fM (0),
+    fM (0),
 
-  fFile     (0),
-  fOpenFile (0),
+    fFile     (0),
+    fOpenFile (0),
 
-  fEvent    (0),
-  fDoubleSR (0),
+    fEvent    (0),
+    fDoubleSR (0),
 
-  fUpdateSectors   (0),
-  fCreateSectors3D (0),
-  fDeleteSectors3D (0)
+    fDataLoadThreshold (0),
+    fDataLoadPedestal  (0),
+    fDataAutoPedestal  (0),
+
+    fUpdateSectors   (0),
+    fReloadSectors   (0),
+    fCreateSectors3D (0),
+    fDeleteSectors3D (0)
 {
   MakeTitle("TPCLoader");
 
-  Int_t labelW = 42;
+  Int_t labelW;
+
+  // File / event interface
+
+  labelW = 42;
   {
     TGHorizontalFrame* f = new TGHorizontalFrame(this);
     TGHorizontalFrame* g = new TGHorizontalFrame(f, labelW, 0, kFixedWidth);
@@ -77,25 +87,71 @@ TPCLoaderEditor::TPCLoaderEditor(const TGWindow *p,
   // Reuse Event for DoubleSR button
   fDoubleSR = new TGCheckButton(fEvent, "Double SR");
   fDoubleSR->SetToolTipText("Double sampling rate");
-  fEvent->AddFrame(fDoubleSR, new TGLayoutHints(kLHintsLeft, 12, 0, 1, 0));
+  fEvent->AddFrame(fDoubleSR, new TGLayoutHints(kLHintsLeft, 12, 0, 2, 0));
   fDoubleSR->Connect("Toggled(Bool_t)",
                      "Alieve::TPCLoaderEditor", this, "DoDoubleSR()");
   AddFrame(fEvent);
 
-  fUpdateSectors = new TGTextButton(this, "Update Sectors");
-  AddFrame(fUpdateSectors, new TGLayoutHints(kLHintsExpandX, 8,8,8,0));
-  fUpdateSectors->Connect("Clicked()",
-                    "Alieve::TPCLoaderEditor", this, "DoUpdateSectors()");
+
+  // TPCData load settings
+
+  labelW = 90;
+
+  fDataLoadThreshold = new RGValuator(this, "Load threshold:", 110, 0);
+  fDataLoadThreshold->SetShowSlider(kFALSE);
+  fDataLoadThreshold->SetLabelWidth(labelW);
+  fDataLoadThreshold->SetNELength(6);
+  fDataLoadThreshold->Build();
+  fDataLoadThreshold->SetLimits(0, 1000);
+  fDataLoadThreshold->SetToolTip("Minimum signal that will be stored (pedestal subtracted afterwards).");
+  fDataLoadThreshold->Connect
+    ("ValueSet(Double_t)",
+     "Alieve::TPCLoaderEditor", this, "DoDataLoadThreshold()");
+  AddFrame(fDataLoadThreshold, new TGLayoutHints(kLHintsLeft, 0, 0, 6, 0));
+
+  fDataLoadPedestal = new RGValuator(this, "Load pedestal:", 110, 0);
+  fDataLoadPedestal->SetShowSlider(kFALSE);
+  fDataLoadPedestal->SetLabelWidth(labelW);
+  fDataLoadPedestal->SetNELength(6);
+  fDataLoadPedestal->Build();
+  fDataLoadPedestal->SetLimits(0, 1000);
+  fDataLoadPedestal->SetToolTip("Pedestal that will be subtracted during data loading.");
+  fDataLoadPedestal->Connect
+    ("ValueSet(Double_t)",
+     "Alieve::TPCLoaderEditor", this, "DoDataLoadPedestal()");
+  // Reuse DataLoadPedestal for DataAutoPedestal check button
+  fDataAutoPedestal = new TGCheckButton(fDataLoadPedestal, "Automatic");
+  fDataAutoPedestal->SetToolTipText("Determine per-pad pedestal during data loading.");
+  fDataAutoPedestal->Connect
+    ("Toggled(Bool_t)",
+     "Alieve::TPCLoaderEditor", this, "DoDataAutoPedestal()");
+  fDataLoadPedestal->AddFrame(fDataAutoPedestal, new TGLayoutHints(kLHintsLeft, 12, 0, 2, 0));
+  AddFrame(fDataLoadPedestal);
+
+  // Steering buttons: update/reload sectors; show/hide 3d
+
+  {
+    TGHorizontalFrame* f = new TGHorizontalFrame(this);
+    fUpdateSectors = new TGTextButton(f, "Update Sectors");
+    f->AddFrame(fUpdateSectors, new TGLayoutHints(kLHintsExpandX, 0,4,0,0));
+    fUpdateSectors->Connect("Clicked()",
+                           "Alieve::TPCLoaderEditor", this, "DoUpdateSectors()");
+    fReloadSectors = new TGTextButton(f, "Reload Sectors");
+    f->AddFrame(fReloadSectors, new TGLayoutHints(kLHintsExpandX, 4,0,0,0));
+    fReloadSectors->Connect("Clicked()",
+                           "Alieve::TPCLoaderEditor", this, "DoReloadSectors()");
+    AddFrame(f, new TGLayoutHints(kLHintsExpandX, 8,8,8,0));
+  }
   {
     TGHorizontalFrame* f = new TGHorizontalFrame(this);
     fCreateSectors3D = new TGTextButton(f, "Create 3D");
     f->AddFrame(fCreateSectors3D, new TGLayoutHints(kLHintsExpandX, 0,4,0,0));
     fCreateSectors3D->Connect("Clicked()",
-                    "Alieve::TPCLoaderEditor", this, "DoCreateSectors3D()");
+                             "Alieve::TPCLoaderEditor", this, "DoCreateSectors3D()");
     fDeleteSectors3D = new TGTextButton(f, "Delete 3D");
     f->AddFrame(fDeleteSectors3D, new TGLayoutHints(kLHintsExpandX, 4,0,0,0));
     fDeleteSectors3D->Connect("Clicked()",
-                    "Alieve::TPCLoaderEditor", this, "DoDeleteSectors3D()");
+                             "Alieve::TPCLoaderEditor", this, "DoDeleteSectors3D()");
     AddFrame(f, new TGLayoutHints(kLHintsExpandX, 8,8,8,0));
   }
 }
@@ -114,7 +170,18 @@ void TPCLoaderEditor::SetModel(TObject* obj)
   fFile->SetText(gSystem->BaseName(fM->fFile));
   fEvent->SetValue(fM->fEvent);
   fEvent->SetEnabled(fM->fEvent >= 0);
-  fDoubleSR->SetState(fM->fDoubleSR  ? kButtonDown : kButtonUp);
+  fDoubleSR->SetState(fM->fDoubleSR ? kButtonDown : kButtonUp);
+
+  TPCData* tpcd = fM->GetData();
+  Bool_t   tpcp = (tpcd != 0);
+  fDataLoadThreshold->SetEnabled(tpcp);
+  fDataLoadPedestal ->SetEnabled(tpcp && ! tpcd->GetAutoPedestal());
+  fDataAutoPedestal ->SetEnabled(tpcp);
+  if (tpcp) {
+    fDataLoadThreshold->SetValue(tpcd->GetLoadThreshold());
+    fDataLoadPedestal ->SetValue(tpcd->GetLoadPedestal());
+    fDataAutoPedestal ->SetState(tpcd->GetAutoPedestal() ? kButtonDown : kButtonUp);
+  }
 }
 
 /**************************************************************************/
@@ -171,11 +238,37 @@ void TPCLoaderEditor::DoDoubleSR()
 
 /**************************************************************************/
 
+void TPCLoaderEditor::DoDataLoadThreshold()
+{
+  if (fM->GetData() == 0) return;
+  fM->GetData()->SetLoadThreshold((Short_t) fDataLoadThreshold->GetValue());
+}
+
+void TPCLoaderEditor::DoDataLoadPedestal()
+{
+  if (fM->GetData() == 0) return;
+  fM->GetData()->SetLoadPedestal((Short_t) fDataLoadPedestal->GetValue());
+}
+
+void TPCLoaderEditor::DoDataAutoPedestal()
+{
+  if (fM->GetData() == 0) return;
+  fM->GetData()->SetAutoPedestal(fDataAutoPedestal->IsOn());
+  fDataLoadPedestal->SetEnabled(!fDataAutoPedestal->IsOn());
+}
+
+/**************************************************************************/
+
 void TPCLoaderEditor::DoUpdateSectors()
 {
   fM->UpdateSectors();
 }
 
+void TPCLoaderEditor::DoReloadSectors()
+{
+  fM->ReloadSectors();
+}
+
 void TPCLoaderEditor::DoCreateSectors3D()
 {
   fM->CreateSectors3D();
index b3ea62c..6f9595e 100644 (file)
@@ -33,7 +33,13 @@ protected:
   Reve::RGValuator* fEvent;
   TGCheckButton*    fDoubleSR;
 
+  // TPCData loading settings
+  Reve::RGValuator* fDataLoadThreshold;
+  Reve::RGValuator* fDataLoadPedestal;
+  TGCheckButton*    fDataAutoPedestal;
+
   TGTextButton* fUpdateSectors;
+  TGTextButton* fReloadSectors;
   TGTextButton* fCreateSectors3D;
   TGTextButton* fDeleteSectors3D;
 
@@ -51,7 +57,12 @@ public:
   void DoEvent();
   void DoDoubleSR();
 
+  void DoDataLoadThreshold();
+  void DoDataLoadPedestal();
+  void DoDataAutoPedestal();
+
   void DoUpdateSectors();
+  void DoReloadSectors();
   void DoCreateSectors3D();
   void DoDeleteSectors3D();