Commit 947fd3eb authored by Stezowski Olivier's avatar Stezowski Olivier
Browse files

Merge branch 'preprod' into 'master'

Merge preprod to master

See merge request !66
parents 90763052 c4087ae0
Pipeline #140328 passed with stage
in 9 minutes and 58 seconds
#include "CXNucChart.h"
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <fstream>
#include "TGListBox.h"
#include "KeySymbols.h"
#include "TGLabel.h"
#include "TGResourcePool.h"
#include "TGStatusBar.h"
#include "TRootEmbeddedCanvas.h"
#include "TGComboBox.h"
#include "TH2D.h"
#include "TFrame.h"
#include "TStyle.h"
#include "TROOT.h"
#include "TObjArray.h"
#include "TList.h"
#include "TLine.h"
#include "TLatex.h"
#include "TMath.h"
#include "THistPainter.h"
#include "TGLabel.h"
#include "TGTextEntry.h"
#include "TExec.h"
#include "TPaletteAxis.h"
#include "CXMainWindow.h"
#include "CXCanvas.h"
#include "CXNucleus.h"
#include "CXNDManager.h"
#include "CXNucleusBox.h"
#include "CXLevelSchemePlayer.h"
#include "CXGuiLSPlayer.h"
#include "TVirtualX.h"
using namespace std;
CXNucChart::CXNucChart(const TGWindow *p, const TGWindow *main, UInt_t w, UInt_t h, CXMainWindow *mainwindow) :
TGTransientFrame(p, main, w, h, kVerticalFrame),
fMainWindow(mainwindow)
{
TGCompositeFrame *Toolbar = new TGCompositeFrame(this,600,100,kHorizontalFrame);
AddFrame(Toolbar,new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX,10,10,0,-5));
TGGroupFrame *gFrame = new TGGroupFrame(Toolbar, "Tools", kVerticalFrame);
gFrame->SetTextColor(CXblue);
gFrame->SetTitlePos(TGGroupFrame::kLeft); // right aligned
Toolbar->AddFrame(gFrame, new TGLayoutHints( kLHintsExpandX | kLHintsExpandY , 0, 0, 0, -10) );
TGHorizontalFrame *hframe = new TGHorizontalFrame(gFrame);
gFrame->AddFrame(hframe, new TGLayoutHints( kLHintsCenterY | kLHintsLeft ,-10,-5,0,-2));
TGLabel *label = new TGLabel(hframe,"View: ");
label->SetTextColor(CXred);
hframe->AddFrame(label, new TGLayoutHints( kLHintsCenterY | kLHintsLeft ,0,5,0,0));
fViewMode = new TGComboBox(hframe);
fViewMode->Resize(150,20);
fViewMode->AddEntry("Life time (s)",M_LifeTime);
fViewMode->AddEntry("1st Isomer life time (s)",M_1stIsomer);
fViewMode->AddEntry("2nd Isomer life time (s)",M_2ndIsomer);
fViewMode->AddEntry("1rst excited state (keV)",M_1rstExcitedState);
fViewMode->AddEntry("Decay mode",M_DecayMode);
fViewMode->AddEntry("B(E2) (e2b2)",M_BE2E2B2);
fViewMode->AddEntry("B(E2) (W.u.)/A",M_BE2WU);
fViewMode->Select(M_LifeTime);
fViewMode->Connect("Selected(Int_t)", "CXNucChart", this, "UpdateNucChart()");
hframe->AddFrame(fViewMode, new TGLayoutHints( kLHintsCenterY | kLHintsLeft ,0,0,0,0));
label = new TGLabel(hframe,"Print: ");
label->SetTextColor(CXred);
hframe->AddFrame(label, new TGLayoutHints( kLHintsCenterY | kLHintsLeft ,10,5,0,0));
fPrintMode = new TGComboBox(hframe);
fPrintMode->Resize(100,20);
fPrintMode->AddEntry("Nucleus",M_NucInfo);
fPrintMode->AddEntry("Levels",M_LevelsInfo);
fPrintMode->AddEntry("Gamma-rays",M_GammaInfos);
fPrintMode->Select(M_NucInfo);
fPrintMode->Connect("Selected(Int_t)", "CXNucChart", this, "UpdatePrintMode()");
hframe->AddFrame(fPrintMode, new TGLayoutHints( kLHintsCenterY | kLHintsLeft ,0,0,0,0));
label = new TGLabel(hframe,"Nucleus: ");
label->SetTextColor(CXred);
hframe->AddFrame(label, new TGLayoutHints( kLHintsCenterY | kLHintsLeft ,10,5,0,0));
fNucleusTextEntry = new TGTextEntry(hframe,"");
fNucleusTextEntry->SetWidth(50);
hframe->AddFrame(fNucleusTextEntry, new TGLayoutHints( kLHintsCenterY | kLHintsLeft ,0,0,0,0));
fNucleusTextEntry->Connect("TextChanged(const char *)", "CXNucChart", this, "NucNotValidated()");
fNucleusTextEntry->Connect("ReturnPressed()", "CXNucChart", this, "UpdateNucFromSymb()");
label = new TGLabel(hframe,"Data set: ");
label->SetTextColor(CXred);
hframe->AddFrame(label, new TGLayoutHints( kLHintsCenterY | kLHintsLeft ,10,5,0,0));
fDataSetMode = new TGComboBox(hframe);
fDataSetMode->Resize(200,20);
fDataSetMode->Connect("Selected(Int_t)", "CXNucChart", this, "UpdateDataSet()");
hframe->AddFrame(fDataSetMode, new TGLayoutHints( kLHintsCenterY | kLHintsLeft ,0,0,0,0));
TGCompositeFrame *Global = new TGCompositeFrame(this,600,100,kHorizontalFrame);
AddFrame(Global,new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX | kLHintsExpandY,5,5,5,5));
TGVerticalFrame *Main = new TGVerticalFrame(Global,600,100,kFixedWidth);
Global->AddFrame(Main,new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandY,5,5,5,5));
Main->SetWidth(220);
gFrame = new TGGroupFrame(Main, "Selected nucleus", kVerticalFrame);
gFrame->SetTextColor(CXblue);
gFrame->SetTitlePos(TGGroupFrame::kLeft); // right aligned
Main->AddFrame(gFrame, new TGLayoutHints(kLHintsTop | kLHintsExpandX | kLHintsExpandY , 0, 0, -5, -10) );
fInfoBox = new TGListBox(gFrame);
gFrame->AddFrame(fInfoBox, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,-10,-10,3,0));
//Canvas Panel
Main = new TGVerticalFrame(Global,400,100);
Global->AddFrame(Main,new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX | kLHintsExpandY,0,5,5,5));
Main->SetWidth(800);
fRootCanvas = new TRootEmbeddedCanvas("NCCanvas", Main);
Main->AddFrame(fRootCanvas, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 5, 5));
Int_t canvasid = fRootCanvas->GetCanvasWindowId();
delete fRootCanvas->GetCanvas(); // To delete the original canvas, without this, it causes crashed on macos
fCanvas = new CXCanvas("NuclearChartCanvas", 10, 10,canvasid);
fCanvas->SetMainWindow(fMainWindow);
// fCanvas->ToggleToolBar();
fRootCanvas->AdoptCanvas(fCanvas);
fRootCanvas->GetContainer()->Connect("ProcessedEvent(Event_t*)", "CXNucChart", this, "ProcessedKeyEvent(Event_t*)");
fCanvas->Connect("ProcessedEvent(Int_t, Int_t, Int_t, TObject*)", "CXNucChart", this, "HandleMovement(Int_t,Int_t,Int_t, TObject*)");
fCanvas->Connect("RangeChanged()","CXNucChart",this,"UpdateRange()");
fCanvas->Connect("UnZoomed()","CXNucChart",this,"UpdateRange()");
fCanvas->SetRightMargin(0.08);
fCanvas->SetBottomMargin(0.09);
fCanvas->SetLeftMargin(0.07);
fCanvas->SetTopMargin(0.04);
// status bar
Int_t parts[] = {20 , 20 , 20 , 20 ,20};
fStatusBar = new TGStatusBar(Main,50,10,kHorizontalFrame);
fStatusBar->SetParts(parts,5);
fStatusBar->Draw3DCorner(kFALSE);
Main->AddFrame(fStatusBar, new TGLayoutHints(kLHintsBottom | kLHintsLeft | kLHintsExpandX, 0, 0, 0, 0));
fMagicList = new TList;
fMagicList->SetOwner();
fListOfBoxes = new TList;
fListOfBoxes->SetOwner();
fMapOfNuclei = gNDManager->GetMap();
fNucChartHist = new TH2D("NucChart","NucChart",gNDManager->GetNMax()+5, -0.5 , gNDManager->GetNMax()+5-0.5,gNDManager->GetZMax()+5, -0.5 , gNDManager->GetZMax()+5-0.5);
fNucChartHist->GetXaxis()->SetTitle("N");fNucChartHist->GetXaxis()->CenterTitle();
fNucChartHist->GetYaxis()->SetTitle("Z");fNucChartHist->GetYaxis()->CenterTitle();
UpdateNucChart();
UpdateRange();
SetCleanup(kDeepCleanup);
SetWindowName("NuclearChart");
CenterOnParent();
MapSubwindows();
Layout();
MapWindow();
}
CXNucChart::~CXNucChart()
{
fMainWindow->fNucChartWindow = nullptr;
delete fMagicList;
delete fListOfBoxes;
delete fNucChartHist;
UnmapWindow();
CloseWindow();
}
void CXNucChart::ShowMagicNumbers(bool On)
{
fMagicList->Clear();
if(On == false) {
return;
}
Int_t fNm[7] = {2,8,20,28,50,82,126};
Double_t fNmMin[7] = {0.,1.,12.,18.,46.,93.,98.};
Double_t fNmMax[7] = {10.,22.,40.,52.,90.,140.,126.*3};
Double_t fZmMin[7] = {0.2,0.2,6.,10.,26.,44.,74.};
Double_t fZmMax[7] = {9.,17.,30.,35.,53.,74.,95.};
for (int i = 0; i < 7; i++) {
Int_t num = fNm[i];
if ((num >= fNMin + 1) && (num <= fNMax - 1) && (fZmMin[i] < fZMax)) {
TLine* ll1 = new TLine(num - 0.5, TMath::Max(fZMin, fZmMin[i]), num - 0.5, TMath::Min(fZMax, fZmMax[i]));
if(fListOfBoxes->GetEntries()) ll1->SetLineWidth(2);
ll1->SetBit(kCannotPick); ll1->SetBit(kCannotPick);
TLine* ll2 = new TLine(num + 0.5, TMath::Max(fZMin, fZmMin[i]), num + 0.5, TMath::Min(fZMax, fZmMax[i]));
if(fListOfBoxes->GetEntries()) ll2->SetLineWidth(2);
ll2->SetBit(kCannotPick); ll2->SetBit(kCannotPick);
fMagicList->AddLast(ll1);
fMagicList->AddLast(ll2);
}
}
for (int i = 0; i < 7; i++) {
Int_t num = fNm[i];
if ((num >= fZMin + 1) && (num <= fZMax - 1) && (fNmMin[i] < fNMax)) {
TLine* ll1 = new TLine(TMath::Max(fNMin, fNmMin[i]), num - 0.5, TMath::Min(fNMax, fNmMax[i]), num - 0.5);
if(fListOfBoxes->GetEntries()) ll1->SetLineWidth(2);
ll1->SetBit(kCannotPick); ll1->SetBit(kCannotPick);
TLine* ll2 = new TLine(TMath::Max(fNMin, fNmMin[i]), num + 0.5, TMath::Min(fNMax, fNmMax[i]), num + 0.5);
if(fListOfBoxes->GetEntries()) ll2->SetLineWidth(2);
ll2->SetBit(kCannotPick); ll2->SetBit(kCannotPick);
fMagicList->AddLast(ll1);
fMagicList->AddLast(ll2);
}
}
fMagicList->Execute("Draw", "");
}
void CXNucChart::PlotBoxes()
{
fListOfBoxes->Clear();
bool withLT = false;
if((fZMax-fZMin)<40 && (fNMax-fNMin)<40 ) withLT = true;
if((fZMax-fZMin)>70 || (fNMax-fNMin)>70 ) return;
for (int zz = fZMin+1; zz <= fZMax; zz++) {
for (int nn = fNMin+1; nn <= fNMax; nn++) {
NucData *data = gNDManager->GetData(zz,nn+zz);
if(data) {
Int_t charheight;
Float_t pad_width = gPad->XtoPixel(gPad->GetX2());
Float_t pad_height = gPad->YtoPixel(gPad->GetY1());
if (pad_width < pad_height) charheight = pad_width/(fNMax-fNMin);
else charheight = pad_height/(fZMax-fZMin);
CXNucleusBox* nb;
if(withLT) {
nb = new CXNucleusBox(data,0.5,kBlack,kGray+1,charheight*0.25,true, fViewMode->GetSelected());
}
else
nb = new CXNucleusBox(data,0.5,kBlack,kGray+1,charheight*0.5);
fListOfBoxes->Add(nb);
}
}
}
fCanvas->DisableClass("TLine");
fCanvas->DisableClass("CXNucleusBox");
fCanvas->DisableClass("TLatex");
fListOfBoxes->Execute("Draw", "");
CXNucleusBox *box = (CXNucleusBox*)fListOfBoxes->FindObject(fLastSelectedBox);
if(box) {
box->SetLineColor(kRed);
box->SetLineWidth(2);
}
}
void CXNucChart::SetPalette(Int_t Mode)
{
if(Mode == M_LifeTime || Mode == M_1stIsomer || Mode == M_2ndIsomer ) {
Int_t NColors = 33;
int ColNbr[NColors];
for(int i=0 ; i<NColors ;i++) ColNbr[i] = 2000+i;
int icol=0;
if(gROOT->GetColor(ColNbr[icol]) == nullptr) {
new TColor(ColNbr[icol++],255./256.,139./256.,109./256.); // <1e-15
new TColor(ColNbr[icol++],255./256.,175./256.,222./256.); // 1e-15
new TColor(ColNbr[icol++],255./256.,175./256.,222./256.); // 1e-14
new TColor(ColNbr[icol++],255./256.,175./256.,222./256.); // 1e-13
new TColor(ColNbr[icol++],255./256.,175./256.,222./256.); // 1e-12
new TColor(ColNbr[icol++],255./256.,175./256.,222./256.); // 1e-11
new TColor(ColNbr[icol++],255./256.,175./256.,222./256.); // 1e-10
new TColor(ColNbr[icol++],255./256.,175./256.,222./256.); // 1e-9
new TColor(ColNbr[icol++],255./256.,175./256.,222./256.); // 1e-8
new TColor(ColNbr[icol++],255./256.,196./256.,160./256.); // 1e-7
new TColor(ColNbr[icol++],255./256.,234./256.,194./256.); // 1e-6
new TColor(ColNbr[icol++],246./256.,255./256.,147./256.); // 1e-5
new TColor(ColNbr[icol++],242./256.,255./256.,0./256.); // 1e-4
new TColor(ColNbr[icol++],217./256.,255./256.,122./256.); // 1e-3
new TColor(ColNbr[icol++],195./256.,255./256.,5./256.); // 1e-2
new TColor(ColNbr[icol++],149./256.,238./256.,89./256.); // 1e-1
new TColor(ColNbr[icol++],0./256.,196./256.,77./256.); // 1e0
new TColor(ColNbr[icol++],76./256.,194./256.,180./256.); // 1e1
new TColor(ColNbr[icol++],84./256.,197./256.,223./256.); // 1e2
new TColor(ColNbr[icol++],0./256.,163./256.,199./256.); // 1e3
new TColor(ColNbr[icol++],0./256.,159./256.,148./256.); // 1e4
new TColor(ColNbr[icol++],0./256.,129./256.,166./256.); // 1e5
new TColor(ColNbr[icol++],0./256.,129./256.,166./256.); // 1e6
new TColor(ColNbr[icol++],69./256.,56./256.,167./256.); // 1e7
new TColor(ColNbr[icol++],69./256.,56./256.,167./256.); // 1e8
new TColor(ColNbr[icol++],69./256.,56./256.,167./256.); // 1e9
new TColor(ColNbr[icol++],60./256.,0./256.,109./256.); // 1e10
new TColor(ColNbr[icol++],60./256.,0./256.,109./256.); // 1e11
new TColor(ColNbr[icol++],60./256.,0./256.,109./256.); // 1e12
new TColor(ColNbr[icol++],60./256.,0./256.,109./256.); // 1e13
new TColor(ColNbr[icol++],60./256.,0./256.,109./256.); // 1e14
new TColor(ColNbr[icol++],60./256.,0./256.,109./256.); // 1e15
new TColor(ColNbr[icol++],0./256.,0./256.,0./256.); // >1e15
}
Int_t palette[NColors];
for(int i=0 ; i<NColors ;i++) palette[i] = ColNbr[i];
gStyle->SetPalette(NColors,palette,0.);
}
else if(Mode == M_DecayMode) {
Int_t NColors = 7;
int ColNbr[NColors];
for(int i=0 ; i<NColors ;i++) ColNbr[i] = 2100+i;
int icol=0;
if(gROOT->GetColor(ColNbr[icol]) == nullptr) {
new TColor(ColNbr[icol++],0./256.,0./256.,0./256.); // STABLE => 1
new TColor(ColNbr[icol++],255./256.,196./256.,0./256.); // P => 2
new TColor(ColNbr[icol++],253./256.,234./256.,0./256.); // A => 3
new TColor(ColNbr[icol++],255./256.,116./256.,89./256.); // B+ => 4
new TColor(ColNbr[icol++],81./256.,187./256.,216./256.); // B- => 5
new TColor(ColNbr[icol++],187./256.,218./256.,228./256.); // N => 6
new TColor(ColNbr[icol++],0./256.,149./256.,0./256.); // SF => 7
}
Int_t palette[NColors];
for(int i=0 ; i<NColors ;i++) palette[i] = ColNbr[i];
gStyle->SetPalette(NColors,palette,0.);
}
if(Mode == M_1rstExcitedState ) {
gStyle->SetPalette(1);
}
if(Mode == M_BE2E2B2 ) {
gStyle->SetPalette(1);
}
if(Mode == M_BE2WU ) {
gStyle->SetPalette(1);
}
}
void CXNucChart::UpdateNucChart()
{
fCanvas->cd();
fNucChartHist->Reset();
fNucChartHist->GetListOfFunctions()->Clear();
if(fViewMode->GetSelected() == M_LifeTime || fViewMode->GetSelected() == M_1stIsomer || fViewMode->GetSelected() == M_2ndIsomer ) {
fNucChartHist->SetContour(33);
TExec *ex1 = new TExec("ex1",Form("CXNucChart::SetPalette(%d)",M_LifeTime));
fNucChartHist->GetListOfFunctions()->Add(ex1);
gPad->Modified();
gPad->Update();
gSystem->ProcessEvents();
}
if(fViewMode->GetSelected() == M_DecayMode) {
fNucChartHist->SetContour(7);
TExec *ex1 = new TExec("ex1",Form("CXNucChart::SetPalette(%d)",M_DecayMode));
fNucChartHist->GetListOfFunctions()->Add(ex1);
gPad->Modified();
gPad->Update();
gSystem->ProcessEvents();
}
if(fViewMode->GetSelected() == M_1rstExcitedState) {
fNucChartHist->SetContour(20);
TExec *ex1 = new TExec("ex1",Form("CXNucChart::SetPalette(%d)",M_1rstExcitedState));
fNucChartHist->GetListOfFunctions()->Add(ex1);
gPad->Modified();
gPad->Update();
gSystem->ProcessEvents();
}
if(fViewMode->GetSelected() == M_BE2E2B2) {
fNucChartHist->SetContour(20);
TExec *ex1 = new TExec("ex1",Form("CXNucChart::SetPalette(%d)",M_BE2E2B2));
fNucChartHist->GetListOfFunctions()->Add(ex1);
gPad->Modified();
gPad->Update();
gSystem->ProcessEvents();
}
if(fViewMode->GetSelected() == M_BE2WU) {
fNucChartHist->SetContour(20);
TExec *ex1 = new TExec("ex1",Form("CXNucChart::SetPalette(%d)",M_BE2WU));
fNucChartHist->GetListOfFunctions()->Add(ex1);
gPad->Modified();
gPad->Update();
gSystem->ProcessEvents();
}
map<TString, NucData*>::iterator itr;
for (itr = fMapOfNuclei.begin(); itr != fMapOfNuclei.end(); ++itr) {
NucData *nuc = itr->second;
if(nuc == nullptr) continue;
NucLevel lev = nuc->Levels.at(0);
Float_t LT = lev.LT;
if(fViewMode->GetSelected() == M_LifeTime) {
if(lev.LT==0. && nuc->Levels.size()>1) LT = nuc->Levels.at(1).LT;
if(isinf(LT)) fNucChartHist->Fill(nuc->N,nuc->Z,1e30);
else fNucChartHist->Fill(nuc->N,nuc->Z,LT);
}
if(fViewMode->GetSelected() == M_1stIsomer && nuc->Levels.size()>1) {
LT = nuc->Levels.at(1).LT;
if(isinf(LT)) fNucChartHist->Fill(nuc->N,nuc->Z,1e30);
else fNucChartHist->Fill(nuc->N,nuc->Z,LT);
}
if(fViewMode->GetSelected() == M_2ndIsomer && nuc->Levels.size()>2) {
LT = nuc->Levels.at(2).LT;
if(isinf(LT)) fNucChartHist->Fill(nuc->N,nuc->Z,1e30);
else fNucChartHist->Fill(nuc->N,nuc->Z,LT);
}
if(fViewMode->GetSelected() == M_DecayMode) {
Int_t value;
TString decay = nuc->Levels.at(0).Decays.at(0).first;
if(((TString)decay[0]).IsDec()) decay.Remove(0,1);
if(isinf(LT)) value = 1;
else if(decay.BeginsWith("P")) value = 2;
else if(decay.BeginsWith("A")) value = 3;
else if(decay.BeginsWith("E")) value = 4;
else if(decay.BeginsWith("B")) value = 5;
else if(decay.BeginsWith("N")) value = 6;
else if(decay.BeginsWith("S")) value = 7;
else continue;
fNucChartHist->Fill(nuc->N,nuc->Z,value);
}
if(fViewMode->GetSelected() == M_1rstExcitedState) {
Float_t Value = nuc->E1rstState.GetValue();
if(Value != 0.) fNucChartHist->Fill(nuc->N,nuc->Z,Value);
}
if(fViewMode->GetSelected() == M_BE2E2B2) {
Float_t Value = nuc->BE2_E2B2.GetValue();
if(Value != 0.) fNucChartHist->Fill(nuc->N,nuc->Z,Value);
}
if(fViewMode->GetSelected() == M_BE2WU) {
Float_t Value = nuc->BE2_WU.GetValue();
if(Value != 0.) fNucChartHist->Fill(nuc->N,nuc->Z,Value/((Float_t)nuc->A));
}
}
if(fViewMode->GetSelected() == M_LifeTime || fViewMode->GetSelected() == M_1stIsomer || fViewMode->GetSelected() == M_2ndIsomer ) {
fNucChartHist->SetMinimum(1e-16);
fNucChartHist->SetMaximum(1e16);
fNucChartHist->Draw("colz");
fCanvas->SetLogz();
}
else if(fViewMode->GetSelected() == M_DecayMode) {
fNucChartHist->SetMinimum(1);
fNucChartHist->SetMaximum(7);
fNucChartHist->Draw("colz");
fCanvas->SetLogz(0);
}
else if(fViewMode->GetSelected() == M_1rstExcitedState) {
fNucChartHist->SetMinimum();
fNucChartHist->SetMaximum();
fNucChartHist->Draw("colz");
fCanvas->SetLogz();
}
else if(fViewMode->GetSelected() == M_BE2E2B2) {
fNucChartHist->SetMinimum(1e-3);
fNucChartHist->SetMaximum();
fNucChartHist->Draw("colz");
fCanvas->SetLogz();
}
else if(fViewMode->GetSelected() == M_BE2WU) {
fNucChartHist->SetMinimum();
fNucChartHist->SetMaximum();
fNucChartHist->Draw("colz");
fCanvas->SetLogz(0);
}
UpdateRange();
TPaletteAxis *palette = (TPaletteAxis*)fNucChartHist->GetListOfFunctions()->FindObject("palette");
if(palette) {
palette->SetX1NDC(0.925);
palette->SetX2NDC(0.95);
palette->SetLineWidth(0);
palette->SetBit(TObject::kCannotPick);
fCanvas->DisableClass("TPaletteAxis");
if(fViewMode->GetSelected() == M_DecayMode)
fNucChartHist->GetZaxis()->SetLabelSize(0.);
else
fNucChartHist->GetZaxis()->SetLabelSize(0.04);
fNucChartHist->GetZaxis()->SetLabelOffset(0.);
fCanvas->Update();
}
fCanvas->GetFrame()->SetBit(TObject::kCannotPick);
}
void CXNucChart::PrintInListBox(TString mess, Int_t Type)
{
#if (OS_TYPE == OS_LINUX)
const TGFont *ufont; // will reflect user font changes
ufont = gClient->GetFont("-*-courier-medium-r-*-*-12-*-*-*-*-*-iso8859-1");
// ufont = gClient->GetFont("-adobe-times-medium-r-*-*-12-*-*-*-*-*-iso8859-1");
if (!ufont)
ufont = fClient->GetResourcePool()->GetDefaultFont();
TGGC *uGC; // will reflect user GC changes
// graphics context changes
GCValues_t val;
val.fMask = kGCFont;
val.fFont = ufont->GetFontHandle();
uGC = gClient->GetGC(&val, kTRUE);
TGTextLBEntry *entry = new TGTextLBEntry(fInfoBox->GetContainer(), new TGString(mess), fInfoBox->GetNumberOfEntries()+1, uGC->GetGC(), ufont->GetFontStruct());
#else
TGTextLBEntry *entry = new TGTextLBEntry(fInfoBox->GetContainer(), new TGString(mess), fInfoBox->GetNumberOfEntries()+1);
#endif
if(Type == kError)
entry->SetBackgroundColor((Pixel_t)0xff0000);
else if(Type == kInfo)
entry->SetBackgroundColor((Pixel_t)0x87a7d2);
else if(Type == kWarning)
entry->SetBackgroundColor((Pixel_t)0xdfdf44);
else if(Type == kPrint)
entry->SetBackgroundColor((Pixel_t)0x90f269);
fInfoBox->AddEntry((TGLBEntry *)entry, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX));
fInfoBox->Layout();
}
void CXNucChart::SelectNucleus(Int_t Z, Int_t N)
{
NucData *data = gNDManager->GetData(Z,Z+N);
fSelectedNucleus = data;
fDataSetMode->RemoveAll();
if(data == nullptr) {
PrintInListBox(Form("Nucleus: Z=%d, N=%d unknown",Z,N),kError);
return;
}
fSelectedLevelScheme = fMainWindow->GetLSPlayer()->GetPlayer()->GetLevelScheme(data->Symb);
if(fSelectedLevelScheme) {
for(uint i=0 ; i< fSelectedLevelScheme->GetDataSets().size() ; i++) {
fDataSetMode->AddEntry(fSelectedLevelScheme->GetDataSets().at(i).Dsid.data(),i);
}
fDataSetMode->Select(0);
}
if(fDataSetMode->GetNumberOfEntries() == 0)
PrintInfos(true);
fNucleusTextEntry->SetTitle(data->Symb);