Skip to content

Commit

Permalink
Remove set methods
Browse files Browse the repository at this point in the history
  • Loading branch information
niclaurenti committed Apr 16, 2024
1 parent ec82bf7 commit f6d7068
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 77 deletions.
5 changes: 0 additions & 5 deletions inc/adani/CoefficientFunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,6 @@ class CoefficientFunction {
char GetKind() const { return kind_; };
char GetChannel() const { return channel_; };

// set methods
void SetOrder(const int &order);
void SetKind(const char &kind);
void SetChannel(const char &channel);

private:
int order_; // order = 1, 2, or 3
char kind_; // kind_ = '2' for F2 and 'L' for FL
Expand Down
5 changes: 0 additions & 5 deletions inc/adani/Convolution.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,6 @@ class AbstractConvolution {
CoefficientFunction *GetCoeffFunc() const { return coefffunc_; };
AbstractSplittingFunction *GetSplitFunc() const { return splitfunc_; };

// set methods
void SetAbserr(const double &abserr);
void SetRelerr(const double &relerr);
void SetDim(const int &dim);

private:
double abserr_;
double relerr_;
Expand Down
3 changes: 0 additions & 3 deletions inc/adani/HighEnergyCoefficientFunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ class AbstractHighEnergyCoefficientFunction : public CoefficientFunction {
// get methods
bool GetNLL() const { return NLL_; };

// set methods
void SetNLL(const bool &NLL) { NLL_ = NLL; };

private:
bool NLL_;

Expand Down
36 changes: 8 additions & 28 deletions src/CoefficientFunction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,48 +11,20 @@ CoefficientFunction::CoefficientFunction(
const int &order, const char &kind, const char &channel
) {

SetOrder(order);
SetKind(kind);
SetChannel(channel);
}

//==========================================================================================//
// CoefficientFunction: destructor
//------------------------------------------------------------------------------------------//

CoefficientFunction::~CoefficientFunction(){};

//==========================================================================================//
// CoefficientFunction: set method for order: order = 1, 2, 3
//------------------------------------------------------------------------------------------//

void CoefficientFunction::SetOrder(const int &order) {
// check order
if (order < 1 || order > 3) {
cout << "Error: order must be 1, 2 or 3. Got: " << order << endl;
exit(-1);
}
order_ = order;
}

//==========================================================================================//
// CoefficientFunction: set method for kind: kind = '2', 'L'
//------------------------------------------------------------------------------------------//

void CoefficientFunction::SetKind(const char &kind) {
// check kind
if (kind != '2' && kind != 'L') {
cout << "Error: kind must be 2 or L. Got: " << kind << endl;
exit(-1);
}
kind_ = kind;
}

//==========================================================================================//
// CoefficientFunction: set method for channel: channel = 'g', 'q'
//------------------------------------------------------------------------------------------//

void CoefficientFunction::SetChannel(const char &channel) {
// check channel
if (channel != 'g' && channel != 'q') {
cout << "Error: channel must be g or q. Got: " << channel << endl;
Expand All @@ -64,8 +36,16 @@ void CoefficientFunction::SetChannel(const char &channel) {
exit(-1);
}
channel_ = channel;

}

//==========================================================================================//
// CoefficientFunction: destructor
//------------------------------------------------------------------------------------------//

CoefficientFunction::~CoefficientFunction(){};


//==========================================================================================//
// CoefficientFunction: central value of fx
//------------------------------------------------------------------------------------------//
Expand Down
49 changes: 14 additions & 35 deletions src/Convolution.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,64 +17,43 @@ AbstractConvolution::AbstractConvolution(
CoefficientFunction *coefffunc, AbstractSplittingFunction *splitfunc,
const double &abserr, const double &relerr, const int &dim
) {
abserr_ = abserr;
relerr_ = relerr;
dim_ = dim;

w_ = gsl_integration_workspace_alloc(dim);

coefffunc_ = coefffunc;
splitfunc_ = splitfunc;
}

//==========================================================================================//
// AbstractConvolution: destructor
//------------------------------------------------------------------------------------------//

AbstractConvolution::~AbstractConvolution() {

gsl_integration_workspace_free(w_);
};

//==========================================================================================//
// AbstractConvolution: set method for abserr
//------------------------------------------------------------------------------------------//

void AbstractConvolution::SetAbserr(const double &abserr) {
// check abserr
if (abserr <= 0) {
cout << "Error: abserr must be positive. Got " << abserr << endl;
exit(-1);
}
abserr_ = abserr;
}

//==========================================================================================//
// AbstractConvolution: set method for relerr
//------------------------------------------------------------------------------------------//

void AbstractConvolution::SetRelerr(const double &relerr) {
// check relerr
if (relerr <= 0) {
cout << "Error: relerr must be positive. Got " << relerr << endl;
exit(-1);
}
relerr_ = relerr;
}

//==========================================================================================//
// AbstractConvolution: set method for dim
//------------------------------------------------------------------------------------------//

void AbstractConvolution::SetDim(const int &dim) {
// check dim
if (dim <= 0) {
cout << "Error: dim must be positive. Got " << dim << endl;
exit(-1);
}
dim_ = dim;

w_ = gsl_integration_workspace_alloc(dim);

coefffunc_ = coefffunc;
splitfunc_ = splitfunc;
}

//==========================================================================================//
// AbstractConvolution: destructor
//------------------------------------------------------------------------------------------//

AbstractConvolution::~AbstractConvolution() {

gsl_integration_workspace_free(w_);
};

//==========================================================================================//
// AbstractConvolution: convolute splitting function with coefficient function
//------------------------------------------------------------------------------------------//
Expand Down
2 changes: 1 addition & 1 deletion src/HighEnergyCoefficientFunction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ AbstractHighEnergyCoefficientFunction::AbstractHighEnergyCoefficientFunction(
)
: CoefficientFunction(order, kind, channel) {

SetNLL(NLL);
NLL_ = NLL;
}

//==========================================================================================//
Expand Down

0 comments on commit f6d7068

Please sign in to comment.