]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/Alieve/PMDModuleEditor.cxx
42f83184b62b531a79160e00661c8ee292cbdf77
[u/mrichter/AliRoot.git] / EVE / Alieve / PMDModuleEditor.cxx
1 // $Header$
2
3 #include "PMDModuleEditor.h"
4 #include <Alieve/PMDModule.h>
5 #include <Reve/RGEditor.h>
6
7 #include <TVirtualPad.h>
8 #include <TColor.h>
9
10 #include <TGLabel.h>
11 #include <TG3DLine.h>
12 #include <TGButton.h>
13 #include <TGNumberEntry.h>
14 #include <TGColorSelect.h>
15 #include <TGDoubleSlider.h>
16
17 #include <TCanvas.h>
18 #include <TGLViewer.h>
19 #include <Reve/ReveManager.h>
20
21
22 #include <TH1F.h>
23
24 using namespace Reve;
25 using namespace Alieve;
26
27 //______________________________________________________________________
28 // PMDModuleEditor
29 //
30
31 ClassImp(PMDModuleEditor)
32
33 PMDModuleEditor::PMDModuleEditor(const TGWindow *p, Int_t width, Int_t height,
34                                  UInt_t options, Pixel_t back) :
35   TGedFrame(p, width, height, options | kVerticalFrame, back),
36   fM(0),
37   fInfoFrame(0),
38   fInfoLabel0(0),
39   fInfoLabel1(0),
40   fInfoLabel2(0),
41   fInfoLabel3(0),
42   fInfoLabel4(0),
43   fInfoLabel5(0)
44   // Initialize widget pointers to 0
45 {
46   MakeTitle("PMDModule");
47
48   CreateInfoFrame();
49 }
50
51 void PMDModuleEditor::CreateInfoFrame()
52 {
53   fInfoFrame = CreateEditorTabSubFrame("Info");
54
55   TGCompositeFrame *title1 = new TGCompositeFrame(fInfoFrame, 145, 10, 
56                                                   kHorizontalFrame | 
57                                                   kLHintsExpandX   | 
58                                                   kFixedWidth      | 
59                                                   kOwnBackground);
60
61   title1->AddFrame(new TGLabel(title1, "PMDModule Info"), 
62                    new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
63   title1->AddFrame(new TGHorizontal3DLine(title1),
64                    new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
65   fInfoFrame->AddFrame(title1, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0));
66
67   Int_t labelW = 67;
68
69   fInfoLabel0 = new TGLabel(fInfoFrame);
70   fInfoLabel0->SetTextJustify(kTextLeft);
71   fInfoFrame->AddFrame(fInfoLabel0, new TGLayoutHints(kLHintsLeft|kLHintsExpandX,
72                                          8, 0, 2, 0));
73
74   fInfoLabel1 = new TGLabel(fInfoFrame);
75   fInfoLabel1->SetTextJustify(kTextLeft);
76   fInfoFrame->AddFrame(fInfoLabel1, new TGLayoutHints(kLHintsLeft|kLHintsExpandX,
77                                          8, 0, 2, 0));
78
79   fInfoLabel2 = new TGLabel(fInfoFrame);
80   fInfoLabel2->SetTextJustify(kTextLeft);
81   fInfoFrame->AddFrame(fInfoLabel2, new TGLayoutHints(kLHintsLeft|kLHintsExpandX,
82                                          8, 0, 2, 0));
83
84   fInfoLabel3 = new TGLabel(fInfoFrame);
85   fInfoLabel3->SetTextJustify(kTextLeft);
86   fInfoFrame->AddFrame(fInfoLabel3, new TGLayoutHints(kLHintsLeft|kLHintsExpandX,
87                                          8, 0, 2, 0));
88
89   fInfoLabel4 = new TGLabel(fInfoFrame);
90   fInfoLabel4->SetTextJustify(kTextLeft);
91   fInfoFrame->AddFrame(fInfoLabel4, new TGLayoutHints(kLHintsLeft|kLHintsExpandX,
92                                          8, 0, 2, 0));
93
94   fInfoLabel5 = new TGLabel(fInfoFrame);
95   fInfoLabel5->SetTextJustify(kTextLeft);
96   fInfoFrame->AddFrame(fInfoLabel5, new TGLayoutHints(kLHintsLeft|kLHintsExpandX,
97                                          8, 0, 2, 0));
98
99
100   {
101     TGHorizontalFrame* f = new TGHorizontalFrame(fInfoFrame, 210, 20, kFixedWidth);
102
103     TGHorizontalFrame* g = new TGHorizontalFrame(f, labelW, 0, kFixedWidth);
104     TGLabel* l = new TGLabel(g, "Histos:");
105     g->AddFrame(l, new TGLayoutHints(kLHintsLeft, 0,0,4,0));
106     f->AddFrame(g);
107
108     TGTextButton* b;
109
110     b = new TGTextButton(f, "Show");
111     f->AddFrame(b, new TGLayoutHints(kLHintsLeft|kLHintsExpandX, 1, 1, 0, 0));
112     b->Connect("Clicked()", "Alieve::PMDModuleEditor", this, "DisplayHistos()");
113
114     fInfoFrame->AddFrame(f, new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
115   }
116 }
117
118 PMDModuleEditor::~PMDModuleEditor()
119 {}
120
121 /**************************************************************************/
122
123 void PMDModuleEditor::SetModel(TObject* obj)
124 {
125   fM = dynamic_cast<PMDModule*>(obj);
126
127   // Set values of widgets
128
129   fInfoLabel0->SetText(Form("Cells hit per Module : %d", fM->GetNPads()));
130   fInfoLabel1->SetText(Form("ADC       per Module : %d", fM->GetAdc()));
131   fInfoLabel2->SetText(Form("Tot Cells for PRE    : %d", fM->GetPRETotPads()));
132   fInfoLabel3->SetText(Form("Tot ADC   for PRE    : %d", fM->GetPRETotAdc()));
133   fInfoLabel4->SetText(Form("Tot Cells for CPV    : %d", fM->GetCPVTotPads()));
134   fInfoLabel5->SetText(Form("Tot ADC   for CPV    : %d", fM->GetCPVTotAdc()));
135 }
136
137 void PMDModuleEditor::DisplayHistos()
138 {
139   fM->GetHisto()->Draw();
140   gPad->Modified();
141   gPad->Update();
142 }