[Rivet-svn] r2951 - in trunk: . bin include/Rivet pyext/rivet src/Core

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Tue Feb 22 11:10:47 GMT 2011


Author: buckley
Date: Tue Feb 22 11:10:46 2011
New Revision: 2951

Log:
Adding Rivet version to top of run printout, and adding Run::crossSection() and printing out the cross-section in pb at the end of a Rivet run.

Modified:
   trunk/ChangeLog
   trunk/bin/rivet
   trunk/include/Rivet/Run.hh
   trunk/pyext/rivet/rivetwrap.i
   trunk/src/Core/Run.cc

Modified: trunk/ChangeLog
==============================================================================
--- trunk/ChangeLog	Tue Feb 22 11:07:38 2011	(r2950)
+++ trunk/ChangeLog	Tue Feb 22 11:10:46 2011	(r2951)
@@ -1,3 +1,12 @@
+2011-02-22  Andy Buckley  <andy at insectnation.org>
+
+	* Make make-plots killable!
+
+	* Adding Rivet version to top of run printout.
+
+	* Adding Run::crossSection() and printing out the cross-section in
+	pb at the end of a Rivet run.
+
 2011-02-22  Hendrik Hoeth <hendrik.hoeth at cern.ch>
 
 	* make lighthisto.py aware of 2D histograms

Modified: trunk/bin/rivet
==============================================================================
--- trunk/bin/rivet	Tue Feb 22 11:07:38 2011	(r2950)
+++ trunk/bin/rivet	Tue Feb 22 11:10:46 2011	(r2951)
@@ -396,7 +396,7 @@
 
 ## Print platform type
 import platform
-logging.info("Rivet running on machine %s (%s)" % (platform.node(), platform.machine()))
+logging.info("Rivet %s running on machine %s (%s)" % (rivet.version(), platform.node(), platform.machine()))
 
 
 def min_nonnull(a, b):
@@ -486,5 +486,6 @@
 run.finalize()
 
 ## Finalize and write out data file
+print "Cross-section = %e pb" % ah.crossSection()
 ah.finalize()
 ah.writeData(opts.HISTOFILE)

Modified: trunk/include/Rivet/Run.hh
==============================================================================
--- trunk/include/Rivet/Run.hh	Tue Feb 22 11:07:38 2011	(r2950)
+++ trunk/include/Rivet/Run.hh	Tue Feb 22 11:10:46 2011	(r2951)
@@ -9,6 +9,7 @@
   class IO_GenEvent;
 }
 
+
 namespace Rivet {
 
 
@@ -34,6 +35,9 @@
     /// Get the cross-section for this run.
     Run& setCrossSection(const double xs);
 
+    /// Get the current cross-section from the analysis handler in pb.
+    double crossSection() const;
+
     /// Declare whether to list available analyses
     Run& setListAnalyses(const bool dolist);
 

Modified: trunk/pyext/rivet/rivetwrap.i
==============================================================================
--- trunk/pyext/rivet/rivetwrap.i	Tue Feb 22 11:07:38 2011	(r2950)
+++ trunk/pyext/rivet/rivetwrap.i	Tue Feb 22 11:10:46 2011	(r2951)
@@ -136,6 +136,7 @@
     void finalize();
     bool needCrossSection();
     AnalysisHandler& setCrossSection(double xs);
+    double crossSection();
     void commitData();
     void writeData(const std::string& filename);
   };

Modified: trunk/src/Core/Run.cc
==============================================================================
--- trunk/src/Core/Run.cc	Tue Feb 22 11:07:38 2011	(r2950)
+++ trunk/src/Core/Run.cc	Tue Feb 22 11:10:46 2011	(r2951)
@@ -8,7 +8,7 @@
 namespace Rivet {
 
 
-  Run::Run(AnalysisHandler& ah) 
+  Run::Run(AnalysisHandler& ah)
     : _ah(ah), _xs(-1.0)
   { }
 
@@ -22,6 +22,11 @@
   }
 
 
+  double Run::crossSection() const {
+    return _ah.crossSection();
+  }
+
+
   Run& Run::setListAnalyses(const bool dolist) {
     _listAnalyses = dolist;
     return *this;
@@ -39,8 +44,8 @@
     }
     return true;
   }
-  
-  
+
+
   bool Run::openFile(const std::string& evtfile) {
     // Set up HepMC input reader objects
     if (evtfile == "-") {
@@ -74,7 +79,7 @@
 
     // Set cross-section from command line
     if (_xs >= 0.0) {
-      Log::getLog("Rivet.Run") 
+      Log::getLog("Rivet.Run")
         << Log::DEBUG << "Setting user cross-section = " << _xs << " pb" << endl;
       _ah.setCrossSection(_xs);
     }
@@ -102,16 +107,16 @@
     #endif
     // Complain about absence of cross-section if required!
     if (_ah.needCrossSection() && !_ah.hasCrossSection()) {
-      Log::getLog("Rivet.Run") 
+      Log::getLog("Rivet.Run")
         << Log::ERROR
         << "Total cross-section needed for at least one of the analyses. "
         << "Please set it (on the command line with '-x' if using the 'rivet' program)" << endl;
       return false;
     }
-     
+
     // Analyze event
     _ah.analyze(*_evt);
- 
+
     return true;
   }
 


More information about the Rivet-svn mailing list