Commit 9b393e96 authored by Stefan Hoeche's avatar Stefan Hoeche

svn merge -c31453 ^/branches/unlops .

(add beam particles to fixed-order hepmc record)
parent 0eebe61f
......@@ -300,7 +300,7 @@ bool HepMC2_Interface::Sherpa2ShortHepMC(ATOOLS::Blob_List *const blobs,
event.set_event_number(ATOOLS::rpa->gen.NumberOfGeneratedEvents());
evtinfo.WriteTo(event);
HepMC::GenVertex * vertex=new HepMC::GenVertex();
std::vector<HepMC::GenParticle*> beamparticles;
std::vector<HepMC::GenParticle*> beamparticles, inparticles;
for (ATOOLS::Blob_List::iterator blit=blobs->begin();
blit!=blobs->end();++blit) {
Blob* blob=*blit;
......@@ -312,6 +312,7 @@ bool HepMC2_Interface::Sherpa2ShortHepMC(ATOOLS::Blob_List *const blobs,
HepMC::GenParticle* inpart =
new HepMC::GenParticle(momentum,(long int)parton->Flav(),2);
vertex->add_particle_in(inpart);
inparticles.push_back(inpart);
// distinct because SHRIMPS has no bunches for some reason
if (blob->Type()==btp::Beam || blob->Type()==btp::Bunch) {
beamparticles.push_back(inpart);
......@@ -330,6 +331,19 @@ bool HepMC2_Interface::Sherpa2ShortHepMC(ATOOLS::Blob_List *const blobs,
}
}
event.add_vertex(vertex);
if (beamparticles.empty() && inparticles.size()==2) {
for (size_t j(0);j<2;++j) {
HepMC::GenVertex *beamvertex = new HepMC::GenVertex();
event.add_vertex(beamvertex);
HepMC::FourVector mombeam(rpa->gen.PBeam(j)[1],rpa->gen.PBeam(j)[2],
rpa->gen.PBeam(j)[3],rpa->gen.PBeam(j)[0]);
beamparticles.push_back
(new HepMC::GenParticle(mombeam,(long int)
(j?rpa->gen.Beam2():rpa->gen.Beam1()),2));
beamvertex->add_particle_in(beamparticles[j]);
beamvertex->add_particle_out(inparticles[j]);
}
}
if (beamparticles.size()==2) {
event.set_beam_particles(beamparticles[0],beamparticles[1]);
}
......@@ -352,7 +366,15 @@ bool HepMC2_Interface::SubEvtList2ShortHepMC(EventInfo &evtinfo)
// set the event number (could be used to identify correlated events)
subevent->set_event_number(ATOOLS::rpa->gen.NumberOfGeneratedEvents());
// assume that only 2->(n-2) processes, flip for Comix, flavs are correct
HepMC::GenParticle *beamparticles[2]={NULL,NULL};
for (size_t j(0);j<2;++j) {
HepMC::GenVertex *beamvertex = new HepMC::GenVertex();
subevent->add_vertex(beamvertex);
HepMC::FourVector mombeam(rpa->gen.PBeam(j)[1],rpa->gen.PBeam(j)[2],
rpa->gen.PBeam(j)[3],rpa->gen.PBeam(j)[0]);
beamparticles[j] = new HepMC::GenParticle
(mombeam,(long int)(j?rpa->gen.Beam2():rpa->gen.Beam1()),2);
beamvertex->add_particle_in(beamparticles[j]);
double flip(sub->p_mom[j][0]<0.);
HepMC::FourVector momentum((flip?-1.:1.)*sub->p_mom[j][1],
(flip?-1.:1.)*sub->p_mom[j][2],
......@@ -361,7 +383,9 @@ bool HepMC2_Interface::SubEvtList2ShortHepMC(EventInfo &evtinfo)
HepMC::GenParticle* inpart =
new HepMC::GenParticle(momentum,(long int)sub->p_fl[j],2);
subvertex->add_particle_in(inpart);
beamvertex->add_particle_out(inpart);
}
subevent->set_beam_particles(beamparticles[0],beamparticles[1]);
for (size_t j(2);j<sub->m_n;++j) {
HepMC::FourVector momentum(sub->p_mom[j][1],sub->p_mom[j][2],
sub->p_mom[j][3],sub->p_mom[j][0]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment