Skip to content

Commit b5bbd3a

Browse files
Using span of o2::tpc::Digit as input to TPC HwClusterer
Does not change the actual algorithm which accesses data object via iterators, the read-only span can be build from any array and vector, e.g. pmr::vector or even with custom allocator.
1 parent 919ec7a commit b5bbd3a

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

Detectors/TPC/reconstruction/include/TPCReconstruction/Clusterer.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ class Clusterer
4949
/// Processing all digits
5050
/// \param digits Container with TPC digits
5151
/// \param mcDigitTruth MC Digit Truth container
52-
virtual void process(std::vector<o2::tpc::Digit> const& digits, MCLabelContainer const* mcDigitTruth) = 0;
53-
virtual void finishProcess(std::vector<o2::tpc::Digit> const& digits, MCLabelContainer const* mcDigitTruth) = 0;
52+
virtual void process(gsl::span<o2::tpc::Digit const> const& digits, MCLabelContainer const* mcDigitTruth) = 0;
53+
virtual void finishProcess(gsl::span<o2::tpc::Digit const> const& digits, MCLabelContainer const* mcDigitTruth) = 0;
5454

5555
/// Setter for noise object, noise will be added before cluster finding
5656
/// \param noiseObject CalDet object, containing noise simulation

Detectors/TPC/reconstruction/include/TPCReconstruction/HwClusterer.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,15 @@ class HwClusterer : public Clusterer
7171
/// \param digits Container with TPC digits
7272
/// \param mcDigitTruth MC Digit Truth container
7373
/// \param clearContainerFirst Clears the outpcontainer for clusters and MC labels first, before processing
74-
void process(std::vector<o2::tpc::Digit> const& digits, MCLabelContainer const* mcDigitTruth) override;
75-
void process(std::vector<o2::tpc::Digit> const& digits, MCLabelContainer const* mcDigitTruth, bool clearContainerFirst);
74+
void process(gsl::span<o2::tpc::Digit const> const& digits, MCLabelContainer const* mcDigitTruth) override;
75+
void process(gsl::span<o2::tpc::Digit const> const& digits, MCLabelContainer const* mcDigitTruth, bool clearContainerFirst);
7676

7777
/// Finish processing digits
7878
/// \param digits Container with TPC digits
7979
/// \param mcDigitTruth MC Digit Truth container
8080
/// \param clearContainerFirst Clears the outpcontainer for clusters and MC labels first, before processing
81-
void finishProcess(std::vector<o2::tpc::Digit> const& digits, MCLabelContainer const* mcDigitTruth) override;
82-
void finishProcess(std::vector<o2::tpc::Digit> const& digits, MCLabelContainer const* mcDigitTruth, bool clearContainerFirst);
81+
void finishProcess(gsl::span<o2::tpc::Digit const> const& digits, MCLabelContainer const* mcDigitTruth) override;
82+
void finishProcess(gsl::span<o2::tpc::Digit const> const& digits, MCLabelContainer const* mcDigitTruth, bool clearContainerFirst);
8383

8484
/// Switch for triggered / continuous readout
8585
/// \param isContinuous - false for triggered readout, true for continuous readout
@@ -216,12 +216,12 @@ class HwClusterer : public Clusterer
216216
MCLabelContainer* mClusterMcLabelArray; ///< Pointer to MC Label container
217217
};
218218

219-
inline void HwClusterer::process(std::vector<o2::tpc::Digit> const& digits, o2::dataformats::MCTruthContainer<o2::MCCompLabel> const* mcDigitTruth)
219+
inline void HwClusterer::process(gsl::span<o2::tpc::Digit const> const& digits, o2::dataformats::MCTruthContainer<o2::MCCompLabel> const* mcDigitTruth)
220220
{
221221
process(digits, mcDigitTruth, true);
222222
}
223223

224-
inline void HwClusterer::finishProcess(std::vector<o2::tpc::Digit> const& digits, o2::dataformats::MCTruthContainer<o2::MCCompLabel> const* mcDigitTruth)
224+
inline void HwClusterer::finishProcess(gsl::span<o2::tpc::Digit const> const& digits, o2::dataformats::MCTruthContainer<o2::MCCompLabel> const* mcDigitTruth)
225225
{
226226
finishProcess(digits, mcDigitTruth, true);
227227
}

Detectors/TPC/reconstruction/src/ClustererTask.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ void ClustererTask::Exec(Option_t* option)
102102
if (mHwClustersMCTruthArray)
103103
mHwClustersMCTruthArray->clear();
104104

105-
mHwClusterer->process(*mDigitsArray.get(), mDigitMCTruthArray.get());
105+
mHwClusterer->process(gsl::span<o2::tpc::Digit const>(mDigitsArray->data(), mDigitsArray->size()), mDigitMCTruthArray.get());
106106
LOG(DEBUG) << "Hw clusterer delivered " << mHwClustersArray->size() << " cluster container";
107107

108108
++mEventCount;

Detectors/TPC/reconstruction/src/HwClusterer.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ void HwClusterer::init()
125125
}
126126

127127
//______________________________________________________________________________
128-
void HwClusterer::process(std::vector<o2::tpc::Digit> const& digits, MCLabelContainer const* mcDigitTruth, bool clearContainerFirst)
128+
void HwClusterer::process(gsl::span<o2::tpc::Digit const> const& digits, MCLabelContainer const* mcDigitTruth, bool clearContainerFirst)
129129
{
130130
if (clearContainerFirst) {
131131
if (mClusterArray)
@@ -252,11 +252,11 @@ void HwClusterer::process(std::vector<o2::tpc::Digit> const& digits, MCLabelCont
252252
finishFrame(true);
253253

254254
if (digits.size() != 0)
255-
LOG(DEBUG) << "Event ranged from time bin " << digits.front().getTimeStamp() << " to " << digits.back().getTimeStamp() << ".";
255+
LOG(DEBUG) << "Event ranged from time bin " << digits[0].getTimeStamp() << " to " << digits[digits.size() - 1].getTimeStamp() << ".";
256256
}
257257

258258
//______________________________________________________________________________
259-
void HwClusterer::finishProcess(std::vector<o2::tpc::Digit> const& digits, MCLabelContainer const* mcDigitTruth, bool clearContainerFirst)
259+
void HwClusterer::finishProcess(gsl::span<o2::tpc::Digit const> const& digits, MCLabelContainer const* mcDigitTruth, bool clearContainerFirst)
260260
{
261261
// Process the last digits (if there are any)
262262
process(digits, mcDigitTruth, clearContainerFirst);

0 commit comments

Comments
 (0)