Beam.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Rivet.hh"
00003 #include "Rivet/Tools/Logging.hh"
00004 #include "Rivet/Projections/Beam.hh"
00005 #include "HepMC/GenVertex.h"
00006 
00007 
00008 namespace Rivet {
00009 
00010   void Beam::project(const Event& e) {
00011     Log& log = getLog();
00012 
00013     // Assume that the first two particles in the event are the beam particles
00014     /// @todo This is not a robust assumption! HepMC should support directly accessing the beams.
00015     assert(e.genEvent().particles_size() >= 2);
00016     HepMC::GenEvent::particle_const_iterator bp = e.genEvent().particles_begin();
00017     _theBeams.first = **bp;
00018     ++bp;
00019     _theBeams.second = **bp;
00020 
00021     log << Log::DEBUG << "Beam particle IDs = " 
00022         << _theBeams.first.getPdgId() << ", "
00023         << _theBeams.second.getPdgId() << endl;
00024   }
00025 
00026 }