Resolve conflict from Jonas' commits
This commit is contained in:
66
src/external/libBNMR/TBNMR.cpp
vendored
66
src/external/libBNMR/TBNMR.cpp
vendored
@ -30,29 +30,15 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include "TBNMR.h"
|
#include "TBNMR.h"
|
||||||
#include "TF1.h"
|
|
||||||
#include "Math/WrappedTF1.h"
|
|
||||||
#include "Math/GaussIntegrator.h"
|
|
||||||
|
|
||||||
#define tau_Li 1210
|
#define tau_Li 1210
|
||||||
#define gamma_Li 6.3018 // In units kHz/mT
|
#define gamma_Li 6.3018 // In units kHz/mT
|
||||||
#define PI 3.14159265358979323846
|
#define PI 3.14159265358979323846
|
||||||
#define TWOPI 6.28318530717958647692
|
#define TWOPI 6.28318530717958647692
|
||||||
|
|
||||||
ClassImp(TBNMR) // for the ROOT-dictionary
|
ClassImp(ExpRlx) // for the ROOT-dictionary
|
||||||
ClassImp(ExpRlx)
|
|
||||||
ClassImp(SExpRlx)
|
ClassImp(SExpRlx)
|
||||||
ClassImp(MLRes)
|
|
||||||
|
|
||||||
double TBNMR::operator()(double x, const vector<double> &par) const {
|
|
||||||
assert(par.size()==1); // make sure the number of parameters handed to the function is correct
|
|
||||||
|
|
||||||
double arg(par[0]*x);
|
|
||||||
|
|
||||||
if(!arg)
|
|
||||||
return 1.0;
|
|
||||||
return sin(arg)/arg;
|
|
||||||
}
|
|
||||||
|
|
||||||
double ExpRlx::operator()(double x, const vector<double> &par) const {
|
double ExpRlx::operator()(double x, const vector<double> &par) const {
|
||||||
assert(par.size()==2); // make sure the number of parameters handed to the function is correct
|
assert(par.size()==2); // make sure the number of parameters handed to the function is correct
|
||||||
@ -75,55 +61,25 @@ double ExpRlx::operator()(double x, const vector<double> &par) const {
|
|||||||
return y;
|
return y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//initialize Integrators
|
||||||
|
TF1 SExpRlx::sexp1=TF1("sexp", "exp(-([0]-x)/[3])*exp(-pow(([1]*([0]-x)),[2]))", 0.0, 20000.0);
|
||||||
|
TF1 SExpRlx::sexp2=TF1("sexp", "exp(-([3]-x)/[4])*exp(-pow(([1]*([0]-x)),[2]))", 0.0, 20000.0);
|
||||||
|
|
||||||
double SExpRlx::operator()(double x, const vector<double> &par) const {
|
double SExpRlx::operator()(double x, const vector<double> &par) const {
|
||||||
assert(par.size()==3); // make sure the number of parameters handed to the function is correct
|
assert(par.size()==3); // make sure the number of parameters handed to the function is correct
|
||||||
|
|
||||||
// par[0] time of beam off
|
// par[0] time of beam off
|
||||||
// par[1] is the relaxation rate
|
// par[1] is the relaxation rate
|
||||||
// par[2] is the exponent
|
// par[2] is the exponent
|
||||||
double tau_p;
|
|
||||||
double y;
|
|
||||||
|
|
||||||
tau_p = (tau_Li/(1.+par[1]*tau_Li));
|
|
||||||
|
|
||||||
|
|
||||||
if ( x >= 0 && x <= par[0] ) {
|
if ( x >= 0 && x <= par[0] ) {
|
||||||
TF1 sexp("sexp", "exp(-([0]-x)/[3])*exp(-pow(([1]*([0]-x)),[2]))", 0.0, 20000.0);
|
sexp1.SetParameters(x, par[1], par[2],tau_Li);
|
||||||
sexp.SetParameters(x, par[1], par[2],tau_Li);
|
return sexp1.Integral(0.0,x)/(1-exp(-x/tau_Li))/tau_Li;
|
||||||
sexp.SetNpx(1000);
|
|
||||||
y=sexp.Integral(0.0,x)/(1-exp(-x/tau_Li))/tau_Li;
|
|
||||||
} else if ( x > par[0] ) {
|
} else if ( x > par[0] ) {
|
||||||
TF1 sexp("sexp", "exp(-([3]-x)/[4])*exp(-pow(([1]*([0]-x)),[2]))", 0.0, 20000.0);
|
sexp2.SetParameters(x, par[1], par[2], par[0],tau_Li);
|
||||||
sexp.SetParameters(x, par[1], par[2], par[0],tau_Li);
|
return sexp2.Integral(0.0,par[0])/(1-exp(-par[0]/tau_Li))/tau_Li;
|
||||||
sexp.SetNpx(1000);
|
|
||||||
y=sexp.Integral(0.0,par[0])/(1-exp(-par[0]/tau_Li))/tau_Li;
|
|
||||||
} else {
|
|
||||||
y = 0;
|
|
||||||
}
|
}
|
||||||
return y;
|
return 0;
|
||||||
}
|
|
||||||
|
|
||||||
double MLRes::operator()(double x, const vector<double> &par) const {
|
|
||||||
assert(par.size()==3); // make sure the number of parameters handed to the function is correct
|
|
||||||
|
|
||||||
// par[0] time of beam off
|
|
||||||
// par[1] is the relaxation rate
|
|
||||||
// par[2] is the exponent
|
|
||||||
double y;
|
|
||||||
|
|
||||||
if ( x >= 0 && x <= par[0] ) {
|
|
||||||
TF1 sexp("sexp", "exp(-([0]-x)/[3])*exp(-pow(([1]*([0]-x)),[2]))", 0.0, 10000.0);
|
|
||||||
sexp.SetParameters(x, par[1], par[2],tau_Li);
|
|
||||||
sexp.SetNpx(1000);
|
|
||||||
y=sexp.Integral(0.0,x)/(1-exp(-x/tau_Li))/tau_Li;
|
|
||||||
} else if ( x > par[0] ) {
|
|
||||||
TF1 sexp("sexp", "exp(-([3]-x)/[4])*exp(-pow(([1]*([0]-x)),[2]))", 0.0, 10000.0);
|
|
||||||
sexp.SetParameters(x, par[1], par[2], par[0],tau_Li);
|
|
||||||
sexp.SetNpx(1000);
|
|
||||||
y=sexp.Integral(0.0,par[0])/(1-exp(-par[0]/tau_Li))/tau_Li;
|
|
||||||
} else {
|
|
||||||
y = 0;
|
|
||||||
}
|
|
||||||
return y;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
45
src/external/libBNMR/TBNMR.h
vendored
45
src/external/libBNMR/TBNMR.h
vendored
@ -31,29 +31,18 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "PUserFcnBase.h"
|
#include "PUserFcnBase.h"
|
||||||
|
#include "TF1.h"
|
||||||
|
#include "Math/WrappedTF1.h"
|
||||||
|
#include "Math/GaussIntegrator.h"
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#ifndef LIBBNMRH
|
||||||
|
#define LIBBNMRH
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
class TBNMR : public PUserFcnBase {
|
|
||||||
|
|
||||||
public:
|
|
||||||
// default constructor and destructor
|
|
||||||
TBNMR(){}
|
|
||||||
~TBNMR(){}
|
|
||||||
|
|
||||||
Bool_t NeedGlobalPart() const { return false; }
|
|
||||||
void SetGlobalPart(vector<void *> &globalPart, UInt_t idx) { }
|
|
||||||
Bool_t GlobalPartIsValid() const { return true; }
|
|
||||||
|
|
||||||
// function operator
|
|
||||||
double operator()(double, const vector<double>&) const;
|
|
||||||
|
|
||||||
// definition of the class for the ROOT-dictionary
|
|
||||||
ClassDef(TBNMR,1)
|
|
||||||
};
|
|
||||||
|
|
||||||
class ExpRlx : public PUserFcnBase {
|
class ExpRlx : public PUserFcnBase {
|
||||||
|
|
||||||
@ -77,7 +66,7 @@ class SExpRlx : public PUserFcnBase {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
// default constructor and destructor
|
// default constructor and destructor
|
||||||
SExpRlx(){}
|
SExpRlx(){sexp1.SetNpx(1000); sexp2.SetNpx(1000);}
|
||||||
~SExpRlx(){}
|
~SExpRlx(){}
|
||||||
|
|
||||||
Bool_t NeedGlobalPart() const { return false; }
|
Bool_t NeedGlobalPart() const { return false; }
|
||||||
@ -86,25 +75,13 @@ public:
|
|||||||
|
|
||||||
// function operator
|
// function operator
|
||||||
double operator()(double, const vector<double>&) const;
|
double operator()(double, const vector<double>&) const;
|
||||||
|
private:
|
||||||
|
static TF1 sexp1;
|
||||||
|
static TF1 sexp2;
|
||||||
|
|
||||||
// definition of the class for the ROOT-dictionary
|
// definition of the class for the ROOT-dictionary
|
||||||
ClassDef(SExpRlx,1)
|
ClassDef(SExpRlx,1)
|
||||||
};
|
};
|
||||||
|
|
||||||
class MLRes : public PUserFcnBase {
|
|
||||||
|
|
||||||
public:
|
#endif //LIBBNMRH
|
||||||
// default constructor and destructor
|
|
||||||
MLRes(){}
|
|
||||||
~MLRes(){}
|
|
||||||
|
|
||||||
Bool_t NeedGlobalPart() const { return false; }
|
|
||||||
void SetGlobalPart(vector<void *> &globalPart, UInt_t idx) { }
|
|
||||||
Bool_t GlobalPartIsValid() const { return true; }
|
|
||||||
|
|
||||||
// function operator
|
|
||||||
double operator()(double, const vector<double>&) const;
|
|
||||||
|
|
||||||
// definition of the class for the ROOT-dictionary
|
|
||||||
ClassDef(MLRes,1)
|
|
||||||
};
|
|
||||||
|
Reference in New Issue
Block a user