
\def\xdim{40}   % Size of the picture enviroment; default = 40
\def\ydim{40}
\def\xoff{0}    % Position of the diagram inside the picture enviroment; default = 0
\def\yoff{0}
\def\dash{2}    % Dash length in massless lines; default = 2
\def\vtxsz{1}   % Vertex size; default = 1
\def\dotsz{1.5} % Dot size; default = 1.5
\def\heavydotsz{4} % size of heavy dot

\SetScale{1}
\SetWidth{0.5}
\newcommand{\momsz}{\small} % Textsize in diagrams

\newcommand{\LA}[1]{\ifthenelse{\equal{#1}{2}}{\CArc(20,20)(19.25,0,90)\CArc(20,20)(20.75,0,90)}{}\ifthenelse{\equal{#1}{1}}{\CArc(20,20)(20,0,90)}{}\ifthenelse{\equal{#1}{0}}{\DashCArc(20,20)(20,0,90){\dash}}{}}
\newcommand{\LB}[1]{\ifthenelse{\equal{#1}{1}}{\CArc(40,40)(20,180,270)}{\DashCArc(40,40)(20,180,270){\dash}}}
\newcommand{\LC}[1]{\ifthenelse{\equal{#1}{1}}{\CArc(20,20)(20,180,270)}{\DashCArc(20,20)(20,180,270){\dash}}}
\newcommand{\LD}[1]{\ifthenelse{\equal{#1}{1}}{\CArc(20,20)(20,90,180)}{\DashCArc(20,20)(20,90,180){\dash}}}
\newcommand{\LE}[1]{\ifthenelse{\equal{#1}{1}}{\Line(20,0)(20,20)}{\DashLine(20,0)(20,20){\dash}}}
\newcommand{\LF}[1]{\ifthenelse{\equal{#1}{1}}{\Line(20,20)(20,40)}{\DashLine(20,20)(20,40){\dash}}}
\newcommand{\LG}[1]{\ifthenelse{\equal{#1}{1}}{\Line(20,20)(0,20)}{\DashLine(20,20)(0,20){\dash}}}
\newcommand{\LH}[1]{\ifthenelse{\equal{#1}{k}}{\PhotonArc(20,20)(20,270,360){1}{9}}{}\ifthenelse{\equal{#1}{3}}{\CArc(20,20)(19,270,360)\CArc(20,20)(20,270,360)\CArc(20,20)(21,270,360)}{}\ifthenelse{\equal{#1}{2}}{\CArc(20,20)(19.25,270,360)\CArc(20,20)(20.75,270,360)}{}\ifthenelse{\equal{#1}{1}}{\CArc(20,20)(20,270,360)}{}\ifthenelse{\equal{#1}{0}}{\DashCArc(20,20)(20,270,360){\dash}}{}}

\newcommand{\KA}{\CArc(20,35)(5,0,360)}
\newcommand{\KC}[1]{\ifthenelse{\equal{#1}{1}}{\CArc(20,15)(15,180,270)}{\DashCArc(20,15)(15,180,270){\dash}}}
\newcommand{\KD}[1]{\ifthenelse{\equal{#1}{1}}{\CArc(20,15)(15,90,180)}{\DashCArc(20,15)(15,90,180){\dash}}}
\newcommand{\KE}[1]{\ifthenelse{\equal{#1}{1}}{\Line(20,0)(20,15)}{\DashLine(20,0)(20,15){\dash}}}
\newcommand{\KF}[1]{\ifthenelse{\equal{#1}{1}}{\Line(20,15)(20,30)}{\DashLine(20,15)(20,30){\dash}}}
\newcommand{\KG}[1]{\ifthenelse{\equal{#1}{1}}{\Line(20,15)(5,15)}{\DashLine(20,15)(5,15){\dash}}}
\newcommand{\KH}[1]{\ifthenelse{\equal{#1}{3}}{\CArc(20,15)(14,-90,90)\CArc(20,15)(15,-90,90)\CArc(20,15)(16,-90,90)}{}\ifthenelse{\equal{#1}{2}}{\CArc(20,15)(14.25,-90,90)\CArc(20,15)(15.75,-90,90)}{}\ifthenelse{\equal{#1}{1}}{\CArc(20,15)(15,-90,90)}{}\ifthenelse{\equal{#1}{0}}{\DashCArc(20,15)(15,-90,90){\dash}}{}}

\newcommand{\SeTopo}[8]{\LA{#1}\LB{#2}\LC{#3}\LD{#4}\LE{#5}\LF{#6}\LG{#7}\LH{#8}\Vertex(0,20){\vtxsz}\Vertex(20,0){\vtxsz}\Vertex(20,20){\vtxsz}\Vertex(20,40){\vtxsz}\Vertex(40,20){\vtxsz}}
\newcommand{\TeTopo}[6]{\KA\KC{#1}\KD{#2}\KE{#3}\KF{#4}\KG{#5}\KH{#6}\Vertex(5,15){\vtxsz}\Vertex(20,0){\vtxsz}\Vertex(20,15){\vtxsz}\Vertex(20,30){\vtxsz}}

\newcommand{\Topo}[1]{
%
\ifthenelse{\equal{#1}{SA}}{\SeTopo{0}{0}{1}{1}{1}{1}{0}{k}}{} % S41
\ifthenelse{\equal{#1}{SB}}{\SeTopo{1}{0}{0}{1}{1}{0}{1}{k}}{} % S42
\ifthenelse{\equal{#1}{SC}}{\SeTopo{1}{1}{1}{1}{1}{1}{0}{k}}{} % S43
\ifthenelse{\equal{#1}{SD}}{\SeTopo{0}{0}{1}{0}{1}{0}{1}{k}}{} % S44
\ifthenelse{\equal{#1}{SE}}{\SeTopo{1}{0}{1}{1}{0}{0}{0}{k}}{} % S45
\ifthenelse{\equal{#1}{SF}}{\SeTopo{1}{1}{1}{0}{1}{0}{1}{k}}{} % S46
\ifthenelse{\equal{#1}{SFo}}{\SeTopo{1}{1}{1}{0}{1}{0}{1}{0}}{} % S46
\ifthenelse{\equal{#1}{SG}}{\SeTopo{1}{1}{0}{0}{0}{0}{0}{k}}{} % S47
%
\ifthenelse{\equal{#1}{WB}}{\SeTopo{1}{0}{0}{1}{1}{0}{1}{0}}{}
\ifthenelse{\equal{#1}{WC}}{\SeTopo{1}{1}{1}{1}{1}{1}{0}{2}}{}
\ifthenelse{\equal{#1}{WE}}{\SeTopo{1}{0}{1}{1}{0}{0}{0}{0}}{}
\ifthenelse{\equal{#1}{WF}}{\SeTopo{1}{1}{1}{0}{1}{0}{1}{2}}{}
\ifthenelse{\equal{#1}{WG}}{\SeTopo{1}{1}{0}{0}{0}{0}{0}{2}}{}
%
\ifthenelse{\equal{#1}{XB}}{\SeTopo{1}{0}{0}{1}{1}{0}{1}{3}}{}
%
\ifthenelse{\equal{#1}{TB}}{\TeTopo{0}{1}{1}{0}{1}{0}}{}
\ifthenelse{\equal{#1}{TC}}{\TeTopo{1}{1}{1}{1}{0}{0}}{}
\ifthenelse{\equal{#1}{TE}}{\TeTopo{1}{1}{0}{0}{0}{0}}{}
\ifthenelse{\equal{#1}{TF}}{\TeTopo{1}{0}{1}{0}{1}{0}}{}
\ifthenelse{\equal{#1}{TG}}{\TeTopo{0}{0}{0}{0}{0}{0}}{}
%
\ifthenelse{\equal{#1}{UB}}{\TeTopo{0}{1}{1}{0}{1}{1}}{}
\ifthenelse{\equal{#1}{UC}}{\TeTopo{1}{1}{1}{1}{0}{2}}{}
\ifthenelse{\equal{#1}{UE}}{\TeTopo{1}{1}{0}{0}{0}{1}}{}
\ifthenelse{\equal{#1}{UF}}{\TeTopo{1}{0}{1}{0}{1}{2}}{}
\ifthenelse{\equal{#1}{UG}}{\TeTopo{0}{0}{0}{0}{0}{2}}{}
%
\ifthenelse{\equal{#1}{VB}}{\TeTopo{0}{1}{1}{0}{1}{3}}{}
%
}


\newcommand{\GenericSeTopo}{
  \raisebox{-9mm}{\begin{picture}(60,60)(\xoff,\yoff)\SetScale{1.5}
    \LA{1}\LB{1}\LC{1}\LD{1}\LE{1}\LF{1}\LH{1}\put(44.68,8.25){\vector(1,1){10}}
    \Vertex(20,0){\vtxsz}\Vertex(20,40){\vtxsz}\Vertex(40,20){\vtxsz}
    \Text(15,30)[]{\small{$R^{\mu_1\dots}$}}\Text(45,45)[]{\small{~$S_{\mu_1..}$}}\Text(53,10)[lt]{\small{$a_0,m_0$}}\Text(49,14)[rb]{\small{$q$}}
  \SetScale{1}\end{picture}}
}
\newcommand{\FireSeTopo}[1]{
  \raisebox{-6mm}{\begin{picture}(40,40)(\xoff,\yoff)
  \LA{2}\LC{1}\LD{0}\LE{1}\LF{0}\LG{1}\LH{0}
  \Vertex(0,20){\vtxsz}\Vertex(20,0){\vtxsz}\Vertex(20,20){\vtxsz}\Vertex(20,40){\vtxsz}\Vertex(40,20){\vtxsz}
  \ifthenelse{\equal{#1}{1}}{\Vertex(40,20){\heavydotsz}}{}
  \end{picture}}
}

\newcommand{\TopoA}[1]{\raisebox{-6mm}{\begin{picture}(\xdim,\ydim)(\xoff,\yoff)\Topo{#1}\end{picture}}}
\newcommand{\TopoB}[2]{\raisebox{-6mm}{$\underset{#2}{\begin{picture}(\xdim,\ydim)(\xoff,\yoff)\Topo{#1}\end{picture}}$}}

\def\labelszC{\scriptsize}
\newcommand{\TopoC}[1]{\raisebox{-6mm}{\begin{picture}(\xdim,\ydim)(\xoff,\yoff)\Topo{#1}
  \Text(36,8)[lt]{\labelszC{$a_0$}}\Text(36,32)[lb]{\labelszC{$a_1$}}\Text(30,28)[]{\labelszC{$a_2$}}\Text(4,8)[rt]{\labelszC{$a_3$}}\Text(4,32)[rb]{\labelszC{$a_4$}}\Text(20,10)[r]{\labelszC{$a_5$}}\Text(20,30)[r]{\labelszC{$a_6$}}\Text(11,19)[t]{\labelszC{$a_7$}}
\end{picture}}}

\def\labelszD{\scriptsize}
\newcommand{\TopoD}[2]{\raisebox{-6mm}{\begin{picture}(50,40)(-5,\yoff)\Topo{#1}
  \Text(37,8)[lt]{\labelszD{$r_#2$}}\Text(6,8)[rt]{\labelszD{$b_1$}}\Text(6,35)[rb]{\labelszD{$b_2$}}\Text(21,10)[l]{\labelszD{$b_3$}}\Text(20,30)[r]{\labelszD{$b_4$}}\Text(11,19)[t]{\labelszD{$b_5$}}
\end{picture}}}

\def\labelszE{\tiny}
\newcommand{\TopoE}[2]{\raisebox{-6mm}{\begin{picture}(50,40)(-5,\yoff)\Topo{#1}
  \Text(36,15)[l]{\labelszE{$r_#2$}}\Text(8,7.5)[rt]{\labelszE{$b_1$}}\Text(8,25)[rb]{\labelszE{$b_2$}}\Text(21,7.5)[l]{\labelszE{$b_3$}}\Text(21,22.5)[l]{\labelszE{$b_4$}}\Text(13,14)[t]{\labelszE{$b_5$}}
\end{picture}}}
