Belle II Software development
|
Implements a soft constraint with chi^2=((efact*sum(E_i) + pxfact*sum(p_x,i)+pyfact*sum(p_y,i)+pzfact*sum(p_z,i)-value)/sigma)^2. More...
#include <SoftGaussMomentumConstraint.h>
Public Member Functions | |
SoftGaussMomentumConstraint (double sigma_=0, double efact_=0, double pxfact_=0, double pyfact_=0, double pzfact_=0, double value_=0) | |
Constructor. | |
virtual | ~SoftGaussMomentumConstraint () |
Virtual destructor. | |
virtual double | getValue () const override |
Returns the value of the constraint function. | |
virtual void | getDerivatives (int idim, double der[]) const override |
Get first order derivatives. | |
virtual void | setFOList (std::vector< ParticleFitObject * > *fitobjects_) |
Adds several ParticleFitObject objects to the list. | |
virtual void | addToFOList (ParticleFitObject &fitobject, int flag=1) |
Adds one ParticleFitObject objects to the list. | |
virtual void | resetFOList () |
Resests ParticleFitObject list. | |
virtual double | getChi2 () const override |
Returns the chi2. | |
virtual double | getError () const override |
Returns the error on the value of the constraint. | |
virtual double | getSigma () const |
Returns the sigma. | |
virtual double | setSigma (double sigma_) |
Sets the sigma. | |
virtual void | add2ndDerivativesToMatrix (double *M, int idim) const override |
Adds second order derivatives to global covariance matrix M. | |
virtual void | addToGlobalChi2DerVector (double *y, int idim) const override |
Add derivatives of chi squared to global derivative matrix. | |
void | invalidateCache () const |
Invalidates any cached values for the next event. | |
void | test1stDerivatives () |
void | test2ndDerivatives () |
double | num1stDerivative (int ifo, int ilocal, double eps) |
Evaluates numerically the 1st derivative w.r.t. a parameter. | |
double | num2ndDerivative (int ifo1, int ilocal1, double eps1, int ifo2, int ilocal2, double eps2) |
Evaluates numerically the 2nd derivative w.r.t. 2 parameters. | |
int | getVarBasis () const |
virtual const char * | getName () const |
Returns the name of the constraint. | |
void | setName (const char *name_) |
Set object's name. | |
virtual std::ostream & | print (std::ostream &os) const |
print object to ostream | |
Protected Types | |
enum | { VAR_BASIS = BaseDefs::VARBASIS_EPXYZ } |
typedef std::vector< ParticleFitObject * > | FitObjectContainer |
Vector of pointers to ParticleFitObjects. | |
typedef FitObjectContainer::iterator | FitObjectIterator |
Iterator through vector of pointers to ParticleFitObjects. | |
typedef FitObjectContainer::const_iterator | ConstFitObjectIterator |
Constant iterator through vector of pointers to ParticleFitObjects. | |
Protected Member Functions | |
virtual bool | secondDerivatives (int i, int j, double *derivatives) const override |
Second derivatives with respect to the 4-vectors of Fit objects i and j; result false if all derivatives are zero. | |
virtual bool | firstDerivatives (int i, double *derivatives) const override |
First derivatives with respect to the 4-vector of Fit objects i; result false if all derivatives are zero. | |
Protected Attributes | |
double | efact |
double | pxfact |
double | pyfact |
double | pzfact |
double | value |
FitObjectContainer | fitobjects |
The FitObjectContainer. | |
std::vector< double > | derivatives |
The derivatives. | |
std::vector< int > | flags |
The flags can be used to divide the FitObjectContainer into several subsets used for example to implement an equal mass constraint (see MassConstraint). | |
double | sigma |
The sigma of the Gaussian. | |
char * | name |
Related Functions | |
(Note that these are not member functions.) | |
std::ostream & | operator<< (std::ostream &os, const BaseConstraint &bc) |
Prints out a BaseConstraint, using its print method. | |
Implements a soft constraint with chi^2=((efact*sum(E_i) + pxfact*sum(p_x,i)+pyfact*sum(p_y,i)+pzfact*sum(p_z,i)-value)/sigma)^2.
This class implements soft constraints on the sum of energies, px, py, and pz. It can be used to for constraints of the form
Author: Jenny List, Benno List Last update:
by:
Definition at line 49 of file SoftGaussMomentumConstraint.h.
|
protectedinherited |
Constant iterator through vector of pointers to ParticleFitObjects.
Definition at line 177 of file SoftGaussParticleConstraint.h.
|
protectedinherited |
Vector of pointers to ParticleFitObjects.
Definition at line 173 of file SoftGaussParticleConstraint.h.
|
protectedinherited |
Iterator through vector of pointers to ParticleFitObjects.
Definition at line 175 of file SoftGaussParticleConstraint.h.
|
protectedinherited |
Definition at line 189 of file SoftGaussParticleConstraint.h.
SoftGaussMomentumConstraint | ( | double | sigma_ = 0 , |
double | efact_ = 0 , |
||
double | pxfact_ = 0 , |
||
double | pyfact_ = 0 , |
||
double | pzfact_ = 0 , |
||
double | value_ = 0 |
||
) |
Constructor.
sigma_ | The sigma value |
efact_ | Factor for energy sum |
pxfact_ | Factor for px sum |
pyfact_ | Factor for py sum |
pzfact_ | Factor for pz sum |
value_ | Target value of sum |
Definition at line 33 of file SoftGaussMomentumConstraint.cc.
|
overridevirtualinherited |
Adds second order derivatives to global covariance matrix M.
Calculates the second derivative of the constraint g w.r.t.
the various parameters and adds it to the global covariance matrix
We denote with P_i the 4-vector of the i-th ParticleFitObject, then
Here, is a Matrix, where is the number of parameters of FitObject i; Correspondingly, is a matrix. Also, is a matrix for a given i and j, and is a 4-vector (though not a Lorentz-vector!).
First, treat the part
Second, treat the parts
and
Here, is a 4-vector, which we pass on to the FitObject
M | Covariance matrix, at least idim x idim |
idim | First dimension of the array |
Implements BaseSoftConstraint.
Definition at line 92 of file SoftGaussParticleConstraint.cc.
|
inlinevirtualinherited |
Adds one ParticleFitObject objects to the list.
Definition at line 92 of file SoftGaussParticleConstraint.h.
|
overridevirtualinherited |
Add derivatives of chi squared to global derivative matrix.
y | Vector of chi2 derivatives |
idim | Vector size |
Implements BaseSoftConstraint.
Definition at line 246 of file SoftGaussParticleConstraint.cc.
|
overrideprotectedvirtual |
First derivatives with respect to the 4-vector of Fit objects i; result false if all derivatives are zero.
i | number of 1st FitObject |
derivatives | The result 4-vector |
Implements SoftGaussParticleConstraint.
Definition at line 86 of file SoftGaussMomentumConstraint.cc.
|
overridevirtualinherited |
Returns the chi2.
Implements BaseSoftConstraint.
Definition at line 48 of file SoftGaussParticleConstraint.cc.
|
overridevirtual |
Get first order derivatives.
Call this with a predefined array "der" with the necessary number of entries!
idim | First dimension of the array |
der | Array of derivatives, at least idim x idim |
Implements SoftGaussParticleConstraint.
Definition at line 67 of file SoftGaussMomentumConstraint.cc.
|
overridevirtualinherited |
Returns the error on the value of the constraint.
Reimplemented from BaseConstraint.
Definition at line 54 of file SoftGaussParticleConstraint.cc.
|
virtualinherited |
Returns the name of the constraint.
Definition at line 56 of file BaseConstraint.cc.
|
virtualinherited |
Returns the sigma.
Definition at line 37 of file SoftGaussParticleConstraint.cc.
|
overridevirtual |
Returns the value of the constraint function.
Implements SoftGaussParticleConstraint.
Definition at line 47 of file SoftGaussMomentumConstraint.cc.
|
inherited |
Definition at line 368 of file SoftGaussParticleConstraint.cc.
|
inlineinherited |
Invalidates any cached values for the next event.
Definition at line 138 of file SoftGaussParticleConstraint.h.
|
inherited |
Evaluates numerically the 1st derivative w.r.t. a parameter.
ifo | Number of FitObject |
ilocal | Local parameter number |
eps | variation of local parameter |
Definition at line 315 of file SoftGaussParticleConstraint.cc.
|
inherited |
Evaluates numerically the 2nd derivative w.r.t. 2 parameters.
ifo1 | Number of 1st FitObject |
ilocal1 | 1st local parameter number |
eps1 | variation of 1st local parameter |
ifo2 | Number of 1st FitObject |
ilocal2 | 1st local parameter number |
eps2 | variation of 2nd local parameter |
Definition at line 329 of file SoftGaussParticleConstraint.cc.
|
virtualinherited |
print object to ostream
os | The output stream |
Definition at line 76 of file BaseConstraint.cc.
|
inlinevirtualinherited |
Resests ParticleFitObject list.
Definition at line 99 of file SoftGaussParticleConstraint.h.
|
overrideprotectedvirtual |
Second derivatives with respect to the 4-vectors of Fit objects i and j; result false if all derivatives are zero.
i | number of 1st FitObject |
j | number of 2nd FitObject |
derivatives | The result 4x4 matrix |
Implements SoftGaussParticleConstraint.
Definition at line 96 of file SoftGaussMomentumConstraint.cc.
|
inlinevirtualinherited |
Adds several ParticleFitObject objects to the list.
fitobjects_ | A list of BaseFitObject objects |
Definition at line 83 of file SoftGaussParticleConstraint.h.
|
inherited |
Set object's name.
Definition at line 61 of file BaseConstraint.cc.
|
virtualinherited |
Sets the sigma.
sigma_ | The new sigma value |
Definition at line 42 of file SoftGaussParticleConstraint.cc.
|
inherited |
Definition at line 260 of file SoftGaussParticleConstraint.cc.
|
inherited |
Definition at line 280 of file SoftGaussParticleConstraint.cc.
|
related |
Prints out a BaseConstraint, using its print method.
os | The output stream |
bc | The object to print |
Definition at line 114 of file BaseConstraint.h.
|
protectedinherited |
The derivatives.
Definition at line 181 of file SoftGaussParticleConstraint.h.
|
protected |
Definition at line 75 of file SoftGaussMomentumConstraint.h.
|
protectedinherited |
The FitObjectContainer.
Definition at line 179 of file SoftGaussParticleConstraint.h.
|
protectedinherited |
The flags can be used to divide the FitObjectContainer into several subsets used for example to implement an equal mass constraint (see MassConstraint).
Definition at line 184 of file SoftGaussParticleConstraint.h.
|
protectedinherited |
Definition at line 108 of file BaseConstraint.h.
|
protected |
Definition at line 76 of file SoftGaussMomentumConstraint.h.
|
protected |
Definition at line 77 of file SoftGaussMomentumConstraint.h.
|
protected |
Definition at line 78 of file SoftGaussMomentumConstraint.h.
|
protectedinherited |
The sigma of the Gaussian.
Definition at line 187 of file SoftGaussParticleConstraint.h.
|
protected |
Definition at line 79 of file SoftGaussMomentumConstraint.h.