From Antonin:
[u/mrichter/AliRoot.git] / EVE / EveBase / AliEveCascadeListEditor.cxx
CommitLineData
2991d609 1// @(#)root/eve:$Id$
2// Author: Matevz Tadel 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
2991d609 10
2991d609 11
12#include "TVirtualPad.h"
13#include "TColor.h"
14
2991d609 15#include "TGLabel.h"
9851a663 16#include "TEveGValuators.h"
17
18// Cleanup these includes:
19
20//#include "TGButton.h"
21//#include "TGNumberEntry.h"
22//#include "TGColorSelect.h"
2991d609 23#include "TGDoubleSlider.h"
9851a663 24#include <TGComboBox.h>
25
26#include "AliEveCascadeListEditor.h"
27#include "AliEveCascade.h"
28
2991d609 29
30
31//______________________________________________________________________________
32// GUI editor for AliEveCascadeList.
33//
34
35ClassImp(AliEveCascadeListEditor)
36
37//______________________________________________________________________________
38AliEveCascadeListEditor::AliEveCascadeListEditor(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),
9851a663 42 fCascadeSpecies(0),
2991d609 43 fMinMaxRCut(0),
44 fMinMaxDaughterDCA(0),
9851a663 45 fMinMaxPt(0),
46 fMinMaxInvariantMass(0)
2991d609 47{
48 // Constructor.
49
50 MakeTitle("AliEveCascadeList");
51
52 // Create widgets
53 // fXYZZ = new TGSomeWidget(this, ...);
54 // AddFrame(fXYZZ, new TGLayoutHints(...));
55 // fXYZZ->Connect("SignalName()", "Reve::AliEveCascadeListEditor", this, "DoXYZZ()");
56
57 fMinMaxRCut = new TEveGDoubleValuator(this,"Radius:", 130, 0);
58 fMinMaxRCut->SetNELength(5);
59 fMinMaxRCut->SetLabelWidth(74);
60 fMinMaxRCut->Build();
61 fMinMaxRCut->GetSlider()->SetWidth(200);
62 fMinMaxRCut->SetLimits(0, 100, TGNumberFormat::kNESRealOne);
63 fMinMaxRCut->Connect("ValueSet()", "AliEveCascadeListEditor", this, "DoMinMaxRCut()");
64 AddFrame(fMinMaxRCut, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
65
66 fMinMaxDaughterDCA = new TEveGDoubleValuator(this,"DCA:", 130, 0);
67 fMinMaxDaughterDCA->SetNELength(5);
68 fMinMaxDaughterDCA->SetLabelWidth(74);
69 fMinMaxDaughterDCA->Build();
70 fMinMaxDaughterDCA->GetSlider()->SetWidth(200);
71 fMinMaxDaughterDCA->SetLimits(0, 1, TGNumberFormat::kNESRealTwo);
72 fMinMaxDaughterDCA->Connect("ValueSet()", "AliEveCascadeListEditor", this, "DoMinMaxDaughterDCA()");
73 AddFrame(fMinMaxDaughterDCA, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
74
75 fMinMaxPt = new TEveGDoubleValuator(this,"pT:", 130, 0);
76 fMinMaxPt->SetNELength(5);
77 fMinMaxPt->SetLabelWidth(74);
78 fMinMaxPt->Build();
79 fMinMaxPt->GetSlider()->SetWidth(200);
80 fMinMaxPt->SetLimits(0, 20, TGNumberFormat::kNESRealOne);
81 fMinMaxPt->Connect("ValueSet()", "AliEveCascadeListEditor", this, "DoMinMaxPt()");
82 AddFrame(fMinMaxPt, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
9851a663 83
84
85 TGHorizontalFrame* fCascadeFrame = new TGHorizontalFrame(this);
86 TGLabel* labPos = new TGLabel(fCascadeFrame, "Cascade:");
87 fCascadeFrame->AddFrame(labPos, new TGLayoutHints(kLHintsLeft|kLHintsBottom, 1, 1, 1, 1));
88 fCascadeSpecies = new TGComboBox(fCascadeFrame);
89 fCascadeSpecies->AddEntry("Xi", kXiMinus);
90 fCascadeSpecies->AddEntry("Omega", kOmegaMinus);
91 TGListBox* lbPos = fCascadeSpecies->GetListBox();
92 lbPos->Resize(lbPos->GetWidth(), 2*18);
93 fCascadeSpecies->Resize(45, 20);
94 fCascadeSpecies->Connect("Selected(Int_t)", "AliEveCascadeListEditor", this, "DoSelectInvMassHyp(Int_t)");
95 fCascadeFrame->AddFrame(fCascadeSpecies, new TGLayoutHints(kLHintsTop, 3, 1, 1, 1));
96 AddFrame(fCascadeFrame);
97
98
99 fMinMaxInvariantMass = new TEveGDoubleValuator(this,"Inv. Mass:", 130, 0);
100 fMinMaxInvariantMass->SetNELength(5);
101 fMinMaxInvariantMass->SetLabelWidth(74);
102 fMinMaxInvariantMass->Build();
103 fMinMaxInvariantMass->GetSlider()->SetWidth(200);
104 fMinMaxInvariantMass->SetLimits(1, 6, TGNumberFormat::kNESRealThree);
105 fMinMaxInvariantMass->Connect("ValueSet()", "AliEveCascadeListEditor", this, "DoMinMaxInvariantMass()");
106 AddFrame(fMinMaxInvariantMass, new TGLayoutHints(kLHintsBottom, 1, 1, 1, 1));
107
2991d609 108}
109
110/******************************************************************************/
111
112//______________________________________________________________________________
113void AliEveCascadeListEditor::SetModel(TObject* obj)
114{
115 // Set model object.
116
117 fM = dynamic_cast<AliEveCascadeList*>(obj);
118
119 // Set values of widgets
120 // fXYZZ->SetValue(fM->GetXYZZ());
121
122 fMinMaxRCut->SetValues(fM->fMinRCut, fM->fMaxRCut);
123 fMinMaxDaughterDCA->SetValues(fM->fMinDaughterDCA, fM->fMaxDaughterDCA);
124 fMinMaxPt->SetValues(fM->fMinPt, fM->fMaxPt);
9851a663 125 fMinMaxInvariantMass->SetValues(fM->fMinInvariantMass,fM->fMaxInvariantMass);
2991d609 126}
127
128/******************************************************************************/
129
130// Implements callback/slot methods
131
132//______________________________________________________________________________
133// void AliEveCascadeListEditor::DoXYZZ()
134// {
135// // Slot for XYZZ.
136//
137// fM->SetXYZZ(fXYZZ->GetValue());
138// Update();
139// }
140
141void AliEveCascadeListEditor::DoMinMaxRCut()
142{
9851a663 143 // Filter cascade candidates by transverse radius
144
2991d609 145 fM->FilterByRadius(fMinMaxRCut->GetMin(), fMinMaxRCut->GetMax());
146}
147
148void AliEveCascadeListEditor::DoMinMaxDaughterDCA()
149{
9851a663 150 // Filter cascade candidates by DCA to primary vertex
151
2991d609 152 fM->FilterByDaughterDCA(fMinMaxDaughterDCA->GetMin(), fMinMaxDaughterDCA->GetMax());
153}
154
155void AliEveCascadeListEditor::DoMinMaxPt()
156{
9851a663 157 // Filter cascade candidates by transverse momentum
158
2991d609 159 fM->FilterByPt(fMinMaxPt->GetMin(), fMinMaxPt->GetMax());
160}
9851a663 161
162
163
164void AliEveCascadeListEditor::DoSelectInvMassHyp(Int_t rInvMassHyp)
165{
166 // Apply the invariant mass hypothesis according the choice made by user
167
168 fM->SetInvMassHyp(rInvMassHyp);
169 Update();
170}
171
172void AliEveCascadeListEditor::DoMinMaxInvariantMass()
173{
174 // Filter cascade candidates by invariant mass (under mass hypothesis made by user)
175
176 Int_t rInvMassHyp = fM->GetInvMassHyp();
177 if(rInvMassHyp)
178 fM->FilterByInvariantMass(fMinMaxInvariantMass->GetMin(), fMinMaxInvariantMass->GetMax(), rInvMassHyp);
179 else
180 fM->FilterByInvariantMass(fMinMaxInvariantMass->GetMin(), fMinMaxInvariantMass->GetMax(), kXiMinus);
181
182}
183