Implementation of a custom fitter and FitResult

Hi.
I’m trying to write a code for track-fitting in data analysis for a small detector-evaluation experiment.
Ever I’ve only used only some popular methods TH1::Fit etc, though I guess I need a more complicated technique for my purpose as described below.

In my detector system, there were two kinds of trackers, (1) strip tracker and (2) gaseous tracker.
(1) gives the exact hit position on 2-dimensional plane (x,y).
(2) gives only diameters ® of the drift circle around the wire position (x,y).

For the track-fitting, (in which I want to fit a straight line “[0]*x + [1]” to the data, )
these different types of data should be treated once.
Since this data structure cannot be expressed with usual TH1, TGraph… etc, I guessed a custom minimization code was needed.

I found a proper tutorial and succeeded only minimization by referring it. However the problem is that I also need TFitResult (or ROOT::Fit::FitResult) to evaluate the fitted track. Especially I want to use TFitResult::GetConfidenceIntervals().

In this case, it looks that I need to make a custom fitter by inheriting from ROOT::Fit::Fitter.
By implementing a class having the operator () and setting it with ROOT::Fit::Fitter::SetFCN(), I realized the same minimization and get the resulting ROOT::Fit::FitResult, although it cannot give any confidence intervals because it doesn’t contain the fitted function.

This thread seems to discuss a very similar problem, but I cannot understand eventually…
(Especially, I don’t think ROOT::Fit::BinData (or UnBinData?) is appropriate to my case…)

Is there any good tutorial or example for my purpose? Or please tell me the technique to realize it…

I uploaded my current code that can only the minimization and return incomplete FitResults.
I’m sorry for that this cannot be complied alone because another code is convoluted into these code.

TTrackFitter.cpp (4.8 KB)
TTrackFitter.hh (3.5 KB)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.