Skip to content

Commit

Permalink
Merge pull request #1476 from VinzenzBildstein/main
Browse files Browse the repository at this point in the history
Minor changes
  • Loading branch information
VinzenzBildstein authored Oct 29, 2024
2 parents a423649 + a2b0458 commit fc353a8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libraries/TAnalysis/TGRSIFit/TMultiPeak.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Bool_t TMultiPeak::fLogLikelihoodFlag = false;
TMultiPeak::TMultiPeak(Double_t xlow, Double_t xhigh, const std::vector<Double_t>& centroids, Option_t*)
: TGRSIFit("multipeakbg", this, &TMultiPeak::MultiPhotoPeakBG, xlow, xhigh, centroids.size() * 6 + 5, "TMultiPeak", "MultiPhotoPeakBG")
{
std::cout << "Warning, the class TMultiPeak is deprecated!" << std::endl;
std::cout << "Warning, the class TMultiPeak is deprecated (use TPeakFitter instead)!" << std::endl;
Clear();
// We make the background first so we can send it to the TPeaks.
fBackground = new TF1(Form("MPbackground_%d_to_%d", static_cast<Int_t>(xlow), static_cast<Int_t>(xhigh)), this, &TMultiPeak::MultiStepBG, xlow, xhigh, centroids.size() * 6 + 5, "TMuliPeak", "MultiStepBG");
Expand Down Expand Up @@ -47,7 +47,7 @@ TMultiPeak::TMultiPeak(Double_t xlow, Double_t xhigh, const std::vector<Double_t

TMultiPeak::TMultiPeak() : TGRSIFit("multipeakbg", this, &TMultiPeak::MultiPhotoPeakBG, 0, 1000, 10, "TMultiPeak", "MultiPhotoPeakBG")
{
std::cout << "Warning, the class TMultiPeak is deprecated!" << std::endl;
std::cout << "Warning, the class TMultiPeak is deprecated (use TPeakFitter instead)!" << std::endl;
// I don't think this constructor should be used, RD.
InitNames();
fBackground = new TF1("background", this, &TMultiPeak::MultiStepBG, 1000, 10, 10, "TMultiPeak", "MultiStepBG"); // This is a weird nonsense line.
Expand Down
8 changes: 8 additions & 0 deletions libraries/TGUI/TSourceCalibration.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@

std::map<std::tuple<double, double, double, double>, std::tuple<double, double, double, double>> Match(std::vector<std::tuple<double, double, double, double>> peaks, std::vector<std::tuple<double, double, double, double>> sources, int verboseLevel)
{
/// This function tries to match a list of found peaks (channels) to a list of provided peaks (energies).
/// It does so in a brute force fashion where we try all combinations of channels and energies, do a linear fit through them, and keep the one with the best chi square.

if(verboseLevel > 1) { std::cout << "Matching " << peaks.size() << " peaks with " << sources.size() << " source energies" << std::endl; }
std::map<std::tuple<double, double, double, double>, std::tuple<double, double, double, double>> result;
std::sort(peaks.begin(), peaks.end());
Expand Down Expand Up @@ -140,6 +143,9 @@ std::map<std::tuple<double, double, double, double>, std::tuple<double, double,

std::map<std::tuple<double, double, double, double>, std::tuple<double, double, double, double>> SmartMatch(std::vector<std::tuple<double, double, double, double>> peaks, std::vector<std::tuple<double, double, double, double>> sources, int verboseLevel)
{
/// This function tries to match a list of found peaks (channels) to a list of provided peaks (energies).
/// It does so in slightly smarter way than the brute force method `Match`, by taking the reported intensity of the source peaks into account.

if(verboseLevel > 1) { std::cout << "Matching " << peaks.size() << " peaks with " << sources.size() << " source energies" << std::endl; }
std::map<std::tuple<double, double, double, double>, std::tuple<double, double, double, double>> result;
std::sort(peaks.begin(), peaks.end());
Expand Down Expand Up @@ -788,6 +794,8 @@ void TSourceCalibration::BuildFirstInterface()
if(std::strstr(fMatrices[i]->GetName(), file.path().stem().c_str()) != nullptr) {
fSourceBox.back()->Select(index);
SetSource(kSourceBox + fSourceBox.size() - 1, index);
} else if(fVerboseLevel > 2) {
std::cout << "matrix name " << fMatrices[i]->GetName() << " not matching " << file.path().stem().c_str() << std::endl;
}
++index;
}
Expand Down

0 comments on commit fc353a8

Please sign in to comment.