diff --git a/Decay/Perturbative/SMWDecayer.cc b/Decay/Perturbative/SMWDecayer.cc --- a/Decay/Perturbative/SMWDecayer.cc +++ b/Decay/Perturbative/SMWDecayer.cc @@ -1,667 +1,667 @@ // -*- C++ -*- // // SMWDecayer.cc is a part of Herwig - A multi-purpose Monte Carlo event generator // Copyright (C) 2002-2011 The Herwig Collaboration // // Herwig is licenced under version 2 of the GPL, see COPYING for details. // Please respect the MCnet academic guidelines, see GUIDELINES for details. // // // This is the implementation of the non-inlined, non-templated member // functions of the SMWDecayer class. // #include "SMWDecayer.h" #include "ThePEG/Interface/ClassDocumentation.h" #include "ThePEG/Interface/ParVector.h" #include "ThePEG/Interface/Reference.h" #include "ThePEG/Persistency/PersistentOStream.h" #include "ThePEG/Persistency/PersistentIStream.h" #include "ThePEG/PDT/DecayMode.h" #include "Herwig/Decay/DecayVertex.h" #include "ThePEG/Helicity/VectorSpinInfo.h" #include "ThePEG/Helicity/FermionSpinInfo.h" #include "ThePEG/Helicity/WaveFunction/VectorWaveFunction.h" #include "Herwig/Models/StandardModel/StandardModel.h" #include "Herwig/Shower/Base/ShowerTree.h" #include "Herwig/Shower/Base/ShowerProgenitor.h" #include "Herwig/Shower/Base/ShowerParticle.h" #include "Herwig/Shower/Base/Branching.h" #include "Herwig/Decay/GeneralDecayMatrixElement.h" using namespace Herwig; using namespace ThePEG::Helicity; const double SMWDecayer::EPS_=0.00000001; SMWDecayer::SMWDecayer() : quarkWeight_(6,0.), leptonWeight_(3,0.) { quarkWeight_[0] = 1.01596; quarkWeight_[1] = 0.0537308; quarkWeight_[2] = 0.0538085; quarkWeight_[3] = 1.01377; quarkWeight_[4] = 1.45763e-05; quarkWeight_[5] = 0.0018143; leptonWeight_[0] = 0.356594; leptonWeight_[1] = 0.356593; leptonWeight_[2] = 0.356333; // intermediates generateIntermediates(false); } void SMWDecayer::doinit() { DecayIntegrator::doinit(); // get the vertices from the Standard Model object tcHwSMPtr hwsm=dynamic_ptr_cast(standardModel()); if(!hwsm) throw InitException() << "Must have Herwig StandardModel object in" << "SMWDecayer::doinit()" << Exception::runerror; FFWvertex_ = dynamic_ptr_cast(hwsm->vertexFFW()); // make sure they are initialized FFWvertex_->init(); // now set up the decay modes DecayPhaseSpaceModePtr mode; tPDVector extpart(3); vector wgt(0); // W modes extpart[0]=getParticleData(ParticleID::Wplus); // loop for the quarks unsigned int iz=0; for(int ix=1;ix<6;ix+=2) { for(int iy=2;iy<6;iy+=2) { // check that the combination of particles is allowed if(!FFWvertex_->allowed(-ix,iy,ParticleID::Wminus)) throw InitException() << "SMWDecayer::doinit() the W vertex" << "cannot handle all the quark modes" << Exception::abortnow; extpart[1] = getParticleData(-ix); extpart[2] = getParticleData( iy); mode = new_ptr(DecayPhaseSpaceMode(extpart,this)); addMode(mode,quarkWeight_[iz],wgt); ++iz; } } // loop for the leptons for(int ix=11;ix<17;ix+=2) { // check that the combination of particles is allowed // if(!FFWvertex_->allowed(-ix,ix+1,ParticleID::Wminus)) // throw InitException() << "SMWDecayer::doinit() the W vertex" // << "cannot handle all the lepton modes" // << Exception::abortnow; extpart[1] = getParticleData(-ix); extpart[2] = getParticleData(ix+1); mode = new_ptr(DecayPhaseSpaceMode(extpart,this)); addMode(mode,leptonWeight_[(ix-11)/2],wgt); } } int SMWDecayer::modeNumber(bool & cc,tcPDPtr parent, const tPDVector & children) const { int imode(-1); if(children.size()!=2) return imode; int id0=parent->id(); tPDVector::const_iterator pit = children.begin(); int id1=(**pit).id(); ++pit; int id2=(**pit).id(); if(abs(id0)!=ParticleID::Wplus) return imode; int idd(0),idu(0); if(abs(id1)%2==1&&abs(id2)%2==0) { idd=abs(id1); idu=abs(id2); } else if(abs(id1)%2==0&&abs(id2)%2==1) { idd=abs(id2); idu=abs(id1); } if(idd==0&&idu==0) { return imode; } else if(idd<=5) { imode=idd+idu/2-2; } else { imode=(idd-1)/2+1; } cc= (id0==ParticleID::Wminus); return imode; } void SMWDecayer::persistentOutput(PersistentOStream & os) const { os << FFWvertex_ << quarkWeight_ << leptonWeight_ << alpha_; } void SMWDecayer::persistentInput(PersistentIStream & is, int) { is >> FFWvertex_ >> quarkWeight_ >> leptonWeight_ >> alpha_; } ClassDescription SMWDecayer::initSMWDecayer; // Definition of the static class description member. void SMWDecayer::Init() { static ClassDocumentation documentation ("The SMWDecayer class is the implementation of the decay" " of the W boson to the Standard Model fermions."); static ParVector interfaceWquarkMax ("QuarkMax", "The maximum weight for the decay of the W to quarks", &SMWDecayer::quarkWeight_, 0, 0, 0, -10000, 10000, false, false, true); static ParVector interfaceWleptonMax ("LeptonMax", "The maximum weight for the decay of the W to leptons", &SMWDecayer::leptonWeight_, 0, 0, 0, -10000, 10000, false, false, true); static Reference interfaceCoupling ("Coupling", "Pointer to the object to calculate the coupling for the correction", &SMWDecayer::alpha_, false, false, true, false, false); } // return the matrix element squared double SMWDecayer::me2(const int, const Particle & inpart, const ParticleVector & decay, MEOption meopt) const { if(!ME()) ME(new_ptr(GeneralDecayMatrixElement(PDT::Spin1,PDT::Spin1Half,PDT::Spin1Half))); int iferm(1),ianti(0); if(decay[0]->id()>0) swap(iferm,ianti); if(meopt==Initialize) { VectorWaveFunction::calculateWaveFunctions(_vectors,_rho, const_ptr_cast(&inpart), incoming,false); } if(meopt==Terminate) { VectorWaveFunction::constructSpinInfo(_vectors,const_ptr_cast(&inpart), incoming,true,false); SpinorBarWaveFunction:: constructSpinInfo(_wavebar,decay[iferm],outgoing,true); SpinorWaveFunction:: constructSpinInfo(_wave ,decay[ianti],outgoing,true); return 0.; } SpinorBarWaveFunction:: calculateWaveFunctions(_wavebar,decay[iferm],outgoing); SpinorWaveFunction:: calculateWaveFunctions(_wave ,decay[ianti],outgoing); // compute the matrix element Energy2 scale(sqr(inpart.mass())); for(unsigned int ifm=0;ifm<2;++ifm) { for(unsigned int ia=0;ia<2;++ia) { for(unsigned int vhel=0;vhel<3;++vhel) { if(iferm>ianti) (*ME())(vhel,ia,ifm)= FFWvertex_->evaluate(scale,_wave[ia],_wavebar[ifm],_vectors[vhel]); else (*ME())(vhel,ifm,ia)= FFWvertex_->evaluate(scale,_wave[ia],_wavebar[ifm],_vectors[vhel]); } } } double output=(ME()->contract(_rho)).real()*UnitRemoval::E2/scale; if(abs(decay[0]->id())<=6) output*=3.; if(decay[0]->hasColour()) decay[0]->antiColourNeighbour(decay[1]); else if(decay[1]->hasColour()) decay[1]->antiColourNeighbour(decay[0]); return output; } void SMWDecayer::doinitrun() { DecayIntegrator::doinitrun(); if(initialize()) { for(unsigned int ix=0;ixmaxWeight(); else leptonWeight_[ix-6]=mode(ix)->maxWeight(); } } } void SMWDecayer::dataBaseOutput(ofstream & output, bool header) const { if(header) output << "update decayers set parameters=\""; for(unsigned int ix=0;ix::const_iterator cjt; // get the quark and antiquark ParticleVector qq; for(cjt=tree->outgoingLines().begin();cjt!=tree->outgoingLines().end();++cjt) qq.push_back(cjt->first->copy()); // ensure quark first if(qq[0]->id()<0) swap(qq[0],qq[1]); // centre of mass energy d_Q_ = (qq[0]->momentum() + qq[1]->momentum()).m(); // quark mass d_m_ = 0.5*(qq[0]->momentum().m()+qq[1]->momentum().m()); // set the other parameters setRho(sqr(d_m_/d_Q_)); setKtildeSymm(); // otherwise can do it initial=1.; final =1.; } void SMWDecayer:: applyHardMatrixElementCorrection(ShowerTreePtr tree) { // get the quark and antiquark ParticleVector qq; map::const_iterator cit; for(cit=tree->outgoingLines().begin();cit!=tree->outgoingLines().end();++cit) qq.push_back(cit->first->copy()); if(!qq[0]->dataPtr()->coloured()) return; // ensure quark first if(qq[0]->id()<0) swap(qq[0],qq[1]); // get the momenta vector newfs = applyHard(qq); // return if no emission if(newfs.size()!=3) return; // perform final check to ensure energy greater than constituent mass for (int i=0; i<2; i++) { if (newfs[i].e() < qq[i]->data().constituentMass()) return; } if (newfs[2].e() < getParticleData(ParticleID::g)->constituentMass()) return; // set masses for (int i=0; i<2; i++) newfs[i].setMass(qq[i]->mass()); newfs[2].setMass(ZERO); // decide which particle emits bool firstEmits= newfs[2].vect().perp2(newfs[0].vect())< newfs[2].vect().perp2(newfs[1].vect()); // create the new quark, antiquark and gluon PPtr newg = getParticleData(ParticleID::g)->produceParticle(newfs[2]); PPtr newq,newa; if(firstEmits) { newq = qq[0]->dataPtr()->produceParticle(newfs[0]); newa = new_ptr(Particle(*qq[1])); qq[1]->antiColourLine()->removeAntiColoured(newa); newa->set5Momentum(newfs[1]); } else { newq = new_ptr(Particle(*qq[0])); qq[0]->colourLine()->removeColoured(newq); newq->set5Momentum(newfs[0]); newa = qq[1]->dataPtr()->produceParticle(newfs[1]); } // get the original colour line ColinePtr col; if(qq[0]->id()>0) col=qq[0]->colourLine(); else col=qq[0]->antiColourLine(); // set the colour lines if(firstEmits) { col->addColoured(newq); col->addAntiColoured(newg); newa->colourNeighbour(newg); } else { col->addAntiColoured(newa); col->addColoured(newg); newq->antiColourNeighbour(newg); } // change the existing quark and antiquark PPtr orig; for(cit=tree->outgoingLines().begin();cit!=tree->outgoingLines().end();++cit) { if(cit->first->progenitor()->id()==newq->id()) { // remove old particles from colour line col->removeColoured(cit->first->copy()); col->removeColoured(cit->first->progenitor()); // insert new particles cit->first->copy(newq); ShowerParticlePtr sp(new_ptr(ShowerParticle(*newq,1,true))); cit->first->progenitor(sp); tree->outgoingLines()[cit->first]=sp; cit->first->perturbative(!firstEmits); if(firstEmits) orig=cit->first->original(); } else { // remove old particles from colour line col->removeAntiColoured(cit->first->copy()); col->removeColoured(cit->first->progenitor()); // insert new particles cit->first->copy(newa); ShowerParticlePtr sp(new_ptr(ShowerParticle(*newa,1,true))); cit->first->progenitor(sp); tree->outgoingLines()[cit->first]=sp; cit->first->perturbative(firstEmits); if(!firstEmits) orig=cit->first->original(); } } // add the gluon ShowerParticlePtr sg=new_ptr(ShowerParticle(*newg,1,true)); ShowerProgenitorPtr gluon=new_ptr(ShowerProgenitor(orig,newg,sg)); gluon->perturbative(false); tree->outgoingLines().insert(make_pair(gluon,sg)); tree->hardMatrixElementCorrection(true); } vector SMWDecayer:: applyHard(const ParticleVector &p) { double x, xbar; vector fs; // return if no emission if (getHard(x, xbar) < UseRandom::rnd() || p.size() != 2) return fs; // centre of mass energy Lorentz5Momentum pcm = p[0]->momentum() + p[1]->momentum(); // momenta of quark,antiquark and gluon Lorentz5Momentum pq, pa, pg; if (p[0]->id() > 0) { pq = p[0]->momentum(); pa = p[1]->momentum(); } else { pa = p[0]->momentum(); pq = p[1]->momentum(); } // boost to boson rest frame Boost beta = (pcm.findBoostToCM()); pq.boost(beta); pa.boost(beta); // return if fails ????? double xg = 2.-x-xbar; if((1.-x)*(1.-xbar)*(1.-xg) < d_rho_*xg*xg) return fs; Axis u1, u2, u3; // moduli of momenta in units of Q and cos theta // stick to q direction? // p1 is the one that is kept, p2 is the other fermion, p3 the gluon. Energy e1, e2, e3; Energy pp1, pp2, pp3; bool keepq = true; if (UseRandom::rnd() > sqr(x)/(sqr(x)+sqr(xbar))) keepq = false; if (keepq) { pp1 = d_Q_*sqrt(sqr(x)-4.*d_rho_)/2.; pp2 = d_Q_*sqrt(sqr(xbar)-4.*d_rho_)/2.; e1 = d_Q_*x/2.; e2 = d_Q_*xbar/2.; u1 = pq.vect().unit(); } else { pp2 = d_Q_*sqrt(sqr(x)-4.*d_rho_)/2.; pp1 = d_Q_*sqrt(sqr(xbar)-4.*d_rho_)/2.; e2 = d_Q_*x/2.; e1 = d_Q_*xbar/2.; u1 = pa.vect().unit(); } pp3 = d_Q_*xg/2.; e3 = pp3; u2 = u1.orthogonal(); u2 /= u2.mag(); u3 = u1.cross(u2); u3 /= u3.mag(); double ct2=-2., ct3=-2.; if (pp1 == ZERO || pp2 == ZERO || pp3 == ZERO) { bool touched = false; if (pp1 == ZERO) { ct2 = 1; ct3 = -1; touched = true; } if (pp2 == ZERO || pp3 == ZERO) { ct2 = 1; ct3 = 1; touched = true; } if (!touched) throw Exception() << "SMWDecayer::applyHard()" << " did not set ct2/3" << Exception::abortnow; } else { ct3 = (sqr(pp1)+sqr(pp3)-sqr(pp2))/(2.*pp1*pp3); ct2 = (sqr(pp1)+sqr(pp2)-sqr(pp3))/(2.*pp1*pp2); } double phi = Constants::twopi*UseRandom::rnd(); double cphi = cos(phi); double sphi = sin(phi); double st2 = sqrt(1.-sqr(ct2)); double st3 = sqrt(1.-sqr(ct3)); ThreeVector pv1, pv2, pv3; pv1 = pp1*u1; pv2 = -ct2*pp2*u1 + st2*cphi*pp2*u2 + st2*sphi*pp2*u3; pv3 = -ct3*pp3*u1 - st3*cphi*pp3*u2 - st3*sphi*pp3*u3; if (keepq) { pq = Lorentz5Momentum(pv1, e1); pa = Lorentz5Momentum(pv2, e2); } else { pa = Lorentz5Momentum(pv1, e1); pq = Lorentz5Momentum(pv2, e2); } pg = Lorentz5Momentum(pv3, e3); pq.boost(-beta); pa.boost(-beta); pg.boost(-beta); fs.push_back(pq); fs.push_back(pa); fs.push_back(pg); return fs; } double SMWDecayer::getHard(double &x1, double &x2) { double w = 0.0; double y1 = UseRandom::rnd(),y2 = UseRandom::rnd(); // simply double MC efficiency // -> weight has to be divided by two (Jacobian) if (y1 + y2 > 1) { y1 = 1.-y1; y2 = 1.-y2; } bool inSoft = false; if (y1 < 0.25) { if (y2 < 0.25) { inSoft = true; if (y1 < y2) { y1 = 0.25-y1; y2 = y1*(1.5 - 2.*y2); } else { y2 = 0.25 - y2; y1 = y2*(1.5 - 2.*y1); } } else { if (y2 < y1 + 2.*sqr(y1)) return w; } } else { if (y2 < 0.25) { if (y1 < y2 + 2.*sqr(y2)) return w; } } // inside PS? x1 = 1.-y1; x2 = 1.-y2; if(y1*y2*(1.-y1-y2) < d_rho_*sqr(y1+y2)) return w; double k1 = getKfromX(x1, x2); double k2 = getKfromX(x2, x1); // Is it in the quark emission zone? if (k1 < d_kt1_) return 0.0; // No...is it in the anti-quark emission zone? if (k2 < d_kt2_) return 0.0; // Point is in dead zone: compute q qbar g weight w = MEV(x1, x2); // for axial: // w = MEA(x1, x2); // Reweight soft region if (inSoft) { if (y1 < y2) w *= 2.*y1; else w *= 2.*y2; } // alpha and colour factors Energy2 pt2 = sqr(d_Q_)*(1.-x1)*(1.-x2); w *= 1./3./Constants::pi*alpha_->value(pt2); return w; } bool SMWDecayer:: softMatrixElementVeto(ShowerProgenitorPtr initial,ShowerParticlePtr parent,Branching br) { // check we should be applying the veto if(parent->id()!=initial->progenitor()->id()|| br.ids[0]!=br.ids[1]|| - br.ids[2]!=ParticleID::g) return false; + br.ids[2]->id()!=ParticleID::g) return false; // calculate pt double d_z = br.kinematics->z(); Energy d_qt = br.kinematics->scale(); Energy2 d_m2 = parent->momentum().m2(); Energy2 pPerp2 = sqr(d_z*d_qt) - d_m2; if(pPerp2vetoEmission(br.type,br.kinematics->scale()); return true; } Energy pPerp = (1.-d_z)*sqrt(pPerp2); // if not hardest so far don't apply veto if(pPerphighestpT()) return false; // calculate the weight double weight = 0.; if(parent->id()>0) weight = qWeightX(d_qt, d_z); else weight = qbarWeightX(d_qt, d_z); // compute veto from weight bool veto = !UseRandom::rndbool(weight); // if vetoing reset the scale if(veto) parent->vetoEmission(br.type,br.kinematics->scale()); // return the veto return veto; } void SMWDecayer::setRho(double r) { d_rho_ = r; d_v_ = sqrt(1.-4.*d_rho_); } void SMWDecayer::setKtildeSymm() { d_kt1_ = (1. + sqrt(1. - 4.*d_rho_))/2.; setKtilde2(); } void SMWDecayer::setKtilde2() { double num = d_rho_ * d_kt1_ + 0.25 * d_v_ *(1.+d_v_)*(1.+d_v_); double den = d_kt1_ - d_rho_; d_kt2_ = num/den; } double SMWDecayer::getZfromX(double x1, double x2) { double uval = u(x2); double num = x1 - (2. - x2)*uval; double den = sqrt(x2*x2 - 4.*d_rho_); return uval + num/den; } double SMWDecayer::getKfromX(double x1, double x2) { double zval = getZfromX(x1, x2); return (1.-x2)/(zval*(1.-zval)); } double SMWDecayer::MEV(double x1, double x2) { // Vector part double num = (x1+2.*d_rho_)*(x1+2.*d_rho_) + (x2+2.*d_rho_)*(x2+2.*d_rho_) - 8.*d_rho_*(1.+2.*d_rho_); double den = (1.+2.*d_rho_)*(1.-x1)*(1.-x2); return (num/den - 2.*d_rho_/((1.-x1)*(1.-x1)) - 2*d_rho_/((1.-x2)*(1.-x2)))/d_v_; } double SMWDecayer::MEA(double x1, double x2) { // Axial part double num = (x1+2.*d_rho_)*(x1+2.*d_rho_) + (x2+2.*d_rho_)*(x2+2.*d_rho_) + 2.*d_rho_*((5.-x1-x2)*(5.-x1-x2) - 19.0 + 4*d_rho_); double den = d_v_*d_v_*(1.-x1)*(1.-x2); return (num/den - 2.*d_rho_/((1.-x1)*(1.-x1)) - 2*d_rho_/((1.-x2)*(1.-x2)))/d_v_; } double SMWDecayer::u(double x2) { return 0.5*(1. + d_rho_/(1.-x2+d_rho_)); } void SMWDecayer:: getXXbar(double kti, double z, double &x, double &xbar) { double w = sqr(d_v_) + kti*(-1. + z)*z*(2. + kti*(-1. + z)*z); if (w < 0) { x = -1.; xbar = -1; } else { x = (1. + sqr(d_v_)*(-1. + z) + sqr(kti*(-1. + z))*z*z*z + z*sqrt(w) - kti*(-1. + z)*z*(2. + z*(-2 + sqrt(w))))/ (1. - kti*(-1. + z)*z + sqrt(w)); xbar = 1. + kti*(-1. + z)*z; } } double SMWDecayer::qWeight(double x, double xbar) { double rval; double xg = 2. - xbar - x; // always return one in the soft gluon region if(xg < EPS_) return 1.0; // check it is in the phase space if((1.-x)*(1.-xbar)*(1.-xg) < d_rho_*xg*xg) return 0.0; double k1 = getKfromX(x, xbar); double k2 = getKfromX(xbar, x); // Is it in the quark emission zone? if(k1 < d_kt1_) { rval = MEV(x, xbar)/PS(x, xbar); // is it also in the anti-quark emission zone? if(k2 < d_kt2_) rval *= 0.5; return rval; } return 1.0; } double SMWDecayer::qbarWeight(double x, double xbar) { double rval; double xg = 2. - xbar - x; // always return one in the soft gluon region if(xg < EPS_) return 1.0; // check it is in the phase space if((1.-x)*(1.-xbar)*(1.-xg) < d_rho_*xg*xg) return 0.0; double k1 = getKfromX(x, xbar); double k2 = getKfromX(xbar, x); // Is it in the antiquark emission zone? if(k2 < d_kt2_) { rval = MEV(x, xbar)/PS(xbar, x); // is it also in the quark emission zone? if(k1 < d_kt1_) rval *= 0.5; return rval; } return 1.0; } double SMWDecayer::qWeightX(Energy qtilde, double z) { double x, xb; getXXbar(sqr(qtilde/d_Q_), z, x, xb); // if exceptionally out of phase space, leave this emission, as there // is no good interpretation for the soft ME correction. if (x < 0 || xb < 0) return 1.0; return qWeight(x, xb); } double SMWDecayer::qbarWeightX(Energy qtilde, double z) { double x, xb; getXXbar(sqr(qtilde/d_Q_), z, xb, x); // see above in qWeightX. if (x < 0 || xb < 0) return 1.0; return qbarWeight(x, xb); } double SMWDecayer::PS(double x, double xbar) { double u = 0.5*(1. + d_rho_ / (1.-xbar+d_rho_)); double z = u + (x - (2.-xbar)*u)/sqrt(xbar*xbar - 4.*d_rho_); double brack = (1.+z*z)/(1.-z)- 2.*d_rho_/(1-xbar); // interesting: the splitting function without the subtraction // term. Actually gives a much worse approximation in the collinear // limit. double brack = (1.+z*z)/(1.-z); double den = (1.-xbar)*sqrt(xbar*xbar - 4.*d_rho_); return brack/den; } diff --git a/Decay/Perturbative/SMZDecayer.cc b/Decay/Perturbative/SMZDecayer.cc --- a/Decay/Perturbative/SMZDecayer.cc +++ b/Decay/Perturbative/SMZDecayer.cc @@ -1,925 +1,925 @@ // -*- C++ -*- // // SMZDecayer.cc is a part of Herwig - A multi-purpose Monte Carlo event generator // Copyright (C) 2002-2011 The Herwig Collaboration // // Herwig is licenced under version 2 of the GPL, see COPYING for details. // Please respect the MCnet academic guidelines, see GUIDELINES for details. // // // This is the implementation of the non-inlined, non-templated member // functions of the SMZDecayer class. // #include "SMZDecayer.h" #include "ThePEG/Interface/ClassDocumentation.h" #include "ThePEG/Interface/ParVector.h" #include "ThePEG/Interface/Reference.h" #include "ThePEG/Persistency/PersistentOStream.h" #include "ThePEG/Persistency/PersistentIStream.h" #include "ThePEG/PDT/DecayMode.h" #include "Herwig/Decay/DecayVertex.h" #include "ThePEG/Helicity/VectorSpinInfo.h" #include "ThePEG/Helicity/FermionSpinInfo.h" #include "ThePEG/Helicity/WaveFunction/VectorWaveFunction.h" #include "Herwig/Models/StandardModel/StandardModel.h" #include "Herwig/Shower/Base/ShowerTree.h" #include "Herwig/Shower/Base/ShowerProgenitor.h" #include "Herwig/Shower/Base/ShowerParticle.h" #include "Herwig/Shower/Base/Branching.h" #include "Herwig/Decay/GeneralDecayMatrixElement.h" using namespace Herwig; using namespace ThePEG::Helicity; const double SMZDecayer::EPS_=0.00000001; SMZDecayer::SMZDecayer() : quarkWeight_(5,0.), leptonWeight_(6,0.) { quarkWeight_[0] = 0.488029; quarkWeight_[1] = 0.378461; quarkWeight_[2] = 0.488019; quarkWeight_[3] = 0.378027; quarkWeight_[4] = 0.483207; leptonWeight_[0] = 0.110709; leptonWeight_[1] = 0.220276; leptonWeight_[2] = 0.110708; leptonWeight_[3] = 0.220276; leptonWeight_[4] = 0.110458; leptonWeight_[5] = 0.220276; // intermediates generateIntermediates(false); // QED corrections hasRealEmissionME(true); hasOneLoopME(true); } void SMZDecayer::doinit() { DecayIntegrator::doinit(); // get the vertices from the Standard Model object tcHwSMPtr hwsm=dynamic_ptr_cast(standardModel()); if(!hwsm) throw InitException() << "Must have Herwig StandardModel object in" << "SMZDecayer::doinit()" << Exception::runerror; FFZvertex_ = dynamic_ptr_cast(hwsm->vertexFFZ()); FFPvertex_ = hwsm->vertexFFP(); // make sure they are initialized FFZvertex_->init(); FFPvertex_->init(); // now set up the decay modes DecayPhaseSpaceModePtr mode; tPDVector extpart(3); vector wgt(0); // the Z decay modes extpart[0]=getParticleData(ParticleID::Z0); // loop over the quarks and the leptons for(int istep=0;istep<11;istep+=10) { for(int ix=1;ix<7;++ix) { int iy=istep+ix; if(iy==6) continue; extpart[1] = getParticleData(-iy); extpart[2] = getParticleData( iy); mode = new_ptr(DecayPhaseSpaceMode(extpart,this)); if(iy<=6) addMode(mode, quarkWeight_.at(ix-1),wgt); else addMode(mode,leptonWeight_.at(iy-11),wgt); } } } int SMZDecayer::modeNumber(bool & cc,tcPDPtr parent, const tPDVector & children) const { int imode(-1); if(children.size()!=2) return imode; int id0=parent->id(); tPDVector::const_iterator pit = children.begin(); int id1=(**pit).id(); ++pit; int id2=(**pit).id(); // Z to quarks or leptons cc =false; if(id0!=ParticleID::Z0) return imode; if(abs(id1)<6&&id1==-id2) { imode=abs(id1)-1; } else if(abs(id1)>=11&&abs(id1)<=16&&id1==-id2) { imode=abs(id1)-6; } cc = false; return imode; } void SMZDecayer::persistentOutput(PersistentOStream & os) const { os << FFZvertex_ << FFPvertex_ << quarkWeight_ << leptonWeight_ << alpha_; } void SMZDecayer::persistentInput(PersistentIStream & is, int) { is >> FFZvertex_ >> FFPvertex_ >> quarkWeight_ >> leptonWeight_ >> alpha_; } ClassDescription SMZDecayer::initSMZDecayer; // Definition of the static class description member. void SMZDecayer::Init() { static ClassDocumentation documentation ("The SMZDecayer class is the implementation of the decay" " Z boson to the Standard Model fermions."); static ParVector interfaceZquarkMax ("QuarkMax", "The maximum weight for the decay of the Z to quarks", &SMZDecayer::quarkWeight_, 0, 0, 0, -10000, 10000, false, false, true); static ParVector interfaceZleptonMax ("LeptonMax", "The maximum weight for the decay of the Z to leptons", &SMZDecayer::leptonWeight_, 0, 0, 0, -10000, 10000, false, false, true); static Reference interfaceCoupling ("Coupling", "Pointer to the object to calculate the coupling for the correction", &SMZDecayer::alpha_, false, false, true, false, false); } // return the matrix element squared double SMZDecayer::me2(const int, const Particle & inpart, const ParticleVector & decay, MEOption meopt) const { if(!ME()) ME(new_ptr(GeneralDecayMatrixElement(PDT::Spin1,PDT::Spin1Half,PDT::Spin1Half))); int iferm(1),ianti(0); if(decay[0]->id()>0) swap(iferm,ianti); if(meopt==Initialize) { VectorWaveFunction::calculateWaveFunctions(_vectors,_rho, const_ptr_cast(&inpart), incoming,false); } if(meopt==Terminate) { VectorWaveFunction::constructSpinInfo(_vectors,const_ptr_cast(&inpart), incoming,true,false); SpinorBarWaveFunction:: constructSpinInfo(_wavebar,decay[iferm],outgoing,true); SpinorWaveFunction:: constructSpinInfo(_wave ,decay[ianti],outgoing,true); return 0.; } SpinorBarWaveFunction:: calculateWaveFunctions(_wavebar,decay[iferm],outgoing); SpinorWaveFunction:: calculateWaveFunctions(_wave ,decay[ianti],outgoing); // compute the matrix element Energy2 scale(sqr(inpart.mass())); unsigned int ifm,ia,vhel; for(ifm=0;ifm<2;++ifm) { for(ia=0;ia<2;++ia) { for(vhel=0;vhel<3;++vhel) { if(iferm>ianti) (*ME())(vhel,ia,ifm)= FFZvertex_->evaluate(scale,_wave[ia],_wavebar[ifm],_vectors[vhel]); else (*ME())(vhel,ifm,ia)= FFZvertex_->evaluate(scale,_wave[ia],_wavebar[ifm],_vectors[vhel]); } } } double output=(ME()->contract(_rho)).real()*UnitRemoval::E2/scale; if(abs(decay[0]->id())<=6) output*=3.; if(decay[0]->hasColour()) decay[0]->antiColourNeighbour(decay[1]); else if(decay[1]->hasColour()) decay[1]->antiColourNeighbour(decay[0]); return output; } void SMZDecayer::doinitrun() { DecayIntegrator::doinitrun(); if(initialize()) { for(unsigned int ix=0;ixmaxWeight(); else if(ix<11) leptonWeight_[ix-5 ]=mode(ix)->maxWeight(); } } } void SMZDecayer::dataBaseOutput(ofstream & output, bool header) const { if(header) output << "update decayers set parameters=\""; for(unsigned int ix=0;ixmomentum().phi(); // wavefunctions for the decaying particle in the rotated dipole frame vector vec1 = _vectors; for(unsigned int ix=0;ix vec2 = _vectors; for(unsigned int ix=0;ixid()<0) swap(iferm,ianti); // wavefunctions for the particles before the radiation // wavefunctions for the outgoing fermion SpinorBarWaveFunction wavebartemp; Lorentz5Momentum ptemp = - _wavebar[0].momentum(); ptemp *= rot2; if(ptemp.perp()/ptemp.e()<1e-10) { ptemp.setX(ZERO); ptemp.setY(ZERO); } wavebartemp = SpinorBarWaveFunction(ptemp,_wavebar[0].particle(),outgoing); // wavefunctions for the outgoing antifermion SpinorWaveFunction wavetemp; ptemp = - _wave[0].momentum(); ptemp *= rot2; if(ptemp.perp()/ptemp.e()<1e-10) { ptemp.setX(ZERO); ptemp.setY(ZERO); } wavetemp = SpinorWaveFunction(ptemp,_wave[0].particle(),outgoing); // loop over helicities vector wf_old; vector wfb_old; for(unsigned int ihel=0;ihel<2;++ihel) { wavetemp.reset(ihel); wf_old.push_back(wavetemp); wavebartemp.reset(ihel); wfb_old.push_back(wavebartemp); } // calculate the wave functions for the new fermions // ensure the momenta have pT=0 for(unsigned int ix=0;ix<2;++ix) { Lorentz5Momentum ptemp = children[ix]->momentum(); if(ptemp.perp()/ptemp.e()<1e-10) { ptemp.setX(ZERO); ptemp.setY(ZERO); children[ix]->set5Momentum(ptemp); } } // calculate the wavefunctions vector wfb; SpinorBarWaveFunction::calculateWaveFunctions(wfb,children[iferm],outgoing); vector wf; SpinorWaveFunction::calculateWaveFunctions (wf ,children[ianti],outgoing); // wave functions for the photons vector photon; VectorWaveFunction::calculateWaveFunctions(photon,children[2],outgoing,true); // loop to calculate the matrix elements Complex lome[3][2][2],diffme[3][2][2][2],summe[3][2][2][2]; Energy2 scale(sqr(parent.mass())); Complex diff[2]={0.,0.}; Complex sum [2]={0.,0.}; for(unsigned int ifm=0;ifm<2;++ifm) { for(unsigned int ia=0;ia<2;++ia) { for(unsigned int vhel=0;vhel<3;++vhel) { // calculation of the leading-order matrix element Complex loamp = FFZvertex_->evaluate(scale,wf_old[ia], wfb_old[ifm],vec2[vhel]); Complex lotemp = FFZvertex_->evaluate(scale,wf[ia], wfb[ifm],vec1[vhel]); if(iferm>ianti) lome[vhel][ia][ifm] = loamp; else lome[vhel][ifm][ia] = loamp; // photon loop for the real emmision terms for(unsigned int phel=0;phel<2;++phel) { // radiation from the antifermion // normal case with small angle treatment if(children[2 ]->momentum().z()/ children[iferm]->momentum().z()>=ZERO && iemitter == iferm ) { Complex dipole = e*double(children[iferm]->dataPtr()->iCharge())/3.* UnitRemoval::E*loamp* (children[iferm]->momentum()*photon[2*phel].wave())/ (children[iferm]->momentum()*children[2]->momentum()); // sum and difference SpinorBarWaveFunction foff = FFPvertex_->evaluateSmall(ZERO,3,children[iferm]->dataPtr()->CC(), wfb[ifm],photon[2*phel], ifm,2*phel,ctheta,phi,stheta,false); diff[0] = FFZvertex_->evaluate(scale,wf[ia],foff,vec1[vhel]) + e*double(children[iferm]->dataPtr()->iCharge())/3.* UnitRemoval::E*(lotemp-loamp)* (children[iferm]->momentum()*photon[2*phel].wave())/ (children[iferm]->momentum()*children[2]->momentum()); sum [0] = diff[0]+2.*dipole; } // special if fermion backwards else { SpinorBarWaveFunction foff = FFPvertex_->evaluate(ZERO,3,children[iferm]->dataPtr()->CC(), wfb[ifm],photon[2*phel]); Complex diag = FFZvertex_->evaluate(scale,wf[ia],foff,vec1[vhel]); Complex dipole = e*double(children[iferm]->dataPtr()->iCharge())/3.* UnitRemoval::E*loamp* (children[iferm]->momentum()*photon[2*phel].wave())/ (children[iferm]->momentum()*children[2]->momentum()); diff[0] = diag-dipole; sum [0] = diag+dipole; } // radiation from the anti fermion // small angle case in general if(children[2 ]->momentum().z()/ children[ianti]->momentum().z()>=ZERO && iemitter == ianti ) { Complex dipole = e*double(children[ianti]->dataPtr()->iCharge())/3.* UnitRemoval::E*loamp* (children[ianti]->momentum()*photon[2*phel].wave())/ (children[ianti]->momentum()*children[2]->momentum()); // sum and difference SpinorWaveFunction foff = FFPvertex_->evaluateSmall(ZERO,3,children[ianti]->dataPtr()->CC(), wf[ia],photon[2*phel], ia,2*phel,ctheta,phi,stheta,false); diff[1] = FFZvertex_->evaluate(scale,foff ,wfb[ifm],vec1[vhel]) + e*double(children[ianti]->dataPtr()->iCharge())/3.* UnitRemoval::E*(lotemp-loamp)* (children[ianti]->momentum()*photon[2*phel].wave())/ (children[ianti]->momentum()*children[2]->momentum()); sum [1] = diff[1]+2.*dipole; } // special if fermion backwards after radiation else { SpinorWaveFunction foff = FFPvertex_->evaluate(ZERO,3,children[ianti]->dataPtr()->CC(), wf[ia],photon[2*phel]); Complex diag = FFZvertex_->evaluate(scale,foff ,wfb[ifm],vec1[vhel]); Complex dipole = e*double(children[ianti]->dataPtr()->iCharge())/3.* UnitRemoval::E*loamp* (children[ianti]->momentum()*photon[2*phel].wave())/ (children[ianti]->momentum()*children[2]->momentum()); // sum and difference diff[1] = diag - dipole; sum [1] = diag + dipole; } // add to me if(iferm>ianti) { diffme[vhel][ia][ifm][phel] = diff[0] + diff[1]; summe [vhel][ia][ifm][phel] = sum[0] + sum[1] ; } else { diffme [vhel][ifm][ia][phel] = diff[0] + diff[1]; summe [vhel][ifm][ia][phel] = sum[0] + sum[1] ; } } } } } // cerr << parent << "\n"; // for(unsigned int ix=0;ixdataPtr()->iCharge()* // children[1]->dataPtr()->iCharge()/9.; // Energy2 ubar = 2.*children[0]->momentum()*children[2]->momentum(); // Energy2 tbar = 2.*children[1]->momentum()*children[2]->momentum(); // double mu2 = sqr(children[1]->mass()/parent.mass()); // double gL = (FFZvertex_->left() *FFZvertex_->norm()).real(); // double gR = (FFZvertex_->right()*FFZvertex_->norm()).real(); // Energy2 den = sqr(parent.mass())*(((sqr(gL)+sqr(gR))*(1-mu2)+6.*mu2*gL*gR)); // InvEnergy2 anal = -iCharge*( 2.*(ubar/tbar+tbar/ubar)/sqr(parent.mass())+ // 4.*mu2/den*((sqr(gL)+sqr(gR))*(1+ubar/tbar+tbar/ubar) // -2.*gL*gR*(1.+2.*(ubar/tbar+tbar/ubar)))); // cerr << "testing ratio " << parent.PDGName() // << " " << difference.real()/sqr(e)/lo.real()*UnitRemoval::InvE2/(anal) << "\n" // << stheta << " " << ctheta << "\n"; return difference.real()/sqr(e)/lo.real()*UnitRemoval::InvE2; } double SMZDecayer::oneLoopVirtualME(unsigned int, const Particle & parent, const ParticleVector & children) { assert(children.size()==2); // velocities of the particles double beta = sqrt(1.-4.*sqr(children[0]->mass()/parent.mass())); double opb = 1.+beta; double omb = 4.*sqr(children[0]->mass()/parent.mass())/opb; // couplings double gL = (FFZvertex_->left() *FFZvertex_->norm()).real(); double gR = (FFZvertex_->right()*FFZvertex_->norm()).real(); double gA = 0.5*(gL-gR); double gV = 0.5*(gL+gR); // correction terms double ln = log(omb/opb); double f1 = 1. + ln*beta; double fA = 1. + ln/beta; InvEnergy f2 = 0.5*sqrt(omb*opb)/parent.mass()/beta*ln; // momentum difference for the loop Lorentz5Momentum q = children[0]->momentum()-children[1]->momentum(); if(children[0]->id()<0) q *= -1.; // spinors vector > sp; vector > sbar; for(unsigned int ix=0;ix<2;++ix) { sp .push_back( _wave[ix].dimensionedWave()); sbar.push_back(_wavebar[ix].dimensionedWave()); } // polarization vectors vector pol; for(unsigned int ix=0;ix<3;++ix) pol.push_back(_vectors[ix].wave()); // matrix elements complex lome[3][2][2],loopme[3][2][2]; for(unsigned int vhel=0;vhel<3;++vhel) { for(unsigned int ihel1=0;ihel1<2;++ihel1) { for(unsigned int ihel2=0;ihel2<2;++ihel2) { complex vector = sp[ihel1].generalCurrent(sbar[ihel2], 1.,1.).dot(pol[vhel]); complex axial = sp[ihel1].generalCurrent(sbar[ihel2],-1.,1.).dot(pol[vhel]); complex scalar = sp[ihel1].scalar(sbar[ihel2])*(q*pol[vhel]); lome [vhel][ihel1][ihel2] = gV* vector-gA* axial; loopme[vhel][ihel1][ihel2] = gV*f1*vector-gA*fA*axial+scalar*f2*gV; } } } // sum sums complex den(ZERO),num(ZERO); for(unsigned int vhel1=0;vhel1<3;++vhel1) { for(unsigned int vhel2=0;vhel2<3;++vhel2) { for(unsigned int ihel1=0;ihel1<2;++ihel1) { for(unsigned int ihel2=0;ihel2<2;++ihel2) { num += _rho(vhel1,vhel2)* ( lome[vhel1][ihel1][ihel2]*conj(loopme[vhel2][ihel1][ihel2])+ loopme[vhel1][ihel1][ihel2]*conj( lome[vhel2][ihel1][ihel2])); den += _rho(vhel1,vhel2)* lome[vhel1][ihel1][ihel2]*conj(lome[vhel2][ihel1][ihel2]); } } } } // prefactor double iCharge = children[0]->dataPtr()->iCharge()* children[1]->dataPtr()->iCharge()/9.; double pre = 0.5*SM().alphaEM()*iCharge/Constants::pi; // output return pre*num.real()/den.real(); } void SMZDecayer:: initializeMECorrection(ShowerTreePtr tree, double & initial, double & final) { map::const_iterator cjt; // get the quark and antiquark ParticleVector qq; for(cjt=tree->outgoingLines().begin();cjt!=tree->outgoingLines().end();++cjt) qq.push_back(cjt->first->copy()); // ensure quark first if(qq[0]->id()<0) swap(qq[0],qq[1]); // centre of mass energy d_Q_ = (qq[0]->momentum() + qq[1]->momentum()).m(); // quark mass d_m_ = 0.5*(qq[0]->momentum().m()+qq[1]->momentum().m()); // set the other parameters setRho(sqr(d_m_/d_Q_)); setKtildeSymm(); // otherwise can do it initial=1.; final =1.; } void SMZDecayer:: applyHardMatrixElementCorrection(ShowerTreePtr tree) { // get the quark and antiquark ParticleVector qq; map::const_iterator cit; for(cit=tree->outgoingLines().begin();cit!=tree->outgoingLines().end();++cit) qq.push_back(cit->first->copy()); if(!qq[0]->dataPtr()->coloured()) return; // ensure quark first if(qq[0]->id()<0) swap(qq[0],qq[1]); // get the momenta vector newfs = applyHard(qq); // return if no emission if(newfs.size()!=3) return; // perform final check to ensure energy greater than constituent mass for (int i=0; i<2; i++) { if (newfs[i].e() < qq[i]->data().constituentMass()) return; } if (newfs[2].e() < getParticleData(ParticleID::g)->constituentMass()) return; // set masses for (int i=0; i<2; i++) newfs[i].setMass(qq[i]->mass()); newfs[2].setMass(ZERO); // decide which particle emits bool firstEmits= newfs[2].vect().perp2(newfs[0].vect())< newfs[2].vect().perp2(newfs[1].vect()); // create the new quark, antiquark and gluon PPtr newg = getParticleData(ParticleID::g)->produceParticle(newfs[2]); PPtr newq,newa; if(firstEmits) { newq = getParticleData(abs(qq[0]->id()))->produceParticle(newfs[0]); newa = new_ptr(Particle(*qq[1])); qq[1]->antiColourLine()->removeAntiColoured(newa); newa->set5Momentum(newfs[1]); } else { newq = new_ptr(Particle(*qq[0])); qq[0]->colourLine()->removeColoured(newq); newq->set5Momentum(newfs[0]); newa = getParticleData(-abs(qq[0]->id()))->produceParticle(newfs[1]); } // get the original colour line ColinePtr col; if(qq[0]->id()>0) col=qq[0]->colourLine(); else col=qq[0]->antiColourLine(); // set the colour lines if(firstEmits) { col->addColoured(newq); col->addAntiColoured(newg); newa->colourNeighbour(newg); } else { col->addAntiColoured(newa); col->addColoured(newg); newq->antiColourNeighbour(newg); } // change the existing quark and antiquark PPtr orig; for(cit=tree->outgoingLines().begin();cit!=tree->outgoingLines().end();++cit) { if(cit->first->progenitor()->id()==newq->id()) { // remove old particles from colour line col->removeColoured(cit->first->copy()); col->removeColoured(cit->first->progenitor()); // insert new particles cit->first->copy(newq); ShowerParticlePtr sp(new_ptr(ShowerParticle(*newq,1,true))); cit->first->progenitor(sp); tree->outgoingLines()[cit->first]=sp; cit->first->perturbative(!firstEmits); if(firstEmits) orig=cit->first->original(); } else { // remove old particles from colour line col->removeAntiColoured(cit->first->copy()); col->removeColoured(cit->first->progenitor()); // insert new particles cit->first->copy(newa); ShowerParticlePtr sp(new_ptr(ShowerParticle(*newa,1,true))); cit->first->progenitor(sp); tree->outgoingLines()[cit->first]=sp; cit->first->perturbative(firstEmits); if(!firstEmits) orig=cit->first->original(); } } // add the gluon ShowerParticlePtr sg=new_ptr(ShowerParticle(*newg,1,true)); ShowerProgenitorPtr gluon=new_ptr(ShowerProgenitor(orig,newg,sg)); gluon->perturbative(false); tree->outgoingLines().insert(make_pair(gluon,sg)); tree->hardMatrixElementCorrection(true); } vector SMZDecayer:: applyHard(const ParticleVector &p) { double x, xbar; vector fs; // return if no emission if (getHard(x, xbar) < UseRandom::rnd() || p.size() != 2) return fs; // centre of mass energy Lorentz5Momentum pcm = p[0]->momentum() + p[1]->momentum(); // momenta of quark,antiquark and gluon Lorentz5Momentum pq, pa, pg; if (p[0]->id() > 0) { pq = p[0]->momentum(); pa = p[1]->momentum(); } else { pa = p[0]->momentum(); pq = p[1]->momentum(); } // boost to boson rest frame Boost beta = (pcm.findBoostToCM()); pq.boost(beta); pa.boost(beta); // return if fails ????? double xg = 2.-x-xbar; if((1.-x)*(1.-xbar)*(1.-xg) < d_rho_*xg*xg) return fs; Axis u1, u2, u3; // moduli of momenta in units of Q and cos theta // stick to q direction? // p1 is the one that is kept, p2 is the other fermion, p3 the gluon. Energy e1, e2, e3; Energy pp1, pp2, pp3; bool keepq = true; if (UseRandom::rnd() > sqr(x)/(sqr(x)+sqr(xbar))) keepq = false; if (keepq) { pp1 = d_Q_*sqrt(sqr(x)-4.*d_rho_)/2.; pp2 = d_Q_*sqrt(sqr(xbar)-4.*d_rho_)/2.; e1 = d_Q_*x/2.; e2 = d_Q_*xbar/2.; u1 = pq.vect().unit(); } else { pp2 = d_Q_*sqrt(sqr(x)-4.*d_rho_)/2.; pp1 = d_Q_*sqrt(sqr(xbar)-4.*d_rho_)/2.; e2 = d_Q_*x/2.; e1 = d_Q_*xbar/2.; u1 = pa.vect().unit(); } pp3 = d_Q_*xg/2.; e3 = pp3; u2 = u1.orthogonal(); u2 /= u2.mag(); u3 = u1.cross(u2); u3 /= u3.mag(); double ct2=-2., ct3=-2.; if (pp1 == ZERO || pp2 == ZERO || pp3 == ZERO) { bool touched = false; if (pp1 == ZERO) { ct2 = 1; ct3 = -1; touched = true; } if (pp2 == ZERO || pp3 == ZERO) { ct2 = 1; ct3 = 1; touched = true; } if (!touched) throw Exception() << "SMZDecayer::applyHard()" << " did not set ct2/3" << Exception::abortnow; } else { ct3 = (sqr(pp1)+sqr(pp3)-sqr(pp2))/(2.*pp1*pp3); ct2 = (sqr(pp1)+sqr(pp2)-sqr(pp3))/(2.*pp1*pp2); } double phi = Constants::twopi*UseRandom::rnd(); double cphi = cos(phi); double sphi = sin(phi); double st2 = sqrt(1.-sqr(ct2)); double st3 = sqrt(1.-sqr(ct3)); ThreeVector pv1, pv2, pv3; pv1 = pp1*u1; pv2 = -ct2*pp2*u1 + st2*cphi*pp2*u2 + st2*sphi*pp2*u3; pv3 = -ct3*pp3*u1 - st3*cphi*pp3*u2 - st3*sphi*pp3*u3; if (keepq) { pq = Lorentz5Momentum(pv1, e1); pa = Lorentz5Momentum(pv2, e2); } else { pa = Lorentz5Momentum(pv1, e1); pq = Lorentz5Momentum(pv2, e2); } pg = Lorentz5Momentum(pv3, e3); pq.boost(-beta); pa.boost(-beta); pg.boost(-beta); fs.push_back(pq); fs.push_back(pa); fs.push_back(pg); return fs; } double SMZDecayer::getHard(double &x1, double &x2) { double w = 0.0; double y1 = UseRandom::rnd(),y2 = UseRandom::rnd(); // simply double MC efficiency // -> weight has to be divided by two (Jacobian) if (y1 + y2 > 1) { y1 = 1.-y1; y2 = 1.-y2; } bool inSoft = false; if (y1 < 0.25) { if (y2 < 0.25) { inSoft = true; if (y1 < y2) { y1 = 0.25-y1; y2 = y1*(1.5 - 2.*y2); } else { y2 = 0.25 - y2; y1 = y2*(1.5 - 2.*y1); } } else { if (y2 < y1 + 2.*sqr(y1)) return w; } } else { if (y2 < 0.25) { if (y1 < y2 + 2.*sqr(y2)) return w; } } // inside PS? x1 = 1.-y1; x2 = 1.-y2; if(y1*y2*(1.-y1-y2) < d_rho_*sqr(y1+y2)) return w; double k1 = getKfromX(x1, x2); double k2 = getKfromX(x2, x1); // Is it in the quark emission zone? if (k1 < d_kt1_) return 0.0; // No...is it in the anti-quark emission zone? if (k2 < d_kt2_) return 0.0; // Point is in dead zone: compute q qbar g weight w = MEV(x1, x2); // for axial: // w = MEA(x1, x2); // Reweight soft region if (inSoft) { if (y1 < y2) w *= 2.*y1; else w *= 2.*y2; } // alpha and colour factors Energy2 pt2 = sqr(d_Q_)*(1.-x1)*(1.-x2); w *= 1./3./Constants::pi*alpha_->value(pt2); return w; } bool SMZDecayer:: softMatrixElementVeto(ShowerProgenitorPtr initial,ShowerParticlePtr parent,Branching br) { // check we should be applying the veto if(parent->id()!=initial->progenitor()->id()|| - br.ids[0]!=br.ids[1]|| - br.ids[2]!=ParticleID::g) return false; + br.ids[0]->id()!=br.ids[1]->id()|| + br.ids[2]->id()!=ParticleID::g) return false; // calculate pt double d_z = br.kinematics->z(); Energy d_qt = br.kinematics->scale(); Energy2 d_m2 = parent->momentum().m2(); Energy pPerp = (1.-d_z)*sqrt( sqr(d_z*d_qt) - d_m2); // if not hardest so far don't apply veto if(pPerphighestpT()) return false; // calculate the weight double weight = 0.; if(parent->id()>0) weight = qWeightX(d_qt, d_z); else weight = qbarWeightX(d_qt, d_z); // compute veto from weight bool veto = !UseRandom::rndbool(weight); // if vetoing reset the scale if(veto) parent->vetoEmission(br.type,br.kinematics->scale()); // return the veto return veto; } void SMZDecayer::setRho(double r) { d_rho_ = r; d_v_ = sqrt(1.-4.*d_rho_); } void SMZDecayer::setKtildeSymm() { d_kt1_ = (1. + sqrt(1. - 4.*d_rho_))/2.; setKtilde2(); } void SMZDecayer::setKtilde2() { double num = d_rho_ * d_kt1_ + 0.25 * d_v_ *(1.+d_v_)*(1.+d_v_); double den = d_kt1_ - d_rho_; d_kt2_ = num/den; } double SMZDecayer::getZfromX(double x1, double x2) { double uval = u(x2); double num = x1 - (2. - x2)*uval; double den = sqrt(x2*x2 - 4.*d_rho_); return uval + num/den; } double SMZDecayer::getKfromX(double x1, double x2) { double zval = getZfromX(x1, x2); return (1.-x2)/(zval*(1.-zval)); } double SMZDecayer::MEV(double x1, double x2) { // Vector part double num = (x1+2.*d_rho_)*(x1+2.*d_rho_) + (x2+2.*d_rho_)*(x2+2.*d_rho_) - 8.*d_rho_*(1.+2.*d_rho_); double den = (1.+2.*d_rho_)*(1.-x1)*(1.-x2); return (num/den - 2.*d_rho_/((1.-x1)*(1.-x1)) - 2*d_rho_/((1.-x2)*(1.-x2)))/d_v_; } double SMZDecayer::MEA(double x1, double x2) { // Axial part double num = (x1+2.*d_rho_)*(x1+2.*d_rho_) + (x2+2.*d_rho_)*(x2+2.*d_rho_) + 2.*d_rho_*((5.-x1-x2)*(5.-x1-x2) - 19.0 + 4*d_rho_); double den = d_v_*d_v_*(1.-x1)*(1.-x2); return (num/den - 2.*d_rho_/((1.-x1)*(1.-x1)) - 2*d_rho_/((1.-x2)*(1.-x2)))/d_v_; } double SMZDecayer::u(double x2) { return 0.5*(1. + d_rho_/(1.-x2+d_rho_)); } void SMZDecayer:: getXXbar(double kti, double z, double &x, double &xbar) { double w = sqr(d_v_) + kti*(-1. + z)*z*(2. + kti*(-1. + z)*z); if (w < 0) { x = -1.; xbar = -1; } else { x = (1. + sqr(d_v_)*(-1. + z) + sqr(kti*(-1. + z))*z*z*z + z*sqrt(w) - kti*(-1. + z)*z*(2. + z*(-2 + sqrt(w))))/ (1. - kti*(-1. + z)*z + sqrt(w)); xbar = 1. + kti*(-1. + z)*z; } } double SMZDecayer::qWeight(double x, double xbar) { double rval; double xg = 2. - xbar - x; // always return one in the soft gluon region if(xg < EPS_) return 1.0; // check it is in the phase space if((1.-x)*(1.-xbar)*(1.-xg) < d_rho_*xg*xg) return 0.0; double k1 = getKfromX(x, xbar); double k2 = getKfromX(xbar, x); // Is it in the quark emission zone? if(k1 < d_kt1_) { rval = MEV(x, xbar)/PS(x, xbar); // is it also in the anti-quark emission zone? if(k2 < d_kt2_) rval *= 0.5; return rval; } return 1.0; } double SMZDecayer::qbarWeight(double x, double xbar) { double rval; double xg = 2. - xbar - x; // always return one in the soft gluon region if(xg < EPS_) return 1.0; // check it is in the phase space if((1.-x)*(1.-xbar)*(1.-xg) < d_rho_*xg*xg) return 0.0; double k1 = getKfromX(x, xbar); double k2 = getKfromX(xbar, x); // Is it in the antiquark emission zone? if(k2 < d_kt2_) { rval = MEV(x, xbar)/PS(xbar, x); // is it also in the quark emission zone? if(k1 < d_kt1_) rval *= 0.5; return rval; } return 1.0; } double SMZDecayer::qWeightX(Energy qtilde, double z) { double x, xb; getXXbar(sqr(qtilde/d_Q_), z, x, xb); // if exceptionally out of phase space, leave this emission, as there // is no good interpretation for the soft ME correction. if (x < 0 || xb < 0) return 1.0; return qWeight(x, xb); } double SMZDecayer::qbarWeightX(Energy qtilde, double z) { double x, xb; getXXbar(sqr(qtilde/d_Q_), z, xb, x); // see above in qWeightX. if (x < 0 || xb < 0) return 1.0; return qbarWeight(x, xb); } double SMZDecayer::PS(double x, double xbar) { double u = 0.5*(1. + d_rho_ / (1.-xbar+d_rho_)); double z = u + (x - (2.-xbar)*u)/sqrt(xbar*xbar - 4.*d_rho_); double brack = (1.+z*z)/(1.-z)- 2.*d_rho_/(1-xbar); // interesting: the splitting function without the subtraction // term. Actually gives a much worse approximation in the collinear // limit. double brack = (1.+z*z)/(1.-z); double den = (1.-xbar)*sqrt(xbar*xbar - 4.*d_rho_); return brack/den; } diff --git a/MatrixElement/DIS/DISBase.cc b/MatrixElement/DIS/DISBase.cc --- a/MatrixElement/DIS/DISBase.cc +++ b/MatrixElement/DIS/DISBase.cc @@ -1,1359 +1,1359 @@ // -*- C++ -*- // // This is the implementation of the non-inlined, non-templated member // functions of the DISBase class. // #include "DISBase.h" #include "ThePEG/Interface/ClassDocumentation.h" #include "ThePEG/Interface/Switch.h" #include "ThePEG/Interface/Reference.h" #include "ThePEG/Interface/Parameter.h" #include "ThePEG/Persistency/PersistentOStream.h" #include "ThePEG/Persistency/PersistentIStream.h" #include "ThePEG/PDT/EnumParticles.h" #include "ThePEG/MatrixElement/Tree2toNDiagram.h" #include "Herwig/Utilities/Maths.h" #include "ThePEG/PDT/EnumParticles.h" #include "ThePEG/PDT/StandardMatchers.h" #include "ThePEG/Repository/EventGenerator.h" #include "ThePEG/Repository/CurrentGenerator.h" #include "ThePEG/Helicity/Vertex/AbstractFFVVertex.h" #include "Herwig/PDT/StandardMatchers.h" #include "Herwig/Models/StandardModel/StandardModel.h" #include #include "Herwig/Shower/Base/ShowerProgenitor.h" #include "Herwig/Shower/Base/ShowerTree.h" #include "Herwig/Shower/Base/Branching.h" #include "Herwig/Shower/Base/HardTree.h" using namespace Herwig; using namespace ThePEG::Helicity; // namespace { // using namespace Herwig; // using namespace ThePEG::Helicity; // // void debuggingMatrixElement(bool BGF,const Lorentz5Momentum & pin, // const Lorentz5Momentum & p1, // const Lorentz5Momentum & p2, // tcPDPtr gluon, // const Lorentz5Momentum & pl1, // const Lorentz5Momentum & pl2, // const Lorentz5Momentum & pq1, // const Lorentz5Momentum & pq2, // tcPDPtr lepton1,tcPDPtr lepton2, // tcPDPtr quark1 ,tcPDPtr quark2, // Energy2 Q2,double phi, double x2, double x3, // double xperp, double zp, double xp, // const vector & azicoeff, // bool normalize) { // tcHwSMPtr hwsm=ThePEG::dynamic_ptr_cast // (CurrentGenerator::current().standardModel()); // assert(hwsm); // vector weakVertex; // vector bosons; // AbstractFFVVertexPtr strongVertex = hwsm->vertexFFG(); // if(lepton1->id()==lepton2->id()) { // weakVertex.push_back(hwsm->vertexFFZ()); // bosons.push_back(hwsm->getParticleData(ParticleID::Z0)); // weakVertex.push_back(hwsm->vertexFFP()); // bosons.push_back(hwsm->getParticleData(ParticleID::gamma)); // } // else { // weakVertex.push_back(hwsm->vertexFFW()); // bosons.push_back(hwsm->getParticleData(ParticleID::Wplus)); // } // if(!BGF) { // SpinorWaveFunction l1,q1,qp1; // SpinorBarWaveFunction l2,q2,qp2; // VectorWaveFunction gl(p2,gluon,outgoing); // if(lepton1->id()>0) { // l1 = SpinorWaveFunction (pl1,lepton1,incoming); // l2 = SpinorBarWaveFunction(pl2,lepton2,outgoing); // } // else { // l1 = SpinorWaveFunction (pl2,lepton2,outgoing); // l2 = SpinorBarWaveFunction(pl1,lepton1,incoming); // } // if(quark1->id()>0) { // q1 = SpinorWaveFunction (pq1,quark1,incoming); // q2 = SpinorBarWaveFunction(pq2,quark2,outgoing); // qp1 = SpinorWaveFunction (pin,quark1,incoming); // qp2 = SpinorBarWaveFunction(p1 ,quark2,outgoing); // } // else { // q1 = SpinorWaveFunction (pq2,quark2,outgoing); // q2 = SpinorBarWaveFunction(pq1,quark1,incoming); // qp1 = SpinorWaveFunction (p1 ,quark2,outgoing); // qp2 = SpinorBarWaveFunction(pin,quark1,incoming); // } // double lome(0.),realme(0.); // for(unsigned int lhel1=0;lhel1<2;++lhel1) { // l1.reset(lhel1); // for(unsigned int lhel2=0;lhel2<2;++lhel2) { // l2.reset(lhel2); // for(unsigned int qhel1=0;qhel1<2;++qhel1) { // q1.reset(qhel1); // qp1.reset(qhel1); // for(unsigned int qhel2=0;qhel2<2;++qhel2) { // q2.reset(qhel2); // qp2.reset(qhel2); // // leading order matrix element // Complex diagLO(0.); // for(unsigned int ix=0;ixevaluate(Q2,3,bosons[ix],l1,l2); // diagLO += weakVertex[ix]->evaluate(Q2,q1,q2,inter); // } // lome += norm(diagLO); // // real emission matrix element // for(unsigned int ghel=0;ghel<2;++ghel) { // gl.reset(2*ghel); // Complex diagReal(0.); // for(unsigned int ix=0;ixevaluate(Q2,3,bosons[ix],l1,l2); // SpinorWaveFunction off1 = // strongVertex->evaluate(Q2,5,qp1.particle(),qp1,gl); // Complex diag1 = weakVertex[ix]->evaluate(Q2,off1,qp2,inter); // SpinorBarWaveFunction off2 = // strongVertex->evaluate(Q2,5,qp2.particle(),qp2,gl); // Complex diag2 = weakVertex[ix]->evaluate(Q2,qp1,off2,inter); // diagReal += diag1+diag2; // } // realme += norm(diagReal); // } // } // } // } // } // double test1 = realme/lome/hwsm->alphaS(Q2)*Q2*UnitRemoval::InvE2; // double cphi(cos(phi)); // double test2; // if(normalize) { // test2 = 8.*Constants::pi/(1.-xp)/(1.-zp)* // (azicoeff[0]+azicoeff[1]*cphi+azicoeff[2]*sqr(cphi))* // (1.+sqr(xp)*(sqr(x2)+1.5*sqr(xperp))); // } // else { // test2 = 8.*Constants::pi/(1.-xp)/(1.-zp)* // (azicoeff[0]+azicoeff[1]*cphi+azicoeff[2]*sqr(cphi)); // } // cerr << "testing RATIO A " << test1/test2 << "\n"; // } // else { // SpinorWaveFunction l1,q1,qp1; // SpinorBarWaveFunction l2,q2,qp2; // VectorWaveFunction gl(pin,gluon,incoming); // if(lepton1->id()>0) { // l1 = SpinorWaveFunction (pl1,lepton1,incoming); // l2 = SpinorBarWaveFunction(pl2,lepton2,outgoing); // } // else { // l1 = SpinorWaveFunction (pl2,lepton2,outgoing); // l2 = SpinorBarWaveFunction(pl1,lepton1,incoming); // } // if(quark1->id()>0) { // q1 = SpinorWaveFunction (pq1,quark1 ,incoming); // q2 = SpinorBarWaveFunction(pq2,quark2 ,outgoing); // qp2 = SpinorBarWaveFunction(p1 ,quark2 ,outgoing); // qp1 = SpinorWaveFunction (p2 ,quark1->CC(),outgoing); // } // else { // q1 = SpinorWaveFunction (pq2,quark2 ,outgoing); // q2 = SpinorBarWaveFunction(pq1,quark1 ,incoming); // qp2 = SpinorBarWaveFunction(p2 ,quark1->CC(),outgoing); // qp1 = SpinorWaveFunction (p1 ,quark2 ,outgoing); // } // double lome(0.),realme(0.); // for(unsigned int lhel1=0;lhel1<2;++lhel1) { // l1.reset(lhel1); // for(unsigned int lhel2=0;lhel2<2;++lhel2) { // l2.reset(lhel2); // for(unsigned int qhel1=0;qhel1<2;++qhel1) { // q1.reset(qhel1); // qp1.reset(qhel1); // for(unsigned int qhel2=0;qhel2<2;++qhel2) { // q2.reset(qhel2); // qp2.reset(qhel2); // // leading order matrix element // Complex diagLO(0.); // for(unsigned int ix=0;ixevaluate(Q2,3,bosons[ix],l1,l2); // diagLO += weakVertex[ix]->evaluate(Q2,q1,q2,inter); // } // lome += norm(diagLO); // // real emission matrix element // for(unsigned int ghel=0;ghel<2;++ghel) { // gl.reset(2*ghel); // Complex diagReal(0.); // for(unsigned int ix=0;ixevaluate(Q2,3,bosons[ix],l1,l2); // SpinorWaveFunction off1 = // strongVertex->evaluate(Q2,5,qp1.particle(),qp1,gl); // Complex diag1 = weakVertex[ix]->evaluate(Q2,off1,qp2,inter); // SpinorBarWaveFunction off2 = // strongVertex->evaluate(Q2,5,qp2.particle(),qp2,gl); // Complex diag2 = weakVertex[ix]->evaluate(Q2,qp1,off2,inter); // diagReal += diag1+diag2; // } // realme += norm(diagReal); // } // } // } // } // } // double test1 = realme/lome/hwsm->alphaS(Q2)*Q2*UnitRemoval::InvE2; // double cphi(cos(phi)); // double test2; // if(normalize) { // test2 = 8.*Constants::pi/zp/(1.-zp)* // (azicoeff[0]+azicoeff[1]*cphi+azicoeff[2]*sqr(cphi))* // sqr(xp)*(sqr(x3)+sqr(x2)+3.*sqr(xperp)); // } // else { // test2 = 8.*Constants::pi/zp/(1.-zp)* // (azicoeff[0]+azicoeff[1]*cphi+azicoeff[2]*sqr(cphi)); // } // cerr << "testing RATIO B " << test1/test2 << "\n"; // } // } // // } DISBase::DISBase() : initial_(6.), final_(3.), procProb_(0.35), comptonInt_(0.), bgfInt_(0.), comptonWeight_(50.), BGFWeight_(150.), pTmin_(0.1*GeV), scaleOpt_(1), muF_(100.*GeV), scaleFact_(1.), contrib_(0), power_(0.1) {} DISBase::~DISBase() {} void DISBase::persistentOutput(PersistentOStream & os) const { os << comptonInt_ << bgfInt_ << procProb_ << initial_ << final_ << alpha_ << ounit(pTmin_,GeV) << comptonWeight_ << BGFWeight_ << gluon_ << ounit(muF_,GeV) << scaleFact_ << scaleOpt_ << contrib_<< power_; } void DISBase::persistentInput(PersistentIStream & is, int) { is >> comptonInt_ >> bgfInt_ >> procProb_ >> initial_ >> final_ >> alpha_ >> iunit(pTmin_,GeV) >> comptonWeight_ >> BGFWeight_ >> gluon_ >> iunit(muF_,GeV) >> scaleFact_ >> scaleOpt_ >> contrib_ >> power_; } AbstractClassDescription DISBase::initDISBase; // Definition of the static class description member. void DISBase::Init() { static ClassDocumentation documentation ("The DISBase class provides the base class for the " "implementation of DIS type processes including the " "hard corrections in either the old-fashioned matrix " "element correction of POWHEG approaches"); static Parameter interfaceProcessProbability ("ProcessProbability", "The probabilty of the QCD compton process for the process selection", &DISBase::procProb_, 0.3, 0.0, 1., false, false, Interface::limited); static Reference interfaceCoupling ("Coupling", "Pointer to the object to calculate the coupling for the correction", &DISBase::alpha_, false, false, true, false, false); static Parameter interfacepTMin ("pTMin", "The minimum pT", &DISBase::pTmin_, GeV, 1.*GeV, 0.0*GeV, 10.0*GeV, false, false, Interface::limited); static Parameter interfaceComptonWeight ("ComptonWeight", "Weight for the overestimate ofthe compton channel", &DISBase::comptonWeight_, 50.0, 0.0, 100.0, false, false, Interface::limited); static Parameter interfaceBGFWeight ("BGFWeight", "Weight for the overestimate of the BGF channel", &DISBase::BGFWeight_, 100.0, 0.0, 1000.0, false, false, Interface::limited); static Switch interfaceContribution ("Contribution", "Which contributions to the cross section to include", &DISBase::contrib_, 0, false, false); static SwitchOption interfaceContributionLeadingOrder (interfaceContribution, "LeadingOrder", "Just generate the leading order cross section", 0); static SwitchOption interfaceContributionPositiveNLO (interfaceContribution, "PositiveNLO", "Generate the positive contribution to the full NLO cross section", 1); static SwitchOption interfaceContributionNegativeNLO (interfaceContribution, "NegativeNLO", "Generate the negative contribution to the full NLO cross section", 2); static Switch interfaceScaleOption ("ScaleOption", "Option for the choice of factorization (and renormalization) scale", &DISBase::scaleOpt_, 1, false, false); static SwitchOption interfaceDynamic (interfaceScaleOption, "Dynamic", "Dynamic factorization scale equal to the current sqrt(sHat())", 1); static SwitchOption interfaceFixed (interfaceScaleOption, "Fixed", "Use a fixed factorization scale set with FactorizationScaleValue", 2); static Parameter interfaceFactorizationScale ("FactorizationScale", "Value to use in the event of a fixed factorization scale", &DISBase::muF_, GeV, 100.0*GeV, 1.0*GeV, 500.0*GeV, true, false, Interface::limited); static Parameter interfaceScaleFactor ("ScaleFactor", "The factor used before Q2 if using a running scale", &DISBase::scaleFact_, 1.0, 0.0, 10.0, false, false, Interface::limited); static Parameter interfaceSamplingPower ("SamplingPower", "Power for the sampling of xp", &DISBase::power_, 0.6, 0.0, 1., false, false, Interface::limited); } void DISBase::doinit() { HwMEBase::doinit(); // integrals of me over phase space double r5=sqrt(5.),darg((r5-1.)/(r5+1.)),ath(0.5*log((1.+1./r5)/(1.-1./r5))); comptonInt_ = 2.*(-21./20.-6./(5.*r5)*ath+sqr(Constants::pi)/3. -2.*Math::ReLi2(1.-darg)-2.*Math::ReLi2(1.-1./darg)); bgfInt_ = 121./9.-56./r5*ath; // extract the gluon ParticleData objects gluon_ = getParticleData(ParticleID::g); } void DISBase::initializeMECorrection(ShowerTreePtr tree, double & initial, double & final) { initial = initial_; final = final_; // incoming particles for(map::const_iterator cit=tree->incomingLines().begin();cit!=tree->incomingLines().end();++cit) { if(QuarkMatcher::Check(cit->first->progenitor()->data())) { partons_[0] = cit->first->progenitor()->dataPtr(); pq_[0] = cit->first->progenitor()->momentum(); } else if(LeptonMatcher::Check(cit->first->progenitor()->data())) { leptons_[0] = cit->first->progenitor()->dataPtr(); pl_[0] = cit->first->progenitor()->momentum(); } } // outgoing particles for(map::const_iterator cit=tree->outgoingLines().begin();cit!=tree->outgoingLines().end();++cit) { if(QuarkMatcher::Check(cit->first->progenitor()->data())) { partons_[1] = cit->first->progenitor()->dataPtr(); pq_[1] = cit->first->progenitor()->momentum(); } else if(LeptonMatcher::Check(cit->first->progenitor()->data())) { leptons_[1] = cit->first->progenitor()->dataPtr(); pl_[1] = cit->first->progenitor()->momentum(); } } // extract the born variables q_ =pl_[0]-pl_[1]; q2_ = -q_.m2(); double yB = (q_*pq_[0])/(pl_[0]*pq_[0]); l_ = 2./yB-1.; // calculate the A coefficient for the correlations acoeff_ = A(leptons_[0],leptons_[1], partons_[0],partons_[1],q2_); } void DISBase::applyHardMatrixElementCorrection(ShowerTreePtr tree) { static const double eps=1e-6; // find the incoming and outgoing quarks and leptons ShowerParticlePtr quark[2],lepton[2]; PPtr hadron; // incoming particles for(map::const_iterator cit=tree->incomingLines().begin();cit!=tree->incomingLines().end();++cit) { if(QuarkMatcher::Check(cit->first->progenitor()->data())) { hadron = cit->first->original()->parents()[0]; quark [0] = cit->first->progenitor(); beam_ = cit->first->beam(); } else if(LeptonMatcher::Check(cit->first->progenitor()->data())) { lepton[0] = cit->first->progenitor(); } } pdf_ = beam_->pdf(); assert(beam_&&pdf_&&quark[0]&&lepton[0]); // outgoing particles for(map::const_iterator cit=tree->outgoingLines().begin();cit!=tree->outgoingLines().end();++cit) { if(QuarkMatcher::Check(cit->first->progenitor()->data())) quark [1] = cit->first->progenitor(); else if(LeptonMatcher::Check(cit->first->progenitor()->data())) { lepton[1] = cit->first->progenitor(); } } // momentum fraction assert(quark[1]&&lepton[1]); xB_ = quark[0]->x(); // calculate the matrix element vector azicoeff; // select the type of process bool BGF = UseRandom::rnd()>procProb_; double xp,zp,wgt,x1,x2,x3,xperp; // generate a QCD compton process if(!BGF) { wgt = generateComptonPoint(xp,zp); if(xpvalue(scale)/procProb_; // PDF piece wgt *= pdf_->xfx(beam_,quark[0]->dataPtr(),scale,xB_/xp)/ pdf_->xfx(beam_,quark[0]->dataPtr(),q2_ ,xB_); // other bits xperp = sqrt(4.*(1.-xp)*(1.-zp)*zp/xp); x1 = -1./xp; x2 = 1.-(1.-zp)/xp; x3 = 2.+x1-x2; // matrix element pieces azicoeff = ComptonME(xp,x2,xperp,true); } // generate a BGF process else { wgt = generateBGFPoint(xp,zp); if(xpvalue(scale)/(1.-procProb_); // PDF piece wgt *= pdf_->xfx(beam_,gluon_ ,scale,xB_/xp)/ pdf_->xfx(beam_,quark[0]->dataPtr(),q2_ ,xB_); // other bits xperp = sqrt(4.*(1.-xp)*(1.-zp)*zp/xp); x1 = -1./xp; x2 = 1.-(1.-zp)/xp; x3 = 2.+x1-x2; // matrix element pieces azicoeff = BGFME(xp,x2,x3,xperp,true); } // compute the azimuthal average of the weight wgt *= (azicoeff[0]+0.5*azicoeff[2]); // decide whether or not to accept the weight if(UseRandom::rnd()>wgt) return; // if generate generate phi unsigned int itry(0); double phimax = std::accumulate(azicoeff.begin(),azicoeff.end(),0.); double phiwgt,phi; do { phi = UseRandom::rnd()*Constants::twopi; double cphi(cos(phi)); phiwgt = azicoeff[0]+azicoeff[1]*cphi+azicoeff[2]*sqr(cphi); ++itry; } while (phimax*UseRandom::rnd() > phiwgt && itry<200); if(itry==200) throw Exception() << "Too many tries in DISMECorrection" << "::applyHardMatrixElementCorrection() to" << " generate phi" << Exception::eventerror; // construct lorentz transform from lab to breit frame Lorentz5Momentum phadron = hadron->momentum(); phadron.setMass(0.*GeV); phadron.rescaleEnergy(); Lorentz5Momentum pcmf = phadron+0.5/xB_*q_; pcmf.rescaleMass(); LorentzRotation rot(-pcmf.boostVector()); Lorentz5Momentum pbeam = rot*phadron; Axis axis(pbeam.vect().unit()); double sinth(sqrt(sqr(axis.x())+sqr(axis.y()))); rot.rotate(-acos(axis.z()),Axis(-axis.y()/sinth,axis.x()/sinth,0.)); Lorentz5Momentum pl = rot*pl_[0]; rot.rotateZ(-atan2(pl.y(),pl.x())); pl_[0] *= rot; pl_[1] *= rot; pq_[0] *= rot; pq_[1] *= rot; // compute the new incoming and outgoing momenta Energy Q(sqrt(q2_)); Lorentz5Momentum p1 = Lorentz5Momentum( 0.5*Q*xperp*cos(phi), 0.5*Q*xperp*sin(phi), -0.5*Q*x2,0.*GeV,0.*GeV); p1.rescaleEnergy(); Lorentz5Momentum p2 = Lorentz5Momentum(-0.5*Q*xperp*cos(phi),-0.5*Q*xperp*sin(phi), -0.5*Q*x3,0.*GeV,0.*GeV); p2.rescaleEnergy(); Lorentz5Momentum pin(0.*GeV,0.*GeV,-0.5*x1*Q,-0.5*x1*Q,0.*GeV); // debuggingMatrixElement(BGF,pin,p1,p2,gluon_,pl_[0],pl_[1],pq_[0],pq_[1], // lepton[0]->dataPtr(),lepton[1]->dataPtr(), // quark [0]->dataPtr(),quark [1]->dataPtr(), // q2_,phi,x2,x3,xperp,zp,xp,azicoeff,true); // we need the Lorentz transform back to the lab rot.invert(); // transform the momenta to lab frame pin *= rot; p1 *= rot; p2 *= rot; // test to ensure outgoing particles can be put on-shell if(!BGF) { if(p1.e()dataPtr()->constituentMass()) return; if(p2.e()constituentMass()) return; } else { if(p1.e()dataPtr() ->constituentMass()) return; if(p2.e()dataPtr()->CC()->constituentMass()) return; } // create the new particles and add to ShowerTree bool isquark = quark[0]->colourLine(); if(!BGF) { PPtr newin = new_ptr(Particle(*quark[0])); newin->set5Momentum(pin); PPtr newg = gluon_ ->produceParticle(p2 ); PPtr newout = quark[1]->dataPtr()->produceParticle(p1 ); ColinePtr col=isquark ? quark[0]->colourLine() : quark[0]->antiColourLine(); ColinePtr newline=new_ptr(ColourLine()); // final-state emission if(xp>zp) { col->removeColoured(newout,!isquark); col->addColoured(newin,!isquark); col->addColoured(newg,!isquark); newline->addColoured(newg,isquark); newline->addColoured(newout,!isquark); } // initial-state emission else { col->removeColoured(newin ,!isquark); col->addColoured(newout,!isquark); col->addColoured(newg,isquark); newline->addColoured(newg,!isquark); newline->addColoured(newin,!isquark); } PPtr orig; for(map::const_iterator cit=tree->incomingLines().begin();cit!=tree->incomingLines().end();++cit) { if(cit->first->progenitor()!=quark[0]) continue; // remove old particles from colour line col->removeColoured(cit->first->copy(),!isquark); col->removeColoured(cit->first->progenitor(),!isquark); // insert new particles cit->first->copy(newin); ShowerParticlePtr sp(new_ptr(ShowerParticle(*newin,1,false))); cit->first->progenitor(sp); tree->incomingLines()[cit->first]=sp; sp->x(xB_/xp); cit->first->perturbative(xp>zp); if(xp<=zp) orig=cit->first->original(); } for(map::const_iterator cit=tree->outgoingLines().begin();cit!=tree->outgoingLines().end();++cit) { if(cit->first->progenitor()!=quark[1]) continue; // remove old particles from colour line col->removeColoured(cit->first->copy(),!isquark); col->removeColoured(cit->first->progenitor(),!isquark); // insert new particles cit->first->copy(newout); ShowerParticlePtr sp(new_ptr(ShowerParticle(*newout,1,true))); cit->first->progenitor(sp); tree->outgoingLines()[cit->first]=sp; cit->first->perturbative(xp<=zp); if(xp>zp) orig=cit->first->original(); } assert(orig); // add the gluon ShowerParticlePtr sg=new_ptr(ShowerParticle(*newg,1,true)); ShowerProgenitorPtr gluon=new_ptr(ShowerProgenitor(orig,newg,sg)); gluon->perturbative(false); tree->outgoingLines().insert(make_pair(gluon,sg)); tree->hardMatrixElementCorrection(true); } else { PPtr newin = gluon_ ->produceParticle(pin); PPtr newqbar = quark[0]->dataPtr()->CC()->produceParticle(p2 ); PPtr newout = quark[1]->dataPtr() ->produceParticle(p1 ); ColinePtr col=isquark ? quark[0]->colourLine() : quark[0]->antiColourLine(); ColinePtr newline=new_ptr(ColourLine()); col ->addColoured(newin ,!isquark); newline->addColoured(newin , isquark); col ->addColoured(newout ,!isquark); newline->addColoured(newqbar, isquark); PPtr orig; for(map::const_iterator cit=tree->incomingLines().begin();cit!=tree->incomingLines().end();++cit) { if(cit->first->progenitor()!=quark[0]) continue; // remove old particles from colour line col->removeColoured(cit->first->copy(),!isquark); col->removeColoured(cit->first->progenitor(),!isquark); // insert new particles cit->first->copy(newin); ShowerParticlePtr sp(new_ptr(ShowerParticle(*newin,1,false))); cit->first->progenitor(sp); tree->incomingLines()[cit->first]=sp; sp->x(xB_/xp); cit->first->perturbative(false); orig=cit->first->original(); } for(map::const_iterator cit=tree->outgoingLines().begin();cit!=tree->outgoingLines().end();++cit) { if(cit->first->progenitor()!=quark[1]) continue; // remove old particles from colour line col->removeColoured(cit->first->copy(),!isquark); col->removeColoured(cit->first->progenitor(),!isquark); // insert new particles cit->first->copy(newout); ShowerParticlePtr sp(new_ptr(ShowerParticle(*newout,1,true))); cit->first->progenitor(sp); tree->outgoingLines()[cit->first]=sp; cit->first->perturbative(true); } assert(orig); // add the (anti)quark ShowerParticlePtr sqbar=new_ptr(ShowerParticle(*newqbar,1,true)); ShowerProgenitorPtr qbar=new_ptr(ShowerProgenitor(orig,newqbar,sqbar)); qbar->perturbative(false); tree->outgoingLines().insert(make_pair(qbar,sqbar)); tree->hardMatrixElementCorrection(true); } } bool DISBase::softMatrixElementVeto(ShowerProgenitorPtr initial, ShowerParticlePtr parent, Branching br) { bool veto = !UseRandom::rndbool(parent->isFinalState() ? 1./final_ : 1./initial_); // check if me correction should be applied long id[2]={initial->id(),parent->id()}; if(id[0]!=id[1]||id[1]==ParticleID::g) return veto; // get the pT Energy pT=br.kinematics->pT(); // check if hardest so far if(pThighestpT()) return veto; double kappa(sqr(br.kinematics->scale())/q2_),z(br.kinematics->z()); double zk((1.-z)*kappa); // final-state double wgt(0.); if(parent->isFinalState()) { double zp=z,xp=1./(1.+z*zk); double xperp = sqrt(4.*(1.-xp)*(1.-zp)*zp/xp); double x2 = 1.-(1.-zp)/xp; vector azicoeff = ComptonME(xp,x2,xperp,false); wgt = (azicoeff[0]+0.5*azicoeff[2])*xp/(1.+sqr(z))/final_; if(wgt<.0||wgt>1.) { ostringstream wstring; wstring << "Soft ME correction weight too large or " << "negative for FSR in DISBase::" << "softMatrixElementVeto() soft weight " << " xp = " << xp << " zp = " << zp << " weight = " << wgt << "\n"; generator()->logWarning( Exception(wstring.str(), Exception::warning) ); } } else { double xp = 2.*z/(1.+zk+sqrt(sqr(1.+zk)-4.*z*zk)); double zp = 0.5* (1.-zk+sqrt(sqr(1.+zk)-4.*z*zk)); double xperp = sqrt(4.*(1.-xp)*(1.-zp)*zp/xp); double x1 = -1./xp, x2 = 1.-(1.-zp)/xp, x3 = 2.+x1-x2; // compton - if(br.ids[0]!=ParticleID::g) { + if(br.ids[0]->id()!=ParticleID::g) { vector azicoeff = ComptonME(xp,x2,xperp,false); wgt = (azicoeff[0]+0.5*azicoeff[2])*xp*(1.-z)/(1.-xp)/(1.+sqr(z))/ (1.-zp+xp-2.*xp*(1.-zp)); } // BGF else { vector azicoeff = BGFME(xp,x2,x3,xperp,true); wgt = (azicoeff[0]+0.5*azicoeff[2])*xp/(1.-zp+xp-2.*xp*(1.-zp))/(sqr(z)+sqr(1.-z)); } wgt /=initial_; if(wgt<.0||wgt>1.) { ostringstream wstring; wstring << "Soft ME correction weight too large or " << "negative for ISR in DISBase::" << "softMatrixElementVeto() soft weight " << " xp = " << xp << " zp = " << zp << " weight = " << wgt << "\n"; generator()->logWarning( Exception(wstring.str(), Exception::warning) ); } } // if not vetoed if(UseRandom::rndbool(wgt)) return false; // otherwise parent->vetoEmission(br.type,br.kinematics->scale()); return true; } double DISBase::generateComptonPoint(double &xp, double & zp) { static const double maxwgt = 1.; double wgt; do { xp = UseRandom::rnd(); double zpmin = xp, zpmax = 1./(1.+xp*(1.-xp)); zp = 1.-pow((1.-zpmin)/(1.-zpmax),UseRandom::rnd())*(1.-zpmax); wgt = log((1.-zpmin)/(1.-zpmax))*(1.-zp); if(UseRandom::rndbool()) swap(xp,zp); double xperp2 = 4.*(1.-xp)*(1.-zp)*zp/xp,x2=1.-(1.-zp)/xp; wgt *= 2.*(1.+sqr(xp)*(sqr(x2)+1.5*xperp2))/(1.-xp)/(1.-zp); if(wgt>maxwgt) { ostringstream wstring; wstring << "DISBase::generateComptonPoint " << "Weight greater than maximum " << "wgt = " << wgt << " maxwgt = 1\n"; generator()->logWarning( Exception(wstring.str(), Exception::warning) ); } } while(wgtmaxwgt) { ostringstream wstring; wstring << "DISBase::generateBGFPoint " << "Weight greater than maximum " << "wgt = " << wgt << " maxwgt = 1\n"; generator()->logWarning( Exception(wstring.str(), Exception::warning) ); } } while(wgt1.+ac) cerr << "testing violates BGF maxA " << wgt << "\n"; // } // while(wgtmaxwgt*zpwgt) cerr << "testing violates BGF maxB " << wgt/xpwgt << "\n"; // } // while(wgt DISBase::ComptonME(double xp, double x2, double xperp, bool norm) { vector output(3,0.); double cos2 = x2 /sqrt(sqr(x2)+sqr(xperp)); double sin2 = xperp/sqrt(sqr(x2)+sqr(xperp)); double root = sqrt(sqr(l_)-1.); output[0] = sqr(cos2)+acoeff_*cos2*l_+sqr(l_); output[1] = -acoeff_*cos2*root*sin2-2.*l_*root*sin2; output[2] = sqr(root)*sqr(sin2); double lo(1+acoeff_*l_+sqr(l_)); double denom = norm ? 1.+sqr(xp)*(sqr(x2)+1.5*sqr(xperp)) : 1.; double fact = sqr(xp)*(sqr(x2)+sqr(xperp))/lo; for(unsigned int ix=0;ix DISBase::BGFME(double xp, double x2, double x3, double xperp, bool norm) { vector output(3,0.); double cos2 = x2 /sqrt(sqr(x2)+sqr(xperp)); double sin2 = xperp/sqrt(sqr(x2)+sqr(xperp)); double fact2 = sqr(xp)*(sqr(x2)+sqr(xperp)); double cos3 = x3 /sqrt(sqr(x3)+sqr(xperp)); double sin3 = xperp/sqrt(sqr(x3)+sqr(xperp)); double fact3 = sqr(xp)*(sqr(x3)+sqr(xperp)); double root = sqrt(sqr(l_)-1.); output[0] = fact2*(sqr(cos2)+acoeff_*cos2*l_+sqr(l_)) + fact3*(sqr(cos3)-acoeff_*cos3*l_+sqr(l_)); output[1] = - fact2*(acoeff_*cos2*root*sin2+2.*l_*root*sin2) - fact3*(acoeff_*cos3*root*sin3-2.*l_*root*sin3); output[2] = fact2*(sqr(root)*sqr(sin2)) + fact3*(sqr(root)*sqr(sin3)); double lo(1+acoeff_*l_+sqr(l_)); double denom = norm ? sqr(xp)*(sqr(x3)+sqr(x2)+3.*sqr(xperp))*lo : lo; for(unsigned int ix=0;ix::const_iterator cit=tree->incomingLines().begin();cit!=tree->incomingLines().end();++cit) { if(QuarkMatcher::Check(cit->first->progenitor()->data())) { hadron = cit->first->original()->parents()[0]; quark [0] = cit->first->progenitor(); beam_ = cit->first->beam(); } else if(LeptonMatcher::Check(cit->first->progenitor()->data())) { lepton[0] = cit->first->progenitor(); leptons_[0] = lepton[0]->dataPtr(); } } pdf_=beam_->pdf(); assert(beam_&&pdf_&&quark[0]&&lepton[0]); // outgoing particles for(map::const_iterator cit=tree->outgoingLines().begin();cit!=tree->outgoingLines().end();++cit) { if(QuarkMatcher::Check(cit->first->progenitor()->data())) quark [1] = cit->first->progenitor(); else if(LeptonMatcher::Check(cit->first->progenitor()->data())) { lepton[1] = cit->first->progenitor(); leptons_[1] = lepton[1]->dataPtr(); } } assert(quark[1]&&lepton[1]); // Particle data objects for(unsigned int ix=0;ix<2;++ix) partons_[ix] = quark[ix]->dataPtr(); // extract the born variables q_ =lepton[0]->momentum()-lepton[1]->momentum(); q2_ = -q_.m2(); xB_ = quark[0]->x(); double yB = ( q_*quark[0]->momentum())/ (lepton[0]->momentum()*quark[0]->momentum()); l_ = 2./yB-1.; // construct lorentz transform from lab to breit frame Lorentz5Momentum phadron = hadron->momentum(); phadron.setMass(0.*GeV); phadron.rescaleRho(); Lorentz5Momentum pb = quark[0]->momentum(); Axis axis(q_.vect().unit()); double sinth(sqrt(sqr(axis.x())+sqr(axis.y()))); LorentzRotation rot_ = LorentzRotation(); if(axis.perp2()>1e-20) { rot_.setRotate(-acos(axis.z()),Axis(-axis.y()/sinth,axis.x()/sinth,0.)); rot_.rotateX(Constants::pi); } if(abs(1.-q_.e()/q_.vect().mag())>1e-6) rot_.boostZ( q_.e()/q_.vect().mag()); pb *= rot_; if(pb.perp2()/GeV2>1e-20) { Boost trans = -1./pb.e()*pb.vect(); trans.setZ(0.); rot_.boost(trans); } Lorentz5Momentum pl = rot_*lepton[0]->momentum(); rot_.rotateZ(-atan2(pl.y(),pl.x())); // momenta of the particles pl_[0]=rot_*lepton[0]->momentum(); pl_[1]=rot_*lepton[1]->momentum(); pq_[0]=rot_* quark[0]->momentum(); pq_[1]=rot_* quark[1]->momentum(); q_ *= rot_; // coefficient for the matrix elements acoeff_ = A(lepton[0]->dataPtr(),lepton[1]->dataPtr(), quark [0]->dataPtr(),quark [1]->dataPtr(),q2_); // generate a compton point generateCompton(); generateBGF(); // no valid emission, return if(pTCompton_pTBGF_; // // find the sudakov for the branching // SudakovPtr sudakov; // // ISR // if(ComptonISFS_||!isCompton) { // BranchingList branchings=evolver()->splittingGenerator()->initialStateBranchings(); // long index = abs(partons_[0]->id()); // IdList br(3); // if(isCompton) { // br[0] = index; // br[1] = index; // br[2] = ParticleID::g; // } // else { // br[0] = ParticleID::g; // br[1] = abs(partons_[0]->id()); // br[2] = -abs(partons_[0]->id()); // } // for(BranchingList::const_iterator cit = branchings.lower_bound(index); // cit != branchings.upper_bound(index); ++cit ) { // IdList ids = cit->second.second; // if(ids[0]==br[0]&&ids[1]==br[1]&&ids[2]==br[2]) { // sudakov=cit->second.first; // break; // } // } // } // // FSR // else { // BranchingList branchings = // evolver()->splittingGenerator()->finalStateBranchings(); // long index=abs(partons_[1]->id()); // for(BranchingList::const_iterator cit = branchings.lower_bound(index); // cit != branchings.upper_bound(index); ++cit ) { // IdList ids = cit->second.second; // if(ids[0]==index&&ids[1]==index&&ids[2]==ParticleID::g) { // sudakov = cit->second.first; // break; // } // } // } // if(!sudakov) throw Exception() << "Can't find Sudakov for the hard emission in " // << "DISBase::generateHardest()" // << Exception::runerror; // add the leptons vector spaceBranchings,allBranchings; spaceBranchings.push_back(new_ptr(HardBranching(lepton[0],SudakovPtr(), HardBranchingPtr(), HardBranching::Incoming))); allBranchings.push_back(spaceBranchings.back()); allBranchings.push_back(new_ptr(HardBranching(lepton[1],SudakovPtr(), HardBranchingPtr(), HardBranching::Outgoing))); // compton hardest if(isCompton) { rot_.invert(); for(unsigned int ix=0;ixset5Momentum(ComptonMomenta_[1]); ShowerParticlePtr newg(new_ptr(ShowerParticle(gluon_,true))); newg->set5Momentum(ComptonMomenta_[2]); ShowerParticlePtr newqin (new_ptr(ShowerParticle(partons_[0],false ))); newqin->set5Momentum(ComptonMomenta_[0]); if(ComptonISFS_) { ShowerParticlePtr newspace(new_ptr(ShowerParticle(partons_[0],false))); newspace->set5Momentum(ComptonMomenta_[0]-ComptonMomenta_[2]); HardBranchingPtr spaceBranch(new_ptr(HardBranching(newqin,SudakovPtr(), HardBranchingPtr(), HardBranching::Incoming))); HardBranchingPtr offBranch(new_ptr(HardBranching(newspace,SudakovPtr(), spaceBranch, HardBranching::Incoming))); spaceBranch->addChild(offBranch); HardBranchingPtr g(new_ptr(HardBranching(newg,SudakovPtr(),spaceBranch, HardBranching::Outgoing))); spaceBranch->addChild(g); spaceBranch->type(offBranch->branchingParticle()->id()>0 ? ShowerPartnerType::QCDColourLine : ShowerPartnerType::QCDAntiColourLine); HardBranchingPtr outBranch(new_ptr(HardBranching(newqout,SudakovPtr(), HardBranchingPtr(), HardBranching::Outgoing))); spaceBranchings.push_back(spaceBranch); allBranchings.push_back(offBranch); allBranchings.push_back(outBranch); ColinePtr newin(new_ptr(ColourLine())),newout(new_ptr(ColourLine())); newin ->addColoured(newqin ,partons_[0]->id()<0); newin ->addColoured(newg ,partons_[0]->id()<0); newout->addColoured(newspace,partons_[0]->id()<0); newout->addColoured(newqout ,partons_[1]->id()<0); newout->addColoured(newg ,partons_[1]->id()>0); } else { ShowerParticlePtr newtime(new_ptr(ShowerParticle(partons_[1],true))); newtime->set5Momentum(ComptonMomenta_[1]+ComptonMomenta_[2]); HardBranchingPtr spaceBranch(new_ptr(HardBranching(newqin,SudakovPtr(), HardBranchingPtr(), HardBranching::Incoming))); HardBranchingPtr offBranch(new_ptr(HardBranching(newtime,SudakovPtr(), HardBranchingPtr(), HardBranching::Outgoing))); HardBranchingPtr g(new_ptr(HardBranching(newg,SudakovPtr(),offBranch, HardBranching::Outgoing))); HardBranchingPtr outBranch(new_ptr(HardBranching(newqout,SudakovPtr(),offBranch, HardBranching::Outgoing))); offBranch->addChild(outBranch); offBranch->addChild(g); offBranch->type(offBranch->branchingParticle()->id()>0 ? ShowerPartnerType::QCDColourLine : ShowerPartnerType::QCDAntiColourLine); spaceBranchings.push_back(spaceBranch); allBranchings.push_back(spaceBranch); allBranchings.push_back(offBranch); ColinePtr newin(new_ptr(ColourLine())),newout(new_ptr(ColourLine())); newin ->addColoured(newqin ,newqin->dataPtr()->iColour()!=PDT::Colour3); newin ->addColoured(newtime,newqin->dataPtr()->iColour()!=PDT::Colour3); newin ->addColoured(newg ,newqin->dataPtr()->iColour()!=PDT::Colour3); newout->addColoured(newg ,newqin->dataPtr()->iColour()==PDT::Colour3); newout->addColoured(newqout,newqin->dataPtr()->iColour()!=PDT::Colour3); } } // BGF hardest else { rot_.invert(); for(unsigned int ix=0;ixset5Momentum(BGFMomenta_[1]); ShowerParticlePtr newqbar(new_ptr(ShowerParticle(partons_[0]->CC(),true))); newqbar->set5Momentum(BGFMomenta_[2]); ShowerParticlePtr newg (new_ptr(ShowerParticle(gluon_,false))); newg->set5Momentum(BGFMomenta_[0]); ShowerParticlePtr newspace(new_ptr(ShowerParticle(partons_[0],false))); newspace->set5Momentum(BGFMomenta_[0]-BGFMomenta_[2]); HardBranchingPtr spaceBranch(new_ptr(HardBranching(newg,SudakovPtr(),HardBranchingPtr(), HardBranching::Incoming))); HardBranchingPtr offBranch(new_ptr(HardBranching(newspace,SudakovPtr(),spaceBranch, HardBranching::Incoming))); HardBranchingPtr qbar(new_ptr(HardBranching(newqbar,SudakovPtr(),spaceBranch, HardBranching::Outgoing))); spaceBranch->addChild(offBranch); spaceBranch->addChild(qbar); spaceBranch->type(offBranch->branchingParticle()->id()>0 ? ShowerPartnerType::QCDColourLine : ShowerPartnerType::QCDAntiColourLine); HardBranchingPtr outBranch(new_ptr(HardBranching(newq,SudakovPtr(), HardBranchingPtr(), HardBranching::Outgoing))); spaceBranchings.push_back(spaceBranch); allBranchings.push_back(offBranch); allBranchings.push_back(outBranch); ColinePtr newin(new_ptr(ColourLine())),newout(new_ptr(ColourLine())); newout->addColoured(newspace,newspace->dataPtr()->iColour()!=PDT::Colour3); newout->addColoured(newq ,newspace->dataPtr()->iColour()!=PDT::Colour3); newout->addColoured(newg ,newspace->dataPtr()->iColour()!=PDT::Colour3); newin ->addColoured(newg ,newspace->dataPtr()->iColour()==PDT::Colour3); newin ->addColoured(newqbar ,newspace->dataPtr()->iColour()==PDT::Colour3); } allBranchings[2]->colourPartner(allBranchings[3]); allBranchings[3]->colourPartner(allBranchings[2]); HardTreePtr newTree(new_ptr(HardTree(allBranchings,spaceBranchings, ShowerInteraction::QCD))); // Set the maximum pt for all other emissions and connect hard and shower tree Energy pT = isCompton ? pTCompton_ : pTBGF_; // incoming particles for(map::const_iterator cit=tree->incomingLines().begin();cit!=tree->incomingLines().end();++cit) { // set maximum pT if(QuarkMatcher::Check(cit->first->progenitor()->data())) cit->first->maximumpT(pT,ShowerInteraction::QCD); for(set::iterator cjt=newTree->branchings().begin(); cjt!=newTree->branchings().end();++cjt) { if(!(*cjt)->branchingParticle()->isFinalState()&& (*cjt)->branchingParticle()->id()==cit->first->progenitor()->id()) { newTree->connect(cit->first->progenitor(),*cjt); tPPtr beam =cit->first->original(); if(!beam->parents().empty()) beam=beam->parents()[0]; (*cjt)->beam(beam); HardBranchingPtr parent=(*cjt)->parent(); while(parent) { parent->beam(beam); parent=parent->parent(); }; } } } // outgoing particles for(map::const_iterator cit=tree->outgoingLines().begin();cit!=tree->outgoingLines().end();++cit) { // set maximum pT if(QuarkMatcher::Check(cit->first->progenitor()->data())) cit->first->maximumpT(pT,ShowerInteraction::QCD); for(set::iterator cjt=newTree->branchings().begin(); cjt!=newTree->branchings().end();++cjt) { if((*cjt)->branchingParticle()->isFinalState()&& (*cjt)->branchingParticle()->id()==cit->first->progenitor()->id()) { newTree->connect(cit->first->progenitor(),*cjt); } } } return newTree; } void DISBase::generateCompton() { // maximum value of the xT double xT = sqrt((1.-xB_)/xB_); double xTMin = 2.*pTmin_/sqrt(q2_); double zp; // prefactor double a = alpha_->overestimateValue()*comptonWeight_/Constants::twopi; // loop to generate kinematics double wgt(0.),xp(0.); vector azicoeff; do { wgt = 0.; // intergration variables dxT/xT^3 xT *= 1./sqrt(1.-2.*log(UseRandom::rnd())/a*sqr(xT)); // zp zp = UseRandom::rnd(); xp = 1./(1.+0.25*sqr(xT)/zp/(1.-zp)); // check allowed if(xp1.) continue; // phase-space piece of the weight wgt = 8.*(1.-xp)*zp/comptonWeight_; // PDF piece of the weight Energy2 scale = q2_*((1.-xp)*(1-zp)*zp/xp+1.); wgt *= pdf_->xfx(beam_,partons_[0],scale,xB_/xp)/ pdf_->xfx(beam_,partons_[0],q2_ ,xB_); // me piece of the weight double x2 = 1.-(1.-zp)/xp; azicoeff = ComptonME(xp,x2,xT,false); wgt *= 4./3.*alpha_->ratio(0.25*q2_*sqr(xT))*(azicoeff[0]+0.5*azicoeff[2]); if(wgt>1.||wgt<0.) { ostringstream wstring; wstring << "DISBase::generateCompton() " << "Weight greater than one or less than zero" << "wgt = " << wgt << "\n"; generator()->logWarning( Exception(wstring.str(), Exception::warning) ); } } while(xT>xTMin&&UseRandom::rnd()>wgt); if(xT<=xTMin) { pTCompton_=-GeV; return; } // generate phi unsigned int itry(0); double phimax = std::accumulate(azicoeff.begin(),azicoeff.end(),0.); double phiwgt,phi; do { phi = UseRandom::rnd()*Constants::twopi; double cphi(cos(phi)); phiwgt = azicoeff[0]+azicoeff[1]*cphi+azicoeff[2]*sqr(cphi); ++itry; } while (phimax*UseRandom::rnd() > phiwgt && itry<200); if(itry==200) throw Exception() << "Too many tries in DISMECorrection" << "::generateCompton() to" << " generate phi" << Exception::eventerror; // momenta for the configuration Energy Q(sqrt(q2_)); double x1 = -1./xp; double x2 = 1.-(1.-zp)/xp; double x3 = 2.+x1-x2; Lorentz5Momentum p1( 0.5*Q*xT*cos(phi), 0.5*Q*xT*sin(phi), -0.5*Q*x2, 0.5*Q*sqrt(sqr(xT)+sqr(x2))); Lorentz5Momentum p2(-0.5*Q*xT*cos(phi), -0.5*Q*xT*sin(phi), -0.5*Q*x3, 0.5*Q*sqrt(sqr(xT)+sqr(x3))); Lorentz5Momentum p0(ZERO,ZERO,-0.5*Q*x1,-0.5*Q*x1); pTCompton_ = 0.5*Q*xT; ComptonMomenta_.resize(3); ComptonMomenta_[0] = p0; ComptonMomenta_[1] = p1; ComptonMomenta_[2] = p2; ComptonISFS_ = zp>xp; // debuggingMatrixElement(false,p0,p1,p2,gluon_,pl_[0],pl_[1],pq_[0],pq_[1], // leptons_[0],leptons_[1], // partons_[0],partons_[1], // q2_,phi,x2,x3,xT,zp,xp,azicoeff,false); } void DISBase::generateBGF() { // maximum value of the xT double xT = (1.-xB_)/xB_; double xTMin = 2.*max(pTmin_,pTCompton_)/sqrt(q2_); double zp; // prefactor double a = alpha_->overestimateValue()*BGFWeight_/Constants::twopi; // loop to generate kinematics double wgt(0.),xp(0.); vector azicoeff; do { wgt = 0.; // intergration variables dxT/xT^3 xT *= 1./sqrt(1.-2.*log(UseRandom::rnd())/a*sqr(xT)); // zp zp = UseRandom::rnd(); xp = 1./(1.+0.25*sqr(xT)/zp/(1.-zp)); // check allowed if(xp1.) continue; // phase-space piece of the weight wgt = 8.*sqr(1.-xp)*zp/BGFWeight_; // PDF piece of the weight Energy2 scale = q2_*((1.-xp)*(1-zp)*zp/xp+1.); wgt *= pdf_->xfx(beam_,gluon_ ,scale,xB_/xp)/ pdf_->xfx(beam_,partons_[0],q2_ ,xB_); // me piece of the weight double x1 = -1./xp; double x2 = 1.-(1.-zp)/xp; double x3 = 2.+x1-x2; azicoeff = BGFME(xp,x2,x3,xT,false); wgt *= 0.5*alpha_->ratio(0.25*q2_*sqr(xT))* (azicoeff[0]+0.5*azicoeff[2]); if(wgt>1.||wgt<0.) { ostringstream wstring; wstring << "DISBase::generateBGF() " << "Weight greater than one or less than zero" << "wgt = " << wgt << "\n"; generator()->logWarning( Exception(wstring.str(), Exception::warning) ); } } while(xT>xTMin&&UseRandom::rnd()>wgt); if(xT<=xTMin) { pTBGF_=-GeV; return; } // generate phi unsigned int itry(0); double phimax = std::accumulate(azicoeff.begin(),azicoeff.end(),0.); double phiwgt,phi; do { phi = UseRandom::rnd()*Constants::twopi; double cphi(cos(phi)); phiwgt = azicoeff[0]+azicoeff[1]*cphi+azicoeff[2]*sqr(cphi); ++itry; } while (phimax*UseRandom::rnd() > phiwgt && itry<200); if(itry==200) throw Exception() << "Too many tries in DISMECorrection" << "::generateBGF() to" << " generate phi" << Exception::eventerror; // momenta for the configuration Energy Q(sqrt(q2_)); double x1 = -1./xp; double x2 = 1.-(1.-zp)/xp; double x3 = 2.+x1-x2; Lorentz5Momentum p1( 0.5*Q*xT*cos(phi), 0.5*Q*xT*sin(phi), -0.5*Q*x2, 0.5*Q*sqrt(sqr(xT)+sqr(x2))); Lorentz5Momentum p2(-0.5*Q*xT*cos(phi), -0.5*Q*xT*sin(phi), -0.5*Q*x3, 0.5*Q*sqrt(sqr(xT)+sqr(x3))); Lorentz5Momentum p0(ZERO,ZERO,-0.5*Q*x1,-0.5*Q*x1); pTBGF_=0.5*Q*xT; BGFMomenta_.resize(3); BGFMomenta_[0]=p0; BGFMomenta_[1]=p1; BGFMomenta_[2]=p2; // debuggingMatrixElement(true,p0,p1,p2,gluon_,pl_[0],pl_[1],pq_[0],pq_[1], // leptons_[0],leptons_[1], // partons_[0],partons_[1], // q2_,phi,x2,x3,xT,zp,xp,azicoeff,false); } int DISBase::nDim() const { return HwMEBase::nDim() + (contrib_>0 ? 1 : 0 ); } bool DISBase::generateKinematics(const double * r) { // Born kinematics if(!HwMEBase::generateKinematics(r)) return false; if(contrib_!=0) { // hadron and momentum fraction if(HadronMatcher::Check(*lastParticles().first->dataPtr())) { hadron_ = dynamic_ptr_cast(lastParticles().first->dataPtr()); xB_ = lastX1(); } else { hadron_ = dynamic_ptr_cast(lastParticles().second->dataPtr()); xB_ = lastX2(); } // Q2 q2_ = -(meMomenta()[0]-meMomenta()[2]).m2(); // xp int ndim=nDim(); double rhomin = pow(1.-xB_,1.-power_); double rho = r[ndim-1]*rhomin; xp_ = 1.-pow(rho,1./(1.-power_)); jac_ = rhomin/(1.-power_)*pow(1.-xp_,power_); jacobian(jacobian()*jac_); } return true; } Energy2 DISBase::scale() const { return scaleOpt_ == 1 ? -sqr(scaleFact_)*tHat() : sqr(scaleFact_*muF_); } CrossSection DISBase::dSigHatDR() const { return NLOWeight()*HwMEBase::dSigHatDR(); } double DISBase::NLOWeight() const { // If only leading order is required return 1: if(contrib_==0) return 1.; // scale and prefactors Energy2 mu2(scale()); double aS = SM().alphaS(mu2); double CFfact = 4./3.*aS/Constants::twopi; double TRfact = 1./2.*aS/Constants::twopi; // LO + dipole subtracted virtual + collinear quark bit with LO pdf double virt = 1.+CFfact*(-4.5-1./3.*sqr(Constants::pi)+1.5*log(q2_/mu2/(1.-xB_)) +2.*log(1.-xB_)*log(q2_/mu2)+sqr(log(1.-xB_))); virt /= jac_; // PDF from leading-order double loPDF = hadron_->pdf()->xfx(hadron_,mePartonData()[1],mu2,xB_)/xB_; // NLO gluon PDF tcPDPtr gluon = getParticleData(ParticleID::g); double gPDF = hadron_->pdf()->xfx(hadron_,gluon,mu2,xB_/xp_)*xp_/xB_; // NLO quark PDF double qPDF = hadron_->pdf()->xfx(hadron_,mePartonData()[1],mu2,xB_/xp_)*xp_/xB_; // collinear counterterms // gluon double collg = TRfact/xp_*gPDF*(2.*xp_*(1.-xp_)+(sqr(xp_)+sqr(1.-xp_))*log((1.-xp_)*q2_/xp_/mu2)); // quark double collq = CFfact/xp_*qPDF*(1-xp_-2./(1.-xp_)*log(xp_)-(1.+xp_)*log((1.-xp_)/xp_*q2_/mu2))+ CFfact/xp_*(qPDF-xp_*loPDF)*(2./(1.-xp_)*log(q2_*(1.-xp_)/mu2)-1.5/(1.-xp_)); // calculate the A coefficient for the real pieces double a(A(mePartonData()[0],mePartonData()[2], mePartonData()[1],mePartonData()[3],q2_)); // cacluate lepton kinematic variables Lorentz5Momentum q = meMomenta()[0]-meMomenta()[2]; double yB = (q*meMomenta()[1])/(meMomenta()[0]*meMomenta()[1]); double l = 2./yB-1.; // q -> qg term double realq = CFfact/xp_/(1.+a*l+sqr(l))*qPDF/loPDF* (2.+2.*sqr(l)-xp_+3.*xp_*sqr(l)+a*l*(2.*xp_+1.)); // g -> q qbar term double realg =-TRfact/xp_/(1.+a*l+sqr(l))*gPDF/loPDF* ((1.+sqr(l)+2.*(1.-3.*sqr(l))*xp_*(1.-xp_)) +2.*a*l*(1.-2.*xp_*(1.-xp_))); // return the full result double wgt = virt+((collq+collg)/loPDF+realq+realg); // double f2g = gPDF/xp_*TRfact*((sqr(1-xp_)+sqr(xp_))*log((1-xp_)/xp_)+ // 8*xp_*(1.-xp_)-1.); // double f2q = // loPDF/jac_*(1.+CFfact*(-1.5*log(1.-xB_)+sqr(log(1.-xB_)) // -sqr(Constants::pi)/3.-4.5)) // +qPDF *CFfact/xp_*(3.+2.*xp_-(1.+xp_)*log(1.-xp_) // -(1.+sqr(xp_))/(1.-xp_)*log(xp_)) // +(qPDF-xp_*loPDF)*CFfact/xp_*(2.*log(1.-xp_)/(1.-xp_)-1.5/(1.-xp_)); // double wgt = (f2g+f2q)/loPDF; return contrib_ == 1 ? max(0.,wgt) : max(0.,-wgt); } diff --git a/MatrixElement/DrellYanBase.cc b/MatrixElement/DrellYanBase.cc --- a/MatrixElement/DrellYanBase.cc +++ b/MatrixElement/DrellYanBase.cc @@ -1,1060 +1,1060 @@ // -*- C++ -*- // // This is the implementation of the non-inlined, non-templated member // functions of the DrellYanBase class. // #include "DrellYanBase.h" #include "ThePEG/Repository/EventGenerator.h" #include "ThePEG/Interface/ClassDocumentation.h" #include "ThePEG/Interface/Parameter.h" #include "ThePEG/Interface/Reference.h" #include "ThePEG/Persistency/PersistentOStream.h" #include "ThePEG/Persistency/PersistentIStream.h" #include "ThePEG/PDT/EnumParticles.h" #include "Herwig/Shower/Base/ShowerTree.h" #include "Herwig/Shower/Base/HardTree.h" #include "Herwig/Shower/Base/ShowerProgenitor.h" #include "Herwig/Shower/Base/ShowerParticle.h" #include "Herwig/Shower/Base/Branching.h" using namespace Herwig; DrellYanBase::DrellYanBase() : _channelwgtA(0.12), _channelwgtB(2.00), _nover(0), _maxwgt(0.), _power(2.0),_preqqbar(6.5),_preqg(4.0),_pregqbar(4.0), _min_pt(2.*GeV) {} void DrellYanBase::persistentOutput(PersistentOStream & os) const { os << _channelwgtA << _channelwgtB << _channelweights << _alpha << _power << _preqqbar << _preqg << _pregqbar << ounit( _min_pt, GeV ) << _prefactor; } void DrellYanBase::persistentInput(PersistentIStream & is, int) { is >> _channelwgtA >> _channelwgtB >> _channelweights >> _alpha >> _power >> _preqqbar >> _preqg >> _pregqbar >> iunit( _min_pt, GeV ) >> _prefactor; } AbstractClassDescription DrellYanBase::initDrellYanBase; // Definition of the static class description member. void DrellYanBase::Init() { static ClassDocumentation documentation ("The DrellYanBase class provides a base class for the" " corrections to Drell-Yan type processes"); static Parameter interfaceQQbarChannelWeight ("QQbarChannelWeight", "The relative weights of the q qbar abd q g channels for selection." " This is a technical parameter for the phase-space generation and " "should not affect the results only the efficiency and fraction" " of events with weight > 1.", &DrellYanBase::_channelwgtA, 0.12, 0.01, 100., false, false, Interface::limited); static Parameter interfaceQGChannelWeight ("QGChannelWeight", "The relative weights of the qg abd qbar g channels for selection." " This is a technical parameter for the phase-space generation and " "should not affect the results only the efficiency and fraction", &DrellYanBase::_channelwgtB, 2., 0.01, 100., false, false, Interface::limited); static Reference interfaceCoupling ("Coupling", "Pointer to the object to calculate the coupling for the correction", &DrellYanBase::_alpha, false, false, true, false, false); static Parameter interfacePower ("Power", "The power for the sampling of the matrix elements", &DrellYanBase::_power, 2.0, 1.0, 10.0, false, false, Interface::limited); static Parameter interfacePrefactorqqbar ("Prefactorqqbar", "The prefactor for the sampling of the q qbar channel", &DrellYanBase::_preqqbar, 5.0, 0.0, 1000.0, false, false, Interface::limited); static Parameter interfacePrefactorqg ("Prefactorqg", "The prefactor for the sampling of the q g channel", &DrellYanBase::_preqg, 3.0, 0.0, 1000.0, false, false, Interface::limited); static Parameter interfacePrefactorgqbar ("Prefactorgqbar", "The prefactor for the sampling of the g qbar channel", &DrellYanBase::_pregqbar, 3.0, 0.0, 1000.0, false, false, Interface::limited); static Parameter interfacePtMin ("minPt", "The pt cut on hardest emision generation" "2*(1-Beta)*exp(-sqr(intrinsicpT/RMS))/sqr(RMS)", &DrellYanBase::_min_pt, GeV, 2.*GeV, ZERO, 100000.0*GeV, false, false, Interface::limited); } void DrellYanBase::doinit() { HwMEBase::doinit(); _channelweights.push_back(_channelwgtA/(1.+_channelwgtA)); _channelweights.push_back(_channelweights[0]+1./(1.+_channelwgtA)/(1+_channelwgtB)); _channelweights.push_back(1.0); _prefactor.push_back(_preqqbar); _prefactor.push_back(_preqg); _prefactor.push_back(_pregqbar); } void DrellYanBase::dofinish() { HwMEBase::dofinish(); if(_nover==0) return; generator()->log() << "DrellYanBase when applying the hard correction " << _nover << " weights larger than one were generated of which" << " the largest was " << _maxwgt << "\n"; } void DrellYanBase::applyHardMatrixElementCorrection(ShowerTreePtr tree) { // get the quark,antiquark and the gauge boson // get the quarks map::const_iterator cit; ShowerParticleVector incoming; vector beams; for(cit=tree->incomingLines().begin();cit!=tree->incomingLines().end();++cit) { incoming.push_back(cit->first->progenitor()); beams.push_back(cit->first->beam()); } // ensure that the quark is first if(incoming[0]->id()id()) { swap(incoming[0],incoming[1]); swap(beams[0],beams[1]); } Lorentz5Momentum pboson; for( map::const_iterator cjt= tree->outgoingLines().begin(); cjt != tree->outgoingLines().end();++cjt ) { pboson += cjt->first->original()->momentum(); } pboson.rescaleMass(); // calculate the momenta unsigned int iemit,itype; vector pnew; LorentzRotation trans; pair xnew; // if not accepted return if(!applyHard(incoming,beams,pboson,iemit,itype,pnew,trans,xnew)) return; // if applying ME correction create the new particles if(itype==0) { // get the momenta of the new particles Lorentz5Momentum pquark(pnew[0]),panti(pnew[1]),pgluon(pnew[2]); if(iemit==2) swap(pquark,panti); // ensure gluon can be put on shell Lorentz5Momentum ptest(pgluon); if(ptest.boost(-(pquark+panti).boostVector()).e() < getParticleData(ParticleID::g)->constituentMass()) return; // create the new gluon PPtr newg= getParticleData(ParticleID::g)->produceParticle(pgluon); PPtr newq,newa; ColinePtr col; // make the new particles if(iemit==1) { col=incoming[0]->colourLine(); newq = getParticleData(incoming[0]->id())->produceParticle(pquark); newa = new_ptr(Particle(*incoming[1])); col->removeAntiColoured(newa); newa->set5Momentum(panti); } else { col=incoming[1]->antiColourLine(); newa = getParticleData(incoming[1]->id())->produceParticle(panti); newq = new_ptr(Particle(*incoming[0])); col->removeColoured(newq); newq->set5Momentum(pquark); } // set the colour lines ColinePtr newline=new_ptr(ColourLine()); if(iemit==1) { newline->addColoured(newq); newline->addColoured(newg); col->addAntiColoured(newg); col->addAntiColoured(newa); } else { newline->addAntiColoured(newa); newline->addAntiColoured(newg); col->addColoured(newg); col->addColoured(newq); } // change the existing quark and antiquark PPtr orig; for(cit=tree->incomingLines().begin();cit!=tree->incomingLines().end();++cit) { if(cit->first->progenitor()->id()==newq->id()) { // remove old particles from colour line col->removeColoured(cit->first->copy()); col->removeColoured(cit->first->progenitor()); // insert new particles cit->first->copy(newq); ShowerParticlePtr sp(new_ptr(ShowerParticle(*newq,1,false))); sp->x(xnew.first); cit->first->progenitor(sp); tree->incomingLines()[cit->first]=sp; cit->first->perturbative(iemit!=1); if(iemit==1) orig=cit->first->original(); } else { // remove old particles from colour line col->removeAntiColoured(cit->first->copy()); col->removeColoured(cit->first->progenitor()); // insert new particles cit->first->copy(newa); ShowerParticlePtr sp(new_ptr(ShowerParticle(*newa,1,false))); sp->x(xnew.second); cit->first->progenitor(sp); tree->incomingLines()[cit->first]=sp; cit->first->perturbative(iemit==1); if(iemit==2) orig=cit->first->original(); } } // fix the momentum of the gauge boson Boost boostv=pboson.findBoostToCM(); trans *=LorentzRotation(boostv); for( map::const_iterator cjt= tree->outgoingLines().begin(); cjt != tree->outgoingLines().end();++cjt ) { cjt->first->progenitor()->transform(trans); cjt->first->copy()->transform(trans); } tree->hardMatrixElementCorrection(true); // add the gluon ShowerParticlePtr sg=new_ptr(ShowerParticle(*newg,1,true)); ShowerProgenitorPtr gluon=new_ptr(ShowerProgenitor(orig,newg,sg)); gluon->perturbative(false); tree->outgoingLines().insert(make_pair(gluon,sg)); } else if(itype==1) { Lorentz5Momentum pin(pnew[0]),pout(pnew[1]),pgluon(pnew[2]); if(iemit==2) swap(pin,pout); // ensure outgoing quark can be put on-shell Lorentz5Momentum ptest(pout); if(ptest.boost(-(pin+pgluon).boostVector()).e() < incoming[1]->dataPtr()->constituentMass()) return; // create the new gluon PPtr newg = getParticleData(ParticleID::g)->produceParticle(pgluon); // create the new outgoing quark PPtr newout= getParticleData(-incoming[1]->id())->produceParticle(pout); // create the new incoming quark PPtr newin = new_ptr(Particle(*incoming[0])); newin->set5Momentum(pin); // colour info ColinePtr col=incoming[0]->colourLine(); col->removeColoured(newin); ColinePtr newline=new_ptr(ColourLine()); newline->addColoured(newout); newline->addColoured(newg); col->addAntiColoured(newg); col->addColoured(newin); // change the existing incoming partons PPtr orig; for(cit=tree->incomingLines().begin();cit!=tree->incomingLines().end();++cit) { if(cit->first->progenitor()->id()==newin->id()) { // remove old particles from colour line col->removeColoured(cit->first->copy()); col->removeColoured(cit->first->progenitor()); // insert new particles cit->first->copy(newin); ShowerParticlePtr sp(new_ptr(ShowerParticle(*newin,1,false))); sp->x(xnew.first); cit->first->progenitor(sp); tree->incomingLines()[cit->first]=sp; cit->first->perturbative(true); } else { // remove old particles from colour line col->removeAntiColoured(cit->first->copy()); col->removeColoured(cit->first->progenitor()); // insert new particles cit->first->copy(newg); ShowerParticlePtr sp(new_ptr(ShowerParticle(*newg,1,false))); sp->x(xnew.second); cit->first->progenitor(sp); tree->incomingLines()[cit->first]=sp; cit->first->perturbative(false); orig=cit->first->original(); } } // fix the momentum of the gauge boson Boost boostv=pboson.findBoostToCM(); trans *=LorentzRotation(boostv); for( map::const_iterator cjt= tree->outgoingLines().begin(); cjt != tree->outgoingLines().end();++cjt ) { cjt->first->progenitor()->transform(trans); cjt->first->copy()->transform(trans); } tree->hardMatrixElementCorrection(true); // add the outgoing quark ShowerParticlePtr sout=new_ptr(ShowerParticle(*newout,1,true)); ShowerProgenitorPtr out=new_ptr(ShowerProgenitor(orig,newout,sout)); out->perturbative(false); tree->outgoingLines().insert(make_pair(out,sout)); } else if(itype==2) { Lorentz5Momentum pin(pnew[0]),pout(pnew[1]),pgluon(pnew[2]); if(iemit==2) swap(pin,pout); // ensure outgoing antiquark can be put on-shell Lorentz5Momentum ptest(pout); if(ptest.boost(-(pin+pgluon).boostVector()).e() < incoming[0]->dataPtr()->constituentMass()) return; // create the new gluon PPtr newg = getParticleData(ParticleID::g)->produceParticle(pgluon); // create the new outgoing antiquark PPtr newout= getParticleData(-incoming[0]->id())->produceParticle(pout); // create the new incoming antiquark PPtr newin = new_ptr(Particle(*incoming[1])); newin->set5Momentum(pin); // colour info ColinePtr col=incoming[0]->colourLine(); col->removeAntiColoured(newin); ColinePtr newline=new_ptr(ColourLine()); newline->addAntiColoured(newout); newline->addAntiColoured(newg); col->addColoured(newg); col->addAntiColoured(newin); // change the existing incoming partons PPtr orig; for(cit=tree->incomingLines().begin();cit!=tree->incomingLines().end();++cit) { if(cit->first->progenitor()->id()==newin->id()) { // remove old particles from colour line col->removeAntiColoured(cit->first->copy()); col->removeAntiColoured(cit->first->progenitor()); // insert new particles cit->first->copy(newin); ShowerParticlePtr sp(new_ptr(ShowerParticle(*newin,1,false))); sp->x(xnew.second); cit->first->progenitor(sp); tree->incomingLines()[cit->first]=sp; cit->first->perturbative(true); } else { // remove old particles from colour line col->removeColoured(cit->first->copy()); col->removeColoured(cit->first->progenitor()); // insert new particles cit->first->copy(newg); ShowerParticlePtr sp(new_ptr(ShowerParticle(*newg,1,false))); sp->x(xnew.first); cit->first->progenitor(sp); tree->incomingLines()[cit->first]=sp; cit->first->perturbative(false); orig=cit->first->original(); } } // fix the momentum of the gauge boson Boost boostv=pboson.findBoostToCM(); trans *=LorentzRotation(boostv); for( map::const_iterator cjt= tree->outgoingLines().begin(); cjt != tree->outgoingLines().end();++cjt ) { cjt->first->progenitor()->transform(trans); cjt->first->copy()->transform(trans); } tree->hardMatrixElementCorrection(true); // add the outgoing antiquark ShowerParticlePtr sout=new_ptr(ShowerParticle(*newout,1,true)); ShowerProgenitorPtr out=new_ptr(ShowerProgenitor(orig,newout,sout)); out->perturbative(false); tree->outgoingLines().insert(make_pair(out,sout)); } } bool DrellYanBase::applyHard(ShowerParticleVector quarks, vector beams, Lorentz5Momentum boson, unsigned int & iemit,unsigned int & itype, vector & pnew, LorentzRotation & trans, pair & xout) { // check that quark along +z and qbar along -z bool quarkplus=quarks[0]->momentum().z()>quarks[1]->momentum().z(); // calculate the limits on s Energy mb = sqrt(mb2_); Energy2 smin=mb2_; Energy2 s= (generator()->currentEvent()->incoming().first ->momentum()+ generator()->currentEvent()->incoming().second->momentum()).m2(); Energy2 smax(s); // calculate the rapidity of the boson double yB=0.5*log((boson.e()+boson.z())/ (boson.e()-boson.z())); if(!quarkplus) yB=-yB; // if no phase-space return if(smaxx(); assert(beams[ix]); pdf[ix]=beams[ix]->pdf(); assert(pdf[ix]); fx[ix]=pdf[ix]->xfx(beams[ix],quarks[ix]->dataPtr(),mb2_,x[ix]); } // select the type of process and generate the kinematics double rn(UseRandom::rnd()); Energy2 shat(ZERO),uhat(ZERO),that(ZERO); double weight(0.),xnew[2]={1.,1.}; // generate the value of s according to 1/s^2 shat = smax*smin/(smin+UseRandom::rnd()*(smax-smin)); Energy2 jacobian = sqr(shat)*(1./smin-1./smax); double sbar=shat/mb2_; // calculate limits on that Energy2 tmax=mb2_*kappa[0]*(1.-sbar)/(kappa[0]+sbar); Energy2 tmin=shat*(1.-sbar)/(kappa[1]+sbar); // calculate the limits on uhat Energy2 umax(mb2_-shat-tmin),umin(mb2_-shat-tmax); // check inside phase space if(tmax g V if(rn<_channelweights[0]) { // generate t and u according to 1/t+1/u // generate in 1/t if(UseRandom::rndbool(0.5)) { that=tmax*pow(tmin/tmax,UseRandom::rnd()); uhat=mb2_-shat-that; jacobian *=log(tmin/tmax); } // generate in 1/u else { uhat=umax*pow(umin/umax,UseRandom::rnd()); that=mb2_-shat-uhat; jacobian *=log(umin/umax); } Energy4 jacobian2 = jacobian * 2.*uhat*that/(shat-mb2_); // new scale (this is mt^2=pt^2+mb^2) Energy2 scale(uhat*that/shat+mb2_); // the PDF's with the emitted gluon double fxnew[2]; xnew[0]=exp(yB)/sqrt(s)*sqrt(shat*(mb2_-uhat)/(mb2_-that)); xnew[1]=shat/(s*xnew[0]); for(unsigned int ix=0;ix<2;++ix) {fxnew[ix]=pdf[ix]->xfx(beams[ix],quarks[ix]->dataPtr(),scale,xnew[ix]);} // jacobian and me parts of the weight weight=jacobian2*(sqr(mb2_-that)+sqr(mb2_-uhat))/(sqr(shat)*that*uhat); // pdf part of the weight weight *=fxnew[0]*fxnew[1]*x[0]*x[1]/(fx[0]*fx[1]*xnew[0]*xnew[1]); // finally coupling, colour factor and different channel pieces weight *= 2./3./Constants::pi/_channelweights[0]*_alpha->value(scale); // select the emiting particle iemit=1; if(UseRandom::rnd()_channelweights[1]) { swap(tmax,tmin); tmax=mb2_-shat-tmax; tmin=mb2_-shat-tmin; } that=tmax*pow(tmin/tmax,UseRandom::rnd()); uhat=mb2_-shat-that; Energy4 jacobian2 = jacobian * that*log(tmax/tmin); // new scale (this is mt^2=pt^2+mb^2) Energy2 scale(uhat*that/shat+mb2_); // g qbar -> qbar V double fxnew[2]; if(rn<_channelweights[1]) { itype=2; xnew[0]=exp(yB)/sqrt(s)*sqrt(shat*(mb2_-uhat)/(mb2_-that)); xnew[1]=shat/(s*xnew[0]); fxnew[0]=pdf[0]->xfx(beams[0],getParticleData(ParticleID::g),scale,xnew[0]); fxnew[1]=pdf[1]->xfx(beams[1],quarks[1]->dataPtr(),scale,xnew[1]); jacobian2/=(_channelweights[1]-_channelweights[0]); } // q g -> q V else { itype=1; xnew[0]=exp(yB)/sqrt(s)*sqrt(shat*(mb2_-that)/(mb2_-uhat)); xnew[1]=shat/(s*xnew[0]); fxnew[0]=pdf[0]->xfx(beams[0],quarks[0]->dataPtr(),scale,xnew[0]); fxnew[1]=pdf[1]->xfx(beams[1],getParticleData(ParticleID::g),scale,xnew[1]); jacobian2/=(_channelweights[2]-_channelweights[1]); } // jacobian and me parts of the weight weight=-jacobian2*(sqr(mb2_-that)+sqr(mb2_-shat))/(sqr(shat)*shat*that); // pdf part of the weight weight *=fxnew[0]*fxnew[1]*x[0]*x[1]/(fx[0]*fx[1]*xnew[0]*xnew[1]); // finally coupling, colour factor and different channel pieces weight *= 0.25/Constants::pi*_alpha->value(scale); // select the emiting particle iemit=1; if(UseRandom::rnd()1.) { ++_nover; _maxwgt=max(_maxwgt,weight); weight=1.; } if(UseRandom::rnd()>weight) return false; // construct the momenta in the rest frame of the boson Lorentz5Momentum pb(ZERO,ZERO,ZERO,mb,mb),pspect,pg,pemit; double cos3 = 0.0; if(itype==0) { pg = Lorentz5Momentum(ZERO,ZERO,ZERO,0.5*(shat-mb2_)/mb,ZERO); Energy2 tp(that),up(uhat); double zsign(-1.); if(iemit==2) { tp=uhat; up=that; zsign=1.; } pspect = Lorentz5Momentum(ZERO,ZERO,zsign*0.5*(mb2_-tp)/mb, 0.5*(mb2_-tp)/mb,ZERO); Energy eemit=0.5*(mb2_-up)/mb; cos3 = 0.5/pspect.z()/pg.e()*(sqr(pspect.e())+sqr(pg.e())-sqr(eemit)); } else { pg=Lorentz5Momentum(ZERO,ZERO,ZERO,0.5*(mb2_-uhat)/mb,ZERO); double zsign(1.); if(iemit==1) { if(itype==1) zsign=-1.; pspect=Lorentz5Momentum(ZERO,ZERO,0.5*zsign*(shat-mb2_)/mb, 0.5*(shat-mb2_)/mb); Energy eemit=0.5*(mb2_-that)/mb; cos3 = 0.5/pspect.z()/pg.e()*(sqr(pspect.e())+sqr(pg.e())-sqr(eemit)); } else { if(itype==2) zsign=-1.; pspect=Lorentz5Momentum(ZERO,ZERO,0.5*zsign*(mb2_-that)/mb, 0.5*(mb2_-that)/mb); Energy eemit=0.5*(shat-mb2_)/mb; cos3 = 0.5/pspect.z()/pg.e()*(-sqr(pspect.e())-sqr(pg.e())+sqr(eemit)); } } // rotate the gluon double sin3(sqrt(1.-sqr(cos3))); double phi(Constants::twopi*UseRandom::rnd()); pg.setX(pg.e()*sin3*cos(phi)); pg.setY(pg.e()*sin3*sin(phi)); pg.setZ(pg.e()*cos3); if(itype==0) { pemit=pb+pg-pspect; } else { if(iemit==1) pemit=pb+pspect-pg; else pemit=pspect+pg-pb; } pemit.rescaleMass(); // find the new CMF Lorentz5Momentum pp[2]; if(itype==0) { if(iemit==1) { pp[0]=pemit; pp[1]=pspect; } else { pp[0]=pspect; pp[1]=pemit; } } else if(itype==1) { pp[1]=pg; if(iemit==1) pp[0]=pemit; else pp[0]=pspect; } else { pp[0]=pg; if(iemit==1) pp[1]=pemit; else pp[1]=pspect; } Lorentz5Momentum pz= quarkplus ? pp[0] : pp[1]; pp[0]/=xnew[0]; pp[1]/=xnew[1]; Lorentz5Momentum plab(pp[0]+pp[1]); plab.rescaleMass(); // construct the boost to rest frame of plab trans=LorentzRotation(plab.findBoostToCM()); pz.transform(trans); // rotate so emitting particle along z axis // rotate so in x-z plane trans.rotateZ(-atan2(pz.y(),pz.x())); // rotate so along trans.rotateY(-acos(pz.z()/pz.vect().mag())); // undo azimuthal rotation trans.rotateZ(atan2(pz.y(),pz.x())); // perform the transforms pb .transform(trans); pspect.transform(trans); pg .transform(trans); pemit .transform(trans); // momenta to be returned pnew.push_back(pemit); pnew.push_back(pspect); pnew.push_back(pg); pnew.push_back(pb); xout.first=xnew[0]; xout.second=xnew[1]; return true; } bool DrellYanBase::softMatrixElementVeto(ShowerProgenitorPtr initial, ShowerParticlePtr parent,Branching br) { if(parent->isFinalState()) return false; // check if me correction should be applied long id[2]={initial->id(),parent->id()}; if(id[0]!=id[1]||id[1]==ParticleID::g) return false; // get the pT Energy pT=br.kinematics->pT(); // check if hardest so far if(pThighestpT()) return false; // compute the invariants double kappa(sqr(br.kinematics->scale())/mb2_),z(br.kinematics->z()); Energy2 shat(mb2_/z*(1.+(1.-z)*kappa)),that(-(1.-z)*kappa*mb2_),uhat(-(1.-z)*shat); // check which type of process // g qbar double wgt(1.); - if(id[0]>0&&br.ids[0]==ParticleID::g) + if(id[0]>0&&br.ids[0]->id()==ParticleID::g) wgt=mb2_/(shat+uhat)*(sqr(mb2_-that)+sqr(mb2_-shat))/(sqr(shat+uhat)+sqr(uhat)); - else if(id[0]>0&&br.ids[0]==id[0]) + else if(id[0]>0&&br.ids[0]->id()==id[0]) wgt=mb2_/(shat+uhat)*(sqr(mb2_-uhat)+sqr(mb2_-that))/(sqr(shat)+sqr(shat+uhat)); - else if(id[0]<0&&br.ids[0]==ParticleID::g) + else if(id[0]<0&&br.ids[0]->id()==ParticleID::g) wgt=mb2_/(shat+uhat)*(sqr(mb2_-that)+sqr(mb2_-shat))/(sqr(shat+uhat)+sqr(uhat)); - else if(id[0]<0&&br.ids[0]==-id[0]) + else if(id[0]<0&&br.ids[0]->id()==-id[0]) wgt=mb2_/(shat+uhat)*(sqr(mb2_-uhat)+sqr(mb2_-that))/(sqr(shat)+sqr(shat+uhat)); else return false; if(wgt<.0||wgt>1.) generator()->log() << "Soft ME correction weight too large or " << "negative in DrellYanBase::" << "softMatrixElementVeto()soft weight " << " sbar = " << shat/mb2_ << " tbar = " << that/mb2_ << "weight = " << wgt << "\n"; // if not vetoed if(UseRandom::rndbool(wgt)) return false; // otherwise parent->vetoEmission(br.type,br.kinematics->scale()); return true; } HardTreePtr DrellYanBase::generateHardest(ShowerTreePtr tree, ShowerInteraction::Type inter) { // check if generating QCD radiation if(inter!=ShowerInteraction::QCD && inter!=ShowerInteraction::QEDQCD && inter!=ShowerInteraction::ALL) return HardTreePtr(); useMe(); // get the particles to be showered _beams.clear(); _partons.clear(); // find the incoming particles ShowerParticleVector incoming; map::const_iterator cit; _quarkplus = true; vector particlesToShower; //progenitor particles are produced in z direction. for( cit = tree->incomingLines().begin(); cit != tree->incomingLines().end(); ++cit ) { incoming.push_back( cit->first->progenitor() ); _beams.push_back( cit->first->beam() ); _partons.push_back( cit->first->progenitor()->dataPtr() ); // check that quark is along +ve z direction if(cit->first->progenitor()->id() > 0 && cit->first->progenitor()->momentum().z() < ZERO ) _quarkplus = false; particlesToShower.push_back( cit->first ); } Lorentz5Momentum pboson; for( map::const_iterator cjt= tree->outgoingLines().begin(); cjt != tree->outgoingLines().end();++cjt ) { pboson += cjt->first->original()->momentum(); } pboson.rescaleMass(); // calculate the rapidity of the boson _yb = 0.5 * log((pboson.e()+pboson.z())/(pboson.e()-pboson.z())); _yb *= _quarkplus ? 1. : -1.; _mass = pboson.mass(); // we are assuming quark first, swap order to ensure this // if antiquark first if(_partons[0]->id()<_partons[1]->id()) { swap(_partons[0],_partons[1]); swap(_beams[0],_beams[1]); } vector pnew; int emission_type(-1); // generate the hard emission and return if no emission if(!getEvent(pnew,emission_type)) { for(unsigned int ix=0;ixmaximumpT(_min_pt,ShowerInteraction::QCD); return HardTreePtr(); } // construct the HardTree object needed to perform the showers ShowerParticleVector newparticles; // make the particles for the HardTree tcPDPtr gluon=getParticleData(ParticleID::g); // create the partons int iemit; // q qbar -> g V ColinePtr newline[2]={new_ptr(ColourLine()),new_ptr(ColourLine())}; if(emission_type==0) { newparticles.push_back(new_ptr(ShowerParticle(_partons[0] ,false))); newparticles.push_back(new_ptr(ShowerParticle(_partons[1] ,false))); newparticles.push_back(new_ptr(ShowerParticle(gluon , true))); newline[1]->addColoured(newparticles[0]); newline[1]->addColoured(newparticles[2]); newline[0]->addAntiColoured(newparticles[1]); newline[0]->addAntiColoured(newparticles[2]); iemit = (pnew[0]-pnew[2]).m2()>(pnew[1]-pnew[2]).m2() ? 0 : 1; } // q g -> q V else if(emission_type==1) { iemit=1; newparticles.push_back(new_ptr(ShowerParticle(_partons[0] ,false))); newparticles.push_back(new_ptr(ShowerParticle(gluon ,false))); newparticles.push_back(new_ptr(ShowerParticle(_partons[1]->CC(), true))); newline[1]->addColoured(newparticles[0]); newline[1]->addAntiColoured(newparticles[1]); newline[0]->addColoured(newparticles[1]); newline[0]->addColoured(newparticles[2]); } // g qbar -> qbar V else { iemit=0; newparticles.push_back(new_ptr(ShowerParticle(gluon ,false))); newparticles.push_back(new_ptr(ShowerParticle(_partons[1] ,false))); newparticles.push_back(new_ptr(ShowerParticle(_partons[0]->CC(), true))); newline[0]->addAntiColoured(newparticles[1]); newline[0]->addColoured(newparticles[0]); newline[1]->addAntiColoured(newparticles[0]); newline[1]->addAntiColoured(newparticles[2]); } // set the momenta for(unsigned int ix=0;ix<3;++ix) newparticles[ix]->set5Momentum(pnew[ix]); // create the off-shell particle Lorentz5Momentum poff=pnew[iemit]-pnew[2]; poff.rescaleMass(); newparticles.push_back(new_ptr(ShowerParticle(_partons[iemit],false))); newparticles.back()->set5Momentum(poff); if(iemit==0) { newline[0]->addColoured(newparticles.back()); } else { newline[1]->addAntiColoured(newparticles.back()); } // compute the boost for the bosons LorentzRotation boost(pboson.findBoostToCM()); boost.boost(pnew[3].boostVector()); for( map::const_iterator cjt= tree->outgoingLines().begin(); cjt != tree->outgoingLines().end();++cjt ) { newparticles.push_back(new_ptr(ShowerParticle(cjt->first->original()->dataPtr(), true))); newparticles.back()->set5Momentum(boost*cjt->first->original()->momentum()); } vector inBranch,hardBranch; // create the branchings for the incoming particles inBranch.push_back(new_ptr(HardBranching(newparticles[0],SudakovPtr(), HardBranchingPtr(),HardBranching::Incoming))); inBranch.push_back(new_ptr(HardBranching(newparticles[1],SudakovPtr(), HardBranchingPtr(),HardBranching::Incoming))); // intermediate IS particle hardBranch.push_back(new_ptr(HardBranching(newparticles[3],SudakovPtr(), inBranch[iemit],HardBranching::Incoming))); inBranch[iemit]->addChild(hardBranch.back()); inBranch[iemit]->type(hardBranch.back()->branchingParticle()->id()>0 ? ShowerPartnerType::QCDColourLine : ShowerPartnerType::QCDAntiColourLine); // create the branching for the emitted jet inBranch[iemit]->addChild(new_ptr(HardBranching(newparticles[2],SudakovPtr(), inBranch[iemit],HardBranching::Outgoing))); // set the colour partners hardBranch.back()->colourPartner(inBranch[iemit==0 ? 1 : 0]); inBranch[iemit==0 ? 1 : 0]->colourPartner(hardBranch.back()); // add other particle hardBranch.push_back(inBranch[iemit==0 ? 1 : 0]); // outgoing particles for(unsigned int ix=4;ix hard=hardtree->branchings(); for(unsigned int ix=0;ixmaximumpT(_min_pt,ShowerInteraction::QCD); else particlesToShower[ix]->maximumpT(_pt,ShowerInteraction::QCD); for(set::const_iterator mit=hard.begin(); mit!=hard.end();++mit) { if(particlesToShower[ix]->progenitor()->id()==(*mit)->branchingParticle()->id()&& (( particlesToShower[ix]->progenitor()->isFinalState()&& (**mit).status()==HardBranching::Outgoing)|| (!particlesToShower[ix]->progenitor()->isFinalState()&& (**mit).status()==HardBranching::Incoming))) { hardtree->connect(particlesToShower[ix]->progenitor(),*mit); if((**mit).status()==HardBranching::Incoming) { (*mit)->beam(particlesToShower[ix]->original()->parents()[0]); } HardBranchingPtr parent=(*mit)->parent(); while(parent) { parent->beam(particlesToShower[ix]->original()->parents()[0]); parent=parent->parent(); }; } } } // return the tree return hardtree; } double DrellYanBase::getResult(int emis_type, Energy pt, double yj) { Energy2 s=sqr(generator()->maximumCMEnergy()); Energy2 m2(sqr(_mass)); Energy2 scale = m2+sqr(pt); Energy et=sqrt(scale); // longitudinal real correction fractions double x = pt*exp( yj)/sqrt(s)+et*exp( _yb)/sqrt(s); double y = pt*exp(-yj)/sqrt(s)+et*exp(-_yb)/sqrt(s); // reject if outside region if(x<0.||x>1.||y<0.||y>1.||x*ypdf()->xfx(_beams[0],_partons[0],m2,x1); pdf[1]=_beams[1]->pdf()->xfx(_beams[1],_partons[1],m2,y1); //qqbar2Zg using Constants::pi; if(emis_type==0) { pdf[2]=_beams[0]->pdf()->xfx(_beams[0],_partons[0],scale,x); pdf[3]=_beams[1]->pdf()->xfx(_beams[1],_partons[1],scale,y); res = 4./3./pi*(sqr(th-m2)+sqr(uh-m2))*pt/(sh*uh*th)*GeV; } //qg2Zq else if(emis_type==1) { pdf[2]=_beams[0]->pdf()->xfx(_beams[0],_partons[0],scale,x); pdf[3]=_beams[1]->pdf()->xfx(_beams[1],getParticleData(ParticleID::g),scale,y); res = -1./2./pi*(sqr(uh-m2)+sqr(sh-m2))*pt/(sh*sh*uh)*GeV; } //qbarg2Zqbar else { pdf[2]=_beams[0]->pdf()->xfx(_beams[0],getParticleData(ParticleID::g),scale,x); pdf[3]=_beams[1]->pdf()->xfx(_beams[1],_partons[1],scale,y); res =- 1./2./pi*(sqr(th-m2)+sqr(sh-m2))*pt/(sh*sh*th)*GeV; } //deals with pdf zero issue at large x if(pdf[0]<=0.||pdf[1]<=0.||pdf[2]<=0.||pdf[3]<=0.) { res=0.; } else { res*=pdf[2]*pdf[3]/pdf[0]/pdf[1]*m2/sh; } res*=_alpha->ratio(sqr(pt)); return res; } bool DrellYanBase::getEvent(vector & pnew, int & emis_type){ // pt cut-off // Energy minp = 0.1*GeV; // maximum pt (half of centre-of-mass energy) Energy maxp = 0.5*generator()->maximumCMEnergy(); // set pt of emission to zero _pt=ZERO; //Working Variables Energy pt; double yj; // limits on the rapidity of the jet double minyj = -8.0,maxyj = 8.0; bool reject; double wgt; emis_type=-1; for(int j=0;j<3;j++) { pt=maxp; double a = _alpha->overestimateValue()*_prefactor[j]*(maxyj-minyj)/(_power-1.); do { // generate next pt pt=GeV/pow(pow(GeV/pt,_power-1)-log(UseRandom::rnd())/a,1./(_power-1.)); // generate rapidity of the jet yj=UseRandom::rnd()*(maxyj-minyj)+ minyj; // calculate rejection weight wgt=getResult(j,pt,yj); wgt/= _prefactor[j]*pow(GeV/pt,_power); reject = UseRandom::rnd()>wgt; //no emission event if p goes past p min - basically set to outside //of the histogram bounds (hopefully hist object just ignores it) if(pt<_min_pt){ pt=ZERO; reject = false; } if(wgt>1.0) { ostringstream s; s << "DrellYanBase::getEvent weight for channel " << j << "is " << wgt << " which is greater than 1"; generator()->logWarning( Exception(s.str(), Exception::warning) ); } } while(reject); // set pt of emission etc if(pt>_pt){ emis_type = j; _pt=pt; _yj=yj; } } //was this an (overall) no emission event? if(_pt<_min_pt){ _pt=ZERO; emis_type = 3; } if(emis_type==3) return false; // generate the momenta of the particles // hadron-hadron cmf Energy2 s=sqr(generator()->maximumCMEnergy()); // transverse energy Energy2 m2(sqr(_mass)); Energy et=sqrt(m2+sqr(_pt)); // first calculate all the kinematic variables // longitudinal real correction fractions double x = _pt*exp( _yj)/sqrt(s)+et*exp( _yb)/sqrt(s); double y = _pt*exp(-_yj)/sqrt(s)+et*exp(-_yb)/sqrt(s); // that and uhat Energy2 th = -sqrt(s)*x*_pt*exp(-_yj); Energy2 uh = -sqrt(s)*y*_pt*exp( _yj); Energy2 sh = x*y*s; if(emis_type==1) swap(th,uh); // decide which was the emitting particle unsigned int iemit=1; // from q qbar if(emis_type==0) { if(UseRandom::rnd() MEPP2Higgs::epsi_ = complex(ZERO,-1.e-10*GeV2); MEPP2Higgs::MEPP2Higgs() : scaleopt_(1), mu_F_(100.*GeV), shapeOption_(2), processOption_(1), minFlavour_(4), maxFlavour_(5), mh_(ZERO), wh_(ZERO), minLoop_(6),maxLoop_(6),massOption_(0), mu_R_opt_(1),mu_F_opt_(1), channelwgtA_(0.45),channelwgtB_(0.15), ggPow_(1.6), qgPow_(1.6), enhance_(1.1), nover_(0), ntry_(0), ngen_(0), maxwgt_(0.), power_(2.0), pregg_(7.), preqg_(3.), pregqbar_(3.), minpT_(2.*GeV), spinCorrelations_(true) {} ClassDescription MEPP2Higgs::initMEPP2Higgs; // Definition of the static class description member. void MEPP2Higgs::persistentOutput(PersistentOStream & os) const { os << HGGVertex_ << HFFVertex_ << shapeOption_ << processOption_ << minFlavour_ << maxFlavour_ << hmass_ << ounit(mh_,GeV) << ounit(wh_,GeV) << minLoop_ << maxLoop_ << massOption_ << alpha_ << prefactor_ << power_ << pregg_ << preqg_ << pregqbar_ << ounit( minpT_, GeV ) << ggPow_ << qgPow_ << enhance_ << channelwgtA_ << channelwgtB_ << channelWeights_ << mu_R_opt_ << mu_F_opt_ << spinCorrelations_; } void MEPP2Higgs::persistentInput(PersistentIStream & is, int) { is >> HGGVertex_ >> HFFVertex_ >> shapeOption_ >> processOption_ >> minFlavour_ >> maxFlavour_ >> hmass_ >> iunit(mh_,GeV) >> iunit(wh_,GeV) >> minLoop_ >> maxLoop_ >> massOption_ >> alpha_ >> prefactor_ >> power_ >> pregg_ >> preqg_ >> pregqbar_ >> iunit( minpT_, GeV ) >> ggPow_ >> qgPow_ >> enhance_ >> channelwgtA_ >> channelwgtB_ >> channelWeights_ >> mu_R_opt_ >> mu_F_opt_ >> spinCorrelations_; } void MEPP2Higgs::Init() { static ClassDocumentation documentation ("The MEPP2Higgs class implements the matrix elements for" " Higgs production (with decay H->W-W+) in hadron-hadron collisions" " including the generation of additional hard QCD radiation in " "gg to h0 processes in the POWHEG scheme", "Hard QCD radiation for $gg\\to h^0$ processes in the" " POWHEG scheme \\cite{Hamilton:2009za}.", "%\\cite{Hamilton:2009za}\n" "\\bibitem{Hamilton:2009za}\n" " K.~Hamilton, P.~Richardson and J.~Tully,\n" " ``A Positive-Weight Next-to-Leading Order Monte Carlo Simulation for Higgs\n" " Boson Production,''\n" " JHEP {\\bf 0904}, 116 (2009)\n" " [arXiv:0903.4345 [hep-ph]].\n" " %%CITATION = JHEPA,0904,116;%%\n"); static Switch interfaceFactorizationScaleOption ("FactorizationScaleOption", "Option for the choice of factorization scale", &MEPP2Higgs::scaleopt_, 1, false, false); static SwitchOption interfaceDynamic (interfaceFactorizationScaleOption, "Dynamic", "Dynamic factorization scale equal to the current sqrt(sHat())", 1); static SwitchOption interfaceFixed (interfaceFactorizationScaleOption, "Fixed", "Use a fixed factorization scale set with FactorizationScaleValue", 2); static Parameter interfaceFactorizationScaleValue ("FactorizationScaleValue", "Value to use in the event of a fixed factorization scale", &MEPP2Higgs::mu_F_, GeV, 100.0*GeV, 50.0*GeV, 500.0*GeV, true, false, Interface::limited); static Reference interfaceCoupling ("Coupling", "Pointer to the object to calculate the coupling for the correction", &MEPP2Higgs::alpha_, false, false, true, false, false); static Switch interfaceShapeOption ("ShapeScheme", "Option for the treatment of the Higgs resonance shape", &MEPP2Higgs::shapeOption_, 1, false, false); static SwitchOption interfaceStandardShapeFixed (interfaceShapeOption, "FixedBreitWigner", "Breit-Wigner s-channel resonanse", 1); static SwitchOption interfaceStandardShapeRunning (interfaceShapeOption, "MassGenerator", "Use the mass generator to give the shape", 2); static Switch interfaceProcess ("Process", "Which subprocesses to include", &MEPP2Higgs::processOption_, 1, false, false); static SwitchOption interfaceProcessAll (interfaceProcess, "All", "Include all subprocesses", 1); static SwitchOption interfaceProcess1 (interfaceProcess, "qqbar", "Only include the incoming q qbar subprocess", 2); static SwitchOption interfaceProcessgg (interfaceProcess, "gg", "Only include the incoming gg subprocess", 3); static Parameter interfaceMinimumInLoop ("MinimumInLoop", "The minimum flavour of the quarks to include in the loops", &MEPP2Higgs::minLoop_, 6, 5, 6, false, false, Interface::limited); static Parameter interfaceMaximumInLoop ("MaximumInLoop", "The maximum flavour of the quarks to include in the loops", &MEPP2Higgs::maxLoop_, 6, 5, 6, false, false, Interface::limited); static Switch interfaceMassOption ("MassOption", "Option for the treatment of the masses in the loop diagrams", &MEPP2Higgs::massOption_, 0, false, false); static SwitchOption interfaceMassOptionFull (interfaceMassOption, "Full", "Include the full mass dependence", 0); static SwitchOption interfaceMassOptionLarge (interfaceMassOption, "Large", "Use the heavy mass limit", 1); static Parameter interfaceMinimumFlavour ("MinimumFlavour", "The minimum flavour of the incoming quarks in the hard process", &MEPP2Higgs::minFlavour_, 4, 3, 5, false, false, Interface::limited); static Parameter interfaceMaximumFlavour ("MaximumFlavour", "The maximum flavour of the incoming quarks in the hard process", &MEPP2Higgs::maxFlavour_, 5, 3, 5, false, false, Interface::limited); static Parameter interfaceQGChannelWeight ("QGChannelWeight", "The relative weights of the g g and q g channels for selection." " This is a technical parameter for the phase-space generation and " "should not affect the results only the efficiency and fraction" " of events with weight > 1.", &MEPP2Higgs::channelwgtA_, 0.45, 0., 1.e10, false, false, Interface::limited); static Parameter interfaceQbarGChannelWeight ("QbarGChannelWeight", "The relative weights of the g g abd qbar g channels for selection." " This is a technical parameter for the phase-space generation and " "should not affect the results only the efficiency and fraction", &MEPP2Higgs::channelwgtB_, 0.15, 0., 1.e10, false, false, Interface::limited); static Parameter interfaceGGPower ("GGPower", "Power for the phase-space sampling of the gg channel", &MEPP2Higgs::ggPow_, 1.6, 1.0, 3.0, false, false, Interface::limited); static Parameter interfaceQGPower ("QGPower", "Power for the phase-space sampling of the qg and qbarg channels", &MEPP2Higgs::qgPow_, 1.6, 1.0, 3.0, false, false, Interface::limited); static Parameter interfaceEnhancementFactor ("InitialEnhancementFactor", "The enhancement factor for initial-state radiation in the shower to ensure" " the weight for the matrix element correction is less than one.", &MEPP2Higgs::enhance_, 1.1, 1.0, 10.0, false, false, Interface::limited); static Parameter interfacePower ("Power", "The power for the sampling of the matrix elements", &MEPP2Higgs::power_, 2.0, 1.0, 10.0, false, false, Interface::limited); static Parameter interfacePrefactorgg ("Prefactorgg", "The prefactor for the sampling of the q qbar channel", &MEPP2Higgs::pregg_, 7.0, 0.0, 1000.0, false, false, Interface::limited); static Parameter interfacePrefactorqg ("Prefactorqg", "The prefactor for the sampling of the q g channel", &MEPP2Higgs::preqg_, 3.0, 0.0, 1000.0, false, false, Interface::limited); static Parameter interfacePrefactorgqbar ("Prefactorgqbar", "The prefactor for the sampling of the g qbar channel", &MEPP2Higgs::pregqbar_, 3.0, 0.0, 1000.0, false, false, Interface::limited); static Parameter interfacePtMin ("minPt", "The pt cut on hardest emision generation" "2*(1-Beta)*exp(-sqr(intrinsicpT/RMS))/sqr(RMS)", &MEPP2Higgs::minpT_, GeV, 2.*GeV, ZERO, 100000.0*GeV, false, false, Interface::limited); static Switch interface_mu_R_Option ("mu_R_Option", "Option to use pT or mT as the scale in alphaS", &MEPP2Higgs::mu_R_opt_, 1, false, false); static SwitchOption interface_mu_R_Option_mT (interface_mu_R_Option, "mT", "Use mT as the scale in alpha_S", 0); static SwitchOption interface_mu_R_Option_pT (interface_mu_R_Option, "pT", "Use pT as the scale in alpha_S", 1); static Switch interface_mu_F_Option ("mu_F_Option", "Option to use pT or mT as the factorization scale in the PDFs", &MEPP2Higgs::mu_F_opt_, 1, false, false); static SwitchOption interface_mu_F_Option_mT (interface_mu_F_Option, "mT", "Use mT as the scale in the PDFs", 0); static SwitchOption interface_mu_F_Option_pT (interface_mu_F_Option, "pT", "Use pT as the scale in the PDFs", 1); static Switch interfaceSpinCorrelations ("SpinCorrelations", "Which on/off spin correlations in the hard process", &MEPP2Higgs::spinCorrelations_, true, false, false); static SwitchOption interfaceSpinCorrelationsYes (interfaceSpinCorrelations, "Yes", "Switch correlations on", true); static SwitchOption interfaceSpinCorrelationsNo (interfaceSpinCorrelations, "No", "Switch correlations off", false); } void MEPP2Higgs::doinit() { HwMEBase::doinit(); // get the vertex pointers from the SM object tcHwSMPtr theSM = dynamic_ptr_cast(standardModel()); // do the initialisation if(!theSM) { throw InitException() << "Wrong type of StandardModel object in MEPP2Higgs::doinit()," << " the Herwig version must be used" << Exception::runerror; } HGGVertex_ = theSM->vertexHGG(); HFFVertex_ = theSM->vertexFFH(); // get the mass generator for the higgs PDPtr h0 = getParticleData(ParticleID::h0); mh_ = h0->mass(); wh_ = h0->generateWidth(mh_); if(h0->massGenerator()) { hmass_=dynamic_ptr_cast(h0->massGenerator()); } if(shapeOption_==2&&!hmass_) throw InitException() << "If using the mass generator for the line shape in MEPP2Higgs::doinit()" << "the mass generator must be an instance of the GenericMassGenerator class" << Exception::runerror; // stuff for the ME correction double total = 1.+channelwgtA_+channelwgtB_; channelWeights_.push_back(1./total); channelWeights_.push_back(channelWeights_.back()+channelwgtA_/total); channelWeights_.push_back(channelWeights_.back()+channelwgtB_/total); // insert the different prefactors in the vector for easy look up prefactor_.push_back(pregg_); prefactor_.push_back(preqg_); prefactor_.push_back(preqg_); prefactor_.push_back(pregqbar_); prefactor_.push_back(pregqbar_); } void MEPP2Higgs::dofinish() { HwMEBase::dofinish(); if(ntry_==0) return; generator()->log() << "MEPP2Higgs when applying the hard correction " << "generated " << ntry_ << " trial emissions of which " << ngen_ << " were accepted\n"; if(nover_==0) return; generator()->log() << "MEPP2Higgs when applying the hard correction " << nover_ << " weights larger than one were generated of which" << " the largest was " << maxwgt_ << "\n"; } unsigned int MEPP2Higgs::orderInAlphaS() const { return 2; } unsigned int MEPP2Higgs::orderInAlphaEW() const { return 1; } Energy2 MEPP2Higgs::scale() const { return scaleopt_ == 1 ? sHat() : sqr(mu_F_); } int MEPP2Higgs::nDim() const { return 0; } bool MEPP2Higgs::generateKinematics(const double *) { Lorentz5Momentum pout = meMomenta()[0] + meMomenta()[1]; pout.rescaleMass(); meMomenta()[2].setMass(pout.mass()); meMomenta()[2] = LorentzMomentum(pout.x(),pout.y(),pout.z(),pout.t()); jacobian(1.0); // check whether it passes all the cuts: returns true if it does vector out(1,meMomenta()[2]); tcPDVector tout(1,mePartonData()[2]); return lastCuts().passCuts(tout, out, mePartonData()[0], mePartonData()[1]); } void MEPP2Higgs::getDiagrams() const { tcPDPtr h0=getParticleData(ParticleID::h0); // gg -> H process if(processOption_==1||processOption_==3) { tcPDPtr g=getParticleData(ParticleID::g); add(new_ptr((Tree2toNDiagram(2), g, g, 1, h0, -1))); } // q qbar -> H processes if(processOption_==1||processOption_==2) { for ( int i = minFlavour_; i <= maxFlavour_; ++i ) { tcPDPtr q = getParticleData(i); tcPDPtr qb = q->CC(); add(new_ptr((Tree2toNDiagram(2), q, qb, 1, h0, -2))); } } } CrossSection MEPP2Higgs::dSigHatDR() const { using Constants::pi; InvEnergy2 bwfact; if(shapeOption_==1) { bwfact = mePartonData()[2]->generateWidth(sqrt(sHat()))*sqrt(sHat())/pi/ (sqr(sHat()-sqr(mh_))+sqr(mh_*wh_)); } else { bwfact = hmass_->BreitWignerWeight(sqrt(sHat())); } double cs = me2() * jacobian() * pi * double(UnitRemoval::E4 * bwfact/sHat()); return UnitRemoval::InvE2 * sqr(hbarc) * cs; } double MEPP2Higgs::me2() const { double output(0.0); ScalarWaveFunction hout(meMomenta()[2],mePartonData()[2],outgoing); // Safety code to garantee the reliable behaviour of Higgs shape limits // (important for heavy and broad Higgs resonance). Energy hmass = meMomenta()[2].m(); tcPDPtr h0 = mePartonData()[2]; Energy mass = h0->mass(); Energy halfmass = .5*mass; if (.0*GeV > hmass) return 0.0; // stricly speaking the condition is applicable if // h0->widthUpCut() == h0->widthLoCut()... if (h0->widthLoCut() > halfmass) { if ( mass + h0->widthUpCut() < hmass || mass - h0->widthLoCut() > hmass ) return 0.0; } else { if (mass + halfmass < hmass || halfmass > hmass) return 0.0; } if (mePartonData()[0]->id() == ParticleID::g && mePartonData()[1]->id() == ParticleID::g) { VectorWaveFunction gin1(meMomenta()[0],mePartonData()[0],incoming); VectorWaveFunction gin2(meMomenta()[1],mePartonData()[1],incoming); vector g1,g2; for(unsigned int i = 0; i < 2; ++i) { gin1.reset(2*i); g1.push_back(gin1); gin2.reset(2*i); g2.push_back(gin2); } output = ggME(g1,g2,hout,false); } else { if (mePartonData()[0]->id() == -mePartonData()[1]->id()) { SpinorWaveFunction qin (meMomenta()[0],mePartonData()[0],incoming); SpinorBarWaveFunction qbin(meMomenta()[1],mePartonData()[1],incoming); vector fin; vector ain; for (unsigned int i = 0; i < 2; ++i) { qin.reset(i); fin.push_back(qin); qbin.reset(i); ain.push_back(qbin); } output = qqME(fin,ain,hout,false); } else assert(false); } return output; } Selector MEPP2Higgs::diagrams(const DiagramVector & diags) const { Selector sel; for (DiagramIndex i = 0; i < diags.size(); ++i) sel.insert(1.0, i); return sel; } Selector MEPP2Higgs::colourGeometries(tcDiagPtr diag) const { // colour lines static const ColourLines line1("1 -2,2 -1"); static const ColourLines line2("1 -2"); // select the colour flow Selector sel; if (diag->id() == -1) { sel.insert(1.0, &line1); } else { sel.insert(1.0, &line2); } // return the answer return sel; } void MEPP2Higgs::constructVertex(tSubProPtr sub) { if(!spinCorrelations_) return; // extract the particles in the hard process ParticleVector hard; hard.push_back(sub->incoming().first); hard.push_back(sub->incoming().second); hard.push_back(sub->outgoing()[0]); if(hard[0]->id() < hard[1]->id()) { swap(hard[0],hard[1]); } // identify the process and calculate the matrix element if(hard[0]->id() == ParticleID::g && hard[1]->id() == ParticleID::g) { vector g1,g2; vector q; vector qbar; VectorWaveFunction (g1,hard[0],incoming,false,true,true); VectorWaveFunction (g2,hard[1],incoming,false,true,true); ScalarWaveFunction hout(hard[2],outgoing,true); g1[1] = g1[2]; g2[1] = g2[2]; ggME(g1,g2,hout,true); } else { vector q1; vector q2; SpinorWaveFunction (q1,hard[0],incoming,false,true); SpinorBarWaveFunction (q2,hard[1],incoming,false,true); ScalarWaveFunction hout(hard[2],outgoing,true); qqME(q1,q2,hout,true); } // construct the vertex HardVertexPtr hardvertex = new_ptr(HardVertex()); // set the matrix element for the vertex hardvertex->ME(me_); // set the pointers and to and from the vertex for(unsigned int i = 0; i < 3; ++i) hard[i]->spinInfo()->productionVertex(hardvertex); } double MEPP2Higgs::ggME(vector g1, vector g2, ScalarWaveFunction & in, bool calc) const { ProductionMatrixElement newme(PDT::Spin1,PDT::Spin1,PDT::Spin0); Energy2 s(sHat()); double me2(0.0); for(int i = 0; i < 2; ++i) { for(int j = 0; j < 2; ++j) { Complex diag = HGGVertex_->evaluate(s,g1[i],g2[j],in); me2 += norm(diag); if(calc) newme(2*i, 2*j, 0) = diag; } } if(calc) me_.reset(newme); // initial colour and spin factors: colour -> (8/64) and spin -> (1/4) return me2/32.; } double MEPP2Higgs::qqME(vector & fin, vector & ain, ScalarWaveFunction & in, bool calc) const { ProductionMatrixElement newme(PDT::Spin1Half,PDT::Spin1Half,PDT::Spin0); Energy2 s(scale()); double me2(0.0); for(int i = 0; i < 2; ++i) { for(int j = 0; j < 2; ++j) { Complex diag = HFFVertex_->evaluate(s,fin[i],ain[j],in); me2+=norm(diag); if(calc) newme(i, j, 0) = diag; } } if(calc) me_.reset(newme); // final colour/spin factors return me2/12.; } void MEPP2Higgs::applyHardMatrixElementCorrection(ShowerTreePtr tree) { useMe(); assert(tree->outgoingLines().size()==1); if(tree->incomingLines().begin()->second->id()!=ParticleID::g) return; // get gluons and Higgs // get the gluons map::const_iterator cit; ShowerParticleVector incoming; vector beams; for(cit=tree->incomingLines().begin();cit!=tree->incomingLines().end();++cit) { incoming.push_back(cit->first->progenitor()); beams.push_back(cit->first->beam()); } if(incoming[0]->momentum().z()outgoingLines().begin()->first->copy(); // calculate the momenta unsigned int iemit,itype; vector pnew; pair xnew; // if not accepted return tPDPtr out; if(!applyHard(incoming,beams,higgs,iemit,itype,pnew,xnew,out)) return; // if applying ME correction create the new particles if(itype==0) { // ensure gluon can be put on shell Lorentz5Momentum ptest(pnew[2]); if(ptest.boost(-(pnew[0]+pnew[1]).boostVector()).e() < getParticleData(ParticleID::g)->constituentMass()) return; // create the new gluon PPtr newg= getParticleData(ParticleID::g)->produceParticle(pnew[2]); PPtr newg1,newg2; ColinePtr col; bool colour = UseRandom::rndbool(); // make the new particles if(iemit==0) { newg1 = incoming[0]->dataPtr()->produceParticle(pnew[0]); if(colour) { col = incoming[0]->colourLine(); incoming[0]->antiColourLine()->addAntiColoured(newg1); } else { col = incoming[0]->antiColourLine(); incoming[0]->colourLine()->addColoured(newg1); } newg2 = new_ptr(Particle(*incoming[1])); col->removeColoured(newg2,colour); newg2->set5Momentum(pnew[1]); } else { newg2 = incoming[1]->dataPtr()->produceParticle(pnew[1]); if(colour) { col= incoming[1]->antiColourLine(); incoming[1]->colourLine()->addColoured(newg2); } else { col= incoming[1]->colourLine(); incoming[1]->antiColourLine()->addAntiColoured(newg2); } newg1 = new_ptr(Particle(*incoming[0])); col->removeColoured(newg1,!colour); newg1->set5Momentum(pnew[0]); } // set the colour lines ColinePtr newline=new_ptr(ColourLine()); if(iemit==0) { newline->addColoured(newg1,!colour); newline->addColoured(newg ,!colour); col ->addColoured(newg , colour); col ->addColoured(newg2, colour); } else { newline->addColoured(newg2, colour); newline->addColoured(newg , colour); col ->addColoured(newg ,!colour); col ->addColoured(newg1,!colour); } // change the existing gluons PPtr orig; for(cit=tree->incomingLines().begin();cit!=tree->incomingLines().end();++cit) { // remove old particles from colour line ColinePtr l1=cit->first->copy()-> colourLine(); ColinePtr l2=cit->first->copy()->antiColourLine(); l1->removeColoured (cit->first->copy() ); l1->removeColoured (cit->first->progenitor()); l2->removeAntiColoured(cit->first->copy() ); l2->removeAntiColoured(cit->first->progenitor()); if(cit->first->progenitor()->momentum().z()/newg1->momentum().z()>0) { // insert new particles cit->first->copy(newg1); ShowerParticlePtr sp(new_ptr(ShowerParticle(*newg1,1,false))); sp->x(xnew.first); cit->first->progenitor(sp); tree->incomingLines()[cit->first]=sp; cit->first->perturbative(iemit!=0); if(iemit==0) orig=cit->first->original(); } else { // insert new particles cit->first->copy(newg2); ShowerParticlePtr sp(new_ptr(ShowerParticle(*newg2,1,false))); sp->x(xnew.second); cit->first->progenitor(sp); tree->incomingLines()[cit->first]=sp; cit->first->perturbative(iemit==0); if(iemit==1) orig=cit->first->original(); } } // fix the momentum of the higgs map::const_iterator cjt=tree->outgoingLines().begin(); Boost boostv=cjt->first->progenitor()->momentum().findBoostToCM(); LorentzRotation trans(pnew[3].boostVector()); trans *=LorentzRotation(boostv); cjt->first->progenitor()->transform(trans); cjt->first->copy()->transform(trans); tree->hardMatrixElementCorrection(true); // add the gluon ShowerParticlePtr sg=new_ptr(ShowerParticle(*newg,1,true)); ShowerProgenitorPtr gluon=new_ptr(ShowerProgenitor(orig,newg,sg)); gluon->perturbative(false); tree->outgoingLines().insert(make_pair(gluon,sg)); } else if(itype==1) { // ensure outgoing quark can be put on-shell Lorentz5Momentum ptest(pnew[2]); if(ptest.boost(-(pnew[0]+pnew[1]).boostVector()).e() < out->constituentMass()) return; // create the new particles PPtr newqout = out->produceParticle(pnew[2]); PPtr newqin,newg; if(iemit==0) { newqin = out ->produceParticle(pnew[0]); newg = new_ptr(Particle(*incoming[1])); newg->set5Momentum(pnew[1]); incoming[0]->colourLine() ->addColoured(newqin); incoming[0]->antiColourLine()->addColoured(newqout); } else { newg = new_ptr(Particle(*incoming[0])); newg->set5Momentum(pnew[0]); newqin = out ->produceParticle(pnew[1]); incoming[1]->colourLine() ->addColoured(newqin); incoming[1]->antiColourLine()->addColoured(newqout); } // change the existing incoming partons PPtr orig; for(cit=tree->incomingLines().begin();cit!=tree->incomingLines().end();++cit) { // remove old particles from colour line ColinePtr l1=cit->first->copy()-> colourLine(); ColinePtr l2=cit->first->copy()->antiColourLine(); l1->removeColoured (cit->first->copy() ); l1->removeColoured (cit->first->progenitor()); l2->removeAntiColoured(cit->first->copy() ); l2->removeAntiColoured(cit->first->progenitor()); if(cit->first->progenitor()->momentum().z()/newqin->momentum().z()>0.) { // insert new particles cit->first->copy(newqin); ShowerParticlePtr sp(new_ptr(ShowerParticle(*newqin,1,false))); sp->x(iemit==0 ? xnew.first : xnew.second ); cit->first->progenitor(sp); tree->incomingLines()[cit->first]=sp; cit->first->perturbative(false); orig=cit->first->original(); } else { // insert new particles cit->first->copy(newg); ShowerParticlePtr sp(new_ptr(ShowerParticle(*newg,1,false))); sp->x(iemit==1 ? xnew.first : xnew.second ); cit->first->progenitor(sp); tree->incomingLines()[cit->first]=sp; cit->first->perturbative(true); } } // fix the momentum of the higgs map::const_iterator cjt=tree->outgoingLines().begin(); Boost boostv=cjt->first->progenitor()->momentum().findBoostToCM(); LorentzRotation trans(pnew[3].boostVector()); trans *=LorentzRotation(boostv); cjt->first->progenitor()->transform(trans); cjt->first->copy()->transform(trans); tree->hardMatrixElementCorrection(true); // add the outgoing quark ShowerParticlePtr sout=new_ptr(ShowerParticle(*newqout,1,true)); ShowerProgenitorPtr out=new_ptr(ShowerProgenitor(orig,newqout,sout)); out->perturbative(false); tree->outgoingLines().insert(make_pair(out,sout)); } else if(itype==2) { // ensure outgoing antiquark can be put on-shell Lorentz5Momentum ptest(pnew[2]); if(ptest.boost(-(pnew[0]+pnew[1]).boostVector()).e() < incoming[0]->dataPtr()->constituentMass()) return; // create the new particles PPtr newqout = out->produceParticle(pnew[2]); PPtr newqin,newg; if(iemit==0) { newqin = out ->produceParticle(pnew[0]); newg = new_ptr(Particle(*incoming[1])); newg->set5Momentum(pnew[1]); incoming[0]->colourLine() ->addAntiColoured(newqout); incoming[0]->antiColourLine()->addAntiColoured(newqin); } else { newg = new_ptr(Particle(*incoming[0])); newg->set5Momentum(pnew[0]); newqin = out ->produceParticle(pnew[1]); incoming[1]->colourLine() ->addAntiColoured(newqout); incoming[1]->antiColourLine()->addAntiColoured(newqin); } // change the existing incoming partons PPtr orig; for(cit=tree->incomingLines().begin();cit!=tree->incomingLines().end();++cit) { // remove old particles from colour line ColinePtr l1=cit->first->copy()-> colourLine(); ColinePtr l2=cit->first->copy()->antiColourLine(); l1->removeColoured (cit->first->copy() ); l1->removeColoured (cit->first->progenitor()); l2->removeAntiColoured(cit->first->copy() ); l2->removeAntiColoured(cit->first->progenitor()); if(cit->first->progenitor()->momentum().z()/newqin->momentum().z()>0.) { // insert new particles cit->first->copy(newqin); ShowerParticlePtr sp(new_ptr(ShowerParticle(*newqin,1,false))); sp->x(iemit==0 ? xnew.first : xnew.second ); cit->first->progenitor(sp); tree->incomingLines()[cit->first]=sp; cit->first->perturbative(false); orig=cit->first->original(); } else { // insert new particles cit->first->copy(newg); ShowerParticlePtr sp(new_ptr(ShowerParticle(*newg,1,false))); sp->x(iemit==1 ? xnew.first : xnew.second ); cit->first->progenitor(sp); tree->incomingLines()[cit->first]=sp; cit->first->perturbative(true); } } // fix the momentum of the higgs map::const_iterator cjt=tree->outgoingLines().begin(); Boost boostv=cjt->first->progenitor()->momentum().findBoostToCM(); LorentzRotation trans(pnew[3].boostVector()); trans *=LorentzRotation(boostv); cjt->first->progenitor()->transform(trans); cjt->first->copy()->transform(trans); tree->hardMatrixElementCorrection(true); // add the outgoing antiquark ShowerParticlePtr sout=new_ptr(ShowerParticle(*newqout,1,true)); ShowerProgenitorPtr out=new_ptr(ShowerProgenitor(orig,newqout,sout)); out->perturbative(false); tree->outgoingLines().insert(make_pair(out,sout)); } } bool MEPP2Higgs::softMatrixElementVeto(ShowerProgenitorPtr initial, ShowerParticlePtr parent,Branching br) { if(parent->isFinalState()) return false; // check if me correction should be applied long id[2]={initial->id(),parent->id()}; // must have started as a gluon if(id[0]!=ParticleID::g) return false; // must be a gluon going into the hard process - if(br.ids[1]!=ParticleID::g) return false; + if(br.ids[1]->id()!=ParticleID::g) return false; // get the pT Energy pT=br.kinematics->pT(); // check if hardest so far if(pThighestpT()) return false; // compute the invariants double kappa(sqr(br.kinematics->scale())/mh2_),z(br.kinematics->z()); Energy2 shat(mh2_/z*(1.+(1.-z)*kappa)),that(-(1.-z)*kappa*mh2_),uhat(-(1.-z)*shat); // check which type of process Energy2 me; // g g - if(br.ids[0]==ParticleID::g&&br.ids[2]==ParticleID::g) { + if(br.ids[0]->id()==ParticleID::g&&br.ids[2]->id()==ParticleID::g) { double split = 6.*(z/(1.-z)+(1.-z)/z+z*(1.-z)); me = ggME(shat,that,uhat)/split; } // q g - else if(br.ids[0] >= 1 && br.ids[0] <= 5 && br.ids[2]==br.ids[0]) { + else if(br.ids[0]->id() >= 1 && br.ids[0]->id() <= 5 && br.ids[2]->id()==br.ids[0]->id()) { double split = 4./3./z*(1.+sqr(1.-z)); me = qgME(shat,uhat,that)/split; } // qbar g - else if(br.ids[0] <= -1 && br.ids[0] >= -5 && br.ids[2]==br.ids[0]) { + else if(br.ids[0]->id() <= -1 && br.ids[0]->id() >= -5 && br.ids[2]->id()==br.ids[0]->id()) { double split = 4./3./z*(1.+sqr(1.-z)); me = qbargME(shat,uhat,that)/split; } else { return false; } InvEnergy2 pre = 0.125/Constants::pi/loME()*sqr(mh2_)*that/shat/(shat+uhat); double wgt = -pre*me/enhance_; if(wgt<.0||wgt>1.) generator()->log() << "Soft ME correction weight too large or " << "negative in MEPP2Higgs::" << "softMatrixElementVeto()\n soft weight " << " sbar = " << shat/mh2_ << " tbar = " << that/mh2_ << "weight = " << wgt << " for " - << br.ids[0] << " " << br.ids[1] << " " - << br.ids[2] << "\n"; + << br.ids[0]->id() << " " << br.ids[1]->id() << " " + << br.ids[2]->id() << "\n"; // if not vetoed if(UseRandom::rndbool(wgt)) return false; // otherwise parent->vetoEmission(br.type,br.kinematics->scale()); return true; } HardTreePtr MEPP2Higgs::generateHardest(ShowerTreePtr tree, ShowerInteraction::Type inter) { // check if generating QCD radiation if(inter!=ShowerInteraction::QCD && inter!=ShowerInteraction::QEDQCD && inter!=ShowerInteraction::ALL) return HardTreePtr(); if(tree->incomingLines().begin()->second->id()!=ParticleID::g) return HardTreePtr(); useMe(); // get the particles to be showered beams_.clear(); partons_.clear(); // find the incoming particles ShowerParticleVector incoming; map::const_iterator cit; vector particlesToShower; for( cit = tree->incomingLines().begin(); cit != tree->incomingLines().end(); ++cit ) { incoming.push_back( cit->first->progenitor() ); beams_.push_back( cit->first->beam() ); partons_.push_back( cit->first->progenitor()->dataPtr() ); particlesToShower.push_back( cit->first ); } // find the higgs boson PPtr higgs; if(tree->outgoingLines().size() == 1) { higgs = tree->outgoingLines().begin()->first->copy(); } else { higgs = tree->outgoingLines().begin()->first->copy()->parents()[0]; } // calculate the rapidity of the higgs yh_ = 0.5 * log((higgs->momentum().e()+higgs->momentum().z())/ (higgs->momentum().e()-higgs->momentum().z())); mass_=higgs->mass(); mh2_ = sqr(mass_); vector pnew; int emission_type(-1); // generate the hard emission and return if no emission if(!getEvent(pnew,emission_type)) { for(unsigned int ix=0;ixmaximumpT(minpT_,ShowerInteraction::QCD); return HardTreePtr(); } // construct the HardTree object needed to perform the showers ShowerParticleVector newparticles(4); // create the partons int iemit=-1; // g g -> h g if(emission_type==0) { newparticles[0] = new_ptr(ShowerParticle(partons_[0] ,false)); newparticles[1] = new_ptr(ShowerParticle(partons_[1] ,false)); iemit = pnew[0].z()/pnew[3].z()>0. ? 0 : 1; } // g q -> H q else if(emission_type==1) { newparticles[0] = new_ptr(ShowerParticle(partons_[0] ,false)); newparticles[1] = new_ptr(ShowerParticle(out_ ,false)); iemit = 1; } // q g -> H q else if(emission_type==2) { newparticles[0] = new_ptr(ShowerParticle(out_ ,false)); newparticles[1] = new_ptr(ShowerParticle(partons_[1] ,false)); iemit = 0; } // g qbar -> H qbar else if(emission_type==3) { newparticles[0] = new_ptr(ShowerParticle(partons_[0] ,false)); newparticles[1] = new_ptr(ShowerParticle(out_ ,false)); iemit = 1; } // qbar g -> H qbar else if(emission_type==4) { newparticles[0] = new_ptr(ShowerParticle(out_ ,false)); newparticles[1] = new_ptr(ShowerParticle(partons_[1] ,false)); iemit = 0; } unsigned int ispect = iemit==0 ? 1 : 0; // create the jet newparticles[3] = new_ptr(ShowerParticle(out_ , true)); // create the boson newparticles[2] = new_ptr(ShowerParticle(higgs->dataPtr(),true)); // set the momenta for(unsigned int ix=0;ix<4;++ix) newparticles[ix]->set5Momentum(pnew[ix]); // create the off-shell particle Lorentz5Momentum poff=pnew[iemit]-pnew[3]; poff.rescaleMass(); newparticles.push_back(new_ptr(ShowerParticle(partons_[iemit],false))); newparticles.back()->set5Momentum(poff); vector inBranch,hardBranch; // create the branchings for the incoming particles inBranch.push_back(new_ptr(HardBranching(newparticles[0],SudakovPtr(), HardBranchingPtr(),HardBranching::Incoming))); inBranch.push_back(new_ptr(HardBranching(newparticles[1],SudakovPtr(), HardBranchingPtr(),HardBranching::Incoming))); // intermediate IS particle hardBranch.push_back(new_ptr(HardBranching(newparticles[4],SudakovPtr(), inBranch[iemit],HardBranching::Incoming))); inBranch[iemit]->addChild(hardBranch.back()); // create the branching for the emitted jet inBranch[iemit]->addChild(new_ptr(HardBranching(newparticles[3],SudakovPtr(), inBranch[iemit],HardBranching::Outgoing))); ColinePtr cline1 = new_ptr(ColourLine()); ColinePtr cline2 = new_ptr(ColourLine()); ColinePtr cline3 = new_ptr(ColourLine()); if(newparticles[3]->id()<0|| (newparticles[3]->id()==ParticleID::g&&UseRandom::rndbool())) { inBranch[iemit]->type(ShowerPartnerType::QCDColourLine); cline1->addAntiColoured(newparticles[3]); cline1->addColoured (newparticles[4]); cline1->addAntiColoured(newparticles[ispect]); cline2->addColoured (newparticles[ispect]); cline2->addAntiColoured(newparticles[4]); cline2->addAntiColoured(newparticles[iemit]); if(newparticles[3]->id()==ParticleID::g) { cline3->addColoured(newparticles[iemit]); cline3->addColoured(newparticles[3]); } } else { inBranch[iemit]->type(ShowerPartnerType::QCDAntiColourLine); cline1->addColoured (newparticles[3]); cline1->addAntiColoured(newparticles[4]); cline1->addColoured (newparticles[ispect]); cline2->addAntiColoured(newparticles[ispect]); cline2->addColoured (newparticles[4]); cline2->addColoured (newparticles[iemit]); if(newparticles[3]->id()==ParticleID::g) { cline3->addAntiColoured(newparticles[iemit]); cline3->addAntiColoured(newparticles[3]); } } // set the colour partners hardBranch.back()->colourPartner(inBranch[iemit==0 ? 1 : 0]); inBranch[iemit==0 ? 1 : 0]->colourPartner(hardBranch.back()); // add other particle hardBranch.push_back(inBranch[iemit==0 ? 1 : 0]); // outgoing Higgs boson hardBranch.push_back(new_ptr(HardBranching(newparticles[2],SudakovPtr(), HardBranchingPtr(),HardBranching::Outgoing))); // make the tree HardTreePtr hardtree=new_ptr(HardTree(hardBranch,inBranch,ShowerInteraction::QCD)); // connect the ShowerParticles with the branchings // and set the maximum pt for the radiation set hard=hardtree->branchings(); for(unsigned int ix=0;ixmaximumpT(minpT_,ShowerInteraction::QCD); else particlesToShower[ix]->maximumpT(pt_,ShowerInteraction::QCD); for(set::const_iterator mit=hard.begin(); mit!=hard.end();++mit) { if(particlesToShower[ix]->progenitor()->id()==(*mit)->branchingParticle()->id()&& (( particlesToShower[ix]->progenitor()->isFinalState()&& (**mit).status()==HardBranching::Outgoing)|| (!particlesToShower[ix]->progenitor()->isFinalState()&& (**mit).status()==HardBranching::Incoming))) { if(particlesToShower[ix]->progenitor()->momentum().z()/ (*mit)->branchingParticle()->momentum().z()<0.) continue; hardtree->connect(particlesToShower[ix]->progenitor(),*mit); if((**mit).status()==HardBranching::Incoming) { (*mit)->beam(particlesToShower[ix]->original()->parents()[0]); } HardBranchingPtr parent=(*mit)->parent(); while(parent) { parent->beam(particlesToShower[ix]->original()->parents()[0]); parent=parent->parent(); }; } } } // return the answer return hardtree; } bool MEPP2Higgs::applyHard(ShowerParticleVector gluons, vector beams,PPtr higgs, unsigned int & iemit, unsigned int & itype, vector & pnew, pair & xout, tPDPtr & out) { ++ntry_; // calculate the limits on s Energy mh(higgs->mass()); mh2_=sqr(mh); Energy2 smin=mh2_; Energy2 s= (generator()->currentEvent()->incoming().first->momentum()+ generator()->currentEvent()->incoming().second->momentum()).m2(); Energy2 smax(s); // calculate the rapidity of the higgs double yH = 0.5*log((higgs->momentum().e()+higgs->momentum().z())/ (higgs->momentum().e()-higgs->momentum().z())); // if no phase-space return if(smaxx(); assert(beams[ix]); pdf[ix]=beams[ix]->pdf(); assert(pdf[ix]); fx[ix]=pdf[ix]->xfx(beams[ix],gluons[ix]->dataPtr(),mh2_,x[ix]); } // leading order ME Energy4 lome = loME(); // select the type of process and generate the kinematics double rn(UseRandom::rnd()); Energy2 shat(ZERO),uhat(ZERO),that(ZERO); double weight(0.),xnew[2]={1.,1.}; // gg -> H g if(rn=1.||xnew[1]<=0.||xnew[1]>=1.) return false; for(unsigned int ix=0;ix<2;++ix) fxnew[ix]=pdf[ix]->xfx(beams[ix],gluons[ix]->dataPtr(),scale,xnew[ix]); // jacobian and me parts of the weight weight = jacobian2*ggME(shat,uhat,that)/lome*mh2_/sqr(shat); // pdf part of the weight weight *=fxnew[0]*fxnew[1]*x[0]*x[1]/(fx[0]*fx[1]*xnew[0]*xnew[1]); // finally coupling and different channel pieces weight *= 1./16./sqr(Constants::pi)*alpha_->value(scale)/channelWeights_[0]; itype=0; iemit = that>uhat ? 0 : 1; out = getParticleData(ParticleID::g); } // incoming quark or antiquark else { // generate the value of s according to 1/s^n double rhomax(pow(smin/mh2_,1.-qgPow_)),rhomin(pow(smax/mh2_,1.-qgPow_)); double rho = rhomin+UseRandom::rnd()*(rhomax-rhomin); shat = mh2_*pow(rho,1./(1.-qgPow_)); Energy2 jacobian = mh2_/(qgPow_-1.)*(rhomax-rhomin)*pow(shat/mh2_,qgPow_); double sbar=shat/mh2_; // calculate limits on that Energy2 tmax=mh2_*kappa[0]*(1.-sbar)/(kappa[0]+sbar); Energy2 tmin=shat*(1.-sbar)/(kappa[1]+sbar); // calculate the limits on uhat Energy2 umax(mh2_-shat-tmin),umin(mh2_-shat-tmax); // check inside phase space if(tmax=1.||xnew[1]<=0.||xnew[1]>=1.) return false; if(rn H q if(!order) { out = quarkFlavour(pdf[0],scale,xnew[0],beams[0],fxnew[0],false); fxnew[1]=pdf[1]->xfx(beams[1],gluons[1]->dataPtr(),scale,xnew[1]); iemit = 0; mewgt = out ? qgME(shat,uhat,that)/lome*mh2_/sqr(shat) : ZERO; } // g q -> H q else { fxnew[0]=pdf[0]->xfx(beams[0],gluons[0]->dataPtr(),scale,xnew[0]); out = quarkFlavour(pdf[1],scale,xnew[1],beams[1],fxnew[1],false); iemit = 1; mewgt = out ? qgME(shat,that,uhat)/lome*mh2_/sqr(shat) : ZERO; } jacobian2 /= (channelWeights_[1]-channelWeights_[0]); } else { itype=2; // qbar g -> H qbar if(!order) { out = quarkFlavour(pdf[0],scale,xnew[0],beams[0],fxnew[0],true); fxnew[1]=pdf[1]->xfx(beams[1],gluons[1]->dataPtr(),scale,xnew[1]); iemit = 0; mewgt = out ? qbargME(shat,uhat,that)/lome*mh2_/sqr(shat) : ZERO; } // g qbar -> H qbar else { fxnew[0]=pdf[0]->xfx(beams[0],gluons[0]->dataPtr(),scale,xnew[0]); out = quarkFlavour(pdf[1],scale,xnew[1],beams[1],fxnew[1],true); iemit = 1; mewgt = out ? qbargME(shat,that,uhat)/lome*mh2_/sqr(shat) : ZERO; } jacobian2/=(channelWeights_[2]-channelWeights_[1]); } // weight (factor of 2 as pick q(bar)g or gq(bar) weight = 2.*jacobian2*mewgt; // pdf part of the weight weight *=fxnew[0]*fxnew[1]*x[0]*x[1]/(fx[0]*fx[1]*xnew[0]*xnew[1]); // finally coupling and different channel pieces weight *= 1./16./sqr(Constants::pi)*alpha_->value(scale); } // if me correction should be applied if(weight>1.) { ++nover_; maxwgt_ = max( maxwgt_ , weight); weight=1.; } if(UseRandom::rnd()>weight) return false; ++ngen_; // construct the momenta Energy roots = 0.5*sqrt(s); Energy pt = sqrt(uhat*that/shat); Energy mt = sqrt(uhat*that/shat+mh2_); Lorentz5Momentum pin[2]={Lorentz5Momentum(ZERO,ZERO, xnew[0]*roots,xnew[0]*roots), Lorentz5Momentum(ZERO,ZERO,-xnew[1]*roots,xnew[1]*roots)}; double phi = Constants::twopi*UseRandom::rnd(); Lorentz5Momentum pH(pt*cos(phi),pt*sin(phi),mt*sinh(yH),mt*cosh(yH)); Lorentz5Momentum pJ(pin[0]+pin[1]-pH); // momenta to be returned pnew.push_back(pin[0]); pnew.push_back(pin[1]); pnew.push_back(pJ); pnew.push_back(pH); xout.first = xnew[0]; xout.second = xnew[1]; return true; } Energy2 MEPP2Higgs::ggME(Energy2 s, Energy2 t, Energy2 u) { Energy2 output; if(massOption_==0) { complex me[2][2][2]; me[1][1][1] = ZERO; me[1][1][0] = ZERO; me[0][1][0] = ZERO; me[0][1][1] = ZERO; for(unsigned int ix=minLoop_; ix<=maxLoop_; ++ix ) { Energy2 mf2=sqr(getParticleData(long(ix))->mass()); bi_[1]=B(s,mf2); bi_[2]=B(u,mf2); bi_[3]=B(t,mf2); bi_[4]=B(mh2_,mf2); bi_[1]=bi_[1]-bi_[4]; bi_[2]=bi_[2]-bi_[4]; bi_[3]=bi_[3]-bi_[4]; ci_[1]=C(s,mf2); ci_[2]=C(u,mf2); ci_[3]=C(t,mf2); ci_[7]=C(mh2_,mf2); ci_[4]=(s*ci_[1]-mh2_*ci_[7])/(s-mh2_); ci_[5]=(u*ci_[2]-mh2_*ci_[7])/(u-mh2_); ci_[6]=(t*ci_[3]-mh2_*ci_[7])/(t-mh2_); di_[1]=D(t,u,s,mf2); di_[2]=D(s,t,u,mf2); di_[3]=D(s,u,t,mf2); me[1][1][1]+=me1(s,u,t,mf2,1,2,3,4,5,6); me[1][1][0]+=me2(s,u,t,mf2); me[0][1][0]+=me1(u,s,t,mf2,2,1,3,5,4,6); me[0][1][1]+=me1(t,u,s,mf2,3,2,1,6,5,4); } me[0][0][0]=-me[1][1][1]; me[0][0][1]=-me[1][1][0]; me[1][0][1]=-me[0][1][0]; me[1][0][0]=-me[0][1][1]; output = real(me[0][0][0]*conj(me[0][0][0])+ me[0][0][1]*conj(me[0][0][1])+ me[0][1][0]*conj(me[0][1][0])+ me[0][1][1]*conj(me[0][1][1])+ me[1][0][0]*conj(me[1][0][0])+ me[1][0][1]*conj(me[1][0][1])+ me[1][1][0]*conj(me[1][1][0])+ me[1][1][1]*conj(me[1][1][1])); output *= 3./8.; } else { output=32./3.* (pow<4,1>(s)+pow<4,1>(t)+pow<4,1>(u)+pow<4,1>(mh2_))/s/t/u; } // spin and colour factors return output/4./64.; } Energy2 MEPP2Higgs::qgME(Energy2 s, Energy2 t, Energy2 u) { Energy2 output; if(massOption_==0) { complex A(ZERO); Energy2 si(u-mh2_); for(unsigned int ix=minLoop_;ix<=maxLoop_;++ix) { Energy2 mf2=sqr(getParticleData(long(ix))->mass()); A += mf2*(2.+2.*double(u/si)*(B(u,mf2)-B(mh2_,mf2)) +double((4.*mf2-s-t)/si)*Complex(u*C(u,mf2)-mh2_*C(mh2_,mf2))); } output =-4.*(sqr(s)+sqr(t))/sqr(si)/u*real(A*conj(A)); } else{ output =-4.*(sqr(s)+sqr(t))/u/9.; } // final colour/spin factors return output/24.; } Energy2 MEPP2Higgs::qbargME(Energy2 s, Energy2 t, Energy2 u) { Energy2 output; if(massOption_==0) { complex A(ZERO); Energy2 si(u-mh2_); for(unsigned int ix=minLoop_;ix<=maxLoop_;++ix) { Energy2 mf2=sqr(getParticleData(long(ix))->mass()); A+=mf2*(2.+2.*double(u/si)*(B(u,mf2)-B(mh2_,mf2)) +double((4.*mf2-s-t)/si)*Complex(u*C(u,mf2)-mh2_*C(mh2_,mf2))); } output =-4.*(sqr(s)+sqr(t))/sqr(si)/u*real(A*conj(A)); } else { output =-4.*(sqr(s)+sqr(t))/u/9.; } // final colour/spin factors return output/24.; } Energy4 MEPP2Higgs::loME() const { Complex I(0); if(massOption_==0) { for(unsigned int ix=minLoop_;ix<=maxLoop_;++ix) { double x = sqr(getParticleData(long(ix))->mass())/mh2_; I += 3.*x*(2.+(4.*x-1.)*F(x)); } } else { I = 1.; } return sqr(mh2_)/576./Constants::pi*norm(I); } tPDPtr MEPP2Higgs::quarkFlavour(tcPDFPtr pdf, Energy2 scale, double x, tcBeamPtr beam, double & pdfweight, bool anti) { vector weights; vector partons; pdfweight = 0.; if(!anti) { for(unsigned int ix=1;ix<=5;++ix) { partons.push_back(getParticleData(long(ix))); weights.push_back(max(0.,pdf->xfx(beam,partons.back(),scale,x))); pdfweight += weights.back(); } } else { for(unsigned int ix=1;ix<=5;++ix) { partons.push_back(getParticleData(-long(ix))); weights.push_back(max(0.,pdf->xfx(beam,partons.back(),scale,x))); pdfweight += weights.back(); } } if(pdfweight==0.) return tPDPtr(); double wgt=UseRandom::rnd()*pdfweight; for(unsigned int ix=0;ix=ZERO&&rat<1.) output=2.-2.*sqrt(1./rat-1.)*asin(sqrt(rat)); else output=2.-sqrt(1.-1./rat)*(2.*log(sqrt(rat)+sqrt(rat-1.))-pii); return output; } complex MEPP2Higgs::C(Energy2 s,Energy2 mf2) const { complex output; Complex pii(0.,Constants::pi); double rat=s/(4.*mf2); if(s=ZERO&&rat<1.) output=-2.*sqr(asin(sqrt(rat)))/s; else { double cosh=log(sqrt(rat)+sqrt(rat-1.)); output=2.*(sqr(cosh)-sqr(Constants::pi)/4.-pii*cosh)/s; } return output; } Complex MEPP2Higgs::dIntegral(Energy2 a, Energy2 b, double y0) const { Complex output; if(b==ZERO) output=0.; else { Complex y1=0.5*(1.+sqrt(1.-4.*(a+epsi_)/b)); Complex y2=1.-y1; Complex z1=y0/(y0-y1); Complex z2=(y0-1.)/(y0-y1); Complex z3=y0/(y0-y2); Complex z4=(y0-1.)/(y0-y2); output=Math::Li2(z1)-Math::Li2(z2)+Math::Li2(z3)-Math::Li2(z4); } return output; } complex MEPP2Higgs::D(Energy2 s,Energy2 t, Energy2, Energy2 mf2) const { Complex output,pii(0.,Constants::pi); Energy4 st=s*t; Energy4 root=sqrt(sqr(st)-4.*st*mf2*(s+t-mh2_)); double xp=0.5*(st+root)/st,xm=1-xp; output = 2.*(-dIntegral(mf2,s,xp)-dIntegral(mf2,t,xp) +dIntegral(mf2,mh2_,xp)+log(-xm/xp) *(log((mf2+epsi_)/GeV2)-log((mf2+epsi_-s*xp*xm)/GeV2) +log((mf2+epsi_-mh2_*xp*xm)/GeV2)-log((mf2+epsi_-t*xp*xm)/GeV2))); return output/root; } complex MEPP2Higgs::me1(Energy2 s,Energy2 t,Energy2 u, Energy2 mf2, unsigned int i ,unsigned int j ,unsigned int k , unsigned int i1,unsigned int j1,unsigned int k1) const { Energy2 s1(s-mh2_),t1(t-mh2_),u1(u-mh2_); return mf2*4.*sqrt(2.*s*t*u)* (-4.*(1./(u*t)+1./(u*u1)+1./(t*t1)) -4.*((2.*s+t)*bi_[k]/sqr(u1)+(2.*s+u)*bi_[j]/sqr(t1))/s -(s-4.*mf2)*(s1*ci_[i1]+(u-s)*ci_[j1]+(t-s)*ci_[k1])/(s*t*u) -8.*mf2*(ci_[j1]/(t*t1)+ci_[k1]/(u*u1)) +0.5*(s-4.*mf2)*(s*t*di_[k]+u*s*di_[j]-u*t*di_[i])/(s*t*u) +4.*mf2*di_[i]/s -2.*(u*ci_[k]+t*ci_[j]+u1*ci_[k1]+t1*ci_[j1]-u*t*di_[i])/sqr(s)); } complex MEPP2Higgs::me2(Energy2 s,Energy2 t,Energy2 u, Energy2 mf2) const { Energy2 s1(s-mh2_),t1(t-mh2_),u1(u-mh2_); return mf2*4.*sqrt(2.*s*t*u)*(4.*mh2_+(mh2_-4.*mf2)*(s1*ci_[4]+t1*ci_[5]+u1*ci_[6]) -0.5*(mh2_-4.*mf2)*(s*t*di_[3]+u*s*di_[2]+u*t*di_[1]) )/ (s*t*u); } Complex MEPP2Higgs::F(double x) const { if(x<.25) { double root = sqrt(1.-4.*x); Complex pii(0.,Constants::pi); return 0.5*sqr(log((1.+root)/(1.-root))-pii); } else { return -2.*sqr(asin(0.5/sqrt(x))); } } bool MEPP2Higgs::getEvent(vector & pnew, int & emis_type){ // maximum pt (half of centre-of-mass energy) Energy maxp = 0.5*generator()->maximumCMEnergy(); // set pt of emission to zero pt_=ZERO; //Working Variables Energy pt; double yj; // limits on the rapidity of the jet double minyj = -8.0,maxyj = 8.0; bool reject; double wgt; emis_type=-1; tcPDPtr outParton; for(int j=0;j<5;++j) { pt = maxp; do { double a = alpha_->overestimateValue()*prefactor_[j]*(maxyj-minyj)/(power_-1.); // generate next pt pt=GeV/pow(pow(GeV/pt,power_-1)-log(UseRandom::rnd())/a,1./(power_-1.)); // generate rapidity of the jet yj=UseRandom::rnd()*(maxyj-minyj)+ minyj; // calculate rejection weight wgt=getResult(j,pt,yj,outParton); wgt/= prefactor_[j]*pow(GeV/pt,power_); reject = UseRandom::rnd()>wgt; //no emission event if p goes past p min - basically set to outside //of the histogram bounds (hopefully hist object just ignores it) if(pt1.0) { ostringstream s; s << "MEPP2Higgs::getEvent weight for channel " << j << "is " << wgt << " which is greater than 1"; generator()->logWarning( Exception(s.str(), Exception::warning) ); } } while(reject); // set pt of emission etc if(pt>pt_){ emis_type = j; pt_=pt; yj_=yj; out_ = outParton; } } //was this an (overall) no emission event? if(pt_maximumCMEnergy()); // transverse energy Energy et=sqrt(mh2_+sqr(pt_)); // first calculate all the kinematic variables // longitudinal real correction fractions double x = pt_*exp( yj_)/sqrt(s)+et*exp( yh_)/sqrt(s); double y = pt_*exp(-yj_)/sqrt(s)+et*exp(-yh_)/sqrt(s); // that and uhat // Energy2 th = -sqrt(s)*x*pt_*exp(-yj_); // Energy2 uh = -sqrt(s)*y*pt_*exp( yj_); // Energy2 sh = x*y*s; // reconstruct the momenta // incoming momenta pnew.push_back(Lorentz5Momentum(ZERO,ZERO, x*0.5*sqrt(s), x*0.5*sqrt(s),ZERO)); pnew.push_back(Lorentz5Momentum(ZERO,ZERO, -y*0.5*sqrt(s), y*0.5*sqrt(s),ZERO)); // outgoing momenta double phi(Constants::twopi*UseRandom::rnd()); double sphi(sin(phi)),cphi(cos(phi)); pnew.push_back(Lorentz5Momentum( cphi*pt_, sphi*pt_, et*sinh(yh_), et*cosh(yh_), mass_)); pnew.push_back(Lorentz5Momentum(-cphi*pt_,-sphi*pt_,pt_*sinh(yj_), pt_*cosh(yj_),ZERO)); return true; } double MEPP2Higgs::getResult(int emis_type, Energy pt, double yj, tcPDPtr & outParton) { Energy2 s=sqr(generator()->maximumCMEnergy()); Energy2 scale = mh2_+sqr(pt); Energy et=sqrt(scale); scale = mu_F_opt_==0 ? mh2_+sqr(pt) : sqr(pt) ; // longitudinal real correction fractions double x = pt*exp( yj)/sqrt(s)+et*exp( yh_)/sqrt(s); double y = pt*exp(-yj)/sqrt(s)+et*exp(-yh_)/sqrt(s); // reject if outside region if(x<0.||x>1.||y<0.||y>1.||x*ypdf()->xfx(beams_[0],partons_[0],mh2_,x1); pdf[1]=beams_[1]->pdf()->xfx(beams_[1],partons_[1],mh2_,y1); } else { // As in Nason and Ridolfi paper ... pdf[0]=beams_[0]->pdf()->xfx(beams_[0],partons_[0],scale,x1); pdf[1]=beams_[1]->pdf()->xfx(beams_[1],partons_[1],scale,y1); } // g g -> H g if(emis_type==0) { outParton = partons_[1]; pdf[2]=beams_[0]->pdf()->xfx(beams_[0],partons_[0],scale,x); pdf[3]=beams_[1]->pdf()->xfx(beams_[1],partons_[1],scale,y); res = ggME(sh,uh,th)/loME(); } // q g -> H q else if(emis_type==1) { outParton = quarkFlavour(beams_[0]->pdf(),scale,x,beams_[0],pdf[2],false); pdf[3]=beams_[1]->pdf()->xfx(beams_[1],partons_[1],scale,y); res = outParton ? qgME(sh,uh,th)/loME() : ZERO; } // g q -> H q else if(emis_type==2) { pdf[2]=beams_[0]->pdf()->xfx(beams_[0],partons_[0],scale,x); outParton = quarkFlavour(beams_[1]->pdf(),scale,y,beams_[1],pdf[3],false); res = outParton ? qgME(sh,th,uh)/loME() : ZERO; } // qbar g -> H qbar else if(emis_type==3) { outParton = quarkFlavour(beams_[0]->pdf(),scale,x,beams_[0],pdf[2],true); pdf[3]=beams_[1]->pdf()->xfx(beams_[1],partons_[1],scale,y); res = outParton ? qbargME(sh,uh,th)/loME() : ZERO; } // g qbar -> H qbar else if(emis_type==4) { pdf[2]=beams_[0]->pdf()->xfx(beams_[0],partons_[0],scale,x); outParton = quarkFlavour(beams_[1]->pdf(),scale,y,beams_[1],pdf[3],true); res = outParton ? qbargME(sh,th,uh)/loME() : ZERO; } //deals with pdf zero issue at large x if(pdf[0]<=0.||pdf[1]<=0.||pdf[2]<=0.||pdf[3]<=0.) { res = ZERO; } else { res *= pdf[2]*pdf[3]/pdf[0]/pdf[1]*mh2_/sh; } scale = mu_R_opt_==0 ? mh2_+sqr(pt) : sqr(pt) ; return alpha_->ratio(scale)/8./sqr(Constants::pi)*mh2_/sh*GeV*pt*res; } void MEPP2Higgs::initializeMECorrection(ShowerTreePtr tree, double & initial, double & final) { final = 1.; initial = tree->incomingLines().begin()->second->id()==ParticleID::g ? enhance_ : 1.; } diff --git a/MatrixElement/Hadron/MEPP2HiggsVBF.cc b/MatrixElement/Hadron/MEPP2HiggsVBF.cc --- a/MatrixElement/Hadron/MEPP2HiggsVBF.cc +++ b/MatrixElement/Hadron/MEPP2HiggsVBF.cc @@ -1,1632 +1,1632 @@ // -*- C++ -*- // // This is the implementation of the non-inlined, non-templated member // functions of the MEPP2HiggsVBF class. // #include "MEPP2HiggsVBF.h" #include "ThePEG/Interface/Parameter.h" #include "ThePEG/Interface/Reference.h" #include "ThePEG/Interface/ClassDocumentation.h" #include "ThePEG/Persistency/PersistentOStream.h" #include "ThePEG/Persistency/PersistentIStream.h" #include "ThePEG/PDT/EnumParticles.h" #include "ThePEG/MatrixElement/Tree2toNDiagram.h" #include "ThePEG/PDT/StandardMatchers.h" #include #include "Herwig/Utilities/Maths.h" #include "Herwig/Models/StandardModel/StandardModel.h" #include "ThePEG/Repository/CurrentGenerator.h" #include "Herwig/Shower/Base/ShowerProgenitor.h" #include "Herwig/Shower/Base/ShowerTree.h" #include "Herwig/Shower/Base/Branching.h" #include "Herwig/Shower/Base/HardTree.h" using namespace Herwig; // namespace { // using namespace Herwig; // using namespace ThePEG; // using namespace ThePEG::Helicity; // void debuggingMatrixElement(bool BGF, // tcPDPtr partons1, tcPDPtr partons2, // tcPDPtr partons3, tcPDPtr partons4, // const Lorentz5Momentum & psystem0, // const Lorentz5Momentum & psystem1, // const Lorentz5Momentum & pother0, // const Lorentz5Momentum & pother1, // const Lorentz5Momentum & p0, // const Lorentz5Momentum & p1, // const Lorentz5Momentum & p2, // const Lorentz5Momentum & phiggs, // Energy2 Q12, Energy2 scale, // double old) { // // get the vertex and the boson // tcHwSMPtr hwsm=ThePEG::dynamic_ptr_cast // (CurrentGenerator::current().standardModel()); // assert(hwsm); // tcPDPtr boson; // AbstractFFVVertexPtr weakVertex; // AbstractFFVVertexPtr strongVertex = hwsm->vertexFFG(); // AbstractVVSVertexPtr higgsVertex = hwsm->vertexWWH(); // if(partons1->id()==partons2->id()) { // weakVertex = hwsm->vertexFFZ(); // boson = hwsm->getParticleData(ParticleID::Z0); // } // else { // weakVertex = hwsm->vertexFFW(); // boson = hwsm->getParticleData(ParticleID::Wplus); // } // tcPDPtr hdata = hwsm->getParticleData(ParticleID::h0); // tcPDPtr gluon = hwsm->getParticleData(ParticleID::g); // SpinorWaveFunction q1,q2; // SpinorBarWaveFunction qbar1,qbar2; // if(partons1->id()>0) { // q1 = SpinorWaveFunction (psystem0,partons1,incoming); // qbar1 = SpinorBarWaveFunction(psystem1,partons2,outgoing); // } // else { // q1 = SpinorWaveFunction (psystem1,partons2,outgoing); // qbar1 = SpinorBarWaveFunction(psystem0,partons1,incoming); // } // if(partons3->id()>0) { // q2 = SpinorWaveFunction (pother0,partons3,incoming); // qbar2 = SpinorBarWaveFunction(pother1,partons4,outgoing); // } // else { // q2 = SpinorWaveFunction (pother1,partons4,outgoing); // qbar2 = SpinorBarWaveFunction(pother0,partons3,incoming); // } // ScalarWaveFunction higgs(phiggs,hdata,outgoing); // if(!BGF) { // SpinorWaveFunction q1p; // SpinorBarWaveFunction qbar1p; // if(partons1->id()>0) { // q1p = SpinorWaveFunction (p0 ,partons1,incoming); // qbar1p = SpinorBarWaveFunction(p1 ,partons2,outgoing); // } // else { // q1p = SpinorWaveFunction (p1 ,partons2,outgoing); // qbar1p = SpinorBarWaveFunction(p0 ,partons1,incoming); // } // VectorWaveFunction gl(p2,gluon,outgoing); // double lome(0.),realme(0.); // for(unsigned int lhel1=0;lhel1<2;++lhel1) { // q2.reset(lhel1); // for(unsigned int lhel2=0;lhel2<2;++lhel2) { // qbar2.reset(lhel2); // VectorWaveFunction off1 // = weakVertex->evaluate(scale,3,boson,q2,qbar2); // VectorWaveFunction off2 // = higgsVertex->evaluate(scale,3,boson,off1,higgs); // for(unsigned int qhel1=0;qhel1<2;++qhel1) { // q1.reset(qhel1); // q1p.reset(qhel1); // for(unsigned int qhel2=0;qhel2<2;++qhel2) { // qbar1.reset(qhel2); // qbar1p.reset(qhel2); // Complex diag = weakVertex->evaluate(scale,q1,qbar1,off2); // lome += norm(diag); // for(unsigned int ghel=0;ghel<2;++ghel) { // gl.reset(2*ghel); // SpinorWaveFunction inter1 = // strongVertex->evaluate(Q12,5,q1p.particle(),q1p,gl); // Complex diag1 = weakVertex->evaluate(scale,inter1,qbar1p,off2); // SpinorBarWaveFunction inter2 = // strongVertex->evaluate(Q12,5,qbar1p.particle(),qbar1p,gl); // Complex diag2 = weakVertex->evaluate(scale,q1p,inter2,off2); // realme += norm(diag1+diag2); // } // } // } // } // } // double test1 = realme/lome/hwsm->alphaS(Q12)*Q12*UnitRemoval::InvE2; // cerr << "testing ratio A " << old/test1 << "\n"; // } // else { // SpinorWaveFunction q1p; // SpinorBarWaveFunction qbar1p; // if(partons1->id()>0) { // q1p = SpinorWaveFunction (p2,partons1->CC(),outgoing); // qbar1p = SpinorBarWaveFunction(p1,partons2 ,outgoing); // } // else { // q1p = SpinorWaveFunction (p1,partons2 ,outgoing); // qbar1p = SpinorBarWaveFunction(p2,partons1->CC(),outgoing); // } // VectorWaveFunction gl(p0,gluon,incoming); // double lome(0.),realme(0.); // for(unsigned int lhel1=0;lhel1<2;++lhel1) { // q2.reset(lhel1); // for(unsigned int lhel2=0;lhel2<2;++lhel2) { // qbar2.reset(lhel2); // VectorWaveFunction off1 // = weakVertex->evaluate(scale,3,boson,q2,qbar2); // VectorWaveFunction off2 // = higgsVertex->evaluate(scale,3,boson,off1,higgs); // for(unsigned int qhel1=0;qhel1<2;++qhel1) { // q1.reset(qhel1); // q1p.reset(qhel1); // for(unsigned int qhel2=0;qhel2<2;++qhel2) { // qbar1.reset(qhel2); // qbar1p.reset(qhel2); // Complex diag = weakVertex->evaluate(scale,q1,qbar1,off2); // lome += norm(diag); // for(unsigned int ghel=0;ghel<2;++ghel) { // gl.reset(2*ghel); // SpinorWaveFunction inter1 = // strongVertex->evaluate(Q12,5,q1p.particle(),q1p,gl); // Complex diag1 = weakVertex->evaluate(scale,inter1,qbar1p,off2); // SpinorBarWaveFunction inter2 = // strongVertex->evaluate(Q12,5,qbar1p.particle(),qbar1p,gl); // Complex diag2 = weakVertex->evaluate(scale,q1p,inter2,off2); // realme += norm(diag1+diag2); // } // } // } // } // } // double test1 = realme/lome/hwsm->alphaS(Q12)*Q12*UnitRemoval::InvE2; // cerr << "testing ratio B " << old/test1 << "\n"; // } // } // } MEPP2HiggsVBF::MEPP2HiggsVBF() : comptonWeight_(8.), BGFWeight_(30.), pTmin_(1.*GeV),initial_(10.),final_(8.), procProb_(0.5), comptonInt_(0.), bgfInt_(0.), nover_(0),maxwgt_(make_pair(0.,0.)) {} void MEPP2HiggsVBF::doinit() { gluon_ = getParticleData(ParticleID::g); // integrals of me over phase space double r5=sqrt(5.),darg((r5-1.)/(r5+1.)),ath(0.5*log((1.+1./r5)/(1.-1./r5))); comptonInt_ = 2.*(-21./20.-6./(5.*r5)*ath+sqr(Constants::pi)/3. -2.*Math::ReLi2(1.-darg)-2.*Math::ReLi2(1.-1./darg)); bgfInt_ = 121./9.-56./r5*ath; // get the vertex pointers from the SM object tcHwSMPtr hwsm= dynamic_ptr_cast(standardModel()); if(!hwsm) throw InitException() << "Wrong type of StandardModel object in " << "MEPP2HiggsVBF::doinit() the Herwig" << " version must be used" << Exception::runerror; // set the vertex setWWHVertex(hwsm->vertexWWH()); higgs(getParticleData(ParticleID::h0)); MEfftoffH::doinit(); } void MEPP2HiggsVBF::dofinish() { MEfftoffH::dofinish(); if(nover_==0) return; generator()->log() << "VBFMECorrection when applying the hard correction " << nover_ << " weights larger than one were generated of which" << " the largest was " << maxwgt_.first << " for the QCD compton" << " processes and " << maxwgt_.second << " for the BGF process\n"; } void MEPP2HiggsVBF::getDiagrams() const { // get the quark particle data objects as we'll be using them tcPDPtr q[6],qbar[6]; for ( int ix=0; ix<5; ++ix ) { q [ix] = getParticleData(ix+1); qbar[ix] = q[ix]->CC(); } // WW processes if(process()==0||process()==1) { std::vector > parentpair; parentpair.reserve(6); // don't even think of putting 'break' in here! switch(maxFlavour()) { case 5: if (minFlavour()<=4) parentpair.push_back(make_pair(getParticleData(ParticleID::b), getParticleData(ParticleID::c))); if (minFlavour()<=2) parentpair.push_back(make_pair(getParticleData(ParticleID::b), getParticleData(ParticleID::u))); case 4: if (minFlavour()<=3) parentpair.push_back(make_pair(getParticleData(ParticleID::s), getParticleData(ParticleID::c))); if (minFlavour()<=1) parentpair.push_back(make_pair(getParticleData(ParticleID::d), getParticleData(ParticleID::c))); case 3: if (minFlavour()<=2) parentpair.push_back(make_pair(getParticleData(ParticleID::s), getParticleData(ParticleID::u))); case 2: if (minFlavour()<=1) parentpair.push_back(make_pair(getParticleData(ParticleID::d), getParticleData(ParticleID::u))); default: ; } for(unsigned int ix=0;ix q1' q2' h if(parentpair[ix].first->id()id()) { add(new_ptr((Tree2toNDiagram(4), parentpair[ix].first, WMinus(), WPlus(), parentpair[iy].second, 1, parentpair[ix].second, 3, parentpair[iy].first, 2, higgs(),-1))); } else { add(new_ptr((Tree2toNDiagram(4), parentpair[iy].second, WPlus(), WMinus(), parentpair[ix].first, 1, parentpair[iy].first, 3, parentpair[ix].second, 2, higgs(),-1))); } // q1 qbar2 -> q1' qbar2' h add(new_ptr((Tree2toNDiagram(4), parentpair[ix].first, WMinus(), WPlus(), parentpair[iy].first->CC(), 1, parentpair[ix].second, 3, parentpair[iy].second->CC(), 2, higgs(),-1))); add(new_ptr((Tree2toNDiagram(4),parentpair[iy].second, WPlus(), WMinus(), parentpair[ix].second->CC(), 1, parentpair[iy].first, 3, parentpair[ix].first->CC(), 2, higgs(),-1))); // qbar1 qbar2 -> qbar1' qbar2' h if(parentpair[ix].first->id()id()) { add(new_ptr((Tree2toNDiagram(4), parentpair[ix].first->CC(), WPlus(), WMinus(), parentpair[iy].second->CC(), 1, parentpair[ix].second->CC(), 3, parentpair[iy].first->CC(), 2, higgs(),-1))); } else { add(new_ptr((Tree2toNDiagram(4), parentpair[iy].second->CC(), WMinus(), WPlus(), parentpair[ix].first->CC(), 1, parentpair[iy].first->CC(), 3, parentpair[ix].second->CC(), 2, higgs(),-1))); } } } } // ZZ processes if(process()==0||process()==2) { for(unsigned int ix=minFlavour()-1;ix q q H add(new_ptr((Tree2toNDiagram(4), q[ix], Z0(), Z0(), q[iy], 1, q[ix], 3, q[iy], 2, higgs(),-2))); // qbar qbar -> qbar qbar H add(new_ptr((Tree2toNDiagram(4), qbar[ix], Z0(), Z0(), qbar[iy], 1, qbar[ix], 3, qbar[iy], 2, higgs(),-2))); } // q qbar -> q qbar H for(unsigned int iy=minFlavour()-1;iy> initial_ >> final_ >> alpha_ >> iunit(pTmin_,GeV) >> comptonWeight_ >> BGFWeight_ >> gluon_ >> comptonInt_ >> bgfInt_ >> procProb_; } ClassDescription MEPP2HiggsVBF::initMEPP2HiggsVBF; // Definition of the static class description member. void MEPP2HiggsVBF::Init() { static ClassDocumentation documentation ("The MEPP2HiggsVBF class implements Higgs production via vector-boson fusion"); static Reference interfaceShowerAlphaQCD ("ShowerAlphaQCD", "The object calculating the strong coupling constant", &MEPP2HiggsVBF::alpha_, false, false, true, false, false); static Parameter interfacepTMin ("pTMin", "The minimum pT", &MEPP2HiggsVBF::pTmin_, GeV, 1.*GeV, 0.0*GeV, 10.0*GeV, false, false, Interface::limited); static Parameter interfaceComptonWeight ("ComptonWeight", "Weight for the overestimate ofthe compton channel", &MEPP2HiggsVBF::comptonWeight_, 50.0, 0.0, 100.0, false, false, Interface::limited); static Parameter interfaceBGFWeight ("BGFWeight", "Weight for the overestimate of the BGF channel", &MEPP2HiggsVBF::BGFWeight_, 100.0, 0.0, 1000.0, false, false, Interface::limited); static Parameter interfaceProcessProbability ("ProcessProbability", "The probabilty of the QCD compton process for the process selection", &MEPP2HiggsVBF::procProb_, 0.3, 0.0, 1., false, false, Interface::limited); } HardTreePtr MEPP2HiggsVBF::generateHardest(ShowerTreePtr tree, ShowerInteraction::Type inter) { // check if generating QCD radiation if(inter!=ShowerInteraction::QCD && inter!=ShowerInteraction::QEDQCD && inter!=ShowerInteraction::ALL) return HardTreePtr(); pair< tShowerParticlePtr, tShowerParticlePtr> first,second; pair beams; pair hadrons; // get the incoming particles for(map::const_iterator cit=tree->incomingLines().begin();cit!=tree->incomingLines().end();++cit) { if(!first.first) { first.first = cit->first->progenitor(); beams.first = cit->first->beam(); hadrons.first = cit->first->original()->parents()[0]; } else { second.first = cit->first->progenitor(); beams.second = cit->first->beam(); hadrons.second = cit->first->original()->parents()[0]; } } // and the outgoing for(map::const_iterator cjt=tree->outgoingLines().begin();cjt!=tree->outgoingLines().end();++cjt) { if(cjt->first->progenitor()->id()==ParticleID::h0) { higgs_ = cjt->first->progenitor(); } else { if(abs(cjt->first->progenitor()->id())>5) continue; if(cjt->first->progenitor()->colourLine()&& cjt->first->progenitor()->colourLine()==first.first->colourLine()) { first.second = cjt->first->progenitor(); continue; } if(cjt->first->progenitor()->antiColourLine()&& cjt->first->progenitor()->antiColourLine()==first.first->antiColourLine()) { first.second = cjt->first->progenitor(); continue; } if(cjt->first->progenitor()->colourLine()&& cjt->first->progenitor()->colourLine()==second.first->colourLine()) { second.second = cjt->first->progenitor(); continue; } if(cjt->first->progenitor()->antiColourLine()&& cjt->first->progenitor()->antiColourLine()==second.first->antiColourLine()) { second.second = cjt->first->progenitor(); continue; } } } // loop over the two possible emitting systems q_ [0] = first .second->momentum()-first .first->momentum(); q2_[0] = -q_[0].m2(); q_ [1] = second.second->momentum()-second.first->momentum(); q2_[1] = -q_[1].m2(); for(unsigned int ix=0;ix<2;++ix) { if(ix==1) { swap(first,second); swap(beams.first,beams.second); } // check beam, all particles assert(beams.first && higgs_ && first .first && first.second && second.first && second.second); // beam and pdf beam_[ix] = beams.first; pdf_ [ix] = beam_[ix]->pdf(); assert(beam_[ix] && pdf_[ix] ); // Particle data objects partons_[ix][0] = first. first->dataPtr(); partons_[ix][1] = first.second->dataPtr(); partons_[ix][2] = second. first->dataPtr(); partons_[ix][3] = second.second->dataPtr(); // extract the born variables xB_[ix] = first.first->x(); Lorentz5Momentum pb = first.first->momentum(); Axis axis(q_[ix].vect().unit()); double sinth(sqrt(sqr(axis.x())+sqr(axis.y()))); rot_[ix] = LorentzRotation(); if(axis.perp2()>1e-20) { rot_[ix].setRotate(-acos(axis.z()),Axis(-axis.y()/sinth,axis.x()/sinth,0.)); rot_[ix].rotateX(Constants::pi); } if(abs(1.-q_[ix].e()/q_[ix].vect().mag())>1e-6) rot_[ix].boostZ( q_[ix].e()/q_[ix].vect().mag()); pb *= rot_[ix]; if(pb.perp2()/GeV2>1e-20) { Boost trans = -1./pb.e()*pb.vect(); trans.setZ(0.); rot_[ix].boost(trans); } // momenta of the particles phiggs_ [ix] = rot_[ix]*higgs_->momentum(); pother_ [ix][0] = rot_[ix]*second. first->momentum(); pother_ [ix][1] = rot_[ix]*second.second->momentum(); psystem_[ix][0] = rot_[ix]* first. first->momentum(); psystem_[ix][1] = rot_[ix]* first.second->momentum(); q_[ix] *= rot_[ix]; pTCompton_[ix] = pTBGF_[ix] = ZERO; // generate a compton point generateCompton(ix); // generate a BGF point generateBGF(ix); } // no valid emissions, return if(pTCompton_[0]::const_iterator cit=tree->incomingLines().begin();cit!=tree->incomingLines().end();++cit) { if(QuarkMatcher::Check(cit->first->progenitor()->data())) cit->first->maximumpT(pTmin_,ShowerInteraction::QCD); } for(map::const_iterator cit=tree->outgoingLines().begin();cit!=tree->outgoingLines().end();++cit) { if(QuarkMatcher::Check(cit->first->progenitor()->data())) cit->first->maximumpT(pTmin_,ShowerInteraction::QCD); } return HardTreePtr(); } // find the maximum pT emission unsigned int system = 0; bool isCompton = false; Energy pTmax = -GeV; for(unsigned int ix=0;ix<2;++ix) { if(pTCompton_[ix]>pTmax) { pTmax = pTCompton_[ix]; isCompton = true; system = ix; } if(pTBGF_[ix]>pTmax) { pTmax = pTBGF_[ix]; isCompton = false; system = ix; } } if(system==0) { swap(first,second); swap(beams.first,beams.second); } // add the non emitting particles vector spaceBranchings,allBranchings; spaceBranchings.push_back(new_ptr(HardBranching(second.first,SudakovPtr(), HardBranchingPtr(), HardBranching::Incoming))); allBranchings.push_back(spaceBranchings.back()); allBranchings.push_back(new_ptr(HardBranching(second.second,SudakovPtr(), HardBranchingPtr(), HardBranching::Outgoing))); allBranchings.push_back(new_ptr(HardBranching(higgs_,SudakovPtr(), HardBranchingPtr(), HardBranching::Outgoing))); allBranchings[0]->colourPartner(allBranchings[1]); allBranchings[1]->colourPartner(allBranchings[0]); rot_[system].invert(); // compton hardest if(isCompton) { for(unsigned int ix=0;ixset5Momentum(ComptonMomenta_[system][1]); ShowerParticlePtr newg(new_ptr(ShowerParticle(gluon_,true))); newg->set5Momentum(ComptonMomenta_[system][2]); ShowerParticlePtr newqin (new_ptr(ShowerParticle(partons_[system][0],false ))); newqin->set5Momentum(ComptonMomenta_[system][0]); if(ComptonISFS_[system]) { ShowerParticlePtr newspace(new_ptr(ShowerParticle(partons_[system][0],false))); newspace->set5Momentum(ComptonMomenta_[system][0]-ComptonMomenta_[system][2]); HardBranchingPtr spaceBranch(new_ptr(HardBranching(newqin,SudakovPtr(), HardBranchingPtr(), HardBranching::Incoming))); HardBranchingPtr offBranch(new_ptr(HardBranching(newspace,SudakovPtr(), spaceBranch, HardBranching::Incoming))); spaceBranch->addChild(offBranch); HardBranchingPtr g(new_ptr(HardBranching(newg,SudakovPtr(),spaceBranch, HardBranching::Outgoing))); spaceBranch->addChild(g); spaceBranch->type(offBranch->branchingParticle()->id()>0 ? ShowerPartnerType::QCDColourLine : ShowerPartnerType::QCDAntiColourLine); HardBranchingPtr outBranch(new_ptr(HardBranching(newqout,SudakovPtr(), HardBranchingPtr(), HardBranching::Outgoing))); spaceBranchings.push_back(spaceBranch); allBranchings.push_back(offBranch); allBranchings.push_back(outBranch); ColinePtr newin(new_ptr(ColourLine())),newout(new_ptr(ColourLine())); newin ->addColoured(newqin ,newspace->dataPtr()->iColour()!=PDT::Colour3); newin ->addColoured(newg ,newspace->dataPtr()->iColour()!=PDT::Colour3); newout->addColoured(newspace,newspace->dataPtr()->iColour()!=PDT::Colour3); newout->addColoured(newqout ,newspace->dataPtr()->iColour()!=PDT::Colour3); newout->addColoured(newg ,newspace->dataPtr()->iColour()==PDT::Colour3); } else { ShowerParticlePtr newtime(new_ptr(ShowerParticle(partons_[system][1],true))); newtime->set5Momentum(ComptonMomenta_[system][1]+ComptonMomenta_[system][2]); HardBranchingPtr spaceBranch(new_ptr(HardBranching(newqin,SudakovPtr(), HardBranchingPtr(), HardBranching::Incoming))); HardBranchingPtr offBranch(new_ptr(HardBranching(newtime,SudakovPtr(), HardBranchingPtr(), HardBranching::Outgoing))); HardBranchingPtr g(new_ptr(HardBranching(newg,SudakovPtr(),offBranch, HardBranching::Outgoing))); HardBranchingPtr outBranch(new_ptr(HardBranching(newqout,SudakovPtr(),offBranch, HardBranching::Outgoing))); offBranch->addChild(outBranch); offBranch->addChild(g); offBranch->type(offBranch->branchingParticle()->id()>0 ? ShowerPartnerType::QCDColourLine : ShowerPartnerType::QCDAntiColourLine); spaceBranchings.push_back(spaceBranch); allBranchings.push_back(spaceBranch); allBranchings.push_back(offBranch); ColinePtr newin(new_ptr(ColourLine())),newout(new_ptr(ColourLine())); newin ->addColoured(newqin ,newqin->dataPtr()->iColour()!=PDT::Colour3); newin ->addColoured(newtime ,newqin->dataPtr()->iColour()!=PDT::Colour3); newin ->addColoured(newg ,newqin->dataPtr()->iColour()!=PDT::Colour3); newout->addColoured(newg ,newqin->dataPtr()->iColour()==PDT::Colour3); newout->addColoured(newqout ,newqin->dataPtr()->iColour()!=PDT::Colour3); } } // BGF hardest else { for(unsigned int ix=0;ixset5Momentum(BGFMomenta_[system][1]); ShowerParticlePtr newqbar(new_ptr(ShowerParticle(partons_[system][0]->CC(),true))); newqbar->set5Momentum(BGFMomenta_[system][2]); ShowerParticlePtr newg (new_ptr(ShowerParticle(gluon_,false))); newg->set5Momentum(BGFMomenta_[system][0]); ShowerParticlePtr newspace(new_ptr(ShowerParticle(partons_[system][0],false))); newspace->set5Momentum(BGFMomenta_[system][0]-BGFMomenta_[system][2]); HardBranchingPtr spaceBranch(new_ptr(HardBranching(newg,SudakovPtr(),HardBranchingPtr(), HardBranching::Incoming))); HardBranchingPtr offBranch(new_ptr(HardBranching(newspace,SudakovPtr(),spaceBranch, HardBranching::Incoming))); HardBranchingPtr qbar(new_ptr(HardBranching(newqbar,SudakovPtr(),spaceBranch, HardBranching::Outgoing))); spaceBranch->addChild(offBranch); spaceBranch->addChild(qbar); spaceBranch->type(offBranch->branchingParticle()->id()>0 ? ShowerPartnerType::QCDColourLine : ShowerPartnerType::QCDAntiColourLine); HardBranchingPtr outBranch(new_ptr(HardBranching(newq,SudakovPtr(), HardBranchingPtr(), HardBranching::Outgoing))); spaceBranchings.push_back(spaceBranch); allBranchings.push_back(offBranch); allBranchings.push_back(outBranch); ColinePtr newin(new_ptr(ColourLine())),newout(new_ptr(ColourLine())); newout->addColoured(newspace,newspace->dataPtr()->iColour()!=PDT::Colour3); newout->addColoured(newq ,newspace->dataPtr()->iColour()!=PDT::Colour3); newout->addColoured(newg ,newspace->dataPtr()->iColour()!=PDT::Colour3); newin ->addColoured(newg ,newspace->dataPtr()->iColour()==PDT::Colour3); newin ->addColoured(newqbar ,newspace->dataPtr()->iColour()==PDT::Colour3); } allBranchings[3]->colourPartner(allBranchings[4]); allBranchings[4]->colourPartner(allBranchings[3]); HardTreePtr newTree(new_ptr(HardTree(allBranchings,spaceBranchings, ShowerInteraction::QCD))); // Set the maximum pt for all other emissions and connect hard and shower tree Energy pT = isCompton ? pTCompton_[system] : pTBGF_[system]; // incoming particles for(map::const_iterator cit=tree->incomingLines().begin();cit!=tree->incomingLines().end();++cit) { // set maximum pT if(QuarkMatcher::Check(cit->first->progenitor()->data())) cit->first->maximumpT(pT,ShowerInteraction::QCD); set::iterator cjt=newTree->branchings().begin(); if(cit->first->progenitor()==first.first) { ++cjt;++cjt;++cjt; } newTree->connect(cit->first->progenitor(),*cjt); tPPtr beam =cit->first->original(); if(!beam->parents().empty()) beam=beam->parents()[0]; (*cjt)->beam(beam); HardBranchingPtr parent=(*cjt)->parent(); while(parent) { parent->beam(beam); parent=parent->parent(); }; } // outgoing particles for(map::const_iterator cit=tree->outgoingLines().begin();cit!=tree->outgoingLines().end();++cit) { // set maximum pT if(QuarkMatcher::Check(cit->first->progenitor()->data())) cit->first->maximumpT(pT,ShowerInteraction::QCD); for(set::iterator cjt=newTree->branchings().begin(); cjt!=newTree->branchings().end();++cjt) { if((*cjt)->branchingParticle()->isFinalState()&& (*cjt)->branchingParticle()->id()==cit->first->progenitor()->id()) { newTree->connect(cit->first->progenitor(),*cjt); } } } // set the evolution partners and scales ShowerParticleVector particles; for(set::iterator cit=newTree->branchings().begin(); cit!=newTree->branchings().end();++cit) { particles.push_back((*cit)->branchingParticle()); } for(set::iterator cjt=newTree->branchings().begin(); cjt!=newTree->branchings().end();++cjt) { if(cjt==newTree->branchings().begin()) { (**cjt).showerMomentum((**cjt).branchingParticle()->momentum()); ++cjt; (**cjt).showerMomentum((**cjt).branchingParticle()->momentum()); ++cjt; (**cjt).showerMomentum((**cjt).branchingParticle()->momentum()); ++cjt; } } return newTree; } void MEPP2HiggsVBF::generateCompton(unsigned int system) { // calculate the A coefficient for the correlations acoeff_ = A(partons_[system][0],partons_[system][1], partons_[system][2],partons_[system][3]); // maximum value of the xT double xT = sqrt((1.-xB_[system])/xB_[system]); double xTMin = 2.*pTmin_/sqrt(q2_[system]); double zp; // prefactor double a = alpha_->overestimateValue()*comptonWeight_/Constants::twopi; // loop to generate kinematics double wgt(0.),xp(0.); l_ = 2.*pother_[system][0]/sqrt(q2_[system]); m_ = 2.*pother_[system][1]/sqrt(q2_[system]); vector azicoeff; do { wgt = 0.; // intergration variables dxT/xT^3 xT *= 1./sqrt(1.-2.*log(UseRandom::rnd())/a*sqr(xT)); // dz zp = UseRandom::rnd(); xp = 1./(1.+0.25*sqr(xT)/zp/(1.-zp)); // check allowed if(xp1.) continue; // phase-space piece of the weight wgt = 8.*(1.-xp)*zp/comptonWeight_; // PDF piece of the weight Energy2 mu2 = q2_[system]*((1.-xp)*(1-zp)*zp/xp+1.); double pdf = pdf_[system]->xfx(beam_[system],partons_[system][0], mu2 ,xB_[system]/xp)/ pdf_[system]->xfx(beam_[system],partons_[system][0], scale(),xB_[system] ); wgt *= max(pdf,0.); // me piece of the weight // double me = comptonME(system,xT,xp,zp,phi); double x2 = 1.-(1.-zp)/xp; azicoeff = ComptonME(xp,x2,xT,l_,m_); double me = 4./3.*alpha_->ratio(0.25*q2_[system]*sqr(xT))* (azicoeff[0]+0.5*azicoeff[2]+0.5*azicoeff[4]); wgt *= me; if(wgt>1.||wgt<0.) { ostringstream wstring; wstring << "MEPP2HiggsVBF::generateCompton() " << "Weight greater than one or less than zero" << "wgt = " << wgt << "\n"; generator()->logWarning( Exception(wstring.str(), Exception::warning) ); } } while(xT>xTMin&&UseRandom::rnd()>wgt); if(xT<=xTMin) { pTCompton_[system]=-GeV; return; } // generate phi unsigned int itry(0); double phimax = std::accumulate(azicoeff.begin(),azicoeff.end(),0.); double phiwgt,phi; do { phi = UseRandom::rnd()*Constants::twopi; double cphi(cos(phi)),sphi(sin(phi)); phiwgt = azicoeff[0]+azicoeff[5]*sphi*cphi +azicoeff[1]*cphi+azicoeff[2]*sqr(cphi) +azicoeff[3]*sphi+azicoeff[4]*sqr(sphi); ++itry; } while (phimax*UseRandom::rnd() > phiwgt && itry<200); if(itry==200) throw Exception() << "Too many tries in MEPP2HiggsVBF" << "::generateCompton() to" << " generate phi" << Exception::eventerror; // momenta for the configuration Energy Q(sqrt(q2_[system])); double x1 = -1./xp; double x2 = 1.-(1.-zp)/xp; double x3 = 2.+x1-x2; Lorentz5Momentum p1( 0.5*Q*xT*cos(phi), 0.5*Q*xT*sin(phi), -0.5*Q*x2, 0.5*Q*sqrt(sqr(xT)+sqr(x2))); Lorentz5Momentum p2(-0.5*Q*xT*cos(phi), -0.5*Q*xT*sin(phi), -0.5*Q*x3, 0.5*Q*sqrt(sqr(xT)+sqr(x3))); Lorentz5Momentum p0(ZERO,ZERO,-0.5*Q*x1,-0.5*Q*x1); pTCompton_[system] = 0.5*Q*xT; ComptonMomenta_[system].resize(3); ComptonMomenta_[system][0] = p0; ComptonMomenta_[system][1] = p1; ComptonMomenta_[system][2] = p2; ComptonISFS_[system] = zp>xp; } double MEPP2HiggsVBF::comptonME(unsigned int system, double xT, double xp, double zp, double phi) { // scale and prefactors double CFfact = 4./3.*alpha_->ratio(0.25*q2_[system]*sqr(xT)); Energy Q(sqrt(q2_[system])); double x1 = -1./xp; double x2 = 1.-(1.-zp)/xp; double x3 = 2.+x1-x2; //set NLO momenta Lorentz5Momentum p1( 0.5*Q*xT*cos(phi), 0.5*Q*xT*sin(phi), -0.5*Q*x2, 0.5*Q*sqrt(sqr(xT)+sqr(x2))); Lorentz5Momentum p2(-0.5*Q*xT*cos(phi), -0.5*Q*xT*sin(phi), -0.5*Q*x3, 0.5*Q*sqrt(sqr(xT)+sqr(x3))); Lorentz5Momentum p0(ZERO,ZERO,-0.5*Q*x1,-0.5*Q*x1); Lorentz5Momentum qnlo = p2+p1-p0; // Breit frame variables Lorentz5Momentum r1 = -p0/x1; Lorentz5Momentum r2 = p1/x2; // electroweak parameters double c0L,c1L,c0R,c1R; // W if(partons_[system][0]->id()!=partons_[system][1]->id()) { c0L = sqrt(0.5); c0R = 0; c1L = sqrt(0.5); c1R = 0; } // Z else { if(abs(partons_[system][0]->id())%2==0) { c0L = generator()->standardModel()->vu()+ generator()->standardModel()->au(); c0R = generator()->standardModel()->vu()- generator()->standardModel()->au(); } else { c0L = generator()->standardModel()->vd()+ generator()->standardModel()->ad(); c0R = generator()->standardModel()->vd()- generator()->standardModel()->ad(); } if(abs(partons_[system][2]->id())%2==0) { c1L = generator()->standardModel()->vu()+ generator()->standardModel()->au(); c1R = generator()->standardModel()->vu()- generator()->standardModel()->au(); } else { c1L = generator()->standardModel()->vd()+ generator()->standardModel()->ad(); c1R = generator()->standardModel()->vd()- generator()->standardModel()->ad(); } c0L *= 0.25; c0R *= 0.25; c1L *= 0.25; c1R *= 0.25; } // Matrix element variables double G1 = sqr(c0L*c1L)+sqr(c0R*c1R); double G2 = sqr(c0L*c1R)+sqr(c0R*c1L); Energy4 term1,term2,loME; if(partons_[system][0]->id()>0) { if(partons_[system][2]->id()>0) { term1 = loMatrixElement(r1 ,pother_[system][0], qnlo+r1 ,pother_[system][1],G1,G2); term2 = loMatrixElement(r2-qnlo ,pother_[system][0], r2 ,pother_[system][1],G1,G2); loME = loMatrixElement(psystem_[system][0],pother_[system][0], psystem_[system][1],pother_[system][1],G1,G2); } else { term1 = loMatrixElement(r1 ,pother_[system][1], qnlo+r1 ,pother_[system][0],G1,G2); term2 = loMatrixElement(r2-qnlo ,pother_[system][1], r2 ,pother_[system][0],G1,G2); loME = loMatrixElement(psystem_[system][0],pother_[system][1], psystem_[system][1],pother_[system][0],G1,G2); } } else { if(partons_[system][2]->id()>0) { term1 = loMatrixElement(qnlo+r1 ,pother_[system][0], r1 ,pother_[system][1],G1,G2); term2 = loMatrixElement(r2 ,pother_[system][0], r2-qnlo ,pother_[system][1],G1,G2); loME = loMatrixElement(psystem_[system][1],pother_[system][0], psystem_[system][0],pother_[system][1],G1,G2); } else { term1 = loMatrixElement(qnlo+r1,pother_[system][1],r1 , pother_[system][0],G1,G2); term2 = loMatrixElement(r2 ,pother_[system][1],r2-qnlo, pother_[system][0],G1,G2); loME = loMatrixElement(psystem_[system][1],pother_[system][1], psystem_[system][0],pother_[system][0],G1,G2); } } double R1 = term1/loME; double R2 = sqr(x2)/(sqr(x2)+sqr(xT))*(term2/loME); // debuggingMatrixElement(false, // partons_[system][0],partons_[system][1], // partons_[system][2],partons_[system][3], // psystem_[system][0],psystem_[system][1], // pother_ [system][0],pother_ [system][1], // p0,p1,p2,phiggs_[system],q2_[system],scale(), // 8.*Constants::pi/(1.-xp)/(1.-zp)*(R1+sqr(xp)*(sqr(x2)+sqr(xT))*R2)); // cerr << "testing pieces A " << R1 << " " << sqr(xp)*(sqr(x2)+sqr(xT)) << " " << R2 << "\n"; return CFfact*(R1+sqr(xp)*(sqr(x2)+sqr(xT))*R2); } void MEPP2HiggsVBF::generateBGF(unsigned int system) { // maximum value of the xT double xT = (1.-xB_[system])/xB_[system]; double xTMin = 2.*pTmin_/sqrt(q2_[system]); double zp; // prefactor double a = alpha_->overestimateValue()*BGFWeight_/Constants::twopi; // loop to generate kinematics double wgt(0.),xp(0.); l_ = 2.*pother_[system][0]/sqrt(q2_[system]); m_ = 2.*pother_[system][1]/sqrt(q2_[system]); vector azicoeff; do { wgt = 0.; // intergration variables dxT/xT^3 xT *= 1./sqrt(1.-2.*log(UseRandom::rnd())/a*sqr(xT)); // dzp zp = UseRandom::rnd(); xp = 1./(1.+0.25*sqr(xT)/zp/(1.-zp)); // check allowed if(xp1.) continue; // phase-space piece of the weight wgt = 8.*sqr(1.-xp)*zp/BGFWeight_; // PDF piece of the weight Energy2 mu2 = q2_[system]*((1.-xp)*(1-zp)*zp/xp+1.); wgt *= pdf_[system]->xfx(beam_[system],gluon_ , mu2 ,xB_[system]/xp)/ pdf_[system]->xfx(beam_[system],partons_[system][0], scale(),xB_[system]); // me piece of the weight //double me = BGFME(system,xT,xp,zp,phi); double x1 = -1./xp; double x2 = 1.-(1.-zp)/xp; double x3 = 2.+x1-x2; azicoeff = BGFME(xp,x2,x3,xT,l_,m_); double me = 0.5*alpha_->ratio(0.25*q2_[system]*sqr(xT))* (azicoeff[0]+0.5*azicoeff[2]+0.5*azicoeff[4]); wgt *= me; if(wgt>1.||wgt<0.) { ostringstream wstring; wstring << "MEPP2HiggsVBF::generateBGF() " << "Weight greater than one or less than zero" << "wgt = " << wgt << "\n"; generator()->logWarning( Exception(wstring.str(), Exception::warning) ); } } while(xT>xTMin&&UseRandom::rnd()>wgt); if(xT<=xTMin) { pTBGF_[system] = -GeV; return; } // generate phi unsigned int itry(0); double phimax = std::accumulate(azicoeff.begin(),azicoeff.end(),0.); double phiwgt,phi; do { phi = UseRandom::rnd()*Constants::twopi; double cphi(cos(phi)),sphi(sin(phi)); phiwgt = azicoeff[0]+azicoeff[5]*sphi*cphi +azicoeff[1]*cphi+azicoeff[2]*sqr(cphi) +azicoeff[3]*sphi+azicoeff[4]*sqr(sphi); ++itry; } while (phimax*UseRandom::rnd() > phiwgt && itry<200); if(itry==200) throw Exception() << "Too many tries in MEPP2HiggsVBF" << "::generateBGF() to" << " generate phi" << Exception::eventerror; // momenta for the configuration Energy Q(sqrt(q2_[system])); double x1 = -1./xp; double x2 = 1.-(1.-zp)/xp; double x3 = 2.+x1-x2; Lorentz5Momentum p1( 0.5*Q*xT*cos(phi), 0.5*Q*xT*sin(phi), -0.5*Q*x2, 0.5*Q*sqrt(sqr(xT)+sqr(x2))); Lorentz5Momentum p2(-0.5*Q*xT*cos(phi), -0.5*Q*xT*sin(phi), -0.5*Q*x3, 0.5*Q*sqrt(sqr(xT)+sqr(x3))); Lorentz5Momentum p0(ZERO,ZERO,-0.5*Q*x1,-0.5*Q*x1); pTBGF_[system] = 0.5*Q*xT; BGFMomenta_[system].resize(3); BGFMomenta_[system][0] = p0; BGFMomenta_[system][1] = p1; BGFMomenta_[system][2] = p2; } double MEPP2HiggsVBF::BGFME(unsigned int system, double xT, double xp, double zp, double phi) { // scale and prefactors double TRfact = 0.5*alpha_->ratio(0.25*q2_[system]*sqr(xT)); Energy Q(sqrt(q2_[system])); double x1 = -1./xp; double x2 = 1.-(1.-zp)/xp; double x3 = 2.+x1-x2; // Set NLO momenta Lorentz5Momentum p1( 0.5*Q*xT*cos(phi), 0.5*Q*xT*sin(phi), -0.5*Q*x2, 0.5*Q*sqrt(sqr(xT)+sqr(x2))); Lorentz5Momentum p2(-0.5*Q*xT*cos(phi), -0.5*Q*xT*sin(phi), -0.5*Q*x3, 0.5*Q*sqrt(sqr(xT)+sqr(x3))); Lorentz5Momentum p0(ZERO,ZERO,-0.5*Q*x1,-0.5*Q*x1); Lorentz5Momentum qnlo = p2+p1-p0; // Breit frame variables Lorentz5Momentum r2 = p1/x2; Lorentz5Momentum r3 = -p2/x3; // electroweak parameters double c0L,c1L,c0R,c1R; // W if(partons_[system][0]->id()!=partons_[system][1]->id()) { c0L = sqrt(0.5); c0R = 0; c1L = sqrt(0.5); c1R = 0; } // Z else { if(abs(partons_[system][0]->id())%2==0) { c0L = generator()->standardModel()->vu()+ generator()->standardModel()->au(); c0R = generator()->standardModel()->vu()- generator()->standardModel()->au(); } else { c0L = generator()->standardModel()->vd()+ generator()->standardModel()->ad(); c0R = generator()->standardModel()->vd()- generator()->standardModel()->ad(); } if(abs(partons_[system][2]->id())%2==0) { c1L = generator()->standardModel()->vu()+ generator()->standardModel()->au(); c1R = generator()->standardModel()->vu()- generator()->standardModel()->au(); } else { c1L = generator()->standardModel()->vd()+ generator()->standardModel()->ad(); c1R = generator()->standardModel()->vd()- generator()->standardModel()->ad(); } c0L *= 0.25; c0R *= 0.25; c1L *= 0.25; c1R *= 0.25; } // Matrix element variables double G1 = sqr(c0L*c1L)+sqr(c0R*c1R); double G2 = sqr(c0L*c1R)+sqr(c0R*c1L); Energy4 term2,term3,loME; if(partons_[system][0]->id()>0) { if(partons_[system][2]->id()>0) { term2 = loMatrixElement(r2-qnlo,pother_[system][0], r2 ,pother_[system][1],G1,G2); term3 = loMatrixElement(r3 ,pother_[system][0], qnlo+r3,pother_[system][1],G1,G2); loME = loMatrixElement(psystem_[system][0],pother_[system][0], psystem_[system][1],pother_[system][1],G1,G2); } else { term2 = loMatrixElement(r2-qnlo,pother_[system][1], r2 ,pother_[system][0],G1,G2); term3 = loMatrixElement(r3 ,pother_[system][1], qnlo+r3,pother_[system][0],G1,G2); loME = loMatrixElement(psystem_[system][0],pother_[system][1], psystem_[system][1],pother_[system][0],G1,G2); } } else { if(partons_[system][2]->id()>0) { term2 = loMatrixElement(r2 ,pother_[system][0], r2-qnlo,pother_[system][1],G1,G2); term3 = loMatrixElement(qnlo+r3,pother_[system][0], r3 ,pother_[system][1],G1,G2); loME = loMatrixElement(psystem_[system][1],pother_[system][0], psystem_[system][0],pother_[system][1],G1,G2); } else { term2 = loMatrixElement(r2 ,pother_[system][1], r2-qnlo,pother_[system][0],G1,G2); term3 = loMatrixElement(qnlo+r3,pother_[system][1], r3 ,pother_[system][0],G1,G2); loME = loMatrixElement(psystem_[system][1],pother_[system][1], psystem_[system][0],pother_[system][0],G1,G2); } } double R3 = sqr(x3)/(sqr(x3)+sqr(xT))*(term3/loME); double R2 = sqr(x2)/(sqr(x2)+sqr(xT))*(term2/loME); // debuggingMatrixElement(true, // partons_[system][0],partons_[system][1], // partons_[system][2],partons_[system][3], // psystem_[system][0],psystem_[system][1], // pother_ [system][0],pother_ [system][1], // p0,p1,p2,phiggs_[system],q2_[system], // 8.*Constants::pi/zp/(1.-zp)*(sqr(xp)*(sqr(x3)+sqr(xT))*R3+ // sqr(xp)*(sqr(x2)+sqr(xT))*R2)); return TRfact* (sqr(xp)*(sqr(x3)+sqr(xT))*R3+ sqr(xp)*(sqr(x2)+sqr(xT))*R2); } Energy4 MEPP2HiggsVBF::loMatrixElement(const Lorentz5Momentum &p1, const Lorentz5Momentum &p2, const Lorentz5Momentum &q1, const Lorentz5Momentum &q2, double G1, double G2) const { return G1*(p1*p2)*(q1*q2) + G2*(p1*q2)*(q1*p2); } void MEPP2HiggsVBF::initializeMECorrection(ShowerTreePtr tree, double & initial, double & final) { systems_.clear(); for(map::const_iterator cit=tree->incomingLines().begin();cit!=tree->incomingLines().end();++cit) { if(QuarkMatcher::Check(cit->first->progenitor()->data())) { systems_.push_back(tChannelPair()); systems_.back().hadron = cit->first->original()->parents()[0]; systems_.back().beam = cit->first->beam(); systems_.back().incoming = cit->first->progenitor(); systems_.back().pdf = systems_.back().beam->pdf(); } } vector outgoing; for(map::const_iterator cjt=tree->outgoingLines().begin();cjt!=tree->outgoingLines().end();++cjt) { if(cjt->first->progenitor()->id()==ParticleID::h0) higgs_ = cjt->first->progenitor(); else if(QuarkMatcher::Check(cjt->first->progenitor()->data())) outgoing.push_back(cjt->first->progenitor()); } assert(outgoing.size()==2&&higgs_); // match up the quarks for(unsigned int ix=0;ixcolourLine()) { for(unsigned int iy=0;iycolourLine()==systems_[ix].incoming->colourLine()) { systems_[ix].outgoing=outgoing[iy]; break; } } } else { for(unsigned int iy=0;iyantiColourLine()==systems_[ix].incoming->antiColourLine()) { systems_[ix].outgoing=outgoing[iy]; break; } } } } assert(systems_[0].outgoing&&systems_[1].outgoing); assert(systems_.size()==2); initial = initial_; final = final_; } void MEPP2HiggsVBF::applyHardMatrixElementCorrection(ShowerTreePtr tree) { static const double eps = 1e-6; // select emitting line if(UseRandom::rndbool()) swap(systems_[0],systems_[1]); // extract the born variables q_[0] = systems_[0].outgoing->momentum()-systems_[0].incoming->momentum(); q2_[0] = -q_[0].m2(); Energy Q = sqrt(q2_[0]); xB_[0] = systems_[0].incoming->x(); // construct lorentz transform from lab to breit frame Lorentz5Momentum phadron = systems_[0].hadron->momentum(); phadron.setMass(0.*GeV); phadron.rescaleEnergy(); Lorentz5Momentum pcmf = phadron+0.5/xB_[0]*q_[0]; pcmf.rescaleMass(); LorentzRotation rot(-pcmf.boostVector()); Lorentz5Momentum pbeam = rot*phadron; Axis axis(pbeam.vect().unit()); double sinth(sqrt(sqr(axis.x())+sqr(axis.y()))); rot.rotate(-acos(axis.z()),Axis(-axis.y()/sinth,axis.x()/sinth,0.)); Lorentz5Momentum pout = rot*(systems_[1].outgoing->momentum()+higgs_->momentum()); rot.rotateZ(-atan2(pout.y(),pout.x())); // calculate the A coefficient for the correlations acoeff_ = A(systems_[0].incoming->dataPtr(),systems_[0].outgoing->dataPtr(), systems_[1].incoming->dataPtr(),systems_[1].outgoing->dataPtr()); vector azicoeff; // select the type of process bool BGF = UseRandom::rnd()>procProb_; double wgt,xp,zp,x1,x2,x3,xperp; l_ = 2.*(rot*systems_[1].incoming->momentum())/Q; m_ = 2.*(rot*systems_[1].outgoing->momentum())/Q; // compton process if(!BGF) { wgt = generateComptonPoint(xp,zp); if(xpvalue(mu2)/procProb_; // PDF piece wgt *= systems_[0].pdf->xfx(systems_[0].beam, systems_[0].incoming->dataPtr(),mu2 ,xB_[0]/xp)/ systems_[0].pdf->xfx(systems_[0].beam, systems_[0].incoming->dataPtr(),scale(),xB_[0] ); // numerator factors wgt /= (1.-xp)*(1.-zp); // other bits xperp = sqrt(4.*(1.-xp)*(1.-zp)*zp/xp); x1 = -1./xp; x2 = 1.-(1.-zp)/xp; x3 = 2.+x1-x2; // matrix element pieces azicoeff = ComptonME(xp,x2,xperp,l_,m_); } else { wgt = generateBGFPoint(xp,zp); if(xp<1e-6) return; // common pieces Energy2 mu2 = q2_[0]*((1.-xp)*(1-zp)*zp/xp+1); wgt *= 0.25/Constants::pi*alpha_->value(mu2)/(1.-procProb_); // PDF piece wgt *= systems_[0].pdf->xfx(systems_[0].beam, gluon_ ,mu2 ,xB_[0]/xp)/ systems_[0].pdf->xfx(systems_[0].beam, systems_[0].incoming->dataPtr(),scale(),xB_[0] ); // numerator factors wgt /= (1.-zp); // other bits xperp = sqrt(4.*(1.-xp)*(1.-zp)*zp/xp); x1 = -1./xp; x2 = 1.-(1.-zp)/xp; x3 = 2.+x1-x2; // matrix element pieces azicoeff = BGFME(xp,x2,x3,xperp,l_,m_); } // compute the azimuthal average of the weight wgt *= azicoeff[0]+0.5*(azicoeff[2]+azicoeff[4]); // finally factor as picked one line wgt *= 2.; // decide whether or not to accept the weight if(UseRandom::rnd()>wgt) return; // if accepted generate generate phi unsigned int itry(0); double phimax = std::accumulate(azicoeff.begin(),azicoeff.end(),0.); double phiwgt,phi; do { phi = UseRandom::rnd()*Constants::twopi; double cphi(cos(phi)),sphi(sin(phi)); phiwgt = azicoeff[0]+azicoeff[5]*sphi*cphi +azicoeff[1]*cphi+azicoeff[2]*sqr(cphi) +azicoeff[3]*sphi+azicoeff[4]*sqr(sphi); ++itry; } while (phimax*UseRandom::rnd() > phiwgt && itry<200); if(itry==200) throw Exception() << "Too many tries in VBFMECorrection" << "::applyHardMatrixElementCorrection() to" << " generate phi" << Exception::eventerror; // compute the new incoming and outgoing momenta Lorentz5Momentum p1 = Lorentz5Momentum( 0.5*Q*xperp*cos(phi), 0.5*Q*xperp*sin(phi), -0.5*Q*x2,0.*GeV,0.*GeV); p1.rescaleEnergy(); Lorentz5Momentum p2 = Lorentz5Momentum(-0.5*Q*xperp*cos(phi),-0.5*Q*xperp*sin(phi), -0.5*Q*x3,0.*GeV,0.*GeV); p2.rescaleEnergy(); Lorentz5Momentum pin(0.*GeV,0.*GeV,-0.5*x1*Q,-0.5*x1*Q,0.*GeV); // debugging code to test vs helicity amplitude expression for matrix elements // double cphi(cos(phi)),sphi(sin(phi)); // double old = (azicoeff[0]+azicoeff[5]*sphi*cphi // +azicoeff[1]*cphi+azicoeff[2]*sqr(cphi) // +azicoeff[3]*sphi+azicoeff[4]*sqr(sphi)); // if(!BGF) { // old *= 8.*Constants::pi/(1.-xp)/(1.-zp); // } // else { // old *= 8.*Constants::pi/zp/(1.-zp); // } // debuggingMatrixElement(BGF, // systems_[0].incoming->dataPtr(), // systems_[0].outgoing->dataPtr(), // systems_[1].incoming->dataPtr(), // systems_[1].outgoing->dataPtr(), // rot*systems_[0].incoming->momentum(), // rot*systems_[0].outgoing->momentum(), // rot*systems_[1].incoming->momentum(), // rot*systems_[1].outgoing->momentum(), // pin,p1,p2,rot*higgs_->momentum(), // q2_[0],scale(),old); // we need inverse of the rotation, i.e back to lab from breit rot.invert(); // transform the momenta to lab frame pin *= rot; p1 *= rot; p2 *= rot; // test to ensure outgoing particles can be put on-shell if(!BGF) { if(p1.e()dataPtr()->constituentMass()) return; if(p2.e()constituentMass()) return; } else { if(p1.e()dataPtr() ->constituentMass()) return; if(p2.e()dataPtr()->CC()->constituentMass()) return; } // stats for weights > 1 if(wgt>1.) { ++nover_; if(!BGF) maxwgt_.first = max(maxwgt_.first ,wgt); else maxwgt_.second = max(maxwgt_.second,wgt); } // create the new particles and add to ShowerTree bool isquark = systems_[0].incoming->colourLine(); if(!BGF) { PPtr newin = new_ptr(Particle(*systems_[0].incoming)); newin->set5Momentum(pin); PPtr newg = gluon_ ->produceParticle(p2 ); PPtr newout = systems_[0].outgoing->dataPtr()->produceParticle(p1 ); ColinePtr col=isquark ? systems_[0].incoming->colourLine() : systems_[0].incoming->antiColourLine(); ColinePtr newline=new_ptr(ColourLine()); // final-state emission if(xp>zp) { col->removeColoured(newout,!isquark); col->addColoured(newin,!isquark); col->addColoured(newg,!isquark); newline->addColoured(newg,isquark); newline->addColoured(newout,!isquark); } // initial-state emission else { col->removeColoured(newin ,!isquark); col->addColoured(newout,!isquark); col->addColoured(newg,isquark); newline->addColoured(newg,!isquark); newline->addColoured(newin,!isquark); } PPtr orig; for(map::const_iterator cit=tree->incomingLines().begin();cit!=tree->incomingLines().end();++cit) { if(cit->first->progenitor()!=systems_[0].incoming) continue; // remove old particles from colour line col->removeColoured(cit->first->copy(),!isquark); col->removeColoured(cit->first->progenitor(),!isquark); // insert new particles cit->first->copy(newin); ShowerParticlePtr sp(new_ptr(ShowerParticle(*newin,1,false))); cit->first->progenitor(sp); tree->incomingLines()[cit->first]=sp; sp->x(xB_[0]/xp); cit->first->perturbative(xp>zp); if(xp<=zp) orig=cit->first->original(); } for(map::const_iterator cit=tree->outgoingLines().begin();cit!=tree->outgoingLines().end();++cit) { if(cit->first->progenitor()!=systems_[0].outgoing) continue; // remove old particles from colour line col->removeColoured(cit->first->copy(),!isquark); col->removeColoured(cit->first->progenitor(),!isquark); // insert new particles cit->first->copy(newout); ShowerParticlePtr sp(new_ptr(ShowerParticle(*newout,1,true))); cit->first->progenitor(sp); tree->outgoingLines()[cit->first]=sp; cit->first->perturbative(xp<=zp); if(xp>zp) orig=cit->first->original(); } assert(orig); // add the gluon ShowerParticlePtr sg=new_ptr(ShowerParticle(*newg,1,true)); ShowerProgenitorPtr gluon=new_ptr(ShowerProgenitor(orig,newg,sg)); gluon->perturbative(false); tree->outgoingLines().insert(make_pair(gluon,sg)); tree->hardMatrixElementCorrection(true); } else { PPtr newin = gluon_ ->produceParticle(pin); PPtr newqbar = systems_[0].incoming->dataPtr()->CC()->produceParticle(p2 ); PPtr newout = systems_[0].outgoing->dataPtr() ->produceParticle(p1 ); ColinePtr col=isquark ? systems_[0].incoming->colourLine() : systems_[0].incoming->antiColourLine(); ColinePtr newline=new_ptr(ColourLine()); col ->addColoured(newin ,!isquark); newline->addColoured(newin , isquark); col ->addColoured(newout ,!isquark); newline->addColoured(newqbar, isquark); PPtr orig; for(map::const_iterator cit=tree->incomingLines().begin();cit!=tree->incomingLines().end();++cit) { if(cit->first->progenitor()!=systems_[0].incoming) continue; // remove old particles from colour line col->removeColoured(cit->first->copy(),!isquark); col->removeColoured(cit->first->progenitor(),!isquark); // insert new particles cit->first->copy(newin); ShowerParticlePtr sp(new_ptr(ShowerParticle(*newin,1,false))); cit->first->progenitor(sp); tree->incomingLines()[cit->first]=sp; sp->x(xB_[0]/xp); cit->first->perturbative(false); orig=cit->first->original(); } for(map::const_iterator cit=tree->outgoingLines().begin();cit!=tree->outgoingLines().end();++cit) { if(cit->first->progenitor()!=systems_[0].outgoing) continue; // remove old particles from colour line col->removeColoured(cit->first->copy(),!isquark); col->removeColoured(cit->first->progenitor(),!isquark); // insert new particles cit->first->copy(newout); ShowerParticlePtr sp(new_ptr(ShowerParticle(*newout,1,true))); cit->first->progenitor(sp); tree->outgoingLines()[cit->first]=sp; cit->first->perturbative(true); } assert(orig); // add the (anti)quark ShowerParticlePtr sqbar=new_ptr(ShowerParticle(*newqbar,1,true)); ShowerProgenitorPtr qbar=new_ptr(ShowerProgenitor(orig,newqbar,sqbar)); qbar->perturbative(false); tree->outgoingLines().insert(make_pair(qbar,sqbar)); tree->hardMatrixElementCorrection(true); } } double MEPP2HiggsVBF::A(tcPDPtr qin1, tcPDPtr qout1, tcPDPtr qin2, tcPDPtr ) { double output; // charged current if(qin1->id()!=qout1->id()) { output = 2; } // neutral current else { double cvl,cal,cvq,caq; if(abs(qin2->id())%2==0) { cvl = generator()->standardModel()->vu(); cal = generator()->standardModel()->au(); } else { cvl = generator()->standardModel()->vd(); cal = generator()->standardModel()->ad(); } if(abs(qin1->id())%2==0) { cvq = generator()->standardModel()->vu(); caq = generator()->standardModel()->au(); } else { cvq = generator()->standardModel()->vd(); caq = generator()->standardModel()->ad(); } output = 8.*cvl*cal*cvq*caq/(sqr(cvl)+sqr(cal))/(sqr(cvq)+sqr(caq)); } if(qin1->id()<0) output *= -1.; if(qin2->id()<0) output *= -1; return output; } double MEPP2HiggsVBF::generateComptonPoint(double &xp, double & zp) { static const double maxwgt = 50.; double wgt,xperp2,x2; do { xp = UseRandom::rnd(); double zpmin = xp, zpmax = 1./(1.+xp*(1.-xp)); zp = 1.-pow((1.-zpmin)/(1.-zpmax),UseRandom::rnd())*(1.-zpmax); wgt = log((1.-zpmin)/(1.-zpmax))*(1.-zp); if(UseRandom::rndbool()) swap(xp,zp); xperp2 = 4.*(1.-xp)*(1.-zp)*zp/xp; x2 = 1.-(1.-zp)/xp; wgt *= 2.*(1.+sqr(xp)*(sqr(x2)+1.5*xperp2))/(1.-xp)/(1.-zp); if(wgt>maxwgt) if(wgt>maxwgt) { ostringstream wstring; wstring << "MEPP2HiggsVBF::generateComptonPoint() " << "Weight greater than maximum" << "wgt = " << wgt << " maxwgt = " << maxwgt << "\n"; generator()->logWarning( Exception(wstring.str(), Exception::warning) ); } } while(wgtmaxwgt) { ostringstream wstring; wstring << "DISBase::generateBGFPoint " << "Weight greater than maximum " << "wgt = " << wgt << " maxwgt = 1\n"; generator()->logWarning( Exception(wstring.str(), Exception::warning) ); } } while(wgtisFinalState() ? 1./final_ : 1./initial_); // check if me correction should be applied long id[2]={initial->id(),parent->id()}; if(id[0]!=id[1]||id[1]==ParticleID::g) return veto; // if not from the right side if(initial->progenitor()!=systems_[0].incoming && initial->progenitor()!=systems_[0].outgoing) return veto; // get the pT Energy pT=br.kinematics->pT(); // check if hardest so far if(pThighestpT()) return veto; double kappa(sqr(br.kinematics->scale())/q2_[0]),z(br.kinematics->z()); double zk((1.-z)*kappa); // final-state double wgt(0.); if(parent->isFinalState()) { double zp=z,xp=1./(1.+z*zk); double xperp = sqrt(4.*(1.-xp)*(1.-zp)*zp/xp); double x2 = 1.-(1.-zp)/xp; vector azicoeff = ComptonME(xp,x2,xperp,l_,m_); wgt = (azicoeff[0]+0.5*azicoeff[2]+0.5*azicoeff[4])* xp/(1.+sqr(z))/final_; if(wgt<.0||wgt>1.) { ostringstream wstring; wstring << "Soft ME correction weight too large or " << "negative for FSR in MEPP2HiggsVBF::" << "softMatrixElementVeto() soft weight " << " xp = " << xp << " zp = " << zp << " weight = " << wgt << "\n"; generator()->logWarning( Exception(wstring.str(), Exception::warning) ); } } else { double xp = 2.*z/(1.+zk+sqrt(sqr(1.+zk)-4.*z*zk)); double zp = 0.5* (1.-zk+sqrt(sqr(1.+zk)-4.*z*zk)); double xperp = sqrt(4.*(1.-xp)*(1.-zp)*zp/xp); double x1 = -1./xp, x2 = 1.-(1.-zp)/xp, x3 = 2.+x1-x2; // compton - if(br.ids[0]!=ParticleID::g) { + if(br.ids[0]->id()!=ParticleID::g) { vector azicoeff = ComptonME(xp,x2,xperp,l_,m_); wgt = (azicoeff[0]+0.5*azicoeff[2]+0.5*azicoeff[4])* xp*(1.-z)/(1.-xp)/(1.+sqr(z))/(1.-zp+xp-2.*xp*(1.-zp)); } // BGF else { vector azicoeff = BGFME(xp,x2,x3,xperp,l_,m_); wgt = (azicoeff[0]+0.5*azicoeff[2]+0.5*azicoeff[4])* xp/(1.-zp+xp-2.*xp*(1.-zp))/(sqr(z)+sqr(1.-z)); } wgt /=initial_; if(wgt<.0||wgt>1.) { ostringstream wstring; wstring << "Soft ME correction weight too large or " << "negative for ISR in MEPP2HiggsVBF::" << "softMatrixElementVeto() soft weight " << " xp = " << xp << " zp = " << zp << " weight = " << wgt << "\n"; generator()->logWarning( Exception(wstring.str(), Exception::warning) ); } } // if not vetoed if(UseRandom::rndbool(wgt)) return false; // otherwise parent->vetoEmission(br.type,br.kinematics->scale()); return true; } vector MEPP2HiggsVBF::ComptonME(double xp, double x2, double xperp, LorentzVector l, LorentzVector m) { vector output(6,0.); double cos2 = x2 /sqrt(sqr(x2)+sqr(xperp)); double sin2 = xperp/sqrt(sqr(x2)+sqr(xperp)); // no phi dependence output[0] = l.t()*m.t()-l.z()*m.z()*sqr(cos2)+0.5*acoeff_*cos2*(l.t()*m.z()-l.z()*m.t()); // cos(phi) output[1] = sin2*(-l.x()*m.t()-l.t()*m.x() + 0.5*acoeff_*cos2*(l.z()*m.x()-m.z()*l.x())); // cos(phi)^2 output[2] = +sqr(sin2)*l.x()*m.x(); // sin(phi) output[3] = sin2*(-l.t()*m.y()-l.y()*m.t() + 0.5*acoeff_*cos2*(l.z()*m.y()-m.z()*l.y())); // sin(phi)^2 output[4] = +sqr(sin2)*l.y()*m.y(); // sin(phi)cos(phi) output[5] = +sqr(sin2)*(m.y()*l.x()+m.x()*l.y()); // additional factors double denom = -l.z()*m.z()+l.t()*m.t()+0.5*acoeff_*(l.t()*m.z()-l.z()*m.t()); double fact = sqr(xp)*(sqr(x2)+sqr(xperp))/denom; for(unsigned int ix=0;ix MEPP2HiggsVBF::BGFME(double xp, double x2, double x3, double xperp, LorentzVector l, LorentzVector m) { vector output(6,0.); double denom = -l.z()*m.z()+l.t()*m.t()+0.5*acoeff_*(l.t()*m.z()-l.z()*m.t()); double cos2 = x2 /sqrt(sqr(x2)+sqr(xperp)); double sin2 = xperp/sqrt(sqr(x2)+sqr(xperp)); double fact2 = sqr(xp)*(sqr(x2)+sqr(xperp))/denom; double cos3 = x3 /sqrt(sqr(x3)+sqr(xperp)); double sin3 = xperp/sqrt(sqr(x3)+sqr(xperp)); double fact3 = sqr(xp)*(sqr(x3)+sqr(xperp))/denom; // no phi dependence output[0] = fact2*(l.t()*m.t()-l.z()*m.z()*sqr(cos2) + 0.5*acoeff_*cos2*(l.t()*m.z()-l.z()*m.t())) + fact3*(l.t()*m.t()-l.z()*m.z()*sqr(cos3) - 0.5*acoeff_*cos3*(l.t()*m.z()-l.z()*m.t())); // cos(phi) output[1] = fact2*sin2*( - l.x()*m.t()-l.t()*m.x() + 0.5*acoeff_*cos2*(l.z()*m.x()-m.z()*l.x())) - fact3*sin3*( - l.x()*m.t()-l.t()*m.x() - 0.5*acoeff_*cos3*(l.z()*m.x()-m.z()*l.x())) ; // cos(phi)^2 output[2] = (fact2*sqr(sin2)+fact3*sqr(sin3))*l.x()*m.x(); // sin(phi) output[3] = fact2*sin2*( - l.t()*m.y()-l.y()*m.t() + 0.5*acoeff_*cos2*(l.z()*m.y()-m.z()*l.y())) - fact3*sin3*( - l.t()*m.y()-l.y()*m.t() - 0.5*acoeff_*cos3*(l.z()*m.y()-m.z()*l.y())); // sin(phi)^2 output[4] = (fact2*sqr(sin2)+fact3*sqr(sin3))*l.y()*m.y(); // sin(phi)cos(phi) output[5] = (fact2*sqr(sin2)+fact3*sqr(sin3))*(m.y()*l.x()+m.x()*l.y()); // return the answer return output; } diff --git a/MatrixElement/Lepton/MEee2gZ2qq.cc b/MatrixElement/Lepton/MEee2gZ2qq.cc --- a/MatrixElement/Lepton/MEee2gZ2qq.cc +++ b/MatrixElement/Lepton/MEee2gZ2qq.cc @@ -1,1169 +1,1169 @@ // -*- C++ -*- // // MEee2gZ2qq.cc is a part of Herwig - A multi-purpose Monte Carlo event generator // Copyright (C) 2002-2011 The Herwig Collaboration // // Herwig is licenced under version 2 of the GPL, see COPYING for details. // Please respect the MCnet academic guidelines, see GUIDELINES for details. // // // This is the implementation of the non-inlined, non-templated member // functions of the MEee2gZ2qq class. // #include "MEee2gZ2qq.h" #include "ThePEG/Interface/ClassDocumentation.h" #include "ThePEG/Interface/Switch.h" #include "ThePEG/Interface/Parameter.h" #include "ThePEG/Interface/Reference.h" #include "ThePEG/Persistency/PersistentOStream.h" #include "ThePEG/Persistency/PersistentIStream.h" #include "ThePEG/PDT/EnumParticles.h" #include "ThePEG/MatrixElement/Tree2toNDiagram.h" #include "ThePEG/Handlers/StandardXComb.h" #include "Herwig/MatrixElement/HardVertex.h" #include "Herwig/Shower/Base/Evolver.h" #include "Herwig/Shower/Base/KinematicsReconstructor.h" #include "Herwig/Shower/Base/PartnerFinder.h" #include "ThePEG/PDF/PolarizedBeamParticleData.h" #include #include "ThePEG/Utilities/DescribeClass.h" using namespace Herwig; const double MEee2gZ2qq::EPS_=0.00000001; void MEee2gZ2qq::doinit() { HwMEBase::doinit(); massOption(vector(2,massopt_)); rescalingOption(3); if(minflav_>maxflav_) throw InitException() << "The minimum flavour " << minflav_ << "must be lower the than maximum flavour " << maxflav_ << " in MEee2gZ2qq::doinit() " << Exception::runerror; // set the particle data objects Z0_ = getParticleData(ParticleID::Z0); gamma_ = getParticleData(ParticleID::gamma); gluon_ = getParticleData(ParticleID::g); // cast the SM pointer to the Herwig SM pointer tcHwSMPtr hwsm= dynamic_ptr_cast(standardModel()); // do the initialisation if(!hwsm) throw InitException() << "Wrong type of StandardModel object in " << "MEee2gZ2qq::doinit() the Herwig version must be used" << Exception::runerror; FFZVertex_ = hwsm->vertexFFZ(); FFPVertex_ = hwsm->vertexFFP(); FFGVertex_ = hwsm->vertexFFG(); } void MEee2gZ2qq::getDiagrams() const { // specific the diagrams tcPDPtr ep = getParticleData(ParticleID::eplus); tcPDPtr em = getParticleData(ParticleID::eminus); tcPDPtr gamma = getParticleData(ParticleID::gamma); tcPDPtr Z0 = getParticleData(ParticleID::Z0); // setup the processes for ( int i =minflav_; i<=maxflav_; ++i ) { tcPDPtr qk = getParticleData(i); tcPDPtr qb = qk->CC(); add(new_ptr((Tree2toNDiagram(2), em, ep, 1, gamma, 3, qk, 3, qb, -1))); add(new_ptr((Tree2toNDiagram(2), em, ep, 1, Z0 , 3, qk, 3, qb, -2))); } } Energy2 MEee2gZ2qq::scale() const { return sqr(getParticleData(ParticleID::Z0)->mass()); // return sHat(); } unsigned int MEee2gZ2qq::orderInAlphaS() const { return 0; } unsigned int MEee2gZ2qq::orderInAlphaEW() const { return 2; } Selector MEee2gZ2qq::diagrams(const DiagramVector & diags) const { double lastCont(0.5),lastBW(0.5); if ( lastXCombPtr() ) { lastCont = meInfo()[0]; lastBW = meInfo()[1]; } Selector sel; for ( DiagramIndex i = 0; i < diags.size(); ++i ) { if ( diags[i]->id() == -1 ) sel.insert(lastCont, i); else if ( diags[i]->id() == -2 ) sel.insert(lastBW, i); } return sel; } Selector MEee2gZ2qq::colourGeometries(tcDiagPtr ) const { static const ColourLines c("-5 4"); Selector sel; sel.insert(1.0, &c); return sel; } void MEee2gZ2qq::persistentOutput(PersistentOStream & os) const { os << FFZVertex_ << FFPVertex_ << FFGVertex_ << Z0_ << gamma_ << gluon_ << minflav_ << maxflav_ << massopt_ << alphaQCD_ << alphaQED_ << ounit(pTminQED_,GeV) << ounit(pTminQCD_,GeV) << preFactor_ << spinCorrelations_; } void MEee2gZ2qq::persistentInput(PersistentIStream & is, int) { is >> FFZVertex_ >> FFPVertex_ >> FFGVertex_ >> Z0_ >> gamma_ >> gluon_ >> minflav_ >> maxflav_ >> massopt_ >> alphaQCD_ >> alphaQED_ >> iunit(pTminQED_,GeV) >> iunit(pTminQCD_,GeV) >> preFactor_ >> spinCorrelations_; } // The following static variable is needed for the type // description system in ThePEG. DescribeClass describeMEee2gZ2qq("Herwig::MEee2gZ2qq", "HwMELepton.so"); void MEee2gZ2qq::Init() { static ClassDocumentation documentation ("The MEee2gZ2qq class implements the matrix element for e+e- -> q qbar"); static Parameter interfaceMinimumFlavour ("MinimumFlavour", "The PDG code of the quark with the lowest PDG code to produce.", &MEee2gZ2qq::minflav_, 1, 1, 6, false, false, Interface::limited); static Parameter interfaceMaximumFlavour ("MaximumFlavour", "The PDG code of the quark with the highest PDG code to produce", &MEee2gZ2qq::maxflav_, 5, 1, 6, false, false, Interface::limited); static Switch interfaceTopMassOption ("TopMassOption", "Option for the treatment of the top quark mass", &MEee2gZ2qq::massopt_, 1, false, false); static SwitchOption interfaceTopMassOptionOnMassShell (interfaceTopMassOption, "OnMassShell", "The top is produced on its mass shell", 1); static SwitchOption interfaceTopMassOption2 (interfaceTopMassOption, "OffShell", "The top is generated off-shell using the mass and width generator.", 2); static Parameter interfacepTMinQED ("pTMinQED", "Minimum pT for hard QED radiation", &MEee2gZ2qq::pTminQED_, GeV, 1.0*GeV, 0.001*GeV, 10.0*GeV, false, false, Interface::limited); static Parameter interfacepTMinQCD ("pTMinQCD", "Minimum pT for hard QCD radiation", &MEee2gZ2qq::pTminQCD_, GeV, 1.0*GeV, 0.001*GeV, 10.0*GeV, false, false, Interface::limited); static Parameter interfacePrefactor ("Prefactor", "Prefactor for the overestimate of the emission probability", &MEee2gZ2qq::preFactor_, 6.0, 1.0, 100.0, false, false, Interface::limited); static Reference interfaceQCDCoupling ("AlphaQCD", "Pointer to the object to calculate the strong coupling for the correction", &MEee2gZ2qq::alphaQCD_, false, false, true, false, false); static Reference interfaceEMCoupling ("AlphaQED", "Pointer to the object to calculate the EM coupling for the correction", &MEee2gZ2qq::alphaQED_, false, false, true, false, false); static Switch interfaceSpinCorrelations ("SpinCorrelations", "Switch the construction of the veretx for spin correlations on/off", &MEee2gZ2qq::spinCorrelations_, true, false, false); static SwitchOption interfaceSpinCorrelationsYes (interfaceSpinCorrelations, "Yes", "Swtich On", true); static SwitchOption interfaceSpinCorrelationsNo (interfaceSpinCorrelations, "No", "Switch off", false); } double MEee2gZ2qq::me2() const { return loME(mePartonData(),rescaledMomenta(),true); } ProductionMatrixElement MEee2gZ2qq::HelicityME(vector & fin, vector & ain, vector & fout, vector & aout, double & me, double & cont, double & BW ) const { // the particles should be in the order // for the incoming // 0 incoming fermion (u spinor) // 1 incoming antifermion (vbar spinor) // for the outgoing // 0 outgoing fermion (ubar spinor) // 1 outgoing antifermion (v spinor) // me to be returned ProductionMatrixElement output(PDT::Spin1Half,PDT::Spin1Half, PDT::Spin1Half,PDT::Spin1Half); ProductionMatrixElement gamma (PDT::Spin1Half,PDT::Spin1Half, PDT::Spin1Half,PDT::Spin1Half); ProductionMatrixElement Zboson(PDT::Spin1Half,PDT::Spin1Half, PDT::Spin1Half,PDT::Spin1Half); // wavefunctions for the intermediate particles VectorWaveFunction interZ,interG; // temporary storage of the different diagrams Complex diag1,diag2; // sum over helicities to get the matrix element unsigned int inhel1,inhel2,outhel1,outhel2; double total[3]={0.,0.,0.}; for(inhel1=0;inhel1<2;++inhel1) { for(inhel2=0;inhel2<2;++inhel2) { // intermediate Z interZ = FFZVertex_->evaluate(scale(),1,Z0_,fin[inhel1],ain[inhel2]); // intermediate photon interG = FFPVertex_->evaluate(scale(),1,gamma_,fin[inhel1],ain[inhel2]); for(outhel1=0;outhel1<2;++outhel1) { for(outhel2=0;outhel2<2;++outhel2) { // first the Z exchange diagram diag1 = FFZVertex_->evaluate(scale(),aout[outhel2],fout[outhel1], interZ); // then the photon exchange diagram diag2 = FFPVertex_->evaluate(scale(),aout[outhel2],fout[outhel1], interG); // add up squares of individual terms total[1] += norm(diag1); Zboson(inhel1,inhel2,outhel1,outhel2) = diag1; total[2] += norm(diag2); gamma (inhel1,inhel2,outhel1,outhel2) = diag2; // the full thing including interference diag1 += diag2; total[0] += norm(diag1); output(inhel1,inhel2,outhel1,outhel2)=diag1; } } } } for(int ix=0;ix<3;++ix) total[ix] *= 0.25; tcPolarizedBeamPDPtr beam[2] = {dynamic_ptr_cast(mePartonData()[0]), dynamic_ptr_cast(mePartonData()[1])}; if( beam[0] || beam[1] ) { RhoDMatrix rho[2] = {beam[0] ? beam[0]->rhoMatrix() : RhoDMatrix(mePartonData()[0]->iSpin()), beam[1] ? beam[1]->rhoMatrix() : RhoDMatrix(mePartonData()[1]->iSpin())}; total[0] = output.average(rho[0],rho[1]); total[1] = Zboson.average(rho[0],rho[1]); total[2] = gamma .average(rho[0],rho[1]); } // results for(int ix=0;ix<3;++ix) total[ix]*= 3.; cont = total[2]; BW = total[1]; me = total[0]; return output; } void MEee2gZ2qq::constructVertex(tSubProPtr sub) { if(!spinCorrelations_) return; // extract the particles in the hard process ParticleVector hard; hard.push_back(sub->incoming().first); hard.push_back(sub->incoming().second); hard.push_back(sub->outgoing()[0]); hard.push_back(sub->outgoing()[1]); if(hard[0]->id()id()) swap(hard[0],hard[1]); if(hard[2]->id()id()) swap(hard[2],hard[3]); vector fin,aout; vector ain,fout; // get wave functions for off-shell momenta for later on SpinorWaveFunction( fin ,hard[0],incoming,false,true); SpinorBarWaveFunction(ain ,hard[1],incoming,false,true); SpinorBarWaveFunction(fout,hard[2],outgoing,true ,true); SpinorWaveFunction( aout,hard[3],outgoing,true ,true); // now rescale the momenta and compute the matrix element with the // rescaled momenta for correlations vector momenta; cPDVector data; for(unsigned int ix=0;ix<4;++ix) { momenta.push_back(hard[ix]->momentum()); data .push_back(hard[ix]->dataPtr()); } rescaleMomenta(momenta,data); SpinorWaveFunction ein (rescaledMomenta()[0],data[0],incoming); SpinorBarWaveFunction pin (rescaledMomenta()[1],data[1],incoming); SpinorBarWaveFunction qkout(rescaledMomenta()[2],data[2],outgoing); SpinorWaveFunction qbout(rescaledMomenta()[3],data[3],outgoing); for(unsigned int ix=0;ix<2;++ix) { ein.reset(ix) ; fin [ix] = ein ; pin.reset(ix) ; ain [ix] = pin ; qkout.reset(ix); fout[ix] = qkout; qbout.reset(ix); aout[ix] = qbout; } // calculate the matrix element double me,cont,BW; ProductionMatrixElement prodme=HelicityME(fin,ain,fout,aout,me,cont,BW); // construct the vertex HardVertexPtr hardvertex=new_ptr(HardVertex()); // set the matrix element for the vertex hardvertex->ME(prodme); // set the pointers and to and from the vertex for(unsigned int ix=0;ix<4;++ix) { tSpinPtr spin = hard[ix]->spinInfo(); if(ix<2) { tcPolarizedBeamPDPtr beam = dynamic_ptr_cast(hard[ix]->dataPtr()); if(beam) spin->rhoMatrix() = beam->rhoMatrix(); } spin->productionVertex(hardvertex); } } void MEee2gZ2qq::rebind(const TranslationMap & trans) { FFZVertex_ = trans.translate(FFZVertex_); FFPVertex_ = trans.translate(FFPVertex_); FFGVertex_ = trans.translate(FFGVertex_); Z0_ = trans.translate(Z0_); gamma_ = trans.translate(gamma_); gluon_ = trans.translate(gluon_); HwMEBase::rebind(trans); } IVector MEee2gZ2qq::getReferences() { IVector ret = HwMEBase::getReferences(); ret.push_back(FFZVertex_); ret.push_back(FFPVertex_); ret.push_back(FFGVertex_); ret.push_back(Z0_ ); ret.push_back(gamma_ ); ret.push_back(gluon_ ); return ret; } void MEee2gZ2qq::initializeMECorrection(ShowerTreePtr , double & initial, double & final) { d_Q_ = sqrt(sHat()); d_m_ = 0.5*(meMomenta()[2].mass()+meMomenta()[3].mass()); // set the other parameters d_rho_ = sqr(d_m_/d_Q_); d_v_ = sqrt(1.-4.*d_rho_); // maximum evolution scale d_kt1_ = (1. + sqrt(1. - 4.*d_rho_))/2.; double num = d_rho_ * d_kt1_ + 0.25 * d_v_ *(1.+d_v_)*(1.+d_v_); double den = d_kt1_ - d_rho_; d_kt2_ = num/den; // maximums for reweighting initial = 1.; final = 1.; } void MEee2gZ2qq::applyHardMatrixElementCorrection(ShowerTreePtr tree) { vector emission; unsigned int iemit,ispect; generateHard(tree,emission,iemit,ispect,true,ShowerInteraction::QCD); if(emission.empty()) return; // get the quark and antiquark ParticleVector qq; map::const_iterator cit; for(cit=tree->outgoingLines().begin();cit!=tree->outgoingLines().end();++cit) qq.push_back(cit->first->copy()); // ensure quark first if(qq[0]->id()<0) swap(qq[0],qq[1]); // perform final check to ensure energy greater than constituent mass for (int i=0; i<2; i++) { if (emission[i+2].e() < qq[i]->data().constituentMass()) return; } if (emission[4].e() < gluon_->constituentMass()) return; // set masses for (int i=0; i<2; i++) emission[i+2].setMass(qq[i]->mass()); emission[4].setMass(ZERO); // decide which particle emits bool firstEmits= emission[4].vect().perp2(emission[2].vect())< emission[4].vect().perp2(emission[3].vect()); // create the new quark, antiquark and gluon PPtr newg = gluon_->produceParticle(emission[4]); PPtr newq,newa; if(firstEmits) { newq = qq[0]->dataPtr()->produceParticle(emission[2]); newa = new_ptr(Particle(*qq[1])); qq[1]->antiColourLine()->removeAntiColoured(newa); newa->set5Momentum(emission[3]); } else { newq = new_ptr(Particle(*qq[0])); qq[0]->colourLine()->removeColoured(newq); newq->set5Momentum(emission[2]); newa = qq[1]->dataPtr()->produceParticle(emission[3]); } // get the original colour line ColinePtr col; if(qq[0]->id()>0) col=qq[0]->colourLine(); else col=qq[0]->antiColourLine(); // set the colour lines if(firstEmits) { col->addColoured(newq); col->addAntiColoured(newg); newa->colourNeighbour(newg); } else { col->addAntiColoured(newa); col->addColoured(newg); newq->antiColourNeighbour(newg); } // change the existing quark and antiquark PPtr orig; for(cit=tree->outgoingLines().begin();cit!=tree->outgoingLines().end();++cit) { map >::const_iterator tit; for(tit = tree->treelinks().begin(); tit != tree->treelinks().end();++tit) { if(tit->second.first && tit->second.second==cit->first->progenitor()) break; } if(cit->first->progenitor()->id()==newq->id()) { // remove old particles from colour line col->removeColoured(cit->first->copy()); col->removeColoured(cit->first->progenitor()); // insert new particles cit->first->copy(newq); ShowerParticlePtr sp(new_ptr(ShowerParticle(*newq,1,true))); cit->first->progenitor(sp); tree->outgoingLines()[cit->first]=sp; cit->first->perturbative(!firstEmits); if(firstEmits) orig=cit->first->original(); if(tit!=tree->treelinks().end()) tree->updateLink(tit->first,make_pair(cit->first,sp)); } else { // remove old particles from colour line col->removeAntiColoured(cit->first->copy()); col->removeAntiColoured(cit->first->progenitor()); // insert new particles cit->first->copy(newa); ShowerParticlePtr sp(new_ptr(ShowerParticle(*newa,1,true))); cit->first->progenitor(sp); tree->outgoingLines()[cit->first]=sp; cit->first->perturbative(firstEmits); if(!firstEmits) orig=cit->first->original(); if(tit!=tree->treelinks().end()) tree->updateLink(tit->first,make_pair(cit->first,sp)); } } // add the gluon ShowerParticlePtr sg=new_ptr(ShowerParticle(*newg,1,true)); ShowerProgenitorPtr gluon=new_ptr(ShowerProgenitor(orig,newg,sg)); gluon->perturbative(false); tree->outgoingLines().insert(make_pair(gluon,sg)); tree->hardMatrixElementCorrection(true); } bool MEee2gZ2qq::softMatrixElementVeto(ShowerProgenitorPtr initial, ShowerParticlePtr parent,Branching br) { // check we should be applying the veto if(parent->id()!=initial->progenitor()->id()|| - br.ids[0]!=br.ids[1]|| - br.ids[2]!=ParticleID::g) return false; + br.ids[0]->id()!=br.ids[1]->id()|| + br.ids[2]->id()!=ParticleID::g) return false; // calculate pt double d_z = br.kinematics->z(); Energy d_qt = br.kinematics->scale(); Energy2 d_m2 = parent->momentum().m2(); Energy pPerp = (1.-d_z)*sqrt( sqr(d_z*d_qt) - d_m2); // if not hardest so far don't apply veto if(pPerphighestpT()) return false; // calculate x and xb double kti = sqr(d_qt/d_Q_); double w = sqr(d_v_) + kti*(-1. + d_z)*d_z*(2. + kti*(-1. + d_z)*d_z); if (w < 0) return false; double x = (1. + sqr(d_v_)*(-1. + d_z) + sqr(kti*(-1. + d_z))*d_z*d_z*d_z + d_z*sqrt(w) - kti*(-1. + d_z)*d_z*(2. + d_z*(-2 + sqrt(w))))/ (1. - kti*(-1. + d_z)*d_z + sqrt(w)); double xb = 1. + kti*(-1. + d_z)*d_z; // calculate the weight if(parent->id()<0) swap(x,xb); // if exceptionally out of phase space, leave this emission, as there // is no good interpretation for the soft ME correction. if( x<0 || xb<0) return false; double xg = 2. - xb - x; // always return one in the soft gluon region if(xg < EPS_) return false; // check it is in the phase space if((1.-x)*(1.-xb)*(1.-xg) < d_rho_*xg*xg) { parent->vetoEmission(parent->id()>0 ? ShowerPartnerType::QCDColourLine : ShowerPartnerType::QCDColourLine,br.kinematics->scale()); return true; } double k1 = getKfromX(x, xb); double k2 = getKfromX(xb, x); double weight = 1.; // quark emission if(parent->id() > 0 && k1 < d_kt1_) { weight = MEV(x, xb)/PS(x, xb); // is it also in the anti-quark emission zone? if(k2 < d_kt2_) weight *= 0.5; } // antiquark emission if(parent->id() < 0 && k2 < d_kt2_) { weight = MEV(x, xb)/PS(xb, x); // is it also in the quark emission zone? if(k1 < d_kt1_) weight *= 0.5; } // compute veto from weight bool veto = !UseRandom::rndbool(weight); // if not vetoed reset max // if vetoing reset the scale if(veto) { parent->vetoEmission(parent->id()>0 ? ShowerPartnerType::QCDColourLine : ShowerPartnerType::QCDColourLine,br.kinematics->scale()); } // return the veto return veto; } double MEee2gZ2qq::getKfromX(double x1, double x2) { double uval = 0.5*(1. + d_rho_/(1.-x2+d_rho_)); double num = x1 - (2. - x2)*uval; double den = sqrt(x2*x2 - 4.*d_rho_); double zval = uval + num/den; return (1.-x2)/(zval*(1.-zval)); } double MEee2gZ2qq::MEV(double x1, double x2) { // Vector part double num = (x1+2.*d_rho_)*(x1+2.*d_rho_) + (x2+2.*d_rho_)*(x2+2.*d_rho_) - 8.*d_rho_*(1.+2.*d_rho_); double den = (1.+2.*d_rho_)*(1.-x1)*(1.-x2); return (num/den - 2.*d_rho_/((1.-x1)*(1.-x1)) - 2*d_rho_/((1.-x2)*(1.-x2)))/d_v_; } double MEee2gZ2qq::PS(double x, double xbar) { double u = 0.5*(1. + d_rho_ / (1.-xbar+d_rho_)); double z = u + (x - (2.-xbar)*u)/sqrt(xbar*xbar - 4.*d_rho_); double brack = (1.+z*z)/(1.-z)- 2.*d_rho_/(1-xbar); // interesting: the splitting function without the subtraction // term. Actually gives a much worse approximation in the collinear // limit. double brack = (1.+z*z)/(1.-z); double den = (1.-xbar)*sqrt(xbar*xbar - 4.*d_rho_); return brack/den; } pair MEee2gZ2qq::generateHard(ShowerTreePtr tree, vector & emmision, unsigned int & iemit, unsigned int & ispect, bool applyVeto,ShowerInteraction::Type type) { vector inter; if(type==ShowerInteraction::QCD) inter.push_back(ShowerInteraction::QCD); else if(type==ShowerInteraction::QED) inter.push_back(ShowerInteraction::QED); else if(type==ShowerInteraction::QEDQCD || type==ShowerInteraction::ALL) { inter.push_back(ShowerInteraction::QCD); inter.push_back(ShowerInteraction::QED); } // get the momenta of the incoming and outgoing partons // incoming ShowerProgenitorPtr emProgenitor = tree->incomingLines().begin() ->first, epProgenitor = tree->incomingLines().rbegin()->first; // outgoing ShowerProgenitorPtr qkProgenitor = tree->outgoingLines().begin() ->first, qbProgenitor = tree->outgoingLines().rbegin()->first; // get the order right if(emProgenitor->id()<0) swap(emProgenitor,epProgenitor); if(qkProgenitor->id()<0) swap(qkProgenitor,qbProgenitor); loMomenta_.clear(); // extract the momenta loMomenta_.push_back(emProgenitor->progenitor()->momentum()); loMomenta_.push_back(epProgenitor->progenitor()->momentum()); loMomenta_.push_back(qkProgenitor->progenitor()->momentum()); loMomenta_.push_back(qbProgenitor->progenitor()->momentum()); // and ParticleData objects partons_.resize(5); partons_[0]=emProgenitor->progenitor()->dataPtr(); partons_[1]=epProgenitor->progenitor()->dataPtr(); partons_[2]=qkProgenitor->progenitor()->dataPtr(); partons_[3]=qbProgenitor->progenitor()->dataPtr(); partons_[4]=cPDPtr(); // boost from lab to CMS frame with outgoing particles // along the z axis LorentzRotation eventFrame( ( loMomenta_[2] + loMomenta_[3] ).findBoostToCM() ); Lorentz5Momentum spectator = eventFrame*loMomenta_[2]; eventFrame.rotateZ( -spectator.phi() ); eventFrame.rotateY( -spectator.theta() ); eventFrame.invert(); // mass of the final-state system Energy2 M2 = (loMomenta_[2]+loMomenta_[3]).m2(); Energy M = sqrt(M2); double mu1 = loMomenta_[2].mass()/M; double mu2 = loMomenta_[3].mass()/M; double mu12 = sqr(mu1), mu22 = sqr(mu2); double lambda = sqrt(1.+sqr(mu12)+sqr(mu22)-2.*mu12-2.*mu22-2.*mu12*mu22); // max pT Energy pTmax = 0.5*sqrt(M2)* (1.-sqr(loMomenta_[2].mass()+loMomenta_[3].mass())/M2); // max y if ( pTmax < pTminQED_ && pTmax < pTminQCD_ ) return make_pair(ZERO,ShowerInteraction::QCD); vector pTemit; vector > emittedMomenta;; vector iemitter,ispectater; for(unsigned int iinter=0;iinteroverestimateValue()/Constants::twopi* 2.*ymax*preFactor_; } else { pTmin = pTminQED_; ymax = acosh(pTmax/pTmin); partons_[4] = gamma_; a = alphaQED_->overestimateValue()/Constants::twopi* 2.*ymax*preFactor_*sqr(double(mePartonData()[2]->iCharge())/3.); } // variables for the emission Energy pT[2]; double y[2],phi[2],x3[2],x1[2][2],x2[2][2]; double contrib[2][2]; // storage of the real emission momenta vector realMomenta[2][2]= {{vector(5),vector(5)}, {vector(5),vector(5)}}; for(unsigned int ix=0;ix<2;++ix) for(unsigned int iy=0;iy<2;++iy) for(unsigned int iz=0;iz<2;++iz) realMomenta[ix][iy][iz] = loMomenta_[iz]; // generate the emission for(unsigned int ix=0;ix<2;++ix) { if(ix==1) { swap(mu1 ,mu2 ); swap(mu12,mu22); } pT[ix] = pTmax; y [ix] = 0.; bool reject = true; do { // generate pT pT[ix] *= pow(UseRandom::rnd(),1./a); if(pT[ix] 1. -sqr( mu1 + mu2 ) ) continue; // find the possible solutions for x1 double xT2 = sqr(2./M*pT[ix]); double root = (-sqr(x3[ix])+xT2)* (xT2*mu22+2.*x3[ix]-sqr(mu12)+2.*mu22+2.*mu12-sqr(x3[ix])-1. +2.*mu12*mu22-sqr(mu22)-2.*mu22*x3[ix]-2.*mu12*x3[ix]); double c1=2.*sqr(x3[ix])-4.*mu22-6.*x3[ix]+4.*mu12-xT2*x3[ix] +2.*xT2-2.*mu12*x3[ix]+2.*mu22*x3[ix]+4.; if(root<0.) continue; x1[ix][0] = 1./(4.-4.*x3[ix]+xT2)*(c1-2.*sqrt(root)); x1[ix][1] = 1./(4.-4.*x3[ix]+xT2)*(c1+2.*sqrt(root)); // change sign of y if 2nd particle emits if(ix==1) y[ix] *=-1.; // loop over the solutions for(unsigned int iy=0;iy<2;++iy) { contrib[ix][iy]=0.; // check x1 value allowed if(x1[ix][iy]<2.*mu1||x1[ix][iy]>1.+mu12-mu22) continue; // calculate x2 value and check allowed x2[ix][iy] = 2.-x3[ix]-x1[ix][iy]; double root = max(0.,sqr(x1[ix][iy])-4.*mu12); root = sqrt(root); double x2min = 1.+mu22-mu12 -0.5*(1.-x1[ix][iy]+mu12-mu22)/(1.-x1[ix][iy]+mu12)*(x1[ix][iy]-2.*mu12+root); double x2max = 1.+mu22-mu12 -0.5*(1.-x1[ix][iy]+mu12-mu22)/(1.-x1[ix][iy]+mu12)*(x1[ix][iy]-2.*mu12-root); if(x2[ix][iy]x2max) continue; // check the z components double z1 = sqrt(sqr(x1[ix][iy])-4.*mu12-xT2); double z2 = -sqrt(sqr(x2[ix][iy])-4.*mu22); double z3 = pT[ix]*sinh(y[ix])*2./M; if(ix==1) z3 *=-1.; if(abs(-z1+z2+z3)<1e-9) z1 *= -1.; if(abs(z1+z2+z3)>1e-5) continue; // if using as an ME correction the veto if(applyVeto) { double xb = x1[ix][iy], xc = x2[ix][iy]; double b = mu12, c = mu22; double r = 0.5*(1.+b/(1.+c-xc)); double z1 = r + (xb-(2.-xc)*r)/sqrt(sqr(xc)-4.*c); double kt1 = (1.-b+c-xc)/z1/(1.-z1); r = 0.5*(1.+c/(1.+b-xb)); double z2 = r + (xc-(2.-xb)*r)/sqrt(sqr(xb)-4.*b); double kt2 = (1.-c+b-xb)/z2/(1.-z2); if(ix==1) { swap(z1 ,z2); swap(kt1,kt2); } // veto the shower region if( kt1 < d_kt1_ || kt2 < d_kt2_ ) continue; } // construct the momenta realMomenta[ix][iy][4] = Lorentz5Momentum(pT[ix]*cos(phi[ix]),pT[ix]*sin(phi[ix]), pT[ix]*sinh(y[ix]) ,pT[ix]*cosh(y[ix]),ZERO); if(ix==0) { realMomenta[ix][iy][2] = Lorentz5Momentum(-pT[ix]*cos(phi[ix]),-pT[ix]*sin(phi[ix]), z1*0.5*M,x1[ix][iy]*0.5*M,M*mu1); realMomenta[ix][iy][3] = Lorentz5Momentum(ZERO,ZERO, z2*0.5*M,x2[ix][iy]*0.5*M,M*mu2); } else { realMomenta[ix][iy][2] = Lorentz5Momentum(ZERO,ZERO,-z2*0.5*M,x2[ix][iy]*0.5*M,M*mu2); realMomenta[ix][iy][3] = Lorentz5Momentum(-pT[ix]*cos(phi[ix]),-pT[ix]*sin(phi[ix]), -z1*0.5*M,x1[ix][iy]*0.5*M,M*mu1); } // boost the momenta back to the lab for(unsigned int iz=2;iz<5;++iz) realMomenta[ix][iy][iz] *= eventFrame; // jacobian and prefactors for the weight Energy J = M/sqrt(xT2)*abs(-x1[ix][iy]*x2[ix][iy]+2.*mu22*x1[ix][iy] +x2[ix][iy]+x2[ix][iy]*mu12+mu22*x2[ix][iy] -sqr(x2[ix][iy])) /pow(sqr(x2[ix][iy])-4.*mu22,1.5); // prefactors etc contrib[ix][iy] = 0.5*pT[ix]/J/preFactor_/lambda; // matrix element piece contrib[ix][iy] *= meRatio(partons_,realMomenta[ix][iy], ix,inter[iinter],false); // coupling piece if(inter[iinter]==ShowerInteraction::QCD) contrib[ix][iy] *= alphaQCD_->ratio(sqr(pT[ix])); else contrib[ix][iy] *= alphaQED_->ratio(sqr(pT[ix])); } if(contrib[ix][0]+contrib[ix][1]>1.) { ostringstream s; s << "MEee2gZ2qq::generateHardest weight for channel " << ix << "is " << contrib[ix][0]+contrib[ix][1] << " which is greater than 1"; generator()->logWarning( Exception(s.str(), Exception::warning) ); } reject = UseRandom::rnd() > contrib[ix][0] + contrib[ix][1]; } while (reject); if(pT[ix]()); iemitter .push_back(0); ispectater.push_back(0); continue; } // now pick the emission with highest pT vector emission; if(pT[0]>pT[1]) { iemitter .push_back(2); ispectater.push_back(3); pTemit.push_back(pT[0]); if(UseRandom::rnd()pTmax) { iselect = ix; pTmax = pTemit[ix]; } } // no emission return if(iselect<0) { return make_pair(ZERO,ShowerInteraction::QCD); } partons_[4] = inter[iselect]==ShowerInteraction::QCD ? gluon_ : gamma_; iemit = iemitter[iselect]; ispect = ispectater[iselect]; emmision = emittedMomenta[iselect]; // return pT of emission return make_pair(pTmax,inter[iselect]); } HardTreePtr MEee2gZ2qq::generateHardest(ShowerTreePtr tree, ShowerInteraction::Type inter) { // generate the momenta for the hard emission vector emmision; unsigned int iemit,ispect; pair output = generateHard(tree,emmision,iemit,ispect,false,inter); Energy pTveto = output.first; ShowerInteraction::Type force = output.second; // incoming progenitors ShowerProgenitorPtr ePProgenitor = tree->incomingLines().begin() ->first, eMProgenitor = tree->incomingLines().rbegin()->first; if(eMProgenitor->id()<0) swap(eMProgenitor,ePProgenitor); // outgoing progenitors ShowerProgenitorPtr qkProgenitor = tree->outgoingLines().begin() ->first, qbProgenitor = tree->outgoingLines().rbegin()->first; if(qkProgenitor->id()<0) swap(qkProgenitor,qbProgenitor); // maximum pT of emission if(emmision.empty()) { if(inter==ShowerInteraction::QCD || inter==ShowerInteraction::QEDQCD || inter==ShowerInteraction::ALL) { qkProgenitor->maximumpT(pTminQCD_,ShowerInteraction::QCD); qbProgenitor->maximumpT(pTminQCD_,ShowerInteraction::QCD); } if(inter==ShowerInteraction::QED || inter==ShowerInteraction::QEDQCD || inter==ShowerInteraction::ALL) { qkProgenitor->maximumpT(pTminQED_,ShowerInteraction::QED); qbProgenitor->maximumpT(pTminQED_,ShowerInteraction::QED); } return HardTreePtr(); } else { if(inter==ShowerInteraction::QCD || inter==ShowerInteraction::QEDQCD || inter==ShowerInteraction::ALL) { qkProgenitor->maximumpT(pTveto,ShowerInteraction::QCD); qbProgenitor->maximumpT(pTveto,ShowerInteraction::QCD); } if(inter==ShowerInteraction::QED || inter==ShowerInteraction::QEDQCD || inter==ShowerInteraction::ALL) { qkProgenitor->maximumpT(pTveto,ShowerInteraction::QED); qbProgenitor->maximumpT(pTveto,ShowerInteraction::QED); } } // perform final check to ensure energy greater than constituent mass if (emmision[2].e() < qkProgenitor->progenitor()->data().constituentMass()) return HardTreePtr(); if (emmision[3].e() < qbProgenitor->progenitor()->data().constituentMass()) return HardTreePtr(); if(force!=ShowerInteraction::QED && emmision[4].e() < gluon_->constituentMass()) return HardTreePtr(); // Make the particles for the hard tree ShowerParticleVector hardParticles; for(unsigned int ix=0;ix=2))); hardParticles.back()->set5Momentum(emmision[ix]); } ShowerParticlePtr parent(new_ptr(ShowerParticle(partons_[iemit],true))); Lorentz5Momentum parentMomentum(emmision[iemit]+emmision[4]); parentMomentum.setMass(partons_[iemit]->mass()); parent->set5Momentum(parentMomentum); // Create the vectors of HardBranchings to create the HardTree: vector spaceBranchings,allBranchings; // Incoming boson: for(unsigned int ix=0;ix<2;++ix) { spaceBranchings.push_back(new_ptr(HardBranching(hardParticles[ix],SudakovPtr(), HardBranchingPtr(), HardBranching::Incoming))); allBranchings.push_back(spaceBranchings.back()); } // Outgoing particles from hard emission: HardBranchingPtr spectatorBranch(new_ptr(HardBranching(hardParticles[ispect], SudakovPtr(),HardBranchingPtr(), HardBranching::Outgoing))); HardBranchingPtr emitterBranch(new_ptr(HardBranching(parent,SudakovPtr(), HardBranchingPtr(), HardBranching::Outgoing))); if(force==ShowerInteraction::QED) { emitterBranch->type(ShowerPartnerType::QED); } else { emitterBranch->type(emitterBranch->branchingParticle()->id()>0 ? ShowerPartnerType::QCDColourLine : ShowerPartnerType::QCDAntiColourLine); } emitterBranch->addChild(new_ptr(HardBranching(hardParticles[iemit], SudakovPtr(),HardBranchingPtr(), HardBranching::Outgoing))); emitterBranch->addChild(new_ptr(HardBranching(hardParticles[4], SudakovPtr(),HardBranchingPtr(), HardBranching::Outgoing))); if(iemit==0) { allBranchings.push_back(emitterBranch); allBranchings.push_back(spectatorBranch); } else { allBranchings.push_back( spectatorBranch ); allBranchings.push_back( emitterBranch ); } emitterBranch ->branchingParticle()->partner(spectatorBranch->branchingParticle()); spectatorBranch->branchingParticle()->partner(emitterBranch ->branchingParticle()); if(force==ShowerInteraction::QED) { spaceBranchings[0]->branchingParticle()->partner(spaceBranchings[1]->branchingParticle()); spaceBranchings[1]->branchingParticle()->partner(spaceBranchings[0]->branchingParticle()); } // Make the HardTree from the HardBranching vectors. HardTreePtr hardtree = new_ptr(HardTree(allBranchings,spaceBranchings, force)); hardtree->partnersSet(true); // Connect the particles with the branchings in the HardTree hardtree->connect( eMProgenitor->progenitor(), allBranchings[0] ); tPPtr beam = eMProgenitor->original(); if(!beam->parents().empty()) beam = beam->parents()[0]; allBranchings[0]->beam(beam); hardtree->connect( ePProgenitor->progenitor(), allBranchings[1] ); beam = ePProgenitor->original(); if(!beam->parents().empty()) beam = beam->parents()[0]; allBranchings[1]->beam(beam); hardtree->connect( qkProgenitor->progenitor(), allBranchings[2] ); hardtree->connect( qbProgenitor->progenitor(), allBranchings[3] ); // colour flow ColinePtr newline=new_ptr(ColourLine()); for(set::const_iterator cit=hardtree->branchings().begin(); cit!=hardtree->branchings().end();++cit) { if((**cit).branchingParticle()->dataPtr()->iColour()==PDT::Colour3) newline->addColoured((**cit).branchingParticle()); else if((**cit).branchingParticle()->dataPtr()->iColour()==PDT::Colour3bar) newline->addAntiColoured((**cit).branchingParticle()); } allBranchings[2]->colourPartner(allBranchings[3]); allBranchings[3]->colourPartner(allBranchings[2]); if(hardParticles[4]->dataPtr()->iColour()==PDT::Colour8) { ColinePtr newLine2=new_ptr(ColourLine()); if(emitterBranch->branchingParticle()->dataPtr()->iColour()==PDT::Colour3) { emitterBranch->branchingParticle()->colourLine()->addColoured(hardParticles[4]); newLine2->addColoured(hardParticles[iemit]); newLine2->addAntiColoured(hardParticles[4]); } else { emitterBranch->branchingParticle()->antiColourLine()->addAntiColoured(hardParticles[4]); newLine2->addAntiColoured(hardParticles[iemit]); newLine2->addColoured(hardParticles[4]); } } else { if(emitterBranch->branchingParticle()->dataPtr()->iColour()==PDT::Colour3) { emitterBranch->branchingParticle()->colourLine()->addColoured(hardParticles[iemit]); } else { emitterBranch->branchingParticle()->antiColourLine()->addAntiColoured(hardParticles[iemit]); } } // Return the HardTree return hardtree; } double MEee2gZ2qq::meRatio(vector partons, vector momenta, unsigned int iemitter, ShowerInteraction::Type inter, bool subtract) const { Lorentz5Momentum q = momenta[2]+momenta[3]+momenta[4]; Energy2 Q2=q.m2(); Energy2 lambda = sqrt((Q2-sqr(momenta[2].mass()+momenta[3].mass()))* (Q2-sqr(momenta[2].mass()-momenta[3].mass()))); InvEnergy2 D[2]; double lome[2]; for(unsigned int iemit=0;iemit<2;++iemit) { unsigned int ispect = iemit==0 ? 1 : 0; Energy2 pipj = momenta[4 ] * momenta[2+iemit ]; Energy2 pipk = momenta[4 ] * momenta[2+ispect]; Energy2 pjpk = momenta[2+iemit] * momenta[2+ispect]; double y = pipj/(pipj+pipk+pjpk); double z = pipk/( pipk+pjpk); Energy mij = sqrt(2.*pipj+sqr(momenta[2+iemit].mass())); Energy2 lamB = sqrt((Q2-sqr(mij+momenta[2+ispect].mass()))* (Q2-sqr(mij-momenta[2+ispect].mass()))); Energy2 Qpk = q*momenta[2+ispect]; Lorentz5Momentum pkt = lambda/lamB*(momenta[2+ispect]-Qpk/Q2*q) +0.5/Q2*(Q2+sqr(momenta[2+ispect].mass())-sqr(momenta[2+ispect].mass()))*q; Lorentz5Momentum pijt = q-pkt; double muj = momenta[2+iemit ].mass()/sqrt(Q2); double muk = momenta[2+ispect].mass()/sqrt(Q2); double vt = sqrt((1.-sqr(muj+muk))*(1.-sqr(muj-muk)))/(1.-sqr(muj)-sqr(muk)); double v = sqr(2.*sqr(muk)+(1.-sqr(muj)-sqr(muk))*(1.-y))-4.*sqr(muk); if(v<=0.) return 0.; v = sqrt(v)/(1.-y)/(1.-sqr(muj)-sqr(muk)); // dipole term D[iemit] = 0.5/pipj*(2./(1.-(1.-z)*(1.-y)) -vt/v*(2.-z+sqr(momenta[2+iemit].mass())/pipj)); // matrix element vector lomom(4); lomom[0] = momenta[0]; lomom[1] = momenta[1]; if(iemit==0) { lomom[2] = pijt; lomom[3] = pkt ; } else { lomom[3] = pijt; lomom[2] = pkt ; } lome[iemit] = loME(partons,lomom,false)/3.; } InvEnergy2 ratio = realME(partons,momenta,inter) *abs(D[iemitter])/(abs(D[0]*lome[0])+abs(D[1]*lome[1])); double output = Q2*ratio; if(subtract) output -= 2.*Q2*D[iemitter]; return output; } double MEee2gZ2qq::loME(const vector & partons, const vector & momenta, bool first) const { // compute the spinors vector fin,aout; vector ain,fout; SpinorWaveFunction ein (momenta[0],partons[0],incoming); SpinorBarWaveFunction pin (momenta[1],partons[1],incoming); SpinorBarWaveFunction qkout(momenta[2],partons[2],outgoing); SpinorWaveFunction qbout(momenta[3],partons[3],outgoing); for(unsigned int ix=0;ix<2;++ix) { ein.reset(ix) ; fin.push_back( ein ); pin.reset(ix) ; ain.push_back( pin ); qkout.reset(ix); fout.push_back(qkout); qbout.reset(ix); aout.push_back(qbout); } // compute the matrix element double me,lastCont,lastBW; HelicityME(fin,ain,fout,aout,me,lastCont,lastBW); // save the components if(first) { DVector save; save.push_back(lastCont); save.push_back(lastBW); meInfo(save); } // return the answer return me; } InvEnergy2 MEee2gZ2qq::realME(const vector & partons, const vector & momenta, ShowerInteraction::Type inter) const { // compute the spinors vector fin,aout; vector ain,fout; vector gout; SpinorWaveFunction ein (momenta[0],partons[0],incoming); SpinorBarWaveFunction pin (momenta[1],partons[1],incoming); SpinorBarWaveFunction qkout(momenta[2],partons[2],outgoing); SpinorWaveFunction qbout(momenta[3],partons[3],outgoing); VectorWaveFunction gluon(momenta[4],partons[4],outgoing); for(unsigned int ix=0;ix<2;++ix) { ein.reset(ix) ; fin.push_back( ein ); pin.reset(ix) ; ain.push_back( pin ); qkout.reset(ix); fout.push_back(qkout); qbout.reset(ix); aout.push_back(qbout); gluon.reset(2*ix); gout.push_back(gluon); } AbstractFFVVertexPtr vertex = inter == ShowerInteraction::QCD ? FFGVertex_ : FFPVertex_; vector diag(4,0.); ProductionMatrixElement output(PDT::Spin1Half,PDT::Spin1Half, PDT::Spin1Half,PDT::Spin1Half, PDT::Spin1); double total(0.); for(unsigned int inhel1=0;inhel1<2;++inhel1) { for(unsigned int inhel2=0;inhel2<2;++inhel2) { // intermediate Z VectorWaveFunction interZ = FFZVertex_->evaluate(scale(),1,Z0_,fin[inhel1],ain[inhel2]); // intermediate photon VectorWaveFunction interG = FFPVertex_->evaluate(scale(),1,gamma_,fin[inhel1],ain[inhel2]); for(unsigned int outhel1=0;outhel1<2;++outhel1) { for(unsigned int outhel2=0;outhel2<2;++outhel2) { for(unsigned int outhel3=0;outhel3<2;++outhel3) { SpinorBarWaveFunction off1 = vertex->evaluate(scale(),3,partons[2],fout[outhel1],gout[outhel3]); diag[0] = FFZVertex_->evaluate(scale(),aout[outhel2],off1,interZ); diag[1] = FFPVertex_->evaluate(scale(),aout[outhel2],off1,interG); SpinorWaveFunction off2 = vertex->evaluate(scale(),3,partons[3],aout[outhel2],gout[outhel3]); diag[2] = FFZVertex_->evaluate(scale(),off2,fout[outhel1],interZ); diag[3] = FFPVertex_->evaluate(scale(),off2,fout[outhel1],interG); // sum of diagrams Complex sum = std::accumulate(diag.begin(),diag.end(),Complex(0.)); // matrix element output(inhel1,inhel2,outhel1,outhel2,outhel3)=sum; // me2 total += norm(sum); } } } } } // spin average total *= 0.25; tcPolarizedBeamPDPtr beam[2] = {dynamic_ptr_cast(partons[0]), dynamic_ptr_cast(partons[1])}; if( beam[0] || beam[1] ) { RhoDMatrix rho[2] = {beam[0] ? beam[0]->rhoMatrix() : RhoDMatrix(mePartonData()[0]->iSpin()), beam[1] ? beam[1]->rhoMatrix() : RhoDMatrix(mePartonData()[1]->iSpin())}; total = output.average(rho[0],rho[1]); } // divide out the coupling total /= norm(vertex->norm()); // and charge (if needed) if(inter==ShowerInteraction::QED) total /= sqr(double(mePartonData()[2]->iCharge())/3.); // return the total return total*UnitRemoval::InvE2; } diff --git a/Shower/Base/Evolver.cc b/Shower/Base/Evolver.cc --- a/Shower/Base/Evolver.cc +++ b/Shower/Base/Evolver.cc @@ -1,3227 +1,3190 @@ // -*- C++ -*- // // Evolver.cc is a part of Herwig - A multi-purpose Monte Carlo event generator // Copyright (C) 2002-2011 The Herwig Collaboration // // Herwig is licenced under version 2 of the GPL, see COPYING for details. // Please respect the MCnet academic guidelines, see GUIDELINES for details. // // // This is the implementation of the non-inlined, non-templated member // functions of the Evolver class. // #include "Evolver.h" #include "ThePEG/Interface/ClassDocumentation.h" #include "ThePEG/Interface/Reference.h" #include "ThePEG/Interface/RefVector.h" #include "ThePEG/Interface/Switch.h" #include "ThePEG/Interface/Parameter.h" #include "ThePEG/Persistency/PersistentOStream.h" #include "ThePEG/Persistency/PersistentIStream.h" #include "Herwig/Shower/Base/ShowerParticle.h" #include "ThePEG/Utilities/EnumIO.h" #include "ShowerKinematics.h" #include "ThePEG/PDT/EnumParticles.h" #include "ThePEG/Repository/EventGenerator.h" #include "ThePEG/Handlers/EventHandler.h" #include "ThePEG/Utilities/Throw.h" #include "ShowerTree.h" #include "ShowerProgenitor.h" #include "KinematicsReconstructor.h" #include "PartnerFinder.h" #include "ThePEG/Handlers/StandardXComb.h" #include "ThePEG/PDT/DecayMode.h" #include "Herwig/Shower/ShowerHandler.h" #include "ThePEG/Utilities/DescribeClass.h" #include "ShowerVertex.h" #include "ThePEG/Repository/CurrentGenerator.h" #include "Herwig/MatrixElement/Matchbox/Base/SubtractedME.h" #include "Herwig/MatrixElement/Matchbox/MatchboxFactory.h" #include "ThePEG/Handlers/StandardXComb.h" using namespace Herwig; namespace { /** * A struct to order the particles in the same way as in the DecayMode's */ struct ParticleOrdering { /** * Operator for the ordering * @param p1 The first ParticleData object * @param p2 The second ParticleData object */ bool operator() (tcPDPtr p1, tcPDPtr p2) { return abs(p1->id()) > abs(p2->id()) || ( abs(p1->id()) == abs(p2->id()) && p1->id() > p2->id() ) || ( p1->id() == p2->id() && p1->fullName() > p2->fullName() ); } }; typedef multiset OrderedParticles; /** * Cached lookup of decay modes. * Generator::findDecayMode() is not efficient. */ tDMPtr findDecayMode(const string & tag) { static map cache; map::const_iterator pos = cache.find(tag); if ( pos != cache.end() ) return pos->second; tDMPtr dm = CurrentGenerator::current().findDecayMode(tag); cache[tag] = dm; return dm; } } DescribeClass describeEvolver ("Herwig::Evolver","HwShower.so"); bool Evolver::_hardEmissionModeWarn = true; bool Evolver::_missingTruncWarn = true; IBPtr Evolver::clone() const { return new_ptr(*this); } IBPtr Evolver::fullclone() const { return new_ptr(*this); } void Evolver::persistentOutput(PersistentOStream & os) const { os << _model << _splittingGenerator << _maxtry << _meCorrMode << _hardVetoMode << _hardVetoRead << _hardVetoReadOption << _limitEmissions << _spinOpt << _softOpt << _hardPOWHEG << ounit(_iptrms,GeV) << _beta << ounit(_gamma,GeV) << ounit(_iptmax,GeV) << _vetoes << _trunc_Mode << _hardEmissionMode << _reconOpt << isMCatNLOSEvent << isMCatNLOHEvent << isPowhegSEvent << isPowhegHEvent << theFactorizationScaleFactor << theRenormalizationScaleFactor << ounit(muPt,GeV) << oenum(interaction_) << _maxTryFSR << _maxFailFSR << _fracFSR; } void Evolver::persistentInput(PersistentIStream & is, int) { is >> _model >> _splittingGenerator >> _maxtry >> _meCorrMode >> _hardVetoMode >> _hardVetoRead >> _hardVetoReadOption >> _limitEmissions >> _spinOpt >> _softOpt >> _hardPOWHEG >> iunit(_iptrms,GeV) >> _beta >> iunit(_gamma,GeV) >> iunit(_iptmax,GeV) >> _vetoes >> _trunc_Mode >> _hardEmissionMode >> _reconOpt >> isMCatNLOSEvent >> isMCatNLOHEvent >> isPowhegSEvent >> isPowhegHEvent >> theFactorizationScaleFactor >> theRenormalizationScaleFactor >> iunit(muPt,GeV) >> ienum(interaction_) >> _maxTryFSR >> _maxFailFSR >> _fracFSR; } void Evolver::doinit() { Interfaced::doinit(); // calculate max no of FSR vetos _maxFailFSR = max(int(_maxFailFSR), int(_fracFSR*double(generator()->N()))); } void Evolver::Init() { static ClassDocumentation documentation ("This class is responsible for carrying out the showering,", "including the kinematics reconstruction, in a given scale range," "including the option of the POWHEG approach to simulated next-to-leading order" " radiation\\cite{Nason:2004rx}.", "%\\cite{Nason:2004rx}\n" "\\bibitem{Nason:2004rx}\n" " P.~Nason,\n" " ``A new method for combining NLO QCD with shower Monte Carlo algorithms,''\n" " JHEP {\\bf 0411} (2004) 040\n" " [arXiv:hep-ph/0409146].\n" " %%CITATION = JHEPA,0411,040;%%\n"); static Reference interfaceSplitGen("SplittingGenerator", "A reference to the SplittingGenerator object", &Herwig::Evolver::_splittingGenerator, false, false, true, false); static Reference interfaceShowerModel ("ShowerModel", "The pointer to the object which defines the shower evolution model.", &Evolver::_model, false, false, true, false, false); static Parameter interfaceMaxTry ("MaxTry", "The maximum number of attempts to generate the shower from a" " particular ShowerTree", &Evolver::_maxtry, 100, 1, 1000, false, false, Interface::limited); static Switch ifaceMECorrMode ("MECorrMode", "Choice of the ME Correction Mode", &Evolver::_meCorrMode, 1, false, false); static SwitchOption off (ifaceMECorrMode,"No","MECorrections off", 0); static SwitchOption on (ifaceMECorrMode,"Yes","hard+soft on", 1); static SwitchOption hard (ifaceMECorrMode,"Hard","only hard on", 2); static SwitchOption soft (ifaceMECorrMode,"Soft","only soft on", 3); static Switch ifaceHardVetoMode ("HardVetoMode", "Choice of the Hard Veto Mode", &Evolver::_hardVetoMode, 1, false, false); static SwitchOption HVoff (ifaceHardVetoMode,"No","hard vetos off", 0); static SwitchOption HVon (ifaceHardVetoMode,"Yes","hard vetos on", 1); static SwitchOption HVIS (ifaceHardVetoMode,"Initial", "only IS emissions vetoed", 2); static SwitchOption HVFS (ifaceHardVetoMode,"Final","only FS emissions vetoed", 3); static Switch ifaceHardVetoRead ("HardVetoScaleSource", "If hard veto scale is to be read", &Evolver::_hardVetoRead, 0, false, false); static SwitchOption HVRcalc (ifaceHardVetoRead,"Calculate","Calculate from hard process", 0); static SwitchOption HVRread (ifaceHardVetoRead,"Read","Read from XComb->lastScale", 1); static Switch ifaceHardVetoReadOption ("HardVetoReadOption", "Apply read-in scale veto to all collisions or just the primary one?", &Evolver::_hardVetoReadOption, false, false, false); static SwitchOption AllCollisions (ifaceHardVetoReadOption, "AllCollisions", "Read-in pT veto applied to primary and secondary collisions.", false); static SwitchOption PrimaryCollision (ifaceHardVetoReadOption, "PrimaryCollision", "Read-in pT veto applied to primary but not secondary collisions.", true); static Parameter ifaceiptrms ("IntrinsicPtGaussian", "RMS of intrinsic pT of Gaussian distribution:\n" "2*(1-Beta)*exp(-sqr(intrinsicpT/RMS))/sqr(RMS)", &Evolver::_iptrms, GeV, ZERO, ZERO, 1000000.0*GeV, false, false, Interface::limited); static Parameter ifacebeta ("IntrinsicPtBeta", "Proportion of inverse quadratic distribution in generating intrinsic pT.\n" "(1-Beta) is the proportion of Gaussian distribution", &Evolver::_beta, 0, 0, 1, false, false, Interface::limited); static Parameter ifacegamma ("IntrinsicPtGamma", "Parameter for inverse quadratic:\n" "2*Beta*Gamma/(sqr(Gamma)+sqr(intrinsicpT))", &Evolver::_gamma,GeV, ZERO, ZERO, 100000.0*GeV, false, false, Interface::limited); static Parameter ifaceiptmax ("IntrinsicPtIptmax", "Upper bound on intrinsic pT for inverse quadratic", &Evolver::_iptmax,GeV, ZERO, ZERO, 100000.0*GeV, false, false, Interface::limited); static RefVector ifaceVetoes ("Vetoes", "The vetoes to be checked during showering", &Evolver::_vetoes, -1, false,false,true,true,false); static Switch interfaceLimitEmissions ("LimitEmissions", "Limit the number and type of emissions for testing", &Evolver::_limitEmissions, 0, false, false); static SwitchOption interfaceLimitEmissionsNoLimit (interfaceLimitEmissions, "NoLimit", "Allow an arbitrary number of emissions", 0); static SwitchOption interfaceLimitEmissionsOneInitialStateEmission (interfaceLimitEmissions, "OneInitialStateEmission", "Allow one emission in the initial state and none in the final state", 1); static SwitchOption interfaceLimitEmissionsOneFinalStateEmission (interfaceLimitEmissions, "OneFinalStateEmission", "Allow one emission in the final state and none in the initial state", 2); static SwitchOption interfaceLimitEmissionsHardOnly (interfaceLimitEmissions, "HardOnly", "Only allow radiation from the hard ME correction", 3); static SwitchOption interfaceLimitEmissionsOneEmission (interfaceLimitEmissions, "OneEmission", "Allow one emission in either the final state or initial state, but not both", 4); static Switch interfaceTruncMode ("TruncatedShower", "Include the truncated shower?", &Evolver::_trunc_Mode, 1, false, false); static SwitchOption interfaceTruncMode0 (interfaceTruncMode,"No","Truncated Shower is OFF", 0); static SwitchOption interfaceTruncMode1 (interfaceTruncMode,"Yes","Truncated Shower is ON", 1); static Switch interfaceHardEmissionMode ("HardEmissionMode", "Whether to use ME corrections or POWHEG for the hardest emission", &Evolver::_hardEmissionMode, 0, false, false); static SwitchOption interfaceHardEmissionModeDecayMECorrection (interfaceHardEmissionMode, "DecayMECorrection", "Old fashioned ME correction for decays only", -1); static SwitchOption interfaceHardEmissionModeMECorrection (interfaceHardEmissionMode, "MECorrection", "Old fashioned ME correction", 0); static SwitchOption interfaceHardEmissionModePOWHEG (interfaceHardEmissionMode, "POWHEG", "Powheg style hard emission using internal matrix elements", 1); static SwitchOption interfaceHardEmissionModeMatchboxPOWHEG (interfaceHardEmissionMode, "MatchboxPOWHEG", "Powheg style emission for the hard process using Matchbox", 2); static SwitchOption interfaceHardEmissionModeFullPOWHEG (interfaceHardEmissionMode, "FullPOWHEG", "Powheg style emission for the hard process using Matchbox " "and decays using internal matrix elements", 3); static Switch interfaceInteraction ("Interaction", "The interactions to be used in the shower", &Evolver::interaction_, ShowerInteraction::QEDQCD, false, false); static SwitchOption interfaceInteractionQCD (interfaceInteraction, "QCDOnly", "Only QCD", ShowerInteraction::QCD); static SwitchOption interfaceInteractionQEDOnly (interfaceInteraction, "QEDOnly", "Only QED", ShowerInteraction::QED); static SwitchOption interfaceInteractionEWOnly (interfaceInteraction, "EWOnly", "Only EW", ShowerInteraction::EW); static SwitchOption interfaceInteractionQEDQCD (interfaceInteraction, "QEDQCD", "QED and QCD", ShowerInteraction::QEDQCD); static SwitchOption interfaceInteractionALL (interfaceInteraction, "ALL", "QED, QCD and EW", ShowerInteraction::ALL); static Switch interfaceReconstructionOption ("ReconstructionOption", "Treatment of the reconstruction of the transverse momentum of " "a branching from the evolution scale.", &Evolver::_reconOpt, 0, false, false); static SwitchOption interfaceReconstructionOptionCutOff (interfaceReconstructionOption, "CutOff", "Use the cut-off masses in the calculation", 0); static SwitchOption interfaceReconstructionOptionOffShell (interfaceReconstructionOption, "OffShell", "Use the off-shell masses in the calculation veto the emission of the parent," " no veto in generation of emissions from children", 1); static SwitchOption interfaceReconstructionOptionOffShell2 (interfaceReconstructionOption, "OffShell2", "Use the off-shell masses in the calculation veto the emissions from the children." " no veto in generation of emissions from children", 2); static SwitchOption interfaceReconstructionOptionOffShell3 (interfaceReconstructionOption, "OffShell3", "Use the off-shell masses in the calculation veto the emissions from the children." " veto in generation of emissions from children using cut-off for second parton", 3); static Switch interfaceSpinCorrelations ("SpinCorrelations", "Treatment of spin correlations in the parton shower", &Evolver::_spinOpt, 1, false, false); static SwitchOption interfaceSpinCorrelationsOff (interfaceSpinCorrelations, "No", "No spin correlations", 0); static SwitchOption interfaceSpinCorrelationsSpin (interfaceSpinCorrelations, "Yes", "Include the azimuthal spin correlations only", 1); static Switch interfaceSoftCorrelations ("SoftCorrelations", "Option for the treatment of soft correlations in the parton shower", &Evolver::_softOpt, 2, false, false); static SwitchOption interfaceSoftCorrelationsNone (interfaceSoftCorrelations, "No", "No soft correlations", 0); static SwitchOption interfaceSoftCorrelationsFull (interfaceSoftCorrelations, "Full", "Use the full eikonal", 1); static SwitchOption interfaceSoftCorrelationsSingular (interfaceSoftCorrelations, "Singular", "Use original Webber-Marchisini form", 2); static Switch interfaceHardPOWHEG ("HardPOWHEG", "Treatment of powheg emissions which are too hard to have a shower interpretation", &Evolver::_hardPOWHEG, false, false, false); static SwitchOption interfaceHardPOWHEGAsShower (interfaceHardPOWHEG, "AsShower", "Still interpret as shower emissions", false); static SwitchOption interfaceHardPOWHEGRealEmission (interfaceHardPOWHEG, "RealEmission", "Generate shower from the real emmission configuration", true); static Parameter interfaceMaxTryFSR ("MaxTryFSR", "The maximum number of attempted FSR emissions in" " the generation of the FSR", &Evolver::_maxTryFSR, 100000, 10, 100000000, false, false, Interface::limited); static Parameter interfaceMaxFailFSR ("MaxFailFSR", "Maximum number of failures generating the FSR", &Evolver::_maxFailFSR, 100, 1, 100000000, false, false, Interface::limited); static Parameter interfaceFSRFailureFraction ("FSRFailureFraction", "Maximum fraction of events allowed to fail due to too many FSR emissions", &Evolver::_fracFSR, 0.001, 1e-10, 1, false, false, Interface::limited); } void Evolver::generateIntrinsicpT(vector particlesToShower) { _intrinsic.clear(); if ( !ipTon() || !isISRadiationON() ) return; // don't do anything for the moment for secondary scatters if( !ShowerHandler::currentHandler()->firstInteraction() ) return; // generate intrinsic pT for(unsigned int ix=0;ixprogenitor()->isFinalState()) continue; if(!particlesToShower[ix]->progenitor()->dataPtr()->coloured()) continue; Energy ipt; if(UseRandom::rnd() > _beta) { ipt=_iptrms*sqrt(-log(UseRandom::rnd())); } else { ipt=_gamma*sqrt(pow(1.+sqr(_iptmax/_gamma), UseRandom::rnd())-1.); } pair pt = make_pair(ipt,UseRandom::rnd(Constants::twopi)); _intrinsic[particlesToShower[ix]] = pt; } } void Evolver::setupMaximumScales(const vector & p, XCPtr xcomb) { // let POWHEG events radiate freely if(_hardEmissionMode>0&&hardTree()) { vector::const_iterator ckt = p.begin(); for (; ckt != p.end(); ckt++) (*ckt)->maxHardPt(Constants::MaxEnergy); return; } // return if no vetos if (!hardVetoOn()) return; // find out if hard partonic subprocess. bool isPartonic(false); map::const_iterator cit = _currenttree->incomingLines().begin(); Lorentz5Momentum pcm; for(; cit!=currentTree()->incomingLines().end(); ++cit) { pcm += cit->first->progenitor()->momentum(); isPartonic |= cit->first->progenitor()->coloured(); } // find minimum pt from hard process, the maximum pt from all outgoing // coloured lines (this is simpler and more general than // 2stu/(s^2+t^2+u^2)). Maximum scale for scattering processes will // be transverse mass. Energy ptmax = generator()->maximumCMEnergy(); // general case calculate the scale if (!hardVetoXComb()|| (hardVetoReadOption()&& !ShowerHandler::currentHandler()->firstInteraction())) { // scattering process if(currentTree()->isHard()) { assert(xcomb); // coloured incoming particles if (isPartonic) { map::const_iterator cjt = currentTree()->outgoingLines().begin(); for(; cjt!=currentTree()->outgoingLines().end(); ++cjt) { if (cjt->first->progenitor()->coloured()) ptmax = min(ptmax,cjt->first->progenitor()->momentum().mt()); } } if (ptmax == generator()->maximumCMEnergy() ) ptmax = pcm.m(); if(hardVetoXComb()&&hardVetoReadOption()&& !ShowerHandler::currentHandler()->firstInteraction()) { ptmax=min(ptmax,sqrt(xcomb->lastShowerScale())); } } // decay, incoming() is the decaying particle. else { ptmax = currentTree()->incomingLines().begin()->first ->progenitor()->momentum().mass(); } } // hepeup.SCALUP is written into the lastXComb by the // LesHouchesReader itself - use this by user's choice. // Can be more general than this. else { if(currentTree()->isHard()) { assert(xcomb); ptmax = sqrt( xcomb->lastShowerScale() ); } else { ptmax = currentTree()->incomingLines().begin()->first ->progenitor()->momentum().mass(); } } ptmax *= ShowerHandler::currentHandler()->hardScaleFactor(); // set maxHardPt for all progenitors. For partonic processes this // is now the max pt in the FS, for non-partonic processes or // processes with no coloured FS the invariant mass of the IS vector::const_iterator ckt = p.begin(); for (; ckt != p.end(); ckt++) (*ckt)->maxHardPt(ptmax); } void Evolver::setupHardScales(const vector & p, XCPtr xcomb) { if ( hardVetoXComb() && (!hardVetoReadOption() || ShowerHandler::currentHandler()->firstInteraction()) ) { Energy hardScale = ZERO; if(currentTree()->isHard()) { assert(xcomb); hardScale = sqrt( xcomb->lastShowerScale() ); } else { hardScale = currentTree()->incomingLines().begin()->first ->progenitor()->momentum().mass(); } hardScale *= ShowerHandler::currentHandler()->hardScaleFactor(); vector::const_iterator ckt = p.begin(); for (; ckt != p.end(); ckt++) (*ckt)->hardScale(hardScale); muPt = hardScale; } } void Evolver::showerHardProcess(ShowerTreePtr hard, XCPtr xcomb) { isMCatNLOSEvent = false; isMCatNLOHEvent = false; isPowhegSEvent = false; isPowhegHEvent = false; Ptr::tptr subme; Ptr::tptr me; Ptr::tptr dipme; Ptr::ptr sxc = dynamic_ptr_cast::ptr>(xcomb); if ( sxc ) { subme = dynamic_ptr_cast::tptr>(sxc->matrixElement()); me = dynamic_ptr_cast::tptr>(sxc->matrixElement()); dipme = dynamic_ptr_cast::tptr>(sxc->matrixElement()); } if ( subme ) { if ( subme->showerApproximation() ) { theShowerApproximation = subme->showerApproximation(); // separate MCatNLO and POWHEG-type corrections if ( !subme->showerApproximation()->needsSplittingGenerator() ) { if ( subme->realShowerSubtraction() ) isMCatNLOHEvent = true; else if ( subme->virtualShowerSubtraction() ) isMCatNLOSEvent = true; } else { if ( subme->realShowerSubtraction() ) isPowhegHEvent = true; else if ( subme->virtualShowerSubtraction() || subme->loopSimSubtraction() ) isPowhegSEvent = true; } } } else if ( me ) { if ( me->factory()->showerApproximation() ) { theShowerApproximation = me->factory()->showerApproximation(); if ( !me->factory()->showerApproximation()->needsSplittingGenerator() ) isMCatNLOSEvent = true; else isPowhegSEvent = true; } } string error = "Inconsistent hard emission set-up in Evolver::showerHardProcess(). "; if ( ( isMCatNLOSEvent || isMCatNLOHEvent ) ){ if (_hardEmissionMode > 1) throw Exception() << error << "Cannot generate POWHEG matching with MC@NLO shower " << "approximation. Add 'set Evolver:HardEmissionMode 0' to input file." << Exception::runerror; if ( ShowerHandler::currentHandler()->canHandleMatchboxTrunc()) throw Exception() << error << "Cannot use truncated qtilde shower with MC@NLO shower " << "approximation. Set LHCGenerator:EventHandler" << ":CascadeHandler to '/Herwig/Shower/ShowerHandler' or " << "'/Herwig/DipoleShower/DipoleShowerHandler'." << Exception::runerror; } else if ( ((isPowhegSEvent || isPowhegHEvent) || dipme) && _hardEmissionMode < 2){ if ( ShowerHandler::currentHandler()->canHandleMatchboxTrunc()) throw Exception() << error << "Unmatched events requested for POWHEG shower " << "approximation. Set Evolver:HardEmissionMode to " << "'MatchboxPOWHEG' or 'FullPOWHEG'." << Exception::runerror; else if (_hardEmissionModeWarn){ _hardEmissionModeWarn = false; _hardEmissionMode+=2; throw Exception() << error << "Unmatched events requested for POWHEG shower " << "approximation. Changing Evolver:HardEmissionMode from " << _hardEmissionMode-2 << " to " << _hardEmissionMode << Exception::warning; } } if ( isPowhegSEvent || isPowhegHEvent) { if (theShowerApproximation->needsTruncatedShower() && !ShowerHandler::currentHandler()->canHandleMatchboxTrunc() ) throw Exception() << error << "Current shower handler cannot generate truncated shower. " << "Set Generator:EventHandler:CascadeHandler to " << "'/Herwig/Shower/PowhegShowerHandler'." << Exception::runerror; } else if ( dipme && _missingTruncWarn){ _missingTruncWarn=false; throw Exception() << "Warning: POWHEG shower approximation used without " << "truncated shower. Set Generator:EventHandler:" << "CascadeHandler to '/Herwig/Shower/PowhegShowerHandler' and " << "'MEMatching:TruncatedShower Yes'." << Exception::warning; } else if ( !dipme && _hardEmissionMode > 1 && ShowerHandler::currentHandler()->firstInteraction()) throw Exception() << error << "POWHEG matching requested for LO events. Include " << "'set Factory:ShowerApproximation MEMatching' in input file." << Exception::runerror; _hardme = HwMEBasePtr(); // extract the matrix element tStdXCombPtr lastXC = dynamic_ptr_cast(xcomb); if(lastXC) { _hardme = dynamic_ptr_cast(lastXC->matrixElement()); } _decayme = HwDecayerBasePtr(); // set the current tree currentTree(hard); hardTree(HardTreePtr()); // number of attempts if more than one interaction switched on unsigned int interactionTry=0; do { try { // generate the showering doShowering(true,xcomb); // if no vetos return return; } catch (InteractionVeto) { currentTree()->clear(); ++interactionTry; } } while(interactionTry<=5); throw Exception() << "Too many tries for shower in " << "Evolver::showerHardProcess()" << Exception::eventerror; } void Evolver::hardMatrixElementCorrection(bool hard) { // set the initial enhancement factors for the soft correction _initialenhance = 1.; _finalenhance = 1.; // if hard matrix element switched off return if(!MECOn(hard)) return; // see if we can get the correction from the matrix element // or decayer if(hard) { if(_hardme&&_hardme->hasMECorrection()) { _hardme->initializeMECorrection(_currenttree, _initialenhance,_finalenhance); if(hardMEC(hard)) _hardme->applyHardMatrixElementCorrection(_currenttree); } } else { if(_decayme&&_decayme->hasMECorrection()) { _decayme->initializeMECorrection(_currenttree, _initialenhance,_finalenhance); if(hardMEC(hard)) _decayme->applyHardMatrixElementCorrection(_currenttree); } } } -ShowerParticleVector Evolver::createTimeLikeChildren(tShowerParticlePtr particle, IdList ids) { +ShowerParticleVector Evolver::createTimeLikeChildren(tShowerParticlePtr, IdList ids) { // Create the ShowerParticle objects for the two children of // the emitting particle; set the parent/child relationship // if same as definition create particles, otherwise create cc - tcPDPtr pdata[2]; - for(unsigned int ix=0;ix<2;++ix) pdata[ix]=getParticleData(ids[ix+1]); - if(particle->id()!=ids[0]) { - for(unsigned int ix=0;ix<2;++ix) { - tPDPtr cc(pdata[ix]->CC()); - if(cc) pdata[ix]=cc; - } - } ShowerParticleVector children; for(unsigned int ix=0;ix<2;++ix) { - children.push_back(new_ptr(ShowerParticle(pdata[ix],true))); - if(children[ix]->id()==_progenitor->id()&&!pdata[ix]->stable()) + children.push_back(new_ptr(ShowerParticle(ids[ix+1],true))); + if(children[ix]->id()==_progenitor->id()&&!ids[ix+1]->stable()) children[ix]->set5Momentum(Lorentz5Momentum(_progenitor->progenitor()->mass())); else - children[ix]->set5Momentum(Lorentz5Momentum(pdata[ix]->mass())); + children[ix]->set5Momentum(Lorentz5Momentum(ids[ix+1]->mass())); } return children; } bool Evolver::timeLikeShower(tShowerParticlePtr particle, ShowerInteraction::Type type, Branching fb, bool first) { // don't do anything if not needed if(_limitEmissions == 1 || hardOnly() || ( _limitEmissions == 2 && _nfs != 0) || ( _limitEmissions == 4 && _nfs + _nis != 0) ) { if(particle->spinInfo()) particle->spinInfo()->develop(); return false; } // too many tries if(_nFSR>=_maxTryFSR) { ++_nFailedFSR; // too many failed events if(_nFailedFSR>=_maxFailFSR) throw Exception() << "Too many events have failed due to too many shower emissions, in\n" << "Evolver::timeLikeShower(). Terminating run\n" << Exception::runerror; throw Exception() << "Too many attempted emissions in Evolver::timeLikeShower()\n" << Exception::eventerror; } // generate the emission ShowerParticleVector children; int ntry=0; // generate the emission if(!fb.kinematics) fb = selectTimeLikeBranching(particle,type,HardBranchingPtr()); // no emission, return if(!fb.kinematics) { if(particle->spinInfo()) particle->spinInfo()->develop(); return false; } Branching fc[2]; bool setupChildren = true; while (ntry<50) { fc[0] = Branching(); fc[1] = Branching(); ++ntry; assert(fb.kinematics); // has emitted // Assign the shower kinematics to the emitting particle. if(setupChildren) { ++_nFSR; particle->showerKinematics(fb.kinematics); // check highest pT if(fb.kinematics->pT()>progenitor()->highestpT()) progenitor()->highestpT(fb.kinematics->pT()); // create the children children = createTimeLikeChildren(particle,fb.ids); // update the children particle->showerKinematics()-> updateChildren(particle, children,fb.type,_reconOpt>=3); // update number of emissions ++_nfs; if(_limitEmissions!=0) { if(children[0]->spinInfo()) children[0]->spinInfo()->develop(); if(children[1]->spinInfo()) children[1]->spinInfo()->develop(); if(particle->spinInfo()) particle->spinInfo()->develop(); return true; } setupChildren = false; } // select branchings for children fc[0] = selectTimeLikeBranching(children[0],type,HardBranchingPtr()); fc[1] = selectTimeLikeBranching(children[1],type,HardBranchingPtr()); // old default if(_reconOpt==0) { // shower the first particle if(fc[0].kinematics) timeLikeShower(children[0],type,fc[0],false); if(children[0]->spinInfo()) children[0]->spinInfo()->develop(); // shower the second particle if(fc[1].kinematics) timeLikeShower(children[1],type,fc[1],false); if(children[1]->spinInfo()) children[1]->spinInfo()->develop(); break; } // Herwig default else if(_reconOpt==1) { // shower the first particle if(fc[0].kinematics) timeLikeShower(children[0],type,fc[0],false); if(children[0]->spinInfo()) children[0]->spinInfo()->develop(); // shower the second particle if(fc[1].kinematics) timeLikeShower(children[1],type,fc[1],false); if(children[1]->spinInfo()) children[1]->spinInfo()->develop(); // branching has happened particle->showerKinematics()->updateParent(particle, children,fb.type); // clean up the vetoed emission if(particle->virtualMass()==ZERO) { particle->showerKinematics(ShoKinPtr()); for(unsigned int ix=0;ixabandonChild(children[ix]); children.clear(); if(particle->spinInfo()) particle->spinInfo()->decayVertex(VertexPtr()); particle->vetoEmission(fb.type,fb.kinematics->scale()); // generate the new emission fb = selectTimeLikeBranching(particle,type,HardBranchingPtr()); // no emission, return if(!fb.kinematics) { if(particle->spinInfo()) particle->spinInfo()->develop(); return false; } setupChildren = true; continue; } else break; } // veto children else if(_reconOpt>=2) { // cut-off masses for the branching const vector & virtualMasses = fb.sudakov->virtualMasses(fb.ids); // compute the masses of the children Energy masses[3]; for(unsigned int ix=0;ix<2;++ix) { if(fc[ix].kinematics) { const vector & vm = fc[ix].sudakov->virtualMasses(fc[ix].ids); Energy2 q2 = fc[ix].kinematics->z()*(1.-fc[ix].kinematics->z())*sqr(fc[ix].kinematics->scale()); - if(fc[ix].ids[0]!=ParticleID::g) q2 += sqr(vm[0]); + if(fc[ix].ids[0]->id()!=ParticleID::g) q2 += sqr(vm[0]); masses[ix+1] = sqrt(q2); } else { masses[ix+1] = virtualMasses[ix+1]; } } - masses[0] = fb.ids[0]!=ParticleID::g ? virtualMasses[0] : ZERO; + masses[0] = fb.ids[0]->id()!=ParticleID::g ? virtualMasses[0] : ZERO; double z = fb.kinematics->z(); Energy2 pt2 = z*(1.-z)*(z*(1.-z)*sqr(fb.kinematics->scale()) + sqr(masses[0])) - sqr(masses[1])*(1.-z) - sqr(masses[2])*z; if(pt2>=ZERO) { break; } else { // reset the scales for the children for(unsigned int ix=0;ix<2;++ix) { if(fc[ix].kinematics) children[ix]->vetoEmission(fc[ix].type,fc[ix].kinematics->scale()); else children[ix]->vetoEmission(ShowerPartnerType::QCDColourLine,ZERO); children[ix]->virtualMass(ZERO); } } } }; if(_reconOpt>=2) { // shower the first particle if(fc[0].kinematics) timeLikeShower(children[0],type,fc[0],false); if(children[0]->spinInfo()) children[0]->spinInfo()->develop(); // shower the second particle if(fc[1].kinematics) timeLikeShower(children[1],type,fc[1],false); if(children[1]->spinInfo()) children[1]->spinInfo()->develop(); // branching has happened particle->showerKinematics()->updateParent(particle, children,fb.type); } if(first&&!children.empty()) particle->showerKinematics()->resetChildren(particle,children); if(particle->spinInfo()) particle->spinInfo()->develop(); return true; } bool Evolver::spaceLikeShower(tShowerParticlePtr particle, PPtr beam, ShowerInteraction::Type type) { //using the pdf's associated with the ShowerHandler assures, that //modified pdf's are used for the secondary interactions via //CascadeHandler::resetPDFs(...) tcPDFPtr pdf; if(ShowerHandler::currentHandler()->firstPDF().particle() == _beam) pdf = ShowerHandler::currentHandler()->firstPDF().pdf(); if(ShowerHandler::currentHandler()->secondPDF().particle() == _beam) pdf = ShowerHandler::currentHandler()->secondPDF().pdf(); Energy freeze = ShowerHandler::currentHandler()->pdfFreezingScale(); // don't do anything if not needed if(_limitEmissions == 2 || hardOnly() || ( _limitEmissions == 1 && _nis != 0 ) || ( _limitEmissions == 4 && _nis + _nfs != 0 ) ) { if(particle->spinInfo()) particle->spinInfo()->develop(); return false; } Branching bb; // generate branching while (true) { bb=_splittingGenerator->chooseBackwardBranching(*particle,beam, _initialenhance, _beam,type, pdf,freeze); // return if no emission if(!bb.kinematics) { if(particle->spinInfo()) particle->spinInfo()->develop(); return false; } // if not vetoed break if(!spaceLikeVetoed(bb,particle)) break; // otherwise reset scale and continue particle->vetoEmission(bb.type,bb.kinematics->scale()); if(particle->spinInfo()) particle->spinInfo()->decayVertex(VertexPtr()); } // assign the splitting function and shower kinematics particle->showerKinematics(bb.kinematics); if(bb.kinematics->pT()>progenitor()->highestpT()) progenitor()->highestpT(bb.kinematics->pT()); // For the time being we are considering only 1->2 branching // particles as in Sudakov form factor - tcPDPtr part[2]={getParticleData(bb.ids[0]), - getParticleData(bb.ids[2])}; - if(particle->id()!=bb.ids[1]) { - if(part[0]->CC()) part[0]=part[0]->CC(); - if(part[1]->CC()) part[1]=part[1]->CC(); - } + tcPDPtr part[2]={bb.ids[0],bb.ids[2]}; // Now create the actual particles, make the otherChild a final state // particle, while the newParent is not - ShowerParticlePtr newParent=new_ptr(ShowerParticle(part[0],false)); + ShowerParticlePtr newParent = new_ptr(ShowerParticle(part[0],false)); ShowerParticlePtr otherChild = new_ptr(ShowerParticle(part[1],true,true)); ShowerParticleVector theChildren; theChildren.push_back(particle); theChildren.push_back(otherChild); //this updates the evolution scale particle->showerKinematics()-> updateParent(newParent, theChildren,bb.type); // update the history if needed _currenttree->updateInitialStateShowerProduct(_progenitor,newParent); _currenttree->addInitialStateBranching(particle,newParent,otherChild); // for the reconstruction of kinematics, parent/child // relationships are according to the branching process: // now continue the shower ++_nis; bool emitted = _limitEmissions==0 ? spaceLikeShower(newParent,beam,type) : false; if(newParent->spinInfo()) newParent->spinInfo()->develop(); // now reconstruct the momentum if(!emitted) { if(_intrinsic.find(_progenitor)==_intrinsic.end()) { bb.kinematics->updateLast(newParent,ZERO,ZERO); } else { pair kt=_intrinsic[_progenitor]; bb.kinematics->updateLast(newParent, kt.first*cos(kt.second), kt.first*sin(kt.second)); } } particle->showerKinematics()-> updateChildren(newParent, theChildren,bb.type,false); if(_limitEmissions!=0) { if(particle->spinInfo()) particle->spinInfo()->develop(); return true; } // perform the shower of the final-state particle timeLikeShower(otherChild,type,Branching(),true); updateHistory(otherChild); if(theChildren[1]->spinInfo()) theChildren[1]->spinInfo()->develop(); // return the emitted if(particle->spinInfo()) particle->spinInfo()->develop(); return true; } void Evolver::showerDecay(ShowerTreePtr decay) { _decayme = HwDecayerBasePtr(); _hardme = HwMEBasePtr(); // find the decayer // try the normal way if possible tDMPtr dm = decay->incomingLines().begin()->first->original() ->decayMode(); if(!dm) dm = decay->incomingLines().begin()->first->copy() ->decayMode(); if(!dm) dm = decay->incomingLines().begin()->first->progenitor()->decayMode(); // otherwise make a string and look it up if(!dm) { string tag = decay->incomingLines().begin()->first->original()->dataPtr()->name() + "->"; OrderedParticles outgoing; for(map::const_iterator it=decay->outgoingLines().begin();it!=decay->outgoingLines().end();++it) { if(abs(decay->incomingLines().begin()->first->original()->id()) == ParticleID::t && abs(it->first->original()->id())==ParticleID::Wplus && decay->treelinks().size() == 1) { ShowerTreePtr Wtree = decay->treelinks().begin()->first; for(map::const_iterator it2=Wtree->outgoingLines().begin();it2!=Wtree->outgoingLines().end();++it2) { outgoing.insert(it2->first->original()->dataPtr()); } } else { outgoing.insert(it->first->original()->dataPtr()); } } for(OrderedParticles::const_iterator it=outgoing.begin(); it!=outgoing.end();++it) { if(it!=outgoing.begin()) tag += ","; tag +=(**it).name(); } tag += ";"; dm = findDecayMode(tag); } if(dm) _decayme = dynamic_ptr_cast(dm->decayer()); // set the ShowerTree to be showered currentTree(decay); decay->applyTransforms(); hardTree(HardTreePtr()); unsigned int interactionTry=0; do { try { // generate the showering doShowering(false,XCPtr()); // if no vetos // force calculation of spin correlations SpinPtr spInfo = decay->incomingLines().begin()->first->progenitor()->spinInfo(); if(spInfo) { if(!spInfo->developed()) spInfo->needsUpdate(); spInfo->develop(); } // and then return return; } catch (InteractionVeto) { currentTree()->clear(); ++interactionTry; } } while(interactionTry<=5); throw Exception() << "Too many tries for QED shower in Evolver::showerDecay()" << Exception::eventerror; } bool Evolver::spaceLikeDecayShower(tShowerParticlePtr particle, const ShowerParticle::EvolutionScales & maxScales, Energy minmass,ShowerInteraction::Type type, Branching fb) { // too many tries if(_nFSR>=_maxTryFSR) { ++_nFailedFSR; // too many failed events if(_nFailedFSR>=_maxFailFSR) throw Exception() << "Too many events have failed due to too many shower emissions, in\n" << "Evolver::timeLikeShower(). Terminating run\n" << Exception::runerror; throw Exception() << "Too many attempted emissions in Evolver::timeLikeShower()\n" << Exception::eventerror; } // generate the emission ShowerParticleVector children; int ntry=0; // generate the emission if(!fb.kinematics) fb = selectSpaceLikeDecayBranching(particle,maxScales,minmass,type, HardBranchingPtr()); // no emission, return if(!fb.kinematics) return false; Branching fc[2]; bool setupChildren = true; while (ntry<50) { if(particle->virtualMass()==ZERO) particle->virtualMass(_progenitor->progenitor()->mass()); fc[0] = Branching(); fc[1] = Branching(); ++ntry; assert(fb.kinematics); // has emitted // Assign the shower kinematics to the emitting particle. if(setupChildren) { ++_nFSR; // Assign the shower kinematics to the emitting particle. particle->showerKinematics(fb.kinematics); if(fb.kinematics->pT()>progenitor()->highestpT()) progenitor()->highestpT(fb.kinematics->pT()); // create the ShowerParticle objects for the two children children = createTimeLikeChildren(particle,fb.ids); // updateChildren the children particle->showerKinematics()-> updateChildren(particle, children, fb.type,_reconOpt>=3); setupChildren = false; } // select branchings for children fc[0] = selectSpaceLikeDecayBranching(children[0],maxScales,minmass, type,HardBranchingPtr()); fc[1] = selectTimeLikeBranching (children[1],type,HardBranchingPtr()); // old default if(_reconOpt==0) { // shower the first particle _currenttree->updateInitialStateShowerProduct(_progenitor,children[0]); _currenttree->addInitialStateBranching(particle,children[0],children[1]); if(fc[0].kinematics) spaceLikeDecayShower(children[0],maxScales,minmass,type,Branching()); // shower the second particle if(fc[1].kinematics) timeLikeShower(children[1],type,fc[1],true); updateHistory(children[1]); // branching has happened break; } // Herwig default else if(_reconOpt==1) { // shower the first particle _currenttree->updateInitialStateShowerProduct(_progenitor,children[0]); _currenttree->addInitialStateBranching(particle,children[0],children[1]); if(fc[0].kinematics) spaceLikeDecayShower(children[0],maxScales,minmass,type,Branching()); // shower the second particle if(fc[1].kinematics) timeLikeShower(children[1],type,fc[1],true); updateHistory(children[1]); // branching has happened particle->showerKinematics()->updateParent(particle, children,fb.type); // clean up the vetoed emission if(particle->virtualMass()==ZERO) { particle->showerKinematics(ShoKinPtr()); for(unsigned int ix=0;ixabandonChild(children[ix]); children.clear(); particle->vetoEmission(fb.type,fb.kinematics->scale()); // generate the new emission fb = selectSpaceLikeDecayBranching(particle,maxScales,minmass,type, HardBranchingPtr()); // no emission, return if(!fb.kinematics) { return false; } setupChildren = true; continue; } else break; } else if(_reconOpt>=2) { // cut-off masses for the branching const vector & virtualMasses = fb.sudakov->virtualMasses(fb.ids); // compute the masses of the children Energy masses[3]; // space-like children masses[1] = children[0]->virtualMass(); // time-like child if(fc[1].kinematics) { const vector & vm = fc[1].sudakov->virtualMasses(fc[1].ids); Energy2 q2 = fc[1].kinematics->z()*(1.-fc[1].kinematics->z())*sqr(fc[1].kinematics->scale()); - if(fc[1].ids[0]!=ParticleID::g) q2 += sqr(vm[0]); + if(fc[1].ids[0]->id()!=ParticleID::g) q2 += sqr(vm[0]); masses[2] = sqrt(q2); } else { masses[2] = virtualMasses[2]; } masses[0]=particle->virtualMass(); double z = fb.kinematics->z(); Energy2 pt2 = (1.-z)*(z*sqr(masses[0])-sqr(masses[1])-z/(1.-z)*sqr(masses[2])); if(pt2>=ZERO) { break; } else { // reset the scales for the children for(unsigned int ix=0;ix<2;++ix) { if(fc[ix].kinematics) children[ix]->vetoEmission(fc[ix].type,fc[ix].kinematics->scale()); else { if(ix==0) children[ix]->vetoEmission(ShowerPartnerType::QCDColourLine,Constants::MaxEnergy); else children[ix]->vetoEmission(ShowerPartnerType::QCDColourLine,ZERO); } } children[0]->virtualMass(_progenitor->progenitor()->mass()); children[1]->virtualMass(ZERO); } } }; if(_reconOpt>=2) { // In the case of splittings which involves coloured particles, // set properly the colour flow of the branching. // update the history if needed _currenttree->updateInitialStateShowerProduct(_progenitor,children[0]); _currenttree->addInitialStateBranching(particle,children[0],children[1]); // shower the first particle if(fc[0].kinematics) spaceLikeDecayShower(children[0],maxScales,minmass,type,Branching()); // shower the second particle if(fc[1].kinematics) timeLikeShower(children[1],type,fc[1],true); updateHistory(children[1]); // branching has happened particle->showerKinematics()->updateParent(particle, children,fb.type); } // branching has happened return true; } vector Evolver::setupShower(bool hard) { // generate POWHEG hard emission if needed if(_hardEmissionMode>0) hardestEmission(hard); ShowerInteraction::Type inter = interaction_; if(_hardtree&&inter!=ShowerInteraction::QEDQCD && inter!=ShowerInteraction::ALL) { inter = _hardtree->interaction(); } // set the initial colour partners setEvolutionPartners(hard,inter,false); // generate hard me if needed if(_hardEmissionMode==0 || (!hard && _hardEmissionMode==-1)) hardMatrixElementCorrection(hard); // get the particles to be showered vector particlesToShower = currentTree()->extractProgenitors(); // remake the colour partners if needed if(_currenttree->hardMatrixElementCorrection()) { setEvolutionPartners(hard,interaction_,true); _currenttree->resetShowerProducts(); } // return the answer return particlesToShower; } void Evolver::setEvolutionPartners(bool hard,ShowerInteraction::Type type, bool clear) { // match the particles in the ShowerTree and hardTree if(hardTree() && !hardTree()->connect(currentTree())) throw Exception() << "Can't match trees in " << "Evolver::setEvolutionPartners()" << Exception::eventerror; // extract the progenitors vector particles = currentTree()->extractProgenitorParticles(); // clear the partners if needed if(clear) { for(unsigned int ix=0;ixpartner(ShowerParticlePtr()); particles[ix]->clearPartners(); } } // sort out the colour partners if(hardTree()) { // find the partner for(unsigned int ix=0;ixparticles()[particles[ix]]->colourPartner(); if(!partner) continue; for(map::const_iterator it=hardTree()->particles().begin(); it!=hardTree()->particles().end();++it) { if(it->second==partner) particles[ix]->partner(it->first); } if(!particles[ix]->partner()) throw Exception() << "Can't match partners in " << "Evolver::setEvolutionPartners()" << Exception::eventerror; } } // Set the initial evolution scales showerModel()->partnerFinder()-> setInitialEvolutionScales(particles,!hard,type,!_hardtree); if(hardTree() && _hardPOWHEG) { bool tooHard=false; map::const_iterator eit=hardTree()->particles().end(); for(unsigned int ix=0;ix::const_iterator mit = hardTree()->particles().find(particles[ix]); Energy hardScale(ZERO); ShowerPartnerType::Type type(ShowerPartnerType::Undefined); // final-state if(particles[ix]->isFinalState()) { if(mit!= eit && !mit->second->children().empty()) { hardScale = mit->second->scale(); type = mit->second->type(); } } // initial-state else { if(mit!= eit && mit->second->parent()) { hardScale = mit->second->parent()->scale(); type = mit->second->parent()->type(); } } if(type!=ShowerPartnerType::Undefined) { if(type==ShowerPartnerType::QED) { tooHard |= particles[ix]->scales().QED_noAOscales().QCD_c_noAOscales().QCD_ac_noAOscales().EWchildren().empty()) { ShowerParticleVector theChildren; for(unsigned int ix=0;ixchildren().size();++ix) { ShowerParticlePtr part = dynamic_ptr_cast (particle->children()[ix]); theChildren.push_back(part); } // update the history if needed if(particle==_currenttree->getFinalStateShowerProduct(_progenitor)) _currenttree->updateFinalStateShowerProduct(_progenitor, particle,theChildren); _currenttree->addFinalStateBranching(particle,theChildren); for(unsigned int ix=0;ixprogenitor()->initializeFinalState(); if(hardTree()) { map::const_iterator eit=hardTree()->particles().end(), mit = hardTree()->particles().find(progenitor()->progenitor()); if( mit != eit && !mit->second->children().empty() ) { bool output=truncatedTimeLikeShower(progenitor()->progenitor(), mit->second ,type,Branching(),true); if(output) updateHistory(progenitor()->progenitor()); return output; } } // do the shower bool output = hardOnly() ? false : timeLikeShower(progenitor()->progenitor() ,type,Branching(),true) ; if(output) updateHistory(progenitor()->progenitor()); return output; } bool Evolver::startSpaceLikeShower(PPtr parent, ShowerInteraction::Type type) { // initialise the basis vectors progenitor()->progenitor()->initializeInitialState(parent); if(hardTree()) { map::const_iterator eit =hardTree()->particles().end(), mit = hardTree()->particles().find(progenitor()->progenitor()); if( mit != eit && mit->second->parent() ) { return truncatedSpaceLikeShower( progenitor()->progenitor(), parent, mit->second->parent(), type ); } } // perform the shower return hardOnly() ? false : spaceLikeShower(progenitor()->progenitor(),parent,type); } bool Evolver:: startSpaceLikeDecayShower(const ShowerParticle::EvolutionScales & maxScales, Energy minimumMass,ShowerInteraction::Type type) { _nFSR = 0; // set up the particle basis vectors progenitor()->progenitor()->initializeDecay(); if(hardTree()) { map::const_iterator eit =hardTree()->particles().end(), mit = hardTree()->particles().find(progenitor()->progenitor()); if( mit != eit && mit->second->parent() ) { HardBranchingPtr branch=mit->second; while(branch->parent()) branch=branch->parent(); return truncatedSpaceLikeDecayShower(progenitor()->progenitor(),maxScales, minimumMass, branch ,type, Branching()); } } // perform the shower return hardOnly() ? false : spaceLikeDecayShower(progenitor()->progenitor(),maxScales,minimumMass,type,Branching()); } bool Evolver::timeLikeVetoed(const Branching & fb, ShowerParticlePtr particle) { // work out type of interaction ShowerInteraction::Type type = convertInteraction(fb.type); // check whether emission was harder than largest pt of hard subprocess if ( hardVetoFS() && fb.kinematics->pT() > _progenitor->maxHardPt() ) return true; // soft matrix element correction veto if( softMEC()) { if(_hardme && _hardme->hasMECorrection()) { if(_hardme->softMatrixElementVeto(_progenitor,particle,fb)) return true; } else if(_decayme && _decayme->hasMECorrection()) { if(_decayme->softMatrixElementVeto(_progenitor,particle,fb)) return true; } } // veto on maximum pt if(fb.kinematics->pT()>_progenitor->maximumpT(type)) return true; // general vetos if (fb.kinematics && !_vetoes.empty()) { bool vetoed=false; for (vector::iterator v = _vetoes.begin(); v != _vetoes.end(); ++v) { bool test = (**v).vetoTimeLike(_progenitor,particle,fb); switch((**v).vetoType()) { case ShowerVeto::Emission: vetoed |= test; break; case ShowerVeto::Shower: if(test) throw VetoShower(); break; case ShowerVeto::Event: if(test) throw Veto(); break; } } if(vetoed) return true; } if ( ShowerHandler::currentHandler()->firstInteraction() && ShowerHandler::currentHandler()->profileScales() ) { double weight = ShowerHandler::currentHandler()->profileScales()-> hardScaleProfile(_progenitor->hardScale(),fb.kinematics->pT()); if ( UseRandom::rnd() > weight ) return true; } return false; } bool Evolver::spaceLikeVetoed(const Branching & bb, ShowerParticlePtr particle) { // work out type of interaction ShowerInteraction::Type type = convertInteraction(bb.type); // check whether emission was harder than largest pt of hard subprocess if (hardVetoIS() && bb.kinematics->pT() > _progenitor->maxHardPt()) return true; // apply the soft correction if( softMEC() && _hardme && _hardme->hasMECorrection() ) { if(_hardme->softMatrixElementVeto(_progenitor,particle,bb)) return true; } // the more general vetos // check vs max pt for the shower if(bb.kinematics->pT()>_progenitor->maximumpT(type)) return true; if (!_vetoes.empty()) { bool vetoed=false; for (vector::iterator v = _vetoes.begin(); v != _vetoes.end(); ++v) { bool test = (**v).vetoSpaceLike(_progenitor,particle,bb); switch ((**v).vetoType()) { case ShowerVeto::Emission: vetoed |= test; break; case ShowerVeto::Shower: if(test) throw VetoShower(); break; case ShowerVeto::Event: if(test) throw Veto(); break; } } if (vetoed) return true; } if ( ShowerHandler::currentHandler()->firstInteraction() && ShowerHandler::currentHandler()->profileScales() ) { double weight = ShowerHandler::currentHandler()->profileScales()-> hardScaleProfile(_progenitor->hardScale(),bb.kinematics->pT()); if ( UseRandom::rnd() > weight ) return true; } return false; } bool Evolver::spaceLikeDecayVetoed( const Branching & fb, ShowerParticlePtr particle) { // work out type of interaction ShowerInteraction::Type type = convertInteraction(fb.type); // apply the soft correction if( softMEC() && _decayme && _decayme->hasMECorrection() ) { if(_decayme->softMatrixElementVeto(_progenitor,particle,fb)) return true; } // veto on hardest pt in the shower if(fb.kinematics->pT()> _progenitor->maximumpT(type)) return true; // general vetos if (!_vetoes.empty()) { bool vetoed=false; for (vector::iterator v = _vetoes.begin(); v != _vetoes.end(); ++v) { bool test = (**v).vetoSpaceLike(_progenitor,particle,fb); switch((**v).vetoType()) { case ShowerVeto::Emission: vetoed |= test; break; case ShowerVeto::Shower: if(test) throw VetoShower(); break; case ShowerVeto::Event: if(test) throw Veto(); break; } if (vetoed) return true; } } return false; } void Evolver::hardestEmission(bool hard) { HardTreePtr ISRTree; if( ( _hardme && _hardme->hasPOWHEGCorrection()!=0 && _hardEmissionMode< 2) || ( _decayme && _decayme->hasPOWHEGCorrection()!=0 && _hardEmissionMode!=2) ) { if(_hardme) { assert(hard); _hardtree = _hardme->generateHardest( currentTree(),interaction_); } else { assert(!hard); _hardtree = _decayme->generateHardest( currentTree() ); } // store initial state POWHEG radiation if(_hardtree && _hardme && _hardme->hasPOWHEGCorrection()==1) ISRTree=_hardtree; } else if (_hardEmissionMode>1 && hard) { // Get minimum pT cutoff used in shower approximation Energy maxpt = 1.*GeV; int colouredIn = 0; int colouredOut = 0; for( map< ShowerProgenitorPtr, tShowerParticlePtr >::iterator it = currentTree()->outgoingLines().begin(); it != currentTree()->outgoingLines().end(); ++it ) { if( it->second->coloured() ) colouredOut+=1; } for( map< ShowerProgenitorPtr, ShowerParticlePtr >::iterator it = currentTree()->incomingLines().begin(); it != currentTree()->incomingLines().end(); ++it ) { if( ! it->second->coloured() ) colouredIn+=1; } if ( theShowerApproximation ){ if ( theShowerApproximation->ffPtCut() == theShowerApproximation->fiPtCut() && theShowerApproximation->ffPtCut() == theShowerApproximation->iiPtCut() ) maxpt = theShowerApproximation->ffPtCut(); else if ( colouredIn == 2 && colouredOut == 0 ) maxpt = theShowerApproximation->iiPtCut(); else if ( colouredIn == 0 && colouredOut > 1 ) maxpt = theShowerApproximation->ffPtCut(); else if ( colouredIn == 2 && colouredOut == 1 ) maxpt = min(theShowerApproximation->iiPtCut(), theShowerApproximation->fiPtCut()); else if ( colouredIn == 1 && colouredOut > 1 ) maxpt = min(theShowerApproximation->ffPtCut(), theShowerApproximation->fiPtCut()); else maxpt = min(min(theShowerApproximation->iiPtCut(), theShowerApproximation->fiPtCut()), theShowerApproximation->ffPtCut()); } // Generate hardtree from born and real emission subprocesses _hardtree = ShowerHandler::currentHandler()->generateCKKW(currentTree()); // Find transverse momentum of hardest emission if (_hardtree){ for(set::iterator it=_hardtree->branchings().begin(); it!=_hardtree->branchings().end();++it) { if ((*it)->parent() && (*it)->status()==HardBranching::Incoming) maxpt=(*it)->branchingParticle()->momentum().perp(); if ((*it)->children().size()==2 && (*it)->status()==HardBranching::Outgoing){ if ((*it)->branchingParticle()->id()!=21 && abs((*it)->branchingParticle()->id())>5 ){ if ((*it)->children()[0]->branchingParticle()->id()==21 || abs((*it)->children()[0]->branchingParticle()->id())<6) maxpt=(*it)->children()[0]->branchingParticle()->momentum().perp(); else if ((*it)->children()[1]->branchingParticle()->id()==21 || abs((*it)->children()[1]->branchingParticle()->id())<6) maxpt=(*it)->children()[1]->branchingParticle()->momentum().perp(); } else { if ( abs((*it)->branchingParticle()->id())<6){ if (abs((*it)->children()[0]->branchingParticle()->id())<6) maxpt = (*it)->children()[1]->branchingParticle()->momentum().perp(); else maxpt = (*it)->children()[0]->branchingParticle()->momentum().perp(); } else maxpt = (*it)->children()[1]->branchingParticle()->momentum().perp(); } } } } // Hardest (pt) emission should be the first powheg emission. maxpt=min(sqrt(ShowerHandler::currentHandler()->lastXCombPtr()->lastShowerScale()),maxpt); // Set maxpt to pT of emission when showering POWHEG real-emission subprocesses if (!isPowhegSEvent && !isPowhegHEvent){ vector outGluon; vector outQuark; map< ShowerProgenitorPtr, tShowerParticlePtr >::iterator it; for( it = currentTree()->outgoingLines().begin(); it != currentTree()->outgoingLines().end(); ++it ) { if ( abs(it->second->id())< 6) outQuark.push_back(it->second->id()); if ( it->second->id()==21 ) outGluon.push_back(it->second->id()); } if (outGluon.size() + outQuark.size() == 1){ for( it = currentTree()->outgoingLines().begin(); it != currentTree()->outgoingLines().end(); ++it ) { if ( abs(it->second->id())< 6 || it->second->id()==21 ) maxpt = it->second->momentum().perp(); } } else if (outGluon.size() + outQuark.size() > 1){ // assume qqbar pair from a Z/gamma if (outGluon.size()==1 && outQuark.size() == 2 && outQuark[0]==-outQuark[1]){ for( it = currentTree()->outgoingLines().begin(); it != currentTree()->outgoingLines().end(); ++it ) { if ( it->second->id()==21 ) maxpt = it->second->momentum().perp(); } } // otherwise take the lowest pT avoiding born DY events else { maxpt = generator()->maximumCMEnergy(); for( it = currentTree()->outgoingLines().begin(); it != currentTree()->outgoingLines().end(); ++it ) { if ( abs(it->second->id())< 6 || it->second->id()==21 ) maxpt = min(maxpt,it->second->momentum().perp()); } } } } // set maximum pT for subsequent emissions from S events if ( isPowhegSEvent || (!isPowhegSEvent && !isPowhegHEvent)){ for( map< ShowerProgenitorPtr, tShowerParticlePtr >::iterator it = currentTree()->outgoingLines().begin(); it != currentTree()->outgoingLines().end(); ++it ) { if( ! it->second->coloured() ) continue; it->first->maximumpT(maxpt, ShowerInteraction::QCD ); } for( map< ShowerProgenitorPtr, ShowerParticlePtr >::iterator it = currentTree()->incomingLines().begin(); it != currentTree()->incomingLines().end(); ++it ) { if( ! it->second->coloured() ) continue; it->first->maximumpT(maxpt, ShowerInteraction::QCD ); } } } else _hardtree = ShowerHandler::currentHandler()->generateCKKW(currentTree()); // if hard me doesn't have a FSR powheg // correction use decay powheg correction if (_hardme && _hardme->hasPOWHEGCorrection()<2) { // check for intermediate colour singlet resonance const ParticleVector inter = _hardme->subProcess()->intermediates(); if (inter.size()!=1 || inter[0]->momentum().m2()/GeV2 < 0 || inter[0]->dataPtr()->iColour()!=PDT::Colour0){ if(_hardtree) connectTrees(currentTree(),_hardtree,hard); return; } map out = currentTree()->outgoingLines(); // ignore cases where outgoing particles are not coloured if (out.size()!=2 || out. begin()->second->dataPtr()->iColour()==PDT::Colour0 || out.rbegin()->second->dataPtr()->iColour()==PDT::Colour0) { if(_hardtree) connectTrees(currentTree(),_hardtree,hard); return; } // look up decay mode tDMPtr dm; string tag; string inParticle = inter[0]->dataPtr()->name() + "->"; vector outParticles; outParticles.push_back(out.begin ()->first->progenitor()->dataPtr()->name()); outParticles.push_back(out.rbegin()->first->progenitor()->dataPtr()->name()); for (int it=0; it<2; ++it){ tag = inParticle + outParticles[it] + "," + outParticles[(it+1)%2] + ";"; dm = generator()->findDecayMode(tag); if(dm) break; } // get the decayer HwDecayerBasePtr decayer; if(dm) decayer = dynamic_ptr_cast(dm->decayer()); // check if decayer has a FSR POWHEG correction if (!decayer || decayer->hasPOWHEGCorrection()<2){ if(_hardtree) connectTrees(currentTree(),_hardtree,hard); return; } // generate the hardest emission ShowerDecayMap decay; PPtr in = new_ptr(*inter[0]); ShowerTreePtr decayTree = new_ptr(ShowerTree(in, decay)); HardTreePtr FSRTree = decayer->generateHardest(decayTree); if (!FSRTree) { if(_hardtree) connectTrees(currentTree(),_hardtree,hard); return; } // if there is no ISRTree make _hardtree from FSRTree if (!ISRTree){ vector inBranch,hardBranch; for(map::const_iterator cit =currentTree()->incomingLines().begin(); cit!=currentTree()->incomingLines().end();++cit ) { inBranch.push_back(new_ptr(HardBranching(cit->second,SudakovPtr(), HardBranchingPtr(), HardBranching::Incoming))); inBranch.back()->beam(cit->first->original()->parents()[0]); hardBranch.push_back(inBranch.back()); } if(inBranch[0]->branchingParticle()->dataPtr()->coloured()) { inBranch[0]->colourPartner(inBranch[1]); inBranch[1]->colourPartner(inBranch[0]); } for(set::iterator it=FSRTree->branchings().begin(); it!=FSRTree->branchings().end();++it) { if((**it).branchingParticle()->id()!=in->id()) hardBranch.push_back(*it); } hardBranch[2]->colourPartner(hardBranch[3]); hardBranch[3]->colourPartner(hardBranch[2]); HardTreePtr newTree = new_ptr(HardTree(hardBranch,inBranch, ShowerInteraction::QCD)); _hardtree = newTree; } // Otherwise modify the ISRTree to include the emission in FSRTree else { vector FSROut, ISROut; set::iterator itFSR, itISR; // get outgoing particles for(itFSR =FSRTree->branchings().begin(); itFSR!=FSRTree->branchings().end();++itFSR){ if ((**itFSR).status()==HardBranching::Outgoing) FSROut.push_back((*itFSR)->branchingParticle()); } for(itISR =ISRTree->branchings().begin(); itISR!=ISRTree->branchings().end();++itISR){ if ((**itISR).status()==HardBranching::Outgoing) ISROut.push_back((*itISR)->branchingParticle()); } // find COM frame formed by outgoing particles LorentzRotation eventFrameFSR, eventFrameISR; eventFrameFSR = ((FSROut[0]->momentum()+FSROut[1]->momentum()).findBoostToCM()); eventFrameISR = ((ISROut[0]->momentum()+ISROut[1]->momentum()).findBoostToCM()); // find rotation between ISR and FSR frames int j=0; if (ISROut[0]->id()!=FSROut[0]->id()) j=1; eventFrameISR.rotateZ( (eventFrameFSR*FSROut[0]->momentum()).phi()- (eventFrameISR*ISROut[j]->momentum()).phi() ); eventFrameISR.rotateY( (eventFrameFSR*FSROut[0]->momentum()).theta()- (eventFrameISR*ISROut[j]->momentum()).theta() ); eventFrameISR.invert(); for (itFSR=FSRTree->branchings().begin(); itFSR!=FSRTree->branchings().end();++itFSR){ if ((**itFSR).branchingParticle()->id()==in->id()) continue; for (itISR =ISRTree->branchings().begin(); itISR!=ISRTree->branchings().end();++itISR){ if ((**itISR).status()==HardBranching::Incoming) continue; if ((**itFSR).branchingParticle()->id()== (**itISR).branchingParticle()->id()){ // rotate FSRTree particle to ISRTree event frame (**itISR).branchingParticle()->setMomentum(eventFrameISR* eventFrameFSR* (**itFSR).branchingParticle()->momentum()); (**itISR).branchingParticle()->rescaleMass(); // add the children of the FSRTree particles to the ISRTree if(!(**itFSR).children().empty()){ (**itISR).addChild((**itFSR).children()[0]); (**itISR).addChild((**itFSR).children()[1]); // rotate momenta to ISRTree event frame (**itISR).children()[0]->branchingParticle()->setMomentum(eventFrameISR* eventFrameFSR* (**itFSR).children()[0]->branchingParticle()->momentum()); (**itISR).children()[1]->branchingParticle()->setMomentum(eventFrameISR* eventFrameFSR* (**itFSR).children()[1]->branchingParticle()->momentum()); } } } } _hardtree = ISRTree; } } if(_hardtree){ connectTrees(currentTree(),_hardtree,hard); } } bool Evolver::truncatedTimeLikeShower(tShowerParticlePtr particle, HardBranchingPtr branch, ShowerInteraction::Type type, Branching fb, bool first) { // select a branching if we don't have one if(!fb.kinematics) fb = selectTimeLikeBranching(particle,type,branch); // must be an emission, the forced one it not a truncated one assert(fb.kinematics); ShowerParticleVector children; int ntry=0; Branching fc[2]; bool setupChildren = true; while (ntry<50) { if(!fc[0].hard) fc[0] = Branching(); if(!fc[1].hard) fc[1] = Branching(); ++ntry; // Assign the shower kinematics to the emitting particle. if(setupChildren) { ++_nFSR; // Assign the shower kinematics to the emitting particle. particle->showerKinematics(fb.kinematics); if(fb.kinematics->pT()>progenitor()->highestpT()) progenitor()->highestpT(fb.kinematics->pT()); // create the children children = createTimeLikeChildren(particle,fb.ids); // update the children particle->showerKinematics()-> updateChildren(particle, children,fb.type,_reconOpt>=3); setupChildren = false; } // select branchings for children if(!fc[0].kinematics) { // select branching for first particle if(!fb.hard && fb.iout ==1 ) fc[0] = selectTimeLikeBranching(children[0],type,branch); else if(fb.hard && !branch->children()[0]->children().empty() ) fc[0] = selectTimeLikeBranching(children[0],type,branch->children()[0]); else fc[0] = selectTimeLikeBranching(children[0],type,HardBranchingPtr()); } // select branching for the second particle if(!fc[1].kinematics) { // select branching for first particle if(!fb.hard && fb.iout ==2 ) fc[1] = selectTimeLikeBranching(children[1],type,branch); else if(fb.hard && !branch->children()[1]->children().empty() ) fc[1] = selectTimeLikeBranching(children[1],type,branch->children()[1]); else fc[1] = selectTimeLikeBranching(children[1],type,HardBranchingPtr()); } // old default if(_reconOpt==0 || (_reconOpt==1 && fb.hard) ) { // shower the first particle if(fc[0].kinematics) { // the parent has truncated emission and following line if(!fb.hard && fb.iout == 1) truncatedTimeLikeShower(children[0],branch,type,fc[0],false); // hard emission and subsquent hard emissions else if(fb.hard && !branch->children()[0]->children().empty() ) truncatedTimeLikeShower(children[0],branch->children()[0],type,fc[0],false); // normal shower else timeLikeShower(children[0],type,fc[0],false); } if(children[0]->spinInfo()) children[0]->spinInfo()->develop(); // shower the second particle if(fc[1].kinematics) { // the parent has truncated emission and following line if(!fb.hard && fb.iout == 2) truncatedTimeLikeShower(children[1],branch,type,fc[1],false); // hard emission and subsquent hard emissions else if(fb.hard && !branch->children()[1]->children().empty() ) truncatedTimeLikeShower(children[1],branch->children()[1],type,fc[1],false); else timeLikeShower(children[1],type,fc[1],false); } if(children[1]->spinInfo()) children[1]->spinInfo()->develop(); // branching has happened particle->showerKinematics()->updateParent(particle, children,fb.type); break; } // H7 default else if(_reconOpt==1) { // shower the first particle if(fc[0].kinematics) { // the parent has truncated emission and following line if(!fb.hard && fb.iout == 1) truncatedTimeLikeShower(children[0],branch,type,fc[0],false); else timeLikeShower(children[0],type,fc[0],false); } if(children[0]->spinInfo()) children[0]->spinInfo()->develop(); // shower the second particle if(fc[1].kinematics) { // the parent has truncated emission and following line if(!fb.hard && fb.iout == 2) truncatedTimeLikeShower(children[1],branch,type,fc[1],false); else timeLikeShower(children[1],type,fc[1],false); } if(children[1]->spinInfo()) children[1]->spinInfo()->develop(); // branching has happened particle->showerKinematics()->updateParent(particle, children,fb.type); // clean up the vetoed emission if(particle->virtualMass()==ZERO) { particle->showerKinematics(ShoKinPtr()); for(unsigned int ix=0;ixabandonChild(children[ix]); children.clear(); if(particle->spinInfo()) particle->spinInfo()->decayVertex(VertexPtr()); particle->vetoEmission(fb.type,fb.kinematics->scale()); // generate the new emission fb = selectTimeLikeBranching(particle,type,branch); // must be at least hard emission assert(fb.kinematics); setupChildren = true; continue; } else break; } else if(_reconOpt>=2) { // cut-off masses for the branching const vector & virtualMasses = fb.sudakov->virtualMasses(fb.ids); // compute the masses of the children Energy masses[3]; for(unsigned int ix=0;ix<2;++ix) { if(fc[ix].kinematics) { const vector & vm = fc[ix].sudakov->virtualMasses(fc[ix].ids); Energy2 q2 = fc[ix].kinematics->z()*(1.-fc[ix].kinematics->z())*sqr(fc[ix].kinematics->scale()); - if(fc[ix].ids[0]!=ParticleID::g) q2 += sqr(vm[0]); + if(fc[ix].ids[0]->id()!=ParticleID::g) q2 += sqr(vm[0]); masses[ix+1] = sqrt(q2); } else { masses[ix+1] = virtualMasses[ix+1]; } } - masses[0] = fb.ids[0]!=ParticleID::g ? virtualMasses[0] : ZERO; + masses[0] = fb.ids[0]->id()!=ParticleID::g ? virtualMasses[0] : ZERO; double z = fb.kinematics->z(); Energy2 pt2 = z*(1.-z)*(z*(1.-z)*sqr(fb.kinematics->scale()) + sqr(masses[0])) - sqr(masses[1])*(1.-z) - sqr(masses[2])*z; if(pt2>=ZERO) { break; } // if only the hard emission have to accept it else if ((fc[0].hard && !fc[1].kinematics) || (fc[1].hard && !fc[0].kinematics) ) { break; } else { // reset the scales for the children for(unsigned int ix=0;ix<2;++ix) { if(fc[ix].hard) continue; if(fc[ix].kinematics && ! fc[ix].hard ) children[ix]->vetoEmission(fc[ix].type,fc[ix].kinematics->scale()); else children[ix]->vetoEmission(ShowerPartnerType::QCDColourLine,ZERO); children[ix]->virtualMass(ZERO); } } } }; if(_reconOpt>=2) { // shower the first particle if(fc[0].kinematics) { // the parent has truncated emission and following line if(!fb.hard && fb.iout == 1) truncatedTimeLikeShower(children[0],branch,type,fc[0],false); // hard emission and subsquent hard emissions else if(fb.hard && !branch->children()[0]->children().empty() ) truncatedTimeLikeShower(children[0],branch->children()[0],type,fc[0],false); // normal shower else timeLikeShower(children[0],type,fc[0],false); } if(children[0]->spinInfo()) children[0]->spinInfo()->develop(); // shower the second particle if(fc[1].kinematics) { // the parent has truncated emission and following line if(!fb.hard && fb.iout == 2) truncatedTimeLikeShower(children[1],branch,type,fc[1],false); // hard emission and subsquent hard emissions else if(fb.hard && !branch->children()[1]->children().empty() ) truncatedTimeLikeShower(children[1],branch->children()[1],type,fc[1],false); else timeLikeShower(children[1],type,fc[1],false); } if(children[1]->spinInfo()) children[1]->spinInfo()->develop(); // branching has happened particle->showerKinematics()->updateParent(particle, children,fb.type); } if(first&&!children.empty()) particle->showerKinematics()->resetChildren(particle,children); if(particle->spinInfo()) particle->spinInfo()->develop(); return true; } bool Evolver::truncatedSpaceLikeShower(tShowerParticlePtr particle, PPtr beam, HardBranchingPtr branch, ShowerInteraction::Type type) { tcPDFPtr pdf; if(ShowerHandler::currentHandler()->firstPDF().particle() == beamParticle()) pdf = ShowerHandler::currentHandler()->firstPDF().pdf(); if(ShowerHandler::currentHandler()->secondPDF().particle() == beamParticle()) pdf = ShowerHandler::currentHandler()->secondPDF().pdf(); Energy freeze = ShowerHandler::currentHandler()->pdfFreezingScale(); Branching bb; // parameters of the force branching double z(0.); HardBranchingPtr timelike; for( unsigned int ix = 0; ix < branch->children().size(); ++ix ) { if( branch->children()[ix]->status() ==HardBranching::Outgoing) { timelike = branch->children()[ix]; } if( branch->children()[ix]->status() ==HardBranching::Incoming ) z = branch->children()[ix]->z(); } // generate truncated branching tcPDPtr part[2]; if(z>=0.&&z<=1.) { while (true) { if( !isTruncatedShowerON() || hardOnly() ) break; bb = splittingGenerator()->chooseBackwardBranching( *particle, beam, 1., beamParticle(), type , pdf,freeze); if( !bb.kinematics || bb.kinematics->scale() < branch->scale() ) { bb = Branching(); break; } // particles as in Sudakov form factor - part[0] = getParticleData( bb.ids[0] ); - part[1] = getParticleData( bb.ids[2] ); - - //is emitter anti-particle - if( particle->id() != bb.ids[1]) { - if( part[0]->CC() ) part[0] = part[0]->CC(); - if( part[1]->CC() ) part[1] = part[1]->CC(); - } + part[0] = bb.ids[0]; + part[1] = bb.ids[2]; double zsplit = bb.kinematics->z(); // apply the vetos for the truncated shower // if doesn't carry most of momentum ShowerInteraction::Type type2 = convertInteraction(bb.type); if(type2==branch->sudakov()->interactionType() && zsplit < 0.5) { particle->vetoEmission(bb.type,bb.kinematics->scale()); continue; } // others if( part[0]->id() != particle->id() || // if particle changes type bb.kinematics->pT() > progenitor()->maximumpT(type2) || // pt veto bb.kinematics->scale() < branch->scale()) { // angular ordering veto particle->vetoEmission(bb.type,bb.kinematics->scale()); continue; } // and those from the base class if(spaceLikeVetoed(bb,particle)) { particle->vetoEmission(bb.type,bb.kinematics->scale()); continue; } break; } } if( !bb.kinematics ) { //do the hard emission ShoKinPtr kinematics = branch->sudakov()->createInitialStateBranching( branch->scale(), z, branch->phi(), branch->children()[0]->pT() ); // assign the splitting function and shower kinematics particle->showerKinematics( kinematics ); if(kinematics->pT()>progenitor()->highestpT()) progenitor()->highestpT(kinematics->pT()); // For the time being we are considering only 1->2 branching // Now create the actual particles, make the otherChild a final state // particle, while the newParent is not ShowerParticlePtr newParent = new_ptr( ShowerParticle( branch->branchingParticle()->dataPtr(), false ) ); ShowerParticlePtr otherChild = new_ptr( ShowerParticle( timelike->branchingParticle()->dataPtr(), true, true ) ); ShowerParticleVector theChildren; theChildren.push_back( particle ); theChildren.push_back( otherChild ); particle->showerKinematics()-> updateParent( newParent, theChildren, branch->type()); // update the history if needed currentTree()->updateInitialStateShowerProduct( progenitor(), newParent ); currentTree()->addInitialStateBranching( particle, newParent, otherChild ); // for the reconstruction of kinematics, parent/child // relationships are according to the branching process: // now continue the shower bool emitted=false; if(!hardOnly()) { if( branch->parent() ) { emitted = truncatedSpaceLikeShower( newParent, beam, branch->parent() , type); } else { emitted = spaceLikeShower( newParent, beam , type); } } if( !emitted ) { if( intrinsicpT().find( progenitor() ) == intrinsicpT().end() ) { kinematics->updateLast( newParent, ZERO, ZERO ); } else { pair kt = intrinsicpT()[progenitor()]; kinematics->updateLast( newParent, kt.first*cos( kt.second ), kt.first*sin( kt.second ) ); } } particle->showerKinematics()-> updateChildren( newParent, theChildren,bb.type,false); if(hardOnly()) return true; // perform the shower of the final-state particle if( timelike->children().empty() ) { timeLikeShower( otherChild , type,Branching(),true); } else { truncatedTimeLikeShower( otherChild, timelike , type,Branching(), true); } updateHistory(otherChild); // return the emitted return true; } // assign the splitting function and shower kinematics particle->showerKinematics( bb.kinematics ); if(bb.kinematics->pT()>progenitor()->highestpT()) progenitor()->highestpT(bb.kinematics->pT()); // For the time being we are considering only 1->2 branching // Now create the actual particles, make the otherChild a final state // particle, while the newParent is not ShowerParticlePtr newParent = new_ptr( ShowerParticle( part[0], false ) ); ShowerParticlePtr otherChild = new_ptr( ShowerParticle( part[1], true, true ) ); ShowerParticleVector theChildren; theChildren.push_back( particle ); theChildren.push_back( otherChild ); particle->showerKinematics()-> updateParent( newParent, theChildren, bb.type); // update the history if needed currentTree()->updateInitialStateShowerProduct( progenitor(), newParent ); currentTree()->addInitialStateBranching( particle, newParent, otherChild ); // for the reconstruction of kinematics, parent/child // relationships are according to the branching process: // now continue the shower bool emitted = truncatedSpaceLikeShower( newParent, beam, branch,type); // now reconstruct the momentum if( !emitted ) { if( intrinsicpT().find( progenitor() ) == intrinsicpT().end() ) { bb.kinematics->updateLast( newParent, ZERO, ZERO ); } else { pair kt = intrinsicpT()[ progenitor() ]; bb.kinematics->updateLast( newParent, kt.first*cos( kt.second ), kt.first*sin( kt.second ) ); } } particle->showerKinematics()-> updateChildren( newParent, theChildren, bb.type,false); // perform the shower of the final-state particle timeLikeShower( otherChild , type,Branching(),true); updateHistory(otherChild); // return the emitted return true; } bool Evolver:: truncatedSpaceLikeDecayShower(tShowerParticlePtr particle, const ShowerParticle::EvolutionScales & maxScales, Energy minmass, HardBranchingPtr branch, ShowerInteraction::Type type, Branching fb) { // select a branching if we don't have one if(!fb.kinematics) fb = selectSpaceLikeDecayBranching(particle,maxScales,minmass,type,branch); // must be an emission, the forced one it not a truncated one assert(fb.kinematics); ShowerParticleVector children; int ntry=0; Branching fc[2]; bool setupChildren = true; while (ntry<50) { if(!fc[0].hard) fc[0] = Branching(); if(!fc[1].hard) fc[1] = Branching(); ++ntry; if(setupChildren) { ++_nFSR; // Assign the shower kinematics to the emitting particle. particle->showerKinematics(fb.kinematics); if(fb.kinematics->pT()>progenitor()->highestpT()) progenitor()->highestpT(fb.kinematics->pT()); // create the ShowerParticle objects for the two children children = createTimeLikeChildren(particle,fb.ids); // updateChildren the children particle->showerKinematics()-> updateChildren(particle, children, fb.type,_reconOpt>=3); setupChildren = false; } // select branchings for children if(!fc[0].kinematics) { if(children[0]->id()==particle->id()) { // select branching for first particle if(!fb.hard) fc[0] = selectSpaceLikeDecayBranching(children[0],maxScales,minmass,type,branch); else if(fb.hard && ! branch->children()[0]->children().empty() ) fc[0] = selectSpaceLikeDecayBranching(children[0],maxScales,minmass,type, branch->children()[0]); else fc[0] = selectSpaceLikeDecayBranching(children[0],maxScales,minmass,type, HardBranchingPtr()); } else { // select branching for first particle if(fb.hard && !branch->children()[0]->children().empty() ) fc[0] = selectTimeLikeBranching(children[0],type,branch->children()[0]); else fc[0] = selectTimeLikeBranching(children[0],type,HardBranchingPtr()); } } // select branching for the second particle if(!fc[1].kinematics) { if(children[1]->id()==particle->id()) { // select branching for first particle if(!fb.hard) fc[1] = selectSpaceLikeDecayBranching(children[1],maxScales,minmass,type,branch); else if(fb.hard && ! branch->children()[1]->children().empty() ) fc[1] = selectSpaceLikeDecayBranching(children[1],maxScales,minmass,type, branch->children()[1]); else fc[1] = selectSpaceLikeDecayBranching(children[1],maxScales,minmass,type, HardBranchingPtr()); } else { if(fb.hard && !branch->children()[1]->children().empty() ) fc[1] = selectTimeLikeBranching(children[1],type,branch->children()[1]); else fc[1] = selectTimeLikeBranching(children[1],type,HardBranchingPtr()); } } // old default if(_reconOpt==0 || (_reconOpt==1 && fb.hard) ) { // update the history if needed currentTree()->updateInitialStateShowerProduct(progenitor(),children[0]); currentTree()->addInitialStateBranching(particle,children[0],children[1]); // shower the first particle if(fc[0].kinematics) { if(children[0]->id()==particle->id()) { if(!fb.hard) truncatedSpaceLikeDecayShower( children[0],maxScales,minmass, branch,type,fc[0]); else if(fb.hard && ! branch->children()[0]->children().empty() ) truncatedSpaceLikeDecayShower( children[0],maxScales,minmass, branch->children()[0],type,fc[0]); else spaceLikeDecayShower( children[0],maxScales,minmass,type,fc[0]); } else { if(fb.hard && !branch->children()[0]->children().empty() ) truncatedTimeLikeShower(children[0],branch->children()[0],type,fc[0],false); // normal shower else timeLikeShower(children[0],type,fc[0],false); } } // shower the second particle if(fc[1].kinematics) { if(children[0]->id()==particle->id()) { if(!fb.hard) truncatedSpaceLikeDecayShower( children[0],maxScales,minmass, branch,type,fc[1]); else if(fb.hard && ! branch->children()[0]->children().empty() ) truncatedSpaceLikeDecayShower( children[0],maxScales,minmass, branch->children()[0],type,fc[1]); else spaceLikeDecayShower( children[0],maxScales,minmass,type,fc[1]); } else { if(fb.hard && !branch->children()[0]->children().empty() ) truncatedTimeLikeShower(children[0],branch->children()[0],type,fc[1],false); // normal shower else timeLikeShower(children[0],type,fc[1],false); } } updateHistory(children[1]); // branching has happened break; } // H7 default else if(_reconOpt==1) { // update the history if needed currentTree()->updateInitialStateShowerProduct(progenitor(),children[0]); currentTree()->addInitialStateBranching(particle,children[0],children[1]); // shower the first particle if(fc[0].kinematics) { if(children[0]->id()==particle->id()) { if(!fb.hard) truncatedSpaceLikeDecayShower( children[0],maxScales,minmass, branch,type,fc[0]); else if(fb.hard && ! branch->children()[0]->children().empty() ) truncatedSpaceLikeDecayShower( children[0],maxScales,minmass, branch->children()[0],type,fc[0]); else spaceLikeDecayShower( children[0],maxScales,minmass,type,fc[0]); } else { if(fb.hard && !branch->children()[0]->children().empty() ) truncatedTimeLikeShower(children[0],branch->children()[0],type,fc[0],false); // normal shower else timeLikeShower(children[0],type,fc[0],false); } } // shower the second particle if(fc[1].kinematics) { if(children[0]->id()==particle->id()) { if(!fb.hard) truncatedSpaceLikeDecayShower( children[0],maxScales,minmass, branch,type,fc[1]); else if(fb.hard && ! branch->children()[0]->children().empty() ) truncatedSpaceLikeDecayShower( children[0],maxScales,minmass, branch->children()[0],type,fc[1]); else spaceLikeDecayShower( children[0],maxScales,minmass,type,fc[1]); } else { if(fb.hard && !branch->children()[0]->children().empty() ) truncatedTimeLikeShower(children[0],branch->children()[0],type,fc[1],false); // normal shower else timeLikeShower(children[0],type,fc[1],false); } } // clean up the vetoed emission if(particle->virtualMass()==ZERO) { particle->showerKinematics(ShoKinPtr()); for(unsigned int ix=0;ixabandonChild(children[ix]); children.clear(); particle->vetoEmission(fb.type,fb.kinematics->scale()); // generate the new emission fb = selectSpaceLikeDecayBranching(particle,maxScales,minmass,type,branch); // must be at least hard emission assert(fb.kinematics); setupChildren = true; continue; } else { updateHistory(children[1]); break; } } else if(_reconOpt>=2) { // cut-off masses for the branching const vector & virtualMasses = fb.sudakov->virtualMasses(fb.ids); // compute the masses of the children Energy masses[3]; // space-like children masses[1] = children[0]->virtualMass(); // time-like child if(fc[1].kinematics) { const vector & vm = fc[1].sudakov->virtualMasses(fc[1].ids); Energy2 q2 = fc[1].kinematics->z()*(1.-fc[1].kinematics->z())*sqr(fc[1].kinematics->scale()); - if(fc[1].ids[0]!=ParticleID::g) q2 += sqr(vm[0]); + if(fc[1].ids[0]->id()!=ParticleID::g) q2 += sqr(vm[0]); masses[2] = sqrt(q2); } else { masses[2] = virtualMasses[2]; } masses[0]=particle->virtualMass(); double z = fb.kinematics->z(); Energy2 pt2 = (1.-z)*(z*sqr(masses[0])-sqr(masses[1])-z/(1.-z)*sqr(masses[2])); if(pt2>=ZERO) { break; } else { // reset the scales for the children for(unsigned int ix=0;ix<2;++ix) { if(fc[ix].kinematics) children[ix]->vetoEmission(fc[ix].type,fc[ix].kinematics->scale()); else { if(ix==0) children[ix]->vetoEmission(ShowerPartnerType::QCDColourLine,Constants::MaxEnergy); else children[ix]->vetoEmission(ShowerPartnerType::QCDColourLine,ZERO); } } children[0]->virtualMass(_progenitor->progenitor()->mass()); children[1]->virtualMass(ZERO); } } }; if(_reconOpt>=2) { // update the history if needed currentTree()->updateInitialStateShowerProduct(progenitor(),children[0]); currentTree()->addInitialStateBranching(particle,children[0],children[1]); // shower the first particle if(fc[0].kinematics) { if(children[0]->id()==particle->id()) { if(!fb.hard) truncatedSpaceLikeDecayShower( children[0],maxScales,minmass, branch,type,fc[0]); else if(fb.hard && ! branch->children()[0]->children().empty() ) truncatedSpaceLikeDecayShower( children[0],maxScales,minmass, branch->children()[0],type,fc[0]); else spaceLikeDecayShower( children[0],maxScales,minmass,type,fc[0]); } else { if(fb.hard && !branch->children()[0]->children().empty() ) truncatedTimeLikeShower(children[0],branch->children()[0],type,fc[0],false); // normal shower else timeLikeShower(children[0],type,fc[0],false); } } // shower the second particle if(fc[1].kinematics) { if(children[0]->id()==particle->id()) { if(!fb.hard) truncatedSpaceLikeDecayShower( children[0],maxScales,minmass, branch,type,fc[1]); else if(fb.hard && ! branch->children()[0]->children().empty() ) truncatedSpaceLikeDecayShower( children[0],maxScales,minmass, branch->children()[0],type,fc[1]); else spaceLikeDecayShower( children[0],maxScales,minmass,type,fc[1]); } else { if(fb.hard && !branch->children()[0]->children().empty() ) truncatedTimeLikeShower(children[0],branch->children()[0],type,fc[1],false); // normal shower else timeLikeShower(children[0],type,fc[1],false); } } updateHistory(children[1]); } return true; } void Evolver::connectTrees(ShowerTreePtr showerTree, HardTreePtr hardTree, bool hard ) { ShowerParticleVector particles; // find the Sudakovs for(set::iterator cit=hardTree->branchings().begin(); cit!=hardTree->branchings().end();++cit) { // Sudakovs for ISR if((**cit).parent()&&(**cit).status()==HardBranching::Incoming) { ++_nis; - IdList br(3); + vector br(3); br[0] = (**cit).parent()->branchingParticle()->id(); br[1] = (**cit). branchingParticle()->id(); br[2] = (**cit).parent()->children()[0]==*cit ? (**cit).parent()->children()[1]->branchingParticle()->id() : (**cit).parent()->children()[0]->branchingParticle()->id(); BranchingList branchings = splittingGenerator()->initialStateBranchings(); if(br[1]<0&&br[0]==br[1]) { br[0] = abs(br[0]); br[1] = abs(br[1]); } else if(br[1]<0) { br[1] = -br[1]; br[2] = -br[2]; } long index = abs(br[1]); SudakovPtr sudakov; for(BranchingList::const_iterator cjt = branchings.lower_bound(index); cjt != branchings.upper_bound(index); ++cjt ) { - IdList ids = cjt->second.second; - if(ids[0]==br[0]&&ids[1]==br[1]&&ids[2]==br[2]) { - sudakov=cjt->second.first; + IdList ids = cjt->second.particles; + if(ids[0]->id()==br[0]&&ids[1]->id()==br[1]&&ids[2]->id()==br[2]) { + sudakov=cjt->second.sudakov; break; } } if(!sudakov) throw Exception() << "Can't find Sudakov for the hard emission in " << "Evolver::connectTrees() for ISR" << Exception::runerror; (**cit).parent()->sudakov(sudakov); } // Sudakovs for FSR else if(!(**cit).children().empty()) { ++_nfs; - IdList br(3); + vector br(3); br[0] = (**cit) .branchingParticle()->id(); br[1] = (**cit).children()[0]->branchingParticle()->id(); br[2] = (**cit).children()[1]->branchingParticle()->id(); BranchingList branchings = splittingGenerator()->finalStateBranchings(); if(br[0]<0) { br[0] = abs(br[0]); br[1] = abs(br[1]); br[2] = abs(br[2]); } long index = br[0]; SudakovPtr sudakov; for(BranchingList::const_iterator cjt = branchings.lower_bound(index); cjt != branchings.upper_bound(index); ++cjt ) { - IdList ids = cjt->second.second; - if(ids[0]==br[0]&&ids[1]==br[1]&&ids[2]==br[2]) { - sudakov=cjt->second.first; + IdList ids = cjt->second.particles; + if(ids[0]->id()==br[0]&&ids[1]->id()==br[1]&&ids[2]->id()==br[2]) { + sudakov=cjt->second.sudakov; break; } } if(!sudakov) throw Exception() << "Can't find Sudakov for the hard emission in " << "Evolver::connectTrees()" << Exception::runerror; (**cit).sudakov(sudakov); } } // calculate the evolution scale for(set::iterator cit=hardTree->branchings().begin(); cit!=hardTree->branchings().end();++cit) { particles.push_back((*cit)->branchingParticle()); } showerModel()->partnerFinder()-> setInitialEvolutionScales(particles,!hard,hardTree->interaction(), !hardTree->partnersSet()); hardTree->partnersSet(true); // inverse reconstruction if(hard) { showerModel()->kinematicsReconstructor()-> deconstructHardJets(hardTree,ShowerHandler::currentHandler()->evolver(), hardTree->interaction()); } else showerModel()->kinematicsReconstructor()-> deconstructDecayJets(hardTree,ShowerHandler::currentHandler()->evolver(), hardTree->interaction()); // now reset the momenta of the showering particles vector particlesToShower; for(map::const_iterator cit=showerTree->incomingLines().begin(); cit!=showerTree->incomingLines().end();++cit ) particlesToShower.push_back(cit->first); // extract the showering particles for(map::const_iterator cit=showerTree->outgoingLines().begin(); cit!=showerTree->outgoingLines().end();++cit ) particlesToShower.push_back(cit->first); // match them map partners; for(set::const_iterator bit=hardTree->branchings().begin(); bit!=hardTree->branchings().end();++bit) { Energy2 dmin( 1e30*GeV2 ); ShowerProgenitorPtr partner; for(vector::const_iterator pit=particlesToShower.begin(); pit!=particlesToShower.end();++pit) { if(partners.find(*pit)!=partners.end()) continue; if( (**bit).branchingParticle()->id() != (**pit).progenitor()->id() ) continue; if( (**bit).branchingParticle()->isFinalState() != (**pit).progenitor()->isFinalState() ) continue; if( (**pit).progenitor()->isFinalState() ) { Energy2 dtest = sqr( (**pit).progenitor()->momentum().x() - (**bit).showerMomentum().x() ) + sqr( (**pit).progenitor()->momentum().y() - (**bit).showerMomentum().y() ) + sqr( (**pit).progenitor()->momentum().z() - (**bit).showerMomentum().z() ) + sqr( (**pit).progenitor()->momentum().t() - (**bit).showerMomentum().t() ); // add mass difference for identical particles (e.g. Z0 Z0 production) dtest += 1e10*sqr((**pit).progenitor()->momentum().m()-(**bit).showerMomentum().m()); if( dtest < dmin ) { partner = *pit; dmin = dtest; } } else { // ensure directions are right if((**pit).progenitor()->momentum().z()/(**bit).showerMomentum().z()>ZERO) { partner = *pit; break; } } } if(!partner) throw Exception() << "Failed to match shower and hard trees in Evolver::hardestEmission" << Exception::eventerror; partners[partner] = *bit; } for(vector::const_iterator pit=particlesToShower.begin(); pit!=particlesToShower.end();++pit) { HardBranchingPtr partner = partners[*pit]; if((**pit).progenitor()->dataPtr()->stable()) { (**pit).progenitor()->set5Momentum(partner->showerMomentum()); (**pit).copy()->set5Momentum(partner->showerMomentum()); } else { Lorentz5Momentum oldMomentum = (**pit).progenitor()->momentum(); Lorentz5Momentum newMomentum = partner->showerMomentum(); LorentzRotation boost( oldMomentum.findBoostToCM(),oldMomentum.e()/oldMomentum.mass()); (**pit).progenitor()->transform(boost); (**pit).copy() ->transform(boost); boost = LorentzRotation(-newMomentum.findBoostToCM(),newMomentum.e()/newMomentum.mass()); (**pit).progenitor()->transform(boost); (**pit).copy() ->transform(boost); } } // correction boosts for daughter trees for(map >::const_iterator tit = showerTree->treelinks().begin(); tit != showerTree->treelinks().end();++tit) { ShowerTreePtr decayTree = tit->first; map::const_iterator cit = decayTree->incomingLines().begin(); // reset the momentum of the decay particle Lorentz5Momentum oldMomentum = cit->first->progenitor()->momentum(); Lorentz5Momentum newMomentum = tit->second.second->momentum(); LorentzRotation boost( oldMomentum.findBoostToCM(),oldMomentum.e()/oldMomentum.mass()); decayTree->transform(boost,true); boost = LorentzRotation(-newMomentum.findBoostToCM(),newMomentum.e()/newMomentum.mass()); decayTree->transform(boost,true); } } void Evolver::doShowering(bool hard,XCPtr xcomb) { // zero number of emissions _nis = _nfs = 0; // if MC@NLO H event and limited emissions // indicate both final and initial state emission if ( isMCatNLOHEvent && _limitEmissions != 0 ) { _nis = _nfs = 1; } // extract particles to shower vector particlesToShower(setupShower(hard)); // setup the maximum scales for the shower if (hardVetoOn()) setupMaximumScales(particlesToShower,xcomb); // set the hard scales for the profiles setupHardScales(particlesToShower,xcomb); // specific stuff for hard processes and decays Energy minmass(ZERO), mIn(ZERO); // hard process generate the intrinsic p_T once and for all if(hard) { generateIntrinsicpT(particlesToShower); } // decay compute the minimum mass of the final-state else { for(unsigned int ix=0;ixprogenitor()->isFinalState()) { if(particlesToShower[ix]->progenitor()->dataPtr()->stable()) minmass += particlesToShower[ix]->progenitor()->dataPtr()->constituentMass(); else minmass += particlesToShower[ix]->progenitor()->mass(); } else { mIn = particlesToShower[ix]->progenitor()->mass(); } } // throw exception if decay can't happen if ( minmass > mIn ) { throw Exception() << "Evolver.cc: Mass of decaying particle is " << "below constituent masses of decay products." << Exception::eventerror; } } // create random particle vector vector tmp; unsigned int nColouredIncoming = 0; while(particlesToShower.size()>0){ unsigned int xx=UseRandom::irnd(particlesToShower.size()); tmp.push_back(particlesToShower[xx]); particlesToShower.erase(particlesToShower.begin()+xx); } particlesToShower=tmp; for(unsigned int ix=0;ixprogenitor()->isFinalState() && particlesToShower[ix]->progenitor()->coloured()) ++nColouredIncoming; } bool switchRecon = hard && nColouredIncoming !=1; // main shower loop unsigned int ntry(0); bool reconstructed = false; do { // clear results of last attempt if needed if(ntry!=0) { currentTree()->clear(); setEvolutionPartners(hard,interaction_,true); _nis = _nfs = 0; // if MC@NLO H event and limited emissions // indicate both final and initial state emission if ( isMCatNLOHEvent && _limitEmissions != 0 ) { _nis = _nfs = 1; } for(unsigned int ix=0; ixprogenitor()->spinInfo(); if(spin && spin->decayVertex() && dynamic_ptr_cast(spin->decayVertex())) { spin->decayVertex(VertexPtr()); } } } // loop over particles for(unsigned int ix=0;ixprogenitor()->isFinalState()) { if(!isFSRadiationON()) continue; // perform shower progenitor()->hasEmitted(startTimeLikeShower(interaction_)); } // initial-state radiation else { if(!isISRadiationON()) continue; // hard process if(hard) { // get the PDF setBeamParticle(_progenitor->beam()); assert(beamParticle()); // perform the shower // set the beam particle tPPtr beamparticle=progenitor()->original(); if(!beamparticle->parents().empty()) beamparticle=beamparticle->parents()[0]; // generate the shower progenitor()->hasEmitted(startSpaceLikeShower(beamparticle, interaction_)); } // decay else { // skip colour and electrically neutral particles if(!progenitor()->progenitor()->dataPtr()->coloured() && !progenitor()->progenitor()->dataPtr()->charged()) { progenitor()->hasEmitted(false); continue; } // perform shower // set the scales correctly. The current scale is the maximum scale for // emission not the starting scale ShowerParticle::EvolutionScales maxScales(progenitor()->progenitor()->scales()); progenitor()->progenitor()->scales() = ShowerParticle::EvolutionScales(); if(progenitor()->progenitor()->dataPtr()->charged()) { progenitor()->progenitor()->scales().QED = progenitor()->progenitor()->mass(); progenitor()->progenitor()->scales().QED_noAO = progenitor()->progenitor()->mass(); } if(progenitor()->progenitor()->hasColour()) { progenitor()->progenitor()->scales().QCD_c = progenitor()->progenitor()->mass(); progenitor()->progenitor()->scales().QCD_c_noAO = progenitor()->progenitor()->mass(); } if(progenitor()->progenitor()->hasAntiColour()) { progenitor()->progenitor()->scales().QCD_ac = progenitor()->progenitor()->mass(); progenitor()->progenitor()->scales().QCD_ac_noAO = progenitor()->progenitor()->mass(); } progenitor()->progenitor()->scales().EW = progenitor()->progenitor()->mass(); progenitor()->progenitor()->scales().EW_noAO = progenitor()->progenitor()->mass(); // perform the shower progenitor()->hasEmitted(startSpaceLikeDecayShower(maxScales,minmass, interaction_)); } } } // do the kinematic reconstruction, checking if it worked reconstructed = hard ? showerModel()->kinematicsReconstructor()-> reconstructHardJets (currentTree(),intrinsicpT(),interaction_, switchRecon && ntry>maximumTries()/2) : showerModel()->kinematicsReconstructor()-> reconstructDecayJets(currentTree(),interaction_); } while(!reconstructed&&maximumTries()>++ntry); // check if failed to generate the shower if(ntry==maximumTries()) { if(hard) throw ShowerHandler::ShowerTriesVeto(ntry); else throw Exception() << "Failed to generate the shower after " << ntry << " attempts in Evolver::showerDecay()" << Exception::eventerror; } // tree has now showered _currenttree->hasShowered(true); hardTree(HardTreePtr()); } void Evolver:: convertHardTree(bool hard,ShowerInteraction::Type type) { map cmap; // incoming particles for(map::const_iterator cit=currentTree()->incomingLines().begin();cit!=currentTree()->incomingLines().end();++cit) { map::const_iterator mit = hardTree()->particles().find(cit->first->progenitor()); // put the colour lines in the map ShowerParticlePtr oldParticle = cit->first->progenitor(); ShowerParticlePtr newParticle = mit->second->branchingParticle(); ColinePtr cLine = oldParticle-> colourLine(); ColinePtr aLine = oldParticle->antiColourLine(); if(newParticle->colourLine() && cmap.find(newParticle-> colourLine())==cmap.end()) cmap[newParticle-> colourLine()] = cLine; if(newParticle->antiColourLine() && cmap.find(newParticle->antiColourLine())==cmap.end()) cmap[newParticle->antiColourLine()] = aLine; // check whether or not particle emits bool emission = mit->second->parent(); if(emission) { if(newParticle->colourLine()) { ColinePtr ctemp = newParticle-> colourLine(); ctemp->removeColoured(newParticle); } if(newParticle->antiColourLine()) { ColinePtr ctemp = newParticle->antiColourLine(); ctemp->removeAntiColoured(newParticle); } newParticle = mit->second->parent()->branchingParticle(); } // get the new colour lines ColinePtr newCLine,newALine; // sort out colour lines if(newParticle->colourLine()) { ColinePtr ctemp = newParticle-> colourLine(); ctemp->removeColoured(newParticle); if(cmap.find(ctemp)!=cmap.end()) { newCLine = cmap[ctemp]; } else { newCLine = new_ptr(ColourLine()); cmap[ctemp] = newCLine; } } // and anticolour lines if(newParticle->antiColourLine()) { ColinePtr ctemp = newParticle->antiColourLine(); ctemp->removeAntiColoured(newParticle); if(cmap.find(ctemp)!=cmap.end()) { newALine = cmap[ctemp]; } else { newALine = new_ptr(ColourLine()); cmap[ctemp] = newALine; } } // remove colour lines from old particle if(aLine) { aLine->removeAntiColoured(cit->first->copy()); aLine->removeAntiColoured(cit->first->progenitor()); } if(cLine) { cLine->removeColoured(cit->first->copy()); cLine->removeColoured(cit->first->progenitor()); } // add particle to colour lines if(newCLine) newCLine->addColoured (newParticle); if(newALine) newALine->addAntiColoured(newParticle); // insert new particles cit->first->copy(newParticle); ShowerParticlePtr sp(new_ptr(ShowerParticle(*newParticle,1,false))); cit->first->progenitor(sp); currentTree()->incomingLines()[cit->first]=sp; cit->first->perturbative(!emission); // and the emitted particle if needed if(emission) { ShowerParticlePtr newOut = mit->second->parent()->children()[1]->branchingParticle(); if(newOut->colourLine()) { ColinePtr ctemp = newOut-> colourLine(); ctemp->removeColoured(newOut); assert(cmap.find(ctemp)!=cmap.end()); cmap[ctemp]->addColoured (newOut); } if(newOut->antiColourLine()) { ColinePtr ctemp = newOut->antiColourLine(); ctemp->removeAntiColoured(newOut); assert(cmap.find(ctemp)!=cmap.end()); cmap[ctemp]->addAntiColoured(newOut); } ShowerParticlePtr sout=new_ptr(ShowerParticle(*newOut,1,true)); ShowerProgenitorPtr out=new_ptr(ShowerProgenitor(cit->first->original(),newOut,sout)); out->perturbative(false); currentTree()->outgoingLines().insert(make_pair(out,sout)); } if(hard) { // sort out the value of x if(mit->second->beam()->momentum().z()>ZERO) { sp->x(newParticle->momentum(). plus()/mit->second->beam()->momentum(). plus()); } else { sp->x(newParticle->momentum().minus()/mit->second->beam()->momentum().minus()); } } } // outgoing particles for(map::const_iterator cit=currentTree()->outgoingLines().begin();cit!=currentTree()->outgoingLines().end();++cit) { map >::const_iterator tit; for(tit = currentTree()->treelinks().begin(); tit != currentTree()->treelinks().end();++tit) { if(tit->second.first && tit->second.second==cit->first->progenitor()) break; } map::const_iterator mit = hardTree()->particles().find(cit->first->progenitor()); if(mit==hardTree()->particles().end()) continue; // put the colour lines in the map ShowerParticlePtr oldParticle = cit->first->progenitor(); ShowerParticlePtr newParticle = mit->second->branchingParticle(); ShowerParticlePtr newOut; ColinePtr cLine = oldParticle-> colourLine(); ColinePtr aLine = oldParticle->antiColourLine(); if(newParticle->colourLine() && cmap.find(newParticle-> colourLine())==cmap.end()) cmap[newParticle-> colourLine()] = cLine; if(newParticle->antiColourLine() && cmap.find(newParticle->antiColourLine())==cmap.end()) cmap[newParticle->antiColourLine()] = aLine; // check whether or not particle emits bool emission = !mit->second->children().empty(); if(emission) { if(newParticle->colourLine()) { ColinePtr ctemp = newParticle-> colourLine(); ctemp->removeColoured(newParticle); } if(newParticle->antiColourLine()) { ColinePtr ctemp = newParticle->antiColourLine(); ctemp->removeAntiColoured(newParticle); } newParticle = mit->second->children()[0]->branchingParticle(); newOut = mit->second->children()[1]->branchingParticle(); if(newParticle->id()!=oldParticle->id()&&newParticle->id()==newOut->id()) swap(newParticle,newOut); } // get the new colour lines ColinePtr newCLine,newALine; // sort out colour lines if(newParticle->colourLine()) { ColinePtr ctemp = newParticle-> colourLine(); ctemp->removeColoured(newParticle); if(cmap.find(ctemp)!=cmap.end()) { newCLine = cmap[ctemp]; } else { newCLine = new_ptr(ColourLine()); cmap[ctemp] = newCLine; } } // and anticolour lines if(newParticle->antiColourLine()) { ColinePtr ctemp = newParticle->antiColourLine(); ctemp->removeAntiColoured(newParticle); if(cmap.find(ctemp)!=cmap.end()) { newALine = cmap[ctemp]; } else { newALine = new_ptr(ColourLine()); cmap[ctemp] = newALine; } } // remove colour lines from old particle if(aLine) { aLine->removeAntiColoured(cit->first->copy()); aLine->removeAntiColoured(cit->first->progenitor()); } if(cLine) { cLine->removeColoured(cit->first->copy()); cLine->removeColoured(cit->first->progenitor()); } // special for unstable particles if(newParticle->id()==oldParticle->id() && (tit!=currentTree()->treelinks().end()||!oldParticle->dataPtr()->stable())) { Lorentz5Momentum oldMomentum = oldParticle->momentum(); Lorentz5Momentum newMomentum = newParticle->momentum(); LorentzRotation boost( oldMomentum.findBoostToCM(),oldMomentum.e()/oldMomentum.mass()); if(tit!=currentTree()->treelinks().end()) tit->first->transform(boost,false); oldParticle->transform(boost); boost = LorentzRotation(-newMomentum.findBoostToCM(),newMomentum.e()/newMomentum.mass()); oldParticle->transform(boost); if(tit!=currentTree()->treelinks().end()) tit->first->transform(boost,false); newParticle=oldParticle; } // add particle to colour lines if(newCLine) newCLine->addColoured (newParticle); if(newALine) newALine->addAntiColoured(newParticle); // insert new particles cit->first->copy(newParticle); ShowerParticlePtr sp(new_ptr(ShowerParticle(*newParticle,1,true))); cit->first->progenitor(sp); currentTree()->outgoingLines()[cit->first]=sp; cit->first->perturbative(!emission); // and the emitted particle if needed if(emission) { if(newOut->colourLine()) { ColinePtr ctemp = newOut-> colourLine(); ctemp->removeColoured(newOut); assert(cmap.find(ctemp)!=cmap.end()); cmap[ctemp]->addColoured (newOut); } if(newOut->antiColourLine()) { ColinePtr ctemp = newOut->antiColourLine(); ctemp->removeAntiColoured(newOut); assert(cmap.find(ctemp)!=cmap.end()); cmap[ctemp]->addAntiColoured(newOut); } ShowerParticlePtr sout=new_ptr(ShowerParticle(*newOut,1,true)); ShowerProgenitorPtr out=new_ptr(ShowerProgenitor(cit->first->original(),newOut,sout)); out->perturbative(false); currentTree()->outgoingLines().insert(make_pair(out,sout)); } // update any decay products if(tit!=currentTree()->treelinks().end()) currentTree()->updateLink(tit->first,make_pair(cit->first,sp)); } // reset the tree currentTree()->resetShowerProducts(); // reextract the particles and set the colour partners vector particles = currentTree()->extractProgenitorParticles(); // clear the partners for(unsigned int ix=0;ixpartner(ShowerParticlePtr()); particles[ix]->clearPartners(); } // clear the tree hardTree(HardTreePtr()); // Set the initial evolution scales showerModel()->partnerFinder()-> setInitialEvolutionScales(particles,!hard,type,!_hardtree); } Branching Evolver::selectTimeLikeBranching(tShowerParticlePtr particle, ShowerInteraction::Type type, HardBranchingPtr branch) { Branching fb; unsigned int iout=0; - tcPDPtr pdata[2]; while (true) { // break if doing truncated shower and no truncated shower needed if(branch && (!isTruncatedShowerON()||hardOnly())) break; fb=_splittingGenerator->chooseForwardBranching(*particle,_finalenhance,type); // no emission break if(!fb.kinematics) break; // special for truncated shower if(branch) { // check haven't evolved too far if(fb.kinematics->scale() < branch->scale()) { fb=Branching(); break; } - // get the particle data objects - for(unsigned int ix=0;ix<2;++ix) pdata[ix]=getParticleData(fb.ids[ix+1]); - if(particle->id()!=fb.ids[0]) { - for(unsigned int ix=0;ix<2;++ix) { - tPDPtr cc(pdata[ix]->CC()); - if(cc) pdata[ix]=cc; - } - } // find the truncated line iout=0; - if(pdata[0]->id()!=pdata[1]->id()) { - if(pdata[0]->id()==particle->id()) iout=1; - else if (pdata[1]->id()==particle->id()) iout=2; + if(fb.ids[1]->id()!=fb.ids[2]->id()) { + if(fb.ids[1]->id()==particle->id()) iout=1; + else if (fb.ids[2]->id()==particle->id()) iout=2; } - else if(pdata[0]->id()==particle->id()) { + else if(fb.ids[1]->id()==particle->id()) { if(fb.kinematics->z()>0.5) iout=1; else iout=2; } // apply the vetos for the truncated shower // no flavour changing branchings if(iout==0) { particle->vetoEmission(fb.type,fb.kinematics->scale()); continue; } double zsplit = iout==1 ? fb.kinematics->z() : 1-fb.kinematics->z(); // only if same interaction for forced branching ShowerInteraction::Type type2 = convertInteraction(fb.type); // and evolution if(type2==branch->sudakov()->interactionType()) { if(zsplit < 0.5 || // hardest line veto fb.kinematics->scale()*zsplit < branch->scale() ) { // angular ordering veto particle->vetoEmission(fb.type,fb.kinematics->scale()); continue; } } // pt veto if(fb.kinematics->pT() > progenitor()->maximumpT(type2)) { particle->vetoEmission(fb.type,fb.kinematics->scale()); continue; } } // standard vetos for all emissions if(timeLikeVetoed(fb,particle)) { particle->vetoEmission(fb.type,fb.kinematics->scale()); if(particle->spinInfo()) particle->spinInfo()->decayVertex(VertexPtr()); continue; } break; } // normal case if(!branch) { if(fb.kinematics) fb.hard = false; return fb; } // truncated emission if(fb.kinematics) { fb.hard = false; fb.iout = iout; return fb; } // otherwise need to return the hard emission // construct the kinematics for the hard emission ShoKinPtr showerKin= branch->sudakov()->createFinalStateBranching(branch->scale(), branch->children()[0]->z(), branch->phi(), branch->children()[0]->pT()); IdList idlist(3); - idlist[0] = particle->id(); - idlist[1] = branch->children()[0]->branchingParticle()->id(); - idlist[2] = branch->children()[1]->branchingParticle()->id(); + idlist[0] = particle->dataPtr(); + idlist[1] = branch->children()[0]->branchingParticle()->dataPtr(); + idlist[2] = branch->children()[1]->branchingParticle()->dataPtr(); fb = Branching( showerKin, idlist, branch->sudakov(),branch->type() ); fb.hard = true; fb.iout=0; // return it return fb; } Branching Evolver::selectSpaceLikeDecayBranching(tShowerParticlePtr particle, const ShowerParticle::EvolutionScales & maxScales, Energy minmass,ShowerInteraction::Type type, HardBranchingPtr branch) { Branching fb; unsigned int iout=0; - tcPDPtr pdata[2]; while (true) { // break if doing truncated shower and no truncated shower needed if(branch && (!isTruncatedShowerON()||hardOnly())) break; // select branching fb=_splittingGenerator->chooseDecayBranching(*particle,maxScales,minmass, _initialenhance,type); // return if no radiation if(!fb.kinematics) break; // special for truncated shower if(branch) { // check haven't evolved too far if(fb.kinematics->scale() < branch->scale()) { fb=Branching(); break; } - // get the particle data objects - for(unsigned int ix=0;ix<2;++ix) pdata[ix]=getParticleData(fb.ids[ix+1]); - if(particle->id()!=fb.ids[0]) { - for(unsigned int ix=0;ix<2;++ix) { - tPDPtr cc(pdata[ix]->CC()); - if(cc) pdata[ix]=cc; - } - } // find the truncated line iout=0; - if(pdata[0]->id()!=pdata[1]->id()) { - if(pdata[0]->id()==particle->id()) iout=1; - else if (pdata[1]->id()==particle->id()) iout=2; + if(fb.ids[1]->id()!=fb.ids[2]->id()) { + if(fb.ids[1]->id()==particle->id()) iout=1; + else if (fb.ids[2]->id()==particle->id()) iout=2; } - else if(pdata[0]->id()==particle->id()) { + else if(fb.ids[1]->id()==particle->id()) { if(fb.kinematics->z()>0.5) iout=1; else iout=2; } // apply the vetos for the truncated shower // no flavour changing branchings if(iout==0) { particle->vetoEmission(fb.type,fb.kinematics->scale()); continue; } ShowerInteraction::Type type2 = convertInteraction(fb.type); double zsplit = iout==1 ? fb.kinematics->z() : 1-fb.kinematics->z(); if(type2==branch->sudakov()->interactionType()) { if(zsplit < 0.5 || // hardest line veto fb.kinematics->scale()*zsplit < branch->scale() ) { // angular ordering veto particle->vetoEmission(fb.type,fb.kinematics->scale()); continue; } } // pt veto if(fb.kinematics->pT() > progenitor()->maximumpT(type2)) { particle->vetoEmission(fb.type,fb.kinematics->scale()); continue; } } // if not vetoed break if(spaceLikeDecayVetoed(fb,particle)) { // otherwise reset scale and continue particle->vetoEmission(fb.type,fb.kinematics->scale()); continue; } break; } // normal case if(!branch) { if(fb.kinematics) fb.hard = false; return fb; } // truncated emission if(fb.kinematics) { fb.hard = false; fb.iout = iout; return fb; } // otherwise need to return the hard emission // construct the kinematics for the hard emission ShoKinPtr showerKin= branch->sudakov()->createDecayBranching(branch->scale(), branch->children()[0]->z(), branch->phi(), branch->children()[0]->pT()); IdList idlist(3); - idlist[0] = particle->id(); - idlist[1] = branch->children()[0]->branchingParticle()->id(); - idlist[2] = branch->children()[1]->branchingParticle()->id(); + idlist[0] = particle->dataPtr(); + idlist[1] = branch->children()[0]->branchingParticle()->dataPtr(); + idlist[2] = branch->children()[1]->branchingParticle()->dataPtr(); // create the branching fb = Branching( showerKin, idlist, branch->sudakov(),ShowerPartnerType::QCDColourLine ); fb.hard=true; fb.iout=0; // return it return fb; } diff --git a/Shower/Base/HardBranching.cc b/Shower/Base/HardBranching.cc --- a/Shower/Base/HardBranching.cc +++ b/Shower/Base/HardBranching.cc @@ -1,107 +1,107 @@ // -*- C++ -*- // // This is the implementation of the non-inlined, non-templated member // functions of the HardTree class. // #include "HardBranching.h" #include "ThePEG/PDT/EnumParticles.h" #include "ThePEG/Repository/CurrentGenerator.h" using namespace Herwig; void HardBranching::setMomenta(LorentzRotation R,double aparent, Lorentz5Momentum ptparent, bool setMomentum) { if(setMomentum) _original=R*_particle->momentum(); // compute the shower variables Energy2 dot = _n*_p; if(dot==ZERO) return; double alpha = (_original*_n)/dot; //set x for incoming partons if( status() == HardBranching::Incoming ) x_frac( alpha ); _z=alpha/aparent; double beta = ((_original*_p)-alpha*sqr(_p.mass()))/dot; _qt = _original - alpha*_p - beta*_n - _z*ptparent; _pt=sqrt(max(-_qt*_qt,ZERO)); // reconstruct children for(unsigned int ix=0;ix<_children.size();++ix) { _children[ix]->_p=_p; _children[ix]->_n=_n; _children[ix]->setMomenta( R, alpha, _qt + _z*ptparent, setMomentum); } // calculate the evolution scale and phi if(!_children.empty()) { IdList ids(3); - ids[0]=_particle->id(); - ids[1]=_children[0]->_particle->id(); - ids[2]=_children[1]->_particle->id(); + ids[0]=_particle->dataPtr(); + ids[1]=_children[0]->_particle->dataPtr(); + ids[2]=_children[1]->_particle->dataPtr(); double z; Energy pt; Lorentz5Momentum vect; if( _status==Outgoing || ( (_status==Incoming || _status==Decay ) && _children[1]->_status == Outgoing ) ) { z = _children[0]->_z ; pt = _children[0]->_pt; vect=_children[0]->_qt; } else { z = _children[1]->_z ; pt = _children[1]->_pt; swap(ids[1],ids[2]); vect=_children[1]->_qt; } _scale=_sudakov->calculateScale(z,pt,ids,_status); // get the pt vector if(_status!=Decay) { Boost beta_bb = -(_p+ _n).boostVector(); Lorentz5Momentum p_bb = _p; vect.boost(beta_bb); p_bb.boost( beta_bb ); Axis axis(p_bb.vect().unit()); LorentzRotation rot; if(axis.perp2()>0.) { double sinth(sqrt(sqr(axis.x())+sqr(axis.y()))); rot.setRotate(-acos(axis.z()), Axis(-axis.y()/sinth,axis.x()/sinth,0.)); vect.transform(rot); } else if(axis.z()<0.) { vect.setZ( vect.z()); vect.setY(-vect.y()); } _phi= atan2(vect.y(),vect.x()); if(_phi<0.) _phi+=Constants::twopi; } else { const Boost beta_bb = -pVector().boostVector(); Lorentz5Momentum p_bb = pVector(); Lorentz5Momentum n_bb = nVector(); p_bb.boost( beta_bb ); n_bb.boost( beta_bb ); vect.boost( beta_bb); Axis axis(n_bb.vect().unit()); LorentzRotation rot; if(axis.perp2()>0.) { double sinth(sqrt(sqr(axis.x())+sqr(axis.y()))); rot.setRotate(-acos(axis.z()), Axis(-axis.y()/sinth,axis.x()/sinth,0.)); vect.transform(rot); } else if(axis.z()<0.) { vect.setZ(vect.z()); } _phi= atan2(vect.y(),vect.x()); if(_phi<0) _phi+=Constants::twopi; } } } HardBranching::HardBranching(ShowerParticlePtr particle, SudakovPtr sudakov, tHardBranchingPtr parent,Status status) : _particle(particle), _original(), _p(particle->momentum()), _n(), _qt(), _shower(particle->momentum()), _pt(ZERO), _x_frac(0.), _status(status), _scale(ZERO), _z(0.),_phi(0.), _parent(parent), _sudakov(sudakov), type_(ShowerPartnerType::Undefined) {} diff --git a/Shower/Base/SudakovFormFactor.cc b/Shower/Base/SudakovFormFactor.cc --- a/Shower/Base/SudakovFormFactor.cc +++ b/Shower/Base/SudakovFormFactor.cc @@ -1,326 +1,326 @@ // -*- C++ -*- // // SudakovFormFactor.cc is a part of Herwig - A multi-purpose Monte Carlo event generator // Copyright (C) 2002-2011 The Herwig Collaboration // // Herwig is licenced under version 2 of the GPL, see COPYING for details. // Please respect the MCnet academic guidelines, see GUIDELINES for details. // // // This is the implementation of the non-inlined, non-templated member // functions of the SudakovFormFactor class. // #include "SudakovFormFactor.h" #include "ThePEG/Interface/ClassDocumentation.h" #include "ThePEG/Persistency/PersistentOStream.h" #include "ThePEG/Persistency/PersistentIStream.h" #include "ThePEG/Interface/Reference.h" #include "ThePEG/Interface/Switch.h" #include "ThePEG/Interface/Parameter.h" #include "ShowerKinematics.h" #include "ShowerParticle.h" #include "ThePEG/Utilities/DescribeClass.h" #include "Herwig/Shower/ShowerHandler.h" using namespace Herwig; DescribeAbstractClass describeSudakovFormFactor ("Herwig::SudakovFormFactor",""); void SudakovFormFactor::persistentOutput(PersistentOStream & os) const { os << splittingFn_ << alpha_ << pdfmax_ << particles_ << pdffactor_ << a_ << b_ << ounit(c_,GeV) << ounit(kinCutoffScale_,GeV) << cutOffOption_ << ounit(vgcut_,GeV) << ounit(vqcut_,GeV) << ounit(pTmin_,GeV) << ounit(pT2min_,GeV2) << theFactorizationScaleFactor << theRenormalizationScaleFactor; } void SudakovFormFactor::persistentInput(PersistentIStream & is, int) { is >> splittingFn_ >> alpha_ >> pdfmax_ >> particles_ >> pdffactor_ >> a_ >> b_ >> iunit(c_,GeV) >> iunit(kinCutoffScale_,GeV) >> cutOffOption_ >> iunit(vgcut_,GeV) >> iunit(vqcut_,GeV) >> iunit(pTmin_,GeV) >> iunit(pT2min_,GeV2) >> theFactorizationScaleFactor >> theRenormalizationScaleFactor; } void SudakovFormFactor::Init() { static ClassDocumentation documentation ("The SudakovFormFactor class is the base class for the implementation of Sudakov" " form factors in Herwig"); static Reference interfaceSplittingFunction("SplittingFunction", "A reference to the SplittingFunction object", &Herwig::SudakovFormFactor::splittingFn_, false, false, true, false); static Reference interfaceAlpha("Alpha", "A reference to the Alpha object", &Herwig::SudakovFormFactor::alpha_, false, false, true, false); static Parameter interfacePDFmax ("PDFmax", "Maximum value of PDF weight. ", &SudakovFormFactor::pdfmax_, 35.0, 1.0, 100000.0, false, false, Interface::limited); static Switch interfacePDFFactor ("PDFFactor", "Include additional factors in the overestimate for the PDFs", &SudakovFormFactor::pdffactor_, 0, false, false); static SwitchOption interfacePDFFactorOff (interfacePDFFactor, "Off", "Don't include any factors", 0); static SwitchOption interfacePDFFactorOverZ (interfacePDFFactor, "OverZ", "Include an additional factor of 1/z", 1); static SwitchOption interfacePDFFactorOverOneMinusZ (interfacePDFFactor, "OverOneMinusZ", "Include an additional factor of 1/(1-z)", 2); static SwitchOption interfacePDFFactorOverZOneMinusZ (interfacePDFFactor, "OverZOneMinusZ", "Include an additional factor of 1/z/(1-z)", 3); static Switch interfaceCutOffOption ("CutOffOption", "The type of cut-off to use to end the shower", &SudakovFormFactor::cutOffOption_, 0, false, false); static SwitchOption interfaceCutOffOptionDefault (interfaceCutOffOption, "Default", "Use the standard Herwig cut-off on virtualities with the minimum" " virtuality depending on the mass of the branching particle", 0); static SwitchOption interfaceCutOffOptionFORTRAN (interfaceCutOffOption, "FORTRAN", "Use a FORTRAN-like cut-off on virtualities", 1); static SwitchOption interfaceCutOffOptionpT (interfaceCutOffOption, "pT", "Use a cut on the minimum allowed pT", 2); static Parameter interfaceaParameter ("aParameter", "The a parameter for the kinematic cut-off", &SudakovFormFactor::a_, 0.3, -10.0, 10.0, false, false, Interface::limited); static Parameter interfacebParameter ("bParameter", "The b parameter for the kinematic cut-off", &SudakovFormFactor::b_, 2.3, -10.0, 10.0, false, false, Interface::limited); static Parameter interfacecParameter ("cParameter", "The c parameter for the kinematic cut-off", &SudakovFormFactor::c_, GeV, 0.3*GeV, 0.1*GeV, 10.0*GeV, false, false, Interface::limited); static Parameter interfaceKinScale ("cutoffKinScale", "kinematic cutoff scale for the parton shower phase" " space (unit [GeV])", &SudakovFormFactor::kinCutoffScale_, GeV, 2.3*GeV, 0.001*GeV, 10.0*GeV,false,false,false); static Parameter interfaceGluonVirtualityCut ("GluonVirtualityCut", "For the FORTRAN cut-off option the minimum virtuality of the gluon", &SudakovFormFactor::vgcut_, GeV, 0.85*GeV, 0.1*GeV, 10.0*GeV, false, false, Interface::limited); static Parameter interfaceQuarkVirtualityCut ("QuarkVirtualityCut", "For the FORTRAN cut-off option the minimum virtuality added to" " the mass for particles other than the gluon", &SudakovFormFactor::vqcut_, GeV, 0.85*GeV, 0.1*GeV, 10.0*GeV, false, false, Interface::limited); static Parameter interfacepTmin ("pTmin", "The minimum pT if using a cut-off on the pT", &SudakovFormFactor::pTmin_, GeV, 1.0*GeV, ZERO, 10.0*GeV, false, false, Interface::limited); } bool SudakovFormFactor::alphaSVeto(Energy2 pt2) const { pt2 *= sqr(renormalizationScaleFactor()); return UseRandom::rnd() > ThePEG::Math::powi(alpha_->ratio(pt2), splittingFn_->interactionOrder()); } bool SudakovFormFactor:: PDFVeto(const Energy2 t, const double x, const tcPDPtr parton0, const tcPDPtr parton1, Ptr::transient_const_pointer beam) const { assert(pdf_); Energy2 theScale = t * sqr(factorizationScaleFactor()); if (theScale < sqr(freeze_)) theScale = sqr(freeze_); double newpdf(0.0), oldpdf(0.0); //different treatment of MPI ISR is done via CascadeHandler::resetPDFs() newpdf=pdf_->xfx(beam,parton0,theScale,x/z()); oldpdf=pdf_->xfx(beam,parton1,theScale,x); if(newpdf<=0.) return true; if(oldpdf<=0.) return false; double ratio = newpdf/oldpdf; double maxpdf(pdfmax_); switch (pdffactor_) { case 1: maxpdf /= z(); break; case 2: maxpdf /= 1.-z(); break; case 3: maxpdf /= (z()*(1.-z())); break; } // ratio / PDFMax must be a probability <= 1.0 if (ratio > maxpdf) { generator()->log() << "PDFVeto warning: Ratio > " << name() << ":PDFmax (by a factor of " << ratio/maxpdf <<") for " << parton0->PDGName() << " to " << parton1->PDGName() << "\n"; } return ratio < UseRandom::rnd()*maxpdf; } void SudakovFormFactor::addSplitting(const IdList & in) { bool add=true; for(unsigned int ix=0;ix::iterator it=particles_.begin(); it!=particles_.end();++it) { if(it->size()==in.size()) { bool match=true; for(unsigned int iy=0;iy::iterator itemp=it; --itemp; particles_.erase(it); it = itemp; } } } } Energy2 SudakovFormFactor::guesst(Energy2 t1,unsigned int iopt, const IdList &ids, double enhance,bool ident) const { unsigned int pdfopt = iopt!=1 ? 0 : pdffactor_; double c = 1./((splittingFn_->integOverP(zlimits_.second,ids,pdfopt) - splittingFn_->integOverP(zlimits_.first ,ids,pdfopt))* alpha_->overestimateValue()/Constants::twopi*enhance); assert(iopt<=2); if(iopt==1) { c/=pdfmax_; //symmetry of FS gluon splitting if(ident) c*=0.5; } else if(iopt==2) c*=-1.; if(splittingFn_->interactionOrder()==1) { double r = UseRandom::rnd(); if(iopt!=2 || c*log(r)interactionOrder()-1); c/=Math::powi(alpha_->overestimateValue()/Constants::twopi,nm); return t1 / pow (1. - nm*c*log(UseRandom::rnd()) * Math::powi(t1*UnitRemoval::InvE2,nm) ,1./double(nm)); } } double SudakovFormFactor::guessz (unsigned int iopt, const IdList &ids) const { unsigned int pdfopt = iopt!=1 ? 0 : pdffactor_; double lower = splittingFn_->integOverP(zlimits_.first,ids,pdfopt); return splittingFn_->invIntegOverP (lower + UseRandom::rnd()*(splittingFn_->integOverP(zlimits_.second,ids,pdfopt) - lower),ids,pdfopt); } void SudakovFormFactor::doinit() { Interfaced::doinit(); pT2min_ = cutOffOption()==2 ? sqr(pTmin_) : ZERO; } const vector & SudakovFormFactor::virtualMasses(const IdList & ids) { static vector output; output.clear(); if(cutOffOption() == 0) { for(unsigned int ix=0;ixmass()); + output.push_back(ids[ix]->mass()); Energy kinCutoff= kinematicCutOff(kinScale(),*std::max_element(output.begin(),output.end())); for(unsigned int ix=0;ixmass()); - output.back() += ids[ix]==ParticleID::g ? vgCut() : vqCut(); + output.push_back(ids[ix]->mass()); + output.back() += ids[ix]->id()==ParticleID::g ? vgCut() : vqCut(); } } else if(cutOffOption() == 2) { for(unsigned int ix=0;ixmass()); + output.push_back(ids[ix]->mass()); } else { throw Exception() << "Unknown option for the cut-off" << " in SudakovFormFactor::virtualMasses()" << Exception::runerror; } return output; } diff --git a/Shower/Base/SudakovFormFactor.h b/Shower/Base/SudakovFormFactor.h --- a/Shower/Base/SudakovFormFactor.h +++ b/Shower/Base/SudakovFormFactor.h @@ -1,698 +1,693 @@ // -*- C++ -*- // // SudakovFormFactor.h is a part of Herwig - A multi-purpose Monte Carlo event generator // Copyright (C) 2002-2011 The Herwig Collaboration // // Herwig is licenced under version 2 of the GPL, see COPYING for details. // Please respect the MCnet academic guidelines, see GUIDELINES for details. // #ifndef HERWIG_SudakovFormFactor_H #define HERWIG_SudakovFormFactor_H // // This is the declaration of the SudakovFormFactor class. // #include "ThePEG/Interface/Interfaced.h" #include "Herwig/Shower/SplittingFunctions/SplittingFunction.h" #include "Herwig/Shower/Couplings/ShowerAlpha.h" #include "Herwig/Shower/SplittingFunctions/SplittingGenerator.fh" #include "ThePEG/Repository/UseRandom.h" #include "ThePEG/PDF/BeamParticleData.h" #include "ThePEG/EventRecord/RhoDMatrix.h" #include "ThePEG/EventRecord/SpinInfo.h" #include "ShowerKinematics.fh" #include "SudakovFormFactor.fh" namespace Herwig { using namespace ThePEG; /** * A typedef for the BeamParticleData */ typedef Ptr::transient_const_pointer tcBeamPtr; /** \ingroup Shower * * This is the definition of the Sudakov form factor class. In general this * is the base class for the implementation of Sudakov form factors in Herwig. * The methods generateNextTimeBranching(), generateNextDecayBranching() and * generateNextSpaceBranching need to be implemented in classes inheriting from this * one. * * In addition a number of methods are implemented to assist with the calculation * of the form factor using the veto algorithm in classes inheriting from this one. * * In general the Sudakov form-factor, for final-state radiation, is given * by * \f[\Delta_{ba}(\tilde{q}_{i+1},\tilde{q}_i)= * \exp\left\{ * -\int^{\tilde{q}^2_i}_{\tilde{q}^2_{i+1}} * \frac{{\rm d}\tilde{q}^2}{\tilde{q}^2} * \int\frac{\alpha_S(z,\tilde{q})}{2\pi} * P_{ba}(z,\tilde{q})\Theta(p_T) * \right\}. * \f] * We can solve this to obtain the next value of the scale \f$\tilde{q}_{i+1}\f$ * given the previous value \f$\tilde{q}_i\f$ * in the following way. First we obtain a simplified form of the integrand * which is greater than or equal to the true integrand for all values of * \f$\tilde{q}\f$. * * In practice it is easiest to obtain this over estimate in pieces. The ShowerAlpha * object contains an over estimate for \f$\alpha_S\f$, the splitting function * contains both an over estimate of the spltting function and its integral * which is needed to compute the over estimate of the \f$\tilde{q}\f$ integrand, * together with an over estimate of the limit of the \f$z\f$ integral. * * This gives an overestimate of the integrand * \f[g(\tilde{q}^2) = \frac{c}{\tilde{q}^2}, \f] * where because the over estimates are chosen to be independent of \f$\tilde{q}\f$ the * parameter * \f[c = \frac{\alpha_{\rm over}}{2\pi}\int^{z_1}_{z_0}P_{\rm over}(z),\f] * is a constant independent of \f$\tilde{q}\f$. * * The guesst() member can then be used to generate generate the value of * \f$\tilde{q}^2\f$ according to this result. This is done by solving the Sudakov * form factor, with the over estimates, is equal to a random number * \f$r\f$ in the interval \f$[0,1]\f$. This gives * \f[\tilde{q}^2_{i+1}=G^{-1}\left[G(\tilde{q}^2_i)+\ln r\right],\f] * where \f$G(\tilde{q}^2)=c\ln(\tilde{q}^2)\f$ is the infinite integral * of \f$g(\tilde{q}^2)\f$ and \f$G^{-1}(x)=\exp\left(\frac{x}c\right)\f$ * is its inverse. * It this case we therefore obtain * \f[\tilde{q}^2_{i+1}=\tilde{q}^2_ir^{\frac1c}.\f] * The value of \f$z\f$ can then be calculated in a similar way * \f[z = I^{-1}\left[I(z_0)+r\left(I(z_1)-I(z_0)\right)\right],\f] * using the guessz() member, * where \f$I=\int P(z){\rm d}z\f$ and \f$I^{-1}\f$ is its inverse. * * The veto algorithm then uses rejection using the ratio of the * true value to the overestimated one to obtain the original distribution. * This is accomplished using the * - alphaSVeto() member for the \f$\alpha_S\f$ veto * - SplittingFnVeto() member for the veto on the value of the splitting function. * in general there must also be a chech that the emission is in the allowed * phase space but this is left to the inheriting classes as it will depend * on the ordering variable. * * The Sudakov form factor for the initial-scale shower is different because * it must include the PDF which guides the backward evolution. * It is given by * \f[\Delta_{ba}(\tilde{q}_{i+1},\tilde{q}_i)= * \exp\left\{ * -\int^{\tilde{q}^2_i}_{\tilde{q}^2_{i+1}} * \frac{{\rm d}\tilde{q}^2}{\tilde{q}^2} * \int\frac{\alpha_S(z,\tilde{q})}{2\pi} * P_{ba}(z,\tilde{q})\frac{x'f_a(\frac{x}z,\tilde{q}^2)}{xf_b(x,\tilde{q^2})} * \right\}, * \f] * where \f$x\f$ is the fraction of the beam momentum the parton \f$b\f$ had before * the backward evolution. * This can be solve in the same way as for the final-state branching but the constant * becomes * \f[c = \frac{\alpha_{\rm over}}{2\pi}\int^{z_1}_{z_0}P_{\rm over}(z)PDF_{\rm max},\f] * where * \f[PDF_{\rm max}=\max\frac{x'f_a(\frac{x}z,\tilde{q}^2)}{xf_b(x,\tilde{q^2})},\f] * which can be set using an interface. * In addition the PDFVeto() member then is needed to implement the relevant veto. * * @see SplittingGenerator * @see SplittingFunction * @see ShowerAlpha * @see \ref SudakovFormFactorInterfaces "The interfaces" * defined for SudakovFormFactor. */ class SudakovFormFactor: public Interfaced { /** * The SplittingGenerator is a friend to insert the particles in the * branchings at initialisation */ friend class SplittingGenerator; public: /** * The default constructor. */ SudakovFormFactor() : pdfmax_(35.0), pdffactor_(0), cutOffOption_(0), a_(0.3), b_(2.3), c_(0.3*GeV), kinCutoffScale_( 2.3*GeV ), vgcut_(0.85*GeV), vqcut_(0.85*GeV), pTmin_(1.*GeV), pT2min_(ZERO), z_( 0.0 ),phi_(0.0), pT_(), theFactorizationScaleFactor(1.0), theRenormalizationScaleFactor(1.0) {} /** * Members to generate the scale of the next branching */ //@{ /** * Return the scale of the next time-like branching. If there is no * branching then it returns ZERO. * @param startingScale starting scale for the evolution * @param ids The PDG codes of the particles in the splitting - * @param cc Whether this is the charge conjugate of the branching * @param enhance The radiation enhancement factor * @param maxQ2 The maximum \f$Q^2\f$ for the emission */ virtual ShoKinPtr generateNextTimeBranching(const Energy startingScale, - const IdList &ids,const bool cc, + const IdList &ids, const RhoDMatrix & rho, double enhance, Energy2 maxQ2)=0; /** * Return the scale of the next space-like decay branching. If there is no * branching then it returns ZERO. * @param startingScale starting scale for the evolution * @param stoppingScale stopping scale for the evolution * @param minmass The minimum mass allowed for the spake-like particle. * @param ids The PDG codes of the particles in the splitting - * @param cc Whether this is the charge conjugate of the branching * defined. * @param enhance The radiation enhancement factor */ virtual ShoKinPtr generateNextDecayBranching(const Energy startingScale, const Energy stoppingScale, const Energy minmass, const IdList &ids, - const bool cc, const RhoDMatrix & rho, double enhance)=0; /** * Return the scale of the next space-like branching. If there is no * branching then it returns ZERO. * @param startingScale starting scale for the evolution * @param ids The PDG codes of the particles in the splitting * @param x The fraction of the beam momentum - * @param cc Whether this is the charge conjugate of the branching * defined. * @param beam The beam particle * @param enhance The radiation enhancement factor */ virtual ShoKinPtr generateNextSpaceBranching(const Energy startingScale, const IdList &ids,double x, - const bool cc, const RhoDMatrix & rho, double enhance, tcBeamPtr beam)=0; //@} /** * Generate the azimuthal angle of the branching for forward evolution * @param particle The branching particle * @param ids The PDG codes of the particles in the branchings * @param The Shower kinematics */ virtual double generatePhiForward(ShowerParticle & particle,const IdList & ids, ShoKinPtr kinematics, const RhoDMatrix & rho)=0; /** * Generate the azimuthal angle of the branching for backward evolution * @param particle The branching particle * @param ids The PDG codes of the particles in the branchings * @param The Shower kinematics */ virtual double generatePhiBackward(ShowerParticle & particle,const IdList & ids, ShoKinPtr kinematics, const RhoDMatrix & rho)=0; /** * Generate the azimuthal angle of the branching for ISR in decays * @param particle The branching particle * @param ids The PDG codes of the particles in the branchings * @param The Shower kinematics */ virtual double generatePhiDecay(ShowerParticle & particle,const IdList & ids, ShoKinPtr kinematics, const RhoDMatrix & rho)=0; /** * Methods to provide public access to the private member variables */ //@{ /** * Return the pointer to the SplittingFunction object. */ tSplittingFnPtr splittingFn() const { return splittingFn_; } /** * Return the pointer to the ShowerAlpha object. */ tShowerAlphaPtr alpha() const { return alpha_; } /** * The type of interaction */ inline ShowerInteraction::Type interactionType() const {return splittingFn_->interactionType();} //@} public: /** * Methods to access the kinematic variables for the branching */ //@{ /** * The energy fraction */ double z() const { return z_; } /** * The azimuthal angle */ double phi() const { return phi_; } /** * The transverse momentum */ Energy pT() const { return pT_; } //@} /** * Access the maximum weight for the PDF veto */ double pdfMax() const { return pdfmax_;} /** * Method to return the evolution scale given the * transverse momentum, \f$p_T\f$ and \f$z\f$. */ virtual Energy calculateScale(double z, Energy pt, IdList ids,unsigned int iopt)=0; /** * Method to create the ShowerKinematics object for a final-state branching */ virtual ShoKinPtr createFinalStateBranching(Energy scale,double z, double phi, Energy pt)=0; /** * Method to create the ShowerKinematics object for an initial-state branching */ virtual ShoKinPtr createInitialStateBranching(Energy scale,double z, double phi, Energy pt)=0; /** * Method to create the ShowerKinematics object for a decay branching */ virtual ShoKinPtr createDecayBranching(Energy scale,double z, double phi, Energy pt)=0; public: /** @name Functions used by the persistent I/O system. */ //@{ /** * Function used to write out object persistently. * @param os the persistent output stream written to. */ void persistentOutput(PersistentOStream & os) const; /** * Function used to read in object persistently. * @param is the persistent input stream read from. * @param version the version number of the object when written. */ void persistentInput(PersistentIStream & is, int version); //@} /** * The standard Init function used to initialize the interfaces. * Called exactly once for each class by the class description system * before the main function starts or * when this class is dynamically loaded. */ static void Init(); protected: /** @name Standard Interfaced functions. */ //@{ /** * Initialize this object after the setup phase before saving an * EventGenerator to disk. * @throws InitException if object could not be initialized properly. */ virtual void doinit(); //@} protected: /** * Methods to implement the veto algorithm to generate the scale of * the next branching */ //@{ /** * Value of the energy fraction for the veto algorithm * @param iopt The option for calculating z * @param ids The PDG codes of the particles in the splitting * - 0 is final-state * - 1 is initial-state for the hard process * - 2 is initial-state for particle decays */ double guessz (unsigned int iopt, const IdList &ids) const; /** * Value of the scale for the veto algorithm * @param t1 The starting valoe of the scale * @param iopt The option for calculating t * @param ids The PDG codes of the particles in the splitting * - 0 is final-state * - 1 is initial-state for the hard process * - 2 is initial-state for particle decays * @param enhance The radiation enhancement factor * @param identical Whether or not the outgoing particles are identical */ Energy2 guesst (Energy2 t1,unsigned int iopt, const IdList &ids, double enhance, bool identical) const; /** * Veto on the PDF for the initial-state shower * @param t The scale * @param x The fraction of the beam momentum * @param parton0 Pointer to the particleData for the * new parent (this is the particle we evolved back to) * @param parton1 Pointer to the particleData for the * original particle * @param beam The BeamParticleData object */ bool PDFVeto(const Energy2 t, const double x, const tcPDPtr parton0, const tcPDPtr parton1, tcBeamPtr beam) const; /** * The veto on the splitting function. * @param t The scale * @param ids The PDG codes of the particles in the splitting * @param mass Whether or not to use the massive splitting functions * @return true if vetoed */ bool SplittingFnVeto(const Energy2 t, const IdList &ids, const bool mass, const RhoDMatrix & rho) const { return UseRandom::rnd()>splittingFn_->ratioP(z_, t, ids,mass,rho); } /** * The veto on the coupling constant * @param pt2 The value of ther transverse momentum squared, \f$p_T^2\f$. * @return true if vetoed */ bool alphaSVeto(Energy2 pt2) const; //@} /** * Methods to set the kinematic variables for the branching */ //@{ /** * The energy fraction */ void z(double in) { z_=in; } /** * The azimuthal angle */ void phi(double in) { phi_=in; } /** * The transverse momentum */ void pT(Energy in) { pT_=in; } //@} /** * Set/Get the limits on the energy fraction for the splitting */ //@{ /** * Get the limits */ pair zLimits() const { return zlimits_;} /** * Set the limits */ void zLimits(pair in) { zlimits_=in; } //@} /** * Set the particles in the splittings */ void addSplitting(const IdList &); /** * Delete the particles in the splittings */ void removeSplitting(const IdList &); /** * Access the potential branchings */ const vector & particles() const { return particles_; } public: /** * @name Methods for the cut-off */ //@{ /** * The option being used */ unsigned int cutOffOption() const { return cutOffOption_; } /** * The kinematic scale */ Energy kinScale() const {return kinCutoffScale_;} /** * The virtuality cut-off on the gluon \f$Q_g=\frac{\delta-am_q}{b}\f$ * @param scale The scale \f$\delta\f$ * @param mq The quark mass \f$m_q\f$. */ Energy kinematicCutOff(Energy scale, Energy mq) const {return max((scale -a_*mq)/b_,c_);} /** * The virtualilty cut-off for gluons */ Energy vgCut() const { return vgcut_; } /** * The virtuality cut-off for everything else */ Energy vqCut() const { return vqcut_; } /** * The minimum \f$p_T\f$ for the branching */ Energy pTmin() const { return pTmin_; } /** * The square of the minimum \f$p_T\f$ */ Energy2 pT2min() const { return pT2min_; } /** * Calculate the virtual masses for a branchings */ const vector & virtualMasses(const IdList & ids); //@} /** * Set the PDF */ void setPDF(tcPDFPtr pdf, Energy scale) { pdf_ = pdf; freeze_ = scale; } private: /** * The assignment operator is private and must never be called. * In fact, it should not even be implemented. */ SudakovFormFactor & operator=(const SudakovFormFactor &); private: /** * Pointer to the splitting function for this Sudakov form factor */ SplittingFnPtr splittingFn_; /** * Pointer to the coupling for this Sudakov form factor */ ShowerAlphaPtr alpha_; /** * Maximum value of the PDF weight */ double pdfmax_; /** * List of the particles this Sudakov is used for to aid in setting up * interpolation tables if needed */ vector particles_; /** * Option for the inclusion of a factor \f$1/(1-z)\f$ in the PDF estimate */ unsigned pdffactor_; private: /** * Option for the type of cut-off to be applied */ unsigned int cutOffOption_; /** * Parameters for the default Herwig cut-off option, i.e. the parameters for * the \f$Q_g=\max(\frac{\delta-am_q}{b},c)\f$ kinematic cut-off */ //@{ /** * The \f$a\f$ parameter */ double a_; /** * The \f$b\f$ parameter */ double b_; /** * The \f$c\f$ parameter */ Energy c_; /** * Kinematic cutoff used in the parton shower phase space. */ Energy kinCutoffScale_; //@} /** * Parameters for the FORTRAN-like cut-off */ //@{ /** * The virtualilty cut-off for gluons */ Energy vgcut_; /** * The virtuality cut-off for everything else */ Energy vqcut_; //@} /** * Parameters for the \f$p_T\f$ cut-off */ //@{ /** * The minimum \f$p_T\f$ for the branching */ Energy pTmin_; /** * The square of the minimum \f$p_T\f$ */ Energy2 pT2min_; //@} private: /** * Member variables to keep the shower kinematics information * generated by a call to generateNextTimeBranching or generateNextSpaceBranching */ //@{ /** * The energy fraction */ double z_; /** * The azimuthal angle */ double phi_; /** * The transverse momentum */ Energy pT_; //@} /** * The limits of \f$z\f$ in the splitting */ pair zlimits_; /** * Stuff for the PDFs */ //@{ /** * PDf */ tcPDFPtr pdf_; /** * Freezing scale */ Energy freeze_; //@} public: /** * Get the factorization scale factor */ double factorizationScaleFactor() const { return theFactorizationScaleFactor; } /** * Set the factorization scale factor */ void factorizationScaleFactor(double f) { theFactorizationScaleFactor = f; } /** * Get the renormalization scale factor */ double renormalizationScaleFactor() const { return theRenormalizationScaleFactor; } /** * Set the renormalization scale factor */ void renormalizationScaleFactor(double f) { theRenormalizationScaleFactor = f; } private: /** * The factorization scale factor. */ double theFactorizationScaleFactor; /** * The renormalization scale factor. */ double theRenormalizationScaleFactor; }; } #endif /* HERWIG_SudakovFormFactor_H */ diff --git a/Shower/Default/Decay_QTildeShowerKinematics1to2.cc b/Shower/Default/Decay_QTildeShowerKinematics1to2.cc --- a/Shower/Default/Decay_QTildeShowerKinematics1to2.cc +++ b/Shower/Default/Decay_QTildeShowerKinematics1to2.cc @@ -1,117 +1,117 @@ // -*- C++ -*- // // Decay_QTildeShowerKinematics1to2.cc is a part of Herwig - A multi-purpose Monte Carlo event generator // Copyright (C) 2002-2011 The Herwig Collaboration // // Herwig is licenced under version 2 of the GPL, see COPYING for details. // Please respect the MCnet academic guidelines, see GUIDELINES for details. // // // This is the implementation of the non-inlined, non-templated member // functions of the Decay_QTildeShowerKinematics1to2 class. // #include "Decay_QTildeShowerKinematics1to2.h" #include "ThePEG/PDT/EnumParticles.h" #include "Herwig/Shower/SplittingFunctions/SplittingFunction.h" #include "Herwig/Shower/Base/ShowerParticle.h" #include #include "Herwig/Shower/ShowerHandler.h" #include "Herwig/Shower/Base/Evolver.h" #include "Herwig/Shower/Base/PartnerFinder.h" #include "Herwig/Shower/Base/ShowerModel.h" #include "Herwig/Shower/Base/KinematicsReconstructor.h" #include "Herwig/Shower/Base/ShowerVertex.h" using namespace Herwig; void Decay_QTildeShowerKinematics1to2:: updateChildren(const tShowerParticlePtr parent, const ShowerParticleVector & children, ShowerPartnerType::Type partnerType, bool massVeto) const { assert(children.size() == 2); // calculate the scales splittingFn()->evaluateDecayScales(partnerType,scale(),z(),parent, children[0],children[1]); // set the maximum virtual masses - vector ids(3); - ids[0] = parent->id(); - ids[1] = children[0]->id(); - ids[2] = children[1]->id(); + IdList ids(3); + ids[0] = parent->dataPtr(); + ids[1] = children[0]->dataPtr(); + ids[2] = children[1]->dataPtr(); const vector & virtualMasses = SudakovFormFactor()->virtualMasses(ids); Energy2 q2 = sqr(virtualMasses[0])-(1.-z())*sqr(scale()); children[0]->virtualMass(sqrt(q2)); if(massVeto) { children[1]->scales().Max_Q2 = (1.-z())/z()*(z()*sqr(virtualMasses[0])-q2); } // determine alphas of children according to interpretation of z const ShowerParticle::Parameters & params = parent->showerParameters(); ShowerParticle::Parameters & child0 = children[0]->showerParameters(); ShowerParticle::Parameters & child1 = children[1]->showerParameters(); child0.alpha = z() * params.alpha; child1.alpha = (1.-z()) * params.alpha; child0.ptx = pT() * cos(phi()) + z()* params.ptx; child0.pty = pT() * sin(phi()) + z()* params.pty; child0.pt = sqrt( sqr(child0.ptx) + sqr(child0.pty) ); child1.ptx = -pT() * cos(phi()) + (1.-z()) * params.ptx; child1.pty = -pT() * sin(phi()) + (1.-z()) * params.pty; child1.pt = sqrt( sqr(child1.ptx) + sqr(child1.pty) ); // set up the colour connections splittingFn()->colourConnection(parent,children[0],children[1],partnerType,false); // make the products children of the parent parent->addChild(children[0]); parent->addChild(children[1]); // set the momenta of the children for(ShowerParticleVector::const_iterator pit=children.begin(); pit!=children.end();++pit) { (**pit).showerBasis(parent->showerBasis(),true); (**pit).setShowerMomentum(true); } } void Decay_QTildeShowerKinematics1to2:: reconstructParent( const tShowerParticlePtr, const ParticleVector &) const { throw Exception() << "Decay_QTildeShowerKinematics1to2::reconstructParent not implemented" << Exception::abortnow; } void Decay_QTildeShowerKinematics1to2:: reconstructLast(const tShowerParticlePtr last, Energy mass) const { // set beta component and consequently all missing data from that, // using the nominal (i.e. PDT) mass. Energy theMass = mass > ZERO ? mass : last->data().constituentMass(); last->showerParameters().beta= (sqr(theMass) + sqr(last->showerParameters().pt) - sqr( last->showerParameters().alpha )*last->showerBasis()->pVector().m2()) / ( 2.*last->showerParameters().alpha*last->showerBasis()->p_dot_n() ); // set that new momentum last->set5Momentum( last->showerBasis()->sudakov2Momentum( last->showerParameters().alpha, last->showerParameters().beta, last->showerParameters().ptx, last->showerParameters().pty) ); } void Decay_QTildeShowerKinematics1to2::updateParent(const tShowerParticlePtr parent, const ShowerParticleVector & children, ShowerPartnerType::Type) const { IdList ids(3); - ids[0] = parent->id(); - ids[1] = children[0]->id(); - ids[2] = children[1]->id(); + ids[0] = parent->dataPtr(); + ids[1] = children[0]->dataPtr(); + ids[2] = children[1]->dataPtr(); const vector & virtualMasses = SudakovFormFactor()->virtualMasses(ids); children[0]->virtualMass(sqrt(sqr(virtualMasses[0])-(1.-z())*sqr(scale()))); if(children[1]->children().empty()) children[1]->virtualMass(virtualMasses[2]); // compute the new pT of the branching Energy2 pt2=(1.-z())*(z()*sqr(virtualMasses[0])-sqr(children[0]->virtualMass())) -z()*sqr(children[1]->virtualMass()); if(pt2>ZERO) { pT(sqrt(pt2)); } else { parent->virtualMass(ZERO); } } diff --git a/Shower/Default/FS_QTildeShowerKinematics1to2.cc b/Shower/Default/FS_QTildeShowerKinematics1to2.cc --- a/Shower/Default/FS_QTildeShowerKinematics1to2.cc +++ b/Shower/Default/FS_QTildeShowerKinematics1to2.cc @@ -1,200 +1,200 @@ // -*- C++ -*- // // FS_QTildeShowerKinematics1to2.cc is a part of Herwig - A multi-purpose Monte Carlo event generator // Copyright (C) 2002-2011 The Herwig Collaboration // // Herwig is licenced under version 2 of the GPL, see COPYING for details. // Please respect the MCnet academic guidelines, see GUIDELINES for details. // // // This is the implementation of the non-inlined, non-templated member // functions of the FS_QTildeShowerKinematics1to2 class. // #include "FS_QTildeShowerKinematics1to2.h" #include "ThePEG/PDT/EnumParticles.h" #include "Herwig/Shower/SplittingFunctions/SplittingFunction.h" #include "Herwig/Shower/Base/ShowerParticle.h" #include "ThePEG/Utilities/Debug.h" #include "Herwig/Shower/ShowerHandler.h" #include "Herwig/Shower/Base/Evolver.h" #include "Herwig/Shower/Base/PartnerFinder.h" #include "Herwig/Shower/Base/ShowerModel.h" #include "Herwig/Shower/Base/KinematicsReconstructor.h" #include "Herwig/Shower/Base/ShowerVertex.h" using namespace Herwig; void FS_QTildeShowerKinematics1to2:: updateParameters(tShowerParticlePtr theParent, tShowerParticlePtr theChild0, tShowerParticlePtr theChild1, bool setAlpha) const { const ShowerParticle::Parameters & parent = theParent->showerParameters(); ShowerParticle::Parameters & child0 = theChild0->showerParameters(); ShowerParticle::Parameters & child1 = theChild1->showerParameters(); // determine alphas of children according to interpretation of z if ( setAlpha ) { child0.alpha = z() * parent.alpha; child1.alpha = (1.-z()) * parent.alpha; } // set the values double cphi = cos(phi()); double sphi = sin(phi()); child0.ptx = pT() * cphi + z() * parent.ptx; child0.pty = pT() * sphi + z() * parent.pty; child0.pt = sqrt( sqr(child0.ptx) + sqr(child0.pty) ); child1.ptx = -pT() * cphi + (1.-z())* parent.ptx; child1.pty = -pT() * sphi + (1.-z())* parent.pty; child1.pt = sqrt( sqr(child1.ptx) + sqr(child1.pty) ); } void FS_QTildeShowerKinematics1to2:: updateChildren(const tShowerParticlePtr parent, const ShowerParticleVector & children, ShowerPartnerType::Type partnerType, bool massVeto) const { assert(children.size()==2); // calculate the scales splittingFn()->evaluateFinalStateScales(partnerType,scale(),z(),parent, children[0],children[1]); // set the maximum virtual masses if(massVeto) { Energy2 q2 = z()*(1.-z())*sqr(scale()); - vector ids(3); - ids[0] = parent->id(); - ids[1] = children[0]->id(); - ids[2] = children[1]->id(); + IdList ids(3); + ids[0] = parent->dataPtr(); + ids[1] = children[0]->dataPtr(); + ids[2] = children[1]->dataPtr(); const vector & virtualMasses = SudakovFormFactor()->virtualMasses(ids); - if(ids[0]!=ParticleID::g && ids[0]!=ParticleID::gamma ) { + if(ids[0]->id()!=ParticleID::g && ids[0]->id()!=ParticleID::gamma ) { q2 += sqr(virtualMasses[0]); } // limits on further evolution children[0]->scales().Max_Q2 = z() *(q2-sqr(virtualMasses[2])/(1.-z())); children[1]->scales().Max_Q2 = (1.-z())*(q2-sqr(virtualMasses[1])/ z() ); } // update the parameters updateParameters(parent, children[0], children[1], true); // set up the colour connections splittingFn()->colourConnection(parent,children[0],children[1],partnerType,false); // make the products children of the parent parent->addChild(children[0]); parent->addChild(children[1]); // set the momenta of the children for(ShowerParticleVector::const_iterator pit=children.begin(); pit!=children.end();++pit) { (**pit).showerBasis(parent->showerBasis(),true); (**pit).setShowerMomentum(true); } // sort out the helicity stuff if(! ShowerHandler::currentHandler()->evolver()->correlations()) return; SpinPtr pspin(parent->spinInfo()); if(!pspin || !ShowerHandler::currentHandler()->evolver()->spinCorrelations() ) return; Energy2 t = sqr(scale())*z()*(1.-z()); IdList ids; - ids.push_back(parent->id()); - ids.push_back(children[0]->id()); - ids.push_back(children[1]->id()); + ids.push_back(parent->dataPtr()); + ids.push_back(children[0]->dataPtr()); + ids.push_back(children[1]->dataPtr()); // create the vertex SVertexPtr vertex(new_ptr(ShowerVertex())); // set the matrix element vertex->ME(splittingFn()->matrixElement(z(),t,ids,phi(),true)); // set the incoming particle for the vertex parent->spinInfo()->decayVertex(vertex); for(ShowerParticleVector::const_iterator pit=children.begin(); pit!=children.end();++pit) { // construct the spin info for the children (**pit).constructSpinInfo(true); // connect the spinInfo object to the vertex (*pit)->spinInfo()->productionVertex(vertex); } } void FS_QTildeShowerKinematics1to2:: reconstructParent(const tShowerParticlePtr parent, const ParticleVector & children ) const { assert(children.size() == 2); ShowerParticlePtr c1 = dynamic_ptr_cast(children[0]); ShowerParticlePtr c2 = dynamic_ptr_cast(children[1]); parent->showerParameters().beta= c1->showerParameters().beta + c2->showerParameters().beta; Lorentz5Momentum pnew = c1->momentum() + c2->momentum(); Energy2 m2 = sqr(pT())/z()/(1.-z()) + sqr(c1->mass())/z() + sqr(c2->mass())/(1.-z()); pnew.setMass(sqrt(m2)); parent->set5Momentum( pnew ); } void FS_QTildeShowerKinematics1to2::reconstructLast(const tShowerParticlePtr last, Energy mass) const { // set beta component and consequently all missing data from that, // using the nominal (i.e. PDT) mass. Energy theMass = mass > ZERO ? mass : last->data().constituentMass(); Lorentz5Momentum pVector = last->showerBasis()->pVector(); ShowerParticle::Parameters & lastParam = last->showerParameters(); Energy2 denom = 2. * lastParam.alpha * last->showerBasis()->p_dot_n(); if(abs(denom)/(sqr(pVector.e())+pVector.rho2())<1e-10) { throw KinematicsReconstructionVeto(); } lastParam.beta = ( sqr(theMass) + sqr(lastParam.pt) - sqr(lastParam.alpha) * pVector.m2() ) / denom; // set that new momentum Lorentz5Momentum newMomentum = last->showerBasis()-> sudakov2Momentum( lastParam.alpha, lastParam.beta, lastParam.ptx , lastParam.pty); newMomentum.setMass(theMass); newMomentum.rescaleEnergy(); if(last->data().stable()) { last->set5Momentum( newMomentum ); } else { last->boost(last->momentum().findBoostToCM()); last->boost(newMomentum.boostVector()); } } void FS_QTildeShowerKinematics1to2::updateParent(const tShowerParticlePtr parent, const ShowerParticleVector & children, ShowerPartnerType::Type) const { IdList ids(3); - ids[0] = parent->id(); - ids[1] = children[0]->id(); - ids[2] = children[1]->id(); + ids[0] = parent->dataPtr(); + ids[1] = children[0]->dataPtr(); + ids[2] = children[1]->dataPtr(); const vector & virtualMasses = SudakovFormFactor()->virtualMasses(ids); if(children[0]->children().empty()) children[0]->virtualMass(virtualMasses[1]); if(children[1]->children().empty()) children[1]->virtualMass(virtualMasses[2]); // compute the new pT of the branching Energy2 pt2=sqr(z()*(1.-z()))*sqr(scale()) - sqr(children[0]->virtualMass())*(1.-z()) - sqr(children[1]->virtualMass())* z() ; - if(ids[0]!=ParticleID::g) pt2 += z()*(1.-z())*sqr(virtualMasses[0]); + if(ids[0]->id()!=ParticleID::g) pt2 += z()*(1.-z())*sqr(virtualMasses[0]); if(pt2>ZERO) { Energy2 q2 = sqr(children[0]->virtualMass())/z() + sqr(children[1]->virtualMass())/(1.-z()) + pt2/z()/(1.-z()); parent->virtualMass(sqrt(q2)); pT(sqrt(pt2)); } else { parent->virtualMass(ZERO); } } void FS_QTildeShowerKinematics1to2:: resetChildren(const tShowerParticlePtr parent, const ShowerParticleVector & children) const { updateParameters(parent, children[0], children[1], false); for(unsigned int ix=0;ixchildren().empty()) continue; ShowerParticleVector newChildren; for(unsigned int iy=0;iychildren().size();++iy) newChildren.push_back(dynamic_ptr_cast (children[ix]->children()[iy])); children[ix]->showerKinematics()->resetChildren(children[ix],newChildren); } } diff --git a/Shower/Default/IS_QTildeShowerKinematics1to2.cc b/Shower/Default/IS_QTildeShowerKinematics1to2.cc --- a/Shower/Default/IS_QTildeShowerKinematics1to2.cc +++ b/Shower/Default/IS_QTildeShowerKinematics1to2.cc @@ -1,147 +1,147 @@ // -*- C++ -*- // // IS_QTildeShowerKinematics1to2.cc is a part of Herwig - A multi-purpose Monte Carlo event generator // Copyright (C) 2002-2011 The Herwig Collaboration // // Herwig is licenced under version 2 of the GPL, see COPYING for details. // Please respect the MCnet academic guidelines, see GUIDELINES for details. // // // This is the implementation of the non-inlined, non-templated member // functions of the IS_QTildeShowerKinematics1to2 class. // #include "IS_QTildeShowerKinematics1to2.h" #include "ThePEG/PDT/EnumParticles.h" #include "ThePEG/Interface/ClassDocumentation.h" #include "Herwig/Shower/Base/ShowerParticle.h" #include "ThePEG/Utilities/Debug.h" #include "Herwig/Shower/ShowerHandler.h" #include "Herwig/Shower/Base/Evolver.h" #include "Herwig/Shower/Base/PartnerFinder.h" #include "Herwig/Shower/Base/ShowerModel.h" #include "Herwig/Shower/Base/KinematicsReconstructor.h" #include "Herwig/Shower/Base/ShowerVertex.h" #include using namespace Herwig; void IS_QTildeShowerKinematics1to2:: updateChildren( const tShowerParticlePtr theParent, const ShowerParticleVector & theChildren, ShowerPartnerType::Type, bool) const { const ShowerParticle::Parameters & parent = theParent->showerParameters(); ShowerParticle::Parameters & child0 = theChildren[0]->showerParameters(); ShowerParticle::Parameters & child1 = theChildren[1]->showerParameters(); double cphi = cos(phi()); double sphi = sin(phi()); child1.alpha = (1.-z()) * parent.alpha; child1.ptx = (1.-z()) * parent.ptx - cphi * pT(); child1.pty = (1.-z()) * parent.pty - sphi * pT(); child1.pt = sqrt( sqr(child1.ptx) + sqr(child1.pty) ); // space-like child child0.alpha = parent.alpha - child1.alpha; child0.beta = parent.beta - child1.beta; child0.ptx = parent.ptx - child1.ptx; child0.pty = parent.pty - child1.pty; } void IS_QTildeShowerKinematics1to2:: updateParent(const tShowerParticlePtr parent, const ShowerParticleVector & children, ShowerPartnerType::Type partnerType) const { // calculate the scales splittingFn()->evaluateInitialStateScales(partnerType,scale(),z(),parent, children[0],children[1]); // set proper colour connections splittingFn()->colourConnection(parent,children[0],children[1], partnerType,true); // set proper parent/child relationships parent->addChild(children[0]); parent->addChild(children[1]); parent->x(children[0]->x()/z()); // sort out the helicity stuff // construct the spin info for parent and timelike child // temporary assignment of shower parameters to calculate correlations parent->showerParameters().alpha = parent->x(); children[1]->showerParameters().alpha = (1.-z()) * parent->x(); children[1]->showerParameters().ptx = - cos(phi()) * pT(); children[1]->showerParameters().pty = - sin(phi()) * pT(); children[1]->showerParameters().pt = pT(); parent ->showerBasis(children[0]->showerBasis(),true); children[1]->showerBasis(children[0]->showerBasis(),true); parent ->setShowerMomentum(false); children[1]->setShowerMomentum(true); if(! ShowerHandler::currentHandler()->evolver()->correlations()) return; SpinPtr pspin(children[0]->spinInfo()); if(!pspin || !ShowerHandler::currentHandler()->evolver()->spinCorrelations() ) return; // compute the matrix element for spin correlations IdList ids; - ids.push_back(parent->id()); - ids.push_back(children[0]->id()); - ids.push_back(children[1]->id()); + ids.push_back(parent->dataPtr()); + ids.push_back(children[0]->dataPtr()); + ids.push_back(children[1]->dataPtr()); Energy2 t = (1.-z())*sqr(scale())/z(); // create the vertex SVertexPtr vertex(new_ptr(ShowerVertex())); // set the matrix element vertex->ME(splittingFn()->matrixElement(z(),t,ids,phi(),false)); // set the incoming particle for the vertex // (in reality the first child as going backwards) pspin->decayVertex(vertex); // construct the spin infos parent ->constructSpinInfo(false); children[1]->constructSpinInfo(true); // connect the spinInfo objects to the vertex parent ->spinInfo()->productionVertex(vertex); children[1]->spinInfo()->productionVertex(vertex); } void IS_QTildeShowerKinematics1to2:: reconstructParent(const tShowerParticlePtr parent, const ParticleVector & children ) const { PPtr c1 = children[0]; ShowerParticlePtr c2 = dynamic_ptr_cast(children[1]); ShowerParticle::Parameters & c2param = c2->showerParameters(); // get shower variables from 1st child in order to keep notation // parent->(c1, c2) clean even though the splitting was initiated // from c1. The name updateParent is still referring to the // timelike branching though. // on-shell child c2param.beta = 0.5*( sqr(c2->data().constituentMass()) + sqr(c2param.pt) ) / ( c2param.alpha * parent->showerBasis()->p_dot_n() ); Lorentz5Momentum pnew = parent->showerBasis()-> sudakov2Momentum(c2param.alpha, c2param.beta, c2param.ptx , c2param.pty); pnew.setMass(c2->data().constituentMass()); pnew.rescaleEnergy(); c2->set5Momentum( pnew ); // spacelike child Lorentz5Momentum pc1(parent->momentum() - c2->momentum()); pc1.rescaleMass(); c1->set5Momentum(pc1); } void IS_QTildeShowerKinematics1to2:: updateLast( const tShowerParticlePtr theLast,Energy px,Energy py) const { if(theLast->isFinalState()) return; Lorentz5Momentum pVector = theLast->showerBasis()->pVector(); ShowerParticle::Parameters & last = theLast->showerParameters(); Energy2 pt2 = sqr(px) + sqr(py); last.alpha = theLast->x(); last.beta = 0.5 * pt2 / last.alpha / theLast->showerBasis()->p_dot_n(); last.ptx = ZERO; last.pty = ZERO; last.pt = ZERO; // momentum Lorentz5Momentum ntemp = Lorentz5Momentum(ZERO,-pVector.vect()); double beta = 0.5 * pt2 / last.alpha / ( pVector * ntemp); Lorentz5Momentum plast = Lorentz5Momentum( (pVector.z()>ZERO ? px : -px), py, ZERO, ZERO) + theLast->x() * pVector + beta * ntemp; plast.rescaleMass(); theLast->set5Momentum(plast); } diff --git a/Shower/Default/QTildeSudakov.cc b/Shower/Default/QTildeSudakov.cc --- a/Shower/Default/QTildeSudakov.cc +++ b/Shower/Default/QTildeSudakov.cc @@ -1,941 +1,927 @@ // -*- C++ -*- // // QTildeSudakov.cc is a part of Herwig - A multi-purpose Monte Carlo event generator // Copyright (C) 2002-2011 The Herwig Collaboration // // Herwig is licenced under version 2 of the GPL, see COPYING for details. // Please respect the MCnet academic guidelines, see GUIDELINES for details. // // // This is the implementation of the non-inlined, non-templated member // functions of the QTildeSudakov class. // #include "QTildeSudakov.h" #include "ThePEG/Interface/ClassDocumentation.h" #include "ThePEG/Interface/Parameter.h" #include "ThePEG/Interface/Switch.h" #include "ThePEG/PDT/ParticleData.h" #include "ThePEG/EventRecord/Event.h" #include "ThePEG/Repository/EventGenerator.h" #include "ThePEG/Repository/CurrentGenerator.h" #include "ThePEG/PDT/EnumParticles.h" #include "Herwig/Shower/Default/FS_QTildeShowerKinematics1to2.h" #include "Herwig/Shower/Default/IS_QTildeShowerKinematics1to2.h" #include "Herwig/Shower/Default/Decay_QTildeShowerKinematics1to2.h" #include "ThePEG/Utilities/DescribeClass.h" #include "Herwig/Shower/Base/ShowerVertex.h" #include "Herwig/Shower/Base/ShowerParticle.h" #include "Herwig/Shower/ShowerHandler.h" #include "Herwig/Shower/Base/Evolver.h" #include "Herwig/Shower/Base/PartnerFinder.h" #include "Herwig/Shower/Base/ShowerModel.h" #include "Herwig/Shower/Base/KinematicsReconstructor.h" using namespace Herwig; DescribeNoPIOClass describeQTildeSudakov ("Herwig::QTildeSudakov","HwShower.so"); void QTildeSudakov::Init() { static ClassDocumentation documentation ("The QTildeSudakov class implements the Sudakov form factor for ordering it" " qtilde"); } bool QTildeSudakov::guessTimeLike(Energy2 &t,Energy2 tmin,double enhance) { Energy2 told = t; // calculate limits on z and if lower>upper return if(!computeTimeLikeLimits(t)) return false; // guess values of t and z t = guesst(told,0,ids_,enhance,ids_[1]==ids_[2]); z(guessz(0,ids_)); // actual values for z-limits if(!computeTimeLikeLimits(t)) return false; if(tupper return if(!computeSpaceLikeLimits(t,x)) return false; // guess values of t and z t = guesst(told,1,ids_,enhance,ids_[1]==ids_[2]); z(guessz(1,ids_)); // actual values for z-limits if(!computeSpaceLikeLimits(t,x)) return false; if(t zLimits().second) return true; Energy2 q2 = z()*(1.-z())*t; - if(ids_[0]!=ParticleID::g && - ids_[0]!=ParticleID::gamma ) q2 += masssquared_[0]; + if(ids_[0]->id()!=ParticleID::g && + ids_[0]->id()!=ParticleID::gamma ) q2 += masssquared_[0]; if(q2>maxQ2) return true; // compute the pts Energy2 pt2 = z()*(1.-z())*q2 - masssquared_[1]*(1.-z()) - masssquared_[2]*z(); // if pt2<0 veto if(pt2 min if(tmax<=tmin) return ShoKinPtr(); // calculate next value of t using veto algorithm Energy2 t(tmax); do { if(!guessTimeLike(t,tmin,enhance)) break; } while(PSVeto(t,maxQ2) || SplittingFnVeto(z()*(1.-z())*t,ids,true,rho) || alphaSVeto(splittingFn()->angularOrdered() ? sqr(z()*(1.-z()))*t : z()*(1.-z())*t)); q_ = t > ZERO ? Energy(sqrt(t)) : -1.*MeV; if(q_ < ZERO) return ShoKinPtr(); // return the ShowerKinematics object return createFinalStateBranching(q_,z(),phi(),pT()); } ShoKinPtr QTildeSudakov:: generateNextSpaceBranching(const Energy startingQ, const IdList &ids, - double x,bool cc, + double x, const RhoDMatrix & rho, double enhance, Ptr::transient_const_pointer beam) { // First reset the internal kinematics variables that can // have been eventually set in the previous call to the method. q_ = ZERO; z(0.); phi(0.); // perform the initialization Energy2 tmax(sqr(startingQ)),tmin; - initialize(ids,tmin,cc); + initialize(ids,tmin); // check max > min if(tmax<=tmin) return ShoKinPtr(); - // extract the partons which are needed for the PDF veto - // Different order, incoming parton is id = 1, outgoing are id=0,2 - tcPDPtr parton0 = getParticleData(ids[0]); - tcPDPtr parton1 = getParticleData(ids[1]); - if(cc) { - if(parton0->CC()) parton0 = parton0->CC(); - if(parton1->CC()) parton1 = parton1->CC(); - } // calculate next value of t using veto algorithm Energy2 t(tmax),pt2(ZERO); do { if(!guessSpaceLike(t,tmin,x,enhance)) break; pt2=sqr(1.-z())*t-z()*masssquared_[2]; } while(z() > zLimits().second || SplittingFnVeto((1.-z())*t/z(),ids,true,rho) || alphaSVeto(splittingFn()->angularOrdered() ? sqr(1.-z())*t : (1.-z())*t) || - PDFVeto(t,x,parton0,parton1,beam) || pt2 < pT2min() ); + PDFVeto(t,x,ids[0],ids[1],beam) || pt2 < pT2min() ); if(t > ZERO && zLimits().first < zLimits().second) q_ = sqrt(t); else return ShoKinPtr(); pT(sqrt(pt2)); // create the ShowerKinematics and return it return createInitialStateBranching(q_,z(),phi(),pT()); } -void QTildeSudakov::initialize(const IdList & ids, Energy2 & tmin,const bool cc) { +void QTildeSudakov::initialize(const IdList & ids, Energy2 & tmin) { ids_=ids; - if(cc) { - for(unsigned int ix=0;ixCC()) ids_[ix]*=-1; - } - } tmin = cutOffOption() != 2 ? ZERO : 4.*pT2min(); masses_ = virtualMasses(ids); masssquared_.clear(); for(unsigned int ix=0;ix0) tmin=max(masssquared_[ix],tmin); } } ShoKinPtr QTildeSudakov::generateNextDecayBranching(const Energy startingScale, const Energy stoppingScale, const Energy minmass, const IdList &ids, - const bool cc, const RhoDMatrix & rho, double enhance) { // First reset the internal kinematics variables that can // have been eventually set in the previous call to this method. q_ = Constants::MaxEnergy; z(0.); phi(0.); // perform initialisation Energy2 tmax(sqr(stoppingScale)),tmin; - initialize(ids,tmin,cc); + initialize(ids,tmin); tmin=sqr(startingScale); // check some branching possible if(tmax<=tmin) return ShoKinPtr(); // perform the evolution Energy2 t(tmin),pt2(-MeV2); do { if(!guessDecay(t,tmax,minmass,enhance)) break; pt2 = sqr(1.-z())*(t-masssquared_[0])-z()*masssquared_[2]; } while(SplittingFnVeto((1.-z())*t/z(),ids,true,rho)|| alphaSVeto(splittingFn()->angularOrdered() ? sqr(1.-z())*t : (1.-z())*t ) || pt2masssquared_[0]-sqr(minmass)); if(t > ZERO) { q_ = sqrt(t); pT(sqrt(pt2)); } else return ShoKinPtr(); phi(0.); // create the ShowerKinematics object return createDecayBranching(q_,z(),phi(),pT()); } bool QTildeSudakov::guessDecay(Energy2 &t,Energy2 tmax, Energy minmass, double enhance) { // previous scale Energy2 told = t; // overestimated limits on z if(tmax limits=make_pair(sqr(minmass/masses_[0]), 1.-sqrt(masssquared_[2]+pT2min()+ 0.25*sqr(masssquared_[2])/tm2)/tm +0.5*masssquared_[2]/tm2); zLimits(limits); if(zLimits().secondtmax||zLimits().second limits; - if(ids_[0]==ParticleID::g||ids_[0]==ParticleID::gamma) { + if(ids_[0]->id()==ParticleID::g||ids_[0]->id()==ParticleID::gamma) { // no emission possible if(t<16.*(masssquared_[1]+pT2min())) { t=-1.*GeV2; return false; } // overestimate of the limits limits.first = 0.5*(1.-sqrt(1.-4.*sqrt((masssquared_[1]+pT2min())/t))); limits.second = 1.-limits.first; } // special case for radiated particle is gluon - else if(ids_[2]==ParticleID::g||ids_[2]==ParticleID::gamma) { + else if(ids_[2]->id()==ParticleID::g||ids_[2]->id()==ParticleID::gamma) { limits.first = sqrt((masssquared_[1]+pT2min())/t); limits.second = 1.-sqrt((masssquared_[2]+pT2min())/t); } - else if(ids_[1]==ParticleID::g||ids_[1]==ParticleID::gamma) { + else if(ids_[1]->id()==ParticleID::g||ids_[1]->id()==ParticleID::gamma) { limits.second = sqrt((masssquared_[2]+pT2min())/t); limits.first = 1.-sqrt((masssquared_[1]+pT2min())/t); } else { limits.first = (masssquared_[1]+pT2min())/t; limits.second = 1.-(masssquared_[2]+pT2min())/t; } if(limits.first>=limits.second) { t=-1.*GeV2; return false; } zLimits(limits); return true; } bool QTildeSudakov::computeSpaceLikeLimits(Energy2 & t, double x) { if (t < 1e-20 * GeV2) { t=-1.*GeV2; return false; } pair limits; // compute the limits limits.first = x; double yy = 1.+0.5*masssquared_[2]/t; limits.second = yy - sqrt(sqr(yy)-1.+pT2min()/t); // return false if lower>upper zLimits(limits); if(limits.second(particle.parents()[0]) : tShowerParticlePtr(); } else { mother = particle.children().size()==2 ? dynamic_ptr_cast(&particle) : tShowerParticlePtr(); } tShowerParticlePtr partner; while(mother) { tPPtr otherChild; if(forward) { for (unsigned int ix=0;ixchildren().size();++ix) { if(mother->children()[ix]!=child) { otherChild = mother->children()[ix]; break; } } } else { otherChild = mother->children()[1]; } tShowerParticlePtr other = dynamic_ptr_cast(otherChild); if((inter==ShowerInteraction::QCD && otherChild->dataPtr()->coloured()) || (inter==ShowerInteraction::QED && otherChild->dataPtr()->charged())) { partner = other; break; } if(forward && !other->isFinalState()) { partner = dynamic_ptr_cast(mother); break; } child = mother; if(forward) { mother = ! mother->parents().empty() ? dynamic_ptr_cast(mother->parents()[0]) : tShowerParticlePtr(); } else { if(mother->children()[0]->children().size()!=2) break; tShowerParticlePtr mtemp = dynamic_ptr_cast(mother->children()[0]); if(!mtemp) break; else mother=mtemp; } } if(!partner) { if(forward) { partner = dynamic_ptr_cast( child)->partner(); } else { if(mother) { tShowerParticlePtr parent; if(!mother->children().empty()) { parent = dynamic_ptr_cast(mother->children()[0]); } if(!parent) { parent = dynamic_ptr_cast(mother); } partner = parent->partner(); } else { partner = dynamic_ptr_cast(&particle)->partner(); } } } return partner; } pair softPhiMin(double phi0, double phi1, double A, double B, double C, double D) { double c01 = cos(phi0 - phi1); double s01 = sin(phi0 - phi1); double s012(sqr(s01)), c012(sqr(c01)); double A2(A*A), B2(B*B), C2(C*C), D2(D*D); if(abs(B/A)<1e-10 && abs(D/C)<1e-10) return make_pair(phi0,phi0+Constants::pi); double root = sqr(B2)*C2*D2*sqr(s012) + 2.*A*B2*B*C2*C*D*c01*s012 + 2.*A*B2*B*C*D2*D*c01*s012 + 4.*A2*B2*C2*D2*c012 - A2*B2*C2*D2*s012 - A2*B2*sqr(D2)*s012 - sqr(B2)*sqr(C2)*s012 - sqr(B2)*C2*D2*s012 - 4.*A2*A*B*C*D2*D*c01 - 4.*A*B2*B*C2*C*D*c01 + sqr(A2)*sqr(D2) + 2.*A2*B2*C2*D2 + sqr(B2)*sqr(C2); if(root<0.) return make_pair(phi0,phi0+Constants::pi); root = sqrt(root); double denom = (-2.*A*B*C*D*c01 + A2*D2 + B2*C2); double denom2 = (-B*C*c01 + A*D); double num = B2*C*D*s012; return make_pair(atan2(B*s01*(-C*(num + root) / denom + D) / denom2, -(num + root ) / denom) + phi0, atan2(B*s01*(-C*(num - root) / denom + D) / denom2, -(num - root ) / denom) + phi0); } } double QTildeSudakov::generatePhiForward(ShowerParticle & particle, const IdList & ids, ShoKinPtr kinematics, const RhoDMatrix & rho) { // no correlations, return flat phi if(! ShowerHandler::currentHandler()->evolver()->correlations()) return Constants::twopi*UseRandom::rnd(); // get the kinematic variables double z = kinematics->z(); Energy2 t = z*(1.-z)*sqr(kinematics->scale()); Energy pT = kinematics->pT(); // if soft correlations Energy2 pipj,pik; - bool canBeSoft[2] = {ids[1]==ParticleID::g || ids[1]==ParticleID::gamma, - ids[2]==ParticleID::g || ids[2]==ParticleID::gamma }; + bool canBeSoft[2] = {ids[1]->id()==ParticleID::g || ids[1]->id()==ParticleID::gamma, + ids[2]->id()==ParticleID::g || ids[2]->id()==ParticleID::gamma }; vector pjk(3,ZERO); vector Ek(3,ZERO); Energy Ei,Ej; Energy2 m12(ZERO),m22(ZERO); InvEnergy2 aziMax(ZERO); bool softAllowed = ShowerHandler::currentHandler()->evolver()->softCorrelations()&& (canBeSoft[0] || canBeSoft[1]); if(softAllowed) { // find the partner for the soft correlations tShowerParticlePtr partner=findCorrelationPartner(particle,true,splittingFn()->interactionType()); // remember we want the softer gluon bool swapOrder = !canBeSoft[1] || (canBeSoft[0] && canBeSoft[1] && z < 0.5); double zFact = !swapOrder ? (1.-z) : z; // compute the transforms to the shower reference frame // first the boost Lorentz5Momentum pVect = particle.showerBasis()->pVector(); Lorentz5Momentum nVect = particle.showerBasis()->nVector(); Boost beta_bb; if(particle.showerBasis()->frame()==ShowerBasis::BackToBack) { beta_bb = -(pVect + nVect).boostVector(); } else if(particle.showerBasis()->frame()==ShowerBasis::Rest) { beta_bb = -pVect.boostVector(); } else assert(false); pVect.boost(beta_bb); nVect.boost(beta_bb); Axis axis; if(particle.showerBasis()->frame()==ShowerBasis::BackToBack) { axis = pVect.vect().unit(); } else if(particle.showerBasis()->frame()==ShowerBasis::Rest) { axis = nVect.vect().unit(); } else assert(false); // and then the rotation LorentzRotation rot; if(axis.perp2()>0.) { double sinth(sqrt(sqr(axis.x())+sqr(axis.y()))); rot.rotate(acos(axis.z()),Axis(-axis.y()/sinth,axis.x()/sinth,0.)); } else if(axis.z()<0.) { rot.rotate(Constants::pi,Axis(1.,0.,0.)); } rot.invert(); pVect *= rot; nVect *= rot; // shower parameters Energy2 pn = pVect*nVect, m2 = pVect.m2(); double alpha0 = particle.showerParameters().alpha; double beta0 = 0.5/alpha0/pn* (sqr(particle.dataPtr()->mass())-sqr(alpha0)*m2+sqr(particle.showerParameters().pt)); Lorentz5Momentum qperp0(particle.showerParameters().ptx, particle.showerParameters().pty,ZERO,ZERO); assert(partner); Lorentz5Momentum pj = partner->momentum(); pj.boost(beta_bb); pj *= rot; // compute the two phi independent dot products pik = 0.5*zFact*(sqr(alpha0)*m2 - sqr(particle.showerParameters().pt) + 2.*alpha0*beta0*pn ) +0.5*sqr(pT)/zFact; Energy2 dot1 = pj*pVect; Energy2 dot2 = pj*nVect; Energy2 dot3 = pj*qperp0; pipj = alpha0*dot1+beta0*dot2+dot3; // compute the constants for the phi dependent dot product pjk[0] = zFact*(alpha0*dot1+dot3-0.5*dot2/pn*(alpha0*m2-sqr(particle.showerParameters().pt)/alpha0)) +0.5*sqr(pT)*dot2/pn/zFact/alpha0; pjk[1] = (pj.x() - dot2/alpha0/pn*qperp0.x())*pT; pjk[2] = (pj.y() - dot2/alpha0/pn*qperp0.y())*pT; m12 = sqr(particle.dataPtr()->mass()); m22 = sqr(partner->dataPtr()->mass()); if(swapOrder) { pjk[1] *= -1.; pjk[2] *= -1.; } Ek[0] = zFact*(alpha0*pVect.t()-0.5*nVect.t()/pn*(alpha0*m2-sqr(particle.showerParameters().pt)/alpha0)) +0.5*sqr(pT)*nVect.t()/pn/zFact/alpha0; Ek[1] = -nVect.t()/alpha0/pn*qperp0.x()*pT; Ek[2] = -nVect.t()/alpha0/pn*qperp0.y()*pT; if(swapOrder) { Ek[1] *= -1.; Ek[2] *= -1.; } Energy mag2=sqrt(sqr(Ek[1])+sqr(Ek[2])); Ei = alpha0*pVect.t()+beta0*nVect.t(); Ej = pj.t(); double phi0 = atan2(-pjk[2],-pjk[1]); if(phi0<0.) phi0 += Constants::twopi; double phi1 = atan2(-Ek[2],-Ek[1]); if(phi1<0.) phi1 += Constants::twopi; double xi_min = pik/Ei/(Ek[0]+mag2), xi_max = pik/Ei/(Ek[0]-mag2), xi_ij = pipj/Ei/Ej; if(xi_min>xi_max) swap(xi_min,xi_max); if(xi_min>xi_ij) softAllowed = false; Energy2 mag = sqrt(sqr(pjk[1])+sqr(pjk[2])); if(ShowerHandler::currentHandler()->evolver()->softCorrelations()==1) { aziMax = -m12/sqr(pik) -m22/sqr(pjk[0]+mag) +2.*pipj/pik/(pjk[0]-mag); } else if(ShowerHandler::currentHandler()->evolver()->softCorrelations()==2) { double A = (pipj*Ek[0]- Ej*pik)/Ej/sqr(Ej); double B = -sqrt(sqr(pipj)*(sqr(Ek[1])+sqr(Ek[2])))/Ej/sqr(Ej); double C = pjk[0]/sqr(Ej); double D = -sqrt(sqr(pjk[1])+sqr(pjk[2]))/sqr(Ej); pair minima = softPhiMin(phi0,phi1,A,B,C,D); aziMax = 0.5/pik/(Ek[0]-mag2)*(Ei-m12*(Ek[0]-mag2)/pik + max(Ej*(A+B*cos(minima.first -phi1))/(C+D*cos(minima.first -phi0)), Ej*(A+B*cos(minima.second-phi1))/(C+D*cos(minima.second-phi0)))); } else assert(false); } // if spin correlations vector > wgts; if(ShowerHandler::currentHandler()->evolver()->spinCorrelations()) { // calculate the weights wgts = splittingFn()->generatePhiForward(z,t,ids,rho); } else { wgts = vector >(1,make_pair(0,1.)); } // generate the azimuthal angle double phi,wgt; static const Complex ii(0.,1.); unsigned int ntry(0); double phiMax(0.),wgtMax(0.); do { phi = Constants::twopi*UseRandom::rnd(); // first the spin correlations bit (gives 1 if correlations off) Complex spinWgt = 0.; for(unsigned int ix=0;ix1e-10) { generator()->log() << "Forward spin weight problem " << wgt << " " << wgt-1. - << " " << ids[0] << " " << ids[1] << " " << ids[2] << " " << " " << phi << "\n"; + << " " << ids[0]->id() << " " << ids[1]->id() << " " << ids[2]->id() << " " << " " << phi << "\n"; generator()->log() << "Weights \n"; for(unsigned int ix=0;ixlog() << wgts[ix].first << " " << wgts[ix].second << "\n"; } // soft correlations bit double aziWgt = 1.; if(softAllowed) { Energy2 dot = pjk[0]+pjk[1]*cos(phi)+pjk[2]*sin(phi); Energy Eg = Ek[0]+Ek[1]*cos(phi)+Ek[2]*sin(phi); if(pipj*Eg>pik*Ej) { if(ShowerHandler::currentHandler()->evolver()->softCorrelations()==1) { aziWgt = (-m12/sqr(pik) -m22/sqr(dot) +2.*pipj/pik/dot)/aziMax; } else if(ShowerHandler::currentHandler()->evolver()->softCorrelations()==2) { aziWgt = max(ZERO,0.5/pik/Eg*(Ei-m12*Eg/pik + (pipj*Eg - Ej*pik)/dot)/aziMax); } if(aziWgt-1.>1e-10||aziWgt<-1e-10) { generator()->log() << "Forward soft weight problem " << aziWgt << " " << aziWgt-1. - << " " << ids[0] << " " << ids[1] << " " << ids[2] << " " << " " << phi << "\n"; + << " " << ids[0]->id() << " " << ids[1]->id() << " " << ids[2]->id() << " " << " " << phi << "\n"; } } else { aziWgt = 0.; } } wgt *= aziWgt; if(wgt>wgtMax) { phiMax = phi; wgtMax = wgt; } ++ntry; } while(wgtlog() << "Too many tries to generate phi in forward evolution\n"; phi = phiMax; } // return the azimuthal angle return phi; } double QTildeSudakov::generatePhiBackward(ShowerParticle & particle, const IdList & ids, ShoKinPtr kinematics, const RhoDMatrix & rho) { // no correlations, return flat phi if(! ShowerHandler::currentHandler()->evolver()->correlations()) return Constants::twopi*UseRandom::rnd(); // get the kinematic variables double z = kinematics->z(); Energy2 t = (1.-z)*sqr(kinematics->scale())/z; Energy pT = kinematics->pT(); // if soft correlations bool softAllowed = ShowerHandler::currentHandler()->evolver()->softCorrelations() && - (ids[2]==ParticleID::g || ids[2]==ParticleID::gamma); + (ids[2]->id()==ParticleID::g || ids[2]->id()==ParticleID::gamma); Energy2 pipj,pik,m12(ZERO),m22(ZERO); vector pjk(3,ZERO); Energy Ei,Ej,Ek; InvEnergy2 aziMax(ZERO); if(softAllowed) { // find the partner for the soft correlations tShowerParticlePtr partner=findCorrelationPartner(particle,false,splittingFn()->interactionType()); double zFact = (1.-z); // compute the transforms to the shower reference frame // first the boost Lorentz5Momentum pVect = particle.showerBasis()->pVector(); Lorentz5Momentum nVect = particle.showerBasis()->nVector(); assert(particle.showerBasis()->frame()==ShowerBasis::BackToBack); Boost beta_bb = -(pVect + nVect).boostVector(); pVect.boost(beta_bb); nVect.boost(beta_bb); Axis axis = pVect.vect().unit(); // and then the rotation LorentzRotation rot; if(axis.perp2()>0.) { double sinth(sqrt(sqr(axis.x())+sqr(axis.y()))); rot.rotate(acos(axis.z()),Axis(-axis.y()/sinth,axis.x()/sinth,0.)); } else if(axis.z()<0.) { rot.rotate(Constants::pi,Axis(1.,0.,0.)); } rot.invert(); pVect *= rot; nVect *= rot; // shower parameters Energy2 pn = pVect*nVect; Energy2 m2 = pVect.m2(); double alpha0 = particle.x(); double beta0 = -0.5/alpha0/pn*sqr(alpha0)*m2; Lorentz5Momentum pj = partner->momentum(); pj.boost(beta_bb); pj *= rot; double beta2 = 0.5*(1.-zFact)*(sqr(alpha0*zFact/(1.-zFact))*m2+sqr(pT))/alpha0/zFact/pn; // compute the two phi independent dot products Energy2 dot1 = pj*pVect; Energy2 dot2 = pj*nVect; pipj = alpha0*dot1+beta0*dot2; pik = alpha0*(alpha0*zFact/(1.-zFact)*m2+pn*(beta2+zFact/(1.-zFact)*beta0)); // compute the constants for the phi dependent dot product pjk[0] = alpha0*zFact/(1.-zFact)*dot1+beta2*dot2; pjk[1] = pj.x()*pT; pjk[2] = pj.y()*pT; m12 = ZERO; m22 = sqr(partner->dataPtr()->mass()); Energy2 mag = sqrt(sqr(pjk[1])+sqr(pjk[2])); if(ShowerHandler::currentHandler()->evolver()->softCorrelations()==1) { aziMax = -m12/sqr(pik) -m22/sqr(pjk[0]+mag) +2.*pipj/pik/(pjk[0]-mag); } else if(ShowerHandler::currentHandler()->evolver()->softCorrelations()==2) { Ek = alpha0*zFact/(1.-zFact)*pVect.t()+beta2*nVect.t(); Ei = alpha0*pVect.t()+beta0*nVect.t(); Ej = pj.t(); if(pipj*Ek> Ej*pik) { aziMax = 0.5/pik/Ek*(Ei-m12*Ek/pik + (pipj*Ek- Ej*pik)/(pjk[0]-mag)); } else { aziMax = 0.5/pik/Ek*(Ei-m12*Ek/pik); } } else { assert(ShowerHandler::currentHandler()->evolver()->softCorrelations()==0); } } // if spin correlations vector > wgts; if(ShowerHandler::currentHandler()->evolver()->spinCorrelations()) { // get the spin density matrix and the mapping // get the weights wgts = splittingFn()->generatePhiBackward(z,t,ids,rho); } else { wgts = vector >(1,make_pair(0,1.)); } // generate the azimuthal angle double phi,wgt; static const Complex ii(0.,1.); unsigned int ntry(0); double phiMax(0.),wgtMax(0.); do { phi = Constants::twopi*UseRandom::rnd(); Complex spinWgt = 0.; for(unsigned int ix=0;ix1e-10) { generator()->log() << "Backward weight problem " << wgt << " " << wgt-1. - << " " << ids[0] << " " << ids[1] << " " << ids[2] << " " << " " << z << " " << phi << "\n"; + << " " << ids[0]->id() << " " << ids[1]->id() << " " << ids[2]->id() << " " << " " << z << " " << phi << "\n"; generator()->log() << "Weights \n"; for(unsigned int ix=0;ixlog() << wgts[ix].first << " " << wgts[ix].second << "\n"; } // soft correlations bit double aziWgt = 1.; if(softAllowed) { Energy2 dot = pjk[0]+pjk[1]*cos(phi)+pjk[2]*sin(phi); if(ShowerHandler::currentHandler()->evolver()->softCorrelations()==1) { aziWgt = (-m12/sqr(pik) -m22/sqr(dot) +2.*pipj/pik/dot)/aziMax; } else if(ShowerHandler::currentHandler()->evolver()->softCorrelations()==2) { aziWgt = max(ZERO,0.5/pik/Ek*(Ei-m12*Ek/pik + pipj*Ek/dot - Ej*pik/dot)/aziMax); } if(aziWgt-1.>1e-10||aziWgt<-1e-10) { generator()->log() << "Backward soft weight problem " << aziWgt << " " << aziWgt-1. - << " " << ids[0] << " " << ids[1] << " " << ids[2] << " " << " " << phi << "\n"; + << " " << ids[0]->id() << " " << ids[1]->id() << " " << ids[2]->id() << " " << " " << phi << "\n"; } } wgt *= aziWgt; if(wgt>wgtMax) { phiMax = phi; wgtMax = wgt; } ++ntry; } while(wgtlog() << "Too many tries to generate phi in backward evolution\n"; phi = phiMax; } // return the azimuthal angle return phi; } double QTildeSudakov::generatePhiDecay(ShowerParticle & particle, const IdList & ids, ShoKinPtr kinematics, const RhoDMatrix &) { // only soft correlations in this case // no correlations, return flat phi if( !(ShowerHandler::currentHandler()->evolver()->softCorrelations() && - (ids[2]==ParticleID::g || ids[2]==ParticleID::gamma ))) + (ids[2]->id()==ParticleID::g || ids[2]->id()==ParticleID::gamma ))) return Constants::twopi*UseRandom::rnd(); // get the kinematic variables double z = kinematics->z(); Energy pT = kinematics->pT(); // if soft correlations // find the partner for the soft correlations tShowerParticlePtr partner = findCorrelationPartner(particle,true,splittingFn()->interactionType()); double zFact(1.-z); // compute the transforms to the shower reference frame // first the boost Lorentz5Momentum pVect = particle.showerBasis()->pVector(); Lorentz5Momentum nVect = particle.showerBasis()->nVector(); assert(particle.showerBasis()->frame()==ShowerBasis::Rest); Boost beta_bb = -pVect.boostVector(); pVect.boost(beta_bb); nVect.boost(beta_bb); Axis axis = nVect.vect().unit(); // and then the rotation LorentzRotation rot; if(axis.perp2()>0.) { double sinth(sqrt(sqr(axis.x())+sqr(axis.y()))); rot.rotate(acos(axis.z()),Axis(-axis.y()/sinth,axis.x()/sinth,0.)); } else if(axis.z()<0.) { rot.rotate(Constants::pi,Axis(1.,0.,0.)); } rot.invert(); pVect *= rot; nVect *= rot; // shower parameters Energy2 pn = pVect*nVect; Energy2 m2 = pVect.m2(); double alpha0 = particle.showerParameters().alpha; double beta0 = 0.5/alpha0/pn* (sqr(particle.dataPtr()->mass())-sqr(alpha0)*m2+sqr(particle.showerParameters().pt)); Lorentz5Momentum qperp0(particle.showerParameters().ptx, particle.showerParameters().pty,ZERO,ZERO); Lorentz5Momentum pj = partner->momentum(); pj.boost(beta_bb); pj *= rot; // compute the two phi independent dot products Energy2 pik = 0.5*zFact*(sqr(alpha0)*m2 - sqr(particle.showerParameters().pt) + 2.*alpha0*beta0*pn ) +0.5*sqr(pT)/zFact; Energy2 dot1 = pj*pVect; Energy2 dot2 = pj*nVect; Energy2 dot3 = pj*qperp0; Energy2 pipj = alpha0*dot1+beta0*dot2+dot3; // compute the constants for the phi dependent dot product vector pjk(3,ZERO); pjk[0] = zFact*(alpha0*dot1+dot3-0.5*dot2/pn*(alpha0*m2-sqr(particle.showerParameters().pt)/alpha0)) +0.5*sqr(pT)*dot2/pn/zFact/alpha0; pjk[1] = (pj.x() - dot2/alpha0/pn*qperp0.x())*pT; pjk[2] = (pj.y() - dot2/alpha0/pn*qperp0.y())*pT; Energy2 m12 = sqr(particle.dataPtr()->mass()); Energy2 m22 = sqr(partner->dataPtr()->mass()); Energy2 mag = sqrt(sqr(pjk[1])+sqr(pjk[2])); InvEnergy2 aziMax; vector Ek(3,ZERO); Energy Ei,Ej; if(ShowerHandler::currentHandler()->evolver()->softCorrelations()==1) { aziMax = -m12/sqr(pik) -m22/sqr(pjk[0]+mag) +2.*pipj/pik/(pjk[0]-mag); } else if(ShowerHandler::currentHandler()->evolver()->softCorrelations()==2) { Ek[0] = zFact*(alpha0*pVect.t()+-0.5*nVect.t()/pn*(alpha0*m2-sqr(particle.showerParameters().pt)/alpha0)) +0.5*sqr(pT)*nVect.t()/pn/zFact/alpha0; Ek[1] = -nVect.t()/alpha0/pn*qperp0.x()*pT; Ek[2] = -nVect.t()/alpha0/pn*qperp0.y()*pT; Energy mag2=sqrt(sqr(Ek[1])+sqr(Ek[2])); Ei = alpha0*pVect.t()+beta0*nVect.t(); Ej = pj.t(); aziMax = 0.5/pik/(Ek[0]-mag2)*(Ei-m12*(Ek[0]-mag2)/pik + pipj*(Ek[0]+mag2)/(pjk[0]-mag) - Ej*pik/(pjk[0]-mag) ); } else assert(ShowerHandler::currentHandler()->evolver()->softCorrelations()==0); // generate the azimuthal angle double phi,wgt(0.); unsigned int ntry(0); double phiMax(0.),wgtMax(0.); do { phi = Constants::twopi*UseRandom::rnd(); Energy2 dot = pjk[0]+pjk[1]*cos(phi)+pjk[2]*sin(phi); if(ShowerHandler::currentHandler()->evolver()->softCorrelations()==1) { wgt = (-m12/sqr(pik) -m22/sqr(dot) +2.*pipj/pik/dot)/aziMax; } else if(ShowerHandler::currentHandler()->evolver()->softCorrelations()==2) { if(qperp0.m2()==ZERO) { wgt = 1.; } else { Energy Eg = Ek[0]+Ek[1]*cos(phi)+Ek[2]*sin(phi); wgt = max(ZERO,0.5/pik/Eg*(Ei-m12*Eg/pik + (pipj*Eg - Ej*pik)/dot)/aziMax); } } if(wgt-1.>1e-10||wgt<-1e-10) { generator()->log() << "Decay soft weight problem " << wgt << " " << wgt-1. - << " " << ids[0] << " " << ids[1] << " " << ids[2] << " " << " " << phi << "\n"; + << " " << ids[0]->id() << " " << ids[1]->id() << " " << ids[2]->id() << " " << " " << phi << "\n"; } if(wgt>wgtMax) { phiMax = phi; wgtMax = wgt; } ++ntry; } while(wgtlog() << "Too many tries to generate phi\n"; } // return the azimuthal angle return phi; } Energy QTildeSudakov::calculateScale(double zin, Energy pt, IdList ids, unsigned int iopt) { Energy2 tmin; - initialize(ids,tmin,false); + initialize(ids,tmin); // final-state branching if(iopt==0) { Energy2 scale=(sqr(pt)+masssquared_[1]*(1.-zin)+masssquared_[2]*zin); - if(ids[0]!=ParticleID::g) scale -= zin*(1.-zin)*masssquared_[0]; + if(ids[0]->id()!=ParticleID::g) scale -= zin*(1.-zin)*masssquared_[0]; scale /= sqr(zin*(1-zin)); return scale<=ZERO ? sqrt(tmin) : sqrt(scale); } else if(iopt==1) { Energy2 scale=(sqr(pt)+zin*masssquared_[2])/sqr(1.-zin); return scale<=ZERO ? sqrt(tmin) : sqrt(scale); } else if(iopt==2) { Energy2 scale = (sqr(pt)+zin*masssquared_[2])/sqr(1.-zin)+masssquared_[0]; return scale<=ZERO ? sqrt(tmin) : sqrt(scale); } else { throw Exception() << "Unknown option in QTildeSudakov::calculateScale() " << "iopt = " << iopt << Exception::runerror; } } ShoKinPtr QTildeSudakov::createFinalStateBranching(Energy scale,double z, double phi, Energy pt) { ShoKinPtr showerKin = new_ptr(FS_QTildeShowerKinematics1to2()); showerKin->scale(scale); showerKin->z(z); showerKin->phi(phi); showerKin->pT(pt); showerKin->SudakovFormFactor(this); return showerKin; } ShoKinPtr QTildeSudakov::createInitialStateBranching(Energy scale,double z, double phi, Energy pt) { ShoKinPtr showerKin = new_ptr(IS_QTildeShowerKinematics1to2()); showerKin->scale(scale); showerKin->z(z); showerKin->phi(phi); showerKin->pT(pt); showerKin->SudakovFormFactor(this); return showerKin; } ShoKinPtr QTildeSudakov::createDecayBranching(Energy scale,double z, double phi, Energy pt) { ShoKinPtr showerKin = new_ptr(Decay_QTildeShowerKinematics1to2()); showerKin->scale(scale); showerKin->z(z); showerKin->phi(phi); showerKin->pT(pt); showerKin->SudakovFormFactor(this); return showerKin; } diff --git a/Shower/Default/QTildeSudakov.h b/Shower/Default/QTildeSudakov.h --- a/Shower/Default/QTildeSudakov.h +++ b/Shower/Default/QTildeSudakov.h @@ -1,294 +1,287 @@ // -*- C++ -*- // // QTildeSudakov.h is a part of Herwig - A multi-purpose Monte Carlo event generator // Copyright (C) 2002-2011 The Herwig Collaboration // // Herwig is licenced under version 2 of the GPL, see COPYING for details. // Please respect the MCnet academic guidelines, see GUIDELINES for details. // #ifndef HERWIG_QTildeSudakov_H #define HERWIG_QTildeSudakov_H // // This is the declaration of the QTildeSudakov class. // #include "Herwig/Shower/Base/SudakovFormFactor.h" namespace Herwig { using namespace ThePEG; /** \ingroup Shower * * The QTildeSudakov class implements the Sudakov form factor for evolution in * \f$\tilde{q}^2\f$ using the veto algorithm. * * @see \ref QTildeSudakovInterfaces "The interfaces" * defined for QTildeSudakov. */ class QTildeSudakov: public SudakovFormFactor { public: /** * The default constructor. */ inline QTildeSudakov() {} /** * Members to generate the scale of the next branching */ //@{ /** * Return the scale of the next time-like branching. If there is no * branching then it returns ZERO. * @param startingScale starting scale for the evolution * @param ids The PDG codes of the particles in the splitting - * @param cc Whether this is the charge conjugate of the branching - * defined. * @param enhance The radiation enhancement factor * @param maxQ2 The maximum \f$Q^2\f$ for the emission */ virtual ShoKinPtr generateNextTimeBranching(const Energy startingScale, - const IdList &ids,const bool cc, + const IdList &ids, const RhoDMatrix & rho, double enhance, Energy2 maxQ2); /** * Return the scale of the next space-like decay branching. If there is no * branching then it returns ZERO. * @param startingScale starting scale for the evolution * @param stoppingScale stopping scale for the evolution * @param minmass The minimum mass allowed for the spake-like particle. * @param ids The PDG codes of the particles in the splitting - * @param cc Whether this is the charge conjugate of the branching * defined. * @param enhance The radiation enhancement factor */ virtual ShoKinPtr generateNextDecayBranching(const Energy startingScale, const Energy stoppingScale, const Energy minmass, const IdList &ids, - const bool cc, const RhoDMatrix & rho, double enhance); /** * Return the scale of the next space-like branching. If there is no * branching then it returns ZERO. * @param startingScale starting scale for the evolution * @param ids The PDG codes of the particles in the splitting * @param x The fraction of the beam momentum - * @param cc Whether this is the charge conjugate of the branching * defined. * @param enhance The radiation enhancement factor * @param beam The beam particle */ virtual ShoKinPtr generateNextSpaceBranching(const Energy startingScale, const IdList &ids,double x, - const bool cc, const RhoDMatrix & rho, double enhance, tcBeamPtr beam); //@} /** * Generate the azimuthal angle of the branching for forward branching * @param particle The branching particle * @param ids The PDG codes of the particles in the branchings * @param The Shower kinematics */ virtual double generatePhiForward(ShowerParticle & particle,const IdList & ids, ShoKinPtr kinematics, const RhoDMatrix & rho); /** * Generate the azimuthal angle of the branching for backward branching * @param particle The branching particle * @param ids The PDG codes of the particles in the branchings * @param The Shower kinematics */ virtual double generatePhiBackward(ShowerParticle & particle,const IdList & ids, ShoKinPtr kinematics, const RhoDMatrix & rho); /** * Generate the azimuthal angle of the branching for ISR in decays * @param particle The branching particle * @param ids The PDG codes of the particles in the branchings * @param The Shower kinematics */ virtual double generatePhiDecay(ShowerParticle & particle,const IdList & ids, ShoKinPtr kinematics, const RhoDMatrix & rho); /** * Method to return the evolution scale given the * transverse momentum, \f$p_T\f$ and \f$z\f$. */ virtual Energy calculateScale(double z, Energy pt, IdList ids,unsigned int iopt); /** * Method to create the ShowerKinematics object for a final-state branching */ virtual ShoKinPtr createFinalStateBranching(Energy scale,double z, double phi, Energy pt); /** * Method to create the ShowerKinematics object for an initial-state branching */ virtual ShoKinPtr createInitialStateBranching(Energy scale,double z, double phi, Energy pt); /** * Method to create the ShowerKinematics object for a decay branching */ virtual ShoKinPtr createDecayBranching(Energy scale,double z, double phi, Energy pt); public: /** @name Functions used by the persistent I/O system. */ //@{ /** * Function used to write out object persistently. * @param os the persistent output stream written to. */ void persistentOutput(PersistentOStream & os) const; /** * Function used to read in object persistently. * @param is the persistent input stream read from. * @param version the version number of the object when written. */ void persistentInput(PersistentIStream & is, int version); //@} /** * The standard Init function used to initialize the interfaces. * Called exactly once for each class by the class description system * before the main function starts or * when this class is dynamically loaded. */ static void Init(); protected: /** * Methods to provide the next value of the scale before the vetos * are applied. */ //@{ /** * Value of the energy fraction and scale for time-like branching * @param t The scale * @param tmin The minimum scale * @param enhance The radiation enhancement factor * @return False if scale less than minimum, true otherwise */ bool guessTimeLike(Energy2 &t, Energy2 tmin, double enhance); /** * Value of the energy fraction and scale for time-like branching * @param t The scale * @param tmax The maximum scale * @param minmass The minimum mass of the particle after the branching * @param enhance The radiation enhancement factor */ bool guessDecay(Energy2 &t, Energy2 tmax,Energy minmass, double enhance); /** * Value of the energy fraction and scale for space-like branching * @param t The scale * @param tmin The minimum scale * @param x Fraction of the beam momentum. * @param enhance The radiation enhancement factor */ bool guessSpaceLike(Energy2 &t, Energy2 tmin, const double x, double enhance); //@} /** * Initialize the values of the cut-offs and scales * @param tmin The minimum scale * @param ids The ids of the partics in the branching - * @param cc Whether this is the charge conjugate of the branching */ - void initialize(const IdList & ids,Energy2 &tmin, const bool cc); + void initialize(const IdList & ids,Energy2 &tmin); /** * Phase Space veto member to implement the \f$\Theta\f$ function as a veto * so that the emission is within the allowed phase space. * @param t The scale * @param maxQ2 The maximum virtuality * @return true if vetoed */ bool PSVeto(const Energy2 t,const Energy2 maxQ2); /** * Compute the limits on \f$z\f$ for time-like branching * @param scale The scale of the particle * @return True if lower limit less than upper, otherwise false */ bool computeTimeLikeLimits(Energy2 & scale); /** * Compute the limits on \f$z\f$ for space-like branching * @param scale The scale of the particle * @param x The energy fraction of the parton * @return True if lower limit less than upper, otherwise false */ bool computeSpaceLikeLimits(Energy2 & scale, double x); protected: /** @name Clone Methods. */ //@{ /** * Make a simple clone of this object. * @return a pointer to the new object. */ inline virtual IBPtr clone() const {return new_ptr(*this);} /** Make a clone of this object, possibly modifying the cloned object * to make it sane. * @return a pointer to the new object. */ inline virtual IBPtr fullclone() const {return new_ptr(*this);} //@} private: /** * The assignment operator is private and must never be called. * In fact, it should not even be implemented. */ QTildeSudakov & operator=(const QTildeSudakov &); private: /** * The evolution scale, \f$\tilde{q}\f$. */ Energy q_; /** * The Ids of the particles in the current branching */ IdList ids_; /** * The masses of the particles in the current branching */ vector masses_; /** * The mass squared of the particles in the current branching */ vector masssquared_; }; } #endif /* HERWIG_QTildeSudakov_H */ diff --git a/Shower/Makefile.am b/Shower/Makefile.am --- a/Shower/Makefile.am +++ b/Shower/Makefile.am @@ -1,50 +1,50 @@ SUBDIRS = Matching . pkglib_LTLIBRARIES = HwShower.la HwShower_la_LDFLAGS = $(AM_LDFLAGS) -module -version-info 20:0:0 HwShower_la_LIBADD = \ $(top_builddir)/PDF/libHwRemDecayer.la \ $(top_builddir)/PDF/libHwMPIPDF.la HwShower_la_SOURCES = \ UEBase.h UEBase.cc UEBase.fh \ Couplings/ShowerAlphaQCD.h Couplings/ShowerAlphaQCD.cc \ Couplings/ShowerAlphaQED.h Couplings/ShowerAlphaQED.cc\ ShowerHandler.h ShowerHandler.fh ShowerHandler.cc \ SplittingFunctions/HalfHalfOneSplitFn.h SplittingFunctions/HalfHalfOneSplitFn.cc\ SplittingFunctions/HalfHalfOneEWSplitFn.h SplittingFunctions/HalfHalfOneEWSplitFn.cc\ SplittingFunctions/OneOneOneSplitFn.h SplittingFunctions/OneOneOneSplitFn.cc\ SplittingFunctions/ZeroZeroOneSplitFn.h SplittingFunctions/ZeroZeroOneSplitFn.cc\ SplittingFunctions/OneHalfHalfSplitFn.h SplittingFunctions/OneHalfHalfSplitFn.cc\ SplittingFunctions/HalfOneHalfSplitFn.h SplittingFunctions/HalfOneHalfSplitFn.cc\ Default/QTildeSudakov.cc Default/QTildeSudakov.h\ Default/QTildeModel.cc Default/QTildeModel.h\ Default/Decay_QTildeShowerKinematics1to2.cc \ Default/Decay_QTildeShowerKinematics1to2.h \ Default/IS_QTildeShowerKinematics1to2.cc Default/IS_QTildeShowerKinematics1to2.h \ Default/FS_QTildeShowerKinematics1to2.cc Default/FS_QTildeShowerKinematics1to2.h \ Default/QTildeFinder.cc Default/QTildeFinder.h\ Default/QTildeReconstructor.cc Default/QTildeReconstructor.h Default/QTildeReconstructor.tcc \ Base/KinematicsReconstructor.cc \ Base/KinematicsReconstructor.h \ Base/KinematicsReconstructor.fh \ Base/ShowerModel.cc Base/ShowerModel.h Base/ShowerModel.fh \ Base/PartnerFinder.h Base/PartnerFinder.fh Base/PartnerFinder.cc \ Base/Evolver.h Base/Evolver.fh Base/Evolver.cc \ Base/ShowerVeto.h Base/ShowerVeto.fh Base/ShowerVeto.cc noinst_LTLIBRARIES = libHwShower.la -libHwShower_la_SOURCES = ShowerConfig.h \ +libHwShower_la_SOURCES = ShowerConfig.h ShowerConfig.cc \ Base/Branching.h \ Base/ShowerParticle.cc Base/ShowerParticle.fh Base/ShowerParticle.h \ Base/ShowerKinematics.fh Base/ShowerKinematics.h Base/ShowerKinematics.cc \ Base/ShowerBasis.fh Base/ShowerBasis.h Base/ShowerBasis.cc \ Base/ShowerTree.h Base/ShowerTree.fh Base/ShowerTree.cc \ Base/ShowerProgenitor.fh Base/ShowerProgenitor.h \ Base/HardTree.h Base/HardTree.fh Base/HardTree.cc\ Base/SudakovFormFactor.cc Base/SudakovFormFactor.h Base/SudakovFormFactor.fh \ Base/HardBranching.h Base/HardBranching.fh Base/HardBranching.cc\ Couplings/ShowerAlpha.h Couplings/ShowerAlpha.cc Couplings/ShowerAlpha.fh\ SplittingFunctions/SplittingGenerator.cc SplittingFunctions/SplittingGenerator.h\ SplittingFunctions/SplittingGenerator.fh \ SplittingFunctions/SplittingFunction.h SplittingFunctions/SplittingFunction.fh \ SplittingFunctions/SplittingFunction.cc \ Base/ShowerVertex.cc Base/ShowerVertex.fh Base/ShowerVertex.h diff --git a/Shower/Matching/PowhegShowerHandler.cc b/Shower/Matching/PowhegShowerHandler.cc --- a/Shower/Matching/PowhegShowerHandler.cc +++ b/Shower/Matching/PowhegShowerHandler.cc @@ -1,1115 +1,1110 @@ // -*- C++ -*- // // PowhegShowerHandler.cc is a part of Herwig - A multi-purpose Monte Carlo event generator // Copyright (C) 2002-2007 The Herwig Collaboration // // Herwig is licenced under version 2 of the GPL, see COPYING for details. // Please respect the MCnet academic guidelines, see GUIDELINES for details. // // // This is the implementation of the non-inlined, non-templated member // functions of the PowhegShowerHandler class. // #include #include "PowhegShowerHandler.h" #include "ThePEG/Interface/ClassDocumentation.h" #include "ThePEG/Interface/Reference.h" #include "ThePEG/Interface/RefVector.h" #include "ThePEG/Interface/Parameter.h" #include "ThePEG/Interface/Switch.h" #include "ThePEG/Persistency/PersistentOStream.h" #include "ThePEG/Persistency/PersistentIStream.h" #include "ThePEG/Utilities/DescribeClass.h" // include theses to have complete types #include "Herwig/Shower/Base/Evolver.h" #include "Herwig/Shower/Base/ShowerParticle.h" #include "Herwig/PDF/MPIPDF.h" #include "Herwig/PDF/MinBiasPDF.h" #include "Herwig/Shower/Base/ShowerTree.h" #include "Herwig/Shower/Base/KinematicsReconstructor.h" #include "Herwig/Shower/Base/PartnerFinder.h" #include "Herwig/PDF/HwRemDecayer.h" #include "Herwig/Shower/Base/ShowerProgenitor.h" #include "Herwig/Shower/Base/HardBranching.h" #include "Herwig/Shower/Base/HardTree.h" #include "Herwig/MatrixElement/HwMEBase.h" #include "ThePEG/MatrixElement/MEBase.h" #include "ThePEG/MatrixElement/DiagramBase.fh" #include "ThePEG/PDF/PartonExtractor.h" #include "Herwig/MatrixElement/Matchbox/MatchboxFactory.h" #include "Herwig/MatrixElement/Matchbox/Utility/DiagramDrawer.h" using namespace Herwig; namespace { struct ParticleOrdering { bool operator()(tcPDPtr p1, tcPDPtr p2) { return abs(p1->id()) > abs(p2->id()) || ( abs(p1->id()) == abs(p2->id()) && p1->id() > p2->id() ) || ( p1->id() == p2->id() && p1->fullName() > p2->fullName() ); } }; } IBPtr PowhegShowerHandler::clone() const { return new_ptr(*this); } IBPtr PowhegShowerHandler::fullclone() const { return new_ptr(*this); } HardTreePtr PowhegShowerHandler::generateCKKW(ShowerTreePtr showerTree) const { // hard subprocess tSubProPtr sub = lastXCombPtr()->subProcess(); // real emission sub-process tSubProPtr real = Factory()->hardTreeSubprocess(); // born emitter emitter_ = Factory()->hardTreeEmitter(); spectator_ = Factory()->hardTreeSpectator(); // if no hard emission return if ( !(real && emitter_>-1) ) return HardTreePtr(); // check emission if(sub->outgoing().size()>=real->outgoing().size()) return HardTreePtr(); // check if decay has radiated don't add it if(showerTree->outgoingLines().size() != sub->outgoing().size()) { // loop over the decay trees for(map >::const_iterator tit=showerTree->treelinks().begin(); tit != showerTree->treelinks().end(); ++tit) { if(tit->first->outgoingLines().empty()) continue; // match the particles set decayProducts; set outgoing(real->outgoing().begin(),real->outgoing().end()); for(map::const_iterator oit=tit->first->outgoingLines().begin(); oit!=tit->first->outgoingLines().end();++oit) { tPPtr decayProd; Energy2 dmin( 1e30*GeV2 ); tPPtr part = oit->second->original(); for( set::const_iterator it = outgoing.begin(); it != outgoing.end(); ++it ) { if((**it).id()!=part->id()) continue; Energy2 dtest = sqr( part->momentum().x() - (**it).momentum().x() ) + sqr( part->momentum().y() - (**it).momentum().y() ) + sqr( part->momentum().z() - (**it).momentum().z() ) + sqr( part->momentum().t() - (**it).momentum().t() ); dtest += 1e10*sqr(part->momentum().m()-(**it).momentum().m()); if( dtest < dmin ) { decayProd = *it; dmin = dtest; } } if(!decayProd) { throw Exception() << "PowhegShowerHandler::generateCKKW(). Can't match shower and hard trees." << Exception::eventerror; } outgoing .erase (decayProd); decayProducts.insert(decayProd); } bool coloured = false, foundParent = true; tPPtr parent,emitted; unsigned int nprod(0); for( set::const_iterator it = decayProducts.begin(); it != decayProducts.end(); ++it ) { coloured |= (**it).dataPtr()->coloured(); tPPtr newParent = !(**it).parents().empty() ? (**it).parents()[0] : tPPtr(); ++nprod; // check if from emission if(newParent->id()==(**it).id()) { if(newParent->children().size()!=2) foundParent=false; bool foundChild(false), foundGluon(false); for(unsigned int ix=0;ixchildren().size();++ix) { if(newParent->children()[ix]==*it) { foundChild = true; continue; } else if(newParent->children()[ix]->id()==ParticleID::g) { foundGluon = true; continue; } } if(foundChild && foundGluon) { newParent = !newParent->parents().empty() ? newParent->parents()[0] : tPPtr(); ++nprod; } else foundParent = false; } if(!newParent) { foundParent = false; } else if(!parent) { parent = newParent; } else { if(parent!=newParent) foundParent = false; } } if(nprod!=tit->first->outgoingLines().size()&&foundParent) { if(decayRadiation_==0) { throw Exception() << "The radiation generated in this event\n " << *real << "\n has been interepted as occuring in the " << "decay \nof a colour-singlet object and cannot be handled " << "you can either not simulated this process, " << "veto this class of events by using\n" << "set " << fullName() << ":DecayRadiation VetoEvent\n" << "or throw the hard radiation away using \n" << "set " << fullName() << ":DecayRadiation VetoRadiation\n" << "Please contact us at herwig@hepforge.org for advice\n" << "on how to simulate this process\n" << Exception::runerror; } else if(decayRadiation_==1) { throw Exception() << "The radiation generated in this event\n " << *real << "\n has been interepted as occuring in the " << "decay \nof a colour-singlet object and cannot be handled " << "vetoing event\n" << Exception::eventerror; } else if(decayRadiation_==2) { generator()->log() << "The radiation generated in this event\n " << *real << "\n has been interepted as occuring in the " << "decay \nof a colour-singlet object and cannot be handled " << "vetoing radiation\n"; return HardTreePtr(); } else assert(false); } } } tStdXCombPtr lastXC = dynamic_ptr_cast(lastXCombPtr()); tStdXCombPtr headXC = lastXC->head(); if (headXC) matrixElement_ = dynamic_ptr_cast(headXC->matrixElement()); else if (lastXC) matrixElement_ = dynamic_ptr_cast(lastXC->matrixElement()); if (lastXC){ tStdXCombPtr projector= lastXC->lastProjector(); if (projector){ matrixElement_ = dynamic_ptr_cast(projector->matrixElement()); setSubtractionIntegral(true); } else setSubtractionIntegral(false); } assert(matrixElement_); // create a hard tree by clustering the event try { hardTree(doClustering(real,showerTree)); } catch(exception &e) { throw Exception() << "Caught a problem in PowhegShowerHandler::doClustering " << e.what() << Exception::eventerror; } // Get the HardTree from the CKKW handler. CKKWTreePtr hardtree = hardTree().tree(); // zero to avoid MPI problems Factory()->setHardTreeEmitter(-1); Factory()->setHardTreeSubprocess(SubProPtr()); return hardtree; } PotentialTree PowhegShowerHandler::doClustering(tSubProPtr real,ShowerTreePtr showerTree) const { // clear storage of the protoTrees protoBranchings().clear(); protoTrees().clear(); hardTrees_.clear(); assert( matrixElement() ); // extract the XComb for the Born process tStdXCombPtr lastXC; if (subtractionIntegral()){ tStdXCombPtr lastXCReal = dynamic_ptr_cast(lastXCombPtr()); lastXC = lastXCReal->lastProjector(); } else lastXC = dynamic_ptr_cast(lastXCombPtr()); const StandardXComb xc= *lastXC; // get the particles for the born process PPair incomingBorn = xc.subProcess()->incoming(); ParticleVector outgoingBorn = xc.subProcess()->outgoing(); // get particles from the XComb object for the real process ParticleVector outgoing = real->outgoing(); PPair incoming = real->incoming(); // loop through the FS particles and create ProtoBranchings for( unsigned int i = 0; i < outgoing.size(); ++i) { tPPtr parent = outgoing[i]->parents()[0]; ProtoBranchingPtr currentBranching = new_ptr(ProtoBranching(outgoing[i]->dataPtr(),HardBranching::Outgoing, outgoing[i]->momentum(),tSudakovPtr())); currentBranching-> colourLine(outgoing[i]-> colourLine()); currentBranching->antiColourLine(outgoing[i]->antiColourLine()); protoBranchings().insert(currentBranching); } // add IS hardBranchings ProtoBranchingPtr currentBranching = new_ptr(ProtoBranching(incoming.first ->dataPtr(),HardBranching::Incoming, incoming.first ->momentum(),tSudakovPtr())); currentBranching-> colourLine(incoming.first-> colourLine()); currentBranching->antiColourLine(incoming.first->antiColourLine()); protoBranchings().insert(currentBranching); currentBranching = new_ptr(ProtoBranching(incoming.second->dataPtr(),HardBranching::Incoming, incoming.second->momentum(),tSudakovPtr())); currentBranching-> colourLine(incoming.second-> colourLine()); currentBranching->antiColourLine(incoming.second->antiColourLine()); protoBranchings().insert(currentBranching); // create and initialise the first tree ProtoTreePtr initialProtoTree = new_ptr( ProtoTree() ); for(set::const_iterator it=protoBranchings().begin(); it!=protoBranchings().end();++it) { initialProtoTree->addBranching(*it); } // fill _proto_trees with all possible trees protoTrees().insert(initialProtoTree ); fillProtoTrees( initialProtoTree , xc.mePartonData()[emitter_]->id() ); // create a HardTree from each ProtoTree and fill hardTrees() for( set< ProtoTreePtr >::const_iterator cit = protoTrees().begin(); cit != protoTrees().end(); ++cit ) { set bornParticles(outgoingBorn.begin(),outgoingBorn.end()); bornParticles.insert(incomingBorn.first ); bornParticles.insert(incomingBorn.second); PotentialTree newTree; newTree.tree((**cit).createHardTree()); // new check based on the colour structure map cmap; // make the colour connections in the tree ShowerParticleVector branchingParticles; map branchingMap; bool matched(true); int iemitter(-1); HardBranchingPtr emitter; map locMap; for( set< HardBranchingPtr >::iterator it = newTree.tree()->branchings().begin(); it != newTree.tree()->branchings().end(); ++it ) { matched = true; // map the particle to the branching for future use branchingParticles.push_back((**it).branchingParticle()); branchingMap.insert(make_pair((**it).branchingParticle(),*it)); tPPtr bornPartner; if((**it).status()==HardBranching::Incoming) { HardBranchingPtr parent=*it; while(parent->parent()) { parent = parent->parent(); }; if(parent->branchingParticle()->momentum().z()/incomingBorn.first->momentum().z()>0.) { bornPartner = incomingBorn.first; if(!parent->children().empty()) { iemitter = 0; emitter = *it; } locMap[0] = *it; } else { bornPartner = incomingBorn.second; if(!parent->children().empty()) { iemitter = 1; emitter = *it; } locMap[1] = *it; } } else { Energy2 dmin( 1e30*GeV2 ); for(set::const_iterator bit=bornParticles.begin();bit!=bornParticles.end(); ++bit) { if((**it).branchingParticle()->id()!=(**bit).id()) continue; if(*bit==incomingBorn.first||*bit==incomingBorn.second) continue; Energy2 dtest = sqr( (**bit).momentum().x() - (**it).branchingParticle()->momentum().x() ) + sqr( (**bit).momentum().y() - (**it).branchingParticle()->momentum().y() ) + sqr( (**bit).momentum().z() - (**it).branchingParticle()->momentum().z() ) + sqr( (**bit).momentum().t() - (**it).branchingParticle()->momentum().t() ); dtest += 1e10*sqr((**bit).momentum().m()-(**it).branchingParticle()->momentum().m()); if( dtest < dmin ) { bornPartner = *bit; dmin = dtest; } } // find the map int iloc(-1); for(unsigned int ix=0;ixcolourLine()) { if(cmap.find((**it).branchingParticle()->colourLine())!=cmap.end()) { if(cmap[(**it).branchingParticle()->colourLine()]!=bornPartner->colourLine()) { matched=false; } } else { cmap[(**it).branchingParticle()->colourLine()] = bornPartner->colourLine(); } } if((**it).branchingParticle()->antiColourLine()) { if(cmap.find((**it).branchingParticle()->antiColourLine())!=cmap.end()) { if(cmap[(**it).branchingParticle()->antiColourLine()]!=bornPartner->antiColourLine()) { matched=false; } } else { cmap[(**it).branchingParticle()->antiColourLine()] = bornPartner->antiColourLine(); } } // require a match if(!matched) break; } // if no match continue if(!matched) continue; // now sort out any decays if(showerTree->outgoingLines().size()+showerTree->incomingLines().size() != newTree.tree()->branchings().size()) { if(showerTree->treelinks().empty()) { matched = false; continue; } // loop over the decay trees for(map >::const_iterator tit=showerTree->treelinks().begin(); tit != showerTree->treelinks().end(); ++tit) { if(tit->first->outgoingLines().empty()) continue; set decayProducts; set branchings = newTree.tree()->branchings(); // match the particles for(map::const_iterator oit=tit->first->outgoingLines().begin(); oit!=tit->first->outgoingLines().end();++oit) { HardBranchingPtr decayProd; Energy2 dmin( 1e30*GeV2 ); tPPtr part = oit->second->original(); for( set< HardBranchingPtr >::iterator it = branchings.begin(); it != branchings.end(); ++it ) { if((**it).status()==HardBranching::Incoming ) continue; if((**it).branchingParticle()->id()!=part->id()) continue; Energy2 dtest = sqr( part->momentum().x() - (**it).branchingParticle()->momentum().x() ) + sqr( part->momentum().y() - (**it).branchingParticle()->momentum().y() ) + sqr( part->momentum().z() - (**it).branchingParticle()->momentum().z() ) + sqr( part->momentum().t() - (**it).branchingParticle()->momentum().t() ); dtest += 1e10*sqr(part->momentum().m()-(**it).branchingParticle()->momentum().m()); if( dtest < dmin ) { decayProd = *it; dmin = dtest; } } if(!decayProd) { throw Exception() << "PowhegShowerHandler::generateCKKW(). Can't match shower and hard trees." << Exception::eventerror; } branchings .erase (decayProd); decayProducts.insert(decayProd); } // erase the decay products Lorentz5Momentum pnew,pshower; for(set::iterator it = decayProducts.begin(); it!=decayProducts.end(); ++it) { newTree.tree()->branchings().erase(*it); pnew += (**it).branchingParticle()->momentum(); pshower += (**it).showerMomentum(); } pnew .setMass(tit->second.second->mass()); pshower.setMass(tit->second.second->mass()); pnew .rescaleEnergy(); pshower.rescaleEnergy(); // create the decaying particle ShowerParticlePtr particle = new_ptr( ShowerParticle( tit->second.second->dataPtr() , true ) ); particle->set5Momentum( pnew ); HardBranchingPtr newBranch = new_ptr( HardBranching( particle, tSudakovPtr(), HardBranchingPtr(), HardBranching::Outgoing ) ); newBranch->showerMomentum(pshower); newTree.tree()->branchings().insert(newBranch); } } // if no match continue if(!matched) continue; // find the colour partners try { evolver()->showerModel()->partnerFinder() ->setInitialEvolutionScales(branchingParticles,false, ShowerInteraction::QCD,true); } catch( Exception & e ) { generator()->log() << "Problem in set evolution scales in " << "PowhegShowerHandler::doClustering(). Exception was" << e.what(); continue; } for(unsigned int ix=0;ixpartner()) { HardBranchingPtr partner = branchingMap[branchingParticles[ix]->partner()]; branchingMap[branchingParticles[ix]]->colourPartner(partner); } } if(forcePartners_) { locMap[emitter_ ]->colourPartner(locMap[spectator_]); locMap[spectator_]->colourPartner(locMap[emitter_ ]); locMap[emitter_ ]->branchingParticle()->partner(locMap[spectator_]->branchingParticle()); locMap[spectator_]->branchingParticle()->partner(locMap[emitter_ ]->branchingParticle()); } newTree.tree()->partnersSet(true); // set the beam particles PPair beams = lastXCombPtr()->lastParticles(); // remove children of beams PVector beam_children = beams.first->children(); if( (**newTree.tree()->incoming().begin()).branchingParticle()->momentum().z() / beams.first->momentum().z() < 0.) swap( beams.first, beams.second ); set::iterator it = newTree.tree()->incoming().begin(); HardBranchingPtr br = *it; br->beam( beams.first ); while ( !br->children().empty() ) { for(unsigned int ix = 0; ix < br->children().size(); ++ix ) { if( br->children()[ix]->status() == HardBranching::Incoming ) { br = br->children()[ix]; break; } } br->beam( beams.first ); } ++it; br = *it; br->beam( beams.second ); while ( !br->children().empty() ) { for( unsigned int ix = 0; ix < br->children().size(); ++ix ) { if( br->children()[ix]->status() == HardBranching::Incoming ) { br = br->children()[ix]; break; } } br->beam( beams.second ); } // check the emitter and the spectator some how if(iemitter!=emitter_) continue; //do inverse momentum reconstruction if( !evolver()->showerModel()->kinematicsReconstructor() ->deconstructHardJets( newTree.tree(), evolver(), ShowerInteraction::QCD ) ) continue; newTree.tree()->findNodes(); newTree.weight(1.); hardTrees_.push_back( make_pair( newTree, 1. ) ); } // select the tree PotentialTree chosen_hardTree; if (hardTrees_.size()==1) { chosen_hardTree = hardTrees_[0].first; } else { // if multiple trees pick the one with matching // intermediate particle momenta for (unsigned int il=0; il > particles; PotentialTree testTree = hardTrees_[il].first; CKKWTreePtr check = testTree.tree(); // get id and momenta of particles in hard tree for (set< HardBranchingPtr >::iterator it=check->branchings().begin(); it!=check->branchings().end(); ++it) { particles.push_back(make_pair((*it)->branchingParticle()->id(), (*it)->branchingParticle()->momentum())); if (!(*it)->children().empty()){ for (unsigned int ic=0; ic<(*it)->children().size(); ++ic) particles.push_back(make_pair((*it)->children()[ic]->branchingParticle()->id(), (*it)->children()[ic]->branchingParticle()->momentum())); } if ((*it)->parent()){ particles.push_back(make_pair((*it)->parent()->branchingParticle()->id(), (*it)->parent()->branchingParticle()->momentum())); if (!(*it)->parent()->children().empty()) { for (unsigned int ic=0; ic<(*it)->parent()->children().size(); ++ic) { if(*it==(*it)->parent()->children()[ic]) continue; particles.push_back(make_pair((*it)->parent()->children()[ic]->branchingParticle()->id(), (*it)->parent()->children()[ic]->branchingParticle()->momentum())); } } } } // loop through and match to particles in real subprocess vector >::iterator part = particles.begin(); // incoming for (; part!=particles.end(); ++part){ if ((*part).first==real->incoming().first->id() && fuzzyEqual((*part).second, real->incoming().first->momentum())) break; } if (part!=particles.end()) particles.erase(part); part = particles.begin(); for (; part!=particles.end(); ++part){ if ((*part).first==real->incoming().second->id() && fuzzyEqual((*part).second, real->incoming().second->momentum())) break; } if (part!=particles.end()) particles.erase(part); // outgoing for (unsigned int io=0; iooutgoing().size(); ++io){ part = particles.begin(); for (; part!=particles.end(); ++part){ if ((*part).first==real->outgoing()[io]->id() && fuzzyEqual((*part).second, real->outgoing()[io]->momentum())) break; } if (part!=particles.end()) particles.erase(part); } // intermediate for (unsigned int ii=0; iiintermediates().size(); ++ii){ part = particles.begin(); for (; part!=particles.end(); ++part){ if ((*part).first==real->intermediates()[ii]->id() && fuzzyEqual((*part).second, real->intermediates()[ii]->momentum())) break; } if (part!=particles.end()) particles.erase(part); } // intermediate CC with -1*momentum for (unsigned int ii=0; iiintermediates().size(); ++ii){ part = particles.begin(); for (; part!=particles.end(); ++part){ if (!real->intermediates()[ii]->coloured() || (real->intermediates()[ii]->hasColour() && real->intermediates()[ii]->hasAntiColour())){ if ((*part).first==real->intermediates()[ii]->id() && fuzzyEqual((*part).second, -1.*real->intermediates()[ii]->momentum()) ) break; } else { if ((*part).first==-1.*real->intermediates()[ii]->id() && fuzzyEqual((*part).second, -1.*real->intermediates()[ii]->momentum()) ) break; } } if (part!=particles.end()) particles.erase(part); } // if all particles match, set as hardtree if (particles.empty()){ chosen_hardTree = testTree; break; } } } protoBranchings().clear(); protoTrees().clear(); hardTrees_.clear(); if(! chosen_hardTree.tree() ) { return PotentialTree(); } else return chosen_hardTree; } bool PowhegShowerHandler::checkDiagram(PotentialTree & tree, tcDiagPtr loDiagram) const { set::const_iterator cit; tcPDPair incoming; multiset outgoing; //get the incoming and outgoing partons involved in hard process for( cit = tree.tree()->branchings().begin(); cit != tree.tree()->branchings().end(); ++cit ){ if( (*cit)->status() ==HardBranching::Incoming) { HardBranchingPtr parent = *cit; while(parent->parent()) parent = parent->parent(); if( parent->branchingParticle()->momentum().z()>ZERO ) incoming.first = (*cit)->branchingParticle()->dataPtr(); else incoming.second = (*cit)->branchingParticle()->dataPtr(); } else { outgoing.insert( (*cit)->branchingParticle()->dataPtr() ); } } if(!incoming.first || !incoming.second) return 0.; pair tag; tag.first = incoming.first ->PDGName() + "," + incoming.second->PDGName() + "->"; tag.second = incoming.second ->PDGName() + "," + incoming.first ->PDGName() + "->"; string tag_out; for ( multiset::iterator i = outgoing.begin(); i != outgoing.end(); ++i ) { if ( i != outgoing.begin() ) tag_out += ","; tag_out += (**i).PDGName(); } tag.first += tag_out; tag.second += tag_out; // find the diagrams if( tag.first == loDiagram->getTag() || tag.second == loDiagram->getTag() ) tree.diagram(loDiagram); // check this is allowed return tree.diagram(); } void PowhegShowerHandler::fillProtoTrees( ProtoTreePtr currentProtoTree,long id ) const { if(currentProtoTree->branchings().size()==(lastXCombPtr()->subProcess()->outgoing().size()+2)) return; for( set::const_iterator ita = currentProtoTree->branchings().begin(); ita!=currentProtoTree->branchings().end();++ita) { for( set::const_iterator itb = currentProtoTree->branchings().begin(); itb!=ita;++itb) { // can't merge two incoming branchings if( (**ita).status() == HardBranching::Incoming && (**itb).status() == HardBranching::Incoming ) continue; // if branching must be outgoing, skip incoming if(emitter_>=2 && ( (**ita).status() == HardBranching::Incoming || (**itb).status() == HardBranching::Incoming )) continue; // if branching must be incoming, skip outgoing if(emitter_<2 && ( (**ita).status() != HardBranching::Incoming && (**itb).status() != HardBranching::Incoming )) continue; // get a new branching for this pair ProtoBranchingPtr currentBranching = getCluster(*ita,*itb); // check branching with the right PID if( ! currentBranching || currentBranching->id() != id) continue; // branching allowed so make a new Tree out of these branchings set< tProtoBranchingPtr > newTreeBranchings = currentProtoTree->branchings(); newTreeBranchings.erase(*ita); newTreeBranchings.erase(*itb); newTreeBranchings.insert(currentBranching); ProtoTreePtr newProtoTree = new_ptr( ProtoTree( newTreeBranchings ) ); // remove duplicate trees if( ! repeatProtoTree( newProtoTree ) ) protoTrees().insert( newProtoTree ); // remove the current tree if it hasn't already been removed if( protoTrees().find( currentProtoTree ) != protoTrees().end() ) protoTrees().erase( currentProtoTree ); // do recursion fillProtoTrees( newProtoTree , id); } } } bool PowhegShowerHandler::repeatProtoTree( ProtoTreePtr currentProtoTree ) const { // loop over all prototrees and see // how many ProtoBranchings of current ProtoTree are found in each for( set< ProtoTreePtr >::const_iterator cit = protoTrees().begin(); cit != protoTrees().end(); ++cit ) { unsigned int no_matches = 0; for( set< tProtoBranchingPtr >::const_iterator ckt = currentProtoTree->branchings().begin(); ckt != currentProtoTree->branchings().end(); ckt++ ) { if( (*cit)->branchings().find( *ckt ) != (*cit)->branchings().end() ) ++no_matches; } // return true if all match if( no_matches == currentProtoTree->branchings().size() ) return true; } return false; } tProtoBranchingPtr PowhegShowerHandler::getCluster( tProtoBranchingPtr b1, tProtoBranchingPtr b2 ) const { // look for the clustered pair in protoBranchings_ for(set::const_iterator cit = protoBranchings().begin(); cit != protoBranchings().end(); ++cit) { // both outgoing if(b1->status()==HardBranching::Outgoing && b2->status()==HardBranching::Outgoing) { if((**cit).status()!=HardBranching::Outgoing|| (**cit).children().empty()) continue; if( ( b1 == (**cit).children()[0] && b2 == (**cit).children()[1] ) || ( b1 == (**cit).children()[1] && b2 == (**cit).children()[0] ) ) return *cit; } // first incoming else if(b1->status()==HardBranching::Incoming) { if((**cit).backChildren().empty() ) continue; if(b1!=(**cit).backChildren()[0]) continue; if(b2==(**cit).backChildren()[1]) return *cit; } // second incoming else if(b2->status()==HardBranching::Incoming) { if((**cit).backChildren().empty() ) continue; if(b2!=(**cit).backChildren()[0]) continue; if(b1==(**cit).backChildren()[1]) return *cit; } } // is branching incoming or outgoing bool incoming = b1->status()==HardBranching::Incoming || b2->status()==HardBranching::Incoming; // get the branching BranchingElement theBranching; if( !incoming ) theBranching = allowedFinalStateBranching( b1, b2 ); else theBranching = allowedInitialStateBranching( b1, b2 ); //if branching is not allowed return null ProtoBrancing - if( !theBranching.first ) - return ProtoBranchingPtr(); + if( !theBranching.sudakov ) return ProtoBranchingPtr(); // get the ParticleData object for the new branching - tcPDPtr particle_data = incoming ? - getParticleData( theBranching.second[1] ) : getParticleData( theBranching.second[0] ); + tcPDPtr particle_data = incoming ? theBranching.particles[1] : theBranching.particles[0]; // create clustered ProtoBranching ProtoBranchingPtr clusteredBranch; // outgoing if( !incoming ) { Lorentz5Momentum pairMomentum = b1->momentum() + b2->momentum(); pairMomentum.setMass(ZERO); clusteredBranch = new_ptr(ProtoBranching(particle_data,HardBranching::Outgoing, - pairMomentum, theBranching.first)); + pairMomentum, theBranching.sudakov)); if(particle_data->iColour()==PDT::Colour0) return ProtoBranchingPtr(); else if(particle_data->iColour()==PDT::Colour3) { if(b1->particle()->iColour()==PDT::Colour3 && b2->particle()->iColour()==PDT::Colour8) { if(b1->colourLine()!=b2->antiColourLine()) return ProtoBranchingPtr(); clusteredBranch->colourLine(b2->colourLine()); } else if(b2->particle()->iColour()==PDT::Colour3 && b1->particle()->iColour()==PDT::Colour8) { if(b2->colourLine()!=b1->antiColourLine()) return ProtoBranchingPtr(); clusteredBranch->antiColourLine(b1->colourLine()); } else assert(false); clusteredBranch->type(ShowerPartnerType::QCDColourLine); } else if(particle_data->iColour()==PDT::Colour3bar) { if(b1->particle()->iColour()==PDT::Colour3bar && b2->particle()->iColour()==PDT::Colour8) { if(b1->antiColourLine()!=b2->colourLine()) return ProtoBranchingPtr(); clusteredBranch->antiColourLine(b2->antiColourLine()); } else if(b2->particle()->iColour()==PDT::Colour3bar && b1->particle()->iColour()==PDT::Colour8) { if(b2->antiColourLine()!=b1->colourLine()) return ProtoBranchingPtr(); clusteredBranch->antiColourLine(b1->antiColourLine()); } else assert(false); clusteredBranch->type(ShowerPartnerType::QCDAntiColourLine); } else if(particle_data->iColour()==PDT::Colour8) { tProtoBranchingPtr coloured,antiColoured; if(b1->particle()->iColour()==PDT::Colour3 && b2->particle()->iColour()==PDT::Colour3bar) { coloured = b1; antiColoured = b2; } else if(b2->particle()->iColour()==PDT::Colour3 && b1->particle()->iColour()==PDT::Colour3bar) { coloured = b2; antiColoured = b1; } else if(b1->particle()->iColour()==PDT::Colour8 && b2->particle()->iColour()==PDT::Colour8 ) { if(b1->colourLine()==b2->antiColourLine()) { coloured = b2; antiColoured = b1; } else if(b2->colourLine()==b1->antiColourLine()) { coloured = b1; antiColoured = b2; } else return ProtoBranchingPtr(); } else assert(false); // can't have colour self connected gluons if(coloured-> colourLine()==antiColoured->antiColourLine()) return ProtoBranchingPtr(); clusteredBranch-> colourLine( coloured-> colourLine()); clusteredBranch->antiColourLine(antiColoured->antiColourLine()); // softest particle is the emitted if(coloured->momentum().t()>antiColoured->momentum().t()) { clusteredBranch->type(ShowerPartnerType::QCDAntiColourLine); } else { clusteredBranch->type(ShowerPartnerType::QCDColourLine); } } else assert(false); } // incoming else { Lorentz5Momentum pairMomentum = b1->momentum() - b2->momentum(); pairMomentum.setMass( ZERO ); // check for CC if( particle_data->CC() && - ( b1->id() != theBranching.second[0] || - b2->id() != theBranching.second[2] ) ) { + ( b1->id() != theBranching.particles[0]->id() || + b2->id() != theBranching.particles[2]->id() ) ) { particle_data = particle_data->CC(); } clusteredBranch = new_ptr(ProtoBranching(particle_data,HardBranching::Incoming, - pairMomentum,theBranching.first)); + pairMomentum,theBranching.sudakov)); // work out the type of branching if(b1->particle()->iColour()==PDT::Colour3) { b1->type(ShowerPartnerType::QCDColourLine); if(b2->particle()->iColour()==PDT::Colour3 && particle_data->iColour()==PDT::Colour8) { if(b1->colourLine()==b2->colourLine()) return ProtoBranchingPtr(); clusteredBranch-> colourLine(b1->colourLine()); clusteredBranch->antiColourLine(b2->colourLine()); } else if(b2->particle()->iColour()==PDT::Colour8 && particle_data->iColour()==PDT::Colour3) { if(b1->colourLine()!=b2->colourLine()) return ProtoBranchingPtr(); clusteredBranch->colourLine(b2->antiColourLine()); } else assert(false); } else if(b1->particle()->iColour()==PDT::Colour3bar) { b1->type(ShowerPartnerType::QCDAntiColourLine); if(b2->particle()->iColour()==PDT::Colour3bar && particle_data->iColour()==PDT::Colour8) { if(b1->antiColourLine()==b2->antiColourLine()) return ProtoBranchingPtr(); clusteredBranch-> colourLine(b2->antiColourLine()); clusteredBranch->antiColourLine(b1->antiColourLine()); } else if(b2->particle()->iColour()==PDT::Colour8 && particle_data->iColour()==PDT::Colour3bar) { if(b1->antiColourLine()!=b2->antiColourLine()) return ProtoBranchingPtr(); clusteredBranch->antiColourLine(b2->colourLine()); } else assert(false); } else if(b1->particle()->iColour()==PDT::Colour8) { if(b2->particle()->iColour()==PDT::Colour3) { if(b1->colourLine()!=b2->colourLine()) return ProtoBranchingPtr(); clusteredBranch->antiColourLine(b1->antiColourLine()); b1->type(ShowerPartnerType::QCDColourLine); } else if(b2->particle()->iColour()==PDT::Colour3bar) { if(b1->antiColourLine()!=b2->antiColourLine()) return ProtoBranchingPtr(); clusteredBranch-> colourLine(b1->colourLine()); b1->type(ShowerPartnerType::QCDAntiColourLine); } else if(b2->particle()->iColour()==PDT::Colour8) { if(b1->colourLine()==b2->colourLine()) { b1->type(ShowerPartnerType::QCDColourLine); clusteredBranch->antiColourLine(b1->antiColourLine()); clusteredBranch->colourLine(b2->antiColourLine()); } else if(b1->antiColourLine()==b2->antiColourLine()) { b1->type(ShowerPartnerType::QCDAntiColourLine); clusteredBranch-> colourLine(b1->colourLine()); clusteredBranch->antiColourLine(b2->colourLine()); } else { return ProtoBranchingPtr(); } } else assert(false); } else assert(false); } protoBranchings().insert(clusteredBranch); //set children relations // outgoing if( !incoming ){ clusteredBranch->addChild( b1 ); clusteredBranch->addChild( b2 ); } else { clusteredBranch->addBackChild( b1 ); clusteredBranch->addBackChild( b2 ); } return clusteredBranch; } BranchingElement PowhegShowerHandler:: allowedFinalStateBranching( tProtoBranchingPtr & b1, tProtoBranchingPtr & b2) const { // check with normal ID's pair< long, long > ptest = make_pair( b1->id(), b2->id() ); - map< pair< long, long >, pair< SudakovPtr, IdList > >::const_iterator + map< pair< long, long >, BranchingElement >::const_iterator split = allowedFinal_.find(ptest); if( split != allowedFinal_.end() ) { - if( split->second.second[1] != ptest.first ) swap( b1, b2 ); + if( split->second.particles[1]->id() != ptest.first ) swap( b1, b2 ); return split->second; } // check with CC if( b1->particle()->CC() ) ptest.first *= -1; if( b2->particle()->CC() ) ptest.second *= -1; split = allowedFinal_.find( ptest ); if( split != allowedFinal_.end() ) { // cc the idlist only be for qbar g clusterings BranchingElement ccBranch = split->second; - if( getParticleData( ccBranch.second[0] )->CC() ) ccBranch.second[0] *= -1; - if( getParticleData( ccBranch.second[1] )->CC() ) ccBranch.second[1] *= -1; - if( getParticleData( ccBranch.second[2] )->CC() ) ccBranch.second[2] *= -1; - if( split->second.second[1] != ptest.first ) swap( b1, b2); + swap(ccBranch.particles,ccBranch.conjugateParticles); + if( split->second.particles[1]->id() != ptest.first ) swap( b1, b2); return ccBranch; } // not found found null pointer - return make_pair( SudakovPtr(), IdList() ); + return BranchingElement(); } BranchingElement PowhegShowerHandler::allowedInitialStateBranching( tProtoBranchingPtr & b1, tProtoBranchingPtr & b2) const { if(b2->status()==HardBranching::Incoming) swap(b1,b2); // is initial parton an antiparticle bool cc = b1->id() < 0; //gives range of allowedInitial_ with matching first abs( id ) - pair< multimap< long, pair< SudakovPtr, IdList > >::const_iterator, - multimap< long, pair< SudakovPtr, IdList > >::const_iterator > + pair< multimap< long, BranchingElement >::const_iterator, + multimap< long, BranchingElement >::const_iterator > location = allowedInitial_.equal_range( abs( b1->id() ) ); //iterates over this range - for( multimap< long, pair< SudakovPtr, IdList> >::const_iterator it = location.first; + for( multimap< long, BranchingElement >::const_iterator it = location.first; it != location.second; ++it ) { //test id for second particle in pair - long idtest = it->second.second[2]; - //if it is antiparticle *= -1 - if( cc && getParticleData( idtest )->CC() ) idtest *= -1; + long idtest = cc ? it->second.conjugateParticles[2]->id() : it->second.particles[2]->id(); // does second id match the test if( idtest == b2->id() ) return it->second; //if the the IS parton is a gluon and charge conjugate of second parton mathes accept if( idtest == -b2->id() && ! b1->particle()->CC() ) return it->second; } // not found found null pointer - return make_pair(SudakovPtr(),IdList()); + return BranchingElement(); } bool PowhegShowerHandler::fuzzyEqual(Lorentz5Momentum a, Lorentz5Momentum b) const{ // check momenta are within 1% of each other if ( (a.e()==ZERO && b.e()==ZERO) || (a.e()/b.e()>0.99 && a.e()/b.e()<1.01) ){ if ((a.x()==ZERO && b.x()==ZERO) || (a.x()/b.x()>0.99 && a.x()/b.x()<1.01) ){ if ((a.y()==ZERO && b.y()==ZERO) || (a.y()/b.y()>0.99 && a.y()/b.y()<1.01) ){ if ((a.z()==ZERO && b.z()==ZERO) || (a.z()/b.z()>0.99 && a.z()/b.z()<1.01) ) return true; } } } return false; } void PowhegShowerHandler::doinit() { ShowerHandler::doinit(); // extract the allowed branchings // final-state for(BranchingList::const_iterator it = evolver()->splittingGenerator()->finalStateBranchings().begin(); it != evolver()->splittingGenerator()->finalStateBranchings().end(); ++it) { - pair prod(make_pair(it->second.second[1],it->second.second[2])); + pair prod(make_pair(it->second.particles[1]->id(), + it->second.particles[2]->id())); allowedFinal_.insert(make_pair(prod,it->second)); swap(prod.first,prod.second); allowedFinal_.insert(make_pair(prod,it->second)); } // initial-state for(BranchingList::const_iterator it = evolver()->splittingGenerator()->initialStateBranchings().begin(); it != evolver()->splittingGenerator()->initialStateBranchings().end(); ++it) { - allowedInitial_.insert(make_pair(it->second.second[0],it->second)); + allowedInitial_.insert(make_pair(it->second.particles[0]->id(),it->second)); } } void PowhegShowerHandler::persistentOutput(PersistentOStream & os) const { os << theFactory << allowedInitial_ << allowedFinal_ << subtractionIntegral_ << enforceColourConsistency_ << forcePartners_ << decayRadiation_; } void PowhegShowerHandler::persistentInput(PersistentIStream & is, int) { is >> theFactory >> allowedInitial_ >> allowedFinal_ >> subtractionIntegral_ >> enforceColourConsistency_ >> forcePartners_ >> decayRadiation_; } // Static variable needed for the type description system in ThePEG. DescribeClass describeHerwigPowhegShowerHandler("Herwig::PowhegShowerHandler", "HwMatchbox.so HwMatching.so"); void PowhegShowerHandler::Init() { static ClassDocumentation documentation ("The PowhegShowerHandler class"); static Reference interfaceFactory ("Factory", "The factory object to use.", &PowhegShowerHandler::theFactory, false, false, true, false, false); static Switch interfaceEnforceColourConsistency ("EnforceColourConsistency", "Force the Born and real emission colour flows to be consistent", &PowhegShowerHandler::enforceColourConsistency_, false, false, false); static SwitchOption interfaceEnforceColourConsistencyYes (interfaceEnforceColourConsistency, "Yes", "Enforce the consistency", true); static SwitchOption interfaceEnforceColourConsistencyNo (interfaceEnforceColourConsistency, "No", "Don't enforce consistency", false); static Switch interfaceForcePartners ("ForcePartners", "Whether or not to force the partners to be those from the kinematic generation", &PowhegShowerHandler::forcePartners_, false, false, false); static SwitchOption interfaceForcePartnersYes (interfaceForcePartners, "Yes", "Force them", true); static SwitchOption interfaceForcePartnersNo (interfaceForcePartners, "No", "Don't force them", false); static Switch interfaceDecayRadiation ("DecayRadiation", "Handling of radiation which is interpretted as having come from decays", &PowhegShowerHandler::decayRadiation_, 0, false,false); static SwitchOption interfaceDecayRadiationNotAllowed (interfaceDecayRadiation, "NotAllowed", "Not allowed at all, run error will be thrown", 0); static SwitchOption interfaceDecayRadiationVetoEvent (interfaceDecayRadiation, "VetoEvent", "Veto the whole event", 1); static SwitchOption interfaceDecayRadiationVetoRadiation (interfaceDecayRadiation, "VetoRadiation", "Throw the radiation away but keep the event", 2); } diff --git a/Shower/Matching/PowhegShowerHandler.h b/Shower/Matching/PowhegShowerHandler.h --- a/Shower/Matching/PowhegShowerHandler.h +++ b/Shower/Matching/PowhegShowerHandler.h @@ -1,306 +1,306 @@ // -*- C++ -*- // // PowhegShowerHandler.h is a part of Herwig - A multi-purpose Monte Carlo event generator // Copyright (C) 2002-2007 The Herwig Collaboration // // Herwig is licenced under version 2 of the GPL, see COPYING for details. // Please respect the MCnet academic guidelines, see GUIDELINES for details. // #ifndef HERWIG_PowhegShowerHandler_H #define HERWIG_PowhegShowerHandler_H // // This is the declaration of the PowhegShowerHandler class. // #include "Herwig/Shower/ShowerHandler.h" #include "Herwig/MatrixElement/Matchbox/MatchboxFactory.h" #include "Herwig/MatrixElement/HwMEBase.h" #include "Herwig/Shower/Base/HardBranching.h" #include "Herwig/Shower/Matching/CKKWTree.h" #include "Herwig/Shower/Matching/ProtoTree.h" #include "Herwig/Shower/Matching/ProtoBranching.h" #include "Herwig/Shower/Matching/PotentialTree.h" #include "ThePEG/MatrixElement/DiagramBase.fh" #include "ThePEG/MatrixElement/MEBase.h" #include "ThePEG/PDF/PartonExtractor.h" #include "Herwig/Shower/Base/HardTree.h" // #include "Herwig/Shower/SplittingFunctions/SplittingGenerator.h" // #include "Herwig/Shower/Base/ShowerModel.h" // #include "ThePEG/PDF/BeamParticleData.h" // #include "Herwig/Shower/Base/ShowerTree.h" // #include "Herwig/Shower/Base/ShowerProgenitor.fh" // #include "Herwig/Shower/ShowerHandler.fh" // #include "Herwig/Shower/Base/Branching.h" // #include "Herwig/Shower/Base/ShowerVeto.h" // #include "ThePEG/Handlers/XComb.h" // #include "Herwig/Decay/HwDecayerBase.h" namespace Herwig { using namespace ThePEG; class PowhegShowerHandler: public ShowerHandler { public: /** * The default constructor. */ PowhegShowerHandler() : subtractionIntegral_(false), enforceColourConsistency_(false), forcePartners_(false), decayRadiation_(0) {} public: Ptr::ptr Factory(){return theFactory;} Ptr::ptr Factory() const {return theFactory;} /** * Return true, if the shower handler can generate a truncated * shower for POWHEG style events generated using Matchbox */ virtual bool canHandleMatchboxTrunc() const { return true; } protected: /** * Generate hard emissions for CKKW etc */ virtual HardTreePtr generateCKKW(ShowerTreePtr tree) const; protected: /** * Access to the core matrix element */ MEPtr matrixElement() const {return matrixElement_;} /** * Creates all (ordered) cluster histories and selects one. */ PotentialTree doClustering(tSubProPtr sub,ShowerTreePtr showerTree) const; /** * Access to the select tree */ PotentialTree & hardTree() {return hardTree_;} const PotentialTree & hardTree() const {return hardTree_;} /** * Access to the select tree */ void hardTree(PotentialTree in) const {hardTree_ = in;} /** * Check if two momenta are equal within 1% */ bool fuzzyEqual(Lorentz5Momentum a, Lorentz5Momentum b) const; /** * Access to the potential branchings */ set & protoBranchings() const {return protoBranchings_;} /** * The ProtoTrees which will become CKKWTrees */ set< ProtoTreePtr > & protoTrees() const {return protoTrees_;} /** * Recursive function to find all possible clustered trees. * Does not produce any repeated trees. */ void fillProtoTrees( ProtoTreePtr , long id ) const; /** * Function looks to see if a cluster of the branchings already exists * in protoBranchings_ if so returns the pointer to that protoBranching * if not creates the hardBranchings, adds it * to protoBranchings and returns the pointer */ tProtoBranchingPtr getCluster( tProtoBranchingPtr, tProtoBranchingPtr ) const; /** * Checks whether a ProtoTree containing the same branchings already * exists in protoTrees_ in which case the current tree is a repeat * and should be removed (and not recursed) */ bool repeatProtoTree( ProtoTreePtr currentProtoTree ) const; /** * Returns the branching element for an FS-FS clustering */ BranchingElement allowedFinalStateBranching( tProtoBranchingPtr &, tProtoBranchingPtr &) const; /** * Returns the branching element for an IS-FS clustering */ BranchingElement allowedInitialStateBranching( tProtoBranchingPtr & , tProtoBranchingPtr &) const; /** * Returns the diagram corresponding to the (leading-order) hardTree */ bool checkDiagram(PotentialTree &,tcDiagPtr) const; bool subtractionIntegral() const {return subtractionIntegral_;} void setSubtractionIntegral(bool subInt) const { subtractionIntegral_=subInt;} private: /** * The factory object to fetch splitting channels from */ Ptr::ptr theFactory; /** * The matrix element for the core process */ mutable MEPtr matrixElement_; /** * The chosen hard tree */ mutable PotentialTree hardTree_; /** * All the Protobranchings used in finding the shower histories */ mutable set protoBranchings_; /** * The ProtoTrees which will become CKKWTrees */ mutable set< ProtoTreePtr > protoTrees_; /** * The possible shower configurations that are angular-ordered */ mutable vector< pair< PotentialTree, double > > hardTrees_; /** * Which branchings are allowed? */ //@{ /** * The allowed final-state branchings */ - mutable map,pair > allowedFinal_; + mutable map,BranchingElement > allowedFinal_; /** * The allowed initial-state branchings */ - mutable multimap > allowedInitial_; + mutable multimap allowedInitial_; //@} public: /** @name Functions used by the persistent I/O system. */ //@{ /** * Function used to write out object persistently. * @param os the persistent output stream written to. */ void persistentOutput(PersistentOStream & os) const; /** * Function used to read in object persistently. * @param is the persistent input stream read from. * @param version the version number of the object when written. */ void persistentInput(PersistentIStream & is, int version); //@} /** * The standard Init function used to initialize the interfaces. * Called exactly once for each class by the class description system * before the main function starts or * when this class is dynamically loaded. */ static void Init(); protected: /** @name Clone Methods. */ //@{ /** * Make a simple clone of this object. * @return a pointer to the new object. */ virtual IBPtr clone() const; /** Make a clone of this object, possibly modifying the cloned object * to make it sane. * @return a pointer to the new object. */ virtual IBPtr fullclone() const; //@} protected: /** @name Standard Interfaced functions. */ //@{ /** * Initialize this object after the setup phase before saving an * EventGenerator to disk. * @throws InitException if object could not be initialized properly. */ virtual void doinit(); //@} private: /** * The assignment operator is private and must never be called. * In fact, it should not even be implemented. */ PowhegShowerHandler & operator=(const PowhegShowerHandler &); private: /** * Emitter particle from the original generation */ mutable int emitter_; /** * Spectator particle from the original generation */ mutable int spectator_; /** * Whether or not a subtraction integral */ mutable bool subtractionIntegral_; /** * Whether or not do enforce consistency of the Born and real colour flows */ bool enforceColourConsistency_; /** * Force emitter and spectator partners */ bool forcePartners_; /** * Handling of radiation in decays */ unsigned int decayRadiation_; }; } #endif /* HERWIG_PowhegShowerHandler_H */ diff --git a/Shower/ShowerConfig.cc b/Shower/ShowerConfig.cc new file mode 100644 --- /dev/null +++ b/Shower/ShowerConfig.cc @@ -0,0 +1,47 @@ +// -*- C++ -*- +// +// ShowerConfig.cc is a part of Herwig - A multi-purpose Monte Carlo event generator +// Copyright (C) 2002-2011 The Herwig Collaboration +// +// Herwig is licenced under version 2 of the GPL, see COPYING for details. +// Please respect the MCnet academic guidelines, see GUIDELINES for details. +// +// +// This is the implementation of the non-inlined, non-templated member +// functions of the ShowerConfig class. +// +#include "ShowerConfig.h" +#include "Base/SudakovFormFactor.h" + +using namespace Herwig; + +BranchingElement::~BranchingElement() {} + +BranchingElement::BranchingElement() {} + +BranchingElement::BranchingElement(SudakovPtr sud, IdList part) : sudakov(sud), particles(part) { + for(unsigned int ix=0;ixCC() ? tcPDPtr(part[ix]->CC()) : part[ix]); +} + +namespace ThePEG { + +/** + * Output operator to allow the structure + */ +PersistentOStream & operator << (PersistentOStream & os, + const Herwig::BranchingElement & x) { + os << x.sudakov << x.particles << x.conjugateParticles; + return os; +} + +/** + * Input operator to allow the structure + */ +PersistentIStream & operator >> (PersistentIStream & is, + Herwig::BranchingElement & x) { + is >> x.sudakov >> x.particles >> x.conjugateParticles; + return is; +} + +} diff --git a/Shower/ShowerConfig.h b/Shower/ShowerConfig.h --- a/Shower/ShowerConfig.h +++ b/Shower/ShowerConfig.h @@ -1,106 +1,156 @@ // -*- C++ -*- // // ShowerConfig.h is a part of Herwig - A multi-purpose Monte Carlo event generator // Copyright (C) 2002-2011 The Herwig Collaboration // // Herwig is licenced under version 2 of the GPL, see COPYING for details. // Please respect the MCnet academic guidelines, see GUIDELINES for details. // #ifndef HERWIG_ShowerConfig_H #define HERWIG_ShowerConfig_H // // This is the declaration of the ShowerConfig class. #include "ThePEG/Config/ThePEG.h" +#include "ThePEG/PDT/ParticleData.h" #include "Base/ShowerParticle.fh" #include "Base/SudakovFormFactor.fh" +#include "ThePEG/Persistency/PersistentOStream.h" +#include "ThePEG/Persistency/PersistentIStream.h" namespace Herwig { using namespace ThePEG; /** \ingroup Shower * * Handy header file to be included in all Shower classes. * It contains only some useful typedefs. */ /** * Pointer to a ColourLine */ typedef Ptr::pointer ColinePtr; /** * Transient Pointer to a ColourLine */ typedef Ptr::transient_pointer tColinePtr; /** * A pair of ColourLine pointers */ typedef pair ColinePair; /** * A pair of transient ColourLine pointers */ typedef pair tColinePair; /** * A Vector of ShowerParticle pointers */ typedef vector ShowerParticleVector; /** * A Vector of transient ShowerParticle pointers */ typedef vector tShowerParticleVector; /** * Definition of the IdList for branchings */ - typedef vector IdList; + typedef vector IdList; namespace ShowerInteraction { /** * Enum for the type of interaction */ enum Type { UNDEFINED=-1, QCD, QED, QEDQCD, EW, ALL }; } namespace ShowerPartnerType { /** * Enum for the type of shower partner */ enum Type {Undefined,QCDColourLine,QCDAntiColourLine,QED,EW}; } inline ShowerInteraction::Type convertInteraction(ShowerPartnerType::Type partner) { if(partner==ShowerPartnerType::QCDColourLine || partner==ShowerPartnerType::QCDAntiColourLine) return ShowerInteraction::QCD; else if(ShowerPartnerType::QED) return ShowerInteraction::QED; else if(ShowerPartnerType::EW) return ShowerInteraction::EW; else return ShowerInteraction::UNDEFINED; } /** * typedef to pair the SudakovFormFactor and the particles in a branching */ - typedef pair BranchingElement; + struct BranchingElement { + + /** + * Constructor + */ + BranchingElement(); + + /** + * Constructor + */ + BranchingElement(SudakovPtr sud, IdList part); + + /** + * Destructor + */ + ~BranchingElement(); + + /** + * Access to the Sudakov + */ + SudakovPtr sudakov; + + /** + * Access to the particles + */ + IdList particles; + + /** + * Access to the charge conjugate particles + */ + IdList conjugateParticles; + }; /** * typedef to pair the PDG code of the particle and the BranchingElement */ typedef multimap BranchingList; /** * typedef to create a structure which can be inserted into a BranchingList */ typedef pair BranchingInsert; } +namespace ThePEG { + + /** + * Output operator to allow the structure + */ + PersistentOStream & operator << (PersistentOStream & os, + const Herwig::BranchingElement & x); + + /** + * Input operator to allow the structure + */ + PersistentIStream & operator >> (PersistentIStream & is, + Herwig::BranchingElement & x); + +} + #endif // HERWIG_ShowerConfig_H diff --git a/Shower/SplittingFunctions/HalfHalfOneEWSplitFn.cc b/Shower/SplittingFunctions/HalfHalfOneEWSplitFn.cc --- a/Shower/SplittingFunctions/HalfHalfOneEWSplitFn.cc +++ b/Shower/SplittingFunctions/HalfHalfOneEWSplitFn.cc @@ -1,214 +1,214 @@ // -*- C++ -*- // // This is the implementation of the non-inlined, non-templated member // functions of the HalfHalfOneEWSplitFn class. // #include "HalfHalfOneEWSplitFn.h" #include "ThePEG/StandardModel/StandardModelBase.h" #include "ThePEG/Repository/EventGenerator.h" #include "ThePEG/Interface/ClassDocumentation.h" #include "ThePEG/Utilities/DescribeClass.h" #include "ThePEG/Persistency/PersistentOStream.h" #include "ThePEG/Persistency/PersistentIStream.h" #include "ThePEG/PDT/ParticleData.h" #include "Herwig/Decay/TwoBodyDecayMatrixElement.h" using namespace Herwig; IBPtr HalfHalfOneEWSplitFn::clone() const { return new_ptr(*this); } IBPtr HalfHalfOneEWSplitFn::fullclone() const { return new_ptr(*this); } void HalfHalfOneEWSplitFn::persistentOutput(PersistentOStream & os) const { os << gZ_ << gWL_; } void HalfHalfOneEWSplitFn::persistentInput(PersistentIStream & is, int) { is >> gZ_ >> gWL_; } // The following static variable is needed for the type description system in ThePEG. DescribeClass describeHerwigHalfHalfOneEWSplitFn("Herwig::HalfHalfOneEWSplitFn", "HwShower.so"); void HalfHalfOneEWSplitFn::Init() { static ClassDocumentation documentation ("The HalfHalfOneEWSplitFn class implements the splitting q->qWand q->qZ"); } void HalfHalfOneEWSplitFn::doinit() { SplittingFunction::doinit(); tcSMPtr sm = generator()->standardModel(); double sw2 = sm->sin2ThetaW(); // left-handled W coupling gWL_ = 1./sqrt(2.*sw2); // Z couplings double fact = 0.25/sqrt(sw2*(1.-sw2)); for(int ix=1;ix<4;++ix) { gZ_[2*ix-1] = make_pair(fact*(sm->vd() + sm->ad()), fact*(sm->vd() - sm->ad() )); gZ_[2*ix ] = make_pair(fact*(sm->vu() + sm->au() ), fact*(sm->vu() - sm->au() )); gZ_[2*ix+9 ] = make_pair(fact*(sm->ve() + sm->ae() ), fact*(sm->ve() - sm->ae() )); gZ_[2*ix+10] = make_pair(fact*(sm->vnu() + sm->anu()), fact*(sm->vnu() - sm->anu())); } } void HalfHalfOneEWSplitFn::getCouplings(double & gL, double & gR, const IdList & ids) const { - if(ids[2]==ParticleID::Z0) { - map >::const_iterator it = gZ_.find(abs(ids[0])); + if(ids[2]->id()==ParticleID::Z0) { + map >::const_iterator it = gZ_.find(abs(ids[0]->id())); assert(it!=gZ_.end()); gL = it->second.first ; gR = it->second.second; } - else if(abs(ids[2])==ParticleID::Wplus) { + else if(abs(ids[2]->id())==ParticleID::Wplus) { gL = gWL_; } else assert(false); } double HalfHalfOneEWSplitFn::P(const double z, const Energy2 t, const IdList &ids, const bool mass, const RhoDMatrix & rho) const { double gL(0.),gR(0.); getCouplings(gL,gR,ids); double val = (1. + sqr(z))/(1.-z); if(mass) { - Energy m = getParticleData(ids[2])->mass(); + Energy m = ids[2]->mass(); val -= sqr(m)/t; } val *= (sqr(gL)*norm(rho(0,0))+sqr(gR)*norm(rho(1,1))); return colourFactor(ids)*val; } double HalfHalfOneEWSplitFn::overestimateP(const double z, const IdList & ids) const { double gL(0.),gR(0.); getCouplings(gL,gR,ids); return 2.*sqr(max(gL,gR))*colourFactor(ids)/(1.-z); } double HalfHalfOneEWSplitFn::ratioP(const double z, const Energy2 t, const IdList & ids, const bool mass, const RhoDMatrix & rho) const { double gL(0.),gR(0.); getCouplings(gL,gR,ids); double val = 1. + sqr(z); if(mass) { - Energy m = getParticleData(ids[2])->mass(); + Energy m = ids[2]->mass(); val -= (1.-z)*sqr(m)/t; } val *= (sqr(gL)*norm(rho(0,0))+sqr(gR)*norm(rho(1,1))); return val; } double HalfHalfOneEWSplitFn::integOverP(const double z, const IdList & ids, unsigned int PDFfactor) const { double gL(0.),gR(0.); getCouplings(gL,gR,ids); double pre = colourFactor(ids)*sqr(max(gL,gR)); switch (PDFfactor) { case 0: return -2.*pre*Math::log1m(z); case 1: return 2.*pre*log(z/(1.-z)); case 2: return 2.*pre/(1.-z); case 3: default: throw Exception() << "HalfHalfOneEWSplitFn::integOverP() invalid PDFfactor = " << PDFfactor << Exception::runerror; } } double HalfHalfOneEWSplitFn::invIntegOverP(const double r, const IdList & ids, unsigned int PDFfactor) const { double gL(0.),gR(0.); getCouplings(gL,gR,ids); double pre = colourFactor(ids)*sqr(max(gL,gR)); switch (PDFfactor) { case 0: return 1. - exp(- 0.5*r/pre); case 1: return 1./(1.-exp(-0.5*r/pre)); case 2: return 1.-2.*pre/r; case 3: default: throw Exception() << "HalfHalfOneEWSplitFn::invIntegOverP() invalid PDFfactor = " << PDFfactor << Exception::runerror; } } bool HalfHalfOneEWSplitFn::accept(const IdList &ids) const { if(ids.size()!=3) return false; - if(ids[2]==ParticleID::Z0) { - if(ids[0]==ids[1] && - ((ids[0]>=1 && ids[0]<=6) || (ids[0]>=11&&ids[0]<=16) )) return true; + if(ids[2]->id()==ParticleID::Z0) { + if(ids[0]->id()==ids[1]->id() && + ((ids[0]->id()>=1 && ids[0]->id()<=6) || (ids[0]->id()>=11&&ids[0]->id()<=16) )) return true; } - else if(abs(ids[2])==ParticleID::Wplus) { - if(!((ids[0]>=1 && ids[0]<=6) || (ids[0]>=11&&ids[0]<=16) )) return false; - if(!((ids[1]>=1 && ids[1]<=6) || (ids[1]>=11&&ids[1]<=16) )) return false; - if(ids[0]+1!=ids[1] && ids[0]-1!=ids[1]) return false; - int out = getParticleData(ids[1])->iCharge()+getParticleData(ids[2])->iCharge(); - if(getParticleData(ids[0])->iCharge()==out) return true; + else if(abs(ids[2]->id())==ParticleID::Wplus) { + if(!((ids[0]->id()>=1 && ids[0]->id()<=6) || (ids[0]->id()>=11&&ids[0]->id()<=16) )) return false; + if(!((ids[1]->id()>=1 && ids[1]->id()<=6) || (ids[1]->id()>=11&&ids[1]->id()<=16) )) return false; + if(ids[0]->id()+1!=ids[1]->id() && ids[0]->id()-1!=ids[1]->id()) return false; + int out = ids[1]->iCharge()+ids[2]->iCharge(); + if(ids[0]->iCharge()==out) return true; } return false; } vector > HalfHalfOneEWSplitFn::generatePhiForward(const double, const Energy2, const IdList & , const RhoDMatrix &) { // no dependence on the spin density matrix, dependence on off-diagonal terms cancels // and rest = splitting function for Tr(rho)=1 as required by defn return vector >(1,make_pair(0,1.)); } vector > HalfHalfOneEWSplitFn::generatePhiBackward(const double, const Energy2, const IdList & , const RhoDMatrix &) { // no dependence on the spin density matrix, dependence on off-diagonal terms cancels // and rest = splitting function for Tr(rho)=1 as required by defn return vector >(1,make_pair(0,1.)); } DecayMEPtr HalfHalfOneEWSplitFn::matrixElement(const double z, const Energy2 t, const IdList & ids, const double phi, bool) { // calculate the kernal DecayMEPtr kernal(new_ptr(TwoBodyDecayMatrixElement(PDT::Spin1Half,PDT::Spin1Half,PDT::Spin1))); - Energy m = getParticleData(ids[2])->mass(); + Energy m = ids[2]->mass(); double gL(0.),gR(0.); getCouplings(gL,gR,ids); double mt = m/sqrt(t); double root = sqrt(1.-sqr(m)/t/(1-z)); double romz = sqrt(1.-z); double rz = sqrt(z); double r2 = sqrt(2.); Complex phase = exp(Complex(0.,1.)*phi); Complex cphase = conj(phase); (*kernal)(0,0,0) = -phase*root*gL/romz; (*kernal)(1,1,2) = cphase*root*gR/romz; (*kernal)(0,0,2) = cphase*z*root*gL/romz; (*kernal)(1,1,0) = -phase*z*root*gR/romz; // long terms (*kernal)(1,1,1) =-gR*mt*r2*rz/(1-z); (*kernal)(0,0,1) =-gL*mt*r2*rz/(1-z); // +- -+ terms zero due quark mass for(unsigned int ix=0;ix<3;++ix) { (*kernal)(1,0,ix) = 0.; (*kernal)(0,1,ix) = 0.; } // return the answer return kernal; } diff --git a/Shower/SplittingFunctions/HalfHalfOneSplitFn.cc b/Shower/SplittingFunctions/HalfHalfOneSplitFn.cc --- a/Shower/SplittingFunctions/HalfHalfOneSplitFn.cc +++ b/Shower/SplittingFunctions/HalfHalfOneSplitFn.cc @@ -1,136 +1,134 @@ // -*- C++ -*- // // HalfHalfOneSplitFn.cc is a part of Herwig - A multi-purpose Monte Carlo event generator // Copyright (C) 2002-2011 The Herwig Collaboration // // Herwig is licenced under version 2 of the GPL, see COPYING for details. // Please respect the MCnet academic guidelines, see GUIDELINES for details. // // // This is the implementation of the non-inlined, non-templated member // functions of the HalfHalfOneSplitFn class. // #include "HalfHalfOneSplitFn.h" #include "ThePEG/PDT/ParticleData.h" #include "ThePEG/Interface/ClassDocumentation.h" #include "ThePEG/Utilities/DescribeClass.h" #include "Herwig/Decay/TwoBodyDecayMatrixElement.h" using namespace Herwig; DescribeNoPIOClass describeHalfHalfOneSplitFn ("Herwig::HalfHalfOneSplitFn","HwShower.so"); void HalfHalfOneSplitFn::Init() { static ClassDocumentation documentation ("The HalfHalfOneSplitFn class implements the q -> qg splitting function"); } double HalfHalfOneSplitFn::P(const double z, const Energy2 t, const IdList &ids, const bool mass, const RhoDMatrix &) const { double val = (1. + sqr(z))/(1.-z); if(mass) { - Energy m = getParticleData(ids[0])->mass(); + Energy m = ids[0]->mass(); val -= 2.*sqr(m)/t; } return colourFactor(ids)*val; } double HalfHalfOneSplitFn::overestimateP(const double z, const IdList & ids) const { return 2.*colourFactor(ids)/(1.-z); } double HalfHalfOneSplitFn::ratioP(const double z, const Energy2 t, const IdList & ids, const bool mass, const RhoDMatrix &) const { double val = 1. + sqr(z); if(mass) { - Energy m = getParticleData(ids[0])->mass(); + Energy m = ids[0]->mass(); val -= 2.*sqr(m)*(1.-z)/t; } return 0.5*val; } double HalfHalfOneSplitFn::integOverP(const double z, const IdList & ids, unsigned int PDFfactor) const { switch (PDFfactor) { case 0: return -2.*colourFactor(ids)*Math::log1m(z); case 1: return 2.*colourFactor(ids)*log(z/(1.-z)); case 2: return 2.*colourFactor(ids)/(1.-z); case 3: default: throw Exception() << "HalfHalfOneSplitFn::integOverP() invalid PDFfactor = " << PDFfactor << Exception::runerror; } } double HalfHalfOneSplitFn::invIntegOverP(const double r, const IdList & ids, unsigned int PDFfactor) const { switch (PDFfactor) { case 0: return 1. - exp(- 0.5*r/colourFactor(ids)); case 1: return 1./(1.-exp(-0.5*r/colourFactor(ids))); case 2: return 1.-2.*colourFactor(ids)/r; case 3: default: throw Exception() << "HalfHalfOneSplitFn::invIntegOverP() invalid PDFfactor = " << PDFfactor << Exception::runerror; } } bool HalfHalfOneSplitFn::accept(const IdList &ids) const { // 3 particles and in and out fermion same if(ids.size()!=3 || ids[0]!=ids[1]) return false; - tcPDPtr q=getParticleData(ids[0]); - tcPDPtr g=getParticleData(ids[2]); - if(q->iSpin()!=PDT::Spin1Half || - g->iSpin()!=PDT::Spin1) return false; + if(ids[0]->iSpin()!=PDT::Spin1Half || + ids[2]->iSpin()!=PDT::Spin1) return false; return checkColours(ids); } vector > HalfHalfOneSplitFn::generatePhiForward(const double, const Energy2, const IdList & , const RhoDMatrix &) { // no dependence on the spin density matrix, dependence on off-diagonal terms cancels // and rest = splitting function for Tr(rho)=1 as required by defn return vector >(1,make_pair(0,1.)); } vector > HalfHalfOneSplitFn::generatePhiBackward(const double, const Energy2, const IdList & , const RhoDMatrix &) { // no dependence on the spin density matrix, dependence on off-diagonal terms cancels // and rest = splitting function for Tr(rho)=1 as required by defn return vector >(1,make_pair(0,1.)); } DecayMEPtr HalfHalfOneSplitFn::matrixElement(const double z, const Energy2 t, const IdList & ids, const double phi, bool timeLike) { // calculate the kernal DecayMEPtr kernal(new_ptr(TwoBodyDecayMatrixElement(PDT::Spin1Half,PDT::Spin1Half,PDT::Spin1))); - Energy m = !timeLike ? ZERO : getParticleData(ids[0])->mass(); + Energy m = !timeLike ? ZERO : ids[0]->mass(); double mt = m/sqrt(t); double root = sqrt(1.-(1.-z)*sqr(m)/z/t); double romz = sqrt(1.-z); double rz = sqrt(z); Complex phase = exp(Complex(0.,1.)*phi); (*kernal)(0,0,0) = -root/romz*phase; (*kernal)(1,1,2) = -conj((*kernal)(0,0,0)); (*kernal)(0,0,2) = root/romz*z/phase; (*kernal)(1,1,0) = -conj((*kernal)(0,0,2)); (*kernal)(1,0,2) = mt*(1.-z)/rz; (*kernal)(0,1,0) = conj((*kernal)(1,0,2)); (*kernal)(0,1,2) = 0.; (*kernal)(1,0,0) = 0.; return kernal; } diff --git a/Shower/SplittingFunctions/HalfOneHalfSplitFn.cc b/Shower/SplittingFunctions/HalfOneHalfSplitFn.cc --- a/Shower/SplittingFunctions/HalfOneHalfSplitFn.cc +++ b/Shower/SplittingFunctions/HalfOneHalfSplitFn.cc @@ -1,145 +1,143 @@ // -*- C++ -*- // // HalfOneHalfSplitFn.cc is a part of Herwig - A multi-purpose Monte Carlo event generator // Copyright (C) 2002-2011 The Herwig Collaboration // // Herwig is licenced under version 2 of the GPL, see COPYING for details. // Please respect the MCnet academic guidelines, see GUIDELINES for details. // // // This is the implementation of the non-inlined, non-templated member // functions of the HalfOneHalfSplitFn class. // #include "HalfOneHalfSplitFn.h" #include "ThePEG/PDT/ParticleData.h" #include "ThePEG/Interface/ClassDocumentation.h" #include "ThePEG/Utilities/DescribeClass.h" #include "Herwig/Decay/TwoBodyDecayMatrixElement.h" using namespace Herwig; DescribeNoPIOClass describeHalfOneHalfSplitFn ("Herwig::HalfOneHalfSplitFn","HwShower.so"); void HalfOneHalfSplitFn::Init() { static ClassDocumentation documentation ("The HalfOneHalfSplitFn class implements the splitting " "function for q -> g q"); } double HalfOneHalfSplitFn::P(const double z, const Energy2 t, const IdList &ids, const bool mass, const RhoDMatrix & ) const { double val=(2.*(1.-z)+sqr(z))/z; if(mass) { - Energy m = getParticleData(ids[0])->mass(); + Energy m = ids[0]->mass(); val-=2.*sqr(m)/t; } return colourFactor(ids)*val; } double HalfOneHalfSplitFn::overestimateP(const double z, const IdList &ids) const { return 2.*colourFactor(ids)/z; } double HalfOneHalfSplitFn::ratioP(const double z, const Energy2 t, const IdList &ids,const bool mass, const RhoDMatrix & ) const { double val=2.*(1.-z)+sqr(z); if(mass) { - Energy m=getParticleData(ids[0])->mass(); + Energy m=ids[0]->mass(); val -=2.*sqr(m)*z/t; } return 0.5*val; } double HalfOneHalfSplitFn::integOverP(const double z, const IdList & ids, unsigned int PDFfactor) const { switch(PDFfactor) { case 0: return 2.*colourFactor(ids)*log(z); case 1: return -2.*colourFactor(ids)/z; case 2: return 2.*colourFactor(ids)*log(z/(1.-z)); case 3: default: throw Exception() << "HalfOneHalfSplitFn::integOverP() invalid PDFfactor = " << PDFfactor << Exception::runerror; } } double HalfOneHalfSplitFn::invIntegOverP(const double r, const IdList & ids, unsigned int PDFfactor) const { switch(PDFfactor) { case 0: return exp(0.5*r/colourFactor(ids)); case 1: return -2.*colourFactor(ids)/r; case 2: return 1./(1.+exp(-0.5*r/colourFactor(ids))); case 3: default: throw Exception() << "HalfOneHalfSplitFn::integOverP() invalid PDFfactor = " << PDFfactor << Exception::runerror; } } bool HalfOneHalfSplitFn::accept(const IdList &ids) const { // 3 particles and in and out fermion same if(ids.size()!=3 || ids[0]!=ids[2]) return false; - tcPDPtr q=getParticleData(ids[0]); - tcPDPtr g=getParticleData(ids[1]); - if(q->iSpin()!=PDT::Spin1Half || - g->iSpin()!=PDT::Spin1) return false; + if(ids[0]->iSpin()!=PDT::Spin1Half || + ids[1]->iSpin()!=PDT::Spin1) return false; return checkColours(ids); } vector > HalfOneHalfSplitFn::generatePhiForward(const double, const Energy2, const IdList & , const RhoDMatrix &) { // no dependence on the spin density matrix, dependence on off-diagonal terms cancels // and rest = splitting function for Tr(rho)=1 as required by defn return vector >(1,make_pair(0,1.)); } vector > HalfOneHalfSplitFn::generatePhiBackward(const double z, const Energy2 t, const IdList & ids, const RhoDMatrix & rho) { assert(rho.iSpin()==PDT::Spin1); - double mt = sqr(getParticleData(ids[0])->mass())/t; + double mt = sqr(ids[0]->mass())/t; double diag = (1.+sqr(1.-z))/z - 2.*mt; double off = 2.*(1.-z)/z*(1.-mt*z/(1.-z)); double max = diag+2.*abs(rho(0,2))*off; vector > output; output.push_back(make_pair( 0, (rho(0,0)+rho(2,2))*diag/max)); output.push_back(make_pair( 2, -rho(0,2) * off/max)); output.push_back(make_pair(-2, -rho(2,0) * off/max)); return output; } DecayMEPtr HalfOneHalfSplitFn::matrixElement(const double z, const Energy2 t, const IdList & ids, const double phi, bool timeLike) { // calculate the kernal DecayMEPtr kernal(new_ptr(TwoBodyDecayMatrixElement(PDT::Spin1Half,PDT::Spin1,PDT::Spin1Half))); - Energy m = !timeLike ? ZERO : getParticleData(ids[0])->mass(); + Energy m = !timeLike ? ZERO : ids[0]->mass(); double mt = m/sqrt(t); double root = sqrt(1.-z*sqr(m)/(1.-z)/t); double romz = sqrt(1.-z); double rz = sqrt(z); Complex phase = exp(Complex(0.,1.)*phi); (*kernal)(0,0,0) = -root/rz/phase; (*kernal)(1,2,1) = -conj((*kernal)(0,0,0)); (*kernal)(0,2,0) = root/rz*(1.-z)*phase; (*kernal)(1,0,1) = -conj((*kernal)(0,2,0)); (*kernal)(1,2,0) = mt*z/romz; (*kernal)(0,0,1) = conj((*kernal)(1,2,0)); (*kernal)(0,2,1) = 0.; (*kernal)(1,0,0) = 0.; return kernal; } diff --git a/Shower/SplittingFunctions/OneHalfHalfSplitFn.cc b/Shower/SplittingFunctions/OneHalfHalfSplitFn.cc --- a/Shower/SplittingFunctions/OneHalfHalfSplitFn.cc +++ b/Shower/SplittingFunctions/OneHalfHalfSplitFn.cc @@ -1,144 +1,142 @@ // -*- C++ -*- // // OneHalfHalfSplitFn.cc is a part of Herwig - A multi-purpose Monte Carlo event generator // Copyright (C) 2002-2011 The Herwig Collaboration // // Herwig is licenced under version 2 of the GPL, see COPYING for details. // Please respect the MCnet academic guidelines, see GUIDELINES for details. // // // This is the implementation of the non-inlined, non-templated member // functions of the OneHalfHalfSplitFn class. // #include "OneHalfHalfSplitFn.h" #include "ThePEG/PDT/ParticleData.h" #include "ThePEG/Interface/ClassDocumentation.h" #include "ThePEG/Utilities/DescribeClass.h" #include "Herwig/Decay/TwoBodyDecayMatrixElement.h" using namespace Herwig; DescribeNoPIOClass describeOneHalfHalfSplitFn ("Herwig::OneHalfHalfSplitFn","HwShower.so"); void OneHalfHalfSplitFn::Init() { static ClassDocumentation documentation ("The OneHalfHalfSplitFn class implements the splitting function for g->q qbar"); } double OneHalfHalfSplitFn::P(const double z, const Energy2 t, const IdList &ids, const bool mass, const RhoDMatrix &) const { double zz = z*(1.-z); double val=1.-2.*zz; if(mass) { - Energy m = getParticleData(ids[1])->mass(); + Energy m = ids[1]->mass(); val +=2.*sqr(m)/t; } return colourFactor(ids)*val; } double OneHalfHalfSplitFn::overestimateP(const double, const IdList &ids) const { return colourFactor(ids); } double OneHalfHalfSplitFn::ratioP(const double z, const Energy2 t, const IdList &ids, const bool mass, const RhoDMatrix &) const { double zz = z*(1.-z); double val = 1.-2.*zz; if(mass) { - Energy m = getParticleData(ids[1])->mass(); + Energy m = ids[1]->mass(); val+= 2.*sqr(m)/t; } return val; } double OneHalfHalfSplitFn::integOverP(const double z, const IdList & ids, unsigned int PDFfactor) const { switch(PDFfactor) { case 0: return colourFactor(ids)*z; case 1: return colourFactor(ids)*log(z); case 2: return -colourFactor(ids)*log(1.-z); case 3: return colourFactor(ids)*log(z/(1.-z)); default: throw Exception() << "OneHalfHalfSplitFn::integOverP() invalid PDFfactor = " << PDFfactor << Exception::runerror; } } double OneHalfHalfSplitFn::invIntegOverP(const double r, const IdList & ids, unsigned int PDFfactor) const { switch(PDFfactor) { case 0: return r/colourFactor(ids); case 1: return exp(r/colourFactor(ids)); case 2: return 1.-exp(-r/colourFactor(ids)); case 3: return 1./(1.+exp(-r/colourFactor(ids))); default: throw Exception() << "OneHalfHalfSplitFn::integOverP() invalid PDFfactor = " << PDFfactor << Exception::runerror; } } bool OneHalfHalfSplitFn::accept(const IdList &ids) const { if(ids.size()!=3) return false; - if(ids[1]!=-ids[2]) return false; - tcPDPtr q=getParticleData(ids[1]); - if(q->iSpin()!=PDT::Spin1Half) return false; - tcPDPtr g=getParticleData(ids[0]); - if(g->iSpin()!=PDT::Spin1) return false; + if(ids[1]!=ids[2]->CC()) return false; + if(ids[1]->iSpin()!=PDT::Spin1Half) return false; + if(ids[0]->iSpin()!=PDT::Spin1) return false; return checkColours(ids); } vector > OneHalfHalfSplitFn::generatePhiForward(const double z, const Energy2 t, const IdList & ids, const RhoDMatrix & rho) { assert(rho.iSpin()==PDT::Spin1); double modRho = abs(rho(0,2)); - Energy mq = getParticleData(ids[1])->mass(); + Energy mq = ids[1]->mass(); Energy2 mq2 = sqr(mq); double fact = z*(1.-z)-mq2/t; double max = 1.+2.*fact*(-1.+2.*modRho); vector > output; output.push_back(make_pair( 0,(rho(0,0)+rho(2,2))*(1.-2.*fact)/max)); output.push_back(make_pair(-2,2.*fact*rho(0,2)/max)); output.push_back(make_pair( 2,2.*fact*rho(2,0)/max)); return output; } vector > OneHalfHalfSplitFn::generatePhiBackward(const double, const Energy2, const IdList &, const RhoDMatrix & ) { // no dependance return vector >(1,make_pair(0,1.)); } DecayMEPtr OneHalfHalfSplitFn::matrixElement(const double z, const Energy2 t, const IdList & ids, const double phi, bool timeLike) { static const Complex ii(0.,1.); // calculate the kernal DecayMEPtr kernal(new_ptr(TwoBodyDecayMatrixElement(PDT::Spin1,PDT::Spin1Half,PDT::Spin1Half))); - double mt = !timeLike ? ZERO : getParticleData(ids[1])->mass()/sqrt(t); + double mt = !timeLike ? ZERO : ids[1]->mass()/sqrt(t); double root =sqrt(1.-sqr(mt)/z/(1.-z)); (*kernal)(0,0,0) = mt/sqrt(z*(1.-z)); (*kernal)(2,1,1) = (*kernal)(0,0,0); (*kernal)(0,0,1) = -z*root*exp(-ii*phi); (*kernal)(2,1,0) = -conj((*kernal)(0,0,1)); (*kernal)(0,1,0) = (1.-z)*exp(-ii*phi)*root; (*kernal)(2,0,1) = -conj((*kernal)(0,1,0)); (*kernal)(0,1,1) = 0.; (*kernal)(2,0,0) = 0.; return kernal; } diff --git a/Shower/SplittingFunctions/OneOneOneSplitFn.cc b/Shower/SplittingFunctions/OneOneOneSplitFn.cc --- a/Shower/SplittingFunctions/OneOneOneSplitFn.cc +++ b/Shower/SplittingFunctions/OneOneOneSplitFn.cc @@ -1,134 +1,133 @@ // -*- C++ -*- // // OneOneOneSplitFn.cc is a part of Herwig - A multi-purpose Monte Carlo event generator // Copyright (C) 2002-2011 The Herwig Collaboration // // Herwig is licenced under version 2 of the GPL, see COPYING for details. // Please respect the MCnet academic guidelines, see GUIDELINES for details. // // // This is the implementation of the non-inlined, non-templated member // functions of the OneOneOneSplitFn class. // #include "OneOneOneSplitFn.h" #include "ThePEG/PDT/ParticleData.h" #include "ThePEG/Interface/ClassDocumentation.h" #include "ThePEG/Utilities/DescribeClass.h" #include "Herwig/Decay/TwoBodyDecayMatrixElement.h" using namespace Herwig; DescribeNoPIOClass describeOneOneOneSplitFn ("Herwig::OneOneOneSplitFn","HwShower.so"); void OneOneOneSplitFn::Init() { static ClassDocumentation documentation ("The OneOneOneSplitFn class implements the g -> gg splitting function"); } double OneOneOneSplitFn::P(const double z, const Energy2, const IdList & ids, const bool, const RhoDMatrix &)const { // (this is historically important! the first physics - two years // after the birth of the project - in the Herwig shower! Alberto // & Stefan, 25/04/2002). return colourFactor(ids)*sqr(1.-z*(1.-z))/(z*(1.-z)); } double OneOneOneSplitFn::overestimateP(const double z, const IdList & ids) const { return colourFactor(ids)*(1/z + 1/(1.-z)); } double OneOneOneSplitFn::ratioP(const double z, const Energy2, const IdList & , const bool, const RhoDMatrix &) const { return sqr(1.-z*(1.-z)); } double OneOneOneSplitFn::invIntegOverP(const double r, const IdList & ids, unsigned int PDFfactor) const { switch(PDFfactor) { case 0: return 1./(1.+exp(-r/colourFactor(ids))); case 1: case 2: case 3: default: throw Exception() << "OneOneOneSplitFn::integOverP() invalid PDFfactor = " << PDFfactor << Exception::runerror; } } double OneOneOneSplitFn::integOverP(const double z, const IdList & ids, unsigned int PDFfactor) const { switch(PDFfactor) { case 0: assert(z>0.&&z<1.); return colourFactor(ids)*log(z/(1.-z)); case 1: case 2: case 3: default: throw Exception() << "OneOneOneSplitFn::integOverP() invalid PDFfactor = " << PDFfactor << Exception::runerror; } } bool OneOneOneSplitFn::accept(const IdList & ids) const { if(ids.size()!=3) return false; for(unsigned int ix=0;ixiSpin()!=PDT::Spin1) return false; + if(ids[0]->iSpin()!=PDT::Spin1) return false; } return checkColours(ids); } vector > OneOneOneSplitFn::generatePhiForward(const double z, const Energy2, const IdList &, const RhoDMatrix & rho) { assert(rho.iSpin()==PDT::Spin1); double modRho = abs(rho(0,2)); double max = 2.*z*modRho*(1.-z)+sqr(1.-(1.-z)*z)/(z*(1.-z)); vector > output; output.push_back(make_pair( 0,(rho(0,0)+rho(2,2))*sqr(1.-(1.-z)*z)/(z*(1.-z))/max)); output.push_back(make_pair(-2,-rho(0,2)*z*(1.-z)/max)); output.push_back(make_pair( 2,-rho(2,0)*z*(1.-z)/max)); return output; } vector > OneOneOneSplitFn::generatePhiBackward(const double z, const Energy2, const IdList &, const RhoDMatrix & rho) { assert(rho.iSpin()==PDT::Spin1); double diag = sqr(1 - (1 - z)*z)/(1 - z)/z; double off = (1.-z)/z; double max = 2.*abs(rho(0,2))*off+diag; vector > output; output.push_back(make_pair( 0, (rho(0,0)+rho(2,2))*diag/max)); output.push_back(make_pair( 2,-rho(0,2) * off/max)); output.push_back(make_pair(-2,-rho(2,0) * off/max)); return output; } DecayMEPtr OneOneOneSplitFn::matrixElement(const double z, const Energy2, const IdList &, const double phi, bool) { // calculate the kernal DecayMEPtr kernal(new_ptr(TwoBodyDecayMatrixElement(PDT::Spin1,PDT::Spin1,PDT::Spin1))); double omz = 1.-z; double root = sqrt(z*omz); Complex phase = exp(Complex(0.,1.)*phi); (*kernal)(0,0,0) = phase/root; (*kernal)(2,2,2) = -conj((*kernal)(0,0,0)); (*kernal)(0,0,2) = -sqr(z)/root/phase; (*kernal)(2,2,0) = -conj((*kernal)(0,0,2)); (*kernal)(0,2,0) = -sqr(omz)/root/phase; (*kernal)(2,0,2) = -conj((*kernal)(0,2,0)); (*kernal)(0,2,2) = 0.; (*kernal)(2,0,0) = 0.; return kernal; } diff --git a/Shower/SplittingFunctions/SplittingFunction.cc b/Shower/SplittingFunctions/SplittingFunction.cc --- a/Shower/SplittingFunctions/SplittingFunction.cc +++ b/Shower/SplittingFunctions/SplittingFunction.cc @@ -1,1028 +1,1025 @@ // -*- C++ -*- // // SplittingFunction.cc is a part of Herwig - A multi-purpose Monte Carlo event generator // Copyright (C) 2002-2011 The Herwig Collaboration // // Herwig is licenced under version 2 of the GPL, see COPYING for details. // Please respect the MCnet academic guidelines, see GUIDELINES for details. // // // This is the implementation of the non-inlined, non-templated member // functions of the SplittingFunction class. // #include "SplittingFunction.h" #include "ThePEG/Utilities/DescribeClass.h" #include "ThePEG/Persistency/PersistentOStream.h" #include "ThePEG/Persistency/PersistentIStream.h" #include "ThePEG/Interface/Switch.h" #include "ThePEG/Repository/UseRandom.h" #include "ThePEG/Utilities/EnumIO.h" #include "Herwig/Shower/Base/ShowerParticle.h" #include "ThePEG/Utilities/DescribeClass.h" using namespace Herwig; DescribeAbstractClass describeSplittingFunction ("Herwig::SplittingFunction",""); void SplittingFunction::Init() { static ClassDocumentation documentation ("The SplittingFunction class is the based class for 1->2 splitting functions" " in Herwig"); static Switch interfaceColourStructure ("ColourStructure", "The colour structure for the splitting function", &SplittingFunction::_colourStructure, Undefined, false, false); static SwitchOption interfaceColourStructureTripletTripletOctet (interfaceColourStructure, "TripletTripletOctet", "3 -> 3 8", TripletTripletOctet); static SwitchOption interfaceColourStructureOctetOctetOctet (interfaceColourStructure, "OctetOctetOctet", "8 -> 8 8", OctetOctetOctet); static SwitchOption interfaceColourStructureOctetTripletTriplet (interfaceColourStructure, "OctetTripletTriplet", "8 -> 3 3bar", OctetTripletTriplet); static SwitchOption interfaceColourStructureTripletOctetTriplet (interfaceColourStructure, "TripletOctetTriplet", "3 -> 8 3", TripletOctetTriplet); static SwitchOption interfaceColourStructureSextetSextetOctet (interfaceColourStructure, "SextetSextetOctet", "6 -> 6 8", SextetSextetOctet); static SwitchOption interfaceColourStructureChargedChargedNeutral (interfaceColourStructure, "ChargedChargedNeutral", "q -> q 0", ChargedChargedNeutral); static SwitchOption interfaceColourStructureNeutralChargedCharged (interfaceColourStructure, "NeutralChargedCharged", "0 -> q qbar", NeutralChargedCharged); static SwitchOption interfaceColourStructureChargedNeutralCharged (interfaceColourStructure, "ChargedNeutralCharged", "q -> 0 q", ChargedNeutralCharged); static SwitchOption interfaceColourStructureEW (interfaceColourStructure, "EW", "q -> q W/Z", EW); static Switch interfaceInteractionType ("InteractionType", "Type of the interaction", &SplittingFunction::_interactionType, ShowerInteraction::UNDEFINED, false, false); static SwitchOption interfaceInteractionTypeQCD (interfaceInteractionType, "QCD","QCD",ShowerInteraction::QCD); static SwitchOption interfaceInteractionTypeQED (interfaceInteractionType, "QED","QED",ShowerInteraction::QED); static SwitchOption interfaceInteractionTypeEW (interfaceInteractionType, "EW","EW",ShowerInteraction::EW); static Switch interfaceAngularOrdered ("AngularOrdered", "Whether or not this interaction is angular ordered, " "normally only g->q qbar and gamma-> f fbar are the only ones which aren't.", &SplittingFunction::angularOrdered_, true, false, false); static SwitchOption interfaceAngularOrderedYes (interfaceAngularOrdered, "Yes", "Interaction is angular ordered", true); static SwitchOption interfaceAngularOrderedNo (interfaceAngularOrdered, "No", "Interaction isn't angular ordered", false); } void SplittingFunction::persistentOutput(PersistentOStream & os) const { using namespace ShowerInteraction; os << oenum(_interactionType) << _interactionOrder << oenum(_colourStructure) << _colourFactor << angularOrdered_; } void SplittingFunction::persistentInput(PersistentIStream & is, int) { using namespace ShowerInteraction; is >> ienum(_interactionType) >> _interactionOrder >> ienum(_colourStructure) >> _colourFactor >> angularOrdered_; } void SplittingFunction::colourConnection(tShowerParticlePtr parent, tShowerParticlePtr first, tShowerParticlePtr second, ShowerPartnerType::Type partnerType, const bool back) const { if(_colourStructure==TripletTripletOctet) { if(!back) { ColinePair cparent = ColinePair(parent->colourLine(), parent->antiColourLine()); // ensure input consistency assert(( cparent.first && !cparent.second && partnerType==ShowerPartnerType::QCDColourLine) || ( !cparent.first && cparent.second && partnerType==ShowerPartnerType::QCDAntiColourLine)); // q -> q g if(cparent.first) { ColinePtr newline=new_ptr(ColourLine()); cparent.first->addColoured(second); newline->addColoured ( first); newline->addAntiColoured (second); } // qbar -> qbar g else { ColinePtr newline=new_ptr(ColourLine()); cparent.second->addAntiColoured(second); newline->addColoured(second); newline->addAntiColoured(first); } // Set progenitor first->progenitor(parent->progenitor()); second->progenitor(parent->progenitor()); } else { ColinePair cfirst = ColinePair(first->colourLine(), first->antiColourLine()); // ensure input consistency assert(( cfirst.first && !cfirst.second && partnerType==ShowerPartnerType::QCDColourLine) || ( !cfirst.first && cfirst.second && partnerType==ShowerPartnerType::QCDAntiColourLine)); // q -> q g if(cfirst.first) { ColinePtr newline=new_ptr(ColourLine()); cfirst.first->addAntiColoured(second); newline->addColoured(second); newline->addColoured(parent); } // qbar -> qbar g else { ColinePtr newline=new_ptr(ColourLine()); cfirst.second->addColoured(second); newline->addAntiColoured(second); newline->addAntiColoured(parent); } // Set progenitor parent->progenitor(first->progenitor()); second->progenitor(first->progenitor()); } } else if(_colourStructure==OctetOctetOctet) { if(!back) { ColinePair cparent = ColinePair(parent->colourLine(), parent->antiColourLine()); // ensure input consistency assert(cparent.first&&cparent.second); // ensure first gluon is hardest if( first->id()==second->id() && parent->showerKinematics()->z()<0.5 ) swap(first,second); // colour line radiates if(partnerType==ShowerPartnerType::QCDColourLine) { // The colour line is radiating ColinePtr newline=new_ptr(ColourLine()); cparent.first->addColoured(second); cparent.second->addAntiColoured(first); newline->addColoured(first); newline->addAntiColoured(second); } // anti colour line radiates else if(partnerType==ShowerPartnerType::QCDAntiColourLine) { ColinePtr newline=new_ptr(ColourLine()); cparent.first->addColoured(first); cparent.second->addAntiColoured(second); newline->addColoured(second); newline->addAntiColoured(first); } else assert(false); } else { ColinePair cfirst = ColinePair(first->colourLine(), first->antiColourLine()); // ensure input consistency assert(cfirst.first&&cfirst.second); // The colour line is radiating if(partnerType==ShowerPartnerType::QCDColourLine) { ColinePtr newline=new_ptr(ColourLine()); cfirst.first->addAntiColoured(second); cfirst.second->addAntiColoured(parent); newline->addColoured(parent); newline->addColoured(second); } // anti colour line radiates else if(partnerType==ShowerPartnerType::QCDAntiColourLine) { ColinePtr newline=new_ptr(ColourLine()); cfirst.first->addColoured(parent); cfirst.second->addColoured(second); newline->addAntiColoured(second); newline->addAntiColoured(parent); } else assert(false); } } else if(_colourStructure == OctetTripletTriplet) { if(!back) { ColinePair cparent = ColinePair(parent->colourLine(), parent->antiColourLine()); // ensure input consistency assert(cparent.first&&cparent.second); cparent.first ->addColoured ( first); cparent.second->addAntiColoured(second); // Set progenitor first->progenitor(parent->progenitor()); second->progenitor(parent->progenitor()); } else { ColinePair cfirst = ColinePair(first->colourLine(), first->antiColourLine()); // ensure input consistency assert(( cfirst.first && !cfirst.second) || (!cfirst.first && cfirst.second)); // g -> q qbar if(cfirst.first) { ColinePtr newline=new_ptr(ColourLine()); cfirst.first->addColoured(parent); newline->addAntiColoured(second); newline->addAntiColoured(parent); } // g -> qbar q else { ColinePtr newline=new_ptr(ColourLine()); cfirst.second->addAntiColoured(parent); newline->addColoured(second); newline->addColoured(parent); } // Set progenitor parent->progenitor(first->progenitor()); second->progenitor(first->progenitor()); } } else if(_colourStructure == TripletOctetTriplet) { if(!back) { ColinePair cparent = ColinePair(parent->colourLine(), parent->antiColourLine()); // ensure input consistency assert(( cparent.first && !cparent.second) || (!cparent.first && cparent.second)); // q -> g q if(cparent.first) { ColinePtr newline=new_ptr(ColourLine()); cparent.first->addColoured(first); newline->addColoured (second); newline->addAntiColoured( first); } // qbar -> g qbar else { ColinePtr newline=new_ptr(ColourLine()); cparent.second->addAntiColoured(first); newline->addColoured ( first); newline->addAntiColoured(second); } // Set progenitor first->progenitor(parent->progenitor()); second->progenitor(parent->progenitor()); } else { ColinePair cfirst = ColinePair(first->colourLine(), first->antiColourLine()); // ensure input consistency assert(cfirst.first&&cfirst.second); // q -> g q if(parent->id()>0) { cfirst.first ->addColoured(parent); cfirst.second->addColoured(second); } else { cfirst.first ->addAntiColoured(second); cfirst.second->addAntiColoured(parent); } // Set progenitor parent->progenitor(first->progenitor()); second->progenitor(first->progenitor()); } } else if(_colourStructure==SextetSextetOctet) { //make sure we're not doing backward evolution assert(!back); //make sure something sensible assert(parent->colourLine() || parent->antiColourLine()); //get the colour lines or anti-colour lines bool isAntiColour=true; ColinePair cparent; if(parent->colourLine()) { cparent = ColinePair(const_ptr_cast(parent->colourInfo()->colourLines()[0]), const_ptr_cast(parent->colourInfo()->colourLines()[1])); isAntiColour=false; } else { cparent = ColinePair(const_ptr_cast(parent->colourInfo()->antiColourLines()[0]), const_ptr_cast(parent->colourInfo()->antiColourLines()[1])); } //check for sensible input // assert(cparent.first && cparent.second); // sextet has 2 colour lines if(!isAntiColour) { //pick at random which of the colour topolgies to take double topology = UseRandom::rnd(); if(topology < 0.25) { ColinePtr newline=new_ptr(ColourLine()); cparent.first->addColoured(second); cparent.second->addColoured(first); newline->addColoured(first); newline->addAntiColoured(second); } else if(topology >=0.25 && topology < 0.5) { ColinePtr newline=new_ptr(ColourLine()); cparent.first->addColoured(first); cparent.second->addColoured(second); newline->addColoured(first); newline->addAntiColoured(second); } else if(topology >= 0.5 && topology < 0.75) { ColinePtr newline=new_ptr(ColourLine()); cparent.first->addColoured(second); cparent.second->addColoured(first); newline->addColoured(first); newline->addAntiColoured(second); } else { ColinePtr newline=new_ptr(ColourLine()); cparent.first->addColoured(first); cparent.second->addColoured(second); newline->addColoured(first); newline->addAntiColoured(second); } } // sextet has 2 anti-colour lines else { double topology = UseRandom::rnd(); if(topology < 0.25){ ColinePtr newline=new_ptr(ColourLine()); cparent.first->addAntiColoured(second); cparent.second->addAntiColoured(first); newline->addAntiColoured(first); newline->addColoured(second); } else if(topology >=0.25 && topology < 0.5) { ColinePtr newline=new_ptr(ColourLine()); cparent.first->addAntiColoured(first); cparent.second->addAntiColoured(second); newline->addAntiColoured(first); newline->addColoured(second); } else if(topology >= 0.5 && topology < 0.75) { ColinePtr newline=new_ptr(ColourLine()); cparent.first->addAntiColoured(second); cparent.second->addAntiColoured(first); newline->addAntiColoured(first); newline->addColoured(second); } else { ColinePtr newline=new_ptr(ColourLine()); cparent.first->addAntiColoured(first); cparent.second->addAntiColoured(second); newline->addAntiColoured(first); newline->addColoured(second); } } } else if(_colourStructure == ChargedChargedNeutral) { if(!parent->data().coloured()) return; if(!back) { ColinePair cparent = ColinePair(parent->colourLine(), parent->antiColourLine()); // q -> q g if(cparent.first) { cparent.first->addColoured(first); } // qbar -> qbar g if(cparent.second) { cparent.second->addAntiColoured(first); } } else { ColinePair cfirst = ColinePair(first->colourLine(), first->antiColourLine()); // q -> q g if(cfirst.first) { cfirst.first->addColoured(parent); } // qbar -> qbar g if(cfirst.second) { cfirst.second->addAntiColoured(parent); } } } else if(_colourStructure == ChargedNeutralCharged) { if(!parent->data().coloured()) return; if(!back) { ColinePair cparent = ColinePair(parent->colourLine(), parent->antiColourLine()); // q -> q g if(cparent.first) { cparent.first->addColoured(second); } // qbar -> qbar g if(cparent.second) { cparent.second->addAntiColoured(second); } } else { if (second->dataPtr()->iColour()==PDT::Colour3 ) { ColinePtr newline=new_ptr(ColourLine()); newline->addColoured(second); newline->addColoured(parent); } else if (second->dataPtr()->iColour()==PDT::Colour3bar ) { ColinePtr newline=new_ptr(ColourLine()); newline->addAntiColoured(second); newline->addAntiColoured(parent); } } } else if(_colourStructure == NeutralChargedCharged ) { if(!back) { if(first->dataPtr()->coloured()) { ColinePtr newline=new_ptr(ColourLine()); if(first->dataPtr()->iColour()==PDT::Colour3) { newline->addColoured (first ); newline->addAntiColoured(second); } else if (first->dataPtr()->iColour()==PDT::Colour3bar) { newline->addColoured (second); newline->addAntiColoured(first ); } else assert(false); } } else { ColinePair cfirst = ColinePair(first->colourLine(), first->antiColourLine()); // gamma -> q qbar if(cfirst.first) { cfirst.first->addAntiColoured(second); } // gamma -> qbar q else if(cfirst.second) { cfirst.second->addColoured(second); } else assert(false); } } else if(_colourStructure == EW) { if(!parent->data().coloured()) return; if(!back) { ColinePair cparent = ColinePair(parent->colourLine(), parent->antiColourLine()); // q -> q g if(cparent.first) { cparent.first->addColoured(first); } // qbar -> qbar g if(cparent.second) { cparent.second->addAntiColoured(first); } } else { ColinePair cfirst = ColinePair(first->colourLine(), first->antiColourLine()); // q -> q g if(cfirst.first) { cfirst.first->addColoured(parent); } // qbar -> qbar g if(cfirst.second) { cfirst.second->addAntiColoured(parent); } } } else { assert(false); } } void SplittingFunction::doinit() { Interfaced::doinit(); assert(_interactionType!=ShowerInteraction::UNDEFINED); assert((_colourStructure>0&&_interactionType==ShowerInteraction::QCD) || (_colourStructure<0&&(_interactionType==ShowerInteraction::QED || _interactionType==ShowerInteraction::EW)) ); if(_colourFactor>0.) return; // compute the colour factors if need if(_colourStructure==TripletTripletOctet) { _colourFactor = 4./3.; } else if(_colourStructure==OctetOctetOctet) { _colourFactor = 3.; } else if(_colourStructure==OctetTripletTriplet) { _colourFactor = 0.5; } else if(_colourStructure==TripletOctetTriplet) { _colourFactor = 4./3.; } else if(_colourStructure==SextetSextetOctet) { _colourFactor = 10./3.; } else if(_colourStructure<0) { _colourFactor = 1.; } else { assert(false); } } bool SplittingFunction::checkColours(const IdList & ids) const { - tcPDPtr pd[3]={getParticleData(ids[0]), - getParticleData(ids[1]), - getParticleData(ids[2])}; if(_colourStructure==TripletTripletOctet) { if(ids[0]!=ids[1]) return false; - if((pd[0]->iColour()==PDT::Colour3||pd[0]->iColour()==PDT::Colour3bar) && - pd[2]->iColour()==PDT::Colour8) return true; + if((ids[0]->iColour()==PDT::Colour3||ids[0]->iColour()==PDT::Colour3bar) && + ids[2]->iColour()==PDT::Colour8) return true; return false; } else if(_colourStructure==OctetOctetOctet) { for(unsigned int ix=0;ix<3;++ix) { - if(pd[ix]->iColour()!=PDT::Colour8) return false; + if(ids[ix]->iColour()!=PDT::Colour8) return false; } return true; } else if(_colourStructure==OctetTripletTriplet) { - if(pd[0]->iColour()!=PDT::Colour8) return false; - if(pd[1]->iColour()==PDT::Colour3&&pd[2]->iColour()==PDT::Colour3bar) + if(ids[0]->iColour()!=PDT::Colour8) return false; + if(ids[1]->iColour()==PDT::Colour3&&ids[2]->iColour()==PDT::Colour3bar) return true; - if(pd[1]->iColour()==PDT::Colour3bar&&pd[2]->iColour()==PDT::Colour3) + if(ids[1]->iColour()==PDT::Colour3bar&&ids[2]->iColour()==PDT::Colour3) return true; return false; } else if(_colourStructure==TripletOctetTriplet) { if(ids[0]!=ids[2]) return false; - if((pd[0]->iColour()==PDT::Colour3||pd[0]->iColour()==PDT::Colour3bar) && - pd[1]->iColour()==PDT::Colour8) return true; + if((ids[0]->iColour()==PDT::Colour3||ids[0]->iColour()==PDT::Colour3bar) && + ids[1]->iColour()==PDT::Colour8) return true; return false; } else if(_colourStructure==SextetSextetOctet) { if(ids[0]!=ids[1]) return false; - if((pd[0]->iColour()==PDT::Colour6 || pd[0]->iColour()==PDT::Colour6bar) && - pd[2]->iColour()==PDT::Colour8) return true; + if((ids[0]->iColour()==PDT::Colour6 || ids[0]->iColour()==PDT::Colour6bar) && + ids[2]->iColour()==PDT::Colour8) return true; return false; } else if(_colourStructure==ChargedChargedNeutral) { if(ids[0]!=ids[1]) return false; - if(pd[2]->iCharge()!=0) return false; - if(pd[0]->iCharge()==pd[1]->iCharge()) return true; + if(ids[2]->iCharge()!=0) return false; + if(ids[0]->iCharge()==ids[1]->iCharge()) return true; return false; } else if(_colourStructure==ChargedNeutralCharged) { if(ids[0]!=ids[2]) return false; - if(pd[1]->iCharge()!=0) return false; - if(pd[0]->iCharge()==pd[2]->iCharge()) return true; + if(ids[1]->iCharge()!=0) return false; + if(ids[0]->iCharge()==ids[2]->iCharge()) return true; return false; } else if(_colourStructure==NeutralChargedCharged) { - if(ids[1]!=-ids[2]) return false; - if(pd[0]->iCharge()!=0) return false; - if(pd[1]->iCharge()==-pd[2]->iCharge()) return true; + if(ids[1]->id()!=-ids[2]->id()) return false; + if(ids[0]->iCharge()!=0) return false; + if(ids[1]->iCharge()==-ids[2]->iCharge()) return true; return false; } else { assert(false); } return false; } namespace { bool hasColour(tPPtr p) { PDT::Colour colour = p->dataPtr()->iColour(); return colour==PDT::Colour3 || colour==PDT::Colour8 || colour == PDT::Colour6; } bool hasAntiColour(tPPtr p) { PDT::Colour colour = p->dataPtr()->iColour(); return colour==PDT::Colour3bar || colour==PDT::Colour8 || colour == PDT::Colour6bar; } } void SplittingFunction::evaluateFinalStateScales(ShowerPartnerType::Type partnerType, Energy scale, double z, tShowerParticlePtr parent, tShowerParticlePtr emitter, tShowerParticlePtr emitted) { // identify emitter and emitted double zEmitter = z, zEmitted = 1.-z; bool bosonSplitting(false); // special for g -> gg, particle highest z is emitter if(emitter->id() == emitted->id() && emitter->id() == parent->id() && zEmitted > zEmitter) { swap(zEmitted,zEmitter); swap( emitted, emitter); } // otherwise if particle ID same else if(emitted->id()==parent->id()) { swap(zEmitted,zEmitter); swap( emitted, emitter); } // no real emitter/emitted else if(emitter->id()!=parent->id()) { bosonSplitting = true; } // may need to add angularOrder flag here // now the various scales // QED if(partnerType==ShowerPartnerType::QED) { assert(colourStructure()==ChargedChargedNeutral || colourStructure()==ChargedNeutralCharged || colourStructure()==NeutralChargedCharged ); // normal case if(!bosonSplitting) { assert(colourStructure()==ChargedChargedNeutral || colourStructure()==ChargedNeutralCharged ); // set the scales // emitter emitter->scales().QED = zEmitter*scale; emitter->scales().QED_noAO = scale; emitter->scales().QCD_c = min(scale,parent->scales().QCD_c ); emitter->scales().QCD_c_noAO = min(scale,parent->scales().QCD_c_noAO ); emitter->scales().QCD_ac = min(scale,parent->scales().QCD_ac ); emitter->scales().QCD_ac_noAO = min(scale,parent->scales().QCD_ac_noAO); emitter->scales().EW = min(scale,parent->scales().EW ); emitter->scales().EW_noAO = min(scale,parent->scales().EW_noAO ); // emitted emitted->scales().QED = zEmitted*scale; emitted->scales().QED_noAO = scale; emitted->scales().QCD_c = ZERO; emitted->scales().QCD_c_noAO = ZERO; emitted->scales().QCD_ac = ZERO; emitted->scales().QCD_ac_noAO = ZERO; emitted->scales().EW = min(scale,parent->scales().EW ); emitted->scales().EW_noAO = min(scale,parent->scales().EW_noAO ); } // gamma -> f fbar else { assert(colourStructure()==NeutralChargedCharged ); // emitter emitter->scales().QED = zEmitter*scale; emitter->scales().QED_noAO = scale; if(hasColour(emitter)) { emitter->scales().QCD_c = zEmitter*scale; emitter->scales().QCD_c_noAO = scale; } if(hasAntiColour(emitter)) { emitter->scales().QCD_ac = zEmitter*scale; emitter->scales().QCD_ac_noAO = scale; } emitter->scales().EW = zEmitter*scale; emitter->scales().EW_noAO = scale; // emitted emitted->scales().QED = zEmitted*scale; emitted->scales().QED_noAO = scale; if(hasColour(emitted)) { emitted->scales().QCD_c = zEmitted*scale; emitted->scales().QCD_c_noAO = scale; } if(hasAntiColour(emitted)) { emitted->scales().QCD_ac = zEmitted*scale; emitted->scales().QCD_ac_noAO = scale; } emitted->scales().EW = zEmitted*scale; emitted->scales().EW_noAO = scale; } } // QCD else if (partnerType==ShowerPartnerType::QCDColourLine || partnerType==ShowerPartnerType::QCDAntiColourLine) { // normal case eg q -> q g and g -> g g if(!bosonSplitting) { emitter->scales().QED = min(scale,parent->scales().QED ); emitter->scales().QED_noAO = min(scale,parent->scales().QED_noAO); emitter->scales().EW = min(scale,parent->scales().EW ); emitter->scales().EW_noAO = min(scale,parent->scales().EW_noAO); if(partnerType==ShowerPartnerType::QCDColourLine) { emitter->scales().QCD_c = zEmitter*scale; emitter->scales().QCD_c_noAO = scale; emitter->scales().QCD_ac = min(zEmitter*scale,parent->scales().QCD_ac ); emitter->scales().QCD_ac_noAO = min( scale,parent->scales().QCD_ac_noAO); } else { emitter->scales().QCD_c = min(zEmitter*scale,parent->scales().QCD_c ); emitter->scales().QCD_c_noAO = min( scale,parent->scales().QCD_c_noAO ); emitter->scales().QCD_ac = zEmitter*scale; emitter->scales().QCD_ac_noAO = scale; } // emitted emitted->scales().QED = ZERO; emitted->scales().QED_noAO = ZERO; emitted->scales().QCD_c = zEmitted*scale; emitted->scales().QCD_c_noAO = scale; emitted->scales().QCD_ac = zEmitted*scale; emitted->scales().QCD_ac_noAO = scale; emitted->scales().EW = min(scale,parent->scales().EW ); emitted->scales().EW_noAO = min(scale,parent->scales().EW_noAO); } // g -> q qbar else { // emitter if(emitter->dataPtr()->charged()) { emitter->scales().QED = zEmitter*scale; emitter->scales().QED_noAO = scale; } emitter->scales().EW = zEmitter*scale; emitter->scales().EW_noAO = scale; emitter->scales().QCD_c = zEmitter*scale; emitter->scales().QCD_c_noAO = scale; emitter->scales().QCD_ac = zEmitter*scale; emitter->scales().QCD_ac_noAO = scale; // emitted if(emitted->dataPtr()->charged()) { emitted->scales().QED = zEmitted*scale; emitted->scales().QED_noAO = scale; } emitted->scales().EW = zEmitted*scale; emitted->scales().EW_noAO = scale; emitted->scales().QCD_c = zEmitted*scale; emitted->scales().QCD_c_noAO = scale; emitted->scales().QCD_ac = zEmitted*scale; emitted->scales().QCD_ac_noAO = scale; } } else if(partnerType==ShowerPartnerType::EW) { // EW emitter->scales().EW = zEmitter*scale; emitter->scales().EW_noAO = scale; emitted->scales().EW = zEmitted*scale; emitted->scales().EW_noAO = scale; // QED // W radiation AO if(emitted->dataPtr()->charged()) { emitter->scales().QED = zEmitter*scale; emitter->scales().QED_noAO = scale; emitted->scales().QED = zEmitted*scale; emitted->scales().QED_noAO = scale; } // Z don't else { emitter->scales().QED = min(scale,parent->scales().QED ); emitter->scales().QED_noAO = min(scale,parent->scales().QED_noAO); emitted->scales().QED = ZERO; emitted->scales().QED_noAO = ZERO; } // QCD emitter->scales().QCD_c = min(scale,parent->scales().QCD_c ); emitter->scales().QCD_c_noAO = min(scale,parent->scales().QCD_c_noAO ); emitter->scales().QCD_ac = min(scale,parent->scales().QCD_ac ); emitter->scales().QCD_ac_noAO = min(scale,parent->scales().QCD_ac_noAO); emitted->scales().QCD_c = ZERO; emitted->scales().QCD_c_noAO = ZERO; emitted->scales().QCD_ac = ZERO; emitted->scales().QCD_ac_noAO = ZERO; } else assert(false); } void SplittingFunction::evaluateInitialStateScales(ShowerPartnerType::Type partnerType, Energy scale, double z, tShowerParticlePtr parent, tShowerParticlePtr spacelike, tShowerParticlePtr timelike) { // scale for time-like child Energy AOScale = (1.-z)*scale; // QED if(partnerType==ShowerPartnerType::QED) { if(parent->id()==spacelike->id()) { // parent parent ->scales().QED = scale; parent ->scales().QED_noAO = scale; parent ->scales().QCD_c = min(scale,spacelike->scales().QCD_c ); parent ->scales().QCD_c_noAO = min(scale,spacelike->scales().QCD_c_noAO ); parent ->scales().QCD_ac = min(scale,spacelike->scales().QCD_ac ); parent ->scales().QCD_ac_noAO = min(scale,spacelike->scales().QCD_ac_noAO); // timelike timelike->scales().QED = AOScale; timelike->scales().QED_noAO = scale; timelike->scales().QCD_c = ZERO; timelike->scales().QCD_c_noAO = ZERO; timelike->scales().QCD_ac = ZERO; timelike->scales().QCD_ac_noAO = ZERO; } else if(parent->id()==timelike->id()) { parent ->scales().QED = scale; parent ->scales().QED_noAO = scale; if(hasColour(parent)) { parent ->scales().QCD_c = scale; parent ->scales().QCD_c_noAO = scale; } if(hasAntiColour(parent)) { parent ->scales().QCD_ac = scale; parent ->scales().QCD_ac_noAO = scale; } // timelike timelike->scales().QED = AOScale; timelike->scales().QED_noAO = scale; if(hasColour(timelike)) { timelike->scales().QCD_c = AOScale; timelike->scales().QCD_c_noAO = scale; } if(hasAntiColour(timelike)) { timelike->scales().QCD_ac = AOScale; timelike->scales().QCD_ac_noAO = scale; } } else { parent ->scales().QED = scale; parent ->scales().QED_noAO = scale; parent ->scales().QCD_c = ZERO ; parent ->scales().QCD_c_noAO = ZERO ; parent ->scales().QCD_ac = ZERO ; parent ->scales().QCD_ac_noAO = ZERO ; // timelike timelike->scales().QED = AOScale; timelike->scales().QED_noAO = scale; if(hasColour(timelike)) { timelike->scales().QCD_c = min(AOScale,spacelike->scales().QCD_ac ); timelike->scales().QCD_c_noAO = min( scale,spacelike->scales().QCD_ac_noAO); } if(hasAntiColour(timelike)) { timelike->scales().QCD_ac = min(AOScale,spacelike->scales().QCD_c ); timelike->scales().QCD_ac_noAO = min( scale,spacelike->scales().QCD_c_noAO ); } } } // QCD else if (partnerType==ShowerPartnerType::QCDColourLine || partnerType==ShowerPartnerType::QCDAntiColourLine) { // timelike if(timelike->dataPtr()->charged()) { timelike->scales().QED = AOScale; timelike->scales().QED_noAO = scale; } if(hasColour(timelike)) { timelike->scales().QCD_c = AOScale; timelike->scales().QCD_c_noAO = scale; } if(hasAntiColour(timelike)) { timelike->scales().QCD_ac = AOScale; timelike->scales().QCD_ac_noAO = scale; } if(parent->id()==spacelike->id()) { parent ->scales().QED = min(scale,spacelike->scales().QED ); parent ->scales().QED_noAO = min(scale,spacelike->scales().QED_noAO ); parent ->scales().QCD_c = min(scale,spacelike->scales().QCD_c ); parent ->scales().QCD_c_noAO = min(scale,spacelike->scales().QCD_c_noAO ); parent ->scales().QCD_ac = min(scale,spacelike->scales().QCD_ac ); parent ->scales().QCD_ac_noAO = min(scale,spacelike->scales().QCD_ac_noAO); } else { if(parent->dataPtr()->charged()) { parent ->scales().QED = scale; parent ->scales().QED_noAO = scale; } if(hasColour(parent)) { parent ->scales().QCD_c = scale; parent ->scales().QCD_c_noAO = scale; } if(hasAntiColour(parent)) { parent ->scales().QCD_ac = scale; parent ->scales().QCD_ac_noAO = scale; } } } else if(partnerType==ShowerPartnerType::EW) { if(abs(spacelike->id())!=ParticleID::Wplus && spacelike->id() !=ParticleID::Z0 ) { // QCD scales parent ->scales().QCD_c = min(scale,spacelike->scales().QCD_c ); parent ->scales().QCD_c_noAO = min(scale,spacelike->scales().QCD_c_noAO ); parent ->scales().QCD_ac = min(scale,spacelike->scales().QCD_ac ); parent ->scales().QCD_ac_noAO = min(scale,spacelike->scales().QCD_ac_noAO); timelike->scales().QCD_c = ZERO; timelike->scales().QCD_c_noAO = ZERO; timelike->scales().QCD_ac = ZERO; timelike->scales().QCD_ac_noAO = ZERO; // QED scales if(timelike->id()==ParticleID::Z0) { parent ->scales().QED = min(scale,spacelike->scales().QED ); parent ->scales().QED_noAO = min(scale,spacelike->scales().QED_noAO ); timelike->scales().QED = ZERO; timelike->scales().QED_noAO = ZERO; } else { parent ->scales().QED = scale; parent ->scales().QED_noAO = scale; timelike->scales().QED = AOScale; timelike->scales().QED_noAO = scale; } // EW scales parent ->scales().EW = scale; parent ->scales().EW_noAO = scale; timelike->scales().EW = AOScale; timelike->scales().EW_noAO = scale; } else assert(false); } else assert(false); } void SplittingFunction::evaluateDecayScales(ShowerPartnerType::Type partnerType, Energy scale, double z, tShowerParticlePtr parent, tShowerParticlePtr spacelike, tShowerParticlePtr timelike) { assert(parent->id()==spacelike->id()); // angular-ordered scale for 2nd child Energy AOScale = (1.-z)*scale; // QED if(partnerType==ShowerPartnerType::QED) { // timelike timelike->scales().QED = AOScale; timelike->scales().QED_noAO = scale; timelike->scales().QCD_c = ZERO; timelike->scales().QCD_c_noAO = ZERO; timelike->scales().QCD_ac = ZERO; timelike->scales().QCD_ac_noAO = ZERO; timelike->scales().EW = ZERO; timelike->scales().EW_noAO = ZERO; // spacelike spacelike->scales().QED = scale; spacelike->scales().QED_noAO = scale; spacelike->scales().EW = max(scale,parent->scales().EW ); spacelike->scales().EW_noAO = max(scale,parent->scales().EW_noAO ); } // QCD else if(partnerType==ShowerPartnerType::QCDColourLine || partnerType==ShowerPartnerType::QCDAntiColourLine) { // timelike timelike->scales().QED = ZERO; timelike->scales().QED_noAO = ZERO; timelike->scales().QCD_c = AOScale; timelike->scales().QCD_c_noAO = scale; timelike->scales().QCD_ac = AOScale; timelike->scales().QCD_ac_noAO = scale; timelike->scales().EW = ZERO; timelike->scales().EW_noAO = ZERO; // spacelike spacelike->scales().QED = max(scale,parent->scales().QED ); spacelike->scales().QED_noAO = max(scale,parent->scales().QED_noAO ); spacelike->scales().EW = max(scale,parent->scales().EW ); spacelike->scales().EW_noAO = max(scale,parent->scales().EW_noAO ); } else if(partnerType==ShowerPartnerType::EW) { // EW timelike->scales().EW = AOScale; timelike->scales().EW_noAO = scale; spacelike->scales().EW = max(scale,parent->scales().EW ); spacelike->scales().EW_noAO = max(scale,parent->scales().EW_noAO ); // QCD timelike->scales().QCD_c = ZERO; timelike->scales().QCD_c_noAO = ZERO; timelike->scales().QCD_ac = ZERO; timelike->scales().QCD_ac_noAO = ZERO; timelike->scales().EW = ZERO; timelike->scales().EW_noAO = ZERO; // QED timelike->scales().QED = ZERO; timelike->scales().QED_noAO = ZERO; spacelike->scales().QED = max(scale,parent->scales().QED ); spacelike->scales().QED_noAO = max(scale,parent->scales().QED_noAO ); } else assert(false); spacelike->scales().QCD_c = max(scale,parent->scales().QCD_c ); spacelike->scales().QCD_c_noAO = max(scale,parent->scales().QCD_c_noAO ); spacelike->scales().QCD_ac = max(scale,parent->scales().QCD_ac ); spacelike->scales().QCD_ac_noAO = max(scale,parent->scales().QCD_ac_noAO); } diff --git a/Shower/SplittingFunctions/SplittingFunction.h b/Shower/SplittingFunctions/SplittingFunction.h --- a/Shower/SplittingFunctions/SplittingFunction.h +++ b/Shower/SplittingFunctions/SplittingFunction.h @@ -1,374 +1,372 @@ // -*- C++ -*- // // SplittingFunction.h is a part of Herwig - A multi-purpose Monte Carlo event generator // Copyright (C) 2002-2011 The Herwig Collaboration // // Herwig is licenced under version 2 of the GPL, see COPYING for details. // Please respect the MCnet academic guidelines, see GUIDELINES for details. // #ifndef HERWIG_SplittingFunction_H #define HERWIG_SplittingFunction_H // // This is the declaration of the SplittingFunction class. // #include "ThePEG/Interface/Interfaced.h" #include "Herwig/Shower/ShowerConfig.h" #include "ThePEG/EventRecord/RhoDMatrix.h" #include "Herwig/Decay/DecayMatrixElement.h" #include "Herwig/Shower/Base/ShowerKinematics.fh" #include "ThePEG/EventRecord/ColourLine.h" #include "ThePEG/PDT/ParticleData.h" #include "SplittingFunction.fh" namespace Herwig { using namespace ThePEG; /** \ingroup Shower * Enum to define the possible types of colour structure which can occur in * the branching. */ enum ColourStructure {Undefined=0, TripletTripletOctet = 1,OctetOctetOctet =2, OctetTripletTriplet = 3,TripletOctetTriplet=4, SextetSextetOctet = 5, ChargedChargedNeutral=-1,ChargedNeutralCharged=-2, NeutralChargedCharged=-3,EW=-4}; /** \ingroup Shower * * This is an abstract class which defines the common interface * for all \f$1\to2\f$ splitting functions, for both initial-state * and final-state radiation. * * The SplittingFunction class contains a number of purely virtual members * which must be implemented in the inheriting classes. The class also stores * the interaction type of the spltting function. * * The inheriting classes need to specific the splitting function * \f$P(z,2p_j\cdot p_k)\f$, in terms of the energy fraction \f$z\f$ and * the evolution scale. In order to allow the splitting functions to be used * with different choices of evolution functions the scale is given by * \f[2p_j\cdot p_k=(p_j+p_k)^2-m_{jk}^2=Q^2-(p_j+p_k)^2=z(1-z)\tilde{q}^2= * \frac{p_T^2}{z(1-z)}-m_{jk}^2+\frac{m_j^2}{z}+\frac{m_k^2}{1-z},\f] * where \f$Q^2\f$ is the virtuality of the branching particle, * $p_T$ is the relative transverse momentum of the branching products and * \f$\tilde{q}^2\f$ is the angular variable described in hep-ph/0310083. * * In addition an overestimate of the * splitting function, \f$P_{\rm over}(z)\f$ which only depends upon \f$z\f$, * the integral, inverse of the integral for this overestimate and * ratio of the true splitting function to the overestimate must be provided * as they are necessary for the veto alogrithm used to implement the evolution. * * @see \ref SplittingFunctionInterfaces "The interfaces" * defined for SplittingFunction. */ class SplittingFunction: public Interfaced { public: /** * The default constructor. * @param b All splitting functions must have an interaction order */ SplittingFunction(unsigned int b) : Interfaced(), _interactionType(ShowerInteraction::UNDEFINED), _interactionOrder(b), _colourStructure(Undefined), _colourFactor(-1.), angularOrdered_(true) {} public: /** * Methods to return the interaction type and order for the splitting function */ //@{ /** * Return the type of the interaction */ ShowerInteraction::Type interactionType() const {return _interactionType;} /** * Return the order of the splitting function in the interaction */ unsigned int interactionOrder() const {return _interactionOrder;} /** * Return the colour structure */ ColourStructure colourStructure() const {return _colourStructure;} /** * Return the colour factor */ double colourFactor(const IdList &ids) const { if(_colourStructure>0) return _colourFactor; else if(_colourStructure<0) { if(_colourStructure==ChargedChargedNeutral || _colourStructure==ChargedNeutralCharged) { - tPDPtr part=getParticleData(ids[0]); - return sqr(double(part->iCharge())/3.); + return sqr(double(ids[0]->iCharge())/3.); } else { - tPDPtr part=getParticleData(ids[1]); - return sqr(double(part->iCharge())/3.); + return sqr(double(ids[1]->iCharge())/3.); } } else assert(false); } //@} /** * Purely virtual method which should determine whether this splitting * function can be used for a given set of particles. * @param ids The PDG codes for the particles in the splitting. */ virtual bool accept(const IdList & ids) const = 0; /** * Method to check the colours are correct */ virtual bool checkColours(const IdList & ids) const; /** * Methods to return the splitting function. */ //@{ /** * Purely virtual method which should return the exact value of the splitting function, * \f$P\f$ evaluated in terms of the energy fraction, \f$z\f$, and the evolution scale \f$\tilde{q}^2\f$. * @param z The energy fraction. * @param t The scale \f$t=2p_j\cdot p_k\f$. * @param ids The PDG codes for the particles in the splitting. * @param mass Whether or not to include the mass dependent terms * @param rho The spin density matrix */ virtual double P(const double z, const Energy2 t, const IdList & ids, const bool mass, const RhoDMatrix & rho) const = 0; /** * Purely virtual method which should return * an overestimate of the splitting function, * \f$P_{\rm over}\f$ such that the result \f$P_{\rm over}\geq P\f$. This function * should be simple enough that it does not depend on the evolution scale. * @param z The energy fraction. * @param ids The PDG codes for the particles in the splitting. */ virtual double overestimateP(const double z, const IdList & ids) const = 0; /** * Purely virtual method which should return * the ratio of the splitting function to the overestimate, i.e. * \f$P(z,\tilde{q}^2)/P_{\rm over}(z)\f$. * @param z The energy fraction. * @param t The scale \f$t=2p_j\cdot p_k\f$. * @param ids The PDG codes for the particles in the splitting. * @param mass Whether or not to include the mass dependent terms * @param rho The spin density matrix */ virtual double ratioP(const double z, const Energy2 t, const IdList & ids, const bool mass, const RhoDMatrix & rho) const = 0; /** * Purely virtual method which should return the indefinite integral of the * overestimated splitting function, \f$P_{\rm over}\f$. * @param z The energy fraction. * @param ids The PDG codes for the particles in the splitting. * @param PDFfactor Which additional factor to include for the PDF * 0 is no additional factor, * 1 is \f$1/z\f$, 2 is \f$1/(1-z)\f$ and 3 is \f$1/z/(1-z)\f$ * */ virtual double integOverP(const double z, const IdList & ids, unsigned int PDFfactor=0) const = 0; /** * Purely virtual method which should return the inverse of the * indefinite integral of the * overestimated splitting function, \f$P_{\rm over}\f$ which is used to * generate the value of \f$z\f$. * @param r Value of the splitting function to be inverted * @param ids The PDG codes for the particles in the splitting. * @param PDFfactor Which additional factor to include for the PDF * 0 is no additional factor, * 1 is \f$1/z\f$, 2 is \f$1/(1-z)\f$ and 3 is \f$1/z/(1-z)\f$ */ virtual double invIntegOverP(const double r, const IdList & ids, unsigned int PDFfactor=0) const = 0; //@} /** * Purely virtual method which should make the proper colour connection * between the emitting parent and the branching products. * @param parent The parent for the branching * @param first The first branching product * @param second The second branching product * @param partnerType The type of evolution partner * @param back Whether this is foward or backward evolution. */ virtual void colourConnection(tShowerParticlePtr parent, tShowerParticlePtr first, tShowerParticlePtr second, ShowerPartnerType::Type partnerType, const bool back) const; /** * Method to calculate the azimuthal angle for forward evolution * @param z The energy fraction * @param t The scale \f$t=2p_j\cdot p_k\f$. * @param ids The PDG codes for the particles in the splitting. * @param The azimuthal angle, \f$\phi\f$. * @return The weight */ virtual vector > generatePhiForward(const double z, const Energy2 t, const IdList & ids, const RhoDMatrix &) = 0; /** * Method to calculate the azimuthal angle for backward evolution * @param z The energy fraction * @param t The scale \f$t=2p_j\cdot p_k\f$. * @param ids The PDG codes for the particles in the splitting. * @return The weight */ virtual vector > generatePhiBackward(const double z, const Energy2 t, const IdList & ids, const RhoDMatrix &) = 0; /** * Calculate the matrix element for the splitting * @param z The energy fraction * @param t The scale \f$t=2p_j\cdot p_k\f$. * @param ids The PDG codes for the particles in the splitting. * @param phi The azimuthal angle, \f$\phi\f$. * @param timeLike Whether timelike or spacelike, affects inclusive of mass terms */ virtual DecayMEPtr matrixElement(const double z, const Energy2 t, const IdList & ids, const double phi, bool timeLike) = 0; /** * Whether or not the interaction is angular ordered */ bool angularOrdered() const {return angularOrdered_;} /** * Functions to state scales after branching happens */ //@{ /** * Sort out scales for final-state emission */ void evaluateFinalStateScales(ShowerPartnerType::Type type, Energy scale, double z, tShowerParticlePtr parent, tShowerParticlePtr first, tShowerParticlePtr second); /** * Sort out scales for initial-state emission */ void evaluateInitialStateScales(ShowerPartnerType::Type type, Energy scale, double z, tShowerParticlePtr parent, tShowerParticlePtr first, tShowerParticlePtr second); /** * Sort out scales for decay emission */ void evaluateDecayScales(ShowerPartnerType::Type type, Energy scale, double z, tShowerParticlePtr parent, tShowerParticlePtr first, tShowerParticlePtr second); //@} public: /** @name Functions used by the persistent I/O system. */ //@{ /** * Function used to write out object persistently. * @param os the persistent output stream written to. */ void persistentOutput(PersistentOStream & os) const; /** * Function used to read in object persistently. * @param is the persistent input stream read from. * @param version the version number of the object when written. */ void persistentInput(PersistentIStream & is, int version); //@} /** * The standard Init function used to initialize the interfaces. * Called exactly once for each class by the class description system * before the main function starts or * when this class is dynamically loaded. */ static void Init(); protected: /** @name Standard Interfaced functions. */ //@{ /** * Initialize this object after the setup phase before saving an * EventGenerator to disk. * @throws InitException if object could not be initialized properly. */ virtual void doinit(); //@} protected: /** * Set the colour factor */ void colourFactor(double in) {_colourFactor=in;} private: /** * The assignment operator is private and must never be called. * In fact, it should not even be implemented. */ SplittingFunction & operator=(const SplittingFunction &); private: /** * The interaction type for the splitting function. */ ShowerInteraction::Type _interactionType; /** * The order of the splitting function in the coupling */ unsigned int _interactionOrder; /** * The colour structure */ ColourStructure _colourStructure; /** * The colour factor */ double _colourFactor; /** * Whether or not this interaction is angular-ordered */ bool angularOrdered_; }; } #endif /* HERWIG_SplittingFunction_H */ diff --git a/Shower/SplittingFunctions/SplittingGenerator.cc b/Shower/SplittingFunctions/SplittingGenerator.cc --- a/Shower/SplittingFunctions/SplittingGenerator.cc +++ b/Shower/SplittingFunctions/SplittingGenerator.cc @@ -1,617 +1,627 @@ // -*- C++ -*- // // SplittingGenerator.cc is a part of Herwig - A multi-purpose Monte Carlo event generator // Copyright (C) 2002-2011 The Herwig Collaboration // // Herwig is licenced under version 2 of the GPL, see COPYING for details. // Please respect the MCnet academic guidelines, see GUIDELINES for details. // // // This is the implementation of the non-inlined, non-templated member // functions of the SplittingGenerator class. // #include "SplittingGenerator.h" #include "ThePEG/Interface/ClassDocumentation.h" #include "ThePEG/Persistency/PersistentOStream.h" #include "ThePEG/Persistency/PersistentIStream.h" #include "ThePEG/Interface/Switch.h" #include "ThePEG/Interface/Command.h" #include "ThePEG/Utilities/StringUtils.h" #include "ThePEG/Repository/Repository.h" #include "Herwig/Shower/Base/ShowerParticle.h" #include "ThePEG/Utilities/Rebinder.h" #include #include "ThePEG/Utilities/DescribeClass.h" using namespace Herwig; namespace { bool checkInteraction(ShowerInteraction::Type allowed, ShowerInteraction::Type splitting) { if(allowed==ShowerInteraction::ALL) return true; else if(allowed==ShowerInteraction::QEDQCD && (splitting==ShowerInteraction::QED || splitting==ShowerInteraction::QCD )) return true; else if(allowed == splitting) return true; else return false; } } DescribeClass describeSplittingGenerator ("Herwig::SplittingGenerator",""); IBPtr SplittingGenerator::clone() const { return new_ptr(*this); } IBPtr SplittingGenerator::fullclone() const { return new_ptr(*this); } void SplittingGenerator::persistentOutput(PersistentOStream & os) const { os << _isr_Mode << _fsr_Mode << _bbranchings << _fbranchings; } void SplittingGenerator::persistentInput(PersistentIStream & is, int) { is >> _isr_Mode >> _fsr_Mode >> _bbranchings >> _fbranchings; } void SplittingGenerator::Init() { static ClassDocumentation documentation ("There class is responsible for initializing the Sudakov form factors ", "and generating splittings."); static Switch interfaceISRMode ("ISR", "Include initial-state radiation?", &SplittingGenerator::_isr_Mode, 1, false, false); static SwitchOption interfaceISRMode0 (interfaceISRMode,"No","ISR (Initial State Radiation) is OFF", 0); static SwitchOption interfaceISRMode1 (interfaceISRMode,"Yes","ISR (Initial State Radiation) is ON", 1); static Switch interfaceFSRMode ("FSR", "Include final-state radiation?", &SplittingGenerator::_fsr_Mode, 1, false, false); static SwitchOption interfaceFSRMode0 (interfaceFSRMode,"No","FSR (Final State Radiation) is OFF", 0); static SwitchOption interfaceFSRMode1 (interfaceFSRMode,"Yes","FSR (Final State Radiation) is ON", 1); static Command interfaceAddSplitting ("AddFinalSplitting", "Adds another splitting to the list of splittings considered " "in the shower. Command is a->b,c; Sudakov", &SplittingGenerator::addFinalSplitting); static Command interfaceAddInitialSplitting ("AddInitialSplitting", "Adds another splitting to the list of initial splittings to consider " "in the shower. Command is a->b,c; Sudakov. Here the particle a is the " "particle that is PRODUCED by the splitting. b is the initial state " "particle that is splitting in the shower.", &SplittingGenerator::addInitialSplitting); static Command interfaceDeleteSplitting ("DeleteFinalSplitting", "Deletes a splitting from the list of splittings considered " "in the shower. Command is a->b,c; Sudakov", &SplittingGenerator::deleteFinalSplitting); static Command interfaceDeleteInitialSplitting ("DeleteInitialSplitting", "Deletes a splitting from the list of initial splittings to consider " "in the shower. Command is a->b,c; Sudakov. Here the particle a is the " "particle that is PRODUCED by the splitting. b is the initial state " "particle that is splitting in the shower.", &SplittingGenerator::deleteInitialSplitting); } string SplittingGenerator::addSplitting(string arg, bool final) { string partons = StringUtils::car(arg); string sudakov = StringUtils::cdr(arg); vector products; string::size_type next = partons.find("->"); if(next == string::npos) return "Error: Invalid string for splitting " + arg; if(partons.find(';') == string::npos) return "Error: Invalid string for splitting " + arg; tPDPtr parent = Repository::findParticle(partons.substr(0,next)); partons = partons.substr(next+2); do { next = min(partons.find(','), partons.find(';')); tPDPtr pdp = Repository::findParticle(partons.substr(0,next)); partons = partons.substr(next+1); if(pdp) products.push_back(pdp); else return "Error: Could not create splitting from " + arg; } while(partons[0] != ';' && partons.size()); SudakovPtr s; s = dynamic_ptr_cast(Repository::TraceObject(sudakov)); if(!s) return "Error: Could not load Sudakov " + sudakov + '\n'; IdList ids; - ids.push_back(parent->id()); + ids.push_back(parent); for(vector::iterator it = products.begin(); it!=products.end(); ++it) - ids.push_back((*it)->id()); + ids.push_back(*it); // check splitting can handle this if(!s->splittingFn()->accept(ids)) - return "Error: Sudakov " + sudakov + "can't handle particles\n"; + return "Error: Sudakov " + sudakov + " SplittingFunction can't handle particles\n"; // add to map addToMap(ids,s,final); return ""; } string SplittingGenerator::deleteSplitting(string arg, bool final) { string partons = StringUtils::car(arg); string sudakov = StringUtils::cdr(arg); vector products; string::size_type next = partons.find("->"); if(next == string::npos) return "Error: Invalid string for splitting " + arg; if(partons.find(';') == string::npos) return "Error: Invalid string for splitting " + arg; tPDPtr parent = Repository::findParticle(partons.substr(0,next)); partons = partons.substr(next+2); do { next = min(partons.find(','), partons.find(';')); tPDPtr pdp = Repository::findParticle(partons.substr(0,next)); partons = partons.substr(next+1); if(pdp) products.push_back(pdp); else return "Error: Could not create splitting from " + arg; } while(partons[0] != ';' && partons.size()); SudakovPtr s; s = dynamic_ptr_cast(Repository::TraceObject(sudakov)); if(!s) return "Error: Could not load Sudakov " + sudakov + '\n'; IdList ids; - ids.push_back(parent->id()); + ids.push_back(parent); for(vector::iterator it = products.begin(); it!=products.end(); ++it) - ids.push_back((*it)->id()); + ids.push_back(*it); // check splitting can handle this if(!s->splittingFn()->accept(ids)) - return "Error: Sudakov " + sudakov + "can't handle particles\n"; + return "Error: Sudakov " + sudakov + " SplittingFunction can't handle particles\n"; // delete from map deleteFromMap(ids,s,final); return ""; } void SplittingGenerator::addToMap(const IdList &ids, const SudakovPtr &s, bool final) { if(isISRadiationON() && !final) { - _bbranchings.insert(BranchingInsert(ids[1],BranchingElement(s,ids))); + _bbranchings.insert(BranchingInsert(abs(ids[1]->id()),BranchingElement(s,ids))); s->addSplitting(ids); } if(isFSRadiationON() && final) { - _fbranchings.insert(BranchingInsert(ids[0],BranchingElement(s,ids))); + _fbranchings.insert(BranchingInsert(abs(ids[0]->id()),BranchingElement(s,ids))); s->addSplitting(ids); } } void SplittingGenerator::deleteFromMap(const IdList &ids, const SudakovPtr &s, bool final) { if(isISRadiationON() && !final) { pair - range = _bbranchings.equal_range(ids[1]); + range = _bbranchings.equal_range(abs(ids[1]->id())); for(BranchingList::iterator it=range.first; - it!=range.second&&it!=_bbranchings.end()&&it->first==ids[1];++it) { - if(it->second.first==s&&it->second.second==ids) { + it!=range.second&&it!=_bbranchings.end();++it) { + if(it->second.sudakov==s&&it->second.particles==ids) { BranchingList::iterator it2=it; --it; _bbranchings.erase(it2); } } s->removeSplitting(ids); } if(isFSRadiationON() && final) { pair - range = _fbranchings.equal_range(ids[0]); + range = _fbranchings.equal_range(abs(ids[0]->id())); for(BranchingList::iterator it=range.first; - it!=range.second&&it!=_fbranchings.end()&&it->first==ids[0];++it) { - if(it->second.first==s&&it->second.second==ids) { + it!=range.second&&it!=_fbranchings.end();++it) { + if(it->second.sudakov==s&&it->second.particles==ids) { BranchingList::iterator it2 = it; --it; _fbranchings.erase(it2); } } s->removeSplitting(ids); } } Branching SplittingGenerator::chooseForwardBranching(ShowerParticle &particle, double enhance, ShowerInteraction::Type type) const { RhoDMatrix rho = particle.extractRhoMatrix(true); Energy newQ = ZERO; ShoKinPtr kinematics = ShoKinPtr(); ShowerPartnerType::Type partnerType(ShowerPartnerType::Undefined); SudakovPtr sudakov = SudakovPtr(); IdList ids; // First, find the eventual branching, corresponding to the highest scale. long index = abs(particle.data().id()); // if no branchings return empty branching struct if( _fbranchings.find(index) == _fbranchings.end() ) return Branching(ShoKinPtr(), IdList(),SudakovPtr(),ShowerPartnerType::Undefined); // otherwise select branching for(BranchingList::const_iterator cit = _fbranchings.lower_bound(index); cit != _fbranchings.upper_bound(index); ++cit) { // check either right interaction or doing both - if(!checkInteraction(type,cit->second.first->interactionType())) continue; + if(!checkInteraction(type,cit->second.sudakov->interactionType())) continue; // whether or not this interaction should be angular ordered - bool angularOrdered = cit->second.first->splittingFn()->angularOrdered(); + bool angularOrdered = cit->second.sudakov->splittingFn()->angularOrdered(); ShoKinPtr newKin; ShowerPartnerType::Type type; + IdList particles = particle.id()!=cit->first ? cit->second.conjugateParticles : cit->second.particles; // work out which starting scale we need - if(cit->second.first->interactionType()==ShowerInteraction::QED) { + if(cit->second.sudakov->interactionType()==ShowerInteraction::QED) { type = ShowerPartnerType::QED; Energy startingScale = angularOrdered ? particle.scales().QED : particle.scales().QED_noAO; - newKin = cit->second.first-> - generateNextTimeBranching(startingScale,cit->second.second, - particle.id()!=cit->first,rho,enhance, + newKin = cit->second.sudakov-> + generateNextTimeBranching(startingScale,particles,rho,enhance, particle.scales().Max_Q2); } - else if(cit->second.first->interactionType()==ShowerInteraction::QCD) { + else if(cit->second.sudakov->interactionType()==ShowerInteraction::QCD) { // special for octets if(particle.dataPtr()->iColour()==PDT::Colour8) { // octet -> octet octet - if(cit->second.first->splittingFn()->colourStructure()==OctetOctetOctet) { + if(cit->second.sudakov->splittingFn()->colourStructure()==OctetOctetOctet) { type = ShowerPartnerType::QCDColourLine; Energy startingScale = angularOrdered ? particle.scales().QCD_c : particle.scales().QCD_c_noAO; - newKin= cit->second.first-> - generateNextTimeBranching(startingScale,cit->second.second, - particle.id()!=cit->first,rho,0.5*enhance, + newKin= cit->second.sudakov-> + generateNextTimeBranching(startingScale,particles,rho,0.5*enhance, particle.scales().Max_Q2); startingScale = angularOrdered ? particle.scales().QCD_ac : particle.scales().QCD_ac_noAO; - ShoKinPtr newKin2 = cit->second.first-> - generateNextTimeBranching(startingScale,cit->second.second, - particle.id()!=cit->first,rho,0.5*enhance, + ShoKinPtr newKin2 = cit->second.sudakov-> + generateNextTimeBranching(startingScale,particles,rho,0.5*enhance, particle.scales().Max_Q2); // pick the one with the highest scale if( ( newKin && newKin2 && newKin2->scale() > newKin->scale()) || (!newKin && newKin2) ) { newKin = newKin2; type = ShowerPartnerType::QCDAntiColourLine; } } // other g -> q qbar else { Energy startingScale = angularOrdered ? max(particle.scales().QCD_c , particle.scales().QCD_ac ) : max(particle.scales().QCD_c_noAO, particle.scales().QCD_ac_noAO); - newKin= cit->second.first-> - generateNextTimeBranching(startingScale, cit->second.second, - particle.id()!=cit->first,rho,enhance, + newKin= cit->second.sudakov-> + generateNextTimeBranching(startingScale,particles,rho,enhance, particle.scales().Max_Q2); type = UseRandom::rndbool() ? ShowerPartnerType::QCDColourLine : ShowerPartnerType::QCDAntiColourLine; } } // everything else q-> qg etc else { Energy startingScale; if(particle.hasColour()) { type = ShowerPartnerType::QCDColourLine; startingScale = angularOrdered ? particle.scales().QCD_c : particle.scales().QCD_c_noAO; } else { type = ShowerPartnerType::QCDAntiColourLine; startingScale = angularOrdered ? particle.scales().QCD_ac : particle.scales().QCD_ac_noAO; } - newKin= cit->second.first-> - generateNextTimeBranching(startingScale,cit->second.second, - particle.id()!=cit->first,rho,enhance, + newKin= cit->second.sudakov-> + generateNextTimeBranching(startingScale,particles,rho,enhance, particle.scales().Max_Q2); } } - else if(cit->second.first->interactionType()==ShowerInteraction::EW) { + else if(cit->second.sudakov->interactionType()==ShowerInteraction::EW) { type = ShowerPartnerType::EW; Energy startingScale = particle.scales().EW; - newKin = cit->second.first-> - generateNextTimeBranching(startingScale,cit->second.second, - particle.id()!=cit->first,rho,enhance, + newKin = cit->second.sudakov-> + generateNextTimeBranching(startingScale,particles,rho,enhance, particle.scales().Max_Q2); } // shouldn't be anything else else assert(false); // if no kinematics contine if(!newKin) continue; // select highest scale if( newKin->scale() > newQ ) { kinematics = newKin; newQ = newKin->scale(); - ids = cit->second.second; - sudakov = cit->second.first; + ids = particles; + sudakov = cit->second.sudakov; partnerType = type; } } // return empty branching if nothing happened if(!kinematics) return Branching(ShoKinPtr(), IdList(),SudakovPtr(), ShowerPartnerType::Undefined); // and generate phi // if not hard generate phi kinematics->phi(sudakov->generatePhiForward(particle,ids,kinematics,rho)); // and return it return Branching(kinematics, ids,sudakov,partnerType); } Branching SplittingGenerator:: chooseDecayBranching(ShowerParticle &particle, const ShowerParticle::EvolutionScales & stoppingScales, Energy minmass, double enhance, ShowerInteraction::Type interaction) const { RhoDMatrix rho(particle.dataPtr()->iSpin()); Energy newQ = Constants::MaxEnergy; ShoKinPtr kinematics; SudakovPtr sudakov; ShowerPartnerType::Type partnerType(ShowerPartnerType::Undefined); IdList ids; // First, find the eventual branching, corresponding to the lowest scale. long index = abs(particle.data().id()); // if no branchings return empty branching struct if(_fbranchings.find(index) == _fbranchings.end()) return Branching(ShoKinPtr(), IdList(),SudakovPtr(),ShowerPartnerType::Undefined); // otherwise select branching for(BranchingList::const_iterator cit = _fbranchings.lower_bound(index); cit != _fbranchings.upper_bound(index); ++cit) { // check interaction doesn't change flavour - if(cit->second.second[1]!=index&&cit->second.second[2]!=index) continue; + if(cit->second.particles[1]->id()!=index&&cit->second.particles[2]->id()!=index) continue; // check either right interaction or doing both - if(!checkInteraction(interaction,cit->second.first->interactionType())) continue; + if(!checkInteraction(interaction,cit->second.sudakov->interactionType())) continue; // whether or not this interaction should be angular ordered - bool angularOrdered = cit->second.first->splittingFn()->angularOrdered(); + bool angularOrdered = cit->second.sudakov->splittingFn()->angularOrdered(); ShoKinPtr newKin; + IdList particles = particle.id()!=cit->first ? cit->second.conjugateParticles : cit->second.particles; ShowerPartnerType::Type type; // work out which starting scale we need - if(cit->second.first->interactionType()==ShowerInteraction::QED) { + if(cit->second.sudakov->interactionType()==ShowerInteraction::QED) { type = ShowerPartnerType::QED; Energy stoppingScale = angularOrdered ? stoppingScales.QED : stoppingScales.QED_noAO; Energy startingScale = angularOrdered ? particle.scales().QED : particle.scales().QED_noAO; if(startingScale < stoppingScale ) { - newKin = cit->second.first-> - generateNextDecayBranching(startingScale,stoppingScale,minmass,cit->second.second, - particle.id()!=cit->first,rho,enhance); + newKin = cit->second.sudakov-> + generateNextDecayBranching(startingScale,stoppingScale,minmass,particles,rho,enhance); } } - else if(cit->second.first->interactionType()==ShowerInteraction::QCD) { + else if(cit->second.sudakov->interactionType()==ShowerInteraction::QCD) { // special for octets if(particle.dataPtr()->iColour()==PDT::Colour8) { // octet -> octet octet - if(cit->second.first->splittingFn()->colourStructure()==OctetOctetOctet) { + if(cit->second.sudakov->splittingFn()->colourStructure()==OctetOctetOctet) { Energy stoppingColour = angularOrdered ? stoppingScales.QCD_c : stoppingScales.QCD_c_noAO; Energy stoppingAnti = angularOrdered ? stoppingScales.QCD_ac : stoppingScales.QCD_ac_noAO; Energy startingColour = angularOrdered ? particle.scales().QCD_c : particle.scales().QCD_c_noAO; Energy startingAnti = angularOrdered ? particle.scales().QCD_ac : particle.scales().QCD_ac_noAO; type = ShowerPartnerType::QCDColourLine; if(startingColoursecond.first-> + newKin= cit->second.sudakov-> generateNextDecayBranching(startingColour,stoppingColour,minmass, - cit->second.second, - particle.id()!=cit->first,rho,0.5*enhance); + particles,rho,0.5*enhance); } ShoKinPtr newKin2; if(startingAntisecond.first-> + newKin2 = cit->second.sudakov-> generateNextDecayBranching(startingAnti,stoppingAnti,minmass, - cit->second.second, - particle.id()!=cit->first,rho,0.5*enhance); + particles,rho,0.5*enhance); } // pick the one with the lowest scale if( (newKin&&newKin2&&newKin2->scale()scale()) || (!newKin&&newKin2) ) { newKin = newKin2; type = ShowerPartnerType::QCDAntiColourLine; } } // other else { assert(false); } } // everything else else { Energy startingScale,stoppingScale; if(particle.hasColour()) { type = ShowerPartnerType::QCDColourLine; stoppingScale = angularOrdered ? stoppingScales.QCD_c : stoppingScales.QCD_c_noAO; startingScale = angularOrdered ? particle.scales().QCD_c : particle.scales().QCD_c_noAO; } else { type = ShowerPartnerType::QCDAntiColourLine; stoppingScale = angularOrdered ? stoppingScales.QCD_ac : stoppingScales.QCD_ac_noAO; startingScale = angularOrdered ? particle.scales().QCD_ac : particle.scales().QCD_ac_noAO; } if(startingScale < stoppingScale ) { - newKin = cit->second.first-> - generateNextDecayBranching(startingScale,stoppingScale,minmass,cit->second.second, - particle.id()!=cit->first,rho,enhance); + newKin = cit->second.sudakov-> + generateNextDecayBranching(startingScale,stoppingScale,minmass,particles,rho,enhance); } } } - else if(cit->second.first->interactionType()==ShowerInteraction::EW) { + else if(cit->second.sudakov->interactionType()==ShowerInteraction::EW) { type = ShowerPartnerType::EW; Energy stoppingScale = stoppingScales.EW; Energy startingScale = particle.scales().EW; if(startingScale < stoppingScale ) { - newKin = cit->second.first-> - generateNextDecayBranching(startingScale,stoppingScale,minmass,cit->second.second, - particle.id()!=cit->first,rho,enhance); + newKin = cit->second.sudakov-> + generateNextDecayBranching(startingScale,stoppingScale,minmass,particles,rho,enhance); } } // shouldn't be anything else else assert(false); if(!newKin) continue; // select highest scale if(newKin->scale() < newQ ) { newQ = newKin->scale(); - ids = cit->second.second; + ids = particles; kinematics=newKin; - sudakov=cit->second.first; + sudakov=cit->second.sudakov; partnerType = type; } } // return empty branching if nothing happened if(!kinematics) return Branching(ShoKinPtr(), IdList(),SudakovPtr(), ShowerPartnerType::Undefined); // and generate phi kinematics->phi(sudakov->generatePhiDecay(particle,ids,kinematics,rho)); // and return it return Branching(kinematics, ids,sudakov,partnerType); } Branching SplittingGenerator:: chooseBackwardBranching(ShowerParticle &particle,PPtr, double enhance, Ptr::transient_const_pointer beam, ShowerInteraction::Type type, tcPDFPtr pdf, Energy freeze) const { RhoDMatrix rho = particle.extractRhoMatrix(false); Energy newQ=ZERO; ShoKinPtr kinematics=ShoKinPtr(); ShowerPartnerType::Type partnerType(ShowerPartnerType::Undefined); SudakovPtr sudakov; IdList ids; // First, find the eventual branching, corresponding to the highest scale. long index = abs(particle.id()); // if no possible branching return if(_bbranchings.find(index) == _bbranchings.end()) return Branching(ShoKinPtr(), IdList(),SudakovPtr(),ShowerPartnerType::Undefined); // otherwise select branching for(BranchingList::const_iterator cit = _bbranchings.lower_bound(index); cit != _bbranchings.upper_bound(index); ++cit ) { // check either right interaction or doing both - if(!checkInteraction(type,cit->second.first->interactionType())) continue; + if(!checkInteraction(type,cit->second.sudakov->interactionType())) continue; // setup the PDF - cit->second.first->setPDF(pdf,freeze); + cit->second.sudakov->setPDF(pdf,freeze); // whether or not this interaction should be angular ordered - bool angularOrdered = cit->second.first->splittingFn()->angularOrdered(); + bool angularOrdered = cit->second.sudakov->splittingFn()->angularOrdered(); ShoKinPtr newKin; + IdList particles = particle.id()!=cit->first ? cit->second.conjugateParticles : cit->second.particles; ShowerPartnerType::Type type; - if(cit->second.first->interactionType()==ShowerInteraction::QED) { + if(cit->second.sudakov->interactionType()==ShowerInteraction::QED) { type = ShowerPartnerType::QED; Energy startingScale = angularOrdered ? particle.scales().QED : particle.scales().QED_noAO; - newKin=cit->second.first-> - generateNextSpaceBranching(startingScale,cit->second.second, particle.x(), - particle.id()!=cit->first,rho,enhance,beam); + newKin=cit->second.sudakov-> + generateNextSpaceBranching(startingScale,particles, particle.x(),rho,enhance,beam); } - else if(cit->second.first->interactionType()==ShowerInteraction::QCD) { + else if(cit->second.sudakov->interactionType()==ShowerInteraction::QCD) { // special for octets if(particle.dataPtr()->iColour()==PDT::Colour8) { // octet -> octet octet - if(cit->second.first->splittingFn()->colourStructure()==OctetOctetOctet) { + if(cit->second.sudakov->splittingFn()->colourStructure()==OctetOctetOctet) { type = ShowerPartnerType::QCDColourLine; Energy startingScale = angularOrdered ? particle.scales().QCD_c : particle.scales().QCD_c_noAO; - newKin = cit->second.first-> - generateNextSpaceBranching(startingScale,cit->second.second, particle.x(), - particle.id()!=cit->first,rho,0.5*enhance,beam); + newKin = cit->second.sudakov-> + generateNextSpaceBranching(startingScale,particles, particle.x(),rho,0.5*enhance,beam); startingScale = angularOrdered ? particle.scales().QCD_ac : particle.scales().QCD_ac_noAO; - ShoKinPtr newKin2 = cit->second.first-> - generateNextSpaceBranching(startingScale,cit->second.second, particle.x(), - particle.id()!=cit->first,rho,0.5*enhance,beam); + ShoKinPtr newKin2 = cit->second.sudakov-> + generateNextSpaceBranching(startingScale,particles, particle.x(),rho,0.5*enhance,beam); // pick the one with the highest scale if( (newKin&&newKin2&&newKin2->scale()>newKin->scale()) || (!newKin&&newKin2) ) { newKin = newKin2; type = ShowerPartnerType::QCDAntiColourLine; } } else { Energy startingScale = angularOrdered ? max(particle.scales().QCD_c , particle.scales().QCD_ac ) : max(particle.scales().QCD_c_noAO, particle.scales().QCD_ac_noAO); type = UseRandom::rndbool() ? ShowerPartnerType::QCDColourLine : ShowerPartnerType::QCDAntiColourLine; - newKin=cit->second.first-> - generateNextSpaceBranching(startingScale,cit->second.second, particle.x(), - particle.id()!=cit->first,rho,enhance,beam); + newKin=cit->second.sudakov-> + generateNextSpaceBranching(startingScale,particles, particle.x(),rho,enhance,beam); } } // everything else else { Energy startingScale; if(particle.hasColour()) { type = ShowerPartnerType::QCDColourLine; startingScale = angularOrdered ? particle.scales().QCD_c : particle.scales().QCD_c_noAO; } else { type = ShowerPartnerType::QCDAntiColourLine; startingScale = angularOrdered ? particle.scales().QCD_ac : particle.scales().QCD_ac_noAO; } - newKin=cit->second.first-> - generateNextSpaceBranching(startingScale,cit->second.second, particle.x(), - particle.id()!=cit->first,rho,enhance,beam); + newKin=cit->second.sudakov-> + generateNextSpaceBranching(startingScale,particles,particle.x(),rho,enhance,beam); } } - else if(cit->second.first->interactionType()==ShowerInteraction::EW) { + else if(cit->second.sudakov->interactionType()==ShowerInteraction::EW) { type = ShowerPartnerType::EW; Energy startingScale = particle.scales().EW; - newKin=cit->second.first-> - generateNextSpaceBranching(startingScale,cit->second.second, particle.x(), - particle.id()!=cit->first,rho,enhance,beam); + newKin=cit->second.sudakov-> + generateNextSpaceBranching(startingScale,particles,particle.x(),rho,enhance,beam); } // shouldn't be anything else else assert(false); // if no kinematics contine if(!newKin) continue; // select highest scale if(newKin->scale() > newQ) { newQ = newKin->scale(); kinematics=newKin; - ids = cit->second.second; - sudakov=cit->second.first; + ids = particles; + sudakov=cit->second.sudakov; partnerType = type; } } // return empty branching if nothing happened if(!kinematics) return Branching(ShoKinPtr(), IdList(),SudakovPtr(), ShowerPartnerType::Undefined); // initialize the ShowerKinematics // and return it // and generate phi kinematics->phi(sudakov->generatePhiBackward(particle,ids,kinematics,rho)); // return the answer return Branching(kinematics, ids,sudakov,partnerType); } void SplittingGenerator::rebind(const TranslationMap & trans) { BranchingList::iterator cit; - for(cit=_fbranchings.begin();cit!=_fbranchings.end();++cit) - {(cit->second).first=trans.translate((cit->second).first);} - for(cit=_bbranchings.begin();cit!=_bbranchings.end();++cit) - {(cit->second).first=trans.translate((cit->second).first);} + for(cit=_fbranchings.begin();cit!=_fbranchings.end();++cit) { + (cit->second).sudakov=trans.translate((cit->second).sudakov); + for(unsigned int ix=0;ix<(cit->second).particles.size();++ix) { + (cit->second).particles[ix]=trans.translate((cit->second).particles[ix]); + } + for(unsigned int ix=0;ix<(cit->second).conjugateParticles.size();++ix) { + (cit->second).conjugateParticles[ix]=trans.translate((cit->second).conjugateParticles[ix]); + } + } + for(cit=_bbranchings.begin();cit!=_bbranchings.end();++cit) { + (cit->second).sudakov=trans.translate((cit->second).sudakov); + for(unsigned int ix=0;ix<(cit->second).particles.size();++ix) { + (cit->second).particles[ix]=trans.translate((cit->second).particles[ix]); + } + for(unsigned int ix=0;ix<(cit->second).conjugateParticles.size();++ix) { + (cit->second).conjugateParticles[ix]=trans.translate((cit->second).conjugateParticles[ix]); + } + } Interfaced::rebind(trans); } IVector SplittingGenerator::getReferences() { IVector ret = Interfaced::getReferences(); BranchingList::iterator cit; - for(cit=_fbranchings.begin();cit!=_fbranchings.end();++cit) - {ret.push_back((cit->second).first);} - for(cit=_bbranchings.begin();cit!=_bbranchings.end();++cit) - {ret.push_back((cit->second).first);} + for(cit=_fbranchings.begin();cit!=_fbranchings.end();++cit) { + ret.push_back((cit->second).sudakov); + for(unsigned int ix=0;ix<(cit->second).particles.size();++ix) + ret.push_back(const_ptr_cast((cit->second).particles[ix])); + for(unsigned int ix=0;ix<(cit->second).conjugateParticles.size();++ix) + ret.push_back(const_ptr_cast((cit->second).conjugateParticles[ix])); + } + for(cit=_bbranchings.begin();cit!=_bbranchings.end();++cit) { + ret.push_back((cit->second).sudakov); + for(unsigned int ix=0;ix<(cit->second).particles.size();++ix) + ret.push_back(const_ptr_cast((cit->second).particles[ix])); + for(unsigned int ix=0;ix<(cit->second).conjugateParticles.size();++ix) + ret.push_back(const_ptr_cast((cit->second).conjugateParticles[ix])); + } return ret; } void SplittingGenerator::factorizationScaleFactor(double f) { BranchingList::iterator cit; for(cit=_fbranchings.begin();cit!=_fbranchings.end();++cit) - {(cit->second).first->factorizationScaleFactor(f);} + {(cit->second).sudakov->factorizationScaleFactor(f);} for(cit=_bbranchings.begin();cit!=_bbranchings.end();++cit) - {(cit->second).first->factorizationScaleFactor(f);} + {(cit->second).sudakov->factorizationScaleFactor(f);} } void SplittingGenerator::renormalizationScaleFactor(double f) { BranchingList::iterator cit; for(cit=_fbranchings.begin();cit!=_fbranchings.end();++cit) - {(cit->second).first->renormalizationScaleFactor(f);} + {(cit->second).sudakov->renormalizationScaleFactor(f);} for(cit=_bbranchings.begin();cit!=_bbranchings.end();++cit) - {(cit->second).first->renormalizationScaleFactor(f);} + {(cit->second).sudakov->renormalizationScaleFactor(f);} } diff --git a/Shower/SplittingFunctions/ZeroZeroOneSplitFn.cc b/Shower/SplittingFunctions/ZeroZeroOneSplitFn.cc --- a/Shower/SplittingFunctions/ZeroZeroOneSplitFn.cc +++ b/Shower/SplittingFunctions/ZeroZeroOneSplitFn.cc @@ -1,120 +1,118 @@ // -*- C++ -*- // // PhitoPhiGSplitFn.cc is a part of Herwig - A multi-purpose Monte Carlo event generator // Copyright (C) 2002-2011 The Herwig Collaboration // // Herwig is licenced under version 2 of the GPL, see COPYING for details. // Please respect the MCnet academic guidelines, see GUIDELINES for details. // // // This is the implementation of the non-inlined, non-templated member // functions of the ZeroZeroOneSplitFn class. // #include "ZeroZeroOneSplitFn.h" #include "ThePEG/PDT/ParticleData.h" #include "ThePEG/Interface/ClassDocumentation.h" #include "ThePEG/Utilities/DescribeClass.h" #include "Herwig/Decay/TwoBodyDecayMatrixElement.h" using namespace Herwig; DescribeNoPIOClass describeZeroZeroOneSplitFn ("Herwig::ZeroZeroOneSplitFn","HwShower.so"); void ZeroZeroOneSplitFn::Init() { static ClassDocumentation documentation ("The ZeroZeroOneSplitFn class implements the splitting function for the " "radiation of a gluon by a scalar coloured particle"); } double ZeroZeroOneSplitFn::P(const double z, const Energy2 t, const IdList &ids, const bool mass, const RhoDMatrix &) const { double val = z/(1.-z); if(mass) { - Energy m = getParticleData(ids[0])->mass(); + Energy m = ids[0]->mass(); val-= sqr(m)/t; } return 2.*colourFactor(ids)*val; } double ZeroZeroOneSplitFn::overestimateP(const double z, const IdList &ids) const { return 2.*colourFactor(ids)/(1.-z); } double ZeroZeroOneSplitFn::ratioP(const double z, const Energy2 t, const IdList &ids,const bool mass, const RhoDMatrix &) const { double val = z; if(mass) { - Energy m = getParticleData(ids[0])->mass(); + Energy m = ids[0]->mass(); val-=sqr(m)*(1.-z)/t; } return val; } double ZeroZeroOneSplitFn::integOverP(const double z, const IdList & ids, unsigned int PDFfactor) const { switch(PDFfactor) { case 0: return -2.*colourFactor(ids)*log(1.-z); case 1: case 2: case 3: default: throw Exception() << "ZeroZeroOneSplitFn::integOverP() invalid PDFfactor = " << PDFfactor << Exception::runerror; } } double ZeroZeroOneSplitFn::invIntegOverP(const double r, const IdList & ids, unsigned int PDFfactor) const { switch(PDFfactor) { case 0: return 1. - exp(- 0.5*r/colourFactor(ids)); case 1: case 2: case 3: default: throw Exception() << "ZeroZeroOneSplitFn::integOverP() invalid PDFfactor = " << PDFfactor << Exception::runerror; } } bool ZeroZeroOneSplitFn::accept(const IdList &ids) const { if(ids.size()!=3) return false; if(ids[0]!=ids[1]) return false; - tcPDPtr q=getParticleData(ids[0]); - tcPDPtr g=getParticleData(ids[2]); - if(q->iSpin()!=PDT::Spin0 || - g->iSpin()!=PDT::Spin1) return false; + if(ids[0]->iSpin()!=PDT::Spin0 || + ids[2]->iSpin()!=PDT::Spin1) return false; return checkColours(ids); } vector > ZeroZeroOneSplitFn::generatePhiForward(const double, const Energy2, const IdList &, const RhoDMatrix &) { // scalar so no dependence return vector >(1,make_pair(0,1.)); } vector > ZeroZeroOneSplitFn::generatePhiBackward(const double, const Energy2, const IdList &, const RhoDMatrix &) { // scalar so no dependence assert(false); return vector >(1,make_pair(0,1.)); } DecayMEPtr ZeroZeroOneSplitFn::matrixElement(const double z, const Energy2 t, const IdList & ids, const double phi, bool timeLike) { // calculate the kernal DecayMEPtr kernal(new_ptr(TwoBodyDecayMatrixElement(PDT::Spin0,PDT::Spin0,PDT::Spin1))); - Energy m = timeLike ? getParticleData(ids[0])->mass() : ZERO; + Energy m = timeLike ? ids[0]->mass() : ZERO; (*kernal)(0,0,0) = -exp(Complex(0.,1.)*phi)*sqrt(1.-(1.-z)*sqr(m)/z/t)*sqrt(z/(1.-z)); (*kernal)(0,0,2) = -conj((*kernal)(0,0,0)); return kernal; }