<!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>