Skip to content
Snippets Groups Projects
Commit 64a36ce5 authored by Bertram Kopf's avatar Bertram Kopf
Browse files

major changes II

parents 7db1ecc4 69a83e2f
No related branches found
No related tags found
No related merge requests found
...@@ -49,6 +49,9 @@ int main(int __argc,char *__argv[]){ ...@@ -49,6 +49,9 @@ int main(int __argc,char *__argv[]){
clock_t start, end; clock_t start, end;
start= clock(); start= clock();
// Disable output buffering
setvbuf(stdout, NULL, _IONBF, 0);
// Parse the command line // Parse the command line
static pbarpParser theAppParams(__argc, __argv); static pbarpParser theAppParams(__argc, __argv);
...@@ -155,11 +158,12 @@ int main(int __argc,char *__argv[]){ ...@@ -155,11 +158,12 @@ int main(int __argc,char *__argv[]){
std::string paramStreamerPath=theAppParams.fitParamFile(); std::string paramStreamerPath=theAppParams.fitParamFile();
std::string outputFileNameSuffix=theAppParams.outputFileNameSuffix();
StreamFitParmsBase theParamStreamer(paramStreamerPath, theLhPtr); StreamFitParmsBase theParamStreamer(paramStreamerPath, theLhPtr);
fitParams theStartparams=theParamStreamer.getFitParamVal(); fitParams theStartparams=theParamStreamer.getFitParamVal();
fitParams theErrorparams=theParamStreamer.getFitParamErr(); fitParams theErrorparams=theParamStreamer.getFitParamErr();
PwaFcnBase theFcn(theLhPtr, theFitParamBase); PwaFcnBase theFcn(theLhPtr, theFitParamBase, outputFileNameSuffix);
MnUserParameters upar; MnUserParameters upar;
theFitParamBase->setMnUsrParams(upar, theStartparams, theErrorparams); theFitParamBase->setMnUsrParams(upar, theStartparams, theErrorparams);
...@@ -181,7 +185,7 @@ int main(int __argc,char *__argv[]){ ...@@ -181,7 +185,7 @@ int main(int __argc,char *__argv[]){
double theLh=theLhPtr->calcLogLh(theStartparams); double theLh=theLhPtr->calcLogLh(theStartparams);
Info <<"theLh = "<< theLh << endmsg; Info <<"theLh = "<< theLh << endmsg;
pbarpHist theHist(theLhPtr, theStartparams); pbarpHist theHist(theLhPtr, theStartparams, outputFileNameSuffix);
double evtWeightSumData = pbarpEventListPtr->NoOfWeightedDataEvts(); double evtWeightSumData = pbarpEventListPtr->NoOfWeightedDataEvts();
double BICcriterion=2.*theLh+noOfFreeFitParams*log(evtWeightSumData); double BICcriterion=2.*theLh+noOfFreeFitParams*log(evtWeightSumData);
...@@ -194,8 +198,10 @@ int main(int __argc,char *__argv[]){ ...@@ -194,8 +198,10 @@ int main(int __argc,char *__argv[]){
Info << "AIC:\t" << AICcriterion << endmsg; Info << "AIC:\t" << AICcriterion << endmsg;
Info << "AICc:\t" << AICccriterion << endmsg; Info << "AICc:\t" << AICccriterion << endmsg;
std::string qaSummaryFileName = "qaSummary.dat"; std::ostringstream qaSummaryFileName;
std::ofstream theQaStream ( qaSummaryFileName.c_str() ); qaSummaryFileName << "qaSummary" << outputFileNameSuffix << ".dat";
std::ofstream theQaStream ( qaSummaryFileName.str().c_str() );
theQaStream << "BIC\t" << BICcriterion << "\n"; theQaStream << "BIC\t" << BICcriterion << "\n";
theQaStream << "AICa\t" << AICcriterion << "\n"; theQaStream << "AICa\t" << AICcriterion << "\n";
theQaStream << "AICc\t" << AICccriterion << "\n"; theQaStream << "AICc\t" << AICccriterion << "\n";
...@@ -245,9 +251,10 @@ int main(int __argc,char *__argv[]){ ...@@ -245,9 +251,10 @@ int main(int __argc,char *__argv[]){
fitParams finalFitErrs=theErrorparams; fitParams finalFitErrs=theErrorparams;
theFitParamBase->getFitParamVal(finalParamErrorVec, finalFitErrs); theFitParamBase->getFitParamVal(finalParamErrorVec, finalFitErrs);
std::string finalResultname = "finalResult.dat"; std::ostringstream finalResultname;
std::ofstream theStream ( finalResultname.c_str() ); finalResultname << "finalResult" << outputFileNameSuffix << ".dat";
//std::ofstream theStream ( "finalResult.dat");
std::ofstream theStream ( finalResultname.str().c_str() );
theFitParamBase->dumpParams(theStream, finalFitParams, finalFitErrs); theFitParamBase->dumpParams(theStream, finalFitParams, finalFitErrs);
MnUserCovariance theCovMatrix = min.UserCovariance(); MnUserCovariance theCovMatrix = min.UserCovariance();
......
...@@ -16,6 +16,7 @@ ParserBase::ParserBase(int argc,char **argv) ...@@ -16,6 +16,7 @@ ParserBase::ParserBase(int argc,char **argv)
, _paramFile("") , _paramFile("")
, _startHypo("base") , _startHypo("base")
, _mode("plotmode") , _mode("plotmode")
, _outputFileNameSuffix("")
, _verbose(true) , _verbose(true)
, _noOfThreads(16) , _noOfThreads(16)
, _ratioMcToData(100000) , _ratioMcToData(100000)
...@@ -52,6 +53,7 @@ ParserBase::ParserBase(int argc,char **argv) ...@@ -52,6 +53,7 @@ ParserBase::ParserBase(int argc,char **argv)
("ratioMcToData",po::value<int>(&_ratioMcToData), "number of MC events defined by ratio #MCs/#Data") ("ratioMcToData",po::value<int>(&_ratioMcToData), "number of MC events defined by ratio #MCs/#Data")
("cacheAmps",po::value<bool>(&_cacheAmps), "cache amplitudes") ("cacheAmps",po::value<bool>(&_cacheAmps), "cache amplitudes")
("useEventWeight",po::value<bool>(&_useEvtWeight), "enable/disable input for event weight") ("useEventWeight",po::value<bool>(&_useEvtWeight), "enable/disable input for event weight")
("name",po::value<string>(&_outputFileNameSuffix), "name that is attached to all otuput file names")
; ;
_config->add_options() _config->add_options()
......
...@@ -41,6 +41,7 @@ public: ...@@ -41,6 +41,7 @@ public:
const std::string dataFile() const {return _dataFile;} const std::string dataFile() const {return _dataFile;}
const std::string mcFile() const {return _mcFile;} const std::string mcFile() const {return _mcFile;}
const std::string fitParamFile() const {return _paramFile;} const std::string fitParamFile() const {return _paramFile;}
const std::string outputFileNameSuffix() const {return _outputFileNameSuffix;}
const std::vector<std::string>& enabledHyps() const { return _enabledHyps; } const std::vector<std::string>& enabledHyps() const { return _enabledHyps; }
const std::string startHypo() const {return _startHypo;} const std::string startHypo() const {return _startHypo;}
const std::string mode() const {return _mode;} const std::string mode() const {return _mode;}
...@@ -60,6 +61,7 @@ protected: ...@@ -60,6 +61,7 @@ protected:
std::string _paramFile; std::string _paramFile;
std::string _startHypo; std::string _startHypo;
std::string _mode; std::string _mode;
std::string _outputFileNameSuffix;
std::vector<std::string> _enabledHyps; std::vector<std::string> _enabledHyps;
std::vector<std::string> _mnParFixs; std::vector<std::string> _mnParFixs;
bool _verbose; bool _verbose;
......
...@@ -34,10 +34,10 @@ PwaFcnBase::~PwaFcnBase() ...@@ -34,10 +34,10 @@ PwaFcnBase::~PwaFcnBase()
double PwaFcnBase::operator()(const std::vector<double>& par) const double PwaFcnBase::operator()(const std::vector<double>& par) const
{ {
fitParams theFitParmValTmp=_defaultFitValParms; fitParams theFitParmValTmp=_defaultFitValParms;
#ifdef _OPENMP #ifdef _OPENMP
#pragma omp critical #pragma omp critical
{ {
...@@ -66,7 +66,7 @@ double PwaFcnBase::operator()(const std::vector<double>& par) const ...@@ -66,7 +66,7 @@ double PwaFcnBase::operator()(const std::vector<double>& par) const
if ( _fcnCounter%200 == 0) { if ( _fcnCounter%200 == 0) {
std::ofstream theStream (_currentResFileName.c_str()); std::ofstream theStream (_currentResFileName.c_str());
_fitParamsBasePtr->dumpParams(theStream, theFitParmValTmp, theFitParmValTmp); _fitParamsBasePtr->dumpParams(theStream, theFitParmValTmp, (fitParams&)_defaultFitErrParms);
} }
#ifdef _OPENMP #ifdef _OPENMP
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment