<!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 28/03/11 07:20, Hannes Jung wrote:
<blockquote cite="mid:B36B4B67-260C-4185-A759-D31B7DE29239@cern.ch"
 type="cite">Dear Holger
  <div><br>
  </div>
  <div>ahh, thanks a lot, I will try this.</div>
  <div>How are the beam particles extracted in rivet ?</div>
  <div>Should this be included in the rivet part to define beam
particles, or in the user code ?</div>
</blockquote>
<br>
Rivet checks if the HepMC has valid beam particles<br>
in the initialisation step to check whether the analzses to<br>
be run are compatible with the HepMC. IIRC this requirement <br>
will go away in the future but at the moment there is no way<br>
avoiding it. So you need to make sure the beam particles<br>
are set properly in HepMC.<br>
<br>
<blockquote cite="mid:B36B4B67-260C-4185-A759-D31B7DE29239@cern.ch"
 type="cite">
  <div><br>
  </div>
  <div>Sorry for my ignorance</div>
</blockquote>
You are welcome!<br>
<br>
HOlger<br>
<blockquote cite="mid:B36B4B67-260C-4185-A759-D31B7DE29239@cern.ch"
 type="cite">
  <div>cheers</div>
  <div>hannes</div>
  <div><br>
  <div>
  <div>On 27.03.2011, at 22:25, Holger Schulz wrote:</div>
  <br class="Apple-interchange-newline">
  <blockquote type="cite">
    <div 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>
    </div>
  </blockquote>
  </div>
  <br>
  <div><span class="Apple-style-span"
 style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;">
  <div style="word-wrap: break-word;"><span class="Apple-style-span"
 style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">
  <div style="word-wrap: break-word;"><span class="Apple-style-span"
 style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">
  <div style="word-wrap: break-word;"><span class="Apple-style-span"
 style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">
  <div style="word-wrap: break-word;"><span class="Apple-style-span"
 style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">
  <div style="word-wrap: break-word;"><span class="Apple-style-span"
 style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px;">
  <div style="word-wrap: break-word;">
  <div>***********************************************************************</div>
  <div>Hannes Jung </div>
  <div>Email: <a moz-do-not-send="true"
 href="mailto:Hannes.Jung@cern.ch">Hannes.Jung@cern.ch</a></div>
  <div>mobile :+49 40 8998 93741</div>
  <div><a moz-do-not-send="true" href="http://www.desy.de/%7Ejung">http://www.desy.de/~jung</a>
                                          </div>
  <div>Tel: +49 (0) 40 8998 3741 (DESY)</div>
  <div>Tel: +41 22 76 71691 (CERN)       </div>
  <div>CERN - PH</div>
  <div>40-3 B11</div>
  <div>CH-1211 Genève 23</div>
  <div>Switzerland</div>
  <div>***********************************************************************</div>
  <br class="Apple-interchange-newline">
  </div>
  </span></div>
  </span><br class="Apple-interchange-newline">
  </div>
  </span><br class="Apple-interchange-newline">
  </div>
  </span><br class="Apple-interchange-newline">
  </div>
  </span><br class="Apple-interchange-newline">
  </div>
  <br class="Apple-interchange-newline">
  </span><br class="Apple-interchange-newline">
  </div>
  <br>
  </div>
</blockquote>
<br>
</body>
</html>