Jpp
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 JPMTAnalogueSignalProcessorgetInstance ()
 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

◆ JFitToT()

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  }

Member Function Documentation

◆ 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

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  }

◆ getValue()

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  }

◆ getInstance()

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  }

◆ getNumberOfModelParameters()

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  }

◆ getModelParameters() [1/2]

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  }

◆ getModelParameters() [2/2]

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  }

◆ setModelParameters()

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  }

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

121  {
122  return getModelParameters()[i];
123  }

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

133  {
134  const Int_t i = &(this->*p) - getModelParameters();
135 
136  return JFitParameter_t(i, getModelParameter(i));
137  }

Member Data Documentation

◆ Xmin

double JCALIBRATE::JFitToT::Xmin
private

Definition at line 286 of file JFitToT.hh.

◆ Xmax

double JCALIBRATE::JFitToT::Xmax
private

Definition at line 287 of file JFitToT.hh.

◆ W

Double_t JCALIBRATE::JFitToTParameters::W
inherited

normalisation

Definition at line 142 of file JFitToT.hh.

◆ gain

Double_t JCALIBRATE::JFitToTParameters::gain
inherited

PMT gain.

Definition at line 143 of file JFitToT.hh.

◆ gainSpread

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:
JCALIBRATE::JFitToTParameters::gain
Double_t gain
PMT gain.
Definition: JFitToT.hh:143
JCALIBRATE::FITTOT_GAINSPREAD_MIN
static const double FITTOT_GAINSPREAD_MIN
Minimal gain spread [unit].
Definition: JFitToT.hh:33
JCALIBRATE::JFitToT::getValue
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
JDETECTOR::TIME_OVER_THRESHOLD_NS
const double TIME_OVER_THRESHOLD_NS
Specification for time-over-threshold corresponding to a one photo-electron pulse.
Definition: JDetector/JCalibration.hh:29
JCALIBRATE::JFitToTParameters::W
Double_t W
normalisation
Definition: JFitToT.hh:142
JDETECTOR::JPMTAnalogueSignalProcessor::setPMTParameters
void setPMTParameters(const JPMTParameters &parameters)
Set PMT parameters.
Definition: JPMTAnalogueSignalProcessor.hh:319
JDETECTOR::JPMTParameters::gainSpread
double gainSpread
gain spread [unit]
Definition: JPMTParameters.hh:218
JPP
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JAAnetToolkit.hh:37
JDETECTOR::JPMTParameters::gain
double gain
gain [unit]
Definition: JPMTParameters.hh:217
JCALIBRATE::FITTOT_GAIN_MAX
static const double FITTOT_GAIN_MAX
Maximal gain [unit].
Definition: JFitToT.hh:32
JTOOLS::result
return result
Definition: JPolint.hh:695
JCALIBRATE::JFitToTParameters::gainSpread
Double_t gainSpread
PMT gain spread.
Definition: JFitToT.hh:144
JCALIBRATE::FITTOT_GAIN_MIN
static const double FITTOT_GAIN_MIN
Minimal gain [unit].
Definition: JFitToT.hh:31
JCALIBRATE::JFitToTParameters::getNumberOfModelParameters
static Int_t getNumberOfModelParameters()
Get number of model parameters.
Definition: JFitToT.hh:73
JCALIBRATE::JFitToT::Xmin
double Xmin
Definition: JFitToT.hh:286
JROOT::setParLimits
bool setParLimits(TF1 &f1, const Int_t index, Double_t xmin, Double_t xmax)
Set fit parameter limits.
Definition: JRootToolkit.hh:293
JCALIBRATE::JFitToTParameters::JFitToTParameters
JFitToTParameters(const JPMTParameters &parameters)
Constructor.
Definition: JFitToT.hh:45
JDETECTOR::JPMTAnalogueSignalProcessor::getProbability
virtual double getProbability(const double npe, const int NPE) const
Get probability for given charge.
Definition: JPMTAnalogueSignalProcessor.hh:413
JCALIBRATE::FITTOT_GAINSPREAD_MAX
static const double FITTOT_GAINSPREAD_MAX
Maximal gain spread [unit].
Definition: JFitToT.hh:34
JDETECTOR::JPMTSignalProcessorInterface::getNPE
double getNPE(const double tot_ns, const double eps=1.0e-3) const
Get number of photo-electrons.
Definition: JPMTSignalProcessorInterface.hh:316
JROOT::setParameter
bool setParameter(TF1 &f1, const JFitParameter_t &parameter)
Set fit parameter.
Definition: JRootToolkit.hh:228
std
Definition: jaanetDictionary.h:36
JCALIBRATE::JFitToT::Xmax
double Xmax
Definition: JFitToT.hh:287
JFIT::JFitParameter_t
JFitParameter_t
Definition: JFitParameters.hh:15
JDETECTOR::JPMTAnalogueSignalProcessor::getDerivative
virtual double getDerivative(const double npe) const
Get derivative of number of photo-electrons to time-over-threshold.
Definition: JPMTAnalogueSignalProcessor.hh:506
JCALIBRATE::JFitToT::getInstance
static JPMTAnalogueSignalProcessor & getInstance()
Get unique instance of PMT analogue signal processor.
Definition: JFitToT.hh:279
JCALIBRATE::JFitToTParameters::getModelParameters
const Double_t * getModelParameters() const
Get model parameters.
Definition: JFitToT.hh:84
JCALIBRATE::JFitToTParameters::setModelParameters
void setModelParameters(const Double_t *data)
Set model parameters.
Definition: JFitToT.hh:106
JCALIBRATE::JFitToTParameters::getModelParameter
const Double_t getModelParameter(const int i) const
Get model parameter.
Definition: JFitToT.hh:120
JCALIBRATE::FITTOT_TOT_MIN_NS
static const double FITTOT_TOT_MIN_NS
Minimal time-over-threshold [ns].
Definition: JFitToT.hh:30