3 #include "ITSScaledModuleEditor.h"
4 #include <Alieve/ITSScaledModule.h>
5 #include <TEveTransEditor.h>
6 #include <TEveGValuators.h>
8 #include <TVirtualPad.h>
12 #include <TGedEditor.h>
16 #include <TGNumberEntry.h>
17 #include <TGColorSelect.h>
18 #include <TGComboBox.h>
19 using namespace Alieve;
21 //______________________________________________________________________
22 // ITSScaledModuleEditor
25 ClassImp(ITSScaledModuleEditor)
27 ITSScaledModuleEditor::ITSScaledModuleEditor(const TGWindow *p, Int_t width, Int_t height,
28 UInt_t options, Pixel_t back) :
29 TGedFrame(p, width, height, options | kVerticalFrame, back),
40 MakeTitle("ITSScaledModule");
43 TGHorizontalFrame* f = new TGHorizontalFrame(this);
44 TGLabel *l = new TGLabel(f, "Scale:");
45 f->AddFrame(l, new TGLayoutHints(kLHintsTop | kLHintsCenterY, 0, 5, 1, 1));
46 fScale = new TGNumberEntry(f, 0, 2, -1,
47 TGNumberFormat::kNESInteger, TGNumberFormat::kNEAPositive,
48 TGNumberFormat::kNELLimitMinMax, 1, 5);
49 fScale->GetNumberEntry()->SetToolTipText("Set cell size.");
50 f->AddFrame(fScale, new TGLayoutHints(kLHintsLeft, 1, 7, 1, 1));
52 fScale->Connect("ValueSet(Long_t)", "Alieve::ITSScaledModuleEditor", this, "DoScale()");
54 TGLabel* lab = new TGLabel(f, "Statistic:");
55 f->AddFrame(lab, new TGLayoutHints(kLHintsLeft|kLHintsBottom, 1, 2, 1, 2));
56 fStatistic = new TGComboBox(f);
57 fStatistic->AddEntry("Occup", 0);
58 fStatistic->AddEntry("Average", 1);
59 fStatistic->AddEntry("RMS", 2);
60 TGListBox* lb = fStatistic->GetListBox();
61 lb->Resize(lb->GetWidth(), 3*16);
62 fStatistic->Resize(74, 20);
63 fStatistic->Connect("Selected(Int_t)", "Alieve::ITSScaledModuleEditor", this, "DoStatType(Int_t)");
64 f->AddFrame(fStatistic, new TGLayoutHints(kLHintsLeft, 1, 2, 1, 1));
65 AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
71 /*************************************************************************/
72 ITSScaledModuleEditor::~ITSScaledModuleEditor()
75 /*************************************************************************/
76 void ITSScaledModuleEditor::CreateInfoFrame()
78 fInfoFrame = CreateEditorTabSubFrame("Info");
79 TGCompositeFrame *title1 = new TGCompositeFrame(fInfoFrame, 145, 10,
85 title1->AddFrame(new TGLabel(title1, "ScaledDigits Info"),
86 new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
87 title1->AddFrame(new TGHorizontal3DLine(title1),
88 new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
89 fInfoFrame->AddFrame(title1, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0));
93 fInfoLabel0 = new TGLabel(fInfoFrame);
94 fInfoLabel0->SetTextJustify(kTextLeft);
95 fInfoFrame->AddFrame(fInfoLabel0, new TGLayoutHints(kLHintsLeft|kLHintsExpandX,
98 fInfoLabel1 = new TGLabel(fInfoFrame);
99 fInfoLabel1->SetTextJustify(kTextLeft);
100 fInfoFrame->AddFrame(fInfoLabel1, new TGLayoutHints(kLHintsLeft|kLHintsExpandX,
105 /**************************************************************************/
107 void ITSScaledModuleEditor::SetModel(TObject* obj)
109 fModule = dynamic_cast<ITSScaledModule*>(obj);
112 fScale->SetIntNumber(fModule->GetScaleInfo()->GetScale());
113 fStatistic->Select(fModule->GetScaleInfo()->GetStatType(), kFALSE);
116 Int_t cnx, cnz, total;
117 fModule->GetScaleData(cnx, cnz, total);
118 fInfoLabel0->SetText(Form("Cell size: Nx=%d Nz=%d", cnx, cnz));
119 fInfoLabel1->SetText(Form("Num cells: %d", total));
123 /**************************************************************************/
125 void ITSScaledModuleEditor::DoScale()
127 fModule->GetScaleInfo()->ScaleChanged(fScale->GetIntNumber());
129 Int_t cnx, cnz, total;
130 fModule->GetScaleData(cnx, cnz, total);
131 fInfoLabel0->SetText(Form("Cell size: Nx=%d Nz=%d", cnx, cnz));
133 fGedEditor->SetModel(fGedEditor->GetPad(), fGedEditor->GetModel(), kButton1Down);
136 /**************************************************************************/
138 void ITSScaledModuleEditor::DoStatType(Int_t v)
140 fModule->GetScaleInfo()->StatTypeChanged(v);
142 fGedEditor->SetModel(fGedEditor->GetPad(), fGedEditor->GetModel(), kButton1Down);