Multisegment CdTe nanowire homojunction photodiode