44#include <TObjString.h>
117 std::cerr << std::endl <<
">> PRunAsymmetry::PRunAsymmetry(): **SEVERE ERROR**: Couldn't find any packing information!";
118 std::cerr << std::endl <<
">> This is very bad :-(, will quit ...";
119 std::cerr << std::endl;
129 if (
fRunInfo->GetAlphaParamNo() == -1) {
130 std::cerr << std::endl <<
">> PRunAsymmetry::PRunAsymmetry(): **ERROR** no alpha parameter given! This is needed for an asymmetry fit!";
131 std::cerr << std::endl;
137 if ((fRunInfo->GetAlphaParamNo()-MSR_PARAM_FUN_OFFSET < 0) ||
138 (fRunInfo->GetAlphaParamNo()-MSR_PARAM_FUN_OFFSET > msrInfo->GetNoOfFuncs())) {
139 std::cerr << std::endl <<
">> PRunAsymmetry::PRunAsymmetry(): **ERROR** alpha parameter is a function with no = " << fRunInfo->GetAlphaParamNo();
140 std::cerr << std::endl <<
">> This is out of bound, since there are only " << msrInfo->GetNoOfFuncs() <<
" functions.";
141 std::cerr << std::endl;
145 }
else if ((fRunInfo->GetAlphaParamNo() < 0) || (fRunInfo->GetAlphaParamNo() >
static_cast<Int_t
>(param->size()))) {
146 std::cerr << std::endl <<
">> PRunAsymmetry::PRunAsymmetry(): **ERROR** alpha parameter no = " << fRunInfo->GetAlphaParamNo();
147 std::cerr << std::endl <<
">> This is out of bound, since there are only " << param->size() <<
" parameters.";
148 std::cerr << std::endl;
153 Bool_t alphaFixedToOne =
false;
155 if (((*param)[fRunInfo->GetAlphaParamNo()-1].fStep == 0.0) &&
156 ((*param)[fRunInfo->GetAlphaParamNo()-1].fValue == 1.0))
157 alphaFixedToOne = true;
160 Bool_t betaFixedToOne =
false;
161 if (fRunInfo->GetBetaParamNo() == -1) {
162 betaFixedToOne = true;
163 }
else if ((fRunInfo->GetBetaParamNo() < 0) || (fRunInfo->GetBetaParamNo() >
static_cast<Int_t
>(param->size()))) {
164 std::cerr << std::endl <<
">> PRunAsymmetry::PRunAsymmetry(): **ERROR** beta parameter no = " << fRunInfo->GetBetaParamNo();
165 std::cerr << std::endl <<
">> This is out of bound, since there are only " << param->size() <<
" parameters.";
166 std::cerr << std::endl;
170 if (((*param)[fRunInfo->GetBetaParamNo()-1].fStep == 0.0) &&
171 ((*param)[fRunInfo->GetBetaParamNo()-1].fValue == 1.0))
172 betaFixedToOne = true;
176 if (alphaFixedToOne && betaFixedToOne)
178 else if (!alphaFixedToOne && betaFixedToOne)
180 else if (alphaFixedToOne && !betaFixedToOne)
229 Double_t chisq = 0.0;
231 Double_t asymFcnValue = 0.0;
235 for (Int_t i=0; i<
fMsrInfo->GetNoOfFuncs(); i++) {
251 a = par[
fRunInfo->GetAlphaParamNo()-1];
263 b = par[
fRunInfo->GetBetaParamNo()-1];
273 a = par[
fRunInfo->GetAlphaParamNo()-1];
281 b = par[
fRunInfo->GetBetaParamNo()-1];
305 #pragma omp parallel for default(shared) private(i,time,diff,asymFcnValue,f) schedule(dynamic,chunk) reduction(+:chisq)
308 time =
fData.GetDataTimeStart() +
static_cast<Double_t
>(i)*
fData.GetDataTimeStep();
310 asymFcnValue = (f*(a*b+1.0)-(a-1.0))/((a+1.0)-f*(a*b-1.0));
311 diff =
fData.GetValue()->at(i) - asymFcnValue;
312 chisq += diff*diff / (
fData.GetError()->at(i)*
fData.GetError()->at(i));
356 std::cout << std::endl <<
"PRunAsymmetry::CalcMaxLikelihood(): not implemented yet ..." << std::endl;
407 TObjArray *tok =
nullptr;
408 TObjString *ostr =
nullptr;
413 tok = fitRange.Tokenize(
" \t");
415 if (tok->GetEntries() == 3) {
417 ostr =
dynamic_cast<TObjString*
>(tok->At(1));
418 str = ostr->GetString();
420 idx = str.First(
"+");
422 str.Remove(0, idx+1);
429 ostr =
dynamic_cast<TObjString*
>(tok->At(2));
430 str = ostr->GetString();
432 idx = str.First(
"-");
434 str.Remove(0, idx+1);
439 }
else if ((tok->GetEntries() > 3) && (tok->GetEntries() % 2 == 1)) {
440 Int_t pos = 2*(
fRunNo+1)-1;
442 if (pos + 1 >= tok->GetEntries()) {
443 std::cerr << std::endl <<
">> PRunAsymmetry::SetFitRangeBin(): **ERROR** invalid FIT_RANGE command found: '" << fitRange <<
"'";
444 std::cerr << std::endl <<
">> will ignore it. Sorry ..." << std::endl;
447 ostr =
static_cast<TObjString*
>(tok->At(pos));
448 str = ostr->GetString();
450 idx = str.First(
"+");
452 str.Remove(0, idx+1);
459 ostr =
static_cast<TObjString*
>(tok->At(pos+1));
460 str = ostr->GetString();
462 idx = str.First(
"-");
464 str.Remove(0, idx+1);
471 std::cerr << std::endl <<
">> PRunAsymmetry::SetFitRangeBin(): **ERROR** invalid FIT_RANGE command found: '" << fitRange <<
"'";
472 std::cerr << std::endl <<
">> will ignore it. Sorry ..." << std::endl;
534 std::vector<Double_t> par;
536 for (UInt_t i=0; i<paramList->size(); i++)
537 par.push_back((*paramList)[i].fValue);
540 for (Int_t i=0; i<
fMsrInfo->GetNoOfFuncs(); i++) {
545 Double_t asymFcnValue = 0.0;
548 for (UInt_t i=0; i<
fData.GetValue()->size(); i++) {
549 time =
fData.GetDataTimeStart() +
static_cast<Double_t
>(i)*
fData.GetDataTimeStep();
556 a = par[
fRunInfo->GetAlphaParamNo()-1];
564 asymFcnValue = (f*(a+1.0)-(a-1.0))/((a+1.0)-f*(a-1.0));
568 b = par[
fRunInfo->GetBetaParamNo()-1];
576 asymFcnValue = f*(b+1.0)/(2.0-f*(b-1.0));
580 a = par[
fRunInfo->GetAlphaParamNo()-1];
588 b = par[
fRunInfo->GetBetaParamNo()-1];
596 asymFcnValue = (f*(a*b+1.0)-(a-1.0))/((a+1.0)-f*(a*b-1.0));
602 fData.AppendTheoryValue(asymFcnValue);
651 std::cerr << std::endl <<
">> PRunAsymmetry::PrepareData(): **ERROR** Couldn't get run " <<
fRunInfo->GetRunName()->Data() <<
"!";
652 std::cerr << std::endl;
669 for (UInt_t i=0; i<
fRunInfo->GetForwardHistoNoSize(); i++) {
670 forwardHistoNo.push_back(
fRunInfo->GetForwardHistoNo(i));
672 if (!runData->
IsPresent(forwardHistoNo[i])) {
673 std::cerr << std::endl <<
">> PRunAsymmetry::PrepareData(): **PANIC ERROR**:";
674 std::cerr << std::endl <<
">> forwardHistoNo found = " << forwardHistoNo[i] <<
", which is NOT present in the data file!?!?";
675 std::cerr << std::endl <<
">> Will quit :-(";
676 std::cerr << std::endl;
678 forwardHistoNo.clear();
679 backwardHistoNo.clear();
683 for (UInt_t i=0; i<
fRunInfo->GetBackwardHistoNoSize(); i++) {
684 backwardHistoNo.push_back(
fRunInfo->GetBackwardHistoNo(i));
686 if (!runData->
IsPresent(backwardHistoNo[i])) {
687 std::cerr << std::endl <<
">> PRunAsymmetry::PrepareData(): **PANIC ERROR**:";
688 std::cerr << std::endl <<
">> backwardHistoNo found = " << backwardHistoNo[i] <<
", which is NOT present in the data file!?!?";
689 std::cerr << std::endl <<
">> Will quit :-(";
690 std::cerr << std::endl;
692 forwardHistoNo.clear();
693 backwardHistoNo.clear();
700 std::cout.precision(10);
701 std::cout << std::endl <<
">> PRunAsymmetry::PrepareData(): time resolution=" << std::fixed << runData->
GetTimeResolution() <<
"(ns)" << std::endl;
704 if (!
GetProperT0(runData, globalBlock, forwardHistoNo, backwardHistoNo)) {
709 std::vector<PDoubleVector> forward, backward;
710 forward.resize(forwardHistoNo.size());
711 for (UInt_t i=0; i<forwardHistoNo.size(); i++) {
712 forward[i].resize(runData->
GetDataBin(forwardHistoNo[i])->size());
713 forward[i] = *runData->
GetDataBin(forwardHistoNo[i]);
720 backward.resize(backwardHistoNo.size());
721 for (UInt_t i=0; i<backwardHistoNo.size(); i++) {
722 backward[i].resize(runData->
GetDataBin(backwardHistoNo[i])->size());
723 backward[i] = *runData->
GetDataBin(backwardHistoNo[i]);
732 if (
fRunInfo->GetRunNameSize() > 1) {
734 std::vector<PDoubleVector> addForward, addBackward;
735 for (UInt_t i=1; i<
fRunInfo->GetRunNameSize(); i++) {
738 if (addRunData ==
nullptr) {
739 std::cerr << std::endl <<
">> PRunAsymmetry::PrepareData(): **ERROR** Couldn't get addrun " <<
fRunInfo->GetRunName(i)->Data() <<
"!";
740 std::cerr << std::endl;
746 addForward.resize(forwardHistoNo.size());
747 for (UInt_t j=0; j<forwardHistoNo.size(); j++) {
748 addForward[j].resize(addRunData->
GetDataBin(forwardHistoNo[j])->size());
749 addForward[j] = *addRunData->
GetDataBin(forwardHistoNo[j]);
753 addBackward.resize(backwardHistoNo.size());
754 for (UInt_t j=0; j<backwardHistoNo.size(); j++) {
755 addBackward[j].resize(addRunData->
GetDataBin(backwardHistoNo[j])->size());
756 addBackward[j] = *addRunData->
GetDataBin(backwardHistoNo[j]);
762 for (UInt_t k=0; k<forwardHistoNo.size(); k++) {
763 addRunSize = addRunData->
GetDataBin(forwardHistoNo[k])->size();
764 for (UInt_t j=0; j<addRunData->
GetDataBin(forwardHistoNo[k])->size(); j++) {
766 if ((
static_cast<Int_t
>(j)+
static_cast<Int_t
>(
fAddT0s[i-1][2*k])-
static_cast<Int_t
>(
fT0s[2*k]) >= 0) &&
767 (j+
static_cast<Int_t
>(
fAddT0s[i-1][2*k])-
static_cast<Int_t
>(
fT0s[2*k]) < addRunSize)) {
768 forward[k][j] += addForward[k][j+
static_cast<Int_t
>(
fAddT0s[i-1][2*k])-
static_cast<Int_t
>(
fT0s[2*k])];
774 for (UInt_t k=0; k<backwardHistoNo.size(); k++) {
775 addRunSize = addRunData->
GetDataBin(backwardHistoNo[k])->size();
776 for (UInt_t j=0; j<addRunData->
GetDataBin(backwardHistoNo[k])->size(); j++) {
778 if ((
static_cast<Int_t
>(j)+
static_cast<Int_t
>(
fAddT0s[i-1][2*k+1])-
static_cast<Int_t
>(
fT0s[2*k+1]) >= 0) &&
779 (j+
static_cast<Int_t
>(
fAddT0s[i-1][2*k+1])-
static_cast<Int_t
>(
fT0s[2*k+1]) < addRunSize)) {
780 backward[k][j] += addBackward[k][j+
static_cast<Int_t
>(
fAddT0s[i-1][2*k+1])-
static_cast<Int_t
>(
fT0s[2*k+1])];
789 for (UInt_t i=0; i<
fForward.size(); i++) {
793 for (UInt_t i=0; i<
fBackward.size(); i++) {
798 for (UInt_t i=1; i<forwardHistoNo.size(); i++) {
799 for (UInt_t j=0; j<runData->
GetDataBin(forwardHistoNo[i])->size(); j++) {
802 fForward[j] += forward[i][j+
static_cast<Int_t
>(
fT0s[2*i])-
static_cast<Int_t
>(
fT0s[0])];
808 for (UInt_t i=1; i<backwardHistoNo.size(); i++) {
809 for (UInt_t j=0; j<runData->
GetDataBin(backwardHistoNo[i])->size(); j++) {
812 fBackward[j] += backward[i][j+
static_cast<Int_t
>(
fT0s[2*i+1])-
static_cast<Int_t
>(
fT0s[1])];
819 if (
fRunInfo->GetBkgRange(0) >= 0) {
823 fRunInfo->SetBkgRange(
static_cast<Int_t
>(
fT0s[0]*0.1), 0);
824 fRunInfo->SetBkgRange(
static_cast<Int_t
>(
fT0s[0]*0.6), 1);
825 fRunInfo->SetBkgRange(
static_cast<Int_t
>(
fT0s[1]*0.1), 2);
826 fRunInfo->SetBkgRange(
static_cast<Int_t
>(
fT0s[1]*0.6), 3);
827 std::cerr << std::endl <<
">> PRunAsymmetry::PrepareData(): **WARNING** Neither fix background nor background bins are given!";
828 std::cerr << std::endl <<
">> Will try the following:";
829 std::cerr << std::endl <<
">> forward: bkg start = " <<
fRunInfo->GetBkgRange(0) <<
", bkg end = " <<
fRunInfo->GetBkgRange(1);
830 std::cerr << std::endl <<
">> backward: bkg start = " <<
fRunInfo->GetBkgRange(2) <<
", bkg end = " <<
fRunInfo->GetBkgRange(3);
831 std::cerr << std::endl <<
">> NO WARRANTY THAT THIS MAKES ANY SENSE! Better check ...";
832 std::cerr << std::endl;
841 UInt_t histoNo[2] = {forwardHistoNo[0], backwardHistoNo[0]};
858 if (
fMsrInfo->GetMsrPlotList()->at(0).fRRFPacking == 0)
869 forwardHistoNo.clear();
870 backwardHistoNo.clear();
897 std::cerr <<
"PRunAsymmetry::SubtractFixBkg(): **ERROR** no fixed bkg for forward set. Will do nothing here." << std::endl;
901 std::cerr <<
"PRunAsymmetry::SubtractFixBkg(): **ERROR** no fixed bkg for backward set. Will do nothing here." << std::endl;
902 std::cerr <<
" you need an entry like:" << std::endl;
903 std::cerr <<
" backgr.fix 2 3" << std::endl;
904 std::cerr <<
" i.e. two entries for forward and backward." << std::endl;
911 for (UInt_t i=0; i<
fForward.size(); i++) {
954 Double_t beamPeriod = 0.0;
957 if (
fRunInfo->GetInstitute()->Contains(
"psi"))
959 else if (
fRunInfo->GetInstitute()->Contains(
"ral"))
961 else if (
fRunInfo->GetInstitute()->Contains(
"triumf"))
969 for (UInt_t i=0; i<2; i++) {
970 if (end[i] < start[i]) {
971 std::cout << std::endl <<
">> PRunAsymmetry::SubtractEstimatedBkg(): end = " << end[i] <<
" > start = " << start[i] <<
"! Will swap them!";
972 UInt_t keep = end[i];
979 for (UInt_t i=0; i<2; i++) {
980 if (beamPeriod != 0.0) {
982 UInt_t fullCycles =
static_cast<UInt_t
>(timeBkg/beamPeriod);
985 std::cout <<
">> PRunAsymmetry::SubtractEstimatedBkg(): Background " << start[i] <<
", " << end[i] << std::endl;
986 if (end[i] == start[i])
987 end[i] =
fRunInfo->GetBkgRange(2*i+1);
992 if ((start[0] < 0) || (start[0] >=
fForward.size()) ||
993 (start[1] < 0) || (start[1] >=
fBackward.size())) {
994 std::cerr << std::endl <<
">> PRunAsymmetry::SubtractEstimatedBkg(): **ERROR** background bin values out of bound!";
995 std::cerr << std::endl <<
">> histo lengths (f/b) = (" <<
fForward.size() <<
"/" <<
fBackward.size() <<
").";
996 std::cerr << std::endl <<
">> background start (f/b) = (" << start[0] <<
"/" << start[1] <<
").";
1001 if ((end[0] < 0) || (end[0] >=
fForward.size()) ||
1002 (end[1] < 0) || (end[1] >=
fBackward.size())) {
1003 std::cerr << std::endl <<
">> PRunAsymmetry::SubtractEstimatedBkg(): **ERROR** background bin values out of bound!";
1004 std::cerr << std::endl <<
">> histo lengths (f/b) = (" <<
fForward.size() <<
"/" <<
fBackward.size() <<
").";
1005 std::cerr << std::endl <<
">> background end (f/b) = (" << end[0] <<
"/" << end[1] <<
").";
1010 Double_t bkg[2] = {0.0, 0.0};
1011 Double_t errBkg[2] = {0.0, 0.0};
1014 for (UInt_t i=start[0]; i<=end[0]; i++)
1016 errBkg[0] = TMath::Sqrt(bkg[0])/(end[0] - start[0] + 1);
1017 bkg[0] /=
static_cast<Double_t
>(end[0] - start[0] + 1);
1018 std::cout << std::endl <<
">> estimated forward histo background: " << bkg[0];
1021 for (UInt_t i=start[1]; i<=end[1]; i++)
1023 errBkg[1] = TMath::Sqrt(bkg[1])/(end[1] - start[1] + 1);
1024 bkg[1] /=
static_cast<Double_t
>(end[1] - start[1] + 1);
1025 std::cout << std::endl <<
">> estimated backward histo background: " << bkg[1] << std::endl;
1028 Double_t errVal = 0.0;
1029 for (UInt_t i=0; i<
fForward.size(); i++) {
1031 errVal = TMath::Sqrt(
fForward[i]+errBkg[0]*errBkg[0]);
1036 errVal = TMath::Sqrt(
fBackward[i]+errBkg[1]*errBkg[1]);
1043 for (UInt_t i=0; i<
fForward.size(); i++) {
1048 fRunInfo->SetBkgEstimated(bkg[0], 0);
1049 fRunInfo->SetBkgEstimated(bkg[1], 1);
1085 Double_t value = 0.0;
1086 Double_t error = 0.0;
1133 UInt_t noOfBins = forwardPacked.
GetValue()->size();
1134 if (forwardPacked.
GetValue()->size() != backwardPacked.
GetValue()->size()) {
1136 noOfBins = backwardPacked.
GetValue()->size();
1141 Double_t f, b, ef, eb;
1146 for (UInt_t i=0; i<noOfBins; i++) {
1148 f = forwardPacked.
GetValue()->at(i);
1149 b = backwardPacked.
GetValue()->at(i);
1150 ef = forwardPacked.
GetError()->at(i);
1151 eb = backwardPacked.
GetError()->at(i);
1154 asym = (f-b) / (f+b);
1157 fData.AppendValue(asym);
1160 error = 2.0/((f+b)*(f+b))*TMath::Sqrt(b*b*ef*ef+eb*eb*f*f);
1163 fData.AppendErrorValue(error);
1205 if (
fMsrInfo->GetMsrPlotList()->at(0).fViewPacking > 0) {
1206 packing =
fMsrInfo->GetMsrPlotList()->at(0).fViewPacking;
1210 std::vector<Double_t> par;
1212 for (UInt_t i=0; i<paramList->size(); i++)
1213 par.push_back((*paramList)[i].fValue);
1221 Int_t t0[2] = {
static_cast<Int_t
>(
fT0s[0]),
static_cast<Int_t
>(
fT0s[1])};
1225 if (start[0]-t0[0] != start[1]-t0[1]) {
1226 if (abs(start[0]-t0[0]) > abs(start[1]-t0[1])) {
1228 fgb[1] = t0[1] + start[0]-t0[0];
1229 std::cerr << std::endl <<
">> PRunAsymmetry::PrepareViewData(): **WARNING** needed to shift backward fgb from ";
1230 std::cerr << start[1] <<
" to " << fgb[1] << std::endl;
1232 fgb[0] = t0[0] + start[1]-t0[1];
1234 std::cerr << std::endl <<
">> PRunAsymmetry::PrepareViewData(): **WARNING** needed to shift forward fgb from ";
1235 std::cerr << start[0] <<
" to " << fgb[0] << std::endl;
1242 Int_t val = fgb[0]-packing*(fgb[0]/packing);
1244 if (fgb[1] - fgb[0] < 0)
1246 }
while (val + fgb[1] - fgb[0] < 0);
1249 start[1] = val + fgb[1] - fgb[0];
1252 UInt_t noOfBins0 = (runData->
GetDataBin(histoNo[0])->size()-start[0])/packing;
1253 UInt_t noOfBins1 = (runData->
GetDataBin(histoNo[1])->size()-start[1])/packing;
1254 if (noOfBins0 > noOfBins1)
1255 noOfBins0 = noOfBins1;
1256 end[0] = start[0] + noOfBins0 * packing;
1257 end[1] = start[1] + noOfBins0 * packing;
1261 for (UInt_t i=0; i<2; i++) {
1262 if (end[i] < start[i]) {
1263 Int_t keep = end[i];
1268 if ((start[i] < 0) || (start[i] >
static_cast<Int_t
>(runData->
GetDataBin(histoNo[i])->size()))) {
1269 std::cerr << std::endl <<
">> PRunAsymmetry::PrepareViewData(): **ERROR** start data bin doesn't make any sense!";
1270 std::cerr << std::endl;
1274 if ((end[i] < 0) || (end[i] >
static_cast<Int_t
>(runData->
GetDataBin(histoNo[i])->size()))) {
1275 std::cerr << std::endl <<
">> PRunAsymmetry::PrepareViewData(): **ERROR** end data bin doesn't make any sense!";
1276 std::cerr << std::endl;
1280 if ((t0[i] < 0) || (t0[i] >
static_cast<Int_t
>(runData->
GetDataBin(histoNo[i])->size()))) {
1281 std::cerr << std::endl <<
">> PRunAsymmetry::PrepareViewData(): **ERROR** t0 data bin doesn't make any sense!";
1282 std::cerr << std::endl;
1290 Double_t value = 0.0;
1291 Double_t error = 0.0;
1294 for (Int_t i=start[0]; i<end[0]; i++) {
1299 if (((i-start[0]) % packing == 0) && (i != start[0])) {
1317 for (Int_t i=start[1]; i<end[1]; i++) {
1322 if (((i-start[1]) % packing == 0) && (i != start[1])) {
1340 UInt_t noOfBins = forwardPacked.
GetValue()->size();
1341 if (forwardPacked.
GetValue()->size() != backwardPacked.
GetValue()->size()) {
1343 noOfBins = backwardPacked.
GetValue()->size();
1348 Double_t f, b, ef, eb, alpha = 1.0, beta = 1.0;
1351 fData.SetDataTimeStart(
fTimeResolution*((
static_cast<Double_t
>(start[0])-0.5) +
static_cast<Double_t
>(packing)/2.0 -
static_cast<Double_t
>(t0[0])));
1362 alpha = par[
fRunInfo->GetAlphaParamNo()-1];
1374 beta = par[
fRunInfo->GetBetaParamNo()-1];
1384 alpha = par[
fRunInfo->GetAlphaParamNo()-1];
1392 beta = par[
fRunInfo->GetBetaParamNo()-1];
1404 for (UInt_t i=0; i<forwardPacked.
GetValue()->size(); i++) {
1406 f = forwardPacked.
GetValue()->at(i);
1407 b = backwardPacked.
GetValue()->at(i);
1408 ef = forwardPacked.
GetError()->at(i);
1409 eb = backwardPacked.
GetError()->at(i);
1412 asym = (alpha*f-b) / (alpha*beta*f+b);
1415 fData.AppendValue(asym);
1418 error = 2.0/((f+b)*(f+b))*TMath::Sqrt(b*b*ef*ef+eb*eb*f*f);
1421 fData.AppendErrorValue(error);
1434 for (Int_t i=0; i<
fMsrInfo->GetNoOfFuncs(); i++) {
1440 UInt_t size = runData->
GetDataBin(histoNo[0])->size()/packing;
1443 fData.SetTheoryTimeStart(
fData.GetDataTimeStart());
1445 fData.SetTheoryTimeStep(
fData.GetDataTimeStep());
1449 fData.SetTheoryTimeStep(
fData.GetDataTimeStep()/(Double_t)factor);
1452 for (UInt_t i=0; i<size; i++) {
1453 time =
fData.GetTheoryTimeStart() +
static_cast<Double_t
>(i)*
fData.GetTheoryTimeStep();
1455 if (fabs(value) > 10.0) {
1458 fData.AppendTheoryValue(value);
1496 std::vector<Double_t> par;
1498 for (UInt_t i=0; i<paramList->size(); i++)
1499 par.push_back((*paramList)[i].fValue);
1508 Int_t t0[2] = {
static_cast<Int_t
>(
fT0s[0]),
static_cast<Int_t
>(
fT0s[1])};
1509 UInt_t packing =
fMsrInfo->GetMsrPlotList()->at(0).fRRFPacking;
1513 if (start[0]-t0[0] != start[1]-t0[1]) {
1514 if (abs(start[0]-t0[0]) > abs(start[1]-t0[1])) {
1516 fgb[1] = t0[1] + start[0]-t0[0];
1517 std::cerr << std::endl <<
">> PRunAsymmetry::PrepareRRFViewData(): **WARNING** needed to shift backward fgb from ";
1518 std::cerr << start[1] <<
" to " << fgb[1] << std::endl;
1520 fgb[0] = t0[0] + start[1]-t0[1];
1522 std::cerr << std::endl <<
">> PRunAsymmetry::PrepareRRFViewData(): **WARNING** needed to shift forward fgb from ";
1523 std::cerr << start[1] <<
" to " << fgb[0] << std::endl;
1530 Int_t val = fgb[0]-packing*(fgb[0]/packing);
1532 if (fgb[1] - fgb[0] < 0)
1534 }
while (val + fgb[1] - fgb[0] < 0);
1537 start[1] = val + fgb[1] - fgb[0];
1540 UInt_t noOfBins0 = runData->
GetDataBin(histoNo[0])->size()-start[0];
1541 UInt_t noOfBins1 = runData->
GetDataBin(histoNo[1])->size()-start[1];
1542 if (noOfBins0 > noOfBins1)
1543 noOfBins0 = noOfBins1;
1544 end[0] = start[0] + noOfBins0;
1545 end[1] = start[1] + noOfBins0;
1549 for (UInt_t i=0; i<2; i++) {
1550 if (end[i] < start[i]) {
1551 Int_t keep = end[i];
1556 if ((start[i] < 0) || (start[i] >
static_cast<Int_t
>(runData->
GetDataBin(histoNo[i])->size()))) {
1557 std::cerr << std::endl <<
">> PRunAsymmetry::PrepareRRFViewData(): **ERROR** start data bin doesn't make any sense!";
1558 std::cerr << std::endl;
1562 if ((end[i] < 0) || (end[i] >
static_cast<Int_t
>(runData->
GetDataBin(histoNo[i])->size()))) {
1563 std::cerr << std::endl <<
">> PRunAsymmetry::PrepareRRFViewData(): **ERROR** end data bin doesn't make any sense!";
1564 std::cerr << std::endl;
1568 if ((t0[i] < 0) || (t0[i] >
static_cast<Int_t
>(runData->
GetDataBin(histoNo[i])->size()))) {
1569 std::cerr << std::endl <<
">> PRunAsymmetry::PrepareRRFViewData(): **ERROR** t0 data bin doesn't make any sense!";
1570 std::cerr << std::endl;
1581 Double_t error = 0.0;
1583 for (Int_t i=start[0]; i<end[0]; i++) {
1588 for (Int_t i=start[1]; i<end[1]; i++) {
1594 UInt_t noOfBins = forward.size();
1595 if (forward.size() != backward.size()) {
1596 if (forward.size() > backward.size())
1597 noOfBins = backward.size();
1603 Double_t f, b, ef, eb, alpha = 1.0, beta = 1.0;
1613 alpha = par[
fRunInfo->GetAlphaParamNo()-1];
1625 beta = par[
fRunInfo->GetBetaParamNo()-1];
1635 alpha = par[
fRunInfo->GetAlphaParamNo()-1];
1643 beta = par[
fRunInfo->GetBetaParamNo()-1];
1655 for (UInt_t i=0; i<noOfBins; i++) {
1660 eb = backwardErr[i];
1663 asym = (alpha*f-b) / (alpha*beta*f+b);
1666 asymmetry.push_back(asym);
1669 error = 2.0/((f+b)*(f+b))*TMath::Sqrt(b*b*ef*ef+eb*eb*f*f);
1672 asymmetryErr.push_back(error);
1687 Double_t gammaRRF = 0.0, wRRF = 0.0, phaseRRF = 0.0;
1690 switch (
fMsrInfo->GetMsrPlotList()->at(0).fRRFUnit) {
1692 gammaRRF = TMath::TwoPi()*1.0e-3;
1695 gammaRRF = TMath::TwoPi();
1707 gammaRRF = TMath::TwoPi();
1710 wRRF = gammaRRF *
fMsrInfo->GetMsrPlotList()->at(0).fRRFFreq;
1711 phaseRRF =
fMsrInfo->GetMsrPlotList()->at(0).fRRFPhase / 180.0 * TMath::Pi();
1713 for (UInt_t i=0; i<asymmetry.size(); i++) {
1714 time =
fTimeResolution*(
static_cast<Double_t
>(start[0])-t0[0]+
static_cast<Double_t
>(i));
1715 asymmetry[i] *= 2.0*TMath::Cos(wRRF*time+phaseRRF);
1721 Double_t value = 0.0;
1723 for (UInt_t i=0; i<asymmetry.size(); i++) {
1724 if ((i % packing == 0) && (i != 0)) {
1726 fData.AppendValue(value);
1727 fData.AppendErrorValue(TMath::Sqrt(error)/packing);
1732 value += asymmetry[i];
1733 error += asymmetryErr[i]*asymmetryErr[i];
1738 fData.SetDataTimeStart(
fTimeResolution*((
static_cast<Double_t
>(start[0])-0.5) +
static_cast<Double_t
>(packing)/2.0 -
static_cast<Double_t
>(t0[0])));
1745 UInt_t rebinRRF =
static_cast<UInt_t
>((TMath::Pi()/2.0/wRRF)/
fTimeResolution);
1746 fData.SetTheoryTimeStart(
fData.GetDataTimeStart());
1747 fData.SetTheoryTimeStep(TMath::Pi()/2.0/wRRF/rebinRRF);
1750 for (Int_t i=0; i<
fMsrInfo->GetNoOfFuncs(); i++) {
1754 Double_t theoryValue;
1755 for (UInt_t i=0; i<asymmetry.size(); i++) {
1756 time =
fData.GetTheoryTimeStart() +
static_cast<Double_t
>(i)*
fData.GetTheoryTimeStep();
1758 theoryValue *= 2.0*TMath::Cos(wRRF * time + phaseRRF);
1760 if (fabs(theoryValue) > 10.0) {
1764 fData.AppendTheoryValue(theoryValue);
1772 Double_t dval = 0.0;
1773 for (UInt_t i=0; i<
fData.GetTheory()->size(); i++) {
1774 if ((i % rebinRRF == 0) && (i != 0)) {
1775 theo.push_back(dval/rebinRRF);
1778 dval +=
fData.GetTheory()->at(i);
1780 fData.ReplaceTheory(theo);
1784 fData.SetTheoryTimeStart(
fData.GetTheoryTimeStart()+
static_cast<Double_t
>(rebinRRF-1)*
fData.GetTheoryTimeStep()/2.0);
1785 fData.SetTheoryTimeStep(rebinRRF*
fData.GetTheoryTimeStep());
1802 backwardErr.clear();
1804 asymmetryErr.clear();
1846 size_t size = 2*forwardHistoNo.size();
1847 if (backwardHistoNo.size() > forwardHistoNo.size())
1848 size = 2*backwardHistoNo.size();
1850 for (UInt_t i=0; i<
fT0s.size(); i++) {
1855 for (UInt_t i=0; i<
fRunInfo->GetT0BinSize(); i++) {
1861 if (
fT0s[i] == -1) {
1867 for (UInt_t i=0; i<forwardHistoNo.size(); i++) {
1868 if (
fT0s[2*i] == -1.0)
1869 if (runData->
GetT0Bin(forwardHistoNo[i]) > 0.0) {
1874 for (UInt_t i=0; i<backwardHistoNo.size(); i++) {
1875 if (
fT0s[2*i+1] == -1.0)
1876 if (runData->
GetT0Bin(backwardHistoNo[i]) > 0.0) {
1883 for (UInt_t i=0; i<forwardHistoNo.size(); i++) {
1884 if (
fT0s[2*i] == -1.0) {
1888 std::cerr << std::endl <<
">> PRunAsymmetry::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!";
1889 std::cerr << std::endl <<
">> run: " <<
fRunInfo->GetRunName()->Data();
1890 std::cerr << std::endl <<
">> will try the estimated one: forward t0 = " << runData->
GetT0BinEstimated(forwardHistoNo[i]);
1891 std::cerr << std::endl <<
">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
1892 std::cerr << std::endl;
1895 for (UInt_t i=0; i<backwardHistoNo.size(); i++) {
1896 if (
fT0s[2*i+1] == -1.0) {
1900 std::cerr << std::endl <<
">> PRunAsymmetry::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!";
1901 std::cerr << std::endl <<
">> run: " <<
fRunInfo->GetRunName()->Data();
1902 std::cerr << std::endl <<
">> will try the estimated one: backward t0 = " << runData->
GetT0BinEstimated(backwardHistoNo[i]);
1903 std::cerr << std::endl <<
">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
1904 std::cerr << std::endl;
1909 for (UInt_t i=0; i<forwardHistoNo.size(); i++) {
1910 if ((
fT0s[2*i] < 0) || (
fT0s[2*i] >
static_cast<Int_t
>(runData->
GetDataBin(forwardHistoNo[i])->size()))) {
1911 std::cerr << std::endl <<
">> PRunAsymmetry::GetProperT0(): **ERROR** t0 data bin (" <<
fT0s[2*i] <<
") doesn't make any sense!";
1912 std::cerr << std::endl <<
">> forwardHistoNo " << forwardHistoNo[i];
1913 std::cerr << std::endl;
1917 for (UInt_t i=0; i<backwardHistoNo.size(); i++) {
1918 if ((
fT0s[2*i+1] < 0) || (
fT0s[2*i+1] >
static_cast<Int_t
>(runData->
GetDataBin(backwardHistoNo[i])->size()))) {
1919 std::cerr << std::endl <<
">> PRunAsymmetry::PrepareData(): **ERROR** t0 data bin (" <<
fT0s[2*i+1] <<
") doesn't make any sense!";
1920 std::cerr << std::endl <<
">> backwardHistoNo " << backwardHistoNo[i];
1921 std::cerr << std::endl;
1927 if (
fRunInfo->GetRunNameSize() > 1) {
1930 for (UInt_t i=1; i<
fRunInfo->GetRunNameSize(); i++) {
1933 if (addRunData == 0) {
1934 std::cerr << std::endl <<
">> PRunAsymmetry::GetProperT0(): **ERROR** Couldn't get addrun " <<
fRunInfo->GetRunName(i)->Data() <<
"!";
1935 std::cerr << std::endl;
1942 fAddT0s[i-1].resize(2*forwardHistoNo.size());
1943 for (UInt_t j=0; j<
fAddT0s[i-1].size(); j++) {
1948 for (Int_t j=0; j<
fRunInfo->GetAddT0BinSize(i-1); j++) {
1953 for (UInt_t j=0; j<forwardHistoNo.size(); j++) {
1954 if (
fAddT0s[i-1][2*j] == -1.0)
1955 if (addRunData->
GetT0Bin(forwardHistoNo[j]) > 0.0) {
1960 for (UInt_t j=0; j<backwardHistoNo.size(); j++) {
1961 if (
fAddT0s[i-1][2*j+1] == -1.0)
1962 if (addRunData->
GetT0Bin(backwardHistoNo[j]) > 0.0) {
1969 for (UInt_t j=0; j<forwardHistoNo.size(); j++) {
1970 if (
fAddT0s[i-1][2*j] == -1.0) {
1974 std::cerr << std::endl <<
">> PRunAsymmetry::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!";
1975 std::cerr << std::endl <<
">> run: " <<
fRunInfo->GetRunName(i)->Data();
1976 std::cerr << std::endl <<
">> will try the estimated one: forward t0 = " << addRunData->
GetT0BinEstimated(forwardHistoNo[j]);
1977 std::cerr << std::endl <<
">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
1978 std::cerr << std::endl;
1981 for (UInt_t j=0; j<backwardHistoNo.size(); j++) {
1982 if (
fAddT0s[i-1][2*j+1] == -1.0) {
1986 std::cerr << std::endl <<
">> PRunAsymmetry::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!";
1987 std::cerr << std::endl <<
">> run: " <<
fRunInfo->GetRunName(i)->Data();
1988 std::cerr << std::endl <<
">> will try the estimated one: backward t0 = " << runData->
GetT0BinEstimated(backwardHistoNo[j]);
1989 std::cerr << std::endl <<
">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
1990 std::cerr << std::endl;
2034 if (start[0] == -1) {
2035 start[0] =
fMsrInfo->GetMsrGlobal()->GetDataRange(0);
2037 if (start[1] == -1) {
2038 start[1] =
fMsrInfo->GetMsrGlobal()->GetDataRange(2);
2041 end[0] =
fMsrInfo->GetMsrGlobal()->GetDataRange(1);
2044 end[1] =
fMsrInfo->GetMsrGlobal()->GetDataRange(3);
2047 Double_t t0[2] = {
fT0s[0],
fT0s[1]};
2052 start[0] =
static_cast<Int_t
>(t0[0])+offset;
2053 fRunInfo->SetDataRange(start[0], 0);
2054 std::cerr << std::endl <<
">> PRunAsymmetry::GetProperDataRange(): **WARNING** data range (forward) was not provided, will try data range start = t0+" << offset <<
"(=10ns) = " << start[0] <<
".";
2055 std::cerr << std::endl <<
">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE.";
2056 std::cerr << std::endl;
2059 start[1] =
static_cast<Int_t
>(t0[1])+offset;
2060 fRunInfo->SetDataRange(start[1], 2);
2061 std::cerr << std::endl <<
">> PRunAsymmetry::GetProperDataRange(): **WARNING** data range (backward) was not provided, will try data range start = t0+" << offset <<
"(=10ns) = " << start[1] <<
".";
2062 std::cerr << std::endl <<
">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE.";
2063 std::cerr << std::endl;
2066 end[0] = runData->
GetDataBin(histoNo[0])->size();
2068 std::cerr << std::endl <<
">> PRunAsymmetry::GetProperDataRange(): **WARNING** data range (forward) was not provided, will try data range end = " << end[0] <<
".";
2069 std::cerr << std::endl <<
">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE.";
2070 std::cerr << std::endl;
2073 end[1] = runData->
GetDataBin(histoNo[1])->size();
2075 std::cerr << std::endl <<
">> PRunAsymmetry::GetProperDataRange(): **WARNING** data range (backward) was not provided, will try data range end = " << end[1] <<
".";
2076 std::cerr << std::endl <<
">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE.";
2077 std::cerr << std::endl;
2082 for (UInt_t i=0; i<2; i++) {
2083 if (end[i] < start[i]) {
2084 Int_t keep = end[i];
2089 if ((start[i] < 0) || (start[i] >
static_cast<Int_t
>(runData->
GetDataBin(histoNo[i])->size()))) {
2090 std::cerr << std::endl <<
">> PRunAsymmetry::GetProperDataRange(): **ERROR** start data bin doesn't make any sense!";
2091 std::cerr << std::endl;
2096 std::cerr << std::endl <<
">> PRunAsymmetry::GetProperDataRange(): **ERROR** end data bin (" << end[i] <<
") doesn't make any sense!";
2097 std::cerr << std::endl;
2100 if (end[i] >
static_cast<Int_t
>(runData->
GetDataBin(histoNo[i])->size())) {
2101 std::cerr << std::endl <<
">> PRunAsymmetry::GetProperDataRange(): **WARNING** end data bin (" << end[i] <<
") > histo length (" <<
static_cast<Int_t
>(runData->
GetDataBin(histoNo[i])->size()) <<
").";
2102 std::cerr << std::endl <<
">> Will set end = (histo length - 1). Consider to change it in the msr-file." << std::endl;
2103 std::cerr << std::endl;
2104 end[i] =
static_cast<Int_t
>(runData->
GetDataBin(histoNo[i])->size())-1;
2107 if ((t0[i] < 0) || (t0[i] >
static_cast<Int_t
>(runData->
GetDataBin(histoNo[i])->size()))) {
2108 std::cerr << std::endl <<
">> PRunAsymmetry::GetProperDataRange(): **ERROR** t0 data bin doesn't make any sense!";
2109 std::cerr << std::endl;
2115 if (fabs(
static_cast<Double_t
>(start[0])-t0[0]) > fabs(
static_cast<Double_t
>(start[1])-t0[1])){
2116 start[1] =
static_cast<Int_t
>(t0[1] +
static_cast<Double_t
>(start[0]) - t0[0]);
2117 end[1] =
static_cast<Int_t
>(t0[1] +
static_cast<Double_t
>(end[0]) - t0[0]);
2118 std::cerr << std::endl <<
">> PRunAsymmetry::GetProperDataRange **WARNING** needed to shift backward data range.";
2119 std::cerr << std::endl <<
">> given: " <<
fRunInfo->GetDataRange(2) <<
", " <<
fRunInfo->GetDataRange(3);
2120 std::cerr << std::endl <<
">> used : " << start[1] <<
", " << end[1];
2121 std::cerr << std::endl;
2123 if (fabs(
static_cast<Double_t
>(start[0])-t0[0]) < fabs(
static_cast<Double_t
>(start[1])-t0[1])){
2124 start[0] =
static_cast<Int_t
>(t0[0] +
static_cast<Double_t
>(start[1]) - t0[1]);
2125 end[0] =
static_cast<Int_t
>(t0[0] +
static_cast<Double_t
>(end[1]) - t0[1]);
2126 std::cerr << std::endl <<
">> PRunAsymmetry::GetProperDataRange **WARNING** needed to shift forward data range.";
2127 std::cerr << std::endl <<
">> given: " <<
fRunInfo->GetDataRange(0) <<
", " <<
fRunInfo->GetDataRange(1);
2128 std::cerr << std::endl <<
">> used : " << start[0] <<
", " << end[0];
2129 std::cerr << std::endl;
2142 std::cerr << std::endl <<
">> PRunAsymmetry::GetProperDataRange **WARNING** needed to shift forward lgb,";
2143 std::cerr << std::endl <<
">> from " <<
fGoodBins[1] <<
" to " <<
fForward.size()-1 << std::endl;
2149 std::cerr << std::endl <<
">> PRunAsymmetry::GetProperDataRange **WARNING** needed to shift backward lgb,";
2150 std::cerr << std::endl <<
">> from " <<
fGoodBins[1] <<
" to " <<
fForward.size()-1 << std::endl;
2210 std::cerr <<
">> PRunSingleHisto::GetProperFitRange(): **WARNING** Couldn't get fit start/end time!" << std::endl;
2211 std::cerr <<
">> Will set it to fgb/lgb which given in time is: " <<
fFitStartTime <<
"..." <<
fFitEndTime <<
" (usec)" << std::endl;
std::vector< UInt_t > PUIntVector
#define ACCEL_PERIOD_TRIUMF
TRIUMF accelerator cycle: 43.37 ns.
@ kFit
Fitting mode - perform least-squares fit to data.
@ kView
Viewing mode - display data and theory without fitting.
#define RRF_UNIT_MHz
Frequency in MHz (megahertz)
#define MSR_PARAM_FUN_OFFSET
Offset added to function indices for parameter parsing.
std::vector< PMsrParamStructure > PMsrParamList
#define RRF_UNIT_Mcs
Angular frequency in Mc/s (Mega-cycles per second)
#define RRF_UNIT_G
Equivalent magnetic field in Gauss (G)
#define RRF_UNIT_kHz
Frequency in kHz (kilohertz)
#define ACCEL_PERIOD_PSI
PSI (Paul Scherrer Institute) accelerator cycle: 19.75 ns.
#define RRF_UNIT_T
Equivalent magnetic field in Tesla (T)
std::vector< Double_t > PDoubleVector
#define ACCEL_PERIOD_RAL
RAL (Rutherford Appleton Lab) - pulsed beam.
virtual void SetFitRange(Double_t dval, UInt_t idx)
virtual Double_t GetFitRange(UInt_t idx)
virtual UInt_t GetT0BinSize()
virtual Bool_t IsFitRangeInBin()
virtual Int_t GetFitRangeOffset(UInt_t idx)
virtual Double_t GetT0Bin(UInt_t idx=0)
MSR file parser and manager for the musrfit framework.
virtual PMsrParamList * GetMsrParamList()
Returns pointer to fit parameter list.
virtual const PDoubleVector * GetDataBin(const UInt_t histoNo)
virtual const Double_t GetT0Bin(const UInt_t histoNo)
virtual const Double_t GetTimeResolution()
virtual const Bool_t IsPresent(UInt_t histoNo)
virtual const UInt_t GetNoOfTemperatures()
virtual const Double_t GetField()
virtual const Double_t GetEnergy()
virtual const Double_t GetT0BinEstimated(const UInt_t histoNo)
virtual const PDoublePairVector * GetTemperature() const
UInt_t fNoOfFitBins
Number of bins included in the fit.
PRunAsymmetry()
Default constructor.
Int_t fPacking
Bin packing factor from RUN or GLOBAL block.
PDoubleVector fForwardErr
Forward detector histogram errors.
virtual void GetProperFitRange(PMsrGlobalBlock *globalBlock)
Determines the proper fit range from global block.
virtual Bool_t GetProperT0(PRawRunData *runData, PMsrGlobalBlock *globalBlock, PUIntVector &forwardHisto, PUIntVector &backwardHistoNo)
Retrieves proper t0 values for all histograms.
Bool_t SubtractFixBkg()
Subtracts fixed background from histograms.
PDoubleVector fBackwardErr
Backward detector histogram errors.
virtual void CalcNoOfFitBins()
Calculates the number of bins to be fitted.
virtual Double_t CalcChiSquareExpected(const std::vector< Double_t > &par)
Calculates expected chi-square (for statistical analysis).
virtual void CalcTheory()
Calculates theoretical asymmetry function.
virtual Bool_t PrepareViewData(PRawRunData *runData, UInt_t histoNo[2])
Prepares data for viewing/plotting.
UInt_t fAlphaBetaTag
Tag indicating α/β configuration: 1=both unity, 2=α free/β unity, 3=α unity/β free,...
virtual Bool_t PrepareFitData()
Prepares data specifically for fitting.
Int_t fGoodBins[4]
Good bin boundaries: [0]=forward first, [1]=forward last, [2]=backward first, [3]=backward last.
Int_t fEndTimeBin
Last bin index for fitting.
virtual Double_t CalcChiSquare(const std::vector< Double_t > &par)
Calculates chi-square for the current parameter set.
virtual ~PRunAsymmetry()
Destructor.
virtual Double_t CalcMaxLikelihood(const std::vector< Double_t > &par)
Calculates maximum likelihood estimator.
virtual Bool_t PrepareRRFViewData(PRawRunData *runData, UInt_t histoNo[2])
Prepares rotating reference frame (RRF) data for viewing.
virtual UInt_t GetNoOfFitBins()
Returns the number of bins used in the fit.
virtual Bool_t GetProperDataRange(PRawRunData *runData, UInt_t histoNo[2])
Retrieves proper data range for histograms.
virtual Bool_t PrepareData()
Prepares all data for fitting or viewing.
PDoubleVector fForward
Forward detector histogram data.
Bool_t SubtractEstimatedBkg()
Estimates and subtracts background from histograms.
PDoubleVector fBackward
Backward detector histogram data.
Int_t fStartTimeBin
First bin index for fitting.
Bool_t fTheoAsData
If true, theory calculated only at data points; if false, extra points for nicer Fourier transforms.
virtual void SetFitRangeBin(const TString fitRange)
Sets the fit range in bins.
Double_t fTimeResolution
Time resolution of raw histogram data in microseconds (μs), e.g., 0.01953125 μs for PSI GPS.
Bool_t fValid
Flag indicating if run object initialized successfully; false if any error occurred.
Double_t fFitEndTime
Fit range end time in microseconds (μs) relative to t0.
PDoubleVector fFuncValues
Cached values of user-defined functions from FUNCTIONS block, evaluated at current parameters.
PMsrHandler * fMsrInfo
Pointer to MSR file handler (owned externally, not deleted here)
virtual void DeadTimeCorrection(std::vector< PDoubleVector > &histos, PUIntVector &histoNo)
carry out dead time correction
PMetaData fMetaData
Experimental metadata extracted from data file header (magnetic field, temperature,...
std::unique_ptr< PTheory > fTheory
Theory function evaluator (smart pointer, automatically deleted)
std::vector< PDoubleVector > fAddT0s
Time-zero bin values for additional runs to be added to main run.
EPMusrHandleTag fHandleTag
Operation mode: kFit (fitting), kView (display only), kEmpty (uninitialized)
virtual void CalculateKaiserFilterCoeff(Double_t wc, Double_t A, Double_t dw)
Calculates Kaiser window FIR filter coefficients for RRF smoothing.
PRunData fData
Processed data container: background-corrected, packed, with theory values.
PRunDataHandler * fRawData
Pointer to raw data handler (owned externally, not deleted here)
PDoubleVector fT0s
Time-zero bin values for all histograms in this run (forward, backward, etc.)
PRunBase()
Default constructor.
Int_t fRunNo
Run number (0-based index in MSR file RUN blocks)
PMsrRunBlock * fRunInfo
Pointer to this run's RUN block settings within fMsrInfo.
Double_t fFitStartTime
Fit range start time in microseconds (μs) relative to t0.
virtual void FilterTheo()
Applies Kaiser FIR filter to theory values for RRF fits.
Raw data file reader and format converter for μSR data.
virtual void AppendErrorValue(Double_t dval)
virtual void AppendValue(Double_t dval)
virtual const PDoubleVector * GetValue()
Returns pointer to data value vector (asymmetry, counts, or y-data)
virtual const PDoubleVector * GetError()
Returns pointer to data error vector (statistical uncertainties)