An apparatus suitable for detecting X-rays, comprising: an X-ray absorption layer comprising an electrode; an electronics layer, the electronics layer comprising: a substrate having a first surface facing the X-ray absorption layer and a second surface opposite the first surface, an electronics system in or on the substrate, an electric contact on the first surface, a via, and a redistribution layer on the second surface; wherein the RDL comprises a transmission line; wherein the via extends from the first surface to the second surface; wherein the electrode is electrically connected to the electric contact; wherein the electronics system is electrically connected to the electric contact and the transmission line through the via; wherein the electronics system comprises: a first voltage comparator configured to compare a voltage of the electrode to a first threshold; a second voltage comparator configured to compare the voltage to a second threshold; a counter configured to register a number of X-ray photons reaching the X-ray absorption layer; a controller; wherein the controller is configured to start a time delay from a time at which the first voltage comparator determines that an absolute value of the voltage equals or exceeds an absolute value of the first threshold; wherein the controller is configured to activate the second voltage comparator during the time delay; wherein the controller is configured to cause the number registered by the counter to increase by one, if the second voltage comparator determines that an absolute value of the voltage equals or exceeds an absolute value of the second threshold, wherein the electrode is on a side of the X-ray absorption layer facing the electronics layer. an X-ray absorption layer comprising an electrode; an electronics layer, the electronics layer comprising: a substrate having a first surface facing the X-ray absorption layer and a second surface opposite the first surface, an electronics system in or on the substrate, an electric contact on the first surface, a via, and a redistribution layer on the second surface; wherein the RDL comprises a transmission line; wherein the via extends from the first surface to the second surface; wherein the electrode is electrically connected to the electric contact; wherein the electronics system is electrically connected to the electric contact and the transmission line through the via; wherein the electronics system comprises: a first voltage comparator configured to compare a voltage of the electrode to a first threshold; a second voltage comparator configured to compare the voltage to a second threshold; a counter configured to register a number of X-ray photons reaching the X-ray absorption layer; a controller; wherein the controller is configured to start a time delay from a time at which the first voltage comparator determines that an absolute value of the voltage equals or exceeds an absolute value of the first threshold; wherein the controller is configured to activate the second voltage comparator during the time delay; wherein the controller is configured to cause the number registered by the counter to increase by one, if the second voltage comparator determines that an absolute value of the voltage equals or exceeds an absolute value of the second threshold, wherein the electrode is on a side of the X-ray absorption layer facing the electronics layer. a first voltage comparator configured to compare a voltage of the electrode to a first threshold; a second voltage comparator configured to compare the voltage to a second threshold; a counter configured to register a number of X-ray photons reaching the X-ray absorption layer; a controller; wherein the controller is configured to start a time delay from a time at which the first voltage comparator determines that an absolute value of the voltage equals or exceeds an absolute value of the first threshold; wherein the controller is configured to activate the second voltage comparator during the time delay; wherein the controller is configured to cause the number registered by the counter to increase by one, if the second voltage comparator determines that an absolute value of the voltage equals or exceeds an absolute value of the second threshold, wherein the electrode is on a side of the X-ray absorption layer facing the electronics layer.