From 18686e73b28d3584a41b29b7dee4a0acf61684a0 Mon Sep 17 00:00:00 2001 From: deserevi <deserevi@nptool> Date: Thu, 6 Jan 2011 23:45:31 +0000 Subject: [PATCH] * Add NPToolLogon.C script which loads all relevant NPTool information when a ROOT session starts. + header directory (NPLib/include) is declared + libraries in NPLib/lib are loaded * new version of the rootlogon.C file calling the NPToolLogon.C script. --- Misc/rootlogon.C | 28 ++++++++++++++++--- NPLib/scripts/NPToolLogon.C | 54 +++++++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+), 3 deletions(-) create mode 100644 NPLib/scripts/NPToolLogon.C diff --git a/Misc/rootlogon.C b/Misc/rootlogon.C index aba6d28ad..1d1c52e6b 100644 --- a/Misc/rootlogon.C +++ b/Misc/rootlogon.C @@ -1,5 +1,27 @@ +/***************************************************************************** + * Copyright (C) 2009-2010 this file is part of the NPTool Project * + * * + * For the licensing terms see $NPTOOL/Licence/NPTool_Licence * + * For the list of contributors see $NPTOOL/Licence/Contributors * + *****************************************************************************/ + +/***************************************************************************** + * Original Author: N. de Sereville contact address: deserevi@ipno.in2p3.fr * + * * + * Creation Date : 07/01/11 * + * Last update : * + *---------------------------------------------------------------------------* + * Decription: Example of rootlogon.C file which calls the NPToolLogon.C * + * located in NPLib/scripts and which loads all necessary NPTool * + * information needed by ROOT. * + * * + *---------------------------------------------------------------------------* + * Comment: * + * * + * * + *****************************************************************************/ { - gROOT->ProcessLine(".include /YourPathToNPTool/NPTool/NPLib/include"); - gSystem->Load("/YourPathToNPTool/NPTool/NPLib/lib/libInitialConditions.so"); - gSystem->Load("/YourPathToNPTool/NPTool/NPLib/lib/libInteractionCoordinates.so"); + // Load NPToolLogon.C macro dealing with all the NPLib shared libraries + TString path = gSystem->Getenv("NPLIB"); + gROOT->ProcessLine(Form(".x %s/scripts/NPToolLogon.C", path.Data())); } diff --git a/NPLib/scripts/NPToolLogon.C b/NPLib/scripts/NPToolLogon.C new file mode 100644 index 000000000..e3283729a --- /dev/null +++ b/NPLib/scripts/NPToolLogon.C @@ -0,0 +1,54 @@ +/***************************************************************************** + * Copyright (C) 2009-2010 this file is part of the NPTool Project * + * * + * For the licensing terms see $NPTOOL/Licence/NPTool_Licence * + * For the list of contributors see $NPTOOL/Licence/Contributors * + *****************************************************************************/ + +/***************************************************************************** + * Original Author: N. de Sereville contact address: deserevi@ipno.in2p3.fr * + * * + * Creation Date : 07/01/11 * + * Last update : * + *---------------------------------------------------------------------------* + * Decription: This script loads automatically the NPLib include path and * + * shared. * + * * + *---------------------------------------------------------------------------* + * Comment: This script should be called in your rootlogon.C file * + * See example in NPTool/Misc/rootlogon.C * + * * + * * + *****************************************************************************/ +{ + TString path = gSystem->Getenv("NPLIB"); + + // Add include path + cout << "NPTool: adding include path ..." << endl; + gSystem->AddIncludePath(Form("%s/include", path.Data())); + + // Add shared libraries + cout << "NPTool: loading NPLib shared libraries ..." << endl; + TString libpath = Form("%s/lib", path.Data()); + TSystemDirectory libdir("libdir", libpath); + TList* listfile = libdir.GetListOfFiles(); + + // Since the list is ordered alphabetically and that the + // libVDetector.so library should be loaded before the + // lib*Physics.so libraries, it is then loaded manually + // first. + gSystem->Load(libpath+"/libVdetector.so"); + + // Since the libMust2Physics.so library uses TVector2 + // objects, the libPhysics.so ROOT library is loaded. + gSystem->Load("libPhysics.so"); + + Int_t i = 0; + while (listfile->At(i)) { + TString libname = listfile->At(i++)->GetName(); + if (libname.Contains("so") && !libname.Contains("libVDetector.so")) { + TString lib = libpath + "/" + libname; + gSystem->Load(lib); + } + } +} -- GitLab