#include "AMEGIC++/Amplitude/Amplitude_Output.H" #include "ATOOLS/Org/MyStrStream.H" #include "ATOOLS/Org/Shell_Tools.H" #include "ATOOLS/Org/Message.H" #include "ATOOLS/Org/Run_Parameter.H" using namespace AMEGIC; using namespace ATOOLS; using namespace std; Amplitude_Output::Amplitude_Output(std::string pid, Topology * _top, std::string gpath, int gmode) { m_graphmode=gmode; std::string script("/plot_graphs"); if (!FileExists(rpa->gen.Variable("SHERPA_CPP_PATH")+script)) Copy(rpa->gen.Variable("SHERPA_SHARE_PATH")+script, rpa->gen.Variable("SHERPA_CPP_PATH")+script); gpath+=std::string("/Amegic/"); MakeDir(gpath,448); pid=pid.substr(pid.rfind('/')+1); std::string fname=gpath+pid+std::string(".tex"); pios.open(fname.c_str()); top = _top; ampl=0; counter=0; maincounter=1; subcounter=0; super_amplitude=false; for (int i=0; i<3;++i) captions.push_back(""); WriteHeader(pid); } void Amplitude_Output::WriteHeader(const std::string &name) { pios<<"\\documentclass{article} "<>o; return o; } void Amplitude_Output::LegCount(Point * mo) { if (!mo) { msg_Error()<left==0) { if (mo->b==1) ++nout; else ++nin; return; } ++nmed; LegCount(mo->left); LegCount(mo->right); if (mo->middle) LegCount(mo->middle); } int Amplitude_Output::InclInComming(Point * mo) { if (mo==0) return 0; if (mo->b==-1 && mo->left==0) return 1; if (mo->left==0) return 0; int test = 4*InclInComming(mo->right); test += 2*InclInComming(mo->middle); test += InclInComming(mo->left); if (test==0) return 0; if (test==4) { Point * help=mo->left; mo->left = mo->right; mo->right = help; } if (test==2) { Point * help=mo->left; mo->left = mo->middle; mo->middle = help; } return 1; } void Amplitude_Output::WriteOut(Point * start) { // count orders std::vector cpls; start->FindOrder(cpls); // make working copy if (ampl==0) ampl=new Point[12*2 + 1]; // up to 10 outgoing particles int count_all=0; top->Copy(start,ampl,count_all); InclInComming(ampl); ostream & s= pios; nin=1; nout=0; nmed=0; LegCount(ampl); // number, fl for (int i=0; i>captions[counter%3]; captions[counter%3]=std::string(" Graph ")+captions[counter%3]; // add orders to caption captions[counter%3]+=std::string(" $\\mathcal{O}(g_s^")+ToString(cpls[0]) +std::string("\\,g^")+ToString(cpls[1]); for (size_t i(2);i=0; --i) s<<","<fl.IsPhoton()) s<<"photon"; else if (ampl->fl.IsGluon()) s<<"gluon"; else if (ampl->fl.IsVector()) s<<"boson"; else if (ampl->fl.IsFermion()) s<<"fermion"; else if (ampl->fl.IsScalar()) s<<"dashes"; else s<<"dots"; bool flip(ampl->fl.IsAnti()); std::string begin(ins[0]); std::string end(meds[0]); if (flip) std::swap(begin,end); s<<",label=$"<fl.TexName()<<"$}{"<left,flip); DrawLine(meds[0],ampl->middle,flip); DrawLine(meds[0],ampl->right,flip); // draw dots // draw numbers // close graph environment s<<"\\end{fmfgraph*} "<left==0 && d->b==1) { // if (d->left==0) { to=outs[oc++]; s<<" \\fmfv{label="<number<<"}{"<left==0) { to=ins[ic++]; s<<" \\fmfv{label="<number<<"}{"<fl.IsPhoton()) s<<"photon"; else if (d->fl.IsGluon()) s<<"gluon"; else if (d->fl.IsVector()) s<<"boson"; else if (d->fl.IsFermion()) s<<"fermion"; else if (d->fl.IsScalar()) s<<"dashes"; else s<<"dots"; s<<",label=$"<fl.TexName()<<"$"; if (!flip) s<<"}{"<left,flip); DrawLine(to,d->middle,flip); DrawLine(to,d->right,flip); } Amplitude_Output::~Amplitude_Output() { if (counter%3!=0) { pios<<"\\\\[12pt]"<