Skip to content

Commit bfd0f76

Browse files
authored
Merge pull request #6 from mhemmer-cern/dev-clean
Dev clean
2 parents f45731e + 767bdde commit bfd0f76

2 files changed

Lines changed: 11 additions & 5 deletions

File tree

DataFormats/Detectors/EMCAL/include/DataFormatsEMCAL/CellLabel.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class CellLabel
4343
/// \brief Constructor using gsl::span
4444
/// \param labels list of mc labels
4545
/// \param amplitudeFractions list of amplitude fractions
46-
CellLabel(std::vector<int> labels, std::vector<float> amplitudeFractions);
46+
CellLabel(gsl::span<const int> labels, gsl::span<const float> amplitudeFractions);
4747

4848
// ~CellLabel() = default;
4949
// CellLabel(const CellLabel& clus) = default;
@@ -77,4 +77,4 @@ class CellLabel
7777

7878
} // namespace emcal
7979
} // namespace o2
80-
#endif // ALICEO2_EMCAL_CELLLABEL_H_
80+
#endif // ALICEO2_EMCAL_CELLLABEL_H_

DataFormats/Detectors/EMCAL/src/CellLabel.cxx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,20 @@
1515
#include "fairlogger/Logger.h"
1616
#include <cstddef>
1717
#include <cstdint>
18-
#include <vector>
1918
#include <gsl/span>
2019
#include <vector>
2120
#include <utility>
2221

2322
using namespace o2::emcal;
2423

25-
CellLabel::CellLabel(std::vector<int> labels, std::vector<float> amplitudeFractions) : mLabels(labels), mAmplitudeFraction(amplitudeFractions)
24+
CellLabel::CellLabel(std::vector<int> labels, std::vector<float> amplitudeFractions) : mLabels(std::move(labels)), mAmplitudeFraction(std::move(amplitudeFractions))
25+
{
26+
if (labels.size() != amplitudeFractions.size()) {
27+
LOG(error) << "Size of labels " << labels.size() << " does not match size of amplitude fraction " << amplitudeFractions.size() << " !";
28+
}
29+
}
30+
31+
CellLabel::CellLabel(gsl::span<const int> labels, gsl::span<const float> amplitudeFractions) : mLabels(labels.begin(), labels.end()), mAmplitudeFraction(amplitudeFractions.begin(), amplitudeFractions.end())
2632
{
2733
if (labels.size() != amplitudeFractions.size()) {
2834
LOG(error) << "Size of labels " << labels.size() << " does not match size of amplitude fraction " << amplitudeFractions.size() << " !";
@@ -41,4 +47,4 @@ int32_t CellLabel::GetLeadingMCLabel() const
4147
}
4248
}
4349
return mLabels[maxIndex];
44-
}
50+
}

0 commit comments

Comments
 (0)