%                            PHOTONSETUP(28).TEX
% CALLED BY FEYNMAN(34).TEX.
% USED FOR GENERATING PHOTON LINES IN FEYNMAN DIAGRAMS IN LATEX.
\newcount\numwiggles    \newcount\numwigglespo
\global\newcount\photonlengthx
\global\newcount\photonlengthy
\global\newcount\photonfrontx  %}(x,y) co-ord of left of photon
\global\newcount\photonfronty  %}
\global\newcount\photonbackx
\global\newcount\photonbacky
\newcount\halfwigglelength
%
\global\font\Twelverom=cmr12
\global\font\Tenrom=cmr10
\gdef\Lbr{{\Twelverom(}}   \gdef\Rbr{{\Twelverom)}}
\gdef\SLbr{{\Tenrom(}}     \gdef\SRbr{{\Tenrom)}}
%  Want \smile,\frown to always be 12-point but won't work!
\gdef\Smile{{\large$\smile$}}  % Default for 10 and 11-point documents.
\gdef\Frown{{\large$\frown$}}  % Default for 10 and 11-point documents.
\ifdim\BIGPHOTONS>0pt  \gdef\Smile{$\smile$} \gdef\Frown{$\frown$} \fi
%  For use with 12-point documents only.  Invoked by saying \bigphotons.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\gdef\selectphoton{   % RECURSIVELY RE-DEFINED HERE.  Define in FEYNMAN.
\global\advance\photoncount by 1  % Counts number of photons drawn. 
\global\photonfrontx=\particlefrontx   % READ IN FROM FEYNMAN \selectphoton
\global\photonfronty=\particlefronty   % READ IN FROM FEYNMAN \selectphoton
% Error messages for overly-long lines.  See FEYNMAN for negative-lengths.
\ifnum\unitboxnumber > 50
\message{   *** WARNING *** Photon with 
\the\unitboxnumber\space half-wiggles requested ***   }
\ifnum\unitboxnumber > 150
\message{   *** Reducing photon length to 10 half-wiggles (max 150) ***   }
\ifnum\unitboxnumber > 1000
\message{   *** Probable Cause:  Photon selected instead of Fermion ***   }
\fi \global\unitboxnumber=10 \fi \fi  % end of length error
\numwiggles=\unitboxnumber
\divide\numwiggles by 2
\global\unitboxnumberpo=\numwiggles % here \unitboxnumberpo is an unused counter
\global\multiply \unitboxnumberpo by -1
\numwigglespo=\unitboxnumber
\advance\numwigglespo by \unitboxnumberpo %\numwigglespo is one greater than 
\global\numlineparts = 2  % DEFAULT                %\numwiggles in this case.
\global\numupperunits=\numwigglespo  % DEFAULT
\global\numlowerunits=\numwiggles  % DEFAULT
\particleadjustx=0  %DEFAULT
\particleadjusty=0  %DEFAULT
% select photon alignment:
\ifcase\LINEDIRECTION
     \Nphoton    %\LINEDIRECTION=0 (NORTH) CASE
\or  \NEphoton   % 1 case
\or  \Ephoton    % 2 case...horizontal photon.
\or  \SEphoton   % .
\or  \Sphoton    % .
\or  \SWphoton   % .
\or  \Wphoton    % .
\or  \NWphoton   % 7 case
\else\DIRECTERROR \fi
\setplength
\global\divide\plengthx by 2  \global\divide\plengthy by 2
\rearcoords  \boxlengthdefault   \midcoords
\global\photonbackx=\pbackx  %PHOTONSETUP26
\global\photonbacky=\pbacky  %PHOTONSETUP26
\global\photonlengthx=\plengthx  %PHOTONSETUP26
\global\photonlengthy=\plengthy  %PHOTONSETUP26
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\gdef\SETUNITBOX(#1)[#2][#3]{ % For slanted photons only.
\gdef\upperunitbox{\oval(#1,#1)[#2]}
\gdef\lowerunitbox{\oval(#1,#1)[#3]}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\gdef\Nphoton{  % VERTICAL PHOTONS
\ifcase\LINECONFIGURATION  %\REG case
\setcoords(-490,-250,0)(260,1250,0)[0,2000]
\gdef\upperunitbox{\SLbr}   \gdef\lowerunitbox{\SRbr}
\particleadjusty=10
\or % \FLIPPED case
\setcoords(-271,-501,0)(250,1250,0)[0,2000]   
\gdef\upperunitbox{\SRbr}   \gdef\lowerunitbox{\SLbr}
\or %\CURLY case (a bit shorter).
\particleadjusty=0
\setcoords(-501,-351,0)(300,1400,0)[0,2200]
\gdef\upperunitbox{\Lbr}   \gdef\lowerunitbox{\Rbr}
\or %\FLIPPEDCURLY case.
\setcoords(-353,-499,0)(300,1400,0)[0,2200]
\gdef\upperunitbox{\Rbr}   \gdef\lowerunitbox{\Lbr}
\or % \FLAT case.  Flatter and shorter than \CURLY.
\setcoords(-481,-371,0)(280,1300,0)[0,2000]
\gdef\upperunitbox{\Lbr}   \gdef\lowerunitbox{\Rbr}
\particleadjusty=150
\ifnum\numwiggles=\number\numwigglespo \particleadjustx=-50 \fi
\or %\FLIPPEDFLAT case.  \LINECONFIGURATION=5.
\setcoords(-321,-391,0)(280,1300,0)[0,2000]
\gdef\upperunitbox{\Rbr}   \gdef\lowerunitbox{\Lbr}
\particleadjusty=150
\ifnum\numwiggles=\number\numwigglespo \particleadjustx=80 \fi
\or % \LONGPHOTON
\setcoords(-490,-260,0)(300,1500,0)[0,2400]
\gdef\upperunitbox{\Lbr}   \gdef\lowerunitbox{\Rbr}
\or % \FLIPPEDLONGPHOTON
\setcoords(-301,-531,0)(300,1500,0)[0,2400]
\gdef\upperunitbox{\Rbr}   \gdef\lowerunitbox{\Lbr}
\else \UNIMPERROR
\fi
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\gdef\NEphoton{    % NE   SLANTED PHOTONS:  RE-ORDERED IN PHOTONSETUP27
\ifcase\LINECONFIGURATION  %\REG case
\setcoords(425,425,0)(1250,0,0)[1250,1250]       \SETUNITBOX(1250)[br][tl]  
\ifnum\numwigglespo > \number \numwiggles \particleadjustx=15 \fi
\or % \FLIPPED case
\setcoords(1050,-200,0)(625,625,0)[1250,1250]    \SETUNITBOX(1250)[tl][br]
\ifnum\numwigglespo > \number \numwiggles \particleadjustx=25 \fi
\or % \CURLY case.
\setcoords(500,500,0)(1400,0,0)[1400,1400]       \SETUNITBOX(1400)[br][tl]
\or % \FLIPPEDCURLY case
\setcoords(1200,-200,0)(700,700,0)[1400,1400]    \SETUNITBOX(1400)[tl][br]  
\or % \FLAT case
\setcoords(400,400,0)(1200,0,0)[1200,1200]       \SETUNITBOX(1200)[br][tl]  
\or % \FLIPPEDFLAT case
\setcoords(1000,-200,0)(600,600,0)[1200,1200]    \SETUNITBOX(1200)[tl][br]
\else \UNIMPERROR
\fi
\numupperunits=\numwiggles   \numlowerunits=\numwigglespo
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\gdef\Ephoton{    %  EASTWARD  HORIZONTAL PHOTONS
\ifcase\LINECONFIGURATION  % REG case
\setcoords(-285,715,0)(-150,-400,0)[2005,0]
\gdef\upperunitbox{\Frown}   \gdef\lowerunitbox{\Smile}
\or  % \FLIPPED case
\setcoords(-285,715,0)(-420,-170,0)[2005,0]
\gdef\upperunitbox{\Smile}   \gdef\lowerunitbox{\Frown}
\else \UNIMPERROR
\fi
\particleadjustx=-15 % Lengths are in centipoints.
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\gdef\SEphoton{   % SE   SLANTED PHOTONS:  RE-ORDERED IN PHOTONSETUP27
\ifcase\LINECONFIGURATION  %\REG case
\setcoords(-200,1050,0)(-625,-625,0)[1250,-1250] \SETUNITBOX(1250)[tr][bl]
\ifnum\numwigglespo > \number \numwiggles \particleadjustx=25 \fi
\or % \FLIPPED case
\setcoords(425,425,0)(0,-1250,0)[1250,-1250]     \SETUNITBOX(1250)[bl][tr]
\ifnum\numwigglespo > \number \numwiggles \particleadjustx=15 \fi
\or % \CURLY case.
\setcoords(-200,1200,0)(-700,-700,0)[1400,-1400] \SETUNITBOX(1400)[tr][bl]  
\or % \FLIPPEDCURLY case
\setcoords(500,500,0)(0,-1400,0)[1400,-1400]     \SETUNITBOX(1400)[bl][tr]  
\or % \FLAT case
\setcoords(-200,1000,0)(-600,-600,0)[1200,-1200] \SETUNITBOX(1200)[tr][bl]
\particleadjustx=-20
\or % \FLIPPEDFLAT case
\setcoords(420,420,0)(0,-1200,0)[1200,-1200]     \SETUNITBOX(1200)[bl][tr]
\particleadjustx=40
\else \UNIMPERROR
\fi
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\gdef\Sphoton{  % DOWN, DOWN VERTICAL PHOTONS
\ifcase\LINECONFIGURATION  %\REG case
\setcoords(-252,-490,0)(-740,-1740,0)[0,-2000]
\gdef\upperunitbox{\SRbr}   \gdef\lowerunitbox{\SLbr}
\or % \FLIPPED case
\setcoords(-490,-260,0)(-740,-1740,0)[0,-2002]
\gdef\upperunitbox{\SLbr}   \gdef\lowerunitbox{\SRbr}
\or %\CURLY case (a bit shorter).
\setcoords(-299,-449,0)(-870,-1970,0)[0,-2200]
\gdef\upperunitbox{\Rbr}    \gdef\lowerunitbox{\Lbr}
\particleadjusty=-95
\or %\FLIPPEDCURLY case.
\setcoords(-517,-371,0)(-900,-2000,0)[0,-2200]
\gdef\upperunitbox{\Lbr}    \gdef\lowerunitbox{\Rbr}
\particleadjusty=-165
\or % \FLAT case.  Flatter and shorter than \CURLY.  \LINECONFIGURATION=4.
\setcoords(-299,-409,0)(-885,-1905,0)[0,-2000]
\gdef\upperunitbox{\Rbr}   \gdef\lowerunitbox{\Lbr}
\particleadjustx=50     \particleadjusty=-380
\ifodd\unitboxnumber\relax\else\particleadjustx=250 \particleadjusty=-400 \fi
\or %\FLIPPEDFLAT case.  \LINECONFIGURATION=5.
\setcoords(-519,-449,0)(-900,-1920,0)[0,-2000]
\gdef\upperunitbox{\Lbr}   \gdef\lowerunitbox{\Rbr}
\particleadjusty=-370
\ifodd\unitboxnumber\relax\else\particleadjustx=-240 \particleadjusty=-400 \fi
\or % \LONGPHOTON
\gdef\upperunitbox{\Rbr}   \gdef\lowerunitbox{\Lbr}
\setcoords(-325,-555,0)(-900,-2100,0)[0,-2400]
\particleadjusty=-40
\or % \FLIPPEDLONG
\setcoords(-505,-275,0)(-900,-2100,0)[0,-2400]
\gdef\upperunitbox{\Lbr}   \gdef\lowerunitbox{\Rbr}
\particleadjusty=-30  % Lengths are in centipoints.
\else \UNIMPERROR
\fi
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\gdef\SWphoton{  % SW SLANTED PHOTONS:  RE-ORDERED IN PHOTONSETUP27
\ifcase\LINECONFIGURATION  %\REG case
\setcoords(-825,-825,0)(0,-1250,0)[-1250,-1250]     \SETUNITBOX(1250)[br][tl]  
\or % \FLIPPED case
\setcoords(-175,-1425,0)(-625,-625,0)[-1250,-1250]  \SETUNITBOX(1250)[tl][br]  
\or % \CURLY case.
\setcoords(-900,-900,0)(0,-1410,0)[-1400,-1400]     \SETUNITBOX(1400)[br][tl]  
\or % \FLIPPEDCURLY case
\setcoords(-200,-1600,0)(-700,-700,0)[-1400,-1400]  \SETUNITBOX(1400)[tl][br]  
\or % \FLAT case
\setcoords(-800,-800,0)(0,-1200,0)[-1200,-1200]     \SETUNITBOX(1200)[br][tl]  
\or % \FLIPPEDFLAT case
\setcoords(-200,-1400,0)(-600,-600,0)[-1200,-1200]  \SETUNITBOX(1200)[tl][br]  
\else \UNIMPERROR
\fi
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\gdef\Wphoton{
\ifcase\LINECONFIGURATION %\REG case
\setcoords(-2245,-1245,0)(-150,-400,0)[-2005,0]
\gdef\upperunitbox{\Frown}   \gdef\lowerunitbox{\Smile}
\or % \FLIPPED case
\setcoords(-2245,-1245,0)(-400,-150,0)[-2005,0]
\gdef\upperunitbox{\Smile}   \gdef\lowerunitbox{\Frown}
\else \UNIMPERROR
\fi
\particleadjustx=57 % Lengths are in centipoints.
\ifnum\numwigglespo=\number\numwiggles \particleadjustx=0  \fi
\numlowerunits=\numwigglespo   \numupperunits=\numwiggles
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\gdef\NWphoton{  % NW   SLANTED PHOTONS:  RE-ORDERED IN PHOTONSETUP27
\ifcase\LINECONFIGURATION  %\REG case
\setcoords(-200,-1425,0)(625,625,0)[-1250,1250]   \SETUNITBOX(1250)[bl][tr]
\or % \FLIPPED case
\setcoords(-825,-825,0)(0,1250,0)[-1250,1250]     \SETUNITBOX(1250)[tr][bl]
\ifnum\numwigglespo > \number \numwiggles \particleadjusty=-15 \fi
\or % \CURLY case.
\setcoords(-200,-1600,0)(700,700,0)[-1400,1400]   \SETUNITBOX(1400)[bl][tr]
\or % \FLIPPEDCURLY case
\setcoords(-900,-900,0)(0,1400,0)[-1400,1400]     \SETUNITBOX(1400)[tr][bl]
\or % \FLAT case.
\setcoords(-200,-1400,0)(600,600,0)[-1200,1200]   \SETUNITBOX(1200)[bl][tr]  
\or % \FLIPPEDFLAT case
\setcoords(-800,-800,0)(0,1200,0)[-1200,1200]     \SETUNITBOX(1200)[tr][bl]  
\else \UNIMPERROR
\fi
}
