]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/EveBase/AliEveBeamsInfoEditor.cxx
Generator for dimuon decays of low masses resonances in AliRoot.
[u/mrichter/AliRoot.git] / EVE / EveBase / AliEveBeamsInfoEditor.cxx
1 // $Id$
2 // Author: Stefano Carrazza 2010, CERN, stefano.carrazza@cern.ch
3
4 /**************************************************************************
5  * Copyright(c) 1998-2009, 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 "AliEveBeamsInfo.h"
11 #include "AliEveBeamsInfoEditor.h"
12
13 #include "TVirtualPad.h"
14 #include "TColor.h"
15 #include "TGButton.h"
16 #include "TGColorSelect.h"
17 #include "TGComboBox.h"
18 #include "TGDoubleSlider.h"
19 #include "TGFrame.h"
20 #include "TGLabel.h"
21 #include "TGNumberEntry.h"
22 #include "TGString.h"
23
24 //______________________________________________________________________________
25 // GUI editor for AliEveBeamsInfo.
26 //
27
28 ClassImp(AliEveBeamsInfoEditor)
29
30 //______________________________________________________________________________
31 AliEveBeamsInfoEditor::AliEveBeamsInfoEditor(const TGWindow *p, Int_t width, Int_t height,
32              UInt_t options, Pixel_t back) :
33   TGedFrame(p, width, height, options | kVerticalFrame, back),
34   fM(0),
35   fIsMC(0),
36   fEventSelection(0),
37   fShowEvents(0),
38   fSelect(0),
39   fButtonPrev(0),
40   fButtonNext(0),
41   fSetAlpha(0),
42   fAlpha(0)
43 {
44   // Constructor.
45   MakeTitle("AliEveBeamsInfo");
46
47   // Events selection  
48   fShowEvents = new TGCheckButton(this, new TGHotString("&Show information box"));
49   fShowEvents->SetState(kButtonDown);
50   fShowEvents->Connect("Clicked()", "AliEveBeamsInfoEditor", this, "ShowEventSelection()");
51   AddFrame(fShowEvents, new TGLayoutHints(kLHintsExpandX));
52
53   fIsMC = new TGCheckButton(this, new TGHotString("&Data is from simulation (MC)"));
54   fIsMC->SetState(kButtonUp);
55   fIsMC->Connect("Clicked()", "AliEveBeamsInfoEditor", this, "SwitchDataType()");
56   AddFrame(fIsMC, new TGLayoutHints(kLHintsExpandX));
57
58   fEventSelection = new TGGroupFrame(this, "Event filter:", kHorizontalFrame);
59   fSelect = new TGComboBox(fEventSelection,-1,kHorizontalFrame | kSunkenFrame | kDoubleBorder | kOwnBackground);
60   fSelect->AddEntry("Show all events",0);
61   fSelect->AddEntry("Only Beam 1 events",1);
62   fSelect->AddEntry("Only Beam 2 events",2);
63   fSelect->AddEntry("Beams 1 & 2 events",3);
64   fSelect->Resize(120,22);
65   fSelect->Select(0);
66   fEventSelection->AddFrame(fSelect, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
67
68   fSelect->Connect("Selected(Int_t)", "AliEveBeamsInfoEditor", this, "SelectEventSelection(Int_t)");
69
70   AddFrame(fEventSelection, new TGLayoutHints(kLHintsExpandX));
71
72   //------
73
74   TGHorizontalFrame *h = new TGHorizontalFrame(this);
75
76   fButtonPrev = new TGTextButton(h, "Previous event");
77   h->AddFrame(fButtonPrev, new TGLayoutHints(kLHintsLeft | kLHintsCenterY | kLHintsExpandX));
78   fButtonPrev->Connect("Clicked()", "AliEveBeamsInfoEditor", this, "ShowPrevEvent()");
79
80   fButtonNext = new TGTextButton(h, "Next event");
81   h->AddFrame( fButtonNext, new TGLayoutHints(kLHintsRight | kLHintsNormal | kLHintsExpandX));
82   fButtonNext->Connect("Clicked()", "AliEveBeamsInfoEditor", this, "ShowNextEvent()");
83
84   AddFrame(h, new TGLayoutHints(kLHintsExpandX | kLHintsCenterY));
85
86   fSetAlpha = new TGGroupFrame(this, "Transparency value:", kHorizontalFrame);
87   fAlpha = new TGNumberEntry(fSetAlpha,  1.5, 7, -1,
88                              TGNumberFormat::kNESRealOne,
89                              TGNumberFormat::kNEANonNegative,
90                              TGNumberFormat::kNELLimitMinMax,
91                              0, 1.5);
92   fAlpha->Resize(120,22);
93   fSetAlpha->AddFrame(fAlpha, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
94   fAlpha->Connect("ValueSet(Long_t)", "AliEveBeamsInfoEditor", this, "SetAlpha()");
95
96   AddFrame(fSetAlpha, new TGLayoutHints(kLHintsExpandX));
97 }
98
99 //______________________________________________________________________________
100 void AliEveBeamsInfoEditor::SetModel(TObject* obj)
101 {
102   // Set model object.
103   fM = dynamic_cast<AliEveBeamsInfo*>(obj);
104 }
105
106 //______________________________________________________________________________
107 void AliEveBeamsInfoEditor::ShowEventSelection()
108 {
109   // Show event selection
110   fM->ShowEventSelection(fShowEvents->IsOn());
111 }
112
113 //______________________________________________________________________________
114 void AliEveBeamsInfoEditor::SelectEventSelection(Int_t id)
115 {
116   // Show event selection
117   fM->SelectEventSelection(id);
118 }
119
120 //______________________________________________________________________________
121 void AliEveBeamsInfoEditor::ShowPrevEvent()
122 {
123   // Show previous event
124   fM->ShowPrevEvent();
125 }
126
127 //______________________________________________________________________________
128 void AliEveBeamsInfoEditor::ShowNextEvent()
129 {
130   // Show next event
131   fM->ShowNextEvent();
132 }
133
134 //______________________________________________________________________________
135 void AliEveBeamsInfoEditor::SwitchDataType()
136 {
137   // Show previous event
138   fM->SwitchDataType(fIsMC->IsOn());
139 }
140
141 //______________________________________________________________________________
142 void AliEveBeamsInfoEditor::SetAlpha()
143 {
144   // Set alpha
145   fM->SetAlpha(fAlpha->GetNumber());
146 }
147
148
149 /******************************************************************************/