Extra header added to the list
[u/mrichter/AliRoot.git] / EVE / EveBase / AliEveV0ListEditor.cxx
CommitLineData
ca8a6926 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
10#include "AliEveV0ListEditor.h"
11#include "AliEveV0.h"
12
13#include "TEveGValuators.h"
14
15#include "TVirtualPad.h"
16#include "TColor.h"
17
18// Cleanup these includes:
19#include "TGLabel.h"
20#include "TGButton.h"
21#include "TGNumberEntry.h"
22#include "TGColorSelect.h"
23#include "TGDoubleSlider.h"
2c7d7ac0 24#include "TGComboBox.h"
25#include "TGLabel.h"
ca8a6926 26
27//______________________________________________________________________________
28// GUI editor for AliEveV0List.
29//
30
31ClassImp(AliEveV0ListEditor)
32
33//______________________________________________________________________________
34AliEveV0ListEditor::AliEveV0ListEditor(const TGWindow *p, Int_t width, Int_t height,
35 UInt_t options, Pixel_t back) :
36 TGedFrame(p, width, height, options | kVerticalFrame, back),
37 fM(0),
e1bb28b4 38 fMinMaxRCut(0),
39 fMinMaxDaughterDCA(0),
2c7d7ac0 40 fMinMaxPt(0),
41 fNegativeSpecies(0),
42 fPositiveSpecies(0),
43 fNegativeCheckMaxPidProbability(0),
44 fPositiveCheckMaxPidProbability(0),
45 fNegativeLevelPidProbability(0),
46 fPositiveLevelPidProbability(0),
47 fMinMaxInvariantMass(0)
ca8a6926 48{
49 // Constructor.
50
51 MakeTitle("AliEveV0List");
52
53 // Create widgets
54 // fXYZZ = new TGSomeWidget(this, ...);
55 // AddFrame(fXYZZ, new TGLayoutHints(...));
56 // fXYZZ->Connect("SignalName()", "Reve::AliEveV0ListEditor", this, "DoXYZZ()");
57
58 fMinMaxRCut = new TEveGDoubleValuator(this,"Radius:", 130, 0);
59 fMinMaxRCut->SetNELength(5);
60 fMinMaxRCut->SetLabelWidth(74);
61 fMinMaxRCut->Build();
62 fMinMaxRCut->GetSlider()->SetWidth(200);
63 fMinMaxRCut->SetLimits(0, 100, TGNumberFormat::kNESRealOne);
64 fMinMaxRCut->Connect("ValueSet()", "AliEveV0ListEditor", this, "DoMinMaxRCut()");
65 AddFrame(fMinMaxRCut, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
e1bb28b4 66
67 fMinMaxDaughterDCA = new TEveGDoubleValuator(this,"DCA:", 130, 0);
68 fMinMaxDaughterDCA->SetNELength(5);
69 fMinMaxDaughterDCA->SetLabelWidth(74);
70 fMinMaxDaughterDCA->Build();
71 fMinMaxDaughterDCA->GetSlider()->SetWidth(200);
72 fMinMaxDaughterDCA->SetLimits(0, 1, TGNumberFormat::kNESRealTwo);
73 fMinMaxDaughterDCA->Connect("ValueSet()", "AliEveV0ListEditor", this, "DoMinMaxDaughterDCA()");
74 AddFrame(fMinMaxDaughterDCA, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
75
2c7d7ac0 76 fMinMaxPt = new TEveGDoubleValuator(this,"pT:", 80, 0);
e1bb28b4 77 fMinMaxPt->SetNELength(5);
78 fMinMaxPt->SetLabelWidth(74);
79 fMinMaxPt->Build();
80 fMinMaxPt->GetSlider()->SetWidth(200);
81 fMinMaxPt->SetLimits(0, 20, TGNumberFormat::kNESRealOne);
82 fMinMaxPt->Connect("ValueSet()", "AliEveV0ListEditor", this, "DoMinMaxPt()");
83 AddFrame(fMinMaxPt, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
2c7d7ac0 84
85 TGHorizontalFrame* fNegFrame = new TGHorizontalFrame(this);
86 TGLabel* labNeg = new TGLabel(fNegFrame, "Neg:");
87 fNegFrame->AddFrame(labNeg, new TGLayoutHints(kLHintsLeft|kLHintsBottom, 1, 1, 1, 1));
88 fNegativeSpecies = new TGComboBox(fNegFrame);
89 fNegativeSpecies->AddEntry("e", 11);
90 fNegativeSpecies->AddEntry("mu", 13);
91 fNegativeSpecies->AddEntry("pi", 211);
92 fNegativeSpecies->AddEntry("K", 321);
93 fNegativeSpecies->AddEntry("p", 2212);
94 TGListBox* lbNeg = fNegativeSpecies->GetListBox();
95 lbNeg->Resize(lbNeg->GetWidth(), 2*18);
96 fNegativeSpecies->Resize(45, 20);
97 fNegativeSpecies->Connect("Selected(Int_t)", "AliEveV0ListEditor", this, "DoSelectNegPid(Int_t)");
98 fNegFrame->AddFrame(fNegativeSpecies, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
99 AddFrame(fNegFrame);
100
101 fNegativeCheckMaxPidProbability = new TGCheckButton(fNegFrame, "Check");
102 fNegFrame->AddFrame(fNegativeCheckMaxPidProbability, new TGLayoutHints(kLHintsLeft, 0, 2, 1, 1));
103 fNegativeCheckMaxPidProbability->Connect("Toggled(Bool_t)", "AliEveV0ListEditor", this, "DoCheckNegPid()");
104
105 fNegativeLevelPidProbability = new TGNumberEntry(fNegFrame, 0.5, 3, -1, TGNumberFormat::kNESRealTwo, TGNumberFormat::kNEANonNegative,TGNumberFormat::kNELLimitMinMax, 0, 1);
106 fNegativeLevelPidProbability->Resize(50,20);
107 fNegativeLevelPidProbability->Connect("ValueSet(Long_t)", "AliEveV0ListEditor", this, "DoSelectNegProb()");
108 fNegFrame->AddFrame(fNegativeLevelPidProbability, new TGLayoutHints(kLHintsLeft|kLHintsExpandX, 1, 1, 1, 1));
109
110 TGHorizontalFrame* fPosFrame = new TGHorizontalFrame(this);
111 TGLabel* labPos = new TGLabel(fPosFrame, "Pos:");
112 fPosFrame->AddFrame(labPos, new TGLayoutHints(kLHintsLeft|kLHintsBottom, 1, 1, 1, 1));
113 fPositiveSpecies = new TGComboBox(fPosFrame);
114 fPositiveSpecies->AddEntry("e", 11);
115 fPositiveSpecies->AddEntry("mu", 13);
116 fPositiveSpecies->AddEntry("pi", 211);
117 fPositiveSpecies->AddEntry("K", 321);
118 fPositiveSpecies->AddEntry("p", 2212);
119 TGListBox* lbPos = fPositiveSpecies->GetListBox();
120 lbPos->Resize(lbPos->GetWidth(), 2*18);
121 fPositiveSpecies->Resize(45, 20);
122 fPositiveSpecies->Connect("Selected(Int_t)", "AliEveV0ListEditor", this, "DoSelectPosPid(Int_t)");
123 fPosFrame->AddFrame(fPositiveSpecies, new TGLayoutHints(kLHintsTop, 3, 1, 1, 1));
124 AddFrame(fPosFrame);
125
126 fPositiveCheckMaxPidProbability = new TGCheckButton(fPosFrame, "Check");
127 fPosFrame->AddFrame(fPositiveCheckMaxPidProbability, new TGLayoutHints(kLHintsLeft, 0, 2, 1, 1));
128 fPositiveCheckMaxPidProbability->Connect("Toggled(Bool_t)", "AliEveV0ListEditor", this, "DoCheckPosPid()");
129
130 fPositiveLevelPidProbability = new TGNumberEntry(fPosFrame, 0.5, 3, -1, TGNumberFormat::kNESRealTwo, TGNumberFormat::kNEANonNegative,TGNumberFormat::kNELLimitMinMax, 0, 1);
131 fPositiveLevelPidProbability->Resize(50,20);
132 fPositiveLevelPidProbability->Connect("ValueSet(Long_t)", "AliEveV0ListEditor", this, "DoSelectPosProb()");
133 fPosFrame->AddFrame(fPositiveLevelPidProbability, new TGLayoutHints(kLHintsLeft|kLHintsExpandX, 1, 1, 1, 1));
134
135 fMinMaxInvariantMass = new TEveGDoubleValuator(this,"Inv. Mass:", 80, 0);
136 fMinMaxInvariantMass->SetNELength(5);
137 fMinMaxInvariantMass->SetLabelWidth(74);
138 fMinMaxInvariantMass->Build();
139 fMinMaxInvariantMass->GetSlider()->SetWidth(200);
140 fMinMaxInvariantMass->SetLimits(0, 1.2, TGNumberFormat::kNESRealThree);
141 fMinMaxInvariantMass->Connect("ValueSet()", "AliEveV0ListEditor", this, "DoMinMaxInvariantMass()");
142 AddFrame(fMinMaxInvariantMass, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
ca8a6926 143}
144
145/******************************************************************************/
146
147//______________________________________________________________________________
148void AliEveV0ListEditor::SetModel(TObject* obj)
149{
150 // Set model object.
151
469ca156 152 fM = static_cast<AliEveV0List*>(obj);
ca8a6926 153
154 // Set values of widgets
155 // fXYZZ->SetValue(fM->GetXYZZ());
156
157 fMinMaxRCut->SetValues(fM->fMinRCut, fM->fMaxRCut);
e1bb28b4 158 fMinMaxDaughterDCA->SetValues(fM->fMinDaughterDCA, fM->fMaxDaughterDCA);
159 fMinMaxPt->SetValues(fM->fMinPt, fM->fMaxPt);
2c7d7ac0 160 fMinMaxInvariantMass->SetValues(fM->fMinInvariantMass, fM->fMaxInvariantMass);
ca8a6926 161}
162
163/******************************************************************************/
164
165// Implements callback/slot methods
166
167//______________________________________________________________________________
168// void AliEveV0ListEditor::DoXYZZ()
169// {
170// // Slot for XYZZ.
171//
172// fM->SetXYZZ(fXYZZ->GetValue());
173// Update();
174// }
175
176void AliEveV0ListEditor::DoMinMaxRCut()
177{
178 fM->FilterByRadius(fMinMaxRCut->GetMin(), fMinMaxRCut->GetMax());
179}
e1bb28b4 180
181void AliEveV0ListEditor::DoMinMaxDaughterDCA()
182{
183 fM->FilterByDaughterDCA(fMinMaxDaughterDCA->GetMin(), fMinMaxDaughterDCA->GetMax());
184}
185
186void AliEveV0ListEditor::DoMinMaxPt()
187{
188 fM->FilterByPt(fMinMaxPt->GetMin(), fMinMaxPt->GetMax());
189}
2c7d7ac0 190
191void AliEveV0ListEditor::DoSelectNegPid(Int_t rNegPid)
192{
193 fM->SetNegCheckedPid(rNegPid);
194 Update();
195}
196
197void AliEveV0ListEditor::DoCheckNegPid()
198{
199 Int_t lNegPid = fM->GetNegCheckedPid();
200 Float_t lNegProb = fM->GetNegCheckedProb();
201 if (lNegPid) {
202 fM->FilterByCheckedPidMinProb(fNegativeCheckMaxPidProbability->IsOn(),0,lNegPid,lNegProb);
203 printf("Selection for negative daughter pid %d prob %.2f \n",lNegPid,lNegProb);
204 Update();
205 }
206}
207
208void AliEveV0ListEditor::DoSelectNegProb()
209{
210 Float_t rMinNegProb = (Float_t)fNegativeLevelPidProbability->GetNumber();
211 fM->SetNegCheckedProb(rMinNegProb);
212 Update();
213}
214
215void AliEveV0ListEditor::DoSelectPosPid(Int_t rPosPid)
216{
217 fM->SetPosCheckedPid(rPosPid);
218 Update();
219}
220
221void AliEveV0ListEditor::DoCheckPosPid()
222{
223 Int_t lPosPid = fM->GetPosCheckedPid();
224 Float_t lPosProb = fM->GetPosCheckedProb();
225 if (lPosPid) {
226 fM->FilterByCheckedPidMinProb(fPositiveCheckMaxPidProbability->IsOn(),1,lPosPid,lPosProb);
227 printf("Selection for positive daughter pid %d prob %.2f \n",lPosPid,lPosProb);
228 Update();
229 }
230}
231
232void AliEveV0ListEditor::DoSelectPosProb()
233{
234 Float_t rMinPosProb = (Float_t)fPositiveLevelPidProbability->GetNumber();
235 fM->SetPosCheckedProb(rMinPosProb);
236 Update();
237}
238
239void AliEveV0ListEditor::DoMinMaxInvariantMass()
240{
241 Int_t lNegPid = fM->GetNegCheckedPid();
242 Int_t lPosPid = fM->GetPosCheckedPid();
243 if( lNegPid && lPosPid)
244 fM->FilterByInvariantMass(fMinMaxInvariantMass->GetMin(), fMinMaxInvariantMass->GetMax(),lNegPid,lPosPid);
245 else
246 fM->FilterByInvariantMass(fMinMaxInvariantMass->GetMin(), fMinMaxInvariantMass->GetMax(),211,-211);
247}