allow to plot normalize data in mupp
This commit is contained in:
parent
54fee067df
commit
38ffcb3104
@ -1702,6 +1702,27 @@ void PmuppGui::plot()
|
|||||||
yLabel = substituteDefaultLabels(yLabel);
|
yLabel = substituteDefaultLabels(yLabel);
|
||||||
fout << "yLabel: " << yLabel << endl;
|
fout << "yLabel: " << yLabel << endl;
|
||||||
|
|
||||||
|
// normalize if wished
|
||||||
|
if (fNormalize) {
|
||||||
|
double max=0.0;
|
||||||
|
for (int k=0; k<yyy.size(); k++) {
|
||||||
|
max=0.0;
|
||||||
|
if (fNormVal == 0.0) {
|
||||||
|
for (int j=0; j<xx.size(); j++) {
|
||||||
|
if (yyy[k][j] > max)
|
||||||
|
max = yyy[k][j];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
max = fNormVal;
|
||||||
|
}
|
||||||
|
for (int j=0; j<xx.size(); j++) {
|
||||||
|
yyy[k][j] /= max;
|
||||||
|
yyyPosErr[k][j] /= max;
|
||||||
|
yyyNegErr[k][j] /= max;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// data
|
// data
|
||||||
for (int j=0; j<xx.size(); j++) {
|
for (int j=0; j<xx.size(); j++) {
|
||||||
fout << xx[j] << ", ";
|
fout << xx[j] << ", ";
|
||||||
@ -2057,22 +2078,62 @@ void PmuppGui::getMinMax(QVector<double> &data, double &min, double &max)
|
|||||||
*/
|
*/
|
||||||
QString PmuppGui::substituteDefaultLabels(QString label)
|
QString PmuppGui::substituteDefaultLabels(QString label)
|
||||||
{
|
{
|
||||||
if (label == "dataT")
|
QString result(label);
|
||||||
return QString("T (K)");
|
|
||||||
else if (label == "dataB")
|
if (label == "dataT") {
|
||||||
return QString("B (G)");
|
result = QString("T (K)");
|
||||||
else if (label == "dataE")
|
} else if (label == "dataB") {
|
||||||
return QString("E (keV)");
|
result = QString("B (G)");
|
||||||
else if (!label.compare("sigma", Qt::CaseInsensitive))
|
} else if (label == "dataE") {
|
||||||
return QString("#sigma (1/#mus)");
|
result =QString("E (keV)");
|
||||||
else if (!label.compare("lambda", Qt::CaseInsensitive))
|
} else if (!label.compare("sigma", Qt::CaseInsensitive)) {
|
||||||
return QString("#lambda (1/#mus)");
|
if (fNormalize) {
|
||||||
else if (!label.compare("alpha_LR", Qt::CaseInsensitive))
|
if (fNormVal == 0.0)
|
||||||
return QString("#alpha_{LR}");
|
result = QString("#sigma/max(#sigma)");
|
||||||
else if (!label.compare("alpha_TB", Qt::CaseInsensitive))
|
|
||||||
return QString("#alpha_{TB}");
|
|
||||||
else
|
else
|
||||||
return label;
|
result = QString("#sigma/%1 (1/#mus)").arg(fNormVal);
|
||||||
|
} else {
|
||||||
|
result = QString("#sigma (1/#mus)");
|
||||||
|
}
|
||||||
|
} else if (!label.compare("lambda", Qt::CaseInsensitive)) {
|
||||||
|
if (fNormalize) {
|
||||||
|
if (fNormVal == 0.0)
|
||||||
|
result = QString("#lambda/max(#lambda)");
|
||||||
|
else
|
||||||
|
result = QString("#lambda/%1 (1/#mus)").arg(fNormVal);
|
||||||
|
} else {
|
||||||
|
result = QString("#lambda (1/#mus)");
|
||||||
|
}
|
||||||
|
} else if (!label.compare("alpha_LR", Qt::CaseInsensitive)) {
|
||||||
|
if (fNormalize) {
|
||||||
|
if (fNormVal == 0.0)
|
||||||
|
result = QString("#alpha_{LR}/max(#alpha_{LR})");
|
||||||
|
else
|
||||||
|
result = QString("#alpha_{LR}/%1").arg(fNormVal);
|
||||||
|
} else {
|
||||||
|
result = QString("#alpha_{LR}");
|
||||||
|
}
|
||||||
|
} else if (!label.compare("alpha_TB", Qt::CaseInsensitive)) {
|
||||||
|
if (fNormalize) {
|
||||||
|
if (fNormVal == 0.0)
|
||||||
|
result = QString("#alpha_{TB}/max(#alpha_{TB})");
|
||||||
|
else
|
||||||
|
result = QString("#alpha_{TB}/%1").arg(fNormVal);
|
||||||
|
} else {
|
||||||
|
result = QString("#alpha_{TB}");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (fNormalize) {
|
||||||
|
if (fNormVal == 0.0) {
|
||||||
|
result = QString("Normalized ");
|
||||||
|
result += label;
|
||||||
|
} else {
|
||||||
|
result = QString("%1/%2").arg(label).arg(fNormVal);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
|
Loading…
x
Reference in New Issue
Block a user