3 #include "TPCSector2DEditor.h"
4 #include <Alieve/TPCSector2D.h>
6 #include <TVirtualPad.h>
11 #include <TGNumberEntry.h>
12 #include <TGColorSelect.h>
14 #include <TGDoubleSlider.h>
17 using namespace Alieve;
19 //______________________________________________________________________
23 ClassImp(TPCSector2DEditor)
25 TPCSector2DEditor::TPCSector2DEditor(const TGWindow *p, Int_t id, Int_t width, Int_t height,
26 UInt_t options, Pixel_t back) :
27 TGedFrame(p, id, width, height, options | kVerticalFrame, back)
30 MakeTitle("TPCSector2D");
32 //!!! create the widgets here ...
34 // Register the editor.
35 // TClass *cl = TPCSector2D::Class();
36 // TGedElement *ge = new TGedElement;
37 // ge->fGedFrame = this;
39 // cl->GetEditorList()->Add(ge);
41 fUseTexture = new TGCheckButton(this, "UseTexture");
42 AddFrame(fUseTexture, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
44 ("Toggled(Bool_t)","Alieve::TPCSector2DEditor", this, "DoUseTexture()");
47 TGHorizontalFrame* f = new TGHorizontalFrame(this);
48 TGLabel *l = new TGLabel(f, "SectorID:");
49 f->AddFrame(l, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 3, 2, 1, 1));
51 fSectorID = new TGNumberEntry(f, 0., 6, -1,
52 TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative,
53 TGNumberFormat::kNELLimitMinMax, 0, 35);
55 fSectorID->GetNumberEntry()->SetToolTipText("0-17 +z plate 18-35 -z plate");
56 f->AddFrame(fSectorID, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
57 fSectorID->Associate(this);
58 fSectorID->Connect("ValueSet(Long_t)",
59 "Alieve::TPCSector2DEditor", this, "DoSectorID()");
61 AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
64 TGHorizontalFrame* f = new TGHorizontalFrame(this);
65 fThresholdLabel = new TGLabel(f, "threshold [XXX]:");
66 f->AddFrame(fThresholdLabel, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 3, 2, 1, 1));
68 fthreshold = new TGHSlider(f, 150);
69 fthreshold->SetRange(0,149);
70 fthreshold->Associate(this);
71 f->AddFrame(fthreshold, new TGLayoutHints(kLHintsLeft, 0, 5));
72 fthreshold->Connect("PositionChanged(Int_t)",
73 "Alieve::TPCSector2DEditor", this, "Dothreshold()");
74 AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
77 TGHorizontalFrame* f = new TGHorizontalFrame(this);
78 fMaxValLabel = new TGLabel(f, "MaxValue [XXX]:");
79 f->AddFrame(fMaxValLabel, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 3, 2, 1, 1));
80 fMaxVal = new TGHSlider(f, 150);
81 fMaxVal->SetRange(0,299);
82 fMaxVal->Associate(this);
83 f->AddFrame(fMaxVal, new TGLayoutHints(kLHintsLeft, 0, 5));
84 fMaxVal->Connect("PositionChanged(Int_t)",
85 "Alieve::TPCSector2DEditor", this, "DoMaxVal()");
86 AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
88 fShowMax = new TGCheckButton(this, "ShowMax");
89 AddFrame(fShowMax, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
90 fShowMax->Connect("Toggled(Bool_t)","Alieve::TPCSector2DEditor", this, "DoShowMax()");
93 TGHorizontalFrame* f = new TGHorizontalFrame(this);
94 TGLabel *l = new TGLabel(f, "Time Range:");
95 f->AddFrame(l, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 1, 2, 1, 1));
97 fTime = new TGDoubleHSlider(f);
98 fTime->SetRange(0, 500);
99 fTime->Resize(160, 20);
100 f->AddFrame(fTime);//, new TGLayoutHints(kLHintsLeft, 0, 5));
101 fTime->Connect("PositionChanged()", "Alieve::TPCSector2DEditor",
103 AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
105 // What is this crap?
106 TClass *cl = TPCSector2DEditor::Class();
107 TGedElement *ge = new TGedElement;
108 ge->fGedFrame = this;
110 cl->GetEditorList()->Add(ge);
113 TPCSector2DEditor::~TPCSector2DEditor()
116 /**************************************************************************/
118 void TPCSector2DEditor::SetModel(TVirtualPad* pad, TObject* obj, Int_t )
123 if (!obj || !obj->InheritsFrom(TPCSector2D::Class()) || obj->InheritsFrom(TVirtualPad::Class())) {
131 fM = dynamic_cast<TPCSector2D*>(fModel);
133 fUseTexture->SetState(fM->fUseTexture ? kButtonDown : kButtonUp);
134 fSectorID->SetNumber(fM->fSectorID);
135 fThresholdLabel->SetText(Form("threshold [%3d]:", fM->fthreshold));
136 fthreshold->SetPosition(fM->fthreshold);
138 fMaxValLabel->SetText(Form("MaxValue [%3d]:", fM->fMaxVal));
139 fMaxVal->SetPosition(fM->fMaxVal);
140 fTime->SetPosition(fM->fMinTime, fM->fMaxTime);
142 fShowMax->SetState(fM->fShowMax ? kButtonDown : kButtonUp);
147 /**************************************************************************/
149 void TPCSector2DEditor::DoUseTexture()
151 fM->fUseTexture = fUseTexture->IsOn();
155 void TPCSector2DEditor::DoSectorID()
157 fM->SetSectorID((Int_t) fSectorID->GetNumber());
161 void TPCSector2DEditor::Dothreshold()
163 fM->Setthreshold((Short_t) fthreshold->GetPosition());
164 fThresholdLabel->SetText(Form("threshold [%3d]:", fM->fthreshold));
168 void TPCSector2DEditor::DoMaxVal()
170 fM->SetMaxVal((Int_t) fMaxVal->GetPosition());
171 fMaxValLabel->SetText(Form("MaxValue [%3d]:", fM->fMaxVal));
175 void TPCSector2DEditor::DoShowMax()
177 fM->SetShowMax(fShowMax->IsOn());
181 void TPCSector2DEditor::DoTime()
183 Double_t min = fTime->GetMinPosition(), max = fTime->GetMaxPosition();
184 printf("hslidor min=%f max=%f\n", min, max);
185 fM->SetMinTime((Int_t) min);
186 fM->SetMaxTime((Int_t) max);