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 <Alieve/AliEveITSScaledModule.h>
12 #include <TEveTransEditor.h>
13 #include <TEveGValuators.h>
15 #include <TVirtualPad.h>
19 #include <TGedEditor.h>
23 #include <TGNumberEntry.h>
24 #include <TGColorSelect.h>
25 #include <TGComboBox.h>
28 //______________________________________________________________________
29 // AliEveITSScaledModuleEditor
32 ClassImp(AliEveITSScaledModuleEditor)
34 AliEveITSScaledModuleEditor::AliEveITSScaledModuleEditor(const TGWindow *p, Int_t width, Int_t height,
35 UInt_t options, Pixel_t back) :
36 TGedFrame(p, width, height, options | kVerticalFrame, back),
47 MakeTitle("AliEveITSScaledModule");
50 TGHorizontalFrame* f = new TGHorizontalFrame(this);
51 TGLabel *l = new TGLabel(f, "Scale:");
52 f->AddFrame(l, new TGLayoutHints(kLHintsTop | kLHintsCenterY, 0, 5, 1, 1));
53 fScale = new TGNumberEntry(f, 0, 2, -1,
54 TGNumberFormat::kNESInteger, TGNumberFormat::kNEAPositive,
55 TGNumberFormat::kNELLimitMinMax, 1, 5);
56 fScale->GetNumberEntry()->SetToolTipText("Set cell size.");
57 f->AddFrame(fScale, new TGLayoutHints(kLHintsLeft, 1, 7, 1, 1));
59 fScale->Connect("ValueSet(Long_t)", "AliEveITSScaledModuleEditor", this, "DoScale()");
61 TGLabel* lab = new TGLabel(f, "Statistic:");
62 f->AddFrame(lab, new TGLayoutHints(kLHintsLeft|kLHintsBottom, 1, 2, 1, 2));
63 fStatistic = new TGComboBox(f);
64 fStatistic->AddEntry("Occup", 0);
65 fStatistic->AddEntry("Average", 1);
66 fStatistic->AddEntry("RMS", 2);
67 TGListBox* lb = fStatistic->GetListBox();
68 lb->Resize(lb->GetWidth(), 3*16);
69 fStatistic->Resize(74, 20);
70 fStatistic->Connect("Selected(Int_t)", "AliEveITSScaledModuleEditor", this, "DoStatType(Int_t)");
71 f->AddFrame(fStatistic, new TGLayoutHints(kLHintsLeft, 1, 2, 1, 1));
72 AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
78 /*************************************************************************/
79 AliEveITSScaledModuleEditor::~AliEveITSScaledModuleEditor()
82 /*************************************************************************/
83 void AliEveITSScaledModuleEditor::CreateInfoFrame()
85 fInfoFrame = CreateEditorTabSubFrame("Info");
86 TGCompositeFrame *title1 = new TGCompositeFrame(fInfoFrame, 145, 10,
92 title1->AddFrame(new TGLabel(title1, "ScaledDigits Info"),
93 new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
94 title1->AddFrame(new TGHorizontal3DLine(title1),
95 new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
96 fInfoFrame->AddFrame(title1, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0));
100 fInfoLabel0 = new TGLabel(fInfoFrame);
101 fInfoLabel0->SetTextJustify(kTextLeft);
102 fInfoFrame->AddFrame(fInfoLabel0, new TGLayoutHints(kLHintsLeft|kLHintsExpandX,
105 fInfoLabel1 = new TGLabel(fInfoFrame);
106 fInfoLabel1->SetTextJustify(kTextLeft);
107 fInfoFrame->AddFrame(fInfoLabel1, new TGLayoutHints(kLHintsLeft|kLHintsExpandX,
112 /**************************************************************************/
114 void AliEveITSScaledModuleEditor::SetModel(TObject* obj)
116 fModule = dynamic_cast<AliEveITSScaledModule*>(obj);
119 fScale->SetIntNumber(fModule->GetScaleInfo()->GetScale());
120 fStatistic->Select(fModule->GetScaleInfo()->GetStatType(), kFALSE);
123 Int_t cnx, cnz, total;
124 fModule->GetScaleData(cnx, cnz, total);
125 fInfoLabel0->SetText(Form("Cell size: Nx=%d Nz=%d", cnx, cnz));
126 fInfoLabel1->SetText(Form("Num cells: %d", total));
130 /**************************************************************************/
132 void AliEveITSScaledModuleEditor::DoScale()
134 fModule->GetScaleInfo()->ScaleChanged(fScale->GetIntNumber());
136 Int_t cnx, cnz, total;
137 fModule->GetScaleData(cnx, cnz, total);
138 fInfoLabel0->SetText(Form("Cell size: Nx=%d Nz=%d", cnx, cnz));
140 fGedEditor->SetModel(fGedEditor->GetPad(), fGedEditor->GetModel(), kButton1Down);
143 /**************************************************************************/
145 void AliEveITSScaledModuleEditor::DoStatType(Int_t v)
147 fModule->GetScaleInfo()->StatTypeChanged(v);
149 fGedEditor->SetModel(fGedEditor->GetPad(), fGedEditor->GetModel(), kButton1Down);