Skip to content

Commit 9b4c8a6

Browse files
authored
Refactor Eval calls to use nullptr instead of 0
Updated function calls to use nullptr instead of 0 for better clarity and safety.
1 parent 8a9cdab commit 9b4c8a6

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

Common/SimConfig/src/FluenceWeightCalculator.cxx

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ double FluenceWeightCalculator::GetWeight(const int pdg, const double kineticEne
2929
}
3030
switch (std::abs(pdg)) {
3131
case 2112: {
32-
return neutronG->Eval(kineticEnergy, 0, "S");
32+
return neutronG->Eval(kineticEnergy, nullptr, "S");
3333
}
3434
case 2212: {
35-
return ((kineticEnergy > 1e-3) ? protonG->Eval(kineticEnergy, 0, "S") : 0.);
35+
return ((kineticEnergy > 1e-3) ? protonG->Eval(kineticEnergy, nullptr, "S") : 0.);
3636
}
3737
case 211: {
38-
return ((kineticEnergy > 10.) ? pionG->Eval(kineticEnergy, 0, "S") : 0.);
38+
return ((kineticEnergy > 10.) ? pionG->Eval(kineticEnergy, nullptr, "S") : 0.);
3939
}
4040
default:
4141
return 0.0;
@@ -97,16 +97,20 @@ void FluenceWeightCalculator::InitWeightsFromCSV(const std::string& filename)
9797
}
9898
std::string line;
9999
while (std::getline(in, line)) {
100-
if (line.empty() || line[0] == '#')
100+
if (line.empty() || line[0] == '#') {
101101
continue;
102+
}
102103
std::istringstream ss(line);
103104
std::string particle, e_str, w_str;
104-
if (!std::getline(ss, particle, ','))
105+
if (!std::getline(ss, particle, ',')) {
105106
continue;
106-
if (!std::getline(ss, e_str, ','))
107+
}
108+
if (!std::getline(ss, e_str, ',')) {
107109
continue;
108-
if (!std::getline(ss, w_str, ','))
110+
}
111+
if (!std::getline(ss, w_str, ',')) {
109112
continue;
113+
}
110114
auto e = std::stod(e_str);
111115
auto w = std::stod(w_str);
112116
auto pdg = std::stoi(particle);

0 commit comments

Comments
 (0)