Jpp  15.0.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 | 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 179 of file JFitToT.hh.

Constructor & Destructor Documentation

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

Constructor.

Parameters
parametersparameters
rangeabscissa range

Definition at line 190 of file JFitToT.hh.

190  :
191 
192  TF1(FITTOT_FNAME.c_str(),
193  this,
195  range.getLowerLimit(),
196  range.getUpperLimit(),
198 
200 
201  cpu(parameters)
202  {}
static Int_t getNumberOfModelParameters()
Get number of model parameters.
Definition: JFitToT.hh:87
T getLowerLimit() const
Get lower limit.
Definition: JRange.hh:202
*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
Double_t getValue(const Double_t *x, const Double_t *par)
Get rate as a function of the fit parameters.
Definition: JFitToT.hh:270
JPMTAnalogueSignalProcessor cpu
Definition: JFitToT.hh:288
JFitToTParameters(const JPMTParameters &parameters)
Constructor.
Definition: JFitToT.hh:59
T getUpperLimit() const
Get upper limit.
Definition: JRange.hh:213
static const std::string FITTOT_FNAME
Definition: JFitToT.hh:37

Member Function Documentation

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

Access method for the analogue signal processor.

Returns
reference to analogue signal processor

Definition at line 210 of file JFitToT.hh.

211  {
212  return cpu;
213  }
JPMTAnalogueSignalProcessor cpu
Definition: JFitToT.hh:288
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 226 of file JFitToT.hh.

227  {
228  using namespace std;
229  using namespace JPP;
230 
231  // Set initial gain and gain-spread
232  const Int_t Ngain = this->getModelParameter(&JFitToT::JFitToTParameters::gain);
233  const Int_t NgainSpread = this->getModelParameter(&JFitToT::JFitToTParameters::gainSpread);
234  const Int_t Nnormalization = this->getModelParameter(&JFitToT::JFitToTParameters::normalization);
235 
236  SetParName(Ngain, MAKE_CSTRING(FITTOT_GAIN_PARNAME));
237  SetParName(NgainSpread, MAKE_CSTRING(FITTOT_GAINSPREAD_PARNAME));
238  SetParName(Nnormalization, MAKE_CSTRING(FITTOT_NORMALIZATION_PARNAME));
239 
240  normalization = h1.Integral(h1.FindBin(this->GetXmin()),
241  h1.FindBin(this->GetXmax()));
242 
243  SetParameters(getModelParameters());
244 
245  // Set parameter and fit ranges
248 
249  FixParameter(Nnormalization, normalization);
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  }
double gain
gain [unit]
const Double_t getModelParameter(const int i) const
Get model parameter.
Definition: JFitToT.hh:146
double gainSpread
gain spread [unit]
static const char * FITTOT_GAINSPREAD_PARNAME
Definition: JFitToT.hh:40
static const double FITTOT_GAIN_MAX
Default maximal gain.
Definition: JFitToT.hh:44
static const double FITTOT_GAIN_MIN
Default minimal gain.
Definition: JFitToT.hh:43
#define MAKE_CSTRING(A)
Make C-string.
Definition: JPrint.hh:151
then for HISTOGRAM in h0 h1
Definition: JMatrixNZ.sh:71
JPMTAnalogueSignalProcessor cpu
Definition: JFitToT.hh:288
const Double_t * getModelParameters() const
Get model parameters.
Definition: JFitToT.hh:98
static const char * FITTOT_GAIN_PARNAME
Definition: JFitToT.hh:39
static const double FITTOT_GAINSPREAD_MAX
Default maximal gain spread.
Definition: JFitToT.hh:47
return result
Definition: JPolint.hh:727
bool setParLimits(TF1 &f1, const Int_t index, Double_t xmin, Double_t xmax)
Set fit parameter limits.
then $JPP_DIR examples JDetector JToT o $OUTPUT_FILE n N $NPE P gain
Definition: JToT.sh:47
void setModelParameters(const Double_t *data)
Set model parameters.
Definition: JFitToT.hh:132
static const double FITTOT_GAINSPREAD_MIN
Default minimal gain spread.
Definition: JFitToT.hh:46
static const char * FITTOT_NORMALIZATION_PARNAME
Definition: JFitToT.hh:41
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 gain
gain [unit]
double gainSpread
gain spread [unit]
JPMTAnalogueSignalProcessor cpu
Definition: JFitToT.hh:288
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.
static Int_t JCALIBRATE::JFitToTParameters::getNumberOfModelParameters ( )
inlinestaticinherited

Get number of model parameters.

Returns
number of parameters

Definition at line 87 of file JFitToT.hh.

88  {
89  return sizeof(JFitToTParameters) / sizeof(Double_t);
90  }
JFitToTParameters(const JPMTParameters &parameters)
Constructor.
Definition: JFitToT.hh:59
const Double_t* JCALIBRATE::JFitToTParameters::getModelParameters ( ) const
inlineinherited

Get model parameters.

Returns
pointer to parameters

Definition at line 98 of file JFitToT.hh.

99  {
100  return &this->gain;
101  }
Double_t gain
PMT gain.
Definition: JFitToT.hh:168
Double_t* JCALIBRATE::JFitToTParameters::getModelParameters ( )
inlineinherited

Get model parameters.

Returns
pointer to parameters

Definition at line 109 of file JFitToT.hh.

110  {
111  return &this->gain;
112  }
Double_t gain
PMT gain.
Definition: JFitToT.hh:168
void JCALIBRATE::JFitToTParameters::setModelParameter ( const int  i,
const Double_t  value 
)
inlineinherited

Set model parameter.

Parameters
iparameter index
valueparameter value

Definition at line 121 of file JFitToT.hh.

122  {
123  getModelParameters()[i] = value;
124  }
const Double_t * getModelParameters() const
Get model parameters.
Definition: JFitToT.hh:98
void JCALIBRATE::JFitToTParameters::setModelParameters ( const Double_t *  data)
inlineinherited

Set model parameters.

Parameters
datapointer to parameters

Definition at line 132 of file JFitToT.hh.

133  {
134  for (Int_t i = 0; i != getNumberOfModelParameters(); ++i) {
135  setModelParameter(i, data[i]);
136  }
137  }
static Int_t getNumberOfModelParameters()
Get number of model parameters.
Definition: JFitToT.hh:87
void setModelParameter(const int i, const Double_t value)
Set model parameter.
Definition: JFitToT.hh:121
const Double_t JCALIBRATE::JFitToTParameters::getModelParameter ( const int  i) const
inlineinherited

Get model parameter.

Parameters
iparameter index
Returns
parameter value

Definition at line 146 of file JFitToT.hh.

147  {
148  return getModelParameters()[i];
149  }
const Double_t * getModelParameters() const
Get model parameters.
Definition: JFitToT.hh:98
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 158 of file JFitToT.hh.

159  {
160  const Int_t i = &(this->*p) - getModelParameters();
161 
162  return JFitParameter_t(i, getModelParameter(i));
163  }
const Double_t getModelParameter(const int i) const
Get model parameter.
Definition: JFitToT.hh:146
const Double_t * getModelParameters() const
Get model parameters.
Definition: JFitToT.hh:98

Member Data Documentation

JPMTAnalogueSignalProcessor JCALIBRATE::JFitToT::cpu
private

Definition at line 288 of file JFitToT.hh.

Double_t JCALIBRATE::JFitToTParameters::gain
inherited

PMT gain.

Definition at line 168 of file JFitToT.hh.

Double_t JCALIBRATE::JFitToTParameters::gainSpread
inherited

PMT gain spread.

Definition at line 169 of file JFitToT.hh.

Double_t JCALIBRATE::JFitToTParameters::normalization
inherited

Definition at line 170 of file JFitToT.hh.


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