Strategies against 50 Hz mains hum on detector signals? I'm having problems with a strong 50 Hz mains hum on signals created by photodetectors. I assume that they are due to ground loops and I realize that the best option would be to remove those. What are the best strategies for removing the hum from the signal? If the noise cannot be eliminated, can you recommend good filters against 50 Hz mains hum or where to look for them? [I reformulated the question after realizing that the best answer answered a more general question than the one I was asking].
Some more information on the setup: The signal is used for locking the frequency of a laser to a high finesse cavity. The lock has to be stable enough for intensity and phase fluctuations resulting from e.g. acoustic vibrations of the cavity to be strongly suppressed. The error signal is created via the tilt locking scheme, i.e. it  is the difference of intensities on two halves of a split photo diode. The photo diode (and a lot of other lab equipment) is powered by a battery which also provides the ground. The hum appears already at this stage. The error signal is then fed into an adder circuit (for fine tuning of the set point). Then it enters a fast PID controller which generates a regulation signal. The regulation signal is fed back via a high voltage amplifier to a piezo to stabilize the cavity length. The main requirement for any additional components such as a notch filter etc. in the locking circuits is a low delay: the locking circuit is currently limited by the bandwidth of the HV amplifier of around 100 kHz and should preferably not be limited by any other filters.
What I'm really interested in in the end are amplitude and phase fluctuations of the light leaving the cavity at frequencies above 100 kHz and below 2 MHz. Hence, the main reason for removing the low-frequency noise is that I don't want to feed it into the control loops. 
 A: There's no magic solution.  Your options are (in something like an order of preference):


*

*Prevent the 50 Hz from entering your signal in the first place by (a) making your setup less sensitive to the 50 Hz field, and (b) removing sources of the 50 Hz field.

*Filter out the 50 Hz with a notch filter. 

*Subtract the 50 Hz signal by using a magnetometer (i.e. coil of wire) to measure the ambient 50 Hz field and experimentally determine the transfer function (i.e. phase) from this measurement to the 50 Hz line in your signal.  (This sort of feedforward is always finicky since it will break if the transfer function changes.)  This is a special case of Wiener filtering.

*Tolerate the 50 Hz.


50/60 Hz problems will be quite difficult to diagnose in a forum like this, since finding the problem usually involves quite a bit of fiddling around with the experimental setup.  
Basic steps towards mitigation include:


*

*Make sure you are using shielded coaxial cables for single-ended signals, and twisted pair for differential signals.

*Seek out and destroy any ground loops!  Sometimes this means connecting the shield of a coaxial cable only on one end.  (For instance, you are using a differential amplifier to subtract the two halves of the photodiode: is there a ground-loop there? Can you shorten those cables, or twist them together?) The first thing to do is to simply move cables around while watching the 50 Hz line on a spectrum analyzer.  Sometimes you can find the offending cable quite easily in this manner.

*Turn off the room lights, and/or make sure your experiment is shielded from line-powered lights.

*Move AC-powered equipment away from your experiment, especially anything involving CRTs, motors, or switching power supplies.  You could use a simple magnetometer (coil of wire hooked to high-impedance differential input of spectrum analyzer) to hunt for the worst sources of 50 Hz field.

*Verify that the 50 Hz is not on the laser light itself, and that the 50 Hz field is not itself moving your mirrors (for instance, if they are suspended and magnetic).

A: If you are not interested in the DC component of your signal but only in the higher frequencies removing a ground loop by AC coupling via a capacitor can be a much better 'quick fix' than trying to filter out the 50Hz component. 
Depending on your needs you can design a band-stop filter which rejects the 50Hz component, e.g.: 
But before filtering I can really recommend trying to get your grounding right. A guide book that I can highly recommend is H.W. Ott, Noise Reduction Techniques in Electronic Systems.
