From 496426063019e17d2d4428830850aabd366741e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niccol=C3=B2=20Laurenti?= Date: Wed, 17 Apr 2024 11:51:51 +0200 Subject: [PATCH] Make data mabers const --- inc/adani/CoefficientFunction.h | 6 +++--- inc/adani/HighEnergyCoefficientFunction.h | 2 +- src/CoefficientFunction.cc | 5 +---- src/HighEnergyCoefficientFunction.cc | 5 +---- 4 files changed, 6 insertions(+), 12 deletions(-) diff --git a/inc/adani/CoefficientFunction.h b/inc/adani/CoefficientFunction.h index f2faa4b..b48cfa7 100644 --- a/inc/adani/CoefficientFunction.h +++ b/inc/adani/CoefficientFunction.h @@ -70,9 +70,9 @@ class CoefficientFunction { char GetChannel() const { return channel_; }; private: - int order_; // order = 1, 2, or 3 - char kind_; // kind_ = '2' for F2 and 'L' for FL - char channel_; // channel_ = 'g' for Cg and 'q' for Cq + const int order_; // order = 1, 2, or 3 + const char kind_; // kind_ = '2' for F2 and 'L' for FL + const char channel_; // channel_ = 'g' for Cg and 'q' for Cq }; #endif diff --git a/inc/adani/HighEnergyCoefficientFunction.h b/inc/adani/HighEnergyCoefficientFunction.h index d44e291..c15fb5d 100644 --- a/inc/adani/HighEnergyCoefficientFunction.h +++ b/inc/adani/HighEnergyCoefficientFunction.h @@ -44,7 +44,7 @@ class AbstractHighEnergyCoefficientFunction : public CoefficientFunction { bool GetNLL() const { return NLL_; }; private: - bool NLL_; + const bool NLL_; //==========================================================================================// // Color factors O(as^3) diff --git a/src/CoefficientFunction.cc b/src/CoefficientFunction.cc index 4a3f463..93af483 100644 --- a/src/CoefficientFunction.cc +++ b/src/CoefficientFunction.cc @@ -9,21 +9,19 @@ using std::endl; CoefficientFunction::CoefficientFunction( const int &order, const char &kind, const char &channel -) { +) : order_(order), kind_(kind), channel_(channel) { // check order if (order < 1 || order > 3) { cout << "Error: order must be 1, 2 or 3. Got: " << order << endl; exit(-1); } - order_ = order; // check kind if (kind != '2' && kind != 'L') { cout << "Error: kind must be 2 or L. Got: " << kind << endl; exit(-1); } - kind_ = kind; // check channel if (channel != 'g' && channel != 'q') { @@ -35,7 +33,6 @@ CoefficientFunction::CoefficientFunction( << endl; exit(-1); } - channel_ = channel; } //==========================================================================================// diff --git a/src/HighEnergyCoefficientFunction.cc b/src/HighEnergyCoefficientFunction.cc index 465f176..045f0cb 100644 --- a/src/HighEnergyCoefficientFunction.cc +++ b/src/HighEnergyCoefficientFunction.cc @@ -14,10 +14,7 @@ using std::endl; AbstractHighEnergyCoefficientFunction::AbstractHighEnergyCoefficientFunction( const int &order, const char &kind, const char &channel, const bool &NLL ) - : CoefficientFunction(order, kind, channel) { - - NLL_ = NLL; -} + : CoefficientFunction(order, kind, channel), NLL_(NLL) {}; //==========================================================================================// // HighEnergyCoefficientFunction: constructor