|
[Rivet-svn] r2638 - in trunk: . bin docblackhole at projects.hepforge.org blackhole at projects.hepforge.orgMon Aug 2 21:52:02 BST 2010
Author: buckley Date: Mon Aug 2 21:52:02 2010 New Revision: 2638 Log: Adding rivet-nopy: a super-simple Rivet C++ command line interface which avoids Python to make profiling and debugging easier. Added: trunk/bin/rivet-nopy.cc Modified: trunk/ChangeLog trunk/bin/ (props changed) trunk/bin/Makefile.am trunk/doc/ (props changed) Modified: trunk/ChangeLog ============================================================================== --- trunk/ChangeLog Mon Aug 2 19:39:57 2010 (r2637) +++ trunk/ChangeLog Mon Aug 2 21:52:02 2010 (r2638) @@ -1,5 +1,9 @@ 2010-08-02 Andy Buckley <andy at insectnation.org> + * Adding rivet-nopy: a super-simple Rivet C++ command line + interface which avoids Python to make profiling and debugging + easier. + * Adding graceful exception handling to the AnalysisHandler event loop methods. Modified: trunk/bin/Makefile.am ============================================================================== --- trunk/bin/Makefile.am Mon Aug 2 19:39:57 2010 (r2637) +++ trunk/bin/Makefile.am Mon Aug 2 21:52:02 2010 (r2638) @@ -1,9 +1,9 @@ -bin_SCRIPTS = rivet-config +bin_SCRIPTS = rivet-config dist_bin_SCRIPTS = \ aida2flat aida2root flat2aida root2flat \ compare-histos make-plots -EXTRA_DIST = +EXTRA_DIST = RIVETPROGS = \ rivet \ @@ -16,3 +16,8 @@ else EXTRA_DIST += $(RIVETPROGS) endif + +noinst_PROGRAMS = rivet-nopy +rivet_nopy_SOURCES = rivet-nopy.cc +rivet_nopy_CPPFLAGS = -I$(top_srcdir)/include $(AM_CPPFLAGS) +rivet_nopy_LDADD = ../src/libRivet.la Added: trunk/bin/rivet-nopy.cc ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ trunk/bin/rivet-nopy.cc Mon Aug 2 21:52:02 2010 (r2638) @@ -0,0 +1,32 @@ +#include "Rivet/AnalysisHandler.hh" +#include "HepMC/IO_GenEvent.h" + +using namespace std; + +int main(int argc, char** argv) { + if (argc < 2) { + cerr << "Usage: " << argv[0] << " <hepmcfile> <ana1> [<ana2> ...]" << endl; + return 1; + } + + Rivet::AnalysisHandler ah; + for (int i = 2; i < argc; ++i) { + ah.addAnalysis(argv[i]); + } + + std::istream* file = new std::fstream(argv[1], std::ios::in); + HepMC::IO_GenEvent hepmcio(*file); + HepMC::GenEvent* evt = hepmcio.read_next_event(); + while (evt) { + ah.analyze(*evt); + delete evt; evt = 0; + hepmcio >> evt; + } + delete file; file = 0; + + ah.setCrossSection(1.0); + ah.finalize(); + ah.writeData("out.aida"); + + return 0; +}
More information about the Rivet-svn mailing list |