Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | Public Attributes | Static Private Member Functions | 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 double xmin, const double xmax)
 Constructor. More...
 
TFitResultPtr operator() (TH1 &h1, const std::string &option)
 Fit histogram. More...
 
const Double_t * getModelParameters () const
 Get model parameters. More...
 
Double_t * getModelParameters ()
 Get model parameters. 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 Double_t getValue (const Double_t *x, const Double_t *par)
 Get rate as a function of the fit parameters. More...
 
static Int_t getNumberOfModelParameters ()
 Get number of model parameters. More...
 

Public Attributes

Double_t W
 normalisation More...
 
Double_t gain
 PMT gain. More...
 
Double_t gainSpread
 PMT gain spread. More...
 

Static Private Member Functions

static
JPMTAnalogueSignalProcessor
getInstance ()
 Get unique instance of PMT analogue signal processor. More...
 

Private Attributes

double Xmin
 
double Xmax
 

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

Constructor & Destructor Documentation

JCALIBRATE::JFitToT::JFitToT ( const JPMTParameters parameters,
const double  xmin,
const double  xmax 
)
inline

Constructor.

Parameters
parametersparameters
xminminimal x
xmaxmaximal x

Definition at line 164 of file JFitToT.hh.

166  :
167 
168  JFitToTParameters(parameters),
169 
170  TF1("fittot",
172  xmin, xmax,
174 
175  Xmin(xmin),
176  Xmax(xmax)
177  {
178  getInstance().setPMTParameters(parameters);
179  }
static Int_t getNumberOfModelParameters()
Get number of model parameters.
Definition: JFitToT.hh:73
static JPMTAnalogueSignalProcessor & getInstance()
Get unique instance of PMT analogue signal processor.
Definition: JFitToT.hh:279
void setPMTParameters(const JPMTParameters &parameters)
Set PMT parameters.
static Double_t getValue(const Double_t *x, const Double_t *par)
Get rate as a function of the fit parameters.
Definition: JFitToT.hh:258
JFitToTParameters(const JPMTParameters &parameters)
Constructor.
Definition: JFitToT.hh:45

Member Function Documentation

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

Definition at line 191 of file JFitToT.hh.

192  {
193  using namespace std;
194  using namespace JPP;
195 
196  Double_t x0 = numeric_limits<Double_t>::max();
197  Double_t y0 = 0.0;
198  this->W = 0.0;
199 
200  for (Int_t i = 1; i <= h1.GetXaxis()->GetNbins(); ++i) {
201 
202  const Double_t x = h1.GetBinCenter (i);
203  const Double_t y = h1.GetBinContent(i);
204 
205  if (x >= this->Xmin &&
206  x <= this->Xmax) {
207  this->W += y;
208  }
209 
210  if (x >= 0.5*TIME_OVER_THRESHOLD_NS &&
211  x <= 2.0*TIME_OVER_THRESHOLD_NS) {
212 
213  if (y >= y0) {
214  x0 = x;
215  y0 = y;
216  }
217  }
218  }
219 
220  double xmin = Xmin + x0 - TIME_OVER_THRESHOLD_NS;
221  double xmax = Xmax + x0 - TIME_OVER_THRESHOLD_NS;
222 
223  if (xmin < FITTOT_TOT_MIN_NS) {
224  xmin = FITTOT_TOT_MIN_NS;
225  }
226 
227  this->SetRange(xmin, xmax);
228 
229  this->gain = getInstance().getNPE(x0);
230 
233 
236 
237  this->SetParameters(this->getModelParameters());
238 
239  getInstance().gain = this->gain;
241 
242  const TFitResultPtr result = h1.Fit(this, option.c_str());
243 
244  this->setModelParameters(this->GetParameters());
245 
246  return result;
247  }
double gain
gain [unit]
const Double_t getModelParameter(const int i) const
Get model parameter.
Definition: JFitToT.hh:120
double gainSpread
gain spread [unit]
static JPMTAnalogueSignalProcessor & getInstance()
Get unique instance of PMT analogue signal processor.
Definition: JFitToT.hh:279
static const double FITTOT_GAIN_MAX
Maximal gain [unit].
Definition: JFitToT.hh:32
Double_t gainSpread
PMT gain spread.
Definition: JFitToT.hh:144
const double TIME_OVER_THRESHOLD_NS
Specification for time-over-threshold corresponding to a one photo-electron pulse.
static const double FITTOT_GAIN_MIN
Minimal gain [unit].
Definition: JFitToT.hh:31
double getNPE(const double tot_ns, const double eps=1.0e-3) const
Get number of photo-electrons.
const Double_t * getModelParameters() const
Get model parameters.
Definition: JFitToT.hh:84
static const double FITTOT_TOT_MIN_NS
Minimal time-over-threshold [ns].
Definition: JFitToT.hh:30
static const double FITTOT_GAINSPREAD_MAX
Maximal gain spread [unit].
Definition: JFitToT.hh:34
bool setParameter(TF1 &f1, const JFitParameter_t &parameter)
Set fit parameter.
Double_t gain
PMT gain.
Definition: JFitToT.hh:143
bool setParLimits(TF1 &f1, const Int_t index, Double_t xmin, Double_t xmax)
Set fit parameter limits.
void setModelParameters(const Double_t *data)
Set model parameters.
Definition: JFitToT.hh:106
Double_t W
normalisation
Definition: JFitToT.hh:142
static const double FITTOT_GAINSPREAD_MIN
Minimal gain spread [unit].
Definition: JFitToT.hh:33
static Double_t JCALIBRATE::JFitToT::getValue ( const Double_t *  x,
const Double_t *  par 
)
inlinestatic

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

259  {
260  static const int NPE = 1;
261 
262  const Double_t W = par[0];
263  getInstance().gain = par[1];
264  getInstance().gainSpread = par[2];
265 
266  const Double_t tot_ns = x[0];
267  const Double_t npe = getInstance().getNPE(tot_ns);
268 
269  return W * getInstance().getProbability(npe, NPE) * getInstance().getDerivative(npe);
270  }
double gain
gain [unit]
double gainSpread
gain spread [unit]
static JPMTAnalogueSignalProcessor & getInstance()
Get unique instance of PMT analogue signal processor.
Definition: JFitToT.hh:279
double getNPE(const double tot_ns, const double eps=1.0e-3) const
Get number of photo-electrons.
virtual double getProbability(const double npe, const int NPE) const
Get probability for given charge.
Double_t W
normalisation
Definition: JFitToT.hh:142
virtual double getDerivative(const double npe) const
Get derivative of number of photo-electrons to time-over-threshold.
static JPMTAnalogueSignalProcessor& JCALIBRATE::JFitToT::getInstance ( )
inlinestaticprivate

Get unique instance of PMT analogue signal processor.

Returns
reference to PMT analogue signal processor.

Definition at line 279 of file JFitToT.hh.

280  {
281  static JPMTAnalogueSignalProcessor object;
282 
283  return object;
284  }
static Int_t JCALIBRATE::JFitToTParameters::getNumberOfModelParameters ( )
inlinestaticinherited

Get number of model parameters.

Returns
number of parameters

Definition at line 73 of file JFitToT.hh.

74  {
75  return sizeof(JFitToTParameters) / sizeof(Double_t);
76  }
JFitToTParameters(const JPMTParameters &parameters)
Constructor.
Definition: JFitToT.hh:45
const Double_t* JCALIBRATE::JFitToTParameters::getModelParameters ( ) const
inlineinherited

Get model parameters.

Returns
pointer to parameters

Definition at line 84 of file JFitToT.hh.

85  {
86  return &this->W;
87  }
Double_t W
normalisation
Definition: JFitToT.hh:142
Double_t* JCALIBRATE::JFitToTParameters::getModelParameters ( )
inlineinherited

Get model parameters.

Returns
pointer to parameters

Definition at line 95 of file JFitToT.hh.

96  {
97  return &this->W;
98  }
Double_t W
normalisation
Definition: JFitToT.hh:142
void JCALIBRATE::JFitToTParameters::setModelParameters ( const Double_t *  data)
inlineinherited

Set model parameters.

Parameters
datapointer to parameters

Definition at line 106 of file JFitToT.hh.

107  {
108  for (Int_t i = 0; i != getNumberOfModelParameters(); ++i) {
109  getModelParameters()[i] = data[i];
110  }
111  }
static Int_t getNumberOfModelParameters()
Get number of model parameters.
Definition: JFitToT.hh:73
const Double_t * getModelParameters() const
Get model parameters.
Definition: JFitToT.hh:84
const Double_t JCALIBRATE::JFitToTParameters::getModelParameter ( const int  i) const
inlineinherited

Get model parameter.

Parameters
iparameter index
Returns
parameter value

Definition at line 120 of file JFitToT.hh.

121  {
122  return getModelParameters()[i];
123  }
const Double_t * getModelParameters() const
Get model parameters.
Definition: JFitToT.hh:84
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 132 of file JFitToT.hh.

133  {
134  const Int_t i = &(this->*p) - getModelParameters();
135 
136  return JFitParameter_t(i, getModelParameter(i));
137  }
const Double_t getModelParameter(const int i) const
Get model parameter.
Definition: JFitToT.hh:120
const Double_t * getModelParameters() const
Get model parameters.
Definition: JFitToT.hh:84

Member Data Documentation

double JCALIBRATE::JFitToT::Xmin
private

Definition at line 286 of file JFitToT.hh.

double JCALIBRATE::JFitToT::Xmax
private

Definition at line 287 of file JFitToT.hh.

Double_t JCALIBRATE::JFitToTParameters::W
inherited

normalisation

Definition at line 142 of file JFitToT.hh.

Double_t JCALIBRATE::JFitToTParameters::gain
inherited

PMT gain.

Definition at line 143 of file JFitToT.hh.

Double_t JCALIBRATE::JFitToTParameters::gainSpread
inherited

PMT gain spread.

Definition at line 144 of file JFitToT.hh.


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