The ultra-long GRB 220627A at z = 3.08

Context. GRB 220627A is a rare burst with two distinct γ -ray emission episodes separated by almost 1000s that triggered the Fermi Gamma-ray Burst Monitor twice. High-energy GeV emission was detected by the Fermi Large Area Telescope coincident with the ﬁrst emission episode but not the second. The discovery of the optical afterglow with MeerLICHT led to MUSE observations which secured the burst redshift to z = 3 . 08, making this the most distant ultra-long gamma-ray burst (GRB) detected to date. Aims. The progenitors of some ultra-long GRBs have been suggested in the literature to be di ﬀ erent to those of normal long GRBs. Our aim is to determine whether the afterglow and host properties of GRB 220627A agree with this interpretation. Methods. We performed empirical and theoretical modelling of the afterglow data within the external forward shock framework, and determined the metallicity of the GRB environment through modelling the absorption lines in the MUSE spectrum. Results. Our optical data show evidence for a jet break in the light curve at ∼ 1 . 2days, while our theoretical modelling shows a preference for a homogeneous circumburst medium. Our forward shock parameters are typical for the wider GRB population, and we ﬁnd that the environment of the burst is characterised by a sub-solar metallicity. Conclusions. Our observations and modelling of GRB 220627A do not suggest that a di ﬀ erent progenitor compared to the progenitor of normal long GRBs is required. We ﬁnd that more observations of ultra-long GRBs are needed to determine if they form a separate population with distinct prompt and afterglow features, and possibly distinct progenitors.


Introduction
Gamma-ray bursts (GRBs) are flashes of γ-rays lasting from milliseconds to hours typically with isotropic γ-ray luminosities of ∼10 51 −10 53 erg s −1 , making them the most luminous explosions observed in the Universe (Zhang 2018).GRBs have traditionally been separated into long and short bursts based on an observed bimodality in their duration distribution, with 2 s taken as the dividing line (Kouveliotou et al. 1993).Short bursts are thought to be caused by the coalescence of two compact objects involving a neutron star, while long bursts are thought to result from the collapse of a massive Wolf-Rayet star, though recent observations have shown there is an overlap between these two classes (e.g., GRB 211211A; Rastinejad et al. 2022;Yang et al. 2022).
A very small number of bursts have been detected with extremely long durations greater than 1000 s (e.g., GRBs 091024A, 101225A, 111209A, 130925A; Gruber et al. 2011;Thöne et al. 2011;Gendre et al. 2013;Stratta et al. 2013;Virgili et al. 2013;Evans et al. 2014;Levan et al. 2014;Piro et al. 2014).Some authors have suggested that these GRBs form a distinct class of so-called ultra-long GRBs whose progenitors may be different with respect to the collapsar model (Gendre et al. 2013;Levan et al. 2014).Levan et al. (2014) studied three ultralong GRBs -GRB 101225A, GRB 111209A, and GRB 121027A -and found that they had very similar long-lasting X-ray emission with flares and were situated close to the cores of highly star-forming dwarf galaxies.The extremely long duration of these bursts led them to conclude that their central engines were active for much longer than normal long GRBs, and therefore their progenitors may be blue supergiant stars (Mészáros & Rees 2001;Nakauchi et al. 2013) which have much larger radii than the compact Wolf-Rayet stars that are commonly regarded as the progenitors of long GRBs (Woosley & Bloom 2006).This was the preferred explanation by Gendre et al. (2013) for the extremely long duration of ∼25 000 s for GRB 111209A, where the additional mass from the outer layers of such a star can power the central engine for much longer, leading to longer-duration γ-ray emission.Zhang et al. (2014), however, pointed out that not all bursts that had been claimed as ultra-long were actually ultra-long in γ-rays (e.g., GRB 121027A).Instead, the long duration of highly variable X-ray light curves had been used to infer the ultralong duration (Levan et al. 2014).Swift observations of X-ray flares and internal plateaus have shown that the central engine duration is much longer than T 90 values suggest.Zhang et al. (2014) therefore used X-ray data in addition to γ-ray data to derive central engine durations for 343 GRBs, and found that 21.9% of GRBs have durations t burst 10 3 s, and 11.5% have t burst 10 4 s.The inference is that ultra-long GRBs may be the tail of a single long GRB population and do not require a separate, blue supergiant progenitor even though the data do not exclude it.Additionally, observations suggest that the afterglow properties of ultra-long GRBs are not different to those of other, classical, long GRBs (Virgili et al. 2013).In order to assess the claim that ultra-long GRBs form a distinct population compared to other long GRBs, further multi-wavelength observational evidence encompassing afterglow and host galaxy properties is needed.
On 2022 June 27, the Fermi Gamma-ray Burst Monitor (GBM; Meegan et al. 2009) was triggered by two events separated by 956 s, leading to the speculation that GRB 220627A was a gravitationally lensed or ultra-long GRB with a duration of ∼1000 s (Roberts et al. 2022).The Large Area Telescope (LAT; Atwood et al. 2009) aboard Fermi detected high-energy photons coincident with the first GBM trigger and localised the first burst to a 0.2 degree-radius error circle (di Lalla et al. 2022), which led to the eventual identification of the optical and X-ray afterglows at ∼0.8 days post-trigger.Here we report the results of our observational follow-up campaign and place GRB 220627A in the context of the ultra-long GRB population.
We note that there is no universally agreed-upon definition for ultra-long GRBs, so we defer to adopting the convention that ultra-long bursts satisfy T 90 1000 s, as used by Lien et al. (2016).We report all uncertainties at the 1σ level unless stated otherwise, and all magnitudes in the AB system.We follow the conventions with F ν ∝ ν β t α and N E (E) ∝ E −Γ , and adopt a Lambda cold dark matter (ΛCDM) cosmology with Ω m = 0.31, Ω Λ = 0.69, and H 0 = 68 km s −1 Mpc −1 (Planck Collaboration XIII 2016).The first Fermi/GBM trigger occurred at 21:21:00.09UT.We take this time as T 0 for GRB 220627A, and reference all other observations with respect to this time.

