Skip to content

Commit 79816c5

Browse files
author
Veronika Barbasova
committed
fix code check erros
Signed-off-by: Veronika Barbasova <vernika.barbasova@cern.ch>
1 parent 053772e commit 79816c5

2 files changed

Lines changed: 15 additions & 19 deletions

File tree

PWGLF/Tasks/Resonances/phianalysisTHnSparse.cxx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ struct PhianalysisTHnSparse {
162162
HistogramRegistry registry{"registry"};
163163
o2::analysis::rsn::Output* rsnOutput = nullptr;
164164

165-
Service<o2::framework::O2DatabasePDG> pdg;
165+
Service<o2::framework::O2DatabasePDG> pdg{};
166166

167167
float massPos = o2::track::PID::getMass(3);
168168
float massNeg = o2::track::PID::getMass(3);
@@ -553,12 +553,13 @@ struct PhianalysisTHnSparse {
553553
float tofNsigma = 0.0f;
554554
int particleType = (track.sign() > 0) ? static_cast<int>(daughterPos) : static_cast<int>(daughterNeg);
555555

556-
if (particleType == pion)
556+
if (particleType == pion) {
557557
tofNsigma = track.tofNSigmaPi();
558-
else if (particleType == kaon)
558+
} else if (particleType == kaon) {
559559
tofNsigma = track.tofNSigmaKa();
560-
else if (particleType == proton)
560+
} else if (particleType == proton) {
561561
tofNsigma = track.tofNSigmaPr();
562+
}
562563
return tofNsigma;
563564
}
564565
template <typename T>

PWGLF/Utils/rsnOutput.h

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@
2828
#include <utility>
2929
#include <vector>
3030

31-
namespace o2::analysis
32-
{
33-
namespace rsn
31+
namespace o2::analysis::rsn
3432
{
3533
enum class EventType {
3634
zvertex,
@@ -124,7 +122,7 @@ class Output
124122
for (int i = 0; i < static_cast<int>(PairAxisType::unknown); i++) {
125123
auto aname = *std::move(allAxes[i].name);
126124
LOGF(debug, "Check axis '%s' %d", aname.c_str(), i);
127-
if (aname != pair_axis::names[static_cast<int>(i)]) {
125+
if (aname != pair_axis::names[i]) {
128126
LOGF(fatal, "rsn::Output::Error: Order in allAxes is not correct !!! Expected axis '%s' and has '%s'.", aname.c_str(), pair_axis::names[static_cast<int>(i)]);
129127
}
130128
}
@@ -141,9 +139,8 @@ class Output
141139
mCurrentAxisTypes.push_back(currentType);
142140
}
143141

144-
if (mFillPoint != nullptr) {
145-
delete mFillPoint;
146-
}
142+
delete mFillPoint;
143+
147144
mFillPoint = new double[mCurrentAxisTypes.size()];
148145

149146
LOGF(info, "Number of axis added: %d", mCurrentAxes.size());
@@ -153,7 +150,7 @@ class Output
153150
for (int i = 0; i < static_cast<int>(SystematicsAxisType::unknown); i++) {
154151
auto aname = *std::move(allAxes_sys[i].name);
155152
LOGF(debug, "Check axis '%s' %d", aname.c_str(), i);
156-
if (aname != systematic_axis::names[static_cast<int>(i)]) {
153+
if (aname != systematic_axis::names[i]) {
157154
LOGF(fatal, "rsn::Output::Error: Order in allAxes_sys is not correct !!! Expected axis '%s' and has '%s'.", aname.c_str(), systematic_axis::names[static_cast<int>(i)]);
158155
}
159156
}
@@ -170,17 +167,16 @@ class Output
170167
mCurrentAxisTypesSys.push_back(currentTypeSys);
171168
}
172169

173-
if (mFillPointSys != nullptr) {
174-
delete mFillPointSys;
175-
}
170+
delete mFillPointSys;
171+
176172
mFillPointSys = new double[mCurrentAxisTypesSys.size()];
177173

178174
LOGF(info, "Number of systematic axis added: %d", mCurrentAxesSys.size());
179175
mPairHistoSys = new o2::framework::HistogramConfigSpec(o2::framework::HistType::kTHnSparseF, mCurrentAxesSys);
180176
}
181177

182178
template <typename T>
183-
void fillSparse(const T& h, double* point)
179+
void fillSparse(const T& h, const double* point)
184180
{
185181
int i = 0;
186182
for (const auto& at : mCurrentAxisTypes) {
@@ -190,7 +186,7 @@ class Output
190186
}
191187

192188
template <typename T>
193-
void fillSparseSys(const T& h, double* point)
189+
void fillSparseSys(const T& h, const double* point)
194190
{
195191
int i = 0;
196192
for (const auto& at : mCurrentAxisTypesSys) {
@@ -411,7 +407,6 @@ class OutputSparse : public Output
411407
fillSparse(HIST("Mapping/systematics"), point);
412408
}
413409
};
414-
} // namespace rsn
415-
} // namespace o2::analysis
410+
} // namespace o2::analysis::rsn
416411

417412
#endif // PWGLF_UTILS_RSNOUTPUT_H_

0 commit comments

Comments
 (0)