Hi.
I am using ROOT to fit some data. One of the sets of data is only of 4 entries, as shown in the code below:
x =-0.011079 time =0.00358523
x =-0.020798 time =0.00713421
x =-0.0293905 time =0.0106832
x =-0.0379928 time =0.0142322
Fitting results:
Error in <TDecompChol>: matrix not positive definite
Error in <TVectorD>: vectors not compatible
Fitting results:
Parameters:
NO. VALUE ERROR
0 0.000000 0.000000
1 0.000000 0.000000
The code I used for fitting is as follows:
gSystem->Load("libpdbd.so");
TFile* f = new TFile("output.root");
TTree* t = (TTree*) f->Get("DBDmc");
Int_t NTracks, NTracksbefore;
Double_t x, y, z;
Float_t ener,time;
// Double_t x;
TLeaf* l_NTracks = t->GetLeaf("fNTracks");
TLeaf* l_fX = t->GetLeaf("fTracks.fX.fX");
TLeaf* l_fY = t->GetLeaf("fTracks.fX.fY");
TLeaf* l_fZ = t->GetLeaf("fTracks.fX.fZ");
TLeaf* l_fEnergy = t->GetLeaf("fTracks.fEnergy");
TLeaf* l_fTime = t->GetLeaf("fTracks.fTime");
NTracksbefore = 0;
Int_t nentries = (Int_t) t->GetEntries();
for (Int_t i=0; i<nentries>GetBranch()->GetEntry(i);
NTracks = l_NTracks->GetValue();
l_fX->GetBranch()->GetEntry(i);
l_fY->GetBranch()->GetEntry(i);
l_fZ->GetBranch()->GetEntry(i);
l_fTime->GetBranch()->GetEntry(i);
l_fEnergy->GetBranch()->GetEntry(i);
// create profiles to hold the data
TProfile* pr1 = new TProfile("pr1","x vs time", 100, 0, 2, -20, 20);
TProfile* pr2 = new TProfile("pr2","y vs time", 100, 0, 2, -20, 20);
TProfile* pr3 = new TProfile("h3","y and time", 100, 0, 2, -20, 20);
for (Int_t j = NTracksbefore;j<NTracks>GetValue(j);
y = l_fY->GetValue(j);
z = l_fZ->GetValue(j);
ener = l_fEnergy->GetValue(j);
time = l_fTime->GetValue(j);
pr1->Fill(time,x);
pr2->Fill(time,y);
pr3->Fill(time,z);
cout << "x =" << x << "time =" << time <<endl>Fit("pol1");
delete pr1;
delete pr2;
delete pr3;
}
Is it an implicit problem in the ROOT fitter?
Thanks
Hui