KaliVeda
Toolkit for HIC analysis
Loading...
Searching...
No Matches
KVTestIDGridDialog.cpp
1#include "KVTestIDGridDialog.h"
2#include "Riostream.h"
3#include "KVIDGridManager.h"
4#include "TGFileDialog.h"
5#include "TPad.h"
6#include <TGMsgBox.h>
7#include <TTimer.h>
8#include <TClass.h>
9#include <TROOT.h>
10#include <TGLayout.h>
11#include <TCanvas.h>
12#include "KVConfig.h"
13#include "KVNucleus.h"
14#include "TStyle.h"
15#include "TBox.h"
16#include "TLine.h"
17#include "KVNuclearChart.h"
18#include "KVIdentificationResult.h"
19#include "KVIDZAFromZGrid.h"
20
36
38
40 const TGWindow* main, UInt_t w,
41 UInt_t h, KVIDGraph* g, TH2* data_histo)
42{
43 if (data_histo) {
44 fNameData.Form("%s", data_histo->GetName());
45 fNameZreal.Form("PID:H=%s_G=%s", data_histo->GetName(), g->GetName());
46 fNameZvsE.Form("PIDvsEres:H=%s_G=%s", data_histo->GetName(), g->GetName());
47 hzvsexmax = data_histo->GetXaxis()->GetXmax();
48 hzvsdexmax = data_histo->GetYaxis()->GetXmax();
49 }
50 // set PID limits from grid
51 g->GetIdentifiers()->Sort(); // make sure lines are in order of increasing PID
52 hzrealxmin = ((KVIDentifier*)g->GetIdentifiers()->First())->GetPID() - 1.0;
53 hzrealxmax = ((KVIDentifier*)g->GetIdentifiers()->Last())->GetPID() + 1.0;
54 hzvseymin = hzrealxmin;
55 hzvseymax = hzrealxmax;
56
57 if (g->HasMassIDCapability() && !g->InheritsFrom("KVIDZAFromZGrid")) {// KLUDGE! replaces if(!g->IsOnlyZId()) {
58 hzrealbins = 150 * (hzrealxmax - hzrealxmin);
59 hzvseybins = hzrealbins;
60 }
61
62 //Dialog box for testing identification grid
63 fMain = new TGTransientFrame(p, main, w, h);
64 fMain->Connect("CloseWindow()", "KVTestIDGridDialog", this,
65 "DoClose()");
66 fMain->DontCallClose(); // to avoid double deletions.
67
68 fSelectedGrid = g;
69 // use hierarchical cleaning
70 fMain->SetCleanup(kDeepCleanup);
71
72 int tw = 30;
73
74 /******* frame for name of data histo ********/
75 fHdataFrame = new TGHorizontalFrame(fMain);
76 fHdataNameLabel = new TGLabel(fHdataFrame, "Name of data histo (TH2F)");
77 fHdataNameEntry = new TGTextEntry(fNameData, fHdataFrame);
78 fHdataNameEntry->SetWidth(150);
79
80 fHdataFrame->AddFrame(fHdataNameEntry, new TGLayoutHints(kLHintsRight, 5, 5, 2, 2));
81 fHdataFrame->AddFrame(fHdataNameLabel, new TGLayoutHints(kLHintsRight, 5, 5, 2, 2));
82
83 /******* frame for Zreal histo **************/
84 fHzrealFrame = new TGGroupFrame(fMain, "ID test histo");
85 fHzrealNameFrame = new TGHorizontalFrame(fHzrealFrame);
86 fHzrealNameLabel = new TGLabel(fHzrealNameFrame, "Name of PID histo (TH1F)");
87 fHzrealNameEntry = new TGTextEntry(fNameZreal, fHzrealNameFrame);
88 fHzrealNameEntry->SetWidth(150);
89
90 fHzrealNameFrame->AddFrame(fHzrealNameEntry, new TGLayoutHints(kLHintsRight, 5, 5, 2, 2));
91 fHzrealNameFrame->AddFrame(fHzrealNameLabel, new TGLayoutHints(kLHintsLeft, 5, 5, 2, 2));
92
93 fHzrealBinsFrame = new TGHorizontalFrame(fHzrealFrame);
94
95 fHzrealBinsLabel = new TGLabel(fHzrealBinsFrame, "nbins");
96 fHzrealBinsLabel->ChangeOptions(fHzrealBinsLabel->GetOptions() | kFixedSize);
97 fHzrealBinsLabel->Resize(60, fHzrealBinsLabel->GetHeight());
98 fHzrealBinsLabel->SetTextJustify(kTextRight);
99 fHzrealBinsEntry = new TGNumberEntry(fHzrealBinsFrame, hzrealbins, 4, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEAPositive);
100 fHzrealXminLabel = new TGLabel(fHzrealBinsFrame, "xmin");
101 fHzrealXminLabel->ChangeOptions(fHzrealXminLabel->GetOptions() | kFixedSize);
102 fHzrealXminLabel->Resize(tw, fHzrealXminLabel->GetHeight());
103 fHzrealXminLabel->SetTextJustify(kTextRight);
104 fHzrealXminEntry = new TGNumberEntry(fHzrealBinsFrame, hzrealxmin, 4, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEAPositive);
105 fHzrealXmaxLabel = new TGLabel(fHzrealBinsFrame, "xmax");
106 fHzrealXmaxLabel->ChangeOptions(fHzrealXmaxLabel->GetOptions() | kFixedSize);
107 fHzrealXmaxLabel->Resize(tw, fHzrealXmaxLabel->GetHeight());
108 fHzrealXmaxLabel->SetTextJustify(kTextRight);
109 fHzrealXmaxEntry = new TGNumberEntry(fHzrealBinsFrame, hzrealxmax, 4, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEAPositive);
110
111 fHzrealBinsFrame->AddFrame(fHzrealXmaxEntry, new TGLayoutHints(kLHintsRight, 5, 5, 2, 2));
112 fHzrealBinsFrame->AddFrame(fHzrealXmaxLabel, new TGLayoutHints(kLHintsRight, 5, 5, 2, 2));
113 fHzrealBinsFrame->AddFrame(fHzrealXminEntry, new TGLayoutHints(kLHintsRight, 5, 5, 2, 2));
114 fHzrealBinsFrame->AddFrame(fHzrealXminLabel, new TGLayoutHints(kLHintsRight, 5, 5, 2, 2));
115 fHzrealBinsFrame->AddFrame(fHzrealBinsEntry, new TGLayoutHints(kLHintsRight, 5, 5, 2, 2));
116 fHzrealBinsFrame->AddFrame(fHzrealBinsLabel, new TGLayoutHints(kLHintsRight, 5, 5, 2, 2));
117
118 fHzrealFrame->AddFrame(fHzrealNameFrame, new TGLayoutHints(kLHintsExpandX, 5, 5, 2, 2));
119 fHzrealFrame->AddFrame(fHzrealBinsFrame, new TGLayoutHints(kLHintsExpandX, 5, 5, 2, 2));
120
121 /******* frame for ZvsE histo **************/
122 fHzvseFrame = new TGGroupFrame(fMain, "PID vs. E histo");
123
124 fHzvseNameFrame = new TGHorizontalFrame(fHzvseFrame);
125 fHzvseNameLabel = new TGLabel(fHzvseNameFrame, "Name of histo (TH2F)");
126 fHzvseNameEntry = new TGTextEntry(fNameZvsE, fHzvseNameFrame);
127 fHzvseNameEntry->SetWidth(150);
128 fHzvseNameFrame->AddFrame(fHzvseNameEntry, new TGLayoutHints(kLHintsRight, 5, 5, 2, 2));
129 fHzvseNameFrame->AddFrame(fHzvseNameLabel, new TGLayoutHints(kLHintsLeft, 5, 5, 2, 2));
130
131 fHzvseXBinsFrame = new TGHorizontalFrame(fHzvseFrame);
132 fHzvseXBinsLabel = new TGLabel(fHzvseXBinsFrame, "E : nbins");
133 fHzvseXBinsLabel->ChangeOptions(fHzvseXBinsLabel->GetOptions() | kFixedSize);
134 fHzvseXBinsLabel->Resize(60, fHzvseXBinsLabel->GetHeight());
135 fHzvseXBinsLabel->SetTextJustify(kTextRight);
136 fHzvseXBinsEntry = new TGNumberEntry(fHzvseXBinsFrame, hzvsexbins, 4, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEAPositive);
137 fHzvseXminLabel = new TGLabel(fHzvseXBinsFrame, "min");
138 fHzvseXminLabel->ChangeOptions(fHzvseXminLabel->GetOptions() | kFixedSize);
139 fHzvseXminLabel->Resize(tw, fHzvseXminLabel->GetHeight());
140 fHzvseXminLabel->SetTextJustify(kTextRight);
141 fHzvseXminEntry = new TGNumberEntry(fHzvseXBinsFrame, hzvsexmin, 4, 0, TGNumberFormat::kNESReal);
142 fHzvseXmaxLabel = new TGLabel(fHzvseXBinsFrame, "max");
143 fHzvseXmaxLabel->ChangeOptions(fHzvseXmaxLabel->GetOptions() | kFixedSize);
144 fHzvseXmaxLabel->Resize(tw, fHzvseXmaxLabel->GetHeight());
145 fHzvseXmaxLabel->SetTextJustify(kTextRight);
146 fHzvseXmaxEntry = new TGNumberEntry(fHzvseXBinsFrame, hzvsexmax, 5, 0, TGNumberFormat::kNESReal);
147
148 fHzvseXBinsFrame->AddFrame(fHzvseXmaxEntry, new TGLayoutHints(kLHintsRight, 5, 5, 2, 2));
149 fHzvseXBinsFrame->AddFrame(fHzvseXmaxLabel, new TGLayoutHints(kLHintsRight, 5, 5, 2, 2));
150 fHzvseXBinsFrame->AddFrame(fHzvseXminEntry, new TGLayoutHints(kLHintsRight, 5, 5, 2, 2));
151 fHzvseXBinsFrame->AddFrame(fHzvseXminLabel, new TGLayoutHints(kLHintsRight, 5, 5, 2, 2));
152 fHzvseXBinsFrame->AddFrame(fHzvseXBinsEntry, new TGLayoutHints(kLHintsRight, 5, 5, 2, 2));
153 fHzvseXBinsFrame->AddFrame(fHzvseXBinsLabel, new TGLayoutHints(kLHintsRight, 5, 5, 2, 2));
154
155 // DE
156 fHzvsdeXBinsFrame = new TGHorizontalFrame(fHzvseFrame);
157 fHzvsdeXBinsLabel = new TGLabel(fHzvsdeXBinsFrame, "DE : nbins");
158 fHzvsdeXBinsLabel->ChangeOptions(fHzvsdeXBinsLabel->GetOptions() | kFixedSize);
159 fHzvsdeXBinsLabel->Resize(60, fHzvsdeXBinsLabel->GetHeight());
160 fHzvsdeXBinsLabel->SetTextJustify(kTextRight);
161 fHzvsdeXBinsEntry = new TGNumberEntry(fHzvsdeXBinsFrame, hzvsdexbins, 4, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEAPositive);
162 fHzvsdeXminLabel = new TGLabel(fHzvsdeXBinsFrame, "min");
163 fHzvsdeXminLabel->ChangeOptions(fHzvsdeXminLabel->GetOptions() | kFixedSize);
164 fHzvsdeXminLabel->Resize(tw, fHzvsdeXminLabel->GetHeight());
165 fHzvsdeXminLabel->SetTextJustify(kTextRight);
166 fHzvsdeXminEntry = new TGNumberEntry(fHzvsdeXBinsFrame, hzvsexmin, 4, 0, TGNumberFormat::kNESReal);
167 fHzvsdeXmaxLabel = new TGLabel(fHzvsdeXBinsFrame, "max");
168 fHzvsdeXmaxLabel->ChangeOptions(fHzvsdeXmaxLabel->GetOptions() | kFixedSize);
169 fHzvsdeXmaxLabel->Resize(tw, fHzvsdeXmaxLabel->GetHeight());
170 fHzvsdeXmaxLabel->SetTextJustify(kTextRight);
171 fHzvsdeXmaxEntry = new TGNumberEntry(fHzvsdeXBinsFrame, hzvsdexmax, 5, 0, TGNumberFormat::kNESReal);
172
173 fHzvsdeXBinsFrame->AddFrame(fHzvsdeXmaxEntry, new TGLayoutHints(kLHintsRight, 5, 5, 2, 2));
174 fHzvsdeXBinsFrame->AddFrame(fHzvsdeXmaxLabel, new TGLayoutHints(kLHintsRight, 5, 5, 2, 2));
175 fHzvsdeXBinsFrame->AddFrame(fHzvsdeXminEntry, new TGLayoutHints(kLHintsRight, 5, 5, 2, 2));
176 fHzvsdeXBinsFrame->AddFrame(fHzvsdeXminLabel, new TGLayoutHints(kLHintsRight, 5, 5, 2, 2));
177 fHzvsdeXBinsFrame->AddFrame(fHzvsdeXBinsEntry, new TGLayoutHints(kLHintsRight, 5, 5, 2, 2));
178 fHzvsdeXBinsFrame->AddFrame(fHzvsdeXBinsLabel, new TGLayoutHints(kLHintsRight, 5, 5, 2, 2));
179 //
180
181 fHzvseYBinsFrame = new TGHorizontalFrame(fHzvseFrame);
182 fHzvseYBinsLabel = new TGLabel(fHzvseYBinsFrame, "PID: nbins");
183 fHzvseYBinsLabel->ChangeOptions(fHzvseYBinsLabel->GetOptions() | kFixedSize);
184 fHzvseYBinsLabel->Resize(60, fHzvseYBinsLabel->GetHeight());
185 fHzvseYBinsLabel->SetTextJustify(kTextRight);
186 fHzvseYBinsEntry = new TGNumberEntry(fHzvseYBinsFrame, hzvseybins, 4, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEAPositive);
187 fHzvseYminLabel = new TGLabel(fHzvseYBinsFrame, "min");
188 fHzvseYminLabel->ChangeOptions(fHzvseYminLabel->GetOptions() | kFixedSize);
189 fHzvseYminLabel->Resize(tw, fHzvseYminLabel->GetHeight());
190 fHzvseYminLabel->SetTextJustify(kTextRight);
191 fHzvseYminEntry = new TGNumberEntry(fHzvseYBinsFrame, hzvseymin, 4, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEAPositive);
192 fHzvseYmaxLabel = new TGLabel(fHzvseYBinsFrame, "max");
193 fHzvseYmaxLabel->ChangeOptions(fHzvseYmaxLabel->GetOptions() | kFixedSize);
194 fHzvseYmaxLabel->Resize(tw, fHzvseYmaxLabel->GetHeight());
195 fHzvseYmaxLabel->SetTextJustify(kTextRight);
196 fHzvseYmaxEntry = new TGNumberEntry(fHzvseYBinsFrame, hzvseymax, 5, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEAPositive);
197
198 fHzvseYBinsFrame->AddFrame(fHzvseYmaxEntry, new TGLayoutHints(kLHintsRight, 5, 5, 2, 2));
199 fHzvseYBinsFrame->AddFrame(fHzvseYmaxLabel, new TGLayoutHints(kLHintsRight, 5, 5, 2, 2));
200 fHzvseYBinsFrame->AddFrame(fHzvseYminEntry, new TGLayoutHints(kLHintsRight, 5, 5, 2, 2));
201 fHzvseYBinsFrame->AddFrame(fHzvseYminLabel, new TGLayoutHints(kLHintsRight, 5, 5, 2, 2));
202 fHzvseYBinsFrame->AddFrame(fHzvseYBinsEntry, new TGLayoutHints(kLHintsRight, 5, 5, 2, 2));
203 fHzvseYBinsFrame->AddFrame(fHzvseYBinsLabel, new TGLayoutHints(kLHintsRight, 5, 5, 2, 2));
204
205 fHzvseFrame->AddFrame(fHzvseNameFrame, new TGLayoutHints(kLHintsExpandX, 5, 5, 2, 2));
206 fHzvseFrame->AddFrame(fHzvseXBinsFrame, new TGLayoutHints(kLHintsExpandX, 5, 5, 2, 2));
207 fHzvseFrame->AddFrame(fHzvsdeXBinsFrame, new TGLayoutHints(kLHintsExpandX, 5, 5, 2, 2));
208 fHzvseFrame->AddFrame(fHzvseYBinsFrame, new TGLayoutHints(kLHintsExpandX, 5, 5, 2, 2));
209
210 /********** progress bar **********/
211 fProgressBar = new TGHProgressBar(fMain, TGProgressBar::kFancy, 300);
212 fProgressBar->SetFillType(TGProgressBar::kBlockFill);
213 fProgressBar->ShowPosition();
214 fProgressBar->SetBarColor("red");
215
216 /************buttons***************/
217 fButtonsFrame = new TGHorizontalFrame(fMain, 100, 50);
218 fTestButton = new TGTextButton(fButtonsFrame, "&Test");
219 fTestButton->Connect("Clicked()", "KVTestIDGridDialog", this,
220 "TestGrid()");
221 fCloseButton = new TGTextButton(fButtonsFrame, "&Close");
222 fCloseButton->Connect("Clicked()", "KVTestIDGridDialog", this,
223 "DoClose()");
224
225 fButtonsFrame->AddFrame(fTestButton,
228 kLHintsCenterY, 2, 2, 5, 5));
229 fButtonsFrame->AddFrame(fCloseButton,
232 kLHintsCenterY, 2, 2, 5, 5));
233
234 fMain->AddFrame(fHdataFrame,
236 5));
237 fMain->AddFrame(fHzrealFrame,
238 new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 5,
239 5));
240 fMain->AddFrame(fHzvseFrame,
242 10));
243 fMain->AddFrame(fProgressBar,
245 5));
246 fMain->AddFrame(fButtonsFrame,
248 5));
249
250 //layout and display window
251 fMain->MapSubwindows();
252 fMain->Resize(fMain->GetDefaultSize());
253
254 // position relative to the parent's window
255 fMain->CenterOnParent();
256
257 fMain->SetWindowName("Test ID grid");
258 fMain->MapWindow();
259
260 // clean up results histograms
261 histos.SetOwner();
262}
263
265{
266 TTimer::SingleShot(150, "KVTestIDGridDialog", this, "CloseWindow()");
267}
268
270{
271 delete this;
272}
273
275{
276 //Delete all widgets
277
279 delete fMain;
280}
281
283{
284 //read current values of all fields, find/create the histograms,
285 //and test the identification
286
290
292 || !CheckNameOK(fNameZvsE)) {
293
294 new TGMsgBox(gClient->GetRoot(), fMain, "Test ID Grid",
295 "Give a valid name for each histo", kMBIconExclamation);
296 return;
297 }
298
302
306
310
311
315
316 Int_t hnmin = ((KVIDentifier*)fSelectedGrid->GetIdentifiers()->First())->GetA() - ((KVIDentifier*)fSelectedGrid->GetIdentifiers()->First())->GetZ() - 1.0;
317 Int_t hnmax = ((KVIDentifier*)fSelectedGrid->GetIdentifiers()->Last())->GetA() - ((KVIDentifier*)fSelectedGrid->GetIdentifiers()->Last())->GetZ() + 1.0;
318 Int_t hamin = ((KVIDentifier*)fSelectedGrid->GetIdentifiers()->First())->GetA();
319 Int_t hamax = ((KVIDentifier*)fSelectedGrid->GetIdentifiers()->Last())->GetA();
320 Int_t hzmin = ((KVIDentifier*)fSelectedGrid->GetIdentifiers()->First())->GetZ();
321 Int_t hzmax = ((KVIDentifier*)fSelectedGrid->GetIdentifiers()->Last())->GetZ();
322 if (fSelectedGrid->InheritsFrom("KVIDZAFromZGrid")) {
323 KVList* is_list = ((KVIDZAFromZGrid*)fSelectedGrid)->GetIntervalSets();
324 if (is_list && is_list->GetEntries()) {
325 KVList* iv_list = ((interval_set*)is_list->Last())->GetIntervals();
326 if (iv_list && iv_list->GetEntries()) {
327 interval* itv = (interval*)iv_list->Last();
328 hnmax = itv->GetA() - itv->GetZ();
329 hamax = itv->GetA();
330 hzmax = itv->GetZ();
331 itv = (interval*)((interval_set*)is_list->First())->GetIntervals()->First();
332 if (itv) {
333 hamin = itv->GetA();
334 hzmin = itv->GetZ();
335 }
336 }
337 }
338 }
339
340 TH2F* hdata = (TH2F*) gROOT->FindObject(fNameData.Data());
341 if (!hdata) {
342
343 new TGMsgBox(gClient->GetRoot(), fMain, "Test ID Grid",
344 "Check name of data histogram", kMBIconExclamation);
345 return;
346 }
347
348 KVNameValueList histo_names;
349
350 // clear any previous results
351 histos.Clear();
352
353 // make results histograms
354 auto hzreal =
355 new TH1F(fNameZreal.Data(), "PID distribution", hzrealbins,
357 add_histo(hzreal);
358 histo_names.SetValue("ID_REAL", fNameZreal.Data());
359
360 auto hzvse =
361 new TH2F(fNameZvsE.Data(), "PID vs. E_{res}", hzvsexbins, hzvsexmin,
363
364 histo_names.SetValue("ID_REAL_VS_ERES", fNameZvsE.Data());
365 add_histo(hzvse);
366
367 auto hzvsde =
368 new TH2F("ID_REAL_VS_DE", "PID vs. #Delta E", hzvsdexbins, hzvsdexmin,
370
371 histo_names.SetValue("ID_REAL_VS_DE", "ID_REAL_VS_DE");
372 add_histo(hzvsde);
373
374
375 // A vs Z map in case of mass identification
376 // A dist for isotopically identified particles
378
379 // make sure to always begin from Z=1 N=0
380 hnmin = 0;
381 auto mapzrealxmin = 0;
382 auto hazreal = new TH2F("AZMap", "N vs. Z [Z&A identified]", 30 * (hnmax - hnmin + 1.5), hnmin - 0.5, hnmax + 2, 30 * (hzrealxmax - mapzrealxmin + 1), mapzrealxmin - 1, hzrealxmax + 1);
383
384 histo_names.SetValue("Z_A_REAL", "AZMap");
385 add_histo(hazreal);
386
387 auto adist_aident = new TH2F("ZADIST_AIDENT", "A vs. Z distribution [Z&A identified]", hzmax - hzmin + 1, hzmin - .5, hzmax + .5, hamax - hamin + 1, hamin - .5, hamax + .5);
388 histo_names.SetValue("ZADIST_AIDENT", "ZADIST_AIDENT");
389 add_histo(adist_aident);
390
391 auto hzreal_aident = new TH1F("ID_REAL_AIDENT", "PID distribution [Z&A identified]",
393 histo_names.SetValue("ID_REAL_AIDENT", "ID_REAL_AIDENT");
394 add_histo(hzreal_aident);
395
396 auto hzreal_zident = new TH1F("ID_REAL_ZIDENT", "PID distribution [only Z identified]",
398 histo_names.SetValue("ID_REAL_ZIDENT", "ID_REAL_ZIDENT");
399 add_histo(hzreal_zident);
400
401 auto hzvse =
402 new TH2F(fNameZvsE.Data(), "PID vs. E_{res}", hzvsexbins, hzvsexmin,
404
405 histo_names.SetValue("ID_REAL_VS_ERES", fNameZvsE.Data());
406 add_histo(hzvse);
407
408 auto hzvse_aident =
409 new TH2F("ID_REAL_VS_ERES_AIDENT", "PID vs. E_{res} [Z&A identified]", hzvsexbins, hzvsexmin,
411
412 histo_names.SetValue("ID_REAL_VS_ERES_AIDENT", "ID_REAL_VS_ERES_AIDENT");
413 add_histo(hzvse_aident);
414
415 auto hzvse_zident =
416 new TH2F("ID_REAL_VS_ERES_ZIDENT", "PID vs. E_{res} [only Z identified]", hzvsexbins, hzvsexmin,
418
419 histo_names.SetValue("ID_REAL_VS_ERES_ZIDENT", "ID_REAL_VS_ERES_ZIDENT");
420 add_histo(hzvse_zident);
421
422
423
424 auto hzvsde_aident =
425 new TH2F("ID_REAL_VS_DE_AIDENT", "PID vs. #Delta E [Z&A identified]", hzvsexbins, hzvsdexmin,
427
428 histo_names.SetValue("ID_REAL_VS_DE_AIDENT", "ID_REAL_VS_DE_AIDENT");
429 add_histo(hzvsde_aident);
430
431 auto hzvsde_zident =
432 new TH2F("ID_REAL_VS_DE_ZIDENT", "PID vs. #Delta E [only Z identified]", hzvsexbins, hzvsdexmin,
434
435 histo_names.SetValue("ID_REAL_VS_DE_ZIDENT", "ID_REAL_VS_DE_ZIDENT");
436 add_histo(hzvsde_zident);
437
438
439 }
440
441 //progress bar set up
442 fProgressBar->SetRange(0, hdata->GetSum());
444 fSelectedGrid->Connect("Increment(Float_t)", "TGHProgressBar",
445 fProgressBar, "SetPosition(Float_t)");
446#ifdef __WITHOUT_TGBUTTON_SETENABLED
447#define SetEnabled(flag) \
448 SetState( flag ? kButtonUp : kButtonDisabled )
449#endif
452 fSelectedGrid->TestIdentification(hdata, histos, histo_names);
455#ifdef __WITHOUT_TGBUTTON_SETENABLED
456#undef SetEnabled
457#endif
458 fSelectedGrid->Disconnect("Increment(Float_t)", fProgressBar,
459 "SetPosition(Float_t)");
461
462 TCanvas* cc = new TCanvas;
463 resultsCanvas.reset(cc);
464
465 gStyle->SetOptTitle(); // display histo title in pads
466
468 cc->Divide(3, 3);
469 cc->SetWindowPosition(100, 100);
470 cc->SetWindowSize(1500, 1300);
471 }
472 else {
473 cc->Divide(3, 1);
474 cc->SetWindowPosition(100, 100);
475 cc->SetWindowSize(1500, 500);
476 }
477
478 int ipad = 1;
479
480 // show results in canvas
481 auto pad = cc->cd(ipad++);
482 pad->SetGridx();
483 pad->SetGridy();
484 hzreal->SetStats(kFALSE);
485 hzreal->Draw("hist");
486 pad->Modified();
487 pad->Update();
488
489 pad = cc->cd(ipad++);
490 pad->SetLogz(kTRUE);
491 pad->SetGridx();
492 pad->SetGridy();
493 hzvse->SetStats(kFALSE);
494 hzvse->Draw("zcol");
495 pad->Modified();
496 pad->Update();
497
498 pad = cc->cd(ipad++);
499 pad->SetLogz(kTRUE);
500 pad->SetGridx();
501 pad->SetGridy();
502 hzvse = histos.get_object<TH2F>("ID_REAL_VS_DE");
503 hzvse->SetStats(kFALSE);
504 hzvse->Draw("zcol");
505 pad->Modified();
506 pad->Update();
507
509 pad = cc->cd(ipad++);
510 pad->SetGridx();
511 pad->SetGridy();
512 hzreal = histos.get_object<TH1F>("ID_REAL_AIDENT");
513 hzreal->SetStats(kFALSE);
514 hzreal->Draw("hist");
515 pad->Modified();
516 pad->Update();
517
518 pad = cc->cd(ipad++);
519 pad->SetLogz(kTRUE);
520 pad->SetGridx();
521 pad->SetGridy();
522 hzvse = histos.get_object<TH2F>("ID_REAL_VS_ERES_AIDENT");
523 hzvse->SetStats(kFALSE);
524 hzvse->Draw("zcol");
525 pad->Modified();
526 pad->Update();
527
528 pad = cc->cd(ipad++);
529 pad->SetLogz(kTRUE);
530 pad->SetGridx();
531 pad->SetGridy();
532 hzvse = histos.get_object<TH2F>("ID_REAL_VS_DE_AIDENT");
533 hzvse->SetStats(kFALSE);
534 hzvse->Draw("zcol");
535 pad->Modified();
536 pad->Update();
537
538 pad = cc->cd(ipad++);
539 pad->SetGridx();
540 pad->SetGridy();
541 hzreal = histos.get_object<TH1F>("ID_REAL_ZIDENT");
542 hzreal->SetStats(kFALSE);
543 hzreal->Draw("hist");
544 pad->Modified();
545 pad->Update();
546
547 pad = cc->cd(ipad++);
548 pad->SetLogz(kTRUE);
549 pad->SetGridx();
550 pad->SetGridy();
551 hzvse = histos.get_object<TH2F>("ID_REAL_VS_ERES_ZIDENT");
552 hzvse->SetStats(kFALSE);
553 hzvse->Draw("zcol");
554 pad->Modified();
555 pad->Update();
556
557 pad = cc->cd(ipad++);
558 pad->SetLogz(kTRUE);
559 pad->SetGridx();
560 pad->SetGridy();
561 hzvse = histos.get_object<TH2F>("ID_REAL_VS_DE_ZIDENT");
562 hzvse->SetStats(kFALSE);
563 hzvse->Draw("zcol");
564 pad->Modified();
565 pad->Update();
566
567 auto kvc = new KVCanvas;
568 resultsKVCanvas.reset(kvc);
569 kvc->SetWindowPosition(1000, 100);
570 kvc->SetWindowSize(900, 900);
571 kvc->SetLogz();
572 auto hazreal = histos.get_object<TH2F>("AZMap");
573 hazreal->Draw("col");
574
575 TAxis* ax = 0;
576 ax = hazreal->GetXaxis();
577 ax->SetNdivisions(000);
578 ax->SetLabelOffset(-0.04);
579 ax->SetTickLength(0);
580
581 ax = hazreal->GetYaxis();
582 ax->SetNdivisions(000);
583 ax->SetLabelOffset(-0.03);
584 ax->SetTickLength(0);
585 hazreal->SetMinimum(1);
586 DrawChart(kvc, -1, hzrealxmax, -1, hnmax + 2);
587 kvc->Modified();
588 kvc->Update();
589 }
590
591}
592
593
595{
596 Double_t marging = 0.001;
597 pp->SetTopMargin(marging);
598 pp->SetRightMargin(marging);
599 pp->SetBottomMargin(marging);
600 pp->SetLeftMargin(marging);
601
602 KVNuclearChart* nucChar = new KVNuclearChart(nmin + 1, nmax, zmin, zmax);
603 nucChar->SetShowSymbol();
604 nucChar->Draw("same");
605
606 return;
607}
608
609
610
611
612
613
614
615
int Int_t
unsigned int UInt_t
kFixedSize
constexpr Bool_t kFALSE
double Double_t
constexpr Bool_t kTRUE
#define gClient
kDeepCleanup
kLHintsRight
kLHintsLeft
kLHintsCenterY
kLHintsCenterX
kLHintsTop
kLHintsExpandX
kMBIconExclamation
kTextRight
winID w
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t g
#define gROOT
R__EXTERN TStyle * gStyle
TCanvas with mouse-controlled dynamic zoom and pan & scan.
Definition KVCanvas.h:54
Base class for particle identification in a 2D map.
Definition KVIDGraph.h:32
virtual void TestIdentification(TH2F *data, KVHashList &histos, KVNameValueList &histo_names)
virtual Bool_t HasMassIDCapability() const
Definition KVIDGraph.h:169
const KVList * GetIdentifiers() const
Definition KVIDGraph.h:298
Hybrid charge & mass identification grid.
Base class for graphical cuts used in particle identification.
Extended TList class which owns its objects by default.
Definition KVList.h:28
Handles lists of named parameters with different types, a list of KVNamedParameter objects.
void SetValue(const Char_t *name, value_type value)
Used to draw nuclear chart.
void SetShowSymbol(Int_t value=1)
void Draw(Option_t *option="")
virtual void Clear(Option_t *option="")
virtual TObject * Last() const
virtual TObject * First() const
T * get_object(const TString &name) const
GUI for testing identification grids.
static TString fNameZvsE
TGNumberEntry * fHzvsdeXBinsEntry
std::unique_ptr< KVCanvas > resultsKVCanvas
static Double_t hzvsdexmin
TGNumberEntry * fHzrealXminEntry
TGNumberEntry * fHzvseXmaxEntry
TGTextButton * fTestButton
TGNumberEntry * fHzvseYmaxEntry
TGTextEntry * fHdataNameEntry
TGHProgressBar * fProgressBar
TGNumberEntry * fHzvseXBinsEntry
void DrawChart(TVirtualPad *cc, Int_t zmin, Int_t zmax, Int_t nmin, Int_t nmax)
TGTextEntry * fHzvseNameEntry
Bool_t CheckNameOK(const TString &name)
TGNumberEntry * fHzrealXmaxEntry
TGNumberEntry * fHzvseXminEntry
TGNumberEntry * fHzvsdeXminEntry
static Double_t hzvsexmax
static TString fNameData
TGNumberEntry * fHzvseYminEntry
TGTextEntry * fHzrealNameEntry
TGTransientFrame * fMain
std::unique_ptr< TCanvas > resultsCanvas
TGNumberEntry * fHzvsdeXmaxEntry
TGNumberEntry * fHzvseYBinsEntry
static Double_t hzvsexmin
static TString fNameZreal
TGTextButton * fCloseButton
static Double_t hzvsdexmax
TGNumberEntry * fHzrealBinsEntry
Stat_t GetSum() const
virtual void SetLabelOffset(Float_t offset=0.005)
virtual void SetNdivisions(Int_t n1, Int_t n2, Int_t n3, Bool_t optim=kTRUE)
virtual void SetTickLength(Float_t length=0.03)
virtual void SetBottomMargin(Float_t bottommargin)
virtual void SetLeftMargin(Float_t leftmargin)
virtual void SetRightMargin(Float_t rightmargin)
virtual void SetTopMargin(Float_t topmargin)
void SetWindowPosition(Int_t x, Int_t y)
virtual Int_t GetEntries() const
virtual void SetEnabled(Bool_t e=kTRUE)
virtual Long_t GetIntNumber() const
virtual Double_t GetNumber() const
void SetRange(Float_t min, Float_t max)
virtual void Reset()
const char * GetText() const
void Draw(Option_t *option="") override
virtual void SetStats(Bool_t stats=kTRUE)
virtual Bool_t InheritsFrom(const char *classname) const
const char * Data() const
void SetOptTitle(Int_t tit=1)
static void SingleShot(Int_t milliSec, const char *receiver_class, void *receiver, const char *method)
int main()
TH1 * h
ClassImp(TPyArg)