Monolithic integration of detectors and transistors in high-resistivity silicon