diff --git a/DataFormats/Detectors/EMCAL/include/DataFormatsEMCAL/CellLabel.h b/DataFormats/Detectors/EMCAL/include/DataFormatsEMCAL/CellLabel.h index 0bba3a02e3f35..401bbf57c2af0 100644 --- a/DataFormats/Detectors/EMCAL/include/DataFormatsEMCAL/CellLabel.h +++ b/DataFormats/Detectors/EMCAL/include/DataFormatsEMCAL/CellLabel.h @@ -43,7 +43,7 @@ class CellLabel /// \brief Constructor using gsl::span /// \param labels list of mc labels /// \param amplitudeFractions list of amplitude fractions - CellLabel(std::vector labels, std::vector amplitudeFractions); + CellLabel(gsl::span labels, gsl::span amplitudeFractions); // ~CellLabel() = default; // CellLabel(const CellLabel& clus) = default; @@ -77,4 +77,4 @@ class CellLabel } // namespace emcal } // namespace o2 -#endif // ALICEO2_EMCAL_CELLLABEL_H_ +#endif // ALICEO2_EMCAL_CELLLABEL_H_ \ No newline at end of file diff --git a/DataFormats/Detectors/EMCAL/src/CellLabel.cxx b/DataFormats/Detectors/EMCAL/src/CellLabel.cxx index cbc1c2897520a..8a2a5d5a0a0a0 100644 --- a/DataFormats/Detectors/EMCAL/src/CellLabel.cxx +++ b/DataFormats/Detectors/EMCAL/src/CellLabel.cxx @@ -15,14 +15,20 @@ #include "fairlogger/Logger.h" #include #include -#include #include #include #include using namespace o2::emcal; -CellLabel::CellLabel(std::vector labels, std::vector amplitudeFractions) : mLabels(labels), mAmplitudeFraction(amplitudeFractions) +CellLabel::CellLabel(std::vector labels, std::vector amplitudeFractions) : mLabels(std::move(labels)), mAmplitudeFraction(std::move(amplitudeFractions)) +{ + if (labels.size() != amplitudeFractions.size()) { + LOG(error) << "Size of labels " << labels.size() << " does not match size of amplitude fraction " << amplitudeFractions.size() << " !"; + } +} + +CellLabel::CellLabel(gsl::span labels, gsl::span amplitudeFractions) : mLabels(labels.begin(), labels.end()), mAmplitudeFraction(amplitudeFractions.begin(), amplitudeFractions.end()) { if (labels.size() != amplitudeFractions.size()) { 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 } } return mLabels[maxIndex]; -} +} \ No newline at end of file