Jpp  19.1.0
the software that should make you happy
Public Member Functions | Static Public Member Functions | Public Attributes | Private Attributes | List of all members
JCALIBRATE::JFitToT Struct Reference

Parametrisation of time-over-threshold distribution. More...

#include <JFitToT.hh>

Inheritance diagram for JCALIBRATE::JFitToT:
JCALIBRATE::JFitToTParameters

Public Member Functions

 JFitToT (const JPMTParameters &parameters, const JRange< double > &range)
 Constructor. More...
 
const JPMTAnalogueSignalProcessorgetCPU () const
 Access method for the analogue signal processor. More...
 
TFitResultPtr operator() (TH1 &h1, const std::string &option)
 Fit histogram. More...
 
Double_t getValue (const Double_t *x, const Double_t *par)
 Get rate as a function of the fit parameters. More...
 
const Double_t * getModelParameters () const
 Get model parameters. More...
 
Double_t * getModelParameters ()
 Get model parameters. More...
 
void setModelParameter (const int i, const Double_t value)
 Set model parameter. More...
 
void setModelParameters (const Double_t *data)
 Set model parameters. More...
 
const Double_t getModelParameter (const int i) const
 Get model parameter. More...
 
JFitParameter_t getModelParameter (Double_t JFitToTParameters::*p) const
 Get model parameter. More...
 

Static Public Member Functions

static Int_t getNumberOfModelParameters ()
 Get number of model parameters. More...
 

Public Attributes

Double_t gain
 PMT gain. More...
 
Double_t gainSpread
 PMT gain spread. More...
 
Double_t normalization
 

Private Attributes

JPMTAnalogueSignalProcessor cpu
 

Detailed Description

Parametrisation of time-over-threshold distribution.

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

Definition at line 180 of file JFitToT.hh.

Constructor & Destructor Documentation

◆ JFitToT()

JCALIBRATE::JFitToT::JFitToT ( const JPMTParameters parameters,
const JRange< double > &  range 
)
inline

Constructor.

Parameters
parametersparameters
rangeabscissa range

Definition at line 191 of file JFitToT.hh.

