Jpp  18.0.0-rc.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | List of all members
JCALIBRATE::JFitK40_t< TF2 > Struct Template Reference

Template specialisation of two-fold coincidence rate due to K40 and other radioactive decays. More...

#include <JFitK40.hh>

Inheritance diagram for JCALIBRATE::JFitK40_t< TF2 >:
JCALIBRATE::JFitK40_t<>

Public Member Functions

 JFitK40_t (const JModule &module, const Double_t xmin, const Double_t xmax, const Double_t ymin, const Double_t ymax, const bool option)
 Constructor. More...
 
TFitResultPtr operator() (TH2 &h2, const std::string &option)
 Fit 2D-histogram. More...
 

Static Public Member Functions

static Double_t getRate (const Double_t *x, const Double_t *data)
 Get K40 coincidence rate as a function of the fit parameters. More...
 

Detailed Description

template<>
struct JCALIBRATE::JFitK40_t< TF2 >

Template specialisation of two-fold coincidence rate due to K40 and other radioactive decays.

Note that for use in ROOT fit operations, the member method JFitK40_t::getRate is static.

Definition at line 586 of file JFitK40.hh.

Constructor & Destructor Documentation

JCALIBRATE::JFitK40_t< TF2 >::JFitK40_t ( const JModule module,
const Double_t  xmin,
const Double_t  xmax,
const Double_t  ymin,
const Double_t  ymax,
const bool  option 
)
inline

Constructor.

Parameters
moduledetector module
xminminimal x
xmaxmaximal x
yminminimal y
ymaxmaximal y
optiontrue = fix average t0; false = free average t0

Definition at line 600 of file JFitK40.hh.

605  :
606  JFitK40_t<>(module, option),
607  TF2("f2",
609  xmin, xmax, ymin, ymax,
610  getNumberOfModelParameters())
611  {}
const double xmax
Definition: JQuadrature.cc:24
const double xmin
Definition: JQuadrature.cc:23

Member Function Documentation

static Double_t JCALIBRATE::JFitK40_t< TF2 >::getRate ( const Double_t *  x,
const Double_t *  data 
)
inlinestatic

Get K40 coincidence rate as a function of the fit parameters.

To speed up the calculation, it is assumed that the parameter values do not change unless also the x[0] value changes (i.e. the index of the PMT pair).

Parameters
xpointer to data
datapointer to parameter values
Returns
rate [Hz/ns]

Definition at line 624 of file JFitK40.hh.

625  {
626  static int id = -1;
627  static Double_t t0;
628  static Double_t sigma;
629  static Double_t rate;
630 
631  const int ix = (int) x[0];
632  const Double_t dt_ns = x[1];
633 
634  if (ix != id) {
635 
636  getInstance().setModelParameters(data);
637 
638  const pair_type& pair = getInstance().getPair(ix);
639 
640  t0 = getInstance().getTimeOffset(pair);
641  sigma = getInstance().getSigma (pair);
642  rate = getInstance().getValue (pair);
643  id = ix;
644  }
645 
646  return getInstance().bg + rate * (getInstance().cc + TMath::Gaus(dt_ns, t0, sigma, kTRUE));
647  }
then set_variable singlesRate set_variable doublesRate set_variable numberOfSlices echo Generating random background echo Singles rate
const double sigma[]
Definition: JQuadrature.cc:74
T & getInstance(const T &object)
Get static instance from temporary object.
Definition: JObject.hh:75
TFitResultPtr JCALIBRATE::JFitK40_t< TF2 >::operator() ( TH2 &  h2,
const std::string option 
)
inline

Fit 2D-histogram.

Note that the PMT parameters are partially reset before the fit according the status of each PMT and the obtained fit parameters are copied back to the model parameters after the fit.

Parameters
h2ROOT histogram
optionfit option

Definition at line 659 of file JFitK40.hh.

660  {
661  for (int pmt = 0; pmt != NUMBER_OF_PMTS; ++pmt) {
662 
663  parameters[pmt].QE = JPMTParameters_t().QE;
664  parameters[pmt].TTS = JPMTParameters_t().TTS;
665 
666  if (disable[pmt]) {
667 
668  parameters[pmt].QE = 0.0;
669 
670  fixParameter(*this, this->getModelParameter(pmt, &JPMTParameters_t::QE));
671  fixParameter(*this, this->getModelParameter(pmt, &JPMTParameters_t::TTS));
672  fixParameter(*this, this->getModelParameter(pmt, &JPMTParameters_t::t0));
673 
674  } else {
675 
676  // Note that setting limits to a parameter will also release it
677 
678  if (!isParameterFixed(*this, this->getModelParameter(pmt, &JPMTParameters_t::QE))) {
679  setParLimits(*this, this->getModelParameter(pmt, &JPMTParameters_t::QE), FITK40_QE_MIN, FITK40_QE_MAX);
680  }
681  if (!isParameterFixed(*this, this->getModelParameter(pmt, &JPMTParameters_t::TTS))) {
682  setParLimits(*this, this->getModelParameter(pmt, &JPMTParameters_t::TTS), FITK40_TTS_MIN_NS, FITK40_TTS_MAX_NS);
683  }
684  if (!isParameterFixed(*this, this->getModelParameter(pmt, &JPMTParameters_t::t0))) {
685  setParLimits(*this, this->getModelParameter(pmt, &JPMTParameters_t::t0), h2.GetYaxis()->GetXmin(), h2.GetYaxis()->GetXmax());
686  }
687  }
688  }
689 
690  if (index_of_average_t0 != -1) {
691 
692  this->setT0(index_of_average_t0, 0.0);
693 
694  fixParameter(*this, this->getModelParameter(index_of_average_t0, &JPMTParameters_t::t0));
695  }
696 
697  this->SetParameters(this->getModelParameters());
698 
699  getInstance() = *this;
700 
701  const TFitResultPtr result = h2.Fit(this, option.c_str());
702 
703  this->setModelParameters(this->GetParameters());
704 
705  return result;
706  }
Double_t TTS
transition-time spread [ns]
Definition: JFitK40.hh:58
Double_t t0
time offset [ns]
Definition: JFitK40.hh:59
Double_t QE
quantum efficiency [unit]
Definition: JFitK40.hh:57
*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
Definition: diff-Tuna.sh:38
static const double FITK40_QE_MAX
Maximal quantum efficiency [unit].
Definition: JFitK40.hh:38
bool isParameterFixed(const TF1 &f1, const Int_t index)
Check if fit parameter is fixed.
T & getInstance(const T &object)
Get static instance from temporary object.
Definition: JObject.hh:75
return result
Definition: JPolint.hh:764
bool setParLimits(TF1 &f1, const Int_t index, Double_t xmin, Double_t xmax)
Set fit parameter limits.
Fit parameters for single PMT.
Definition: JFitK40.hh:46
static const double FITK40_QE_MIN
Minimal quantum efficiency [unit].
Definition: JFitK40.hh:37
static const double FITK40_TTS_MIN_NS
Minimal transition-time spread [ns].
Definition: JFitK40.hh:39
bool fixParameter(TF1 &f1, const JFitParameter_t &parameter)
Fix fit parameter.
static const double FITK40_TTS_MAX_NS
Maximal transition-time spread [ns].
Definition: JFitK40.hh:40
static const int NUMBER_OF_PMTS
Total number of PMTs in module.
Definition: JDAQ.hh:26

The documentation for this struct was generated from the following file: