3 #include "ITSScaledModuleEditor.h"
4 #include <Alieve/ITSScaledModule.h>
5 #include <Reve/ZTransEditor.h>
6 #include <Reve/RGValuators.h>
8 #include <TVirtualPad.h>
12 #include <TGedEditor.h>
16 #include <TGNumberEntry.h>
17 #include <TGColorSelect.h>
18 #include <TGComboBox.h>
21 using namespace Alieve;
23 //______________________________________________________________________
24 // ITSScaledModuleEditor
27 ClassImp(ITSScaledModuleEditor)
29 ITSScaledModuleEditor::ITSScaledModuleEditor(const TGWindow *p, Int_t width, Int_t height,
30 UInt_t options, Pixel_t back) :
31 TGedFrame(p, width, height, options | kVerticalFrame, back),
42 MakeTitle("ITSScaledModule");
45 TGHorizontalFrame* f = new TGHorizontalFrame(this);
46 TGLabel *l = new TGLabel(f, "Scale:");
47 f->AddFrame(l, new TGLayoutHints(kLHintsTop | kLHintsCenterY, 0, 5, 1, 1));
48 fScale = new TGNumberEntry(f, 0, 2, -1,
49 TGNumberFormat::kNESInteger, TGNumberFormat::kNEAPositive,
50 TGNumberFormat::kNELLimitMinMax, 1, 5);
51 fScale->GetNumberEntry()->SetToolTipText("Set cell size.");
52 f->AddFrame(fScale, new TGLayoutHints(kLHintsLeft, 1, 7, 1, 1));
54 fScale->Connect("ValueSet(Long_t)", "Alieve::ITSScaledModuleEditor", this, "DoScale()");
56 TGLabel* lab = new TGLabel(f, "Statistic:");
57 f->AddFrame(lab, new TGLayoutHints(kLHintsLeft|kLHintsBottom, 1, 2, 1, 2));
58 fStatistic = new TGComboBox(f);
59 fStatistic->AddEntry("Occup", 0);
60 fStatistic->AddEntry("Average", 1);
61 fStatistic->AddEntry("RMS", 2);
62 TGListBox* lb = fStatistic->GetListBox();
63 lb->Resize(lb->GetWidth(), 3*16);
64 fStatistic->Resize(74, 20);
65 fStatistic->Connect("Selected(Int_t)", "Alieve::ITSScaledModuleEditor", this, "DoStatType(Int_t)");
66 f->AddFrame(fStatistic, new TGLayoutHints(kLHintsLeft, 1, 2, 1, 1));
67 AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
73 /*************************************************************************/
74 ITSScaledModuleEditor::~ITSScaledModuleEditor()
77 /*************************************************************************/
78 void ITSScaledModuleEditor::CreateInfoFrame()
80 fInfoFrame = CreateEditorTabSubFrame("Info");
81 TGCompositeFrame *title1 = new TGCompositeFrame(fInfoFrame, 145, 10,
87 title1->AddFrame(new TGLabel(title1, "ScaledDigits Info"),
88 new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
89 title1->AddFrame(new TGHorizontal3DLine(title1),
90 new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
91 fInfoFrame->AddFrame(title1, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0));
95 fInfoLabel0 = new TGLabel(fInfoFrame);
96 fInfoLabel0->SetTextJustify(kTextLeft);
97 fInfoFrame->AddFrame(fInfoLabel0, new TGLayoutHints(kLHintsLeft|kLHintsExpandX,
100 fInfoLabel1 = new TGLabel(fInfoFrame);
101 fInfoLabel1->SetTextJustify(kTextLeft);
102 fInfoFrame->AddFrame(fInfoLabel1, new TGLayoutHints(kLHintsLeft|kLHintsExpandX,
107 /**************************************************************************/
109 void ITSScaledModuleEditor::SetModel(TObject* obj)
111 fModule = dynamic_cast<ITSScaledModule*>(obj);
114 fScale->SetIntNumber(fModule->GetScaleInfo()->GetScale());
115 fStatistic->Select(fModule->GetScaleInfo()->GetStatType(), kFALSE);
118 Int_t cnx, cnz, total;
119 fModule->GetScaleData(cnx, cnz, total);
120 fInfoLabel0->SetText(Form("Cell size: Nx=%d Nz=%d", cnx, cnz));
121 fInfoLabel1->SetText(Form("Num cells: %d", total));
125 /**************************************************************************/
127 void ITSScaledModuleEditor::DoScale()
129 fModule->GetScaleInfo()->ScaleChanged(fScale->GetIntNumber());
131 Int_t cnx, cnz, total;
132 fModule->GetScaleData(cnx, cnz, total);
133 fInfoLabel0->SetText(Form("Cell size: Nx=%d Nz=%d", cnx, cnz));
135 fGedEditor->SetModel(fGedEditor->GetPad(), fGedEditor->GetModel(), kButton1Down);
138 /**************************************************************************/
140 void ITSScaledModuleEditor::DoStatType(Int_t v)
142 fModule->GetScaleInfo()->StatTypeChanged(v);
144 fGedEditor->SetModel(fGedEditor->GetPad(), fGedEditor->GetModel(), kButton1Down);