some minor improvments in the SCAN/CONTOURS handling
This commit is contained in:
parent
97968654fa
commit
686419119f
@ -71,6 +71,7 @@ using namespace std;
|
|||||||
PFitter::PFitter(PMsrHandler *runInfo, PRunListCollection *runListCollection, Bool_t chisq_only) :
|
PFitter::PFitter(PMsrHandler *runInfo, PRunListCollection *runListCollection, Bool_t chisq_only) :
|
||||||
fChisqOnly(chisq_only), fRunInfo(runInfo)
|
fChisqOnly(chisq_only), fRunInfo(runInfo)
|
||||||
{
|
{
|
||||||
|
fIsScanOnly = true;
|
||||||
fConverged = false;
|
fConverged = false;
|
||||||
fUseChi2 = true; // chi^2 is the default
|
fUseChi2 = true; // chi^2 is the default
|
||||||
|
|
||||||
@ -356,14 +357,18 @@ Bool_t PFitter::CheckCommands()
|
|||||||
} else if (it->fLine.Contains("EIGEN")) {
|
} else if (it->fLine.Contains("EIGEN")) {
|
||||||
fCmdList.push_back(PMN_EIGEN);
|
fCmdList.push_back(PMN_EIGEN);
|
||||||
} else if (it->fLine.Contains("HESSE")) {
|
} else if (it->fLine.Contains("HESSE")) {
|
||||||
|
fIsScanOnly = false;
|
||||||
fCmdList.push_back(PMN_HESSE);
|
fCmdList.push_back(PMN_HESSE);
|
||||||
} else if (it->fLine.Contains("MACHINE_PRECISION")) {
|
} else if (it->fLine.Contains("MACHINE_PRECISION")) {
|
||||||
fCmdList.push_back(PMN_MACHINE_PRECISION);
|
fCmdList.push_back(PMN_MACHINE_PRECISION);
|
||||||
} else if (it->fLine.Contains("MIGRAD")) {
|
} else if (it->fLine.Contains("MIGRAD")) {
|
||||||
|
fIsScanOnly = false;
|
||||||
fCmdList.push_back(PMN_MIGRAD);
|
fCmdList.push_back(PMN_MIGRAD);
|
||||||
} else if (it->fLine.Contains("MINIMIZE")) {
|
} else if (it->fLine.Contains("MINIMIZE")) {
|
||||||
|
fIsScanOnly = false;
|
||||||
fCmdList.push_back(PMN_MINIMIZE);
|
fCmdList.push_back(PMN_MINIMIZE);
|
||||||
} else if (it->fLine.Contains("MINOS")) {
|
} else if (it->fLine.Contains("MINOS")) {
|
||||||
|
fIsScanOnly = false;
|
||||||
fCmdList.push_back(PMN_MINOS);
|
fCmdList.push_back(PMN_MINOS);
|
||||||
} else if (it->fLine.Contains("MNPLOT")) {
|
} else if (it->fLine.Contains("MNPLOT")) {
|
||||||
fCmdList.push_back(PMN_PLOT);
|
fCmdList.push_back(PMN_PLOT);
|
||||||
@ -578,6 +583,20 @@ Bool_t PFitter::ExecuteContours()
|
|||||||
{
|
{
|
||||||
cout << ">> PFitter::ExecuteContours() ..." << endl;
|
cout << ">> PFitter::ExecuteContours() ..." << endl;
|
||||||
|
|
||||||
|
// if already some minimization is done use the minuit2 output as input
|
||||||
|
if (!fFcnMin) {
|
||||||
|
cerr << endl << "**WARNING**: CONTOURS musn't be called before any minimization (MINIMIZE/MIGRAD/SIMPLEX) is done!!";
|
||||||
|
cerr << endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// check if minimum was valid
|
||||||
|
if (!fFcnMin->IsValid()) {
|
||||||
|
cerr << endl << "**ERROR**: CONTOURS cannot started since the previous minimization failed :-(";
|
||||||
|
cerr << endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
ROOT::Minuit2::MnContours contours((*fFitterFcn), *fFcnMin);
|
ROOT::Minuit2::MnContours contours((*fFitterFcn), *fFcnMin);
|
||||||
|
|
||||||
fScanData = contours(fScanParameter[0], fScanParameter[1], fScanNoPoints);
|
fScanData = contours(fScanParameter[0], fScanParameter[1], fScanNoPoints);
|
||||||
@ -856,6 +875,8 @@ Bool_t PFitter::ExecuteScan()
|
|||||||
fScanData = scan.Scan(fScanParameter[0], fScanNoPoints, fScanLow, fScanHigh);
|
fScanData = scan.Scan(fScanParameter[0], fScanNoPoints, fScanLow, fScanHigh);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fConverged = true;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,11 +68,13 @@ class PFitter
|
|||||||
virtual ~PFitter();
|
virtual ~PFitter();
|
||||||
|
|
||||||
Bool_t IsValid() { return fIsValid; }
|
Bool_t IsValid() { return fIsValid; }
|
||||||
|
Bool_t IsScanOnly() { return fIsScanOnly; }
|
||||||
Bool_t HasConverged() { return fConverged; }
|
Bool_t HasConverged() { return fConverged; }
|
||||||
Bool_t DoFit();
|
Bool_t DoFit();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Bool_t fIsValid;
|
Bool_t fIsValid;
|
||||||
|
Bool_t fIsScanOnly;
|
||||||
Bool_t fConverged;
|
Bool_t fConverged;
|
||||||
Bool_t fChisqOnly;
|
Bool_t fChisqOnly;
|
||||||
Bool_t fUseChi2;
|
Bool_t fUseChi2;
|
||||||
|
@ -497,12 +497,13 @@ int main(int argc, char *argv[])
|
|||||||
fitter = new PFitter(msrHandler, runListCollection, chisq_only);
|
fitter = new PFitter(msrHandler, runListCollection, chisq_only);
|
||||||
if (fitter->IsValid()) {
|
if (fitter->IsValid()) {
|
||||||
fitter->DoFit();
|
fitter->DoFit();
|
||||||
|
if (!fitter->IsScanOnly())
|
||||||
msrHandler->SetMsrStatisticConverged(fitter->HasConverged());
|
msrHandler->SetMsrStatisticConverged(fitter->HasConverged());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// write log file
|
// write log file
|
||||||
if (success && !chisq_only) {
|
if (success && !chisq_only && !fitter->IsScanOnly()) {
|
||||||
status = msrHandler->WriteMsrLogFile();
|
status = msrHandler->WriteMsrLogFile();
|
||||||
if (status != PMUSR_SUCCESS) {
|
if (status != PMUSR_SUCCESS) {
|
||||||
switch (status) {
|
switch (status) {
|
||||||
@ -532,7 +533,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
// rename MINUIT2.OUTPUT and MINUIT2.root file if wanted
|
// rename MINUIT2.OUTPUT and MINUIT2.root file if wanted
|
||||||
if (keep_mn2_output && !chisq_only) {
|
if (keep_mn2_output && !chisq_only && !fitter->IsScanOnly()) {
|
||||||
// 1st rename MINUIT2.OUTPUT
|
// 1st rename MINUIT2.OUTPUT
|
||||||
TString fln = TString(filename);
|
TString fln = TString(filename);
|
||||||
char ext[32];
|
char ext[32];
|
||||||
@ -547,7 +548,7 @@ int main(int argc, char *argv[])
|
|||||||
gSystem->CopyFile("MINUIT2.root", fln.Data(), kTRUE);
|
gSystem->CopyFile("MINUIT2.root", fln.Data(), kTRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!chisq_only) {
|
if (!chisq_only && !fitter->IsScanOnly()) {
|
||||||
// swap msr- and mlog-file
|
// swap msr- and mlog-file
|
||||||
cout << endl << ">> swapping msr-, mlog-file ..." << endl;
|
cout << endl << ">> swapping msr-, mlog-file ..." << endl;
|
||||||
// copy msr-file -> __temp.msr
|
// copy msr-file -> __temp.msr
|
||||||
|
Loading…
x
Reference in New Issue
Block a user