[Rivet-svn] r1968 - trunk/src

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Thu Oct 29 15:48:28 GMT 2009


Author: buckley
Date: Thu Oct 29 15:48:28 2009
New Revision: 1968

Log:
Adding debug printout of event weight before each event is analysed

Modified:
   trunk/src/AnalysisHandler.cc
   trunk/src/Run.cc

Modified: trunk/src/AnalysisHandler.cc
==============================================================================
--- trunk/src/AnalysisHandler.cc	Wed Oct 28 10:54:00 2009	(r1967)
+++ trunk/src/AnalysisHandler.cc	Thu Oct 29 15:48:28 2009	(r1968)
@@ -56,10 +56,12 @@
   void AnalysisHandler::analyze(const GenEvent& ge) {
     Event event(ge);
     _numEvents++;
-    _sumOfWeights += event.weight();
+    // Weights
+    const double weight = event.weight();
+    _sumOfWeights += weight;
+    getLog() << Log::DEBUG << "Event #" << _numEvents << " weight = " << weight << endl;
     #ifdef HEPMC_HAS_CROSS_SECTION
     if (ge.cross_section()) {
-      /// @todo Use xs error?
       const double xs = ge.cross_section()->cross_section();
       setCrossSection(xs);
     }

Modified: trunk/src/Run.cc
==============================================================================
--- trunk/src/Run.cc	Wed Oct 28 10:54:00 2009	(r1967)
+++ trunk/src/Run.cc	Thu Oct 29 15:48:28 2009	(r1968)
@@ -44,6 +44,7 @@
   
     return true;
   }
+
   
   bool Run::processEvent(bool firstEvent) {
     GenEvent* evt = new GenEvent();
@@ -83,19 +84,21 @@
         }
       }
     }
-    
+
+    // Set cross-section if specified from command line
     if (_xs > 0.0) {
       _ah.setCrossSection(_xs);
     }
-#ifdef HEPMC_HAS_CROSS_SECTION
+    // Set cross-section if found in event
+    #ifdef HEPMC_HAS_CROSS_SECTION
     else if (evt->cross_section()) {
-      /// @todo Use xs error?
       const double xs = evt->cross_section()->cross_section(); //< in pb
       Log::getLog("Rivet.Run") << Log::DEBUG
           << "Setting cross-section = " << xs << " pb" << endl;
       _ah.setCrossSection(xs);
     }
-#endif
+    #endif
+    // Complain about absence of cross-section if required!
     else {
       if (_ah.needCrossSection()) {
         Log::getLog("Rivet.Run") << Log::ERROR
@@ -105,6 +108,7 @@
         return false;
       }
     }
+
     /// @todo If NOT first event, check that beams aren't changed
     
     // Analyze event and delete HepMC event object      


More information about the Rivet-svn mailing list