|
[Rivet-svn] r2509 - in trunk: . bin include/Rivet include/Rivet/Tools pyext src/Toolsblackhole at projects.hepforge.org blackhole at projects.hepforge.orgWed Jun 23 11:39:31 BST 2010
Author: buckley Date: Wed Jun 23 11:39:45 2010 New Revision: 2509 Log: Adding environment-aware search path functions Added: trunk/include/Rivet/Tools/RivetPaths.hh Modified: trunk/ChangeLog trunk/bin/rivet trunk/include/Rivet/Makefile.am trunk/include/Rivet/Rivet.hh trunk/pyext/rivet.i trunk/src/Tools/RivetPaths.cc Modified: trunk/ChangeLog ============================================================================== --- trunk/ChangeLog Wed Jun 23 10:23:39 2010 (r2508) +++ trunk/ChangeLog Wed Jun 23 11:39:45 2010 (r2509) @@ -1,3 +1,7 @@ +2010-06-23 Andy Buckley <andy at insectnation.org> + + * Adding environment-aware functions for Rivet search path list access. + 2010-06-21 Andy Buckley <andy at insectnation.org> * Using .info file beam ID and energy info in HTML and LaTeX documentation. Modified: trunk/bin/rivet ============================================================================== --- trunk/bin/rivet Wed Jun 23 10:23:39 2010 (r2508) +++ trunk/bin/rivet Wed Jun 23 11:39:45 2010 (r2509) @@ -80,6 +80,7 @@ ## Try importing rivet try: import rivet + #print rivet.getAnalysisLibPaths() except Exception, e: sys.stderr.write(PROGNAME + " requires the 'rivet' Python module\n"); logging.debug(str(e)) Modified: trunk/include/Rivet/Makefile.am ============================================================================== --- trunk/include/Rivet/Makefile.am Wed Jun 23 10:23:39 2010 (r2508) +++ trunk/include/Rivet/Makefile.am Wed Jun 23 11:39:45 2010 (r2509) @@ -7,8 +7,7 @@ ## Rivet interface nobase_pkginclude_HEADERS += \ Rivet.hh Exceptions.hh \ - RivetBoost.hh RivetHepMC.hh \ - RivetSTL.hh \ + RivetBoost.hh RivetHepMC.hh RivetSTL.hh \ Constraints.hh BeamConstraint.hh \ Event.hh Event.fhh \ ParticleBase.hh Jet.hh \ @@ -87,6 +86,7 @@ Tools/Logging.hh \ Tools/Logging.fhh \ Tools/Utils.hh \ + Tools/RivetPaths.hh \ Tools/BinnedHistogram.hh \ Tools/ParticleIdUtils.hh \ Tools/TypeTraits.hh Modified: trunk/include/Rivet/Rivet.hh ============================================================================== --- trunk/include/Rivet/Rivet.hh Wed Jun 23 10:23:39 2010 (r2508) +++ trunk/include/Rivet/Rivet.hh Wed Jun 23 11:39:45 2010 (r2509) @@ -44,6 +44,7 @@ #include "Rivet/Math/Matrices.hh" #include "Rivet/Math/Units.hh" #include "Rivet/Tools/Utils.hh" +#include "Rivet/Tools/RivetPaths.hh" #include "Rivet/ParticleName.hh" #include "Rivet/Particle.hh" Added: trunk/include/Rivet/Tools/RivetPaths.hh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ trunk/include/Rivet/Tools/RivetPaths.hh Wed Jun 23 11:39:45 2010 (r2509) @@ -0,0 +1,30 @@ +// -*- C++ -*- +#ifndef RIVET_RivetPaths_HH +#define RIVET_RivetPaths_HH + +namespace Rivet { + + + /// Get library install path + const std::string getLibPath(); + + /// Get data install path + const std::string getDataPath(); + + /// Get Rivet data install path + const std::string getRivetDataPath(); + + + /// Get Rivet analysis plugin library search paths + const std::vector<std::string> getAnalysisLibPaths(); + + /// Get Rivet analysis reference data search paths + const std::vector<std::string> getAnalysisRefPaths(); + + /// Get Rivet analysis info metadata search paths + const std::vector<std::string> getAnalysisInfoPaths(); + + +} + +#endif Modified: trunk/pyext/rivet.i ============================================================================== --- trunk/pyext/rivet.i Wed Jun 23 10:23:39 2010 (r2508) +++ trunk/pyext/rivet.i Wed Jun 23 11:39:45 2010 (r2509) @@ -40,14 +40,13 @@ } %include "Rivet/Tools/Logging.hh" +// Rivet search paths +%include "Rivet/Tools/RivetPaths.hh" -// Rivet class mappings -namespace Rivet { +// Main Rivet class mappings +namespace Rivet { - const std::string getLibPath(); - const std::string getDataPath(); - const std::string getRivetDataPath(); std::string version(); Modified: trunk/src/Tools/RivetPaths.cc ============================================================================== --- trunk/src/Tools/RivetPaths.cc Wed Jun 23 10:23:39 2010 (r2508) +++ trunk/src/Tools/RivetPaths.cc Wed Jun 23 11:39:45 2010 (r2509) @@ -1,4 +1,7 @@ #include "Rivet/Rivet.hh" +#include "Rivet/Tools/RivetPaths.hh" +#include "Rivet/Tools/Utils.hh" +#include "Rivet/RivetBoost.hh" #include "binreloc.h" namespace Rivet { @@ -23,4 +26,49 @@ } + const vector<string> getAnalysisLibPaths() { + vector<string> dirs; + char* env = 0; + env = getenv("RIVET_ANALYSIS_PATH"); + if (env) { + // Use the Rivet analysis path variable if set... + dirs += split(env); + } else { + // ... otherwise fall back to the Rivet library install path + dirs += getLibPath(); + } + return dirs; + } + + + const vector<string> getAnalysisRefPaths() { + vector<string> dirs; + char* env = 0; + env = getenv("RIVET_REF_PATH"); + if (env) { + // Use the Rivet analysis path variable if set... + dirs += split(env); + } else { + // ... otherwise fall back to the Rivet library install path + dirs += getRivetDataPath(); + } + return dirs; + } + + + const vector<string> getAnalysisInfoPaths() { + vector<string> dirs; + char* env = 0; + env = getenv("RIVET_INFO_PATH"); + if (env) { + // Use the Rivet analysis path variable if set... + dirs += split(env); + } else { + // ... otherwise fall back to the Rivet library install path + dirs += getRivetDataPath(); + } + return dirs; + } + + }
More information about the Rivet-svn mailing list |