The square kilometer array (KM2A) is the main array of the Large High Altitude Air Shower
Observatory (LHAASO), which is the most sensitive gamma-ray detector for energies above a few
tens of TeV. We are developing a software pipeline based on the experimental data, Monte-Carlo
simulations and the pointing track of the arrays. The pipeline is able to perform 3D (sky images at
different energies) fits of KM2A data, similar to those used for Fermi-LAT and DAMPE gamma-ray
analysis. This 3D likelihood analysis could fit source models of arbitrary morphology to the
sky images, and get energy spectra information and detection significances simultaneously. The
analysis with this software could give consistent results with those using traditional method.