\section{Introduction}\label{intro}


Red clump stars (RCs) with almost constant brightness have long been regarded as valuable indicators and are used widely for (1) estimating distances \citep[e.g.,][]{1998ApJ...494L.219P, 1998ApJ...500L.141S, 2000ApJ...539..732A, 2000ApJ...531L..25U, 2002AJ....123..244K, 2007MNRAS.378.1064R, 2007MNRAS.380.1255R, 2012MNRAS.419.1637L, 2020A&A...639A..72W}, 
(2) investigating the reddening and extinction \citep[e.g.,][]{2005ApJ...619..931I, 2009ApJ...707...89G, 2009ApJ...696.1407N, 2009ApJ...707..510Z, 2013ApJ...769...88N, 2016MNRAS.456.2692N, 2017ApJ...848..106W, 2019ApJ...877..116W, 2020NatAs...4..377N}, 
and (3) studying the structures of our Galaxy and nearby dwarf galaxies \citep[e.g.,][]{2002A&A...394..883L, 2007MNRAS.378.1064R, 2010ApJ...724.1491M, 2010ApJ...721L..28N, 2013MNRAS.435.1874W, 2016ApJ...823...30B, 2020MNRAS.491.2104W}.
However, the absolute magnitude of RCs has been reported to depend on the age and metallicity in the literature \citep{1999AJ....118.2321S, 1999AJ....117.1816T, 2001MNRAS.323..109G, 2002MNRAS.337..332S, 2007A&A...463..559V, 2010AJ....140.1038P, 2016ARA&A..54...95G, 2019MNRAS.486.5600O}. 
The use of constant absolute magnitude in studying distances and structures can lead to significantly systematic biases. This problem is mitigated if spectroscopic data is available, since the age of RC can be inferred from elemental abundances, such as [C/N] and [$\alpha$/M] \citep{2016ApJ...823..114N}. Nevertheless, an optimal absolute magnitude is still expected, which can be used for a large number of RCs without spectroscopic information.

\citet{2000ApJ...539..732A} used {\it Hipparcos} RCs to investigate the $K$-band absolute magnitude and found no correlation between $M_{K}$ and [Fe/H].  
Based on the study of $\sim$ 200 nearby RCs, \citet{2012MNRAS.419.1637L} agreed with the result of \citet{2000ApJ...539..732A}. 
\citet{2001MNRAS.323..109G} and \citet{2016ARA&A..54...95G} summarized that the population effects on RC's absolute magnitude exist in any band. 
\citet{2017ApJ...840...77C} investigated the RC absolute magnitudes from optical to infrared (IR) bands and found a clear trend between absolute magnitudes and ages.
With the wealth of available astrometric data from {\it Gaia} and spectroscopic data from APOGEE \citep[the Apache Point Observatory Galactic Evolution Experiment,][]{2011AJ....142...72E,2017AJ....154...94M}, LAMOST \citep[the Large Sky Area Multi-Object Fiber Spectroscopic Telescope,][]{2012RAA....12.1197C,2012RAA....12..735D,2012RAA....12..723Z}, GALAH \citep[the GALactic Archaeology with HERMES1,][]{2015MNRAS.449.2604D}, there have been many works devoted to studying the RC absolute magnitudes in recent years.
Based on the {\it Gaia} TGAS parallaxes, \citet{2017MNRAS.471..722H} determined the RC absolute magnitudes in 2MASS \citep[The Two Micron All Sky Survey,][]{Cohen2003AJ....126.1090C}, {\it Gaia} $G$, and {\it WISE} \citep[Wide-field Infrared Survey Explorer,][]{2010AJ....140.1868W}
bands. 
\citet{2018A&A...609A.116R} derived RC absolute magnitudes and discussed their dependence on color. 
Later, with {\it Gaia} DR2 and APOGEE data, \citet{2020MNRAS.493.4367C} derived the RC absolute magnitudes in 2MASS and {\it Gaia} $G$ bands and found that the absolute magnitude varies with [$\alpha$/Fe] for the low-$\alpha$ and high-$\alpha$ populations. 
They suggested a more detailed model of the RC absolute magnitudes is necessary for using it precisely.  
\citet{2020ApJ...893..108P} derived the median RC absolute magnitudes for low-$\alpha$ and high-$\alpha$ populations separately. 
\citet{2020ApJS..249...29H} calibrated $\Ks$-band absolute magnitude and its dependency on metallicity and age for LAMOST RCs. 

To better study the absolute magnitude of RC, it is important to have a good understanding of the Galactic structure and the distribution of the stellar population.
RCs' ages are around $1-10$ Gyrs and more concentrated in $1-2$ Gyrs \citep{2016ARA&A..54...95G}. RCs are found mainly in thin and thick disks, and to a lesser extent in the halo. The density of thin and thick disks decreases outwards roughly exponentially with scalelengths around $2.6\pm0.5$ kpc and $2.0\pm0.2$ kpc, and scaleheights around $0.30\pm0.05$ kpc and $0.90\pm0.18$ kpc \citep[and reference therein]{2016ARA&A..54..529B}.
The flare and warp of the stellar disk have been studied by red giants and RCs \citep{2002A&A...394..883L}. Recently, with thousands of classical Cepheids, the flared and warped disk was directly illustrated and well determined \citep{2019NatAs...3..320C, 2019Sci...365..478S}. The amplitudes of flare and warp increase with the Galactocentric distance, and the relationships can be approximated as a power-law equation.


With the availability of large-scale spectroscopic data in recent years, the stellar metallicity and elemental abundance distributions in the Milky Way have been further studied and better understood. 
Based on APOGEE red giants, \citet{2014AJ....147..116H,2015ApJ...808..132H} measured the stellar distribution in the [$\alpha$/Fe]$-$[Fe/H] plane and studied metallicity gradient and metallicity distribution functions in the Milky Way disk.
\citet{2015RAA....15.1209X} derived the radial and vertical metallicity gradients of the Milky Way disk in the anti-center direction by using main sequence turn-off stars in LAMOST. 
Later, \citet{2016ApJ...823...30B} studied the different distributions of RCs with mono-abundance populations and found that low-[$\alpha$/Fe] RCs show flare features in the outer disk.  
\citet{2017MNRAS.471.3057M} further measured the age-metallicity structure and surface-mass density profile of the Milky Way by using red giants. 
\citet{2017A&A...600A..70A} measured the evolution of the radial metallicity gradient in the Milky Way's thin disk. 
Generally, the metallicity decreases with the increase of the Galactocentric distance (only considering $R>4$ kpc), while the gradient $\mathrm{d}{\rm [M/H]}/\mathrm{d}R$ varies with the height.  
The knowledge about the relationship between RC absolute magnitudes and the elemental abundances allow the study of the distribution of RC absolute magnitudes in the Milky Way.



Nowadays, {\it Gaia} early data release 3 (EDR3) is available with about 30\% better distance accuracy than that of DR2 \citep{2018A&A...616A...1G}, and the systematic bias of the parallax has been well constrained by the parallax correction from \citet{2021A&A...649A...4L,2021A&A...649A...2L}. 
Therefore, with a combination of {\it Gaia} EDR3 parallaxes, APOGEE, and LAMOST spectral parameters, it is time to establish a three-dimensional (3D) distribution model of the RC absolute magnitude throughout the Milky Way instead of a constant absolute magnitude. 
To design the model, we consider the main structures of the Milky Way, as well as the distribution of elemental abundances and populations. 
Based on our model, more suitable absolute magnitudes and intrinsic colors can be obtained for RCs at any spatial position and distance without the spectroscopic information. 
In turn, more accurate absolute magnitudes will benefit the study of the Galactic structure and extinction, especially in regions where spectroscopic observations are lacking.

The sketch of this paper is as follows. 
The description of data sets and the spectral RC sample are presented in Section~\ref{data}. 
In Section~\ref{RCabs_int}, we present the method to derive the absolute magnitudes and intrinsic colors of RCs with spectral parameters. 
Section~\ref{3Dmap} presents the methods and results of establishing RCs' 3D absolute magnitude and intrinsic color maps. 
The validation of our 3D parameter maps is discussed in Section~\ref{section4}. 
In Section~\ref{GaiaRC}, we construct a large whole-sky {\it Gaia} RC sample. 
We briefly describe our prospects for this work in Section~\ref{prospect} and summarize our principal conclusions in Section~\ref{Conclusion}.



\section{Data and Sample} \label{data}

\subsection{Data} 

To investigate the multi-band absolute magnitudes of RCs, we used astrometric data from {\it Gaia} EDR3, spectroscopic data from APOGEE and LAMOST, and photometric data from the {\it Gaia}, APASS, Pan-STARRS1 (PS1), 2MASS, and {\it WISE} surveys. 

\subsubsection{Gaia} 

The {\it Gaia} EDR3 provides photometry and astrometry for 1.8 billion sources brighter than 21.0 mag in $G$ band \citep{2021A&A...649A...1G}.
The high-precision photometry contains three broadbands, $G$, $\GBP$, $\GRP$, for more than 1.5 billion stars. 
\citet{2021A&A...649A...4L} investigated the relationship between parallax offset and star's spatial position, magnitude, and color. 
They found an overall zero-point offset of the Gaia EDR3 parallax is about -0.017 mas and provided a formal procedure for offset correction. 
This procedure is very effective in reducing the systematic offset of parallaxes and has been validated by distance tracers such as RCs \citep{2021ApJ...910L...5H} and contact binaries \citep{2021ApJ...911L..20R}. We adopted the correction estimated by this procedure for distance estimation. For our RC sample, the offsets are around -0.03 mas, slightly larger than the mean value.  

\subsubsection{APOGEE} 

APOGEE is a near-IR $H$-band ($15000-17000\rm{\AA}$) spectroscopic survey with high-resolution ($R\sim22,500$). 
The spectra reduction has been described in \citet{2015AJ....150..173N}. 
Stellar atmospheric parameters, such as effective temperature $\Teff$, surface gravity $\log g$, and metallicity [M/H], and chemical abundances are derived by using the APOGEE Stellar Parameters and Chemical Abundance Pipeline \citep[ASPCAP;][]{2016AJ....151..144G}. 
\citet{2018AJ....156..125H} and \citet{2018AJ....156..126J} further analyzed the  precision of these parameters. 
We utilize data from the latest released APOGEE DR16 \citep{2020ApJS..249....3A} with the catalog provided by \citet{2020AJ....160..120J}.  
A detailed description and element-by-element discussion of the reliability of the DR16 results can also be found in \citet{2020AJ....160..120J}.


\subsubsection{LAMOST} 

