Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-04-19 09:06:56

0001 // -*- C++ -*-
0002 #ifndef RIVET_AnalysisLoader_HH
0003 #define RIVET_AnalysisLoader_HH
0004 
0005 #include "Rivet/Config/RivetCommon.hh"
0006 #include <map>
0007 #include <string>
0008 
0009 namespace Rivet {
0010 
0011 
0012   // Forward declarations
0013   class Analysis;
0014   class AnalysisBuilderBase;
0015   class Log;
0016 
0017 
0018   /// Internal class which loads and registers analyses from plugin libs
0019   class AnalysisLoader {
0020   public:
0021 
0022     /// @name Analysis names
0023     /// @{
0024 
0025     /// Get the available analyses' canonical names
0026     static vector<string> analysisNames();
0027 
0028     /// Get all the available analyses' names, including aliases
0029     static vector<string> allAnalysisNames();
0030 
0031     /// Get the standard analyses' names (from a release-specific list file)
0032     static vector<string> stdAnalysisNames();
0033 
0034     /// Get the map of analysis alias-names to their canonical equivalents
0035     static map<string,string> analysisNameAliases();
0036 
0037     /// @}
0038 
0039 
0040     /// @name Analysis instantiation
0041     /// @{
0042 
0043     /// @brief Get an analysis by name
0044     ///
0045     /// Warning: a name arg which matches no known analysis will return a null
0046     /// pointer. Check your return values before using them!
0047     static unique_ptr<Analysis> getAnalysis(const string& analysisname);
0048 
0049     /// Get all the available analyses.
0050     static vector<unique_ptr<Analysis>> getAllAnalyses();
0051 
0052     /// @}
0053 
0054 
0055     /// @name Plugin library management
0056     /// @{
0057 
0058     /// @brief Return the active set of analysis plugin paths
0059     ///
0060     /// If the current set of plugin paths is empty, this will automatically
0061     /// call the search function.
0062     static vector<string> analysisPlugins();
0063 
0064     /// @brief Explicitly trigger the search for the available analyses plugin libraries (caches)
0065     ///
0066     /// Search the analysis paths for analysis libraries with the Rivet*.so name
0067     /// pattern, if the RIVET_ANALYSIS_PLUGINS environment variable has not been
0068     /// set. If it has, use the space-separated file paths in that variable.
0069     static vector<string> searchAnalysisPlugins();
0070 
0071     /// @brief Set a fixed list of analysis plugin libraries, bypassing the search.
0072     ///
0073     /// Setting an empty list of plugin libraries will reenable plugin searching.
0074     ///
0075     /// May be useful on MPI machines, where you want to avoid having many
0076     /// machines all doing the same filesystem lookup: either specify all the
0077     /// paths in advance, or (if you have a shared or guaranteed identical
0078     /// filesystem) retrieve the search function on the main rank, and pass the
0079     /// list for rapid, search-free setting on all the others.
0080     ///
0081     /// Calling this function will clear the lists of analysis builder functions,
0082     /// if any have been loaded from the previous active set of plugin libraries.
0083     static void setAnalysisPlugins(const vector<string> pluginpaths);
0084 
0085     /// Load the available analyses from the active plugin libraries (caches)
0086     static void loadFromAnalysisPlugins();
0087 
0088     /// @}
0089 
0090 
0091   private:
0092 
0093     /// Allow the analysis builders to call the private _registerBuilder function
0094     friend class AnalysisBuilderBase;
0095 
0096     /// Register a new analysis builder
0097     static void _registerBuilder(const AnalysisBuilderBase* ab);
0098 
0099     /// List of Rivet*.so plugin library paths to load from
0100     static vector<string> _pluginpaths;
0101 
0102     typedef map<string, const AnalysisBuilderBase*> AnalysisBuilderMap;
0103     /// Canonical analysis builder functors
0104     static AnalysisBuilderMap _ptrs;
0105     /// Alias analysis builder functors
0106     static AnalysisBuilderMap _aliasptrs;
0107 
0108   };
0109 
0110 
0111 }
0112 
0113 #endif