Skip to content

Commit 13b695d

Browse files
authored
[EMCAL-688] ClusterFactory: remove std::optional (#14314)
- std::optional creates copies, potentially slowing down the code and increase memory usage. Instead we just use a gsl::span here and check if it is empty or not.
1 parent a81a238 commit 13b695d

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

Detectors/EMCAL/base/include/EMCALBase/ClusterFactory.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#define ALICEO2_EMCAL_CLUSTERFACTORY_H_
1313
#include <array>
1414
#include <vector>
15-
#include <optional>
1615
#include <utility>
1716
#include <gsl/span>
1817
#include "Rtypes.h"
@@ -336,16 +335,16 @@ class ClusterFactory
336335
bool getUseWeightExotic() const { return mUseWeightExotic; }
337336
void setUseWeightExotic(float useWeightExotic) { mUseWeightExotic = useWeightExotic; }
338337

339-
void setContainer(gsl::span<const o2::emcal::Cluster> clusterContainer, gsl::span<const InputType> cellContainer, gsl::span<const int> indicesContainer, std::optional<gsl::span<const o2::emcal::CellLabel>> cellLabelContainer = std::nullopt)
338+
void setContainer(gsl::span<const o2::emcal::Cluster> clusterContainer, gsl::span<const InputType> cellContainer, gsl::span<const int> indicesContainer, gsl::span<const o2::emcal::CellLabel> cellLabelContainer = {})
340339
{
341340
mClustersContainer = clusterContainer;
342341
mInputsContainer = cellContainer;
343342
mCellsIndices = indicesContainer;
344343
if (!getLookUpInit()) {
345344
setLookUpTable();
346345
}
347-
if (cellLabelContainer) {
348-
mCellLabelContainer = cellLabelContainer.value();
346+
if (!cellLabelContainer.empty()) {
347+
mCellLabelContainer = cellLabelContainer;
349348
}
350349
}
351350

0 commit comments

Comments
 (0)