87 while (fFileName.Index(
"/", idx+1) != -1) {
88 idx = fFileName.Index(
"/", idx+1);
93 fMsrFileDirectoryPath =
"./";
198 f.open(
fFileName.Data(), std::iostream::in);
214 current.
fLine = line;
216 if (line.BeginsWith(
"#") || line.IsWhitespace()) {
221 line.Remove(TString::kLeading,
' ');
223 if (!line.IsWhitespace()) {
227 }
else if (line.BeginsWith(
"FITPARAMETER")) {
229 }
else if (line.BeginsWith(
"THEORY")) {
231 theory.push_back(current);
232 }
else if (line.BeginsWith(
"FUNCTIONS")) {
234 functions.push_back(current);
235 }
else if (line.BeginsWith(
"GLOBAL")) {
237 global.push_back(current);
238 }
else if (line.BeginsWith(
"RUN")) {
240 run.push_back(current);
241 }
else if (line.BeginsWith(
"COMMANDS")) {
243 commands.push_back(current);
244 }
else if (line.BeginsWith(
"FOURIER")) {
246 fourier.push_back(current);
247 }
else if (line.BeginsWith(
"PLOT")) {
249 plot.push_back(current);
250 }
else if (line.BeginsWith(
"STATISTIC")) {
252 statistic.push_back(current);
257 fit_parameter.push_back(current);
260 theory.push_back(current);
263 functions.push_back(current);
266 global.push_back(current);
269 run.push_back(current);
272 commands.push_back(current);
275 fourier.push_back(current);
278 plot.push_back(current);
281 statistic.push_back(current);
323 for (UInt_t i=0; i<
fCommands.size(); i++) {
324 if (
fCommands[i].fLine.Contains(
"MAX_LIKELIHOOD"))
343 fLastErrorMsg <<
">> PMsrHandler::ReadMsrFile: **SEVERE ERROR** parameter name " <<
fParam[parX].fName.Data() <<
" is identical for parameter no " <<
fParam[parX].fNo <<
" and " <<
fParam[parY].fNo <<
"!\n";
389 fit_parameter.clear();
450 const UInt_t prec = 6;
451 UInt_t neededPrec = 0;
452 UInt_t neededWidth = 9;
454 Int_t tag, lineNo = 0, number;
455 Int_t runNo = -1, addRunNo = 0;
458 TString logFileName, str, sstr, *pstr;
459 Bool_t found =
false;
460 Bool_t statisticBlockFound =
false;
461 Bool_t partialStatisticBlockFound =
true;
464 for (UInt_t i=0; i<
fRuns.size(); i++) {
465 t0TagMissing.push_back(
true);
467 std::vector<PBoolVector> addt0TagMissing;
469 for (UInt_t i=0; i<
fRuns.size(); i++) {
471 for (UInt_t j=0; j<
fRuns[i].GetAddT0BinEntries(); j++)
472 bvec.push_back(
true);
473 addt0TagMissing.push_back(bvec);
476 for (UInt_t i=0; i<
fRuns.size(); i++) {
477 backgroundTagMissing.push_back(
true);
480 for (UInt_t i=0; i<
fRuns.size(); i++) {
481 dataTagMissing.push_back(
true);
488 for (UInt_t i=0; i<
fRuns.size(); i++) {
489 fitTagMissing.push_back(
true);
490 lastRunLineNo.push_back(-1);
494 Int_t addT0Counter = 0;
495 Int_t addT0GlobalCounter = 0;
502 fin.open(
fFileName.Data(), std::iostream::in);
503 if (!fin.is_open()) {
506 Bool_t inRunBlock =
false;
514 if (str.BeginsWith(
"RUN")) {
517 lastRunLineNo[runNo] = lineNo;
521 if (str.BeginsWith(
"FITPARAMETER") || str.BeginsWith(
"THEORY") || str.BeginsWith(
"FUNCTIONS") ||
522 str.BeginsWith(
"GLOBAL") || str.BeginsWith(
"COMMANDS") || str.BeginsWith(
"FOURIER") ||
523 str.BeginsWith(
"PLOT") || str.BeginsWith(
"STATISTIC"))
529 if (inRunBlock && !str.IsWhitespace() && !str.BeginsWith(
"#")) {
530 lastRunLineNo[runNo] = lineNo;
531 if (str.BeginsWith(
"fit") && !str.BeginsWith(
"fittype"))
532 fitTagMissing[runNo] =
false;
535 if (str.BeginsWith(
"t0"))
536 t0TagMissing[runNo] =
false;
537 else if (str.BeginsWith(
"background"))
538 backgroundTagMissing[runNo] =
false;
539 else if (str.BeginsWith(
"data"))
540 dataTagMissing[runNo] =
false;
547 while (
fFileName.Index(
".", idx+1) != -1) {
555 logFileName.Remove(idx+1);
556 logFileName +=
"mlog";
559 fin.open(
fFileName.Data(), std::iostream::in);
560 if (!fin.is_open()) {
565 fout.open(logFileName.Data(), std::iostream::out);
566 if (!fout.is_open()) {
571 auto writeMissingRunTags = [&](Int_t runNo) {
573 if (addMissingT0s && t0TagMissing[runNo] &&
fRuns[runNo].GetInstitute()->CompareTo(
"isis", TString::kIgnoreCase)) {
574 if (
fRuns[runNo].GetT0BinSize() > 0) {
576 fout << std::left <<
"t0";
577 for (UInt_t j=0; j<
fRuns[runNo].GetT0BinSize(); j++) {
580 fout.setf(std::ios::fixed,std::ios::floatfield);
581 fout << std::left <<
fRuns[runNo].GetT0Bin(j);
586 for (UInt_t i=0; i<
fRuns[runNo].GetAddT0BinEntries(); i++) {
587 if (addMissingT0s && addt0TagMissing[runNo][i] &&
fRuns[runNo].GetInstitute()->CompareTo(
"isis", TString::kIgnoreCase)) {
588 if (
fRuns[runNo].GetAddT0BinSize(i) > 0) {
590 fout << std::left <<
"addt0";
591 for (Int_t j=0; j<
fRuns[runNo].GetAddT0BinSize(i); j++) {
594 fout.setf(std::ios::fixed,std::ios::floatfield);
595 fout << std::left <<
fRuns[runNo].GetAddT0Bin(i, j);
601 if (backgroundTagMissing[runNo]) {
602 if (
fRuns[runNo].GetBkgRange(0) >= 0) {
604 fout << std::left <<
"background";
605 for (UInt_t j=0; j<4; j++) {
606 if (
fRuns[runNo].GetBkgRange(j) > 0) {
608 fout << std::left <<
fRuns[runNo].GetBkgRange(j);
614 if (dataTagMissing[runNo]) {
615 if (
fRuns[runNo].GetDataRange(0) >= 0) {
617 fout << std::left <<
"data";
618 for (UInt_t j=0; j<4; j++) {
619 if (
fRuns[runNo].GetDataRange(j) > 0) {
621 fout << std::left <<
fRuns[runNo].GetDataRange(j);
641 if (str.BeginsWith(
"FITPARAMETER")) {
643 }
else if (str.BeginsWith(
"THEORY")) {
645 fout << str.Data() << std::endl;
647 }
else if (str.BeginsWith(
"FUNCTIONS")) {
649 fout << str.Data() << std::endl;
651 }
else if (str.BeginsWith(
"GLOBAL")) {
653 fout << str.Data() << std::endl;
655 }
else if (str.BeginsWith(
"RUN")) {
660 }
else if (str.BeginsWith(
"COMMANDS")) {
662 fout << str.Data() << std::endl;
664 }
else if (str.BeginsWith(
"FOURIER")) {
666 fout << str.Data() << std::endl;
668 }
else if (str.BeginsWith(
"PLOT")) {
671 }
else if (str.BeginsWith(
"STATISTIC")) {
679 fout <<
fTitle.Data() << std::endl;
681 fout << str.Data() << std::endl;
685 if (tokens.empty()) {
686 fout << str.Data() << std::endl;
692 assert ((number >= 0) && (number < (Int_t)
fParam.size()));
695 fout << std::right <<
fParam[number].fNo;
699 fout << std::left <<
fParam[number].fName.Data();
702 if (
fParam[number].fStep == 0.0)
711 neededWidth = neededPrec + 3;
712 fout.width(neededWidth);
713 fout.setf(std::ios::fixed, std::ios::floatfield);
714 fout.precision(neededPrec);
715 fout << std::left <<
fParam[number].fValue;
719 fout.setf(std::ios::fixed);
720 if (
fParam[number].fStep == 0.0)
722 fout.precision(neededPrec);
723 fout << std::left <<
fParam[number].fStep;
726 fout.setf(std::ios::fixed);
727 fout.precision(neededPrec);
728 if ((
fParam[number].fNoOfParams == 5) || (
fParam[number].fNoOfParams == 7))
729 if (
fParam[number].fPosErrorPresent && (
fParam[number].fStep != 0))
730 fout << std::left <<
fParam[number].fPosError;
732 fout << std::left <<
"none";
734 fout << std::left <<
"none";
736 fout.unsetf(std::ios::floatfield);
738 if (
fParam[number].fNoOfParams > 5) {
740 fout.precision(prec);
741 if (
fParam[number].fLowerBoundaryPresent)
742 fout << std::left <<
fParam[number].fLowerBoundary;
744 fout << std::left <<
"none";
747 fout.precision(prec);
748 if (
fParam[number].fUpperBoundaryPresent)
749 fout << std::left <<
fParam[number].fUpperBoundary;
751 fout << std::left <<
"none";
756 fout << str.Data() << std::endl;
763 for (UInt_t i=0; i<
fTheory.size(); i++) {
764 if (
fTheory[i].fLineNo == lineNo) {
765 fout <<
fTheory[i].fLine.Data() << std::endl;
770 fout << str.Data() << std::endl;
775 sstr.Remove(TString::kLeading,
' ');
776 if (str.BeginsWith(
"fun")) {
781 fout << sstr.Data() << std::endl;
784 fout << str.Data() << std::endl;
789 if (sstr.BeginsWith(
"fittype")) {
791 switch (
fGlobal.GetFitType()) {
799 fout << std::left <<
"fittype" <<
MSR_FITTYPE_ASYM <<
" (asymmetry fit)" << std::endl ;
808 fout << std::left <<
"fittype" <<
MSR_FITTYPE_BNMR <<
" (beta-NMR fit)" << std::endl ;
818 fout << std::left <<
"rrf_freq ";
821 fout.precision(neededPrec);
822 fout << std::left << std::fixed <<
fGlobal.GetRRFFreq(
fGlobal.GetRRFUnit().Data());
823 fout <<
" " <<
fGlobal.GetRRFUnit();
827 fout <<
"rrf_phase ";
829 fout << std::left <<
fGlobal.GetRRFPhase();
833 fout <<
"rrf_packing ";
835 fout << std::left <<
fGlobal.GetRRFPacking();
837 }
else if (sstr.BeginsWith(
"data")) {
839 fout << std::left <<
"data";
840 for (UInt_t j=0; j<4; j++) {
841 if (
fGlobal.GetDataRange(j) > 0) {
843 fout << std::left <<
fGlobal.GetDataRange(j);
847 }
else if (sstr.BeginsWith(
"t0")) {
849 fout << std::left <<
"t0";
850 for (UInt_t j=0; j<
fGlobal.GetT0BinSize(); j++) {
853 fout.setf(std::ios::fixed,std::ios::floatfield);
854 fout << std::left <<
fGlobal.GetT0Bin(j);
857 }
else if (sstr.BeginsWith(
"addt0")) {
859 fout << std::left <<
"addt0";
860 for (Int_t j=0; j<
fGlobal.GetAddT0BinSize(addT0GlobalCounter); j++) {
863 fout.setf(std::ios::fixed,std::ios::floatfield);
864 fout << std::left <<
fGlobal.GetAddT0Bin(addT0GlobalCounter, j);
867 addT0GlobalCounter++;
868 }
else if (sstr.BeginsWith(
"fit")) {
870 fout << std::left <<
"fit";
871 if (
fGlobal.IsFitRangeInBin()) {
873 if (
fGlobal.GetFitRangeOffset(0) > 0)
874 fout <<
"+" <<
fGlobal.GetFitRangeOffset(0);
876 if (
fGlobal.GetFitRangeOffset(1) > 0)
877 fout <<
"-" <<
fGlobal.GetFitRangeOffset(1);
881 fout.precision(neededPrec);
882 fout <<
" # in time: " <<
fGlobal.GetFitRange(0) <<
".." <<
fGlobal.GetFitRange(1) <<
" (usec)";
884 for (UInt_t j=0; j<2; j++) {
885 if (
fGlobal.GetFitRange(j) == -1)
889 fout.width(neededWidth);
890 fout.precision(neededPrec);
891 fout << std::left << std::fixed <<
fGlobal.GetFitRange(j);
897 }
else if (sstr.BeginsWith(
"packing")) {
899 fout << std::left <<
"packing";
900 fout <<
fGlobal.GetPacking() << std::endl;
901 }
else if (sstr.BeginsWith(
"deadtime-cor")) {
903 fout << std::left <<
"deadtime-cor";
904 fout <<
fGlobal.GetDeadTimeCorrection() << std::endl;
906 fout << str.Data() << std::endl;
911 sstr.Remove(TString::kLeading,
' ');
912 if (sstr.BeginsWith(
"RUN")) {
914 fout <<
"RUN " <<
fRuns[runNo].GetRunName()->Data() <<
" ";
915 pstr =
fRuns[runNo].GetBeamline();
916 if (pstr ==
nullptr) {
917 std::cerr << std::endl <<
">> PMsrHandler::WriteMsrLogFile: **ERROR** Couldn't obtain beamline data." << std::endl;
921 fout << pstr->Data() <<
" ";
922 pstr =
fRuns[runNo].GetInstitute();
923 if (pstr ==
nullptr) {
924 std::cerr << std::endl <<
">> PMsrHandler::WriteMsrLogFile: **ERROR** Couldn't obtain institute data." << std::endl;
928 fout << pstr->Data() <<
" ";
929 pstr =
fRuns[runNo].GetFileFormat();
930 if (pstr ==
nullptr) {
931 std::cerr << std::endl <<
">> PMsrHandler::WriteMsrLogFile: **ERROR** Couldn't obtain file format data." << std::endl;
935 fout << pstr->Data() <<
" (name beamline institute data-file-format)" << std::endl;
936 }
else if (sstr.BeginsWith(
"ADDRUN")) {
938 fout <<
"ADDRUN " <<
fRuns[runNo].GetRunName(addRunNo)->Data() <<
" ";
939 pstr =
fRuns[runNo].GetBeamline(addRunNo);
940 if (pstr ==
nullptr) {
941 std::cerr << std::endl <<
">> PMsrHandler::WriteMsrLogFile: **ERROR** Couldn't obtain beamline data (addrun)." << std::endl;
945 fout << pstr->Data() <<
" ";
946 pstr =
fRuns[runNo].GetInstitute(addRunNo);
947 if (pstr ==
nullptr) {
948 std::cerr << std::endl <<
">> PMsrHandler::WriteMsrLogFile: **ERROR** Couldn't obtain institute data (addrun)." << std::endl;
952 fout << pstr->Data() <<
" ";
953 pstr =
fRuns[runNo].GetFileFormat(addRunNo);
954 if (pstr ==
nullptr) {
955 std::cerr << std::endl <<
">> PMsrHandler::WriteMsrLogFile: **ERROR** Couldn't obtain file format data (addrun)." << std::endl;
959 fout << pstr->Data() <<
" (name beamline institute data-file-format)" << std::endl;
960 }
else if (sstr.BeginsWith(
"fittype")) {
962 switch (
fRuns[runNo].GetFitType()) {
970 fout << std::left <<
"fittype" <<
MSR_FITTYPE_ASYM <<
" (asymmetry fit)" << std::endl ;
979 fout << std::left <<
"fittype" <<
MSR_FITTYPE_BNMR <<
" (beta-NMR fit)" << std::endl ;
987 }
else if (sstr.BeginsWith(
"alpha ")) {
989 fout << std::left <<
"alpha";
994 fout <<
fRuns[runNo].GetAlphaParamNo();
996 }
else if (sstr.BeginsWith(
"beta ")) {
998 fout << std::left <<
"beta";
1002 fout <<
fRuns[runNo].GetBetaParamNo();
1004 }
else if (sstr.BeginsWith(
"norm")) {
1006 fout << std::left <<
"norm";
1011 fout <<
fRuns[runNo].GetNormParamNo();
1013 }
else if (sstr.BeginsWith(
"backgr.fit")) {
1015 fout << std::left <<
"backgr.fit";
1016 fout <<
fRuns[runNo].GetBkgFitParamNo() << std::endl;
1017 }
else if (sstr.BeginsWith(
"lifetime ")) {
1019 fout << std::left <<
"lifetime";
1020 fout <<
fRuns[runNo].GetLifetimeParamNo() << std::endl;
1021 }
else if (sstr.BeginsWith(
"lifetimecorrection")) {
1023 }
else if (sstr.BeginsWith(
"map")) {
1025 for (UInt_t j=0; j<
fRuns[runNo].GetMap()->size(); j++) {
1027 fout << std::right <<
fRuns[runNo].GetMap(j);
1030 if (
fRuns[runNo].GetMap()->size() < 10) {
1031 for (UInt_t j=
fRuns[runNo].GetMap()->size(); j<10; j++)
1035 }
else if (sstr.BeginsWith(
"forward")) {
1036 if (
fRuns[runNo].GetForwardHistoNoSize() == 0) {
1037 std::cerr << std::endl <<
">> PMsrHandler::WriteMsrLogFile: **WARNING** 'forward' tag without any data found!";
1038 std::cerr << std::endl <<
">> Something is VERY fishy, please check your msr-file carfully." << std::endl;
1042 for (UInt_t i=0; i<
fRuns[runNo].GetForwardHistoNoSize(); i++)
1043 forward.push_back(
fRuns[runNo].GetForwardHistoNo(i));
1046 fout << result.Data() << std::endl;
1048 }
else if (sstr.BeginsWith(
"backward")) {
1049 if (
fRuns[runNo].GetBackwardHistoNoSize() == 0) {
1050 std::cerr << std::endl <<
">> PMsrHandler::WriteMsrLogFile: **WARNING** 'backward' tag without any data found!";
1051 std::cerr << std::endl <<
">> Something is VERY fishy, please check your msr-file carfully." << std::endl;
1055 for (UInt_t i=0; i<
fRuns[runNo].GetBackwardHistoNoSize(); i++)
1056 backward.push_back(
fRuns[runNo].GetBackwardHistoNo(i));
1059 fout << result.Data() << std::endl;
1061 }
else if (sstr.BeginsWith(
"backgr.fix")) {
1063 fout << std::left <<
"backgr.fix";
1064 for (UInt_t j=0; j<2; j++) {
1066 fout.precision(prec);
1068 fout << std::left <<
fRuns[runNo].GetBkgFix(j);
1072 }
else if (sstr.BeginsWith(
"background")) {
1073 backgroundTagMissing[runNo] =
false;
1075 fout << std::left <<
"background";
1076 for (UInt_t j=0; j<4; j++) {
1077 if (
fRuns[runNo].GetBkgRange(j) > 0) {
1079 fout << std::left <<
fRuns[runNo].GetBkgRange(j);
1084 if ((Int_t)log10(
fRuns[runNo].GetBkgEstimated(0))+1 >= 4)
1086 fout <<
" # estimated bkg: ";
1088 fout.precision(precision);
1089 fout <<
fRuns[runNo].GetBkgEstimated(0);
1093 fout.precision(precision);
1094 fout <<
fRuns[runNo].GetBkgEstimated(1);
1098 }
else if (sstr.BeginsWith(
"data")) {
1099 dataTagMissing[runNo] =
false;
1101 fout << std::left <<
"data";
1102 for (UInt_t j=0; j<4; j++) {
1103 if (
fRuns[runNo].GetDataRange(j) > 0) {
1105 fout << std::left <<
fRuns[runNo].GetDataRange(j);
1109 }
else if (sstr.BeginsWith(
"t0")) {
1110 t0TagMissing[runNo] =
false;
1112 fout << std::left <<
"t0";
1113 for (UInt_t j=0; j<
fRuns[runNo].GetT0BinSize(); j++) {
1116 fout.setf(std::ios::fixed,std::ios::floatfield);
1117 fout << std::left <<
fRuns[runNo].GetT0Bin(j);
1120 }
else if (sstr.BeginsWith(
"addt0")) {
1121 addt0TagMissing[runNo][addT0Counter] =
false;
1122 if (
fRuns[runNo].GetAddT0BinSize(addT0Counter) <=0) {
1123 std::cerr << std::endl <<
">> PMsrHandler::WriteMsrLogFile: **WARNING** 'addt0' tag without any data found!";
1124 std::cerr << std::endl <<
">> Something is VERY fishy, please check your msr-file carfully." << std::endl;
1127 fout << std::left <<
"addt0";
1128 for (Int_t j=0; j<
fRuns[runNo].GetAddT0BinSize(addT0Counter); j++) {
1131 fout.setf(std::ios::fixed,std::ios::floatfield);
1132 fout << std::left <<
fRuns[runNo].GetAddT0Bin(addT0Counter, j);
1137 }
else if (sstr.BeginsWith(
"xy-data")) {
1138 if (
fRuns[runNo].GetXDataIndex() != -1) {
1140 fout << std::left <<
"xy-data";
1143 fout << std::left << std::fixed <<
fRuns[runNo].GetXDataIndex();
1146 fout << std::left << std::fixed <<
fRuns[runNo].GetYDataIndex();
1148 }
else if (!
fRuns[runNo].GetXDataLabel()->IsWhitespace()) {
1150 fout << std::left <<
"xy-data";
1152 fout << std::left << std::fixed <<
fRuns[runNo].GetXDataLabel()->Data();
1155 fout << std::left << std::fixed <<
fRuns[runNo].GetYDataLabel()->Data();
1158 }
else if (sstr.BeginsWith(
"fit")) {
1160 writeMissingRunTags(runNo);
1163 fout << std::left <<
"fit";
1164 if (
fRuns[runNo].IsFitRangeInBin()) {
1166 if (
fRuns[runNo].GetFitRangeOffset(0) > 0)
1167 fout <<
"+" <<
fRuns[runNo].GetFitRangeOffset(0);
1169 if (
fRuns[runNo].GetFitRangeOffset(1) > 0)
1170 fout <<
"-" <<
fRuns[runNo].GetFitRangeOffset(1);
1174 fout.precision(neededPrec);
1175 fout <<
" # in time: " <<
fRuns[runNo].GetFitRange(0) <<
".." <<
fRuns[runNo].GetFitRange(1) <<
" (usec)";
1177 for (UInt_t j=0; j<2; j++) {
1178 if (
fRuns[runNo].GetFitRange(j) == -1)
1182 fout.width(neededWidth);
1183 fout.precision(neededPrec);
1184 fout << std::left << std::fixed <<
fRuns[runNo].GetFitRange(j);
1190 }
else if (sstr.BeginsWith(
"packing")) {
1192 fout << std::left <<
"packing";
1193 fout <<
fRuns[runNo].GetPacking() << std::endl;
1194 }
else if (sstr.BeginsWith(
"deadtime-cor")) {
1196 fout << std::left <<
"deadtime-cor";
1197 fout <<
fRuns[runNo].GetDeadTimeCorrection() << std::endl;
1199 fout << str.Data() << std::endl;
1203 if (addMissingT0s && fitTagMissing[runNo] && (lineNo == lastRunLineNo[runNo]))
1204 writeMissingRunTags(runNo);
1207 fout << str.Data() << std::endl;
1211 sstr.Remove(TString::kLeading,
' ');
1212 if (sstr.BeginsWith(
"units")) {
1223 fout <<
" # units either 'Gauss', 'Tesla', 'MHz', or 'Mc/s'";
1225 }
else if (sstr.BeginsWith(
"fourier_power")) {
1226 fout <<
"fourier_power " <<
fFourier.fFourierPower << std::endl;
1227 }
else if (sstr.BeginsWith(
"dc-corrected")) {
1228 fout <<
"dc-corrected ";
1230 fout <<
"true" << std::endl;
1232 fout <<
"false" << std::endl;
1233 }
else if (sstr.BeginsWith(
"apodization")) {
1234 fout <<
"apodization ";
1244 fout <<
" # NONE, WEAK, MEDIUM, STRONG";
1246 }
else if (sstr.BeginsWith(
"plot")) {
1253 fout <<
"REAL_AND_IMAG";
1259 fout <<
"PHASE_OPT_REAL";
1261 fout <<
" # REAL, IMAG, REAL_AND_IMAG, POWER, PHASE, PHASE_OPT_REAL";
1263 }
else if (sstr.BeginsWith(
"phase")) {
1264 if (
fFourier.fPhaseParamNo.size() > 0) {
1266 fout <<
"phase " << phaseParamStr << std::endl;
1267 }
else if (
fFourier.fPhase.size() > 0) {
1269 for (UInt_t i=0; i<
fFourier.fPhase.size()-1; i++) {
1270 fout <<
fFourier.fPhase[i] <<
", ";
1274 }
else if (sstr.BeginsWith(
"range_for_phase_correction")) {
1275 fout <<
"range_for_phase_correction " <<
fFourier.fRangeForPhaseCorrection[0] <<
" " <<
fFourier.fRangeForPhaseCorrection[1] << std::endl;
1276 }
else if (sstr.BeginsWith(
"range ")) {
1277 fout.setf(std::ios::fixed,std::ios::floatfield);
1281 fout.precision(neededPrec);
1282 fout <<
"range " <<
fFourier.fPlotRange[0] <<
" " <<
fFourier.fPlotRange[1] << std::endl;
1284 fout << str.Data() << std::endl;
1289 sstr.Remove(TString::kLeading,
' ');
1290 if (sstr.BeginsWith(
"PLOT")) {
1291 switch (
fPlots[plotNo].fPlotType) {
1293 fout <<
"PLOT " <<
fPlots[plotNo].fPlotType <<
" (single histo plot)" << std::endl;
1296 fout <<
"PLOT " <<
fPlots[plotNo].fPlotType <<
" (single histo RRF plot)" << std::endl;
1299 fout <<
"PLOT " <<
fPlots[plotNo].fPlotType <<
" (asymmetry plot)" << std::endl;
1302 fout <<
"PLOT " <<
fPlots[plotNo].fPlotType <<
" (asymmetry RRF plot)" << std::endl;
1305 fout <<
"PLOT " <<
fPlots[plotNo].fPlotType <<
" (mu minus plot)" << std::endl;
1308 fout <<
"PLOT " <<
fPlots[plotNo].fPlotType <<
" (beta-NMR asymmetry plot)" << std::endl;
1311 fout <<
"PLOT " <<
fPlots[plotNo].fPlotType <<
" (non muSR plot)" << std::endl;
1316 if (
fPlots[plotNo].fLifeTimeCorrection) {
1317 fout <<
"lifetimecorrection" << std::endl;
1319 }
else if (sstr.BeginsWith(
"lifetimecorrection")) {
1323 }
else if (sstr.BeginsWith(
"runs")) {
1326 for (UInt_t j=0; j<
fPlots[plotNo].fRuns.size(); j++) {
1328 fout <<
fPlots[plotNo].fRuns[j];
1331 }
else if (sstr.BeginsWith(
"range")) {
1334 fout.precision(neededPrec);
1335 fout <<
fPlots[plotNo].fTmin[0];
1338 fout.precision(neededPrec);
1339 fout <<
fPlots[plotNo].fTmax[0];
1340 if (
fPlots[plotNo].fYmin.size() > 0) {
1343 fout.precision(neededPrec);
1344 fout <<
fPlots[plotNo].fYmin[0] <<
" ";
1346 fout.precision(neededPrec);
1347 fout <<
fPlots[plotNo].fYmax[0];
1351 fout << str.Data() << std::endl;
1355 statisticBlockFound =
true;
1357 sstr.Remove(TString::kLeading,
' ');
1358 if (sstr.BeginsWith(
"STATISTIC")) {
1360 fout <<
"STATISTIC --- " << dt.AsSQLString() << std::endl;
1361 }
else if (sstr.BeginsWith(
"chisq") || sstr.BeginsWith(
"maxLH")) {
1362 partialStatisticBlockFound =
false;
1369 fout << str.Data() << std::endl;
1371 std::cout << std::endl << str.Data() << std::endl;
1376 str.Form(
" expected chisq = %.1lf, NDF = %d, expected chisq/NDF = %lf",
1379 str.Form(
" expected maxLH = %.1lf, NDF = %d, expected maxLH/NDF = %lf",
1384 fout << str.Data() << std::endl;
1387 std::cout << std::endl << str.Data() << std::endl;
1389 for (UInt_t i=0; i<
fStatistic.fMinExpectedPerHisto.size(); i++) {
1392 str.Form(
" run block %d: (NDF/red.chisq/red.chisq_e) = (%d/%lf/%lf)",
1395 str.Form(
" run block %d: (NDF/red.maxLH/red.maxLH_e) = (%d/%lf/%lf)",
1400 fout << str.Data() << std::endl;
1404 std::cout << str.Data() << std::endl;
1407 }
else if (
fStatistic.fNdfPerHisto.size() > 1) {
1408 for (UInt_t i=0; i<
fStatistic.fNdfPerHisto.size(); i++) {
1410 str.Form(
" run block %d: (NDF/red.chisq) = (%d/%lf)",
1413 str.Form(
" run block %d: (NDF/maxLH.chisq) = (%d/%lf)",
1418 fout << str.Data() << std::endl;
1422 std::cout << str.Data() << std::endl;
1426 fout <<
"*** FIT DID NOT CONVERGE ***" << std::endl;
1428 std::cout << std::endl <<
"*** FIT DID NOT CONVERGE ***" << std::endl;
1430 }
else if (sstr.BeginsWith(
"*** FIT DID NOT CONVERGE ***")) {
1431 partialStatisticBlockFound =
false;
1438 fout << str.Data() << std::endl;
1440 std::cout << std::endl << str.Data() << std::endl;
1445 str.Form(
" expected chisq = %.1lf, NDF = %d, expected chisq/NDF = %lf",
1448 str.Form(
" expected maxLH = %.1lf, NDF = %d, expected maxLH/NDF = %lf",
1453 fout << str.Data() << std::endl;
1456 std::cout << str.Data() << std::endl;
1458 for (UInt_t i=0; i<
fStatistic.fMinExpectedPerHisto.size(); i++) {
1461 str.Form(
" run block %d: (NDF/red.chisq/red.chisq_e) = (%d/%lf/%lf)",
1464 str.Form(
" run block %d: (NDF/red.maxLH/red.maxLH_e) = (%d/%lf/%lf)",
1469 fout << str.Data() << std::endl;
1473 std::cout << str.Data() << std::endl;
1476 }
else if (
fStatistic.fNdfPerHisto.size() > 1) {
1477 for (UInt_t i=0; i<
fStatistic.fNdfPerHisto.size(); i++) {
1479 str.Form(
" run block %d: (NDF/red.chisq) = (%d/%lf)",
1482 str.Form(
" run block %d: (NDF/red.maxLH) = (%d/%lf)",
1487 fout << str.Data() << std::endl;
1491 std::cout << str.Data() << std::endl;
1495 fout <<
"*** FIT DID NOT CONVERGE ***" << std::endl;
1497 std::cout << std::endl <<
"*** FIT DID NOT CONVERGE ***" << std::endl;
1500 if (str.Length() > 0) {
1502 sstr.Remove(TString::kLeading,
' ');
1503 if (!sstr.BeginsWith(
"expected chisq") && !sstr.BeginsWith(
"expected maxLH") && !sstr.BeginsWith(
"run block"))
1504 fout << str.Data() << std::endl;
1517 if (!statisticBlockFound) {
1518 partialStatisticBlockFound =
false;
1519 std::cerr << std::endl <<
">> PMsrHandler::WriteMsrLogFile: **WARNING** no STATISTIC block present, will write a default one" << std::endl;
1520 fout <<
"###############################################################" << std::endl;
1522 fout <<
"STATISTIC --- " << dt.AsSQLString() << std::endl;
1529 fout << str.Data() << std::endl;
1531 std::cout << std::endl << str.Data() << std::endl;
1536 str.Form(
" expected chisq = %.1lf, NDF = %d, expected chisq/NDF = %lf",
1539 str.Form(
" expected maxLH = %.1lf, NDF = %d, expected maxLH/NDF = %lf",
1544 fout << str.Data() << std::endl;
1547 std::cout << str.Data() << std::endl;
1549 for (UInt_t i=0; i<
fStatistic.fMinExpectedPerHisto.size(); i++) {
1552 str.Form(
" run block %d: (NDF/red.chisq/red.chisq_e) = (%d/%lf/%lf)",
1555 str.Form(
" run block %d: (NDF/red.maxLH/red.maxLH_e) = (%d/%lf/%lf)",
1560 fout << str.Data() << std::endl;
1564 std::cout << str.Data() << std::endl;
1567 }
else if (
fStatistic.fNdfPerHisto.size() > 1) {
1568 for (UInt_t i=0; i<
fStatistic.fNdfPerHisto.size(); i++) {
1570 str.Form(
" run block %d: (NDF/red.chisq) = (%d/%lf)",
1573 str.Form(
" run block %d: (NDF/red.maxLH) = (%d/%lf)",
1578 fout << str.Data() << std::endl;
1582 std::cout << str.Data() << std::endl;
1586 fout <<
"*** FIT DID NOT CONVERGE ***" << std::endl;
1588 std::cout << std::endl <<
"*** FIT DID NOT CONVERGE ***" << std::endl;
1593 if (partialStatisticBlockFound) {
1594 std::cerr << std::endl <<
">> PMsrHandler::WriteMsrLogFile: **WARNING** garbage STATISTIC block present in the msr-input file.";
1595 std::cerr << std::endl <<
">> ** WILL ADD SOME SENSIBLE STUFF, BUT YOU HAVE TO CHECK IT SINCE I AM **NOT** REMOVING THE GARBAGE! **" << std::endl;
1597 fout <<
"STATISTIC --- " << dt.AsSQLString() << std::endl;
1604 fout << str.Data() << std::endl;
1606 std::cout << std::endl << str.Data() << std::endl;
1611 str.Form(
" expected chisq = %.1lf, NDF = %d, expected chisq/NDF = %lf",
1614 str.Form(
" expected maxLH = %.1lf, NDF = %d, expected maxLH/NDF = %lf",
1619 fout << str.Data() << std::endl;
1622 std::cout << str.Data() << std::endl;
1624 for (UInt_t i=0; i<
fStatistic.fMinExpectedPerHisto.size(); i++) {
1627 str.Form(
" run block %d: (NDF/red.chisq/red.chisq_e) =(%d/%lf/%lf)",
1630 str.Form(
" run block %d: (NDF/red.maxLH/red.maxLH_e) =(%d/%lf/%lf)",
1635 fout << str.Data() << std::endl;
1639 std::cout << str.Data() << std::endl;
1642 }
else if (
fStatistic.fNdfPerHisto.size() > 1) {
1643 for (UInt_t i=0; i<
fStatistic.fNdfPerHisto.size(); i++) {
1645 str.Form(
" run block %d: (NDF/red.chisq) = (%d/%lf)",
1648 str.Form(
" run block %d: (NDF/red.maxLH) = (%d/%lf)",
1653 fout << str.Data() << std::endl;
1657 std::cout << str.Data() << std::endl;
1661 fout <<
"*** FIT DID NOT CONVERGE (4) ***" << std::endl;
1663 std::cout << std::endl <<
"*** FIT DID NOT CONVERGE ***" << std::endl;
1672 t0TagMissing.clear();
1673 backgroundTagMissing.clear();
1674 dataTagMissing.clear();
1730 std::map<UInt_t, TString> *commentsTHE, \
1731 std::map<UInt_t, TString> *commentsFUN, \
1732 std::map<UInt_t, TString> *commentsRUN)
1734 const UInt_t prec = 6;
1735 const TString hline =
"###############################################################";
1737 std::map<UInt_t, TString>::iterator iter;
1741 std::ofstream fout(filename);
1747 fout <<
fTitle.Data() << std::endl;
1748 fout << hline.Data() << std::endl;
1751 fout <<
"FITPARAMETER" << std::endl;
1752 fout <<
"# No Name Value Step Pos_Error Boundaries" << std::endl;
1754 for (i = 0; i <
fParam.size(); ++i) {
1756 iter = commentsPAR->find(i+1);
1757 if (iter != commentsPAR->end()) {
1759 fout <<
"# " << iter->second.Data() << std::endl;
1761 commentsPAR->erase(iter);
1766 fout << std::right <<
fParam[i].fNo;
1770 fout << std::left <<
fParam[i].fName.Data();
1774 fout.precision(prec);
1775 fout << std::left <<
fParam[i].fValue;
1779 fout.precision(prec);
1780 fout << std::left <<
fParam[i].fStep;
1783 fout.precision(prec);
1784 if ((
fParam[i].fNoOfParams == 5) || (
fParam[i].fNoOfParams == 7))
1785 if (
fParam[i].fPosErrorPresent && (
fParam[i].fStep != 0))
1786 fout << std::left <<
fParam[i].fPosError;
1788 fout << std::left <<
"none";
1790 fout << std::left <<
"none";
1793 if (
fParam[i].fNoOfParams > 5) {
1795 fout.precision(prec);
1796 if (
fParam[i].fLowerBoundaryPresent)
1797 fout << std::left <<
fParam[i].fLowerBoundary;
1799 fout << std::left <<
"none";
1802 fout.precision(prec);
1803 if (
fParam[i].fUpperBoundaryPresent)
1804 fout << std::left <<
fParam[i].fUpperBoundary;
1806 fout << std::left <<
"none";
1811 if (commentsPAR && !commentsPAR->empty()) {
1813 for(iter = commentsPAR->begin(); iter != commentsPAR->end(); ++iter) {
1814 fout <<
"# " << iter->second.Data() << std::endl;
1816 commentsPAR->clear();
1819 fout << hline.Data() << std::endl;
1822 fout <<
"THEORY" << std::endl;
1824 for (i = 1; i <
fTheory.size(); ++i) {
1826 iter = commentsTHE->find(i);
1827 if (iter != commentsTHE->end()) {
1829 fout <<
"# " << iter->second.Data() << std::endl;
1831 commentsTHE->erase(iter);
1834 fout <<
fTheory[i].fLine.Data() << std::endl;
1836 if (commentsTHE && !commentsTHE->empty()) {
1838 for(iter = commentsTHE->begin(); iter != commentsTHE->end(); ++iter) {
1839 fout <<
"# " << iter->second.Data() << std::endl;
1841 commentsTHE->clear();
1844 fout << hline.Data() << std::endl;
1850 fout <<
"FUNCTIONS" << std::endl;
1854 iter = commentsFUN->find(i);
1855 if (iter != commentsFUN->end()) {
1857 fout <<
"# " << iter->second.Data() << std::endl;
1859 commentsFUN->erase(iter);
1862 fout <<
fFunctions[i].fLine.Data() << std::endl;
1864 if (commentsFUN && !commentsFUN->empty()) {
1866 for(iter = commentsFUN->begin(); iter != commentsFUN->end(); ++iter) {
1867 fout <<
"# " << iter->second.Data() << std::endl;
1869 commentsFUN->clear();
1872 fout << hline.Data() << std::endl;
1876 fout <<
"GLOBAL" << std::endl;
1879 if (
fGlobal.GetFitType() != -1) {
1881 switch (
fGlobal.GetFitType()) {
1889 fout << std::left <<
"fittype" <<
MSR_FITTYPE_ASYM <<
" (asymmetry fit)" << std::endl ;
1892 fout << std::left <<
"fittype" <<
MSR_FITTYPE_ASYM_RRF <<
" (asymmetry RRF fit)" << std::endl ;
1898 fout << std::left <<
"fittype" <<
MSR_FITTYPE_BNMR <<
" (beta-NMR fit)" << std::endl ;
1911 fout << std::left <<
"rrf_freq ";
1913 fout << std::left <<
fGlobal.GetRRFFreq(
fGlobal.GetRRFUnit().Data());
1914 fout <<
" " <<
fGlobal.GetRRFUnit();
1919 fout <<
"rrf_phase ";
1921 fout << std::left <<
fGlobal.GetRRFPhase();
1926 fout <<
"rrf_packing ";
1928 fout << std::left <<
fGlobal.GetRRFPacking();
1933 if ((
fGlobal.GetDataRange(0) != -1) || (
fGlobal.GetDataRange(1) != -1) || (
fGlobal.GetDataRange(2) != -1) || (
fGlobal.GetDataRange(3) != -1)) {
1935 fout << std::left <<
"data";
1936 for (UInt_t j=0; j<4; ++j) {
1937 if (
fGlobal.GetDataRange(j) > 0) {
1939 fout << std::left <<
fGlobal.GetDataRange(j);
1946 if (
fGlobal.GetT0BinSize() > 0) {
1948 fout << std::left <<
"t0";
1949 for (UInt_t j=0; j<
fGlobal.GetT0BinSize(); ++j) {
1952 fout.setf(std::ios::fixed,std::ios::floatfield);
1953 fout << std::left <<
fGlobal.GetT0Bin(j);
1959 for (UInt_t j = 0; j <
fGlobal.GetAddT0BinEntries(); ++j) {
1960 if (
fGlobal.GetAddT0BinSize(j) > 0) {
1962 fout << std::left <<
"addt0";
1963 for (Int_t k=0; k<
fGlobal.GetAddT0BinSize(j); ++k) {
1966 fout.setf(std::ios::fixed,std::ios::floatfield);
1967 fout << std::left <<
fGlobal.GetAddT0Bin(j, k);
1974 if ( (
fGlobal.IsFitRangeInBin() &&
fGlobal.GetFitRangeOffset(0) != -1) ||
1977 fout << std::left <<
"fit";
1978 if (
fGlobal.IsFitRangeInBin()) {
1980 if (
fGlobal.GetFitRangeOffset(0) > 0)
1981 fout <<
"+" <<
fGlobal.GetFitRangeOffset(0);
1983 if (
fGlobal.GetFitRangeOffset(1) > 0)
1984 fout <<
"-" <<
fGlobal.GetFitRangeOffset(1);
1986 for (UInt_t j=0; j<2; j++) {
1987 if (
fGlobal.GetFitRange(j) == -1)
1989 UInt_t neededWidth = 7;
1991 fout.width(neededWidth);
1992 fout.precision(neededPrec);
1993 fout << std::left << std::fixed <<
fGlobal.GetFitRange(j);
2002 if (
fGlobal.GetPacking() != -1) {
2004 fout << std::left <<
"packing";
2005 fout <<
fGlobal.GetPacking() << std::endl;
2008 fout << std::endl << hline.Data() << std::endl;
2012 for (i = 0; i <
fRuns.size(); ++i) {
2014 iter = commentsRUN->find(i + 1);
2015 if (iter != commentsRUN->end()) {
2018 fout <<
"# " << iter->second.Data() << std::endl;
2020 commentsRUN->erase(iter);
2023 fout <<
"RUN " <<
fRuns[i].GetRunName()->Data() <<
" ";
2024 pstr =
fRuns[i].GetBeamline();
2025 if (pstr ==
nullptr) {
2026 std::cerr << std::endl <<
">> PMsrHandler::WriteMsrFile: **ERROR** Couldn't obtain beamline data." << std::endl;
2030 fout << pstr->Data() <<
" ";
2031 pstr =
fRuns[i].GetInstitute();
2032 if (pstr ==
nullptr) {
2033 std::cerr << std::endl <<
">> PMsrHandler::WriteMsrFile: **ERROR** Couldn't obtain institute data." << std::endl;
2037 fout << pstr->Data() <<
" ";
2038 pstr =
fRuns[i].GetFileFormat();
2039 if (pstr ==
nullptr) {
2040 std::cerr << std::endl <<
">> PMsrHandler::WriteMsrFile: **ERROR** Couldn't obtain file format data." << std::endl;
2044 fout << pstr->Data() <<
" (name beamline institute data-file-format)" << std::endl;
2047 for (UInt_t j = 1; j <
fRuns[i].GetRunNameSize(); ++j) {
2048 fout <<
"ADDRUN " <<
fRuns[i].GetRunName(j)->Data() <<
" ";
2049 pstr =
fRuns[i].GetBeamline(j);
2050 if (pstr ==
nullptr) {
2051 std::cerr << std::endl <<
">> PMsrHandler::WriteMsrFile: **ERROR** Couldn't obtain beamline data (addrun)." << std::endl;
2055 fout << pstr->Data() <<
" ";
2056 pstr =
fRuns[i].GetInstitute(j);
2057 if (pstr ==
nullptr) {
2058 std::cerr << std::endl <<
">> PMsrHandler::WriteMsrFile: **ERROR** Couldn't obtain institute data (addrun)." << std::endl;
2062 fout << pstr->Data() <<
" ";
2063 pstr =
fRuns[i].GetFileFormat(j);
2064 if (pstr ==
nullptr) {
2065 std::cerr << std::endl <<
">> PMsrHandler::WriteMsrFile: **ERROR** Couldn't obtain file format data (addrun)." << std::endl;
2069 fout << pstr->Data() <<
" (name beamline institute data-file-format)" << std::endl;
2073 if (
fRuns[i].GetFitType() != -1) {
2075 switch (
fRuns[i].GetFitType()) {
2083 fout << std::left <<
"fittype" <<
MSR_FITTYPE_ASYM <<
" (asymmetry fit)" << std::endl ;
2086 fout << std::left <<
"fittype" <<
MSR_FITTYPE_ASYM_RRF <<
" (asymmetry RRF fit)" << std::endl ;
2092 fout << std::left <<
"fittype" <<
MSR_FITTYPE_BNMR <<
" (beta-NMR fit)" << std::endl ;
2103 if (
fRuns[i].GetAlphaParamNo() != -1) {
2105 fout << std::left <<
"alpha";
2110 fout <<
fRuns[i].GetAlphaParamNo();
2115 if (
fRuns[i].GetBetaParamNo() != -1) {
2117 fout << std::left <<
"beta";
2122 fout <<
fRuns[i].GetBetaParamNo();
2127 if (
fRuns[i].GetNormParamNo() != -1) {
2129 fout << std::left <<
"norm";
2134 fout <<
fRuns[i].GetNormParamNo();
2139 if (
fRuns[i].GetBkgFitParamNo() != -1) {
2141 fout << std::left <<
"backgr.fit";
2142 fout <<
fRuns[i].GetBkgFitParamNo() << std::endl;
2146 if (
fRuns[i].GetLifetimeParamNo() != -1) {
2148 fout << std::left <<
"lifetime";
2149 fout <<
fRuns[i].GetLifetimeParamNo() << std::endl;
2154 fout <<
"lifetimecorrection" << std::endl;
2159 for (UInt_t j=0; j<
fRuns[i].GetMap()->size(); ++j) {
2161 fout << std::right <<
fRuns[i].GetMap(j);
2164 if (
fRuns[i].GetMap()->size() < 10) {
2165 for (UInt_t j=
fRuns[i].GetMap()->size(); j<10; ++j)
2171 if (
fRuns[i].GetForwardHistoNoSize() == 0) {
2172 std::cerr << std::endl <<
">> PMsrHandler::WriteMsrFile: **WARNING** No 'forward' data found!";
2173 std::cerr << std::endl <<
">> Something is VERY fishy, please check your msr-file carfully." << std::endl;
2176 fout << std::left <<
"forward";
2177 for (UInt_t j=0; j<
fRuns[i].GetForwardHistoNoSize(); ++j) {
2179 fout <<
fRuns[i].GetForwardHistoNo(j);
2185 if (
fRuns[i].GetBackwardHistoNoSize() > 0) {
2187 fout << std::left <<
"backward";
2188 for (UInt_t j=0; j<
fRuns[i].GetBackwardHistoNoSize(); ++j) {
2190 fout <<
fRuns[i].GetBackwardHistoNo(j);
2198 fout << std::left <<
"backgr.fix";
2199 for (UInt_t j=0; j<2; ++j) {
2201 fout.precision(prec);
2203 fout << std::left <<
fRuns[i].GetBkgFix(j);
2210 if ((
fRuns[i].GetBkgRange(0) != -1) || (
fRuns[i].GetBkgRange(1) != -1) || (
fRuns[i].GetBkgRange(2) != -1) || (
fRuns[i].GetBkgRange(3) != -1)) {
2212 fout << std::left <<
"background";
2213 for (UInt_t j=0; j<4; ++j) {
2214 if (
fRuns[i].GetBkgRange(j) > 0) {
2216 fout << std::left <<
fRuns[i].GetBkgRange(j);
2223 if ((
fRuns[i].GetDataRange(0) != -1) || (
fRuns[i].GetDataRange(1) != -1) || (
fRuns[i].GetDataRange(2) != -1) || (
fRuns[i].GetDataRange(3) != -1)) {
2225 fout << std::left <<
"data";
2226 for (UInt_t j=0; j<4; ++j) {
2227 if (
fRuns[i].GetDataRange(j) > 0) {
2229 fout << std::left <<
fRuns[i].GetDataRange(j);
2236 if (
fRuns[i].GetT0BinSize() > 0) {
2238 fout << std::left <<
"t0";
2239 for (UInt_t j=0; j<
fRuns[i].GetT0BinSize(); ++j) {
2242 fout.setf(std::ios::fixed,std::ios::floatfield);
2243 fout << std::left <<
fRuns[i].GetT0Bin(j);
2249 if (
fRuns[i].GetAddT0BinEntries() > 0) {
2250 for (UInt_t j = 0; j <
fRuns[i].GetRunNameSize() - 1; ++j) {
2251 if (
fRuns[i].GetAddT0BinSize(j) > 0) {
2253 fout << std::left <<
"addt0";
2254 for (Int_t k=0; k<
fRuns[i].GetAddT0BinSize(j); ++k) {
2257 fout.setf(std::ios::fixed,std::ios::floatfield);
2258 fout << std::left <<
fRuns[i].GetAddT0Bin(j, k);
2266 if (
fRuns[i].GetXDataIndex() != -1) {
2268 fout << std::left <<
"xy-data";
2271 fout << std::left << std::fixed <<
fRuns[i].GetXDataIndex();
2274 fout << std::left << std::fixed <<
fRuns[i].GetYDataIndex();
2276 }
else if (!
fRuns[i].GetXDataLabel()->IsWhitespace()) {
2278 fout << std::left <<
"xy-data";
2280 fout << std::left << std::fixed <<
fRuns[i].GetXDataLabel()->Data();
2283 fout << std::left << std::fixed <<
fRuns[i].GetYDataLabel()->Data();
2288 if ( (
fRuns[i].IsFitRangeInBin() &&
fRuns[i].GetFitRangeOffset(0) != -1) ||
2291 fout << std::left <<
"fit";
2292 if (
fRuns[i].IsFitRangeInBin()) {
2294 if (
fRuns[i].GetFitRangeOffset(0) > 0)
2295 fout <<
"+" <<
fRuns[i].GetFitRangeOffset(0);
2297 if (
fRuns[i].GetFitRangeOffset(1) > 0)
2298 fout <<
"-" <<
fRuns[i].GetFitRangeOffset(1);
2300 for (UInt_t j=0; j<2; j++) {
2301 if (
fRuns[i].GetFitRange(j) == -1)
2303 UInt_t neededWidth = 7;
2305 fout.width(neededWidth);
2306 fout.precision(neededPrec);
2307 fout << std::left << std::fixed <<
fRuns[i].GetFitRange(j);
2316 if (
fRuns[i].GetPacking() != -1) {
2318 fout << std::left <<
"packing";
2319 fout <<
fRuns[i].GetPacking() << std::endl;
2325 if (commentsRUN && !commentsRUN->empty()) {
2326 for(iter = commentsRUN->begin(); iter != commentsRUN->end(); ++iter) {
2327 fout <<
"# " << iter->second.Data() << std::endl;
2330 commentsRUN->clear();
2332 fout << hline.Data() << std::endl;
2335 fout <<
"COMMANDS" << std::endl;
2336 for (i = 0; i <
fCommands.size(); ++i) {
2337 if (
fCommands[i].fLine.BeginsWith(
"SET BATCH") ||
fCommands[i].fLine.BeginsWith(
"END RETURN"))
2340 fout <<
fCommands[i].fLine.Data() << std::endl;
2343 fout << hline.Data() << std::endl;
2346 if (
fFourier.fFourierBlockPresent) {
2347 fout <<
"FOURIER" << std::endl;
2361 fout <<
" # units either 'Gauss', 'Tesla', 'MHz', or 'Mc/s'";
2366 if (
fFourier.fFourierPower != -1) {
2367 fout <<
"fourier_power " <<
fFourier.fFourierPower << std::endl;
2372 fout <<
"apodization ";
2382 fout <<
" # NONE, WEAK, MEDIUM, STRONG";
2394 fout <<
"REAL_AND_IMAG";
2400 fout <<
"PHASE_OPT_REAL";
2402 fout <<
" # REAL, IMAG, REAL_AND_IMAG, POWER, PHASE, PHASE_OPT_REAL";
2407 if (
fFourier.fPhaseParamNo.size() > 0) {
2409 fout <<
"phase " << phaseParamStr << std::endl;
2410 }
else if (
fFourier.fPhase.size() > 0) {
2412 for (UInt_t i=0; i<
fFourier.fPhase.size()-1; i++) {
2413 fout <<
fFourier.fPhase[i] <<
", ";
2419 if ((
fFourier.fRangeForPhaseCorrection[0] != -1.0) || (
fFourier.fRangeForPhaseCorrection[1] != -1.0)) {
2420 fout <<
"range_for_phase_correction " <<
fFourier.fRangeForPhaseCorrection[0] <<
" " <<
fFourier.fRangeForPhaseCorrection[1] << std::endl;
2424 if ((
fFourier.fPlotRange[0] != -1.0) || (
fFourier.fPlotRange[1] != -1.0)) {
2425 fout.setf(std::ios::fixed,std::ios::floatfield);
2429 fout.precision(neededPrec);
2430 fout <<
"range " <<
fFourier.fPlotRange[0] <<
" " <<
fFourier.fPlotRange[1] << std::endl;
2439 fout << hline.Data() << std::endl;
2443 for (i = 0; i <
fPlots.size(); ++i) {
2444 switch (
fPlots[i].fPlotType) {
2446 fout <<
"PLOT " <<
fPlots[i].fPlotType <<
" (single histo plot)" << std::endl;
2449 fout <<
"PLOT " <<
fPlots[i].fPlotType <<
" (single histo RRF plot)" << std::endl;
2452 fout <<
"PLOT " <<
fPlots[i].fPlotType <<
" (asymmetry plot)" << std::endl;
2455 fout <<
"PLOT " <<
fPlots[i].fPlotType <<
" (asymmetry RRF plot)" << std::endl;
2458 fout <<
"PLOT " <<
fPlots[i].fPlotType <<
" (mu minus plot)" << std::endl;
2461 fout <<
"PLOT " <<
fPlots[i].fPlotType <<
" (beta-NMR asymmetry plot)" << std::endl;
2464 fout <<
"PLOT " <<
fPlots[i].fPlotType <<
" (non muSR plot)" << std::endl;
2473 for (UInt_t j=0; j<
fPlots[i].fRuns.size(); ++j) {
2475 fout <<
fPlots[i].fRuns[j];
2480 if ((
fPlots[i].fTmin.size() == 1) && (
fPlots[i].fTmax.size() == 1)) {
2483 fout <<
fPlots[i].fTmin[0] <<
" " <<
fPlots[i].fTmax[0];
2484 }
else if ((
fPlots[i].fTmin.size() > 1) && (
fPlots[i].fTmax.size() > 1)) {
2485 fout <<
"sub_ranges ";
2487 for (UInt_t j=0; j <
fPlots[i].fTmin.size(); ++j) {
2488 fout <<
" " <<
fPlots[i].fTmin[j] <<
" " <<
fPlots[i].fTmax[j];
2491 if (!
fPlots[i].fYmin.empty() && !
fPlots[i].fYmax.empty()) {
2492 fout <<
" " <<
fPlots[i].fYmin[0] <<
" " <<
fPlots[i].fYmax[0];
2497 if (
fPlots[i].fUseFitRanges) {
2498 if (!
fPlots[i].fYmin.empty() && !
fPlots[i].fYmax.empty())
2499 fout <<
"use_fit_ranges " <<
fPlots[i].fYmin[0] <<
" " <<
fPlots[i].fYmax[0] << std::endl;
2501 fout <<
"use_fit_ranges" << std::endl;
2505 if (
fPlots[i].fViewPacking != -1) {
2506 fout <<
"view_packing " <<
fPlots[i].fViewPacking << std::endl;
2511 fout <<
"logx" << std::endl;
2516 fout <<
"logy" << std::endl;
2520 if (
fPlots[i].fLifeTimeCorrection) {
2521 fout <<
"lifetimecorrection" << std::endl;
2525 if (
fPlots[i].fRRFPacking) {
2526 fout <<
"rrf_packing " <<
fPlots[i].fRRFPacking << std::endl;
2530 if (
fPlots[i].fRRFFreq) {
2531 fout <<
"rrf_freq " <<
fPlots[i].fRRFFreq <<
" ";
2532 switch (
fPlots[i].fRRFUnit) {
2555 if (
fPlots[i].fRRFPhaseParamNo > 0) {
2556 fout <<
"rrf_phase par" <<
fPlots[i].fRRFPhaseParamNo << std::endl;
2557 }
else if (
fPlots[i].fRRFPhase) {
2558 fout <<
"rrf_phase " <<
fPlots[i].fRRFPhase << std::endl;
2564 fout << hline.Data() << std::endl;
2569 fout <<
"STATISTIC --- " << dt.AsSQLString() << std::endl;
2576 str +=
", chisq/NDF = ";
2578 fout << str.Data() << std::endl;
2584 str +=
", maxLH/NDF = ";
2586 fout << str.Data() << std::endl;
2589 fout <<
"*** FIT DID NOT CONVERGE ***" << std::endl;
2616 if (idx >=
fParam.size()) {
2619 fLastErrorMsg <<
">> PMsrHandler::SetMsrParamValue(): **ERROR** idx = " << idx <<
" is >= than the number of fit parameters " <<
fParam.size() <<
"\n";
2624 fParam[idx].fValue = value;
2645 if (idx >=
fParam.size()) {
2648 fLastErrorMsg <<
">> PMsrHandler::SetMsrParamValue(): **ERROR** idx = " << idx <<
" is larger than the number of parameters " <<
fParam.size() <<
"\n";
2653 fParam[idx].fStep = value;
2673 if (idx >=
fParam.size()) {
2676 fLastErrorMsg <<
">> PMsrHandler::SetMsrParamPosErrorPresent(): **ERROR** idx = " << idx <<
" is larger than the number of parameters " <<
fParam.size() <<
"\n";
2681 fParam[idx].fPosErrorPresent = value;
2701 if (idx >=
fParam.size()) {
2704 fLastErrorMsg <<
">> PMsrHandler::SetMsrParamPosError(): **ERROR** idx = " << idx <<
" is larger than the number of parameters " <<
fParam.size() <<
"\n";
2709 fParam[idx].fPosErrorPresent =
true;
2710 fParam[idx].fPosError = value;
2727 if (runNo >=
fRuns.size()) {
2730 fLastErrorMsg <<
">> PMsrHandler::SetMsrT0Entry: **ERROR** runNo = " << runNo <<
", is out of valid range 0.." <<
fRuns.size() <<
"\n";
2735 if (idx >=
fRuns[runNo].GetT0BinSize()) {
2736 std::cerr << std::endl <<
">> PMsrHandler::SetMsrT0Entry: **WARNING** idx = " << idx <<
", is out of valid range 0.." <<
fRuns[runNo].GetT0BinSize();
2737 std::cerr << std::endl <<
">> Will add it anyway.";
2738 std::cerr << std::endl;
2741 fRuns[runNo].SetT0Bin(bin, idx);
2757 if (runNo >=
fRuns.size()) {
2760 fLastErrorMsg <<
">> PMsrHandler::SetMsrAddT0Entry: **ERROR** runNo = " << runNo <<
", is out of valid range 0.." <<
fRuns.size() <<
"\n";
2765 if (addRunIdx >=
fRuns[runNo].GetAddT0BinEntries()) {
2766 std::cerr << std::endl <<
">> PMsrHandler::SetMsrAddT0Entry: **WARNING** addRunIdx = " << addRunIdx <<
", is out of valid range 0.." <<
fRuns[runNo].GetAddT0BinEntries();
2767 std::cerr << std::endl <<
">> Will add it anyway.";
2768 std::cerr << std::endl;
2771 if (
static_cast<Int_t
>(histoIdx) >
fRuns[runNo].GetAddT0BinSize(addRunIdx)) {
2772 std::cerr << std::endl <<
">> PMsrHandler::SetMsrAddT0Entry: **WARNING** histoIdx = " << histoIdx <<
", is out of valid range 0.." <<
fRuns[runNo].GetAddT0BinSize(addRunIdx);
2773 std::cerr << std::endl <<
">> Will add it anyway.";
2774 std::cerr << std::endl;
2777 fRuns[runNo].SetAddT0Bin(bin, addRunIdx, histoIdx);
2792 if (runNo >=
fRuns.size()) {
2795 fLastErrorMsg <<
">> PMsrHandler::SetMsrDataRangeEntry: **ERROR** runNo = " << runNo <<
", is out of valid range 0.." <<
fRuns.size() <<
"\n";
2800 fRuns[runNo].SetDataRange(bin, idx);
2815 if (runNo >=
fRuns.size()) {
2818 fLastErrorMsg <<
">> PMsrHandler::SetMsrBkgRangeEntry: **ERROR** runNo = " << runNo <<
", is out of valid range 0.." <<
fRuns.size() <<
"\n";
2823 fRuns[runNo].SetBkgRange(bin, idx);
2844 if (paramNo >=
fParam.size())
2877 Bool_t error =
false;
2879 PMsrLines::iterator iter;
2881 std::vector<std::string> tokens;
2884 iter = lines.begin();
2885 while ((iter != lines.end()) && !error) {
2890 param.
fName = TString(
"");
2903 if ((tokens.size() < 4) || (tokens.size() > 7) || (tokens.size() == 6)) {
2913 param.
fName = tokens[1].c_str();
2926 if (tokens.size() == 4) {
2931 if (tokens.size() == 5) {
2946 if (tokens.size() == 7) {
2996 fLastErrorMsg <<
">> PMsrHandler::HandleFitParameterEntry: **ERROR** in line " << iter->fLineNo <<
":\n";
2998 fLastErrorMsg <<
">> A Fit Parameter line needs to have the following form:\n";
3000 fLastErrorMsg <<
">> No Name Value Step/Error [Lower_Boundary Upper_Boundary]\n\n";
3002 fLastErrorMsg <<
">> No Name Value Step/Neg_Error Pos_Error [Lower_Boundary Upper_Boundary]\n\n";
3003 fLastErrorMsg <<
">> No: the parameter number (an Int_t)\n";
3004 fLastErrorMsg <<
">> Name: the name of the parameter (less than 256 character)\n";
3005 fLastErrorMsg <<
">> Value: the starting value of the parameter (a Double_t)\n";
3007 fLastErrorMsg <<
">> Step/Neg_Error: the starting step value in a fit (a Double_t), or\n";
3008 fLastErrorMsg <<
">> the symmetric error (MIGRAD, SIMPLEX), or\n";
3010 fLastErrorMsg <<
">> Pos_Error: the positive error (MINOS), (a Double_t or \"none\")\n";
3011 fLastErrorMsg <<
">> Lower_Boundary: the lower boundary allowed for the fit parameter (a Double_t or \"none\")\n";
3012 fLastErrorMsg <<
">> Upper_Boundary: the upper boundary allowed for the fit parameter (a Double_t or \"none\")\n";
3022 for (UInt_t i=0; i<
fParam.size(); i++) {
3023 if (
fParam[i].fNo !=
static_cast<Int_t
>(i)+1) {
3027 fLastErrorMsg <<
">> PMsrHandler::HandleFitParameterEntry: **ERROR**\n";
3028 fLastErrorMsg <<
">> Sorry, you are assuming to much from this program, it cannot\n";
3029 fLastErrorMsg <<
">> handle none subsequent numbered parameters yet or in the near future.\n";
3031 fLastErrorMsg <<
">> parameter number " <<
fParam[i].fNo <<
", at paramter position " << i+1 <<
".\n";
3094 if ((
fFuncHandler->GetNoOfFuncs() == 0) && !lines.empty()) {
3095 std::cerr << std::endl <<
">> PMsrHandler::HandleFunctionsEntry: **WARNING** empty FUNCTIONS block found!";
3096 std::cerr << std::endl;
3116 PMsrLines::iterator iter;
3119 Bool_t error =
false;
3122 std::vector<std::string> tokens;
3124 Double_t dval = 0.0;
3125 UInt_t addT0Counter = 0;
3130 iter = lines.begin();
3131 while ((iter != lines.end()) && !error) {
3134 Ssiz_t idx = str.Index(
"#");
3141 if (iter->fLine.BeginsWith(
"fittype", TString::kIgnoreCase)) {
3142 if (tokens.size() < 2) {
3159 }
else if (iter->fLine.BeginsWith(
"rrf_freq", TString::kIgnoreCase)) {
3160 if (tokens.size() < 3) {
3165 if (!ok || dval <= 0.0)
3173 }
else if (iter->fLine.BeginsWith(
"rrf_packing", TString::kIgnoreCase)) {
3174 if (tokens.size() < 2) {
3179 if (ok && ival > 0) {
3185 }
else if (iter->fLine.BeginsWith(
"rrf_phase", TString::kIgnoreCase)) {
3186 if (tokens.size() < 2) {
3196 }
else if (iter->fLine.BeginsWith(
"data", TString::kIgnoreCase)) {
3197 if (tokens.size() < 3) {
3200 for (UInt_t i=1; i<tokens.size(); i++) {
3203 if (ok && ival >= 0) {
3210 }
else if (iter->fLine.BeginsWith(
"t0", TString::kIgnoreCase)) {
3211 if (tokens.size() < 2) {
3214 for (UInt_t i=1; i<tokens.size(); i++) {
3217 if (ok && dval >= 0.0)
3223 }
else if (iter->fLine.BeginsWith(
"addt0", TString::kIgnoreCase)) {
3224 if (tokens.size() < 2) {
3227 for (UInt_t i=1; i<tokens.size(); i++) {
3230 if (ok && dval >= 0.0)
3237 }
else if (iter->fLine.BeginsWith(
"fit", TString::kIgnoreCase)) {
3238 if (tokens.size() < 3) {
3241 if (iter->fLine.Contains(
"fgb", TString::kIgnoreCase)) {
3243 std::string numStr = tokens[1];
3244 std::string::size_type pos = numStr.find(
'+');
3245 if (pos != std::string::npos) {
3246 numStr = numStr.substr(pos+1);
3257 pos = numStr.find(
'-');
3258 if (pos != std::string::npos) {
3259 numStr = numStr.substr(pos+1);
3271 for (UInt_t i=1; i<3; i++) {
3281 }
else if (iter->fLine.BeginsWith(
"packing", TString::kIgnoreCase)) {
3282 if (tokens.size() < 2) {
3287 if (ok && ival >= 0) {
3293 }
else if (iter->fLine.BeginsWith(
"deadtime-cor", TString::kIgnoreCase)) {
3294 if (tokens.size() < 2) {
3314 fLastErrorMsg <<
">> PMsrHandler::HandleGlobalEntry: **ERROR** in line " << iter->fLineNo <<
":\n";
3316 fLastErrorMsg <<
">> GLOBAL block syntax is too complex to print it here. Please check the manual.\n";
3339 PMsrLines::iterator iter;
3341 Bool_t first =
true;
3342 Bool_t error =
false;
3343 Bool_t runLinePresent =
false;
3346 std::vector<std::string> tokens;
3348 UInt_t addT0Counter = 0;
3353 iter = lines.begin();
3354 while ((iter != lines.end()) && !error) {
3357 Ssiz_t idx = str.Index(
"#");
3360 idx = str.Index(
"(");
3370 line.Remove(TString::kLeading,
' ');
3373 if (line.BeginsWith(
"run", TString::kIgnoreCase)) {
3375 runLinePresent =
true;
3378 fRuns.push_back(param);
3386 if (tokens.size() < 5) {
3390 std::string runName(
"");
3391 for (UInt_t i=1; i<tokens.size()-3; i++) {
3392 runName += tokens[i];
3393 if (i<tokens.size()-4)
3396 str = runName.c_str();
3399 str = tokens[tokens.size()-3].c_str();
3402 str = tokens[tokens.size()-2].c_str();
3405 str = tokens[tokens.size()-1].c_str();
3413 if (line.BeginsWith(
"addrun", TString::kIgnoreCase)) {
3415 if (!runLinePresent) {
3418 fLastErrorMsg <<
">> PMsrHandler::HandleRunEntry: **ERROR** Found ADDRUN without prior RUN, or\n";
3419 fLastErrorMsg <<
">> ADDRUN lines intercepted by other stuff. All this is not allowed!\n";
3420 fLastErrorMsg <<
">> error in line " << iter->fLineNo <<
"\n";
3427 if (tokens.size() < 5) {
3431 str = tokens[1].c_str();
3434 str = tokens[2].c_str();
3437 str = tokens[3].c_str();
3440 str = tokens[4].c_str();
3446 if (line.BeginsWith(
"fittype", TString::kIgnoreCase)) {
3448 runLinePresent =
false;
3450 if (tokens.size() < 2) {
3470 if (line.BeginsWith(
"alpha", TString::kIgnoreCase)) {
3472 runLinePresent =
false;
3474 if (tokens.size() < 2) {
3484 }
else if (tokens[1].find(
"fun") != std::string::npos) {
3497 if (line.BeginsWith(
"beta", TString::kIgnoreCase)) {
3499 runLinePresent =
false;
3501 if (tokens.size() < 2) {
3511 }
else if (tokens[1].find(
"fun") != std::string::npos) {
3524 if (line.BeginsWith(
"norm", TString::kIgnoreCase)) {
3526 runLinePresent =
false;
3528 if (tokens.size() < 2) {
3535 }
else if (tokens[1].find(
"fun") != std::string::npos) {
3548 if (line.BeginsWith(
"backgr.fit", TString::kIgnoreCase)) {
3550 runLinePresent =
false;
3552 if (tokens.size() < 2) {
3565 if (line.BeginsWith(
"lifetime ", TString::kIgnoreCase)) {
3567 runLinePresent =
false;
3569 if (tokens.size() < 2) {
3582 if (line.BeginsWith(
"lifetimecorrection", TString::kIgnoreCase)) {
3584 runLinePresent =
false;
3590 if (line.BeginsWith(
"map", TString::kIgnoreCase)) {
3592 runLinePresent =
false;
3594 for (UInt_t i=1; i<tokens.size(); i++) {
3597 if (ok && ival >= 0)
3604 for (UInt_t i=0; i<param.
GetMap()->size(); i++) {
3605 if ((param.
GetMap(i) < 0) || (param.
GetMap(i) >
static_cast<Int_t
>(
fParam.size()))) {
3608 fLastErrorMsg <<
">> PMsrHandler::HandleRunEntry: **SEVERE ERROR** map value " << param.
GetMap(i) <<
" in line " << iter->fLineNo <<
" is out of range!\n";
3618 if (line.BeginsWith(
"forward", TString::kIgnoreCase)) {
3620 runLinePresent =
false;
3622 if (tokens.size() < 2) {
3627 std::unique_ptr<PStringNumberList> rl = std::make_unique<PStringNumberList>(str.Data());
3628 std::string errorMsg(
"");
3629 if (rl->Parse(errorMsg,
true)) {
3630 group = rl->GetList();
3631 for (UInt_t i=0; i<group.size(); i++) {
3642 if (line.BeginsWith(
"backward", TString::kIgnoreCase)) {
3644 runLinePresent =
false;
3646 if (tokens.size() < 2) {
3651 std::unique_ptr<PStringNumberList> rl = std::make_unique<PStringNumberList>(str.Data());
3652 std::string errorMsg(
"");
3653 if (rl->Parse(errorMsg,
true)) {
3654 group = rl->GetList();
3655 for (UInt_t i=0; i<group.size(); i++) {
3666 if (line.BeginsWith(
"backgr.fix", TString::kIgnoreCase)) {
3668 runLinePresent =
false;
3670 if (tokens.size() < 2) {
3673 for (UInt_t i=1; i<tokens.size(); i++) {
3685 if (line.BeginsWith(
"background", TString::kIgnoreCase)) {
3687 runLinePresent =
false;
3689 if ((tokens.size() < 3) || (tokens.size() % 2 != 1)) {
3692 for (UInt_t i=1; i<tokens.size(); i++) {
3704 if (line.BeginsWith(
"data", TString::kIgnoreCase)) {
3706 runLinePresent =
false;
3708 if ((tokens.size() < 3) || (tokens.size() % 2 != 1)) {
3711 for (UInt_t i=1; i<tokens.size(); i++) {
3723 if (line.BeginsWith(
"t0", TString::kIgnoreCase)) {
3725 runLinePresent =
false;
3727 if (tokens.size() < 2) {
3730 for (UInt_t i=1; i<tokens.size(); i++) {
3733 if (ok && dval >= 0.0)
3742 if (line.BeginsWith(
"addt0", TString::kIgnoreCase)) {
3744 runLinePresent =
false;
3746 if (tokens.size() < 2) {
3749 for (UInt_t i=1; i<tokens.size(); i++) {
3752 if (ok && dval >= 0.0)
3763 if (line.BeginsWith(
"fit ", TString::kIgnoreCase)) {
3765 runLinePresent =
false;
3767 if (tokens.size() < 3) {
3770 if (iter->fLine.Contains(
"fgb", TString::kIgnoreCase)) {
3772 std::string numStr = tokens[1];
3773 std::string::size_type pos = numStr.find(
'+');
3774 if (pos != std::string::npos) {
3775 numStr = numStr.substr(pos+1);
3786 pos = numStr.find(
'-');
3787 if (pos != std::string::npos) {
3788 numStr = numStr.substr(pos+1);
3801 for (UInt_t i=1; i<3; i++) {
3814 if (line.BeginsWith(
"packing", TString::kIgnoreCase)) {
3816 runLinePresent =
false;
3818 if (tokens.size() != 2) {
3831 if (iter->fLine.BeginsWith(
"deadtime-cor", TString::kIgnoreCase)) {
3833 runLinePresent =
false;
3835 if (tokens.size() < 2) {
3850 if (line.BeginsWith(
"xy-data", TString::kIgnoreCase)) {
3852 runLinePresent =
false;
3854 if (tokens.size() != 3) {
3869 str = tokens[1].c_str();
3871 str = tokens[2].c_str();
3884 fLastErrorMsg <<
">> PMsrHandler::HandleRunEntry: **ERROR** in line " << iter->fLineNo <<
":\n";
3886 fLastErrorMsg <<
">> RUN block syntax is too complex to print it here. Please check the manual.\n";
3889 fRuns.push_back(param);
3916 Int_t found, no_found=-1;
3919 Char_t *cstr, filterStr[32];
3920 cstr =
new Char_t[str.Sizeof()];
3921 strncpy(cstr, str.Data(), str.Sizeof());
3922 snprintf(filterStr,
sizeof(filterStr),
"%s%%d", filter);
3925 found = sscanf(cstr, filterStr, &no_found);
3927 if (no_found < 1000)
3928 no = no_found + offset;
3936 if ((no_found < 0) || (no_found > 1000))
3959 PMsrLines::iterator iter;
3961 if (lines.empty()) {
3962 std::cerr << std::endl <<
">> PMsrHandler::HandleCommandsEntry(): **WARNING**: There is no COMMAND block! Do you really want this?";
3963 std::cerr << std::endl;
3966 for (iter = lines.begin(); iter != lines.end(); ++iter) {
3967 if (!iter->fLine.BeginsWith(
"COMMANDS"))
3993 for (UInt_t i=0; i<2; i++) {
4012 Ssiz_t idx = str.First(
'#');
4016 truncStr.Resize(idx-1);
4036 Bool_t result =
true;
4041 if (tok.size() < 2) {
4047 for (UInt_t i=1; i<tok.size(); i++) {
4051 fourier.
fPhase.push_back(phase);
4057 fLastErrorMsg <<
">> PMsrHandler::ParseFourierPhaseValueVector: **ERROR** in Fourier phase line.\n";
4058 fLastErrorMsg <<
">> Attempt to mix val, parX? This is currently not supported.\n\n";
4087 Bool_t result =
true;
4093 if (tok.size() < 2) {
4099 for (UInt_t i=1; i<tok.size(); i++) {
4100 if (tok[i].rfind(
"par", 0) != 0) {
4103 fLastErrorMsg <<
">> PMsrHandler::ParseFourierPhaseParVector: **ERROR** found unhandable token '" << tok[i] <<
"'\n";
4110 if (tok[i].rfind(
"parR", 0) == 0) {
4115 if (tok[i].rfind(
"par(", 0) == 0) {
4124 fLastErrorMsg <<
">> PMsrHandler::ParseFourierPhaseParVector: **ERROR** found multiple parR's! Only one reference phase is accepted.\n";
4131 if (result !=
false) {
4132 for (UInt_t i=1; i<tok.size(); i++) {
4133 std::string sstr = tok[i];
4135 if (sstr.rfind(
"parR", 0) == 0) {
4138 sstr = sstr.substr(rmNoOf);
4148 fLastErrorMsg <<
">> PMsrHandler::ParseFourierPhaseParVector: **ERROR** found token '" << tok[i] <<
"' which is not parX with X an integer.\n";
4186 wstr = wstr.Strip(TString::kLeading,
' ');
4189 if (!wstr.BeginsWith(
"par(") && !wstr.BeginsWith(
"parR(")) {
4192 fLastErrorMsg <<
">> PMsrHandler::ParseFourierPhaseParIterVector: **ERROR** token should start with 'par(' or 'parR(', found: '" << wstr <<
"' -> ERROR\n";
4198 Bool_t relativePhase =
false;
4199 if (wstr.BeginsWith(
"parR(")) {
4201 relativePhase =
true;
4203 wstr.Remove(0, noOf);
4206 wstr = wstr.Strip(TString::kTrailing,
' ');
4209 Ssiz_t idx=wstr.Last(
')');
4210 wstr.Remove(idx, wstr.Length()-idx);
4216 if (tok.size() != 3) {
4219 fLastErrorMsg <<
">> PMsrHandler::ParseFourierPhaseParIterVector: **ERROR** wrong syntax for the expected par(X0, offset, #param).\n";
4225 Int_t x0, offset, noParam;
4233 fLastErrorMsg <<
">> PMsrHandler::ParseFourierPhaseParIterVector: **ERROR** X0='" << tok[0] <<
"' is not an integer.\n";
4244 fLastErrorMsg <<
">> PMsrHandler::ParseFourierPhaseParIterVector: **ERROR** offset='" << tok[1] <<
"' is not an integer.\n";
4255 fLastErrorMsg <<
">> PMsrHandler::ParseFourierPhaseParIterVector: **ERROR** #Param='" << tok[2] <<
"' is not an integer.\n";
4267 for (Int_t i=0; i<noParam; i++)
4287 Bool_t error =
false;
4298 PMsrLines::iterator iter;
4300 std::vector<std::string> tokens;
4301 TString pcStr=TString(
"");
4305 iter = lines.begin();
4306 while ((iter != lines.end()) && !error) {
4310 if (iter->fLine.BeginsWith(
"units", TString::kIgnoreCase)) {
4311 if (tokens.size() < 2) {
4328 }
else if (iter->fLine.BeginsWith(
"fourier_power", TString::kIgnoreCase)) {
4329 if (tokens.size() < 2) {
4335 if (ok && (ival >= 0) && (ival <= 20)) {
4342 }
else if (iter->fLine.BeginsWith(
"dc-corrected", TString::kIgnoreCase)) {
4343 if (tokens.size() < 2) {
4356 }
else if (iter->fLine.BeginsWith(
"apodization", TString::kIgnoreCase)) {
4357 if (tokens.size() < 2) {
4374 }
else if (iter->fLine.BeginsWith(
"plot", TString::kIgnoreCase)) {
4375 if (tokens.size() < 2) {
4396 }
else if (iter->fLine.BeginsWith(
"phase", TString::kIgnoreCase)) {
4397 if (tokens.size() < 2) {
4427 if (!result || error) {
4437 fLastErrorMsg <<
">> PMsrHandler::HandleFourierEntry: found Fourier parameter entry par" << fourier.
fPhaseParamNo[i] <<
" > #Param = " <<
fParam.size() <<
"\n";
4447 Double_t phaseRef = 0.0;
4462 }
else if (iter->fLine.BeginsWith(
"range_for_phase_correction", TString::kIgnoreCase)) {
4466 pcStr = iter->fLine;
4467 }
else if (iter->fLine.BeginsWith(
"range", TString::kIgnoreCase)) {
4468 if (tokens.size() < 3) {
4472 for (UInt_t i=0; i<2; i++) {
4481 }
else if (!iter->fLine.BeginsWith(
"fourier", TString::kIgnoreCase) && !iter->fLine.BeginsWith(
"#") &&
4482 !iter->fLine.IsWhitespace() && (iter->fLine.Length() != 0)) {
4491 if ((pcStr.Length() != 0) && !error) {
4495 switch (tokens.size()) {
4505 for (UInt_t i=0; i<2; i++) {
4521 fLastErrorMsg <<
">> PMsrHandler::HandleFourierEntry: **ERROR** in line " << iter->fLineNo <<
":\n\n";
4523 fLastErrorMsg <<
">> FOURIER block syntax, parameters in [] are optinal:\n\n";
4526 fLastErrorMsg <<
">> [fourier_power n # n is a number such that zero padding up to 2^n will be used]\n";
4530 fLastErrorMsg <<
">> [apodization none | weak | medium | strong]\n";
4531 fLastErrorMsg <<
">> [plot real | imag | real_and_imag | power | phase | phase_opt_real]\n";
4532 fLastErrorMsg <<
">> [phase valList | parList | parIterList [# comment]]\n";
4533 fLastErrorMsg <<
">> valList : val [sep val ... sep val]. sep=' ,;\\t'\n";
4534 fLastErrorMsg <<
">> parList : parX0 [sep parX1 ... sep parXn], Xi is the parameter number\n";
4535 fLastErrorMsg <<
">> parList : parRX0 sep parX1 ... sep parXn, parRX0 is the reference phase, e.g. parR3\n";
4536 fLastErrorMsg <<
">> parIterList : par(X0,offset,#param), with X0=first parameter number\n";
4537 fLastErrorMsg <<
">> offset=parameter offset, #param=number of phase parameters.\n";
4538 fLastErrorMsg <<
">> [range_for_phase_correction min max | all]\n";
4562 Bool_t error =
false;
4566 PMsrLines::iterator iter1;
4567 PMsrLines::iterator iter2;
4568 std::vector<std::string> tokens;
4570 if (lines.empty()) {
4571 std::cerr << std::endl <<
">> PMsrHandler::HandlePlotEntry(): **WARNING**: There is no PLOT block! Do you really want this?";
4572 std::cerr << std::endl;
4575 iter1 = lines.begin();
4576 while ((iter1 != lines.end()) && !error) {
4582 param.
fLogX =
false;
4583 param.
fLogY =
false;
4585 param.
fRuns.clear();
4586 param.
fTmin.clear();
4587 param.
fTmax.clear();
4588 param.
fYmin.clear();
4589 param.
fYmax.clear();
4599 for ( ; iter2 != lines.end(); ++iter2) {
4600 if (iter2->fLine.Contains(
"PLOT"))
4605 while ((iter1 != iter2) && !error) {
4606 TString line = iter1->fLine;
4607 if (line.First(
'#') != -1)
4608 line.Resize(line.First(
'#'));
4610 if (line.Contains(
"PLOT")) {
4612 if (tokens.size() < 2) {
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)) {
4642 fLastErrorMsg <<
">> PMsrHandler::HandlePlotEntry: **SEVERE ERROR** Couldn't tokenize PLOT in line " << iter1->fLineNo <<
"\n";
4647 runList = rl->GetList();
4648 for (UInt_t i=0; i<runList.size(); i++) {
4649 run = TComplex(runList[i], -1.0);
4650 param.
fRuns.push_back(run);
4659 }
else if (line.Contains(
"range ", TString::kIgnoreCase)) {
4661 param.
fTmin.clear();
4662 param.
fTmax.clear();
4663 param.
fYmin.clear();
4664 param.
fYmax.clear();
4667 if ((tokens.size() != 3) && (tokens.size() != 5)) {
4675 param.
fTmin.push_back(tmin);
4682 param.
fTmax.push_back(tmax);
4686 if (tokens.size() == 5) {
4691 param.
fYmin.push_back(ymin);
4698 param.
fYmax.push_back(ymax);
4703 }
else if (line.Contains(
"sub_ranges", TString::kIgnoreCase)) {
4705 param.
fTmin.clear();
4706 param.
fTmax.clear();
4707 param.
fYmin.clear();
4708 param.
fYmax.clear();
4711 if ((tokens.size() != 2*param.
fRuns.size() + 1) && (tokens.size() != 2*param.
fRuns.size() + 3)) {
4715 for (UInt_t i=0; i<param.
fRuns.size(); i++) {
4721 param.
fTmin.push_back(tmin);
4728 param.
fTmax.push_back(tmax);
4734 if (tokens.size() == 2*param.
fRuns.size() + 3) {
4740 param.
fYmin.push_back(ymin);
4747 param.
fYmax.push_back(ymax);
4752 }
else if (line.Contains(
"use_fit_ranges", TString::kIgnoreCase)) {
4758 if (tokens.size() == 3) {
4763 param.
fYmin.push_back(ymin);
4770 param.
fYmax.push_back(ymax);
4775 if ((tokens.size() != 1) && (tokens.size() != 3)) {
4776 std::cerr << std::endl <<
">> PMsrHandler::HandlePlotEntry: **WARNING** use_fit_ranges with undefined additional parameters in line " << iter1->fLineNo;
4777 std::cerr << std::endl <<
">> Will ignore this PLOT block command line, sorry.";
4778 std::cerr << std::endl <<
">> Proper syntax: use_fit_ranges [ymin ymax]";
4779 std::cerr << std::endl <<
">> Found: '" << iter1->fLine.Data() <<
"'" << std::endl;
4781 }
else if (iter1->fLine.Contains(
"logx", TString::kIgnoreCase)) {
4783 }
else if (iter1->fLine.Contains(
"logy", TString::kIgnoreCase)) {
4785 }
else if (iter1->fLine.Contains(
"lifetimecorrection", TString::kIgnoreCase)) {
4787 }
else if (iter1->fLine.Contains(
"view_packing", TString::kIgnoreCase)) {
4789 if (tokens.size() != 2) {
4799 }
else if (iter1->fLine.Contains(
"rrf_freq", TString::kIgnoreCase)) {
4803 if (tokens.size() != 3) {
4825 }
else if (iter1->fLine.Contains(
"rrf_phase", TString::kIgnoreCase)) {
4829 if (tokens.size() != 2) {
4841 if (
static_cast<Int_t
>(
fParam.size()) < no) {
4854 }
else if (iter1->fLine.Contains(
"rrf_packing", TString::kIgnoreCase)) {
4857 if (tokens.size() != 2) {
4877 if (param.
fRuns.empty()) {
4880 if ((param.
fTmin.size() > 0) || (param.
fTmax.size() > 0)) {
4881 for (UInt_t i=0; i<param.
fTmin.size(); i++) {
4883 keep = param.
fTmin[i];
4885 param.
fTmax[i] = keep;
4890 if ((param.
fYmin.size() > 0) || (param.
fYmax.size() > 0)) {
4891 for (UInt_t i=0; i<param.
fYmin.size(); i++) {
4893 keep = param.
fYmin[i];
4895 param.
fYmax[i] = keep;
4903 std::cerr << std::endl <<
">> PMsrHandler::HandlePlotEntry(): **ERROR** found RRF frequency but no required RRF packing.";
4904 std::cerr << std::endl <<
">> Will ignore the RRF option.";
4905 std::cerr << std::endl;
4911 for (UInt_t i=0; i<param.
fRuns.size(); i++) {
4912 if (param.
fRuns[i] >
static_cast<Int_t
>(
fRuns.size())) {
4913 std::cerr << std::endl <<
">> PMsrHandler::HandlePlotEntry(): **WARNING** found plot run number " << param.
fRuns[i] <<
".";
4914 std::cerr << std::endl <<
">> There are only " <<
fRuns.size() <<
" runs present, will ignore this run.";
4915 std::cerr << std::endl;
4919 if (param.
fRuns[i] == 0) {
4920 std::cerr << std::endl <<
">> PMsrHandler::HandlePlotEntry(): **WARNING** found plot run number 0.";
4921 std::cerr << std::endl <<
">> Pot number needs to be > 0. Will ignore this entry.";
4922 std::cerr << std::endl;
4928 if (param.
fRuns.size() > 0) {
4931 std::cerr << std::endl <<
">> PMsrHandler::HandlePlotEntry: **ERROR** no valid PLOT block entries, will ignore the entire PLOT block.";
4932 std::cerr << std::endl;
4937 if (
fPlots.size() == 0) {
4939 std::cerr << std::endl <<
">> PMsrHandler::HandlePlotEntry: **ERROR** no valid PLOT block at all present. Fix this first!";
4940 std::cerr << std::endl;
4945 std::cerr << std::endl <<
">> PMsrHandler::HandlePlotEntry: **ERROR** in line " << iter1->fLineNo <<
": " << iter1->fLine.Data();
4946 std::cerr << std::endl <<
">> A PLOT block needs to have the following structure:";
4947 std::cerr << std::endl;
4948 std::cerr << std::endl <<
">> PLOT <plot_type>";
4949 std::cerr << std::endl <<
">> runs <run_list>";
4950 std::cerr << std::endl <<
">> [range tmin tmax [ymin ymax]]";
4951 std::cerr << std::endl <<
">> [sub_ranges tmin1 tmax1 tmin2 tmax2 ... tminN tmaxN [ymin ymax]";
4952 std::cerr << std::endl <<
">> [logx | logy]";
4953 std::cerr << std::endl <<
">> [use_fit_ranges [ymin ymax]]";
4954 std::cerr << std::endl <<
">> [view_packing n]";
4955 std::cerr << std::endl;
4956 std::cerr << std::endl <<
">> where <plot_type> is: 0=single histo,";
4957 std::cerr << std::endl <<
">> 1=RRF single histo,";
4958 std::cerr << std::endl <<
">> 2=forward-backward asym,";
4959 std::cerr << std::endl <<
">> 3=forward-backward RRF asym,";
4960 std::cerr << std::endl <<
">> 4=mu minus single histo,";
4961 std::cerr << std::endl <<
">> 5=forward-backward beta-NMR asym,";
4962 std::cerr << std::endl <<
">> 8=non muSR.";
4963 std::cerr << std::endl <<
">> <run_list> is the list of runs, e.g. runs 1 3";
4964 std::cerr << std::endl <<
">> range is optional";
4965 std::cerr << std::endl <<
">> sub_ranges (if present) will plot the N given runs each on its own sub-range";
4966 std::cerr << std::endl <<
">> logx, logy (if present) will present the x-, y-axis in log-scale";
4967 std::cerr << std::endl <<
">> use_fit_ranges (if present) will plot each run on its fit-range";
4968 std::cerr << std::endl <<
">> view_packing n (if present) will bin all data by n (> 0) rather than the binning of the fit";
4969 std::cerr << std::endl;
4972 param.
fRuns.clear();
4997 if (lines.empty()) {
4998 std::cerr << std::endl <<
">> PMsrHandler::HandleStatisticEntry: **WARNING** There is no STATISTIC block! Do you really want this?";
4999 std::cerr << std::endl;
5011 for (UInt_t i=0; i<lines.size(); i++) {
5013 tstr = lines[i].fLine;
5014 tstr.Remove(TString::kLeading,
' ');
5015 if (tstr.Length() > 0) {
5016 if (!tstr.BeginsWith(
"#") && !tstr.BeginsWith(
"STATISTIC") && !tstr.BeginsWith(
"chisq") &&
5017 !tstr.BeginsWith(
"maxLH") && !tstr.BeginsWith(
"*** FIT DID NOT CONVERGE ***") &&
5018 !tstr.BeginsWith(
"expected chisq") && !tstr.BeginsWith(
"expected maxLH") &&
5019 !tstr.BeginsWith(
"run block")) {
5020 std::cerr << std::endl <<
">> PMsrHandler::HandleStatisticEntry: **SYNTAX ERROR** in line " << lines[i].fLineNo;
5021 std::cerr << std::endl <<
">> '" << lines[i].fLine.Data() <<
"'";
5022 std::cerr << std::endl <<
">> not a valid STATISTIC block line";
5023 std::cerr << std::endl <<
">> If you do not understand this, just remove the STATISTIC block, musrfit will recreate after fitting";
5024 std::cerr << std::endl << std::endl;
5031 if (lines[i].fLine.Contains(
"STATISTIC")) {
5032 status = sscanf(lines[i].fLine.Data(),
"STATISTIC --- %s%s", date, time);
5034 fStatistic.fDate = TString(date)+TString(
", ")+TString(time);
5036 fStatistic.fDate = TString(
"\?\?\?\?-\?\?-\?\?, \?\?:\?\?:\?\?");
5040 if (lines[i].fLine.Contains(
"chisq =")) {
5041 if (lines[i].fLine.Contains(
"expected")) {
5042 strncpy(str, lines[i].fLine.Data(),
sizeof(str));
5043 status = sscanf(str+lines[i].fLine.Index(
"chisq = ")+8,
"%lf", &dval);
5051 strncpy(str, lines[i].fLine.Data(),
sizeof(str));
5052 status = sscanf(str+lines[i].fLine.Index(
"chisq = ")+8,
"%lf", &dval);
5061 if (lines[i].fLine.Contains(
"maxLH =")) {
5063 strncpy(str, lines[i].fLine.Data(),
sizeof(str));
5064 status = sscanf(str+lines[i].fLine.Index(
"maxLH = ")+8,
"%lf", &dval);
5072 if (lines[i].fLine.Contains(
", NDF =")) {
5073 strncpy(str, lines[i].fLine.Data(),
sizeof(str));
5074 status = sscanf(str+lines[i].fLine.Index(
", NDF = ")+8,
"%u", &ival);
5099 UInt_t noOfFitParameters = 0;
5103 std::vector<std::string> tokens;
5109 if (idx >=
fRuns.size()) {
5110 std::cerr << std::endl <<
">> PMsrHandler::GetNoOfFitParameters() **ERROR** idx=" << idx <<
", out of range fRuns.size()=" <<
fRuns.size();
5111 std::cerr << std::endl;
5116 if (
fRuns[idx].GetNormParamNo() != -1) {
5118 paramVector.push_back(
fRuns[idx].GetNormParamNo());
5124 if (
fRuns[idx].GetBkgFitParamNo() != -1)
5125 paramVector.push_back(
fRuns[idx].GetBkgFitParamNo());
5128 if (
fRuns[idx].GetAlphaParamNo() != -1) {
5130 paramVector.push_back(
fRuns[idx].GetAlphaParamNo());
5136 if (
fRuns[idx].GetBetaParamNo() != -1) {
5138 paramVector.push_back(
fRuns[idx].GetBetaParamNo());
5145 for (UInt_t i=0; i<
fTheory.size(); i++) {
5148 pos = str.Index(
'#');
5154 for (UInt_t j=0; j<tokens.size(); j++) {
5158 paramVector.push_back(dval);
5162 if (tokens[j].find(
"map") != std::string::npos) {
5163 status = sscanf(tokens[j].c_str(),
"map%d", &dval);
5165 mapVector.push_back(dval);
5170 if (tokens[j].find(
"fun") != std::string::npos) {
5171 status = sscanf(tokens[j].c_str(),
"fun%d", &dval);
5173 funVector.push_back(dval);
5180 for (UInt_t i=0; i<funVector.size(); i++) {
5185 if (dval == funVector[i])
5192 std::cerr << std::endl <<
">> PMsrHandler::GetNoOfFitParameters() **ERROR** couldn't find fun" << funVector[i];
5193 std::cerr << std::endl << std::endl;
5198 paramVector.clear();
5205 pos = str.Index(
'#');
5213 for (UInt_t j=0; j<tokens.size(); j++) {
5216 if (tokens[j].rfind(
"par", 0) == 0) {
5217 status = sscanf(tokens[j].c_str(),
"par%d", &dval);
5219 paramVector.push_back(dval);
5223 if (tokens[j].rfind(
"map", 0) == 0) {
5224 status = sscanf(tokens[j].c_str(),
"map%d", &dval);
5226 mapVector.push_back(dval);
5232 for (UInt_t i=0; i<mapVector.size(); i++) {
5233 paramVector.push_back(
fRuns[idx].GetMap(mapVector[i]-1));
5238 param.push_back(paramVector[0]);
5239 for (UInt_t i=0; i<paramVector.size(); i++) {
5240 for (k=0; k<param.size(); k++) {
5241 if (param[k] == paramVector[i])
5244 if (k == param.size())
5245 param.push_back(paramVector[i]);
5249 for (UInt_t i=0; i<param.size(); i++) {
5250 if (
fParam[param[i]-1].fStep != 0.0)
5251 noOfFitParameters++;
5258 paramVector.clear();
5260 return noOfFitParameters;
5278 PMsrLines::iterator iter;
5279 std::vector<std::string> tokens;
5284 for (UInt_t i=0; i<
fParam.size(); i++)
5288 for (iter = theory.begin(); iter != theory.end(); ++iter) {
5291 if (str.First(
'#') != -1)
5292 str.Resize(str.First(
'#'));
5301 for (UInt_t i=0; i<tokens.size(); i++) {
5304 if ((ival > 0) && (ival <
static_cast<Int_t
>(
fParam.size())+1)) {
5307 }
else if (tokens[i].find(
"map") != std::string::npos) {
5310 }
else if (tokens[i].find(
"fun") != std::string::npos) {
5318 for (iter = funcs.begin(); iter != funcs.end(); ++iter) {
5321 if (str.First(
'#') != -1)
5322 str.Resize(str.First(
'#'));
5338 for (UInt_t i=0; i<fun.size(); i++) {
5339 if (fun[i] == funNo) {
5343 while (sstr.Index(
"par") != -1) {
5344 memset(sval, 0,
sizeof(sval));
5345 sstr = &sstr[sstr.Index(
"par")+3];
5346 for (Int_t j=0; j<sstr.Sizeof(); j++) {
5347 if (!isdigit(sstr[j]))
5351 sscanf(sval,
"%d", &ival);
5357 while (sstr.Index(
"map") != -1) {
5358 memset(sval, 0,
sizeof(sval));
5359 sstr = &sstr[sstr.Index(
"map")+3];
5360 for (Int_t j=0; j<sstr.Sizeof(); j++) {
5361 if (!isdigit(sstr[j]))
5365 sscanf(sval,
"%d", &ival);
5369 for (pos=0; pos<map.size(); pos++) {
5370 if (ival == map[pos])
5373 if (pos == map.size()) {
5374 map.push_back(ival);
5384 for (iter = run.begin(); iter != run.end(); ++iter) {
5387 if (str.First(
'#') != -1)
5388 str.Resize(str.First(
'#'));
5394 if (str.Contains(
"alpha") || str.Contains(
"beta") ||
5395 str.Contains(
"alpha2") || str.Contains(
"beta2") ||
5396 str.Contains(
"norm") || str.Contains(
"backgr.fit") ||
5397 str.Contains(
"lifetime ")) {
5400 if (tokens.size()<2)
5403 std::string tok1 = tokens[1];
5410 if (tok1.find(
"fun") != std::string::npos) {
5418 if (str.Contains(
"map")) {
5423 for (UInt_t i=0; i<map.size(); i++) {
5426 if (map[i] <
static_cast<Int_t
>(tokens.size())) {
5439 for (iter = funcs.begin(); iter != funcs.end(); ++iter) {
5442 if (str.First(
'#') != -1)
5443 str.Resize(str.First(
'#'));
5459 for (UInt_t i=0; i<fun.size(); i++) {
5460 if (fun[i] == funNo) {
5464 while (sstr.Index(
"par") != -1) {
5465 memset(sval, 0,
sizeof(sval));
5466 sstr = &sstr[sstr.Index(
"par")+3];
5467 for (Int_t j=0; j<sstr.Sizeof(); j++) {
5468 if (!isdigit(sstr[j]))
5472 sscanf(sval,
"%d", &ival);
5478 while (sstr.Index(
"map") != -1) {
5479 memset(sval, 0,
sizeof(sval));
5480 sstr = &sstr[sstr.Index(
"map")+3];
5481 for (Int_t j=0; j<sstr.Sizeof(); j++) {
5482 if (!isdigit(sstr[j]))
5486 sscanf(sval,
"%d", &ival);
5490 for (pos=0; pos<map.size(); pos++) {
5491 if (ival == map[pos])
5494 if (
static_cast<UInt_t
>(pos) == map.size()) {
5495 map.push_back(ival);
5504 for (iter = run.begin(); iter != run.end(); ++iter) {
5507 if (str.First(
'#') != -1)
5508 str.Resize(str.First(
'#'));
5514 if (str.Contains(
"map")) {
5519 for (UInt_t i=0; i<map.size(); i++) {
5522 if (map[i] <
static_cast<Int_t
>(tokens.size())) {
5535 for (UInt_t i=0; i<
fParam.size(); i++) {
5537 if (
fParam[i].fStep != 0.0) {
5538 std::cerr << std::endl <<
">> **WARNING** : Parameter No " << i+1 <<
" is not used at all, will fix it" << std::endl;
5565 for (UInt_t i=0; i<
fRuns.size(); i++) {
5567 fitType =
fRuns[i].GetFitType();
5568 if (fitType == -1) {
5569 fitType =
fGlobal.GetFitType();
5570 if (fitType == -1) {
5571 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** fittype is neither defined in RUN block number " << i+1 <<
", nor in the GLOBAL block." << std::endl;
5577 Int_t detectorGroups = 1;
5582 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
5583 std::cerr << std::endl <<
">> Norm parameter number not defined. Necessary for single histogram fits." << std::endl;
5590 if (
fRuns[i].GetNormParamNo() >
static_cast<Int_t
>(
fParam.size())) {
5591 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
5592 std::cerr << std::endl <<
">> Norm parameter number " <<
fRuns[i].GetNormParamNo() <<
" is larger than the number of fit parameters (" <<
fParam.size() <<
").";
5593 std::cerr << std::endl <<
">> Consider to check the manual ;-)" << std::endl;
5598 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
5599 std::cerr << std::endl <<
">> Norm parameter function number " <<
fRuns[i].GetNormParamNo()-
MSR_PARAM_FUN_OFFSET <<
" is larger than the number of functions (" <<
GetNoOfFuncs() <<
").";
5600 std::cerr << std::endl <<
">> Consider to check the manual ;-)" << std::endl;
5606 if (
fRuns[i].GetForwardHistoNo() == -1) {
5607 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
5608 std::cerr << std::endl <<
">> forward parameter number not defined. Necessary for single histogram fits." << std::endl;
5614 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
5615 std::cerr << std::endl <<
">> forward histogram number " <<
fRuns[i].GetNormParamNo() <<
" is larger than the number of fit parameters (" <<
fParam.size() <<
").";
5616 std::cerr << std::endl <<
">> Consider to check the manual ;-)" << std::endl;
5623 if (!
fGlobal.IsFitRangeInBin()) {
5625 std::cerr << std::endl <<
"PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
5626 std::cerr << std::endl <<
" Fit range is not defined. Necessary for single histogram fits." << std::endl;
5633 detectorGroups =
fRuns[i].GetForwardHistoNoSize();
5634 if ((
fRuns[i].GetT0BinSize() > detectorGroups) || (
fGlobal.GetT0BinSize() > detectorGroups)) {
5635 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
5636 if (
fRuns[i].GetT0BinSize() > detectorGroups)
5637 std::cerr << std::endl <<
">> In RUN Block " << i+1 <<
": found " <<
fRuns[i].GetT0BinSize() <<
" T0 entries. Expecting max. " << detectorGroups <<
" entries.";
5638 if (
fGlobal.GetT0BinSize() > 1)
5639 std::cerr << std::endl <<
">> In GLOBAL block: found " <<
fGlobal.GetT0BinSize() <<
" T0 entries. Expecting max. " << detectorGroups <<
" entries. Needs to be fixed.";
5640 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;
5645 if ((
fRuns[i].GetPacking() == -1) && (
fGlobal.GetPacking() == -1)) {
5646 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **WARNING** in RUN block number " << i+1;
5647 std::cerr << std::endl <<
">> Packing is neither defined here, nor in the GLOBAL block, will set it to 1." << std::endl;
5648 fRuns[i].SetPacking(1);
5653 if (
fRuns[i].GetForwardHistoNo() == -1) {
5654 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
5655 std::cerr << std::endl <<
">> forward parameter number not defined. Necessary for single histogram RRF fits." << std::endl;
5661 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
5662 std::cerr << std::endl <<
">> forward histogram number " <<
fRuns[i].GetNormParamNo() <<
" is larger than the number of fit parameters (" <<
fParam.size() <<
").";
5663 std::cerr << std::endl <<
">> Consider to check the manual ;-)" << std::endl;
5670 if (!
fGlobal.IsFitRangeInBin()) {
5672 std::cerr << std::endl <<
"PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
5673 std::cerr << std::endl <<
" Fit range is not defined. Necessary for single histogram fits." << std::endl;
5680 detectorGroups =
fRuns[i].GetForwardHistoNoSize();
5681 if ((
fRuns[i].GetT0BinSize() > detectorGroups) || (
fGlobal.GetT0BinSize() > detectorGroups)) {
5682 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
5683 if (
fRuns[i].GetT0BinSize() > detectorGroups)
5684 std::cerr << std::endl <<
">> In RUN Block " << i+1 <<
": found " <<
fRuns[i].GetT0BinSize() <<
" T0 entries. Expecting max. " << detectorGroups <<
" entries.";
5685 if (
fGlobal.GetT0BinSize() > 1)
5686 std::cerr << std::endl <<
">> In GLOBAL block: found " <<
fGlobal.GetT0BinSize() <<
" T0 entries. Expecting max. " << detectorGroups <<
" entries. Needs to be fixed.";
5687 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;
5692 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** no RRF frequency found in the GLOBAL block." << std::endl;
5696 if (
fGlobal.GetRRFPacking() == -1) {
5697 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** no RRF packing found in the GLOBAL block." << std::endl;
5704 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
5705 std::cerr << std::endl <<
">> alpha parameter number missing which is needed for an asymmetry fit.";
5706 std::cerr << std::endl <<
">> Consider to check the manual ;-)" << std::endl;
5710 if (
fRuns[i].GetForwardHistoNo() == -1) {
5711 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
5712 std::cerr << std::endl <<
">> forward histogram number not defined. Necessary for asymmetry fits." << std::endl;
5716 if (
fRuns[i].GetBackwardHistoNo() == -1) {
5717 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
5718 std::cerr << std::endl <<
">> backward histogram number not defined. Necessary for asymmetry fits." << std::endl;
5722 if (!
fRuns[i].IsFitRangeInBin()) {
5725 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
5726 std::cerr << std::endl <<
">> Fit range is not defined, also NOT present in the GLOBAL block. Necessary for asymmetry fits." << std::endl;
5732 detectorGroups = 2*
fRuns[i].GetForwardHistoNoSize();
5733 if (detectorGroups < 2*
fRuns[i].GetBackwardHistoNoSize())
5734 detectorGroups = 2*
fRuns[i].GetBackwardHistoNoSize();
5735 if ((
fRuns[i].GetT0BinSize() > detectorGroups) || (
fGlobal.GetT0BinSize() > detectorGroups)) {
5736 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
5737 if (
fRuns[i].GetT0BinSize() > detectorGroups)
5738 std::cerr << std::endl <<
">> In RUN Block " << i+1 <<
": found " <<
fRuns[i].GetT0BinSize() <<
" T0 entries. Expecting max. " << detectorGroups <<
" entries.";
5739 if (
fGlobal.GetT0BinSize() > 1)
5740 std::cerr << std::endl <<
">> In GLOBAL block: found " <<
fGlobal.GetT0BinSize() <<
" T0 entries. Expecting max. " << detectorGroups <<
" entries. Needs to be fixed.";
5741 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;
5745 if ((
fRuns[i].GetPacking() == -1) && (
fGlobal.GetPacking() == -1)) {
5746 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **WARNING** in RUN block number " << i+1;
5747 std::cerr << std::endl <<
">> Packing is neither defined here, nor in the GLOBAL block, will set it to 1." << std::endl;
5748 fRuns[i].SetPacking(1);
5760 if (
fRuns[i].GetForwardHistoNo() == -1) {
5761 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
5762 std::cerr << std::endl <<
">> forward histogram number not defined. Necessary for asymmetry fits." << std::endl;
5766 if (
fRuns[i].GetBackwardHistoNo() == -1) {
5767 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
5768 std::cerr << std::endl <<
">> backward histogram number not defined. Necessary for asymmetry fits." << std::endl;
5772 if (!
fRuns[i].IsFitRangeInBin()) {
5775 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
5776 std::cerr << std::endl <<
">> Fit range is not defined, also NOT present in the GLOBAL block. Necessary for asymmetry fits." << std::endl;
5782 if ((
fRuns[i].GetT0BinSize() > 2*
fRuns[i].GetForwardHistoNoSize()) &&
5783 (
fGlobal.GetT0BinSize() > 2*
fRuns[i].GetForwardHistoNoSize())) {
5784 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
5785 std::cerr << std::endl <<
">> Found " <<
fRuns[i].GetT0BinSize() <<
" T0 entries. Expecting only " << 2*
fRuns[i].GetForwardHistoNoSize() <<
" in forward. Needs to be fixed." << std::endl;
5786 std::cerr << std::endl <<
">> In GLOBAL block: " <<
fGlobal.GetT0BinSize() <<
" T0 entries. Expecting only " << 2*
fRuns[i].GetForwardHistoNoSize() <<
". Needs to be fixed." << std::endl;
5789 if ((
fRuns[i].GetT0BinSize() > 2*
fRuns[i].GetBackwardHistoNoSize()) &&
5790 (
fGlobal.GetT0BinSize() > 2*
fRuns[i].GetBackwardHistoNoSize())) {
5791 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
5792 std::cerr << std::endl <<
">> Found " <<
fRuns[i].GetT0BinSize() <<
" T0 entries. Expecting only " << 2*
fRuns[i].GetBackwardHistoNoSize() <<
" in backward. Needs to be fixed." << std::endl;
5793 std::cerr << std::endl <<
">> In GLOBAL block: " <<
fGlobal.GetT0BinSize() <<
" T0 entries. Expecting only " << 2*
fRuns[i].GetBackwardHistoNoSize() <<
". Needs to be fixed." << std::endl;
5797 if ((
fRuns[i].GetPacking() == -1) && (
fGlobal.GetPacking() == -1)) {
5798 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **WARNING** in RUN block number " << i+1;
5799 std::cerr << std::endl <<
">> Packing is neither defined here, nor in the GLOBAL block, will set it to 1." << std::endl;
5800 fRuns[i].SetPacking(1);
5806 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
5807 std::cerr << std::endl <<
">> alpha parameter number missing which is needed for an asymmetry RRF fit.";
5808 std::cerr << std::endl <<
">> Consider to check the manual ;-)" << std::endl;
5812 if (
fRuns[i].GetForwardHistoNo() == -1) {
5813 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
5814 std::cerr << std::endl <<
">> forward histogram number not defined. Necessary for asymmetry RRF fits." << std::endl;
5818 if (
fRuns[i].GetBackwardHistoNo() == -1) {
5819 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
5820 std::cerr << std::endl <<
">> backward histogram number not defined. Necessary for asymmetry RRF fits." << std::endl;
5824 if (!
fRuns[i].IsFitRangeInBin()) {
5827 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
5828 std::cerr << std::endl <<
">> Fit range is not defined, also NOT present in the GLOBAL block. Necessary for asymmetry RRF fits." << std::endl;
5834 detectorGroups = 2*
fRuns[i].GetForwardHistoNoSize();
5835 if (detectorGroups < 2*
fRuns[i].GetBackwardHistoNoSize())
5836 detectorGroups = 2*
fRuns[i].GetBackwardHistoNoSize();
5837 if ((
fRuns[i].GetT0BinSize() > detectorGroups) || (
fGlobal.GetT0BinSize() > detectorGroups)) {
5838 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
5839 if (
fRuns[i].GetT0BinSize() > detectorGroups)
5840 std::cerr << std::endl <<
">> In RUN Block " << i+1 <<
": found " <<
fRuns[i].GetT0BinSize() <<
" T0 entries. Expecting max. " << detectorGroups <<
" entries.";
5841 if (
fGlobal.GetT0BinSize() > 1)
5842 std::cerr << std::endl <<
">> In GLOBAL block: found " <<
fGlobal.GetT0BinSize() <<
" T0 entries. Expecting max. " << detectorGroups <<
" entries. Needs to be fixed.";
5843 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;
5848 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** no RRF frequency found in the GLOBAL block." << std::endl;
5852 if (
fGlobal.GetRRFPacking() == -1) {
5853 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** no RRF packing found in the GLOBAL block." << std::endl;
5862 if ((
fRuns[i].GetXDataIndex() == -1) && (
fRuns[i].GetXDataLabel()->Length() == 0)) {
5863 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
5864 std::cerr << std::endl <<
">> xy-data is missing. Necessary for non muSR fits." << std::endl;
5870 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
5871 std::cerr << std::endl <<
">> Fit range is not defined, neither in the RUN block, nor in the GLOBAL block.";
5872 std::cerr << std::endl <<
">> Necessary for non muSR fits." << std::endl;
5877 if (
fRuns[i].GetPacking() == -1) {
5878 if (
fGlobal.GetPacking() == -1) {
5879 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **WARNING** in RUN block number " << i+1;
5880 std::cerr << std::endl <<
">> Packing is not defined, will set it to 1." << std::endl;
5881 fRuns[i].SetPacking(1);
5886 std::cerr << std::endl <<
">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** fittype " << fitType <<
" undefined." << std::endl;
5911 Bool_t unique =
true;
5913 for (UInt_t i=0; i<
fParam.size()-1; i++) {
5914 for (UInt_t j=i+1; j<
fParam.size(); j++) {
5940 Bool_t result =
true;
5946 std::vector<std::string> tokens;
5951 for (UInt_t i=0; i<
fTheory.size(); i++) {
5952 if (
fTheory[i].fLine.Contains(
"map", TString::kIgnoreCase)) {
5955 for (UInt_t j=0; j<tokens.size(); j++) {
5958 mapVec.push_back(no);
5959 mapBlock.push_back(0);
5960 mapLineNo.push_back(
fTheory[i].fLineNo);
5969 if (
fFunctions[i].fLine.Contains(
"map", TString::kIgnoreCase)) {
5972 for (UInt_t j=0; j<tokens.size(); j++) {
5975 mapVec.push_back(no);
5976 mapBlock.push_back(1);
5986 for (UInt_t i=0; i<mapVec.size(); i++) {
5988 for (UInt_t j=0; j<
fRuns.size(); j++) {
5999 std::cerr << std::endl <<
">> PMsrHandler::CheckMaps: **ERROR** map" << mapVec[i]-
MSR_PARAM_MAP_OFFSET <<
" found in the ";
6000 if (mapBlock[i] == 0)
6001 std::cerr <<
"theory-block ";
6003 std::cerr <<
"functions-block ";
6004 std::cerr <<
"in line " << mapLineNo[i] <<
" is not present in the run-block!";
6005 std::cerr << std::endl;
6007 std::cerr << std::endl <<
">> by the way: map must be > 0 ...";
6008 std::cerr << std::endl;
6034 Bool_t result =
true;
6043 std::vector<std::string> tokens;
6049 for (UInt_t i=0; i<
fTheory.size(); i++) {
6050 if (
fTheory[i].fLine.Contains(
"fun", TString::kIgnoreCase)) {
6053 for (UInt_t j=0; j<tokens.size(); j++) {
6056 funVec.push_back(no);
6057 funBlock.push_back(0);
6058 funLineBlockNo.push_back(
fTheory[i].fLineNo);
6066 for (UInt_t i=0; i<
fRuns.size(); i++) {
6068 funVec.push_back(
fRuns[i].GetNormParamNo());
6069 funBlock.push_back(1);
6070 funLineBlockNo.push_back(i+1);
6076 for (UInt_t i=0; i<funVec.size(); i++) {
6082 str = TString(
"fun");
6084 if (
fFunctions[j].fLine.Contains(str, TString::kIgnoreCase)) {
6091 std::cerr << std::endl <<
">> PMsrHandler::CheckFuncs: **ERROR** fun" << funVec[i]-
MSR_PARAM_FUN_OFFSET <<
" found in the ";
6092 if (funBlock[i] == 0)
6093 std::cerr <<
"theory-block in line " << funLineBlockNo[i] <<
" is not present in the functions-block!";
6095 std::cerr <<
"run-block No " << funLineBlockNo[i] <<
" (norm) is not present in the functions-block!";
6096 std::cerr << std::endl;
6103 funLineBlockNo.clear();
6120 Bool_t result =
true;
6122 for (UInt_t i=0; i<
fRuns.size(); i++) {
6124 if (
fRuns[i].GetForwardHistoNoSize() > 1) {
6125 for (UInt_t j=0; j<
fRuns[i].GetForwardHistoNoSize(); j++) {
6126 for (UInt_t k=j+1; k<
fRuns[i].GetForwardHistoNoSize(); k++) {
6127 if (
fRuns[i].GetForwardHistoNo(j) ==
fRuns[i].GetForwardHistoNo(k)) {
6128 std::cerr << std::endl <<
">> PMsrHandler::CheckHistoGrouping: **WARNING** grouping identical histograms!!";
6129 std::cerr << std::endl <<
">> run no " << i+1 <<
", forward histo " << j+1 <<
" == forward histo " << k+1 <<
".";
6130 std::cerr << std::endl <<
">> this really doesn't make any sense, but you are the boss.";
6131 std::cerr << std::endl;
6137 if (
fRuns[i].GetBackwardHistoNoSize() > 1) {
6138 for (UInt_t j=0; j<
fRuns[i].GetBackwardHistoNoSize(); j++) {
6139 for (UInt_t k=j+1; k<
fRuns[i].GetBackwardHistoNoSize(); k++) {
6140 if (
fRuns[i].GetBackwardHistoNo(j) ==
fRuns[i].GetBackwardHistoNo(k)) {
6141 std::cerr << std::endl <<
">> PMsrHandler::CheckHistoGrouping: **WARNING** grouping identical histograms!!";
6142 std::cerr << std::endl <<
">> run no " << i+1 <<
", backward histo " << j+1 <<
" == backward histo " << k+1 <<
".";
6143 std::cerr << std::endl <<
">> this really doesn't make any sense, but you are the boss.";
6144 std::cerr << std::endl;
6166 Bool_t result =
true;
6168 for (UInt_t i=0; i<
fRuns.size(); i++) {
6169 if (
fRuns[i].GetRunNameSize() > 1) {
6171 if (
fRuns[i].GetAddT0BinEntries() != 0) {
6172 if (
fRuns[i].GetAddT0BinEntries() !=
fRuns[i].GetRunNameSize()-1) {
6175 fLastErrorMsg <<
">> PMsrHandler::CheckAddRunParameters: **ERROR** # of addt0 != # of addruns.\n";
6199 for (UInt_t i=0; i<
fRuns.size(); i++) {
6204 fLastErrorMsg <<
">> PMsrHandler::CheckMaxLikelihood: **WARNING**: Maximum Log Likelihood Fit is only implemented\n";
6205 fLastErrorMsg <<
">> for Single Histogram and Mu Minus Fits. Will fall back to Chi Square Fit.\n";
6206 std::cerr << std::endl << std::endl;
6223 Bool_t result =
true;
6224 Int_t fittype =
fGlobal.GetFitType();
6228 if (fittype != -1) {
6231 std::cerr << std::endl <<
">> PMsrHandler::CheckRRFSettings: **ERROR** found GLOBAL fittype " << fittype <<
" and";
6232 std::cerr << std::endl <<
">> RRF settings in the GLOBAL section. This is NOT compatible. Fix it first.";
6236 for (UInt_t i=0; i<
fRuns.size(); i++) {
6237 fittype =
fRuns[i].GetFitType();
6240 std::cerr << std::endl <<
">> PMsrHandler::CheckRRFSettings: **ERROR** found RUN with fittype " << fittype <<
" and";
6241 std::cerr << std::endl <<
">> RRF settings in the GLOBAL section. This is NOT compatible. Fix it first.";
6248 if (
fGlobal.GetRRFPacking() != -1) {
6249 std::cerr << std::endl <<
">> PMsrHandler::CheckRRFSettings: **WARNING** found in the GLOBAL section rrf_packing, without";
6250 std::cerr << std::endl <<
">> rrf_freq. Doesn't make any sense. Will drop rrf_packing";
6251 std::cerr << std::endl << std::endl;
6254 if (
fGlobal.GetRRFPhase() != 0.0) {
6255 std::cerr << std::endl <<
">> PMsrHandler::CheckRRFSettings: **WARNING** found in the GLOBAL section rrf_phase, without";
6256 std::cerr << std::endl <<
">> rrf_freq. Doesn't make any sense. Will drop rrf_phase";
6257 std::cerr << std::endl << std::endl;
6269 fittype =
fGlobal.GetFitType();
6273 std::cerr << std::endl <<
">> PMsrHandler::CheckRRFSettings: **ERROR** RRF fit chosen, but";
6274 std::cerr << std::endl <<
">> no RRF frequency found in the GLOBAL section! Fix it.";
6277 if (
fGlobal.GetRRFPacking() == -1) {
6278 std::cerr << std::endl <<
">> PMsrHandler::CheckRRFSettings: **ERROR** RRF fit chosen, but";
6279 std::cerr << std::endl <<
">> no RRF packing found in the GLOBAL section! Fix it.";
6283 UInt_t rrfFitCounter = 0;
6284 for (UInt_t i=0; i<
fRuns.size(); i++) {
6285 fittype =
fRuns[i].GetFitType();
6291 if (rrfFitCounter !=
fRuns.size()) {
6292 std::cerr << std::endl <<
">> PMsrHandler::CheckRRFSettings: **ERROR** #Runs (" <<
fRuns.size() <<
") != # RRF fits found (" << rrfFitCounter <<
")";
6293 std::cerr << std::endl <<
">> This is currently not supported.";
6297 std::cerr << std::endl <<
">> PMsrHandler::CheckRRFSettings: **ERROR** RRF fit chosen, but";
6298 std::cerr << std::endl <<
">> no RRF frequency found in the GLOBAL section! Fix it.";
6301 if (
fGlobal.GetRRFPacking() == -1) {
6302 std::cerr << std::endl <<
">> PMsrHandler::CheckRRFSettings: **ERROR** RRF fit chosen, but";
6303 std::cerr << std::endl <<
">> no RRF packing found in the GLOBAL section! Fix it.";
6322 if (!
fFourier.fFourierBlockPresent)
6334 fLastErrorMsg <<
">> PMsrHandler::ReadMsrFile: **ERROR** if more than one phase is given in the Fourier block,\n";
6335 fLastErrorMsg <<
">> it needs to correspond to the number of runs in the Plot block!\n";
6337 fLastErrorMsg <<
">> number of runs in the PLOT block: " <<
fPlots[0].fRuns.size() <<
"\n";
6345 if ((
fFourier.fPhase.size() == 0) && (
fFourier.fPhaseParamNo.size() == 0)) {
6348 fLastErrorMsg <<
">> PMsrHandler::ReadMsrFile: **ERROR** for FOURIER plot != POWER,\n";
6349 fLastErrorMsg <<
">> phases need to be defined in the FOURIER block!\n";
6352 fLastErrorMsg <<
">> where parR7 is the reference phase, and the others the relative phases.\n";
6353 fLastErrorMsg <<
">> I.e. phase of run 2: parR7 + par9, etc.\n";
6377 if (!detector.CompareTo(
"forward", TString::kIgnoreCase)) {
6378 for (UInt_t i=0; i<
fRuns[runNo].GetForwardHistoNoSize(); i++)
6379 grouping.push_back(
fRuns[runNo].GetForwardHistoNo(i));
6381 }
else if (!detector.CompareTo(
"backward", TString::kIgnoreCase)) {
6382 for (UInt_t i=0; i<
fRuns[runNo].GetBackwardHistoNoSize(); i++)
6383 grouping.push_back(
fRuns[runNo].GetBackwardHistoNo(i));
6386 groupingStr =
"**ERROR** unkown detector. Allow forward/backward.";
6426 for (UInt_t i=0; i<precLimit; i++) {
6427 if (
static_cast<Int_t
>(dval*pow(10.0,
static_cast<Double_t
>(i))) != 0) {
6433 if (prec == precLimit) {
6434 std::cerr << std::endl <<
">> PMsrHandler::NeededPrecision(): **WARNING** precision limit of " << precLimit <<
", requested.";
6453 UInt_t lastSignificant = 2;
6454 UInt_t decimalPoint = 0;
6458 snprintf(str,
sizeof(str),
"%lf", dval);
6461 for (UInt_t i=0; i<strlen(str); i++) {
6462 if (str[i] ==
'.') {
6469 for (Int_t i=strlen(str)-1; i>=0; i--) {
6470 if (str[i] !=
'0') {
6471 if ((
static_cast<UInt_t
>(i)-decimalPoint) < precLimit)
6472 lastSignificant =
static_cast<UInt_t
>(i)-decimalPoint;
6474 lastSignificant = precLimit;
6479 return lastSignificant;
6495 if (includeDetector) {
6496 result = str + TString(
" ");
6497 if (str == TString(
"forward"))
6503 if (group.size()==0)
6509 if (j+1 < group.size()) {
6510 while (group[j]+1 == group[j+1]) {
6512 if (j == group.size()-1)
6527 }
while (i<group.size());
6543 TString formatStr(
"par%d, par%d");
6545 if (
fFourier.fPhaseParamNo.size() == 0)
6548 Int_t phaseRef =
fFourier.fPhaseRef;
6550 if (
fFourier.fPhaseParamNo.size() == 1) {
6551 str = TString::Format(
"par%d",
fFourier.fPhaseParamNo[0]);
6552 }
else if (
fFourier.fPhaseParamNo.size() == 2) {
6553 if (phaseRef ==
fFourier.fPhaseParamNo[0])
6554 formatStr =
"parR%d, par%d";
6555 if (phaseRef ==
fFourier.fPhaseParamNo[1])
6556 formatStr =
"par%d, parR%d";
6557 str = TString::Format(formatStr,
fFourier.fPhaseParamNo[0],
fFourier.fPhaseParamNo[1]);
6559 Bool_t phaseIter =
true;
6563 for (Int_t i=2; i<
fFourier.fPhaseParamNo.size(); i++) {
6571 if (phaseRef != -1) {
6572 str = TString::Format(
"parR(%d, %d, %lu)",
fFourier.fPhaseParamNo[0], offset,
fFourier.fPhaseParamNo.size());
6574 str = TString::Format(
"par(%d, %d, %lu)",
fFourier.fPhaseParamNo[0], offset,
fFourier.fPhaseParamNo.size());
6578 for (Int_t i=0; i<
fFourier.fPhaseParamNo.size()-1; i++) {
6579 if (phaseRef ==
fFourier.fPhaseParamNo[i]) {
6611 for (UInt_t i=0; i<
fPlots.size(); i++) {
6612 for (UInt_t j=0; j<
fPlots[i].fRuns.size(); j++) {
6613 idx =
fPlots[i].fRuns[j]-1;
6614 if (
fRuns[idx].IsLifetimeCorrected()) {
6615 fPlots[i].fLifeTimeCorrection =
true;
#define MSR_TAG_TITLE
TITLE block - describes the experiment.
#define MSR_TAG_RUN
RUN block - run-specific settings and data file information.
std::vector< UInt_t > PUIntVector
#define MSR_PARAM_MAP_OFFSET
Offset added to map indices for parameter parsing.
#define PRUN_ASYMMETRY
Asymmetry fit using forward and backward detectors.
#define MSR_TAG_FUNCTIONS
FUNCTIONS block - user-defined mathematical functions.
#define MSR_FITTYPE_ASYM
Fit asymmetry A(t) = (F-αB)/(F+αB).
#define PMUSR_MSR_LOG_FILE_WRITE_ERROR
Failed to write to MSR log file.
#define PRUN_MU_MINUS
Negative muon (μ-) single histogram fit.
#define MSR_PLOT_SINGLE_HISTO
Plot single histogram.
#define FOURIER_UNIT_FREQ
Frequency in MHz.
#define FOURIER_PLOT_REAL_AND_IMAG
Plot both real and imaginary components (default).
#define PRUN_ASYMMETRY_RRF
Asymmetry fit in rotating reference frame (RRF).
#define RRF_UNIT_MHz
Frequency in MHz (megahertz).
#define PMUSR_SUCCESS
Successful operation completion.
#define FOURIER_UNIT_GAUSS
Magnetic field in Gauss (G).
#define MSR_FITTYPE_SINGLE_HISTO_RRF
Fit single histogram in rotating reference frame.
#define FOURIER_PLOT_NOT_GIVEN
Plot type not specified.
#define FOURIER_PLOT_POWER
Plot power spectrum |F(ω)|²
#define MSR_TAG_COMMANDS
COMMANDS block - post-fit commands (e.g., parameter output).
#define MSR_TAG_FOURIER
FOURIER block - Fourier transform settings.
#define PMUSR_MSR_FILE_NOT_FOUND
MSR file could not be found at specified path.
#define MSR_PARAM_FUN_OFFSET
Offset added to function indices for parameter parsing.
#define MSR_TAG_THEORY
THEORY block - specifies the theory function(s) to fit.
std::vector< Bool_t > PBoolVector
#define MSR_FITTYPE_SINGLE_HISTO
Fit single histogram (e.g., positron counts vs. time).
#define PRUN_SINGLE_HISTO_RRF
Single histogram fit in rotating reference frame (RRF).
#define FOURIER_PLOT_REAL
Plot real component only.
#define FOURIER_PLOT_PHASE_OPT_REAL
Plot phase-optimized real component.
#define MSR_FITTYPE_MU_MINUS
Fit negative muon (μ-) single histogram.
#define FOURIER_APOD_WEAK
Weak apodization (gentle windowing).
#define MSR_PLOT_ASYM_RRF
Plot asymmetry in rotating reference frame.
std::vector< PMsrLineStructure > PMsrLines
#define MSR_FITTYPE_ASYM_RRF
Fit asymmetry in rotating reference frame.
#define MSR_FITTYPE_NON_MUSR
Fit non-μSR data (general x-y data).
#define MSR_PLOT_SINGLE_HISTO_RRF
Plot single histogram in rotating reference frame.
#define PMUSR_MSR_SYNTAX_ERROR
Syntax error detected in MSR file content.
#define FOURIER_APOD_NONE
No apodization (rectangular window).
#define FOURIER_UNIT_CYCLES
Angular frequency in Mc/s (Mega-cycles per second).
#define MSR_PLOT_ASYM
Plot asymmetry.
#define PRUN_NON_MUSR
Non-μSR data fit (general x-y data).
#define FOURIER_APOD_STRONG
Strong apodization (heavy windowing for best frequency resolution).
#define MSR_TAG_PLOT
PLOT block - plotting configuration for data visualization.
#define PRUN_SINGLE_HISTO
Single histogram fit (e.g., forward or backward detector).
std::vector< Int_t > PIntVector
#define PMUSR_MSR_FILE_WRITE_ERROR
Failed to write MSR file.
#define MSR_PLOT_MU_MINUS
Plot negative muon (μ-) data.
#define MSR_TAG_FITPARAMETER
FITPARAMETER block - defines fit parameters with initial values and constraints.
#define MSR_FITTYPE_BNMR
Fit beta-detected NMR asymmetry.
#define RRF_UNIT_Mcs
Angular frequency in Mc/s (Mega-cycles per second).
#define RRF_UNIT_G
Equivalent magnetic field in Gauss (G).
#define FOURIER_PLOT_IMAG
Plot imaginary component only.
#define MSR_TAG_STATISTIC
STATISTIC block - fit statistics and results (generated after fit).
#define RRF_UNIT_kHz
Frequency in kHz (kilohertz).
#define FOURIER_APOD_MEDIUM
Medium apodization (moderate windowing).
#define MSR_PLOT_BNMR
Plot beta-detected NMR data.
#define RRF_UNIT_T
Equivalent magnetic field in Tesla (T).
#define FOURIER_PLOT_PHASE
Plot phase spectrum arg(F(ω)).
#define FOURIER_UNIT_NOT_GIVEN
Units not specified.
#define PRUN_ASYMMETRY_BNMR
Beta-detected NMR asymmetry fit.
#define FOURIER_UNIT_TESLA
Magnetic field in Tesla (T).
#define FOURIER_APOD_NOT_GIVEN
Apodization not specified.
#define RRF_UNIT_UNDEF
RRF unit undefined.
#define MSR_TAG_GLOBAL
GLOBAL block - global fit settings (RRF, fit type, etc.).
#define MSR_PLOT_NON_MUSR
Plot non-μSR data.
virtual void SetT0Bin(Double_t dval, Int_t idx=-1)
virtual void SetFitRangeInBins(Bool_t bval)
virtual void SetRRFFreq(Double_t freq, const char *unit)
virtual void SetFitRange(Double_t dval, UInt_t idx)
virtual void SetGlobalPresent(Bool_t bval)
virtual void SetFitType(Int_t ival)
virtual void SetDeadTimeCorrection(TString str)
virtual void SetDataRange(Int_t ival, Int_t idx)
virtual void SetPacking(Int_t ival)
virtual void SetRRFPhase(Double_t phase)
virtual void SetRRFPacking(Int_t pack)
virtual void SetFitRangeOffset(Int_t ival, UInt_t idx)
virtual void SetAddT0Bin(Double_t dval, UInt_t addRunIdx, UInt_t histoNoIdx)
virtual Double_t GetRRFFreq(const char *unit)
virtual Bool_t CheckMaps()
Validates that all map indices are within parameter range.
virtual UInt_t GetNoOfFitParameters(UInt_t idx)
virtual UInt_t NeededPrecision(Double_t dval, UInt_t precLimit=13)
Calculates precision needed for formatting a double value.
virtual Bool_t ParseFourierPhaseValueVector(PMsrFourierStructure &fourier, const TString &str, Bool_t &error)
Parses Fourier phase value vector.
virtual Bool_t CheckHistoGrouping()
Checks histogram grouping consistency across runs.
virtual void SetMsrBkgRangeEntry(UInt_t runNo, UInt_t idx, Int_t bin)
virtual Bool_t SetMsrParamStep(UInt_t i, Double_t value)
virtual Bool_t CheckRRFSettings()
Validates RRF (Rotating Reference Frame) settings.
virtual Bool_t EstimateN0()
Bool_t fFourierOnly
Flag indicating Fourier transform only mode (for musrFT).
std::stringstream fLastErrorMsg
Stream accumulating error messages during parsing.
std::unique_ptr< PFunctionHandler > fFuncHandler
Handler for parsing and evaluating user-defined functions.
virtual void SetMsrAddT0Entry(UInt_t runNo, UInt_t addRunIdx, UInt_t histoIdx, Double_t bin)
virtual Bool_t HandleGlobalEntry(PMsrLines &line)
Parses GLOBAL block entries.
TString fTitle
MSR file title string.
virtual void SetMsrT0Entry(UInt_t runNo, UInt_t idx, Double_t bin)
virtual void FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLines &run)
Determines which parameters are used in theory and functions.
virtual void SetMsrDataRangeEntry(UInt_t runNo, UInt_t idx, Int_t bin)
virtual Int_t GetNoOfFuncs()
Returns the number of user-defined functions in FUNCTIONS block.
virtual Bool_t HandleFourierEntry(PMsrLines &line)
Parses FOURIER block entries.
virtual Bool_t HandleFitParameterEntry(PMsrLines &line)
Parses FITPARAMETER block entries.
PMsrGlobalBlock fGlobal
Global block settings (fit type, data format, etc.).
virtual ~PMsrHandler()
Destructor that cleans up all data structures.
virtual Bool_t CheckRunBlockIntegrity()
Validates RUN block structure and consistency.
Bool_t fCopyStatisticsBlock
If true, copy old statistics block (musrt0); if false, write new one (musrfit).
virtual Bool_t CheckAddRunParameters()
Validates addrun parameter references.
virtual Bool_t SetMsrParamPosError(UInt_t i, Double_t value)
PMsrStatisticStructure fStatistic
Fit statistics (χ², NDF, convergence status).
virtual Bool_t HandleTheoryEntry(PMsrLines &line)
Parses THEORY block entries.
virtual Bool_t ParseFourierPhaseParIterVector(PMsrFourierStructure &fourier, const TString &str, Bool_t &error)
Parses Fourier phase parameter iteration vector.
virtual Bool_t SetMsrParamValue(UInt_t i, Double_t value)
virtual Bool_t SetMsrParamPosErrorPresent(UInt_t i, Bool_t value)
PIntVector fParamInUse
Flags indicating which parameters are actually used in theory/functions.
virtual TString BeautifyFourierPhaseParameterString()
Formats Fourier phase parameter string for display.
PMsrLines fFunctions
User-defined functions block lines.
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)
Writes an MSR file from internal data structures.
virtual Bool_t HandleCommandsEntry(PMsrLines &line)
Parses COMMANDS block entries.
virtual Bool_t CheckRealFFT()
Checks if real FFT requirements are met.
virtual Bool_t HandleStatisticEntry(PMsrLines &line)
Parses STATISTIC block entries.
virtual Bool_t FilterNumber(TString str, const Char_t *filter, Int_t offset, Int_t &no)
Extracts number from string with specific filter pattern.
virtual Bool_t HandleRunEntry(PMsrLines &line)
Parses RUN block entries.
virtual UInt_t LastSignificant(Double_t dval, UInt_t precLimit=6)
Finds position of last significant digit in a double value.
virtual Int_t ReadMsrFile()
Reads and parses the MSR file.
virtual Bool_t ParseFourierPhaseParVector(PMsrFourierStructure &fourier, const TString &str, Bool_t &error)
Parses Fourier phase parameter vector.
virtual void CheckMaxLikelihood()
Validates maximum likelihood fit settings.
virtual void RemoveComment(const TString &str, TString &truncStr)
Removes comments from MSR file line.
PMsrRunList fRuns
List of RUN blocks with data file specifications.
virtual Bool_t HandleFunctionsEntry(PMsrLines &line)
Parses FUNCTIONS block entries.
virtual Int_t WriteMsrLogFile(const Bool_t messages=true, const Bool_t addMissingT0s=false)
Writes an MSR log file (.mlog) with parsed MSR content.
virtual void GetGroupingString(Int_t runNo, TString detector, TString &groupingStr)
TString fMsrFileDirectoryPath
Directory path of the MSR file.
PMsrLines fTheory
Theory block lines defining asymmetry/relaxation functions.
PStartupOptions * fStartupOptions
Pointer to startup options from musrfit_startup.xml.
TString fFileName
MSR file name (with path).
virtual UInt_t GetFuncIndex(Int_t funNo)
PMsrFourierStructure fFourier
Fourier transform parameters and settings.
virtual Bool_t CheckFuncs()
Validates user-defined functions syntax and parameter usage.
PMsrHandler(const Char_t *fileName, PStartupOptions *startupOptions=0, const Bool_t fourierOnly=false)
Constructor that initializes the MSR handler.
virtual Int_t ParameterInUse(UInt_t paramNo)
virtual void MakeDetectorGroupingString(TString str, PIntVector &group, TString &result, Bool_t includeDetector=true)
Creates detector grouping string from integer vector.
virtual void InitFourierParameterStructure(PMsrFourierStructure &fourier)
Initializes Fourier parameter structure with default values.
Int_t fMsrBlockCounter
Counter to track current MSR block during parsing.
virtual void CheckLegacyLifetimecorrection()
Checks for deprecated lifetimecorrection syntax and warns user.
PMsrLines fCommands
MINUIT commands block lines.
PMsrParamList fParam
List of fit parameters with values, errors, constraints.
virtual Bool_t HandlePlotEntry(PMsrLines &line)
Parses PLOT block entries.
PMsrPlotList fPlots
List of PLOT blocks with plotting parameters.
virtual Bool_t CheckUniquenessOfParamNames(UInt_t &parX, UInt_t &parY)
Checks that all parameter names are unique.
virtual PIntVector * GetMap()
virtual void SetLifetimeParamNo(Int_t ival)
virtual void SetFitRangeOffset(Int_t ival, UInt_t idx)
virtual void SetBeamline(TString &str, Int_t idx=-1)
virtual void SetBkgFix(Double_t dval, Int_t idx)
virtual void SetXDataLabel(TString &str)
virtual void SetFitType(Int_t ival)
virtual void SetFitRange(Double_t dval, UInt_t idx)
virtual void SetFileFormat(TString &str, Int_t idx=-1)
virtual void SetMap(Int_t mapVal, Int_t idx=-1)
virtual void SetPacking(Int_t ival)
virtual void SetYDataIndex(Int_t ival)
virtual void SetLifetimeCorrection(Bool_t bval)
virtual void SetT0Bin(Double_t dval, Int_t idx=-1)
virtual void SetBkgFitParamNo(Int_t ival)
virtual void SetBackwardHistoNo(Int_t histoNo, Int_t idx=-1)
virtual void SetDataRange(Int_t ival, Int_t idx)
virtual void SetXDataIndex(Int_t ival)
virtual void SetRunName(TString &str, Int_t idx=-1)
virtual void SetBetaParamNo(Int_t ival)
virtual void SetYDataLabel(TString &str)
virtual void SetAlphaParamNo(Int_t ival)
virtual void SetBkgRange(Int_t ival, Int_t idx)
virtual void SetInstitute(TString &str, Int_t idx=-1)
virtual void SetDeadTimeCorrection(TString str)
virtual void SetNormParamNo(Int_t ival)
virtual void SetFitRangeInBins(Bool_t bval)
virtual void SetForwardHistoNo(Int_t histoNo, Int_t idx=-1)
virtual void SetAddT0Bin(Double_t dval, UInt_t addRunIdx, UInt_t histoNoIdx)
static bool IsFloat(const std::string &str)
static bool ContainsNoCase(const std::string &haystack, const std::string &needle)
static int ToInt(const std::string &str, bool *ok=nullptr)
static bool BeginsWithNoCase(const std::string &str, const std::string &prefix)
static bool IsEqualNoCase(const std::string &a, const std::string &b)
static std::vector< std::string > Split(const std::string &str, const std::string &delimiters)
static double ToDouble(const std::string &str, bool *ok=nullptr)
static bool IsInt(const std::string &str)
Int_t fPlotTag
tag used for initial plot. 0=real, 1=imaginary, 2=real & imaginary (default), 3=power,...
Bool_t fFourierBlockPresent
flag indicating if a Fourier block is present in the msr-file
Double_t fPlotRange[2]
field/frequency plot range
PDoubleVector fPhase
phase(s)
Double_t fRangeForPhaseCorrection[2]
field/frequency range for automatic phase correction
PIntVector fPhaseParamNo
parameter number(s) if used instead of a phase value
Int_t fFourierPower
i.e. zero padding up to 2^fFourierPower, default = 0 which means NO zero padding
Int_t fUnits
flag used to indicate the units. 1=field units (G); 2=field units (T); 3=frequency units (MHz); 4=Mc/...
Int_t fPhaseRef
phase reference for relative phase(s)
Bool_t fDCCorrected
if set true, the dc offset of the signal/theory will be removed before the FFT is made.
Int_t fApodization
tag indicating the kind of apodization wished, 0=no appodization (default), 1=weak,...
Int_t fLineNo
Line number in original MSR file (1-based).
TString fLine
Content of the MSR file line.
Double_t fStep
Step size / error / negative error (context-dependent).
Double_t fPosError
Positive error for asymmetric uncertainties.
Bool_t fLowerBoundaryPresent
True if lower bound constraint is active.
Int_t fNoOfParams
Total number of parameters in FITPARAMETER block.
Double_t fLowerBoundary
Lower boundary value for parameter constraints.
Int_t fNo
Parameter number (1, 2, 3, ...).
Double_t fUpperBoundary
Upper boundary value for parameter constraints.
Bool_t fPosErrorPresent
True if positive error explicitly defined (asymmetric errors).
Bool_t fUpperBoundaryPresent
True if upper bound constraint is active.
Double_t fValue
Parameter value (initial or fitted).
TString fName
Parameter name (e.g., "alpha", "lambda", "field").
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
UInt_t fRRFUnit
RRF frequency unit. 0=kHz, 1=MHz, 2=Mc/s, 3=Gauss, 4=Tesla.
Bool_t fLogY
yes -> y-axis in log-scale, no (default) -> y-axis in lin-scale
Bool_t fLogX
yes -> x-axis in log-scale, no (default) -> x-axis in lin-scale
Int_t fRRFPhaseParamNo
parameter number if used instead of a RRF phase value
Double_t fRRFFreq
RRF frequency.
PDoubleVector fYmax
asymmetry/counts maximum
Bool_t fLifeTimeCorrection
needed for single histo. If yes, only the asymmetry is shown, otherweise the positron spectrum
Int_t fViewPacking
-1 -> use the run packing to generate the view, otherwise is fViewPacking for the binning of ALL runs...
Double_t fRRFPhase
RRF phase.
UInt_t fRRFPacking
rotating reference frame (RRF) packing
PDoubleVector fYmin
asymmetry/counts minimum
PDoubleVector fTmax
time maximum
PDoubleVector fTmin
time minimum