How can you find the detector that each pixel comes from?

How can you find the detector that each pixel comes from in Sentinel-2?

There is a mask for each band and each of the 12 detectors.

Thank you for the reply. Is this in the L2A product only? I don’t see such a mask band when I search the L1C .SAFE directory.

This is contained in the L1C.
This information is in e.g.,
\S2A_MSIL1C_20201229T130251_N0209_R095_T24MVA_20201229T144625.SAFE\GRANULE\L1C_T24MVA_A028835_20201229T130247\QI_DATA
Depending on the processing baseline version you need to either look at the
MSK_DETFOO_B##.gml files or the MSK_DETFOO_B##.jp2

You can read more about the data format in the Sentinel-2 Products Specification Document