O&G: Crack and Frac Spreads Question

Does anyone have any resources that walk you through exactly how crack and frac spreads are calculated and the underlying forces that drive them? I’m trying to understand how refining margins work and the NGL business. Any help would be appreciated, thanks.