MeerLICHT optical afterglow discovery
MeerLICHT is a 65-cm aperture fully-robotic optical telescope located at the South African Astronomical Observatory (SAAO) site in Sutherland, South Africa (Bloemen et al. 2016).The primary science goal behind MeerLICHT is to provide simultaneous optical coverage of the radio sky as observed by the 64-antennae MeerKAT radio array, which is also located within the arid Karoo region of the South African interior.Meer-LICHT's wide field-of-view of 2.7 deg 2 (98.6 × 98.6 ) and robotic operation make it suitable for the discovery of new transients and follow-up of events with large error boxes on the plane of the sky, such as gravitational wave (GW) events and poorlylocalised GRBs, while its six filters (SDSS ugriz plus a wide q filter spanning 440-720 nm, roughly equivalent to g + r) make it suitable for multi-colour monitoring of transients.
MeerLICHT began an observing programme in June 2021 to follow-up GRBs detected by the Swift and Fermi missions.For Swift bursts the aim is to start observing Burst Alert Telescope (BAT) error boxes as soon as possible after a trigger, regardless of whether an X-ray or optical counterpart is discovered by Swift.For Fermi bursts the aim is to observe a cumulative probability of at least 70% of the GBM HEALPix skymaps with 80 or fewer telescope pointings, an observing criterion which naturally targets brighter bursts since they are better-localised.Observations are automatically triggered for bursts if they can begin within five hours of a trigger, with manual scheduling available for specific cases such as LAT-detected bursts or bursts with a high scientific interest.
GRB 220627A triggered automatic observations with Meer-LICHT starting 21 min after the trigger at 21:42:23 UT, when the fields became visible given the telescope's observing constraints.The first GBM trigger had a 90% (50%) error area of 216.5 (52.7) deg 2 , while the second trigger had a 90% (50%) error area of 213.8 (32.5) deg 2 .A total of 52 fields encompassing a cumulative probability of 71% of the first trigger GBM skymap (see Fig. 1) were observed during the 1.6 h that MeerLICHT was observing.All observations consisted of 60 s q-band exposures, since the q band is our most sensitive band and also has the most complete set of archival reference images.Our automatic scheduling aims to target the highest probability fields first, but due to the western fields setting first only the most eastern fields were scheduled.All 52 fields were observed at least once in the q band, while ten of the most eastern fields were observed twice encompassing a cumulative probability of 7.5%.Two of these ten fields were observed three times.The MeerLICHT transient detection pipeline was used to identify two afterglow candidates which were reported via the GCN within six hours of the first trigger (Groot et al. 2022).
The next morning at 07:00:40 UT, a Fermi/LAT GCN circular indicated that high-energy γ-rays had been detected along with a 0.2 degree radius localisation -a much smaller error box than the GBM error box (di Lalla et al. 2022).The LAT error box straddled two MeerLICHT fields which had not been observed on the previous night, ruling out our two initial afterglow candidates.We scheduled 2 × 300 s observations in the q band for these fields in order to search for an optical afterglow within the LAT error box.Observations began just after the evening twilight under new moon conditions at 17:12:15 UT, at approximately 0.83 days post-trigger.Swift/XRT target of opportunity (ToO) observations identified 15 X-ray sources 1 within the LAT  error box that may have been associated with GRB 220627A (Evans & Swift Team 2022), most having error regions with radii smaller than 8 .Among the three most promising2 candidates (green in Fig. 1), only one source was uncatalogued.Our two MeerLICHT images at 0.84 and 0.87 days showed a new optical transient within the error box of this source at coordinates α = 13 h 25 m 28.49 s , δ = −32 d 25 m 33.31 s (ICRS).The brightness of q = 21.25 ± 0.09 mag in our first exposure, and the lack of any source at the same position down to q > 21.71 in an archival image from two months earlier made it likely that this source was indeed the optical afterglow to GRB 220627A (de Wet et al. 2022).The source was confirmed as the afterglow through spectroscopic observations with MUSE mounted on the VLT (see Sect. 2.5 below, and Izzo et al. 2022).

Prompt emission
The duration of the burst associated with the first GBM trigger was T 90 = 136.71± 1.28 s, while that of the burst associated with the second trigger was T 90 = 126.98± 8.84 s, as taken from the online Fermi GBM Burst Catalog3 (von Kienlin et al. 2020).The 10−1000 keV fluence for the first and second triggers (from the Burst Catalog) are (4.54 ± 0.01) × 10 −5 erg cm −2 and (1.08 ± 0.02) × 10 −5 erg cm −2 , resulting in a total fluence of (5.62 ± 0.02) × 10 −5 erg cm −2 across both episodes.At the burst redshift of z = 3.08 (Sect.2.5) this results in a high isotropic γ-ray energy of E γ,iso = (4.81± 0.02) × 10 54 erg.Among the ∼130 GRBs with known redshift listed in the 10-yr Fermi-GBM Gamma-Ray Burst Spectral Catalog (Poolakkil et al. 2021), only two bursts have a larger isotropic γ-ray energy: GRBs 090323 and 160625B.Both emission episodes were also detected by Konus-Wind (Aptekar et al. 1995).The Konus-Wind light curve had a similar structure to the GBM light curve, though it was reported that a weak emission tail may have been present in the soft energy bands (20−100 keV) lasting up until T 0 + 3700 s (Frederiks et al. 2022).
GeV photons were detected by Fermi/LAT coincident with the first GBM trigger but not with the second one (di Lalla et al. 2022).The detection of GeV photons makes GRB 220627A the first ultra-long (with duration >1000 s) GRB detected at these energies.The prompt emission from GBM and LAT was studied in detail by Huang et al. (2022).They found that the time-integrated spectrum for the first emission episode is best described by a cutoff power law plus a power law component, where the power law component (with Γ = 1.92 ± 0.05) is necessary to account for the detected LAT photons.The second emission episode is best described by a cutoff power law alone.The cutoff energy for the first and second episodes are E c = 286.96± 38.00 keV and E c = 248.64± 66.58 keV, while their low-energy photon indices are Γ = 0.73 ± 0.10 and Γ = 1.06 ± 0.11, respectively.Huang et al. (2022) argue that the gravitational-lensing scenario to explain the two triggers can be ruled out at the 5.1σ level based on the non-detection of any LAT photons coincident with the second trigger.Furthermore, they place a lower limit on the bulk Lorentz factor of Γ ≥ 300 by using the optical depth to pair production method along with the highest energy LAT photon with an energy of 15.3 GeV.
In order to quantify the duration of GRB 220627A across both emission episodes, we obtained the CSPEC data from the NASA HEASARC data archive for the NaI detectors where the burst position was within 50 • of the detector normal -these were naturally the detectors with the strongest detected signal.For trigger 1 these were detectors n0, n1, n3 and n6, while for trigger 2 these were n3, n4, n6, n7, and n8.We considered photons with energies between 8 keV and 1 MeV and rebinned the count-rate light curve for each detector in 4.096 s time bins, fitting the background with polynomials of varying order in three time intervals for each detector: before the first trigger, between both triggers, and after the second trigger.These time intervals correspond to [−250.0,−60.0], [300.0,900.0] and [1200.0,1500.0]s with respect to T 0 .The summed count rate light curve for all seven detectors is shown in Fig. 2. We determine a burst duration of T 90 ≈ 1092 s as the time difference between the times when the cumulative background-subtracted count rate was between 5% and 95% of its total value.We note that this duration depends on the time binning used and the detectors included in the summed light curve, and hence should be regarded as approximate.
The spectral hardness vs. duration diagram has long been used as a means of categorising bursts into long and soft or short and hard classes (Kouveliotou et al. 1993), notwithstanding the fact that the burst duration is energy and detector-dependent (Qin et al. 2013;Bromberg et al. 2013).For both emission episodes we calculated the hardness ratio as the ratio of the integrated flux in the 50-300 keV to 10-50 keV energy ranges, making use of the best-fit parameters from the cutoff power law fits performed by Huang et al. (2022).Figure 3 compares the position of both emission episodes in the hardness-duration diagram with the sample of triggers from the Fourth Fermi/GBM Gamma-Ray Burst Catalog (von Kienlin et al. 2020).We see that both emission episodes sit in the long and soft portion of the diagram, providing support for a collapsar origin.

X-rays
The Swift X-Ray Telescope (XRT; Burrows et al. 2005) conducted ToO observations of the LAT error box in order to search for X-ray afterglow candidates (Evans & Swift Team 2022).The MeerLICHT identification of an optical source coincident with one of the potential X-ray afterglow candidates (see Sect. 2.1) confirmed this source as the X-ray afterglow, along with evidence of X-ray fading.A total of three orbits of Photon Counting mode (PC) observations of the afterglow were acquired at mid-times of 0.52, 1.59 and 4.62 days post-trigger.We obtained the X-ray count-rate light curve and spectrum from the online Swift/XRT GRB Catalogue hosted on the UK Swift Science Data Centre (UKSSDC) website (Evans et al. 2007(Evans et al. , 2009)).We fitted the photon spectrum with a photoelectrically absorbed power law model (tbabs*ztbabs*pow) in Xspec version 12.12.1,fixing the Galactic hydrogen column density at N Gal with a C-statistic of 14.7 for 19 degrees of freedom.The unabsorbed 0.3−10 keV flux was 1.05 +0.28 −0.24 × 10 −12 erg cm −2 s −1 , from which we derive an unabsorbed counts-to-flux conversion factor of 3.60 × 10 −11 erg cm −2 count −1 .Using this value along with a spectral index of β X ≡ 1 − Γ X ≈ −0.73 we created a 1 keV X-ray light curve.The light curve consisted of two detections at 0.52 and 1.59 days, and a 3σ upper limit at 4.62 days (see Fig. 4).

