Jpp - 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 585 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 599 of file JFitK40.hh.

604  :
605  JFitK40_t<>(module, option),
606  TF2("f2",
608  xmin, xmax, ymin, ymax,
609  getNumberOfModelParameters())
610  {}

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 623 of file JFitK40.hh.

624  {
625  static int id = -1;
626  static Double_t t0;
627  static Double_t sigma;
628  static Double_t rate;
629 
630  const int ix = (int) x[0];
631  const Double_t dt_ns = x[1];
632 
633  if (ix != id) {
634 
635  getInstance().setModelParameters(data);
636 
637  const pair_type& pair = getInstance().getPair(ix);
638 
639  t0 = getInstance().getTimeOffset(pair);
640  sigma = getInstance().getSigma (pair);
641  rate = getInstance().getValue (pair);
642  id = ix;
643  }
644 
645  return getInstance().bg + rate * (getInstance().cc + TMath::Gaus(dt_ns, t0, sigma, kTRUE));
646  }
then set_variable singlesRate set_variable doublesRate set_variable numberOfSlices echo Generating random background echo Singles rate
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 658 of file JFitK40.hh.

659  {
660  for (int pmt = 0; pmt != NUMBER_OF_PMTS; ++pmt) {
661 
662  parameters[pmt].QE = JPMTParameters_t().QE;
663  parameters[pmt].TTS = JPMTParameters_t().TTS;
664 
665  if (disable[pmt]) {
666 
667  parameters[pmt].QE = 0.0;
668 
669  fixParameter(*this, this->getModelParameter(pmt, &JPMTParameters_t::QE));
670  fixParameter(*this, this->getModelParameter(pmt, &JPMTParameters_t::TTS));
671  fixParameter(*this, this->getModelParameter(pmt, &JPMTParameters_t::t0));
672 
673  } else {
674 
675  // Note that setting limits to a parameter will also release it
676 
677  if (!isParameterFixed(*this, this->getModelParameter(pmt, &JPMTParameters_t::QE))) {
678  setParLimits(*this, this->getModelParameter(pmt, &JPMTParameters_t::QE), FITK40_QE_MIN, FITK40_QE_MAX);
679  }
680  if (!isParameterFixed(*this, this->getModelParameter(pmt, &JPMTParameters_t::TTS))) {
681  setParLimits(*this, this->getModelParameter(pmt, &JPMTParameters_t::TTS), FITK40_TTS_MIN_NS, FITK40_TTS_MAX_NS);
682  }
683  if (!isParameterFixed(*this, this->getModelParameter(pmt, &JPMTParameters_t::t0))) {
684  setParLimits(*this, this->getModelParameter(pmt, &JPMTParameters_t::t0), h2.GetYaxis()->GetXmin(), h2.GetYaxis()->GetXmax());
685  }
686  }
687  }
688 
689  if (index_of_average_t0 != -1) {
690 
691  this->setT0(index_of_average_t0, 0.0);
692 
693  fixParameter(*this, this->getModelParameter(index_of_average_t0, &JPMTParameters_t::t0));
694  }
695 
696  this->SetParameters(this->getModelParameters());
697 
698  getInstance() = *this;
699 
700  const TFitResultPtr result = h2.Fit(this, option.c_str());
701 
702  this->setModelParameters(this->GetParameters());
703 
704  return result;
705  }
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:727
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: