Skip to content

Commit 6b682ec

Browse files
Refactor function signatures for efficiency
Updated function signatures to use const references for string parameters and vector parameters.
1 parent a9fed51 commit 6b682ec

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

PWGCF/EbyEFluctuations/Tasks/kaonIsospinFluctuations.cxx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ inline T getCfg(const auto& cfgLabelledArray, int32_t row, int32_t col)
174174
if constexpr (std::is_same_v<T, bool>) {
175175
return val != 0.0; // will return anything nonzero as true
176176
} else if constexpr (std::is_same_v<T, float>) {
177+
// cppcheck-suppress suspiciousFloatingPointCast
177178
return static_cast<float>(val);
178179
} else if constexpr (std::is_same_v<T, double>) {
179180
return val;
@@ -195,12 +196,12 @@ double calculateTime(T Start)
195196
return timeInSeconds;
196197
}
197198
template <typename T>
198-
void printTime(T Start, const std::string String)
199+
void printTime(T Start, const std::string& String)
199200
{
200201
LOG(info) << String << calculateTime(Start) << " seconds";
201202
}
202203

203-
void printHistInfo(const std::string String, const auto& hist)
204+
void printHistInfo(const std::string& String, const auto& hist)
204205
{
205206
int64_t iEntries = hist->GetEntries();
206207
double mean = hist->GetMean();
@@ -2587,7 +2588,7 @@ struct KaonIsospinFluctuations {
25872588
}
25882589

25892590
template <typename T, typename H>
2590-
void findRepeatedEntries(const std::vector<H> ParticleList, T hist)
2591+
void findRepeatedEntries(const std::vector<H>& ParticleList, T hist)
25912592
{
25922593
for (uint ii = 0; ii < ParticleList.size(); ii++) {
25932594
int nCommonCount = 0; // checking the repeat number of track

0 commit comments

Comments
 (0)