Optical/near-infrared photometry
Following confirmation of the afterglow detection, we obtained 600 s exposures in each of the q, g, r, and i bands with MeerLICHT at ∼1.84 days post-trigger.We used the MeerLICHT pipeline (Vreeswijk et al., in prep.) to perform standard CCD reduction tasks including calibration, astrometry and point-spread function (PSF) photometry.Due to the faintness of the afterglow in some of our images, we employed a forced photometry routine (developed as part of the MeerLICHT pipeline) to accurately measure the flux and significance of the detections.The afterglow was detected with a high significance (>15σ) in the first two q-band images at 0.84 and 0.87 days.The afterglow was detected at more than 5σ significance in the q and r bands at 1.84 days, and at 4.7σ significance in the g band.The i-band observation yielded a lowsignificance measurement of 2.7σ which we do not include as a detection.
We obtained 6 × 600 s exposures at approximately 0.93 days post-trigger in the g, r, and i bands with the 1-m SAAO Lesedi optical telescope (Worters et al. 2016) located in Sutherland and equipped with the Mookodi spectrograph and imager (Erasmus et al., in prep.).We employed an adapted version of the Meer-LICHT pipeline to perform astrometry and photometry on each image since both telescopes make use of the SDSS ugriz filter set.The pipeline produced a catalogue file containing all 5σ source detections.We detected the afterglow in each image.MeerLICHT is abbreviated to ML in the legend.The vertical grey region denotes the time of the MUSE spectroscopic observations.We show the broken power law fits to each of the g, q, r and i bands, where the break time and temporal indices were constrained to be the same across each fit.Residuals are shown in magnitudes in the lower panel.We show the two X-ray detections as crosses and the single upper limit as an upside-down triangle.The dotted line is the optical light curve fit shifted vertically to the X-ray band.
We acquired three epochs of imaging in the Bessel R filter at 1.13, 5.09, and 360.2 days post-trigger with the European Southern Observatory Very Large Telescope (ESO VLT) UT1 (Antu) equipped with FORS2.We obtained the last epoch approximately one year after the GRB in order to constrain any host galaxy emission long after the afterglow had faded.Each epoch consisted of 6 × 200 s, 3 × 200 s and 3 × 300 s exposures, respectively.We performed photometric calibration in the R band using ri DELVE DR2 photometry (Drlica-Wagner et al. 2022) of a large number of stars in the field along with the Lupton (2005)4 transformation equation R = r − 0.2936 * (r − i) − 0.1439.We employed the Aperture Photometry Tool (APT; Laher et al. 2012) with a three-pixel radius aperture in an automated mode to extract instrumental magnitudes of all 3σ point sources within the FORS2 images, and derived image zero-points of 33.18 ± 0.02, 33.37±0.01,and 33.42±0.03mag in the images from 1.13, 5.09, and 360.2 days, respectively.We detected the afterglow with a brightness of R = 21.25 ± 0.02 and R = 24.61± 0.10 mag during the first two epochs, and derived a 3σ upper limit of R > 25.92 mag during the third epoch.
We further obtained two epochs of follow-up observations of GRB 220627A in the g r i z JHK bands with the Gamma-ray Burst Optical Near-Infrared Detector (GROND; Greiner et al. 2008) mounted at the 2.2-m MPG telescope at the ESO La Silla observatory in Chile.The afterglow was detected in all the optical bands (g r i z ) but not in the near-infrared bands (JHK) during the first epoch of observations at 2.18 days post-trigger (Nicuesa Guelbenzu et al. 2022).The afterglow was detected in only the g and r bands during the second epoch at 3.21 days.The GROND data were reduced using standard PSF photometry through DAOPHOT (Stetson 1987) and IRAF (Tody 1993).The optical data were calibrated to the Pan-STARRS catalogue (Chambers et al. 2016) while the NIR data were calibrated to the 2MASS catalogue (Skrutskie et al. 2006).We present all optical detections of GRB 220627A in Fig. 4.

Optical spectroscopy
Following the detection of the optical afterglow by MeerLICHT, we observed the GRB afterglow region with the Multi-Unit Spectroscopic Explorer (MUSE; Bacon et al. 2010) mounted on UT4 at the ESO VLT.A set of four exposures of 600 s were obtained at 1.17 days post-trigger covering the wavelength range 4800-9300 Å with the corresponding spectral resolution ranging from R ∼ 1800-3500.Data from each exposure was reduced and stacked using standard esorex recipes.Finally, we subtracted the sky background in the reduced data cube using zap (Soto et al. 2016).We extracted a spectrum from the MUSE data cube using a circular aperture of 0.6 .The spectrum is characterised by the presence of a broad damped Lyα absorption feature and the pres- (Izzo et al. 2022).An intervening absorber at z = 2.665 was also identified by the presence of S iv, Si ii, C iv, Fe ii, Al ii lines (Izzo et al. 2022).The white light image, obtained by integrating over the entire wavelength region covered by MUSE, is shown in Fig. 5 along with the resulting spectrum.

Radio
Radio observations with the ATCA and MeerKAT arrays were obtained at 8 and 44 days post-trigger, respectively (Leung et al. 2022;Giarratana et al. 2022).The radio afterglow of GRB 220627A was detected by ATCA with a flux of ∼0.4 mJy at a frequency of 17 GHz at 7.3 days, while no source was detected by MeerKAT in the L band at 8.9 and 35.7 days where the image RMS noise was 9 and 14 µJy for each epoch, respectively.We assume a conservative 33% error on the ATCA flux measurement, and the upper limits as three times the RMS noise (3σ).
All flux measurements and upper limits used in this work are presented in Table 1, where we have converted AB magnitudes to flux densities in µJy.The frequency of each optical filter corresponds to the effective wavelength of that filter, which we obtained from the SVO Filter Profile Service5 for the VLT and GROND filters, while for MeerLICHT and Lesedi we obtained them internally.

External forward shock framework
We interpret our afterglow observations in the framework of the synchrotron external forward shock model (Mészáros & Rees 1997;Sari et al. 1998;Chevalier & Li 2000).In this model, the GRB central engine -usually assumed to be a black hole or neutron star -powers an extremely relativistic, collimated outflow that sweeps up mass in the surrounding circumburst medium, Right: telluric-corrected spectrum (black) and error spectrum (grey) of GRB 220627A extracted from the MUSE data cube using an aperture with a radius of 0.6 .We show identified absorption lines at the GRB redshift (z = 3.084) and the intervening system (z = 2.665) in grey and red, respectively.The vertical shaded region is heavily affected by telluric lines.forming a shock front behind which electrons are accelerated to a power law distribution in energies with N(γ e ) ∝ γ −p e for γ e > γ m , where γ m is the minimum Lorentz factor of the electrons in the distribution and p is the electron spectral index.The electrons produce synchrotron radiation whose emission spectrum is a multi-segment broken power law characterised by three break frequencies: the frequency associated with the peak of the spectrum, ν m , corresponding to electrons with the Lorentz factor γ m in the instantaneous electron distribution; the cooling frequency ν c corresponding to the Lorentz factor beyond which electrons are cooling efficiently by synchrotron radiation over the lifetime of the system; and the self-absorption frequency ν a corresponding to the frequency below which the synchrotron emission is self-absorbed.The ordering and evolution of the spectral breaks with time is dictated by the dynamics of the blast wave.After reverse shock crossing, the decelerating blast wave enters a self-similar regime described by the Blandford-McKee (BM;Blandford & McKee 1976) solution for a spherical, relativistic blast wave expanding into a medium with a density profile n(r) ∝ r −k .From this solution, the spectral flux density is given as a power law of both time and frequency, from which so-called closure relations can be derived relating the temporal and spectral indices within a given spectral regime (Zhang & Mészáros 2004;Zhang et al. 2006;Gao et al. 2013).We consider both a constant density ISM-like medium (k = 0) or a stellar wind medium (k = 2) in the relativistic (BM) regime, as in Granot & Sari (2002).

