Fitting in THnSparse

is there a simple way to do fitting in THnSparse class?



Hi Maki,

I didn’t add support for fitting yet - you would be very welcome to contribute! Within ROOT we can currently use TMultiDimFit which can only fit polynomials, though. If that is appropriate for your use case you can give it a try to implement it; I expect it to be pretty straight forward. You are welcome to contact me personally ( or x78225 at CERN) if you need some info.

Cheers, Axel.

Axel is busy with CINT and Reflex. If you are in a rush, you can use directly the fitter on a THnSparse as illustrated in the example in the attachment.

sparsefit.C (2.36 KB)

a slightly better version of the example (will run much faster).

root > .x sparsefit.C+

sparsefit.C (2.52 KB)

Thanks a lot for the assistance…
but would this work for fitting in say 5 dimensions ?



Yes this technique should work (of course change the 3 nested loops to 5).
It would be better to use a log likelihood algorithm than the chisquare.