19#ifndef __SOFTBWPARTICLECONSTRAINT_H
20#define __SOFTBWPARTICLECONSTRAINT_H
22#include "analysis/OrcaKinFit/BaseSoftConstraint.h"
23#include "analysis/OrcaKinFit/BaseFitObject.h"
34 namespace OrcaKinFit {
36 class ParticleFitObject;
77 class SoftBWParticleConstraint:
public BaseSoftConstraint {
80 SoftBWParticleConstraint(
double gamma_,
81 double emin_ = -std::numeric_limits<double>::infinity(),
82 double emax_ = std::numeric_limits<double>::infinity()
85 virtual ~SoftBWParticleConstraint() {};
88 virtual void setFOList(std::vector <ParticleFitObject*>* fitobjects_
91 for (
int i = 0; i < (int) fitobjects_->size(); i++) {
92 fitobjects.push_back((*fitobjects_)[i]);
97 virtual void addToFOList(ParticleFitObject& fitobject,
int flag = 1
100 fitobjects.push_back(&fitobject);
101 flags.push_back(flag);
105 virtual double getValue()
const override = 0;
108 virtual double getChi2()
const override;
111 virtual double getError()
const override;
114 virtual double getGamma()
const;
117 virtual double setGamma(
double gamma_
122 virtual void getDerivatives(
int idim,
124 )
const override = 0;
126 virtual void add2ndDerivativesToMatrix(
double* M,
131 virtual void addToGlobalChi2DerVector(
double* y,
137 void invalidateCache()
const;
140 virtual void updateCache()
const;
143 virtual bool cacheValid()
const;
145 void test1stDerivatives();
146 void test2ndDerivatives();
149 double num1stDerivative(
int ifo,
154 double num2ndDerivative(
int ifo1,
168 static double erfinv(
double x);
170 static double normal_quantile(
double x);
171 static double normal_quantile_1stderiv(
double x);
172 static double normal_quantile_2ndderiv(
double x);
173 static double normal_pdf(
double x);
174 static double normal_pdf_deriv(
double x);
177 double penalty(
double e)
const;
179 double penalty1stder(
double e)
const;
181 double penalty2ndder(
double e)
const;
183 int getVarBasis()
const;
188 virtual bool secondDerivatives(
int i,
193 virtual bool firstDerivatives(
int i,
199 typedef std::vector <ParticleFitObject*> FitObjectContainer;
201 typedef FitObjectContainer::iterator FitObjectIterator;
203 typedef FitObjectContainer::const_iterator ConstFitObjectIterator;
205 FitObjectContainer fitobjects;
207 std::vector <double> derivatives;
210 std::vector <int> flags;
217 mutable bool cachevalid;
218 mutable double atanxmin;
219 mutable double atanxmax;
220 mutable double diffatanx;
222 enum { VAR_BASIS = BaseDefs::VARBASIS_EPXYZ };
Abstract base class for different kinds of events.