Evidence for a jet break
Optical detections of GRB 220627A are presented in Fig. 4, separated by observing band.To account for the slight differences in observing filters, we shifted the r-and R-band data to a common frequency of 4.820×10 14 Hz (the GROND r -band effective frequency) using a spectral index of β ≈ −1.This is the approximate spectral index derived from the GROND r , i and z bands at 2.18 days, uncorrected for Galactic extinction.We excluded the g -band detection from the spectral fit as there is a clear dip in the spectral energy distribution (SED) in this band compared to the redder bands, due to rest-frame Lyα absorption (see Fig. 5).
We fitted the light curves in each of the g, q, r, and i bands with two analytic functions: a simple power law (PL), and a smoothly broken power law6 (BPL), constraining the temporal indices and break times (for the BPL) to be the same across each fit.We employed a break smoothness parameter of ω = 9 since smoother breaks result in fits with higher reduced χ 2 values.The BPL fit had a reduced χ 2 value substantially closer to one compared to the simple PL fit (1.30 vs. 1.87).Furthermore, the Bayesian information criterion (BIC) for the two fits gives preference to the BPL model (16.09 vs. 19.86).Figure 4 shows the best-fit BPL model in each optical band.The pre-and post-break temporal indices are α 1 = −1.24± 0.44 and α 2 = −2.17± 0.14, with a break time of t b = 1.23 ± 0.28 days.Our late-time constraint on any host galaxy emission of R > 25.92 mag allows us to place an upper limit to any possible host galaxy contribution to the final R-band detection at 5.09 days of <30%, providing additional support to the steepening observed in the light curve.The BPL model is also compatible with the X-rays, as the data can accommodate the optical light curve fit shifted to the X-ray band (Fig. 4).
in which F 0 is the normalising flux level, α 1 and α 2 are the pre-and post-break temporal indices, t b is the break time, and ω is a smoothness parameter.
At X-ray and optical frequencies, an achromatic steepening of the afterglow light curves from a 'normal' temporal index of α ≈ −1 to a post-break index of α ≈ −2 has often been attributed to the jet break effect.Observationally, jet breaks have been studied extensively (see the sample in Wang et al. 2018).As the blast wave decelerates, a deficit in flux will be observed once 1/Γ > θ j , resulting in a steepening of the light curves.If the jet break is purely due to sharp edges of the jet (e.g., a top-hat jet) coming into view rather than due to lateral spreading or a combination of both, the light curves at all frequencies will steepen by t −3/4 or t −1/2 in an ISM or stellar wind environment, respectively.Rhoads (1999) and Sari et al. (1999) considered sideways expansion of a conical jet and found that the bulk Lorentz factor of the jet decreases exponentially after 1/Γ > θ j , producing a steeper post-jet break decay.For the spectral break ordering with ν a < ν m < ν c (usually relevant when a jet break occurs), Sari et al. (1999) found that the light curves decay as t −p for ν > ν m , t −1/3 for ν a < ν < ν m , and t 0 for ν < ν a .Numerical simulations, however, have shown that sideways expansion should not contribute before Γ has decreased considerably, though post-jet break decay is predicted to be steeper than with the edge effect only so that t −p may be a reasonable approximation (Zhang & MacFadyen 2009;van Eerten & MacFadyen 2012b;Granot & Piran 2012).
The passage of the cooling frequency through the optical bands can in principle lead to a temporal break in optical light curves.For both an ISM and wind medium undergoing slow cooling the difference in spectral index between the spectral segments either side of the cooling break is ∆β = 0.5.Interpolating and extrapolating the R-band light curve fit to the same time as the two X-ray detections, we find that the optical to Xray spectral index either side of the break in the light curve is β O,X ≈ −0.9, indicative of negligible spectral evolution between the optical and X-ray bands during this time.This spectral slope is also consistent with the optical in-band spectral index of β O = −0.91 at 2.18 days, indicating that both bands may lie on the same spectral segment.The difference in decay rate between the regimes either side of the cooling break is |∆α| = 0.25, so that the passage of ν c should not lead to a steepening of more than ∆α = −0.25.We also expect the temporal break to be chromatic, that is it occurs at different times in different observing bands.Our light curves steepen by ∆α = −0.93 ± 0.46, which is too large for the passage of the cooling break but is consistent with a jet break due to the edge effect (∆α = −0.75 in an ISM medium) or lateral spreading (t −p ).Furthermore, the post-break decay index of α ≈ −2.2 is difficult to reconcile within the standard closure relations.The steepest decay rate is expected in the regime with ν m < ν < ν c within a stellar wind scenario, where α = (1 − 3p)/4.An extreme electron power law index of p = 3 would result in α = −2, which is still shallower than our measured value of α ≈ −2.2.It is therefore likely that the break in our light curve is a jet break.We investigate the jet-break scenario further via theoretical modelling in Sect. 4.

Broadband temporal and spectral considerations
The GROND optical spectral energy distribution (SED) at 2.18 days has a spectral slope of β O = −0.91 ± 0.16 as derived from the r , i and z bands (The JHK near-infrared bands did not constrain the spectral slope) corrected for Galactic extinction using the Milky Way extinction curve from Fitzpatrick (1999) with R V = 3.1 and A V = 0.13 mag for the GRB line of sight (Schlafly & Finkbeiner 2011).We note that these observing bands correspond to rest-frame ultraviolet (UV) wavelengths A32, page 7 of 17 de Wet, S., et al.: A&A 677, A32 (2023) at the redshift of GRB 220627A (z = 3.08), so that the intrinsic spectral slope may be shallower than this value if there is significant host-galaxy extinction.The X-ray spectral index from our fit in Sect. 2 was β X = −0.73+0.57−0.77 .We calculate an optical to X-ray spectral index at the time of the second X-ray detection at 1.59 days by interpolating our r-band fit to this time.We take the mean relative error in our r-band flux measurements as the error on the interpolated r-band flux, approximately 10%.We measure a spectral index of β O,X = −0.93 ± 0.08, which is consistent with the GROND spectral index of β O = −0.91±0.16.With even moderate host-galaxy extinction, we would expect this to set an upper limit on the optical to X-ray spectral index, such that a value β ≈ −1 is likely from optical to X-ray frequencies.
Due to a paucity of data, we are not able to estimate the location or evolution of the cooling break, ν c .It is therefore difficult to perform an accurate closure relation analysis to determine the circumburst medium density profile and electron energy spectral index p.Nevertheless, if we start with the assumption that p ≈ 2.2 based on a post-jet break decay of α 2 = −2.17± 0.14, we can draw some broad conclusions.In the slow cooling regime (ν m < ν c ) we have spectral slopes of β = (1 − p)/2 and β = −p/2 below and above ν c , respectively.Assuming p ≈ 2.2, we would have β ≈ −0.6 and β ≈ −1.1 below and above ν c .Our optical to X-ray spectral index of β ≈ −1 therefore appears more consistent with being in the spectral regime above ν c .With p = 2.2, the expected light curve decay rate in this spectral regime is α = (2 − 3p)/4 = −1.15,which is fully consistent with the pre-break temporal index of α = −1.24± 0.44 from our optical light curve fit.In an ISM environment, ν c moves to lower frequencies as t −1/2 , while in a stellar wind environment ν c is expected to rise as t 1/2 (Granot & Sari 2002).The most plausible 7 scenario is that we are in an ISM environment where ν c has already moved below the optical observing bands at the time of our measurement of β O,X at 1.59 days.
The radio data consists of a single detection at 7.3 days at 17 GHz, and two non-detections in the L band (1.4 GHz) at 8.9 and 35.7 days.If we assume that the MeerKAT upper limit at 8.9 days also holds at 7.3 days, we can constrain the spectral slope between the L band and 17 GHz (Ku band) to β L−Ku 1.07 at 7.3 days.This implies that the spectrum is likely synchrotron self-absorbed at GHz frequencies.
Since we cannot precisely constrain the location of ν m , ν c , or ν a , there are likely to be extensive model degeneracies when performing theoretical modelling, as shown in Sect. 4.

MUSE spectroscopy
The huge photon flux emitted by early GRB afterglows allows us to investigate the composition of the immediate environment surrounding the GRB progenitor star (Savaglio et al. 2003;Jakobsson et al. 2004;Fynbo et al. 2006;Prochaska et al. 2007;Heintz et al. 2018;Bolmer et al. 2019;Saccardi et al. 2023).This is one of the main motivations to get an optical/near-IR GRB spectrum as soon as an optical counterpart has been identified.Early GRB afterglow spectra have shown the presence of neutral and singly-ionised low-excitation metal absorption lines, such as O i, C ii, Si ii, S ii, Fe ii, Ni ii, Zn ii, Al ii, and Al iii (Vreeswijk et al. 2007).In several cases, fine structure and meta-stable levels of Si ii and Fe ii have also been detected 7 We cannot conclusively rule out a wind environment with ν c below the optical since the optical light curve spans less than a single decade in time which corresponds to a change in ν c by a factor of ∼3 given a t 1/2 evolution.( D'Elia et al. 2007).The study of these absorption features can provide us with information on the metallicity of the immediate GRB region, while from the estimate of the column densities N X , with X being the element under consideration, one can also obtain a rough estimate of the extinction A V along our line of sight (De Cia et al. 2016).Due to their large redshifts, GRB afterglows are therefore one of the most important tools for investigating the evolution of the properties of the ISM in long GRB host galaxies, and consequently, in star-forming galaxies over a large redshift range.
The HI column density in GRB 220627A is derived by modelling the broad Lyα absorption trough with a Voigt profile using VoigtFit (Krogager 2018).This code convolves the intrinsic model with the spectral resolution and determines the redshift z, broadening parameter b, and column density N, of the input lines.Due to the substantial column density of HI, the Lorentzian wings dominate the line profile allowing for accurate estimates of the column density.We derive a best-fit log(N HI /cm −2 ) = 21.15 ± 0.05 (see Fig. 6).
We also attempt to measure the column densities of the main elements identified in the MUSE spectrum (Fig. 7).To this aim, and given the spectral resolution of MUSE, we have used the curve of growth (CoG) methodology, which provides a relation between the equivalent width (EW) of ISM lines and the corresponding column densities (Spitzer 1998).For low EW values (<0.1 Å), the EW is directly proportional to the column density, while for larger values the situation is complicated by saturation effects.The dependence of the EW from the column density is also related to the Doppler parameter b, which could not be very well constrained with the spectral resolution provided by MUSE.However, if we identify at least two absorption lines originating from the same electronic transition of the same ion (such as Si ii 1260, 1808 Å), we can roughly estimate the b value from their EWs, given that these lines have the same column density.Then, under the assumption that the curve of growth of ions with similar excitation potential is described by the same Doppler parameter, we can estimate their column density from their rest-frame EW. Figure 8 shows the results of our methodology.The majority of the lines used for the analysis are consistent with the CoG determined using Si ii lines, with the interesting exception of S ii.We also note that we have not applied any correction for dust depletion, which can considerably affect ions such as Fe ii.2012), we estimate metal abundances assuming that ions with ionisation potentials just above the ionisation energy of hydrogen constitute the dominant ionisation level, and finally give an estimate for the element abundance.We also do not include any ionisation correction given that this is negligible in Damped Lyman α (DLA) systems (Jenkins 2009), and especially when log(N HI /cm −2 ) > 10 20.5 (Péroux et al. 2007), as with GRB 220627A.To determine the metallicity, we derive the relative metal to hydrogen abundances in the GRB afterglow spectrum assuming Solar values provided by Asplund et al. (2009).The metallicity is then determined as [X/H] = log(N X /N H ) GRB − log(N X /N H ) for each element identified in the GRB spectrum.In Table 2 we report our final estimates of [X/H] for each ion identified in the GRB spectrum.In Fig. 9 we compare our results with the distribution of absorption-derived GRB and QSO-DLA metallicities (Rafelski et al. 2012;Thöne et al. 2013;Bolmer et al. 2019;Saccardi et al. 2023), where [X/H] is mainly derived from the S ii and Si ii ions, which are also the faintest detected lines in the GRB 220627A spectrum, see also Fig. 7.We further notice that for the estimate of the metallicity from S ii lines, we have used the S ii 1253 Å transition, given that the other line visible in the spectrum, S ii 1250 Å, is strongly blended with Si iv 1394 Å from the intervening absorber.The environment of GRB 220627A is characterised by a typical sub-solar GRB afterglow metallicity.Prochaska (2006) discussed this methodology comprehensively and concluded that column densities obtained using low-resolution spectra are likely to be underestimated due to instrumental line broadening and consequent blending of more intrinsically narrow absorption components.This is particularly true when metal absorption lines display heavily saturated profiles.In the case of GRB 220627A, we are also limited by the low spectral resolution provided by MUSE, which is not suitable to study ISM lines with smaller Doppler parameters.With these prescriptions, the metallicity values determined above must be considered as lower limits, especially for oxygen and carbon that can be heavily saturated.However, we also note that in the very few cases where GRB afterglows have been studied with both high-and low-resolution data, the results obtained using analysis based with Voigt-line profile fits and with the CoG method were fully in agreement (D'Elia et al. 2011).

Theoretical afterglow modelling
We perform theoretical afterglow modelling to determine the physical blast wave parameters of the forward shock, with the A32, page 9 of 17 de Wet, S., et al.: A&A 677, A32 (2023)  aim of establishing whether the afterglow properties of this ultralong GRB are unusual compared to the wider GRB population.

Model
We make use of the ScaleFit software package to perform theoretical modelling of our broadband afterglow dataset (Ryan et al. 2015;Aksulu et al. 2020Aksulu et al. , 2022)).ScaleFit is based on the BoxFit set of high-resolution hydrodynamic simulations of GRB explosions (van Eerten et al. 2012).Boxfit interpolates between a series of compressed data sets of hydrodynamical jet simulations and employs scale invariance between the blast wave energies and circumburst medium densities to cover the space of afterglow parameters, rapidly computing light curves and spectra using a linear radiative transfer module.Scalefit builds on this by making use of simple scaling laws between a set of scale-invariant characteristic quantities to derive the full set of spectral parameters that determine the observed emission (van Eerten & MacFadyen 2012a).The characteristic quantities are computed and tabulated directly from the BoxFit simulations, allowing for nearly instantaneous calculation of afterglow light curves and spectra given an arbitrary set of blast wave parameters.The initial conditions for the BoxFit simulations are the Blandford-McKee radial profile truncated to the opening angle of the jet θ j .ScaleFit is therefore only suitable for the deceleration phase after reverse shock crossing and so cannot be used to model energy injection, plateaus or flares.
The jet break and non-relativistic (Sedov-Taylor) transitions are both well-handled by ScaleFit (van Eerten & MacFadyen 2012a).ScaleFit can be used to model both an ISM or stellar wind medium, and accepts ten free parameters: explosionrelated parameters including the isotropic-equivalent blast wave energy E K,iso , circumburst medium density n 0 , and opening angle of the jet θ j ; shock microphysics parameters including the electron energy distribution spectral index p, the fraction of accelerated electrons within the shock ξ N , and the fractions of shock internal energy partitioned to electrons and magnetic fields, e and B , respectively; and observer-related parameters including the burst redshift z, luminosity distance d L , and observer angle with respect to the jet axis θ obs .
We use the emcee Python package (Foreman-Mackey et al. 2013) to implement a Markov chain Monte Carlo (MCMC) exploration of our ScaleFit model parameter space.An MCMC analysis allows for correlations (and degeneracies) between parameters to be readily identified.Furthermore, the uncertainty on each parameter can be determined through marginalisation of the posterior distribution.emcee offers advantages over traditional MCMC samplers because its multiple 'walkers' moving through the parameter space make it affineinvariant, with the result that it is unaffected by covariances between parameters.For GRB afterglow modelling, if a large majority of the measured data points are in a single spectral regime (e.g., at optical and X-ray frequencies) the location of the spectral breaks will not be well constrained, and so there are likely to be strong correlations between the E K,iso , n 0 , e and B parameters.
In order to reduce the number of free parameters when fitting, we fix the burst redshift at the MUSE value of z = 3.08 (Sect.2.5) and the luminosity distance at 8.25 × 10 28 cm, computed using our adopted cosmology (Sect.1).The fraction of shock-accelerated electrons ξ N is degenerate with respect to the parameters {E K,iso , n 0 , e , B } (Eichler & Waxman 2005), so we make the common assumption that ξ N = 1.We further assume that the observer is looking directly down the axis of the jet (θ obs = 0).We account for Galactic extinction using the Milky Way extinction curve from Fitzpatrick (1999) with R V = 3.1 and A V = 0.13 mag for the GRB line of sight (Schlafly & Finkbeiner 2011).The host galaxy extinction is a free parameter in our modelling, where we employ the Small Magellanic Cloud (SMC) extinction curve from Pei (1992) at the burst redshift since the vast majority of GRB host galaxies are consistent with an SMC extinction law (Schady et al. 2010;Zafar et al. 2011).We assume that the flux blueward of the rest-frame Lyman limit (912 Å) is totally absorbed.For both Galactic and host extinction we employ the astropy-affiliated dust_extinction8 Python package to redden our model SEDs.
In total we have seven free parameters denoted by the vector Θ: (1) Given a data set D of flux measurements at frequencies ν i and times t i , the posterior probability p(Θ|D) is proportional to the product of the likelihood p(D|Θ) and the prior p(Θ) via Bayes' Theorem To account for both detections and non-detections in our data, we employ the likelihood function for Gaussian errors used by Laskar et al. ( 2014) where δ i is equal to one for a detection and zero for an upper limit, e i are the residuals p(e i ) is the probability density function of the residuals, and F(e i ) is the cumulative distribution function of the residuals.The two functions p(e i ) and F(e i ) take the form and respectively, where σ i are the errors on the flux measurements or upper limits.As in Laskar et al. (2014), we also enforce a floor of 5% on the measured flux errors so as not to give undue weight to very high S/N measurements (usually those at optical wavelengths).
ScaleFit requires certain parameters to be transformed into dimensionless values in log space in order to improve performance when fitting.The energy E K,iso is transformed into dimensionless units of log 10 53 erg, and the quantity log ¯ e is used by ScaleFit rather than log e .The two quantities are related via The circumburst medium density n 0 is defined as the number of particles per cm 3 at the reference distance of 10 17 cm from the GRB central engine.In a stellar wind medium the circumburst medium has a density profile following ρ(r) = Ar −2 .
Chevalier & Li (2000) define a dimensionless A parameter according to A = A/(5 × 10 11 g cm −1 ).The n 0 parameter is therefore related to A via We employ wide, uninformative log-uniform priors on all parameters except for p and A V,host , for which we use uniform priors (see Table 3).The jet opening angle is restricted to a range varying from a very narrow jet (θ j = 0.6 • ) to a spherical jet (θ j = 90 • ).Our priors are equivalent to those used by Aksulu et al. (2022).During our emcee run we utilise 1000 walkers performing 2000 steps through the parameter space.The initial state of the walkers are clustered around the values from a Maximum-Likelihood fit performed using the scipy package.We discard the initial 200 steps as burn-in.We performed the MCMC analysis in both an ISM and stellar wind circumburst medium and calculated log likelihoods of ln P(Θ ISM |D) = 124.9+1.6 −2.2 and ln P(Θ Wind |D) = 120.0+2.5 −3.8 for each medium, respectively.Assuming both an ISM and stellar wind medium have equal prior probabilities of fitting our data, the Bayes factor is simply the likelihood ratio between the two models.We therefore derive a Bayes factor of 134.29 in favour of an ISM environment.According to Kass & Raftery (1995) a Bayes factor >100 provides decisive evidence in favour of one model over another, so we only show the results of our ISM modelling henceforth.For completeness we present the results of the wind modelling in Appendix A.

