Changeset 19874


Ignore:
Timestamp:
11/18/19 11:33:03 (5 years ago)
Author:
tbretz
Message:
Just found out that this was the wrong version of the macro. The correct one (which also contains the correct function from the paper) is this one.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Mars/fact/analysis/gain/fit_spectra.C

    r19860 r19874  
    2323
    2424// --------------------------------------------------------------------------
     25// After fit_spectra_bt2b.C
    2526
    2627// Fit function for a single pe spectrum
     
    3536    const Double_t expo  = par[6];
    3637
     38    const Double_t P = cross*TMath::Exp(-cross);
     39
    3740    Double_t y = 0;
    3841    for (int N=1; N<14; N++)
     
    4144        const Double_t sigN = TMath::Sqrt(N*sigma*sigma + noise*noise);
    4245
    43         const Double_t p = TMath::Power(cross, N-1) * TMath::Power(N, -expo);
     46        const Double_t p =
     47            TMath::Power(N*P, N-1)/TMath::Power(TMath::Factorial(N-1), expo);
    4448
    4549        y += TMath::Gaus(xx[0], muN, sigN) * p / sigN;
     
    5660    Double_t expo  = f.GetParameter(6);
    5761
     62    const Double_t P = cross*TMath::Exp(-cross);
     63
    5864    Double_t y = 0;
    5965    for (int N=2; N<14; N++)
    60         y +=  TMath::Power(cross,  N-1) * TMath::Power(N, -expo);
     66        y +=
     67            TMath::Power(N*P, N-1)/TMath::Power(TMath::Factorial(N-1), expo);
    6168
    6269    return y / (y + 1);
     
    7178    const Double_t expo  = func.GetParameter(6);
    7279
     80    const Double_t P = cross*TMath::Exp(-cross);
     81
    7382    Double_t sum = 0;
    7483    for (int N=1; N<14; N++)
    75         sum += TMath::Power(cross, N-1) * TMath::Power(N, -expo);
     84        sum +=
     85            TMath::Power(N*P, N-1)/TMath::Power(TMath::Factorial(N-1), expo);
    7686
    7787    const Double_t scale = hist.GetBinWidth(1);
     
    383393    if (!fixednoise)
    384394        func.SetParLimits(5, 0, 150);          // Noise
     395    func.SetParLimits(6, 0, 2);            // Expo
    385396
    386397    func.SetParameter(0, ampl);                         // Amplitude
     
    394405        func.SetParameter(5, 0.1*maxpos);               // Noise
    395406
    396     func.SetParameter(6, 0.4);                          // Expo
     407    func.SetParameter(6, 0.95);                         // Expo
    397408
    398409    func.SetRange(fitmin, fitmax);
Note: See TracChangeset for help on using the changeset viewer.