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/Analysis.fhh" 00007 #include "Rivet/AnalysisLoader.hh" 00008 #include "Rivet/Tools/Logging.fhh" 00009 00010 namespace Rivet { 00011 00012 00013 /// @cond ANALYSIS_PLUGIN_DETAILS 00014 00015 /// @brief Interface for analysis builders 00016 class AnalysisBuilderBase { 00017 public: 00018 AnalysisBuilderBase() { } 00019 virtual ~AnalysisBuilderBase() { } 00020 00021 virtual Analysis* mkAnalysis() const = 0; 00022 00023 const string name() const { 00024 Analysis* a = mkAnalysis(); 00025 string rtn = a->name(); 00026 delete a; 00027 return rtn; 00028 } 00029 00030 protected: 00031 void _register() { 00032 AnalysisLoader::_registerBuilder(this); 00033 } 00034 }; 00035 00036 00037 /// @brief Self-registering analysis plugin builder 00038 template <typename T> 00039 class AnalysisBuilder : public AnalysisBuilderBase { 00040 public: 00041 AnalysisBuilder() { 00042 _register(); 00043 } 00044 00045 Analysis* mkAnalysis() const { 00046 return new T(); 00047 } 00048 }; 00049 00050 /// @endcond 00051 00052 } 00053 00054 #endif Generated on Fri Dec 21 2012 15:03:38 for The Rivet MC analysis system by ![]() |