Results
Figure 10 shows the marginalised distributions and correlations between pairs of parameters, and Table 4 presents the median values along with their 1σ uncertainties derived from the marginalised distributions.For the electron spectral index

Parameter
Prior Distribution we derive a value of p = 2.00 +0.08 −0.06 .This value is consistent within uncertainties with the value for p derived from the postjet break decay index of p = α 2 = 2.17 ± 0.14 in Sect.3.2.Furthermore, the model associated with the median values for each parameter (bold lines in Fig. 11) has ν c below the optical and X-ray regimes during our observations, consistent with the argument in Sect.3.3 based on the optical spectral index.This model has ν a ≈ 10 12 Hz until ν m crosses ν a at 0.13 days, whereafter the afterglow spectral breaks are ordered ν m < ν a < ν c .The single radio detection at 17 GHz and MeerKAT nondetections at 1.4 GHz are unable to constrain the location of ν m and ν a precisely, and as a result there are strong degeneracies between E K,iso , n 0 , ¯ e and B , as expected.In contrast, the jet-opening angle is well-constrained to 4.5 +1.2 −0.3 deg and is driven by the clear break in the optical light curves as discussed in Sect.3.2.The corresponding beaming correction of f b = (1 − cos θ j ) = 3.1 +1.8 −0.3 × 10 −3 results in a beaming-corrected prompt γ-ray energy of E γ = 1.5 +0.9 −0.2 ×10 52 erg and kinetic energy of E K = 3.1 +20.3 −2.5 × 10 51 erg.The radiative efficiency of a GRB is defined as (Lloyd-Ronning & Zhang 2004) from which we derive a high radiative efficiency of η γ ≈ 84%.As mentioned in Sect.4.1, assuming ξ N = 1 means that our derived kinetic energy is actually a lower limit on the true energy, and therefore this calculated radiative efficiency is actually an upper limit.We note also that the uncertainty on E K is rather large due to degeneracies in our theoretical modelling.Taking into account the uncertainties in E K and E γ , we derive a 1σ range of 39−97% for η γ .Wang et al. (2015) find that radiative efficiencies peak at ∼6% with the 1σ range extending up to ∼40%, though they still have a very wide distribution extending to almost 90%, fully consistent with our derived value.

