|
[Rivet-svn] r1781 - trunk/plugindemoblackhole at projects.hepforge.org blackhole at projects.hepforge.orgFri Aug 28 22:27:46 BST 2009
Author: buckley Date: Fri Aug 28 22:27:46 2009 New Revision: 1781 Log: Change plugin example to new system Modified: trunk/plugindemo/Makefile.am trunk/plugindemo/MyAnalysis.cc Modified: trunk/plugindemo/Makefile.am ============================================================================== --- trunk/plugindemo/Makefile.am Fri Aug 28 22:11:20 2009 (r1780) +++ trunk/plugindemo/Makefile.am Fri Aug 28 22:27:46 2009 (r1781) @@ -1,10 +1,9 @@ ## Build rule for the demo plugin analysis, MyAnalysis +pluginlib = RivetMyAnalysis.so if WITH_OSX - pluginlib = libRivetMyAnalysis.dylib - shared_flags =-undefined dynamic_lookup + shared_flags = -undefined dynamic_lookup else - pluginlib = libRivetMyAnalysis.so shared_flags = -shared endif Modified: trunk/plugindemo/MyAnalysis.cc ============================================================================== --- trunk/plugindemo/MyAnalysis.cc Fri Aug 28 22:11:20 2009 (r1780) +++ trunk/plugindemo/MyAnalysis.cc Fri Aug 28 22:27:46 2009 (r1781) @@ -5,6 +5,7 @@ namespace Rivet { + class MyAnalysis : public Analysis { public: @@ -16,13 +17,7 @@ const ChargedFinalState cfs; addProjection(cfs, "CFS"); } - - - /// Factory method - static Analysis* create() { - return new MyAnalysis(); - } - + /// Return the name of this analysis string name() const { @@ -80,10 +75,8 @@ void analyze(const Event& event) { const FinalState& cfs = applyProjection<FinalState>(event, "CFS"); const FinalState& cnfs = applyProjection<FinalState>(event, "CNFS"); - getLog() << Log::DEBUG << "Total multiplicity = " - << cnfs.size() << endl; - getLog() << Log::DEBUG << "Total charged multiplicity = " - << cfs.size() << endl; + getLog() << Log::DEBUG << "Total multiplicity = " << cnfs.size() << endl; + getLog() << Log::DEBUG << "Total charged multiplicity = " << cfs.size() << endl; } void finalize() { @@ -94,13 +87,8 @@ }; - extern "C" { - AnalysisBuilders getAnalysisBuilders() { - AnalysisBuilders fns; - fns["MYANALYSIS"] = Rivet::MyAnalysis::create; - return fns; - } - } + // This global object acts as a hook for the plugin system + AnalysisBuilder<MyAnalysis> plugin_MyAnalysis; }
More information about the Rivet-svn mailing list |