Physics of scintillation in REAlO3:Ce3+ (RE=Y, Lu)