1 #include "KVTestIDGridDialog.h"
3 #include "KVIDGridManager.h"
13 #include "KVNucleus.h"
17 #include "KVNuclearChart.h"
18 #include "KVIdentificationResult.h"
19 #include "KVIDZAFromZGrid.h"
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()
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");
391 auto hzreal_aident =
new TH1F(
"ID_REAL_AIDENT",
"PID distribution [Z&A identified]",
393 histo_names.
SetValue(
"ID_REAL_AIDENT",
"ID_REAL_AIDENT");
396 auto hzreal_zident =
new TH1F(
"ID_REAL_ZIDENT",
"PID distribution [only Z identified]",
398 histo_names.
SetValue(
"ID_REAL_ZIDENT",
"ID_REAL_ZIDENT");
412 histo_names.
SetValue(
"ID_REAL_VS_ERES_AIDENT",
"ID_REAL_VS_ERES_AIDENT");
419 histo_names.
SetValue(
"ID_REAL_VS_ERES_ZIDENT",
"ID_REAL_VS_ERES_ZIDENT");
428 histo_names.
SetValue(
"ID_REAL_VS_DE_AIDENT",
"ID_REAL_VS_DE_AIDENT");
435 histo_names.
SetValue(
"ID_REAL_VS_DE_ZIDENT",
"ID_REAL_VS_DE_ZIDENT");
444 fSelectedGrid->Connect(
"Increment(Float_t)",
"TGHProgressBar",
446 #ifdef __WITHOUT_TGBUTTON_SETENABLED
447 #define SetEnabled(flag) \
448 SetState( flag ? kButtonUp : kButtonDisabled )
455 #ifdef __WITHOUT_TGBUTTON_SETENABLED
459 "SetPosition(Float_t)");
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++);
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);
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 SetShowSymbol(Int_t value=1)
void Draw(Option_t *option="")
T * get_object(const TString &name) const
virtual TObject * Last() const
virtual void Clear(Option_t *option="")
virtual TObject * First() const
GUI for testing identification grids.
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
KVIDGraph * fSelectedGrid
Bool_t CheckNameOK(const TString &name)
TGNumberEntry * fHzrealXmaxEntry
TGNumberEntry * fHzvseXminEntry
TGNumberEntry * fHzvsdeXminEntry
static Double_t hzvsexmax
TGNumberEntry * fHzvseYminEntry
TGTextEntry * fHzrealNameEntry
std::unique_ptr< TCanvas > resultsCanvas
TGNumberEntry * fHzvsdeXmaxEntry
TGNumberEntry * fHzvseYBinsEntry
static Double_t hzvsexmin
static TString fNameZreal
TGTextButton * fCloseButton
static Double_t hzvsdexmax
TGNumberEntry * fHzrealBinsEntry
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)