<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html; charset=ISO-8859-1"
 http-equiv="Content-Type">
  <title></title>
</head>
<body text="#000000" bgcolor="#ffffff">
On 27/03/11 17:36, Hannes Jung wrote:
<blockquote cite="mid:0A3D7FEB-73B6-4D58-B5A4-AAEFFAC6E0F5@cern.ch"
 type="cite">
  <pre wrap="">Dear all

I am rying to run PHOJET with rivet, I managed to write out the hepmc record and inserted the beam particles.
It seems to be fine, but rivet cannot identify the beams. The following error appears:
----------
~/jung/cvs/rivet/myrivet>  ../../phojet/main1/main1 < ../../phojet/main1/mb.inp > test.out &     
[3] 12393
~/jung/cvs/rivet/myrivet> ../build/Rivet-1.5.0/bin/rivet-nopy /tmp/example_out.dat CMS_FWD_11_001
Rivet.Analysis.Handler: WARN  Analysis 'CMS_FWD_11_001' is unvalidated: be careful, it may be broken!
 CMS_FWD_11_001 init phase
 new event 
Assertion failed: (beams.first && beams.second), function project, file Beam.cc, line 53.
zsh: abort      ../build/Rivet-1.5.0/bin/rivet-nopy /tmp/example_out.dat CMS_FWD_11_001
----------

The first few lines of the hepmc file look like:

HepMC::Version 2.03.11
HepMC::IO_GenEvent-START_EVENT_LISTING
E 0 -1 -1.0000000000000000e+00 -1.0000000000000000e+00 -1.0000000000000000e+00 0 0 167 1 2 0 0
H 0 0 0 0 0 0 0 0 0 0 0 0 0
F 0 0 0 0 0 0 0
V -1 0 0 0 0 0 1 1 0
P 1 2212 0 0 3.5000000000000000e+03 3.5000000000000000e+03 9.3827000000000005e-01 3 0 0 -1 0
P 3 1 -1.9197591135156278e+00 -3.9088666188920991e-02 1.8743428161779718e+01 1.8841528606871407e+01 9.9000002932664519e-03 2 0 0 -3 0
V -2 0 0 0 0 0 1 27 0
P 2 2212 0 0 -3.5000000000000000e+03 3.5000000000000000e+03 9.3827000000000005e-01 3 0 0 -2 0
P 4 -2 4.9018658469058018e-01 5.6550380835818814e-01 -2.0026574606985077e+03 2.0026576005398924e+03 5.5999254606944934e-03 2 0 0 -4 0
P 5 -1 -2.1560772467809458e-01 -1.8019388783202768e+00 2.5303300407030580e+00 3.1138623182516181e+00 9.8999999999710413e-03 2 0 0 -5 0
.....

Any idea what I am doing wrong here ?

Thanks a lot
Cheers
Hannes


  </pre>
</blockquote>
Hi Hannes,<br>
<br>
I am not 100 percent sure but it could be that the beams have not
properly been<br>
set in the HepMC event record. Something similar showed up when
recently we<br>
solved a problem with the Whizard event generator. There is a solution
by Frank<br>
Siegert that may apply here as well. When filling the HepMC stuff, you
could<br>
iterate over all particles and look for those without a mother and
explicitly<br>
set those as beam particles.<br>
<br>
Here is a code snippet that solved the Whizard problem, <br>
the lines in blue do the beam particle finding:<br>
<br>
// Function copied from Frank siegert<br>
bool cmpGenParticleByEDesc(const HepMC::GenParticle* a, const
HepMC::GenParticle* b) {<br>
  return a->momentum().e() > b->momentum().e();<br>
}<br>
<br>
extern "C" void io_gen_event_write_event<br>
( IO_GenEvent* iostream, GenEvent* evt) {<br>
  // Add beam particles by trying to find those particles without a
mother<br>
  <font color="#000099">if (!evt->valid_beam_particles()) {<br>
    std::vector<HepMC::GenParticle*> beams;<br>
    for ( HepMC::GenEvent::particle_const_iterator p =
evt->particles_begin();<br>
          p != evt->particles_end(); ++p ) {<br>
      if (!(*p)->production_vertex() &&
(*p)->pdg_id()!=0) {<br>
        beams.push_back(*p);<br>
      }<br>
    }<br>
   // Set the beam particles<br>
   evt->set_beam_particles(beams[0], beams[1]);</font><br>
  }<br>
  // Write the event<br>
  iostream->write_event( evt);<br>
}<br>
<br>
<br>
Hope that helps,<br>
Holger<br>
<br>
<br>
<br>
<br>
<br>
</body>
</html>