Skip to content

Commit 5b193ab

Browse files
committed
[EMCAL-1154] Adjust CellLabels for cross talk emulation (AliceO2Group#14385)
- The CellLabel class used gsl::span as its members to store the mcLabels and amplitude fractions. However, when we want to use the cross talk emulation, we want to add new cells which happens inside the cross talk emulation function. Outside of this function the newley added CellLabels would point to dangling memory. That's why the members needed to be changed to std::vectors. Also a move constructor was added.
1 parent 543c8c4 commit 5b193ab

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,12 @@ class CellLabel
3535
public:
3636
// CellLabel() = default;
3737

38-
/// \brief Constructor
38+
/// \brief Constructor using std::vector by moving NOT copying
39+
/// \param labels list of mc labels
40+
/// \param amplitudeFractions list of amplitude fractions
41+
CellLabel(std::vector<int> labels, std::vector<float> amplitudeFractions);
42+
43+
/// \brief Constructor using gsl::span
3944
/// \param labels list of mc labels
4045
/// \param amplitudeFractions list of amplitude fractions
4146
CellLabel(std::vector<int> labels, std::vector<float> amplitudeFractions);

DataFormats/Detectors/EMCAL/src/CellLabel.cxx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#include <cstdint>
1818
#include <vector>
1919
#include <gsl/span>
20+
#include <vector>
21+
#include <utility>
2022

2123
using namespace o2::emcal;
2224

0 commit comments

Comments
 (0)