added necessary DKS switches in prepare sector.

This commit is contained in:
suter_a 2020-02-04 09:37:44 +01:00
parent 7d27c18da5
commit 14c3cd73ed

View File

@ -2624,14 +2624,23 @@ void PFitter::PrepareSector(PDoubleVector &param, PDoubleVector &error)
secFitRange[0].second = fSector[k].GetTimeRangeLast(); secFitRange[0].second = fSector[k].GetTimeRangeLast();
fRunListCollection->SetFitRange(secFitRange); fRunListCollection->SetFitRange(secFitRange);
// calculate chisq // calculate chisq
val = (*fFitterFcn)(param); if (fDKSReady)
val = (*fFitterFcnDKS)(param);
else
val = (*fFitterFcn)(param);
fSector[k].SetChisq(val); fSector[k].SetChisq(val);
// calculate NDF // calculate NDF
ndf = static_cast<UInt_t>(fFitterFcn->GetTotalNoOfFittedBins()) - usedParams; if (fDKSReady)
ndf = fFitterFcnDKS->GetTotalNoOfFittedBins() - static_cast<UInt_t>(usedParams);
else
ndf = fFitterFcn->GetTotalNoOfFittedBins() - static_cast<UInt_t>(usedParams);
fSector[k].SetNDF(ndf); fSector[k].SetNDF(ndf);
// calculate expected chisq // calculate expected chisq
totalExpectedChisq = 0.0; totalExpectedChisq = 0.0;
fFitterFcn->CalcExpectedChiSquare(param, totalExpectedChisq, expectedChisqPerRun); if (fDKSReady)
fFitterFcnDKS->CalcExpectedChiSquare(param, totalExpectedChisq, expectedChisqPerRun);
else
fFitterFcn->CalcExpectedChiSquare(param, totalExpectedChisq, expectedChisqPerRun);
fSector[k].SetExpectedChisq(totalExpectedChisq); fSector[k].SetExpectedChisq(totalExpectedChisq);
// calculate chisq per run // calculate chisq per run
for (UInt_t i=0; i<fRunInfo->GetMsrRunList()->size(); i++) { for (UInt_t i=0; i<fRunInfo->GetMsrRunList()->size(); i++) {
@ -2643,7 +2652,10 @@ void PFitter::PrepareSector(PDoubleVector &param, PDoubleVector &error)
if (totalExpectedChisq != 0.0) { if (totalExpectedChisq != 0.0) {
UInt_t ndf_run = 0; UInt_t ndf_run = 0;
for (UInt_t i=0; i<expectedChisqPerRun.size(); i++) { for (UInt_t i=0; i<expectedChisqPerRun.size(); i++) {
ndf_run = fFitterFcn->GetNoOfFittedBins(i) - fRunInfo->GetNoOfFitParameters(i); if (fDKSReady)
ndf_run = fFitterFcnDKS->GetNoOfFittedBins(i) - fRunInfo->GetNoOfFitParameters(i);
else
ndf_run = fFitterFcn->GetNoOfFittedBins(i) - fRunInfo->GetNoOfFitParameters(i);
if (ndf_run > 0) { if (ndf_run > 0) {
fSector[k].SetNDF(ndf_run, i); fSector[k].SetNDF(ndf_run, i);
} }
@ -2651,7 +2663,10 @@ void PFitter::PrepareSector(PDoubleVector &param, PDoubleVector &error)
} else if (chisqPerRun.size() > 0) { // in case expected chisq is not applicable like for asymmetry fits } else if (chisqPerRun.size() > 0) { // in case expected chisq is not applicable like for asymmetry fits
UInt_t ndf_run = 0; UInt_t ndf_run = 0;
for (UInt_t i=0; i<chisqPerRun.size(); i++) { for (UInt_t i=0; i<chisqPerRun.size(); i++) {
ndf_run = fFitterFcn->GetNoOfFittedBins(i) - fRunInfo->GetNoOfFitParameters(i); if (fDKSReady)
ndf_run = fFitterFcnDKS->GetNoOfFittedBins(i) - fRunInfo->GetNoOfFitParameters(i);
else
ndf_run = fFitterFcn->GetNoOfFittedBins(i) - fRunInfo->GetNoOfFitParameters(i);
if (ndf_run > 0) { if (ndf_run > 0) {
fSector[k].SetNDF(ndf_run, i); fSector[k].SetNDF(ndf_run, i);
} }
@ -2671,14 +2686,23 @@ void PFitter::PrepareSector(PDoubleVector &param, PDoubleVector &error)
secFitRange[0].second = fSector[k].GetTimeRangeLast(); secFitRange[0].second = fSector[k].GetTimeRangeLast();
fRunListCollection->SetFitRange(secFitRange); fRunListCollection->SetFitRange(secFitRange);
// calculate maxLH // calculate maxLH
val = (*fFitterFcn)(param); if (fDKSReady)
val = (*fFitterFcnDKS)(param);
else
val = (*fFitterFcn)(param);
fSector[k].SetChisq(val); fSector[k].SetChisq(val);
// calculate NDF // calculate NDF
ndf = static_cast<UInt_t>(fFitterFcn->GetTotalNoOfFittedBins()) - usedParams; if (fDKSReady)
ndf = fFitterFcnDKS->GetTotalNoOfFittedBins() - static_cast<UInt_t>(usedParams);
else
ndf = fFitterFcn->GetTotalNoOfFittedBins() - static_cast<UInt_t>(usedParams);
fSector[k].SetNDF(ndf); fSector[k].SetNDF(ndf);
// calculate expected maxLH // calculate expected maxLH
totalExpectedMaxLH = 0.0; totalExpectedMaxLH = 0.0;
fFitterFcn->CalcExpectedChiSquare(param, totalExpectedMaxLH, expectedMaxLHPerRun); if (fDKSReady)
fFitterFcnDKS->CalcExpectedChiSquare(param, totalExpectedMaxLH, expectedMaxLHPerRun);
else
fFitterFcn->CalcExpectedChiSquare(param, totalExpectedMaxLH, expectedMaxLHPerRun);
fSector[k].SetExpectedChisq(totalExpectedMaxLH); fSector[k].SetExpectedChisq(totalExpectedMaxLH);
// calculate maxLH per run // calculate maxLH per run
for (UInt_t i=0; i<fRunInfo->GetMsrRunList()->size(); i++) { for (UInt_t i=0; i<fRunInfo->GetMsrRunList()->size(); i++) {
@ -2690,7 +2714,10 @@ void PFitter::PrepareSector(PDoubleVector &param, PDoubleVector &error)
if (totalExpectedMaxLH != 0.0) { if (totalExpectedMaxLH != 0.0) {
UInt_t ndf_run = 0; UInt_t ndf_run = 0;
for (UInt_t i=0; i<expectedMaxLHPerRun.size(); i++) { for (UInt_t i=0; i<expectedMaxLHPerRun.size(); i++) {
ndf_run = fFitterFcn->GetNoOfFittedBins(i) - fRunInfo->GetNoOfFitParameters(i); if (fDKSReady)
ndf_run = fFitterFcnDKS->GetNoOfFittedBins(i) - fRunInfo->GetNoOfFitParameters(i);
else
ndf_run = fFitterFcn->GetNoOfFittedBins(i) - fRunInfo->GetNoOfFitParameters(i);
if (ndf_run > 0) { if (ndf_run > 0) {
fSector[k].SetNDF(ndf_run, i); fSector[k].SetNDF(ndf_run, i);
} }