Jpp
 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 176 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 187 of file JFitToT.hh.

187  :
188 
189  TF1(FITTOT_FNAME.c_str(),
190  this,
192  range.getLowerLimit(),
193  range.getUpperLimit(),
195 
197 
198  cpu(parameters)
199  {}
static Int_t getNumberOfModelParameters()
Get number of model parameters.
Definition: JFitToT.hh:84
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:267
JPMTAnalogueSignalProcessor cpu
Definition: JFitToT.hh:285
JFitToTParameters(const JPMTParameters &parameters)
Constructor.
Definition: JFitToT.hh:56
T getUpperLimit() const
Get upper limit.
Definition: JRange.hh:213
static const std::string FITTOT_FNAME
Definition: JFitToT.hh:38

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 207 of file JFitToT.hh.

208  {
209  return cpu;
210  }
JPMTAnalogueSignalProcessor cpu
Definition: JFitToT.hh:285
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 223 of file JFitToT.hh.

224  {
225  using namespace std;
226  using namespace JPP;
227 
228  // Set initial gain and gain-spread
229  const Int_t Ngain = this->getModelParameter(&JFitToT::JFitToTParameters::gain);
230  const Int_t NgainSpread = this->getModelParameter(&JFitToT::JFitToTParameters::gainSpread);
231  const Int_t Nnormalization = this->getModelParameter(&JFitToT::JFitToTParameters::normalization);
232 
233  SetParName(Ngain, MAKE_CSTRING("gain"));
234  SetParName(NgainSpread, MAKE_CSTRING("gainSpread"));
235  SetParName(Nnormalization, MAKE_CSTRING("normalization"));
236 
237  normalization = h1.Integral(h1.FindBin(this->GetXmin()),
238  h1.FindBin(this->GetXmax()));
239 
240  SetParameters(getModelParameters());
241 
242  // Set parameter and fit ranges
245 
246  FixParameter(Nnormalization, normalization);
247 
248  // Fit histogram
249  const TFitResultPtr result = h1.Fit(this, option.c_str());
250 
251  this->setModelParameters(this->GetParameters());
252 
253  cpu.gain = getModelParameter(Ngain);
254  cpu.gainSpread = getModelParameter(NgainSpread);
255 
256  return result;
257  }
double gain
gain [unit]
const Double_t getModelParameter(const int i) const
Get model parameter.
Definition: JFitToT.hh:143
double gainSpread
gain spread [unit]
static const double FITTOT_GAIN_MAX
Default maximal gain.
Definition: JFitToT.hh:41
static const double FITTOT_GAIN_MIN
Default minimal gain.
Definition: JFitToT.hh:40
#define MAKE_CSTRING(A)
Make C-string.
Definition: JPrint.hh:151
then for HISTOGRAM in h0 h1
Definition: JMatrixNZ.sh:69
JPMTAnalogueSignalProcessor cpu
Definition: JFitToT.hh:285
const Double_t * getModelParameters() const
Get model parameters.
Definition: JFitToT.hh:95
static const double FITTOT_GAINSPREAD_MAX
Default maximal gain spread.
Definition: JFitToT.hh:44
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:45
void setModelParameters(const Double_t *data)
Set model parameters.
Definition: JFitToT.hh:129
static const double FITTOT_GAINSPREAD_MIN
Default minimal gain spread.
Definition: JFitToT.hh:43
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 267 of file JFitToT.hh.

268  {
269  const double tot_ns = x[0];
270 
271  // Set new parameter values
272  cpu.gain = par[0];
273  cpu.gainSpread = par[1];
274 
275  // Determine normalization factor
276  const int NPE = 1;
277  const double Whist = par[2];
278  const double Wpdf = cpu.getIntegralOfTimeOverThresholdProbability(GetXmin(), GetXmax(), NPE);
279 
280  return (Wpdf > 0.0 ? (Whist / Wpdf) : Whist) * cpu.getTimeOverThresholdProbability(tot_ns, NPE);
281  }
double gain
gain [unit]
double gainSpread
gain spread [unit]
JPMTAnalogueSignalProcessor cpu
Definition: JFitToT.hh:285
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 84 of file JFitToT.hh.

85  {
86  return sizeof(JFitToTParameters) / sizeof(Double_t);
87  }
JFitToTParameters(const JPMTParameters &parameters)
Constructor.
Definition: JFitToT.hh:56
const Double_t* JCALIBRATE::JFitToTParameters::getModelParameters ( ) const
inlineinherited

Get model parameters.

Returns
pointer to parameters

Definition at line 95 of file JFitToT.hh.

96  {
97  return &this->gain;
98  }
Double_t gain
PMT gain.
Definition: JFitToT.hh:165
Double_t* JCALIBRATE::JFitToTParameters::getModelParameters ( )
inlineinherited

Get model parameters.

Returns
pointer to parameters

Definition at line 106 of file JFitToT.hh.

107  {
108  return &this->gain;
109  }
Double_t gain
PMT gain.
Definition: JFitToT.hh:165
void JCALIBRATE::JFitToTParameters::setModelParameter ( const int  i,
const Double_t  value 
)
inlineinherited

Set model parameter.

Parameters
iparameter index
valueparameter value

Definition at line 118 of file JFitToT.hh.

119  {
120  getModelParameters()[i] = value;
121  }
const Double_t * getModelParameters() const
Get model parameters.
Definition: JFitToT.hh:95
void JCALIBRATE::JFitToTParameters::setModelParameters ( const Double_t *  data)
inlineinherited

Set model parameters.

Parameters
datapointer to parameters

Definition at line 129 of file JFitToT.hh.

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

Get model parameter.

Parameters
iparameter index
Returns
parameter value

Definition at line 143 of file JFitToT.hh.

144  {
145  return getModelParameters()[i];
146  }
const Double_t * getModelParameters() const
Get model parameters.
Definition: JFitToT.hh:95
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 155 of file JFitToT.hh.

156  {
157  const Int_t i = &(this->*p) - getModelParameters();
158 
159  return JFitParameter_t(i, getModelParameter(i));
160  }
const Double_t getModelParameter(const int i) const
Get model parameter.
Definition: JFitToT.hh:143
const Double_t * getModelParameters() const
Get model parameters.
Definition: JFitToT.hh:95

Member Data Documentation

JPMTAnalogueSignalProcessor JCALIBRATE::JFitToT::cpu
private

Definition at line 285 of file JFitToT.hh.

Double_t JCALIBRATE::JFitToTParameters::gain
inherited

PMT gain.

Definition at line 165 of file JFitToT.hh.

Double_t JCALIBRATE::JFitToTParameters::gainSpread
inherited

PMT gain spread.

Definition at line 166 of file JFitToT.hh.

Double_t JCALIBRATE::JFitToTParameters::normalization
inherited

Definition at line 167 of file JFitToT.hh.


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