Possible parents for the cometary CN radical: photochemistry and excitation conditions