Discussion
The defining feature of GRB 220627A is its two distinct prompt γ-ray emission episodes separated by ∼600 s, resulting in a total burst duration of ∼1090 s.At a redshift of z = 3.08, GRB 220627A is the most distant ultra-long GRB detected to date.We now discuss whether the prompt and afterglow emission are typical for normal long GRBs.

Prompt emission properties
Based on the sample of long GRBs fitted with cutoff power laws in the Fermi-GBM Gamma-Ray Burst Spectral Catalog, indices of Γ = 1.01 +0.39 0.35 and peak energies of E p = 205 +374 −109 keV.The prompt emission spectral parameters of GRB 220627A (see Sect. 2.2) are fully consistent with these distributions.For the first emission episode, an additional power law spectral component extending up to higher energies (>100 MeV) is needed to explain the LAT emission.Such a feature has been observed in several other long GRBs (e.g., GRBs 090902B, 090926A; Abdo et al. 2009;Ackermann et al. 2011).The spectral properties of GRB 220627A are therefore not unusual compared to the long GRB population.The temporal features, however, are rare though not unprecedented, and we discuss these further in Sect.5.3 below.

Afterglow properties
Most of our model parameters derived from our theoretical modelling (Sect.4.2) are typical values within the literature.Our value of p is within the 1σ range found by Wang et al. (2015) of p = 2.33 ± 0.48.Wang et al. (2015) also find that the typical isotropic kinetic energy for GRBs without energy injection is log(E K,iso /erg) = 54.66 ± 1.18.Our inferred kinetic energy of E K,iso = 9.0 × 10 53 erg is well within their sample range.Our circumburst medium density of 19 cm −3 agrees within the range of 0.06−26 cm −3 found by Aksulu et al. (2022)   almost five orders of magnitude from 10 −5 −10 −1 .Our value of B ≈ 5 × 10 −3 is close to their median value of 1.0 × 10 −2 .We are unable to determine a physical value for e using Eq. ( 7) since p = 2 results in ¯ e = 0. Values of p less than two have been suggested in the literature (Panaitescu & Kumar 2002;Dai & Cheng 2001) and have been found through modelling of actual GRB datasets (Aksulu et al. 2022).As discussed in Granot & Sari (2002), using ¯ e is still valid when p < 2 as long as γ m is proportional to the shock Lorentz factor; a high-energy cutoff in the electron energy distribution is then needed so that the total energy in electrons is bounded.Wang et al. (2015) found that the jet opening angle takes values of θ j = 2.5 ± 1.5 deg.Our value of 4.5 +1.2 −0.3 deg is just outside their 1σ range, but well within the range of the sample considered by Laskar et al. (2014) having θ j = 7.4 +11 −6.6 deg.The afterglow properties derived from our theoretical modelling are fully consistent with long GRBs, and do not suggest a different or unusual progenitor.The large distance to GRB 220627A means that we are also unable to shed light on the progenitor through observations of a possible supernova (e.g., SN 2011kl accompanying the ultra-long GRB 111209A; Greiner et al. 2015) or another thermal transient.The findings presented here cannot exclude that GRB 220627A has a different progenitor compared to normal long GRBs.

GRBs with widely-spaced emission episodes
Among ultra-long GRBs, GRB 220627A is one of an even smaller subset of GRBs with distinct γ-ray emission episodes separated by long quiescent periods.Virgili et al. (2013) compared the ultra-long GRB 091024A with a sample of 11 other bursts having durations >1000 s and divided ultra-long GRBs into those with continuous prompt γ-ray emission, and those with distinct emission episodes separated by long quiescent periods (so-called interrupted bursts).They pointed out that the total duration of interrupted bursts holds less significance than for continuous bursts, since long quiescent intervals between sub-bursts may not accurately reflect the duration of central engine activity.They identified four bursts with interrupted emission: GRBs 020410A, 080407A, 091024A, and 110709B.Since then, three GRBs have triggered Fermi/GBM twice as listed in the Fourth Fermi/GBM Gamma-Ray Burst Catalog (von Kienlin et al. 2020): GRB 130925A, GRB 150201A, and GRB 160625B.Although GRBs 110709B and 160625B are not strictly ultra-long due to having durations <1000 s, we still include them in this sample since they are close to 1000 s and have widely-spaced emission episodes.Some properties of these bursts including GRB 220627A are presented in Table 5, similar to Table 6 in Virgili et al. (2013).We now discuss the prompt and afterglow properties of these bursts in order to determine if they share any unifying characteristics.

GRB
Duration (a)  z Fluence (b)  Energy range (c) E γ,iso Episodes (e) GeV ( f ) Afterglow Notes. (a) Approximate duration of γ-ray activity across all emission episodes. (b) Fluence as measured across all emission episodes. (c) Energy range over which reported fluence was measured. (d) We assume z = 1 to calculate E γ,iso for bursts without measured redshifts.The prompt emission light curves for all eight bursts are diverse in their morphology.Some bursts have weak precursorlike episodes preceding the main episode which contains the majority of the total fluence (GRBs 091024A, 130925A, 160625B), while others have brighter initial episodes (020410A, 080407A, 150201A, 220627A).GRB 110709B has two emission episodes of similar brightness.All bursts appear to show hard to soft evolution across the whole duration of γ-ray activity, a common trait for the wider GRB population.GRB 220627A is the most distant of all these bursts, and has the highest isotropic γ-ray energy.The bursts in Table 5 span almost two orders of magnitude in E γ,iso , comparable to the range of energies of the normal long GRB population (see Fig. 19 in Poolakkil et al. 2021).GRB 220627A is also one of only two bursts that has been detected at GeV γ-ray energies by Fermi/LAT.
The prompt emission light curve of GRB 220627A is most similar to that of GRB 110709B, a so-called double burst which triggered Swift/BAT twice separated by an interval of 11 min.Zhang et al. (2012) studied the prompt and X-ray emission in detail and ruled out a gravitational lensing and a giant X-ray flare origin for the second sub-burst.Their preferred physical explanation for the two sub-bursts with a long quiescent period in between was a magnetar to black hole (BH) scenario, where the first sub-burst is produced by a newly-formed magnetar releasing rotational energy via a magnetised jet, and the second, softer sub-burst is produced by a slower jet once the magnetar has collapsed to a BH.GRB 160625B was an extremely bright burst with three distinct emission episodes which were studied in great detail by Zhang et al. (2018).The first, short precursor episode was thermal-dominated, while the latter two episodes were consistent with synchrotron emission.This spectral transition was interpreted as direct evidence of the GRB jet changing its composition, with the first thermal component associated with the initial core collapse and break out of the ejecta from the surface of the Wolf-Rayet progenitor.For a black hole central engine the quiescent phase prior to the main emission was suggested to be a result of a magnetic barrier delaying accretion until enough material has built up (Proga & Zhang 2006), while for the magnetar engine the delay may be a result of the hot proto-magnetar taking time to dissipate energy before launching an outflow (Komissarov & Barkov 2007;Metzger et al. 2011).
Thereafter, a Poynting-flux dominated outflow characterised by synchrotron emission would be launched.Due to the weakness and short duration (T 90 ∼ 0.84 s) of the thermal precursor emission, the authors noted that such a feature would not have been observable had GRB 160625B been more distant.Such a feature may have been observed in GRB 220627A had it been closer.Based on 3D simulations, Gottlieb et al. (2022) proposed that the observed quiescent periods of ∼1−100 s in prompt emission light curves are naturally explained by a time-varying tilt of the central engine, such that quiescent periods correspond to times when the jet axis is pointed away from the observer.The much longer quiescent period of ∼600 s for GRB 220627A, however, may exclude this scenario.
In terms of afterglow emission, almost all of the bursts in Table 5 were detected in X-rays, and their X-ray luminosities are comparable to the majority of the GRB population (see Fig. 12).Levan et al. (2014) regarded the presence of X-ray flares as a defining feature of ultra-long GRBs.GRBs 110709B and 130925A show evidence for X-ray flares, though in the cases of GRBs 091024A and 160625B Swift/XRT was unable to observe at early times, so any flares may simply have been undetected (Fig. 12).GRB 150201A does not show any X-ray flares, despite there being early-time data.GRB 220627A was not localised until 0.84 days, so no search for flaring could be conducted.GRB 130925A is the nearest of the ultra-long GRBs in the sample and also has the longest duration measured in γ-rays.Its X-ray afterglow showed many large flares, similar to those of the ultra-long GRBs studied by Levan et al. (2014).Evidence for a thermal emission component was found in the X-ray spectra and was interpreted as photospheric emission from the GRB fireball (Piro et al. 2014).Such thermal emission has been observed in a number of other X-ray flares (Peng et al. 2014).Evans et al. (2014) suggested that the lack of external shock X-ray emission implied a low circumburst density, which could explain the ultra-long γ-ray duration since the deceleration time and radius would be larger, allowing more ejected shells to interact and produce prompt emission before reaching the external shock.The radio emission from GRB 130925A proved challenging to explain in a normal forward shock afterglow model (Horesh et al. 2015).GRBs 091024A, 130925A, and 160625B were all detected and localised by Swift/BAT A32, page 14 of 17 de Wet, S., et al.: A&A 677, A32 (2023) and were therefore monitored from very early times at optical frequencies.
In summary, GRBs with widely-spaced emission episodes show a wide variety of prompt and afterglow features.More observations of such bursts are needed in order to determine if there are unifying characteristics that distinguish them from single-emission episode bursts.

