[Rivet-svn] r2833 - in trunk: pyext/rivet src/Analyses src/Core

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Tue Dec 7 18:16:33 GMT 2010


Author: dgrell
Date: Tue Dec  7 18:16:32 2010
New Revision: 2833

Log:
Messages to cerr on hard fail.

Modified:
   trunk/pyext/rivet/__init__.py
   trunk/src/Analyses/JADE_OPAL_2000_S4300807.cc
   trunk/src/Core/AnalysisHandler.cc
   trunk/src/Core/AnalysisLoader.cc
   trunk/src/Core/ProjectionApplier.cc
   trunk/src/Core/ProjectionHandler.cc

Modified: trunk/pyext/rivet/__init__.py
==============================================================================
--- trunk/pyext/rivet/__init__.py	Tue Dec  7 17:56:57 2010	(r2832)
+++ trunk/pyext/rivet/__init__.py	Tue Dec  7 18:16:32 2010	(r2833)
@@ -20,5 +20,5 @@
     import sys
     req_version = (2,4,0)
     if sys.version_info[:3] < req_version:
-        print "rivet scripts require Python version >= %s... exiting" % ".".join(req_version)
+        sys.stderr.write( "rivet scripts require Python version >= %s... exiting\n" % ".".join(req_version) )
         sys.exit(1)

Modified: trunk/src/Analyses/JADE_OPAL_2000_S4300807.cc
==============================================================================
--- trunk/src/Analyses/JADE_OPAL_2000_S4300807.cc	Tue Dec  7 17:56:57 2010	(r2832)
+++ trunk/src/Analyses/JADE_OPAL_2000_S4300807.cc	Tue Dec  7 18:16:32 2010	(r2833)
@@ -44,12 +44,7 @@
       case 172: offset = 12; break;
       case 183: offset = 13; break;
       case 189: offset = 14; break;
-      default:
-        getLog() << Log::ERROR
-                 << "CMS energy of events sqrt(s) = " << sqrtS()/GeV
-                 <<" doesn't match any available analysis energy." << endl;
-        /// @todo Really call exit()? I don't like the break of "command chain" that this implies
-        exit(1);
+      default: break;
       }
       for (size_t i = 0; i < 5; ++i) {
         _h_R_Jade[i] = bookDataPointSet(offset, 1, i+1);

Modified: trunk/src/Core/AnalysisHandler.cc
==============================================================================
--- trunk/src/Core/AnalysisHandler.cc	Tue Dec  7 17:56:57 2010	(r2832)
+++ trunk/src/Core/AnalysisHandler.cc	Tue Dec  7 18:16:32 2010	(r2833)
@@ -74,8 +74,7 @@
       }
     }
     if (num_anas_requested > 0 && analysisNames().size() == 0) {
-      getLog() << Log::ERROR
-               << "All analyses were incompatible with the first event's beams\n"
+      cerr     << "All analyses were incompatible with the first event's beams\n"
                << "Exiting, since this probably isn't intentional!" << endl;
       exit(1);
     }
@@ -89,7 +88,7 @@
         //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: "
+        cerr     << "Error in " << a->name() << "::init method: "
                  << err.what() << endl;
         exit(1);
       }
@@ -111,7 +110,7 @@
     const PdgIdPair beams = Rivet::beamIds(ge);
     const double sqrts = Rivet::sqrtS(ge);
     if (!compatible(beams, _beams) || !fuzzyEquals(sqrts, sqrtS())) {
-      getLog() << Log::ERROR << "Event beams mismatch: "
+      cerr     << "Event beams mismatch: "
                << toBeamsString(beams) << " @ " << sqrts/GeV << " GeV" << " vs. first beams "
                << this->beams() << " @ " << this->sqrtS()/GeV << " GeV" << endl;
       exit(1);
@@ -135,7 +134,7 @@
       try {
         a->analyze(event);
       } catch (const Error& err) {
-        getLog() << Log::ERROR << "Error in " << a->name() << "::analyze method: "
+        cerr     << "Error in " << a->name() << "::analyze method: "
                  << err.what() << endl;
         exit(1);
       }
@@ -151,7 +150,7 @@
       try {
         a->finalize();
       } catch (const Error& err) {
-        getLog() << Log::ERROR << "Error in " << a->name() << "::finalize method: "
+        cerr     << "Error in " << a->name() << "::finalize method: "
                  << err.what() << endl;
         exit(1);
       }

Modified: trunk/src/Core/AnalysisLoader.cc
==============================================================================
--- trunk/src/Core/AnalysisLoader.cc	Tue Dec  7 17:56:57 2010	(r2832)
+++ trunk/src/Core/AnalysisLoader.cc	Tue Dec  7 18:16:32 2010	(r2833)
@@ -55,7 +55,7 @@
     if (_ptrs.find(name) != _ptrs.end()) {
       // Protect against overwriting analyses by throwing an error
       /// @todo Tidy this up!
-      Log::getLog("Rivet.AnalysisLoader") << Log::ERROR << "Tried to register a second plugin analysis called '" << name << "'" << endl;
+      cerr << "Tried to register a second plugin analysis called '" << name << "'" << endl;
       exit(1);
     }
     Log::getLog("Rivet.AnalysisLoader") << Log::TRACE << "Registering a plugin analysis called '" << name << "'" << endl;

Modified: trunk/src/Core/ProjectionApplier.cc
==============================================================================
--- trunk/src/Core/ProjectionApplier.cc	Tue Dec  7 17:56:57 2010	(r2832)
+++ trunk/src/Core/ProjectionApplier.cc	Tue Dec  7 18:16:32 2010	(r2833)
@@ -33,8 +33,8 @@
   const Projection& ProjectionApplier::_addProjection(const Projection& proj,
                                                       const std::string& name) {
     if (!_allowProjReg) {
-      getLog() << Log::ERROR << "Trying to register projection '"
-               << proj.name() << "' before init phase in '" << this->name() << "'." << endl;
+      cerr << "Trying to register projection '"
+           << proj.name() << "' before init phase in '" << this->name() << "'." << endl;
       exit(2);
     }
     const Projection& reg = getProjHandler().registerProjection(*this, proj, name);

Modified: trunk/src/Core/ProjectionHandler.cc
==============================================================================
--- trunk/src/Core/ProjectionHandler.cc	Tue Dec  7 17:56:57 2010	(r2832)
+++ trunk/src/Core/ProjectionHandler.cc	Tue Dec  7 18:16:32 2010	(r2833)
@@ -65,7 +65,10 @@
 
     // Check for duplicate use of "name" on "parent"
     const bool dupOk = _checkDuplicate(parent, proj, name);
-    if (!dupOk) exit(1);
+    if (!dupOk) {
+      cerr << "Duplicate name '" << name << "' in parent '" << parent.name() << "'." << endl;
+      exit(1);
+    }
 
     // Choose which version of the projection to register with this parent and name
     const Projection* p = _getEquiv(proj);


More information about the Rivet-svn mailing list