#include "AMEGIC++/String/String_Output.H" #include #include #include "ATOOLS/Org/Run_Parameter.H" #include "ATOOLS/Org/Message.H" #include "ATOOLS/Org/My_MPI.H" using namespace AMEGIC; using namespace ATOOLS; using namespace std; #define use_templates String_Output::String_Output(const string &_path,int _maxgraph,int _maxhel, int mode) : slib(mode), path(_path), maxgraph(_maxgraph), maxhel(_maxhel), m_mode(mode) { pathID = path; pID = path; for (short int i=path.length()-1;i>=0;i--) { if (path[i]=='/') { pID = string("V")+path.substr(i+1); // pathID = path.substr(i+1); break; } } //kill +- in ID string help; short int i; for (;;) { i = pID.find("+"); if (i==-1) i = pID.find("-"); if (i==-1) break; help = pID.substr(0,i) + pID.substr(i+1); pID = help; } path=rpa->gen.Variable("SHERPA_CPP_PATH")+string("/Process/Amegic/")+path; } void String_Output::Output(sknot*** sk,String_Tree* stree, Virtual_String_Generator* sgen,Helicity* hel) { //Create names string headername = path+string("/V.H"); if (slib.IsFile(headername)==1){ return; } string cfilename = path+string("/V"); slib.InitMakefile(pathID); ofstream header; header.open(headername.c_str()); Make_Header(header,sgen); int maxlines = 200; int tolerance = 50; Zform(header,maxlines,tolerance,sgen,stree); Cform(header,maxlines,tolerance,sgen,sk,stree,cfilename,hel); header<<"};"<gen.Variable("SHERPA_CPP_PATH")+string("/Process/Amegic/")+pathID+string("/Makefile"); slib.AddToMakefile(Makefile,pathID,string("V")); int lines = 0; int fnumber = 0; cfile<<"#include "<<'"'<<"V.H"<<'"'<UsesFunction(4) || sgen->UsesFunction(1) || sgen->UsesFunction(0) || sgen->UsesFunction(3) || sgen->UsesFunction(9) || sgen->UsesFunction(5) || sgen->UsesFunction(10) || sgen->UsesFunction(7) || sgen->UsesFunction(11) || sgen->UsesFunction(12)) cfile<<" :"<UsesFunction(4)) cfile<<","<UsesFunction(1)) cfile<<","<UsesFunction(0)) cfile<<","<UsesFunction(3)||sgen->UsesFunction(9)) cfile<<","<UsesFunction(5)) cfile<<","<UsesFunction(10)) cfile<<","<UsesFunction(7)) cfile<<","<UsesFunction(11)||sgen->UsesFunction(12)) cfile<<","<GetFlavours()->size()<<"];"<NumberOfCouplings()<<"];"<ZXMaxNumber()<<"];"<On(ihel)!=0) { header<<" void Calculate_M"<On(ihel)==0) if (hel->Partner(ihel)!=-1) { cfile<<" case "<Partner(ihel)<<");"<On(ihel)!=0) { if ((maxlines-tolerance)Tree2String(sk[igraph][ihel],0); else str = string(""); if (str!=string("")) { cfile<<" M["<gen.Variable("SHERPA_CPP_PATH")+string("/Process/Amegic/")+pathID+string("/Makefile"); slib.AddToMakefile(Makefile,pathID,string("V_Z")); int lines = 0; zf<<"#include "<<'"'<<"V.H"<<'"'<& coupl)"<GetFlavours()->size();i++) { zf<<" f["<GetFlavours())[i]<<";"<NumberOfCouplings()<<";i++) "<<"c[i] = coupl[i];"<ZXMaxNumber()>maxlines+tolerance); ofstream* pz=&zf; int divnum = 0; if (mvz) { divnum = 1; szf.open((Zname+string("_")+ToString(divnum)+string(".C")).c_str()); slib.AddToMakefile(Makefile,pathID,string("V_Z_")+ToString(divnum)); szf<<"#include "<<'"'<<"V.H"<<'"'<ZXMaxNumber();i++) { zx = sgen->GetZXl(i); if (zx->on) { lines++; (*pz)<<" Z["<arg; switch (zx->zlist) { case 0: #ifdef use_templates (*pz)<<"XT<"<"; (*pz)<<"("<Massless(i)) (*pz)<<"M"; (*pz)<<"<"<"; (*pz)<<"("<value.Value(); hit = 0; //couplings for (short int j=0;jNumberOfCouplings();j++) { if ( norm==sgen->GetCoupling(j) || norm==-sgen->GetCoupling(j) ) { hit = 1; if (norm==-sgen->GetCoupling(j)) (*pz)<<"-"; (*pz)<<"c["<GetFlavours()->size();i++) { int kfcode = abs((*sgen->GetFlavours())[i]); if (ATOOLS::IsEqual(norm,Complex(1./sqr(Flavour(kfcode).Mass()),0.))) { (*pz)<<"Complex(1./sqr(Flavour("<GetFlavours())[i])<<").Mass()),0.);"<GetFlavours()->size();i++) { int kfcode = abs((*sgen->GetFlavours())[i]); if (Flavour(kfcode).Width()!=0.) if (ATOOLS::IsEqual(norm,1./Complex(sqr(Flavour(kfcode).Mass()),-Flavour(kfcode).Mass()*Flavour(kfcode).Width()))) { (*pz)<<"1./Complex(sqr(Flavour("<GetFlavours())[i])<<").Mass()),-Flavour(" <GetFlavours())[i])<<").Mass()*Flavour("<GetFlavours())[i])<<").Width());"<value.Value()<"; (*pz)<<"("<sk!=0) { lines += Line_Form((*pz),stree->Tree2String(zx->sk,0)); (*pz)<("<ZXMaxNumber()-1)) { lines = 0; divnum++; //close the old one (*pz)<<"}"<UsesFunction(4)) header<<","<UsesFunction(1)) header<<","<UsesFunction(0)) header<<","<UsesFunction(3)||sgen->UsesFunction(9)) header<<","<UsesFunction(5)) header<<","<UsesFunction(10)) header<<","<UsesFunction(7)) header<<","<UsesFunction(11)||sgen->UsesFunction(12)) header<<","<&);"<NumberOfCouplings()<<"; }"<70) { int hit = 0; switch (str[j]) { case '+':hit = 1;break; case '*':hit = 1;break; case '-':hit = 1;break; } if (hit) { file<gen.Variable("SHERPA_CPP_PATH")+string("/Process/Amegic/Set_Values.C")).c_str()); to.open((rpa->gen.Variable("SHERPA_CPP_PATH")+string("/Process/Amegic/Set_Values.C.tmp")).c_str()); int hit = 0; string buffer; //include into first line to<<"#include "<<'"'<<(pathID+string("/V.H")).c_str()<<'"'<gen.Variable("SHERPA_CPP_PATH")+string("/Process/Amegic/Set_Values.C.tmp"),rpa->gen.Variable("SHERPA_CPP_PATH")+string("/Process/Amegic/Set_Values.C")); else remove((rpa->gen.Variable("SHERPA_CPP_PATH")+string("/Process/Amegic/Set_Values.C.tmp")).c_str()); }