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