00001
00002 #include "Rivet/Rivet.hh"
00003 #include "Rivet/Projections/PVertex.hh"
00004 #include "HepMC/GenVertex.h"
00005 #include "HepMC/GenEvent.h"
00006
00007 namespace Rivet {
00008
00009
00010 void PVertex::project(const Event& e) {
00011
00012 _thePVertex = e.genEvent().signal_process_vertex();
00013 getLog() << Log::DEBUG << "PVertex ptr from HepMC = " << _thePVertex << endl;
00014 if (!_thePVertex) {
00015
00016
00017
00018 HepMC::GenEvent::vertex_const_iterator vIt = e.genEvent().vertices_begin();
00019 while((*vIt)->particles_in_size() != 2 && vIt != e.genEvent().vertices_end()){
00020 ++vIt;
00021 }
00022
00023 if(vIt != e.genEvent().vertices_end()) _thePVertex = *vIt;
00024 }
00025 assert(_thePVertex);
00026 const unsigned int pVertexParticleSize = _thePVertex->particles_in_size();
00027 if (pVertexParticleSize != 2 ) {
00028 stringstream ss;
00029 ss << "Wrong number of Primary Vertex particles: " << pVertexParticleSize;
00030 throw Error(ss.str());
00031 }
00032 }
00033
00034
00035 }