Conclusion
GRB 220627A is an ultra-long GRB that triggered Fermi/GBM twice separated by a 956 s time interval.High-energy GeV γ-rays were detected by Fermi/LAT in coincidence with the first emission episode which led to the discovery of the optical afterglow with MeerLICHT at 0.84 days.Optical spectroscopic observations with MUSE were used to deduce the burst redshift of z = 3.08, making GRB 220627A the most distant ultra-long GRB observed to date.From our optical follow-up observations we identified a temporal break in the light curve at ∼1.2 days which we interpret as a jet break.From our spectroscopic measurements we found that the environment of the burst is consistent with a sub-solar metallicity typical of DLA systems and other GRB afterglows.Combined with publicly-available X-ray and radio data, we performed broad-band theoretical modelling of the afterglow data and found preference for a homogeneous circumburst medium.Our most well-constrained parameter is the jet opening angle, which we constrain to θ j = 4.5 +1.2 −0.3 deg.All our parameters are typical for long GRB afterglows.Our observations of this ultra-long GRB do not require a different progenitor compared to normal long GRBs as suggested by some authors, though we cannot exclude this possibility.More observations of bursts with widely-spaced emission episodes are needed to determine if they form a separate population with distinct prompt and afterglow features.
Fig. 1.Localisation of GRB 220627A.Left: 50% and 90% uncertainty regions for both GBM triggers associated with GRB 220627A are outlined in purple.A total of 52 MeerLICHT fields (grey boxes) were automatically scheduled for observations immediately following the first trigger.Following the announcement of the Fermi/LAT localisation region (red circle), two MeerLICHT fields (orange boxes) were scheduled for observations the following night.Top right: Swift/XRT ToO observations identified 15 X-ray sources within the LAT error box.MeerLICHT identified a new optical transient within the error box of the third 'good' XRT source (yellow diamond).Bottom right: first MeerLICHT detection of the new transient (left), and an archival image taken two months previously on 2022 April 26 (right).Both thumbnails are 1 × 1 in dimension.

H = 4
.90 × 10 20 cm −2(Willingale et al. 2013) and fixing the source redshift to z = 3.08.From our fit we derive a host column density of N host H = 3.75+7.83−3.74 ×10 22 cm −2 and a photon index of Γ = 1.73 +0.78 −0.51 Fig.4.X-ray and optical light curves associated with GRB 220627A, organised by observing band and instrument.MeerLICHT is abbreviated to ML in the legend.The vertical grey region denotes the time of the MUSE spectroscopic observations.We show the broken power law fits to each of the g, q, r and i bands, where the break time and temporal indices were constrained to be the same across each fit.Residuals are shown in magnitudes in the lower panel.We show the two X-ray detections as crosses and the single upper limit as an upside-down triangle.The dotted line is the optical light curve fit shifted vertically to the X-ray band.

Fig. 5 .
Fig. 5. MUSE spectroscopy of GRB 220627A.Left: white light image resulting from the final MUSE data cube.The GRB afterglow is clearly visible at the centre of the image.Right: telluric-corrected spectrum (black) and error spectrum (grey) of GRB 220627A extracted from the MUSE data cube using an aperture with a radius of 0.6 .We show identified absorption lines at the GRB redshift (z = 3.084) and the intervening system (z = 2.665) in grey and red, respectively.The vertical shaded region is heavily affected by telluric lines.

Fig. 7 .Fig. 8 .
Fig. 7. Absorption lines of S ii and Si ii used in the CoG analysis.We show in grey the Si iv lines from the intervening absorber at z = 2.665.The Si iv 1394 line from the absorber is blended with the Si ii 1250 line.The purple horizontal line denotes the telluric correction applied to the spectrum, shifted vertically up by 1.4 flux units.

Fig. 9 .
Fig.9.Metallicities obtained from the analysis of S ii and Si ii absorption lines in GRB afterglows (orange points;Thöne et al. 2013;Bolmer et al. 2019;Saccardi et al. 2023) compared with the corresponding [X/H] values obtained from the same elements in GRB 220627A (green and red data), as a function of redshift.We also show the absorption-derived metallicity values for a large sample of QSO-DLA systems (grey points;Rafelski et al. 2012;De Cia et al. 2016;Saccardi et al. 2023).

Fig. 10 .
Fig. 10.Corner plot from our MCMC implementation showing the 2D marginalised distributions between pairs of model parameters along with the marginalised distributions for each individual model parameter.Contours denote the 1σ, 2σ and 3σ levels while the red lines denote the median values from the marginalised distributions for each model parameter.Uncertainties on each parameter are at the 16th and 84th (1σ) percentile.
for long GRBs in ISM environments.Santana et al. (2014) found that B spans A32, page 12 of 17 de Wet, S., et al.: A&A 677, A32 (2023) Table4.Parameter values derived from our theoretical modelling.We report the median values and 68% confidence intervals derived from our marginalised distributions in Fig.10.

Fig. 11 .
Fig. 11.All afterglow flux measurements presented in Table1along with 100 random models drawn from our MCMC exploration of the parameter space.The bold lines represent the model associated with the median values from the marginalised posterior distributions in Fig.10.Upper limits are shown as upside-down triangles.

Fig
Fig.12.X-ray luminosities as a function of rest-frame time for all Swift/XRT-detected bursts in Table5.For GRBs without redshifts (110709B and 150201A) we assume z = 1.The grey colour bar denotes the fraction of Swift/XRT-detected afterglows with known redshifts crossing each luminosity-time bin.

Table 1 .
X-ray, optical and radio observations of GRB 220627A used in this work.

Table 2 .
Metallicity computed from the MUSE spectrum and using the CoG method for metal lines.

Table 3 .
Priors on parameters in Θ used in our MCMC analysis.