]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/Alieve/AliEveITSScaledModuleEditor.cxx
Temporary fix to avoid xrootd thrashing
[u/mrichter/AliRoot.git] / EVE / Alieve / AliEveITSScaledModuleEditor.cxx
1 // $Id$
2 // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
3
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  **************************************************************************/
9
10 #include "AliEveITSScaledModuleEditor.h"
11 #include <Alieve/AliEveITSScaledModule.h>
12 #include <TEveTransEditor.h>
13 #include <TEveGValuators.h>
14
15 #include <TVirtualPad.h>
16 #include <TColor.h>
17 #include <TMath.h>
18
19 #include <TGedEditor.h>
20 #include <TGLabel.h>
21 #include <TG3DLine.h>
22 #include <TGButton.h>
23 #include <TGNumberEntry.h>
24 #include <TGColorSelect.h>
25 #include <TGComboBox.h>
26
27
28 //______________________________________________________________________________
29 // AliEveITSScaledModuleEditor
30 //
31
32 ClassImp(AliEveITSScaledModuleEditor)
33
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),
37
38     fInfoFrame(0),
39
40     fModule(0),
41
42     fScale(0),
43     fStatistic(0),
44     fInfoLabel0(0),
45     fInfoLabel1(0)
46 {
47   MakeTitle("AliEveITSScaledModule");
48   // Create widgets
49   {
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));
58     fScale->Associate(f);
59     fScale->Connect("ValueSet(Long_t)", "AliEveITSScaledModuleEditor", this, "DoScale()");
60
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));
73   }
74
75   CreateInfoFrame();
76 }
77
78 /******************************************************************************/
79 AliEveITSScaledModuleEditor::~AliEveITSScaledModuleEditor()
80 {}
81
82 /******************************************************************************/
83 void AliEveITSScaledModuleEditor::CreateInfoFrame()
84 {
85   fInfoFrame = CreateEditorTabSubFrame("Info");
86   TGCompositeFrame *title1 = new TGCompositeFrame(fInfoFrame, 145, 10,
87                                                   kHorizontalFrame |
88                                                   kLHintsExpandX   |
89                                                   kFixedWidth      |
90                                                   kOwnBackground);
91
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));
97
98
99   Int_t lp = 2;
100   fInfoLabel0 = new TGLabel(fInfoFrame);
101   fInfoLabel0->SetTextJustify(kTextLeft);
102   fInfoFrame->AddFrame(fInfoLabel0, new TGLayoutHints(kLHintsLeft|kLHintsExpandX,
103                                           lp, 0, 8, 0));
104
105   fInfoLabel1 = new TGLabel(fInfoFrame);
106   fInfoLabel1->SetTextJustify(kTextLeft);
107   fInfoFrame->AddFrame(fInfoLabel1, new TGLayoutHints(kLHintsLeft|kLHintsExpandX,
108                                           lp, 0, 2, 8));
109
110 }
111
112 /******************************************************************************/
113
114 void AliEveITSScaledModuleEditor::SetModel(TObject* obj)
115 {
116   fModule = dynamic_cast<AliEveITSScaledModule*>(obj);
117
118   // widgets
119   fScale->SetIntNumber(fModule->GetScaleInfo()->GetScale());
120   fStatistic->Select(fModule->GetScaleInfo()->GetStatType(), kFALSE);
121
122   // text info
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));
127 }
128
129
130 /******************************************************************************/
131
132 void AliEveITSScaledModuleEditor::DoScale()
133 {
134   fModule->GetScaleInfo()->ScaleChanged(fScale->GetIntNumber());
135
136   Int_t cnx, cnz, total;
137   fModule->GetScaleData(cnx, cnz, total);
138   fInfoLabel0->SetText(Form("Cell size:  Nx=%d Nz=%d", cnx, cnz));
139   Update();
140   fGedEditor->SetModel(fGedEditor->GetPad(), fGedEditor->GetModel(), kButton1Down);
141 }
142
143 /******************************************************************************/
144
145 void AliEveITSScaledModuleEditor::DoStatType(Int_t v)
146 {
147   fModule->GetScaleInfo()->StatTypeChanged(v);
148   Update();
149   fGedEditor->SetModel(fGedEditor->GetPad(), fGedEditor->GetModel(), kButton1Down);
150 }