From a2d47a09f82f6e26981485986031a1539d13008f Mon Sep 17 00:00:00 2001 From: Zaher Salman Date: Fri, 17 Aug 2018 16:08:04 +0200 Subject: [PATCH] First working duplicate asymmetry class for beta-NMR. --- src/classes/PMusrCanvas.cpp | 4 +- src/classes/PRunListCollection.cpp | 12 +-- src/musrt0.cpp | 164 +++++++++++++++++++++++++++++ 3 files changed, 171 insertions(+), 9 deletions(-) diff --git a/src/classes/PMusrCanvas.cpp b/src/classes/PMusrCanvas.cpp index fa93311e..8cc30344 100644 --- a/src/classes/PMusrCanvas.cpp +++ b/src/classes/PMusrCanvas.cpp @@ -2770,9 +2770,7 @@ void PMusrCanvas::HandleDataSet(UInt_t plotNo, UInt_t runNo, PRunData *data) size = data->GetValue()->size(); dataSet.dataRange->SetXRange(start, end); // full possible range // make sure that for asymmetry the y-range is initialized reasonably - if (fMsrHandler->GetMsrPlotList()->at(fPlotNumber).fPlotType == MSR_PLOT_ASYM) - dataSet.dataRange->SetYRange(-0.4, 0.4); - if (fMsrHandler->GetMsrPlotList()->at(fPlotNumber).fPlotType == MSR_PLOT_BNMR) + if ((fMsrHandler->GetMsrPlotList()->at(fPlotNumber).fPlotType == MSR_PLOT_ASYM) || (fMsrHandler->GetMsrPlotList()->at(fPlotNumber).fPlotType == MSR_PLOT_BNMR)) dataSet.dataRange->SetYRange(-0.4, 0.4); // extract necessary range information if ((fMsrHandler->GetMsrPlotList()->at(fPlotNumber).fTmin.size() == 0) && diff --git a/src/classes/PRunListCollection.cpp b/src/classes/PRunListCollection.cpp index dd0ecca1..0edab270 100644 --- a/src/classes/PRunListCollection.cpp +++ b/src/classes/PRunListCollection.cpp @@ -987,19 +987,19 @@ PRunData* PRunListCollection::GetAsymmetryBNMR(UInt_t index, EDataSwitch tag) switch (tag) { case kIndex: // called from musrfit when dumping the data - if (index > fRunAsymmetryList.size()) { + if (index > fRunAsymmetryBNMRList.size()) { cerr << endl << ">> PRunListCollection::GetAsymmetryBNMR(): **ERROR** index = " << index << " out of bounds"; cerr << endl; return 0; } - fRunAsymmetryList[index]->CalcTheory(); - data = fRunAsymmetryList[index]->GetData(); + fRunAsymmetryBNMRList[index]->CalcTheory(); + data = fRunAsymmetryBNMRList[index]->GetData(); break; case kRunNo: // called from PMusrCanvas - for (UInt_t i=0; iGetRunNo() == index) { - data = fRunAsymmetryList[i]->GetData(); + for (UInt_t i=0; iGetRunNo() == index) { + data = fRunAsymmetryBNMRList[i]->GetData(); break; } } diff --git a/src/musrt0.cpp b/src/musrt0.cpp index 81f13738..b6e9c770 100644 --- a/src/musrt0.cpp +++ b/src/musrt0.cpp @@ -645,6 +645,169 @@ Int_t main(Int_t argc, Char_t *argv[]) } } } + break; + case MSR_FITTYPE_BNMR: + if ((runList->at(i).GetRunNameSize() == 1) && (runList->at(i).GetForwardHistoNoSize() == 1)) { // no addruns / no grouping + // handle forward histo + // get histo number + histoNo = runList->at(i).GetForwardHistoNo(); + runName = runList->at(i).GetRunName(); + // get bin position of maximal data + t0Bin = musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo)); + // set t0 to maximum data position + runList->at(i).SetT0Bin(t0Bin, 0); + // set data range as well if firstGoodBinOffset is given + if (firstGoodBinOffsetPresent) { + start = t0Bin + firstGoodBinOffset; + end = dataHandler->GetRunData(*runName)->GetDataBin(histoNo)->size(); + runList->at(i).SetDataRange(start, 0); + runList->at(i).SetDataRange(end, 1); + } + // handle backward histo + // get histo number + histoNo = runList->at(i).GetBackwardHistoNo(); + runName = runList->at(i).GetRunName(); + // get bin position of maximal data + t0Bin = musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo)); + // set t0 to maximum data position + runList->at(i).SetT0Bin(t0Bin, 1); + // set data range as well if firstGoodBinOffset is given + if (firstGoodBinOffsetPresent) { + start = t0Bin + firstGoodBinOffset; + end = dataHandler->GetRunData(*runName)->GetDataBin(histoNo)->size(); + runList->at(i).SetDataRange(start, 2); + runList->at(i).SetDataRange(end, 3); + } + } else if ((runList->at(i).GetRunNameSize() > 1) && (runList->at(i).GetForwardHistoNoSize() == 1)) { // addruns / no grouping + // handle forward histo + // get histo number + histoNo = runList->at(i).GetForwardHistoNo(); + runName = runList->at(i).GetRunName(); + // get bin position of maximal data + t0Bin = musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo)); + // set t0 to maximum data position + runList->at(i).SetT0Bin(t0Bin, 0); + // set data range as well if firstGoodBinOffset is given + if (firstGoodBinOffsetPresent) { + start = t0Bin + firstGoodBinOffset; + end = dataHandler->GetRunData(*runName)->GetDataBin(histoNo)->size(); + runList->at(i).SetDataRange(start, 0); + runList->at(i).SetDataRange(end, 1); + } + // handle addruns + for (UInt_t j=1; jat(i).GetRunNameSize(); j++) { + runName = runList->at(i).GetRunName(j); + // get bin position of maximal data + t0Bin = musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo)); + // set t0 to maximum data position + runList->at(i).SetAddT0Bin(t0Bin, j-1, 0); + } + // handle backward histo + // get histo number + histoNo = runList->at(i).GetBackwardHistoNo(); + runName = runList->at(i).GetRunName(); + // get bin position of maximal data + t0Bin = musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo)); + // set t0 to maximum data position + runList->at(i).SetT0Bin(t0Bin, 1); + // set data range as well if firstGoodBinOffset is given + if (firstGoodBinOffsetPresent) { + start = t0Bin + firstGoodBinOffset; + end = dataHandler->GetRunData(*runName)->GetDataBin(histoNo)->size(); + runList->at(i).SetDataRange(start, 2); + runList->at(i).SetDataRange(end, 3); + } + // handle addruns + for (UInt_t j=1; jat(i).GetRunNameSize(); j++) { + runName = runList->at(i).GetRunName(j); + // get bin position of maximal data + t0Bin = musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo)); + // set t0 to maximum data position + runList->at(i).SetAddT0Bin(t0Bin, j-1, 1); + } + } else if ((runList->at(i).GetRunNameSize() == 1) && (runList->at(i).GetForwardHistoNoSize() > 1)) { // no addruns / grouping + // handle forward histo + for (UInt_t j=0; jat(i).GetForwardHistoNoSize(); j++) { + // get histo number + histoNo = runList->at(i).GetForwardHistoNo(j); + runName = runList->at(i).GetRunName(); + // get bin position of maximal data + t0Bin = musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo)); + // set t0 to maximum data position + runList->at(i).SetT0Bin(t0Bin, 2*j); + if (firstGoodBinOffsetPresent && (j==0)) { + start = t0Bin + firstGoodBinOffset; + end = dataHandler->GetRunData(*runName)->GetDataBin(histoNo)->size(); + runList->at(i).SetDataRange(start, 0); + runList->at(i).SetDataRange(end, 1); + } + } + // handle backward histo + for (UInt_t j=0; jat(i).GetBackwardHistoNoSize(); j++) { + // get histo number + histoNo = runList->at(i).GetBackwardHistoNo(j); + runName = runList->at(i).GetRunName(); + // get bin position of maximal data + t0Bin = musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo)); + // set t0 to maximum data position + runList->at(i).SetT0Bin(t0Bin, 2*j+1); + if (firstGoodBinOffsetPresent && (j==0)) { + start = t0Bin + firstGoodBinOffset; + end = dataHandler->GetRunData(*runName)->GetDataBin(histoNo)->size(); + runList->at(i).SetDataRange(start, 2); + runList->at(i).SetDataRange(end, 3); + } + } + } else { // addruns / grouping + // handle forward histo + for (UInt_t j=0; jat(i).GetForwardHistoNoSize(); j++) { + // get histo number + histoNo = runList->at(i).GetForwardHistoNo(j); + runName = runList->at(i).GetRunName(); + // get bin position of maximal data + t0Bin = musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo)); + // set t0 to maximum data position + runList->at(i).SetT0Bin(t0Bin, 2*j); + if (firstGoodBinOffsetPresent && (j==0)) { + start = t0Bin + firstGoodBinOffset; + end = dataHandler->GetRunData(*runName)->GetDataBin(histoNo)->size(); + runList->at(i).SetDataRange(start, 0); + runList->at(i).SetDataRange(end, 1); + } + // handle addruns + for (UInt_t k=1; kat(i).GetRunNameSize(); k++) { + runName = runList->at(i).GetRunName(k); + // get bin position of maximal data + t0Bin = musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo)); + // set t0 to maximum data position + runList->at(i).SetAddT0Bin(t0Bin, k-1, 2*j); + } + } + // handle backward histo + for (UInt_t j=0; jat(i).GetBackwardHistoNoSize(); j++) { + // get histo number + histoNo = runList->at(i).GetBackwardHistoNo(j); + runName = runList->at(i).GetRunName(); + // get bin position of maximal data + t0Bin = musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo)); + // set t0 to maximum data position + runList->at(i).SetT0Bin(t0Bin, 2*j+1); + if (firstGoodBinOffsetPresent && (j==0)) { + start = t0Bin + firstGoodBinOffset; + end = dataHandler->GetRunData(*runName)->GetDataBin(histoNo)->size(); + runList->at(i).SetDataRange(start, 2); + runList->at(i).SetDataRange(end, 3); + } + // handle addruns + for (UInt_t k=1; kat(i).GetRunNameSize(); k++) { + runName = runList->at(i).GetRunName(k); + // get bin position of maximal data + t0Bin = musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo)); + // set t0 to maximum data position + runList->at(i).SetAddT0Bin(t0Bin, k-1, 2*j+1); + } + } + } break; default: break; @@ -806,6 +969,7 @@ Int_t main(Int_t argc, Char_t *argv[]) } break; case MSR_FITTYPE_ASYM: + case MSR_FITTYPE_BNMR: case MSR_FITTYPE_ASYM_RRF: if ((runList->at(i).GetRunNameSize() == 1) && (runList->at(i).GetForwardHistoNoSize() == 1)) { // no addruns / no grouping // feed necessary data forward