Skip to content

Commit

Permalink
Merge pull request #36 from vlvovch/devel
Browse files Browse the repository at this point in the history
Added scaled moments and Pearson correlation coefficients into the correlations dialog
  • Loading branch information
vlvovch authored May 3, 2022
2 parents efeac1e + 70fe41e commit e8784ea
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 15 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)

## [Version 1.3.3]

Date: 2022-05-03

GUI: Added scaled moments and Pearson correlation coefficients into the correlations dialog

## [Version 1.3.2]

Expand Down Expand Up @@ -193,6 +198,8 @@ Date: 2018-08-02

**The first public version of Thermal-FIST**

[Version 1.3.3]: https://github.com/vlvovch/Thermal-FIST/compare/v1.3.2...v1.3.3

[Version 1.3.2]: https://github.com/vlvovch/Thermal-FIST/compare/v1.3.1...v1.3.2

[Version 1.3.1]: https://github.com/vlvovch/Thermal-FIST/compare/v1.3...v1.3.1
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ project (ThermalFIST)
# The version number.
set (ThermalFIST_VERSION_MAJOR 1)
set (ThermalFIST_VERSION_MINOR 3)
set (ThermalFIST_VERSION_DEVEL 2)
set (ThermalFIST_VERSION_DEVEL 3)

