Nanga Parbat 1.1.0
A TMD fitting framework
chisquare.h
Go to the documentation of this file.
1//
2// Author: Valerio Bertone: valerio.bertone@cern.ch
3//
4
5#pragma once
6
7#include <numeric>
8
12
13namespace NangaParbat
14{
22 {
23 public:
31 ChiSquare(std::vector<std::pair<DataHandler*, ConvolutionTable*>> DSVect, Parameterisation* NPFunc);
32
40
47 virtual void AddBlock(std::pair<DataHandler*, ConvolutionTable*> DSBlock);
48
59 std::vector<double> GetResiduals(int const& ids, bool const& central = false) const;
60
69 std::vector<double> GetResidualDerivatives(int const& ids, int const& ipar) const;
70
78 std::pair<std::vector<double>, double> GetSystematicShifts(int const& ids) const;
79
90 double Evaluate(int const& ids = -1, bool const& central = false) const;
91
102 std::vector<double> Derive() const;
103
107 double operator()(int const& ids = -1) { return Evaluate(ids); };
108
114 virtual void SetParameters(std::vector<double> const& pars) { _NPFunc->SetParameters(pars); };
115
122 std::vector<std::pair<DataHandler*, ConvolutionTable*>> GetBlocks() const { return _DSVect; };
123
130
138 std::vector<int> GetDataPointNumbers() const { return _ndata; };
139
147 std::vector<int> GetDataPointNumbersAfterCuts() const { return _ndatac; };
148
155 int GetDataPointNumber() const { return std::accumulate(_ndata.begin(), _ndata.end(), 0); };
156
163 int GetDataPointNumberAfterCuts() const { return std::accumulate(_ndatac.begin(), _ndatac.end(), 0); };
164
169 int GetNumberOfExperiments() const { return (int) _ndata.size(); };
170
176 int GetNumberOfParameters() const { return (int) _NPFunc->GetParameters().size(); };
177
183 std::vector<double> GetParameters() const { return _NPFunc->GetParameters(); };
184
185 protected:
186 std::vector<std::pair<DataHandler*, ConvolutionTable*>> _DSVect;
188 std::vector<int> _ndata;
189 std::vector<int> _ndatac;
190
191 friend YAML::Emitter& operator << (YAML::Emitter& os, ChiSquare const& chi2);
192 };
193
197 YAML::Emitter& operator << (YAML::Emitter& os, ChiSquare const& chi2);
198}
The "ChiSquare" class computes the χ2's given a set of "DataHandler" objects and the corresponding "C...
Definition: chisquare.h:22
std::vector< double > GetResidualDerivatives(int const &ids, int const &ipar) const
Function that returns the derivative of the residuals of the χ2 deriving from the Cholesky decomposit...
int GetDataPointNumberAfterCuts() const
Function that gets the number of data points that pass all the cuts for the whole dataset.
Definition: chisquare.h:163
int GetNumberOfExperiments() const
Function that returns the number of experiments.
Definition: chisquare.h:169
std::vector< std::pair< DataHandler *, ConvolutionTable * > > _DSVect
Vector of "DataHandler-ConvolutionTable" pairs.
Definition: chisquare.h:183
std::pair< std::vector< double >, double > GetSystematicShifts(int const &ids) const
Function that returns the systematic shifts and the associated penalty term of the χ2.
double operator()(int const &ids=-1)
Utility operator that shortcuts the Evaluate method.
Definition: chisquare.h:107
std::vector< double > GetParameters() const
Function that returns the parameters of the parameterisation objects.
Definition: chisquare.h:183
Parameterisation * _NPFunc
Parameterisation of the non-perturbative component.
Definition: chisquare.h:187
ChiSquare(Parameterisation *NPFunc)
The default "ChiSquare" constructor.
double Evaluate(int const &ids=-1, bool const &central=false) const
Function that evaluates the χ2's.
virtual void AddBlock(std::pair< DataHandler *, ConvolutionTable * > DSBlock)
Add ("DataHandler","ConvolutionTable") pair block to the "DSVect" vector.
std::vector< int > _ndata
Vector constaining the number of data points per dataset that pass the qT/Q cut.
Definition: chisquare.h:188
friend YAML::Emitter & operator<<(YAML::Emitter &os, ChiSquare const &chi2)
Method which prints ChiSquare feautures with cout <<.
std::vector< int > GetDataPointNumbersAfterCuts() const
Function that gets the number of data points that pass all the cuts for each data set in the form of ...
Definition: chisquare.h:147
std::vector< double > Derive() const
Function that evaluates the (analytic) derivative of the χ2's w.r.t. the "ipar"-th parameter.
Parameterisation * GetNonPerturbativeFunction() const
Function that returns the "Parameterisation" object associated to this chisquare object.
Definition: chisquare.h:129
std::vector< std::pair< DataHandler *, ConvolutionTable * > > GetBlocks() const
Function that returns the vector of ("DataHandler", "ConvolutionTable") object-pairs for all the data...
Definition: chisquare.h:122
std::vector< int > _ndatac
Vector constaining the number of data points per dataset that pass all the cuts.
Definition: chisquare.h:189
virtual void SetParameters(std::vector< double > const &pars)
Function that sets the free parameters of the parameterisation.
Definition: chisquare.h:114
std::vector< int > GetDataPointNumbers() const
Function that gets the number of data points that pass the qT / Q cut for each data set in the form o...
Definition: chisquare.h:138
int GetDataPointNumber() const
Function that gets the number of data points that pass the qT / Q cut for the whole dataset.
Definition: chisquare.h:155
int GetNumberOfParameters() const
Function that returns the number of parameters of the parameterisation objects.
Definition: chisquare.h:176
ChiSquare(std::vector< std::pair< DataHandler *, ConvolutionTable * > > DSVect, Parameterisation *NPFunc)
The "ChiSquare" constructor.
std::vector< double > GetResiduals(int const &ids, bool const &central=false) const
Function that returns the residuals of the χ2 deriving from the Cholesky decomposition of the covaria...
Mother class that implements the main feautures of a functional parameterisation of non-perturbative ...
Definition: parameterisation.h:20
virtual std::vector< double > GetParameters() const
Definition: parameterisation.h:105
virtual void SetParameters(std::vector< double > const &pars)
Function that sets the free parameters of the parameterisation.
Definition: parameterisation.h:41
Definition: bstar.h:12
YAML::Emitter & operator<<(YAML::Emitter &os, ChiSquare const &chi2)
Method which prints ChiSquare feautures with cout <<.