Photon A ---> | Glass | ---->Photon B
Is photon B generated within the glass? Or is B=A
This is an interesting question that goes to the heart of how light behaves. The best answer is that we just can't meaningfully say whether photons A and B in your example are one and the same. The reason is that within quantum mechanics, particles often lose their individual identity. To use a crude analogy, imagine you had two bullets, one tagged with red paint and one tagged with blue paint. If you shook the box, you could still track the trajectory of each bullet and say which is which. However, in quantum mechanics, situations can arise where particles become truly indistinguishable. This is true of say electrons in a metal or photons in a beam. At that point you can no longer keep track of individual particles, but you can only study the system as a whole.
In the case at hand, the system you care about is the electromagnetic field from the laser to the detector. The way you can think about it is that at the laser you are dumping energy into the field. Because the states of the EM field are discrete, this energy will be packaged into chunks called photons. So now you can say that at the detector you have a total number of photons N1. Next, this energy will propagate like a ripple in the EM field towards your detector through the glass. Within the glass, each atom/electron will interact weakly with the incoming wave. You can then imagine that each part of the glass can act as a small scattering center, re-radiating the energy as shown here. In this process, both the momentum and energy of the beam can change by a tiny bit since some energy can be transferred to the glass.
You can find the total EM field by adding up all these small wavelets. Because of how the system is set up, you will end up with two beams: 1) a reflected beam and 2) a refracted beam. Here we recover the simple predictions of geometrical optics. Moreover, if we can ignore absorption, we can once again say that the total number of photons is N, with Nt being the number of refracted photons and Nr being the number of reflected photons. Finally, this process will continue until the refracted beam reaches the detector. At that point the EM field will couple to the detector and you will read off that there were Nt photons.
I hope the description above gives you some sense for why your question is difficult to answer in absolute terms. We can certainly say that the photons at A and B will be similar in that their total number will be identical (minus the reflected photons) and their energy and momentum distributions will be very similar. However, there is no good way we could argue that the photons we record at B truly are the very same ones that were fired off at A.Source