KaliVeda  1.13/01
Heavy-Ion Analysis Toolkit
KVZAFinderDialog.cpp
Go to the documentation of this file.
1 //Created by KVClassFactory on Wed Dec 12 10:11:10 2012
2 //Author: dgruyer
3 
4 #include "KVZAFinderDialog.h"
5 #include "KVIDGridEditor.h"
6 
9 TString KVZAFinderDialog::fAList = "1,4,7,9,11,12,14,16,19,21,23,25,27,29,31,34,37,40,41";
10 
13 
15 
16 //________________________________________________________________
17 
18 
21 {
22  fGrid = g;
23  fHisto = data_histo;
24  if ((fZmin < 0) && fGrid) fZmin = ((KVIDentifier*)fGrid->GetIdentifiers()->First())->GetPID();
25  if ((fZmax < 0) && fGrid) fZmax = ((KVIDentifier*)fGrid->GetIdentifiers()->Last())->GetPID();
26 
27  //Dialog box for testing identification grid
28  fMain = new TGTransientFrame(gClient->GetDefaultRoot(), gClient->GetDefaultRoot(), 10, 10);
29  fMain->Connect("CloseWindow()", "KVSpIdGUI", this, "DoClose()");
30  fMain->DontCallClose();
31  fMain->SetCleanup(kDeepCleanup);
32 
33  /******* frame for initialization **************/
34  fInitFrame = new TGGroupFrame(fMain, "Initialization");
35 
36  fZpFrame = new TGHorizontalFrame(fInitFrame);
37  fZminLabel = new TGLabel(fZpFrame, "Zmin ");
38  fZminEntry = new TGNumberEntry(fZpFrame, fZmin, 6, 0,
40  fZpFrame->AddFrame(fZminLabel, new TGLayoutHints(kLHintsLeft, 2, 2, 2, 2));
41  fZpFrame->AddFrame(fZminEntry, new TGLayoutHints(kLHintsLeft, 2, 2, 2, 2));
42 
43  fZmaxLabel = new TGLabel(fZpFrame, " Zmax ");
44  fZmaxEntry = new TGNumberEntry(fZpFrame, fZmax, 6, 0,
46  fZpFrame->AddFrame(fZmaxLabel, new TGLayoutHints(kLHintsLeft, 2, 2, 2, 2));
47  fZpFrame->AddFrame(fZmaxEntry, new TGLayoutHints(kLHintsLeft, 2, 2, 2, 2));
48 
49  fZbinLabel = new TGLabel(fZpFrame, " Bins ");
50  fZbinEntry = new TGNumberEntry(fZpFrame, fBinsByZ, 6, 0,
52 
53  fZpFrame->AddFrame(fZbinLabel, new TGLayoutHints(kLHintsLeft, 2, 2, 2, 2));
54  fZpFrame->AddFrame(fZbinEntry, new TGLayoutHints(kLHintsLeft, 2, 2, 2, 2));
55  fInitFrame->AddFrame(fZpFrame, new TGLayoutHints(kLHintsExpandX, 2, 2, 2, 2));
56 
57  fApFrame = new TGHorizontalFrame(fInitFrame);
58  fALabel = new TGLabel(fApFrame, "A ");
59  fAEntry = new TGTextEntry(fAList.Data(), fApFrame);
60  fApFrame->AddFrame(fALabel, new TGLayoutHints(kLHintsLeft, 2, 2, 2, 2));
61  fApFrame->AddFrame(fAEntry, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 2, 2, 2, 2));
62  fInitFrame->AddFrame(fApFrame, new TGLayoutHints(kLHintsExpandX, 2, 2, 5, 5));
63 
64 // /********** linearization bar **********/
65 // fLinearFrame = new TGGroupFrame(fMain, "Linearization");
66 // fLinearBar = new TGHProgressBar(fLinearFrame, TGProgressBar::kFancy, 300);
67 // fLinearBar->SetFillType(TGProgressBar::kBlockFill);
68 // fLinearBar->ShowPosition();
69 // fLinearBar->SetBarColor("green");
70 // fLinearFrame->AddFrame(fLinearBar,new TGLayoutHints(kLHintsExpandX | kLHintsTop,5,5,5,5));
71 
72  /********** progress bar **********/
73  fProgressFrame = new TGGroupFrame(fMain, "Progress");
74  fProgressBar = new TGHProgressBar(fProgressFrame, TGProgressBar::kFancy, 300);
75  fProgressBar->SetFillType(TGProgressBar::kBlockFill);
76  fProgressBar->ShowPosition();
77  fProgressBar->SetBarColor("green");
78  fProgressFrame->AddFrame(fProgressBar, new TGLayoutHints(kLHintsExpandX | kLHintsTop, 5, 5, 5, 5));
79 
80  /************buttons***************/
81  fButtonsFrame = new TGHorizontalFrame(fMain, 100, 50);
82  fTestButton = new TGTextButton(fButtonsFrame, "&Process");
83  fTestButton->Connect("Clicked()", "KVZAFinderDialog", this, "ProcessIdentification()");
84  fCloseButton = new TGTextButton(fButtonsFrame, "&Close");
85  fCloseButton->Connect("Clicked()", "KVZAFinderDialog", this, "DoClose()");
86 
87  fButtonsFrame->AddFrame(fTestButton,
90  kLHintsCenterY, 2, 2, 5, 5));
91  fButtonsFrame->AddFrame(fCloseButton,
94  kLHintsCenterY, 2, 2, 5, 5));
95 
96 
97  fMain->AddFrame(fInitFrame, new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsExpandX, 2, 2, 10, 2));
98 // fMain->AddFrame(fLinearFrame, new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsExpandX, 2, 2, 2, 2));
99  fMain->AddFrame(fProgressFrame, new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsExpandX, 2, 2, 2, 2));
100  fMain->AddFrame(fButtonsFrame, new TGLayoutHints(kLHintsCenterX | kLHintsTop, 2, 2, 2, 2));
101 
102  //layout and display window
103  fMain->MapSubwindows();
104  fMain->Resize(fMain->GetDefaultSize());
105 
106  // position relative to the parent's window
107  fMain->CenterOnParent();
108 
109  fMain->SetWindowName("Masses Identification");
110  fMain->MapWindow();
111 
112 
113 }
114 
115 
116 
123 
125 {
126  // Copy constructor
127  // This ctor is used to make a copy of an existing object (for example
128  // when a method returns an object), and it is always a good idea to
129  // implement it.
130  // If your class allocates memory in its constructor(s) then it is ESSENTIAL :-)
131 
132 }
133 
134 
135 
138 
140 {
141  // Destructor
142 }
143 
144 
145 
147 
149 {
150  TTimer::SingleShot(150, "KVZAFinderDialog", this, "CloseWindow()");
151 }
152 
153 
154 
156 
158 {
159  delete fMain;
160  delete this;
161 }
162 
163 
164 
166 
168 {
171  fAList = fAEntry->GetText();
172 
173  Int_t zmin = ((KVIDentifier*)fGrid->GetIdentifiers()->First())->GetPID();
174  if (fZmin < zmin) fZmin = zmin;
175  Int_t zmax = ((KVIDentifier*)fGrid->GetIdentifiers()->Last())->GetPID();
176  if (fZmax > zmax) fZmax = zmax;
177 
179 
180 // fLinearBar->SetRange(0, ((TH2F*)fHisto)->GetSum());
181 // fLinearBar->SetRange(0, fHisto->GetNbinsX()*fHisto->GetNbinsY());
182 // fLinearBar->Reset();
183 // toto.Connect("IncrementLinear(Float_t)","TGHProgressBar",
184 // fLinearBar, "SetPosition(Float_t)");
185  fProgressBar->SetRange(0, zmax - zmin);
186  fProgressBar->Reset();
187  toto.Connect("Increment(Float_t)", "TGHProgressBar",
188  fProgressBar, "SetPosition(Float_t)");
189 
190  toto.SetAList(fAList.Data());
191  toto.SetNbinsByZ(fBinsByZ);
192 
195 
199 
200  toto.Disconnect("IncrementLinear(Float_t)",
201  fLinearBar, "SetPosition(Float_t)");
202  toto.Disconnect("Increment(Float_t)",
203  fProgressBar, "SetPosition(Float_t)");
204 
205 
206  if (!gIDGridEditor) {
207  new KVIDGridEditor;
209  }
210 
213 
214  DoClose();
215 }
216 
217 
int Int_t
KVIDGridEditor * gIDGridEditor
ClassImp(KVPartitionList) void KVPartitionList
Initialisation.
const Bool_t kFALSE
const Bool_t kTRUE
#define gClient
kDeepCleanup
kLHintsLeft
kLHintsCenterY
kLHintsCenterX
kLHintsTop
kLHintsExpandX
Base class for particle identification in a 2D map.
Definition: KVIDGraph.h:31
const KVList * GetIdentifiers() const
Definition: KVIDGraph.h:297
Identification grid editor GUI ,.
void SetGrid(KVIDGraph *gg, Bool_t histo=true)
void StartViewer()
Close();.
void SetHisto(TH2 *hh)
Identification grid with lines corresponding to different nuclear isotopes (KVIDZALine)
Definition: KVIDZAGrid.h:65
Base class for graphical cuts used in particle identification.
Definition: KVIDentifier.h:27
virtual TObject * Last() const
virtual TObject * First() const
Dialog box for KVZALineFinder class.
TGNumberEntry * fZminEntry
TGHProgressBar * fLinearBar
TGTextButton * fCloseButton
TGTextButton * fTestButton
virtual ~KVZAFinderDialog()
Destructor.
static Int_t fZmax
static Int_t fBinsByZ
static Int_t fZmin
TGNumberEntry * fZmaxEntry
static TString fAList
TGTransientFrame * fMain
TGTextEntry * fAEntry
TGHProgressBar * fProgressBar
KVZAFinderDialog(KVIDGraph *g=0, TH2 *data_histo=0)
static Int_t fStepsByLine
(try to) find mass lines from charge lines
void SetNbinsByZ(Int_t binByZ)
KVIDZAGrid * GetGrid()
void SetAList(const char *Alist)
void ProcessIdentification(Int_t zmin=-1, Int_t zmax=-1)
virtual void SetEnabled(Bool_t e=kTRUE)
virtual Long_t GetIntNumber() const
void SetRange(Float_t min, Float_t max)
virtual void Reset()
const char * GetText() const
const char * Data() const
static void SingleShot(Int_t milliSec, const char *receiver_class, void *receiver, const char *method)
const long double g
masses
Definition: KVUnits.h:72