#include "AMEGIC++/Amplitude/Zfunctions/Mom.H" #ifndef Basic_Sfuncs_In_MHV #include "ATOOLS/Phys/Color.H" #include "ATOOLS/Org/Exception.H" #include "ATOOLS/Org/Run_Parameter.H" #include "ATOOLS/Org/MyStrStream.H" #include #include "ATOOLS/Math/MathTools.H" using namespace ATOOLS; using namespace AMEGIC; // class Mom // constructors Mom::Mom(Vec4D& m,int h,int p):hel(h),part(p),etha(0) { for (size_t i=0;i<4;i++) (*this)[i]=m[i]; Compute_l(); } Mom::Mom(Vec4D& m, double *et):hel(0),part(0),etha(et) { for (size_t i=0;i<4;i++) (*this)[i]=m[i]; Compute_l(); } // public functions void Mom::Print() { msg_Info()<<(*this)<<" p^2="; if (ATOOLS::IsZero(Abs2())) {msg_Info()<<0;} else msg_Info()<1.e+2*Accu()?1:0) { l0[0]=csqrt((*this)[0]+(*this)[3]); l0[1]=Complex((*this)[1],(*this)[2])/csqrt((*this)[0]+(*this)[3]); l1[0]=csqrt((*this)[0]+(*this)[3]); l1[1]=Complex((*this)[1],-(*this)[2])/csqrt((*this)[0]+(*this)[3]); } else { l0[0]=0; l0[1]=csqrt((*this)[0]-(*this)[3]); l1[0]=0; l1[1]=csqrt((*this)[0]-(*this)[3]); } } } // class MomentumList // constructors MomentumList::MomentumList(const char* file):m_propsize(0) { etha[0]=1; etha[1]=1; if (!Get(file)) THROW(fatal_error,"Error in initializing class MomentumList"); MakeHlist(); MakePlist(); if (!etha[0] && !etha[1]) { etha[0]=0; etha[1]=1; } if (m_size>5) { Vec4D m; Mom* momentum; m_propsize=(1<<(m_size-1))-1; for (size_t y=m_size;ypush_back(momentum); } BuildMomList(); } s0= new Complex*[size()]; s1= new Complex*[size()]; for (size_t y=1;ypush_back(momentum); } if (m_size>5) { m_propsize=(1<<(m_size-1))-1; for (size_t y=m_size;ypush_back(momentum); } } s0= new Complex*[size()]; s1= new Complex*[size()]; for (size_t y=1;yCompute_l(); } for (size_t y=m_in;yCompute_l(); } if (m_size>5) BuildMomList(); Compute_s(); } Vec4D MomentumList::Momentum(int mindex) { Vec4D m; for (size_t i=0;i<4;i++) m[i]=(*(*this)[mindex])[i]; return m; } int MomentumList::GetMomNumber(Pfunc* pf) { size_t res(0); int max(-1); for (int y=1;yargnum;y++) { res+=(1<arg[y]); if (pf->arg[y]>max) max=pf->arg[y]; } if (max==(int)m_size-1) { res= m_propsize*2+1-res; size_t tst=res; for (max=-1;tst>0;max++) tst= tst>>1; } res+= m_size-2-max; return res; } int * MomentumList::GetHList() { if (hlist) return hlist; else THROW(fatal_error,"List of helicities is not properly constructed."); } int * MomentumList::GetPList() { if (plist) return plist; else THROW(fatal_error,"List of particles is not properly constructed."); } void MomentumList::Print() { for (size_t i=0;iPrint(); if (hlist) { msg_Info()<endpos) THROW(fatal_error,"Momentum is not properly defined"); size_t c1pos(line.find(',',stpos+1)); if (c1pos==std::string::npos) THROW(fatal_error,"Invalid number of momentum indices"); size_t c2pos(line.find(',',c1pos+1)); if (c2pos==std::string::npos) THROW(fatal_error,"Invalid number of momentum indices"); size_t c3pos(line.find(',',c2pos+1)); if (c3pos==std::string::npos || line.find(',',c3pos+1)endpos) THROW(fatal_error,"Invalid number of momentum indices"); Vec4D m; m[0]= ToType(line.substr(stpos+1,c1pos-stpos-1)); m[1]= ToType(line.substr(c1pos+1,c2pos-c1pos-1)); m[2]= ToType(line.substr(c2pos+1,c3pos-c2pos-1)); m[3]= ToType(line.substr(c3pos+1,endpos-c3pos-1)); if (line.substr(endpos+1,2)=="_t") m[0]=m.PSpat(); if (line.substr(endpos+1,2)=="_s") { double sp(m.PSpat()); for (int i=1;i<4;i++) m[i]=m[i]*m[0]/sp; } if (line.find("h")==std::string::npos) THROW(fatal_error,"No helicity specified"); int h=0; if (line.substr(line.find("h")+1,1)=="+") h=1; if (line.substr(line.find("h")+1,1)=="-") h=-1; if (!h) THROW(fatal_error,"No helicity specified"); stpos=line.find("("); endpos=line.find(")"); if (stpos+2>endpos) THROW(fatal_error,"Particle type is not properly defined"); int p=ToType(line.substr(stpos+1,endpos-stpos-1)); Mom* momentum = new Mom(m,h,p) ; this->push_back(momentum); } if (line.find("etha=[")!=std::string::npos) { size_t stpos(line.find("etha=[")+5); size_t endpos(line.find("]")); if (stpos>endpos || endpos==std::string::npos) THROW(fatal_error,"etha is not properly defined"); size_t c1pos(line.find(',',stpos+1)); if (c1pos==std::string::npos || line.find(',',c1pos+1)endpos) THROW(fatal_error,"Definition of etha requires exectly two numbers"); etha[0]= ToType(line.substr(stpos+1,c1pos-stpos-1)); etha[1]= ToType(line.substr(c1pos+1,endpos-c1pos-1)); } } dat.Close(); m_size=size(); if (size()>0) return 1; return 0; } void MomentumList::MakeHlist() { hlist = new int[Size()]; for (size_t i=0;ihel; } void MomentumList::MakePlist() { plist = new int[Size()]; int aqpos1=-1, aqtype1=0; int aqpos2=-1, aqtype2=0; for (size_t i=0;ipart; if (plist[i]<0 && plist[i]>-10) { if (aqpos1==-1) {aqpos1=i; aqtype1=plist[i];} else if (aqpos2==-1) {aqpos2=i; aqtype2=plist[i];} else THROW(fatal_error,"To many quark-antiquark pairs"); } } if (aqpos1>-1 && plist[(aqpos1+1)%Size()]!=-aqtype1) THROW(fatal_error,"Wrong quark-antiquark structure"); if (aqpos2>-1 && plist[(aqpos2+1)%Size()]!=-aqtype2) THROW(fatal_error,"Wrong quark-antiquark structure"); } void MomentumList::BuildMomList() { size_t cn(m_size); for (size_t i=3;i1) { for (size_t y=0;y<4;y++) (*(*this)[cn])[y]=0; for (size_t j=0;jCompute_l(); cn++; } } } void MomentumList::Compute_s() { for (size_t i=1;il0[0] * (*this)[j]->l0[1] - (*this)[i]->l0[1] * (*this)[j]->l0[0]; s1[i][j]=(*this)[i]->l1[0] * (*this)[j]->l1[1] - (*this)[i]->l1[1] * (*this)[j]->l1[0]; } } } // class Fullamplitude_MHV_test // constructor Fullamplitude_MHV_test::Fullamplitude_MHV_test(MomentumList *momentuml,int *hl,int *pl): momentumlist(momentuml), hlist(hl), plist(pl) {} // destructor //Fullamplitude_MHV_test::~Fullamplitude_MHV_test() {} Complex Fullamplitude_MHV_test::Calculate() { int qpos=1; amp=Complex(0.0,0.0); int part(momentumlist->Size()); calc = new MHVCalculator(part,momentumlist,plist); const int* qlist(calc->GetQlist()); perm = new int[part]; int** perm_adr = new int*[part-qlist[0]+1]; if (!qlist[0]) { perm[part-1] = part-1; for (int i=0;iDifferential(perm,hlist); amp+=norm(am); // start 6 gluons TEST if (momentumlist->Size()==6) { am=conj(am); int perm1[]={0,2,4,1,5,3}; int permz[6]; for (int l=0;l<6;l++) permz[l]=perm[perm1[l]]; Complex am2=calc->Differential(permz,hlist); int perm2[]={0,4,2,5,1,3}; for (int l=0;l<6;l++) permz[l]=perm[perm2[l]]; am2 +=calc->Differential(permz,hlist); int perm3[]={0,2,5,3,1,4}; for (int l=0;l<6;l++) permz[l]=perm[perm3[l]]; am2+=calc->Differential(permz,hlist); am*=am2; am*=2; am/=pow(3,2); amp+=am; } // end 6 gluons TEST if (1) { //print msg_Info()<<" perm: ("<Size();i++) msg_Info()<<","<0) { for (int l=0;lDifferential(&permtest[y],hlist); if (1) msg_Info()<<" "<Differential(permtest,hlist); // start 2 gluons + 2 quarks TEST if ((momentumlist->Size()-ma[0])==2) { if (momentumlist->Size()==4) { amp+= 9*norm(am); am=-conj(am); int perm1[]={0,1,2,3}; int permz[4]; for (int l=0;l<4;l++) permz[l]=perm[perm1[l]]; Complex am2=calc->Differential(permz,hlist); int perm2[]={0,2,1,3}; for (int l=0;l<4;l++) permz[l]=perm[perm2[l]]; am2 +=calc->Differential(permz,hlist); am*=am2; amp+=am; } // end 2 gluons + 2 quarks TEST // start 3 gluons + 2 quarks TEST else if (momentumlist->Size()==5) { amp+= 81*norm(am); Complex am11=-conj(am); int perm1[]={0,1,2,3,4}; int permz[5]; for (int l=0;l<5;l++) permz[l]=perm[perm1[l]]; Complex am12=calc->Differential(permz,hlist); am12*=2; int perm2[]={4,1,2,3,0}; for (int l=0;l<5;l++) permz[l]=perm[perm2[l]]; am12 +=calc->Differential(permz,hlist); int perm3[]={0,1,2,4,3}; for (int l=0;l<5;l++) permz[l]=perm[perm3[l]]; am12 +=calc->Differential(permz,hlist); int perm4[]={3,1,2,0,4}; for (int l=0;l<5;l++) permz[l]=perm[perm4[l]]; am12 -=calc->Differential(permz,hlist); am11*=am12; am11*=9; amp+=am11; am=conj(am); int perm21[]={0,1,2,3,4}; for (int l=0;l<5;l++) permz[l]=perm[perm21[l]]; Complex am22= calc->Differential(permz,hlist); int perm22[]={0,1,2,4,3}; for (int l=0;l<5;l++) permz[l]=perm[perm22[l]]; am22 +=calc->Differential(permz,hlist); int perm23[]={3,1,2,0,4}; for (int l=0;l<5;l++) permz[l]=perm[perm23[l]]; am22 +=calc->Differential(permz,hlist); int perm24[]={4,1,2,0,3}; for (int l=0;l<5;l++) permz[l]=perm[perm24[l]]; am22 +=calc->Differential(permz,hlist); int perm25[]={3,1,2,4,0}; for (int l=0;l<5;l++) permz[l]=perm[perm25[l]]; am22 +=calc->Differential(permz,hlist); int perm26[]={4,1,2,3,0}; for (int l=0;l<5;l++) permz[l]=perm[perm26[l]]; am22 +=calc->Differential(permz,hlist); am*=am22; amp+=am; } // end 3 gluons + 2 quarks TEST } else amp+=norm(am); if (1) { //print msg_Info()<<" perm: ("<Size();i++) msg_Info()<<","<ScalarFunction(std::string("alpha_S"),sqr(rpa->gen.Ecms())),(double)n_part-2.); } //destructor Fullamplitude_MHV_old::~Fullamplitude_MHV_old() { delete [] perm; delete [] plist; if (calc) delete calc; if (colorstore) delete permstore; } // Full amplitude double Fullamplitude_MHV_old::MSquare(MomentumList *p_BS,int *hlist) { if (!calc) calc = new MHVCalculator(n_part,p_BS,plist); qlist = calc->GetQlist(); p_hlist=hlist; ampsq=0; // pure gluons if (qlist[0]==0) { permconj = new int[n_part]; int** perm_adr = new int*[n_part-1]; perm[n_part-1] = n_part-1; permconj[n_part-1] = n_part-1; for (int i=0;i[n_part]; std::vector** permtb_adr = new std::vector*[n_part-2]; if (qlist[1]==0 && qlist[2]==n_part-1) { (permtb[n_part-2]).push_back(qlist[2]); (permtb[n_part-2]).push_back(-1); (permtb[n_part-1]).push_back(qlist[1]); (permtb[n_part-1]).push_back(-1); } else { (permtb[n_part-2]).push_back(qlist[1]); (permtb[n_part-2]).push_back(-1); (permtb[n_part-1]).push_back(qlist[2]); (permtb[n_part-1]).push_back(-1); } int qpos=1; for (int i=0;iGetPlist()); int fq=0; if (plist[qlist[1]]>0) { fq=1; perm[n_part-2]=qlist[4]; perm[n_part-1]=qlist[1]; permconj[n_part-2]=qlist[4]; permconj[n_part-1]=qlist[1]; } else { perm[n_part-2]=qlist[1]; perm[n_part-1]=qlist[2]; permconj[n_part-2]=qlist[1]; permconj[n_part-1]=qlist[2]; } for (m_qpos=1;m_qpos