\section{Introduction}\label{sec:intro}

The winds of massive stars power and enrich the ISM, affect the evolution
of the stars, determine their ultimate fate and the nature of their
remnants, influence the appearance of the integrated spectra of young,
massive clusters and star-bursts, and play a major role in the initial
stages of massive star cluster formation and their subsequent evolution.
Consequently, reliable measurements of mass loss rates due to stellar winds
are essential for all of these subjects.

Stellar winds are driven by radiative pressure on metal lines (Castor et al.\
1975, CAK).  However, in recent years, it has become apparent that the winds
are far more complex than the homogeneous, spherically symmetric flows
envisioned by CAK.  Instead, they have been shown to contain optically thick
structures which may be quite small or very large.  Further, these
structures are thought to have non-monotonic radial velocities.  Co-rotating
interaction regions (CIRs) (Cranmer \& Owocki, 1996, Lobel \& Blomme, 2008)
are examples of large structures and wind fragments caused by the line
deshadowing instability (LDI) (Owocki et al.\ 1988, Sunqvist et al.\ 2011,
\v{S}urlan et al.\ 2012) are examples of small structures.  Until the
details of these flows are unraveled, we cannot reliably translate
observational diagnostics into physical quantities such as mass loss rates.
To progress, a firm grasp on the underlying physical mechanisms which
determine the wind structures is required.  The state of affairs can be seen
in recent literature where the values of observationally derived mass loss
rates have swung back and forth by factors of 10 or more (Puls et al.\ 2006,
Massa et al.\ 2003, Fullerton et al.\ 2006, Sunqvist et al.\ 2011, \v{S}urlan
et al.\ 2012).

Evidence for large scale wind structure first emerged when the variability
was observed in H$\alpha$\ line profiles (Underhill, 1961, Rosendhal, 1973a, b and
Ebbets 1982).  This was followed by studies of UV P Cygni line variability
by several investigators, who examined the behavior of discrete absorption
components (DACs), which traverse UV wind line profiles and suggest the
presence of large, coherent structures propagating through the winds (e.g.,
Kaper et al.\ 1999, Prinja et al.\ 2002).  Similar features are observed in
LMC and SMC O stars (Massa et al.\ 2000) and in planetary nebula central
stars (Prinja et al.\ 2012), suggesting these structures are a universal
property of radiatively driven flows.

Perhaps the most compelling evidence that the winds contain optically thick
structures was provided by Prinja \& Massa (2010) who used doublet ratios to
demonstrate that apparently unsaturated wind lines often arise in
structures that are optically very thick, but cover only a fraction of the
stellar surface.  Further, Massa \& Prinja (2015) used UV excited state
wind lines to demonstrate that at least some of these structures are quite
large and originate very near or on the stellar surface.  Additional
evidence for large scale structure has been deduced from X-ray variability
(e.g., Massa et al.\ 2014, Rauw et al.\ 2015).  Models which account for
optically thick structures have been developed (Sundqvist, Puls \& Feldmeier
2010, and \v{S}urlan et al.\ 2012), and they provide somewhat better
descriptions of the observations.  However, one must keep in mind that
whenever optically thick structures are included in a model, {\em geometry
matters}.  Therefore, it is essential to constrain the shape of the
structures as much as possible, and the best way to probe the geometry is
to examine all of the spectral diagnostics available.  Only when all of
the available diagnostics have been examined, and a model constructed that
can simultaneously explain them all, will we be assured that
observationally determined mass loss rates are meaningful.  Each diagnostic
provides an important piece of the puzzle.

The IR fluxes of OB stars present an important diagnostic that has been
largely neglected.  It was shown early on that emission from OB star winds
should be detectable at IR and radio wavelengths (Wright \& Barlow 1975,
Panagia \& Felli 1975).  This realization spawned observations of OB stars
at near and mid-IR wavelengths (e.g., Castor \& Simon 1983, Abbott et al.\
1984), but the results were considered untrustworthy for two reasons.
First, IR photometric systems were still evolving at the time and poorly
calibrated.  As a result, only rather large excesses could be trusted.
Second, accurate reddening corrections are essential for interpreting IR
excesses, since the excess must be measured relative to the stellar flux at
a wavelength assumed to be free of wind emission, typically $V$ band
photometry.  However, there are very few lightly reddened, luminous
Galactic OB stars, and the exact form of the IR reddening law was poorly
characterized at the time of the early studies.  Nevertheless, there
remains strong motivation to study IR excesses since, as Puls et al.\ (2006)
demonstrated, the wavelength dependence of the mid-IR SED can provide
important information on the radial dependence of clumping in the wind.

This paper has two major goals. The first is to use near IR (NIR) and
mid-IR observations of Magellanic cloud O stars to determine their IR
excesses and compare them to theoretical expectations.  The second is to
compare the IR mass loss rates of LMC and SMC stars to examine how
metallicity affects the results.  In \S~\ref{sec:sample} we describe our
sample of stars.  In \S~\ref{sec:params}, we derive the physical parameters
of the stars and quantify the influence of interstellar extinction.  In
\S~\ref{sec:model} we motivate, describe and justify the simplified model
we use to derive mass loss rates from IR excesses.  In \S~\ref{sec:results}
we describe how we fit the IR photometry and present our results.  In
\S~\ref{sec:systematics}, we quantify the sensitivity of the derived mass
loss rates to various systematic effects.  In \S~\ref{sec:discussion} we
discuss the implications of our results.

\section{The Sample and Data}\label{sec:sample}