191  :
192 
193  TF1(FITTOT_FNAME.c_str(),
194  this,
196  range.getLowerLimit(),
197  range.getUpperLimit(),
199 
200  JFitToTParameters(parameters),
201 
202  cpu(parameters)
203  {}
T getLowerLimit() const
Get lower limit.
Definition: JRange.hh:202
T getUpperLimit() const
Get upper limit.
Definition: JRange.hh:213
static const std::string FITTOT_FNAME
Definition: JFitToT.hh:38
static Int_t getNumberOfModelParameters()
Get number of model parameters.
Definition: JFitToT.hh:88
JFitToTParameters(const JPMTParameters &parameters)
Constructor.
Definition: JFitToT.hh:60
JPMTAnalogueSignalProcessor cpu
Definition: JFitToT.hh:290
Double_t getValue(const Double_t *x, const Double_t *par)
Get rate as a function of the fit parameters.
Definition: JFitToT.hh:270

Member Function Documentation

◆ getCPU()

const JPMTAnalogueSignalProcessor& JCALIBRATE::JFitToT::getCPU ( ) const
inline

Access method for the analogue signal processor.

Returns
reference to analogue signal processor

Definition at line 211 of file JFitToT.hh.

212  {
213  return cpu;
214  }

◆ operator()()

TFitResultPtr JCALIBRATE::JFitToT::operator() ( TH1 &  h1,
const std::string &  option 
)
inline

Fit histogram.

Note that the PMT parameters which are part of the model are 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
h1ROOT 1D-histogram
optionfit option
Returns
fit result

Definition at line 227 of file JFitToT.hh.

228  {
229  using namespace std;
230  using namespace JPP;
231 
232  // Set initial gain and gain-spread
233  const Int_t Ngain = this->getModelParameter(&JFitToT::JFitToTParameters::gain);
234  const Int_t NgainSpread = this->getModelParameter(&JFitToT::JFitToTParameters::gainSpread);
235  const Int_t Nnormalization = this->getModelParameter(&JFitToT::JFitToTParameters::normalization);
236 
237  SetParName(Ngain, MAKE_CSTRING(FITTOT_GAIN_PARNAME));
238  SetParName(NgainSpread, MAKE_CSTRING(FITTOT_GAINSPREAD_PARNAME));
239  SetParName(Nnormalization, MAKE_CSTRING(FITTOT_NORMALIZATION_PARNAME));
240 
241  normalization = h1.Integral(h1.FindBin(this->GetXmin()),
242  h1.FindBin(this->GetXmax()));
243 
244  SetParameters(getModelParameters());
245  FixParameter(Nnormalization, normalization);
246 
247  for (Int_t i = 0; i != GetNpar(); ++i) {
248  SetParError(i, 0.0);
249  }
250 
251  // Fit histogram
252  const TFitResultPtr result = h1.Fit(this, option.c_str());
253 
254  this->setModelParameters(this->GetParameters());
255 
256  cpu.gain = getModelParameter(Ngain);
257  cpu.gainSpread = getModelParameter(NgainSpread);
258 
259  return result;
260  }
#define MAKE_CSTRING(A)
Make C-string.
Definition: JPrint.hh:72
double gainSpread
gain spread [unit]
static const char * FITTOT_GAIN_PARNAME
Definition: JFitToT.hh:40
static const char * FITTOT_NORMALIZATION_PARNAME
Definition: JFitToT.hh:42
static const char * FITTOT_GAINSPREAD_PARNAME
Definition: JFitToT.hh:41
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JSTDTypes.hh:14
const Double_t * getModelParameters() const
Get model parameters.
Definition: JFitToT.hh:99
void setModelParameters(const Double_t *data)
Set model parameters.
Definition: JFitToT.hh:133
const Double_t getModelParameter(const int i) const
Get model parameter.
Definition: JFitToT.hh:147

◆ getValue()

Double_t JCALIBRATE::JFitToT::getValue ( const Double_t *  x,
const Double_t *  par 
)
inline

Get rate as a function of the fit parameters.

Parameters
xpointer to abscissa values
parpointer to parameter values
Returns
rate distribution at specified time-over-threshold [Hz/ns]

Definition at line 270 of file JFitToT.hh.

271  {
272  const double tot_ns = x[0];
273 
274  // Set new parameter values
275  cpu.gain = par[0];
276  cpu.gainSpread = par[1];
277 
278  // Determine normalization factor
279  const int NPE = 1;
280  const double Whist = par[2];
281  const double Wpdf = cpu.getIntegralOfTimeOverThresholdProbability(GetXmin(), GetXmax(), NPE);
282 
283  return (Wpdf > 0.0 ? (Whist / Wpdf) : Whist) * cpu.getTimeOverThresholdProbability(tot_ns, NPE);
284  }
double getTimeOverThresholdProbability(const double tot_ns, const int NPE) const
Get probability of having a pulse with specific time-over-threshold.
double getIntegralOfTimeOverThresholdProbability(const double Tmin, const double Tmax, const int NPE) const
Get cumulative probability of time-over-threshold distribution.

◆ getNumberOfModelParameters()

static Int_t JCALIBRATE::JFitToTParameters::getNumberOfModelParameters ( )
inlinestaticinherited

Get number of model parameters.

Returns
number of parameters

Definition at line 88 of file JFitToT.hh.

89  {
90  return sizeof(JFitToTParameters) / sizeof(Double_t);
91  }

◆ getModelParameters() [1/2]

const Double_t* JCALIBRATE::JFitToTParameters::getModelParameters ( ) const
inlineinherited

Get model parameters.

Returns
pointer to parameters

Definition at line 99 of file JFitToT.hh.

100  {
101  return &this->gain;
102  }
Double_t gain
PMT gain.
Definition: JFitToT.hh:169

◆ getModelParameters() [2/2]

Double_t* JCALIBRATE::JFitToTParameters::getModelParameters ( )
inlineinherited

Get model parameters.

Returns
pointer to parameters

Definition at line 110 of file JFitToT.hh.

111  {
112  return &this->gain;
113  }

◆ setModelParameter()

void JCALIBRATE::JFitToTParameters::setModelParameter ( const int  i,
const Double_t  value 
)
inlineinherited

Set model parameter.

Parameters
iparameter index
valueparameter value

Definition at line 122 of file JFitToT.hh.

123  {
124  getModelParameters()[i] = value;
125  }

◆ setModelParameters()

void JCALIBRATE::JFitToTParameters::setModelParameters ( const Double_t *  data)
inlineinherited

Set model parameters.

Parameters
datapointer to parameters

Definition at line 133 of file JFitToT.hh.

134  {
135  for (Int_t i = 0; i != getNumberOfModelParameters(); ++i) {
136  setModelParameter(i, data[i]);
137  }
138  }
void setModelParameter(const int i, const Double_t value)
Set model parameter.
Definition: JFitToT.hh:122

◆ getModelParameter() [1/2]

const Double_t JCALIBRATE::JFitToTParameters::getModelParameter ( const int  i) const
inlineinherited

Get model parameter.

Parameters
iparameter index
Returns
parameter value

Definition at line 147 of file JFitToT.hh.

148  {
149  return getModelParameters()[i];
150  }

◆ getModelParameter() [2/2]

JFitParameter_t JCALIBRATE::JFitToTParameters::getModelParameter ( Double_t JFitToTParameters::*  p) const
inlineinherited

Get model parameter.

Parameters
ppointer to data member
Returns
parameter index and value

Definition at line 159 of file JFitToT.hh.

160  {
161  const Int_t i = &(this->*p) - getModelParameters();
162 
163  return JFitParameter_t(i, getModelParameter(i));
164  }
Auxiliary data structure for a parameter index and its value.

Member Data Documentation

◆ cpu

JPMTAnalogueSignalProcessor JCALIBRATE::JFitToT::cpu
private

Definition at line 290 of file JFitToT.hh.

◆ gain

Double_t JCALIBRATE::JFitToTParameters::gain
inherited

PMT gain.

Definition at line 169 of file JFitToT.hh.

◆ gainSpread

Double_t JCALIBRATE::JFitToTParameters::gainSpread
inherited

PMT gain spread.

Definition at line 170 of file JFitToT.hh.

◆ normalization

Double_t JCALIBRATE::JFitToTParameters::normalization
inherited

Definition at line 171 of file JFitToT.hh.


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