Skip to content

Commit a00aeb4

Browse files
committed
Make EMCAL clusterizer to process empty input data
1 parent e64d267 commit a00aeb4

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

Detectors/EMCAL/reconstruction/include/EMCALReconstruction/Clusterizer.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ class Clusterizer
6767
Clusterizer();
6868
~Clusterizer() = default;
6969

70+
void clear()
71+
{
72+
mFoundClusters.clear();
73+
mInputIndices.clear();
74+
}
7075
void initialize(double timeCut, double timeMin, double timeMax, double gradientCut, bool doEnergyGradientCut, double thresholdSeedE, double thresholdCellE);
7176
void findClusters(const gsl::span<InputType const>& inputArray);
7277
const std::vector<Cluster>* getFoundClusters() const { return &mFoundClusters; }

Detectors/EMCAL/reconstruction/src/Clusterizer.cxx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,7 @@ void Clusterizer<InputType>::getTopologicalRowColumn(const InputType& input, int
124124
template <class InputType>
125125
void Clusterizer<InputType>::findClusters(const gsl::span<InputType const>& inputArray)
126126
{
127-
mFoundClusters.clear();
128-
mInputIndices.clear();
127+
clear();
129128

130129
// Algorithm
131130
// - Fill cells/digits in 2D topological map

Detectors/EMCAL/workflow/src/ClusterizerSpec.cxx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,11 @@ void ClusterizerSpec<InputType>::run(framework::ProcessingContext& ctx)
7878
int currentStartClusters = mOutputClusters->size();
7979
int currentStartIndices = mOutputCellDigitIndices->size();
8080
for (auto iTrgRcrd : InputTriggerRecord) {
81-
82-
mClusterizer.findClusters(gsl::span<const InputType>(&Inputs[iTrgRcrd.getFirstEntry()], iTrgRcrd.getNumberOfObjects())); // Find clusters on cells/digits (pass by ref)
83-
81+
if (Inputs.size() && iTrgRcrd.getNumberOfObjects()) {
82+
mClusterizer.findClusters(gsl::span<const InputType>(&Inputs[iTrgRcrd.getFirstEntry()], iTrgRcrd.getNumberOfObjects())); // Find clusters on cells/digits (pass by ref)
83+
} else {
84+
mClusterizer.clear();
85+
}
8486
// Get found clusters + cell/digit indices for output
8587
// * A cluster contains a range that correspond to the vector of cell/digit indices
8688
// * The cell/digit index vector contains the indices of the clusterized cells/digits wrt to the original cell/digit array

0 commit comments

Comments
 (0)