RivetPaths.cc

Go to the documentation of this file.
00001 #include "Rivet/Rivet.hh"
00002 #include "Rivet/Tools/RivetPaths.hh"
00003 #include "Rivet/Tools/Utils.hh"
00004 #include "Rivet/RivetBoost.hh"
00005 #include "binreloc.h"
00006 
00007 namespace Rivet {
00008 
00009 
00010   const string getLibPath() {
00011     BrInitError error;
00012     br_init_lib(&error);
00013     char* temp = br_find_lib_dir(DEFAULTLIBDIR);
00014     const string libdir(temp);
00015     free (temp);
00016     return libdir;
00017   }
00018 
00019   const string getDataPath() {
00020     BrInitError error;
00021     br_init_lib(&error);
00022     char* temp = br_find_data_dir(DEFAULTDATADIR);
00023     const string sharedir(temp);
00024     free (temp);
00025     return sharedir;
00026   }
00027 
00028   const string getRivetDataPath() {
00029     return getDataPath() + "/Rivet";
00030   }
00031 
00032 
00033   const vector<string> getAnalysisLibPaths() {
00034     vector<string> dirs;
00035     char* env = 0;
00036     env = getenv("RIVET_ANALYSIS_PATH");
00037     if (env) {
00038       // Use the Rivet analysis path variable if set...
00039       dirs += split(env);
00040     } else {
00041       // ... otherwise fall back to the Rivet library install path
00042       dirs += getLibPath();
00043     }
00044     return dirs;
00045   }
00046 
00047 
00048   const vector<string> getAnalysisRefPaths() {
00049     vector<string> dirs;
00050     char* env = 0;
00051     env = getenv("RIVET_REF_PATH");
00052     if (env) {
00053       // Use the Rivet analysis path variable if set...
00054       dirs += split(env);
00055     } else {
00056       // ... otherwise fall back to the Rivet data install path
00057       dirs += getRivetDataPath();
00058     }
00059     return dirs;
00060   }
00061 
00062 
00063   const vector<string> getAnalysisInfoPaths() {
00064     vector<string> dirs;
00065     char* env = 0;
00066     env = getenv("RIVET_INFO_PATH");
00067     if (env) {
00068       // Use the Rivet analysis path variable if set...
00069       dirs += split(env);
00070     } else {
00071       // ... otherwise fall back to the Rivet data install path
00072       dirs += getRivetDataPath();
00073     }
00074     return dirs;
00075   }
00076 
00077 
00078 }