37 #include <TObjArray.h> 38 #include <TObjString.h> 53 fFourierOnly(fourierOnly), fStartupOptions(startupOptions), fFileName(fileName)
72 while (
fFileName.Index(
"/", idx+1) != -1) {
136 f.open(
fFileName.Data(), std::iostream::in);
152 current.
fLine = line;
154 if (line.BeginsWith(
"#") || line.IsWhitespace()) {
159 line.Remove(TString::kLeading,
' ');
161 if (!line.IsWhitespace()) {
165 }
else if (line.BeginsWith(
"FITPARAMETER")) {
167 }
else if (line.BeginsWith(
"THEORY")) {
169 theory.push_back(current);
170 }
else if (line.BeginsWith(
"FUNCTIONS")) {
172 functions.push_back(current);
173 }
else if (line.BeginsWith(
"GLOBAL")) {
175 global.push_back(current);
176 }
else if (line.BeginsWith(
"RUN")) {
178 run.push_back(current);
179 }
else if (line.BeginsWith(
"COMMANDS")) {
181 commands.push_back(current);
182 }
else if (line.BeginsWith(
"FOURIER")) {
184 fourier.push_back(current);
185 }
else if (line.BeginsWith(
"PLOT")) {
187 plot.push_back(current);
188 }
else if (line.BeginsWith(
"STATISTIC")) {
190 statistic.push_back(current);
195 fit_parameter.push_back(current);
198 theory.push_back(current);
201 functions.push_back(current);
204 global.push_back(current);
207 run.push_back(current);
210 commands.push_back(current);
213 fourier.push_back(current);
216 plot.push_back(current);
219 statistic.push_back(current);
261 for (UInt_t i=0; i<
fCommands.size(); i++) {
262 if (
fCommands[i].fLine.Contains(
"MAX_LIKELIHOOD"))
279 std::cerr << std::endl <<
">> PMsrHandler::ReadMsrFile: **SEVERE ERROR** parameter name " <<
fParam[parX].fName.Data() <<
" is identical for parameter no " <<
fParam[parX].fNo <<
" and " <<
fParam[parY].fNo <<
"!";
280 std::cerr << std::endl <<
">> Needs to be fixed first!";
281 std::cerr << std::endl;
322 std::cerr << std::endl <<
">> PMsrHandler::ReadMsrFile: **ERROR** if more than one phase is given in the Fourier block,";
323 std::cerr << std::endl <<
">> it needs to correspond to the number of runs in the Plot block!" << std::endl;
329 fit_parameter.clear();
358 const UInt_t prec = 6;
359 UInt_t neededPrec = 0;
360 UInt_t neededWidth = 9;
362 Int_t tag, lineNo = 0, number;
363 Int_t runNo = -1, addRunNo = 0;
366 TString logFileName, str, sstr, *pstr;
367 TObjArray *tokens =
nullptr;
368 TObjString *ostr =
nullptr;
369 Bool_t found =
false;
370 Bool_t statisticBlockFound =
false;
371 Bool_t partialStatisticBlockFound =
true;
374 for (UInt_t i=0; i<
fRuns.size(); i++) {
375 t0TagMissing.push_back(
true);
377 std::vector<PBoolVector> addt0TagMissing;
379 for (UInt_t i=0; i<
fRuns.size(); i++) {
381 for (UInt_t j=0; j<
fRuns[i].GetAddT0BinEntries(); j++)
382 bvec.push_back(
true);
383 addt0TagMissing.push_back(bvec);
386 for (UInt_t i=0; i<
fRuns.size(); i++) {
387 backgroundTagMissing.push_back(
true);
390 for (UInt_t i=0; i<
fRuns.size(); i++) {
391 dataTagMissing.push_back(
true);
395 Int_t addT0Counter = 0;
396 Int_t addT0GlobalCounter = 0;
403 fin.open(
fFileName.Data(), std::iostream::in);
404 if (!fin.is_open()) {
412 if (str.BeginsWith(
"RUN")) {
420 if (str.BeginsWith(
"t0"))
421 t0TagMissing[runNo] =
false;
422 else if (str.BeginsWith(
"background"))
423 backgroundTagMissing[runNo] =
false;
424 else if (str.BeginsWith(
"data"))
425 dataTagMissing[runNo] =
false;
432 while (
fFileName.Index(
".", idx+1) != -1) {
440 logFileName.Remove(idx+1);
441 logFileName +=
"mlog";
444 fin.open(
fFileName.Data(), std::iostream::in);
445 if (!fin.is_open()) {
450 fout.open(logFileName.Data(), std::iostream::out);
451 if (!fout.is_open()) {
467 if (str.BeginsWith(
"FITPARAMETER")) {
469 }
else if (str.BeginsWith(
"THEORY")) {
471 fout << str.Data() << std::endl;
473 }
else if (str.BeginsWith(
"FUNCTIONS")) {
475 fout << str.Data() << std::endl;
477 }
else if (str.BeginsWith(
"GLOBAL")) {
479 fout << str.Data() << std::endl;
481 }
else if (str.BeginsWith(
"RUN")) {
486 }
else if (str.BeginsWith(
"COMMANDS")) {
488 fout << str.Data() << std::endl;
490 }
else if (str.BeginsWith(
"FOURIER")) {
492 fout << str.Data() << std::endl;
494 }
else if (str.BeginsWith(
"PLOT")) {
497 }
else if (str.BeginsWith(
"STATISTIC")) {
505 fout <<
fTitle.Data() << std::endl;
507 fout << str.Data() << std::endl;
510 tokens = str.Tokenize(
" \t");
511 if (tokens->GetEntries() == 0) {
512 fout << str.Data() << std::endl;
514 ostr =
dynamic_cast<TObjString*
>(tokens->At(0));
515 sstr = ostr->GetString();
516 if (sstr.IsDigit()) {
517 number = sstr.Atoi();
520 assert ((number >= 0) && (number < (Int_t)
fParam.size()));
523 fout << std::right <<
fParam[number].fNo;
527 fout << std::left <<
fParam[number].fName.Data();
530 if (
fParam[number].fStep == 0.0)
539 neededWidth = neededPrec + 3;
540 fout.width(neededWidth);
541 fout.setf(std::ios::fixed, std::ios::floatfield);
542 fout.precision(neededPrec);
543 fout << std::left <<
fParam[number].fValue;
547 fout.setf(std::ios::fixed);
548 if (
fParam[number].fStep == 0.0)
550 fout.precision(neededPrec);
551 fout << std::left <<
fParam[number].fStep;
554 fout.setf(std::ios::fixed);
555 fout.precision(neededPrec);
556 if ((
fParam[number].fNoOfParams == 5) || (
fParam[number].fNoOfParams == 7))
557 if (
fParam[number].fPosErrorPresent && (
fParam[number].fStep != 0))
558 fout << std::left <<
fParam[number].fPosError;
560 fout << std::left <<
"none";
562 fout << std::left <<
"none";
564 fout.unsetf(std::ios::floatfield);
566 if (
fParam[number].fNoOfParams > 5) {
568 fout.precision(prec);
569 if (
fParam[number].fLowerBoundaryPresent)
570 fout << std::left <<
fParam[number].fLowerBoundary;
572 fout << std::left <<
"none";
575 fout.precision(prec);
576 if (
fParam[number].fUpperBoundaryPresent)
577 fout << std::left <<
fParam[number].fUpperBoundary;
579 fout << std::left <<
"none";
584 fout << str.Data() << std::endl;
592 for (UInt_t i=0; i<
fTheory.size(); i++) {
593 if (
fTheory[i].fLineNo == lineNo) {
594 fout <<
fTheory[i].fLine.Data() << std::endl;
599 fout << str.Data() << std::endl;
604 sstr.Remove(TString::kLeading,
' ');
605 if (str.BeginsWith(
"fun")) {
610 fout << sstr.Data() << std::endl;
613 fout << str.Data() << std::endl;
618 if (sstr.BeginsWith(
"fittype")) {
628 fout << std::left <<
"fittype" <<
MSR_FITTYPE_ASYM <<
" (asymmetry fit)" << std::endl ;
637 fout << std::left <<
"fittype" <<
MSR_FITTYPE_BNMR <<
" (beta-NMR fit)" << std::endl ;
647 fout << std::left <<
"rrf_freq ";
650 fout.precision(neededPrec);
656 fout <<
"rrf_phase ";
662 fout <<
"rrf_packing ";
666 }
else if (sstr.BeginsWith(
"data")) {
668 fout << std::left <<
"data";
669 for (UInt_t j=0; j<4; j++) {
676 }
else if (sstr.BeginsWith(
"t0")) {
678 fout << std::left <<
"t0";
682 fout.setf(std::ios::fixed,std::ios::floatfield);
686 }
else if (sstr.BeginsWith(
"addt0")) {
688 fout << std::left <<
"addt0";
692 fout.setf(std::ios::fixed,std::ios::floatfield);
696 addT0GlobalCounter++;
697 }
else if (sstr.BeginsWith(
"fit")) {
699 fout << std::left <<
"fit";
710 fout.precision(neededPrec);
713 for (UInt_t j=0; j<2; j++) {
718 fout.width(neededWidth);
719 fout.precision(neededPrec);
726 }
else if (sstr.BeginsWith(
"packing")) {
728 fout << std::left <<
"packing";
731 fout << str.Data() << std::endl;
736 sstr.Remove(TString::kLeading,
' ');
737 if (sstr.BeginsWith(
"RUN")) {
739 fout <<
"RUN " <<
fRuns[runNo].GetRunName()->Data() <<
" ";
740 pstr =
fRuns[runNo].GetBeamline();
741 if (pstr ==
nullptr) {
742 std::cerr << std::endl <<
">> PMsrHandler::WriteMsrLogFile: **ERROR** Couldn't obtain beamline data." << std::endl;
746 fout << pstr->Data() <<
" ";
747 pstr =
fRuns[runNo].GetInstitute();
748 if (pstr ==
nullptr) {
749 std::cerr << std::endl <<
">> PMsrHandler::WriteMsrLogFile: **ERROR** Couldn't obtain institute data." << std::endl;
753 fout << pstr->Data() <<
" ";
754 pstr =
fRuns[runNo].GetFileFormat();
755 if (pstr ==
nullptr) {
756 std::cerr << std::endl <<
">> PMsrHandler::WriteMsrLogFile: **ERROR** Couldn't obtain file format data." << std::endl;
760 fout << pstr->Data() <<
" (name beamline institute data-file-format)" << std::endl;
761 }
else if (sstr.BeginsWith(
"ADDRUN")) {
763 fout <<
"ADDRUN " <<
fRuns[runNo].GetRunName(addRunNo)->Data() <<
" ";
764 pstr =
fRuns[runNo].GetBeamline(addRunNo);
765 if (pstr ==
nullptr) {
766 std::cerr << std::endl <<
">> PMsrHandler::WriteMsrLogFile: **ERROR** Couldn't obtain beamline data (addrun)." << std::endl;
770 fout << pstr->Data() <<
" ";
771 pstr =
fRuns[runNo].GetInstitute(addRunNo);
772 if (pstr ==
nullptr) {
773 std::cerr << std::endl <<
">> PMsrHandler::WriteMsrLogFile: **ERROR** Couldn't obtain institute data (addrun)." << std::endl;
777 fout << pstr->Data() <<
" ";
778 pstr =
fRuns[runNo].GetFileFormat(addRunNo);
779 if (pstr ==
nullptr) {
780 std::cerr << std::endl <<
">> PMsrHandler::WriteMsrLogFile: **ERROR** Couldn't obtain file format data (addrun)." << std::endl;
784 fout << pstr->Data() <<
" (name beamline institute data-file-format)" << std::endl;
785 }
else if (sstr.BeginsWith(
"fittype")) {
787 switch (
fRuns[runNo].GetFitType()) {
795 fout << std::left <<
"fittype" <<
MSR_FITTYPE_ASYM <<
" (asymmetry fit)" << std::endl ;
804 fout << std::left <<
"fittype" <<
MSR_FITTYPE_BNMR <<
" (beta-NMR fit)" << std::endl ;
812 }
else if (sstr.BeginsWith(
"alpha ")) {
814 fout << std::left <<
"alpha";
819 fout <<
fRuns[runNo].GetAlphaParamNo();
821 }
else if (sstr.BeginsWith(
"beta ")) {
823 fout << std::left <<
"beta";
827 fout <<
fRuns[runNo].GetBetaParamNo();
829 }
else if (sstr.BeginsWith(
"norm")) {
831 fout << std::left <<
"norm";
836 fout <<
fRuns[runNo].GetNormParamNo();
838 }
else if (sstr.BeginsWith(
"backgr.fit")) {
840 fout << std::left <<
"backgr.fit";
841 fout <<
fRuns[runNo].GetBkgFitParamNo() << std::endl;
842 }
else if (sstr.BeginsWith(
"lifetime ")) {
844 fout << std::left <<
"lifetime";
845 fout <<
fRuns[runNo].GetLifetimeParamNo() << std::endl;
846 }
else if (sstr.BeginsWith(
"lifetimecorrection")) {
848 }
else if (sstr.BeginsWith(
"map")) {
850 for (UInt_t j=0; j<
fRuns[runNo].GetMap()->size(); j++) {
852 fout << std::right <<
fRuns[runNo].GetMap(j);
855 if (
fRuns[runNo].GetMap()->size() < 10) {
856 for (UInt_t j=
fRuns[runNo].GetMap()->size(); j<10; j++)
860 }
else if (sstr.BeginsWith(
"forward")) {
861 if (
fRuns[runNo].GetForwardHistoNoSize() == 0) {
862 std::cerr << std::endl <<
">> PMsrHandler::WriteMsrLogFile: **WARNING** 'forward' tag without any data found!";
863 std::cerr << std::endl <<
">> Something is VERY fishy, please check your msr-file carfully." << std::endl;
867 for (UInt_t i=0; i<
fRuns[runNo].GetForwardHistoNoSize(); i++)
868 forward.push_back(
fRuns[runNo].GetForwardHistoNo(i));
871 fout << result.Data() << std::endl;
873 }
else if (sstr.BeginsWith(
"backward")) {
874 if (
fRuns[runNo].GetBackwardHistoNoSize() == 0) {
875 std::cerr << std::endl <<
">> PMsrHandler::WriteMsrLogFile: **WARNING** 'backward' tag without any data found!";
876 std::cerr << std::endl <<
">> Something is VERY fishy, please check your msr-file carfully." << std::endl;
880 for (UInt_t i=0; i<
fRuns[runNo].GetBackwardHistoNoSize(); i++)
881 backward.push_back(
fRuns[runNo].GetBackwardHistoNo(i));
884 fout << result.Data() << std::endl;
886 }
else if (sstr.BeginsWith(
"backgr.fix")) {
888 fout << std::left <<
"backgr.fix";
889 for (UInt_t j=0; j<2; j++) {
891 fout.precision(prec);
893 fout << std::left <<
fRuns[runNo].GetBkgFix(j);
897 }
else if (sstr.BeginsWith(
"background")) {
898 backgroundTagMissing[runNo] =
false;
900 fout << std::left <<
"background";
901 for (UInt_t j=0; j<4; j++) {
902 if (
fRuns[runNo].GetBkgRange(j) > 0) {
904 fout << std::left <<
fRuns[runNo].GetBkgRange(j);
909 if ((Int_t)log10(
fRuns[runNo].GetBkgEstimated(0))+1 >= 4)
911 fout <<
" # estimated bkg: ";
913 fout.precision(precision);
914 fout <<
fRuns[runNo].GetBkgEstimated(0);
918 fout.precision(precision);
919 fout <<
fRuns[runNo].GetBkgEstimated(1);
923 }
else if (sstr.BeginsWith(
"data")) {
924 dataTagMissing[runNo] =
false;
926 fout << std::left <<
"data";
927 for (UInt_t j=0; j<4; j++) {
928 if (
fRuns[runNo].GetDataRange(j) > 0) {
930 fout << std::left <<
fRuns[runNo].GetDataRange(j);
934 }
else if (sstr.BeginsWith(
"t0")) {
935 t0TagMissing[runNo] =
false;
937 fout << std::left <<
"t0";
938 for (UInt_t j=0; j<
fRuns[runNo].GetT0BinSize(); j++) {
941 fout.setf(std::ios::fixed,std::ios::floatfield);
942 fout << std::left <<
fRuns[runNo].GetT0Bin(j);
945 }
else if (sstr.BeginsWith(
"addt0")) {
946 addt0TagMissing[runNo][addT0Counter] =
false;
947 if (
fRuns[runNo].GetAddT0BinSize(addT0Counter) <=0) {
948 std::cerr << std::endl <<
">> PMsrHandler::WriteMsrLogFile: **WARNING** 'addt0' tag without any data found!";
949 std::cerr << std::endl <<
">> Something is VERY fishy, please check your msr-file carfully." << std::endl;
952 fout << std::left <<
"addt0";
953 for (Int_t j=0; j<
fRuns[runNo].GetAddT0BinSize(addT0Counter); j++) {
956 fout.setf(std::ios::fixed,std::ios::floatfield);
957 fout << std::left <<
fRuns[runNo].GetAddT0Bin(addT0Counter, j);
962 }
else if (sstr.BeginsWith(
"xy-data")) {
963 if (
fRuns[runNo].GetXDataIndex() != -1) {
965 fout << std::left <<
"xy-data";
968 fout << std::left << std::fixed <<
fRuns[runNo].GetXDataIndex();
971 fout << std::left << std::fixed <<
fRuns[runNo].GetYDataIndex();
973 }
else if (!
fRuns[runNo].GetXDataLabel()->IsWhitespace()) {
975 fout << std::left <<
"xy-data";
977 fout << std::left << std::fixed <<
fRuns[runNo].GetXDataLabel()->Data();
980 fout << std::left << std::fixed <<
fRuns[runNo].GetYDataLabel()->Data();
983 }
else if (sstr.BeginsWith(
"fit")) {
986 if (t0TagMissing[runNo] &&
fRuns[runNo].GetInstitute()->CompareTo(
"isis", TString::kIgnoreCase)) {
987 if (
fRuns[runNo].GetT0BinSize() > 0) {
989 fout << std::left <<
"t0";
990 for (UInt_t j=0; j<
fRuns[runNo].GetT0BinSize(); j++) {
993 fout.setf(std::ios::fixed,std::ios::floatfield);
994 fout << std::left <<
fRuns[runNo].GetT0Bin(j);
999 for (UInt_t i=0; i<
fRuns[runNo].GetAddT0BinEntries(); i++) {
1000 if (addt0TagMissing[runNo][i] &&
fRuns[runNo].GetInstitute()->CompareTo(
"isis", TString::kIgnoreCase)) {
1001 if (
fRuns[runNo].GetAddT0BinSize(i) > 0) {
1003 fout << std::left <<
"addt0";
1004 for (Int_t j=0; j<
fRuns[runNo].GetAddT0BinSize(i); j++) {
1007 fout.setf(std::ios::fixed,std::ios::floatfield);
1008 fout << std::left <<
fRuns[runNo].GetAddT0Bin(i, j);
1014 if (backgroundTagMissing[runNo]) {
1015 if (
fRuns[runNo].GetBkgRange(0) >= 0) {
1017 fout << std::left <<
"background";
1018 for (UInt_t j=0; j<4; j++) {
1019 if (
fRuns[runNo].GetBkgRange(j) > 0) {
1021 fout << std::left <<
fRuns[runNo].GetBkgRange(j);
1027 if (dataTagMissing[runNo]) {
1028 if (
fRuns[runNo].GetDataRange(0) >= 0) {
1030 fout << std::left <<
"data";
1031 for (UInt_t j=0; j<4; j++) {
1032 if (
fRuns[runNo].GetDataRange(j) > 0) {
1034 fout << std::left <<
fRuns[runNo].GetDataRange(j);
1042 fout << std::left <<
"fit";
1043 if (
fRuns[runNo].IsFitRangeInBin()) {
1045 if (
fRuns[runNo].GetFitRangeOffset(0) > 0)
1046 fout <<
"+" <<
fRuns[runNo].GetFitRangeOffset(0);
1048 if (
fRuns[runNo].GetFitRangeOffset(1) > 0)
1049 fout <<
"-" <<
fRuns[runNo].GetFitRangeOffset(1);
1053 fout.precision(neededPrec);
1054 fout <<
" # in time: " <<
fRuns[runNo].GetFitRange(0) <<
".." <<
fRuns[runNo].GetFitRange(1) <<
" (usec)";
1056 for (UInt_t j=0; j<2; j++) {
1057 if (
fRuns[runNo].GetFitRange(j) == -1)
1061 fout.width(neededWidth);
1062 fout.precision(neededPrec);
1063 fout << std::left << std::fixed <<
fRuns[runNo].GetFitRange(j);
1069 }
else if (sstr.BeginsWith(
"packing")) {
1071 fout << std::left <<
"packing";
1072 fout <<
fRuns[runNo].GetPacking() << std::endl;
1074 fout << str.Data() << std::endl;
1078 fout << str.Data() << std::endl;
1082 sstr.Remove(TString::kLeading,
' ');
1083 if (sstr.BeginsWith(
"units")) {
1094 fout <<
" # units either 'Gauss', 'Tesla', 'MHz', or 'Mc/s'";
1096 }
else if (sstr.BeginsWith(
"fourier_power")) {
1098 }
else if (sstr.BeginsWith(
"dc-corrected")) {
1099 fout <<
"dc-corrected ";
1101 fout <<
"true" << std::endl;
1103 fout <<
"false" << std::endl;
1104 }
else if (sstr.BeginsWith(
"apodization")) {
1105 fout <<
"apodization ";
1115 fout <<
" # NONE, WEAK, MEDIUM, STRONG";
1117 }
else if (sstr.BeginsWith(
"plot")) {
1124 fout <<
"REAL_AND_IMAG";
1130 fout <<
"PHASE_OPT_REAL";
1132 fout <<
" # REAL, IMAG, REAL_AND_IMAG, POWER, PHASE, PHASE_OPT_REAL";
1134 }
else if (sstr.BeginsWith(
"phase")) {
1137 fout <<
"phase " << phaseParamStr << std::endl;
1145 }
else if (sstr.BeginsWith(
"range_for_phase_correction")) {
1147 }
else if (sstr.BeginsWith(
"range ")) {
1148 fout.setf(std::ios::fixed,std::ios::floatfield);
1152 fout.precision(neededPrec);
1155 fout << str.Data() << std::endl;
1160 sstr.Remove(TString::kLeading,
' ');
1161 if (sstr.BeginsWith(
"PLOT")) {
1162 switch (
fPlots[plotNo].fPlotType) {
1164 fout <<
"PLOT " <<
fPlots[plotNo].fPlotType <<
" (single histo plot)" << std::endl;
1167 fout <<
"PLOT " <<
fPlots[plotNo].fPlotType <<
" (single histo RRF plot)" << std::endl;
1170 fout <<
"PLOT " <<
fPlots[plotNo].fPlotType <<
" (asymmetry plot)" << std::endl;
1173 fout <<
"PLOT " <<
fPlots[plotNo].fPlotType <<
" (asymmetry RRF plot)" << std::endl;
1176 fout <<
"PLOT " <<
fPlots[plotNo].fPlotType <<
" (mu minus plot)" << std::endl;
1179 fout <<
"PLOT " <<
fPlots[plotNo].fPlotType <<
" (beta-NMR asymmetry plot)" << std::endl;
1182 fout <<
"PLOT " <<
fPlots[plotNo].fPlotType <<
" (non muSR plot)" << std::endl;
1187 if (
fPlots[plotNo].fLifeTimeCorrection) {
1188 fout <<
"lifetimecorrection" << std::endl;
1190 }
else if (sstr.BeginsWith(
"lifetimecorrection")) {
1194 }
else if (sstr.BeginsWith(
"runs")) {
1197 for (UInt_t j=0; j<
fPlots[plotNo].fRuns.size(); j++) {
1199 fout <<
fPlots[plotNo].fRuns[j];
1202 }
else if (sstr.BeginsWith(
"range")) {
1205 fout.precision(neededPrec);
1206 fout <<
fPlots[plotNo].fTmin[0];
1209 fout.precision(neededPrec);
1210 fout <<
fPlots[plotNo].fTmax[0];
1211 if (
fPlots[plotNo].fYmin.size() > 0) {
1214 fout.precision(neededPrec);
1215 fout <<
fPlots[plotNo].fYmin[0] <<
" ";
1217 fout.precision(neededPrec);
1218 fout <<
fPlots[plotNo].fYmax[0];
1222 fout << str.Data() << std::endl;
1226 statisticBlockFound =
true;
1228 sstr.Remove(TString::kLeading,
' ');
1229 if (sstr.BeginsWith(
"STATISTIC")) {
1231 fout <<
"STATISTIC --- " << dt.AsSQLString() << std::endl;
1232 }
else if (sstr.BeginsWith(
"chisq") || sstr.BeginsWith(
"maxLH")) {
1233 partialStatisticBlockFound =
false;
1240 fout << str.Data() << std::endl;
1242 std::cout << std::endl << str.Data() << std::endl;
1247 str.Form(
" expected chisq = %.1lf, NDF = %d, expected chisq/NDF = %lf",
1250 str.Form(
" expected maxLH = %.1lf, NDF = %d, expected maxLH/NDF = %lf",
1255 fout << str.Data() << std::endl;
1258 std::cout << std::endl << str.Data() << std::endl;
1263 str.Form(
" run block %d: (NDF/red.chisq/red.chisq_e) = (%d/%lf/%lf)",
1266 str.Form(
" run block %d: (NDF/red.maxLH/red.maxLH_e) = (%d/%lf/%lf)",
1271 fout << str.Data() << std::endl;
1275 std::cout << str.Data() << std::endl;
1281 str.Form(
" run block %d: (NDF/red.chisq) = (%d/%lf)",
1284 str.Form(
" run block %d: (NDF/maxLH.chisq) = (%d/%lf)",
1289 fout << str.Data() << std::endl;
1293 std::cout << str.Data() << std::endl;
1297 fout <<
"*** FIT DID NOT CONVERGE ***" << std::endl;
1299 std::cout << std::endl <<
"*** FIT DID NOT CONVERGE ***" << std::endl;
1301 }
else if (sstr.BeginsWith(
"*** FIT DID NOT CONVERGE ***")) {
1302 partialStatisticBlockFound =
false;
1309 fout << str.Data() << std::endl;
1311 std::cout << std::endl << str.Data() << std::endl;
1316 str.Form(
" expected chisq = %.1lf, NDF = %d, expected chisq/NDF = %lf",
1319 str.Form(
" expected maxLH = %.1lf, NDF = %d, expected maxLH/NDF = %lf",
1324 fout << str.Data() << std::endl;
1327 std::cout << str.Data() << std::endl;
1332 str.Form(
" run block %d: (NDF/red.chisq/red.chisq_e) = (%d/%lf/%lf)",
1335 str.Form(
" run block %d: (NDF/red.maxLH/red.maxLH_e) = (%d/%lf/%lf)",
1340 fout << str.Data() << std::endl;
1344 std::cout << str.Data() << std::endl;
1350 str.Form(
" run block %d: (NDF/red.chisq) = (%d/%lf)",
1353 str.Form(
" run block %d: (NDF/red.maxLH) = (%d/%lf)",
1358 fout << str.Data() << std::endl;
1362 std::cout << str.Data() << std::endl;
1366 fout <<
"*** FIT DID NOT CONVERGE ***" << std::endl;
1368 std::cout << std::endl <<
"*** FIT DID NOT CONVERGE ***" << std::endl;
1371 if (str.Length() > 0) {
1373 sstr.Remove(TString::kLeading,
' ');
1374 if (!sstr.BeginsWith(
"expected chisq") && !sstr.BeginsWith(
"expected maxLH") && !sstr.BeginsWith(
"run block"))
1375 fout << str.Data() << std::endl;
1388 if (!statisticBlockFound) {
1389 partialStatisticBlockFound =
false;
1390 std::cerr << std::endl <<
">> PMsrHandler::WriteMsrLogFile: **WARNING** no STATISTIC block present, will write a default one" << std::endl;
1391 fout <<
"###############################################################" << std::endl;
1393 fout <<
"STATISTIC --- " << dt.AsSQLString() << std::endl;
1400 fout << str.Data() << std::endl;
1402 std::cout << std::endl << str.Data() << std::endl;
1407 str.Form(
" expected chisq = %.1lf, NDF = %d, expected chisq/NDF = %lf",
1410 str.Form(
" expected maxLH = %.1lf, NDF = %d, expected maxLH/NDF = %lf",
1415 fout << str.Data() << std::endl;
1418 std::cout << str.Data() << std::endl;
1423 str.Form(
" run block %d: (NDF/red.chisq/red.chisq_e) = (%d/%lf/%lf)",
1426 str.Form(
" run block %d: (NDF/red.maxLH/red.maxLH_e) = (%d/%lf/%lf)",
1431 fout << str.Data() << std::endl;
1435 std::cout << str.Data() << std::endl;
1441 str.Form(
" run block %d: (NDF/red.chisq) = (%d/%lf)",
1444 str.Form(
" run block %d: (NDF/red.maxLH) = (%d/%lf)",
1449 fout << str.Data() << std::endl;
1453 std::cout << str.Data() << std::endl;
1457 fout <<
"*** FIT DID NOT CONVERGE ***" << std::endl;
1459 std::cout << std::endl <<
"*** FIT DID NOT CONVERGE ***" << std::endl;
1464 if (partialStatisticBlockFound) {
1465 std::cerr << std::endl <<
">> PMsrHandler::WriteMsrLogFile: **WARNING** garbage STATISTIC block present in the msr-input file.";
1466 std::cerr << std::endl <<
">> ** WILL ADD SOME SENSIBLE STUFF, BUT YOU HAVE TO CHECK IT SINCE I AM **NOT** REMOVING THE GARBAGE! **" << std::endl;
1468 fout <<
"STATISTIC --- " << dt.AsSQLString() << std::endl;
1475 fout << str.Data() << std::endl;
1477 std::cout << std::endl << str.Data() << std::endl;
1482 str.Form(
" expected chisq = %.1lf, NDF = %d, expected chisq/NDF = %lf",
1485 str.Form(
" expected maxLH = %.1lf, NDF = %d, expected maxLH/NDF = %lf",
1490 fout << str.Data() << std::endl;
1493 std::cout << str.Data() << std::endl;
1498 str.Form(
" run block %d: (NDF/red.chisq/red.chisq_e) =(%d/%lf/%lf)",
1501 str.Form(
" run block %d: (NDF/red.maxLH/red.maxLH_e) =(%d/%lf/%lf)",
1506 fout << str.Data() << std::endl;
1510 std::cout << str.Data() << std::endl;
1516 str.Form(
" run block %d: (NDF/red.chisq) = (%d/%lf)",
1519 str.Form(
" run block %d: (NDF/red.maxLH) = (%d/%lf)",
1524 fout << str.Data() << std::endl;
1528 std::cout << str.Data() << std::endl;
1532 fout <<
"*** FIT DID NOT CONVERGE (4) ***" << std::endl;
1534 std::cout << std::endl <<
"*** FIT DID NOT CONVERGE ***" << std::endl;
1543 t0TagMissing.clear();
1544 backgroundTagMissing.clear();
1545 dataTagMissing.clear();
1563 std::map<UInt_t, TString> *commentsTHE, \
1564 std::map<UInt_t, TString> *commentsFUN, \
1565 std::map<UInt_t, TString> *commentsRUN)
1567 const UInt_t prec = 6;
1568 const TString hline =
"###############################################################";
1570 std::map<UInt_t, TString>::iterator iter;
1574 std::ofstream fout(filename);
1580 fout <<
fTitle.Data() << std::endl;
1581 fout << hline.Data() << std::endl;
1584 fout <<
"FITPARAMETER" << std::endl;
1585 fout <<
"# No Name Value Step Pos_Error Boundaries" << std::endl;
1587 for (i = 0; i <
fParam.size(); ++i) {
1589 iter = commentsPAR->find(i+1);
1590 if (iter != commentsPAR->end()) {
1592 fout <<
"# " << iter->second.Data() << std::endl;
1594 commentsPAR->erase(iter);
1599 fout << std::right <<
fParam[i].fNo;
1603 fout << std::left <<
fParam[i].fName.Data();
1607 fout.precision(prec);
1608 fout << std::left <<
fParam[i].fValue;
1612 fout.precision(prec);
1613 fout << std::left <<
fParam[i].fStep;
1616 fout.precision(prec);
1617 if ((
fParam[i].fNoOfParams == 5) || (
fParam[i].fNoOfParams == 7))
1618 if (
fParam[i].fPosErrorPresent && (
fParam[i].fStep != 0))
1619 fout << std::left <<
fParam[i].fPosError;
1621 fout << std::left <<
"none";
1623 fout << std::left <<
"none";
1626 if (
fParam[i].fNoOfParams > 5) {
1628 fout.precision(prec);
1629 if (
fParam[i].fLowerBoundaryPresent)
1630 fout << std::left <<
fParam[i].fLowerBoundary;
1632 fout << std::left <<
"none";
1635 fout.precision(prec);
1636 if (
fParam[i].fUpperBoundaryPresent)
1637 fout << std::left <<
fParam[i].fUpperBoundary;
1639 fout << std::left <<
"none";
1644 if (commentsPAR && !commentsPAR->empty()) {
1646 for(iter = commentsPAR->begin(); iter != commentsPAR->end(); ++iter) {
1647 fout <<
"# " << iter->second.Data() << std::endl;
1649 commentsPAR->clear();
1652 fout << hline.Data() << std::endl;
1655 fout <<
"THEORY" << std::endl;
1657 for (i = 1; i <
fTheory.size(); ++i) {
1659 iter = commentsTHE->find(i);
1660 if (iter != commentsTHE->end()) {
1662 fout <<
"# " << iter->second.Data() << std::endl;
1664 commentsTHE->erase(iter);
1667 fout <<
fTheory[i].fLine.Data() << std::endl;
1669 if (commentsTHE && !commentsTHE->empty()) {
1671 for(iter = commentsTHE->begin(); iter != commentsTHE->end(); ++iter) {
1672 fout <<
"# " << iter->second.Data() << std::endl;
1674 commentsTHE->clear();
1677 fout << hline.Data() << std::endl;
1683 fout <<
"FUNCTIONS" << std::endl;
1687 iter = commentsFUN->find(i);
1688 if (iter != commentsFUN->end()) {
1690 fout <<
"# " << iter->second.Data() << std::endl;
1692 commentsFUN->erase(iter);
1695 fout <<
fFunctions[i].fLine.Data() << std::endl;
1697 if (commentsFUN && !commentsFUN->empty()) {
1699 for(iter = commentsFUN->begin(); iter != commentsFUN->end(); ++iter) {
1700 fout <<
"# " << iter->second.Data() << std::endl;
1702 commentsFUN->clear();
1705 fout << hline.Data() << std::endl;
1709 fout <<
"GLOBAL" << std::endl;
1722 fout << std::left <<
"fittype" <<
MSR_FITTYPE_ASYM <<
" (asymmetry fit)" << std::endl ;
1725 fout << std::left <<
"fittype" <<
MSR_FITTYPE_ASYM_RRF <<
" (asymmetry RRF fit)" << std::endl ;
1731 fout << std::left <<
"fittype" <<
MSR_FITTYPE_BNMR <<
" (beta-NMR fit)" << std::endl ;
1744 fout << std::left <<
"rrf_freq ";
1752 fout <<
"rrf_phase ";
1759 fout <<
"rrf_packing ";
1768 fout << std::left <<
"data";
1769 for (UInt_t j=0; j<4; ++j) {
1781 fout << std::left <<
"t0";
1785 fout.setf(std::ios::fixed,std::ios::floatfield);
1795 fout << std::left <<
"addt0";
1799 fout.setf(std::ios::fixed,std::ios::floatfield);
1810 fout << std::left <<
"fit";
1819 for (UInt_t j=0; j<2; j++) {
1822 UInt_t neededWidth = 7;
1824 fout.width(neededWidth);
1825 fout.precision(neededPrec);
1837 fout << std::left <<
"packing";
1841 fout << std::endl << hline.Data() << std::endl;
1845 for (i = 0; i <
fRuns.size(); ++i) {
1847 iter = commentsRUN->find(i + 1);
1848 if (iter != commentsRUN->end()) {
1851 fout <<
"# " << iter->second.Data() << std::endl;
1853 commentsRUN->erase(iter);
1856 fout <<
"RUN " <<
fRuns[i].GetRunName()->Data() <<
" ";
1857 pstr =
fRuns[i].GetBeamline();
1858 if (pstr ==
nullptr) {
1859 std::cerr << std::endl <<
">> PMsrHandler::WriteMsrFile: **ERROR** Couldn't obtain beamline data." << std::endl;
1863 fout << pstr->Data() <<
" ";
1864 pstr =
fRuns[i].GetInstitute();
1865 if (pstr ==
nullptr) {
1866 std::cerr << std::endl <<
">> PMsrHandler::WriteMsrFile: **ERROR** Couldn't obtain institute data." << std::endl;
1870 fout << pstr->Data() <<
" ";
1871 pstr =
fRuns[i].GetFileFormat();
1872 if (pstr ==
nullptr) {
1873 std::cerr << std::endl <<
">> PMsrHandler::WriteMsrFile: **ERROR** Couldn't obtain file format data." << std::endl;
1877 fout << pstr->Data() <<
" (name beamline institute data-file-format)" << std::endl;
1880 for (UInt_t j = 1; j <
fRuns[i].GetRunNameSize(); ++j) {
1881 fout <<
"ADDRUN " <<
fRuns[i].GetRunName(j)->Data() <<
" ";
1882 pstr =
fRuns[i].GetBeamline(j);
1883 if (pstr ==
nullptr) {
1884 std::cerr << std::endl <<
">> PMsrHandler::WriteMsrFile: **ERROR** Couldn't obtain beamline data (addrun)." << std::endl;
1888 fout << pstr->Data() <<
" ";
1889 pstr =
fRuns[i].GetInstitute(j);
1890 if (pstr ==
nullptr) {
1891 std::cerr << std::endl <<
">> PMsrHandler::WriteMsrFile: **ERROR** Couldn't obtain institute data (addrun)." << std::endl;
1895 fout << pstr->Data() <<
" ";
1896 pstr =
fRuns[i].GetFileFormat(j);
1897 if (pstr ==
nullptr) {
1898 std::cerr << std::endl <<
">> PMsrHandler::WriteMsrFile: **ERROR** Couldn't obtain file format data (addrun)." << std::endl;
1902 fout << pstr->Data() <<
" (name beamline institute data-file-format)" << std::endl;
1906 if (
fRuns[i].GetFitType() != -1) {
1908 switch (
fRuns[i].GetFitType()) {
1916 fout << std::left <<
"fittype" <<
MSR_FITTYPE_ASYM <<
" (asymmetry fit)" << std::endl ;
1919 fout << std::left <<
"fittype" <<
MSR_FITTYPE_ASYM_RRF <<
" (asymmetry RRF fit)" << std::endl ;
1925 fout << std::left <<
"fittype" <<
MSR_FITTYPE_BNMR <<
" (beta-NMR fit)" << std::endl ;
1936 if (
fRuns[i].GetAlphaParamNo() != -1) {
1938 fout << std::left <<
"alpha";
1943 fout <<
fRuns[i].GetAlphaParamNo();
1948 if (
fRuns[i].GetBetaParamNo() != -1) {
1950 fout << std::left <<
"beta";
1955 fout <<
fRuns[i].GetBetaParamNo();
1960 if (
fRuns[i].GetNormParamNo() != -1) {
1962 fout << std::left <<
"norm";
1967 fout <<
fRuns[i].GetNormParamNo();
1972 if (
fRuns[i].GetBkgFitParamNo() != -1) {
1974 fout << std::left <<
"backgr.fit";
1975 fout <<
fRuns[i].GetBkgFitParamNo() << std::endl;
1979 if (
fRuns[i].GetLifetimeParamNo() != -1) {
1981 fout << std::left <<
"lifetime";
1982 fout <<
fRuns[i].GetLifetimeParamNo() << std::endl;
1987 fout <<
"lifetimecorrection" << std::endl;
1992 for (UInt_t j=0; j<
fRuns[i].GetMap()->size(); ++j) {
1994 fout << std::right <<
fRuns[i].GetMap(j);
1997 if (
fRuns[i].GetMap()->size() < 10) {
1998 for (UInt_t j=
fRuns[i].GetMap()->size(); j<10; ++j)
2004 if (
fRuns[i].GetForwardHistoNoSize() == 0) {
2005 std::cerr << std::endl <<
">> PMsrHandler::WriteMsrFile: **WARNING** No 'forward' data found!";
2006 std::cerr << std::endl <<
">> Something is VERY fishy, please check your msr-file carfully." << std::endl;
2009 fout << std::left <<
"forward";
2010 for (UInt_t j=0; j<
fRuns[i].GetForwardHistoNoSize(); ++j) {
2012 fout <<
fRuns[i].GetForwardHistoNo(j);
2018 if (
fRuns[i].GetBackwardHistoNoSize() > 0) {
2020 fout << std::left <<
"backward";
2021 for (UInt_t j=0; j<
fRuns[i].GetBackwardHistoNoSize(); ++j) {
2023 fout <<
fRuns[i].GetBackwardHistoNo(j);
2031 fout << std::left <<
"backgr.fix";
2032 for (UInt_t j=0; j<2; ++j) {
2034 fout.precision(prec);
2036 fout << std::left <<
fRuns[i].GetBkgFix(j);
2043 if ((
fRuns[i].GetBkgRange(0) != -1) || (
fRuns[i].GetBkgRange(1) != -1) || (
fRuns[i].GetBkgRange(2) != -1) || (
fRuns[i].GetBkgRange(3) != -1)) {
2045 fout << std::left <<
"background";
2046 for (UInt_t j=0; j<4; ++j) {
2047 if (
fRuns[i].GetBkgRange(j) > 0) {
2049 fout << std::left <<
fRuns[i].GetBkgRange(j);
2056 if ((
fRuns[i].GetDataRange(0) != -1) || (
fRuns[i].GetDataRange(1) != -1) || (
fRuns[i].GetDataRange(2) != -1) || (
fRuns[i].GetDataRange(3) != -1)) {
2058 fout << std::left <<
"data";
2059 for (UInt_t j=0; j<4; ++j) {
2060 if (
fRuns[i].GetDataRange(j) > 0) {
2062 fout << std::left <<
fRuns[i].GetDataRange(j);
2069 if (
fRuns[i].GetT0BinSize() > 0) {
2071 fout << std::left <<
"t0";
2072 for (UInt_t j=0; j<
fRuns[i].GetT0BinSize(); ++j) {
2075 fout.setf(std::ios::fixed,std::ios::floatfield);
2076 fout << std::left <<
fRuns[i].GetT0Bin(j);
2082 if (
fRuns[i].GetAddT0BinEntries() > 0) {
2083 for (UInt_t j = 0; j <
fRuns[i].GetRunNameSize() - 1; ++j) {
2084 if (
fRuns[i].GetAddT0BinSize(j) > 0) {
2086 fout << std::left <<
"addt0";
2087 for (Int_t k=0; k<
fRuns[i].GetAddT0BinSize(j); ++k) {
2090 fout.setf(std::ios::fixed,std::ios::floatfield);
2091 fout << std::left <<
fRuns[i].GetAddT0Bin(j, k);
2099 if (
fRuns[i].GetXDataIndex() != -1) {
2101 fout << std::left <<
"xy-data";
2104 fout << std::left << std::fixed <<
fRuns[i].GetXDataIndex();
2107 fout << std::left << std::fixed <<
fRuns[i].GetYDataIndex();
2109 }
else if (!
fRuns[i].GetXDataLabel()->IsWhitespace()) {
2111 fout << std::left <<
"xy-data";
2113 fout << std::left << std::fixed <<
fRuns[i].GetXDataLabel()->Data();
2116 fout << std::left << std::fixed <<
fRuns[i].GetYDataLabel()->Data();
2121 if ( (
fRuns[i].IsFitRangeInBin() &&
fRuns[i].GetFitRangeOffset(0) != -1) ||
2124 fout << std::left <<
"fit";
2125 if (
fRuns[i].IsFitRangeInBin()) {
2127 if (
fRuns[i].GetFitRangeOffset(0) > 0)
2128 fout <<
"+" <<
fRuns[i].GetFitRangeOffset(0);
2130 if (
fRuns[i].GetFitRangeOffset(1) > 0)
2131 fout <<
"-" <<
fRuns[i].GetFitRangeOffset(1);
2133 for (UInt_t j=0; j<2; j++) {
2134 if (
fRuns[i].GetFitRange(j) == -1)
2136 UInt_t neededWidth = 7;
2138 fout.width(neededWidth);
2139 fout.precision(neededPrec);
2140 fout << std::left << std::fixed <<
fRuns[i].GetFitRange(j);
2149 if (
fRuns[i].GetPacking() != -1) {
2151 fout << std::left <<
"packing";
2152 fout <<
fRuns[i].GetPacking() << std::endl;
2158 if (commentsRUN && !commentsRUN->empty()) {
2159 for(iter = commentsRUN->begin(); iter != commentsRUN->end(); ++iter) {
2160 fout <<
"# " << iter->second.Data() << std::endl;
2163 commentsRUN->clear();
2165 fout << hline.Data() << std::endl;
2168 fout <<
"COMMANDS" << std::endl;
2169 for (i = 0; i <
fCommands.size(); ++i) {
2170 if (
fCommands[i].fLine.BeginsWith(
"SET BATCH") ||
fCommands[i].fLine.BeginsWith(
"END RETURN"))
2173 fout <<
fCommands[i].fLine.Data() << std::endl;
2176 fout << hline.Data() << std::endl;
2180 fout <<
"FOURIER" << std::endl;
2194 fout <<
" # units either 'Gauss', 'Tesla', 'MHz', or 'Mc/s'";
2205 fout <<
"apodization ";
2215 fout <<
" # NONE, WEAK, MEDIUM, STRONG";
2227 fout <<
"REAL_AND_IMAG";
2233 fout <<
"PHASE_OPT_REAL";
2235 fout <<
" # REAL, IMAG, REAL_AND_IMAG, POWER, PHASE, PHASE_OPT_REAL";
2242 fout <<
"phase " << phaseParamStr << std::endl;
2258 fout.setf(std::ios::fixed,std::ios::floatfield);
2262 fout.precision(neededPrec);
2272 fout << hline.Data() << std::endl;
2276 for (i = 0; i <
fPlots.size(); ++i) {
2277 switch (
fPlots[i].fPlotType) {
2279 fout <<
"PLOT " <<
fPlots[i].fPlotType <<
" (single histo plot)" << std::endl;
2282 fout <<
"PLOT " <<
fPlots[i].fPlotType <<
" (single histo RRF plot)" << std::endl;
2285 fout <<
"PLOT " <<
fPlots[i].fPlotType <<
" (asymmetry plot)" << std::endl;
2288 fout <<
"PLOT " <<
fPlots[i].fPlotType <<
" (asymmetry RRF plot)" << std::endl;
2291 fout <<
"PLOT " <<
fPlots[i].fPlotType <<
" (mu minus plot)" << std::endl;
2294 fout <<
"PLOT " <<
fPlots[i].fPlotType <<
" (beta-NMR asymmetry plot)" << std::endl;
2297 fout <<
"PLOT " <<
fPlots[i].fPlotType <<
" (non muSR plot)" << std::endl;
2306 for (UInt_t j=0; j<
fPlots[i].fRuns.size(); ++j) {
2308 fout <<
fPlots[i].fRuns[j];
2313 if ((
fPlots[i].fTmin.size() == 1) && (
fPlots[i].fTmax.size() == 1)) {
2316 fout <<
fPlots[i].fTmin[0] <<
" " <<
fPlots[i].fTmax[0];
2317 }
else if ((
fPlots[i].fTmin.size() > 1) && (
fPlots[i].fTmax.size() > 1)) {
2318 fout <<
"sub_ranges ";
2320 for (UInt_t j=0; j <
fPlots[i].fTmin.size(); ++j) {
2321 fout <<
" " <<
fPlots[i].fTmin[j] <<
" " <<
fPlots[i].fTmax[j];
2324 if (!
fPlots[i].fYmin.empty() && !
fPlots[i].fYmax.empty()) {
2325 fout <<
" " <<
fPlots[i].fYmin[0] <<
" " <<
fPlots[i].fYmax[0];
2330 if (
fPlots[i].fUseFitRanges) {
2331 if (!
fPlots[i].fYmin.empty() && !
fPlots[i].fYmax.empty())
2332 fout <<
"use_fit_ranges " <<
fPlots[i].fYmin[0] <<
" " <<
fPlots[i].fYmax[0] << std::endl;
2334 fout <<
"use_fit_ranges" << std::endl;
2338 if (
fPlots[i].fViewPacking != -1) {
2339 fout <<
"view_packing " <<
fPlots[i].fViewPacking << std::endl;
2344 fout <<
"logx" << std::endl;
2349 fout <<
"logy" << std::endl;
2353 if (
fPlots[i].fLifeTimeCorrection) {
2354 fout <<
"lifetimecorrection" << std::endl;
2358 if (
fPlots[i].fRRFPacking) {
2359 fout <<
"rrf_packing " <<
fPlots[i].fRRFPacking << std::endl;
2363 if (
fPlots[i].fRRFFreq) {
2364 fout <<
"rrf_freq " <<
fPlots[i].fRRFFreq <<
" ";
2365 switch (
fPlots[i].fRRFUnit) {
2388 if (
fPlots[i].fRRFPhaseParamNo > 0) {
2389 fout <<
"rrf_phase par" <<
fPlots[i].fRRFPhaseParamNo << std::endl;
2390 }
else if (
fPlots[i].fRRFPhase) {
2391 fout <<
"rrf_phase " <<
fPlots[i].fRRFPhase << std::endl;
2397 fout << hline.Data() << std::endl;
2402 fout <<
"STATISTIC --- " << dt.AsSQLString() << std::endl;
2409 str +=
", chisq/NDF = ";
2411 fout << str.Data() << std::endl;
2417 str +=
", maxLH/NDF = ";
2419 fout << str.Data() << std::endl;
2422 fout <<
"*** FIT DID NOT CONVERGE ***" << std::endl;
2449 if (idx >=
fParam.size()) {
2450 std::cerr << std::endl <<
">> PMsrHandler::SetMsrParamValue(): **ERROR** idx = " << idx <<
" is >= than the number of fit parameters " <<
fParam.size();
2451 std::cerr << std::endl;
2455 fParam[idx].fValue = value;
2476 if (idx >=
fParam.size()) {
2477 std::cerr << std::endl <<
">> PMsrHandler::SetMsrParamValue(): **ERROR** idx = " << idx <<
" is larger than the number of parameters " <<
fParam.size();
2478 std::cerr << std::endl;
2482 fParam[idx].fStep = value;
2502 if (idx >=
fParam.size()) {
2503 std::cerr << std::endl <<
">> PMsrHandler::SetMsrParamPosErrorPresent(): **ERROR** idx = " << idx <<
" is larger than the number of parameters " <<
fParam.size();
2504 std::cerr << std::endl;
2508 fParam[idx].fPosErrorPresent = value;
2528 if (idx >=
fParam.size()) {
2529 std::cerr << std::endl <<
">> PMsrHandler::SetMsrParamPosError(): **ERROR** idx = " << idx <<
" is larger than the number of parameters " <<
fParam.size();
2530 std::cerr << std::endl;
2534 fParam[idx].fPosErrorPresent =
true;
2535 fParam[idx].fPosError = value;
2552 if (runNo >=
fRuns.size()) {
2553 std::cerr << std::endl <<
">> PMsrHandler::SetMsrT0Entry: **ERROR** runNo = " << runNo <<
", is out of valid range 0.." <<
fRuns.size();
2554 std::cerr << std::endl;
2558 if (idx >=
fRuns[runNo].GetT0BinSize()) {
2559 std::cerr << std::endl <<
">> PMsrHandler::SetMsrT0Entry: **WARNING** idx = " << idx <<
", is out of valid range 0.." <<
fRuns[runNo].GetT0BinSize();
2560 std::cerr << std::endl <<
">> Will add it anyway.";
2561 std::cerr << std::endl;
2564 fRuns[runNo].SetT0Bin(bin, idx);
2580 if (runNo >=
fRuns.size()) {
2581 std::cerr << std::endl <<
">> PMsrHandler::SetMsrAddT0Entry: **ERROR** runNo = " << runNo <<
", is out of valid range 0.." <<
fRuns.size();
2582 std::cerr << std::endl;
2586 if (addRunIdx >=
fRuns[runNo].GetAddT0BinEntries()) {
2587 std::cerr << std::endl <<
">> PMsrHandler::SetMsrAddT0Entry: **WARNING** addRunIdx = " << addRunIdx <<
", is out of valid range 0.." <<
fRuns[runNo].GetAddT0BinEntries();
2588 std::cerr << std::endl <<
">> Will add it anyway.";
2589 std::cerr << std::endl;
2592 if (static_cast<Int_t>(histoIdx) >
fRuns[runNo].GetAddT0BinSize(addRunIdx)) {
2593 std::cerr << std::endl <<
">> PMsrHandler::SetMsrAddT0Entry: **WARNING** histoIdx = " << histoIdx <<
", is out of valid range 0.." <<
fRuns[runNo].GetAddT0BinSize(addRunIdx);
2594 std::cerr << std::endl <<
">> Will add it anyway.";
2595 std::cerr << std::endl;
2598 fRuns[runNo].SetAddT0Bin(bin, addRunIdx, histoIdx);
2613 if (runNo >=
fRuns.size()) {
2614 std::cerr << std::endl <<
">> PMsrHandler::SetMsrDataRangeEntry: **ERROR** runNo = " << runNo <<
", is out of valid range 0.." <<
fRuns.size();
2615 std::cerr << std::endl;
2619 fRuns[runNo].SetDataRange(bin, idx);
2634 if (runNo >=
fRuns.size()) {
2635 std::cerr << std::endl <<
">> PMsrHandler::SetMsrBkgRangeEntry: **ERROR** runNo = " << runNo <<
", is out of valid range 0.." <<
fRuns.size();
2636 std::cerr << std::endl;
2640 fRuns[runNo].SetBkgRange(bin, idx);
2661 if (paramNo >=
fParam.size())
2694 Bool_t error =
false;
2696 PMsrLines::iterator iter;
2698 TObjArray *tokens =
nullptr;
2699 TObjString *ostr =
nullptr;
2703 iter = lines.begin();
2704 while ((iter != lines.end()) && !error) {
2709 param.
fName = TString(
"");
2719 tokens = iter->fLine.Tokenize(
" \t");
2721 std::cerr << std::endl <<
">> PMsrHandler::HandleFitParameterEntry: **SEVERE ERROR** Couldn't tokenize Parameters in line " << iter->fLineNo;
2722 std::cerr << std::endl << std::endl;
2727 if ((tokens->GetEntries() < 4) || (tokens->GetEntries() > 7) || (tokens->GetEntries() == 6)) {
2731 ostr =
dynamic_cast<TObjString*
>(tokens->At(0));
2732 str = ostr->GetString();
2734 param.
fNo = str.Atoi();
2739 ostr =
dynamic_cast<TObjString*
>(tokens->At(1));
2740 str = ostr->GetString();
2744 ostr =
dynamic_cast<TObjString*
>(tokens->At(2));
2745 str = ostr->GetString();
2747 param.
fValue = static_cast<Double_t>(str.Atof());
2752 ostr =
dynamic_cast<TObjString*
>(tokens->At(3));
2753 str = ostr->GetString();
2755 param.
fStep = static_cast<Double_t>(str.Atof());
2760 if (tokens->GetEntries() == 4) {
2765 if (tokens->GetEntries() == 5) {
2769 ostr =
dynamic_cast<TObjString*
>(tokens->At(4));
2770 str = ostr->GetString();
2771 if (str.IsFloat()) {
2773 param.
fPosError =
static_cast<Double_t
>(str.Atof());
2776 if (!str.CompareTo(
"none", TString::kIgnoreCase))
2784 if (tokens->GetEntries() == 7) {
2788 ostr =
dynamic_cast<TObjString*
>(tokens->At(4));
2789 str = ostr->GetString();
2790 if (str.IsFloat()) {
2792 param.
fPosError =
static_cast<Double_t
>(str.Atof());
2795 if (!str.CompareTo(
"none", TString::kIgnoreCase))
2802 ostr =
dynamic_cast<TObjString*
>(tokens->At(5));
2803 str = ostr->GetString();
2805 if (!str.CompareTo(
"none", TString::kIgnoreCase)) {
2808 if (str.IsFloat()) {
2817 ostr =
dynamic_cast<TObjString*
>(tokens->At(6));
2818 str = ostr->GetString();
2820 if (!str.CompareTo(
"none", TString::kIgnoreCase)) {
2823 if (str.IsFloat()) {
2839 std::cerr << std::endl;
2840 std::cerr << std::endl <<
">> PMsrHandler::HandleFitParameterEntry: **ERROR** in line " << iter->fLineNo <<
":";
2841 std::cerr << std::endl <<
">> " << iter->fLine.Data();
2842 std::cerr << std::endl <<
">> A Fit Parameter line needs to have the following form: ";
2843 std::cerr << std::endl;
2844 std::cerr << std::endl <<
">> No Name Value Step/Error [Lower_Boundary Upper_Boundary]";
2845 std::cerr << std::endl;
2846 std::cerr << std::endl <<
">> or";
2847 std::cerr << std::endl;
2848 std::cerr << std::endl <<
">> No Name Value Step/Neg_Error Pos_Error [Lower_Boundary Upper_Boundary]";
2849 std::cerr << std::endl;
2850 std::cerr << std::endl <<
">> No: the parameter number (an Int_t)";
2851 std::cerr << std::endl <<
">> Name: the name of the parameter (less than 256 character)";
2852 std::cerr << std::endl <<
">> Value: the starting value of the parameter (a Double_t)";
2853 std::cerr << std::endl <<
">> Step/Error,";
2854 std::cerr << std::endl <<
">> Step/Neg_Error: the starting step value in a fit (a Double_t), or";
2855 std::cerr << std::endl <<
">> the symmetric error (MIGRAD, SIMPLEX), or";
2856 std::cerr << std::endl <<
">> the negative error (MINOS)";
2857 std::cerr << std::endl <<
">> Pos_Error: the positive error (MINOS), (a Double_t or \"none\")";
2858 std::cerr << std::endl <<
">> Lower_Boundary: the lower boundary allowed for the fit parameter (a Double_t or \"none\")";
2859 std::cerr << std::endl <<
">> Upper_Boundary: the upper boundary allowed for the fit parameter (a Double_t or \"none\")";
2860 std::cerr << std::endl;
2875 for (UInt_t i=0; i<
fParam.size(); i++) {
2876 if (
fParam[i].fNo != static_cast<Int_t>(i)+1) {
2878 std::cerr << std::endl <<
">> PMsrHandler::HandleFitParameterEntry: **ERROR**";
2879 std::cerr << std::endl <<
">> Sorry, you are assuming to much from this program, it cannot";
2880 std::cerr << std::endl <<
">> handle none subsequent numbered parameters yet or in the near future.";
2881 std::cerr << std::endl <<
">> Found parameter " <<
fParam[i].fName.Data() <<
", with";
2882 std::cerr << std::endl <<
">> parameter number " <<
fParam[i].fNo <<
", at paramter position " << i+1 <<
".";
2883 std::cerr << std::endl <<
">> This needs to be fixed first.";
2884 std::cerr << std::endl;
2945 if ((
fFuncHandler->GetNoOfFuncs() == 0) && !lines.empty()) {
2946 std::cerr << std::endl <<
">> PMsrHandler::HandleFunctionsEntry: **WARNING** empty FUNCTIONS block found!";
2947 std::cerr << std::endl;
2967 PMsrLines::iterator iter;
2970 Bool_t error =
false;
2973 TObjArray *tokens =
nullptr;
2974 TObjString *ostr =
nullptr;
2976 Double_t dval = 0.0;
2977 UInt_t addT0Counter = 0;
2982 iter = lines.begin();
2983 while ((iter != lines.end()) && !error) {
2986 Ssiz_t idx = str.Index(
"#");
2991 tokens = str.Tokenize(
" \t");
2993 std::cerr << std::endl <<
">> PMsrHandler::HandleGlobalEntry: **SEVERE ERROR** Couldn't tokenize line " << iter->fLineNo;
2994 std::cerr << std::endl << std::endl;
2998 if (iter->fLine.BeginsWith(
"fittype", TString::kIgnoreCase)) {
2999 if (tokens->GetEntries() < 2) {
3002 ostr =
dynamic_cast<TObjString*
>(tokens->At(1));
3003 str = ostr->GetString();
3004 if (str.IsDigit()) {
3005 Int_t fittype = str.Atoi();
3021 }
else if (iter->fLine.BeginsWith(
"rrf_freq", TString::kIgnoreCase)) {
3022 if (tokens->GetEntries() < 3) {
3025 ostr =
dynamic_cast<TObjString*
>(tokens->At(1));
3026 str = ostr->GetString();
3027 if (str.IsFloat()) {
3033 ostr =
dynamic_cast<TObjString*
>(tokens->At(2));
3034 str = ostr->GetString();
3040 }
else if (iter->fLine.BeginsWith(
"rrf_packing", TString::kIgnoreCase)) {
3041 if (tokens->GetEntries() < 2) {
3044 ostr =
dynamic_cast<TObjString*
>(tokens->At(1));
3045 str = ostr->GetString();
3046 if (str.IsDigit()) {
3057 }
else if (iter->fLine.BeginsWith(
"rrf_phase", TString::kIgnoreCase)) {
3058 if (tokens->GetEntries() < 2) {
3061 ostr =
dynamic_cast<TObjString*
>(tokens->At(1));
3062 str = ostr->GetString();
3063 if (str.IsFloat()) {
3070 }
else if (iter->fLine.BeginsWith(
"data", TString::kIgnoreCase)) {
3071 if (tokens->GetEntries() < 3) {
3074 for (Int_t i=1; i<tokens->GetEntries(); i++) {
3075 ostr =
dynamic_cast<TObjString*
>(tokens->At(i));
3076 str = ostr->GetString();
3077 if (str.IsDigit()) {
3089 }
else if (iter->fLine.BeginsWith(
"t0", TString::kIgnoreCase)) {
3090 if (tokens->GetEntries() < 2) {
3093 for (Int_t i=1; i<tokens->GetEntries(); i++) {
3094 ostr =
dynamic_cast<TObjString*
>(tokens->At(i));
3095 str = ostr->GetString();
3096 if (str.IsFloat()) {
3107 }
else if (iter->fLine.BeginsWith(
"addt0", TString::kIgnoreCase)) {
3108 if (tokens->GetEntries() < 2) {
3111 for (Int_t i=1; i<tokens->GetEntries(); i++) {
3112 ostr =
dynamic_cast<TObjString*
>(tokens->At(i));
3113 str = ostr->GetString();
3114 if (str.IsFloat()) {
3126 }
else if (iter->fLine.BeginsWith(
"fit", TString::kIgnoreCase)) {
3127 if (tokens->GetEntries() < 3) {
3130 if (iter->fLine.Contains(
"fgb", TString::kIgnoreCase)) {
3132 ostr =
dynamic_cast<TObjString*
>(tokens->At(1));
3133 str = ostr->GetString();
3134 Ssiz_t idx = str.First(
"+");
3135 TString numStr = str;
3137 numStr.Remove(0,idx+1);
3138 if (numStr.IsFloat()) {
3147 ostr =
dynamic_cast<TObjString*
>(tokens->At(2));
3148 str = ostr->GetString();
3149 idx = str.First(
"-");
3152 numStr.Remove(0,idx+1);
3153 if (numStr.IsFloat()) {
3164 for (Int_t i=1; i<3; i++) {
3165 ostr =
dynamic_cast<TObjString*
>(tokens->At(i));
3166 str = ostr->GetString();
3174 }
else if (iter->fLine.BeginsWith(
"packing", TString::kIgnoreCase)) {
3175 if (tokens->GetEntries() < 2) {
3178 ostr =
dynamic_cast<TObjString*
>(tokens->At(1));
3179 str = ostr->GetString();
3180 if (str.IsDigit()) {
3204 std::cerr << std::endl <<
">> PMsrHandler::HandleGlobalEntry: **ERROR** in line " << iter->fLineNo <<
":";
3205 std::cerr << std::endl <<
">> '" << iter->fLine.Data() <<
"'";
3206 std::cerr << std::endl <<
">> GLOBAL block syntax is too complex to print it here. Please check the manual.";
3228 PMsrLines::iterator iter;
3230 Bool_t first =
true;
3231 Bool_t error =
false;
3232 Bool_t runLinePresent =
false;
3235 TObjArray *tokens =
nullptr;
3236 TObjString *ostr =
nullptr;
3238 UInt_t addT0Counter = 0;
3243 iter = lines.begin();
3244 while ((iter != lines.end()) && !error) {
3247 Ssiz_t idx = str.Index(
"#");
3252 tokens = str.Tokenize(
" \t");
3254 std::cerr << std::endl <<
">> PMsrHandler::HandleRunEntry: **SEVERE ERROR** Couldn't tokenize Parameters in line " << iter->fLineNo;
3255 std::cerr << std::endl << std::endl;
3262 line.Remove(TString::kLeading,
' ');
3265 if (line.BeginsWith(
"run", TString::kIgnoreCase)) {
3267 runLinePresent =
true;
3270 fRuns.push_back(param);
3277 if (tokens->GetEntries() < 5) {
3281 ostr =
dynamic_cast<TObjString*
>(tokens->At(1));
3282 str = ostr->GetString();
3285 ostr =
dynamic_cast<TObjString*
>(tokens->At(2));
3286 str = ostr->GetString();
3289 ostr =
dynamic_cast<TObjString*
>(tokens->At(3));
3290 str = ostr->GetString();
3293 ostr =
dynamic_cast<TObjString*
>(tokens->At(4));
3294 str = ostr->GetString();
3302 if (line.BeginsWith(
"addrun", TString::kIgnoreCase)) {
3304 if (!runLinePresent) {
3305 std::cerr << std::endl <<
">> PMsrHandler::HandleRunEntry: **ERROR** Found ADDRUN without prior RUN, or";
3306 std::cerr << std::endl <<
">> ADDRUN lines intercepted by other stuff. All this is not allowed!";
3307 std::cerr << std::endl <<
">> error in line " << iter->fLineNo;
3308 std::cerr << std::endl;
3314 if (tokens->GetEntries() < 5) {
3318 ostr =
dynamic_cast<TObjString*
>(tokens->At(1));
3319 str = ostr->GetString();
3322 ostr =
dynamic_cast<TObjString*
>(tokens->At(2));
3323 str = ostr->GetString();
3326 ostr =
dynamic_cast<TObjString*
>(tokens->At(3));
3327 str = ostr->GetString();
3330 ostr =
dynamic_cast<TObjString*
>(tokens->At(4));
3331 str = ostr->GetString();
3337 if (line.BeginsWith(
"fittype", TString::kIgnoreCase)) {
3339 runLinePresent =
false;
3341 if (tokens->GetEntries() < 2) {
3344 ostr =
dynamic_cast<TObjString*
>(tokens->At(1));
3345 str = ostr->GetString();
3346 if (str.IsDigit()) {
3347 Int_t fittype = str.Atoi();
3366 if (line.BeginsWith(
"alpha", TString::kIgnoreCase)) {
3368 runLinePresent =
false;
3370 if (tokens->GetEntries() < 2) {
3373 ostr =
dynamic_cast<TObjString*
>(tokens->At(1));
3374 str = ostr->GetString();
3375 if (str.IsDigit()) {
3381 }
else if (str.Contains(
"fun")) {
3394 if (line.BeginsWith(
"beta", TString::kIgnoreCase)) {
3396 runLinePresent =
false;
3398 if (tokens->GetEntries() < 2) {
3401 ostr =
dynamic_cast<TObjString*
>(tokens->At(1));
3402 str = ostr->GetString();
3403 if (str.IsDigit()) {
3409 }
else if (str.Contains(
"fun")) {
3422 if (line.BeginsWith(
"norm", TString::kIgnoreCase)) {
3424 runLinePresent =
false;
3426 if (tokens->GetEntries() < 2) {
3429 ostr =
dynamic_cast<TObjString*
>(tokens->At(1));
3430 str = ostr->GetString();
3431 if (str.IsDigit()) {
3433 }
else if (str.Contains(
"fun")) {
3446 if (line.BeginsWith(
"backgr.fit", TString::kIgnoreCase)) {
3448 runLinePresent =
false;
3450 if (tokens->GetEntries() < 2) {
3453 ostr =
dynamic_cast<TObjString*
>(tokens->At(1));
3454 str = ostr->GetString();
3455 if (str.IsDigit()) {
3468 if (line.BeginsWith(
"lifetime ", TString::kIgnoreCase)) {
3470 runLinePresent =
false;
3472 if (tokens->GetEntries() < 2) {
3475 ostr =
dynamic_cast<TObjString*
>(tokens->At(1));
3476 str = ostr->GetString();
3477 if (str.IsDigit()) {
3490 if (line.BeginsWith(
"lifetimecorrection", TString::kIgnoreCase)) {
3492 runLinePresent =
false;
3498 if (line.BeginsWith(
"map", TString::kIgnoreCase)) {
3500 runLinePresent =
false;
3502 for (Int_t i=1; i<tokens->GetEntries(); i++) {
3503 ostr =
dynamic_cast<TObjString*
>(tokens->At(i));
3504 str = ostr->GetString();
3505 if (str.IsDigit()) {
3517 for (UInt_t i=0; i<param.
GetMap()->size(); i++) {
3518 if ((param.
GetMap(i) < 0) || (param.
GetMap(i) >
static_cast<Int_t
>(
fParam.size()))) {
3519 std::cerr << std::endl <<
">> PMsrHandler::HandleRunEntry: **SEVERE ERROR** map value " << param.
GetMap(i) <<
" in line " << iter->fLineNo <<
" is out of range!";
3528 if (line.BeginsWith(
"forward", TString::kIgnoreCase)) {
3530 runLinePresent =
false;
3532 if (tokens->GetEntries() < 2) {
3537 std::unique_ptr<PStringNumberList> rl = std::make_unique<PStringNumberList>(str.Data());
3538 std::string errorMsg(
"");
3539 if (rl->Parse(errorMsg,
true)) {
3540 group = rl->GetList();
3541 for (UInt_t i=0; i<group.size(); i++) {
3552 if (line.BeginsWith(
"backward", TString::kIgnoreCase)) {
3554 runLinePresent =
false;
3556 if (tokens->GetEntries() < 2) {
3561 std::unique_ptr<PStringNumberList> rl = std::make_unique<PStringNumberList>(str.Data());
3562 std::string errorMsg(
"");
3563 if (rl->Parse(errorMsg,
true)) {
3564 group = rl->GetList();
3565 for (UInt_t i=0; i<group.size(); i++) {
3576 if (line.BeginsWith(
"backgr.fix", TString::kIgnoreCase)) {
3578 runLinePresent =
false;
3580 if (tokens->GetEntries() < 2) {
3583 for (Int_t i=1; i<tokens->GetEntries(); i++) {
3584 ostr =
dynamic_cast<TObjString*
>(tokens->At(i));
3585 str = ostr->GetString();
3595 if (line.BeginsWith(
"background", TString::kIgnoreCase)) {
3597 runLinePresent =
false;
3599 if ((tokens->GetEntries() < 3) || (tokens->GetEntries() % 2 != 1)) {
3602 for (Int_t i=1; i<tokens->GetEntries(); i++) {
3603 ostr =
dynamic_cast<TObjString*
>(tokens->At(i));
3604 str = ostr->GetString();
3605 if (str.IsDigit()) {
3619 if (line.BeginsWith(
"data", TString::kIgnoreCase)) {
3621 runLinePresent =
false;
3623 if ((tokens->GetEntries() < 3) || (tokens->GetEntries() % 2 != 1)) {
3626 for (Int_t i=1; i<tokens->GetEntries(); i++) {
3627 ostr =
dynamic_cast<TObjString*
>(tokens->At(i));
3628 str = ostr->GetString();
3629 if (str.IsDigit()) {
3643 if (line.BeginsWith(
"t0", TString::kIgnoreCase)) {
3645 runLinePresent =
false;
3647 if (tokens->GetEntries() < 2) {
3650 for (Int_t i=1; i<tokens->GetEntries(); i++) {
3651 ostr =
dynamic_cast<TObjString*
>(tokens->At(i));
3652 str = ostr->GetString();
3653 if (str.IsFloat()) {
3667 if (line.BeginsWith(
"addt0", TString::kIgnoreCase)) {
3669 runLinePresent =
false;
3671 if (tokens->GetEntries() < 2) {
3674 for (Int_t i=1; i<tokens->GetEntries(); i++) {
3675 ostr =
dynamic_cast<TObjString*
>(tokens->At(i));
3676 str = ostr->GetString();
3677 if (str.IsFloat()) {
3693 if (line.BeginsWith(
"fit ", TString::kIgnoreCase)) {
3695 runLinePresent =
false;
3697 if (tokens->GetEntries() < 3) {
3700 if (iter->fLine.Contains(
"fgb", TString::kIgnoreCase)) {
3702 ostr =
dynamic_cast<TObjString*
>(tokens->At(1));
3703 str = ostr->GetString();
3704 Ssiz_t idx = str.First(
"+");
3705 TString numStr = str;
3707 numStr.Remove(0,idx+1);
3708 if (numStr.IsFloat()) {
3717 ostr =
dynamic_cast<TObjString*
>(tokens->At(2));
3718 str = ostr->GetString();
3719 idx = str.First(
"-");
3722 numStr.Remove(0,idx+1);
3723 if (numStr.IsFloat()) {
3735 for (Int_t i=1; i<3; i++) {
3736 ostr =
dynamic_cast<TObjString*
>(tokens->At(i));
3737 str = ostr->GetString();
3748 if (line.BeginsWith(
"packing", TString::kIgnoreCase)) {
3750 runLinePresent =
false;
3752 if (tokens->GetEntries() != 2) {
3755 ostr =
dynamic_cast<TObjString*
>(tokens->At(1));
3756 str = ostr->GetString();
3757 if (str.IsDigit()) {
3770 if (line.BeginsWith(
"xy-data", TString::kIgnoreCase)) {
3772 runLinePresent =
false;
3774 if (tokens->GetEntries() != 3) {
3777 ostr =
dynamic_cast<TObjString*
>(tokens->At(1));
3778 str = ostr->GetString();
3779 if (str.IsDigit()) {
3781 ostr =
dynamic_cast<TObjString*
>(tokens->At(2));
3782 str = ostr->GetString();
3783 if (str.IsDigit()) {
3794 ostr =
dynamic_cast<TObjString*
>(tokens->At(2));
3795 str = ostr->GetString();
3812 std::cerr << std::endl <<
">> PMsrHandler::HandleRunEntry: **ERROR** in line " << iter->fLineNo <<
":";
3813 std::cerr << std::endl <<
">> " << iter->fLine.Data();
3814 std::cerr << std::endl <<
">> RUN block syntax is too complex to print it here. Please check the manual.";
3816 fRuns.push_back(param);
3843 Int_t found, no_found=-1;
3846 Char_t *cstr, filterStr[32];
3847 cstr =
new Char_t[str.Sizeof()];
3848 strncpy(cstr, str.Data(), str.Sizeof());
3849 snprintf(filterStr,
sizeof(filterStr),
"%s%%d", filter);
3852 found = sscanf(cstr, filterStr, &no_found);
3854 if (no_found < 1000)
3855 no = no_found + offset;
3863 if ((no_found < 0) || (no_found > 1000))
3886 PMsrLines::iterator iter;
3888 if (lines.empty()) {
3889 std::cerr << std::endl <<
">> PMsrHandler::HandleCommandsEntry(): **WARNING**: There is no COMMAND block! Do you really want this?";
3890 std::cerr << std::endl;
3893 for (iter = lines.begin(); iter != lines.end(); ++iter) {
3894 if (!iter->fLine.BeginsWith(
"COMMANDS"))
3920 for (UInt_t i=0; i<2; i++) {
3939 Ssiz_t idx = str.First(
'#');
3943 truncStr.Resize(idx-1);
3963 Bool_t result =
true;
3965 TObjArray *tok = str.Tokenize(
" ,;\t");
3966 if (tok ==
nullptr) {
3967 std::cerr << std::endl <<
">> PMsrHandler::ParseFourierPhaseValueVector: **ERROR** couldn't tokenize Fourier phase line." << std::endl << std::endl;
3972 if (tok->GetEntries() < 2) {
3978 TObjString *ostr =
nullptr;
3980 for (Int_t i=1; i<tok->GetEntries(); i++) {
3981 ostr =
dynamic_cast<TObjString*
>(tok->At(i));
3982 sstr = ostr->GetString();
3983 if (sstr.IsFloat()) {
3984 fourier.
fPhase.push_back(sstr.Atof());
3988 std::cerr << std::endl <<
">> PMsrHandler::ParseFourierPhaseValueVector: **ERROR** in Fourier phase line.";
3989 std::cerr << std::endl <<
">> Attempt to mix val, parX? This is currently not supported." << std::endl << std::endl;
4022 Bool_t result =
true;
4025 TObjArray *tok = str.Tokenize(
" ,;\t");
4026 if (tok ==
nullptr) {
4027 std::cerr << std::endl <<
">> PMsrHandler::ParseFourierPhaseParVector: **ERROR** couldn't tokenize Fourier phase line." << std::endl << std::endl;
4032 if (tok->GetEntries() < 2) {
4039 for (Int_t i=1; i<tok->GetEntries(); i++) {
4040 TObjString *ostr =
dynamic_cast<TObjString*
>(tok->At(i));
4041 sstr = ostr->GetString();
4042 if (!sstr.BeginsWith(
"par")) {
4043 std::cerr <<
">> PMsrHandler::ParseFourierPhaseParVector: **ERROR** found unhandable token '" << sstr <<
"'" << std::endl;
4049 if (sstr.BeginsWith(
"parR")) {
4054 if (sstr.BeginsWith(
"par(")) {
4061 std::cerr <<
">> PMsrHandler::ParseFourierPhaseParVector: **ERROR** found multiple parR's! Only one reference phase is accepted." << std::endl;
4067 if (result !=
false) {
4068 for (Int_t i=1; i<tok->GetEntries(); i++) {
4069 TObjString *ostr =
dynamic_cast<TObjString*
>(tok->At(i));
4070 sstr = ostr->GetString();
4072 if (sstr.BeginsWith(
"parR")) {
4075 sstr.Remove(0, rmNoOf);
4076 if (sstr.IsDigit()) {
4081 std::cerr <<
">> PMsrHandler::ParseFourierPhaseParVector: **ERROR** found token '" << ostr->GetString() <<
"' which is not parX with X an integer." << std::endl;
4123 wstr = wstr.Strip(TString::kLeading,
' ');
4126 if (!wstr.BeginsWith(
"par(") && !wstr.BeginsWith(
"parR(")) {
4127 std::cout <<
">> PMsrHandler::ParseFourierPhaseParIterVector: **ERROR** token should start with 'par(' or 'parR(', found: '" << wstr <<
"' -> ERROR" << std::endl;
4132 Bool_t relativePhase =
false;
4133 if (wstr.BeginsWith(
"parR(")) {
4135 relativePhase =
true;
4137 wstr.Remove(0, noOf);
4140 wstr = wstr.Strip(TString::kTrailing,
' ');
4143 Ssiz_t idx=wstr.Last(
')');
4144 wstr.Remove(idx, wstr.Length()-idx);
4147 TObjArray *tok = wstr.Tokenize(
",;");
4148 if (tok ==
nullptr) {
4149 std::cerr <<
">> PMsrHandler::ParseFourierPhaseParIterVector: **ERROR** tokenize failed." << std::endl;
4155 if (tok->GetEntries() != 3) {
4156 std::cerr <<
">> PMsrHandler::ParseFourierPhaseParIterVector: **ERROR** wrong syntax for the expected par(X0, offset, #param)." << std::endl;
4162 Int_t x0, offset, noParam;
4165 TObjString *ostr =
dynamic_cast<TObjString*
>(tok->At(0));
4166 wstr = ostr->GetString();
4167 if (wstr.IsDigit()) {
4170 std::cerr <<
">> PMsrHandler::ParseFourierPhaseParIterVector: **ERROR** X0='" << wstr <<
"' is not an integer." << std::endl;
4177 ostr =
dynamic_cast<TObjString*
>(tok->At(1));
4178 wstr = ostr->GetString();
4179 if (wstr.IsDigit()) {
4180 offset = wstr.Atoi();
4182 std::cerr <<
">> PMsrHandler::ParseFourierPhaseParIterVector: **ERROR** offset='" << wstr <<
"' is not an integer." << std::endl;
4189 ostr =
dynamic_cast<TObjString*
>(tok->At(2));
4190 wstr = ostr->GetString();
4191 if (wstr.IsDigit()) {
4192 noParam = wstr.Atoi();
4194 std::cerr <<
">> PMsrHandler::ParseFourierPhaseParIterVector: **ERROR** #Param='" << wstr <<
"' is not an integer." << std::endl;
4206 for (Int_t i=0; i<noParam; i++)
4231 Bool_t error =
false;
4242 PMsrLines::iterator iter;
4244 TObjArray *tokens =
nullptr;
4245 TObjString *ostr =
nullptr;
4246 TString str, pcStr=TString(
"");
4250 iter = lines.begin();
4251 while ((iter != lines.end()) && !error) {
4253 tokens = iter->fLine.Tokenize(
" \t");
4255 std::cerr << std::endl <<
">> PMsrHandler::HandleFourierEntry: **SEVERE ERROR** Couldn't tokenize Parameters in line " << iter->fLineNo;
4256 std::cerr << std::endl << std::endl;
4260 if (iter->fLine.BeginsWith(
"units", TString::kIgnoreCase)) {
4261 if (tokens->GetEntries() < 2) {
4265 ostr =
dynamic_cast<TObjString*
>(tokens->At(1));
4266 str = ostr->GetString();
4267 if (!str.CompareTo(
"gauss", TString::kIgnoreCase)) {
4269 }
else if (!str.CompareTo(
"tesla", TString::kIgnoreCase)) {
4271 }
else if (!str.CompareTo(
"mhz", TString::kIgnoreCase)) {
4273 }
else if (!str.CompareTo(
"mc/s", TString::kIgnoreCase)) {
4280 }
else if (iter->fLine.BeginsWith(
"fourier_power", TString::kIgnoreCase)) {
4281 if (tokens->GetEntries() < 2) {
4285 ostr =
dynamic_cast<TObjString*
>(tokens->At(1));
4286 str = ostr->GetString();
4287 if (str.IsDigit()) {
4289 if ((ival >= 0) && (ival <= 20)) {
4300 }
else if (iter->fLine.BeginsWith(
"dc-corrected", TString::kIgnoreCase)) {
4301 if (tokens->GetEntries() < 2) {
4305 ostr =
dynamic_cast<TObjString*
>(tokens->At(1));
4306 str = ostr->GetString();
4307 if (!str.CompareTo(
"true", TString::kIgnoreCase) || !str.CompareTo(
"1")) {
4309 }
else if (!str.CompareTo(
"false", TString::kIgnoreCase) || !str.CompareTo(
"0")) {
4316 }
else if (iter->fLine.BeginsWith(
"apodization", TString::kIgnoreCase)) {
4317 if (tokens->GetEntries() < 2) {
4321 ostr =
dynamic_cast<TObjString*
>(tokens->At(1));
4322 str = ostr->GetString();
4323 if (!str.CompareTo(
"none", TString::kIgnoreCase)) {
4325 }
else if (!str.CompareTo(
"weak", TString::kIgnoreCase)) {
4327 }
else if (!str.CompareTo(
"medium", TString::kIgnoreCase)) {
4329 }
else if (!str.CompareTo(
"strong", TString::kIgnoreCase)) {
4336 }
else if (iter->fLine.BeginsWith(
"plot", TString::kIgnoreCase)) {
4337 if (tokens->GetEntries() < 2) {
4341 ostr =
dynamic_cast<TObjString*
>(tokens->At(1));
4342 str = ostr->GetString();
4343 if (!str.CompareTo(
"real", TString::kIgnoreCase)) {
4345 }
else if (!str.CompareTo(
"imag", TString::kIgnoreCase)) {
4347 }
else if (!str.CompareTo(
"real_and_imag", TString::kIgnoreCase)) {
4349 }
else if (!str.CompareTo(
"power", TString::kIgnoreCase)) {
4351 }
else if (!str.CompareTo(
"phase", TString::kIgnoreCase)) {
4353 }
else if (!str.CompareTo(
"phase_opt_real", TString::kIgnoreCase)) {
4360 }
else if (iter->fLine.BeginsWith(
"phase", TString::kIgnoreCase)) {
4361 if (tokens->GetEntries() < 2) {
4391 if (!result || error) {
4399 std::cerr <<
">> PMsrHandler::HandleFourierEntry: found Fourier parameter entry par" << fourier.
fPhaseParamNo[i] <<
" > #Param = " <<
fParam.size() << std::endl;
4408 Double_t phaseRef = 0.0;
4423 }
else if (iter->fLine.BeginsWith(
"range_for_phase_correction", TString::kIgnoreCase)) {
4427 pcStr = iter->fLine;
4428 }
else if (iter->fLine.BeginsWith(
"range", TString::kIgnoreCase)) {
4429 if (tokens->GetEntries() < 3) {
4433 for (UInt_t i=0; i<2; i++) {
4434 ostr =
dynamic_cast<TObjString*
>(tokens->At(i+1));
4435 str = ostr->GetString();
4436 if (str.IsFloat()) {
4444 }
else if (!iter->fLine.BeginsWith(
"fourier", TString::kIgnoreCase) && !iter->fLine.BeginsWith(
"#") &&
4445 !iter->fLine.IsWhitespace() && (iter->fLine.Length() != 0)) {
4466 if ((pcStr.Length() != 0) && !error) {
4468 tokens = pcStr.Tokenize(
" \t");
4470 switch (tokens->GetEntries()) {
4472 ostr =
dynamic_cast<TObjString*
>(tokens->At(1));
4473 str = ostr->GetString();
4474 if (!str.CompareTo(
"all", TString::kIgnoreCase)) {
4482 for (UInt_t i=0; i<2; i++) {
4483 ostr =
dynamic_cast<TObjString*
>(tokens->At(i+1));
4484 str = ostr->GetString();
4485 if (str.IsFloat()) {
4505 std::cerr << std::endl <<
">> PMsrHandler::HandleFourierEntry: **ERROR** in line " << iter->fLineNo <<
":";
4506 std::cerr << std::endl;
4507 std::cerr << std::endl <<
">> " << iter->fLine.Data();
4508 std::cerr << std::endl;
4509 std::cerr << std::endl <<
">> FOURIER block syntax, parameters in [] are optinal:";
4510 std::cerr << std::endl;
4511 std::cerr << std::endl <<
">> FOURIER";
4512 std::cerr << std::endl <<
">> [units Gauss | MHz | Mc/s]";
4513 std::cerr << std::endl <<
">> [fourier_power n # n is a number such that zero padding up to 2^n will be used]";
4514 std::cerr << std::endl <<
">> n=0 means no zero padding";
4515 std::cerr << std::endl <<
">> 0 <= n <= 20 are allowed values";
4516 std::cerr << std::endl <<
">> [dc-corrected true | false]";
4517 std::cerr << std::endl <<
">> [apodization none | weak | medium | strong]";
4518 std::cerr << std::endl <<
">> [plot real | imag | real_and_imag | power | phase | phase_opt_real]";
4519 std::cerr << std::endl <<
">> [phase valList | parList | parIterList [# comment]]";
4520 std::cerr << std::endl <<
">> valList : val [sep val ... sep val]. sep=' ,;\\t'";
4521 std::cerr << std::endl <<
">> parList : parX0 [sep parX1 ... sep parX1]";
4522 std::cerr << std::endl <<
">> parIterList : par(X0,offset,#param), with X0=first parameter number";
4523 std::cerr << std::endl <<
">> offset=parameter offset, #param=number of phase parameters.";
4524 std::cerr << std::endl <<
">> [range_for_phase_correction min max | all]";
4525 std::cerr << std::endl <<
">> [range min max]";
4526 std::cerr << std::endl;
4548 Bool_t error =
false;
4552 PMsrLines::iterator iter1;
4553 PMsrLines::iterator iter2;
4554 TObjArray *tokens =
nullptr;
4555 TObjString *ostr =
nullptr;
4558 if (lines.empty()) {
4559 std::cerr << std::endl <<
">> PMsrHandler::HandlePlotEntry(): **WARNING**: There is no PLOT block! Do you really want this?";
4560 std::cerr << std::endl;
4563 iter1 = lines.begin();
4564 while ((iter1 != lines.end()) && !error) {
4570 param.
fLogX =
false;
4571 param.
fLogY =
false;
4573 param.
fRuns.clear();
4574 param.
fTmin.clear();
4575 param.
fTmax.clear();
4576 param.
fYmin.clear();
4577 param.
fYmax.clear();
4587 for ( ; iter2 != lines.end(); ++iter2) {
4588 if (iter2->fLine.Contains(
"PLOT"))
4593 while ((iter1 != iter2) && !error) {
4594 TString line = iter1->fLine;
4595 if (line.First(
'#') != -1)
4596 line.Resize(line.First(
'#'));
4598 if (line.Contains(
"PLOT")) {
4599 tokens = line.Tokenize(
" \t");
4601 std::cerr << std::endl <<
">> PMsrHandler::HandlePlotEntry: **SEVERE ERROR** Couldn't tokenize PLOT in line " << iter1->fLineNo;
4602 std::cerr << std::endl << std::endl;
4605 if (tokens->GetEntries() < 2) {
4608 ostr =
dynamic_cast<TObjString*
>(tokens->At(1));
4609 str = ostr->GetString();
4620 }
else if (line.Contains(
"lifetimecorrection", TString::kIgnoreCase)) {
4622 }
else if (line.Contains(
"runs", TString::kIgnoreCase)) {
4624 std::unique_ptr<PStringNumberList> rl;
4625 std::string errorMsg;
4638 rl = std::make_unique<PStringNumberList>(line.Data());
4639 if (!rl->Parse(errorMsg,
true)) {
4640 std::cerr << std::endl <<
">> PMsrHandler::HandlePlotEntry: **SEVERE ERROR** Couldn't tokenize PLOT in line " << iter1->fLineNo;
4641 std::cerr << std::endl <<
">> Error Message: " << errorMsg;
4642 std::cerr << std::endl << std::endl;
4645 runList = rl->GetList();
4646 for (UInt_t i=0; i<runList.size(); i++) {
4647 run = TComplex(runList[i], -1.0);
4648 param.
fRuns.push_back(run);
4657 }
else if (line.Contains(
"range ", TString::kIgnoreCase)) {
4659 param.
fTmin.clear();
4660 param.
fTmax.clear();
4661 param.
fYmin.clear();
4662 param.
fYmax.clear();
4664 tokens = line.Tokenize(
" \t");
4666 std::cerr << std::endl <<
">> PMsrHandler::HandlePlotEntry: **SEVERE ERROR** Couldn't tokenize PLOT in line " << iter1->fLineNo;
4667 std::cerr << std::endl << std::endl;
4670 if ((tokens->GetEntries() != 3) && (tokens->GetEntries() != 5)) {
4675 ostr =
dynamic_cast<TObjString*
>(tokens->At(1));
4676 str = ostr->GetString();
4678 param.
fTmin.push_back(static_cast<Double_t>(str.Atof()));
4683 ostr =
dynamic_cast<TObjString*
>(tokens->At(2));
4684 str = ostr->GetString();
4686 param.
fTmax.push_back(static_cast<Double_t>(str.Atof()));
4690 if (tokens->GetEntries() == 5) {
4693 ostr =
dynamic_cast<TObjString*
>(tokens->At(3));
4694 str = ostr->GetString();
4696 param.
fYmin.push_back(static_cast<Double_t>(str.Atof()));
4701 ostr =
dynamic_cast<TObjString*
>(tokens->At(4));
4702 str = ostr->GetString();
4704 param.
fYmax.push_back(static_cast<Double_t>(str.Atof()));
4714 }
else if (line.Contains(
"sub_ranges", TString::kIgnoreCase)) {
4716 param.
fTmin.clear();
4717 param.
fTmax.clear();
4718 param.
fYmin.clear();
4719 param.
fYmax.clear();
4721 tokens = line.Tokenize(
" \t");
4723 std::cerr << std::endl <<
">> PMsrHandler::HandlePlotEntry: **SEVERE ERROR** Couldn't tokenize PLOT in line " << iter1->fLineNo;
4724 std::cerr << std::endl << std::endl;
4727 if ((tokens->GetEntries() !=
static_cast<Int_t
>(2*param.
fRuns.size() + 1)) && (tokens->GetEntries() !=
static_cast<Int_t
>(2*param.
fRuns.size() + 3))) {
4731 for (UInt_t i=0; i<param.
fRuns.size(); i++) {
4734 ostr =
dynamic_cast<TObjString*
>(tokens->At(2*i+1));
4735 str = ostr->GetString();
4737 param.
fTmin.push_back(static_cast<Double_t>(str.Atof()));
4742 ostr =
dynamic_cast<TObjString*
>(tokens->At(2*i+2));
4743 str = ostr->GetString();
4745 param.
fTmax.push_back(static_cast<Double_t>(str.Atof()));
4751 if (tokens->GetEntries() ==
static_cast<Int_t
>(2*param.
fRuns.size() + 3)) {
4754 ostr =
dynamic_cast<TObjString*
>(tokens->At(2*param.
fRuns.size()+1));
4755 str = ostr->GetString();
4757 param.
fYmin.push_back(static_cast<Double_t>(str.Atof()));
4762 ostr =
dynamic_cast<TObjString*
>(tokens->At(2*param.
fRuns.size()+2));
4763 str = ostr->GetString();
4765 param.
fYmax.push_back(static_cast<Double_t>(str.Atof()));
4776 }
else if (line.Contains(
"use_fit_ranges", TString::kIgnoreCase)) {
4780 tokens = line.Tokenize(
" \t");
4782 std::cerr << std::endl <<
">> PMsrHandler::HandlePlotEntry: **SEVERE ERROR** Couldn't tokenize PLOT in line " << iter1->fLineNo;
4783 std::cerr << std::endl << std::endl;
4787 if (tokens->GetEntries() == 3) {
4789 ostr =
dynamic_cast<TObjString*
>(tokens->At(1));
4790 str = ostr->GetString();
4792 param.
fYmin.push_back(static_cast<Double_t>(str.Atof()));
4797 ostr =
dynamic_cast<TObjString*
>(tokens->At(2));
4798 str = ostr->GetString();
4800 param.
fYmax.push_back(static_cast<Double_t>(str.Atof()));
4805 if ((tokens->GetEntries() != 1) && (tokens->GetEntries() != 3)) {
4806 std::cerr << std::endl <<
">> PMsrHandler::HandlePlotEntry: **WARNING** use_fit_ranges with undefined additional parameters in line " << iter1->fLineNo;
4807 std::cerr << std::endl <<
">> Will ignore this PLOT block command line, sorry.";
4808 std::cerr << std::endl <<
">> Proper syntax: use_fit_ranges [ymin ymax]";
4809 std::cerr << std::endl <<
">> Found: '" << iter1->fLine.Data() <<
"'" << std::endl;
4817 }
else if (iter1->fLine.Contains(
"logx", TString::kIgnoreCase)) {
4819 }
else if (iter1->fLine.Contains(
"logy", TString::kIgnoreCase)) {
4821 }
else if (iter1->fLine.Contains(
"lifetimecorrection", TString::kIgnoreCase)) {
4823 }
else if (iter1->fLine.Contains(
"view_packing", TString::kIgnoreCase)) {
4824 tokens = iter1->fLine.Tokenize(
" \t");
4826 std::cerr << std::endl <<
">> PMsrHandler::HandlePlotEntry: **SEVERE ERROR** Couldn't tokenize view_packing in line " << iter1->fLineNo;
4827 std::cerr << std::endl << std::endl;
4830 if (tokens->GetEntries() != 2) {
4833 ostr =
dynamic_cast<TObjString*
>(tokens->At(1));
4834 str = ostr->GetString();
4835 if (str.IsDigit()) {
4836 Int_t val = str.Atoi();
4851 }
else if (iter1->fLine.Contains(
"rrf_freq", TString::kIgnoreCase)) {
4854 tokens = iter1->fLine.Tokenize(
" \t");
4856 std::cerr << std::endl <<
">> PMsrHandler::HandlePlotEntry: **SEVERE ERROR** Couldn't tokenize rrf_freq in line " << iter1->fLineNo;
4857 std::cerr << std::endl << std::endl;
4860 if (tokens->GetEntries() != 3) {
4864 ostr =
dynamic_cast<TObjString*
>(tokens->At(1));
4865 str = ostr->GetString();
4866 if (str.IsFloat()) {
4872 ostr =
dynamic_cast<TObjString*
>(tokens->At(2));
4873 str = ostr->GetString();
4874 if (str.Contains(
"kHz", TString::kIgnoreCase))
4876 else if (str.Contains(
"MHz", TString::kIgnoreCase))
4878 else if (str.Contains(
"Mc/s", TString::kIgnoreCase))
4880 else if (str.Contains(
"G", TString::kIgnoreCase))
4882 else if (str.Contains(
"T", TString::kIgnoreCase))
4892 }
else if (iter1->fLine.Contains(
"rrf_phase", TString::kIgnoreCase)) {
4895 tokens = iter1->fLine.Tokenize(
" \t");
4897 std::cerr << std::endl <<
">> PMsrHandler::HandlePlotEntry: **SEVERE ERROR** Couldn't tokenize rrf_phase in line " << iter1->fLineNo;
4898 std::cerr << std::endl << std::endl;
4901 if (tokens->GetEntries() != 2) {
4905 ostr =
dynamic_cast<TObjString*
>(tokens->At(1));
4906 str = ostr->GetString();
4907 if (str.IsFloat()) {
4910 if (str.BeginsWith(
"par", TString::kIgnoreCase)) {
4914 if (static_cast<Int_t>(
fParam.size()) < no) {
4933 }
else if (iter1->fLine.Contains(
"rrf_packing", TString::kIgnoreCase)) {
4935 tokens = iter1->fLine.Tokenize(
" \t");
4937 std::cerr << std::endl <<
">> PMsrHandler::HandlePlotEntry: **SEVERE ERROR** Couldn't tokenize rrf_packing in line " << iter1->fLineNo;
4938 std::cerr << std::endl << std::endl;
4941 if (tokens->GetEntries() != 2) {
4945 ostr =
dynamic_cast<TObjString*
>(tokens->At(1));
4946 str = ostr->GetString();
4947 if (str.IsDigit()) {
4969 if (param.
fRuns.empty()) {
4972 if ((param.
fTmin.size() > 0) || (param.
fTmax.size() > 0)) {
4973 for (UInt_t i=0; i<param.
fTmin.size(); i++) {
4975 keep = param.
fTmin[i];
4977 param.
fTmax[i] = keep;
4982 if ((param.
fYmin.size() > 0) || (param.
fYmax.size() > 0)) {
4983 for (UInt_t i=0; i<param.
fYmin.size(); i++) {
4985 keep = param.
fYmin[i];
4987 param.
fYmax[i] = keep;
4995 std::cerr << std::endl <<
">> PMsrHandler::HandlePlotEntry(): **ERROR** found RRF frequency but no required RRF packing.";
4996 std::cerr << std::endl <<
">> Will ignore the RRF option.";
4997 std::cerr << std::endl;
5003 for (UInt_t i=0; i<param.
fRuns.size(); i++) {
5004 if (param.
fRuns[i] > static_cast<Int_t>(
fRuns.size())) {
5005 std::cerr << std::endl <<
">> PMsrHandler::HandlePlotEntry(): **WARNING** found plot run number " << param.
fRuns[i] <<
".";
5006 std::cerr << std::endl <<
">> There are only " <<
fRuns.size() <<
" runs present, will ignore this run.";
5007 std::cerr << std::endl;
5011 if (param.
fRuns[i] == 0) {
5012 std::cerr << std::endl <<
">> PMsrHandler::HandlePlotEntry(): **WARNING** found plot run number 0.";
5013 std::cerr << std::endl <<
">> Pot number needs to be > 0. Will ignore this entry.";
5014 std::cerr << std::endl;
5020 if (param.
fRuns.size() > 0) {
5023 std::cerr << std::endl <<
">> PMsrHandler::HandlePlotEntry: **ERROR** no valid PLOT block entries, will ignore the entire PLOT block.";
5024 std::cerr << std::endl;
5029 if (
fPlots.size() == 0) {
5031 std::cerr << std::endl <<
">> PMsrHandler::HandlePlotEntry: **ERROR** no valid PLOT block at all present. Fix this first!";
5032 std::cerr << std::endl;
5037 std::cerr << std::endl <<
">> PMsrHandler::HandlePlotEntry: **ERROR** in line " << iter1->fLineNo <<
": " << iter1->fLine.Data();
5038 std::cerr << std::endl <<
">> A PLOT block needs to have the following structure:";
5039 std::cerr << std::endl;
5040 std::cerr << std::endl <<
">> PLOT <plot_type>";
5041 std::cerr << std::endl <<
">> runs <run_list>";
5042 std::cerr << std::endl <<
">> [range tmin tmax [ymin ymax]]";
5043 std::cerr << std::endl <<
">> [sub_ranges tmin1 tmax1 tmin2 tmax2 ... tminN tmaxN [ymin ymax]";
5044 std::cerr << std::endl <<
">> [logx | logy]";
5045 std::cerr << std::endl <<
">> [use_fit_ranges [ymin ymax]]";
5046 std::cerr << std::endl <<
">> [view_packing n]";
5047 std::cerr << std::endl;
5048 std::cerr << std::endl <<
">> where <plot_type> is: 0=single histo,";
5049 std::cerr << std::endl <<
">> 1=RRF single histo,";
5050 std::cerr << std::endl <<
">> 2=forward-backward asym,";
5051 std::cerr << std::endl <<
">> 3=forward-backward RRF asym,";
5052 std::cerr << std::endl <<
">> 4=mu minus single histo,";
5053 std::cerr << std::endl <<
">> 5=forward-backward beta-NMR asym,";
5054 std::cerr << std::endl <<
">> 8=non muSR.";
5055 std::cerr << std::endl <<
">> <run_list> is the list of runs, e.g. runs 1 3";
5056 std::cerr << std::endl <<
">> range is optional";
5057 std::cerr << std::endl <<
">> sub_ranges (if present) will plot the N given runs each on its own sub-range";
5058 std::cerr << std::endl <<
">> logx, logy (if present) will present the x-, y-axis in log-scale";
5059 std::cerr << std::endl <<
">> use_fit_ranges (if present) will plot each run on its fit-range";
5060 std::cerr << std::endl <<
">> view_packing n (if present) will bin all data by n (> 0) rather than the binning of the fit";
5061 std::cerr << std::endl;
5064 param.
fRuns.clear();
5089 if (lines.empty()) {
5090 std::cerr << std::endl <<
">> PMsrHandler::HandleStatisticEntry: **WARNING** There is no STATISTIC block! Do you really want this?";
5091 std::cerr << std::endl;
5103 for (UInt_t i=0; i<lines.size(); i++) {
5105 tstr = lines[i].fLine;
5106 tstr.Remove(TString::kLeading,
' ');
5107 if (tstr.Length() > 0) {
5108 if (!tstr.BeginsWith(
"#") && !tstr.BeginsWith(
"STATISTIC") && !tstr.BeginsWith(
"chisq") &&
5109 !tstr.BeginsWith(
"maxLH") && !tstr.BeginsWith(
"*** FIT DID NOT CONVERGE ***") &&
5110 !tstr.BeginsWith(
"expected chisq") && !tstr.BeginsWith(
"expected maxLH") &&
5111 !tstr.BeginsWith(
"run block")) {
5112 std::cerr << std::endl <<
">> PMsrHandler::HandleStatisticEntry: **SYNTAX ERROR** in line " << lines[i].fLineNo;
5113 std::cerr << std::endl <<
">> '" << lines[i].fLine.Data() <<
"'";
5114 std::cerr << std::endl <<
">> not a valid STATISTIC block line";
5115 std::cerr << std::endl <<
">> If you do not understand this, just remove the STATISTIC block, musrfit will recreate after fitting";
5116 std::cerr << std::endl << std::endl;
5123 if (lines[i].fLine.Contains(
"STATISTIC")) {
5124 status = sscanf(lines[i].fLine.Data(),
"STATISTIC --- %s%s", date, time);
5132 if (lines[i].fLine.Contains(
"chisq =")) {
5133 if (lines[i].fLine.Contains(
"expected")) {
5134 strncpy(str, lines[i].fLine.Data(),
sizeof(str));
5135 status = sscanf(str+lines[i].fLine.Index(
"chisq = ")+8,
"%lf", &dval);
5143 strncpy(str, lines[i].fLine.Data(),
sizeof(str));
5144 status = sscanf(str+lines[i].fLine.Index(
"chisq = ")+8,
"%lf", &dval);
5153 if (lines[i].fLine.Contains(
"maxLH =")) {
5155 strncpy(str, lines[i].fLine.Data(),
sizeof(str));
5156 status = sscanf(str+lines[i].fLine.Index(
"maxLH = ")+8,
"%lf", &dval);
5164 if (lines[i].fLine.Contains(
", NDF =")) {
5165 strncpy(str, lines[i].fLine.Data(),
sizeof(str));
5166 status = sscanf(str+lines[i].fLine.Index(
", NDF = ")+8,
"%u", &ival);
5191 UInt_t noOfFitParameters = 0;
5195 TObjArray *tokens =
nullptr;
5196 TObjString *ostr =
nullptr;
5202 if (idx >=
fRuns.size()) {
5203 std::cerr << std::endl <<
">> PMsrHandler::GetNoOfFitParameters() **ERROR** idx=" << idx <<
", out of range fRuns.size()=" <<
fRuns.size();
5204 std::cerr << std::endl;
5209 if (
fRuns[idx].GetNormParamNo() != -1) {
5211 paramVector.push_back(
fRuns[idx].GetNormParamNo());
5217 if (
fRuns[idx].GetBkgFitParamNo() != -1)
5218 paramVector.push_back(
fRuns[idx].GetBkgFitParamNo());
5221 if (
fRuns[idx].GetAlphaParamNo() != -1) {
5223 paramVector.push_back(
fRuns[idx].GetAlphaParamNo());
5229 if (
fRuns[idx].GetBetaParamNo() != -1) {
5231 paramVector.push_back(
fRuns[idx].GetBetaParamNo());
5238 for (UInt_t i=0; i<
fTheory.size(); i++) {
5241 pos = str.Index(
'#');
5245 tokens = str.Tokenize(
" \t");
5249 paramVector.clear();
5253 for (Int_t j=0; j<tokens->GetEntries(); j++) {
5254 ostr =
dynamic_cast<TObjString*
>(tokens->At(j));
5255 str = ostr->GetString();
5257 if (str.IsDigit()) {
5259 paramVector.push_back(dval);
5263 if (str.Contains(
"map")) {
5264 status = sscanf(str.Data(),
"map%d", &dval);
5266 mapVector.push_back(dval);
5271 if (str.Contains(
"fun")) {
5272 status = sscanf(str.Data(),
"fun%d", &dval);
5274 funVector.push_back(dval);
5284 for (UInt_t i=0; i<funVector.size(); i++) {
5289 if (dval == funVector[i])
5296 std::cerr << std::endl <<
">> PMsrHandler::GetNoOfFitParameters() **ERROR** couldn't find fun" << funVector[i];
5297 std::cerr << std::endl << std::endl;
5302 paramVector.clear();
5309 pos = str.Index(
'#');
5314 tokens = str.Tokenize(
" \t");
5318 paramVector.clear();
5323 for (Int_t j=0; j<tokens->GetEntries(); j++) {
5324 ostr =
dynamic_cast<TObjString*
>(tokens->At(j));
5325 str = ostr->GetString();
5328 if (str.BeginsWith(
"par")) {
5329 status = sscanf(str.Data(),
"par%d", &dval);
5331 paramVector.push_back(dval);
5335 if (str.BeginsWith(
"map")) {
5336 status = sscanf(str.Data(),
"map%d", &dval);
5338 mapVector.push_back(dval);
5344 for (UInt_t i=0; i<mapVector.size(); i++) {
5345 paramVector.push_back(
fRuns[idx].GetMap(mapVector[i]-1));
5350 param.push_back(paramVector[0]);
5351 for (UInt_t i=0; i<paramVector.size(); i++) {
5352 for (k=0; k<param.size(); k++) {
5353 if (param[k] == paramVector[i])
5356 if (k == param.size())
5357 param.push_back(paramVector[i]);
5361 for (UInt_t i=0; i<param.size(); i++) {
5362 if (
fParam[param[i]-1].fStep != 0.0)
5363 noOfFitParameters++;
5370 paramVector.clear();
5372 return noOfFitParameters;
5390 PMsrLines::iterator iter;
5391 TObjArray *tokens =
nullptr;
5392 TObjString *ostr =
nullptr;
5397 for (UInt_t i=0; i<
fParam.size(); i++)
5401 for (iter = theory.begin(); iter != theory.end(); ++iter) {
5404 if (str.First(
'#') != -1)
5405 str.Resize(str.First(
'#'));
5411 tokens = str.Tokenize(
" \t");
5416 for (Int_t i=0; i<tokens->GetEntries(); i++) {
5417 ostr =
dynamic_cast<TObjString*
>(tokens->At(i));
5418 str = ostr->GetString();
5419 if (str.IsDigit()) {
5421 if ((ival > 0) && (ival < static_cast<Int_t>(
fParam.size())+1)) {
5424 }
else if (str.Contains(
"map")) {
5427 }
else if (str.Contains(
"fun")) {
5441 for (iter = funcs.begin(); iter != funcs.end(); ++iter) {
5444 if (str.First(
'#') != -1)
5445 str.Resize(str.First(
'#'));
5450 tokens = str.Tokenize(
" /t");
5455 ostr =
dynamic_cast<TObjString*
>(tokens->At(0));
5456 str = ostr->GetString();
5463 for (UInt_t i=0; i<fun.size(); i++) {
5464 if (fun[i] == funNo) {
5468 while (sstr.Index(
"par") != -1) {
5469 memset(sval, 0,
sizeof(sval));
5470 sstr = &sstr[sstr.Index(
"par")+3];
5471 for (Int_t j=0; j<sstr.Sizeof(); j++) {
5472 if (!isdigit(sstr[j]))
5476 sscanf(sval,
"%d", &ival);
5482 while (sstr.Index(
"map") != -1) {
5483 memset(sval, 0,
sizeof(sval));
5484 sstr = &sstr[sstr.Index(
"map")+3];
5485 for (Int_t j=0; j<sstr.Sizeof(); j++) {
5486 if (!isdigit(sstr[j]))
5490 sscanf(sval,
"%d", &ival);
5494 for (pos=0; pos<map.size(); pos++) {
5495 if (ival == map[pos])
5498 if (pos == map.size()) {
5499 map.push_back(ival);
5515 for (iter = run.begin(); iter != run.end(); ++iter) {
5518 if (str.First(
'#') != -1)
5519 str.Resize(str.First(
'#'));
5525 if (str.Contains(
"alpha") || str.Contains(
"beta") ||
5526 str.Contains(
"alpha2") || str.Contains(
"beta2") ||
5527 str.Contains(
"norm") || str.Contains(
"backgr.fit") ||
5528 str.Contains(
"lifetime ")) {
5530 tokens = str.Tokenize(
" \t");
5533 if (tokens->GetEntries()<2)
5536 ostr =
dynamic_cast<TObjString*
>(tokens->At(1));
5537 str = ostr->GetString();
5539 if (str.IsDigit()) {
5544 if (str.Contains(
"fun")) {
5558 if (str.Contains(
"map")) {
5560 tokens = str.Tokenize(
" \t");
5565 for (UInt_t i=0; i<map.size(); i++) {
5568 if (map[i] < tokens->GetEntries()) {
5569 ostr =
dynamic_cast<TObjString*
>(tokens->At(map[i]));
5570 str = ostr->GetString();
5571 if (str.IsDigit()) {
5589 for (iter = funcs.begin(); iter != funcs.end(); ++iter) {
5592 if (str.First(
'#') != -1)
5593 str.Resize(str.First(
'#'));
5598 tokens = str.Tokenize(
" /t");
5603 ostr =
dynamic_cast<TObjString*
>(tokens->At(0));
5604 str = ostr->GetString();
5611 for (UInt_t i=0; i<fun.size(); i++) {
5612 if (fun[i] == funNo) {
5616 while (sstr.Index(
"par") != -1) {
5617 memset(sval, 0,
sizeof(sval));
5618 sstr = &sstr[sstr.Index(
"par")+3];
5619 for (Int_t j=0; j<sstr.Sizeof(); j++) {
5620 if (!isdigit(sstr[j]))
5624 sscanf(sval,
"%d", &ival);
5630 while (sstr.Index(
"map") != -1) {
5631 memset(sval, 0,
sizeof(sval));
5632 sstr = &sstr[sstr.Index(
"map")+3];
5633 for (Int_t j=0; j<sstr.Sizeof(); j++) {
5634 if (!isdigit(sstr[j]))
5638 sscanf(sval,
"%d", &ival);
5642 for (pos=0; pos<map.size(); pos++) {
5643 if (ival == map[pos])
5646 if (static_cast<UInt_t>(pos) == map.size()) {
5647 map.push_back(ival);
5662 for (iter = run.begin(); iter != run.end(); ++iter) {
5665 if (str.First(
'#') != -1)
5666 str.Resize(str.First(
'#'));
5672 if (str.Contains(
"map")) {
5674 tokens = str.Tokenize(
" \t");
5679 for (UInt_t i=0; i<map.size(); i++) {
5682 if (map[i] < tokens->GetEntries()) {
5683 ostr =
dynamic_cast<TObjString*
>(tokens->At(map[i]));
5684 str = ostr->GetString();
5685 if (str.IsDigit()) {
5703 for (UInt_t i=0; i<
fParam.size(); i++) {
5705 if (
fParam[i].fStep != 0.0) {
5706 std::cerr << std::endl <<
">> **WARNING** : Parameter No " << i+1 <<
" is not used at all, will fix it" << std::endl;
5733 for (UInt_t i=0; i<
fRuns.size(); i++) {
5735 fitType =
fRuns[i].GetFitType();
5736 if (fitType == -1) {
5738 if (fitType == -1) {
5739 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** fittype is neither defined in RUN block number " << i+1 <<
", nor in the GLOBAL block." << std::endl;
5745 Int_t detectorGroups = 1;
5750 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
5751 std::cerr << std::endl <<
">> Norm parameter number not defined. Necessary for single histogram fits." << std::endl;
5758 if (
fRuns[i].GetNormParamNo() > static_cast<Int_t>(
fParam.size())) {
5759 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
5760 std::cerr << std::endl <<
">> Norm parameter number " <<
fRuns[i].GetNormParamNo() <<
" is larger than the number of fit parameters (" <<
fParam.size() <<
").";
5761 std::cerr << std::endl <<
">> Consider to check the manual ;-)" << std::endl;
5766 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
5767 std::cerr << std::endl <<
">> Norm parameter function number " <<
fRuns[i].GetNormParamNo()-
MSR_PARAM_FUN_OFFSET <<
" is larger than the number of functions (" <<
GetNoOfFuncs() <<
").";
5768 std::cerr << std::endl <<
">> Consider to check the manual ;-)" << std::endl;
5774 if (
fRuns[i].GetForwardHistoNo() == -1) {
5775 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
5776 std::cerr << std::endl <<
">> forward parameter number not defined. Necessary for single histogram fits." << std::endl;
5782 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
5783 std::cerr << std::endl <<
">> forward histogram number " <<
fRuns[i].GetNormParamNo() <<
" is larger than the number of fit parameters (" <<
fParam.size() <<
").";
5784 std::cerr << std::endl <<
">> Consider to check the manual ;-)" << std::endl;
5793 std::cerr << std::endl <<
"PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
5794 std::cerr << std::endl <<
" Fit range is not defined. Necessary for single histogram fits." << std::endl;
5801 detectorGroups =
fRuns[i].GetForwardHistoNoSize();
5803 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
5804 if (
fRuns[i].GetT0BinSize() > detectorGroups)
5805 std::cerr << std::endl <<
">> In RUN Block " << i+1 <<
": found " <<
fRuns[i].GetT0BinSize() <<
" T0 entries. Expecting max. " << detectorGroups <<
" entries.";
5807 std::cerr << std::endl <<
">> In GLOBAL block: found " <<
fGlobal.
GetT0BinSize() <<
" T0 entries. Expecting max. " << detectorGroups <<
" entries. Needs to be fixed.";
5808 std::cerr << std::endl <<
">> In case you added runs, please use the key word 'addt0' to add the t0's of the runs to be added." << std::endl;
5814 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **WARNING** in RUN block number " << i+1;
5815 std::cerr << std::endl <<
">> Packing is neither defined here, nor in the GLOBAL block, will set it to 1." << std::endl;
5816 fRuns[i].SetPacking(1);
5821 if (
fRuns[i].GetForwardHistoNo() == -1) {
5822 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
5823 std::cerr << std::endl <<
">> forward parameter number not defined. Necessary for single histogram RRF fits." << std::endl;
5829 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
5830 std::cerr << std::endl <<
">> forward histogram number " <<
fRuns[i].GetNormParamNo() <<
" is larger than the number of fit parameters (" <<
fParam.size() <<
").";
5831 std::cerr << std::endl <<
">> Consider to check the manual ;-)" << std::endl;
5840 std::cerr << std::endl <<
"PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
5841 std::cerr << std::endl <<
" Fit range is not defined. Necessary for single histogram fits." << std::endl;
5848 detectorGroups =
fRuns[i].GetForwardHistoNoSize();
5850 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
5851 if (
fRuns[i].GetT0BinSize() > detectorGroups)
5852 std::cerr << std::endl <<
">> In RUN Block " << i+1 <<
": found " <<
fRuns[i].GetT0BinSize() <<
" T0 entries. Expecting max. " << detectorGroups <<
" entries.";
5854 std::cerr << std::endl <<
">> In GLOBAL block: found " <<
fGlobal.
GetT0BinSize() <<
" T0 entries. Expecting max. " << detectorGroups <<
" entries. Needs to be fixed.";
5855 std::cerr << std::endl <<
">> In case you added runs, please use the key word 'addt0' to add the t0's of the runs to be added." << std::endl;
5860 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** no RRF frequency found in the GLOBAL block." << std::endl;
5865 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** no RRF packing found in the GLOBAL block." << std::endl;
5872 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
5873 std::cerr << std::endl <<
">> alpha parameter number missing which is needed for an asymmetry fit.";
5874 std::cerr << std::endl <<
">> Consider to check the manual ;-)" << std::endl;
5878 if (
fRuns[i].GetForwardHistoNo() == -1) {
5879 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
5880 std::cerr << std::endl <<
">> forward histogram number not defined. Necessary for asymmetry fits." << std::endl;
5884 if (
fRuns[i].GetBackwardHistoNo() == -1) {
5885 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
5886 std::cerr << std::endl <<
">> backward histogram number not defined. Necessary for asymmetry fits." << std::endl;
5890 if (!
fRuns[i].IsFitRangeInBin()) {
5893 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
5894 std::cerr << std::endl <<
">> Fit range is not defined, also NOT present in the GLOBAL block. Necessary for asymmetry fits." << std::endl;
5900 detectorGroups = 2*
fRuns[i].GetForwardHistoNoSize();
5901 if (detectorGroups < 2*
fRuns[i].GetBackwardHistoNoSize())
5902 detectorGroups = 2*
fRuns[i].GetBackwardHistoNoSize();
5904 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
5905 if (
fRuns[i].GetT0BinSize() > detectorGroups)
5906 std::cerr << std::endl <<
">> In RUN Block " << i+1 <<
": found " <<
fRuns[i].GetT0BinSize() <<
" T0 entries. Expecting max. " << detectorGroups <<
" entries.";
5908 std::cerr << std::endl <<
">> In GLOBAL block: found " <<
fGlobal.
GetT0BinSize() <<
" T0 entries. Expecting max. " << detectorGroups <<
" entries. Needs to be fixed.";
5909 std::cerr << std::endl <<
">> In case you added runs, please use the key word 'addt0' to add the t0's of the runs to be added." << std::endl;
5914 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **WARNING** in RUN block number " << i+1;
5915 std::cerr << std::endl <<
">> Packing is neither defined here, nor in the GLOBAL block, will set it to 1." << std::endl;
5916 fRuns[i].SetPacking(1);
5928 if (
fRuns[i].GetForwardHistoNo() == -1) {
5929 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
5930 std::cerr << std::endl <<
">> forward histogram number not defined. Necessary for asymmetry fits." << std::endl;
5934 if (
fRuns[i].GetBackwardHistoNo() == -1) {
5935 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
5936 std::cerr << std::endl <<
">> backward histogram number not defined. Necessary for asymmetry fits." << std::endl;
5940 if (!
fRuns[i].IsFitRangeInBin()) {
5943 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
5944 std::cerr << std::endl <<
">> Fit range is not defined, also NOT present in the GLOBAL block. Necessary for asymmetry fits." << std::endl;
5950 if ((
fRuns[i].GetT0BinSize() > 2*
fRuns[i].GetForwardHistoNoSize()) &&
5952 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
5953 std::cerr << std::endl <<
">> Found " <<
fRuns[i].GetT0BinSize() <<
" T0 entries. Expecting only " << 2*
fRuns[i].GetForwardHistoNoSize() <<
" in forward. Needs to be fixed." << std::endl;
5954 std::cerr << std::endl <<
">> In GLOBAL block: " <<
fGlobal.
GetT0BinSize() <<
" T0 entries. Expecting only " << 2*
fRuns[i].GetForwardHistoNoSize() <<
". Needs to be fixed." << std::endl;
5957 if ((
fRuns[i].GetT0BinSize() > 2*
fRuns[i].GetBackwardHistoNoSize()) &&
5959 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
5960 std::cerr << std::endl <<
">> Found " <<
fRuns[i].GetT0BinSize() <<
" T0 entries. Expecting only " << 2*
fRuns[i].GetBackwardHistoNoSize() <<
" in backward. Needs to be fixed." << std::endl;
5961 std::cerr << std::endl <<
">> In GLOBAL block: " <<
fGlobal.
GetT0BinSize() <<
" T0 entries. Expecting only " << 2*
fRuns[i].GetBackwardHistoNoSize() <<
". Needs to be fixed." << std::endl;
5966 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **WARNING** in RUN block number " << i+1;
5967 std::cerr << std::endl <<
">> Packing is neither defined here, nor in the GLOBAL block, will set it to 1." << std::endl;
5968 fRuns[i].SetPacking(1);
5974 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
5975 std::cerr << std::endl <<
">> alpha parameter number missing which is needed for an asymmetry RRF fit.";
5976 std::cerr << std::endl <<
">> Consider to check the manual ;-)" << std::endl;
5980 if (
fRuns[i].GetForwardHistoNo() == -1) {
5981 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
5982 std::cerr << std::endl <<
">> forward histogram number not defined. Necessary for asymmetry RRF fits." << std::endl;
5986 if (
fRuns[i].GetBackwardHistoNo() == -1) {
5987 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
5988 std::cerr << std::endl <<
">> backward histogram number not defined. Necessary for asymmetry RRF fits." << std::endl;
5992 if (!
fRuns[i].IsFitRangeInBin()) {
5995 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
5996 std::cerr << std::endl <<
">> Fit range is not defined, also NOT present in the GLOBAL block. Necessary for asymmetry RRF fits." << std::endl;
6002 detectorGroups = 2*
fRuns[i].GetForwardHistoNoSize();
6003 if (detectorGroups < 2*
fRuns[i].GetBackwardHistoNoSize())
6004 detectorGroups = 2*
fRuns[i].GetBackwardHistoNoSize();
6006 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
6007 if (
fRuns[i].GetT0BinSize() > detectorGroups)
6008 std::cerr << std::endl <<
">> In RUN Block " << i+1 <<
": found " <<
fRuns[i].GetT0BinSize() <<
" T0 entries. Expecting max. " << detectorGroups <<
" entries.";
6010 std::cerr << std::endl <<
">> In GLOBAL block: found " <<
fGlobal.
GetT0BinSize() <<
" T0 entries. Expecting max. " << detectorGroups <<
" entries. Needs to be fixed.";
6011 std::cerr << std::endl <<
">> In case you added runs, please use the key word 'addt0' to add the t0's of the runs to be added." << std::endl;
6016 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** no RRF frequency found in the GLOBAL block." << std::endl;
6021 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** no RRF packing found in the GLOBAL block." << std::endl;
6030 if ((
fRuns[i].GetXDataIndex() == -1) && (
fRuns[i].GetXDataLabel()->Length() == 0)) {
6031 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
6032 std::cerr << std::endl <<
">> xy-data is missing. Necessary for non muSR fits." << std::endl;
6038 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
6039 std::cerr << std::endl <<
">> Fit range is not defined, neither in the RUN block, nor in the GLOBAL block.";
6040 std::cerr << std::endl <<
">> Necessary for non muSR fits." << std::endl;
6045 if (
fRuns[i].GetPacking() == -1) {
6047 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **WARNING** in RUN block number " << i+1;
6048 std::cerr << std::endl <<
">> Packing is not defined, will set it to 1." << std::endl;
6049 fRuns[i].SetPacking(1);
6054 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** fittype " << fitType <<
" undefined." << std::endl;
6079 Bool_t unique =
true;
6081 for (UInt_t i=0; i<
fParam.size()-1; i++) {
6082 for (UInt_t j=i+1; j<
fParam.size(); j++) {
6108 Bool_t result =
true;
6114 TObjArray *tokens =
nullptr;
6115 TObjString *ostr =
nullptr;
6121 for (UInt_t i=0; i<
fTheory.size(); i++) {
6122 if (
fTheory[i].fLine.Contains(
"map", TString::kIgnoreCase)) {
6124 tokens =
fTheory[i].fLine.Tokenize(
" \t");
6125 for (Int_t j=0; j<tokens->GetEntries(); j++) {
6126 ostr =
dynamic_cast<TObjString*
>(tokens->At(j));
6127 str = ostr->GetString();
6128 if (str.Contains(
"map", TString::kIgnoreCase)) {
6130 mapVec.push_back(no);
6131 mapBlock.push_back(0);
6132 mapLineNo.push_back(
fTheory[i].fLineNo);
6146 if (
fFunctions[i].fLine.Contains(
"map", TString::kIgnoreCase)) {
6148 tokens =
fFunctions[i].fLine.Tokenize(
" \t");
6149 for (Int_t j=0; j<tokens->GetEntries(); j++) {
6150 ostr =
dynamic_cast<TObjString*
>(tokens->At(j));
6151 str = ostr->GetString();
6152 if (str.Contains(
"map", TString::kIgnoreCase)) {
6154 mapVec.push_back(no);
6155 mapBlock.push_back(1);
6170 for (UInt_t i=0; i<mapVec.size(); i++) {
6172 for (UInt_t j=0; j<
fRuns.size(); j++) {
6183 std::cerr << std::endl <<
">> PMsrHandler::CheckMaps: **ERROR** map" << mapVec[i]-
MSR_PARAM_MAP_OFFSET <<
" found in the ";
6184 if (mapBlock[i] == 0)
6185 std::cerr <<
"theory-block ";
6187 std::cerr <<
"functions-block ";
6188 std::cerr <<
"in line " << mapLineNo[i] <<
" is not present in the run-block!";
6189 std::cerr << std::endl;
6191 std::cerr << std::endl <<
">> by the way: map must be > 0 ...";
6192 std::cerr << std::endl;
6218 Bool_t result =
true;
6227 TObjArray *tokens =
nullptr;
6228 TObjString *ostr =
nullptr;
6234 for (UInt_t i=0; i<
fTheory.size(); i++) {
6235 if (
fTheory[i].fLine.Contains(
"fun", TString::kIgnoreCase)) {
6237 tokens =
fTheory[i].fLine.Tokenize(
" \t");
6238 for (Int_t j=0; j<tokens->GetEntries(); j++) {
6239 ostr =
dynamic_cast<TObjString*
>(tokens->At(j));
6240 str = ostr->GetString();
6241 if (str.Contains(
"fun", TString::kIgnoreCase)) {
6243 funVec.push_back(no);
6244 funBlock.push_back(0);
6245 funLineBlockNo.push_back(
fTheory[i].fLineNo);
6258 for (UInt_t i=0; i<
fRuns.size(); i++) {
6260 funVec.push_back(
fRuns[i].GetNormParamNo());
6261 funBlock.push_back(1);
6262 funLineBlockNo.push_back(i+1);
6268 for (UInt_t i=0; i<funVec.size(); i++) {
6274 str = TString(
"fun");
6276 if (
fFunctions[j].fLine.Contains(str, TString::kIgnoreCase)) {
6283 std::cerr << std::endl <<
">> PMsrHandler::CheckFuncs: **ERROR** fun" << funVec[i]-
MSR_PARAM_FUN_OFFSET <<
" found in the ";
6284 if (funBlock[i] == 0)
6285 std::cerr <<
"theory-block in line " << funLineBlockNo[i] <<
" is not present in the functions-block!";
6287 std::cerr <<
"run-block No " << funLineBlockNo[i] <<
" (norm) is not present in the functions-block!";
6288 std::cerr << std::endl;
6295 funLineBlockNo.clear();
6312 Bool_t result =
true;
6314 for (UInt_t i=0; i<
fRuns.size(); i++) {
6316 if (
fRuns[i].GetForwardHistoNoSize() > 1) {
6317 for (UInt_t j=0; j<
fRuns[i].GetForwardHistoNoSize(); j++) {
6318 for (UInt_t k=j+1; k<
fRuns[i].GetForwardHistoNoSize(); k++) {
6319 if (
fRuns[i].GetForwardHistoNo(j) ==
fRuns[i].GetForwardHistoNo(k)) {
6320 std::cerr << std::endl <<
">> PMsrHandler::CheckHistoGrouping: **WARNING** grouping identical histograms!!";
6321 std::cerr << std::endl <<
">> run no " << i+1 <<
", forward histo " << j+1 <<
" == forward histo " << k+1 <<
".";
6322 std::cerr << std::endl <<
">> this really doesn't make any sense, but you are the boss.";
6323 std::cerr << std::endl;
6329 if (
fRuns[i].GetBackwardHistoNoSize() > 1) {
6330 for (UInt_t j=0; j<
fRuns[i].GetBackwardHistoNoSize(); j++) {
6331 for (UInt_t k=j+1; k<
fRuns[i].GetBackwardHistoNoSize(); k++) {
6332 if (
fRuns[i].GetBackwardHistoNo(j) ==
fRuns[i].GetBackwardHistoNo(k)) {
6333 std::cerr << std::endl <<
">> PMsrHandler::CheckHistoGrouping: **WARNING** grouping identical histograms!!";
6334 std::cerr << std::endl <<
">> run no " << i+1 <<
", backward histo " << j+1 <<
" == backward histo " << k+1 <<
".";
6335 std::cerr << std::endl <<
">> this really doesn't make any sense, but you are the boss.";
6336 std::cerr << std::endl;
6358 Bool_t result =
true;
6360 for (UInt_t i=0; i<
fRuns.size(); i++) {
6361 if (
fRuns[i].GetRunNameSize() > 1) {
6363 if (
fRuns[i].GetAddT0BinEntries() != 0) {
6364 if (
fRuns[i].GetAddT0BinEntries() !=
fRuns[i].GetRunNameSize()-1) {
6365 std::cerr << std::endl <<
">> PMsrHandler::CheckAddRunParameters: **ERROR** # of addt0 != # of addruns.";
6366 std::cerr << std::endl <<
">> Run #" << i+1;
6367 std::cerr << std::endl;
6389 for (UInt_t i=0; i<
fRuns.size(); i++) {
6392 std::cerr << std::endl <<
">> PMsrHandler::CheckMaxLikelihood: **WARNING**: Maximum Log Likelihood Fit is only implemented";
6393 std::cerr << std::endl <<
">> for Single Histogram and Mu Minus Fits. Will fall back to Chi Square Fit.";
6394 std::cerr << std::endl << std::endl;
6411 Bool_t result =
true;
6416 if (fittype != -1) {
6419 std::cerr << std::endl <<
">> PMsrHandler::CheckRRFSettings: **ERROR** found GLOBAL fittype " << fittype <<
" and";
6420 std::cerr << std::endl <<
">> RRF settings in the GLOBAL section. This is NOT compatible. Fix it first.";
6424 for (UInt_t i=0; i<
fRuns.size(); i++) {
6425 fittype =
fRuns[i].GetFitType();
6428 std::cerr << std::endl <<
">> PMsrHandler::CheckRRFSettings: **ERROR** found RUN with fittype " << fittype <<
" and";
6429 std::cerr << std::endl <<
">> RRF settings in the GLOBAL section. This is NOT compatible. Fix it first.";
6437 std::cerr << std::endl <<
">> PMsrHandler::CheckRRFSettings: **WARNING** found in the GLOBAL section rrf_packing, without";
6438 std::cerr << std::endl <<
">> rrf_freq. Doesn't make any sense. Will drop rrf_packing";
6439 std::cerr << std::endl << std::endl;
6443 std::cerr << std::endl <<
">> PMsrHandler::CheckRRFSettings: **WARNING** found in the GLOBAL section rrf_phase, without";
6444 std::cerr << std::endl <<
">> rrf_freq. Doesn't make any sense. Will drop rrf_phase";
6445 std::cerr << std::endl << std::endl;
6461 std::cerr << std::endl <<
">> PMsrHandler::CheckRRFSettings: **ERROR** RRF fit chosen, but";
6462 std::cerr << std::endl <<
">> no RRF frequency found in the GLOBAL section! Fix it.";
6466 std::cerr << std::endl <<
">> PMsrHandler::CheckRRFSettings: **ERROR** RRF fit chosen, but";
6467 std::cerr << std::endl <<
">> no RRF packing found in the GLOBAL section! Fix it.";
6471 UInt_t rrfFitCounter = 0;
6472 for (UInt_t i=0; i<
fRuns.size(); i++) {
6473 fittype =
fRuns[i].GetFitType();
6479 if (rrfFitCounter !=
fRuns.size()) {
6480 std::cerr << std::endl <<
">> PMsrHandler::CheckRRFSettings: **ERROR** #Runs (" <<
fRuns.size() <<
") != # RRF fits found (" << rrfFitCounter <<
")";
6481 std::cerr << std::endl <<
">> This is currently not supported.";
6485 std::cerr << std::endl <<
">> PMsrHandler::CheckRRFSettings: **ERROR** RRF fit chosen, but";
6486 std::cerr << std::endl <<
">> no RRF frequency found in the GLOBAL section! Fix it.";
6490 std::cerr << std::endl <<
">> PMsrHandler::CheckRRFSettings: **ERROR** RRF fit chosen, but";
6491 std::cerr << std::endl <<
">> no RRF packing found in the GLOBAL section! Fix it.";
6513 if (!detector.CompareTo(
"forward", TString::kIgnoreCase)) {
6514 for (UInt_t i=0; i<
fRuns[runNo].GetForwardHistoNoSize(); i++)
6515 grouping.push_back(
fRuns[runNo].GetForwardHistoNo(i));
6517 }
else if (!detector.CompareTo(
"backward", TString::kIgnoreCase)) {
6518 for (UInt_t i=0; i<
fRuns[runNo].GetBackwardHistoNoSize(); i++)
6519 grouping.push_back(
fRuns[runNo].GetBackwardHistoNo(i));
6522 groupingStr =
"**ERROR** unkown detector. Allow forward/backward.";
6562 for (UInt_t i=0; i<precLimit; i++) {
6563 if (static_cast<Int_t>(dval*pow(10.0,static_cast<Double_t>(i))) != 0) {
6569 if (prec == precLimit) {
6570 std::cerr << std::endl <<
">> PMsrHandler::NeededPrecision(): **WARNING** precision limit of " << precLimit <<
", requested.";
6589 UInt_t lastSignificant = 2;
6590 UInt_t decimalPoint = 0;
6594 snprintf(str,
sizeof(str),
"%lf", dval);
6597 for (UInt_t i=0; i<strlen(str); i++) {
6598 if (str[i] ==
'.') {
6605 for (Int_t i=strlen(str)-1; i>=0; i--) {
6606 if (str[i] !=
'0') {
6607 if ((static_cast<UInt_t>(i)-decimalPoint) < precLimit)
6608 lastSignificant = static_cast<UInt_t>(i)-decimalPoint;
6610 lastSignificant = precLimit;
6615 return lastSignificant;
6631 if (includeDetector) {
6632 result = str + TString(
" ");
6633 if (str == TString(
"forward"))
6639 if (group.size()==0)
6645 if (j+1 < group.size()) {
6646 while (group[j]+1 == group[j+1]) {
6648 if (j == group.size()-1)
6663 }
while (i<group.size());
6679 TString formatStr(
"par%d, par%d");
6690 formatStr =
"parR%d, par%d";
6692 formatStr =
"par%d, parR%d";
6695 Bool_t phaseIter =
true;
6707 if (phaseRef != -1) {
6747 for (UInt_t i=0; i<
fPlots.size(); i++) {
6748 for (UInt_t j=0; j<
fPlots[i].fRuns.size(); j++) {
6749 idx =
fPlots[i].fRuns[j]-1;
6750 if (
fRuns[idx].IsLifetimeCorrected()) {
6751 fPlots[i].fLifeTimeCorrection =
true;
PMsrRunList fRuns
holds a list of run information
virtual UInt_t GetT0BinSize()
std::unique_ptr< PFunctionHandler > fFuncHandler
needed to parse functions
virtual TString GetRRFUnit()
virtual void SetDataRange(Int_t ival, Int_t idx)
#define MSR_PLOT_ASYM_RRF
PMsrParamList fParam
holds a list of the fit parameters
Bool_t fCopyStatisticsBlock
flag, if true: just copy to old statistics block (musrt0), otherwise write a new one (musrfit) ...
virtual Double_t GetAddT0Bin(UInt_t addRunIdx, UInt_t histoIdx)
PMsrLines fStatLines
statistics block in msr-file clear text
Double_t fRRFFreq
RRF frequency.
#define FOURIER_APOD_WEAK
PMsrPlotList fPlots
holds a list of the plot input parameters
PStartupOptions * fStartupOptions
contains information about startup options from the musrfit_startup.xml
Bool_t writeExpectedChisq
if set to true, expected chisq and chisq per block will be written
Bool_t fFourierBlockPresent
flag indicating if a Fourier block is present in the msr-file
virtual Int_t GetNoOfFuncs()
virtual Int_t GetDataRange(UInt_t idx)
virtual Double_t GetT0Bin(UInt_t idx=0)
virtual void SetFitRangeOffset(Int_t ival, UInt_t idx)
virtual Bool_t HandleTheoryEntry(PMsrLines &line)
Bool_t estimateN0
if set to true, for single histogram fits N0 will be estimated
virtual void SetFitRangeOffset(Int_t ival, UInt_t idx)
virtual Int_t GetRRFUnitTag()
virtual void FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLines &run)
virtual UInt_t GetAddT0BinEntries()
Int_t fPlotTag
tag used for initial plot. 0=real, 1=imaginary, 2=real & imaginary (default), 3=power, 4=phase
virtual void SetBackwardHistoNo(Int_t histoNo, Int_t idx=-1)
virtual Int_t GetFitRangeOffset(UInt_t idx)
virtual void SetRunName(TString &str, Int_t idx=-1)
#define MSR_FITTYPE_SINGLE_HISTO_RRF
virtual void SetBeamline(TString &str, Int_t idx=-1)
#define FOURIER_PLOT_POWER
TString fMsrFileDirectoryPath
msr-file directory path
PMsrFourierStructure fFourier
holds the parameters used for the Fourier transform
virtual Bool_t HandleRunEntry(PMsrLines &line)
#define MSR_TAG_FUNCTIONS
virtual void SetRRFPhase(Double_t phase)
PDoubleVector fMinPerHisto
chisq or max. likelihood per histo
#define MSR_FITTYPE_SINGLE_HISTO
virtual void SetYDataIndex(Int_t ival)
virtual void SetYDataLabel(TString &str)
virtual Bool_t FilterNumber(TString str, const Char_t *filter, Int_t offset, Int_t &no)
virtual void SetMsrDataRangeEntry(UInt_t runNo, UInt_t idx, Int_t bin)
Int_t fPhaseRef
phase reference for relative phase(s)
UInt_t fRRFPacking
rotating reference frame (RRF) packing
virtual void SetMap(Int_t mapVal, Int_t idx=-1)
virtual void SetXDataLabel(TString &str)
virtual Bool_t CheckAddRunParameters()
virtual UInt_t NeededPrecision(Double_t dval, UInt_t precLimit=13)
#define MSR_PLOT_SINGLE_HISTO
#define PMUSR_MSR_FILE_NOT_FOUND
virtual void SetMsrT0Entry(UInt_t runNo, UInt_t idx, Double_t bin)
Double_t fMin
chisq or max. likelihood
virtual Int_t GetRRFPacking()
virtual void SetFitRangeInBins(Bool_t bval)
#define MSR_PARAM_MAP_OFFSET
#define FOURIER_PLOT_IMAG
Bool_t fValid
flag showing if the statistics block is valid, i.e. a fit took place which converged ...
Int_t fViewPacking
-1 -> use the run packing to generate the view, otherwise is fViewPacking for the binning of ALL runs...
virtual void SetFileFormat(TString &str, Int_t idx=-1)
#define FOURIER_PLOT_REAL
Bool_t fDCCorrected
if set true, the dc offset of the signal/theory will be removed before the FFT is made...
virtual void SetFitRangeInBins(Bool_t bval)
std::vector< Int_t > PIntVector
virtual UInt_t GetFuncIndex(Int_t funNo)
virtual Bool_t IsFitRangeInBin()
virtual Bool_t ParseFourierPhaseParIterVector(PMsrFourierStructure &fourier, const TString &str, Bool_t &error)
#define FOURIER_UNIT_CYCLES
PMsrHandler(const Char_t *fileName, PStartupOptions *startupOptions=0, const Bool_t fourierOnly=false)
std::vector< UInt_t > PUIntVector
PIntVector fParamInUse
array holding the information if a particular parameter is used at all, i.e. if the theory is using i...
virtual Bool_t IsPresent()
virtual void MakeDetectorGroupingString(TString str, PIntVector &group, TString &result, Bool_t includeDetector=true)
#define FOURIER_PLOT_REAL_AND_IMAG
virtual Bool_t ParseFourierPhaseParVector(PMsrFourierStructure &fourier, const TString &str, Bool_t &error)
virtual Double_t GetRRFFreq(const char *unit)
virtual void SetAlphaParamNo(Int_t ival)
virtual Bool_t HandlePlotEntry(PMsrLines &line)
virtual Bool_t CheckHistoGrouping()
#define PRUN_ASYMMETRY_BNMR
Bool_t fLowerBoundaryPresent
flag showing if a lower boundary is present
virtual Bool_t HandleFunctionsEntry(PMsrLines &line)
#define MSR_PARAM_FUN_OFFSET
#define FOURIER_UNIT_NOT_GIVEN
#define FOURIER_UNIT_FREQ
virtual Int_t WriteMsrLogFile(const Bool_t messages=true)
virtual Bool_t HandleCommandsEntry(PMsrLines &line)
virtual void SetBkgFitParamNo(Int_t ival)
virtual Int_t WriteMsrFile(const Char_t *filename, std::map< UInt_t, TString > *commentsPAR=0, std::map< UInt_t, TString > *commentsTHE=0, std::map< UInt_t, TString > *commentsFUN=0, std::map< UInt_t, TString > *commentsRUN=0)
Int_t fApodization
tag indicating the kind of apodization wished, 0=no appodization (default), 1=weak, 2=medium, 3=strong (for details see the docu)
PMsrStatisticStructure fStatistic
holds the statistic info
Int_t fNo
parameter number
virtual Bool_t CheckUniquenessOfParamNames(UInt_t &parX, UInt_t &parY)
#define MSR_FITTYPE_NON_MUSR
virtual Bool_t HandleFourierEntry(PMsrLines &line)
virtual Bool_t CheckRunBlockIntegrity()
Bool_t fUpperBoundaryPresent
flag showing if an upper boundary is present
#define PRUN_SINGLE_HISTO_RRF
Bool_t fLogX
yes -> x-axis in log-scale, no (default) -> x-axis in lin-scale
#define MSR_TAG_STATISTIC
#define MSR_PLOT_NON_MUSR
Double_t fUpperBoundary
upper boundary for the fit parameter
virtual void SetT0Bin(Double_t dval, Int_t idx=-1)
#define PMUSR_MSR_FILE_WRITE_ERROR
virtual Int_t ParameterInUse(UInt_t paramNo)
Int_t fLineNo
original line number of the msr-file
#define PRUN_ASYMMETRY_RRF
virtual void SetForwardHistoNo(Int_t histoNo, Int_t idx=-1)
Bool_t fLogY
yes -> y-axis in log-scale, no (default) -> y-axis in lin-scale
Double_t fStep
step / error / neg_error, depending on the situation
virtual Bool_t CheckMaps()
std::vector< PMsrLineStructure > PMsrLines
PIntVector fPhaseParamNo
parameter number(s) if used instead of a phase value
Double_t fRangeForPhaseCorrection[2]
field/frequency range for automatic phase correction
PMsrLines fFunctions
holds the user defined functions
TString fLine
msr-file line
PMsrLines fCommands
holds a list of the minuit commands
PDoubleVector fMinExpectedPerHisto
expected pre histo chi2 or max. likelihood
virtual void SetAddT0Bin(Double_t dval, UInt_t addRunIdx, UInt_t histoNoIdx)
virtual Bool_t CheckRRFSettings()
virtual void RemoveComment(const TString &str, TString &truncStr)
TString fFileName
file name of the msr-file
#define MSR_PLOT_SINGLE_HISTO_RRF
virtual Bool_t SetMsrParamStep(UInt_t i, Double_t value)
virtual void SetMsrAddT0Entry(UInt_t runNo, UInt_t addRunIdx, UInt_t histoIdx, Double_t bin)
Int_t fMsrBlockCounter
used to select the proper msr-block
PDoubleVector fTmin
time minimum
PDoubleVector fTmax
time maximum
PDoubleVector fPhase
phase(s)
virtual void SetLifetimeParamNo(Int_t ival)
virtual void SetInstitute(TString &str, Int_t idx=-1)
virtual void SetAddT0Bin(Double_t dval, UInt_t addRunIdx, UInt_t histoNoIdx)
Int_t fUnits
flag used to indicate the units. 1=field units (G); 2=field units (T); 3=frequency units (MHz); 4=Mc/...
virtual UInt_t LastSignificant(Double_t dval, UInt_t precLimit=6)
virtual Int_t ReadMsrFile()
virtual void SetRRFPacking(Int_t pack)
Int_t fRRFPhaseParamNo
parameter number if used instead of a RRF phase value
#define MSR_FITTYPE_MU_MINUS
virtual void InitFourierParameterStructure(PMsrFourierStructure &fourier)
virtual void SetT0Bin(Double_t dval, Int_t idx=-1)
#define PMUSR_MSR_SYNTAX_ERROR
#define FOURIER_APOD_NONE
virtual void SetNormParamNo(Int_t ival)
Bool_t fFourierOnly
flag indicating if Fourier transform only is wished. If yes, some part of the msr-file blocks are not...
virtual void SetFitType(Int_t ival)
#define MSR_PLOT_MU_MINUS
#define FOURIER_PLOT_PHASE
#define FOURIER_UNIT_GAUSS
virtual Double_t GetRRFPhase()
virtual void CheckMaxLikelihood()
virtual Int_t GetFitType()
virtual Bool_t SetMsrParamValue(UInt_t i, Double_t value)
Bool_t fChisq
flag telling if min = chi2 or min = max.likelihood
virtual void SetBkgRange(Int_t ival, Int_t idx)
virtual void SetFitRange(Double_t dval, UInt_t idx)
#define FOURIER_APOD_NOT_GIVEN
virtual void SetRRFFreq(Double_t freq, const char *unit)
Bool_t fUseFitRanges
yes -> use the fit ranges to plot the data, no (default) -> use range information if present ...
PIntVector fRuns
list of runs to be plotted
virtual void SetPacking(Int_t ival)
#define FOURIER_UNIT_TESLA
virtual void SetGlobalPresent(Bool_t bval)
virtual UInt_t GetNoOfFitParameters(UInt_t idx)
Double_t fMinExpected
expected total chi2 or max. likelihood
Double_t fLowerBoundary
lower boundary for the fit parameter
#define FOURIER_PLOT_PHASE_OPT_REAL
#define PMUSR_MSR_LOG_FILE_WRITE_ERROR
virtual void SetLifetimeCorrection(Bool_t bval)
#define FOURIER_PLOT_NOT_GIVEN
virtual Int_t GetAddT0BinSize(UInt_t addRunIdx)
virtual void SetFitRange(Double_t dval, UInt_t idx)
virtual Bool_t HandleStatisticEntry(PMsrLines &line)
UInt_t fRRFUnit
RRF frequency unit. 0=kHz, 1=MHz, 2=Mc/s, 3=Gauss, 4=Tesla.
virtual void GetGroupingString(Int_t runNo, TString detector, TString &groupingStr)
virtual Bool_t HandleFitParameterEntry(PMsrLines &line)
Bool_t fLifeTimeCorrection
needed for single histo. If yes, only the asymmetry is shown, otherweise the positron spectrum ...
virtual void SetXDataIndex(Int_t ival)
Int_t fFourierPower
i.e. zero padding up to 2^fFourierPower, default = 0 which means NO zero padding
virtual PIntVector * GetMap()
#define MSR_FITTYPE_ASYM_RRF
Double_t fPosError
positive error if present
UInt_t fNdf
number of degrees of freedom
virtual void SetMsrBkgRangeEntry(UInt_t runNo, UInt_t idx, Int_t bin)
#define FOURIER_APOD_STRONG
virtual void CheckLegacyLifetimecorrection()
virtual TString BeautifyFourierPhaseParameterString()
PDoubleVector fYmin
asymmetry/counts minimum
virtual void SetBetaParamNo(Int_t ival)
PMsrLines fTheory
holds the theory definition
virtual Bool_t SetMsrParamPosErrorPresent(UInt_t i, Bool_t value)
Double_t fPlotRange[2]
field/frequency plot range
PDoubleVector fYmax
asymmetry/counts maximum
TString fTitle
holds the title string of the msr-file
Double_t fRRFPhase
RRF phase.
virtual Bool_t EstimateN0()
Int_t fNoOfParams
how many parameters are given
virtual void SetDataRange(Int_t ival, Int_t idx)
virtual void SetPacking(Int_t ival)
virtual Int_t GetPacking()
virtual Double_t GetFitRange(UInt_t idx)
PMsrGlobalBlock fGlobal
holds the information of the global section
#define FOURIER_APOD_MEDIUM
TString fDate
string holding fitting date and time
PUIntVector fNdfPerHisto
number of degrees of freedom per histo
#define PRUN_SINGLE_HISTO
virtual Bool_t SetMsrParamPosError(UInt_t i, Double_t value)
virtual void SetBkgFix(Double_t dval, Int_t idx)
Bool_t fPosErrorPresent
positive error is defined (as a number)
virtual Bool_t HandleGlobalEntry(PMsrLines &line)
virtual void SetFitType(Int_t ival)
#define MSR_TAG_FITPARAMETER
virtual Bool_t CheckFuncs()
virtual Bool_t ParseFourierPhaseValueVector(PMsrFourierStructure &fourier, const TString &str, Bool_t &error)
std::vector< Bool_t > PBoolVector