[Rivet-svn] r3303 - in branches/2011-07-aida2yoda: bin include/Rivet src/Core src/Projections

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Mon Aug 22 11:47:02 BST 2011


Author: hoeth
Date: Mon Aug 22 11:47:02 2011
New Revision: 3303

Log:
merge r3297 from trunk

Modified:
   branches/2011-07-aida2yoda/bin/rivet
   branches/2011-07-aida2yoda/include/Rivet/AnalysisHandler.hh
   branches/2011-07-aida2yoda/include/Rivet/Run.hh
   branches/2011-07-aida2yoda/src/Core/AnalysisHandler.cc
   branches/2011-07-aida2yoda/src/Core/Run.cc
   branches/2011-07-aida2yoda/src/Projections/Beam.cc

Modified: branches/2011-07-aida2yoda/bin/rivet
==============================================================================
--- branches/2011-07-aida2yoda/bin/rivet	Mon Aug 22 11:46:14 2011	(r3302)
+++ branches/2011-07-aida2yoda/bin/rivet	Mon Aug 22 11:47:02 2011	(r3303)
@@ -106,6 +106,8 @@
 parser.add_option("-x", "--cross-section", dest="CROSS_SECTION",
                   default=None, metavar="XS",
                   help="specify the signal process cross-section in pb")
+parser.add_option("--ignore-beams", dest="IGNORE_BEAMS", action="store_true", default=False,
+                  help="Ignore input event beams when checking analysis compatibility.")
 
 verbgroup = OptionGroup(parser, "Verbosity control")
 parser.add_option("-l", dest="NATIVE_LOG_STRS", action="append",
@@ -432,7 +434,7 @@
 try:
     if opts.EVENT_TIMEOUT or opts.RUN_TIMEOUT:
         signal.alarm(min_nonnull(opts.EVENT_TIMEOUT, opts.RUN_TIMEOUT))
-    init_ok = run.init(hepmcfile, hepmcfileweight)
+    init_ok = run.init(hepmcfile, hepmcfileweight, opts.IGNORE_BEAMS)
     signal.alarm(0)
     if not init_ok:
         logging.error("Failed to initialise using event file '%s'... exiting" % hepmcfile)

Modified: branches/2011-07-aida2yoda/include/Rivet/AnalysisHandler.hh
==============================================================================
--- branches/2011-07-aida2yoda/include/Rivet/AnalysisHandler.hh	Mon Aug 22 11:46:14 2011	(r3302)
+++ branches/2011-07-aida2yoda/include/Rivet/AnalysisHandler.hh	Mon Aug 22 11:47:02 2011	(r3303)
@@ -154,7 +154,7 @@
 
 
     /// Initialize a run, with the run beams taken from the example event.
-    void init(const GenEvent& event);
+    void init(const GenEvent& event, bool ignorebeams=false);
 
 
     /// Analyze the given \a event. This function will call the

Modified: branches/2011-07-aida2yoda/include/Rivet/Run.hh
==============================================================================
--- branches/2011-07-aida2yoda/include/Rivet/Run.hh	Mon Aug 22 11:46:14 2011	(r3302)
+++ branches/2011-07-aida2yoda/include/Rivet/Run.hh	Mon Aug 22 11:47:02 2011	(r3303)
@@ -48,7 +48,7 @@
     //@{
 
     /// Set up HepMC file readers (using the appropriate file weight for the first file)
-    bool init(const std::string& evtfile, double weight=1.0);
+    bool init(const std::string& evtfile, double weight=1.0, bool ignorebeams=false);
 
     /// Open a HepMC GenEvent file (using the appropriate file weight for the first file)
     bool openFile(const std::string& evtfile, double weight=1.0);

Modified: branches/2011-07-aida2yoda/src/Core/AnalysisHandler.cc
==============================================================================
--- branches/2011-07-aida2yoda/src/Core/AnalysisHandler.cc	Mon Aug 22 11:46:14 2011	(r3302)
+++ branches/2011-07-aida2yoda/src/Core/AnalysisHandler.cc	Mon Aug 22 11:47:02 2011	(r3303)
@@ -26,7 +26,7 @@
   }
 
 
-  void AnalysisHandler::init(const GenEvent& ge) {
+  void AnalysisHandler::init(const GenEvent& ge, bool ignorebeams) {
     assert(!_initialised);
     setRunBeams(Rivet::beams(ge));
     MSG_DEBUG("Initialising the analysis handler");
@@ -37,7 +37,7 @@
     const size_t num_anas_requested = analysisNames().size();
     vector<string> anamestodelete;
     foreach (const AnaHandle a, _analyses) {
-      if (!a->isCompatible(beams())) {
+      if ((!a->isCompatible(beams())) && (!ignorebeams)) {
         //MSG_DEBUG(a->name() << " requires beams " << a->requiredBeams() << " @ " << a->requiredEnergies() << " GeV");
         anamestodelete.push_back(a->name());
       }

Modified: branches/2011-07-aida2yoda/src/Core/Run.cc
==============================================================================
--- branches/2011-07-aida2yoda/src/Core/Run.cc	Mon Aug 22 11:46:14 2011	(r3302)
+++ branches/2011-07-aida2yoda/src/Core/Run.cc	Mon Aug 22 11:47:02 2011	(r3303)
@@ -2,7 +2,6 @@
 #include "Rivet/Run.hh"
 #include "Rivet/AnalysisHandler.hh"
 #include "HepMC/IO_GenEvent.h"
-#include "Rivet/Projections/Beam.hh"
 #include "Rivet/Math/MathUtils.hh"
 #include <limits>
 
@@ -72,7 +71,7 @@
   }
 
 
-  bool Run::init(const std::string& evtfile, double weight) {
+  bool Run::init(const std::string& evtfile, double weight, bool ignorebeams) {
     if (!openFile(evtfile, weight)) return false;
 
     // Read first event to define run conditions
@@ -84,7 +83,7 @@
     }
 
     // Initialise AnalysisHandler with beam information from first event
-    _ah.init(*_evt);
+    _ah.init(*_evt, ignorebeams);
 
     // Set cross-section from command line
     if (_xs >= 0.0) {

Modified: branches/2011-07-aida2yoda/src/Projections/Beam.cc
==============================================================================
--- branches/2011-07-aida2yoda/src/Projections/Beam.cc	Mon Aug 22 11:46:14 2011	(r3302)
+++ branches/2011-07-aida2yoda/src/Projections/Beam.cc	Mon Aug 22 11:47:02 2011	(r3303)
@@ -54,10 +54,14 @@
       assert(beams.first && beams.second);
       _theBeams.first = *(beams.first);
       _theBeams.second = *(beams.second);
-    } else {
+    } else if(e.genEvent().barcode_to_particle(1) && e.genEvent().barcode_to_particle(2)) {
       _theBeams.first = *(e.genEvent().barcode_to_particle(1));
       _theBeams.second = *(e.genEvent().barcode_to_particle(2));
     }
+    else {
+      _theBeams.first = Particle(ANY, FourMomentum());
+      _theBeams.second = Particle(ANY, FourMomentum());
+    }
     //getLog() << Log::DEBUG << "Beam particle IDs = " << beamIds() << endl;
   }
 


More information about the Rivet-svn mailing list