|
[Rivet-svn] r3120 - contrib/lhef2hepmcblackhole at projects.hepforge.org blackhole at projects.hepforge.orgThu Jun 2 22:51:43 BST 2011
Author: buckley Date: Thu Jun 2 22:51:43 2011 New Revision: 3120 Log: Tweaks Modified: contrib/lhef2hepmc/Makefile contrib/lhef2hepmc/lhef2hepmc.cc Modified: contrib/lhef2hepmc/Makefile ============================================================================== --- contrib/lhef2hepmc/Makefile Thu Jun 2 22:23:47 2011 (r3119) +++ contrib/lhef2hepmc/Makefile Thu Jun 2 22:51:43 2011 (r3120) @@ -13,5 +13,8 @@ ./lhef2hepmc ttbar.lhe - which rivet && { ./lhef2hepmc ttbar.lhe fifo.hepmc & rivet -a MC_GENERIC fifo.hepmc; } +install: lhef2hepmc + @test -d $(HEPMC_PREFIX)/bin && install lhef2hepmc $(HEPMC_PREFIX)/bin + clean: @rm -f lhef2hepmc test.hepmc fifo.hepmc Rivet.aida Modified: contrib/lhef2hepmc/lhef2hepmc.cc ============================================================================== --- contrib/lhef2hepmc/lhef2hepmc.cc Thu Jun 2 22:23:47 2011 (r3119) +++ contrib/lhef2hepmc/lhef2hepmc.cc Thu Jun 2 22:51:43 2011 (r3120) @@ -13,30 +13,43 @@ #include <cassert> #include <iostream> +using namespace std; using namespace HepMC; int main(int argc, char** argv) { + // Look for a help argument + for (int i = 1; i < argc; ++i) { + const string arg = argv[i]; + if (arg == "--help" || arg == "-h") { + cout << argv[0] << ": an LHEF to HepMC event format converter" << endl; + cout << "Usage: " << argv[0] << "[<infile> <outfile>]" << endl; + cout << "If called with no args, reads from stdin and writes to stdout." << endl; + cout << "Use filename '-' to explicitly specify reading/writing on stdin/out." << endl; + exit(0); + } + } + // Choose input and output files from the command line - std::string infile("-"), outfile("-"); + string infile("-"), outfile("-"); if (argc == 3) { infile = argv[1]; outfile = argv[2]; } else if (argc == 2 || argc > 3) { - std::cerr << "Usage: " << argv[0] << "[<infile> <outfile>]" << std::endl; + cerr << "Usage: " << argv[0] << "[<infile> <outfile>]" << endl; exit(1); } // Init readers and writers LHEF::Reader* reader = 0; if (infile == "-") { - reader = new LHEF::Reader(std::cin); + reader = new LHEF::Reader(cin); } else { reader = new LHEF::Reader(infile); } IO_GenEvent* writer = 0; if (outfile == "-") { - writer = new IO_GenEvent(std::cout); + writer = new IO_GenEvent(cout); } else { writer = new IO_GenEvent(outfile); } @@ -59,7 +72,7 @@ for (int i = 0; i < reader->hepeup.NUP; ++i) { if (reader->hepeup.ISTUP[i] != 1) { - //std::cout << reader->hepeup.ISTUP[i] << ", " << reader->hepeup.IDUP[i] << std::endl; + //cout << reader->hepeup.ISTUP[i] << ", " << reader->hepeup.IDUP[i] << endl; continue; } FourVector p(reader->hepeup.PUP[i][0], reader->hepeup.PUP[i][1],
More information about the Rivet-svn mailing list |