first steps towards asymmetry RRF fit.
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2014 by Andreas Suter *
|
||||
* Copyright (C) 2007-2016 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
@ -70,6 +70,12 @@ PRunListCollection::~PRunListCollection()
|
||||
}
|
||||
fRunAsymmetryList.clear();
|
||||
|
||||
for (UInt_t i=0; i<fRunAsymmetryRRFList.size(); i++) {
|
||||
fRunAsymmetryRRFList[i]->CleanUp();
|
||||
fRunAsymmetryRRFList[i]->~PRunAsymmetryRRF();
|
||||
}
|
||||
fRunAsymmetryRRFList.clear();
|
||||
|
||||
for (UInt_t i=0; i<fRunMuMinusList.size(); i++) {
|
||||
fRunMuMinusList[i]->CleanUp();
|
||||
fRunMuMinusList[i]->~PRunMuMinus();
|
||||
@ -122,6 +128,11 @@ Bool_t PRunListCollection::Add(Int_t runNo, EPMusrHandleTag tag)
|
||||
if (!fRunAsymmetryList[fRunAsymmetryList.size()-1]->IsValid())
|
||||
success = false;
|
||||
break;
|
||||
case PRUN_ASYMMETRY_RRF:
|
||||
fRunAsymmetryRRFList.push_back(new PRunAsymmetryRRF(fMsrInfo, fData, runNo, tag));
|
||||
if (!fRunAsymmetryRRFList[fRunAsymmetryRRFList.size()-1]->IsValid())
|
||||
success = false;
|
||||
break;
|
||||
case PRUN_MU_MINUS:
|
||||
fRunMuMinusList.push_back(new PRunMuMinus(fMsrInfo, fData, runNo, tag));
|
||||
if (!fRunMuMinusList[fRunMuMinusList.size()-1]->IsValid())
|
||||
@ -162,6 +173,8 @@ void PRunListCollection::SetFitRange(const TString fitRange)
|
||||
fRunSingleHistoRRFList[i]->SetFitRangeBin(fitRange);
|
||||
for (UInt_t i=0; i<fRunAsymmetryList.size(); i++)
|
||||
fRunAsymmetryList[i]->SetFitRangeBin(fitRange);
|
||||
for (UInt_t i=0; i<fRunAsymmetryRRFList.size(); i++)
|
||||
fRunAsymmetryRRFList[i]->SetFitRangeBin(fitRange);
|
||||
for (UInt_t i=0; i<fRunMuMinusList.size(); i++)
|
||||
fRunMuMinusList[i]->SetFitRangeBin(fitRange);
|
||||
for (UInt_t i=0; i<fRunNonMusrList.size(); i++)
|
||||
@ -186,6 +199,8 @@ void PRunListCollection::SetFitRange(const PDoublePairVector fitRange)
|
||||
fRunSingleHistoRRFList[i]->SetFitRange(fitRange);
|
||||
for (UInt_t i=0; i<fRunAsymmetryList.size(); i++)
|
||||
fRunAsymmetryList[i]->SetFitRange(fitRange);
|
||||
for (UInt_t i=0; i<fRunAsymmetryRRFList.size(); i++)
|
||||
fRunAsymmetryRRFList[i]->SetFitRange(fitRange);
|
||||
for (UInt_t i=0; i<fRunMuMinusList.size(); i++)
|
||||
fRunMuMinusList[i]->SetFitRange(fitRange);
|
||||
for (UInt_t i=0; i<fRunNonMusrList.size(); i++)
|
||||
@ -255,6 +270,27 @@ Double_t PRunListCollection::GetAsymmetryChisq(const std::vector<Double_t>& par)
|
||||
return chisq;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetAsymmetryRRFChisq (public)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Calculates chi-square of <em>all</em> asymmetry RRF runs of a msr-file.
|
||||
*
|
||||
* <b>return:</b>
|
||||
* - chi-square of all asymmetry RRF runs of the msr-file
|
||||
*
|
||||
* \param par fit parameter vector
|
||||
*/
|
||||
Double_t PRunListCollection::GetAsymmetryRRFChisq(const std::vector<Double_t>& par) const
|
||||
{
|
||||
Double_t chisq = 0.0;
|
||||
|
||||
for (UInt_t i=0; i<fRunAsymmetryRRFList.size(); i++)
|
||||
chisq += fRunAsymmetryRRFList[i]->CalcChiSquare(par);
|
||||
|
||||
return chisq;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetMuMinusChisq (public)
|
||||
//--------------------------------------------------------------------------
|
||||
@ -341,6 +377,9 @@ Double_t PRunListCollection::GetSingleHistoChisqExpected(const std::vector<Doubl
|
||||
case PRUN_ASYMMETRY:
|
||||
expectedChisq = fRunAsymmetryList[subIdx]->CalcChiSquareExpected(par);
|
||||
break;
|
||||
case PRUN_ASYMMETRY_RRF:
|
||||
expectedChisq = fRunAsymmetryRRFList[subIdx]->CalcChiSquareExpected(par);
|
||||
break;
|
||||
case PRUN_MU_MINUS:
|
||||
expectedChisq = fRunMuMinusList[subIdx]->CalcChiSquareExpected(par);
|
||||
break;
|
||||
@ -399,6 +438,9 @@ Double_t PRunListCollection::GetSingleRunChisq(const std::vector<Double_t>& par,
|
||||
case PRUN_ASYMMETRY:
|
||||
chisq = fRunAsymmetryList[subIdx]->CalcChiSquare(par);
|
||||
break;
|
||||
case PRUN_ASYMMETRY_RRF:
|
||||
chisq = fRunAsymmetryRRFList[subIdx]->CalcChiSquare(par);
|
||||
break;
|
||||
case PRUN_MU_MINUS:
|
||||
chisq = fRunMuMinusList[subIdx]->CalcChiSquare(par);
|
||||
break;
|
||||
@ -476,6 +518,28 @@ Double_t PRunListCollection::GetAsymmetryMaximumLikelihood(const std::vector<Dou
|
||||
return mlh;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetAsymmetryRRFMaximumLikelihood (public)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p> Since it is not clear yet how to handle asymmetry fits with max likelihood
|
||||
* the chi square will be used!
|
||||
*
|
||||
* <b>return:</b>
|
||||
* - chi-square of all asymmetry RRF runs of the msr-file
|
||||
*
|
||||
* \param par fit parameter vector
|
||||
*/
|
||||
Double_t PRunListCollection::GetAsymmetryRRFMaximumLikelihood(const std::vector<Double_t>& par) const
|
||||
{
|
||||
Double_t mlh = 0.0;
|
||||
|
||||
for (UInt_t i=0; i<fRunAsymmetryRRFList.size(); i++)
|
||||
mlh += fRunAsymmetryRRFList[i]->CalcChiSquare(par);
|
||||
|
||||
return mlh;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetMuMinusMaximumLikelihood (public)
|
||||
//--------------------------------------------------------------------------
|
||||
@ -563,6 +627,9 @@ UInt_t PRunListCollection::GetNoOfBinsFitted(const UInt_t idx) const
|
||||
case PRUN_ASYMMETRY:
|
||||
result = fRunAsymmetryList[subIdx]->GetNoOfFitBins();
|
||||
break;
|
||||
case PRUN_ASYMMETRY_RRF:
|
||||
result = fRunAsymmetryRRFList[subIdx]->GetNoOfFitBins();
|
||||
break;
|
||||
case PRUN_MU_MINUS:
|
||||
result = fRunMuMinusList[subIdx]->GetNoOfFitBins();
|
||||
break;
|
||||
@ -599,6 +666,9 @@ UInt_t PRunListCollection::GetTotalNoOfBinsFitted() const
|
||||
for (UInt_t i=0; i<fRunAsymmetryList.size(); i++)
|
||||
counts += fRunAsymmetryList[i]->GetNoOfFitBins();
|
||||
|
||||
for (UInt_t i=0; i<fRunAsymmetryRRFList.size(); i++)
|
||||
counts += fRunAsymmetryRRFList[i]->GetNoOfFitBins();
|
||||
|
||||
for (UInt_t i=0; i<fRunMuMinusList.size(); i++)
|
||||
counts += fRunMuMinusList[i]->GetNoOfFitBins();
|
||||
|
||||
@ -628,7 +698,7 @@ PRunData* PRunListCollection::GetSingleHisto(UInt_t index, EDataSwitch tag)
|
||||
switch (tag) {
|
||||
case kIndex:
|
||||
if ((index < 0) || (index >= fRunSingleHistoList.size())) {
|
||||
cerr << endl << "PRunListCollection::GetSingleHisto: **ERROR** index = " << index << " out of bounds";
|
||||
cerr << endl << ">> PRunListCollection::GetSingleHisto(): **ERROR** index = " << index << " out of bounds";
|
||||
cerr << endl;
|
||||
return 0;
|
||||
}
|
||||
@ -671,7 +741,7 @@ PRunData* PRunListCollection::GetSingleHistoRRF(UInt_t index, EDataSwitch tag)
|
||||
switch (tag) {
|
||||
case kIndex:
|
||||
if ((index < 0) || (index >= fRunSingleHistoRRFList.size())) {
|
||||
cerr << endl << "PRunListCollection::GetSingleHistoRRF: **ERROR** index = " << index << " out of bounds";
|
||||
cerr << endl << ">> PRunListCollection::GetSingleHistoRRF(): **ERROR** index = " << index << " out of bounds";
|
||||
cerr << endl;
|
||||
return 0;
|
||||
}
|
||||
@ -714,7 +784,7 @@ PRunData* PRunListCollection::GetAsymmetry(UInt_t index, EDataSwitch tag)
|
||||
switch (tag) {
|
||||
case kIndex: // called from musrfit when dumping the data
|
||||
if ((index < 0) || (index > fRunAsymmetryList.size())) {
|
||||
cerr << endl << "PRunListCollection::GetAsymmetry: **ERROR** index = " << index << " out of bounds";
|
||||
cerr << endl << ">> PRunListCollection::GetAsymmetry(): **ERROR** index = " << index << " out of bounds";
|
||||
cerr << endl;
|
||||
return 0;
|
||||
}
|
||||
@ -737,6 +807,49 @@ PRunData* PRunListCollection::GetAsymmetry(UInt_t index, EDataSwitch tag)
|
||||
return data;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetAsymmetryRRF (public)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Get a processed asymmetry RRF data set.
|
||||
*
|
||||
* <b>return:</b>
|
||||
* - pointer to the run data set (processed data) if data set is found
|
||||
* - null pointer otherwise
|
||||
*
|
||||
* \param index msr-file run index
|
||||
* \param tag kIndex -> data at index, kRunNo -> data of given run no
|
||||
*/
|
||||
PRunData* PRunListCollection::GetAsymmetryRRF(UInt_t index, EDataSwitch tag)
|
||||
{
|
||||
PRunData *data = 0;
|
||||
|
||||
switch (tag) {
|
||||
case kIndex: // called from musrfit when dumping the data
|
||||
if ((index < 0) || (index > fRunAsymmetryRRFList.size())) {
|
||||
cerr << endl << ">> PRunListCollection::GetAsymmetryRRF(): **ERROR** index = " << index << " out of bounds";
|
||||
cerr << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
fRunAsymmetryList[index]->CalcTheory();
|
||||
data = fRunAsymmetryList[index]->GetData();
|
||||
break;
|
||||
case kRunNo: // called from PMusrCanvas
|
||||
for (UInt_t i=0; i<fRunAsymmetryList.size(); i++) {
|
||||
if (fRunAsymmetryRRFList[i]->GetRunNo() == index) {
|
||||
data = fRunAsymmetryRRFList[i]->GetData();
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default: // error
|
||||
break;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetMuMinus (public)
|
||||
//--------------------------------------------------------------------------
|
||||
@ -757,7 +870,7 @@ PRunData* PRunListCollection::GetMuMinus(UInt_t index, EDataSwitch tag)
|
||||
switch (tag) {
|
||||
case kIndex:
|
||||
if ((index < 0) || (index > fRunMuMinusList.size())) {
|
||||
cerr << endl << "PRunListCollection::GetMuMinus: **ERROR** index = " << index << " out of bounds";
|
||||
cerr << endl << ">> PRunListCollection::GetMuMinus(): **ERROR** index = " << index << " out of bounds";
|
||||
cerr << endl;
|
||||
return 0;
|
||||
}
|
||||
@ -799,7 +912,7 @@ PRunData* PRunListCollection::GetNonMusr(UInt_t index, EDataSwitch tag)
|
||||
switch (tag) {
|
||||
case kIndex:
|
||||
if ((index < 0) || (index > fRunNonMusrList.size())) {
|
||||
cerr << endl << "PRunListCollection::GetNonMusr: **ERROR** index = " << index << " out of bounds";
|
||||
cerr << endl << ">> PRunListCollection::GetNonMusr(): **ERROR** index = " << index << " out of bounds";
|
||||
cerr << endl;
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user