Commit 3fc920a2 authored by J. Dudouet's avatar J. Dudouet
Browse files

remove bugs on macos

parent 47f80390
Pipeline #56820 failed with stage
in 1 minute and 7 seconds
......@@ -43,10 +43,15 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib_)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib_)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin_)
#if(APPLE)
# set(CMAKE_MACOSX_RPATH 1)
#endif()
#set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
cmake_policy(SET CMP0077 NEW)
cmake_policy(SET CMP0068 NEW)
# FIX Warning with rpath on macosx
if(APPLE)
set(CMAKE_MACOSX_RPATH 1)
endif()
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
#
# ROOT MANDATORY
#
......
How to create/update the database
1) dowload, in the DataBase/LevelScheme/Downloads folder (create it if not existing), the zip files (3 files) from: https://www.nndc.bnl.gov/ensarchivals/
1) download, in the DataBase/LevelScheme/Downloads folder (create it if not existing), the zip files (3 files) from: https://www.nndc.bnl.gov/ensarchivals/
ex: for the data from 01/11/2018
ex: for the data from 04/10/2019
wget https://www.nndc.bnl.gov/ensarchivals/distributions/dist18/ensdf_181101_099.zip -P Downloads/
wget https://www.nndc.bnl.gov/ensarchivals/distributions/dist18/ensdf_181101_199.zip -P Downloads/
wget https://www.nndc.bnl.gov/ensarchivals/distributions/dist18/ensdf_181101_299.zip -P Downloads/
mkdir -p $GWSYS/DataBase/LevelScheme/Downloads
cd $GWSYS/DataBase/LevelScheme/
wget https://www.nndc.bnl.gov/ensarchivals/distributions/dist19/ensdf_191004_099.zip -P Downloads/
wget https://www.nndc.bnl.gov/ensarchivals/distributions/dist19/ensdf_191004_199.zip -P Downloads/
wget https://www.nndc.bnl.gov/ensarchivals/distributions/dist19/ensdf_191004_300.zip -P Downloads/
2) execute the ExtractFiles script, giving the files to process in argument:
chmod u+w src/compile.sh
src/compile.sh
chmod u+x src/compile.sh
./src/compile.sh
./ExtractFiles Downloads/ensdf_181101_*.zip
......@@ -2,4 +2,4 @@
NAME=ExtractFiles
NAME2=src/ExtractFiles.cpp
g++ $NAME2 -o $NAME -O6 -g `root-config --cflags` `root-config --cflags --libs` -lProof
g++ $NAME2 -o $NAME -O3 -g `root-config --cflags` `root-config --cflags --libs` -lProof
......@@ -12,10 +12,6 @@ CXArrow::CXArrow(CXFit *fit, Double_t E,Double_t y1 ,Double_t y2,Float_t arrowsi
fFit = fit;
}
CXArrow::~CXArrow()
{
}
void CXArrow::SetEnergy(Float_t E)
{
SetX1(E);
......@@ -39,27 +35,27 @@ void CXArrow::RemoveArrow()
void CXArrow::RemoveFit()
{
if(fFit)
delete fFit;
delete fFit;
}
Int_t CXArrow::Compare(const TObject *obj) const
{
if(obj->InheritsFrom(CXArrow::Class())) {
CXArrow *arr = (CXArrow*)obj;
auto *arr = dynamic_cast<const CXArrow*>(obj);
return (GetEnergy() > arr->GetEnergy()) ? 1 : -1;
}
else return 0;
return 0;
}
void CXArrow::SetText(TH1 *hist, TString text, TString tooltip)
void CXArrow::SetText(TH1 *hist, const TString &text, const TString &tooltip)
{
Int_t XMinbin = hist->GetXaxis()->GetFirst();
Int_t XMaxbin = hist->GetXaxis()->GetLast();
Int_t XMin = hist->GetBinLowEdge(XMinbin);
Int_t XMax = hist->GetBinLowEdge(XMaxbin);
if(fBox) delete fBox;
delete fBox;
fBox = new CXArrowBox(this);
fBox->SetX1(fX1-(XMax-XMin)/300.);
......@@ -73,7 +69,7 @@ void CXArrow::SetText(TH1 *hist, TString text, TString tooltip)
fBox->SetLineColor(0);
fBox->SetLineStyle(3);
if(fLatex) delete fLatex;
delete fLatex;
fLatex = new TLatex(fX1,fY2,text);
fLatex->SetTextAngle(90);
fLatex->SetTextFont(132);
......
......@@ -28,7 +28,7 @@ private:
public:
CXArrow(CXFit *fit, Double_t E,Double_t y1 ,Double_t y2,Float_t arrowsize=0.05,Option_t *option=">");
~CXArrow();
~CXArrow() = default;
CXFit *GetFit(){return fFit;}
......@@ -41,7 +41,7 @@ public:
void RemoveArrow(); // *MENU*
void RemoveFit(); // *MENU*
void SetText(TH1 *hist, TString text, TString tooltip);
void SetText(TH1 *hist, const TString &text, const TString &tooltip);
void ClearPad(TVirtualPad *pad = nullptr, bool refresh = true);
......
......@@ -21,15 +21,14 @@ CXBgdUtility::CXBgdUtility(const TGCompositeFrame *MotherFrame, UInt_t w, UInt_t
fListOfButtons1D = new TList();
TGLayoutHints *GroupHints = new TGLayoutHints(kLHintsCenterY | kLHintsLeft | kLHintsExpandX, -10, -10, 0, 0);
TGLayoutHints *HFHints = new TGLayoutHints(kLHintsCenterY | kLHintsLeft,5,0,8,0);
auto *GroupHints = new TGLayoutHints(kLHintsCenterY | kLHintsLeft | kLHintsExpandX, -10, -10, 0, 0);
auto *HFHints = new TGLayoutHints(kLHintsCenterY | kLHintsLeft,5,0,8,0);
TGGroupFrame *f1DGroupFrame = new TGGroupFrame(MotherFrame, "1D background", kVerticalFrame);
auto *f1DGroupFrame = new TGGroupFrame(MotherFrame, "1D background", kVerticalFrame);
f1DGroupFrame->SetTextColor(red);
f1DGroupFrame->SetTitlePos(TGGroupFrame::kLeft); // right aligned
AddFrame(f1DGroupFrame, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX, 0, 0, 0, 0));
//Activation du mode background supress
fGroupFrame = new TGGroupFrame(f1DGroupFrame, "Activate utility", kVerticalFrame);
......@@ -142,8 +141,7 @@ CXBgdUtility::CXBgdUtility(const TGCompositeFrame *MotherFrame, UInt_t w, UInt_t
fGroupFrame->AddFrame(fHorizontalFrame,HFHints);
fHorizontalFrame = new TGCompositeFrame(fGroupFrame, 60, 20, kHorizontalFrame);
for(int i=0 ; i<7 ; i++)
{
for(int i=0 ; i<7 ; i++) {
fSmoothingButton1D[i] = new TGRadioButton(fHorizontalFrame, Form("%d",3+2*i), i);
if(i==0) fSmoothingButton1D[i]->SetState(kButtonDown);
fSmoothingButton1D[i]->Connect("Clicked()", "CXBgdUtility", this, "HandleSmoothButtons()");
......
......@@ -20,7 +20,7 @@ protected:
private:
CXMainWindow *fMainWindow;
CXMainWindow *fMainWindow{};
TGLabel *fLabel;
TGGroupFrame *fGroupFrame;
......@@ -44,17 +44,17 @@ private:
bool fCompton;
TGNumberEntry *fNItersButton1D;
TGNumberEntry *fNItersButton2D[2];
TGNumberEntry *fNItersButton2D[2]={};
TGRadioButton *fDirectionButton1D[2];
TGRadioButton *fFilterOrderButton1D[4];
TGRadioButton *fSmoothingButton1D[7];
TGRadioButton *fDirectionButton1D[2]={};
TGRadioButton *fFilterOrderButton1D[4]={};
TGRadioButton *fSmoothingButton1D[7]={};
TGTextButton *fSubtractButton;
TGTextButton *f2DEvalButton;
TGRadioButton *fDirectionButton2D[2];
TGRadioButton *fFilterOrderButton2D[2];
TGRadioButton *fDirectionButton2D[2]={};
TGRadioButton *fFilterOrderButton2D[2]={};
TList *fListOfButtons1D = nullptr;
......@@ -63,9 +63,9 @@ private:
TH2 *fCurrent2DBackd = nullptr;
TH2 *fCurrent2DSubtract = nullptr;
ULong_t red;
ULong_t blue;
ULong_t black;
ULong_t red={};
ULong_t blue={};
ULong_t black={};
public:
CXBgdUtility(const TGCompositeFrame *MotherFrame, UInt_t w, UInt_t h);
......
......@@ -384,8 +384,27 @@ void CXCanvas::HandleInput(EEventType event, Int_t px, Int_t py)
case kButton1Double:
case kButton1Shift:
if (FindHisto() && !FindHisto()->InheritsFrom("TH2"))
if (FindHisto() && !FindHisto()->InheritsFrom("TH2")) {
moved1D = true;
oldx = GetEventX();
oldy = GetEventY();
xmin = AbsPixeltoX(oldx);
ymin = AbsPixeltoY(oldy);
fZoomBox = new TBox(xmin, ymin, AbsPixeltoX(oldx), AbsPixeltoY(oldy));
Int_t ci = TColor::GetColor("#7d7dff");
TColor *zoomcolor = gROOT->GetColor(ci);
if (!SupportAlpha() || !zoomcolor)
fZoomBox->SetFillStyle(3002);
else
zoomcolor->SetAlpha(0.5);
fZoomBox->SetFillColor(ci);
fZoomBox->Draw();
gPad->Modified();
gPad->Update();
}
gVirtualX->SetLineWidth(1);
/* fall through */
......@@ -405,9 +424,7 @@ void CXCanvas::HandleInput(EEventType event, Int_t px, Int_t py)
RunAutoExec();
if (fSelected->InheritsFrom("TH2") || (FindHisto() && !FindHisto()->InheritsFrom("TH2"))) {
gVirtualX->SetLineWidth(1);
oldx = GetEventX();
oldy = GetEventY();
xmin = AbsPixeltoX(oldx);
......@@ -465,6 +482,15 @@ void CXCanvas::HandleInput(EEventType event, Int_t px, Int_t py)
oldx = GetEventX();
oldy = GetEventY();
gVirtualX->DrawBox(XtoAbsPixel(xmin), YtoAbsPixel(ymin), oldx, oldy, TVirtualX::kHollow);
if (fZoomBox) {
fZoomBox->SetX1(xmin);
fZoomBox->SetY1(ymin);
fZoomBox->SetX2(AbsPixeltoX(oldx));
fZoomBox->SetY2(AbsPixeltoY(oldy));
}
gPad->Modified();
gPad->Update();
}
break;
......@@ -552,6 +578,9 @@ void CXCanvas::HandleInput(EEventType event, Int_t px, Int_t py)
moved1D = false;
xmax = xmin = ymax = ymin = 0.;
delete fZoomBox;
fZoomBox = nullptr;
}
Update(); // before calling update make sure gPad is reset
......
......@@ -50,6 +50,7 @@ protected:
TGFrame* fKeyHandler; //! handler for keys
Bool_t fFreezed;
TBox *fZoomBox;
Int_t fLastX;
Int_t fLastY;
......
......@@ -107,7 +107,7 @@ void CXFit::Update()
else Ener.Add(arr);
}
for(uint i=0 ; i<back.GetEntries() ; i++) {
for(int i=0 ; i<back.GetEntries() ; i++) {
CXArrow *arr = (CXArrow*)back.At(i);
Double_t E = arr->GetEnergy();
Double_t MaxGlob = fHistogram->GetMaximum();
......@@ -117,7 +117,7 @@ void CXFit::Update()
arr->SetFillColor(kBlue);
fBackgd.push_back(E);
}
for(uint i=0 ; i<Ener.GetEntries() ; i++) {
for(int i=0 ; i<Ener.GetEntries() ; i++) {
CXArrow *arr = (CXArrow*)Ener.At(i);
Double_t E = arr->GetEnergy();
Double_t MaxGlob = fHistogram->GetMaximum();
......
......@@ -334,7 +334,7 @@ void CXHist1DPlayer::PeakSearch()
void CXHist1DPlayer::NewFit()
{
fCurrentHist = fMainWindow->GetHisto();
cout<<fCurrentHist<<endl;
if(fCurrentHist==nullptr || fCurrentHist->InheritsFrom(TH2::Class())) {
cout<<"No 1D istogram found, ignored"<<endl;
return;
......
......@@ -304,7 +304,7 @@ void CXMainWindow::Init()
fVFRight->AddFrame(fStatusBar, new TGLayoutHints(kLHintsBottom | kLHintsLeft | kLHintsExpandX, 0, 0, 2, 0));
AddFrame(fHf, new TGLayoutHints(kLHintsRight | kLHintsExpandX | kLHintsExpandY));
UpdateContextMenus();
// What to clean up in destructor
......@@ -584,6 +584,7 @@ void CXMainWindow::NewTab(Int_t px, Int_t py, TString name)
fRootCanvas = new TRootEmbeddedCanvas("ec1", atab);
atab->AddFrame(fRootCanvas, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX | kLHintsExpandY, 5, 5, 5, 5));
Int_t canvasid = fRootCanvas->GetCanvasWindowId();
delete fRootCanvas->GetCanvas();
fCanvas = new CXCanvas(TabName.Copy().ReplaceAll(" ","_"), 10, 10, canvasid);
fCanvas->SetMainWindow(this);
fListOfCanvases->Add(fCanvas);
......@@ -904,8 +905,9 @@ TH1 *CXMainWindow::GetHisto(TVirtualPad *pad, bool GetFirst)
while (lnk) {
obj = lnk->GetObject();
if (obj->InheritsFrom(TH1::Class())) {
if (obj->InheritsFrom(TH1::Class()) && strncmp(obj->GetName() ,"hframe",strlen(obj->GetName()))) {
hist = dynamic_cast<TH1*>(obj);
hist->Print();
if(GetFirst) return hist;
}
lnk = (TObjOptLink*)lnk->Next();
......
......@@ -122,9 +122,10 @@ CXNucChart::CXNucChart(const TGWindow *p, const TGWindow *main, UInt_t w, UInt_t
Global->AddFrame(Main,new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX | kLHintsExpandY,0,5,5,5));
Main->SetWidth(800);
TRootEmbeddedCanvas *fRootCanvas = new TRootEmbeddedCanvas("NCCanvas", Main);
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();
......@@ -549,7 +550,7 @@ void CXNucChart::SelectNucleus(Int_t Z, Int_t N)
fSelectedLevelScheme = fMainWindow->GetLSPlayer()->GetPlayer()->GetLevelScheme(data->Symb);
if(fSelectedLevelScheme) {
for(int i=0 ; i< fSelectedLevelScheme->GetDataSets().size() ; i++) {
for(uint i=0 ; i< fSelectedLevelScheme->GetDataSets().size() ; i++) {
fDataSetMode->AddEntry(fSelectedLevelScheme->GetDataSets().at(i).Dsid.data(),i);
}
fDataSetMode->Select(0);
......@@ -649,7 +650,7 @@ void CXNucChart::PrintInfos(bool inprompt)
PrintInListBox(Form("B(E2) (e2b2): %g (%g)",fSelectedNucleus->BE2_E2B2.GetValue(),fSelectedNucleus->BE2_E2B2.GetError()),kPrint);
PrintInListBox(Form("B(E2) (W.u.): %g (%g)",fSelectedNucleus->BE2_WU.GetValue(),fSelectedNucleus->BE2_WU.GetError()),kPrint);
}
for(int i=0 ; i<fSelectedNucleus->Levels.size() ; i++) {
for(uint i=0 ; i<fSelectedNucleus->Levels.size() ; i++) {
NucLevel lev = fSelectedNucleus->Levels.at(i);
if(inprompt) {
cout<<endl;
......@@ -666,7 +667,7 @@ void CXNucChart::PrintInfos(bool inprompt)
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);
if(!lev.LT_Text.Contains("STABLE")) {
for(int j=0 ;j<lev.Decays.size() ; j++) {
for(uint 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);
}
......
......@@ -14,6 +14,7 @@ class TGComboBox;
class TH2D;
class NucData;
class TGTextEntry;
class TRootEmbeddedCanvas;
using namespace Gw;
......@@ -38,6 +39,7 @@ private:
CXMainWindow *fMainWindow;
TGListBox *fInfoBox;
TRootEmbeddedCanvas *fRootCanvas;
CXCanvas *fCanvas;
TGStatusBar *fStatusBar;
TGComboBox *fViewMode;
......
......@@ -152,8 +152,6 @@ private:
int lumy3d[RW_MAXCH+16];
int lumz3d[RW_MAXCH+16];
int gate_label_h_offset = 0;
/* look up minicube addr */
#define LUMC3D(x,y,z) lumx3d[x] + lumy3d[y] + lumz3d[z]
......
......@@ -5,6 +5,7 @@
#include "TGClient.h"
#include "TString.h"
#include "TEnv.h"
#include "TROOT.h"
#include "CXMainWindow.h"
......@@ -50,10 +51,11 @@ int main(int argc, char **argv)
// make sure that the Gpad and GUI libs are loaded
TRint::NeedGraphicsLibs();
// TApplication::NeedGraphicsLibs();
// gApplication->InitializeGraphics();
TApplication::NeedGraphicsLibs();
gApplication->InitializeGraphics();
fCXMainWindow = new CXMainWindow(gClient->GetRoot(), 1300, 600 );
theApp->Run(false);
if (fCXMainWindow) {
......
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