LAMOST is the Galactic spectroscopic survey that takes 4000 spectra simultaneously with a resolution of $R\sim1,800$ covering the full optical range of $3690-9100\rm{\AA}$.
We adopted $\log g$, $\Teff$, and [Fe/H] from LAMOST DR7 and obtained their chemical abundances [C/Fe], [N/Fe], and [$\alpha$/Fe] from \citet{2019ApJS..245...34X}. 
The typical internal uncertainties are $150$ K in $\Teff$, 0.25 dex in $\log g$, and 0.15 dex in [Fe/H], at a spectral signal-to-noise ratio (S/N) $>10$ \citep{2015RAA....15.1095L}.
 

\subsubsection{APASS}
The American Association of Variable Star Observers (AAVSO)
Photometric All-Sky Survey (APASS) DR9 provides $B$ and $V$ bands photometric data for stars brighter than $V\sim17$ mag \citep{2016yCat.2336....0H}.


\subsubsection{Pan-STARRS1} 

The PS1 survey images the sky in five optical bands, $g, r, i, z$, and $y$, covering 400 nm to 1$\mum$ \citep{2016arXiv161205560C}. The mean 5\,$\sigma$ limiting magnitudes of point-source in $g, r, i, z$, and $y$ bands are 23.3, 23.2, 23.1, 22.3, and 21.4 mag, respectively. 


\subsubsection{2MASS} 

The 2MASS is a whole-sky survey in the near-IR $J H \Ks$ bands \citep{Cohen2003AJ....126.1090C}. The 10\,$\sigma$ limiting magnitudes of the point-source catalog are 15.8, 15.1, and 14.3 mag in the $J$, $H$, and $\Ks$ bands, respectively \citep{2006AJ....131.1163S}. 


\subsubsection{{\it WISE}} 
The {\it WISE} survey is a mid-IR whole-sky survey in four bands: $W1$, $W2$, $W3$, and $W4$ bands with centering wavelengths center 3.35, 4.60, 11.56, and 22.09$\mum$, respectively. 
We collected {\it WISE} $W1$, $W2$, and $W3$ bands data from the ALLWISE catalog. 




\subsection{Spectral Red Clump Sample}\label{RCsample} 

