When your shader is called (evaluated) .. meaning a (incident) ray intersected a geometry where your shader is attached to .. Arnold fills a global structure with data where you can check what kind of ray did hit your shader and many other things. 'shader_evaluate' is a macro defined for 'static void Evaluate(AtNode* node, AtShaderGlobals* sg)'.
That 'AtShaderGlobals' is what you need to check to retrieve any info available at the intersection point. So for example in your 'shader_evaluate' simply start with 'sg->' and your intellisense should give you a rollout with all the member available from AtShaderGlobals (or check ai_shaderglobals.h). For the purpose of a 'ray switch' shader you may want to check for example sg->Rt .. that is the ray type .. AI_RAY_CAMERA AI_RAY_DIFFUSE_REFLECT etc. (see ai_ray.h) of the incident ray that called your shader.