[Rivet-svn] r2635 - in trunk: . src/Core

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Mon Aug 2 13:19:07 BST 2010


Author: buckley
Date: Mon Aug  2 13:19:06 2010
New Revision: 2635

Log:
Adding graceful top-level exception handling in the AnalysisHandler::init,analyze,finalize() methods

Modified:
   trunk/ChangeLog
   trunk/src/Core/AnalysisHandler.cc

Modified: trunk/ChangeLog
==============================================================================
--- trunk/ChangeLog	Mon Aug  2 10:44:00 2010	(r2634)
+++ trunk/ChangeLog	Mon Aug  2 13:19:06 2010	(r2635)
@@ -1,3 +1,12 @@
+2010-08-02  Andy Buckley  <andy at insectnation.org>
+
+	* Adding graceful exception handling to the AnalysisHandler event
+	loop methods.
+
+	* Changing compare-histos behaviour to always show plots for which
+	there is at least one MC histo. The default behaviour should now
+	be the correct one in 99% of use cases.
+
 2010-07-30  Andy Buckley  <andy at insectnation.org>
 
 	* Merging in a fix for shared_ptrs not being compared for

Modified: trunk/src/Core/AnalysisHandler.cc
==============================================================================
--- trunk/src/Core/AnalysisHandler.cc	Mon Aug  2 10:44:00 2010	(r2634)
+++ trunk/src/Core/AnalysisHandler.cc	Mon Aug  2 13:19:06 2010	(r2635)
@@ -82,11 +82,17 @@
 
     foreach (AnaHandle a, _analyses) {
       getLog() << Log::DEBUG << "Initialising analysis: " << a->name() << endl;
-      // Allow projection registration in the init phase onwards
-      a->_allowProjReg = true;
-      a->init();
-      //getLog() << Log::DEBUG << "Checking consistency of analysis: " << a->name() << endl;
-      //a->checkConsistency();
+      try {
+        // Allow projection registration in the init phase onwards
+        a->_allowProjReg = true;
+        a->init();
+        //getLog() << Log::DEBUG << "Checking consistency of analysis: " << a->name() << endl;
+        //a->checkConsistency();
+      } catch (const Error& err) {
+        getLog() << Log::ERROR << "Error in " << a->name() << "::init method: "
+                 << err.what() << endl;
+        exit(1);
+      }
       getLog() << Log::DEBUG << "Done initialising analysis: " << a->name() << endl;
     }
     _initialised = true;
@@ -126,7 +132,13 @@
     #endif
     foreach (AnaHandle a, _analyses) {
       //getLog() << Log::DEBUG << "About to run analysis " << a->name() << endl;
-      a->analyze(event);
+      try {
+        a->analyze(event);
+      } catch (const Error& err) {
+        getLog() << Log::ERROR << "Error in " << a->name() << "::analyze method: "
+                 << err.what() << endl;
+        exit(1);
+      }
       //getLog() << Log::DEBUG << "Finished running analysis " << a->name() << endl;
     }
   }
@@ -136,7 +148,13 @@
     assert(_initialised);
     getLog() << Log::INFO << "Finalising analyses" << endl;
     foreach (AnaHandle a, _analyses) {
-      a->finalize();
+      try {
+        a->finalize();
+      } catch (const Error& err) {
+        getLog() << Log::ERROR << "Error in " << a->name() << "::finalize method: "
+                 << err.what() << endl;
+        exit(1);
+      }
     }
 
     // Print out number of events processed


More information about the Rivet-svn mailing list