\begin{figure*
\centering
\includegraphics[width=\hsize]{rcsample1.eps}
\caption{
The $\Teff-\log g$ diagrams (top) and $\Ks-{\rm DM}$ vs. ($J-\Ks$) CMDs (bottom) for the selected APOGEE RCs (left) and LAMOST RCs (right). 
The color represents the number density of RCs.
The magenta, green, cyan dotted asterisk lines are the evolutionary tracks from \citet{2001MNRAS.323..109G} with metallicities $Z=0.04, 0.19, 0.30$, respectively. The yellow-dashed lines $(J-\Ks)_0=0.71$ mag and $M_{K_{\rm S}}+1.7\times(J-\Ks)_0+0.2=0$ mag indicate the boundaries of RCs, whose absolute magnitudes and intrinsic colors are predicted based on spectral parameters (see Section 3). 
}
\label{Fig_RC1}
\end{figure*}



\begin{table*}[ht]
\begin{center}
\caption{\label{tab_sample} Seven Different Red Clump Samples Used In This Work}
\begin{tabular}{p{110pt}p{250pt}p{75pt}p{30pt}}
\hline \hline
Name & Notes &  Sample Size & Section   \\ 
\hline      
APOGEE RC sample  &  spectral RCs, $4550\K \le \Teff \le 5120\K$ and $2.3 \le \log g \le 2.5$, left panels of Figure 1  &  42,947  &  2.2   \\ 
LAMOST RC sample & spectral RCs, in the high-density region of the $\Teff-\log g$ diagram, centered at $\Teff=4800 \K$ and $\log g=2.5$, RCs with $\Ks-{\rm DM}> -1.2$ mag and $\log g>2.6$ are excluded, right panels of Figure 1 &  93,542  &  2.2   \\   
APOGEE RC training sets & subsets of APOGEE RC sample for absolute magnitude training ($A_{V}<0.1$ mag, $\varpi>1$, and $\sigma_\varpi/\varpi<0.05$), and for intrinsic color training ($A_{V}<0.1$ mag) &  $\sim 1,300$/7,712 &  3.1,  3.3  \\
LAMOST RC training sets & subsets of LAMOST RC sample for absolute magnitude training ($A_{V}<0.1$ mag, $\varpi>1$, and $\sigma_\varpi/\varpi<0.05$), for intrinsic color training ($A_{V}<0.1$ mag) &  $\sim 3,700$/10,797  &  3.1,  3.3  \\
Combined RC sample & a combination of LAMOST, APOGEE, and {\it Gaia} RCs to establish RC 3D parameter maps &  $\sim 156,000$  &  4.1  \\
External test RC sample & photometric RCs from {\it Gaia} with $\sigma_\varpi/\varpi<0.2$, $-2.4<m_G-1.89\times(\GBP-\GRP)-(5\log d+10) <-0.9$ mag, and $M_\Ks+1.7\times(J-\Ks)_0\leq0$ mag  &    &  5.1  \\
{\it Gaia} RC sample & a whole-sky photometric RC sample selected from {\it Gaia} data &  $\sim 11,000,000$  &  6  \\
\hline
\end{tabular}
\end{center}
\end{table*}



The RCs, core-helium-burning evolved stars, cover the range of spectral types G8III--K2III with effective temperatures of 4500--5300K \citep{2016ARA&A..54...95G}. 
These stars stand out in the $\Teff-\log g$ diagram and can be easily identified as a clump. 
Hence, we constructed the spectral RC sample based on the stellar parameters from APOGEE and LAMOST surveys. 

The initial data selection required stars with high-quality data. 
\begin{itemize}
\item[--] For APOGEE data, we required ASPCAPFLAG=0, and S/N$>70$. 
The uncertainties in stellar parameters $\Teff$, $\log g$, and [M/H] are less than 150 K, 0.08 dex, 0.02 dex, respectively.  
We also required that uncertainties in elemental abundances [$\alpha$/M], [C/Fe], and [N/Fe] are less than 0.02 dex, 0.05 dex, 0.05 dex, respectively.   
\item[--] For LAMOST data, we required S/N$\underline{~~}$g$>30$ (Spectral S/N per pixel in $g$ band), and qflag$\underline{~~}$chi2=``good".
The uncertainties of $\Teff$ and $\log g$ are less than $200\K$ and 0.2 dex, respectively.
We also required that uncertainties in elemental abundances [Fe/H], [$\alpha$/Fe], [C/Fe], and [N/Fe] are less than 0.1 dex, 0.04 dex, 0.05 dex, 0.1 dex, respectively.
\end{itemize}
Next, we selected RC candidates from the $\Teff-\log g$ diagram.  
For the APOGEE data, we required that RCs satisfy $4550\K \le \Teff \le 5120\K$ and $2.3 \le \log g \le 2.5$. 
Such a narrow range of $\log g$ effectively removes secondary RC stars (SRCs) and red giants \citep{2019ApJ...877..116W}. 
For the LAMOST data, we first selected stars located in the high-density region of the $\Teff-\log g$ diagram, centered at $\Teff=4800 \K$ and $\log g=2.5$. 
The top panel of Figure~\ref{Fig_RC1} shows the $\Teff-\log g$ plots of APOGEE RCs (left) and LAMOST RCs (right). 
We find that the APOGEE RCs and LAMOST RCs show different correlations between $\log g$ and $\Teff$. This is due to the systematic bias in the $\log g$ calculated by the LAMOST Stellar Parameters Pipeline (LASP) for giant stars. \citet{2015RAA....15.1209X} analyzed the LAMOST spectra based on their pipeline and found that for giants with $2<\log g<3$, their $\log g$ also shows an anti-correlation with LASP \citep[Figure 22 of ][]{2015RAA....15.1209X}. Nevertheless, the systematic deviation of $\log g$ does not affect the selection and internal statistical analysis of the LAMOST RCs. 
Since $\log g$ in LAMOST is not as accurate as in APOGEE, the LAMOST RC candidates selected from the $\Teff-\log g$ diagram contain some contamination, mainly red giants and SRCs. 
Comparing with APOGEE data, we find that 30\% of LAMOST RC candidates do not satisfy the APOGEE RC criterion. If we consider that our APOGEE RC criterion is too strict, the actual contamination rate of LAMOST RC candidates selected based on $\log g$ and $\Teff$ is probably around 20\%. This is consistent with the analysis of \citet{2018ApJ...858L...7T}. 
Then, we tried to remove contamination using the near-IR color-magnitude diagram (CMD). 
Based on the corrected {\it Gaia} parallaxes, we estimated the distance-corrected magnitude in the $\Ks$ band $\Ks-{\rm DM}$ (DM denotes the distance modulus). 
In the plot of $\Ks-{\rm DM}$ versus ($J-\Ks$), some stars are distributed in $\Ks-{\rm DM}>-1.2$ mag, and they deviate from the RCs distribution. 
These stars are mainly distributed in $\log g>2.6$ on the $\Teff-\log g$ diagram, with a high probability of being red giants and SRCs. 
Therefore, we excluded stars with $\Ks-{\rm DM}> -1.2$ mag and $\log g>2.6$ in the selection of LAMOST RCs. 


Only APOGEE RCs with $2.3<\log g<2.5, 4550\K<\Teff<5120\K, -0.8<{\rm [M/H]}<0.5, -0.12<{\rm [N/Fe]}<0.5, -0.15<{\rm [C/Fe]}<0.3, -0.05<{\rm [\alpha/M]}<0.3$ and LAMOST RCs with $2.1<\log g<2.9, 4550\K<\Teff<5000\K, -0.9<{\rm [Fe/H]}<0.3, -0.12<{\rm [N/Fe]}<0.5, -0.4<{\rm [C/Fe]}<0.1, -0.1<{\rm [\alpha/Fe]}<0.3$ were selected to ensure that all parameter ranges are covered by the training sets (see Section 3).



The final spectral RC sample contains 42,947 APOGEE RCs and 93,542 LAMOST RCs. 
\citet{2018ApJ...853...20H, 2018ApJ...858L...7T} obtained a sample of RCs based on asteroseismology parameters determined directly from the spectra of APOGEE and LAMOST.  We cross-matched our RC sample with their entire sample and obtained 90,385 common objects. Of these, 83\% were classified as pristine RCs by \citet{2018ApJ...858L...7T}. By examining the period spacing-frequency separation distribution \citep[Figure 1 of][]{2018ApJ...858L...7T}, only ~1\% of our RCs are located in the red giant sequence, while the other 16\% of RCs are located in the transition region. This indicates that our sample is less contaminated. During the comparison, we found that both the ($\log g$, $\Teff$, parallax) cut method and the spectroscopic asteroseismology method miss a certain percentage of RCs to ensure purity. 



The bottom panels of Figure~\ref{Fig_RC1} display near-IR bands $\Ks-{\rm DM}$ versus ($J-\Ks$) CMDs. 
The color represents the number density of RCs. 
The distribution of LAMOST RCs in the CMD is similar to that of APOGEE RCs, indicating that the selection criteria we applied to the LAMOST data effectively remove contamination. 
The evolutionary tracks of RCs with different metallicities $Z=0.04, 0.19, 0.30$ \citep{2001MNRAS.323..109G} are plotted as magenta, green, cyan dotted asterisk lines, respectively.  
The yellow-dashed lines $(J-\Ks)_0=0.71$ mag and $M_{K_{\rm S}}+1.7\times(J-\Ks)_0+0.2=0$ mag indicate the boundaries of RCs, whose absolute magnitude and intrinsic color are predicted based on spectral parameters (see Section 3). These RC boundaries agree with the theoretical evolutionary tracks. Despite the extinction effect, the distribution of most RCs is consistent with the theoretical predictions, which justifies our selection criteria. Note that these criteria were used again in Sections \ref{3Dmapderive} and \ref{result_check} to purify {\it Gaia} RCs.
For clarity, we describe the different RC samples used in this work in Table \ref{tab_sample}.


 
In the subsequent calculations and predictions of RCs' multi-band absolute magnitudes and intrinsic colors, we also require that the photometric errors $\sigma_m$ and magnitudes of different data satisfy the corresponding criteria:
\begin{enumerate}
\item For {\it Gaia} data, $\sigma_m \le 0.01$ mag and magnitude $\le18.0$ mag in $G$, $\GBP$, $\GRP$ bands.
\item For APASS data, $\sigma_m \le 0.05$ mag in $B$, $V$ bands. 
\item For PS1 data, $\sigma_m \le 0.02$ mag in $g, r, i, z$, $y$ bands. 
\item For 2MASS data, $\sigma_m \le 0.05$ mag and magnitude ranging from 6.0 to 14.0 mag in $J$, $H$, $\Ks$ bands. 
\item For {\it WISE} data, $\sigma_m \le 0.05$ mag in $W1, W2$, $W3$ bands. 
\end{enumerate}

 
\section{Red Clump Absolute Magnitude and Intrinsic Color} \label{RCabs_int}

This section describes how we derived the absolute magnitude and intrinsic color of RCs based on their spectral parameters. 
A summary of the process is as follows. 
First, we selected RCs from the spectral RC sample (including APOGEE RCs and LAMOST RCs) to construct the training sets. 
Then, we calculated the absolute magnitude and intrinsic color of each training set star. 
After that, we built regression learners based on the training sets to estimate 
$M_\lambda$ (the absolute magnitude in bandpass $\lambda$) and $(\lambda_1-\lambda_2)_0$ (the intrinsic color in bandpass $\lambda_1$ and bandpass $\lambda_2$) from observed parameters, such as $\log {\rm g}$, $T_{\rm eff}$, [M/H] ([Fe/H] for LAMOST data), [C/Fe], [N/Fe], and [$\alpha$/M] ([$\alpha$/Fe] for LAMOST data). 
Finally, we estimated $M_\lambda$ and $(\lambda_1-\lambda_2)_0$ for each spectral RC based on their stellar parameters and spectral parameters. 
Meanwhile, we analyzed the dependence of their $M_\lambda$ and $(\lambda_1-\lambda_2)_0$ on the observed parameters, including position, stellar parameters, and element abundances. 



\begin{figure*
\centering
\includegraphics[width=\hsize]{ap_Mk.eps}
\caption{The $M_{K_{\rm S}}$ distributions of APOGEE RCs with respect to the Galactocentric cylindrical coordinates ($z$, $R$, $\phi$), elements abundances ([$\alpha$/M], [C/Fe], [N/Fe]), and stellar parameters ([M/H], $\Teff$, $\log g$). 
The color represents the number density of RCs.
}
\label{Fig_MK}
\end{figure*}


\begin{figure*
\centering
\includegraphics[width=\hsize]{ap_MG.eps}
\caption{The similar distributions of APOGEE RCs as Figure~\ref{Fig_MK} but for the {\it Gaia} $G$-band absolute magnitude $M_{G}$.}
\label{Fig_MG}
\end{figure*}


\begin{figure*}[ht]
\centering
\includegraphics[width=\hsize]{ap_jk.eps}
\caption{The similar distributions of APOGEE RCs as Figure~\ref{Fig_MK} but for the intrinsic color $(J-\Ks)_0$.}
\label{Fig_int}
\end{figure*}



\subsection{Absolute Magnitude Training}\label{RCabs}


Absolute magnitude of an RC star in the $\lambda$ band can be calculated by the equation 
\begin{equation}
M_\lambda=m_\lambda -A_\lambda -5\log d-10 ~.  
\label{equ1}
\end{equation}
The value of apparent magnitude $m_\lambda$ is from the multi-band photometric data. 
The distance information $d$ in kpc can be obtained from the inverse of the corrected {\it Gaia} EDR3 parallax $\varpi-\varpi_{\rm offset}$. 
The extinction $A_\lambda$ is estimated with the combination of color excess and the extinction conversion factor. 
The accuracy of $M_\lambda$ measurements worsens as the increasing distance and extinction uncertainties. 
Therefore, we use RCs with reliable absolute magnitudes to build regression learners to learn the relationship between absolute magnitudes and spectral parameters. The regression learners are then applied to estimate the absolute magnitudes of all RCs with spectral parameters. 
This avoids, when the parallax and extinction uncertainties are large, the large errors caused by using equation ~ref{equ1} to calculate absolute magnitudes.



To avoid loss of parameter features, a machine learning algorithm, Gaussian Process regression (GPR) learner, is used to train and predict $M_\lambda$ of RCs. 
The GPR learner is a kernel-based nonparametric probabilistic learner. 
It uses a Gaussian Process prior for regression analysis and is widely used in the machine learning community \citep{2006gpml.book.....R}. 
In our tests, considering a small training set ($10^3-10^4$) available for training learners, the GPR learner can predict the RC absolute magnitudes more accurately than learners such as regression ensembles and support vector products. 
Here, we use the Matlab Regression Learner application to train regression learners and estimate RC's $M_\lambda$.
For the choice of the correlation function (called the kernel), we chose the Mat\'ern correlation with $\nu=5/2$.


For different databases (APOGEE and LAMOST) or different bands, we trained $M_\lambda$ separately. 
As a result, there are 34 trainers in total for 17 bands and two databases. 
It includes our constructed Weisenheit magnitude \citep{1982ApJ...253..575M} $W_{G,\GBP,\GRP}=m_G-1.89\times(\GBP-\GRP)$ for {\it Gaia} bands, which is less affected by extinction and metallicity. The coefficient 1.89 is from \citet{2019ApJ...877..116W} and suitable for RCs. 
A brief description of the process is given below. We first built a training set for each band. 
For each RC in the training set, we calculated $M_\lambda$ by equation~\ref{equ1}. 
Then based on the training set, we trained the GPR learners to establish the relationship between $M_\lambda$ and the spectral parameters. 
We performed 10-fold cross-validation to generate regression learners and evaluate them simultaneously. 
Finally, these generated GPR learners were used to estimate $M_\lambda$ of APOGEE RCs and LAMOST RCs.  



To build the training sets, we set the following criteria: low extinction ($A_{V}<0.1$ mag) and accurate {\it Gaia} parallax ($\varpi>1$, $\sigma_\varpi/\varpi<0.05$).
This is to ensure the reliability of $M_\lambda$ for the training RCs since the accuracy of $M_\lambda$ estimated by equation~\ref{equ1} decreases with increasing distance and extinction uncertainties. 
The extinction $A_{V}$ is converted from color excess $E(\GBP-\GRP)$ by $A_{V}=2.394\times E(\GBP-\GRP)$, where the extinction coefficient 2.394 is from \citet{2019ApJ...877..116W}. 
For APOGEE RCs, $E(\GBP-\GRP)$ can be roughly calculated by using empirical formulae between intrinsic colors and stellar parameters \citep[Table 1 of ][]{2019ApJ...877..116W}.   
For LAMOST RCs, we established the linear relations between the stellar parameters of LAMOST and APOGEE based on more than 6,000 RCs with both APOGEE and LAMOST data. We then used the empirical intrinsic color formulae to determine $E(\GBP-\GRP)$. 
Since only low-extinction objects are used, the error of  $M_\lambda$ propagated from the extinction error is negligible.
We also required that RCs have good astrometric solutions by ${\rm RUWE}<1.4$ \citep{2021ApJ...907L..33S}, where RUWE is the renormalized unit weight error.
After selection, the training sets for absolute magnitudes contain around 1,300 APOGEE RCs and 3,700 LAMOST RCs (see Table~\ref{tab_sample}). These numbers vary slightly in different bands. 



With the training sets, we trained GPR learners to establish the relationships between $M_\lambda$ and parameters $\log g$, $\Teff$, [M/H], [C/Fe], [N/Fe], and [$\alpha$/M]. 
Simultaneously, we performed 10-fold cross-validation to test the resulting GPR learners. 
This was done by dividing the training set into 10 equal-sized random folds: 9 folds were trained to derive the GPR learners, and the remaining one was used to validate it. 
This process was repeated 10 times. The root mean square errors (RMSEs) in validation are $\sim0.10$ mag in {\it Gaia} bands and 2MASS bands, $\sim0.12$ mag in {\it WISE} bands and APASS bands, and $0.12-0.18$ mag in PS1 bands. The best model appears in 2MASS bands for the APOGEE sample, where we think that its $0.09$ mag RMSE is close to the intrinsic scatter of RC absolute magnitude. 
Learners perform slightly worse in PS1 bands, mainly due to the effect of saturation, and we need to compromise between maintaining the number of the training set and the photometric quality. 
To avoid overfitting at the parameter edges, we selected samples whose difference between the predicted and training values is less than one RMSE for re-training to obtain the final learners.
Finally, we built 34 $M_\lambda$ learners $M_{\lambda,\rm{pred}}$ for 17 bands and two databases. 



\subsection{Absolute Magnitude Estimation}\label{RCabs2}

We applied the 34 learners to estimate $M_\lambda$ for all RCs in APOGEE (42,947 RCs) and LAMOST (93,542 RCs). To check the possible offsets between the two databases, we estimated the absolute magnitude differences based on 6,252 RCs with both APOGEE and LAMOST observations. The differences in $M_\lambda$ are around or less than $0.005\pm0.090$ mag. These small systematic offsets imply that the combination of the two databases for subsequent analysis is reliable. 

We take $\Ks$ and $G$ bands as examples to understand the importance of each parameter in estimating $M_\lambda$.
Figures \ref{Fig_MK} and \ref{Fig_MG} show the distributions of $M_{K_{\rm S}}$ and $M_{G}$ of APOGEE RCs with respect to different observed parameters, including the position in Galactic cylindrical coordinates ($z$, $R$, $\phi$), elements abundances ([$\alpha$/M], [C/Fe], [N/Fe]), and stellar parameters ([M/H], $\Teff$, $\log g$). 
The color represents the number density of RCs. 
According to the high-density regions in the figures, we find that $M_{K_{\rm S}}$ and $M_{G}$ are both strongly correlated to [$\alpha$/M], [C/Fe], [N/Fe] (middle panels of Figures~\ref{Fig_MK} and ~\ref{Fig_MG}) that characterize the RC age. As [C/Fe] increases and [N/Fe] decreases, the RC gradually becomes fainter in both $\Ks$ and $G$ bands. As [M/H] increases, RC gradually becomes fainter in the $G$ band. Compared to $M_{G}$, $M_{K_{\rm S}}$ shows a very weak correlation with [M/H]. Overall, $M_\lambda$ becomes fainter with increasing age and metallicity. The relationship between $M_\lambda$ and metallicity weakened with increasing wavelengths from ultraviolet to IR.

For parameters characterizing the Galactic structure, $M_\lambda$ almost does not vary with the Galactocentric angle $\phi$, mainly because APOGEE does not cover much of RCs in the warped disk. 
In the IR band, $M_{K_{\rm S}}$ becomes fainter with increasing height from the Galactic plane $\,| z \,|$ and varies little with Galactocentric radius $R$. Due to the metallicity effect, the absolute magnitude of optical bands, e.g., $MG$, becomes significantly brighter with the increase of $R$.  $M_{G}$ does not vary with increasing $\,| z \,|$ because the fainting of $M_{G}$ with age counteracts the brightening of $M_{G}$ with the decrease of metallicity. Combining the relationship between $M_\lambda$ and ($R, z$), and the relationship between $M_\lambda$ and metallicity and elemental abundances, we verified that [M/H] decreases with increasing $R$ and $ \,| z \,|$, and that the stellar age becomes older with increasing $ \,| z \,|$ in regions $ \,| z \,|<4$ kpc, $4<R<14$ kpc.

Both $M_{K_{\rm S}}$ and $M_{G}$ are insensitive to $\log g$ because the accuracy of $\log g$ prevents seeing more details. At longer wavelengths, the dependence of $M_\lambda$ on $\Teff$ is weaker. To establish RCs' $M_\lambda$ maps, a detailed two-dimensional analysis of the variation of $M_\lambda$ with $(R, z)$ is described in Section~\ref{3Dmap}. 


\subsection{Intrinsic Colors}\label{RCint}

Although intrinsic colors $(\lambda_1-\lambda_2)_0$ can be obtained from the difference between two predicted absolute magnitudes $(M_{\lambda_1}-M_{\lambda_2})$, we still trained intrinsic color learners independently for $(J-\Ks)_0$ and $(\GBP-\GRP)_0$. They can be used to testify the absolute magnitude learners and for subsequent extinction calculations. 
We built the RC training sets for intrinsic colors by selecting RCs with low extinction $A_{V}<0.1$ mag. 
The training sets contain 7,712 APOGEE RCs and 10,797 LAMOST RCs (see Table~\ref{tab_sample}). 
The intrinsic color of each RC in the training set was estimated by the difference between the observed color and the extinction mentioned in Section~\ref{RCabs}.
We then trained the GPR learners to establish the relationships between intrinsic colors and observed spectral parameters. 
RMSEs of the cross-validation are $\sim0.012$ mag and $\sim0.024$ mag for $(J-\Ks)_0$ and $(\GBP-\GRP)_0$, which are much smaller than that of absolute magnitude learners. Therefore, the spectral parameters are better to calculate the intrinsic color compared to the absolute magnitude. The difference between intrinsic colors estimated by the intrinsic color learner, i.e., $(J-\Ks)_0$, and the two absolute magnitude learners, i.e., $M_{J}-M_{K_{\rm S}}$, is less than 0.001 mag, which demonstrates the intrinsic consistency between the learners.

Figure~\ref{Fig_int} shows the distributions of the estimated $(J-\Ks)_0$ of APOGEE RCs with different observed parameters. The variations of $(J-\Ks)_0$ on stellar parameters $\Teff$ and [M/H] are significant. The weak relationships between $(J-\Ks)_0$ and elemental abundances [$\alpha$/M], [C/Fe], and [N/Fe] suggest that age has little effect on the intrinsic color. This also indicates that the effect of age on the absolute magnitude is relatively consistent in different bands. $(J-\Ks)_0$ is also not sensitive to $\phi$ and $\log g$. In $(R, z)$ space, $(J-\Ks)_0$ becomes bluer as the increase of $\,| z \,|$ and $R$.


\subsection{Usage of our GPR learners}\label{UGPR}

To facilitate users to use our learners to estimate the absolute magnitudes and intrinsic colors for RCs from the APOGEE or LAMOST parameters, we assembled the learners as an application `RC2021' and stored it in an external repository\footnote{doi:\url{https://doi.org/10.5281/zenodo.5140055}}. To avoid external interpolation, the best applicable ranges for our application are $2.3<\log g<2.5, 4550\K<\Teff<5120\K, -0.8<{\rm [M/H]}<0.5, -0.12<{\rm [N/Fe]}<0.5, -0.15<{\rm [C/Fe]}<0.3, -0.05<{\rm [\alpha/M]}<0.3$ for APOGEE parameters and $2.1<\log g<2.9, 4550\K<\Teff<5000\K, -0.9<{\rm [Fe/H]}<0.3, -0.12<{\rm [N/Fe]}<0.5, -0.4<{\rm [C/Fe]}<0.1, -0.1<{\rm [\alpha/Fe]}<0.3$ for LAMOST parameters. The supplementary figures showing the parameter distributions of the training sets were attached with the application.


\section{Red Clump 3D Parameter Maps}\label{3Dmap}

For RCs with spectral parameters, their absolute magnitude and intrinsic color can be better derived from the spectral parameters without simply adopting constant mean values. However, to apply to a larger sample of RCs without spectroscopic observations, we would like to build three-dimensional maps of the absolute magnitude and intrinsic color associated with the location of RCs in the Milky Way.
This section describes how we built models to derive 3D absolute magnitude and intrinsic color maps based on our knowledge of the RCs distribution and the Galactic structure. 
With these maps, we can obtain the multi-band mean absolute magnitudes and intrinsic colors of RCs at any location ($l, b, d$) when the spectral data are not available.


\subsection{Building 3D Map Model}\label{3Dmapderive}


\begin{figure*}[ht]
\centering
\includegraphics[width=\hsize]{zong.eps}
\caption{The distributions of $\mathrm{d}{M_\lambda}/\mathrm{d}R$ to $\,| z \,|$, where $\lambda$ are $\Ks, J, z, G$ bands, respectively, from the top left to the bottom right.
Red, blue, and green dots are gradients in each $\,| z \,|$ bin for LAMOST RCs, APOGEE RCs, and {\it Gaia} RCs, respectively. 
The black-solid lines and black-dashed lines are from our 3D maps (Section \ref{results}) by assuming the functional form of quadratic and cubic polynomials, respectively.} 
\label{Fig_zr}
\end{figure*}


To establish 3D parameter maps, we further analyzed the variation of $M_{\lambda,\rm{pred}}$ (from absolute magnitude learners) with the Galactocentric radius $R$, the height $z$, and the Galactocentric angle $\phi$, following the results discussed in Sections~\ref{RCabs2} and \ref{RCint}. First, we find that in the nonparametric fit, $M_{\lambda,\rm{pred}}$ varies very little with different $\phi$. This is reasonable because the non-axisymmetric warp and overdensity are not significant in the spectral RC sample. Therefore, we omitted the parameter $\phi$ in building the map model. As $\,| z\,|$ increases, the fainting of $M_{\lambda,\rm{pred}}$ can be approximated by a first- or second-order polynomial.
The variation of $M_{\lambda,\rm{pred}}$ with $R$ is more complicated. At different $\,| z \,|$, RCs contain different proportions of thin-disk, thick-disk, and halo components, so the gradients $\mathrm{d}{M_\lambda}/\mathrm{d}R$ are variable. This is consistent with the current understanding of the Galactic disk structure \citep{2016ApJ...823...30B}.
At $\,| z \,| <$ 0.2 kpc, RCs are mostly thin-disk components and $M_{\lambda,\rm{pred}}$ is only related to the metallicity. In IR bands, such as the $\Ks$ band, the gradient $\mathrm{d}{M_{K_{\rm S}}}/\mathrm{d}R$ is close to zero.
At 0.2 kpc $< \,| z \,| <$ 2 kpc, RCs consist of thick-disk stars, thin-disk stars, and a small number of halo components. When $R$ is small, the thick-disk RCs dominate. 
When $R$ becomes larger, the proportion of thin-disk RCs increases due to the effect of the flared disk. So the gradients of $\mathrm{d}{M_{K_{\rm S}}}/\mathrm{d}R$ are noticeable in these $\,| z \,|$ ranges. At $\,| z \,| >$2 kpc, RCs are gradually dominated by halo components and $\mathrm{d}{M_\lambda}/\mathrm{d}R$ is close to zero again.
Therefore, we expect that the variation of $\mathrm{d}{M_{K_{\rm S}}}/\mathrm{d}R$ with $\,| z \,|$ can be simplified and described by a quadratic polynomial.


Based on the above analysis, we set up a function $M_{\lambda,{\rm map}} = f_\lambda(R, z)$ dependent on $R$ and $z$ to predict the absolute magnitude distribution of the Galactic RCs. The form of the function $M_{\lambda,{\rm map}} = f_\lambda(R, z)$ is
\begin{eqnarray}
M_{\lambda,{\rm map}} & = & f_\lambda(R,z) 
       \nonumber\\
      & = &  a_1\,(R-8.0)\,z^2+ a_2\,(R-8.0)\,|z| 
       \nonumber\\
      & \; &   +a_3\,(R-8.0) +a_4\,|z| +a_5 +a_6\,R^2\,|z| ~.
\label{equ2}
\end{eqnarray}
The first three terms denote the quadratic polynomials of $\mathrm{d}{M_\lambda}/\mathrm{d}R$ with $\,| z \,|$. 
$a_4\,|z|$ shows the linear relationship between $M_\lambda$ and ${\,| z \,|}$. We also tried an individual quadratic term $z^2$ and found that it could be ignored. $a_5$ is the zero point of $M_\lambda$.
When $R=8.0$ and $z=0$, i.e., $M_\lambda=a_5$, it is the RC absolute magnitude in the solar neighborhood. 
We also considered the flared disk denoted by the last term $a_6\,R^2\,|z|$. The functional forms for intrinsic colors $(J-\Ks)_0$ and $(\GBP-\GRP)_0$ are the same as equation~\ref{equ2}. 



\begin{table*}[ht]
\begin{center}
\caption{\label{tab2} Coefficients of Absolute Magnitude and Intrinsic Color Maps $f_\lambda(R,z)$}
\hspace{1in}
\begin{tabular}{lcccccccc}
\hline \hline
\multicolumn{9}{c}{$f_\lambda(R,z)= a_1\,(R-8.0)\,z^2+ a_2\,(R-8.0)\,|z|+a_3\,(R-8.0) +a_4\,|z| +a_5 +a_6\,R^2\,|z|$} \\
\hline
Survey & $M_\lambda$ & $a_1$ & $a_2$ & $a_3$&  $a_4$ & $a_5$ &  $a_6$  & $\sigma$   \\ 
\hline   
{\it Gaia} & $G$                         &-0.0030 & 0.0300  &-0.0358 &0.0582  & 0.570  & -0.00071 &0.159    \\  
           & $\GBP$                      &-0.0051 & 0.0458  &-0.0476 &0.0549  & 1.103  & -0.00101 &0.180    \\  
           & $\GRP$                      &-0.0016 & 0.0187  &-0.0283 &0.0590  & -0.114 & -0.00045 &0.146    \\  
           & $W_{G,\GBP,\GRP}$$^*$     &0.0027  & -0.0166 &-0.0042 &0.0654  & -1.727 & 0.00033  &0.134    \\  
APASS      & $B$                         &-0.0107 & 0.0886  &-0.0722 &0.0705  & 1.928  & -0.00203 &0.232    \\  
           & $V$                         &-0.0067 & 0.0497  &-0.0472 &0.0610  & 0.857  & -0.00101 &0.175    \\  
Pan-STARRS & $g$                         &-0.0080 & 0.0701  &-0.0591 &0.0563  & 1.332  & -0.00166 &0.216    \\  
           & $r$                         &-0.0032 & 0.0298  &-0.0369 &0.0353  & 0.593  & -0.00064 &0.185    \\  
           & $i$                         &-0.0017 & 0.0146  &-0.0290 &0.0247  & 0.302  & -0.00021 &0.178    \\  
           & $z$                         &-0.0002 & 0.0015  &-0.0214 &0.0198  & 0.140  & 0.00019  &0.168    \\  
           & $y$                         &-0.0004 & 0.0102  &-0.0224 &0.0573  & 0.057  & -0.00030 &0.160    \\  
2MASS      & $J$                         &0.0006  & 0.0013  &-0.0169 &0.0610  & -0.984 & -0.00005 &0.134    \\  
           & $H$                         &0.0013  & -0.0049 &-0.0110 &0.0609  & -1.504 & 0.00007  &0.136    \\  
           & $\Ks$                       &0.0026  & -0.0147 &-0.0049 &0.0583  & -1.628 & 0.00028  &0.133    \\  
{\it WISE} & $W1$                        &0.0028  & -0.0165 &-0.0043 &0.0648  & -1.724 & 0.00034  &0.141    \\  
           & $W2$                        &0.0012  & -0.0022 &-0.0126 &0.0736  & -1.596 & -0.00004 &0.141    \\  
           & $W3$                        &0.0028  & -0.0165 &-0.0103 &0.0648  & -1.705 & 0.00048  &0.105    \\  
\hline                                                                                                          
{\it Gaia} & $(\GBP-\GRP)_0$             &-0.0039 & 0.0289  &-0.0184 &-0.0090 & 1.244  & -0.00061 &0.061    \\  
2MASS      & $(J-\Ks)_0$                 &-0.0020 & 0.0159  &-0.0104 &0.0003  & 0.656  & -0.00036 &0.040    \\  
   
\hline
\end{tabular}
\tablenotetext{}{Note $*$: Weisenheit magnitude $W_{G,\GBP,\GRP}=m_G-1.89\times(\GBP-\GRP)$.}
\end{center}
\end{table*}

 
\begin{figure*}[ht]
\centering
\subfigure{\includegraphics[width=3.5in]{kmag1.eps}}
\subfigure{\includegraphics[width=3.5in]{jkmag1.eps}}
\quad
\subfigure{\includegraphics[width=3.5in]{kmag.eps}}
\subfigure{\includegraphics[width=3.5in]{jkmag.eps}}
\caption{The absolute magnitude $M_{K_{\rm S}}$ and intrinsic color $(J-\Ks)_0$ distributions of RCs in the $R-z$ plane. The colorbars denote the values of $M_{K_{\rm S}}$ and $(J-\Ks)_0$. $M_{K_{\rm S}}$ and $(J-\Ks)_0$ derived from observations are plotted in panels (a) and (b), while $M_{K_{\rm S}}$ and $(J-\Ks)_0$ from our parameter maps are plotted in panels (c) and (d).}\label{Fig_jk_kmag}
\end{figure*}



To verify the functional form of the quadratic polynomial in observations, we investigated how $\mathrm{d}{M_\lambda}/\mathrm{d}R$ varies with $\,| z \,|$ in different bands. 
Figure~\ref{Fig_zr} shows the distributions of gradients $\mathrm{d}{M_\lambda}/\mathrm{d}R$ to $\,| z \,|$ in the$\Ks, J, z, G$ bands, respectively. 
The red, blue, and greed dots are gradients of LAMOST RCs, APOGEE RCs, and {\it Gaia} RCs, respectively. The black solid and dashed lines are not fitting lines but are taken from our final maps $M_{\lambda,\rm{map}}$ (see Section \ref{results}) by assuming quadratic and cubic polynomials in equation \ref{equ2}, respectively. From this figure, we find the quadratic and cubic polynomials agree well in $|z|<4$ kpc. The number of RCs with $|z|>4$ kpc is too small to constrain the maps. We therefore adopted a quadratic polynomial between $\mathrm{d}{M_\lambda}/\mathrm{d}R$ and $\,| z \,|$ in equation \ref{equ2} to establish our maps $M_{\lambda,\rm{map}}$. We also tried a two-exponent model and found that the quadratic polynomial model is more appropriate and more convenient to use.


In Figure~\ref{Fig_zr}, the trend of the gradients varies from one band to another. We can see that it changes from a concave function in IR bands to a convex function in optical bands. 
In the $\Ks$ band, the gradients show a decreasing trend followed by an increasing trend. 
When $\,| z \,|$ is small (dominated by thin-disk RCs) or large (dominated by halo RCs), $ \mathrm{d}{M_{K_{\rm S}}}/\mathrm{d}R$ are close to zero. 
At $\,| z \,| \sim$ 2 kpc, $\,| \mathrm{d}{M_{K_{\rm S}}}/\mathrm{d}R \,|$ is larger.  
The variation of $\mathrm{d}{M_{K_{\rm S}}}/\mathrm{d}R$ with $\,| z \,|$ satisfies an approximate quadratic polynomial. 



The gradients of the LAMOST and APOGEE RCs show similar trends, which coincide with each other considering the uncertainty. Considering the similar gradients and small absolute magnitude bias, we combined the spectral RC samples of APOGEE and LAMOST to determine the maps. 
The combined sample effectively reduces the selection effect caused by the different coverage of LAMOST (northern sky, mainly low extinction regions) and APOGEE (disk dominated). 
At $|z|>2$ kpc, the gradient uncertainties of LAMOST and APOGEE RCs become larger due to the sharp decrease in the number of RCs. 
In these regions, the gradient uncertainties of {\it Gaia} RCs are small. The inclusion of {\it Gaia} RCs in the combined sample can avoid the external interpolation at $|z|>2$ kpc. Moreover, {\it Gaia} RCs show a small gradient at $|z|>3$ kpc, consistent with our understanding of the Galactic population. The following three paragraphs explain the details of how we constructed the combined RC sample.



To obtain the parameters of $M_{\lambda,{\rm map}} = f_\lambda(R, z)$, $a_n (n=1, 2, ..., 6)$, we performed Markov chain Monte Carlo (MCMC) simulations to fit equation~\ref{equ2} to $M_{\lambda,\rm{pred}}$ of RCs. To reduce the selection effect and completeness problem, we assembled an RC sample with RCs from APOGEE, LAMOST, and {\it Gaia}. 
First, we selected all APOGEE RCs and supplemented them with LAMOST RCs for boxes in $R-z$ space not covered by APOGEE. The space of $4<R<14$ kpc and $-4<z<4$ kpc was divided into $100\times100$ boxes. 
For boxes containing both APOGEE and LAMOST RCs, we also supplemented the LAMOST RCs with an average absolute magnitude similar to that of the APOGEE RCs.
Since the parameters of LAMOST are less accurate than those of APOGEE, the absolute magnitude distribution of LAMOST RCs is wider than that of APOGEE RCs in the same box. 
We selected LAMOST RCs according to the APOGEE RCs' absolute magnitude distribution. 
In each box, we required $ \,| M_{\lambda,\rm LA}-\langle M_{\lambda,\rm AP}\rangle \,| < 1 \sigma_{\lambda, \rm AP}$.  $M_{\lambda, \rm LA}$ denotes the absolute magnitudes of LAMOST RCs, $\langle M_{\lambda,\rm AP}\rangle$ and $\sigma_{\lambda, \rm AP}$ are the average absolute magnitude and the standard deviation of APOGEE RCs in each box, respectively. 
We also tested and found that adjusting the threshold from $1 \sigma_{\lambda, \rm AP}$ to 0 or $3 \sigma_{\lambda, \rm AP}$ hardly affect our final maps.


For the boxes not covered by APOGEE or LAMOST, we selected RCs from {\it Gaia} as a supplement.
The selected {\it Gaia} RCs satisfy the following criteria:  $\,| z \,|>2$ kpc and $\sigma_\varpi/\varpi<0.2$, and the extinction-corrected $G$-band absolute magnitude $-2.4<m_G-1.89\times(\GBP-\GRP)-(5\log d+10) <-0.9$ mag. These RCs are far from the disk, so there is almost no contamination from giants or dwarfs. We also excluded SRCs and red giants by the cuts of $0.4<(J-\Ks)_0<0.71$ mag and $M_{\Ks}+1.7\times(J-\Ks)_0<0$ mag. The second cut is 0.2 mag ($10\%$ in parallax) looser than the yellow-dashed line used in Figure \ref{Fig_RC1} to avoid introducing bias in absolute magnitude determination. A tighter selection cut, while improving the purity of the sample, would lose true RCs whose parallaxes are underestimated. 
We also only adopted RCs with declination in the range of $-36^\circ$ to $90^\circ$, and the extinction of these RCs can be read from the extinction map of \citet{2019ApJ...887...93G}. 
The multi-band absolute magnitudes, intrinsic colors $(J-\Ks)_0$ and $(\GBP-\GRP)_0$ were estimated.

The combined RC sample used to establish 3D maps of absolute magnitudes and intrinsic colors contains $\sim156,000$ RCs including $\sim42,000$ APOGEE RCs, $\sim67,000$ LAMOST RCs, and $\sim47,000$ {\it Gaia} RCs. 
MCMC simulations were first run in the $\Ks$ band, and we excluded $\sim13,000$ spectral RCs and $\sim29,000$ {\it Gaia} RCs with $|M_{\Ks,{\rm map}}-M_{\Ks,{\rm pred}}|>0.15$ mag to avoid overfitting at the edges of the model. Based on the remaining RCs, the polynomial coefficients $a_n$ of both absolute magnitude and intrinsic color functions were determined by MCMC simulations.

The multi-band coefficients are listed in Table~\ref{tab2}. The last column of Table~\ref{tab2} shows the RMSEs of absolute magnitudes and intrinsic colors between our 3D parameter maps and observed values for $\sim156,000$ RCs. The RMSEs are close to uncertainties of absolute magnitudes and intrinsic colors estimated by spectral parameters mentioned in Sections~\ref{RCabs} and ~\ref{RCint}. Based on the RMSEs, the 3D parameter maps can predict multi-band absolute magnitudes and intrinsic colors with an accuracy of $20\%$ better than the constant values. The overall offsets between our 3D parameter maps and observed values are less than 0.005 mag. The error analysis shows that our 3D parameter maps are reliable.




\subsection{Results of 3D Maps}\label{results}


From Table~\ref{tab2}, the average absolute magnitudes and intrinsic colors of RCs at any spatial location can be estimated from the 3D parameter maps with $M_\lambda = f_\lambda(l, b, {\rm distance}) = f_\lambda(R, z)$. The maps are suitable for RCs located at $4 <R<14$ kpc, $-4< z<4$ kpc. To better understand this map, we discuss some specific cases. 
\begin{enumerate}
\item We set $z=0$, equation~\ref{equ2} simplifies to $M_\lambda=a_3(R-8.0)+a_5$, which represents the variation of $M_\lambda$ in the middle plane. The slope $a_3$ becomes flat from optical bands to IR bands. 
Thus, in the $\Ks$ band or {\it WISE} bands, a constant absolute magnitude can be used to approximate calculate the distances of thin-disk RCs. 
\item We set $R=8$ kpc, equation~\ref{equ2} simplifies to $M_\lambda=a_4\,| z\,|+a_5+64a_6\,| z\,|$, which represents the variation of absolute magnitudes with $\,| z\,|$ at $R=8$ kpc. We find that the gradients increase toward long wavelength bands, and in the $V, r$, and $G$ bands, the gradients are close to zero. Thus, the constant absolute magnitudes in these bands can be used to estimate the distances of RCs in the long cylinder along $z$ with $R\sim8.0$ kpc. 
\item We set both $R=8$ kpc and $z=0$ kpc, equation~\ref{equ2} simplifies to $M_\lambda=a_5$, representing the multi-band absolute magnitudes of RCs in the solar neighborhood. 
\end{enumerate} 


Figure~\ref{Fig_jk_kmag} shows $M_{K_{\rm S}}$ and $(J-\Ks)_0$ distributions of RCs in the $R-z$ plane from observations (panels a, b) and our maps (panels c, d). The observed average $M_{K_{\rm S}}$ and $(J-\Ks)_0$ are estimated from at least 4 RCs in each $0.1\times0.08$ kpc$^2$ bin. The corresponding $M_G$ and $(\GBP-\GRP)_0$ distributions are shown in Appendix Figure~\ref{Fig_bprp_Gmag}.  We find that our parameter maps reproduce the observed features well. In the $M_{K_{\rm S}}$ distribution, the flared disk is evident. Young RCs with brighter $\Ks$-band absolute magnitude can exist at higher heights $\,| z\,|$ when $R>8$ kpc. In the thin disk, the variation of $M_{K_{\rm S}}$ is small, varying by about 0.05 mag from $R=4$ kpc to $R=14$ kpc. At $\,| z\,| \sim 4$ kpc, the gradient of $M_\Ks$ with $R$ is small, and RCs are old halo stars. The gradients of $\mathrm{d}M_\lambda/\mathrm{d}\,| z\,|$ are different at different $R$. 

For {\it WISE} bands, the distributions of absolute magnitudes in the $R-z$ plane are similar to that of the $\Ks$ band. At shorter wavelengths, the slopes $\mathrm{d}M_\lambda/\mathrm{d}\rm{[M/H]}$ become steeper, making the distribution of $M_\lambda$ more distorted relative to $M_{K_{\rm S}}$. At a given age, metal-poor RCs are brighter. 
The one dex of metallicity change leads to an absolute magnitude change of 0.2 mag in the $J$ band and 0.5 mag in the $V$ band. 
Thus, we see a significant gradient between $M_G$ and $R$ in the thin disk (Appendix Figure~\ref{Fig_bprp_Gmag}). In the $M_G$ (also $M_V$ and $M_r$) distribution, the variation of $M_G$ with $\,| z\,|$ is not significant. Consider that the metallicity decreases and the age increases as $\,| z\,|$ increases. The former makes $M_\lambda$ brighter, while the latter makes $M_\lambda$ fainter, and these two effects counteract each other in the $V, r, G$ bands.


\section{Discussion}\label{section4}
\subsection{Validation of 3D Parameter Maps}\label{result_check}


\begin{figure*}[ht]
\centering
\includegraphics[width=\hsize]{pred_k.eps}
\caption{The absolute magnitude $M_{K_{\rm S}}$ distributions of RCs along distance $D$ at different lines of sight.
Blue dots are distribution of the external test RC sample (spectral RCs have been excluded), and orange dots are the contamination. 
Large red dots indicate the predicted mean absolute magnitudes from our 3D maps. The black dashed lines are linear fits of the blue dots, indicating the variation of the mean absolute magnitude with distance.
The main contribution of the scatter of observed absolute magnitude is the uncertainties of the {\it Gaia} parallax. }
\label{Fig_pred_k}
\end{figure*}


\begin{figure*}[ht]
\centering
\includegraphics[width=\hsize]{pred_jk.eps}
\caption{The extinction-corrected CMDs of RCs in 2MASS bands $\Ks_{,0}$ vs. $(J-\Ks)_0$ at different lines of sight. Blue dots are distributions of the external test RC sample, while red dots show the distributions of predicted mean magnitudes and mean colors from our 3D maps.}
\label{Fig_pred_jk}
\end{figure*}


We constructed an external test RC sample (Table~\ref{tab_sample}) using {\it Gaia} data to assess the validity of the 3D parameter maps by comparing the observed results with the model predictions. 
The selection criteria for the test RC sample are $\sigma_\varpi/\varpi<0.2$ and  $-2.4 <m_G-1.89\times(\GBP-\GRP)-(5\log d+10) <-0.9$ mag. 
The contamination was excluded by $M_\Ks+1.7\times(J-\Ks)_0>0$ (see Sections \ref{RCsample} and \ref{3Dmapderive}). 
The spectral RCs from APOGEE and LAMOST, which are the main contributors to our 3D maps, were excluded to make the test RC sample more independent.


Eight typical regions with a $10^\circ$ box size ($2^\circ$ for $|b|\leq10^\circ$) at different Galactic longitudes and latitudes were selected for examination. Figure~\ref{Fig_pred_k} is an example showing a comparison of predicted and observed values of absolute magnitudes in the $\Ks$ band at different distances. The $r$-band and $W_{G,\GBP,\GRP}$-band figures are shown in Appendix Figures~\ref{Fig_pred_r} and \ref{Fig_pred_wg}.
The dots are the observed values of RCs (blue) and contamination (orange) with distances converted from the {\it Gaia} parallaxes and absolute magnitudes from $M_{K_{\rm S}}=m_\Ks -A_\Ks -5\log d - 10$. 
The extinction $A_\Ks$ was estimated based on Green's 3D extinction map \citep{2019ApJ...887...93G} and Wang's extinction coefficients \citep{2019ApJ...877..116W}.  
The black dashed lines are linear fits of the observed RC absolute magnitudes. 
The red dots are the mean absolute magnitudes predicted by our 3D absolute magnitude maps, which are consistent with the observed absolute magnitudes. 
At high latitudes, both predictions and observations show a slight increase of $M_{K_{\rm S}}$ with distance.
In contrast, at low latitudes, $M_{K_{\rm S}}$ hardly vary with distance.
 
The $M_\lambda$ distributions (Figures~\ref{Fig_pred_k}, \ref{Fig_pred_r}, and \ref{Fig_pred_wg}) show that the mean RC absolute magnitudes are not uniform across the different spatial locations of the Milky Way as a result of the effects of age and metallicity. 
The predictions of our 3D parameter maps (red dots) are in good agreement with the observed mean absolute magnitude distributions of RCs (black-dashed lines) at different spatial locations.
The scatter of the observed absolute magnitudes (blue dots) is mainly due to the $20\%$ uncertainty of the {\it Gaia} parallax. 



We also examined our intrinsic color maps.  
Figure~\ref{Fig_pred_jk} is the 2MASS CMDs used to compare the observed results (blue dots) to our predictions (red dots). Similar figures for PS1 bands (Figure~\ref{Fig_pred_gr}) and {\it Gaia} bands (Figure~\ref{Fig_pred_bprp}) are shown in the Appendix.
For the observed results, the intrinsic color and extinction-corrected magnitude are determined by $(J-\Ks)_0=(J-\Ks)-E(J-\Ks)$ and $\Ks_{,0}=m_\Ks-A_\Ks$, respectively. 
Based on the 3D intrinsic color map, we derived the predicted intrinsic color. 
The predicted extinction-corrected magnitude is equal to the absolute magnitude from the 3D absolute magnitude map plus the distance modulus. 
We find that the observations are distributed around the predicted values.
The significant intrinsic color dispersion at the Galactic plane, such as the region of ($l, b$)=(120$^\circ$, 0$^\circ$), is due to the unidentified contamination or large extinction uncertainties. 
To summarize, the consistency of predictions and observations validates that our 3D parameter maps are reliable.


\subsection{Comparison with Previous Results}

The RC absolute magnitude, as the main parameter of RCs, has been investigated in many works.
In this section, we briefly summarize the measurements of the RC absolute magnitude in the literature and compare them with our measurements. 

In the last century, the $I$ band was often used to measure the distance of RCs, considering the constant value of $M_I$ \citep{1998ApJ...494L.219P}. 
However, the $I$-band RC absolute magnitude is still somewhat affected by the metallicity. The band used to measure RC distances has gradually shifted from $I$ band to near-IR $\Ks$ band because the measurement of distances in the $\Ks$ band is less affected by both extinction and metallicity. \citet{2000ApJ...539..732A} obtained the $K$-band absolute magnitude $-1.61\pm0.03$ mag, which was supported by the following measurements: $-1.61\pm0.04$ mag \citep{2002AJ....123.1603G}, $-1.613\pm0.015$ mag \citep{2012MNRAS.419.1637L}, $-1.626\pm0.057$ mag \citep{2017ApJ...840...77C}, $-1.61\pm0.01$ mag \citep{2017MNRAS.471..722H}, $-1.606\pm0.009$ mag \citep{2018A&A...609A.116R}, $-1.622\pm0.004$ mag \citep{2020MNRAS.493.4367C}. These values are in agreement with each other.
A slightly fainter $M_{K_{\rm S}}$ has also been reported, such as $-1.57\pm0.05$ mag \citep{2007A&A...463..559V}, $-1.54\pm0.04$ mag  \citep{2008A&A...488..935G}, $-1.53\pm0.01$ mag  \citep{2014MNRAS.441.1105F}, $-1.55\pm0.08$ mag  \citep{2015RAA....15.1166W}. Compared to the $\Ks$ band, the reported absolute magnitudes have greater variability in optical bands.
Recently, \citet{2020ApJ...893..108P} defined high-$\alpha$ and low-$\alpha$ populations in the [$\alpha$/Fe]$-$[Fe/H] plane and provided their absolute magnitudes separately. 
\citet{2020ApJS..249...29H} considered the effects of metallicity and age on $M_{K_{\rm S}}$. They used a third-order polynomial to describe the relationship between $MKs$ and age for RCs with four different metallicities. \citet{2021MNRAS.500.2590G} studied the variation of RC's mode absolute magnitude with $\,| z\,|$ in the solar neighborhood.


According to our maps, RC parameters (absolute magnitude and intrinsic color) are not represented by a constant or simple multiple constants in the vast majority of cases. When comparing absolute magnitudes obtained from different works, it is only meaningful to select RCs from similar regions or similar samples for comparison. The reason why the $\Ks$-band absolute magnitudes happen to be consistent in the past works is that the selected samples are nearby RCs or younger RCs. At the solar position, our 3D map gives an absolute magnitude of $1.628$ mag in the $Ks$ band, which is consistent with previously reported values. However, if an RC sample contains a higher proportion of thick-disk or halo RCs, the determined $\Ks$-band mean absolute magnitude will be fainter.
$M_\lambda$ is affected by both age and metallicity. The dependence of $M_\lambda$ on metallicity decreases from optical to IR bands, while the dependence of $M_\lambda$ on age is relatively similar in each band. Intrinsic colors are more affected by metallicity than age.  Considering that the distributions of metallicity and age can be inferred from the Galactic structure, we recommend using 3D parameter maps rather than a constant value to represent RC's absolute magnitude and intrinsic color. Position-dependent parameters would be more appropriate for RC distance measurements and comparisons between different works.

Our 3D absolute magnitude and intrinsic color maps, which take into account the population effects of the main structures of the Milky Way and the distribution of elemental abundances, can better represent the properties of RCs in the Milky Way.


\section{{\it Gaia} Red Clump sample}\label{GaiaRC}

In this section, we introduce how to use the 3D parameter maps to determine distances of RCs, and we also provide a whole-sky photometric RC sample based on the {\it Gaia} parallaxes. 

To obtain RC parameters based on 3D maps, we discuss the following three cases.
\begin{enumerate}
\item With known distances from external measurements, the absolute magnitude and the intrinsic color of an RC can be obtained directly from the 3D parameter map by ${\rm Value}_\lambda = f_\lambda(l, b, {\rm distance}) = f_\lambda(R, z)$. 
\item In the lack of distance information, iterations are needed to obtain the best distance and absolute amplitude from the apparent magnitude. 
\item If extinction is also considered, multi-band iterations are required to obtain the best distance, extinction, and absolute magnitude simultaneously. Alternatively, the extinction can be obtained from an external 3D extinction map.
\end{enumerate}


\begin{figure*}[ht]
\centering
\includegraphics[width=\hsize]{rcsample.eps}
\caption{The CMDs of 11 million RCs in optical bands $G$ vs. $(\GBP-\GRP)$ (left) and near-IR bands $M_{K_{\rm S}}$ vs. $(J-\Ks)_0$ (right), respectively. Most of RCs are concentrated around [$M_{K_{\rm S}}$, $(J-\Ks)_0$]=[-1.580, 0.645]. The color represents the number density of RCs.}
\label{Fig_RCsample}
\end{figure*}



In Section~\ref{result_check}, we have selected an external test RC sample from the {\it Gaia} catalog based on the roughly estimated Weisenheit absolute magnitude $M_{W_{G,\GBP,\GRP}}$. 
Here, we only adopted the criterion $-2.4<m_G-1.89\times(\GBP-\GRP)-(5\log d+10) <-0.9$ mag and obtained an initial sample of 15 million RC candidates. This sample contains contamination of dwarfs, SRCs, red giants, and blue giants. We calculated the distance of each candidate under the assumption of being an RC. 
The specific procedure is as follows.
First, We considered an initial distance modulus $({\rm DM})_0$ and an initial $V$-band extinction $(A_{V})_0$: 
$({\rm DM})_0=m_{K_{\rm S}}-(-1.56)$ and $(A_{V})_0=[(\GBP-\GRP)-1.18]\times2.394$, where the value of $-1.56$ is the mean value of $M_{K_{\rm S}}$, 1.18 is the mean value of intrinsic color $(\GBP-\GRP)_0$, and $2.394$ is the extinction coefficient. 
Then we created a set of [${\rm DM}$, $A_{V}$] with 100$\times$100 meshes to include all possible distance modulus and extinction. 
${\rm DM}$ is in the range of [$({\rm DM})_0-5\sigma_{{\rm DM}}-0.2 (A_{V})_0$, $({\rm DM})_0+5\sigma_{{\rm DM}}$], where $\sigma_{{\rm DM}}$, the scatter of ${\rm DM}$, is assumed to be 0.14 mag. 
Since $A_{K_{\rm S}}/A_{V}$ was found ranging from 0.08 to 0.12, we took a larger factor of 0.2 to avoid a possible underestimation of extinction. 
As $(\GBP-\GRP)$ can deviate from the mean value by 0.5 mag, we set $A_{V}$ in the range of [$(A_{V})_0-0.5\times 2.394$, $(A_{V})_0+0.5\times 2.394$].  
After that, we calculated the distance modulus at each given band by the equation ${\rm DM}_\lambda=m_\lambda-M_\lambda-A_\lambda$. 
For each [${\rm DM}$, $A_{V}$] value in the meshes, the $M_\lambda$ is inferred from our 3D absolute magnitude map with the distance converted from ${\rm DM}$, and $A_\lambda$ is $A_{V}$ multiplied by the extinction coefficient $C_{\rm ext, \lambda}$ taken from \citep{2019ApJ...877..116W}. The dimension of ${\rm DM}_\lambda$ is $15\ {\rm million}\times6\times100\times100$. We used six bands from {\it Gaia} and 2MASS to determine the multi-band mean distance moduli $\langle{\rm DM}_\lambda \rangle$ and its standard deviation $\sigma_{{\rm DM}_\lambda}$. For bands with no photometry or poor-quality photometry, we set their weights to zero. At last, we obtained the optimal distance modulus and extinction for 15 million RC candidates by searching the lowest $\sigma_{{\rm DM}_\lambda}$ in $100\times100$ meshes.


As for contamination, blue giants can be eliminated by the color information. SRCs and dwarfs are fainter than RCs, as well as some red giants are brighter than RCs, both of which can be removed by better distance information. Here we combine extinction and distance to improve the purity of the sample.
If a dwarf or SRC is mistaken for an RC, the distance is overestimated. If a giant is mistaken for an RC, the distance is underestimated. Assuming that the RC sample is pure, the distribution of extinction with distance should display a concentrated monotonic non-decreasing trend in each line of sight. 
Contamination well below the extinction--distance profile are dwarfs and a fraction of SRCs, and those well above are giants. 
To remove contamination, we determined the extinction--distance profile for RC candidates in each line of sight. These candidates were divided into solid angle bins, where each bin contained 1,000 stars. For each bin, we obtained the distribution of $\langle{\rm DM}\rangle$ vs. $\langle A_{V} \rangle$ and fitted this distribution by the GPR. 
RC candidates that lie outside the fitting line by $2\sigma$ (95\%) are considered as contamination and excluded.
After completing the sample purification, we obtained the final {\it Gaia} photometric RC sample containing 11 million RCs listed in Table~\ref{tab_sample}.

Figure \ref{Fig_RCsample} shows the density distributions of 11 million RCs in the ($\GBP-\GRP$, $\G$) CMD and the extinction-corrected ($(J-\Ks)_0$, $M_{K_{\rm S}}$) CMD. The RC $M_{K_{\rm S}}$ is distributed between -2.0 mag and -0.9 mag, and most of the RCs concentrated around [$M_{K_{\rm S}}$, $(J-\Ks)_0$]=[-1.600, 0.645]. There are also about 50,000 RCs with abnormal intrinsic colors, i.e., $(J-\Ks)_0>0.8$ mag or $(J-\Ks)_0<0.4$ mag, which may be the result of inaccurate extinction estimation or are not genuine RCs. The catalog for 11 million RCs is available in the repository \footnote{doi:\url{https://doi.org/10.5281/zenodo.5140055}}, which includes information of position, distance modulus, extinction, corrected distance modulus, corrected extinction, and uncertainty of distance modulus. The corrected extinction and distance modulus are determined by using a uniform mean extinction at each distance and line of sight based on the extinction--distance profile. The corrected extinction avoids negative extinction and is more suitable for RCs in the low extinction regions ($A_{V}<0.5$ mag). However, it loses the differential extinction information and is less suitable for RCs in high extinction regions ($A_{V}>1.0$ mag). The distance modulus uncertainty is the root of the sum of squares of the internal standard deviation and the map RMSE. We adopted an RMSE of 0.14 mag based on Table \ref{tab2}.
The catalog also contains a `flag' column to distinguish between high and low probability RCs. The high probability RCs satisfying $M_{K_{\rm S}}+1.7\times(J-\Ks)_0<0$ are marked with flag$=1$. Low probability RCs are more inclined to be contaminated by faint red giants and SRCs.
For high probability RCs, the distances converted from high-quality {\it Gaia} parallaxes ($\sigma_\varpi/\varpi<0.1$) are in good agreement with our distances. For $\sim188,000$ RCs with $\sigma_\varpi/\varpi<0.05, \varpi>1$, the distance modulus difference is ${\rm DM_{map}}-{\rm DM}_{\it Gaia}=0.022\pm0.226$ mag, while for $\sim892,000$ RCs with $\sigma_\varpi/\varpi<0.1, \varpi>0.5$, the distance modulus difference is ${\rm DM_{map}}-{\rm DM}_{\it Gaia}=0.033\pm0.229$ mag. The distance modulus difference reflects the purity of the sample, and an RC sample heavily contaminated by red giants and SRCs will have a larger distance modulus difference. Therefore, the criterion of $M_{K_{\rm S}}+1.7\times(J-\Ks)_0<0$ is very effective for selecting high-probability RC samples.



Comparing to the photometric RC sample from \citet{2020MNRAS.495.3087L}, we find that 61\% of their best sample ($\sim405,000$, $20\%$ contamination rate) and 46\% of their main sample (2.6 million, $33\%$ contamination rate) are included in our sample. The vast majority of RCs missed in our sample are due to our absolute magnitude selection, which is limited by the accuracy of the {\it Gaia} parallax. 
If our selection criteria were applied to their RC sample, 83\% of their RCs were included in our sample. The other 15\% of their RCs were excluded by our extinction-distance selection. The inclusion rate of our sample decreases as the purity of their sample decreases, which also hints that our sample successfully avoids some contamination.



\section{Prospect}\label{prospect}

In this section, we discuss future work that can be done with RC's 3D parameter maps.
The first thing we want to know is how much the warped disk affects our 3D parameter maps. 
In the outer disk, a warped disk has been found through OB-type stars, Cepheids, RCs, and red giants \citep{2018MNRAS.481L..21P, 2019NatAs...3..320C, 2019A&A...627A.150R}. Unlike Cepheids, the warp model traced by other tracers is not well established by the current surveys. The warp was found in precession \citep{2019NatAs...3..320C} and evolved with time \citep{2020NatAs...4..590P,2020ApJ...897..119W}. The density of different stars in the warp also varies. Considering these reasons, it is not appropriate to use Cepheid's warp model for RC. We expect to obtain the number density of warp RCs in the line of sight where warp's $z$-height reaches its maximum or minimum value through the future database. By comparing them with the number density of thick-disk RCs in the same region, we can evaluate the effect of warp on our 3D parameter maps.

The bulge region has not been included in our 3D parameter maps due to the small number of RCs with spectra and poorly understood structure. The bulge traced by RCs shows an X-shaped structure \citep{2010ApJ...721L..28N,2010ApJ...724.1491M}, which is not supported by other tracers such as RR Lyrae \citep{2015ApJ...811..113P}, Mira \citep{2017ApJ...836..218L}. The kinematic information and element abundances reveal that the bulge possesses two components with different age distributions \citep{2019MNRAS.490.4740B,2020ApJ...900....4S}, and the younger component having a more pronounced X-shaped structure \citep{2020MNRAS.492.3128G}. With $6000-7000$ bulge stars in APOGEE DR16, the metallicity and age distributions in the bulge were studied in more detail \citep{2020ApJ...901..109H,2020arXiv200712915Q}. However, most of these stars are red giants with luminosity brighter than RCs. A recent work studying of RCs in the bulge with spectral information was based on hundreds of RCs \citep{2021ApJ...907...47L}. Therefore, to build 3D absolute magnitude maps of RCs in the bulge, we need to wait for a more in-depth IR spectroscopic survey. Alternatively, we can use red giants to build the maps after establishing the correlation between red giants and RCs in terms of elemental abundance distributions and density distribution.

The 3D parameter maps of RCs in the Milky Way are helpful to future work on the 3D structure of the Magellanic Clouds (MCs). Based on RCs in the Survey of the MAgellanic Stellar History \citep[SMASH]{2018ApJ...866...90C} and the Optical Gravitational Lensing Experiment OGLE \citep{2021ApJS..252...23S}, the 3D structure of the MCs was seen in more detail. 
The [$\alpha$/H] and [Fe/H] distributions in the MCs were better studied by $\sim3600$ red giants with APOGEE spectra \citep{2020ApJ...895...88N}. 
\citet{2021ApJ...910..121N} investigated the color--metallicity relation of RCs in the MCs, which is an important parameter to anchor the distance of RCs. 
From our 3D parameter maps, age is the most important parameter for deriving the RC distance. 
With more spectral data in the future, the age distribution of RCs in the MCs and its association with the 3D structure of MCs will be investigated.

In contrast to RCs, the absolute magnitudes of red giants are related not only to their age and metallicity but also to their intrinsic color. We expect to build 3D absolute magnitude maps of red giants in the future. Compared to RCs, many red giants are brighter and can measure farther distances. Besides, red giants can track older and more metal-poor environments than RCs. A better understanding of the dependence of absolute magnitudes on age and metallicity for red giants, especially for the tip of the red giant branch, will help the optimization of the Hubble constant \citep{2019ApJ...882...34F} and the discovery of new structures in the Galactic halo \citep{2021arXiv210409515C}. With millions of spectral red giants, the Milky Way is one of the best places to study the absolute magnitude of red giants.

\section{Summary}\label{Conclusion}

To make RCs a more accurate and convenient distance indicator, we investigated the effects of age and metallicity on their parameters, including multi-band absolute magnitudes and intrinsic colors. We established position-dependent 3D maps for RCs' mean absolute magnitudes and intrinsic colors based on a combination of spectroscopic, astrometric, and photometric data from {\it Gaia}, APOGEE, LAMOST, APASS, PS1, 2MASS, and {\it WISE} surveys. 
The main results of this work are as follows.  


1. For 42,947 APOGEE RCs and 93,542 LAMOST RCs, we selected nearby RCs with low extinction to build machine learners between the absolute magnitude $M_\lambda$ and the intrinsic color $(\lambda_1-\lambda_2)_0$ with the spectral parameters by Gaussian process regression. Then $M_\lambda$ and $(\lambda_1-\lambda_2)_0$ were calculated for all spectral RCs. 
We find that $M_\lambda$ becomes fainter with increasing age and metallicity, and the metallicity dependence decreases with increasing wavelength. 
The intrinsic colors are strongly related to metallicity and effective temperature. 
In contrast, the age effect on intrinsic colors is small, implying that the age effect on $M_\lambda$ is almost consistent in different bands. 

2. We further analyzed the variation of $M_\lambda$ and $(\lambda_1-\lambda_2)_0$ in spatial distribution and constructed an ($R, z$) dependence function to predict the $M_\lambda$ and $(\lambda_1-\lambda_2)_0$ distribution of the Galactic RCs. 
In establishing the function, we considered the main Galactic structure, elemental abundance distribution, and population distribution of the Milky Way.
Finally, we presented for the first time the 3D maps of RC's multi-band absolute magnitudes and intrinsic colors in a volume of $4 <R<14$ kpc, $0<\,| z \,|<4$ kpc. 
For RCs in the thin disk, the variation of $M_\lambda$ with the Galactocentric radius $R$ is not as apparent in IR bands as in optical bands.  In the solar neighborhood, the absolute magnitude of RCs in the $z$-direction is more consistent in optical bands.
The $\Ks$-band absolute magnitude of our 3D maps for RCs in the solar neighborhood is consistent with previously reported values.

3. Based on {\it Gaia}'s EDR3 parallax, our 3D parameter maps, and the extinction--distance profile selection, we obtained the largest all-sky photometric RC sample to date, containing 11 million stars.

4. With our 3D parameter maps, more appropriate mean absolute magnitudes and mean intrinsic colors for RCs without spectral information can be obtained based on spatial positions ($l,b,d$). 
In studies that take RCs as indicators, such as the 3D structure of the Milky Way, the 3D extinction maps, and the extinction law, we recommend using position-dependent absolute magnitudes (intrinsic colors) rather than a constant value to reduce the systematic uncertainty.




\acknowledgments{We thank the referee for very insightful and helpful suggestions/comments. 
This work is supported by the National Key Research and Development Program of China, grant 2019YFA0405504. 
It is also supported by the National Natural Science Foundation of China (NSFC) through the projects 12003046, 11903045, 12173047, 12133002, and 11973001. 
We acknowledge the science research grants from the China Manned Space Project with No. CMS-CSST-220221-A09.
This work has made use of data from the surveys by LAMOST, {\it Gaia}, APOGEE, APASS, Pan-STARRS1, 2MASS, and {\it WISE}.
Guoshoujing Telescope (the Large Sky Area Multi-Object Fiber Spectroscopic Telescope, LAMOST) is a National Major Scientific Project built by the Chinese Academy of Sciences. Funding for the project has been provided by the National Development and Reform Commission. LAMOST is operated and managed by the National Astronomical Observatories, Chinese Academy of Sciences. 
APOGEE survey is part of Sloan Digital Sky Survey (SDSS) IV. 
SDSS-IV acknowledges support and resources from the Center for High Performance Computing  at the University of Utah. SDSS-IV is managed by the Astrophysical Research Consortium for the Participating Institutions of the SDSS Collaboration (\url{https://www.sdss.org}). 
This work has made use of data from the European Space Agency (ESA) mission
{\it Gaia} (\url{https://www.cosmos.esa.int/gaia}), processed by the {\it Gaia}
Data Processing and Analysis Consortium (DPAC,
\url{https://www.cosmos.esa.int/web/gaia/dpac/consortium}). Funding for the DPAC
has been provided by national institutions, in particular the institutions
participating in the {\it Gaia} Multilateral Agreement.
This research has made use of the APASS database, located at the AAVSO web site. Funding for APASS has been provided by the Robert Martin Ayers Sciences Fund.
This work has made use of Pan-STARRS1 data (https://outerspace.stsci. edu/display/PANSTARRS). Fourteen organizations in six nations (plus two funding organizations) supported the Pan-STARRS1 survey. 
The Two Micron All Sky Survey is a joint project of the University of Massachusetts and the Infrared Processing and Analysis Center/California Institute of Technology, funded by the NASA and the NSF. 
The Wide-field Infrared Survey Explorer is a joint project of the University of California, Los Angeles, and the Jet Propulsion Laboratory/California Institute of Technology, funded by the NASA.
}


