[Rivet-svn] r2579 - trunk/src/Core

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Mon Jul 12 16:19:40 BST 2010


Author: buckley
Date: Mon Jul 12 16:20:09 2010
New Revision: 2579

Log:
Refuse to add an analysis twice: issues a warning and continues with its business. With new histogramming and analysis params it might not necessarily be the case that duplicate analyses are absolutely forbidden, but it's certainly true at the moment.

Modified:
   trunk/src/Core/AnalysisHandler.cc

Modified: trunk/src/Core/AnalysisHandler.cc
==============================================================================
--- trunk/src/Core/AnalysisHandler.cc	Mon Jul 12 16:17:49 2010	(r2578)
+++ trunk/src/Core/AnalysisHandler.cc	Mon Jul 12 16:20:09 2010	(r2579)
@@ -166,6 +166,14 @@
 
 
   AnalysisHandler& AnalysisHandler::addAnalysis(const string& analysisname) {
+    // Check for a duplicate analysis
+    /// @todo Might we want to be able to run an analysis twice, with different params? Requires avoiding histo clashes.
+    foreach (const Analysis* a, _analyses) {
+      if (a->name() == analysisname) {
+        getLog() << Log::WARNING << "Analysis '" << analysisname << "' already registered: skipping duplicate" << endl;
+        return *this;
+      }
+    }
     Analysis* analysis = AnalysisLoader::getAnalysis(analysisname);
     if (analysis) { // < Check for null analysis.
       getLog() << Log::DEBUG << "Adding analysis '" << analysisname << "'" << endl;


More information about the Rivet-svn mailing list