Commit 9ac36556 authored by Shahid Khan's avatar Shahid Khan
Browse files

Merge branch 'fix_fitting_2gaus' into 'master'

Fix fitting 2gaus

See merge request !2
parents 4d838ad9 a7e09a3e
......@@ -3,3 +3,6 @@ include_directories(${CMAKE_SOURCE_DIR}/src)
add_executable(fit FitXicZerotoXiPiInvMass.C)
target_link_libraries(fit SignalExtraction ${ROOT_LIBRARIES} EG Minuit)
add_executable(test_exe test.cpp)
target_link_libraries(test_exe SignalExtraction ${ROOT_LIBRARIES} EG Minuit)
#if !defined(__CLING__)
#include "AliHFInvMassFitter.h"
#include <TH1F.h>
#include <TF1.h>
#endif
TH1F* CreateTestHisto(){
TH1F* h = new TH1F("h_test", "", 100, 1.05, 1.2);
auto f = new TF1("f","gaus(0) + gaus(3) + pol1(5)",1.05, 1.2);
f->SetParameters(2,1.115,0.002,1,1.115,0.005, 0.1, 0.1);
h->FillRandom("f", 20000);
return h;
}
void test(){
auto h = CreateTestHisto();
// h->Draw();
auto fitter = new AliHFInvMassFitter(h, 1.05, 1.2, AliHFInvMassFitter::ETypeOfBkg::kLin, AliHFInvMassFitter::ETypeOfSgn::k2Gaus);
fitter->SetInitialFrac2Gaus(0.5);
fitter->SetInitialGaussianMean(1.115);
fitter->SetInitialGaussianSigma(0.002);
fitter->SetInitialSecondGaussianSigma(0.005);
Bool_t ok = fitter->MassFitter(kTRUE);
if(!ok){
std::cout << "Not OK!" << std::endl;
}
}
int main(){
test();
return 0;
}
\ No newline at end of file
......@@ -610,14 +610,14 @@ TF1* AliHFInvMassFitter::CreateSignalFitFunction(TString fname, Double_t integsi
funcsig->SetParameter(1,fMass);
if(fFixedMean) funcsig->FixParameter(1,fMass);
funcsig->SetParameter(2,fSigmaSgn);
funcsig->SetParLimits(2,0.004,0.05);
funcsig->SetParLimits(2,0.001,0.05);
if(fFixedSigma) funcsig->FixParameter(2,fSigmaSgn);
funcsig->SetParameter(3,fFrac2Gaus);
if(fFixedFrac2Gaus) funcsig->FixParameter(3,fFrac2Gaus);
else funcsig->SetParLimits(3,0.,1.);
funcsig->SetParameter(4,fSigmaSgn2Gaus);
if(fFixedSigma2Gaus) funcsig->FixParameter(4,fSigmaSgn2Gaus);
else funcsig->SetParLimits(4,0.004,0.05);
else funcsig->SetParLimits(4,0.001,0.05);
funcsig->SetParNames("SgnInt","Mean","Sigma1","Frac","Sigma2");
}
if(fTypeOfFit4Sgn==k2GausSigmaRatioPar){
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment