From 1ea877621fa461add637d8311a393f25cf8f0d11 Mon Sep 17 00:00:00 2001 From: Andreas Suter Date: Sun, 2 Feb 2020 17:12:08 +0100 Subject: [PATCH] adopted to the SECTOR command in combination with DKS. --- src/classes/PFitter.cpp | 271 ++++++++++++++++++++++++++--- src/classes/PRunAsymmetry.cpp | 2 +- src/classes/PRunAsymmetryBNMR.cpp | 2 +- src/classes/PRunAsymmetryRRF.cpp | 2 +- src/classes/PRunListCollection.cpp | 24 ++- src/classes/PRunMuMinus.cpp | 2 +- src/classes/PRunSingleHisto.cpp | 2 +- src/classes/PRunSingleHistoRRF.cpp | 2 +- src/include/PFitter.h | 9 +- src/include/PMsrHandler.h | 2 + src/include/PRunAsymmetry.h | 3 +- src/include/PRunAsymmetryBNMR.h | 3 +- src/include/PRunAsymmetryRRF.h | 3 +- src/include/PRunMuMinus.h | 3 +- src/include/PRunSingleHisto.h | 3 +- src/include/PRunSingleHistoRRF.h | 3 +- 16 files changed, 293 insertions(+), 43 deletions(-) diff --git a/src/classes/PFitter.cpp b/src/classes/PFitter.cpp index 922f9cc4..9040b60f 100644 --- a/src/classes/PFitter.cpp +++ b/src/classes/PFitter.cpp @@ -83,30 +83,38 @@ PSectorChisq::PSectorChisq(UInt_t noOfRuns) : fNoOfRuns(noOfRuns) { // init - fFirst = 0.0; fLast = 0.0; fChisq = 0.0; fNDF = 0; + fFirst.resize(fNoOfRuns); fChisqRun.resize(fNoOfRuns); fNDFRun.resize(fNoOfRuns); for (UInt_t i=0; iSet the time range for one sector + *

Set the time of the fgb of a given RUN * * @param first time stamp of the fgb - * @param last time stamp of the requested sector end + * @param idx index of the RUN */ -void PSectorChisq::SetTimeRange(Double_t first, Double_t last) +void PSectorChisq::SetRunFirstTime(Double_t first, UInt_t idx) { - // NOT YET IMPLEMENTED //as35 + if (idx > fNoOfRuns) { + std::cerr << "**WARNING** from PSectorChisq::SetRunFirstTime. It tries to set" << std::endl; + std::cerr << " a fgb time stamp with idx=" << idx << " which is larger than #RUNS=" << fNoOfRuns << "." << std::endl; + std::cerr << " Will ignore it, but you better check what is going on!" << std::endl; + return; + } + + fFirst[idx] = first; } //-------------------------------------------------------------------------- @@ -120,7 +128,14 @@ void PSectorChisq::SetTimeRange(Double_t first, Double_t last) */ void PSectorChisq::SetChisq(Double_t chisq, UInt_t idx) { - // NOT YET IMPLEMENTED //as35 + if (idx > fNoOfRuns) { + std::cerr << "**WARNING** from PSectorChisq::SetChisq. It tries to set" << std::endl; + std::cerr << " a chisq with idx=" << idx << " which is larger than #RUNS=" << fNoOfRuns << "." << std::endl; + std::cerr << " Will ignore it, but you better check what is going on!" << std::endl; + return; + } + + fChisqRun[idx] = chisq; } //-------------------------------------------------------------------------- @@ -134,7 +149,33 @@ void PSectorChisq::SetChisq(Double_t chisq, UInt_t idx) */ void PSectorChisq::SetNDF(Double_t ndf, UInt_t idx) { - // NOT YET IMPLEMENTED //as35 + if (idx > fNoOfRuns) { + std::cerr << "**WARNING** from PSectorChisq::SetNDF. It tries to set" << std::endl; + std::cerr << " a NDF with idx=" << idx << " which is larger than #RUNS=" << fNoOfRuns << "." << std::endl; + std::cerr << " Will ignore it, but you better check what is going on!" << std::endl; + return; + } + + fNDFRun[idx] = ndf; +} + +//-------------------------------------------------------------------------- +// GetTimeRangeFirst +//-------------------------------------------------------------------------- +/** + *

Get the fgb time of RUN with index idx. If idx is out-of-range + * PMUSR_UNDEFINED is returned. + * + * @param idx index of the RUN + * + * return: return the fgb time of RUN with index idx. + */ +Double_t PSectorChisq::GetTimeRangeFirst(UInt_t idx) +{ + if (idx > fNoOfRuns) + return PMUSR_UNDEFINED; + + return fFirst[idx]; } //-------------------------------------------------------------------------- @@ -196,6 +237,8 @@ PFitter::PFitter(PMsrHandler *runInfo, PRunListCollection *runListCollection, Bo fStrategy = 1; // 0=low, 1=default, 2=high + fSectorFlag = false; + fParams = *(runInfo->GetMsrParamList()); fCmdLines = *runInfo->GetMsrCommands(); @@ -311,6 +354,11 @@ Bool_t PFitter::DoFit() // check if only chisq/maxLH shall be calculated once if (fChisqOnly) { + + // check for sector command + if (fSectorFlag) + PrepareSector(); + std::vector param = fMnUserParams.Params(); std::vector error = fMnUserParams.Errors(); Int_t usedParams = 0; @@ -331,15 +379,15 @@ Bool_t PFitter::DoFit() if (fUseChi2) { // calculate expected chisq Double_t totalExpectedChisq = 0.0; - std::vector expectedChisqPerHisto; + std::vector expectedChisqPerRun; if (fDKSReady) - fFitterFcnDKS->CalcExpectedChiSquare(param, totalExpectedChisq, expectedChisqPerHisto); + fFitterFcnDKS->CalcExpectedChiSquare(param, totalExpectedChisq, expectedChisqPerRun); else - fFitterFcn->CalcExpectedChiSquare(param, totalExpectedChisq, expectedChisqPerHisto); + fFitterFcn->CalcExpectedChiSquare(param, totalExpectedChisq, expectedChisqPerRun); // calculate chisq per run - std::vector chisqPerHisto; + std::vector chisqPerRun; for (UInt_t i=0; iGetMsrRunList()->size(); i++) { - chisqPerHisto.push_back(fRunListCollection->GetSingleRunChisq(param, i)); + chisqPerRun.push_back(fRunListCollection->GetSingleRunChisq(param, i)); } std::cout << std::endl << std::endl << ">> chisq = " << val << ", NDF = " << ndf << ", chisq/NDF = " << val/ndf; @@ -347,32 +395,173 @@ Bool_t PFitter::DoFit() if (totalExpectedChisq != 0.0) { std::cout << std::endl << ">> expected chisq = " << totalExpectedChisq << ", NDF = " << ndf << ", expected chisq/NDF = " << totalExpectedChisq/ndf; UInt_t ndf_histo = 0; - for (UInt_t i=0; iGetNoOfFittedBins(i) - fRunInfo->GetNoOfFitParameters(i); else ndf_histo = fFitterFcn->GetNoOfFittedBins(i) - fRunInfo->GetNoOfFitParameters(i); if (ndf_histo > 0) - std::cout << std::endl << ">> run block " << i+1 << ": (NDF/red.chisq/red.chisq_e) = (" << ndf_histo << "/" << chisqPerHisto[i]/ndf_histo << "/" << expectedChisqPerHisto[i]/ndf_histo << ")"; + std::cout << std::endl << ">> run block " << i+1 << ": (NDF/red.chisq/red.chisq_e) = (" << ndf_histo << "/" << chisqPerRun[i]/ndf_histo << "/" << expectedChisqPerRun[i]/ndf_histo << ")"; } - } else if (chisqPerHisto.size() > 0) { // in case expected chisq is not applicable like for asymmetry fits + } else if (chisqPerRun.size() > 0) { // in case expected chisq is not applicable like for asymmetry fits UInt_t ndf_histo = 0; - for (UInt_t i=0; iGetNoOfFittedBins(i) - fRunInfo->GetNoOfFitParameters(i); else ndf_histo = fFitterFcn->GetNoOfFittedBins(i) - fRunInfo->GetNoOfFitParameters(i); if (ndf_histo > 0) - std::cout << std::endl << ">> run block " << i+1 << ": (NDF/red.chisq) = (" << ndf_histo << "/" << chisqPerHisto[i]/ndf_histo << ")"; + std::cout << std::endl << ">> run block " << i+1 << ": (NDF/red.chisq) = (" << ndf_histo << "/" << chisqPerRun[i]/ndf_histo << ")"; } } // clean up - chisqPerHisto.clear(); - expectedChisqPerHisto.clear(); + chisqPerRun.clear(); + expectedChisqPerRun.clear(); + + if (fSectorFlag) { + PDoublePairVector secFitRange; + secFitRange.resize(1); + for (UInt_t k=0; kSetFitRange(secFitRange); + // calculate chisq and NDF + if (fDKSReady) { + ndf = static_cast(fFitterFcnDKS->GetTotalNoOfFittedBins()) - usedParams; + val = (*fFitterFcnDKS)(param); + } else { + ndf = static_cast(fFitterFcn->GetTotalNoOfFittedBins()) - usedParams; + val = (*fFitterFcn)(param); + } + // calculate expected chisq + totalExpectedChisq = 0.0; + if (fDKSReady) + fFitterFcnDKS->CalcExpectedChiSquare(param, totalExpectedChisq, expectedChisqPerRun); + else + fFitterFcn->CalcExpectedChiSquare(param, totalExpectedChisq, expectedChisqPerRun); + // calculate chisq per run + for (UInt_t i=0; iGetMsrRunList()->size(); i++) { + chisqPerRun.push_back(fRunListCollection->GetSingleRunChisq(param, i)); + } + + std::cout << std::endl; + std::cout << "++++" << std::endl; + std::cout << ">> Sector " << k << ": FitRange: " << secFitRange[0].first << ", " << secFitRange[0].second << std::endl; + std::cout << ">> chisq = " << val << ", NDF = " << ndf << ", chisq/NDF = " << val/ndf; + + if (totalExpectedChisq != 0.0) { + std::cout << std::endl << ">> expected chisq = " << totalExpectedChisq << ", NDF = " << ndf << ", expected chisq/NDF = " << totalExpectedChisq/ndf; + UInt_t ndf_histo = 0; + for (UInt_t i=0; iGetNoOfFittedBins(i) - fRunInfo->GetNoOfFitParameters(i); + else + ndf_histo = fFitterFcn->GetNoOfFittedBins(i) - fRunInfo->GetNoOfFitParameters(i); + if (ndf_histo > 0) + std::cout << std::endl << ">> run block " << i+1 << ": (NDF/red.chisq/red.chisq_e) = (" << ndf_histo << "/" << chisqPerRun[i]/ndf_histo << "/" << expectedChisqPerRun[i]/ndf_histo << ")"; + } + } else if (chisqPerRun.size() > 0) { // in case expected chisq is not applicable like for asymmetry fits + UInt_t ndf_histo = 0; + for (UInt_t i=0; iGetNoOfFittedBins(i) - fRunInfo->GetNoOfFitParameters(i); + else + ndf_histo = fFitterFcn->GetNoOfFittedBins(i) - fRunInfo->GetNoOfFitParameters(i); + if (ndf_histo > 0) + std::cout << std::endl << ">> run block " << i+1 << ": (NDF/red.chisq) = (" << ndf_histo << "/" << chisqPerRun[i]/ndf_histo << ")"; + } + } + // clean up + chisqPerRun.clear(); + expectedChisqPerRun.clear(); + } + } } else { // max. log likelihood + // calculate expected maxLH + Double_t totalExpectedMaxLH = 0.0; + std::vector expectedMaxLHPerRun; + if (fDKSReady) + fFitterFcnDKS->CalcExpectedChiSquare(param, totalExpectedMaxLH, expectedMaxLHPerRun); + else + fFitterFcn->CalcExpectedChiSquare(param, totalExpectedMaxLH, expectedMaxLHPerRun); + // calculate maxLH per run + std::vector maxLHPerRun; + for (UInt_t i=0; iGetMsrRunList()->size(); i++) { + maxLHPerRun.push_back(fRunListCollection->GetSingleRunMaximumLikelihood(param, i)); + } + std::cout << std::endl << std::endl << ">> maxLH = " << val << ", NDF = " << ndf << ", maxLH/NDF = " << val/ndf; + + if (totalExpectedMaxLH != 0.0) { + std::cout << std::endl << ">> expected maxLH = " << totalExpectedMaxLH << ", NDF = " << ndf << ", expected maxLH/NDF = " << totalExpectedMaxLH/ndf; + UInt_t ndf_histo = 0; + for (UInt_t i=0; iGetNoOfFittedBins(i) - fRunInfo->GetNoOfFitParameters(i); + else + ndf_histo = fFitterFcn->GetNoOfFittedBins(i) - fRunInfo->GetNoOfFitParameters(i); + if (ndf_histo > 0) + std::cout << std::endl << ">> run block " << i+1 << ": (NDF/maxLH.chisq/maxLH.chisq_e) = (" << ndf_histo << "/" << maxLHPerRun[i]/ndf_histo << "/" << expectedMaxLHPerRun[i]/ndf_histo << ")"; + } + } + + // clean up + maxLHPerRun.clear(); + expectedMaxLHPerRun.clear(); + + if (fSectorFlag) { + PDoublePairVector secFitRange; + secFitRange.resize(1); + for (UInt_t k=0; kSetFitRange(secFitRange); + // calculate chisq and NDF + if (fDKSReady) { + ndf = static_cast(fFitterFcnDKS->GetTotalNoOfFittedBins()) - usedParams; + val = (*fFitterFcnDKS)(param); + } else { + ndf = static_cast(fFitterFcn->GetTotalNoOfFittedBins()) - usedParams; + val = (*fFitterFcn)(param); + } + // calculate expected maxLH + totalExpectedMaxLH = 0.0; + if (fDKSReady) + fFitterFcnDKS->CalcExpectedChiSquare(param, totalExpectedMaxLH, expectedMaxLHPerRun); + else + fFitterFcn->CalcExpectedChiSquare(param, totalExpectedMaxLH, expectedMaxLHPerRun); + // calculate maxLH per run + for (UInt_t i=0; iGetMsrRunList()->size(); i++) { + maxLHPerRun.push_back(fRunListCollection->GetSingleRunMaximumLikelihood(param, i)); + } + + std::cout << std::endl; + std::cout << "++++" << std::endl; + std::cout << ">> Sector " << k << ": FitRange: " << secFitRange[0].first << ", " << secFitRange[0].second << std::endl; + std::cout << ">> maxLH = " << val << ", NDF = " << ndf << ", maxLH/NDF = " << val/ndf; + + if (totalExpectedMaxLH != 0.0) { + std::cout << std::endl << ">> expected maxLH = " << totalExpectedMaxLH << ", NDF = " << ndf << ", expected maxLH/NDF = " << totalExpectedMaxLH/ndf; + UInt_t ndf_histo = 0; + for (UInt_t i=0; iGetNoOfFittedBins(i) - fRunInfo->GetNoOfFitParameters(i); + else + ndf_histo = fFitterFcn->GetNoOfFittedBins(i) - fRunInfo->GetNoOfFitParameters(i); + if (ndf_histo > 0) + std::cout << std::endl << ">> run block " << i+1 << ": (NDF/maxLH.chisq/maxLH.chisq_e) = (" << ndf_histo << "/" << maxLHPerRun[i]/ndf_histo << "/" << expectedMaxLHPerRun[i]/ndf_histo << ")"; + } + } + + // clean up + maxLHPerRun.clear(); + expectedMaxLHPerRun.clear(); + } + } } std::cout << std::endl << std::endl; return true; @@ -449,6 +638,9 @@ Bool_t PFitter::DoFit() case PMN_SCAN: status = ExecuteScan(); break; + case PMN_SECTOR: + // nothing to be done here + break; case PMN_SIMPLEX: status = ExecuteSimplex(); break; @@ -1057,6 +1249,7 @@ Bool_t PFitter::CheckCommands() cmd.second = cmdLineNo; fCmdList.push_back(cmd); } else if (line.Contains("SECTOR", TString::kIgnoreCase)) { + fSectorFlag = true; cmd.first = PMN_SECTOR; cmd.second = cmdLineNo; fCmdList.push_back(cmd); @@ -1080,11 +1273,15 @@ Bool_t PFitter::CheckCommands() tokens = nullptr; } fIsValid = false; + fSectorFlag = false; break; } Double_t dval; for (Int_t i=1; iGetEntries(); i++) { + // keep time range of sector + PSectorChisq sec(fRunInfo->GetNoOfRuns()); + // get parse tokens ostr = dynamic_cast(tokens->At(i)); str = ostr->GetString(); if (str.IsFloat()) { @@ -1103,9 +1300,13 @@ Bool_t PFitter::CheckCommands() tokens = nullptr; } fIsValid = false; + fSectorFlag = false; return fIsValid; } + sec.SetRunFirstTime(fOriginalFitRange[j].first, j); // keep fgb time stamp for sector } + sec.SetSectorTime(dval); + fSector.push_back(sec); } else { // sector element is NOT a float std::cerr << std::endl << ">> PFitter::CheckCommands(): **FATAL ERROR** in line " << it->fLineNo; std::cerr << std::endl << ">> " << line.Data(); @@ -1118,6 +1319,7 @@ Bool_t PFitter::CheckCommands() tokens = nullptr; } fIsValid = false; + fSectorFlag = false; break; } } @@ -1283,7 +1485,7 @@ Bool_t PFitter::ExecuteFitRange(UInt_t lineNo) PMsrRunList *runList = fRunInfo->GetMsrRunList(); - // execute command, no error checking needed since this has been already carried out in CheckCommands() + // execute command, no error checking needed since this has been already carried out in CheckCommands() if (tokens->GetEntries() == 2) { // reset command fRunListCollection->SetFitRange(fOriginalFitRange); } else if (tokens->GetEntries() == 3) { // single fit range for all runs @@ -2308,11 +2510,36 @@ Bool_t PFitter::ExecuteSimplex() return true; } +//-------------------------------------------------------------------------- +// PrepareSector +//-------------------------------------------------------------------------- +/** + *

Collect all the necessary chisq/maxLH sector information. + */ +void PFitter::PrepareSector() +{ + // NOT YET IMPLEMENTED //as35 + +/* + for (UInt_t i=0; i +++++" << std::endl; + std::cout << "debug> sector " << i << std::endl; + std::cout << "debug> noOfRuns: " << fSector[i].GetNoRuns() << std::endl; + for (UInt_t j=0; j ----" << std::endl; + std::cout << "debug> RUN BLOCK " << j << std::endl; + std::cout << "debug> Sector Time Range: " << fSector[i].GetTimeRangeFirst(j) << ", " << fSector[i].GetTimeRangeLast() << std::endl; + } + } +*/ +} + //-------------------------------------------------------------------------- // ExecuteSector //-------------------------------------------------------------------------- /** - *

Collects all the necessary chisq/maxLH for the given sectors. + *

Write all chisq/maxLH sector information to MINUIT.OUTPUT and dump it + * to stdout. * * return: if the sector command was successful, otherwise return flase. */ diff --git a/src/classes/PRunAsymmetry.cpp b/src/classes/PRunAsymmetry.cpp index 2616ea1b..eb6edba7 100644 --- a/src/classes/PRunAsymmetry.cpp +++ b/src/classes/PRunAsymmetry.cpp @@ -378,7 +378,7 @@ void PRunAsymmetry::SetFitRangeBin(const TString fitRange) } //-------------------------------------------------------------------------- -// CalcNoOfFitBins (protected) +// CalcNoOfFitBins (public) //-------------------------------------------------------------------------- /** *

Calculate the number of fitted bins for the current fit range. diff --git a/src/classes/PRunAsymmetryBNMR.cpp b/src/classes/PRunAsymmetryBNMR.cpp index 0235c989..9b95c074 100644 --- a/src/classes/PRunAsymmetryBNMR.cpp +++ b/src/classes/PRunAsymmetryBNMR.cpp @@ -400,7 +400,7 @@ void PRunAsymmetryBNMR::SetFitRangeBin(const TString fitRange) } //-------------------------------------------------------------------------- -// CalcNoOfFitBins (protected) +// CalcNoOfFitBins (public) //-------------------------------------------------------------------------- /** *

Calculate the number of fitted bins for the current fit range. diff --git a/src/classes/PRunAsymmetryRRF.cpp b/src/classes/PRunAsymmetryRRF.cpp index 64d2fdc2..0c39f0e7 100644 --- a/src/classes/PRunAsymmetryRRF.cpp +++ b/src/classes/PRunAsymmetryRRF.cpp @@ -370,7 +370,7 @@ void PRunAsymmetryRRF::SetFitRangeBin(const TString fitRange) } //-------------------------------------------------------------------------- -// CalcNoOfFitBins (protected) +// CalcNoOfFitBins (public) //-------------------------------------------------------------------------- /** *

Calculate the number of fitted bins for the current fit range. diff --git a/src/classes/PRunListCollection.cpp b/src/classes/PRunListCollection.cpp index 522e7792..11cfcb03 100644 --- a/src/classes/PRunListCollection.cpp +++ b/src/classes/PRunListCollection.cpp @@ -206,18 +206,30 @@ void PRunListCollection::SetFitRange(const TString fitRange) */ void PRunListCollection::SetFitRange(const PDoublePairVector fitRange) { - for (UInt_t i=0; iSetFitRange(fitRange); - for (UInt_t i=0; iCalcNoOfFitBins(); // needed to update fStartTimeBin, fEndTimeBin + } + for (UInt_t i=0; iSetFitRange(fitRange); - for (UInt_t i=0; iCalcNoOfFitBins(); // needed to update fStartTimeBin, fEndTimeBin + } + for (UInt_t i=0; iSetFitRange(fitRange); - for (UInt_t i=0; iCalcNoOfFitBins(); // needed to update fStartTimeBin, fEndTimeBin + } + for (UInt_t i=0; iSetFitRange(fitRange); - for (UInt_t i=0; iCalcNoOfFitBins(); // needed to update fStartTimeBin, fEndTimeBin + } + for (UInt_t i=0; iSetFitRange(fitRange); - for (UInt_t i=0; iCalcNoOfFitBins(); // needed to update fStartTimeBin, fEndTimeBin + } + for (UInt_t i=0; iSetFitRange(fitRange); + fRunMuMinusList[i]->CalcNoOfFitBins(); // needed to update fStartTimeBin, fEndTimeBin + } for (UInt_t i=0; iSetFitRange(fitRange); } diff --git a/src/classes/PRunMuMinus.cpp b/src/classes/PRunMuMinus.cpp index 83101a8e..38240625 100644 --- a/src/classes/PRunMuMinus.cpp +++ b/src/classes/PRunMuMinus.cpp @@ -382,7 +382,7 @@ void PRunMuMinus::SetFitRangeBin(const TString fitRange) } //-------------------------------------------------------------------------- -// CalcNoOfFitBins (private) +// CalcNoOfFitBins (public) //-------------------------------------------------------------------------- /** *

Calculate the number of fitted bins for the current fit range. diff --git a/src/classes/PRunSingleHisto.cpp b/src/classes/PRunSingleHisto.cpp index 4931703f..b3d15f09 100644 --- a/src/classes/PRunSingleHisto.cpp +++ b/src/classes/PRunSingleHisto.cpp @@ -659,7 +659,7 @@ void PRunSingleHisto::SetFitRangeBin(const TString fitRange) } //-------------------------------------------------------------------------- -// CalcNoOfFitBins (protected) +// CalcNoOfFitBins (public) //-------------------------------------------------------------------------- /** *

Calculate the number of fitted bins for the current fit range. diff --git a/src/classes/PRunSingleHistoRRF.cpp b/src/classes/PRunSingleHistoRRF.cpp index ec9ab895..e13c1c8d 100644 --- a/src/classes/PRunSingleHistoRRF.cpp +++ b/src/classes/PRunSingleHistoRRF.cpp @@ -388,7 +388,7 @@ void PRunSingleHistoRRF::SetFitRangeBin(const TString fitRange) } //-------------------------------------------------------------------------- -// CalcNoOfFitBins (protected) +// CalcNoOfFitBins (public) //-------------------------------------------------------------------------- /** *

Calculate the number of fitted bins for the current fit range. diff --git a/src/include/PFitter.h b/src/include/PFitter.h index 47e5f722..724c1f60 100644 --- a/src/include/PFitter.h +++ b/src/include/PFitter.h @@ -74,13 +74,14 @@ class PSectorChisq public: PSectorChisq(UInt_t noOfRuns); - void SetTimeRange(Double_t first, Double_t last); + void SetRunFirstTime(Double_t first, UInt_t idx); + void SetSectorTime(Double_t last) { fLast = last; } void SetChisq(Double_t chisq) { fChisq = chisq; } void SetChisq(Double_t chisq, UInt_t idx); void SetNDF(Double_t ndf) { fNDF = ndf; } void SetNDF(Double_t ndf, UInt_t idx); - Double_t GetTimeRangeFirst() { return fFirst; } + Double_t GetTimeRangeFirst(UInt_t idx); Double_t GetTimeRangeLast() { return fLast; } Double_t GetChisq() { return fChisq; } UInt_t GetNDF() { return fNDF; } @@ -90,10 +91,10 @@ class PSectorChisq private: UInt_t fNoOfRuns; ///< number of runs presesent - Double_t fFirst; ///< time stamp for fgb Double_t fLast; ///< requested time stamp Double_t fChisq; ///< chisq or maxLH for the sector UInt_t fNDF; ///< NDF for the sector + std::vector fFirst; ///< time stamp for fgb for a given run std::vector fChisqRun; ///< chisq or maxLH for the sector and run std::vector fNDFRun; ///< NDF for the sector and run }; @@ -151,6 +152,7 @@ class PFitter PStringVector fElapsedTime; + Bool_t fSectorFlag; ///< sector command present flag std::vector fSector; ///< stores all chisq/maxLH sector information // commands @@ -171,6 +173,7 @@ class PFitter Bool_t ExecuteScan(); Bool_t ExecuteSave(Bool_t first); Bool_t ExecuteSimplex(); + void PrepareSector(); Bool_t ExecuteSector(); Double_t MilliTime(); diff --git a/src/include/PMsrHandler.h b/src/include/PMsrHandler.h index 0ea28e59..ead9f83d 100644 --- a/src/include/PMsrHandler.h +++ b/src/include/PMsrHandler.h @@ -68,6 +68,8 @@ class PMsrHandler virtual TString* GetMsrFileDirectoryPath() { return &fMsrFileDirectoryPath; } + virtual UInt_t GetNoOfRuns() { return fRuns.size(); } + virtual UInt_t GetNoOfParams() { return fParam.size(); } virtual const TString& GetFileName() const { return fFileName; } diff --git a/src/include/PRunAsymmetry.h b/src/include/PRunAsymmetry.h index 2d028cbb..798e26da 100644 --- a/src/include/PRunAsymmetry.h +++ b/src/include/PRunAsymmetry.h @@ -56,8 +56,9 @@ class PRunAsymmetry : public PRunBase virtual Int_t GetEndTimeBin() { return fEndTimeBin; } virtual Int_t GetPacking() { return fPacking; } - protected: virtual void CalcNoOfFitBins(); + + protected: virtual Bool_t PrepareData(); virtual Bool_t PrepareFitData(); virtual Bool_t PrepareViewData(PRawRunData* runData, UInt_t histoNo[2]); diff --git a/src/include/PRunAsymmetryBNMR.h b/src/include/PRunAsymmetryBNMR.h index 688c84c8..bc827273 100644 --- a/src/include/PRunAsymmetryBNMR.h +++ b/src/include/PRunAsymmetryBNMR.h @@ -57,8 +57,9 @@ class PRunAsymmetryBNMR : public PRunBase virtual Int_t GetEndTimeBin() { return fEndTimeBin; } virtual Int_t GetPacking() { return fPacking; } - protected: virtual void CalcNoOfFitBins(); + + protected: virtual Bool_t PrepareData(); virtual Bool_t PrepareFitData(); virtual Bool_t PrepareViewData(PRawRunData* runData, UInt_t histoNo[2]); diff --git a/src/include/PRunAsymmetryRRF.h b/src/include/PRunAsymmetryRRF.h index 78971e76..4aef2598 100644 --- a/src/include/PRunAsymmetryRRF.h +++ b/src/include/PRunAsymmetryRRF.h @@ -55,8 +55,9 @@ class PRunAsymmetryRRF : public PRunBase virtual Int_t GetStartTimeBin() { return fStartTimeBin; } virtual Int_t GetEndTimeBin() { return fEndTimeBin; } - protected: virtual void CalcNoOfFitBins(); + + protected: virtual Bool_t PrepareData(); virtual Bool_t PrepareFitData(); virtual Bool_t PrepareViewData(PRawRunData* runData, UInt_t histoNo[2]); diff --git a/src/include/PRunMuMinus.h b/src/include/PRunMuMinus.h index 8c9a0e20..f95056d1 100644 --- a/src/include/PRunMuMinus.h +++ b/src/include/PRunMuMinus.h @@ -55,8 +55,9 @@ class PRunMuMinus : public PRunBase virtual Int_t GetEndTimeBin() { return fEndTimeBin; } virtual Int_t GetPacking() { return fPacking; } - protected: virtual void CalcNoOfFitBins(); + + protected: virtual Bool_t PrepareData(); virtual Bool_t PrepareFitData(PRawRunData* runData, const UInt_t histoNo); virtual Bool_t PrepareRawViewData(PRawRunData* runData, const UInt_t histoNo); diff --git a/src/include/PRunSingleHisto.h b/src/include/PRunSingleHisto.h index 6b3a02d1..2152cae6 100644 --- a/src/include/PRunSingleHisto.h +++ b/src/include/PRunSingleHisto.h @@ -59,8 +59,9 @@ class PRunSingleHisto : public PRunBase virtual Int_t GetPacking() { return fPacking; } virtual Bool_t GetScaleN0AndBkg() { return fScaleN0AndBkg; } - protected: virtual void CalcNoOfFitBins(); + + protected: virtual Bool_t PrepareData(); virtual Bool_t PrepareFitData(PRawRunData* runData, const UInt_t histoNo); virtual Bool_t PrepareRawViewData(PRawRunData* runData, const UInt_t histoNo); diff --git a/src/include/PRunSingleHistoRRF.h b/src/include/PRunSingleHistoRRF.h index 5631bfb4..8f92dcfe 100644 --- a/src/include/PRunSingleHistoRRF.h +++ b/src/include/PRunSingleHistoRRF.h @@ -54,8 +54,9 @@ class PRunSingleHistoRRF : public PRunBase virtual Int_t GetStartTimeBin() { return fStartTimeBin; } virtual Int_t GetEndTimeBin() { return fEndTimeBin; } - protected: virtual void CalcNoOfFitBins(); + + protected: virtual Bool_t PrepareData(); virtual Bool_t PrepareFitData(PRawRunData* runData, const UInt_t histoNo); virtual Bool_t PrepareViewData(PRawRunData* runData, const UInt_t histoNo);