1 #ifndef __JCALIBRATE_JFITK40__
2 #define __JCALIBRATE_JFITK40__
10 #include "TFitResult.h"
25 namespace JCALIBRATE {}
26 namespace JPP {
using namespace JCALIBRATE; }
28 namespace JCALIBRATE {
203 void setQE(
const int pmt,
const Double_t QE)
227 void setTTS(
const int pmt,
const Double_t TTS)
251 void setT0(
const int pmt,
const Double_t t0)
286 template<
class JFunction_t = JNullType>
321 static_cast<JModule&
>(*this) = module;
327 index_of_average_t0 = (option ? 0 : -1);
342 return this->sigmaK40_ns;
353 this->sigmaK40_ns = sigma;
377 return pmt == index_of_average_t0;
392 if (index_of_average_t0 == -1) {
408 if (!disable[i] && i != index_of_average_t0) {
416 if (pmt != index_of_average_t0)
432 disable[pmt] =
false;
448 if (index_of_average_t0 == pmt) {
450 for (index_of_average_t0 = 0; index_of_average_t0 !=
NUMBER_OF_PMTS; ++index_of_average_t0) {
451 if (!disable[index_of_average_t0]) {
472 this->getPMT(pair.second));
484 return TMath::Sqrt(getTTS(pair.first) * getTTS(pair.first) +
485 getTTS(pair.second) * getTTS(pair.second) +
486 getSigmaK40() * getSigmaK40());
498 if (index_of_average_t0 == -1) {
504 if (pair.first == index_of_average_t0) {
508 }
else if (pair.second == index_of_average_t0) {
528 const Double_t ct =
getDot(pair);
545 const Double_t t0 = getTimeOffset(pair);
546 const Double_t sigma =
getSigma (pair);
548 return getValue(pair) * TMath::Gaus(dt_ns, t0, sigma, kTRUE);
608 xmin, xmax, ymin, ymax,
609 getNumberOfModelParameters())
623 static Double_t
getRate(
const Double_t* x,
const Double_t* data)
627 static Double_t sigma;
628 static Double_t
rate;
630 const int ix = (int) x[0];
631 const Double_t dt_ns = x[1];
689 if (index_of_average_t0 != -1) {
691 this->setT0(index_of_average_t0, 0.0);
696 this->SetParameters(this->getModelParameters());
700 const TFitResultPtr
result = h2.Fit(
this, option.c_str());
702 this->setModelParameters(this->GetParameters());
728 f2.GetXmin(), f2.GetXmax(),
729 getNumberOfModelParameters())
731 this->SetParameters(f2.GetParameters());
758 const int ix = (int) x[0];
783 if (index_of_average_t0 != -1) {
785 this->setT0(index_of_average_t0, 0.0);
790 this->SetParameters(this->getModelParameters());
794 const TFitResultPtr
result = h1.Fit(
this, option.c_str());
796 this->setModelParameters(this->GetParameters());
Double_t bg
remaining constant background
JFitK40_t(const JModule &module, const Double_t xmin, const Double_t xmax, const Double_t ymin, const Double_t ymax, const bool option)
Constructor.
TFitResultPtr operator()(TH1 &h1, const std::string &option)
Fit 1D-histogram.
Double_t TTS
transition-time spread [ns]
JFitParameter_t getModelParameter(Double_t JFitK40Parameters::*p) const
Get model parameter.
Double_t getQE(const int pmt) const
Get QE of given PMT.
static JFitK40_t & getInstance()
Get unique instance of fit object.
void setT0(const int pmt, const Double_t t0)
Set time offset of given PMT.
double getValue(const JScale_t scale)
Get numerical value corresponding to scale.
bool is_average_t0(int pmt) const
Test PMT status.
Double_t sigmaK40_ns
intrinsic K40 arrival time spread [ns]
Data structure for a composite optical module.
Double_t t0
time offset [ns]
Double_t QE
quantum efficiency [unit]
double getDot(const pair_type &pair) const
Get cosine of space angle between PMT axes.
JFitK40_t< TF2 > JFitK40
Type definition for backward compatibility.
double getDot(const JNeutrinoDirection &first, const JNeutrinoDirection &second)
Dot product.
static Double_t getTimeOffset(const Double_t *x, const Double_t *data)
Get time offset as a function of the fit parameters.
bool is_disabled(int pmt) const
Test PMT status.
double getSigma(vector< double > &v)
get standard deviation of vector content
JFitK40Parameters(const Double_t *data)
Copy constructor.
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
then set_variable singlesRate set_variable doublesRate set_variable numberOfSlices echo Generating random background echo Singles rate
Double_t getValue(const pair_type &pair, const Double_t dt_ns) const
Get K40 coincidence rate.
Template specialisation of two-fold coincidence rate due to K40 and other radioactive decays...
Double_t getTTS(const int pmt) const
Get time resolution of given PMT.
*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
static const double FITK40_QE_MAX
Maximal quantum efficiency [unit].
then for HISTOGRAM in h0 h1
JFitK40_t(const JModule &module, const bool option)
Constructor.
void enablePMT(const int pmt)
Enable PMT.
Double_t p3
angle dependence coincidence rate
JPMTParameters_t()
Default constructor.
const Double_t * getModelParameters() const
Get model parameters.
bool isParameterFixed(const TF1 &f1, const Int_t index)
Check if fit parameter is fixed.
Double_t getT0(const int pmt) const
Get time offset of given PMT.
Double_t getSigma(const pair_type &pair) const
Get time resolution of given PMT pair.
Auxiliary data structure for a parameter index and its value.
Double_t getValue(const Double_t ct) const
Get K40 coincidence rate as a function of cosine angle between PMT axes.
Auxiliary class to sort pairs of PMT addresses within optical module.
void setModelParameters(const Double_t *data)
Set model parameters.
double getRate(const JDAQSummaryFrame &frame, const int pmt, const double factor=1.0)
Get corrected rate of PMT.
T & getInstance(const T &object)
Get static instance from temporary object.
Template definition of two-fold coincidence rate due to K40 and other radioactive decays...
Double_t getValue(const pair_type &pair) const
Get K40 coincidence rate.
double getQE(const double R, const double mu)
Get QE for given ratio of hit probabilities and expectation value of the number of photo-electrons...
JFitK40_t(const JFitK40_t< TF2 > &f2)
Constructor.
Double_t getModelParameter(Int_t i) const
Get model parameter.
int index_of_average_t0
index of t0 used for average time offset
Auxiliary class for no type definition.
JPMTParameters_t parameters[NUMBER_OF_PMTS]
double getDot(const JFirst_t &first, const JSecond_t &second)
Get dot product of objects.
static Int_t getNumberOfModelParameters()
Get number of model parameters.
JFitParameter_t getModelParameter(Int_t pmt, Double_t JPMTParameters_t::*p) const
Get model parameter.
Double_t p4
angle dependence coincidence rate
Double_t getSigmaK40() const
Get intrinsic K40 arrival time spread.
bool setParLimits(TF1 &f1, const Int_t index, Double_t xmin, Double_t xmax)
Set fit parameter limits.
Fit parameters for single PMT.
void setSigmaK40(const Double_t sigma)
Set intrinsic K40 arrival time spread.
static const double FITK40_QE_MIN
Minimal quantum efficiency [unit].
JCombinatorics::pair_type pair_type
Data structure for a pair of addresses.
static const double FITK40_TTS_MIN_NS
Minimal transition-time spread [ns].
JFitK40_t()
Default constructor.
Double_t getTimeOffset(const pair_type &pair) const
Get time offset of given PMT pair.
void disablePMT(const int pmt)
Disable PMT.
void setQE(const int pmt, const Double_t QE)
Set QE of given PMT.
Double_t Rate_Hz
maximal coincidence rate [Hz]
bool fixParameter(TF1 &f1, const JFitParameter_t ¶meter)
Fix fit parameter.
static Double_t getRate(const Double_t *x, const Double_t *data)
Get K40 coincidence rate as a function of the fit parameters.
void setTTS(const int pmt, const Double_t TTS)
Set time resolution of given PMT.
static const double FITK40_TTS_MAX_NS
Maximal transition-time spread [ns].
Double_t p1
angle dependence coincidence rate
Double_t p2
angle dependence coincidence rate
Exception for accessing an index in a collection that is outside of its range.
KM3NeT DAQ constants, bit handling, etc.
static const int NUMBER_OF_PMTS
Total number of PMTs in module.
Double_t getT0(const int pmt) const
Get time offset of given PMT.
Fit parameters for two-fold coincidence rate due to K40.
TFitResultPtr operator()(TH2 &h2, const std::string &option)
Fit 2D-histogram.
Double_t * getModelParameters()
Get model parameters.
Double_t cc
fraction of signal correlated background
JFitK40Parameters()
Default constructor.
Data structure for a composite optical module.