AnalysisBuilder.hh
Go to the documentation of this file.
00001 // -*- C++ -*- 00002 #ifndef RIVET_AnalysisBuilder_HH 00003 #define RIVET_AnalysisBuilder_HH 00004 00005 #include "Rivet/Rivet.hh" 00006 #include "Rivet/AnalysisLoader.hh" 00007 #include "Rivet/Tools/Logging.hh" 00008 00009 namespace Rivet { 00010 00011 00012 // Forward declaration 00013 class Analysis; 00014 00015 00016 /// @cond ANALYSIS_PLUGIN_DETAILS 00017 00018 /// @brief Interface for analysis builders 00019 class AnalysisBuilderBase { 00020 public: 00021 AnalysisBuilderBase() { } 00022 virtual ~AnalysisBuilderBase() { } 00023 00024 virtual Analysis* mkAnalysis() const = 0; 00025 00026 const string name() const { 00027 Analysis* a = mkAnalysis(); 00028 string rtn = a->name(); 00029 delete a; 00030 return rtn; 00031 } 00032 00033 protected: 00034 void _register() { 00035 AnalysisLoader::_registerBuilder(this); 00036 } 00037 }; 00038 00039 00040 /// @brief Self-registering analysis plugin builder 00041 template <typename T> 00042 class AnalysisBuilder : public AnalysisBuilderBase { 00043 public: 00044 AnalysisBuilder() { 00045 _register(); 00046 } 00047 00048 Analysis* mkAnalysis() const { 00049 return new T(); 00050 } 00051 }; 00052 00053 /// @endcond 00054 00055 } 00056 00057 #endif Generated on Thu Feb 6 2014 17:38:41 for The Rivet MC analysis system by ![]() |