With the advent of {\it Spitzer}, well calibrated mid-IR observations of the
Magellanic Clouds became available, thanks to the {\it Spitzer}\ SAGE legacy
data products provided by Meixner et al.\ (2006) for the LMC and Gordon
et al.\ (2011) for the SMC.  These data present the opportunity to obtain a
large, uniform set of IR derived mass loss rates from lightly reddened
stars, with well-determined luminosities.  Bonanos et al.\ (2009, 2010) took
advantage of the new data and compiled catalogs by starting with all massive
stars in the LMC and SMC with high quality spectral classifications, and
then matching them to entries in the {\it Spitzer}\ and other photometric data
bases.  The catalogs contain $U$, $B$, $V$, and $I$ from various sources
and $JHK$\ photometry (primarily from the Two Micron All Sky Survey, 2MASS;
Skrutskie et al.\ 2006 and the targeted IRSF survey, (Kato et al.\ 2007),
together with {\it Spitzer}\ IRAC [3.6], [4.5], [5.8] and [8.0] photometry and some
MIPS [24] photometry (see Bonanos et al.\ for details).  The Bonanos et al.\
catalogs contain 341 LMC and 195 SMC O stars with high quality spectral
types and optical, NIR and {\it Spitzer}\ mid-IR photometry through [4.5].  Bonanos
et al.\ also demonstrated that the O stars had detectable IR excesses due to
winds, but did not perform a quantitative analysis of individual stars.

In this paper, we concentrate on a sub-sample of the Bonanos et al.\ (2009,
2010) catalogs, namely those O stars which are also in the Blair et al.\
(2009) {\it FUSE}\ sample.  This will allow direct comparison of results derived
from different diagnostics in many cases.  We rejected stars later than B0,
since their winds can contain a significant fraction of neutral hydrogen.
This fraction can be strongly dependent upon NLTE processes and clumping in
the wind, both of which introduce unwanted complications into the modeling
(see Petrov et al.\ 2014).  We also rejected WR stars since their massive
winds require a full treatment of electron scattering, which we neglect.
After imposing these restrictions, our sample contained 46 SMC and 58 LMC O
stars (see Tables~\ref{tab:smcstars} and \ref{tab:lmcstars}).

We supplemented the CCD based optical photometry listed by Bonanos et al.\
with photoelectric $V$ and $B$ photometry from the literature whenever
possible and assigned errors of 0.03 mag to each.  Priority was given to
the photoelectric photometry.  We eliminated the {\it Spitzer}\ MIPS data, since
very few stars were detected at [24].  The $I$ band photometry was also
eliminated for reasons discussed in \S~\ref{sec:model}, and $U$ band
photometry was not included since CCD $U$ band photometry (which is all
that exists for most of the stars) often has calibration issues and it
was not needed for our purposes.

The Bonanos et al.\ (2009) calibrations and effective wavelengths were used,
with two exceptions.  First, the Kato et al.\ (2007) IRSF to 2MASS conversion
factors were applied to the IRSF photometry.  Second, the $B$ band zero
magnitude flux was decreased by 4\% with respect to the one listed by
Bonanos et al..  This was needed to produce $(B-V)$ indices which agree with
the Fitzpatrick \& Massa (2005) calibration and to insure that derived
$E(B-V)$ values are greater than 0.

\section{Stellar Parameters and Reddening}\label{sec:params}

To determine the underlying photospheric flux of each program star and its
expected theoretical mass loss rate, we must know its physical parameters,
i.e., mass, effective temperature, luminosity and chemical composition.
We obtain these from the SMC and LMC spectral type to luminosity, effective
temperature and mass calibrations provided by Weidner \& Vink (2010).
Tables~\ref{tab:smcstars} and \ref{tab:lmcstars} summarize the physical
parameters for the SMC and LMC samples, respectively.  We used the spectral
types from the Bonanos et al.\ catalogs for most stars, and exceptions are
noted in the tables.

Observed color excesses, $E(B-V)_{obs}$, were determined using $(B-V)_0$
values from TLUSTY model atmospheres (Lanz \& Hubeny 2002) with the
appropriate {$T_{\rm eff}$}, {$\log g$}\ and metallicity.  These same models were used to
determine the photospheric fluxes of the stars.

To characterize the optical and IR extinction, we adopt the Weingartner \&
Draine (2001) curves for the SMC and LMC.  As with all other wavelength
ranges, the form of the IR extinction law is variable (e.g., Fitzpatrick \&
Massa 2009, Schlafly et al.\ 2016).  However, because reddening is minimal
in most cases, the exact form of the extinction curve used is not too
important.  Nevertheless, the effects of variations in $R(V) \equiv
A(V)/E(B-V)$ are taken into account by allowing $E(B-V)$ to be a free
parameter in fitting the IR continua (see \S~\ref{sec:results}).  The
consequences of this action are examined in \S~\ref{sec:systematics}.

\section{The Wind Model}\label{sec:model}
\subsection{Formulation of the model}\label{subsec:model}
In general, the wind density of a smooth spherically symmetric flow from a
star of radius $R_\star$\ is determined by the wind velocity law and the
mass loss rate, $\dot{M}$.  Typically, the velocity law for a wind with a
terminal velocity $v_\infty$ is assumed to have the form
\begin{equation}
w = \left(1 - \frac{a}{x}\right)^\beta
\label{eq:vlaw}
\end{equation}
where $w = v/v_\infty$, $x = r/R_\star$, $a = 1 - w_0^{1/\beta}$ and $w_0
= w(x=1)$.  These wind laws have a maximum velocity gradient at $x = 1$,
and laws with larger $\beta$ parameters accelerate more slowly.   In the
following, we adopt $\beta = 1$ and $w_0 = 0.01$, which are typical values
for OB stars.  Whenever possible, $v_\infty$ values derived from UV
observations were collected from the literature.  If none were available,
we derived $v_\infty$ from the stellar parameters and the prescription
provided by Vink et al.\ (2001).  Their method was also used to calculate
theoretical mass loss rates, $\dot{M}$(Vink).  The mass loss rates derived
from IR excesses turn out to be more sensitive to the wind parameters than
the stellar parameters.

The continuity equation relates the wind density and the velocity
\begin{equation}
\rho = \frac{\dot{M}}{4 \pi R_\star^2 v_\infty x^2 w(x)}
\label{eq:cont}
\end{equation}
Thus, $\rho$ varies rapidly as $x$ approaches 1; is proportional to $\dot{M}$;
is inversely proportional to $v_\infty$; and, is denser at a given $x$ for
larger $\beta$.  The IR emission from a wind is dominated by free-free and
free-bound emission and absorption by H and He.  It can originate very near
the star (the exact radius depends upon wavelength and wind density).

Because our goal is to survey several objects in order to determine mean
properties, identify outliers, contrast differences between the LMC and SMC,
compare the results with theoretical expectations, and search for trends.
To accomplish this, we model the observed IR excesses of 104 O stars.
Consequently, we sought the simplest available model that captures the
essential physics of IR continuum formation.  A computational fast model
which suffers only a minimal loss of precision is the one developed by
Lamers \& Waters (1984a, 1984b, LWa, LWb).  This is a core-halo model
wherein the flux from a static plane parallel model atmosphere is embedded
in a stellar wind and both the emission and absorption by the wind material
are treated in detail.  As is typical, the wind is assumed to be uniform and
spherically symmetric with a density structure set by the velocity law.  For
simplicity, it is also assumed that the wind is in LTE at a fixed
temperature, $T_w$, typically 0.8 -- $0.9 \times T_{eff}$.

We employ the LWa model together with TLUSTY models (with appropriate
SMC or LMC metallicities) for the underlying photospheres.  In this
core-halo formulation, the observed flux, $f(\lambda)$, and the flux of the
underlying photosphere, $f(\lambda)_p$, are related by
\begin{equation}
f(\lambda) = \left[Z(\lambda)_1 +Z(\lambda)_2
\frac{f(\lambda)_w}{f(\lambda)_p}\right] f(\lambda)_p \label{eq:landw}
\end{equation}
where $f(\lambda)_w$ is a Planck function with $T = T_w$, and $Z_1$ and
$Z_2$ are functions which represent the attenuation of the stellar flux by
the wind and the emission and self-absorption of the wind, respectively.
These functions are integrals over the impact parameter, $q$, and can be
calculated very quickly once the optical depth through the wind as a
function of impact parameter, $\tau(q)$, is known.  While determining
$\tau(q)$ can be time consuming, it only has to be done once for a given
set of wind law parameters, $\beta$ and $w_0$.  Consequently, tables of
$\tau(q)$ as a function of $q$ can be constructed for each velocity law and
then scaled by the mass loss rate, terminal velocity and $T_w$.  These can
be integrated very quickly over $q$ to obtain a specific model.

When fitting the models to the observations, we use a version of
equation~(\ref{eq:landw}) which is normalized to the flux at $V$ and
accounts for extinction, viz,
\begin{equation}
\frac{f(\lambda)}{f(V)} = \frac{[Z(\lambda)_1 +Z(\lambda)_2 f(\lambda)_w
    /f(\lambda)_p] f(\lambda)_p 10^{-0.4 A(\lambda)}}{[Z(V)_1 +Z(V)_2 f(V)_w
    /f(V)_p] f(V)_p10^{-0.4 A(V)}}
\end{equation}
where $f(\lambda)_p$ is a TLUSTY model which depends on $T_{eff}$,
$\log g$ and metallicity, and $Z_1(\lambda)$ and $Z_2(\lambda)$ depend on
the velocity law parameters, $\beta$, $w_0$ and $v_\infty$ and $\dot{M}$.
We also assume that $Z(V)_1 = 1$ and $Z(V)_2 = 0$, which gives
\begin{equation}
\frac{f(\lambda)}{f(V)} = \left[Z(\lambda)_1 +Z(\lambda)_2
      \frac{f(\lambda)_w} {f(\lambda)_p}\right] \frac{f(\lambda)_p}{f(V)_p}
     10^{-0.4 E(\lambda -V)}
\end{equation}
In performing the fits, we adopt a logarithmic version of this equation,
\begin{eqnarray}
  \log \frac{f(\lambda)/f(V)}{f(\lambda)_p/f(V)_p} & = &
     \log \left[Z(\lambda)_1 +Z(\lambda)_2 \frac{f(\lambda)_w}
     {f(\lambda)_p}\right]  \nonumber \\
& & -0.4 E(B-V) k(\lambda -V)\label{eq:fit}
\end{eqnarray}
where $k(\lambda -V) \equiv E(\lambda -V)/E(B-V)$, so $E(\lambda -V) =
E(B-V) k(\lambda -V)$.  Note that $k(\lambda -V) < 0$ for $\lambda >
\lambda_V$.

Following LWa, we do not extend the wind model to wavelengths shorter
than 1~\micron.  Shorter wavelengths require including the Paschen jump at
0.82~\micron.  This could introduce sizable uncertainties.  The strength of
the Paschen jump is much stronger than the Brackett jump (at 1.46~\micron)
because the populations of the Hydrogen levels increase dramatically with
decreasing quantum number.  Further, the populations of the lower hydrogen
levels are strongly affected by NLTE effects, so the exact strength of the
jump cannot be accurately predicted by the LTE assumption of the LWa model.
As a result, we bypass the problem by not including $I$ band photometry in
the fits, which is the only filter strongly affected.  In addition,
available $I$ band calibrations are not very reliable (see Fitzpatrick \&
Massa 2005).

Because the LWa core-halo models can be calculated almost instantaneously,
they are ideal for the current work because we use a non-linear least
squares fitting routine, where each fit typically involves several tens of
model calculations, and this has to be done for 104 stars.  In addition, we
also examine how a variety of constraints and systematic errors affect the
results, a feat which would be extremely time consuming for more
sophisticated models. We also ignore the effects of electron scattering, but
this should be a minor effect for the stars and wavelengths considered here.

A final simplification used to increase calculation speed was to apply a
photometric calibration based on effective wavelength, $\lambda_{eff}$.
We tested the validity of this approach by comparing the fluxes derived
this way to those determined from integrating over filter response curves.
Over the small range of intrinsic colors and color excesses in the current
sample, the effects were all less than 1\%.

\subsection{Accuracy of the model}\label{subsec:accuracy}
To determine the accuracy of the mass loss rates determined by the simple
LWa model, we performed the following experiment.  We employed the unclumped
CMFGEN models calculated by Martins \& Plez (2006) as surrogates for actual
stars.  These were then fit with LWa models, using eq.~(\ref{eq:fit}).  To
begin, we constructed a set of Galactic abundance TLUSTY models whose {$T_{\rm eff}$}\
and $\log g$ values correspond to the CMFGEN models.  For the LWa models, we
used $\beta = 0.9$ (same as the CMFGEN models used) and assumed $w_0 = 0.01$
since, unlike the CMFGEN models, the LWa models do not continue into the
photosphere.  We set $T_w = 0.9 T_{eff}$, since this gave the best overall
agreement.  The near equality of the wind and stellar temperatures is
reasonable since, at the wavelengths considered here, the bulk of the wind
emission comes from very near the stellar surface.  The fits also allowed
for reddening to be present as well, using a Weingartner \& Draine (2001)
$R(V) = 3.1$ extinction curve.  This simulates fitting actual data, since
any difference between the LWa models and the CMFGEN models which has a
wavelength dependence similar to an extinction curve will be absorbed into
the measured extinction.  We also allowed for a 2\% error in each point, to
simulate photometric errors.

All of the fits were excellent, with reduced $\chi^2 < 1$.  A few aspects
of the fits are noteworthy.  First, two models ({$T_{\rm eff}$} = 32,500K, $\dot{M}$
$\times 10^{6} = 0.011$ and {$T_{\rm eff}$} = 37,500K, $\dot{M}$ $\times 10^{6} = 9.33$)
do not fit the trends defined by models with similar parameters.  The
reason for this discord is unknown.  Second, very few of the $E(B-V)$ values
derived from the fits are larger than 0.01 mag, implying that the model
distinguishes between reddening and wind excesses very well.  Third, some
CMFGEN models with very low mass loss rates have IR continua that are {\em
fainter} than the corresponding TLUSTY model, resulting in small ``negative
excesses'', which resulted in negative $E(B-V)$ values.  This effect is
likely related to differences in the structure of the outer atmospheres of
the CMFGEN and TLUSTY models caused by including the dynamic nature of the
outer atmosphere in the CMFGEN models.  While interesting, this effect is
very small, with the magnitude of the negative excesses always less than
0.01 mag.

Figure~\ref{fig:ratios} summarizes the comparison of the two models.  It
shows the mass loss rate derived from the LWa model that provides the best
fit to the IR continuum of the CMFGEN model, $\dot{M}$ (IR), versus the CMFGEN
$\dot{M}$ s.  The $\dot{M}$ (IR) values are nearly identical to the CMFGEN $\dot{M}$ s
for models with large mass loss rates.  For $\dot{M}$\ $\lesssim 2 \times
10^{-6}$~M$_\odot$~yr$^{-1}$, the $\dot{M}$ (IR)s overestimate the CMFGEN $\dot{M}$ s by
about a factor of 2.  Finally, for the smallest $\dot{M}$ s, the fitting cannot
detect a significant excess, resulting in $\dot{M}$(IR) $\simeq 0$.

\begin{figure}
\includegraphics[width=1.0\linewidth]{fig1_cmfgen_lwa.pdf}
\vspace{-2.0in}\caption{Mass loss rates (in M$_\odot$~yr$^{-1}$) determined from LWa
model fits to the IR continua of the CMFGEN models of Martins \& Plez
(2006), $\dot{M}({\rm IR})$, versus the CMFGEN model mass loss rates, $\dot{M}$.  The points
shown as squares are for CMFGEN models whose fluxes deviate from the trends
of models with similar physical parameters.  The upper limits are for models
where the fit could not determine a significant $\dot{M}$, when photometric
errors of 0.02 mag are assigned to each photometry point.  The solid line is
$\dot{M}$$ = $$\dot{M}({\rm IR})$, and the dashed line is $\dot{M}$$ = $2 $\dot{M}({\rm IR})$.  Overall, the
mass loss rates determined by the simple LWa models recover the CMFGEN rates
very well for high mass loss rates, but then begin to overestimate the mass
loss rates for models with smaller $\dot{M}$.  Even so, the disagreement is
typically within a factor of 2 for cases where mass loss rates are
detectable.
\label{fig:ratios}}
\end{figure}

The significant result of this exercise is that if we assume that the
CMFGEN models provide a good representation of the IR continua of real
stars, then the simple LWa core halo model faithfully represents actual IR
continua.  Further, fitting IR continua with the LWa model results in
$\dot{M}$ (IR)s that are very accurate for stars with  $\dot{M}$\ $\gtrsim 2 \times
10^{-6}$ M$_\odot$~yr$^{-1}$, but may overestimate the actual $\dot{M}$ s by a factor of 2
for $\dot{M}$\ $\lesssim 2 \times 10^{-6}$ M$_\odot$~yr$^{-1}$.

\section{Results}\label{sec:results}
To summarize, the following ingredients are used in the fits: Weidner \&
Vink (2010) tables to translate spectral types into physical parameters;
TLUSTY models with these parameters to give the photospheric fluxes; and,
Weingartner \& Draine (2001) extinction curves to characterize the
extinction.  We examine the implications of these assumptions in
\S~\ref{sec:systematics}.
\begin{figure}
\begin{center}
\includegraphics[width=1.0\linewidth]{fig2_smc_bwstacks1.pdf}
\end{center}
\vspace{-0.5in}
\caption{Each plot shows a model fit to the log of the fluxes minus the log
of the appropriate TLUSTY model, both normalized to $V$.  For each star, the
observed data are shown as points, with every other curve shown as open or
filled points to avoid confusion when points of adjoining SEDs overlap.
The black curve is the model fit, the dotted curve dotted curve shows the
reddening determined by the fit, and the dashed curve is the reddening plus
the excess expected from the Vink et al.\ (2001) mass loss rate, $\dot{M}({\rm Vink})$.
One $\sigma$ errors (often smaller than the points) are shown and successive
curves are offset by 0.5 dex from the bottom for display.
\label{fig:smcfits1}}
\end{figure}

\begin{figure}
\begin{center}
\includegraphics[width=1.0\linewidth]{fig3_smc_bwstacks2.pdf}
\end{center}
\vspace{-0.5in}
\caption{Same as Figure~\ref{fig:smcfits1}.\label{fig:smcfits2}}
\end{figure}

\begin{figure}
\begin{center}
\includegraphics[width=1.0\linewidth]{fig4_lmc_bwstacks1.pdf}
\end{center}
\vspace{-0.5in}
\caption{Same as Figure~\ref{fig:smcfits1} for the LMC sample.
\label{fig:lmcfits1}}
\end{figure}

For each star, the observed and TLUSTY SEDs were normalized by their $V$
band fluxes.  The difference, $\log f(\lambda)/f(V) - \log f(\lambda)_p/
f(V)_p$, is the IR excess.  This excess was fit using equation~(
\ref{eq:fit}) and a non-linear least squares routine to determine 2 free
parameters: $\dot{M}$(IR), which is the mass loss rate of the best fitting LWa
model and $E(B-V)$ (or, equivalently, $R(V)$, see \S~\ref{sec:systematics}).

Figures~\ref{fig:smcfits1} -- \ref{fig:smcfits2} show the SMC fits,
Figures~\ref{fig:lmcfits1} -- \ref{fig:lmcfits3} show the LMC fits, and
Tables~\ref{tab:smcwinds} and \ref{tab:lmcwinds} list the results.  Because
these figures show the differences between the log of the observed fluxes
and the appropriate TLUSTY model, any shape is due to either reddening or
wind excess.  The photometry is shown as filled of open points and the best
fit model for each star is shown as a thick black curve.  The excess that
would result from the derived reddening and the excess expected from the
mass loss rate predicted using the Vink et al.\ (2001) formulae, $\dot{M}({\rm Vink})$,  is
shown as the dashed curve.  The contribution of reddening to the fits is
shown as a dotted curve (not always visible because it often coincides with
the dashed curve).  For each star, the difference between the dotted curve
and the black curve is the IR excess, and the difference between the dashed
curve and the black curve is the excess over the IR continuum expected for
$\dot{M}({\rm Vink})$.  A few stars, such as AzV~47, show little evidence of either wind
excess or reddening.  Several, such as AzV~120 and AzV~216, are well fit by
reddening alone.  For most stars, there is a clear excess relative to pure
extinction and to the $\dot{M}({\rm Vink})$\ curves.

In general, the fits in Figures~\ref{fig:smcfits1} -- \ref{fig:lmcfits3} are
quite good.  However, four stars: Az~V207, AzV~461, NGC346-026 and AzV~235,
have extremely large excesses and are poorly fit.  The $\dot{M}$(IR) for these
stars are unreliable since their huge excesses suggest circumstellar disks
(see Figure~10 in Bonanos et al.\ 2010).  Consequently, stars with
$\dot{M}({\rm IR})$/$\dot{M}({\rm Vink})$ $ > 100$ (more than twice the next largest ratio) are
identified as probable disks systems in Table~\ref{tab:smcwinds} (all are
in the SMC).  Notice too, that there is evidence that the IR fluxes varied
for some stars with large excesses.  For example, the two sets of nearly
parallel, but off set, points for AzV~243 are from the two $JHK$ surveys,
which were obtained at different epochs.

\begin{figure}
\begin{center}
\includegraphics[width=1.0\linewidth]{fig5_lmc_bwstacks2.pdf}
\end{center}
\vspace{-0.5in}
\caption{Same as Figure~\ref{fig:lmcfits1}.
\label{fig:lmcfits2}}
\end{figure}

\begin{figure}
\vspace{-1.5in}
\begin{center}
\includegraphics[width=1.0\linewidth]{fig6_lmc_bwstacks3.pdf}
\end{center}
\vspace{-0.5in}
\caption{Same as Figure~\ref{fig:lmcfits1}.
\label{fig:lmcfits3}}
\end{figure}

A few other properties of the SEDs are also noteworthy.  For example,
the SEDs of a few stars, such as AzV435 and Sk$-71^\circ46$, show the
effects of relatively large reddening.  It is also interesting to contrast
the excesses and $\dot{M}$(IR)s of the O2 star Sk$-70^\circ90$ and the
O4.5 star Sk$-67^\circ108$.  The former has a smaller excess, but a larger
$\dot{M}$(IR). This is because the O2 star has a much larger $v_\infty$, so the
wind density (and IR emission) is lower for the same $\dot{M}$(IR).

While the fits for most stars shown in Figures~\ref{fig:smcfits1} --
\ref{fig:lmcfits3} appear to have distinct IR excesses, the evidence is
marginal in some cases (e.g., AzV69, AzV135, BI~208 and Sk$-67^\circ$118).
This is an important point since even a small IR excess can imply a fairly
large $\dot{M}$(IR), $\sim 10^{-6}$ $M_\odot$~yr$^{-1}$, which can be far
larger than expected.  To address this problem, all of the stars were fitted
a second time, with {$E(B-V)$}\ as the only free parameter and $\dot{M}$(IR) set to 0.
We then formed the ratio of the $\chi^2$s for the fits with and without
mass loss and compared them to an $F$-distribution.  Stars whose ratios
correspond to a 50\% or more probability of being drawn from the same
distribution are flagged in Tables~\ref{tab:smcwinds} and \ref{tab:lmcwinds},
since there is a good chance that they have no detectable mass loss.

Tables~\ref{tab:smcwinds} and \ref{tab:lmcwinds} contain several stars whose
fits result in relatively large $\chi^2$.  Ignoring the probable disks, an
inspection of Figures~\ref{fig:smcfits1} -- \ref{fig:lmcfits3} reveals that
nearly all of the fits with $\chi^2 \ge 4$ are due to a large discrepancy
in the two sets of $JHK$ photometry.  This means that either the photometry
errors are incorrect, or that the $JHK$ fluxes are variable.  Whatever the
case, the fits tend to go through the mean of the two sets and usually fit
the mid-IR quite well.  Since it is the {\it Spitzer} fluxes which determine
$\dot{M}$ (IR), we believe that most of these fits are better than their
$\chi^2$ would indicate.  However, there are two cases that cannot be
explained as a discordant NIR photometry.  One is AzV~388, whose continuum
seems to have a distinctly different shape than expected, for reasons that
are not clear.  The other is AzV~435 whose derived $E(B-V)$ is the largest
of the entire sample.  Further, it has largest difference between $E(B-V)$
and $E(B-V)_{obs}$, suggesting a peculiar extinction curve, whose shape may
be very different from the one used in the fitting, resulting in a poor fit.
This case illustrates the difficulties encountered when fitting the IR
continua of heavily reddened stars.

Figure~\ref{fig:results} shows the ratio of the derived $\dot{M}$(IR) divided by
$\dot{M}({\rm Vink})$\ for all of the program stars plotted against $\dot{M}({\rm Vink})$.  The red
symbols are for LMC stars and the black symbols for SMC stars.  The downward
pointing arrows indicate stars whose best fits implied $\dot{M}({\rm IR})$~$=0$, stars
with a 50\% or more probability of having no wind are shown as open symbols,
and stars whose fits had a $\chi^2 \ge 4$ are shown as crosses.  Two aspects
of Figure~\ref{fig:results} are worth noting.  The first is that for
$\dot{M}({\rm Vink})$~$\gtrsim 10^{-6}\; M_\odot$ yr$^{-1}$, the relation between the
observed and expected mass loss rates tightens, and $\dot{M}({\rm IR})$~$\simeq
2$~$\dot{M}({\rm Vink})$.  The second is that for $\dot{M}({\rm Vink})$~$\lesssim 10^{-7}\; M_\odot$
yr$^{-1}$, even when the non-detections, probable non-detections and stars
with obvious disks are ignored, more than half of the stars still have solid
detections, implying that the large measured excesses are quite real.

\begin{figure}
\begin{center}
\includegraphics[width=1.0\linewidth]{fig7_summary.pdf}
\end{center}
\vspace{-2.0in}
\caption{Ratios of the mass loss rates determined from IR excesses,
$\dot{M}$(IR), to the theoretical mass loss rates, $\dot{M}({\rm Vink})$, versus $\dot{M}({\rm Vink})$.  Red
and black points are for the LMC and SMC samples, respectively.  Open
circles represent stars whose measured $\dot{M}$(IR)s are consistent with zero,
downward arrows are for stars whose best fits give $\dot{M}$(IR$)=0$, crosses
are for stars with reduced $\chi^2 > 4$ and upward arrows are for stars
with very large mass loss rates, probably from disks.
\label{fig:results}}
\end{figure}

\section{Systematic effects}\label{sec:systematics}
This section examines how the derived mass loss rates are affected by errors
in: spectral classifications; the neglect of wind emission on the $B$ and
$V$ photometry; variations in the extinction curves; the assumed wind
temperature; and, the velocity law parameters.

Changing the spectral and luminosity classes (and, hence, the stellar
parameters) changes $f(\lambda)_p$ and $\dot{M}({\rm Vink})$.  Nevertheless, simulations
showed that the derived $\dot{M}({\rm IR})$\ were not very sensitive to classification
errors of $\pm 1$ spectral or luminosity class and changed by less than 20\%
in both cases.

Comparisons to CMFGEN models (\S~\ref{sec:model}), suggest that our
assumption that $B$ and $V$ are unaffected by wind emission is reasonable
in most cases.  However, in the few instances where the wind emission is
strong enough to affect the optical photometry, it will contaminate $V$
more than $B$.  This creates an intrinsic $E(B-V)$, causing an over
correction for extinction which, in turn, leaves less excess to be
accounted for by $\dot{M}$(IR), resulting in an underestimate of $\dot{M}$(IR).
Since our major concern is effects that might lead us to over estimate
$\dot{M}$(IR), this issue is not considered further.

Variations in the extinction law are another concern.
Figure~\ref{fig:extinction} demonstrates how changing $E(B-V)$ or $R(V)$ are
equivalent over the wavelength range of interest.  It shows two Weingartner
\& Draine (2001) Galactic curves: one for $R(V) = 3.1$ and one for $R(V) =
5.5$ divided by 1.7.  The locations of the photometric bands are also
indicated.  The figure shows that for wavelengths longer than $V$, rescaling
an extinction curve with one value of $R(V)$ results in a good approximation
of an extinction curve with a different $R(V)$.  However, for large values
of $E(B-V)$, the differences can become important, introducing errors of 0.1
mag or more.  That is why it is best to derive IR excesses for stars with
small color excesses.

\begin{figure}
\begin{center}
\includegraphics[width=1.0\linewidth]{fig8_comp_klam.pdf}
\vspace{-2.1in}
\caption{Comparison of Weingartner \& Draine (2001) extinction curves for
$R(V) = 3.1$ (black curve) and $R(V) = 5.5$ (dashed curve).  The $R(V) =
5.5$ has been divided by 1.7 to demonstrate how very different curves can
appear proportional for wavelengths longer than $V$.\label{fig:extinction}}
\end{center}
\end{figure}

The degeneracy of {$E(B-V)$}\ and {$R(V)$}\ was the motivation for allowing {$E(B-V)$}\ to be
a free parameter when fitting the SEDs instead of simply setting it equal to
$E(B-V)_{obs}$.  This accommodates possible variations in {$R(V)$}.  If the
actual value of {$R(V)$}\ along the line of sight, {$R(V)$}$_0$, differs from the
assumed Weingartner \& Draine (2001) value, {$R(V)$}$_{WD}$, then it should be
possible to recover {$R(V)$}$_0$, from the relation
\begin{equation}
E(B-V)_{obs} R(V)_{WD} = E(B-V)_{fit} R(V)_0
\end{equation}
where $E(B-V)_{fit}$ is the excess obtained from the fit.
Figure~\ref{fig:rv_smc} shows {$R(V)$}$_0$ plotted against {$E(B-V)$}$_{obs}$ for the
SMC sample.  Considering that all of the excesses are small and that the
errors are large, we see that there is a general trend for {$R(V)$}$_0$ to
decrease with increasing $E(B-V)_{obs}$.  This is consistent with the sight
lines passing through a small amount of foreground, Galactic dust, with an
{$R(V)$} $\sim 4$ and then passing through more and more SMC dust with $R(V)
\sim 2.5$.  Although the line of sight to the SMC was not included in
Schlafly et al.\ (2017), they do detect $R(V) \sim 4$ for high latitude
Galactic dust in nearby fields.  Further, $R(V) = 2.5$ is consistent with
the SMC $R(V)$ determined by Gordon \& Clayton (1998).  Keeping in mind
that neither the foreground nor the SMC dust are probably perfectly uniform,
the general trend appears to verify our assumption that the value of {$R(V)$}\
is changing from one line of sight to the next, and the amount of change
depends on the relative amounts of Galactic and SMC dust encountered.

\begin{figure}
\begin{center}
\includegraphics[width=1.0\linewidth]{fig9_rv_smc.pdf}
\end{center}
\vspace{-2.0in}
\caption{
Values of {$R(V)$}\ derived from the fits plotted against {$E(B-V)$}$_{obs}$ for the
SMC sample.  Solid points have a reduced $\chi^2 < 4$ and crosses have
$\chi^2 \geq 4$.  The plot suggests a foreground contribution to the
extinction of {$E(B-V)$}$\simeq 0.05$\ mag from dust with a rather large {$R(V)$},
which then melds into SMC dust with a much smaller {$R(V)$}.  Both components
may be rather patchy, accounting for the large scatter.\label{fig:rv_smc}}
\end{figure}

Assigning an incorrect temperature to the wind can affect the results.  The
wind temperature could be much higher than 0.9{$T_{\rm eff}$}\ if shocks and their
associated X-rays heat the wind to temperatures $\sim 10^6$K as suggested
by Cassinelli et al.\ (2001).  However, increasing $T_{w}$ to $10^6$~K only
reduces $\dot{M}$(IR) by 30\%.

Finally, we examined how changing the parameters in the velocity law,
eq.~(\ref{eq:vlaw}), affects the derived mass loss rates.  Changing $w_0$
over the range $0.005 \leq w_0 \leq 0.02$ (the most commonly used values)
changed the derived $\dot{M}({\rm IR})$ s by 20\% or less, which is small compared to
the observed disagreement between theory and observation.

It is particularly important to examine the effect of changing $v_\infty$
for the less luminous stars.  For most of these stars, observed values are
not available so we rely on the values predicted by Vink et al.\ (2001).
When observed values are available, they are often much less than the
predicted ones, but this could be a systematic effect.  It is difficult to
measure $v_\infty$ in less luminous stars, since their wind lines are
typically asymmetric, lacking a distinctive blue edge.  This makes the full
extent of the wind absorption hard to measure and easy to underestimate.
However, experiments show that reducing $v_\infty$ by a factor of 2 reduces
$\dot{M}({\rm IR})$\ by 40\%.  While substantial, this is too little to explain the
observed $\dot{M}({\rm IR})$ / $\dot{M}({\rm Vink})$\ ratios.

In contrast to the other parameters, $\beta$\ can have a major effect on
the derived $\dot{M}$(IR)s (as noted by LWa).  Changing $\beta$ from 1 to 2.5
reduces the inferred $\dot{M}$\ by a factor of 2.7.  Figure~\ref{fig:beta}
demonstrates this effect.  It arises because a larger $\beta$ reduces the
velocity gradient (increasing the density) near the surface of the star,
where most of the emission occurs.  We return to this issue in the next
section.

\begin{figure}
\begin{center}
\includegraphics[width=1.0\linewidth]{fig10_beta_effect.pdf}
\end{center}
\vspace{-2.0in}
\caption{
The effect of changing $\beta$ on the derived mass loss rates for the sample
shown in Figure~\ref{fig:results}.  The plot shows $\dot{M}({\rm IR})$/$\dot{M}({\rm Vink})$\ as a
function of $\dot{M}({\rm Vink})$.  Open points are $\dot{M}({\rm IR})$\ derived using $\beta =1$,
filled points are $\dot{M}({\rm IR})$\ derived using $\beta = 2.5$, and lines connect
points for the same star.
\label{fig:beta}}
\end{figure}

\section{Discussion}\label{sec:discussion}

Our results can be summarized as follows: mass loss rates determined from IR
excesses are larger than expected, increasing from about a factor of 2 for
the most luminous stars to about 40 for the least luminous stars with
detectable IR excesses; and, the LMC and the SMC results are similar.
Because we have shown that $\dot{M}({\rm IR})$\ derived by the LWa models can
overestimate the actual $\dot{M}$\ by a factor of 2 for stars with $\dot{M}
\lesssim 2 \times 10^{-6}$ M$_\odot$~yr$^{-1}$, these results are consistent with
$\dot{M}({\rm Vink})$~$\lesssim$ $\dot{M}({\rm IR})$ $\lesssim$ 2$\dot{M}({\rm Vink})$\ for $\dot{M}({\rm Vink})$~$\gtrsim 2
\times 10^{-6}$ M$_\odot$~yr$^{-1}$, growing to 5 $\dot{M}({\rm Vink})$~$\lesssim$ $\dot{M}({\rm IR})$~$\lesssim
20$~$\dot{M}({\rm Vink})$\ for the least luminous stars.  Thus, if we interpret the IR
excesses in terms of mass loss, they infer rates that are equal to or
much larger than theoretical predictions.  This is in stark contrast to
recent mass loss rates determined from UV wind lines, H$\alpha$\ and X-ray
diagnostics, which suggest rates smaller than the Vink et al.\ (2001)
predictions by a factor of 2 to 3 (see Martins \& Palacios 2017 for a
summary).

However, it is well known that increasing the mass loss rate is not the only
way to increase the IR emission.  In this section, we argue that the large
IR excesses and their implied large $\dot{M}$(IR)s are not the result of large
mass loss rates.  Instead, we attribute them to density and velocity
structures near the base of the wind.  We also consider the implications of
the scatter in Figure~\ref{fig:results} and the fact that points from stars
in both galaxies are interspersed.

Throughout the discussion, we emphasize that the IR excesses in our sample
originate very near the stellar surface.  To see this, consider the
effective radii of the IR excesses.  Using a $\beta = 1$ velocity law and
our longest wavelength, 8.0$\mu$m, even the strongest winds in our sample
(aside from the obvious disks) result in a value of the LWa parameter
$E_\nu$ (their eq.~6) that is less than 0.01.  This implies an effective
radius which is only a few percent larger than the stellar radius (see LWa
Figure~4).

At O star temperatures, the intensity of the IR wind emission is
proportional to the density squared, and there are two ways to enhance
this for a fixed mass loss rate.  One is to collect most of the wind mass
into structures or clumps with enhanced densities.  The other is to reduce
the velocity gradient, which then increases the density through the
continuity equation.  Since, as outlined in \S~\ref{sec:intro}, evidence
for structure in O star winds abounds, including indications that this
structure originates near the stellar surface, we suspect that this
structure accounts for much of the large excesses.  The notion that we are
seeing effects that originate near the stellar surface is reinforced by the
fact that the largest discrepancies occur for stars with lower expected mass
loss rates, where we expect to see nearly to the stellar surface.

It is possible to make our results a bit more quantitative.  First, consider
the case where all of the excess is due to density inhomogeneities.  Abbott
et al.\ (1981) developed a simple model for how clumping enhances the
observed emission.  It assumes the wind consists of two components whose
density ratio is $x$, where $0 \leq x \leq 1$, and the fraction of the wind
volume occupied by the higher density is $f_V$.  The geometry of the
structures is unspecified.  Setting $x = 0$ gives the largest enhancements
for fixed $f_V$, with the ratio of the observed to actual mass loss rates
being simply $f_V^{-1/2}$.  In our case, this ratio is $\dot{M}({\rm IR})$/$\dot{M}({\rm Vink})$.  For
stars with smaller $\dot{M}({\rm Vink})$, this ratio varies between 5 and 20 (where an
overestimate of 2 by $\dot{M}({\rm IR})$\ is assumed).  Thus, if the entire discrepancy
is attributed to clumping, stars with weak winds must have all of the wind
material confined to between 0.3 and 4\% of the wind volume.  This is in
contrast to stars with more massive the winds, where Massa \& Prinja (2015)
showed that the wind structures near the photosphere are quite large and to
recent H$\alpha$\ results, described below.

Next, consider the effects of the velocity gradient.  Figure~\ref{fig:beta}
shows that increasing $\beta$ from 1 to 2.5 (which corresponds to
reducing the velocity gradient at $x=1$ by a factor of 7.5 for $w_0 =
0.01$), decreases the inferred $\dot{M}({\rm IR})$\ by a factor of 2.7.  Thus, a large
reduction in the velocity gradient can also strongly influence the mass
loss inferred from the IR flux.

It is interesting to compare our results with the recent H$\alpha$\ mass loss
rates determined by Ram\'{i}rez-Agudelo et al.\ (2017).  For stars more
luminous than $\log L/L_\odot \gtrsim 5.6$, (which corresponds roughly to
$\dot{M}({\rm Vink})$ $\gtrsim 10^{-6}$ M$_\odot$~yr$^{-1}$) both approaches require similar volume
filling factors to bring the observational mass loss rates into accord with
the theoretical ones.  However, at lower luminosity, the IR mass loss rates
are much larger than those determined from H$\alpha$.  This can arise if the
velocity gradient is small, so that the opacity at continuum wavelengths is
much less than in a line like H$\alpha$.  In this case, the IR emission probes
more deeply into the wind and, as we saw above, a slow acceleration can
greatly enhance the IR emission.  Therefore, to avoid extremely large
values of $f_V$, it seems that some combination of strong density clumping
and a small acceleration at the base of the wind are required to produce
the observed IR excesses.  Given that the IR emission in stars expected to
have low mass loss rates originates in the poorly understood transition
region between the photosphere and wind, our results should not be too
surprising.  Instead, we should view the IR as providing important
constraints on the structure of the photosphere -- wind interface.

A few other aspects of Figure~\ref{fig:results} are also of interest. First,
the large intrinsic scatter in $\dot{M}({\rm IR})$\ for stars with smaller $\dot{M}({\rm Vink})$\
suggests that either the IR excesses are affected by physical parameters
beyond those used to determine $\dot{M}({\rm Vink})$\ (e.g., rotation, magnetic fields,
interacting binary winds or incipient disks), or that the excesses in these
stars are variable.  Second, points from both the SMC and LMC overlap,
implying that the physical origin of the process causing the additional
excesses is independent of metallicity, and consistent with the Vink et al.\
(2001) treatment of different metallicities.

Our results could also have bearing on the ``weak wind problem'' (Martins
et al.\ 2005).  If the excesses for low luminosity stars are due to extremely
compact structures and small velocity gradients near the stellar surfaces,
then many of the diagnostics used to interpret weak winds could be strongly
affected.

\section*{Acknowledgements}
DM acknowledges support from ADP Grant No.\ NNX14AB30G to SSI.  This
publication makes use of data products from the 2MASS, which is a joint
project of the University of Massachusetts and the Infrared Processing and
Analysis Center/California Institute of Technology, funded by the National
Aeronautics and Space Administration and the National Science Foundation.