Technically speaking, you problem is vibration, not water hammer. Water hammer is one or perhaps two loud bangs that occurs immediately after a valve is turned off. Having said that, let us move on to your problem:
The problem is the fill valve on the toilet. When the fill begins the float is all the way down and the fill valve is wide open. As the tank is nearly full and the float is rising the valve begins throttling down. It is at that point where your vibration occurs and continues until the tank is full and the valve finally closes.
The solution is to replace the diaphram in the fill valve, however, if you have an old style Ballcock with a brass body often they are very difficult to get open to repair, and depending upon what brand you have, often it is difficult to find replacement parts.
The quickest and simplest solution is to replace the fill valve assembly.
Fluidmaster makes a very good universal replacement fill valve that is simple to install. Takes about ten minutes for an experienced plumber and would probably be under 30 minutes for a novice DIY project.
On the inside of your tank their is a "Water Level" index line either printed or embossed into the ceramic. It is very important that you adjust the new valve to insure it fills the tank to that level.
The Fluidmaster kits can be found in all hardware or home supplies for about $10.
The only tools you should require is a pair of channel lock pliers.
I would suggest that you examine the water supply line before you go out for parts. If you have a chrome plated brass water line you Will have to replace the cone washer on the upper end of the line while installing the fill valve. The kit comes with a new cone washer but many ppl find it simpler to just get one of the ready made supply lines and replace it while installing the kit. If you elect to get a new line, measure the length of the existing line so you get the correct size replacement.
I have prepared the following illustration for you.
