Some misinformation in this thread.
Max heart rate is not calculated. It isn't determined by competing with a friend up a hill. Stava live segments won't tell it to you and puking isn't an indicator. Max heart rate is
tested. Testing max heart rate begins with being fully recovered. If you are not fully recovered from recent rides then you are not testing your max heart rate. Performing the test is easy and how to do it can be googled.
Max heart rate is not sports specific. Max heart rate is the highest your heart can go, period. It doesn't matter if you are doing jumping jacks or sprinting for a stage win at the Giro. Your max is your max.
The most important post in this thread is number two by @
aLpclr0331. Once max is determined you can pretty much forget it because it has no use in terms of training. Lactic threshold is what matters. Lactice threshold is also testable and highly trainable.
-Tim-