Certain cheap oil filters will drain overnight, which means that the entire engine is dry in the morning. This happens because the cheaper oil fil;ters don't have a "drain-back flapper" which lets all the oil drain out of the filter. So in the morning, the oil filter is empty, and the rest of the engine is too, so the oil pump has to pump about an extra 1/2 quart of oil before it can pump oil into the crankshaft and pushrods, which means they ar running dry( bad) until the engine gets oiled up. The 'hammering' you hear is probably the dry pushrods or the dry rod ends banging because there is no oil in there for lubrication.