void Lund_Interface::FillOutgoingParticlesInBlob(Blob *blob) { Flavour flav; Vec4D momentum; Particle * particle; int n_q(0), n_g(0); Particle_Vector partons; for (int j=hepevt.jdahep[0][0]-1;j<hepevt.jdahep[0][1];j++) { int idhep = hepevt.idhep[j]; flav=IdhepToSherpa(idhep); momentum=Vec4D(hepevt.phep[j][3],hepevt.phep[j][0], hepevt.phep[j][1],hepevt.phep[j][2]); // don't fill blob position vector here, because decay is in CMS until boosting back particle = new Particle(-1,flav,momentum); particle->SetNumber(0); particle->SetStatus(part_status::active); particle->SetInfo('D'); particle->SetFinalMass(hepevt.phep[j][4]); blob->AddToOutParticles(particle); if(abs(idhep)>0 && abs(idhep)<7) { n_q++; partons.push_back(particle); } else if(abs(idhep)==21) { n_g++; partons.push_back(particle); } } size_t n=partons.size(); if(n>0) blob->SetStatus(blob_status::needs_showers); if(n_q==2 && n_g==0 && n==2) { if(partons[0]->Flav().IsAnti()) { partons[0]->SetFlow(2,-1); partons[1]->SetFlow(1,partons[0]->GetFlow(2)); } else { partons[0]->SetFlow(1,-1); partons[1]->SetFlow(2,partons[0]->GetFlow(1)); } } else if(n_q==0 && n_g==2 && n==2) { partons[0]->SetFlow(2,-1); partons[0]->SetFlow(1,-1); partons[1]->SetFlow(2,partons[0]->GetFlow(1)); partons[1]->SetFlow(1,partons[0]->GetFlow(2)); } else if(n_q==0 && n_g==3 && n==3) { partons[0]->SetFlow(2,-1); partons[0]->SetFlow(1,-1); partons[1]->SetFlow(2,partons[0]->GetFlow(1)); partons[1]->SetFlow(1,-1); partons[2]->SetFlow(2,partons[1]->GetFlow(1)); partons[2]->SetFlow(1,partons[0]->GetFlow(2)); } else if(n>0) { msg_Error()<<METHOD<<" wasn't able to set the color flow for"<<endl<<*blob<<endl; } }
void Lund_Interface::FillFragmentationBlob(Blob *blob) { Particle *particle; Flavour flav; Vec4D momentum, position; for (int i=0;i<hepevt.nhep;++i) { if ((hepevt.isthep[i]!=2)&&(hepevt.isthep[i]!=1)&&(hepevt.isthep[i]!=149)) continue; if (hepevt.idhep[i]==93) flav=Flavour(kf_cluster); else flav=IdhepToSherpa(hepevt.idhep[i]); if (flav==Flavour(kf_string) || flav==Flavour(kf_cluster)) { for (int j=hepevt.jdahep[i][0]-1;j<hepevt.jdahep[i][1];j++) { flav=IdhepToSherpa(hepevt.idhep[j]); momentum=Vec4D(hepevt.phep[j][3],hepevt.phep[j][0], hepevt.phep[j][1],hepevt.phep[j][2]); position=Vec4D(hepevt.vhep[j][3],hepevt.vhep[j][0], hepevt.vhep[j][1],hepevt.vhep[j][2]); particle = new Particle(-1,flav,momentum); particle->SetNumber(0); particle->SetStatus(part_status::active); particle->SetInfo('P'); particle->SetFinalMass(hepevt.phep[j][4]); blob->SetPosition(position); blob->AddToOutParticles(particle); } } } blob->SetStatus(blob_status::needs_hadrondecays); }
size_t Colour_Generator:: SelectColourReplacement(Particle * part1,Particle * part2) { bool dir(ran->Get()>=0.5),found(false); size_t beam,index,col,col1,idcol; for (size_t i=0;i<2;i++) { beam = dir?i:1-i; for (index = 1;index<3;index++) { col = (beam==1?part2:part1)->GetFlow(index); for (set<int>::iterator cit=m_col[beam][2-index].begin(); cit!=m_col[beam][2-index].end();cit++) { if (col==(*cit)) { col1 = (beam==1?part1:part2)->GetFlow(3-index); if (col1!=0) { found = false; for (int i=0;i<m_hadrons[1-beam]->GetParticles().size();i++){ if (m_hadrons[1-beam]->GetParticles()[i]->GetFlow(index)==col && m_hadrons[1-beam]->GetParticles()[i]->GetFlow(3-index)!=col1){ found = true; idcol = m_hadrons[1-beam]->GetParticles()[i]->GetFlow(3-index); break; } } break; } } } if (found) break; } if (found) break; } if (!found) return 0; p_compensator = new Blob(p_ladder->Position()*rpa->hBar()*rpa->c()); p_compensator->SetId(); p_compensator->SetType(btp::Soft_Collision); p_compensator->SetTypeSpec("ColourCompensation"); p_compensator->SetStatus(blob_status::inactive); p_compensator->AddToInParticles((beam==1?part2:part1)); (beam==1?part2:part1)->SetStatus(part_status::decayed); Particle * gluon = new Particle(-1,Flavour(kf_gluon),Vec4D(0.,0.,0.,0.),'R'); gluon->SetNumber(); gluon->SetFlow(index,col1); gluon->SetFlow(3-index,col); if (col1==0 || col1==0) msg_Error()<<"Error with colours here (4).\n"; gluon->SetStatus(part_status::decayed); p_compensator->AddToInParticles(gluon); p_blob->AddToOutParticles(gluon); Particle * part= new Particle(*((beam==1?part2:part1))); part->SetNumber(); part->SetFlow(index,col1); if ((part->Flav().IsGluon() && col1==0) || (part->Flav().IsQuark() && part->Flav().IsAnti() && index==2 && col1==0) || (part->Flav().IsQuark() && !part->Flav().IsAnti() && index==1 && col1==0)) msg_Error()<<"Error with colours here (5).\n"; (beam==1?p_ladder->GetIn2():p_ladder->GetIn1())->m_flow.SetCode(index,col1); (beam==1?p_ladder->GetIn2():p_ladder->GetIn1())->p_part = part; for (int i=0;i<p_blob->NInP();i++) { part = p_blob->InParticle(i); if (part->GetFlow(index)==col && part->GetFlow(3-index)==idcol && part->Beam()==(1-beam)){ part->SetFlow(index,col1); break; } if ((part->Flav().IsGluon() && col1==0) || (part->Flav().IsQuark() && part->Flav().IsAnti() && index==2 && col1==0) || (part->Flav().IsQuark() && !part->Flav().IsAnti() && index==1 && col1==0)) msg_Error()<<"Error with colours here (6).\n"; } m_col[beam][2-index].erase(col); m_col[beam][2-index].insert(col1); return (beam==1?3-index:index); }