Dear rooters,
I have background data, background + signal data, and Monte Carlo simulated signal sample, all in TTree format. I’d like to retrieve the detector response by comparing the energy spectra between data and MC. The detector response can be described by a scaling and a smearing parameter on the energy, both can be applied to individual MC events, and the energy scaling parameter is what I am after.
My first attempt is to write a double myfunc(double* x, double* p)
that can be used to create a TF1 object, fMC. I read MC events’ energies from a tree, scale them using p[0]
, smear them using p[1]
, and save the result to a histogram, hMC, in myfunc
. The background data is saved in another histogram, hBG. I add them together: h->Add(hMC, hBG, p[2], p[3])
and return its bin content based on x[0] (energy). Background + signal data is filled into another histogram, hdata. I then try hdata->Fit(fMC)
to determine all the p
’s, including p[0]
, which is what I’d like to know. Unfortunately, the fitting never converges.
RooUnfold
seems to be a standard way to get the response matrix, but I don’t know how to get the scaling factor from the matrix.
I am thinking using RooKeysPdf
to get the signal PDF from the MC tree, and convolute it with a Gaussian. But how can I implement the energy scaling factor to the resulting PDF as a fitting parameter? Another question is that FFT is used to calculate the convolution, is it possible to apply FFT directly to the energies saved in the tree? It seems silly to create the PDF from the tree, and then use the PDF to create random samples for FFT.
Am I on the right track? Is there any other way that I am not aware of? Please advice.
Thanks,
Jing