diff --git a/src/ToDo.txt b/src/ToDo.txt index 4d0e636b..14504ad3 100644 --- a/src/ToDo.txt +++ b/src/ToDo.txt @@ -52,8 +52,7 @@ short term: * something is strange with the coordinate system in TPaveText! **CHECK** -* check problem with the mathmore implementation of 1F1(m;n;z) - 2008-04-07 cannot reproduce Bastians problem!?!?! +* need a CLEAN concept for handling data/theory generation for kView!! --------------------- intermediate term: diff --git a/src/classes/PMsrHandler.cpp b/src/classes/PMsrHandler.cpp index 708875e1..57ceb0b5 100644 --- a/src/classes/PMsrHandler.cpp +++ b/src/classes/PMsrHandler.cpp @@ -134,7 +134,7 @@ int PMsrHandler::ReadMsrFile() current.fLineNo = line_no; current.fLine = line; - if (line.BeginsWith("#")) { // if the line is not a comment line keep it + if (line.BeginsWith("#") || line.IsWhitespace()) { // if the line is a comment/empty line keep it fComments.push_back(current); continue; } @@ -270,8 +270,6 @@ int PMsrHandler::WriteMsrLogFile() tokens = 0; } -//cout << endl << "log file name = " << str.Data() << endl << endl; - ofstream f; // open mlog-file @@ -281,20 +279,16 @@ int PMsrHandler::WriteMsrLogFile() } // write mlog-file - int lineNo = 1; // write title f << fTitle.Data(); CheckAndWriteComment(f, ++lineNo); -// f << endl << "###############################################################"; // write fit parameter block f << endl << "FITPARAMETER"; CheckAndWriteComment(f, ++lineNo); -// f << endl << "# No Name Value Step Pos_Error Boundaries"; f << endl; - CheckAndWriteComment(f, ++lineNo); PMsrParamList::iterator param_iter; for (param_iter = fParam.begin(); param_iter != fParam.end(); ++param_iter) { // parameter no @@ -336,11 +330,10 @@ int PMsrHandler::WriteMsrLogFile() f << left << param_iter->fUpperBoundary; f << " "; } - // terminate line + // terminate parameter line f << endl; CheckAndWriteComment(f, ++lineNo); } -// f << endl << "###############################################################"; // write theory block PMsrLines::iterator theo_iter; @@ -348,9 +341,6 @@ int PMsrHandler::WriteMsrLogFile() f << endl << theo_iter->fLine.Data(); CheckAndWriteComment(f, ++lineNo); } - f << endl; - CheckAndWriteComment(f, ++lineNo); -// f << endl << "###############################################################"; // write functions block f << endl << "FUNCTIONS"; @@ -361,9 +351,6 @@ int PMsrHandler::WriteMsrLogFile() f << endl << str.Data(); CheckAndWriteComment(f, ++lineNo); } - f << endl; - CheckAndWriteComment(f, ++lineNo); -// f << endl << "###############################################################"; // write run block PMsrRunList::iterator run_iter; @@ -586,11 +573,7 @@ int PMsrHandler::WriteMsrLogFile() f << endl << left << "packing"; f << run_iter->fPacking; CheckAndWriteComment(f, ++lineNo); - // run block done - f << endl; - CheckAndWriteComment(f, ++lineNo); } -// f << endl << "###############################################################"; // write command block f << endl << "COMMANDS"; @@ -600,9 +583,6 @@ int PMsrHandler::WriteMsrLogFile() f << endl << cmd_iter->fLine.Data(); CheckAndWriteComment(f, ++lineNo); } - f << endl; - CheckAndWriteComment(f, ++lineNo); -// f << endl << "###############################################################"; // write plot block PMsrPlotList::iterator plot_iter; @@ -646,10 +626,7 @@ int PMsrHandler::WriteMsrLogFile() f << " " << plot_iter->fYmin << " " << plot_iter->fYmax; } CheckAndWriteComment(f, ++lineNo); - f << endl; - CheckAndWriteComment(f, ++lineNo); } -// f << endl << "###############################################################"; // write statistic block TDatime dt; @@ -684,10 +661,6 @@ int PMsrHandler::WriteMsrLogFile() f << endl << stat_iter->fLine.Data(); CheckAndWriteComment(f, ++lineNo); } - f << endl; - CheckAndWriteComment(f, ++lineNo); -// f << endl << "###############################################################"; - // close mlog-file f.close(); diff --git a/src/classes/PMusrCanvas.cpp b/src/classes/PMusrCanvas.cpp index d4473aae..25a3c0c3 100644 --- a/src/classes/PMusrCanvas.cpp +++ b/src/classes/PMusrCanvas.cpp @@ -685,8 +685,8 @@ void PMusrCanvas::HandleSingleHistoDataSet(unsigned int runNo, PRunData *data) // fill histogram int pack = fMsrHandler->GetMsrRunList()->at(runNo).fPacking; for (unsigned int i=0; ifValue.size(); i++) { - dataHisto->SetBinContent(i, pack*data->fValue[i]); - dataHisto->SetBinError(i, TMath::Sqrt(pack)*data->fError[i]); + dataHisto->SetBinContent(i, data->fValue[i]); + dataHisto->SetBinError(i, data->fError[i]); } } @@ -717,6 +717,8 @@ void PMusrCanvas::HandleSingleHistoDataSet(unsigned int runNo, PRunData *data) start = data->fTheoryTimeStart; end = data->fTheoryTimeStart + (data->fTheory.size()-1)*data->fTheoryTimeStep; +cout << endl << ">> start = " << start << ", end = " << end << endl; + // invoke histo theoHisto = new TH1F(name, name, data->fTheory.size(), start, end); @@ -728,8 +730,8 @@ void PMusrCanvas::HandleSingleHistoDataSet(unsigned int runNo, PRunData *data) } else { // no lifetimecorrection // fill histogram int pack = fMsrHandler->GetMsrRunList()->at(runNo).fPacking; - for (unsigned int i=0; ifValue.size(); i++) { - theoHisto->SetBinContent(i, pack*data->fTheory[i]); + for (unsigned int i=0; ifTheory.size(); i++) { + theoHisto->SetBinContent(i, data->fTheory[i]); } } diff --git a/src/classes/PRunSingleHisto.cpp b/src/classes/PRunSingleHisto.cpp index cbaf5751..95eb8b27 100644 --- a/src/classes/PRunSingleHisto.cpp +++ b/src/classes/PRunSingleHisto.cpp @@ -257,9 +257,38 @@ void PRunSingleHisto::CalcTheory() } // calculate theory + unsigned int size; + double start; + double resolution; double time; - for (unsigned int i=0; iGetRunData(fRunInfo->fRunName); + if (fRunInfo->fFileFormat.Contains("ppc")) { + histoNo = runData->fDataBin.size()/2 + fRunInfo->fForwardHistoNo-1; + } else { + histoNo = fRunInfo->fForwardHistoNo-1; + } + size = runData->fDataBin[histoNo].size(); + start = -fT0s[0]*fTimeResolution; + resolution = fTimeResolution; + fData.fTheoryTimeStart = start; + fData.fTheoryTimeStep = resolution; + break; + case kEmpty: + default: + size = -1; + break; + } + for (unsigned int i=0; iFunc(time, par, fFuncValues))+bkg); } @@ -382,7 +411,7 @@ bool PRunSingleHisto::PrepareData() } // everything looks fine, hence fill data set - double value = 0.0; + double value = 0.0; // data start at data_start-t0 // time shifted so that packing is included correctly, i.e. t0 == t0 after packing fData.fDataTimeStart = fTimeResolution*(((double)start-t0)+(double)fRunInfo->fPacking/2.0); @@ -412,28 +441,8 @@ bool PRunSingleHisto::PrepareData() } // fill theory vector for kView - if (kView) { - // feed the parameter vector - std::vector par; - PMsrParamList *paramList = fMsrInfo->GetMsrParamList(); - for (unsigned int i=0; isize(); i++) - par.push_back((*paramList)[i].fValue); - - - fData.fTheoryTimeStart = -t0*fTimeResolution; - fData.fTheoryTimeStep = fTimeResolution; - for (unsigned int i=0; ifDataBin[histoNo].size(); i++) { - if ((int)i-(int)t0 < 0) { - fData.fTheory.push_back(0.0); - } else { - time = fData.fTheoryTimeStart + i*fTimeResolution; - value = fTheory->Func(time, par, fFuncValues); - fData.fTheory.push_back(value); - } - } - - // clean up - par.clear(); + if (fHandleTag == kView) { + CalcTheory(); } return true; diff --git a/src/musrview.cpp b/src/musrview.cpp index b2a48b55..25e6df64 100644 --- a/src/musrview.cpp +++ b/src/musrview.cpp @@ -55,7 +55,7 @@ using namespace std; void musrview_syntax() { cout << endl << "usage: musrview | --version | --help"; - cout << endl << " : msr input file"; + cout << endl << " : msr/mlog input file"; cout << endl << " 'musrview ' will execute msrfit"; cout << endl << " 'musrview' or 'msrfit --help' will show this help"; cout << endl << " 'musrview --version' will print the msrfit version"; @@ -81,9 +81,9 @@ int main(int argc, char *argv[]) } else if (strstr(argv[1], "--help")) { show_syntax = true; } else { - // check if filename has extension msr - if (!strstr(argv[1], ".msr")) { - cout << endl << "**ERROR** " << argv[1] << " is not a msr-file!" << endl; + // check if filename has extension msr or mlog + if (!strstr(argv[1], ".msr") && !strstr(argv[1], ".mlog")) { + cout << endl << "**ERROR** " << argv[1] << " is not a msr/mlog-file!" << endl; show_syntax = true; } }