Commit 4976a4d9 authored by Jérémie Dudouet's avatar Jérémie Dudouet
Browse files

Update NucChart cout info, add utilities to select dataset in ENSDF reader

parent b65f1c76
......@@ -963,8 +963,8 @@ Bool_t CXCanvas::HandleKey(Int_t px, Int_t py)
}
else if (FindHisto() && (FindHisto()->InheritsFrom("TH1") || FindHisto()->InheritsFrom("TH1D") ) ) {
if(fMainWindow->IsCtrlOn() == false){
((TH1*)FindHisto())->GetXaxis()->UnZoom();
((TH1*)FindHisto())->GetYaxis()->UnZoom();
((TH1*)FindHisto())->GetXaxis()->UnZoom();
gPad->Modified();
gPad->Update();
}
......
......@@ -218,7 +218,7 @@ void CXGammaSearch::FindGammaRays(Bool_t Bash)
CXNucleus Nuc(iz,ia);
TString MajName = Nuc.GetSymbol();
MajName.ToUpper();
MajName.Append("NV");
MajName.Append("NoVerbose");
TString FileName = fDataBaseFolder + "/" + ((TString)Nuc.GetSymbol()) + ".ens";
......@@ -766,7 +766,7 @@ LevelScheme *CXGammaSearch::ImportRAWENSDF(const char *NucSymbol)
CXNucleus nuc(NucSymbol);
TString ZMaj = ((TString)nuc.GetSymbol());
ZMaj.ToUpper();
ZMaj.Append("NV");
ZMaj.Append("NoVerbose");
TString FileName = fDataBaseFolder + "/" + ((TString)nuc.GetSymbol().Data()) + ".ens";
......
......@@ -310,7 +310,7 @@ void CXGuiLSPlayer::PlotLS()
for(int i=0 ; i<arr->GetEntries() ; i++) {
TString Nuc = arr->At(i)->GetName();
fLSPlayer->PlotLevelScheme(Nuc,"ENSDF");
fLSPlayer->PlotLevelScheme(Nuc,"ENSDF",fCurrentDataSet);
}
delete arr;
......
......@@ -94,9 +94,6 @@ LevelScheme *CXLevelSchemePlayer::DrawArrows(TString ListOfNuclei,TH1 *h, TStrin
gPad = fMainWindow->GetSelectedPad();
if(h == nullptr || h->GetEntries() == 0)
return RefLevel;
ConnectCanvas();
fCanReplot = false;
......@@ -461,7 +458,7 @@ LevelScheme *CXLevelSchemePlayer::ImportExpData(const char *NucSymbol)
}
}
LevelScheme *CXLevelSchemePlayer::ImportENSDFData(const char *NucSymbol, bool quietmode, TString dataset)
LevelScheme *CXLevelSchemePlayer::ImportENSDFData(const char *NucSymbol, bool quietmode,TString dataset, bool graphical)
{
TVirtualPad *tempPad = gPad;
......@@ -471,7 +468,8 @@ LevelScheme *CXLevelSchemePlayer::ImportENSDFData(const char *NucSymbol, bool qu
if(dataset == "") dataset = "ADOPTED LEVELS, GAMMAS";
ZMaj.Append(Form(" %s",dataset.Data()));
if(quietmode) ZMaj.Append("NV");
if(quietmode) ZMaj.Append("NoVerbose");
if(!graphical) ZMaj.Append("NoGraphical");
TString FileName = fENSDFDataDir + "/" + ((TString)nuc.GetSymbol()) + ".ens";
......@@ -488,9 +486,9 @@ LevelScheme *CXLevelSchemePlayer::ImportENSDFData(const char *NucSymbol, bool qu
gPad = tempPad;
// if(lev->GetLinks().GetSize() == 0)
// return nullptr;
// else
// if(lev->GetLinks().GetSize() == 0)
// return nullptr;
// else
return lev;
}
}
......@@ -501,9 +499,16 @@ TString CXLevelSchemePlayer::PrintNucleusGammas(LevelScheme *lev, TString NucNam
TString Text="";
if(print) cout<<"***** Gamma-rays transitions for nucleus "<<NucName<<" *****" << endl;
if(print) cout<<"--------------------------"<<endl;
if(print) cout<<endl;
if(print) {
TString text = Form("** Gamma-rays transitions for nucleus %s **",NucName.Data());
TString stars; for (int i=0 ; i<text.Length() ; i++) stars.Append("*");
cout<<endl<<endl<<stars<<endl<<text<<endl<<stars<<endl<<endl;
cout<<Form(" E Gamma : Ji ( Ei ) --> Jf ( Ef ) ( I %% )")<<endl;
cout<< "-------------------------------------------------------------------"<<endl;
cout<<endl;
}
for(Int_t i=0 ; i<lev->GetLinks().GetSize() ; i++) {
......@@ -522,7 +527,7 @@ TString CXLevelSchemePlayer::PrintNucleusGammas(LevelScheme *lev, TString NucNam
Float_t ELevF = NucLevF->GetEnergy().GetValue();
TString spinF_s = GetSpinFromLev(NucLevF);
TString TransitionName = Form(" %6.1f keV : %7s (%6.1f keV) --> %7s (%6.1f keV) (%g %%) ",Energy,spinI_s.Data(),ELevI,spinF_s.Data(),ELevF,Strengh);
TString TransitionName = Form(" %6.1f keV : %7s (%6.1f keV) --> %7s (%6.1f keV) (%3.f %%) ",Energy,spinI_s.Data(),ELevI,spinF_s.Data(),ELevF,Strengh);
if(print) cout<<TransitionName<<endl;
Text += Form("!%-7g %-7s->%-7s",Energy,spinI_s.Data(),spinF_s.Data());
......@@ -556,9 +561,14 @@ TString CXLevelSchemePlayer::PrintNucleusLevels(LevelScheme *lev, TString NucNam
TString Text="";
if(print) cout<<"***** Levels info for nucleus "<<NucName<<" *****" << endl;
if(print) cout<<left<<setw(15)<<"Energy"<<setw(6)<<"Spin"<<setw(8)<<"T 1/2"<<endl;
if(print) cout<<"--------------------------"<<endl;
if(print) {
TString text = Form("** Levels info for nucleus %s **",NucName.Data());
TString stars; for (int i=0 ; i<text.Length() ; i++) stars.Append("*");
cout<<endl<<endl<<stars<<endl<<text<<endl<<stars<<endl<<endl;
cout<<left<<setw(15)<<"Energy"<<setw(6)<<"Spin"<<setw(8)<<"T 1/2"<<endl;
cout<<"--------------------------"<<endl<<endl;
}
for(Int_t i=0 ; i<lev->GetLevels().GetSize() ; i++) {
NuclearLevel *NucLev = (NuclearLevel*)lev->GetLevels().At(i);
Float_t ELev = NucLev->GetEnergy().GetValue();
......@@ -609,12 +619,12 @@ TString CXLevelSchemePlayer::PrintNucleusLevels(Int_t Z, Int_t N, bool print)
return PrintNucleusLevels(lev,nuc.GetSymbol(),print);
}
void CXLevelSchemePlayer::PlotLevelScheme(TString NucName, TString Type)
void CXLevelSchemePlayer::PlotLevelScheme(TString NucName, TString Type, TString DataSet)
{
LevelScheme *lev = nullptr;
if(Type=="ENSDF")
lev = ImportENSDFData(NucName);
lev = ImportENSDFData(NucName,true,DataSet,false);
else
lev = ImportExpData(NucName);
......@@ -645,23 +655,22 @@ void CXLevelSchemePlayer::PlotLevelScheme(TString NucName, TString Type)
CXNucleus Nuc(NucName);
for(Int_t i=0 ; i<lev->GetLinks().GetSize() ; i++)
{
for(Int_t i=0 ; i<lev->GetLinks().GetSize() ; i++) {
Gw::GammaLink *Link= (Gw::GammaLink*)lev->GetLinks().At(i);
NuclearLevel *NucLevI = (NuclearLevel*)Link->GetIL();
NuclearLevel *NucLevF = (NuclearLevel*)Link->GetFL();
Float_t Strengh = Link->GetStrength().GetValue();
Float_t ELevI = NucLevI->GetEnergy().GetValue();
TString spinI_s = GetSpinFromLev(NucLevI);
Float_t spinI = NucLevI->GetSpin().Get();
Float_t ELevF = NucLevF->GetEnergy().GetValue();
TString spinF_s = GetSpinFromLev(NucLevF);
Float_t LifeTime = NucLevI->GetT().GetValue();
Float_t LifeTimeI = NucLevI->GetT().GetValue();
Float_t LifeTimeF = NucLevF->GetT().GetValue();
TString LifeTimestrI = GetLTString(LifeTimeI);
TString LifeTimestrF = GetLTString(LifeTimeF);
if( fGuiLSPlayer->UseBranchingRatio() && (Strengh<fMinStrenght || Strengh>fMaxStrenght))
continue;
......@@ -678,41 +687,40 @@ void CXLevelSchemePlayer::PlotLevelScheme(TString NucName, TString Type)
// if(fGuiLSPlayer->GetYrastMode() && ELevF>fYrastEnergies[2*spinF])
// continue;
if(fGuiLSPlayer->UseLifeTime() && (LifeTime<fMinLifeTime || LifeTime>fMaxLifeTime))
if(fGuiLSPlayer->UseLifeTime() && (LifeTimeI<fMinLifeTime || LifeTimeI>fMaxLifeTime))
continue;
// cout<<spinI_s<<" "<<ELevI<<" "<<spinF_s<<" "<<ELevF<<" "<<Energy<<endl;
NuclearLevel *NucLevel_F = GetLevel(NucLevF,LS_To_Plot);
if(NucLevel_F == nullptr)
{
if(TMath::Abs(ELevF)<0.001)
LSPlayer->AddGroundLevel(Nuc.GetZ(),Nuc.GetA(),spinF_s.Data());
else
LSPlayer->AddLevel(ELevF,0,spinF_s.Data());
NucLevel_F = GetLevel(NucLevF,LS_To_Plot);
if(NucLevel_F == nullptr) {
cout<<"tot "<< ELevF<<" "<<(TMath::Abs(ELevF)<0.001)<<endl;
if(TMath::Abs(ELevF)<0.001){
NucLevel_F = LSPlayer->AddGroundLevel(Nuc.GetZ(),Nuc.GetA(),spinF_s.Data());
NucLevel_F->SetLabels(spinF_s.Data(),"",LifeTimestrF.Data(),Form("%g",ELevF));
}
else {
NucLevel_F = LSPlayer->AddLevel(ELevF,0,spinF_s.Data());
NucLevel_F->SetLabels(spinF_s.Data(),"",LifeTimestrF.Data(),Form("%g",ELevF));
}
}
LS_To_Plot->SetCLevel(NucLevel_F);
NuclearLevel *NucLevel_I = GetLevel(NucLevI,LS_To_Plot);
if(NucLevel_I == nullptr)
{
LSPlayer->AddLevel(ELevI,0,spinI_s.Data());
NucLevel_I = GetLevel(NucLevI,LS_To_Plot);
if(NucLevel_I == nullptr) {
NucLevel_I = LSPlayer->AddLevel(ELevI,0,spinI_s.Data());
NucLevel_I->SetLabels(spinI_s.Data(),"",LifeTimestrI.Data(),Form("%g",ELevI));
}
LSPlayer->HandleMovement(kKeyPress,-666,kKey_s,NucLevel_I);
LSPlayer->HandleMovement(kKeyPress,-666,kKey_s,NucLevel_F);
DrawLink(LS_To_Plot,Link);
}
Float_t YMax=0;
for(int i=0 ; i<LS_To_Plot->GetLevels().GetEntries() ; i++)
{
for(int i=0 ; i<LS_To_Plot->GetLevels().GetEntries() ; i++) {
NuclearLevel *lev = (NuclearLevel*)LS_To_Plot->GetLevels().At(i);
lev->SetVisLabel("1001");
lev->SetVisLabel("1111");
if(lev->GetEnergy().Get()>YMax)
YMax = lev->GetEnergy().Get();
......@@ -721,8 +729,7 @@ void CXLevelSchemePlayer::PlotLevelScheme(TString NucName, TString Type)
lev->SetX2(fRangeXMax);
}
for(int i=0 ; i<LS_To_Plot->GetLinks().GetEntries() ; i++)
{
for(int i=0 ; i<LS_To_Plot->GetLinks().GetEntries() ; i++) {
Link* link = (Link*)LS_To_Plot->GetLinks().At(i);
link->RefreshPoints();
......@@ -730,11 +737,13 @@ void CXLevelSchemePlayer::PlotLevelScheme(TString NucName, TString Type)
}
LS_To_Plot->Draw();
LSPlayer->GetLSAxis()->SetRange(0,YMax,fRangeXMin,fRangeXMax);
ctest->SetName(Form("ENSDFLS_%s",NucName.Data()));
ctest->SetTitle(Form("ENSDF level Scheme for nuc %s",NucName.Data()));
gSystem->ProcessEvents();
LSPlayer->RefreshLinks();
}
void CXLevelSchemePlayer::DrawLink(LevelScheme *ls, GammaLink *gammalink)
......@@ -742,25 +751,20 @@ void CXLevelSchemePlayer::DrawLink(LevelScheme *ls, GammaLink *gammalink)
Float_t energy = gammalink->GetEnergy().Get();
Float_t strenght = gammalink->GetStrength().Get();
if(strenght==0)
strenght=5;
// cout<<"DrawLink "<<energy<<" "<<strenght<<" "<<GetSpinFromLev((NuclearLevel*)gammalink->GetIL())<<" -> "<<GetSpinFromLev((NuclearLevel*)gammalink->GetFL())<< endl;
GLSPlayer *LSPlayer = (GLSPlayer*)ls->GetPlayer();
LSPlayer->AddLink(strenght,0,energy);
GammaLink *NewLink = (GammaLink*) ls->GetLinks().Last();
if(ls->GetLinks().GetEntries()==1)
{
if(ls->GetLinks().GetEntries()==1) {
NewLink->RefreshPoints();
NewLink->Paint();
}
Bool_t ok = false;
while(ok==false)
{
while(ok==false) {
Float_t xmin_new,xmax_new,ymin_new,ymax_new;
GetLimits(NewLink,xmin_new,xmax_new,ymin_new,ymax_new);
......@@ -769,22 +773,16 @@ void CXLevelSchemePlayer::DrawLink(LevelScheme *ls, GammaLink *gammalink)
ok = true;
for(Int_t i=0 ; i<ls->GetLinks().GetSize()-1 ; i++)
{
for(Int_t i=0 ; i<ls->GetLinks().GetSize()-1 ; i++) {
GammaLink *Link= (Gw::GammaLink*)ls->GetLinks().At(i);
Float_t xmin,xmax,ymin,ymax;
GetLimits(Link,xmin,xmax,ymin,ymax);
if((ymin+0.5>ymax_new) || (ymax-0.5<ymin_new))
{
continue;
}
else if((xmax<xmin_new) || (xmin>xmax_new))
{
continue;
}
else
{
else {
ShiftLink(NewLink,60);
ok = false;
break;
......@@ -833,8 +831,7 @@ NuclearLevel *CXLevelSchemePlayer::GetLevel(NuclearLevel *nuclev, LevelScheme *l
NuclearLevel *level = nullptr;
for(Int_t i=0 ; i<ls->GetLevels().GetSize() ; i++)
{
for(Int_t i=0 ; i<ls->GetLevels().GetSize() ; i++) {
level = (NuclearLevel*)ls->GetLevels().At(i);
Float_t ELevel2 = level->GetEnergy().GetValue();
......@@ -901,6 +898,39 @@ void CXLevelSchemePlayer::RemoveArrow(Int_t ArrowIndex)
fMainWindow->GetCanvas()->Update();
}
TString CXLevelSchemePlayer::GetLTString(Float_t LifeTime)
{
TString Value="";
if(LifeTime >0.) {
if(LifeTime<1e-12)
Value = Form("%.3g fs",LifeTime*1e15);
else if(LifeTime<1e-9)
Value = Form("%.3g ps",LifeTime*1e12);
else if(LifeTime<1e-6)
Value = Form("%.3g ns",LifeTime*1e9);
else if(LifeTime<1e-3)
Value = Form("%.3g us",LifeTime*1e6);
else if(LifeTime<1e-0)
Value = Form("%.3g ms",LifeTime*1e3);
else if(LifeTime<60)
Value = Form("%.3g s",LifeTime);
else if(LifeTime<3600)
Value = Form("%.3g min",LifeTime/60.);
else if(LifeTime<3600*12)
Value = Form("%.3g h",LifeTime/3600.);
else if(LifeTime<3600*24*365.242190517)
Value = Form("%.3g d",LifeTime/(3600.*24));
else if(!isinf(LifeTime))
Value = Form("%.3g y",LifeTime/(3600.*24*365.242190517));
else
Value = Form("STABLE");
}
Value.Append(" ");
return Value;
}
ClassImp(CXLevelSchemePlayer);
......
......@@ -77,12 +77,12 @@ public:
Bool_t CanReplot(){return fCanReplot;}
LevelScheme *ImportExpData(const char *NucSymbol);
LevelScheme *ImportENSDFData(const char *NucSymbol, bool quietmode=false, TString dataset="");
LevelScheme *ImportENSDFData(const char *NucSymbol, bool quietmode=false,TString dataset="", bool graphical=false);
void ProcessedEventLevelScheme(Int_t eventType, Int_t eventX, Int_t eventY, TObject*obj);
void RemoveArrow(Int_t ArrowIndex);
void PlotLevelScheme(TString NucName, TString Type="ENSDF");
void PlotLevelScheme(TString NucName, TString Type="ENSDF", TString DataSet="ADOPTED LEVELS, GAMMAS");
TString PrintNucleusLevels(Int_t Z, Int_t N, bool print = false);
TString PrintNucleusLevels(LevelScheme *lev, TString NucName, bool print = false);
......@@ -91,6 +91,7 @@ public:
TString PrintNucleusGammas(LevelScheme *lev, TString NucName, bool print = false);
LevelScheme *GetLevelScheme(TString Symb, bool print = false, TString dataset="");
TString GetLTString(Float_t LifeTime);
private:
......
......@@ -555,9 +555,11 @@ void CXNucChart::SelectNucleus(Int_t Z, Int_t N)
fDataSetMode->Select(0);
}
if(fDataSetMode->GetNumberOfEntries() == 0)
PrintInfos(true);
fNucleusTextEntry->SetTitle(data->Symb);
fNucleusTextEntry->SetTextColor(CXblack);
PrintInfos();
CXNucleusBox *box = (CXNucleusBox*)fListOfBoxes->FindObject(Form("(Z=%d,N=%d)",Z,N));
if(box) {
......@@ -606,9 +608,9 @@ void CXNucChart::HandleMovement(Int_t EventType, Int_t EventX, Int_t EventY, TOb
Int_t N = TMath::Nint(fNucChartHist->GetXaxis()->GetBinCenter(fNucChartHist->GetXaxis()->FindBin(fCanvas->AbsPixeltoX(EventX))));
SelectNucleus(Z,N);
}
if(EventType == kButton1Double) {
PrintInfos(true);
}
// if(EventType == kButton1Double) {
// PrintInfos(true);
// }
/// Recuperation de la derniere position de la souris
if(EventType == kMouseMotion) {
......@@ -635,7 +637,11 @@ void CXNucChart::PrintInfos(bool inprompt)
fInfoBox->RemoveAll();
if(fPrintMode->GetSelected() == M_NucInfo) {
if(inprompt) cout<<Form("Nucleus: %s (Z:%d, N:%d)",fSelectedNucleus->Symb.Data(),fSelectedNucleus->Z,fSelectedNucleus->N)<<endl;
if(inprompt) {
TString text = Form("** Nucleus: %s (Z:%d, N:%d) **",fSelectedNucleus->Symb.Data(),fSelectedNucleus->Z,fSelectedNucleus->N);
TString stars; for (int i=0 ; i<text.Length() ; i++) stars.Append("*");
cout<<endl<<endl<<stars<<endl<<text<<endl<<stars<<endl<<endl;
}
PrintInListBox(Form("Nucleus: %s (Z:%d, N:%d)",fSelectedNucleus->Symb.Data(),fSelectedNucleus->Z,fSelectedNucleus->N),kPrint);
if(fSelectedNucleus->BE2_E2B2.GetValue() != 0.) {
if(inprompt) cout<<Form("B(E2) (e2b2): %g (%g)",fSelectedNucleus->BE2_E2B2.GetValue(),fSelectedNucleus->BE2_E2B2.GetError())<<endl;
......@@ -651,7 +657,7 @@ void CXNucChart::PrintInfos(bool inprompt)
cout<<Form("Jpi : %s",lev.JPi.Data())<<endl;
cout<<Form("Mass Excess : %g (%g)",lev.MassExc,lev.MassExc_err)<<endl;
cout<<Form("T 1/2 : %s",lev.LT_Text.Data())<<endl;
cout<<Form("Abundance : %g %% (%g)",lev.Abund.GetValue(),lev.Abund.GetError());
cout<<Form("Abundance : %g %% (%g)",lev.Abund.GetValue(),lev.Abund.GetError())<<endl;
}
PrintInListBox("");
PrintInListBox(Form("Energy (keV): %g",lev.Energy),kInfo);
......@@ -659,14 +665,16 @@ void CXNucChart::PrintInfos(bool inprompt)
PrintInListBox(Form("Mass Excess : %g (%g)",lev.MassExc,lev.MassExc_err),kInfo);
PrintInListBox(Form("T 1/2 : %s",lev.LT_Text.Data()),kInfo);
if(lev.Abund.GetValue() != 0) PrintInListBox(Form("Abundance : %g %% (%g)",lev.Abund.GetValue(),lev.Abund.GetError()),kInfo);
for(int j=0 ;j<lev.Decays.size() ; j++) {
if(inprompt) cout<<Form("decay : %s",lev.Decays.at(j).first.Data())<<endl;
PrintInListBox(Form("decay : %s",lev.Decays.at(j).first.Data()),kInfo);
if(!lev.LT_Text.Contains("STABLE")) {
for(int j=0 ;j<lev.Decays.size() ; j++) {
if(inprompt) cout<<Form("decay : %s",lev.Decays.at(j).first.Data())<<endl;
PrintInListBox(Form("decay : %s",lev.Decays.at(j).first.Data()),kInfo);
}
}
}
}
else if(fPrintMode->GetSelected() == M_LevelsInfo) {
TString Text = fMainWindow->GetLSPlayer()->GetPlayer()->PrintNucleusLevels(fSelectedLevelScheme,inprompt);
TString Text = fMainWindow->GetLSPlayer()->GetPlayer()->PrintNucleusLevels(fSelectedLevelScheme,fSelectedNucleus->Symb,inprompt);
PrintInListBox(Form("Energy (keV)"),kInfo);
TObjArray *arr = Text.Tokenize("!");
......@@ -676,7 +684,7 @@ void CXNucChart::PrintInfos(bool inprompt)
delete arr;
}
else if(fPrintMode->GetSelected() == M_GammaInfos) {
TString Text = fMainWindow->GetLSPlayer()->GetPlayer()->PrintNucleusGammas(fSelectedLevelScheme,inprompt);
TString Text = fMainWindow->GetLSPlayer()->GetPlayer()->PrintNucleusGammas(fSelectedLevelScheme,fSelectedNucleus->Symb,inprompt);
PrintInListBox(Form("Energy (keV)"),kInfo);
......@@ -771,7 +779,7 @@ void CXNucChart::UpdateRange()
fZMax = fCanvas->GetUymax();
Int_t Height = fZMax-fZMin;
if(Width<Height) {
if(Width>(Height*1.5)) {
if(fNMin+Height<fNucChartHist->GetXaxis()->GetXmax()) {
fNucChartHist->GetXaxis()->SetRangeUser(fNMin,fNMin+Height);
}
......@@ -807,7 +815,7 @@ void CXNucChart::UpdateDataSet()
fSelectedLevelScheme = nullptr;
if(fSelectedNucleus)
fSelectedLevelScheme = fMainWindow->GetLSPlayer()->GetPlayer()->GetLevelScheme(fSelectedNucleus->Symb,false,dataset);
PrintInfos();
PrintInfos(true);
}
ClassImp(CXNucChart);
......
......@@ -91,7 +91,7 @@ public:
void PrintInfos(bool inprompt = false);
void NucNotValidated();
void UpdateNucFromSymb();
void UpdatePrintMode(){PrintInfos();}
void UpdatePrintMode(){PrintInfos(true);}
void UpdateDataSet();
static void SetPalette(Int_t Mode);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment