1 #ifndef __JCALIBRATE__JFITTOT__
2 #define __JCALIBRATE__JFITTOT__
10 #include "TFitResult.h"
24 namespace JCALIBRATE {}
25 namespace JPP {
using namespace JCALIBRATE; }
27 namespace JCALIBRATE {
191 range.getLowerLimit(),
192 range.getUpperLimit(),
213 void fitInit(TH1&
h1,
const double gradientThreshold = -0.005)
219 const Int_t
N = h1.GetXaxis()->GetNbins();
221 double max = h1.GetBinContent(
N);
222 double mode = h1.GetBinCenter(
N);
224 for (
int i = h1.GetBinCenter(
N-1);
225 i > h1.GetBinCenter(h1.FindBin(
getInstance().mean_ns));
228 const double x = h1.GetBinCenter (i);
229 const double y = h1.GetBinContent(i);
231 const double gradient = ( (h1.GetBinContent(i-1) - h1.GetBinContent(i+1)) /
232 (h1.GetBinCenter (i+1) - h1.GetBinCenter (i-1)) );
239 }
else if (gradient < gradientThreshold) {
255 this->SetParName(NgainSpread,
MAKE_CSTRING(
"gainSpread"));
297 TFitResultPtr
operator()(TH1&
h1,
const double minWeight,
const std::string& option)
307 const TFitResultPtr
result = h1.Fit(
this, option.c_str());
313 return (
fitRange(ToTcheck) ? result : TFitResultPtr());
317 return TFitResultPtr();
331 const Double_t tot_ns = x[0];
static Int_t getNumberOfModelParameters()
Get number of model parameters.
JFitParameter_t getModelParameter(Double_t JFitToTParameters::*p) const
Get model parameter.
const Double_t getModelParameter(const int i) const
Get model parameter.
TFitResultPtr operator()(TH1 &h1, const double minWeight, const std::string &option)
Fit histogram.
const double getInitGainSpread() const
Retrieve initial gainspread.
double gainSpread
gain spread [unit]
static JPMTAnalogueSignalProcessor & getInstance()
Get unique instance of PMT analogue signal processor.
JFitToTParameters(const Double_t *data)
Copy constructor.
static const double FITTOT_GAIN_MAX
Maximal gain.
Double_t gainSpread
PMT gain spread.
static const double FITTOT_GAIN_MIN
Minimal gain.
void setPMTParameters(const JPMTParameters ¶meters)
Set PMT parameters.
Double_t getValue(Double_t *x, Double_t *par)
Get rate as a function of the fit parameters.
virtual double getTimeOverThreshold(const double npe) const
Get time-over-threshold (ToT).
Double_t * getModelParameters()
Get model parameters.
*fatal Wrong number of arguments esac JCookie sh typeset Z DETECTOR typeset Z SOURCE_RUN typeset Z TARGET_RUN set_variable PARAMETERS_FILE $WORKDIR parameters
#define MAKE_CSTRING(A)
Make C-string.
then for HISTOGRAM in h0 h1
Parametrisation of time-over-threshold distribution.
Fit parameters for two-fold coincidence rate due to K40.
void fitInit(TH1 &h1, const double gradientThreshold=-0.005)
Fit initializer.
const Double_t * getModelParameters() const
Get model parameters.
Auxiliary data structure for a parameter index and its value.
JFitToTParameters(const JPMTParameters ¶meters)
Constructor.
const double getInitGain() const
Retrieve initial gain.
static const double FITTOT_GAINSPREAD_MAX
Maximal gain spread.
double init_gain
Initial input value for gain.
bool setParLimits(TF1 &f1, const Int_t index, Double_t xmin, Double_t xmax)
Set fit parameter limits.
double init_gainSpread
Initial input value for gainSpread.
JRange< Double_t > JRange_t
PMT analogue signal processor.
JFitToT(const JPMTParameters ¶meters, const JRange_t &range)
Constructor.
virtual double getNPE(const double tot_ns, const double eps=1.0e-3) const
Get number of photo-electrons.
Auxiliary class to define a range between two values.
void setModelParameters(const Double_t *data)
Set model parameters.
JRange_t fitRange
fit-range [ns]
void setModelParameter(const int i, const Double_t value)
Set model parameter.
double getIntegralOfTimeOverThresholdProbability(const double Tmin, const double Tmax, const int NPE) const
Get cumulative probability of time-over-threshold distribution.
double getTimeOverThresholdProbability(const double tot_ns, const int NPE) const
Get probability of having a pulse with specific time-over-threshold.
PMT analogue signal processor.
const int NPE
True number of photo-electrons.
static const double FITTOT_GAINSPREAD_MIN
Minimal gain spread.
double WfitRange
Cumulative weight within fit-range.
Data structure for PMT parameters.
then usage $script[input file[working directory[option]]] nWhere option can be N
static const double FITTOT_TOT_RMARGIN
Fit-region right of peak [ns].
static const std::string FITTOT_FNAME
static const double FITTOT_TOT_LMARGIN
Fit-region left of peak [ns].