Mechanism of defects and electrode structure on the performance of AlN-based metal semiconductor metal detectors