]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVE/Alieve/ITSScaledModuleEditor.cxx
Add some class docs.
[u/mrichter/AliRoot.git] / EVE / Alieve / ITSScaledModuleEditor.cxx
CommitLineData
3b868b75 1// $Header$
2
3#include "ITSScaledModuleEditor.h"
4#include <Alieve/ITSScaledModule.h>
5#include <Reve/ZTransEditor.h>
6#include <Reve/RGValuators.h>
7
8#include <TVirtualPad.h>
9#include <TColor.h>
10#include <TMath.h>
11
12#include <TGedEditor.h>
13#include <TGLabel.h>
32e219c2 14#include <TG3DLine.h>
3b868b75 15#include <TGButton.h>
16#include <TGNumberEntry.h>
17#include <TGColorSelect.h>
18#include <TGComboBox.h>
19
20using namespace Reve;
21using namespace Alieve;
22
23//______________________________________________________________________
32e219c2 24// ITSScaledModuleEditor
3b868b75 25//
32e219c2 26
27ClassImp(ITSScaledModuleEditor)
28
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),
32
33 fInfoFrame(0),
34
35 fModule(0),
36
37 fScale(0),
38 fStatistic(0),
39 fInfoLabel0(0),
40 fInfoLabel1(0)
3b868b75 41{
32e219c2 42 MakeTitle("ITSScaledModule");
3b868b75 43 // Create widgets
44 {
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));
53 fScale->Associate(f);
32e219c2 54 fScale->Connect("ValueSet(Long_t)", "Alieve::ITSScaledModuleEditor", this, "DoScale()");
3b868b75 55
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);
32e219c2 65 fStatistic->Connect("Selected(Int_t)", "Alieve::ITSScaledModuleEditor", this, "DoStatType(Int_t)");
3b868b75 66 f->AddFrame(fStatistic, new TGLayoutHints(kLHintsLeft, 1, 2, 1, 1));
67 AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
68 }
69
32e219c2 70 CreateInfoFrame();
71}
72
73/*************************************************************************/
74ITSScaledModuleEditor::~ITSScaledModuleEditor()
75{}
76
77/*************************************************************************/
78void ITSScaledModuleEditor::CreateInfoFrame()
79{
80 fInfoFrame = CreateEditorTabSubFrame("Info");
81 TGCompositeFrame *title1 = new TGCompositeFrame(fInfoFrame, 145, 10,
82 kHorizontalFrame |
83 kLHintsExpandX |
84 kFixedWidth |
85 kOwnBackground);
86
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));
92
93
3b868b75 94 Int_t lp = 2;
32e219c2 95 fInfoLabel0 = new TGLabel(fInfoFrame);
3b868b75 96 fInfoLabel0->SetTextJustify(kTextLeft);
32e219c2 97 fInfoFrame->AddFrame(fInfoLabel0, new TGLayoutHints(kLHintsLeft|kLHintsExpandX,
98 lp, 0, 8, 0));
3b868b75 99
32e219c2 100 fInfoLabel1 = new TGLabel(fInfoFrame);
3b868b75 101 fInfoLabel1->SetTextJustify(kTextLeft);
32e219c2 102 fInfoFrame->AddFrame(fInfoLabel1, new TGLayoutHints(kLHintsLeft|kLHintsExpandX,
103 lp, 0, 2, 8));
3b868b75 104
3b868b75 105}
106
107/**************************************************************************/
108
32e219c2 109void ITSScaledModuleEditor::SetModel(TObject* obj)
3b868b75 110{
32e219c2 111 fModule = dynamic_cast<ITSScaledModule*>(obj);
112
113 // widgets
03dfc4a7 114 fScale->SetIntNumber(fModule->GetScaleInfo()->GetScale());
115 fStatistic->Select(fModule->GetScaleInfo()->GetStatType(), kFALSE);
32e219c2 116
117 // text info
3b868b75 118 Int_t cnx, cnz, total;
32e219c2 119 fModule->GetScaleData(cnx, cnz, total);
3b868b75 120 fInfoLabel0->SetText(Form("Cell size: Nx=%d Nz=%d", cnx, cnz));
121 fInfoLabel1->SetText(Form("Num cells: %d", total));
3b868b75 122}
123
3b868b75 124
125/**************************************************************************/
126
32e219c2 127void ITSScaledModuleEditor::DoScale()
3b868b75 128{
03dfc4a7 129 fModule->GetScaleInfo()->ScaleChanged(fScale->GetIntNumber());
3b868b75 130
32e219c2 131 Int_t cnx, cnz, total;
132 fModule->GetScaleData(cnx, cnz, total);
133 fInfoLabel0->SetText(Form("Cell size: Nx=%d Nz=%d", cnx, cnz));
134 Update();
135 fGedEditor->SetModel(fGedEditor->GetPad(), fGedEditor->GetModel(), kButton1Down);
3b868b75 136}
137
138/**************************************************************************/
139
32e219c2 140void ITSScaledModuleEditor::DoStatType(Int_t v)
3b868b75 141{
32e219c2 142 fModule->GetScaleInfo()->StatTypeChanged(v);
143 Update();
144 fGedEditor->SetModel(fGedEditor->GetPad(), fGedEditor->GetModel(), kButton1Down);
3b868b75 145}