1 /**************************************************************************
2 * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
3 * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for *
4 * full copyright notice. *
5 **************************************************************************/
8 // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
10 #include "AliEveTOFSectorEditor.h"
11 #include <EveDet/AliEveTOFSector.h>
13 #include <TVirtualPad.h>
15 #include <TEveGValuators.h>
19 #include <TGNumberEntry.h>
20 #include <TGColorSelect.h>
22 #include <TGDoubleSlider.h>
25 //______________________________________________________________________________
26 // AliEveTOFSectorEditor
29 ClassImp(AliEveTOFSectorEditor)
31 AliEveTOFSectorEditor::AliEveTOFSectorEditor(const TGWindow *p, Int_t width, Int_t height,
32 UInt_t options, Pixel_t back) :
33 TGedFrame(p, width, height, options | kVerticalFrame, back),
35 fSectorID (0), fAutoTrans (0),
37 fPlate0(0), fPlate1(0), fPlate2(0), fPlate3(0), fPlate4(0),
38 fThreshold (0), fMaxVal(0)
42 fPlate = new TGCheckButton*[5];
43 for (Int_t ii=0; ii<5; ii++) fPlate[ii] = new TGCheckButton;
46 MakeTitle("AliEveTOFSector");
48 fSectorID = new TEveGValuator(this, "SectorID", 110, 0);
49 fSectorID->SetLabelWidth(60);
50 fSectorID->SetShowSlider(kFALSE);
51 fSectorID->SetNELength(4);
53 fSectorID->SetLimits(0, 17);
54 fSectorID->SetToolTip("The 18 Tof Sector's");
55 fSectorID->Connect("ValueSet(Double_t)",
56 "AliEveTOFSectorEditor", this, "DoSectorID()");
57 // Reuse sectorID for auto-transformation button
58 fAutoTrans = new TGCheckButton(fSectorID, "AutoTrans");
59 fAutoTrans->SetToolTipText("Automatically set transformation to true position");
60 fSectorID->AddFrame(fAutoTrans, new TGLayoutHints(kLHintsLeft, 12, 0, 1, 0));
61 fAutoTrans->Connect("Toggled(Bool_t)","AliEveTOFSectorEditor", this, "DoAutoTrans()");
62 AddFrame(fSectorID, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
65 // fXYZZ = new TGSomeWidget(this, ...);
66 // AddFrame(fXYZZ, new TGLayoutHints(...));
67 // fXYZZ->Connect("SignalName()", "AliEveTOFSectorEditor", this, "DoXYZZ()"); {
68 TGHorizontalFrame* f = new TGHorizontalFrame(this);
71 fPlate0 = new TGCheckButton(f, "Plate0");
72 f->AddFrame(fPlate0, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
73 fPlate0->Connect("Toggled(Bool_t)","AliEveTOFSectorEditor", this, "DoPlate0()");
74 //fPlate0->Connect("Toggled(Bool_t)","AliEveTOFSectorEditor", this, "DoPlate(Int_t)");
77 fPlate1 = new TGCheckButton(f, "Plate 1");
78 f->AddFrame(fPlate1, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
79 fPlate1->Connect("Toggled(Bool_t)","AliEveTOFSectorEditor", this, "DoPlate1()");
80 //fPlate1->Connect("Toggled(Bool_t)","AliEveTOFSectorEditor", this, "DoPlate(Int_t)");
83 fPlate2 = new TGCheckButton(f, "Plate 2");
84 f->AddFrame(fPlate2, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
85 fPlate2->Connect("Toggled(Bool_t)","AliEveTOFSectorEditor", this, "DoPlate2()");
86 //fPlate2->Connect("Toggled(Bool_t)","AliEveTOFSectorEditor", this, "DoPlate(Int_t)");
89 fPlate3 = new TGCheckButton(f, "Plate 3");
90 f->AddFrame(fPlate3, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
91 fPlate3->Connect("Toggled(Bool_t)","AliEveTOFSectorEditor", this, "DoPlate3()");
92 //fPlate3->Connect("Toggled(Bool_t)","AliEveTOFSectorEditor", this, "DoPlate(Int_t)");
95 fPlate4 = new TGCheckButton(f, "Plate 4");
96 f->AddFrame(fPlate4, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
97 fPlate4->Connect("Toggled(Bool_t)","AliEveTOFSectorEditor", this, "DoPlate4()");
98 //fPlate4->Connect("Toggled(Bool_t)","AliEveTOFSectorEditor", this, "DoPlate(Int_t)");
106 AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
108 fThreshold = new TEveGValuator(this, "Threshold", 200, 0);
109 fThreshold->SetNELength(4);
110 fThreshold->SetLabelWidth(60);
112 fThreshold->GetSlider()->SetWidth(120);
113 fThreshold->SetLimits(0,250);
114 fThreshold->Connect("ValueSet(Double_t)",
115 "AliEveTOFSectorEditor", this, "DoThreshold()");
116 AddFrame(fThreshold, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1));
118 fMaxVal = new TEveGValuator(this,"MaxVal", 200, 0);
119 fMaxVal->SetNELength(4);
120 fMaxVal->SetLabelWidth(60);
122 fMaxVal->GetSlider()->SetWidth(60);
123 fMaxVal->SetLimits(0, 500);
124 fMaxVal->Connect("ValueSet(Double_t)",
125 "AliEveTOFSectorEditor", this, "DoMaxVal()");
126 AddFrame(fMaxVal, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1));
130 /******************************************************************************/
132 AliEveTOFSectorEditor::~AliEveTOFSectorEditor()
139 /******************************************************************************/
141 void AliEveTOFSectorEditor::SetModel(TObject* obj)
143 // Set object to monitor at visualization level
145 fM = dynamic_cast<AliEveTOFSector*>(obj);
147 fSectorID->SetValue(fM->GetSectorID());
148 fAutoTrans->SetState(fM->GetAutoTrans() ? kButtonDown : kButtonUp);
150 fPlate0->SetState(fM->GetPlate(0) ? kButtonDown : kButtonUp);
151 fPlate1->SetState(fM->GetPlate(1) ? kButtonDown : kButtonUp);
152 fPlate2->SetState(fM->GetPlate(2) ? kButtonDown : kButtonUp);
153 fPlate3->SetState(fM->GetPlate(3) ? kButtonDown : kButtonUp);
154 fPlate4->SetState(fM->GetPlate(4) ? kButtonDown : kButtonUp);
157 /******************************************************************************/
158 void AliEveTOFSectorEditor::DoSectorID()
160 fM->SetSectorID((Int_t) fSectorID->GetValue());
164 void AliEveTOFSectorEditor::DoAutoTrans()
166 fM->SetAutoTrans(fAutoTrans->IsOn());
170 /******************************************************************************/
172 void AliEveTOFSectorEditor::DoPlate(Int_t nPlate)
174 fM->SetPlate(nPlate, fPlate[nPlate]->IsOn());
178 void AliEveTOFSectorEditor::DoPlate0()
180 fM->SetPlate(0, fPlate0->IsOn());
184 void AliEveTOFSectorEditor::DoPlate1()
186 fM->SetPlate(1, fPlate1->IsOn());
190 void AliEveTOFSectorEditor::DoPlate2()
192 fM->SetPlate(2, fPlate2->IsOn());
195 void AliEveTOFSectorEditor::DoPlate3()
197 fM->SetPlate(3, fPlate3->IsOn());
201 void AliEveTOFSectorEditor::DoPlate4()
203 fM->SetPlate(4, fPlate4->IsOn());
208 void AliEveTOFSectorEditor::DoThreshold()
210 fM->SetThreshold((Short_t) fThreshold->GetValue());
211 fThreshold->SetValue(fM->GetThreshold());
215 void AliEveTOFSectorEditor::DoMaxVal()
217 fM->SetMaxVal((Int_t) fMaxVal->GetValue());
218 fMaxVal->SetValue(fM->GetMaxVal());
223 void AliEveTOFSectorEditor::DoTime()
225 fM->SetMinTime((Int_t) fTime->GetMin());
226 fM->SetMaxTime((Int_t) fTime->GetMax());