1 #include "KVTestIDGridDialog.h"
3 #include "KVIDGridManager.h"
13 #include "KVNucleus.h"
17 #include "KVNuclearChart.h"
18 #include "KVIdentificationResult.h"
19 #include "KVIDZAFromZGrid.h"
21 TString KVTestIDGridDialog::fNameData =
"htemp";
22 TString KVTestIDGridDialog::fNameZreal =
"hzreal";
23 TString KVTestIDGridDialog::fNameZvsE =
"hzvse";
24 Int_t KVTestIDGridDialog::hzrealbins = 1500;
25 Int_t KVTestIDGridDialog::hzrealxmin = 0;
26 Int_t KVTestIDGridDialog::hzrealxmax = 100;
27 Int_t KVTestIDGridDialog::hzvsexbins = 500;
28 Double_t KVTestIDGridDialog::hzvsexmin = 0;
29 Double_t KVTestIDGridDialog::hzvsexmax = 5000;
30 Int_t KVTestIDGridDialog::hzvsdexbins = 500;
31 Double_t KVTestIDGridDialog::hzvsdexmin = 0;
32 Double_t KVTestIDGridDialog::hzvsdexmax = 5000;
33 Int_t KVTestIDGridDialog::hzvseybins = 1500;
34 Int_t KVTestIDGridDialog::hzvseymin = 0;
35 Int_t KVTestIDGridDialog::hzvseymax = 100;
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();
51 g->GetIdentifiers()->Sort();
52 hzrealxmin = ((
KVIDentifier*)
g->GetIdentifiers()->First())->GetPID() - 1.0;
53 hzrealxmax = ((
KVIDentifier*)
g->GetIdentifiers()->Last())->GetPID() + 1.0;
54 hzvseymin = hzrealxmin;
55 hzvseymax = hzrealxmax;
57 if (
g->HasMassIDCapability() && !
g->InheritsFrom(
"KVIDZAFromZGrid")) {
58 hzrealbins = 150 * (hzrealxmax - hzrealxmin);
59 hzvseybins = hzrealbins;
64 fMain->Connect(
"CloseWindow()",
"KVTestIDGridDialog",
this,
66 fMain->DontCallClose();
76 fHdataNameLabel =
new TGLabel(fHdataFrame,
"Name of data histo (TH2F)");
77 fHdataNameEntry =
new TGTextEntry(fNameData, fHdataFrame);
78 fHdataNameEntry->SetWidth(150);
86 fHzrealNameLabel =
new TGLabel(fHzrealNameFrame,
"Name of PID histo (TH1F)");
87 fHzrealNameEntry =
new TGTextEntry(fNameZreal, fHzrealNameFrame);
88 fHzrealNameEntry->SetWidth(150);
95 fHzrealBinsLabel =
new TGLabel(fHzrealBinsFrame,
"nbins");
96 fHzrealBinsLabel->ChangeOptions(fHzrealBinsLabel->GetOptions() |
kFixedSize);
97 fHzrealBinsLabel->Resize(60, fHzrealBinsLabel->GetHeight());
100 fHzrealXminLabel =
new TGLabel(fHzrealBinsFrame,
"xmin");
101 fHzrealXminLabel->ChangeOptions(fHzrealXminLabel->GetOptions() |
kFixedSize);
102 fHzrealXminLabel->Resize(tw, fHzrealXminLabel->GetHeight());
105 fHzrealXmaxLabel =
new TGLabel(fHzrealBinsFrame,
"xmax");
106 fHzrealXmaxLabel->ChangeOptions(fHzrealXmaxLabel->GetOptions() |
kFixedSize);
107 fHzrealXmaxLabel->Resize(tw, fHzrealXmaxLabel->GetHeight());
122 fHzvseFrame =
new TGGroupFrame(fMain,
"PID vs. E histo");
125 fHzvseNameLabel =
new TGLabel(fHzvseNameFrame,
"Name of histo (TH2F)");
126 fHzvseNameEntry =
new TGTextEntry(fNameZvsE, fHzvseNameFrame);
127 fHzvseNameEntry->SetWidth(150);
132 fHzvseXBinsLabel =
new TGLabel(fHzvseXBinsFrame,
"E : nbins");
133 fHzvseXBinsLabel->ChangeOptions(fHzvseXBinsLabel->GetOptions() |
kFixedSize);
134 fHzvseXBinsLabel->Resize(60, fHzvseXBinsLabel->GetHeight());
137 fHzvseXminLabel =
new TGLabel(fHzvseXBinsFrame,
"min");
138 fHzvseXminLabel->ChangeOptions(fHzvseXminLabel->GetOptions() |
kFixedSize);
139 fHzvseXminLabel->Resize(tw, fHzvseXminLabel->GetHeight());
142 fHzvseXmaxLabel =
new TGLabel(fHzvseXBinsFrame,
"max");
143 fHzvseXmaxLabel->ChangeOptions(fHzvseXmaxLabel->GetOptions() |
kFixedSize);
144 fHzvseXmaxLabel->Resize(tw, fHzvseXmaxLabel->GetHeight());
157 fHzvsdeXBinsLabel =
new TGLabel(fHzvsdeXBinsFrame,
"DE : nbins");
158 fHzvsdeXBinsLabel->ChangeOptions(fHzvsdeXBinsLabel->GetOptions() |
kFixedSize);
159 fHzvsdeXBinsLabel->Resize(60, fHzvsdeXBinsLabel->GetHeight());
160 fHzvsdeXBinsLabel->SetTextJustify(
kTextRight);
162 fHzvsdeXminLabel =
new TGLabel(fHzvsdeXBinsFrame,
"min");
163 fHzvsdeXminLabel->ChangeOptions(fHzvsdeXminLabel->GetOptions() |
kFixedSize);
164 fHzvsdeXminLabel->Resize(tw, fHzvsdeXminLabel->GetHeight());
167 fHzvsdeXmaxLabel =
new TGLabel(fHzvsdeXBinsFrame,
"max");
168 fHzvsdeXmaxLabel->ChangeOptions(fHzvsdeXmaxLabel->GetOptions() |
kFixedSize);
169 fHzvsdeXmaxLabel->Resize(tw, fHzvsdeXmaxLabel->GetHeight());
182 fHzvseYBinsLabel =
new TGLabel(fHzvseYBinsFrame,
"PID: nbins");
183 fHzvseYBinsLabel->ChangeOptions(fHzvseYBinsLabel->GetOptions() |
kFixedSize);
184 fHzvseYBinsLabel->Resize(60, fHzvseYBinsLabel->GetHeight());
187 fHzvseYminLabel =
new TGLabel(fHzvseYBinsFrame,
"min");
188 fHzvseYminLabel->ChangeOptions(fHzvseYminLabel->GetOptions() |
kFixedSize);
189 fHzvseYminLabel->Resize(tw, fHzvseYminLabel->GetHeight());
192 fHzvseYmaxLabel =
new TGLabel(fHzvseYBinsFrame,
"max");
193 fHzvseYmaxLabel->ChangeOptions(fHzvseYmaxLabel->GetOptions() |
kFixedSize);
194 fHzvseYmaxLabel->Resize(tw, fHzvseYmaxLabel->GetHeight());
213 fProgressBar->ShowPosition();
214 fProgressBar->SetBarColor(
"red");
219 fTestButton->Connect(
"Clicked()",
"KVTestIDGridDialog",
this,
221 fCloseButton =
new TGTextButton(fButtonsFrame,
"&Close");
222 fCloseButton->Connect(
"Clicked()",
"KVTestIDGridDialog",
this,
225 fButtonsFrame->AddFrame(fTestButton,
229 fButtonsFrame->AddFrame(fCloseButton,
234 fMain->AddFrame(fHdataFrame,
237 fMain->AddFrame(fHzrealFrame,
240 fMain->AddFrame(fHzvseFrame,
243 fMain->AddFrame(fProgressBar,
246 fMain->AddFrame(fButtonsFrame,
251 fMain->MapSubwindows();
252 fMain->Resize(fMain->GetDefaultSize());
255 fMain->CenterOnParent();
257 fMain->SetWindowName(
"Test ID grid");
274 KVTestIDGridDialog::~KVTestIDGridDialog()
287 fNameData = fHdataNameEntry->
GetText();
288 fNameZreal = fHzrealNameEntry->
GetText();
289 fNameZvsE = fHzvseNameEntry->
GetText();
304 hzvsexmin = fHzvseXminEntry->
GetNumber();
305 hzvsexmax = fHzvseXmaxEntry->
GetNumber();
308 hzvsdexmin = fHzvsdeXminEntry->
GetNumber();
309 hzvsdexmax = fHzvsdeXmaxEntry->
GetNumber();
324 if (is_list && is_list->GetEntries()) {
355 new TH1F(fNameZreal.
Data(),
"PID distribution", hzrealbins,
356 hzrealxmin, hzrealxmax);
361 new TH2F(fNameZvsE.
Data(),
"PID vs. E_{res}", hzvsexbins, hzvsexmin,
362 hzvsexmax, hzvseybins, hzvseymin, hzvseymax);
364 histo_names.
SetValue(
"ID_REAL_VS_ERES", fNameZvsE.
Data());
368 new TH2F(
"ID_REAL_VS_DE",
"PID vs. #Delta E", hzvsdexbins, hzvsdexmin,
369 hzvsdexmax, hzvseybins, hzvseymin, hzvseymax);
371 histo_names.
SetValue(
"ID_REAL_VS_DE",
"ID_REAL_VS_DE");
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);
384 histo_names.
SetValue(
"Z_A_REAL",
"AZMap");
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);
391 auto hzreal_aident =
new TH1F(
"ID_REAL_AIDENT",
"PID distribution [Z&A identified]",
392 hzrealbins, hzrealxmin, hzrealxmax);
393 histo_names.
SetValue(
"ID_REAL_AIDENT",
"ID_REAL_AIDENT");
394 add_histo(hzreal_aident);
396 auto hzreal_zident =
new TH1F(
"ID_REAL_ZIDENT",
"PID distribution [only Z identified]",
397 hzrealbins, hzrealxmin, hzrealxmax);
398 histo_names.
SetValue(
"ID_REAL_ZIDENT",
"ID_REAL_ZIDENT");
399 add_histo(hzreal_zident);
402 new TH2F(fNameZvsE.
Data(),
"PID vs. E_{res}", hzvsexbins, hzvsexmin,
403 hzvsexmax, hzvseybins, hzvseymin, hzvseymax);
405 histo_names.
SetValue(
"ID_REAL_VS_ERES", fNameZvsE.
Data());
409 new TH2F(
"ID_REAL_VS_ERES_AIDENT",
"PID vs. E_{res} [Z&A identified]", hzvsexbins, hzvsexmin,
410 hzvsexmax, hzvseybins, hzvseymin, hzvseymax);
412 histo_names.
SetValue(
"ID_REAL_VS_ERES_AIDENT",
"ID_REAL_VS_ERES_AIDENT");
413 add_histo(hzvse_aident);
416 new TH2F(
"ID_REAL_VS_ERES_ZIDENT",
"PID vs. E_{res} [only Z identified]", hzvsexbins, hzvsexmin,
417 hzvsexmax, hzvseybins, hzvseymin, hzvseymax);
419 histo_names.
SetValue(
"ID_REAL_VS_ERES_ZIDENT",
"ID_REAL_VS_ERES_ZIDENT");
420 add_histo(hzvse_zident);
425 new TH2F(
"ID_REAL_VS_DE_AIDENT",
"PID vs. #Delta E [Z&A identified]", hzvsexbins, hzvsdexmin,
426 hzvsdexmax, hzvseybins, hzvseymin, hzvseymax);
428 histo_names.
SetValue(
"ID_REAL_VS_DE_AIDENT",
"ID_REAL_VS_DE_AIDENT");
429 add_histo(hzvsde_aident);
432 new TH2F(
"ID_REAL_VS_DE_ZIDENT",
"PID vs. #Delta E [only Z identified]", hzvsexbins, hzvsdexmin,
433 hzvsdexmax, hzvseybins, hzvseymin, hzvseymax);
435 histo_names.
SetValue(
"ID_REAL_VS_DE_ZIDENT",
"ID_REAL_VS_DE_ZIDENT");
436 add_histo(hzvsde_zident);
443 fProgressBar->
Reset();
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 )
455 #ifdef __WITHOUT_TGBUTTON_SETENABLED
458 fSelectedGrid->Disconnect(
"Increment(Float_t)", fProgressBar,
459 "SetPosition(Float_t)");
460 fProgressBar->
Reset();
463 resultsCanvas.reset(cc);
469 cc->SetWindowPosition(100, 100);
470 cc->SetWindowSize(1500, 1300);
474 cc->SetWindowPosition(100, 100);
475 cc->SetWindowSize(1500, 500);
481 auto pad = cc->cd(ipad++);
485 hzreal->Draw(
"hist");
489 pad = cc->cd(ipad++);
498 pad = cc->cd(ipad++);
509 pad = cc->cd(ipad++);
514 hzreal->Draw(
"hist");
518 pad = cc->cd(ipad++);
528 pad = cc->cd(ipad++);
538 pad = cc->cd(ipad++);
543 hzreal->Draw(
"hist");
547 pad = cc->cd(ipad++);
557 pad = cc->cd(ipad++);
568 resultsKVCanvas.reset(kvc);
569 kvc->SetWindowPosition(1000, 100);
570 kvc->SetWindowSize(900, 900);
573 hazreal->
Draw(
"col");
576 ax = hazreal->GetXaxis();
581 ax = hazreal->GetYaxis();
585 hazreal->SetMinimum(1);
586 DrawChart(kvc, -1, hzrealxmax, -1, hnmax + 2);
604 nucChar->
Draw(
"same");
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
R__EXTERN TStyle * gStyle
TCanvas with mouse-controlled dynamic zoom and pan & scan.
Base class for particle identification in a 2D map.
virtual void TestIdentification(TH2F *data, KVHashList &histos, KVNameValueList &histo_names)
virtual Bool_t HasMassIDCapability() const
const KVList * GetIdentifiers() const
Hybrid charge & mass identification grid.
Base class for graphical cuts used in particle identification.
Extended TList class which owns its objects by default.
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 Draw(Option_t *option="") override
void SetShowSymbol(Int_t value=1)
TObject * First() const override
T * get_object(const TString &name) const
TObject * Last() const override
void Clear(Option_t *option="") override
GUI for testing identification grids.
void DrawChart(TVirtualPad *cc, Int_t zmin, Int_t zmax, Int_t nmin, Int_t nmax)
Bool_t CheckNameOK(const TString &name)
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)
virtual Int_t GetEntries() const
virtual Long_t GetIntNumber() const
virtual Double_t GetNumber() const
void SetRange(Float_t min, Float_t max)
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(int argc, char **argv)