# configure a header file to pass some of the CMake settings
# to the source code
Expand Down
83 changes: 69 additions & 14 deletions src/gui/QtThermalFIST/correlationsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ CorrelationsDialog::CorrelationsDialog(QWidget* parent, ThermalModelBase* mod) :
comboQuantity = new QComboBox();
comboQuantity->addItem(tr("Susceptibility"));
comboQuantity->addItem(tr("Moment"));
comboQuantity->addItem(tr("Scaled moment"));
comboQuantity->addItem(tr("Pearson correlation"));
comboQuantity->addItem(tr("Delta[N1,N2]"));
comboQuantity->addItem(tr("Sigma[N1,N2]"));
comboQuantity->setCurrentIndex(0);
Expand Down Expand Up @@ -149,11 +151,27 @@ void CorrelationsDialog::recalculate()
tableCorr->setItem(i, j, new QTableWidgetItem(QString::number(corr)));
else if (comboQuantity->currentIndex() == 1)
tableCorr->setItem(i, j, new QTableWidgetItem(QString::number(corr * model->Volume() * pow(model->Parameters().T, 3) * pow(xMath::GeVtoifm(), 3))));
//else if (comboQuantity->currentIndex() == 2) {
// double val = corr * model->Volume() * pow(model->Parameters().T, 3) * pow(xMath::GeVtoifm(), 3);
// double yld1 = model->GetYield(pdg1, Feeddown::Primordial);
// double yld2 = model->GetYield(pdg2, Feeddown::Primordial);
// if (comboFeeddown->currentIndex() == 1) {
// yld1 = model->GetYield(pdg1, Feeddown::StabilityFlag);
// yld2 = model->GetYield(pdg2, Feeddown::StabilityFlag);
// }
// tableCorr->setItem(i, j, new QTableWidgetItem(QString::number(val / sqrt(yld1 * yld2))));
//}
//else if (comboQuantity->currentIndex() == 3) {
// double val = corr;
// double var1 = model->TwoParticleSusceptibilityPrimordialByPdg(pdg1, pdg1);
// double var2 = model->TwoParticleSusceptibilityPrimordialByPdg(pdg2, pdg2);
// if (comboFeeddown->currentIndex() == 1) {
// var1 = model->TwoParticleSusceptibilityFinalByPdg(pdg1, pdg1);
// var2 = model->TwoParticleSusceptibilityFinalByPdg(pdg2, pdg2);
// }
// tableCorr->setItem(i, j, new QTableWidgetItem(QString::number(val / sqrt(var1 * var2))));
//}
else {
if (pdg1 == pdg2) {
tableCorr->setItem(i, j, new QTableWidgetItem(QString::number(0.)));
continue;
}

double N1 = 0., N2 = 0.;
double wn1 = 0., wn2 = 0.;
Expand Down Expand Up @@ -209,17 +227,36 @@ void CorrelationsDialog::recalculate()

corr *= model->Volume() * pow(model->Parameters().T, 3) * pow(xMath::GeVtoifm(), 3);

// Delta
// Scaled moment
if (comboQuantity->currentIndex() == 2) {
double DeltaN1N2 = (N1 * wn2 - N2 * wn1) / (N2 - N1);
tableCorr->setItem(i, j, new QTableWidgetItem(QString::number(DeltaN1N2)));
continue;
if (pdg1 == pdg2) {
qDebug() << pdg1 << " " << corr << " " << N1 << " " << N2 << endl;
}
tableCorr->setItem(i, j, new QTableWidgetItem(QString::number(corr / sqrt(N1 * N2))));
}
// Pearson
else if (comboQuantity->currentIndex() == 3) {
double var1 = wn1 * N1, var2 = wn2 * N2;
tableCorr->setItem(i, j, new QTableWidgetItem(QString::number(corr / sqrt(var1 * var2))));
}
// Sigma
else {
double SigmaN1N2 = (N1 * wn2 + N2 * wn1 - 2. * corr) / (N2 + N1);
tableCorr->setItem(i, j, new QTableWidgetItem(QString::number(SigmaN1N2)));
continue;
if (pdg1 == pdg2) {
tableCorr->setItem(i, j, new QTableWidgetItem(QString::number(0.)));
continue;
}

// Delta
if (comboQuantity->currentIndex() == 4) {
double DeltaN1N2 = (N1 * wn2 - N2 * wn1) / (N2 - N1);
tableCorr->setItem(i, j, new QTableWidgetItem(QString::number(DeltaN1N2)));
continue;
}
// Sigma
else {
double SigmaN1N2 = (N1 * wn2 + N2 * wn1 - 2. * corr) / (N2 + N1);
tableCorr->setItem(i, j, new QTableWidgetItem(QString::number(SigmaN1N2)));
continue;
}
}
}
}
Expand Down Expand Up @@ -264,8 +301,17 @@ void CorrelationsDialog::recalculate()
double wn1 = model->Susc((ConservedCharge::Name)i, (ConservedCharge::Name)i) * model->Volume() * pow(model->Parameters().T, 3) * pow(xMath::GeVtoifm(), 3) / N1;
double wn2 = model->Susc((ConservedCharge::Name)j, (ConservedCharge::Name)j) * model->Volume() * pow(model->Parameters().T, 3) * pow(xMath::GeVtoifm(), 3) / N2;
double corr = model->Susc((ConservedCharge::Name)i, (ConservedCharge::Name)j) * model->Volume() * pow(model->Parameters().T, 3) * pow(xMath::GeVtoifm(), 3);
// Delta
// Scaled moment
if (comboQuantity->currentIndex() == 2) {
tableCorr->setItem(i, j, new QTableWidgetItem(QString::number(corr / sqrt(N1 * N2))));
}
// Pearson
else if (comboQuantity->currentIndex() == 3) {
double var1 = wn1 * N1, var2 = wn2 * N2;
tableCorr->setItem(i, j, new QTableWidgetItem(QString::number(corr / sqrt(var1 * var2))));
}
// Delta
if (comboQuantity->currentIndex() == 4) {
double DeltaN1N2 = (N1 * wn2 - N2 * wn1) / (N2 - N1);
tableCorr->setItem(i1, i2, new QTableWidgetItem(QString::number(DeltaN1N2)));
}
Expand Down Expand Up @@ -386,8 +432,17 @@ void CorrelationsDialog::recalculate()

corr *= model->Volume() * pow(model->Parameters().T, 3) * pow(xMath::GeVtoifm(), 3);

// Delta
// Scaled moment
if (comboQuantity->currentIndex() == 2) {
tableCorr->setItem(i, i2, new QTableWidgetItem(QString::number(corr / sqrt(N1 * N2))));
}
// Pearson
else if (comboQuantity->currentIndex() == 3) {
double var1 = wn1 * N1, var2 = wn2 * N2;
tableCorr->setItem(i, i2, new QTableWidgetItem(QString::number(corr / sqrt(var1 * var2))));
}
// Delta
if (comboQuantity->currentIndex() == 4) {
double DeltaN1N2 = (N1 * wn2 - N2 * wn1) / (N2 - N1);
tableCorr->setItem(i, i2, new QTableWidgetItem(QString::number(DeltaN1N2)));
}
Expand Down

0 comments on commit e8784ea

Please sign in to comment.