RooFit how to implement cache/optimization in such case

Hello RooFit experts,

My PDF = |sum_r[ a_r * A_r(m1,m2) ]|^2 / Norm; where r are several resonance components, a_r are fitting parameters, and A_r^i are constant mostly (allowing to update during the fit if resonance mass or width is free parameter) for the data point i of (m1,m2). Norm is normalization calcualted seperately and optimized using cache. For large number of dataset, the fit is too slow to calculate A_r^i repeatly in evaluate(). What in my mind is to cache these informations, but how to connect the information to each data point in evaluate()? Thanks in advance.


Have you solved this question meanwhile ?