Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauDecayTimePdf.hh
\brief File containing declaration of LauDecayTimePdf class.
*/
/*! \class LauDecayTimePdf
\brief Class for defining the PDFs used in the time-dependent fit model to describe the decay time.
LauDecayTimePdf is a class that provides the PDFs for describing the
time-dependence of the various terms in a particle/antiparticle decay to a
common final state. The various terms have the form of exponentially
decaying trigonometric or hyperbolic functions convolved with a N-Gaussian
resolution function.
*/
#ifndef LAU_DECAYTIME_PDF
#define LAU_DECAYTIME_PDF
#include <vector>
+#include <array>
#include <complex>
#include "TString.h"
#include "LauAbsRValue.hh"
#include "LauFitDataTree.hh"
#include "LauComplex.hh"
class TH1;
class Lau1DHistPdf;
class Lau1DCubicSpline;
// TODO - Should this have Pdf in the name?
// - Audit function names and public/private access category
// - Audit what should be given to constructor and what can be set later (maybe different constructors for different scenarios, e.g. smeared with per-event error/smeared with avg error/not smeared)
class LauDecayTimePdf final {
public:
// TODO - can we think of better names?
//! The functional form of the decay time PDF
enum FuncType {
Hist, //< Hist PDF for fixed background
Delta, //< Delta function - for prompt background
Exp, //< Exponential function - for non-prompt background or charged B's
DeltaExp, //< Delta + Exponential function - for background with prompt and non-prompt parts
ExpTrig, //< Exponential function with Delta m driven mixing - for neutral B_d's
ExpHypTrig //< Exponential function with both Delta m and Delta Gamma driven mixing - for neutral B_s's
};
//! How is the decay time measured - absolute or difference?
enum TimeMeasurementMethod {
DecayTime, //< Absolute measurement of decay time, e.g. LHCb scenario
DecayTimeDiff //< Measurement of the difference of two decay times, e.g. BaBar/Belle(II) scenario
};
//! How is the TD efficiency information going to be given?
enum EfficiencyMethod {
Spline, //< As a cubic spline
Binned, //< As a histogram (TH1D/TH1F)
Flat //< As a flat distribution (constant)
};
//! Constructor
/*!
\param [in] theVarName the name of the decay time variable in the input data
\param [in] theVarErrName the name of the decay time error variable in the input data
\param [in] params the parameters of the PDF
\param [in] minAbscissaVal the minimum value of the abscissa
\param [in] maxAbscissaVal the maximum value of the abscissa
\param [in] minAbscissaErr the minimum value of the abscissa error
\param [in] maxAbscissaErr the maximum value of the abscissa error
\param [in] type the functional form of the PDF
\param [in] nGauss the number of Gaussians in the resolution function
\param [in] scale controls whether the Gaussian parameters are scaled by the per-event error
\param [in] method set the type of the time measurement used in the given experiment
/* case Lau1DCubicSpline::AkimaSpline: // Double check the Akima description of splines (in evaluate) right now they're the same except for the first derivatives
{
//using fomulae from https://asmquantmacro.com/2015/09/01/akima-spline-interpolation-in-excel/
std::function<Double_t(Int_t)> m = [&](Int_t j) //formula to get the straight line gradient
{
if(j < 0){return 2*m(j+1)-m(j+2);}
if(j >= nKnots_){return 2*m(j-1)-m(j-2);}
return (y_[j+1]-y_[j]) / (x_[j+1]-x_[j]);
};
auto t = [&](Int_t j)
{
Double_t res = 0.; //originally res was called 't' but that produced a shadow warning
+ if(not effiFun_){std::cerr << "FATAL : no spline defined!"; gSystem->Exit(EXIT_FAILURE);}
+
+ for(size_t i = 0; i < effiFun_ -> getnKnots()-1; ++i)
+ {
+ if( this -> doSmearing() )
+ {this -> calcSmearedSplinePartialIntegrals( i, means, sigmas, fracs );}
+ else
+ {std::cerr << "Spline acceptance for non-smeared case not implemented!"<<std::endl; gSystem -> Exit(EXIT_FAILURE);}
+ }
+
+
+ /*
std::cerr << "WARNING in LauDecayTimePdf::calcNorm : normalisation integrals for spline acceptance not yet implemented - effect of acceptance will be neglected!" << std::endl;
+ std::cout << "INFO in LauDecayTimePdf::setEffiHist : Supplied histogram for Decay Time Acceptance has values too large: normalising..." << std::endl;