How to get an ID mask/alpha map for the whole object if it overlaps with another one?

Dear Experts,

using Cycles, I want to create a (‘Hollywood-style’) laser beam that passes through glass. What I tried was to create the beam as an emmiting cylinder and to add a blur in compositing. I assigned the cylinder a unique object ‘pass index’ (alternatively a pass index for the material of the cylinder) which I used in compositing to get an alpha map for the blurring effect. This works nicely for the beam itself.

The problem is that with this method it seems to be impossible to make the beam pass through another object (‘glass’). I already found out that this is an issue with the way the ID works. Namely, it is geometric only. (Which i find very weird and counterintuitive.)

Is there another type if ‘ID’ that i could use for this purpose? Something with which I could alpha-map the whole cylinder?

Or is there maybe a much easier way to achieve this effect of the scattered light you see from a laser beam?
(to be really realistic one should see strong scattering from the entrance and exit spots of the glass block and only very weak from within the glass… but this is not my primary concern at the moment ;))

hoping for your helpful comments =)

Seems like it might be better to add the beam onto another scene layer and just use an alpha mask to combine it with the rest of the scene. Have you tried that?