fixed merge conflict
This commit is contained in:
parent
b261554e8f
commit
01ba9f3add
@ -71,6 +71,110 @@
|
||||
|
||||
#include "PFitter.h"
|
||||
|
||||
|
||||
//+++ PSectorChisq class +++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Constructor
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Constructor.
|
||||
*/
|
||||
PSectorChisq::PSectorChisq(UInt_t noOfRuns) : fNoOfRuns(noOfRuns)
|
||||
{
|
||||
// init
|
||||
fFirst = 0.0;
|
||||
fLast = 0.0;
|
||||
fChisq = 0.0;
|
||||
fNDF = 0;
|
||||
fChisqRun.resize(fNoOfRuns);
|
||||
fNDFRun.resize(fNoOfRuns);
|
||||
for (UInt_t i=0; i<fNoOfRuns; i++) {
|
||||
fChisqRun[i] = 0.0;
|
||||
fNDFRun[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// SetTimeRange
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Set the time range for one sector
|
||||
*
|
||||
* @param first time stamp of the fgb
|
||||
* @param last time stamp of the requested sector end
|
||||
*/
|
||||
void PSectorChisq::SetTimeRange(Double_t first, Double_t last)
|
||||
{
|
||||
// NOT YET IMPLEMENTED //as35
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// SetChisq
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Set the chisq/maxLH for a given detector with index idx.
|
||||
*
|
||||
* @param chisq chisq/maxLH to be set
|
||||
* @param idx index of the run to be set
|
||||
*/
|
||||
void PSectorChisq::SetChisq(Double_t chisq, UInt_t idx)
|
||||
{
|
||||
// NOT YET IMPLEMENTED //as35
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// SetNDF
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Set the NDF for a given detector with index idx.
|
||||
*
|
||||
* @param ndf to be set
|
||||
* @param idx index of the run to be set
|
||||
*/
|
||||
void PSectorChisq::SetNDF(Double_t ndf, UInt_t idx)
|
||||
{
|
||||
// NOT YET IMPLEMENTED //as35
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetChisq
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>chisq/maxLH of the run with index idx
|
||||
*
|
||||
* @param idx index of the run
|
||||
*
|
||||
* <b>return:</b> chisq/maxLH of the requested run or -1.0 if the idx is out-of-range.
|
||||
*/
|
||||
Double_t PSectorChisq::GetChisq(UInt_t idx)
|
||||
{
|
||||
if (idx >= fNoOfRuns)
|
||||
return -1.0;
|
||||
|
||||
return fChisqRun[idx];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetChisq
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>NDF of the run with index idx
|
||||
*
|
||||
* @param idx index of the run
|
||||
*
|
||||
* <b>return:</b> NDF of the requested run or 0.0 if the idx is out-of-range.
|
||||
*/
|
||||
UInt_t PSectorChisq::GetNDF(UInt_t idx)
|
||||
{
|
||||
if (idx >= fNoOfRuns)
|
||||
return 0;
|
||||
|
||||
return fNDFRun[idx];
|
||||
}
|
||||
|
||||
//+++ PFitter class ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Constructor
|
||||
//--------------------------------------------------------------------------
|
||||
@ -109,12 +213,20 @@ PFitter::PFitter(PMsrHandler *runInfo, PRunListCollection *runListCollection, Bo
|
||||
fPrintLevel = 1.0;
|
||||
|
||||
// keep all the fit ranges in case RANGE command is present
|
||||
PDoublePair rangeGlob;
|
||||
PMsrGlobalBlock *global = fRunInfo->GetMsrGlobal();
|
||||
rangeGlob.first = global->GetFitRange(0);
|
||||
rangeGlob.second = global->GetFitRange(1);
|
||||
|
||||
PMsrRunList *runs = fRunInfo->GetMsrRunList();
|
||||
PDoublePair range;
|
||||
for (UInt_t i=0; i<runs->size(); i++) {
|
||||
range.first = (*runs)[i].GetFitRange(0);
|
||||
range.second = (*runs)[i].GetFitRange(1);
|
||||
fOriginalFitRange.push_back(range);
|
||||
if (range.first == PMUSR_UNDEFINED)
|
||||
fOriginalFitRange.push_back(rangeGlob);
|
||||
else
|
||||
fOriginalFitRange.push_back(range);
|
||||
}
|
||||
|
||||
// check msr minuit commands
|
||||
@ -391,12 +503,21 @@ Bool_t PFitter::CheckCommands()
|
||||
PIntPair cmd;
|
||||
PMsrLines::iterator it;
|
||||
UInt_t cmdLineNo = 0;
|
||||
TString line;
|
||||
Ssiz_t pos;
|
||||
for (it = fCmdLines.begin(); it != fCmdLines.end(); ++it) {
|
||||
if (it == fCmdLines.begin())
|
||||
cmdLineNo = 0;
|
||||
else
|
||||
cmdLineNo++;
|
||||
if (it->fLine.Contains("COMMANDS", TString::kIgnoreCase)) {
|
||||
|
||||
// strip potential comments
|
||||
line = it->fLine;
|
||||
pos = line.First('#');
|
||||
if (pos > 0) // comment present
|
||||
line.Remove(pos,line.Length()-pos);
|
||||
|
||||
if (line.Contains("COMMANDS", TString::kIgnoreCase)) {
|
||||
continue;
|
||||
} else if (it->fLine.Contains("OpenMP", TString::kIgnoreCase)) { // run on CPU using OpenMP
|
||||
continue;
|
||||
@ -408,19 +529,19 @@ Bool_t PFitter::CheckCommands()
|
||||
continue;
|
||||
} else if (it->fLine.Contains("SET BATCH", TString::kIgnoreCase)) { // needed for backward compatibility
|
||||
continue;
|
||||
} else if (it->fLine.Contains("END RETURN", TString::kIgnoreCase)) { // needed for backward compatibility
|
||||
} else if (line.Contains("END RETURN", TString::kIgnoreCase)) { // needed for backward compatibility
|
||||
continue;
|
||||
} else if (it->fLine.Contains("CHI_SQUARE", TString::kIgnoreCase)) {
|
||||
} else if (line.Contains("CHI_SQUARE", TString::kIgnoreCase)) {
|
||||
continue;
|
||||
} else if (it->fLine.Contains("MAX_LIKELIHOOD", TString::kIgnoreCase)) {
|
||||
} else if (line.Contains("MAX_LIKELIHOOD", TString::kIgnoreCase)) {
|
||||
continue;
|
||||
} else if (it->fLine.Contains("SCALE_N0_BKG", TString::kIgnoreCase)) {
|
||||
} else if (line.Contains("SCALE_N0_BKG", TString::kIgnoreCase)) {
|
||||
continue;
|
||||
} else if (it->fLine.Contains("INTERACTIVE", TString::kIgnoreCase)) {
|
||||
} else if (line.Contains("INTERACTIVE", TString::kIgnoreCase)) {
|
||||
cmd.first = PMN_INTERACTIVE;
|
||||
cmd.second = cmdLineNo;
|
||||
fCmdList.push_back(cmd);
|
||||
} else if (it->fLine.Contains("CONTOURS", TString::kIgnoreCase)) {
|
||||
} else if (line.Contains("CONTOURS", TString::kIgnoreCase)) {
|
||||
cmd.first = PMN_CONTOURS;
|
||||
cmd.second = cmdLineNo;
|
||||
fCmdList.push_back(cmd);
|
||||
@ -430,7 +551,7 @@ Bool_t PFitter::CheckCommands()
|
||||
TString str;
|
||||
UInt_t ival;
|
||||
|
||||
tokens = it->fLine.Tokenize(", \t");
|
||||
tokens = line.Tokenize(", \t");
|
||||
|
||||
for (Int_t i=0; i<tokens->GetEntries(); i++) {
|
||||
ostr = dynamic_cast<TObjString*>(tokens->At(i));
|
||||
@ -440,7 +561,7 @@ Bool_t PFitter::CheckCommands()
|
||||
// check that token is a UInt_t
|
||||
if (!str.IsDigit()) {
|
||||
std::cerr << std::endl << ">> PFitter::CheckCommands: **ERROR** in line " << it->fLineNo;
|
||||
std::cerr << std::endl << ">> " << it->fLine.Data();
|
||||
std::cerr << std::endl << ">> " << line.Data();
|
||||
std::cerr << std::endl << ">> parameter number is not number!";
|
||||
std::cerr << std::endl << ">> command syntax for CONTOURS is: CONTOURS parameter-X parameter-Y [# of points]";
|
||||
std::cerr << std::endl;
|
||||
@ -455,7 +576,7 @@ Bool_t PFitter::CheckCommands()
|
||||
// check that parameter is within range
|
||||
if ((ival < 1) || (ival > fParams.size())) {
|
||||
std::cerr << std::endl << ">> PFitter::CheckCommands: **ERROR** in line " << it->fLineNo;
|
||||
std::cerr << std::endl << ">> " << it->fLine.Data();
|
||||
std::cerr << std::endl << ">> " << line.Data();
|
||||
std::cerr << std::endl << ">> parameter number is out of range [1," << fParams.size() << "]!";
|
||||
std::cerr << std::endl << ">> command syntax for CONTOURS is: CONTOURS parameter-X parameter-Y [# of points]";
|
||||
std::cerr << std::endl;
|
||||
@ -475,7 +596,7 @@ Bool_t PFitter::CheckCommands()
|
||||
// check that token is a UInt_t
|
||||
if (!str.IsDigit()) {
|
||||
std::cerr << std::endl << ">> PFitter::CheckCommands: **ERROR** in line " << it->fLineNo;
|
||||
std::cerr << std::endl << ">> " << it->fLine.Data();
|
||||
std::cerr << std::endl << ">> " << line.Data();
|
||||
std::cerr << std::endl << ">> number of points is not number!";
|
||||
std::cerr << std::endl << ">> command syntax for CONTOURS is: CONTOURS parameter-X parameter-Y [# of points]";
|
||||
std::cerr << std::endl;
|
||||
@ -489,7 +610,7 @@ Bool_t PFitter::CheckCommands()
|
||||
ival = str.Atoi();
|
||||
if ((ival < 1) || (ival > 100)) {
|
||||
std::cerr << std::endl << ">> PFitter::CheckCommands: **ERROR** in line " << it->fLineNo;
|
||||
std::cerr << std::endl << ">> " << it->fLine.Data();
|
||||
std::cerr << std::endl << ">> " << line.Data();
|
||||
std::cerr << std::endl << ">> number of scan points is out of range [1,100]!";
|
||||
std::cerr << std::endl << ">> command syntax for CONTOURS is: CONTOURS parameter-X parameter-Y [# of points]";
|
||||
std::cerr << std::endl;
|
||||
@ -508,11 +629,11 @@ Bool_t PFitter::CheckCommands()
|
||||
delete tokens;
|
||||
tokens = nullptr;
|
||||
}
|
||||
} else if (it->fLine.Contains("EIGEN", TString::kIgnoreCase)) {
|
||||
} else if (line.Contains("EIGEN", TString::kIgnoreCase)) {
|
||||
cmd.first = PMN_EIGEN;
|
||||
cmd.second = cmdLineNo;
|
||||
fCmdList.push_back(cmd);
|
||||
} else if (it->fLine.Contains("FIT_RANGE", TString::kIgnoreCase)) {
|
||||
} else if (line.Contains("FIT_RANGE", TString::kIgnoreCase)) {
|
||||
// check the 5 options:
|
||||
// (i) FIT_RANGE RESET,
|
||||
// (ii) FIT_RANGE start end,
|
||||
@ -523,7 +644,7 @@ Bool_t PFitter::CheckCommands()
|
||||
TObjString *ostr;
|
||||
TString str;
|
||||
|
||||
tokens = it->fLine.Tokenize(", \t");
|
||||
tokens = line.Tokenize(", \t");
|
||||
|
||||
if (tokens->GetEntries() == 2) { // should only be RESET
|
||||
ostr = dynamic_cast<TObjString*>(tokens->At(1));
|
||||
@ -534,7 +655,7 @@ Bool_t PFitter::CheckCommands()
|
||||
fCmdList.push_back(cmd);
|
||||
} else {
|
||||
std::cerr << std::endl << ">> PFitter::CheckCommands: **ERROR** in line " << it->fLineNo;
|
||||
std::cerr << std::endl << ">> " << it->fLine.Data();
|
||||
std::cerr << std::endl << ">> " << line.Data();
|
||||
std::cerr << std::endl << ">> Syntax: FIT_RANGE RESET | FIT_RANGE start end | FIT_RANGE s1 e1 s2 e2 .. sN eN,";
|
||||
std::cerr << std::endl << ">> with N the number of runs in the msr-file." << std::endl;
|
||||
std::cerr << std::endl << ">> Found " << str.Data() << ", instead of RESET" << std::endl;
|
||||
@ -548,7 +669,7 @@ Bool_t PFitter::CheckCommands()
|
||||
} else if ((tokens->GetEntries() > 1) && (static_cast<UInt_t>(tokens->GetEntries()) % 2) == 1) {
|
||||
if ((tokens->GetEntries() > 3) && ((static_cast<UInt_t>(tokens->GetEntries())-1)) != 2*fRunInfo->GetMsrRunList()->size()) {
|
||||
std::cerr << std::endl << ">> PFitter::CheckCommands: **ERROR** in line " << it->fLineNo;
|
||||
std::cerr << std::endl << ">> " << it->fLine.Data();
|
||||
std::cerr << std::endl << ">> " << line.Data();
|
||||
std::cerr << std::endl << ">> Syntax: FIT_RANGE RESET | FIT_RANGE <start> <end> | FIT_RANGE <s1> <e1> <s2> <e2> .. <sN> <eN> |";
|
||||
std::cerr << std::endl << ">> FIT_RANGE fgb+<n0> lgb-<n1> | FIT_RANGE fgb+<n00> lgb-<n01> fgb+<n10> lgb-<n11> ... fgb+<nN0> lgb-<nN1>,";
|
||||
std::cerr << std::endl << ">> with N the number of runs in the msr-file.";
|
||||
@ -581,7 +702,7 @@ Bool_t PFitter::CheckCommands()
|
||||
fCmdList.push_back(cmd);
|
||||
} else {
|
||||
std::cerr << std::endl << ">> PFitter::CheckCommands: **ERROR** in line " << it->fLineNo;
|
||||
std::cerr << std::endl << ">> " << it->fLine.Data();
|
||||
std::cerr << std::endl << ">> " << line.Data();
|
||||
std::cerr << std::endl << ">> Syntax: FIT_RANGE RESET | FIT_RANGE <start> <end> | FIT_RANGE <s1> <e1> <s2> <e2> .. <sN> <eN> |";
|
||||
std::cerr << std::endl << ">> FIT_RANGE fgb+<n0> lgb-<n1> | FIT_RANGE fgb+<n00> lgb-<n01> fgb+<n10> lgb-<n11> ... fgb+<nN0> lgb-<nN1>,";
|
||||
std::cerr << std::endl << ">> with N the number of runs in the msr-file.";
|
||||
@ -596,7 +717,7 @@ Bool_t PFitter::CheckCommands()
|
||||
}
|
||||
} else {
|
||||
std::cerr << std::endl << ">> PFitter::CheckCommands: **ERROR** in line " << it->fLineNo;
|
||||
std::cerr << std::endl << ">> " << it->fLine.Data();
|
||||
std::cerr << std::endl << ">> " << line.Data();
|
||||
std::cerr << std::endl << ">> Syntax: FIT_RANGE RESET | FIT_RANGE <start> <end> | FIT_RANGE <s1> <e1> <s2> <e2> .. <sN> <eN> |";
|
||||
std::cerr << std::endl << ">> FIT_RANGE fgb+<n0> lgb-<n1> | FIT_RANGE fgb+<n00> lgb-<n01> fgb+<n10> lgb-<n11> ... fgb+<nN0> lgb-<nN1>,";
|
||||
std::cerr << std::endl << ">> with N the number of runs in the msr-file.";
|
||||
@ -612,14 +733,14 @@ Bool_t PFitter::CheckCommands()
|
||||
delete tokens;
|
||||
tokens = nullptr;
|
||||
}
|
||||
} else if (it->fLine.Contains("FIX", TString::kIgnoreCase)) {
|
||||
} else if (line.Contains("FIX", TString::kIgnoreCase)) {
|
||||
// check if the given set of parameters (number or names) is present
|
||||
TObjArray *tokens = nullptr;
|
||||
TObjString *ostr;
|
||||
TString str;
|
||||
UInt_t ival;
|
||||
|
||||
tokens = it->fLine.Tokenize(", \t");
|
||||
tokens = line.Tokenize(", \t");
|
||||
|
||||
for (Int_t i=1; i<tokens->GetEntries(); i++) {
|
||||
ostr = dynamic_cast<TObjString*>(tokens->At(i));
|
||||
@ -630,7 +751,7 @@ Bool_t PFitter::CheckCommands()
|
||||
// check that ival is in the parameter list
|
||||
if (ival > fParams.size()) {
|
||||
std::cerr << std::endl << ">> PFitter::CheckCommands: **ERROR** in line " << it->fLineNo;
|
||||
std::cerr << std::endl << ">> " << it->fLine.Data();
|
||||
std::cerr << std::endl << ">> " << line.Data();
|
||||
std::cerr << std::endl << ">> Parameter " << ival << " is out of the Parameter Range [1," << fParams.size() << "]";
|
||||
std::cerr << std::endl;
|
||||
fIsValid = false;
|
||||
@ -651,7 +772,7 @@ Bool_t PFitter::CheckCommands()
|
||||
}
|
||||
if (!found) {
|
||||
std::cerr << std::endl << ">> PFitter::CheckCommands: **ERROR** in line " << it->fLineNo;
|
||||
std::cerr << std::endl << ">> " << it->fLine.Data();
|
||||
std::cerr << std::endl << ">> " << line.Data();
|
||||
std::cerr << std::endl << ">> Parameter '" << str.Data() << "' is NOT present as a parameter name";
|
||||
std::cerr << std::endl;
|
||||
fIsValid = false;
|
||||
@ -673,46 +794,46 @@ Bool_t PFitter::CheckCommands()
|
||||
cmd.first = PMN_FIX;
|
||||
cmd.second = cmdLineNo;
|
||||
fCmdList.push_back(cmd);
|
||||
} else if (it->fLine.Contains("HESSE", TString::kIgnoreCase)) {
|
||||
} else if (line.Contains("HESSE", TString::kIgnoreCase)) {
|
||||
fIsScanOnly = false;
|
||||
cmd.first = PMN_HESSE;
|
||||
cmd.second = cmdLineNo;
|
||||
fCmdList.push_back(cmd);
|
||||
} else if (it->fLine.Contains("MACHINE_PRECISION", TString::kIgnoreCase)) {
|
||||
} else if (line.Contains("MACHINE_PRECISION", TString::kIgnoreCase)) {
|
||||
cmd.first = PMN_MACHINE_PRECISION;
|
||||
cmd.second = cmdLineNo;
|
||||
fCmdList.push_back(cmd);
|
||||
} else if (it->fLine.Contains("MIGRAD", TString::kIgnoreCase)) {
|
||||
} else if (line.Contains("MIGRAD", TString::kIgnoreCase)) {
|
||||
fIsScanOnly = false;
|
||||
cmd.first = PMN_MIGRAD;
|
||||
cmd.second = cmdLineNo;
|
||||
fCmdList.push_back(cmd);
|
||||
} else if (it->fLine.Contains("MINIMIZE", TString::kIgnoreCase)) {
|
||||
} else if (line.Contains("MINIMIZE", TString::kIgnoreCase)) {
|
||||
fIsScanOnly = false;
|
||||
cmd.first = PMN_MINIMIZE;
|
||||
cmd.second = cmdLineNo;
|
||||
fCmdList.push_back(cmd);
|
||||
} else if (it->fLine.Contains("MINOS", TString::kIgnoreCase)) {
|
||||
} else if (line.Contains("MINOS", TString::kIgnoreCase)) {
|
||||
fIsScanOnly = false;
|
||||
cmd.first = PMN_MINOS;
|
||||
cmd.second = cmdLineNo;
|
||||
fCmdList.push_back(cmd);
|
||||
} else if (it->fLine.Contains("MNPLOT", TString::kIgnoreCase)) {
|
||||
} else if (line.Contains("MNPLOT", TString::kIgnoreCase)) {
|
||||
cmd.first = PMN_PLOT;
|
||||
cmd.second = cmdLineNo;
|
||||
fCmdList.push_back(cmd);
|
||||
} else if (it->fLine.Contains("PRINT_LEVEL", TString::kIgnoreCase)) {
|
||||
} else if (line.Contains("PRINT_LEVEL", TString::kIgnoreCase)) {
|
||||
cmd.first = PMN_PRINT;
|
||||
cmd.second = cmdLineNo;
|
||||
fCmdList.push_back(cmd);
|
||||
} else if (it->fLine.Contains("RELEASE", TString::kIgnoreCase)) {
|
||||
} else if (line.Contains("RELEASE", TString::kIgnoreCase)) {
|
||||
// check if the given set of parameters (number or names) is present
|
||||
TObjArray *tokens = nullptr;
|
||||
TObjString *ostr;
|
||||
TString str;
|
||||
UInt_t ival;
|
||||
|
||||
tokens = it->fLine.Tokenize(", \t");
|
||||
tokens = line.Tokenize(", \t");
|
||||
|
||||
for (Int_t i=1; i<tokens->GetEntries(); i++) {
|
||||
ostr = dynamic_cast<TObjString*>(tokens->At(i));
|
||||
@ -723,7 +844,7 @@ Bool_t PFitter::CheckCommands()
|
||||
// check that ival is in the parameter list
|
||||
if (ival > fParams.size()) {
|
||||
std::cerr << std::endl << ">> PFitter::CheckCommands: **ERROR** in line " << it->fLineNo;
|
||||
std::cerr << std::endl << ">> " << it->fLine.Data();
|
||||
std::cerr << std::endl << ">> " << line.Data();
|
||||
std::cerr << std::endl << ">> Parameter " << ival << " is out of the Parameter Range [1," << fParams.size() << "]";
|
||||
std::cerr << std::endl;
|
||||
fIsValid = false;
|
||||
@ -744,7 +865,7 @@ Bool_t PFitter::CheckCommands()
|
||||
}
|
||||
if (!found) {
|
||||
std::cerr << std::endl << ">> PFitter::CheckCommands: **ERROR** in line " << it->fLineNo;
|
||||
std::cerr << std::endl << ">> " << it->fLine.Data();
|
||||
std::cerr << std::endl << ">> " << line.Data();
|
||||
std::cerr << std::endl << ">> Parameter '" << str.Data() << "' is NOT present as a parameter name";
|
||||
std::cerr << std::endl;
|
||||
fIsValid = false;
|
||||
@ -764,15 +885,15 @@ Bool_t PFitter::CheckCommands()
|
||||
cmd.first = PMN_RELEASE;
|
||||
cmd.second = cmdLineNo;
|
||||
fCmdList.push_back(cmd);
|
||||
} else if (it->fLine.Contains("RESTORE", TString::kIgnoreCase)) {
|
||||
} else if (line.Contains("RESTORE", TString::kIgnoreCase)) {
|
||||
cmd.first = PMN_RESTORE;
|
||||
cmd.second = cmdLineNo;
|
||||
fCmdList.push_back(cmd);
|
||||
} else if (it->fLine.Contains("SAVE", TString::kIgnoreCase)) {
|
||||
} else if (line.Contains("SAVE", TString::kIgnoreCase)) {
|
||||
cmd.first = PMN_SAVE;
|
||||
cmd.second = cmdLineNo;
|
||||
fCmdList.push_back(cmd);
|
||||
} else if (it->fLine.Contains("SCAN", TString::kIgnoreCase)) {
|
||||
} else if (line.Contains("SCAN", TString::kIgnoreCase)) {
|
||||
cmd.first = PMN_SCAN;
|
||||
cmd.second = cmdLineNo;
|
||||
fCmdList.push_back(cmd);
|
||||
@ -782,7 +903,7 @@ Bool_t PFitter::CheckCommands()
|
||||
TString str;
|
||||
UInt_t ival;
|
||||
|
||||
tokens = it->fLine.Tokenize(", \t");
|
||||
tokens = line.Tokenize(", \t");
|
||||
|
||||
for (Int_t i=0; i<tokens->GetEntries(); i++) {
|
||||
ostr = dynamic_cast<TObjString*>(tokens->At(i));
|
||||
@ -791,7 +912,7 @@ Bool_t PFitter::CheckCommands()
|
||||
// check that token is a UInt_t
|
||||
if (!str.IsDigit()) {
|
||||
std::cerr << std::endl << ">> PFitter::CheckCommands: **ERROR** in line " << it->fLineNo;
|
||||
std::cerr << std::endl << ">> " << it->fLine.Data();
|
||||
std::cerr << std::endl << ">> " << line.Data();
|
||||
std::cerr << std::endl << ">> parameter number is not number!";
|
||||
std::cerr << std::endl << ">> command syntax for SCAN is: SCAN [parameter no [# of points [low high]]]";
|
||||
std::cerr << std::endl;
|
||||
@ -806,7 +927,7 @@ Bool_t PFitter::CheckCommands()
|
||||
// check that parameter is within range
|
||||
if ((ival < 1) || (ival > fParams.size())) {
|
||||
std::cerr << std::endl << ">> PFitter::CheckCommands: **ERROR** in line " << it->fLineNo;
|
||||
std::cerr << std::endl << ">> " << it->fLine.Data();
|
||||
std::cerr << std::endl << ">> " << line.Data();
|
||||
std::cerr << std::endl << ">> parameter number is out of range [1," << fParams.size() << "]!";
|
||||
std::cerr << std::endl << ">> command syntax for SCAN is: SCAN [parameter no [# of points [low high]]]";
|
||||
std::cerr << std::endl;
|
||||
@ -826,7 +947,7 @@ Bool_t PFitter::CheckCommands()
|
||||
// check that token is a UInt_t
|
||||
if (!str.IsDigit()) {
|
||||
std::cerr << std::endl << ">> PFitter::CheckCommands: **ERROR** in line " << it->fLineNo;
|
||||
std::cerr << std::endl << ">> " << it->fLine.Data();
|
||||
std::cerr << std::endl << ">> " << line.Data();
|
||||
std::cerr << std::endl << ">> number of points is not number!";
|
||||
std::cerr << std::endl << ">> command syntax for SCAN is: SCAN [parameter no [# of points [low high]]]";
|
||||
std::cerr << std::endl;
|
||||
@ -840,7 +961,7 @@ Bool_t PFitter::CheckCommands()
|
||||
ival = str.Atoi();
|
||||
if ((ival < 1) || (ival > 100)) {
|
||||
std::cerr << std::endl << ">> PFitter::CheckCommands: **ERROR** in line " << it->fLineNo;
|
||||
std::cerr << std::endl << ">> " << it->fLine.Data();
|
||||
std::cerr << std::endl << ">> " << line.Data();
|
||||
std::cerr << std::endl << ">> number of scan points is out of range [1,100]!";
|
||||
std::cerr << std::endl << ">> command syntax for SCAN is: SCAN [parameter no [# of points [low high]]]";
|
||||
std::cerr << std::endl;
|
||||
@ -858,7 +979,7 @@ Bool_t PFitter::CheckCommands()
|
||||
// check that token is a Double_t
|
||||
if (!str.IsFloat()) {
|
||||
std::cerr << std::endl << ">> PFitter::CheckCommands: **ERROR** in line " << it->fLineNo;
|
||||
std::cerr << std::endl << ">> " << it->fLine.Data();
|
||||
std::cerr << std::endl << ">> " << line.Data();
|
||||
std::cerr << std::endl << ">> low is not a floating point number!";
|
||||
std::cerr << std::endl << ">> command syntax for SCAN is: SCAN [parameter no [# of points [low high]]]";
|
||||
std::cerr << std::endl;
|
||||
@ -876,7 +997,7 @@ Bool_t PFitter::CheckCommands()
|
||||
// check that token is a Double_t
|
||||
if (!str.IsFloat()) {
|
||||
std::cerr << std::endl << ">> PFitter::CheckCommands: **ERROR** in line " << it->fLineNo;
|
||||
std::cerr << std::endl << ">> " << it->fLine.Data();
|
||||
std::cerr << std::endl << ">> " << line.Data();
|
||||
std::cerr << std::endl << ">> high is not a floating point number!";
|
||||
std::cerr << std::endl << ">> command syntax for SCAN is: SCAN [parameter no [# of points [low high]]]";
|
||||
std::cerr << std::endl;
|
||||
@ -895,16 +1016,16 @@ Bool_t PFitter::CheckCommands()
|
||||
delete tokens;
|
||||
tokens = nullptr;
|
||||
}
|
||||
} else if (it->fLine.Contains("SIMPLEX", TString::kIgnoreCase)) {
|
||||
} else if (line.Contains("SIMPLEX", TString::kIgnoreCase)) {
|
||||
cmd.first = PMN_SIMPLEX;
|
||||
cmd.second = cmdLineNo;
|
||||
fCmdList.push_back(cmd);
|
||||
} else if (it->fLine.Contains("STRATEGY", TString::kIgnoreCase)) {
|
||||
} else if (line.Contains("STRATEGY", TString::kIgnoreCase)) {
|
||||
TObjArray *tokens = nullptr;
|
||||
TObjString *ostr;
|
||||
TString str;
|
||||
|
||||
tokens = it->fLine.Tokenize(" \t");
|
||||
tokens = line.Tokenize(" \t");
|
||||
if (tokens->GetEntries() == 2) {
|
||||
ostr = dynamic_cast<TObjString*>(tokens->At(1));
|
||||
str = ostr->GetString();
|
||||
@ -927,19 +1048,89 @@ Bool_t PFitter::CheckCommands()
|
||||
delete tokens;
|
||||
tokens = nullptr;
|
||||
}
|
||||
} else if (it->fLine.Contains("USER_COVARIANCE", TString::kIgnoreCase)) {
|
||||
} else if (line.Contains("USER_COVARIANCE", TString::kIgnoreCase)) {
|
||||
cmd.first = PMN_USER_COVARIANCE;
|
||||
cmd.second = cmdLineNo;
|
||||
fCmdList.push_back(cmd);
|
||||
} else if (it->fLine.Contains("USER_PARAM_STATE", TString::kIgnoreCase)) {
|
||||
} else if (line.Contains("USER_PARAM_STATE", TString::kIgnoreCase)) {
|
||||
cmd.first = PMN_USER_PARAM_STATE;
|
||||
cmd.second = cmdLineNo;
|
||||
fCmdList.push_back(cmd);
|
||||
} else if (line.Contains("SECTOR", TString::kIgnoreCase)) {
|
||||
cmd.first = PMN_SECTOR;
|
||||
cmd.second = cmdLineNo;
|
||||
fCmdList.push_back(cmd);
|
||||
|
||||
// check if the given sector arguments are valid time stamps, i.e. doubles and value < lgb time stamp
|
||||
TObjArray *tokens = nullptr;
|
||||
TObjString *ostr;
|
||||
TString str;
|
||||
|
||||
tokens = line.Tokenize(" ,\t");
|
||||
|
||||
if (tokens->GetEntries() == 1) { // no sector time stamps given -> issue an error
|
||||
std::cerr << std::endl << ">> PFitter::CheckCommands(): **FATAL ERROR** in line " << it->fLineNo;
|
||||
std::cerr << std::endl << ">> " << line.Data();
|
||||
std::cerr << std::endl << ">> At least one sector time stamp is expected.";
|
||||
std::cerr << std::endl << ">> Will stop ...";
|
||||
std::cerr << std::endl;
|
||||
// cleanup
|
||||
if (tokens) {
|
||||
delete tokens;
|
||||
tokens = nullptr;
|
||||
}
|
||||
fIsValid = false;
|
||||
break;
|
||||
}
|
||||
|
||||
Double_t dval;
|
||||
for (Int_t i=1; i<tokens->GetEntries(); i++) {
|
||||
ostr = dynamic_cast<TObjString*>(tokens->At(i));
|
||||
str = ostr->GetString();
|
||||
if (str.IsFloat()) {
|
||||
dval = str.Atof();
|
||||
// check that the sector time stamp is smaller than all lgb time stamps
|
||||
for (UInt_t j=0; j<fOriginalFitRange.size(); j++) {
|
||||
if (dval > fOriginalFitRange[j].second) {
|
||||
std::cerr << std::endl << ">> PFitter::CheckCommands(): **FATAL ERROR** in line " << it->fLineNo;
|
||||
std::cerr << std::endl << ">> " << line.Data();
|
||||
std::cerr << std::endl << ">> The sector time stamp " << dval << " is > as the lgb time stamp (" << fOriginalFitRange[j].second << ") of run " << j << ".";
|
||||
std::cerr << std::endl << ">> Will stop ...";
|
||||
std::cerr << std::endl;
|
||||
// cleanup
|
||||
if (tokens) {
|
||||
delete tokens;
|
||||
tokens = nullptr;
|
||||
}
|
||||
fIsValid = false;
|
||||
return fIsValid;
|
||||
}
|
||||
}
|
||||
} else { // sector element is NOT a float
|
||||
std::cerr << std::endl << ">> PFitter::CheckCommands(): **FATAL ERROR** in line " << it->fLineNo;
|
||||
std::cerr << std::endl << ">> " << line.Data();
|
||||
std::cerr << std::endl << ">> The sector time stamp '" << str << "' is not a number.";
|
||||
std::cerr << std::endl << ">> Will stop ...";
|
||||
std::cerr << std::endl;
|
||||
// cleanup
|
||||
if (tokens) {
|
||||
delete tokens;
|
||||
tokens = nullptr;
|
||||
}
|
||||
fIsValid = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (tokens) {
|
||||
delete tokens;
|
||||
tokens = nullptr;
|
||||
}
|
||||
} else { // unkown command
|
||||
std::cerr << std::endl << ">> PFitter::CheckCommands(): **FATAL ERROR** in line " << it->fLineNo << " an unkown command is found:";
|
||||
std::cerr << std::endl << ">> " << it->fLine.Data();
|
||||
std::cerr << std::endl << ">> Will stop ...";
|
||||
std::cerr << std::endl;
|
||||
std::cerr << std::endl << ">> PFitter::CheckCommands(): **FATAL ERROR** in line " << it->fLineNo << " an unkown command is found:";
|
||||
std::cerr << std::endl << ">> " << line.Data();
|
||||
std::cerr << std::endl << ">> Will stop ...";
|
||||
std::cerr << std::endl;
|
||||
fIsValid = false;
|
||||
break;
|
||||
}
|
||||
@ -951,17 +1142,17 @@ Bool_t PFitter::CheckCommands()
|
||||
Bool_t releaseFlag = false;
|
||||
Bool_t minimizerFlag = false;
|
||||
for (it = fCmdLines.begin(); it != fCmdLines.end(); ++it) {
|
||||
if (it->fLine.Contains("FIX", TString::kIgnoreCase))
|
||||
if (line.Contains("FIX", TString::kIgnoreCase))
|
||||
fixFlag = true;
|
||||
else if (it->fLine.Contains("RELEASE", TString::kIgnoreCase) ||
|
||||
it->fLine.Contains("RESTORE", TString::kIgnoreCase))
|
||||
else if (line.Contains("RELEASE", TString::kIgnoreCase) ||
|
||||
line.Contains("RESTORE", TString::kIgnoreCase))
|
||||
releaseFlag = true;
|
||||
else if (it->fLine.Contains("MINIMIZE", TString::kIgnoreCase) ||
|
||||
it->fLine.Contains("MIGRAD", TString::kIgnoreCase) ||
|
||||
it->fLine.Contains("SIMPLEX", TString::kIgnoreCase)) {
|
||||
else if (line.Contains("MINIMIZE", TString::kIgnoreCase) ||
|
||||
line.Contains("MIGRAD", TString::kIgnoreCase) ||
|
||||
line.Contains("SIMPLEX", TString::kIgnoreCase)) {
|
||||
if (releaseFlag)
|
||||
minimizerFlag = true;
|
||||
} else if (it->fLine.Contains("MINOS", TString::kIgnoreCase)) {
|
||||
} else if (line.Contains("MINOS", TString::kIgnoreCase)) {
|
||||
if (fixFlag && releaseFlag && !minimizerFlag) {
|
||||
std::cerr << std::endl << ">> PFitter::CheckCommands(): **WARNING** RELEASE/RESTORE command present";
|
||||
std::cerr << std::endl << ">> without minimizer command (MINIMIZE/MIGRAD/SIMPLEX) between";
|
||||
@ -2118,7 +2309,22 @@ Bool_t PFitter::ExecuteSimplex()
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// MilliTime (private)
|
||||
// ExecuteSector
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Collects all the necessary chisq/maxLH for the given sectors.
|
||||
*
|
||||
* <b>return:</b> if the sector command was successful, otherwise return flase.
|
||||
*/
|
||||
Bool_t PFitter::ExecuteSector()
|
||||
{
|
||||
// NOT YET IMPLEMENTED //as35
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// MilliTime
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
|
@ -61,7 +61,44 @@
|
||||
#define PMN_USER_COVARIANCE 17
|
||||
#define PMN_USER_PARAM_STATE 18
|
||||
#define PMN_PRINT 19
|
||||
#define PMN_SECTOR 20
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>The PSectorChisq class is needed to store the chisq/maxLH of a sector.
|
||||
* A sector is a time window from fgb to fLast (fLast < lgb). It also stores
|
||||
* these information for each run of the msr-file.
|
||||
*/
|
||||
class PSectorChisq
|
||||
{
|
||||
public:
|
||||
PSectorChisq(UInt_t noOfRuns);
|
||||
|
||||
void SetTimeRange(Double_t first, Double_t last);
|
||||
void SetChisq(Double_t chisq) { fChisq = chisq; }
|
||||
void SetChisq(Double_t chisq, UInt_t idx);
|
||||
void SetNDF(Double_t ndf) { fNDF = ndf; }
|
||||
void SetNDF(Double_t ndf, UInt_t idx);
|
||||
|
||||
Double_t GetTimeRangeFirst() { return fFirst; }
|
||||
Double_t GetTimeRangeLast() { return fLast; }
|
||||
Double_t GetChisq() { return fChisq; }
|
||||
UInt_t GetNDF() { return fNDF; }
|
||||
UInt_t GetNoRuns() { return fNoOfRuns; }
|
||||
Double_t GetChisq(UInt_t idx);
|
||||
UInt_t GetNDF(UInt_t idx);
|
||||
|
||||
private:
|
||||
UInt_t fNoOfRuns; ///< number of runs presesent
|
||||
Double_t fFirst; ///< time stamp for fgb
|
||||
Double_t fLast; ///< requested time stamp
|
||||
Double_t fChisq; ///< chisq or maxLH for the sector
|
||||
UInt_t fNDF; ///< NDF for the sector
|
||||
std::vector<Double_t> fChisqRun; ///< chisq or maxLH for the sector and run
|
||||
std::vector<UInt_t> fNDFRun; ///< NDF for the sector and run
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Interface class to minuit2.
|
||||
*/
|
||||
@ -114,6 +151,8 @@ class PFitter
|
||||
|
||||
PStringVector fElapsedTime;
|
||||
|
||||
std::vector<PSectorChisq> fSector; ///< stores all chisq/maxLH sector information
|
||||
|
||||
// commands
|
||||
Bool_t CheckCommands();
|
||||
Bool_t SetParameters();
|
||||
@ -132,6 +171,7 @@ class PFitter
|
||||
Bool_t ExecuteScan();
|
||||
Bool_t ExecuteSave(Bool_t first);
|
||||
Bool_t ExecuteSimplex();
|
||||
Bool_t ExecuteSector();
|
||||
|
||||
Double_t MilliTime();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user