\midheading{Output}
\label{sec:output}

In addition to the direct output of the program to {\tt stdout}, after
all integration regions have completed the warmup stage and a subsequent
sweep has been made for each contribution, the program will
produce additional output files as specified below.
If a working directory was specified in the command line, then these
output files will be written to that directory.

The standard output will detail the iteration-by-iteration best estimate
of each contribution to the total cross-section, together with the
accompanying error estimate.  Estimates of the total cross-sectio, summing
over all contributions, will be reported in the form:
\begin{verbatim}
 Value of integral is    11.7521       0.58456E-02 nb 
\end{verbatim}

Other output files may be produced containing various histograms associated
with the calculated process. The write-out of the different output files
is controlled by the logical variable {\tt nohistograms} in the {\tt extra}
section.  The default value of this variable is {\tt .false.}, but setting it
to {\.true.} may be useful for faster running if no histograms are required.

Histograms are written to a srries of files with the generic naming structure:
\begin{verbatim}
procname_part_lhapdfset_scale_facscale_runstring_histoname.txt
\end{verbatim}
where {\tt procname} is a label assigned by the program corresponding to
the calculated process; {\tt histoname} is the name of the histogram specified
in the plotting routine (see below) and the remaining labels are as input
by the user in the file {\tt input.ini}.

A default set of histograms is filled for each process.  A snippet of
the histogram output is repeated below:
\begin{verbatim}
# W rapidity
# underflow	  0.0000000    	  0.0000000
# overflow	  0.0000000    	  0.0000000
# sum	  10453523.    	  7919.1419
# xmin	xmax	cross	numerror
 -6.0000000    	 -5.8000000    	  0.0000000    	  0.0000000
 -5.8000000    	 -5.6000000    	  0.0000000    	  0.0000000
 -5.6000000    	 -5.4000000    	  0.0000000    	  0.0000000
 -5.4000000    	 -5.2000000    	  0.0000000    	  0.0000000
 -5.2000000    	 -5.0000000    	  7.1413485    	 0.24680943
 -5.0000000    	 -4.8000000    	  1289.2697    	  28.436126
 -4.8000000    	 -4.6000000    	  11218.037    	  211.10230
 -4.6000000    	 -4.4000000    	  36844.231    	  656.21780
\end{verbatim}
The header lines provide the name of the histogram and the accumulated
cross-section and uncertainty entering the bins ({\tt sum}),
as well as any underflow or overlow outide the bins (zero in this case).
The following lines report the results in each bin, in the format:
bin lower edge, bin upper edge, accumulated cross section, uncertainty.
The units of the reported cross-section is femtobarns.

To modify existing, or add new, histograms one must edit the plotting
routine specified in each process description.  These are found in
the directory {\tt src/User/} and correspond to the (default) value
{\tt .false.} for the flag {\tt newstyle} in the {\tt histogram} section.

Additional plotting infrastructure was include in the release
of CuTe-MCFM, which is enabled by setting {\tt histogram\%newstyle = .true.}
in the input file.
At present this is only possible for the processes
$W^\pm$, $Z$, $H$, $\gamma\gamma$, $Z\gamma$, $ZH$,
$W^\pm H$, $WW$, $W^\pm Z$ and $ZZ$.
It is the default for the CuTe-MCFM example input files.
The predefined plotting routines that can be adjusted in this case are,
for example for $Z$ production, in the file
{\tt src/User/nplotter\_Z\_new.f90}, and similarly for the other processes.

A brief description of the two alteratives for the plotting routines is
provided in the  subsections below.

\bottomheading{Traditional histograms ({\tt newstyle = .false.})}
\label{sec:oldhistos}

Extra histograms may be added to the plotting files in
a fairly straightforward manner. Each histogram is filled by making
a call to the routine {\tt bookplot} and updating the histogram
counter {\tt n} by 1. For example, the rapidity of particle $3$
may be plotted using the following code fragment:

\begin{verbatim}
      eta3=etarap(3,p)
      call bookplot(n,tag,'eta3',eta3,wt,wt2,-4d0,4d0,0.1d0,'lin')
      n=n+1
\end{verbatim}
The first two arguments of the call should not be changed. The third
argument is a string which is used as the title of the plot in the
output files. The fourth argument carries the variable to
be plotted, which has been previously calculated. The arguments {\tt
	wt} and {\tt wt2} contain information about the phase-space weight and
should not be changed. The
last arguments tell the histogramming routine to use bins of size {\tt
	0.1} which run from {\tt -4} to {\tt 4}, and use a linear scale for
the plot. A logarithmic scale may be used by changing the final
argument to {\tt 'log'}.

\bottomheading{New histograms ({\tt newstyle = .true.})}
\label{sec:newhistos}

The routine {\tt setup} first allocates the required space to store
all histograms.  For instance, space for 2 histograms is requested with:
\begin{verbatim}
      allocate(histos(2))
\end{verbatim}
Following this, the histograms can be defined either with uniform binning
or custum bin sizes.  For example, the line:
\begin{verbatim}
      histos(1) = plot_setup_uniform(0._dp,500._dp,10._dp,'mZZ')
\end{verbatim}
initializes the first histogram with bins from 0 to 500, of width 10, named
{\tt mZZ}.  The second histogram could be initialized with:
\begin{verbatim}
      histos(2) = plot_setup_custom([0d0,25d0,50d0,75d0,100d0,150d0,200d0],'ptZZ')
\end{verbatim}
This time the first argument sets up the array of bin edges -- 7 edges
to define 6 bins -- and the histogram is named {\tt ptZZ}.

After setup, the routine {\tt book} is called for each phase space
point.  The plotting routine is provided the momentum configuration ({\tt p})
and associated Vegas weight ({\tt wt}).  Given these, it returns the array of
histograms ({\tt ids}), calculated observables in the
{\tt vals} array, and Vegas weights in {\tt wts}.
For instance, for the example above this could be accomplished by:
\begin{verbatim}
      ptZZ = ptfour(3,4,5,6,p)
      mZZ = puremass(p(3,:)+p(4,:)+p(5,:)+p(6,:))
      ids = histos
      vals = [ptZZ, mZZ]
      wts = [wt, wt]
\end{verbatim}
The specification of weights for individual histograms allows the
the original Vegas weights to be reweighted for particular distributions,
for instance with the output of the transition function in the case of
resummed calculations.
