The signal transmitted on the optical fiber is encoded by the photoelectric conversion module of the optical transceiver, and the HDB3 code is a telecom number, so it must be encoded and converted before it can be transmitted on the optical fiber. The code type of SDH transmission is scrambling code NRZ, while there are many PDH codes, and NRZ scrambling code and 5b6b code can be used.
Finally, I personally feel that SDH and PDH systems do not need to modulate signals when transmitting signals on optical fibers, but only need to multiplex electrical signals.