44 #include <TObjArray.h> 45 #include <TObjString.h> 80 PRunBase(msrInfo, rawData, runNo, tag), fTheoAsData(theoAsData)
89 std::cerr << std::endl <<
">> PRunAsymmetryRRF::PRunAsymmetryRRF(): **SEVERE ERROR**: Couldn't find any RRF packing information!";
90 std::cerr << std::endl <<
">> This is very bad :-(, will quit ...";
91 std::cerr << std::endl;
102 std::cerr << std::endl <<
">> PRunAsymmetryRRF::PRunAsymmetryRRF(): **ERROR** no alpha parameter given! This is needed for an asymmetry fit!";
103 std::cerr << std::endl;
109 std::cerr << std::endl <<
">> PRunAsymmetryRRF::PRunAsymmetryRRF(): **ERROR** alpha parameter no = " <<
fRunInfo->
GetAlphaParamNo();
110 std::cerr << std::endl <<
">> This is out of bound, since there are only " << param->size() <<
" parameters.";
111 std::cerr << std::endl;
116 Bool_t alphaFixedToOne =
false;
119 alphaFixedToOne =
true;
122 Bool_t betaFixedToOne =
false;
124 betaFixedToOne =
true;
126 std::cerr << std::endl <<
">> PRunAsymmetryRRF::PRunAsymmetryRRF(): **ERROR** beta parameter no = " <<
fRunInfo->
GetBetaParamNo();
127 std::cerr << std::endl <<
">> This is out of bound, since there are only " << param->size() <<
" parameters.";
128 std::cerr << std::endl;
134 betaFixedToOne =
true;
138 if (alphaFixedToOne && betaFixedToOne)
140 else if (!alphaFixedToOne && betaFixedToOne)
142 else if (alphaFixedToOne && !betaFixedToOne)
179 Double_t chisq = 0.0;
181 Double_t asymFcnValue = 0.0;
255 #pragma omp parallel for default(shared) private(i,time,diff,asymFcnValue,f) schedule(dynamic,chunk) reduction(+:chisq) 260 asymFcnValue = (f*(a*b+1.0)-(a-1.0))/((a+1.0)-f*(a*b-1.0));
294 std::cout << std::endl <<
"PRunAsymmetryRRF::CalcMaxLikelihood(): not implemented yet ..." << std::endl;
330 TObjArray *tok =
nullptr;
331 TObjString *ostr =
nullptr;
336 tok = fitRange.Tokenize(
" \t");
338 if (tok->GetEntries() == 3) {
340 ostr =
static_cast<TObjString*
>(tok->At(1));
341 str = ostr->GetString();
343 idx = str.First(
"+");
345 str.Remove(0, idx+1);
352 ostr =
static_cast<TObjString*
>(tok->At(2));
353 str = ostr->GetString();
355 idx = str.First(
"-");
357 str.Remove(0, idx+1);
362 }
else if ((tok->GetEntries() > 3) && (tok->GetEntries() % 2 == 1)) {
363 Int_t pos = 2*(
fRunNo+1)-1;
365 if (pos + 1 >= tok->GetEntries()) {
366 std::cerr << std::endl <<
">> PRunSingleHisto::SetFitRangeBin(): **ERROR** invalid FIT_RANGE command found: '" << fitRange <<
"'";
367 std::cerr << std::endl <<
">> will ignore it. Sorry ..." << std::endl;
370 ostr =
static_cast<TObjString*
>(tok->At(pos));
371 str = ostr->GetString();
373 idx = str.First(
"+");
375 str.Remove(0, idx+1);
382 ostr =
static_cast<TObjString*
>(tok->At(pos+1));
383 str = ostr->GetString();
385 idx = str.First(
"-");
387 str.Remove(0, idx+1);
394 std::cerr << std::endl <<
">> PRunSingleHisto::SetFitRangeBin(): **ERROR** invalid FIT_RANGE command found: '" << fitRange <<
"'";
395 std::cerr << std::endl <<
">> will ignore it. Sorry ..." << std::endl;
435 std::vector<Double_t> par;
437 for (UInt_t i=0; i<paramList->size(); i++)
438 par.push_back((*paramList)[i].fValue);
446 Double_t asymFcnValue = 0.0;
465 asymFcnValue = (f*(a+1.0)-(a-1.0))/((a+1.0)-f*(a-1.0));
477 asymFcnValue = f*(b+1.0)/(2.0-f*(b-1.0));
497 asymFcnValue = (f*(a*b+1.0)-(a-1.0))/((a+1.0)-f*(a*b-1.0));
544 std::cerr << std::endl <<
">> PRunAsymmetryRRF::PrepareData(): **ERROR** Couldn't get run " <<
fRunInfo->
GetRunName()->Data() <<
"!";
545 std::cerr << std::endl;
565 if (!runData->
IsPresent(forwardHistoNo[i])) {
566 std::cerr << std::endl <<
">> PRunAsymmetryRRF::PrepareData(): **PANIC ERROR**:";
567 std::cerr << std::endl <<
">> forwardHistoNo found = " << forwardHistoNo[i] <<
", which is NOT present in the data file!?!?";
568 std::cerr << std::endl <<
">> Will quit :-(";
569 std::cerr << std::endl;
571 forwardHistoNo.clear();
572 backwardHistoNo.clear();
579 if (!runData->
IsPresent(backwardHistoNo[i])) {
580 std::cerr << std::endl <<
">> PRunAsymmetryRRF::PrepareData(): **PANIC ERROR**:";
581 std::cerr << std::endl <<
">> backwardHistoNo found = " << backwardHistoNo[i] <<
", which is NOT present in the data file!?!?";
582 std::cerr << std::endl <<
">> Will quit :-(";
583 std::cerr << std::endl;
585 forwardHistoNo.clear();
586 backwardHistoNo.clear();
593 std::cout.precision(10);
594 std::cout << std::endl <<
">> PRunAsymmetryRRF::PrepareData(): time resolution=" << std::fixed << runData->
GetTimeResolution() <<
"(ns)" << std::endl;
597 if (!
GetProperT0(runData, globalBlock, forwardHistoNo, backwardHistoNo)) {
602 std::vector<PDoubleVector> forward, backward;
603 forward.resize(forwardHistoNo.size());
604 for (UInt_t i=0; i<forwardHistoNo.size(); i++) {
605 forward[i].resize(runData->
GetDataBin(forwardHistoNo[i])->size());
606 forward[i] = *runData->
GetDataBin(forwardHistoNo[i]);
608 backward.resize(backwardHistoNo.size());
609 for (UInt_t i=0; i<backwardHistoNo.size(); i++) {
610 backward[i].resize(runData->
GetDataBin(backwardHistoNo[i])->size());
611 backward[i] = *runData->
GetDataBin(backwardHistoNo[i]);
621 if (addRunData ==
nullptr) {
622 std::cerr << std::endl <<
">> PRunAsymmetryRRF::PrepareData(): **ERROR** Couldn't get addrun " <<
fRunInfo->
GetRunName(i)->Data() <<
"!";
623 std::cerr << std::endl;
629 for (UInt_t k=0; k<forwardHistoNo.size(); k++) {
630 addRunSize = addRunData->
GetDataBin(forwardHistoNo[k])->size();
631 for (UInt_t j=0; j<addRunData->
GetDataBin(forwardHistoNo[k])->size(); j++) {
633 if (((Int_t)j+(Int_t)
fAddT0s[i-1][2*k]-(Int_t)
fT0s[2*k] >= 0) && (j+(Int_t)
fAddT0s[i-1][2*k]-(Int_t)
fT0s[2*k] < addRunSize)) {
634 forward[k][j] += addRunData->
GetDataBin(forwardHistoNo[k])->at(j+(Int_t)
fAddT0s[i-1][2*k]-(Int_t)
fT0s[2*k]);
640 for (UInt_t k=0; k<backwardHistoNo.size(); k++) {
641 addRunSize = addRunData->
GetDataBin(backwardHistoNo[k])->size();
642 for (UInt_t j=0; j<addRunData->
GetDataBin(backwardHistoNo[k])->size(); j++) {
644 if (((Int_t)j+(Int_t)
fAddT0s[i-1][2*k+1]-(Int_t)
fT0s[2*k+1] >= 0) && (j+(Int_t)
fAddT0s[i-1][2*k+1]-(Int_t)
fT0s[2*k+1] < addRunSize)) {
645 backward[k][j] += addRunData->
GetDataBin(backwardHistoNo[k])->at(j+(Int_t)
fAddT0s[i-1][2*k+1]-(Int_t)
fT0s[2*k+1]);
655 for (UInt_t i=0; i<
fForward.size(); i++) {
661 for (UInt_t i=1; i<forwardHistoNo.size(); i++) {
662 for (UInt_t j=0; j<runData->
GetDataBin(forwardHistoNo[i])->size(); j++) {
671 for (UInt_t i=1; i<backwardHistoNo.size(); i++) {
672 for (UInt_t j=0; j<runData->
GetDataBin(backwardHistoNo[i])->size(); j++) {
690 std::cerr << std::endl <<
">> PRunAsymmetryRRF::PrepareData(): **WARNING** Neither fix background nor background bins are given!";
691 std::cerr << std::endl <<
">> Will try the following:";
694 std::cerr << std::endl <<
">> NO WARRANTY THAT THIS MAKES ANY SENSE! Better check ...";
695 std::cerr << std::endl;
704 UInt_t histoNo[2] = {forwardHistoNo[0], backwardHistoNo[0]};
729 forwardHistoNo.clear();
730 backwardHistoNo.clear();
757 for (UInt_t i=0; i<
fForward.size(); i++) {
800 Double_t beamPeriod = 0.0;
815 for (UInt_t i=0; i<2; i++) {
816 if (end[i] < start[i]) {
817 std::cout << std::endl <<
"PRunAsymmetryRRF::SubtractEstimatedBkg(): end = " << end[i] <<
" > start = " << start[i] <<
"! Will swap them!";
818 UInt_t keep = end[i];
825 for (UInt_t i=0; i<2; i++) {
826 if (beamPeriod != 0.0) {
827 Double_t timeBkg =
static_cast<Double_t
>(end[i]-start[i])*
fTimeResolution;
828 UInt_t fullCycles =
static_cast<UInt_t
>(timeBkg/beamPeriod);
830 end[i] = start[i] +
static_cast<UInt_t
>((fullCycles*beamPeriod)/
fTimeResolution);
831 std::cout <<
"PRunAsymmetryRRF::SubtractEstimatedBkg(): Background " << start[i] <<
", " << end[i] << std::endl;
832 if (end[i] == start[i])
839 std::cerr << std::endl <<
">> PRunAsymmetryRRF::SubtractEstimatedBkg(): **ERROR** background bin values out of bound!";
840 std::cerr << std::endl <<
">> histo lengths (f/b) = (" <<
fForward.size() <<
"/" <<
fBackward.size() <<
").";
841 std::cerr << std::endl <<
">> background start (f/b) = (" << start[0] <<
"/" << start[1] <<
").";
847 std::cerr << std::endl <<
">> PRunAsymmetryRRF::SubtractEstimatedBkg(): **ERROR** background bin values out of bound!";
848 std::cerr << std::endl <<
">> histo lengths (f/b) = (" <<
fForward.size() <<
"/" <<
fBackward.size() <<
").";
849 std::cerr << std::endl <<
">> background end (f/b) = (" << end[0] <<
"/" << end[1] <<
").";
854 Double_t bkg[2] = {0.0, 0.0};
855 Double_t errBkg[2] = {0.0, 0.0};
858 for (UInt_t i=start[0]; i<=end[0]; i++)
860 errBkg[0] = TMath::Sqrt(bkg[0])/(end[0] - start[0] + 1);
861 bkg[0] /=
static_cast<Double_t
>(end[0] - start[0] + 1);
862 std::cout << std::endl <<
">> estimated forward histo background: " << bkg[0];
865 for (UInt_t i=start[1]; i<=end[1]; i++)
867 errBkg[1] = TMath::Sqrt(bkg[1])/(end[1] - start[1] + 1);
868 bkg[1] /=
static_cast<Double_t
>(end[1] - start[1] + 1);
869 std::cout << std::endl <<
">> estimated backward histo background: " << bkg[1] << std::endl;
872 Double_t errVal = 0.0;
873 for (UInt_t i=0; i<
fForward.size(); i++) {
875 errVal = TMath::Sqrt(
fForward[i]+errBkg[0]*errBkg[0]);
880 errVal = TMath::Sqrt(
fBackward[i]+errBkg[1]*errBkg[1]);
887 for (UInt_t i=0; i<
fForward.size(); i++) {
916 Int_t lgb_offset =
fGoodBins[1]-
static_cast<Int_t
>(
fT0s[0])+fgbOffset;
917 if (lgb_offset <
fGoodBins[3]-static_cast<Int_t>(
fT0s[1])+fgbOffset)
918 lgb_offset =
fGoodBins[3]-static_cast<Int_t>(
fT0s[1])+fgbOffset;
920 Int_t fgb =
static_cast<Int_t
>(
fT0s[0])+fgbOffset;
921 Int_t lgb = fgb + lgb_offset;
922 Int_t dt0 =
static_cast<Int_t
>(
fT0s[0])-static_cast<Int_t>(
fT0s[1]);
926 Double_t asymVal, asymValErr;
927 Double_t ff, bb, eff, ebb;
928 for (Int_t i=fgb; i<lgb; i++) {
932 asymVal = (ff-bb)/(ff+bb);
935 asym.push_back(asymVal);
938 if ((asymVal != 0.0) && (ff+bb) > 0.0)
939 asymValErr = 2.0/pow((ff+bb),2.0)*sqrt(bb*bb*eff*eff+ff*ff*ebb*ebb);
942 asymErr.push_back(asymValErr);
947 Double_t wRRF = globalBlock->
GetRRFFreq(
"Mc");
948 Double_t phaseRRF = globalBlock->
GetRRFPhase()*TMath::TwoPi()/180.0;
950 Double_t startTime =
fTimeResolution *
static_cast<Double_t
>(fgbOffset);
952 for (UInt_t i=0; i<asym.size(); i++) {
954 asym[i] *= 2.0*cos(wRRF*time+phaseRRF);
960 for (UInt_t i=0; i<asym.size(); i++) {
971 for (UInt_t i=0; i<asymErr.size(); i++) {
973 asymRRFErr.push_back(sqrt(2.0*asymValErr)/
fRRFPacking);
976 asymValErr += asymErr[i]*asymErr[i];
982 for (UInt_t i=0; i<asymRRF.size(); i++) {
1024 std::vector<Double_t> par;
1026 for (UInt_t i=0; i<paramList->size(); i++)
1027 par.push_back((*paramList)[i].fValue);
1032 Int_t t0[2] = {
static_cast<Int_t
>(
fT0s[0]), static_cast<Int_t>(
fT0s[1])};
1036 if (start[0]-t0[0] != start[1]-t0[1]) {
1037 if (abs(start[0]-t0[0]) > abs(start[1]-t0[1])) {
1039 fgb[1] = t0[1] + start[0]-t0[0];
1040 std::cerr << std::endl <<
">> PRunAsymmetryRRF::PrepareViewData(): **WARNING** needed to shift backward fgb from ";
1041 std::cerr << start[1] <<
" to " << fgb[1] << std::endl;
1043 fgb[0] = t0[0] + start[1]-t0[1];
1045 std::cerr << std::endl <<
">> PRunAsymmetryRRF::PrepareViewData(): **WARNING** needed to shift forward fgb from ";
1046 std::cerr << start[0] <<
" to " << fgb[0] << std::endl;
1056 UInt_t noOfBins0 = runData->
GetDataBin(histoNo[0])->size()-start[0];
1057 UInt_t noOfBins1 = runData->
GetDataBin(histoNo[1])->size()-start[1];
1058 if (noOfBins0 > noOfBins1)
1059 noOfBins0 = noOfBins1;
1060 end[0] = start[0] + noOfBins0;
1061 end[1] = start[1] + noOfBins0;
1064 for (UInt_t i=0; i<2; i++) {
1066 if ((start[i] < 0) || (start[i] > static_cast<Int_t>(runData->
GetDataBin(histoNo[i])->size()))) {
1067 std::cerr << std::endl <<
">> PRunAsymmetryRRF::PrepareViewData(): **ERROR** start data bin doesn't make any sense!";
1068 std::cerr << std::endl;
1072 if ((end[i] < 0) || (end[i] >
static_cast<Int_t
>(runData->
GetDataBin(histoNo[i])->size()))) {
1073 std::cerr << std::endl <<
">> PRunAsymmetryRRF::PrepareViewData(): **ERROR** end data bin doesn't make any sense!";
1074 std::cerr << std::endl;
1078 if ((t0[i] < 0) || (t0[i] >
static_cast<Int_t
>(runData->
GetDataBin(histoNo[i])->size()))) {
1079 std::cerr << std::endl <<
">> PRunAsymmetryRRF::PrepareViewData(): **ERROR** t0 data bin doesn't make any sense!";
1080 std::cerr << std::endl;
1092 Double_t asym, error;
1093 Double_t f, b, ef, eb, alpha = 1.0, beta = 1.0;
1146 Int_t dtBin = start[1]-start[0];
1147 for (Int_t i=start[0]; i<end[0]; i++) {
1155 asym = (alpha*f-b) / (alpha*beta*f+b);
1158 asymVec.push_back(asym);
1161 error = 2.0/((f+b)*(f+b))*TMath::Sqrt(b*b*ef*ef+eb*eb*f*f);
1164 asymErr.push_back(error);
1170 Double_t wRRF = globalBlock->
GetRRFFreq(
"Mc");
1171 Double_t phaseRRF = globalBlock->
GetRRFPhase()*TMath::TwoPi()/180.0;
1172 Double_t startTime=
fTimeResolution*(
static_cast<Double_t
>(start[0])-t0[0]);
1173 Double_t time = 0.0;
1174 for (UInt_t i=0; i<asymVec.size(); i++) {
1176 asymVec[i] *= 2.0*cos(wRRF*time+phaseRRF);
1179 Double_t dval = 0.0;
1181 for (UInt_t i=0; i<asymVec.size(); i++) {
1192 for (UInt_t i=0; i<asymErr.size(); i++) {
1197 dval += asymErr[i]*asymErr[i];
1203 for (UInt_t i=0; i<asymRRF.size(); i++) {
1227 UInt_t size = runData->
GetDataBin(histoNo[0])->size();
1238 for (UInt_t i=0; i<size; i++) {
1241 if (fabs(dval) > 10.0) {
1280 size_t size = 2*forwardHistoNo.size();
1281 if (backwardHistoNo.size() > forwardHistoNo.size())
1282 size = 2*backwardHistoNo.size();
1284 for (UInt_t i=0; i<
fT0s.size(); i++) {
1295 if (
fT0s[i] == -1.0) {
1301 for (UInt_t i=0; i<forwardHistoNo.size(); i++) {
1302 if (
fT0s[2*i] == -1.0)
1303 if (runData->
GetT0Bin(forwardHistoNo[i]) > 0.0) {
1308 for (UInt_t i=0; i<backwardHistoNo.size(); i++) {
1309 if (
fT0s[2*i+1] == -1.0)
1310 if (runData->
GetT0Bin(backwardHistoNo[i]) > 0.0) {
1317 for (UInt_t i=0; i<forwardHistoNo.size(); i++) {
1318 if (
fT0s[2*i] == -1.0) {
1322 std::cerr << std::endl <<
">> PRunAsymmetryRRF::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!";
1324 std::cerr << std::endl <<
">> will try the estimated one: forward t0 = " << runData->
GetT0BinEstimated(forwardHistoNo[i]);
1325 std::cerr << std::endl <<
">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
1326 std::cerr << std::endl;
1329 for (UInt_t i=0; i<backwardHistoNo.size(); i++) {
1330 if (
fT0s[2*i+1] == -1.0) {
1334 std::cerr << std::endl <<
">> PRunAsymmetryRRF::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!";
1336 std::cerr << std::endl <<
">> will try the estimated one: backward t0 = " << runData->
GetT0BinEstimated(backwardHistoNo[i]);
1337 std::cerr << std::endl <<
">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
1338 std::cerr << std::endl;
1343 for (UInt_t i=0; i<forwardHistoNo.size(); i++) {
1344 if ((
fT0s[2*i] < 0) || (
fT0s[2*i] >
static_cast<Int_t
>(runData->
GetDataBin(forwardHistoNo[i])->size()))) {
1345 std::cerr << std::endl <<
">> PRunAsymmetryRRF::GetProperT0(): **ERROR** t0 data bin (" <<
fT0s[2*i] <<
") doesn't make any sense!";
1346 std::cerr << std::endl <<
">> forwardHistoNo " << forwardHistoNo[i];
1347 std::cerr << std::endl;
1351 for (UInt_t i=0; i<backwardHistoNo.size(); i++) {
1352 if ((
fT0s[2*i+1] < 0) || (
fT0s[2*i+1] >
static_cast<Int_t
>(runData->
GetDataBin(backwardHistoNo[i])->size()))) {
1353 std::cerr << std::endl <<
">> PRunAsymmetryRRF::PrepareData(): **ERROR** t0 data bin (" <<
fT0s[2*i+1] <<
") doesn't make any sense!";
1354 std::cerr << std::endl <<
">> backwardHistoNo " << backwardHistoNo[i];
1355 std::cerr << std::endl;
1367 if (addRunData ==
nullptr) {
1368 std::cerr << std::endl <<
">> PRunAsymmetryRRF::GetProperT0(): **ERROR** Couldn't get addrun " <<
fRunInfo->
GetRunName(i)->Data() <<
"!";
1369 std::cerr << std::endl;
1376 fAddT0s[i-1].resize(2*forwardHistoNo.size());
1377 for (UInt_t j=0; j<
fAddT0s[i-1].size(); j++) {
1387 for (UInt_t j=0; j<forwardHistoNo.size(); j++) {
1388 if (
fAddT0s[i-1][2*j] == -1.0)
1389 if (addRunData->
GetT0Bin(forwardHistoNo[j]) > 0.0) {
1394 for (UInt_t j=0; j<backwardHistoNo.size(); j++) {
1395 if (
fAddT0s[i-1][2*j+1] == -1.0)
1396 if (addRunData->
GetT0Bin(backwardHistoNo[j]) > 0.0) {
1403 for (UInt_t j=0; j<forwardHistoNo.size(); j++) {
1404 if (
fAddT0s[i-1][2*j] == -1.0) {
1408 std::cerr << std::endl <<
">> PRunAsymmetryRRF::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!";
1410 std::cerr << std::endl <<
">> will try the estimated one: forward t0 = " << addRunData->
GetT0BinEstimated(forwardHistoNo[j]);
1411 std::cerr << std::endl <<
">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
1412 std::cerr << std::endl;
1415 for (UInt_t j=0; j<backwardHistoNo.size(); j++) {
1416 if (
fAddT0s[i-1][2*j+1] == -1.0) {
1420 std::cerr << std::endl <<
">> PRunAsymmetryRRF::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!";
1422 std::cerr << std::endl <<
">> will try the estimated one: backward t0 = " << runData->
GetT0BinEstimated(backwardHistoNo[j]);
1423 std::cerr << std::endl <<
">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
1424 std::cerr << std::endl;
1455 if (start[0] == -1) {
1458 if (start[1] == -1) {
1468 Double_t t0[2] = {
fT0s[0],
fT0s[1]};
1473 start[0] =
static_cast<Int_t
>(t0[0])+offset;
1475 std::cerr << std::endl <<
">> PRunAsymmetryRRF::GetProperDataRange(): **WARNING** data range (forward) was not provided, will try data range start = t0+" << offset <<
"(=10ns) = " << start[0] <<
".";
1476 std::cerr << std::endl <<
">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE.";
1477 std::cerr << std::endl;
1480 start[1] =
static_cast<Int_t
>(t0[1])+offset;
1482 std::cerr << std::endl <<
">> PRunAsymmetryRRF::GetProperDataRange(): **WARNING** data range (backward) was not provided, will try data range start = t0+" << offset <<
"(=10ns) = " << start[1] <<
".";
1483 std::cerr << std::endl <<
">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE.";
1484 std::cerr << std::endl;
1487 end[0] = runData->
GetDataBin(histoNo[0])->size();
1489 std::cerr << std::endl <<
">> PRunAsymmetryRRF::GetProperDataRange(): **WARNING** data range (forward) was not provided, will try data range end = " << end[0] <<
".";
1490 std::cerr << std::endl <<
">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE.";
1491 std::cerr << std::endl;
1494 end[1] = runData->
GetDataBin(histoNo[1])->size();
1496 std::cerr << std::endl <<
">> PRunAsymmetryRRF::GetProperDataRange(): **WARNING** data range (backward) was not provided, will try data range end = " << end[1] <<
".";
1497 std::cerr << std::endl <<
">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE.";
1498 std::cerr << std::endl;
1503 for (UInt_t i=0; i<2; i++) {
1504 if (end[i] < start[i]) {
1505 Int_t keep = end[i];
1510 if ((start[i] < 0) || (start[i] > static_cast<Int_t>(runData->
GetDataBin(histoNo[i])->size()))) {
1511 std::cerr << std::endl <<
">> PRunAsymmetryRRF::GetProperDataRange(): **ERROR** start data bin doesn't make any sense!";
1512 std::cerr << std::endl;
1517 std::cerr << std::endl <<
">> PRunAsymmetryRRF::GetProperDataRange(): **ERROR** end data bin (" << end[i] <<
") doesn't make any sense!";
1518 std::cerr << std::endl;
1521 if (end[i] > static_cast<Int_t>(runData->
GetDataBin(histoNo[i])->size())) {
1522 std::cerr << std::endl <<
">> PRunAsymmetryRRF::GetProperDataRange(): **WARNING** end data bin (" << end[i] <<
") > histo length (" << (Int_t)runData->
GetDataBin(histoNo[i])->size() <<
").";
1523 std::cerr << std::endl <<
">> Will set end = (histo length - 1). Consider to change it in the msr-file." << std::endl;
1524 std::cerr << std::endl;
1525 end[i] =
static_cast<Int_t
>(runData->
GetDataBin(histoNo[i])->size())-1;
1528 if ((t0[i] < 0) || (t0[i] >
static_cast<Int_t
>(runData->
GetDataBin(histoNo[i])->size()))) {
1529 std::cerr << std::endl <<
">> PRunAsymmetryRRF::GetProperDataRange(): **ERROR** t0 data bin doesn't make any sense!";
1530 std::cerr << std::endl;
1536 if (fabs(static_cast<Double_t>(start[0])-t0[0]) > fabs(static_cast<Double_t>(start[1])-t0[1])){
1537 start[1] =
static_cast<Int_t
>(t0[1] +
static_cast<Double_t
>(start[0]) - t0[0]);
1538 end[1] =
static_cast<Int_t
>(t0[1] +
static_cast<Double_t
>(end[0]) - t0[0]);
1539 std::cerr << std::endl <<
">> PRunAsymmetryRRF::GetProperDataRange **WARNING** needed to shift backward data range.";
1541 std::cerr << std::endl <<
">> used : " << start[1] <<
", " << end[1];
1542 std::cerr << std::endl;
1544 if (fabs(static_cast<Double_t>(start[0])-t0[0]) < fabs(static_cast<Double_t>(start[1])-t0[1])){
1545 start[0] =
static_cast<Int_t
>(t0[0] +
static_cast<Double_t
>(start[1]) - t0[1]);
1546 end[0] =
static_cast<Int_t
>(t0[0] +
static_cast<Double_t
>(end[1]) - t0[1]);
1547 std::cerr << std::endl <<
">> PRunAsymmetryRRF::GetProperDataRange **WARNING** needed to shift forward data range.";
1549 std::cerr << std::endl <<
">> used : " << start[0] <<
", " << end[0];
1550 std::cerr << std::endl;
1605 std::cerr <<
">> PRunSingleHisto::GetProperFitRange(): **WARNING** Couldn't get fit start/end time!" << std::endl;
1606 std::cerr <<
">> Will set it to fgb/lgb which given in time is: " <<
fFitStartTime <<
"..." <<
fFitEndTime <<
" (usec)" << std::endl;
virtual Double_t CalcChiSquareExpected(const std::vector< Double_t > &par)
virtual UInt_t GetT0BinSize()
Bool_t fValid
flag showing if the state of the class is valid
virtual Bool_t PrepareFitData()
Int_t fRRFPacking
RRF packing for this particular run. Given in the GLOBAL-block.
virtual void SetDataRange(Int_t ival, Int_t idx)
virtual const PDoubleVector * GetError()
virtual Int_t GetNoOfFuncs()
virtual Int_t GetDataRange(UInt_t idx)
virtual Double_t GetT0Bin(UInt_t idx=0)
Int_t fStartTimeBin
bin at which the fit starts
virtual const Double_t GetTimeResolution()
virtual Bool_t GetProperDataRange(PRawRunData *runData, UInt_t histoNo[2])
PRunDataHandler * fRawData
holds the raw run data
virtual Bool_t PrepareViewData(PRawRunData *runData, UInt_t histoNo[2])
std::vector< PDoubleVector > fAddT0s
all t0 bins of all addrun's of a run! The derived classes will handle it.
virtual void SetBkgEstimated(Double_t dval, Int_t idx)
virtual Int_t GetFitRangeOffset(UInt_t idx)
virtual void SetTheoryTimeStart(Double_t dval)
PMsrHandler * fMsrInfo
msr-file handler
virtual Bool_t PrepareData()
virtual Bool_t IsFitRangeInBin()
Bool_t SubtractEstimatedBkg()
virtual const PDoublePairVector * GetTemperature() const
Double_t fTimeResolution
time resolution in (us)
virtual void CalcTheory()
PMetaData fMetaData
keeps the meta data from the data file like field, temperature, energy, ...
virtual PRawRunData * GetRunData(const TString &runName)
virtual Double_t CalcMaxLikelihood(const std::vector< Double_t > &par)
virtual Double_t GetAddT0Bin(UInt_t addRunIdx, UInt_t histoIdx)
virtual Int_t GetRRFPacking()
virtual UInt_t GetT0BinSize()
virtual void AppendErrorValue(Double_t dval)
PDoubleVector fBackwardErr
backward histo errors
virtual Bool_t IsFitRangeInBin()
virtual ~PRunAsymmetryRRF()
virtual Double_t GetTheoryTimeStep()
std::vector< UInt_t > PUIntVector
PRunData fData
data to be fitted, viewed, i.e. binned data
virtual void SetDataTimeStep(Double_t dval)
virtual Double_t GetTheoryTimeStart()
virtual Double_t GetT0Bin(UInt_t idx=0)
std::vector< PMsrParamStructure > PMsrParamList
std::vector< Double_t > PDoubleVector
virtual Double_t GetRRFFreq(const char *unit)
virtual const Bool_t IsPresent(UInt_t histoNo)
#define MSR_PARAM_FUN_OFFSET
#define ACCEL_PERIOD_TRIUMF
virtual const Double_t GetT0Bin(const UInt_t histoNo)
virtual Double_t CalcChiSquare(const std::vector< Double_t > &par)
UInt_t fNoOfFitBins
number of bins to be be fitted
virtual Int_t GetBackwardHistoNo(UInt_t idx=0)
virtual void SetT0Bin(Double_t dval, Int_t idx=-1)
virtual Bool_t GetProperT0(PRawRunData *runData, PMsrGlobalBlock *globalBlock, PUIntVector &forwardHisto, PUIntVector &backwardHistoNo)
virtual void AppendTheoryValue(Double_t dval)
virtual PMsrGlobalBlock * GetMsrGlobal()
virtual Int_t GetAddT0BinSize(UInt_t addRunIdx)
virtual void SetDataTimeStart(Double_t dval)
virtual Int_t GetFitRangeOffset(UInt_t idx)
virtual void AppendValue(Double_t dval)
virtual const PDoubleVector * GetValue()
virtual UInt_t GetNoOfFitBins()
virtual const Double_t GetField()
virtual void SetAddT0Bin(Double_t dval, UInt_t addRunIdx, UInt_t histoNoIdx)
virtual Double_t GetBkgFix(UInt_t idx)
virtual UInt_t GetFuncNo(Int_t idx)
virtual const UInt_t GetNoOfTemperatures()
virtual Int_t GetForwardHistoNo(UInt_t idx=0)
PDoubleVector fT0s
all t0 bins of a run! The derived classes will handle it.
virtual Int_t GetBkgRange(UInt_t idx)
UInt_t fAlphaBetaTag
; ; ; .
EPMusrHandleTag fHandleTag
tag telling whether this is used for fit, view, ...
virtual UInt_t GetForwardHistoNoSize()
Int_t fGoodBins[4]
keep first/last good bins. 0=fgb, 1=lgb (forward); 2=fgb, 3=lgb (backward)
virtual Double_t GetRRFPhase()
PMsrRunBlock * fRunInfo
run info used to filter out needed infos of a run
virtual const Double_t GetEnergy()
virtual void SetBkgRange(Int_t ival, Int_t idx)
virtual void SetFitRange(Double_t dval, UInt_t idx)
virtual void GetProperFitRange(PMsrGlobalBlock *globalBlock)
Double_t fFitEndTime
fit end time
virtual void SetTheoryTimeStep(Double_t dval)
virtual TString * GetInstitute(UInt_t idx=0)
PDoubleVector fForward
forward histo data
virtual Int_t GetAlphaParamNo()
virtual void SetFitRange(Double_t dval, UInt_t idx)
Double_t fFitStartTime
fit start time
Int_t fEndTimeBin
bin at which the fit ends
virtual Int_t GetBetaParamNo()
virtual PMsrParamList * GetMsrParamList()
virtual PIntVector * GetMap()
virtual Double_t EvalFunc(UInt_t i, std::vector< Int_t > map, std::vector< Double_t > param, PMetaData metaData)
virtual const PDoubleVector * GetDataBin(const UInt_t histoNo)
virtual Double_t GetDataTimeStart()
virtual UInt_t GetRunNameSize()
virtual Int_t GetDataRange(UInt_t idx)
virtual const Double_t GetT0BinEstimated(const UInt_t histoNo)
PDoubleVector fBackward
backward histo data
std::unique_ptr< PTheory > fTheory
theory needed to calculate chi-square
virtual Double_t GetFitRange(UInt_t idx)
Bool_t fTheoAsData
true=only calculate the theory points at the data points, false=calculate more points for the theory ...
virtual Double_t GetDataTimeStep()
Int_t fRunNo
number of the run within the msr-file
PDoubleVector fForwardErr
forward histo errors
virtual void CalcNoOfFitBins()
virtual TString * GetRunName(UInt_t idx=0)
virtual Double_t GetFitRange(UInt_t idx)
virtual void SetFitRangeBin(const TString fitRange)
PDoubleVector fFuncValues
is keeping the values of the functions from the FUNCTIONS block
virtual UInt_t GetBackwardHistoNoSize()