diff --git a/Examples/Example2/ShowResults.C b/Examples/Example2/ShowResults.C index 3da629ce34bd0fa5fcba4e423ab15631ffee27e2..2898696c6f690b5fe176aa8712f901dd781635d7 100644 --- a/Examples/Example2/ShowResults.C +++ b/Examples/Example2/ShowResults.C @@ -15,7 +15,6 @@ TChain* chain = LoadChain(); TCanvas* c1 = new TCanvas("Example2","Example2",0,0,800,800); c1->Divide(2,2); - // Kinematic Line c1->cd(1); chain->Draw("ELab:ThetaLab>>hKine(180,0,180,400,0,20)","ELab>0","colz"); diff --git a/NPLib/CMakeLists.txt b/NPLib/CMakeLists.txt index 5da89f42651dd7763657ff49bc504fbf108e3143..1594e19a32d283cc4446a07c8fa60569ee9c19de 100644 --- a/NPLib/CMakeLists.txt +++ b/NPLib/CMakeLists.txt @@ -47,6 +47,15 @@ if(${CMAKE_CXX_COMPILER_ID} MATCHES ".*Clang.*") endif() endif() +# If compiler is GCC active the color diagnostic +if(${CMAKE_CXX_COMPILER_ID} MATCHES ".*GNU.*") +execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion + OUTPUT_VARIABLE GCC_VERSION) + if (GCC_VERSION VERSION_GREATER 4.9 OR GCC_VERSION VERSION_EQUAL 4.9) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-color=always") + endif() +endif() + # Adjust the compiler language flag set(NOCPPFLAGS true) if(${CMAKE_CXX_FLAGS} MATCHES ".*std=.*11") diff --git a/NPLib/Core/RootInput.cxx b/NPLib/Core/RootInput.cxx index ae605d165a4d6b75821ee8cea9ae531f0c103465..584ff84fce400b62277c7be34c37af77efb20279 100644 --- a/NPLib/Core/RootInput.cxx +++ b/NPLib/Core/RootInput.cxx @@ -301,6 +301,8 @@ RootInput::~RootInput(){ cout << endl << "Root Input summary" << endl; cout << " - Number of bites read: " << pRootFile->GetBytesRead() << endl; cout << " - Number of transactions: " << pRootFile->GetReadCalls() << endl; + // Close the Root file + pRootFile->Close(); } //////////////////////////////////////////////////////////////////////////////// diff --git a/NPLib/Physics/NPReaction.cxx b/NPLib/Physics/NPReaction.cxx index ed011dc6ee8836d2f46f30141395345fe40eeca3..411cd0987bb9d17774bffc4d59bf7f55c01b2282 100644 --- a/NPLib/Physics/NPReaction.cxx +++ b/NPLib/Physics/NPReaction.cxx @@ -147,7 +147,7 @@ Reaction::Reaction(string reaction){ fCrossSectionHist = new TH1F(Form("EnergyHist_%i",offset),"Reaction_CS",1,0,180); fDoubleDifferentialCrossSectionHist = NULL ; -fshoot3=true; + fshoot3=true; fshoot4=true; initializePrecomputeVariable(); diff --git a/NPLib/Utility/npanalysis.cxx b/NPLib/Utility/npanalysis.cxx index fcb8fbe3395595795dc92b3f397187a0aa60b67e..b572f8c9c2e7474b8fea5dfbcc9ac0aed12de108 100644 --- a/NPLib/Utility/npanalysis.cxx +++ b/NPLib/Utility/npanalysis.cxx @@ -16,7 +16,7 @@ // Root #include"TKey.h" #include"TEnv.h" - +#include"TROOT.h" void ProgressDisplay(clock_t&,clock_t&,unsigned long&, unsigned long&, unsigned long&, double&, unsigned long&, int&, int&); //////////////////////////////////////////////////////////////////////////////// int main(int argc , char** argv){ @@ -249,7 +249,7 @@ int main(int argc , char** argv){ RootOutput::Destroy(); RootInput::Destroy(); - return 0; +return 0; } //////////////////////////////////////////////////////////////////////////////// diff --git a/NPLib/Utility/nptool-installer.cxx b/NPLib/Utility/nptool-installer.cxx index ce82ae5c4b3aac2f8d049bef9b37dba70a64c1b9..226556aba1b97a4e97a6b1831dcd5417fbdf66b2 100644 --- a/NPLib/Utility/nptool-installer.cxx +++ b/NPLib/Utility/nptool-installer.cxx @@ -136,13 +136,17 @@ int main(int argc , char** argv){ } // Change all the .so to .dylib for Mac Os X in the installed rootmap +#ifdef __APPLE__ path = getenv("NPTOOL"); path += "/NPLib/*/*.rootmap"; string command = "ls "+ path +" > /dev/null 2>/dev/null"; - return_value=system(command.c_str()); + return_value=system(command.c_str()); + if(!return_value){ std::string command = "sed -i '' -e 's/"+INCORRECT_LIB_EXTENSION+"/"+CORRECT_LIB_EXTENSION+"/g' "+path; - return_value=system(command.c_str()); - } + return_value=system(command.c_str()); + } +#endif + return 0; } diff --git a/NPLib/ressources/CMake/NPAnalysis.cmake b/NPLib/ressources/CMake/NPAnalysis.cmake index 58ec6b2fabac199bf3a384530963aebcd1a1499f..5baa9cba5b00e92793ff5fd0c55d04b01ed1ee57 100644 --- a/NPLib/ressources/CMake/NPAnalysis.cmake +++ b/NPLib/ressources/CMake/NPAnalysis.cmake @@ -43,6 +43,16 @@ if(${CMAKE_CXX_COMPILER_ID} MATCHES ".*Clang.*") endif() endif() +# If compiler is GCC active the color diagnostic +if(${CMAKE_CXX_COMPILER_ID} MATCHES ".*GNU.*") +execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion + OUTPUT_VARIABLE GCC_VERSION) + if (GCC_VERSION VERSION_GREATER 4.9 OR GCC_VERSION VERSION_EQUAL 4.9) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-color=always") + endif() +endif() + + # Adjust the compiler language flag set(NOCPPFLAGS true) if(${CMAKE_CXX_FLAGS} MATCHES ".*std=.*11") diff --git a/NPLib/scripts/Style_nponline.C b/NPLib/scripts/Style_nponline.C index 56802af75214ee9992ac039ab21182032636c018..83c2018e5ad38cbcee67663125add5716079ebeb 100644 --- a/NPLib/scripts/Style_nponline.C +++ b/NPLib/scripts/Style_nponline.C @@ -6,79 +6,79 @@ void Style_nponline(){ // produce minimalist publication ready // outlook with nptool color scheme //----------------------------------- - TStyle* style_nponline = new TStyle("nponline", "style_nponline"); + TStyle* style = new TStyle("nponline", "style"); //General - style_nponline->SetFrameFillColor(kGray+3); - style_nponline->SetFrameBorderMode(0); - style_nponline->SetFrameLineColor(kGray+3); - style_nponline->SetStatColor(kGray+3); - style_nponline->SetFillColor(kGray+3); - style_nponline->SetTitleFillColor(kGray+3); - style_nponline->SetTitleColor(kWhite,"pad"); - style_nponline->SetTitleBorderSize(0); - style_nponline->SetTextColor(kWhite); + style->SetFrameFillColor(kGray+3); + style->SetFrameBorderMode(0); + style->SetFrameLineColor(kGray+3); + style->SetStatColor(kGray+3); + style->SetFillColor(kGray+3); + style->SetTitleFillColor(kGray+3); + style->SetTitleColor(kWhite,"pad"); + style->SetTitleBorderSize(0); + style->SetTextColor(kWhite); // Canvas - style_nponline->SetCanvasColor(kGray+3); - style_nponline->SetCanvasDefH(800); - style_nponline->SetCanvasDefW(800); - style_nponline->SetCanvasBorderMode(0); + style->SetCanvasColor(kGray+3); + style->SetCanvasDefH(800); + style->SetCanvasDefW(800); + style->SetCanvasBorderMode(0); // Pad - style_nponline->SetPadBottomMargin(0.10); - style_nponline->SetPadLeftMargin(0.15); - style_nponline->SetPadTopMargin(0.10); - style_nponline->SetPadRightMargin(0.15); - style_nponline->SetPadBorderMode(0); - style_nponline->SetPadBorderSize(1); - style_nponline->SetPadColor(kGray+3); - style_nponline->SetPadTickX(1); - style_nponline->SetPadTickY(1); + style->SetPadBottomMargin(0.10); + style->SetPadLeftMargin(0.15); + style->SetPadTopMargin(0.10); + style->SetPadRightMargin(0.15); + style->SetPadBorderMode(0); + style->SetPadBorderSize(1); + style->SetPadColor(kGray+3); + style->SetPadTickX(1); + style->SetPadTickY(1); // Desable stat title and fit - style_nponline->SetOptStat(0); - style_nponline->SetOptTitle(1); - style_nponline->SetOptFit(1); + style->SetOptStat(0); + style->SetOptTitle(1); + style->SetOptFit(1); // x axis - style_nponline->SetAxisColor(kWhite,"X"); - style_nponline->SetLabelColor(kWhite,"X"); - style_nponline->SetTitleXSize(0.06); - style_nponline->SetTitleXOffset(1.0); - style_nponline->SetLabelOffset(0.1,"X"); - style_nponline->SetLabelSize(0.06,"X"); - style_nponline->SetLabelOffset(0.006,"X"); + style->SetAxisColor(kWhite,"X"); + style->SetLabelColor(kWhite,"X"); + style->SetTitleXSize(0.06); + style->SetTitleXOffset(1.0); + style->SetLabelOffset(0.1,"X"); + style->SetLabelSize(0.06,"X"); + style->SetLabelOffset(0.006,"X"); // y axis - style_nponline->SetTitleYSize(0.06); - style_nponline->SetTitleYOffset(1.1); - style_nponline->SetLabelOffset(0.1,"Y"); - style_nponline->SetLabelSize(0.06,"Y"); - style_nponline->SetLabelOffset(0.006,"Y"); - style_nponline->SetAxisColor(kWhite,"Y"); - style_nponline->SetLabelColor(kWhite,"Y"); + style->SetTitleYSize(0.06); + style->SetTitleYOffset(1.1); + style->SetLabelOffset(0.1,"Y"); + style->SetLabelSize(0.06,"Y"); + style->SetLabelOffset(0.006,"Y"); + style->SetAxisColor(kWhite,"Y"); + style->SetLabelColor(kWhite,"Y"); // z axis - style_nponline->SetAxisColor(kWhite,"Z"); - style_nponline->SetLabelSize(0.06,"Z"); - style_nponline->SetLabelOffset(0.006,"Z"); - style_nponline->SetLabelColor(kWhite,"Z"); + style->SetAxisColor(kWhite,"Z"); + style->SetLabelSize(0.06,"Z"); + style->SetLabelOffset(0.006,"Z"); + style->SetLabelColor(kWhite,"Z"); // Histogramm - style_nponline->SetHistLineColor(kAzure+7); - style_nponline->SetHistFillStyle(1001); - style_nponline->SetHistFillColor(kAzure+7); - style_nponline->SetMarkerColor(kOrange+7); - style_nponline->SetMarkerStyle(20); - style_nponline->SetLineColor(kOrange+7); - style_nponline->SetLineWidth(1); - style_nponline->SetFuncColor(kOrange+7); - style_nponline->SetFuncWidth(2); + style->SetHistLineColor(kAzure+7); + style->SetHistFillStyle(1001); + style->SetHistFillColor(kAzure+7); + style->SetMarkerColor(kOrange+7); + style->SetMarkerStyle(20); + style->SetLineColor(kOrange+7); + style->SetLineWidth(1); + style->SetFuncColor(kOrange+7); + style->SetFuncWidth(2); - style_nponline->SetTitlePS("nptool"); + style->SetTitlePS("nptool"); const UInt_t Number = 2; Double_t Red[Number] = { 0,0 }; @@ -88,5 +88,5 @@ void Style_nponline(){ Double_t Length[Number] = { 0,1.00 }; Int_t nb=255; TColor::CreateGradientColorTable(Number,Length,Red,Green,Blue,nb); - style_nponline->SetNumberContours(99); + style->SetNumberContours(99); } diff --git a/NPLib/scripts/Style_nptool.C b/NPLib/scripts/Style_nptool.C index f5a6bb9c410cb7adad00bb6d4f0945273244473f..ccf35f6bee611d83bcb44edddcfcff4082856977 100644 --- a/NPLib/scripts/Style_nptool.C +++ b/NPLib/scripts/Style_nptool.C @@ -6,83 +6,87 @@ void Style_nptool(){ // produce minimalist publication ready // outlook with nptool color scheme //----------------------------------- - TStyle* style_nptool = new TStyle("nptool", "style_nptool"); + TStyle* style = new TStyle("nptool", "style"); + style->SetTitlePS("nptool"); //General - style_nptool->SetFrameFillColor(kWhite); - style_nptool->SetFrameBorderMode(0); - style_nptool->SetFrameLineColor(kBlack); - style_nptool->SetStatColor(kWhite); - style_nptool->SetFillColor(kWhite); - style_nptool->SetTitleFillColor(kWhite); - style_nptool->SetPaperSize(20,24); - // Canvas - style_nptool->SetCanvasColor(kWhite); - style_nptool->SetCanvasDefH(800); - style_nptool->SetCanvasDefW(800); - style_nptool->SetCanvasBorderMode(0); + style->SetFrameFillColor(kWhite); + style->SetFrameBorderMode(0); + style->SetFrameLineColor(kWhite); + style->SetStatColor(kBlack); + style->SetTitleFillColor(kWhite); + style->SetTitleColor(kBlack,"pad"); + style->SetTitleBorderSize(0); + style->SetTextColor(kBlack); + // Canvas + style->SetCanvasPreferGL(true); + style->SetCanvasColor(kWhite); + style->SetCanvasDefH(800); + style->SetCanvasDefW(800); + style->SetCanvasBorderMode(0); + // Pad - style_nptool->SetPadBottomMargin(0.15); - style_nptool->SetPadLeftMargin(0.15); - style_nptool->SetPadTopMargin(0.05); - style_nptool->SetPadRightMargin(0.10); - style_nptool->SetPadBorderMode(0); - style_nptool->SetPadBorderSize(1); - style_nptool->SetPadColor(kWhite); - style_nptool->SetPadTickX(1); - style_nptool->SetPadTickY(1); + style->SetPadBottomMargin(0.10); + style->SetPadLeftMargin(0.10); + style->SetPadTopMargin(0.15); + style->SetPadRightMargin(0.15); + style->SetPadBorderMode(0); + style->SetPadBorderSize(1); + // style->SetPadColor(kWhite); + style->SetPadTickX(1); + style->SetPadTickY(1); - // Desable stat title and fit - style_nptool->SetOptStat(0); - style_nptool->SetOptTitle(0); - //style_nptool->SetOptFit(0); + // Disable stat, title and fit + style->SetOptStat(0); + style->SetOptTitle(0); + style->SetOptFit(0); // x axis - style_nptool->SetTitleXSize(0.07); - style_nptool->SetTitleXOffset(1.0); - style_nptool->SetLabelOffset(0.1,"X"); - style_nptool->SetLabelSize(0.04,"X"); - style_nptool->SetLabelOffset(0.006,"X"); - - /*style_nptool->SetTitleBorderSize(0); - style_nptool->SetTitleX(0.1f); - style_nptool->SetTitleW(0.8f); - style_nptool->SetTitleAlign(3);*/ + style->SetAxisColor(kBlack,"X"); + style->SetLabelColor(kBlack,"X"); + style->SetTitleXSize(0.04); + style->SetTitleXOffset(1.0); + style->SetLabelOffset(0.1,"X"); + style->SetLabelSize(0.04,"X"); + style->SetLabelOffset(0.004,"X"); // y axis - //style_nptool->GetYaxis()->CenterTitle(); - style_nptool->SetTitleYSize(0.07); - style_nptool->SetTitleYOffset(1.02); - style_nptool->SetLabelOffset(0.1,"Y"); - style_nptool->SetLabelSize(0.04,"Y"); - style_nptool->SetLabelOffset(0.006,"Y"); + style->SetTitleYSize(0.04); + style->SetTitleYOffset(1.1); + style->SetLabelOffset(0.1,"Y"); + style->SetLabelSize(0.04,"Y"); + style->SetLabelOffset(0.004,"Y"); + style->SetAxisColor(kBlack,"Y"); + style->SetLabelColor(kBlack,"Y"); // z axis - style_nptool->SetLabelSize(0.04,"Z"); - style_nptool->SetLabelOffset(0.006,"Z"); - + style->SetAxisColor(kBlack,"Z"); + style->SetLabelSize(0.04,"Z"); + style->SetLabelOffset(0.004,"Z"); + style->SetLabelColor(kBlack,"Z"); // Histogramm - style_nptool->SetHistLineColor(kAzure+7); - style_nptool->SetHistFillStyle(1001); - style_nptool->SetHistFillColor(kAzure+7); - style_nptool->SetMarkerColor(kOrange+7); - style_nptool->SetMarkerStyle(20); - style_nptool->SetLineColor(kOrange+7); - style_nptool->SetLineWidth(2); - style_nptool->SetFuncColor(kOrange+7); - style_nptool->SetFuncWidth(2); - - style_nptool->SetTitlePS("nptool"); + style->SetHistLineColor(kAzure+7); + // style->SetHistFillStyle(1001); + style->SetHistFillColor(kAzure+7); + + // Graph, Line and Marker + style->SetMarkerStyle(20); + style->SetMarkerColor(kOrange+7); + style->SetLineColor(kOrange+7); + style->SetLineWidth(1); + style->SetFuncColor(kOrange+7); + style->SetFuncWidth(2); + // Create the color gradiant const UInt_t Number = 2; - Double_t Red[Number] = { 0, 0 }; - Double_t Green[Number] = { 0, 0.8 }; - Double_t Blue[Number] = { 0, 1.00 }; + Double_t Red[Number] = { 0,0 }; + Double_t Green[Number] = { 0,0.8 }; + Double_t Blue[Number] = { 0,1.00 }; Double_t Length[Number] = { 0,1.00 }; Int_t nb=255; TColor::CreateGradientColorTable(Number,Length,Red,Green,Blue,nb); - style_nptool->SetNumberContours(99); + style->SetNumberContours(99); } diff --git a/NPLib/scripts/test/simulation_run.sh b/NPLib/scripts/test/simulation_run.sh index 6dac7f956520710f02efa7c5872e0831470a6a0a..0d3a0fdc1dda954642b885a188d3361898b020f7 100755 --- a/NPLib/scripts/test/simulation_run.sh +++ b/NPLib/scripts/test/simulation_run.sh @@ -7,4 +7,4 @@ set -ev cd $NPTOOL/Examples/Example2 npsimulation -D Example2.detector -E Example2.reaction -O Example2 -B 28Mg.mac npanalysis --last-sim -O Example2 -echo ".q" | root -b -l ShowResult.C +echo ".q" | root -b -l ShowResults.C diff --git a/NPSimulation/CMakeLists.txt b/NPSimulation/CMakeLists.txt index e127a0a59f05666a71631e9dc2df804dbb2c960a..a99ffb2d31cf69225bdeba9caf6dbab83ad10cb2 100644 --- a/NPSimulation/CMakeLists.txt +++ b/NPSimulation/CMakeLists.txt @@ -50,6 +50,15 @@ if(${CMAKE_CXX_COMPILER_ID} MATCHES ".*Clang.*") endif() endif() +# If compiler is GCC active the color diagnostic +if(${CMAKE_CXX_COMPILER_ID} MATCHES ".*GNU.*") +execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion + OUTPUT_VARIABLE GCC_VERSION) + if (GCC_VERSION VERSION_GREATER 4.9 OR GCC_VERSION VERSION_EQUAL 4.9) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-color=always") + endif() +endif() + # Adjust the compiler language flag set(NOCPPFLAGS true) if(${CMAKE_CXX_FLAGS} MATCHES ".*std=.*11")