2 // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
4 /**************************************************************************
5 * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
6 * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for *
7 * full copyright notice. *
8 **************************************************************************/
10 #include "AliEveITSScaledModuleEditor.h"
11 #include <EveDet/AliEveITSScaledModule.h>
13 #include <TVirtualPad.h>
14 #include <TGedEditor.h>
17 #include <TGNumberEntry.h>
18 #include <TGComboBox.h>
20 //==============================================================================
21 //==============================================================================
22 // AliEveITSScaledModuleEditor
23 //==============================================================================
25 //______________________________________________________________________________
27 // Editor for AliEveITSScaledModule.
29 ClassImp(AliEveITSScaledModuleEditor)
31 AliEveITSScaledModuleEditor::AliEveITSScaledModuleEditor(const TGWindow *p, Int_t width, Int_t height,
32 UInt_t options, Pixel_t back) :
33 TGedFrame(p, width, height, options | kVerticalFrame, back),
43 MakeTitle("AliEveITSScaledModule");
46 TGHorizontalFrame* f = new TGHorizontalFrame(this);
47 TGLabel *l = new TGLabel(f, "Scale:");
48 f->AddFrame(l, new TGLayoutHints(kLHintsTop | kLHintsCenterY, 0, 5, 1, 1));
49 fScale = new TGNumberEntry(f, 0, 2, -1,
50 TGNumberFormat::kNESInteger, TGNumberFormat::kNEAPositive,
51 TGNumberFormat::kNELLimitMinMax, 1, 5);
52 fScale->GetNumberEntry()->SetToolTipText("Set cell size.");
53 f->AddFrame(fScale, new TGLayoutHints(kLHintsLeft, 1, 7, 1, 1));
55 fScale->Connect("ValueSet(Long_t)", "AliEveITSScaledModuleEditor", this, "DoScale()");
57 TGLabel* lab = new TGLabel(f, "Statistic:");
58 f->AddFrame(lab, new TGLayoutHints(kLHintsLeft|kLHintsBottom, 1, 2, 1, 2));
59 fStatistic = new TGComboBox(f);
60 fStatistic->AddEntry("Occup", 0);
61 fStatistic->AddEntry("Average", 1);
62 fStatistic->AddEntry("RMS", 2);
63 TGListBox* lb = fStatistic->GetListBox();
64 lb->Resize(lb->GetWidth(), 3*16);
65 fStatistic->Resize(74, 20);
66 fStatistic->Connect("Selected(Int_t)", "AliEveITSScaledModuleEditor", this, "DoStatType(Int_t)");
67 f->AddFrame(fStatistic, new TGLayoutHints(kLHintsLeft, 1, 2, 1, 1));
68 AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
74 /******************************************************************************/
76 void AliEveITSScaledModuleEditor::CreateInfoFrame()
78 // Create a frame under tab "Info".
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,
106 /******************************************************************************/
108 void AliEveITSScaledModuleEditor::SetModel(TObject* obj)
112 fModule = dynamic_cast<AliEveITSScaledModule*>(obj);
115 fScale->SetIntNumber(fModule->GetScaleInfo()->GetScale());
116 fStatistic->Select(fModule->GetScaleInfo()->GetStatType(), kFALSE);
119 Int_t cnx, cnz, total;
120 fModule->GetScaleData(cnx, cnz, total);
121 fInfoLabel0->SetText(Form("Cell size: Nx=%d Nz=%d", cnx, cnz));
122 fInfoLabel1->SetText(Form("Num cells: %d", total));
126 /******************************************************************************/
128 void AliEveITSScaledModuleEditor::DoScale()
132 fModule->GetScaleInfo()->ScaleChanged(fScale->GetIntNumber());
134 Int_t cnx, cnz, total;
135 fModule->GetScaleData(cnx, cnz, total);
136 fInfoLabel0->SetText(Form("Cell size: Nx=%d Nz=%d", cnx, cnz));
138 fGedEditor->SetModel(fGedEditor->GetPad(), fGedEditor->GetModel(), kButton1Down);
141 /******************************************************************************/
143 void AliEveITSScaledModuleEditor::DoStatType(Int_t v)
145 // Slot for StatType.
147 fModule->GetScaleInfo()->StatTypeChanged(v);
149 fGedEditor->SetModel(fGedEditor->GetPad(), fGedEditor->GetModel(), kButton1Down);