Skip to content

Commit a498560

Browse files
authored
Optionally drop huge clusters in the ALPIDE clusterer (#13808)
1 parent ce6b536 commit a498560

File tree

5 files changed

+38
-29
lines changed

5 files changed

+38
-29
lines changed

Detectors/ITSMFT/ITS/workflow/src/ClustererSpec.cxx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,9 @@ void ClustererDPL::updateTimeDependentParams(ProcessingContext& pc)
121121
// settings for the fired pixel overflow masking
122122
const auto& alpParams = o2::itsmft::DPLAlpideParam<o2::detectors::DetID::ITS>::Instance();
123123
const auto& clParams = o2::itsmft::ClustererParam<o2::detectors::DetID::ITS>::Instance();
124+
mClusterer->setDropHugeClusters(clParams.dropHugeClusters);
124125
if (clParams.maxBCDiffToMaskBias > 0 && clParams.maxBCDiffToSquashBias > 0) {
125-
LOGP(fatal, "maxBCDiffToMaskBias = {} and maxBCDiffToMaskBias = {} cannot be set at the same time. Either set masking or squashing with a BCDiff > 0", clParams.maxBCDiffToMaskBias, clParams.maxBCDiffToSquashBias);
126+
LOGP(fatal, "maxBCDiffToMaskBias = {} and maxBCDiffToSquashBias = {} cannot be set at the same time. Either set masking or squashing with a BCDiff > 0", clParams.maxBCDiffToMaskBias, clParams.maxBCDiffToSquashBias);
126127
}
127128
auto nbc = clParams.maxBCDiffToMaskBias;
128129
nbc += mClusterer->isContinuousReadOut() ? alpParams.roFrameLengthInBC : (alpParams.roFrameLengthTrig / o2::constants::lhc::LHCBunchSpacingNS);

Detectors/ITSMFT/MFT/workflow/src/ClustererSpec.cxx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,9 @@ void ClustererDPL::updateTimeDependentParams(ProcessingContext& pc)
122122
const auto& alpParams = o2::itsmft::DPLAlpideParam<o2::detectors::DetID::MFT>::Instance();
123123
const auto& clParams = o2::itsmft::ClustererParam<o2::detectors::DetID::MFT>::Instance();
124124
if (clParams.maxBCDiffToMaskBias > 0 && clParams.maxBCDiffToSquashBias > 0) {
125-
LOGP(fatal, "maxBCDiffToMaskBias = {} and maxBCDiffToMaskBias = {} cannot be set at the same time. Either set masking or squashing with a BCDiff > 0", clParams.maxBCDiffToMaskBias, clParams.maxBCDiffToSquashBias);
125+
LOGP(fatal, "maxBCDiffToMaskBias = {} and maxBCDiffToSquashBias = {} cannot be set at the same time. Either set masking or squashing with a BCDiff > 0", clParams.maxBCDiffToMaskBias, clParams.maxBCDiffToSquashBias);
126126
}
127+
mClusterer->setDropHugeClusters(clParams.dropHugeClusters);
127128
auto nbc = clParams.maxBCDiffToMaskBias;
128129
nbc += mClusterer->isContinuousReadOut() ? alpParams.roFrameLengthInBC : (alpParams.roFrameLengthTrig / o2::constants::lhc::LHCBunchSpacingNS);
129130
mClusterer->setMaxBCSeparationToMask(nbc);

Detectors/ITSMFT/common/reconstruction/include/ITSMFTReconstruction/Clusterer.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,9 @@ class Clusterer
204204
bool isContinuousReadOut() const { return mContinuousReadout; }
205205
void setContinuousReadOut(bool v) { mContinuousReadout = v; }
206206

207+
bool isDropHugeClusters() const { return mDropHugeClusters; }
208+
void setDropHugeClusters(bool v) { mDropHugeClusters = v; }
209+
207210
int getMaxBCSeparationToMask() const { return mMaxBCSeparationToMask; }
208211
void setMaxBCSeparationToMask(int n) { mMaxBCSeparationToMask = n; }
209212

@@ -238,6 +241,7 @@ class Clusterer
238241

239242
// clusterization options
240243
bool mContinuousReadout = true; ///< flag continuous readout
244+
bool mDropHugeClusters = false; ///< don't include clusters that would be split in more than one
241245

242246
///< mask continuosly fired pixels in frames separated by less than this amount of BCs (fired from hit in prev. ROF)
243247
int mMaxBCSeparationToMask = 6000. / o2::constants::lhc::LHCBunchSpacingNS + 10;

Detectors/ITSMFT/common/reconstruction/include/ITSMFTReconstruction/ClustererParam.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ struct ClustererParam : public o2::conf::ConfigurableParamHelper<ClustererParam<
3838
int maxBCDiffToMaskBias = 10; ///< mask if 2 ROFs differ by <= StrobeLength + Bias BCs, use value <0 to disable masking
3939
int maxBCDiffToSquashBias = -10; ///< squash if 2 ROFs differ by <= StrobeLength + Bias BCs, use value <0 to disable squashing
4040
float maxSOTMUS = 8.; ///< max expected signal over threshold in \mus
41+
bool dropHugeClusters = false; ///< option to drop huge clusters (mitigate beam background)
4142

4243
O2ParamDef(ClustererParam, getParamName().data());
4344

Detectors/ITSMFT/common/reconstruction/src/Clusterer.cxx

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -263,36 +263,38 @@ void Clusterer::ClustererThread::finishChip(ChipPixelData* curChipData, CompClus
263263
parent->streamCluster(pixArrBuff, &labelsBuff, bbox, parent->mPattIdConverter, compClusPtr, patternsPtr, labelsClusPtr, nlab);
264264
} else {
265265
auto warnLeft = MaxHugeClusWarn - parent->mNHugeClus;
266-
if (warnLeft > 0) {
267-
LOGP(warn, "Splitting a huge cluster: chipID {}, rows {}:{} cols {}:{}{}", bbox.chipID, bbox.rowMin, bbox.rowMax, bbox.colMin, bbox.colMax,
268-
warnLeft == 1 ? " (Further warnings will be muted)" : "");
266+
if (!parent->mDropHugeClusters) {
267+
if (warnLeft > 0) {
268+
LOGP(warn, "Splitting a huge cluster: chipID {}, rows {}:{} cols {}:{}{}", bbox.chipID, bbox.rowMin, bbox.rowMax, bbox.colMin, bbox.colMax,
269+
warnLeft == 1 ? " (Further warnings will be muted)" : "");
269270
#ifdef WITH_OPENMP
270271
#pragma omp critical
271272
#endif
272-
{
273-
parent->mNHugeClus++;
273+
{
274+
parent->mNHugeClus++;
275+
}
274276
}
275-
}
276-
BBox bboxT(bbox); // truncated box
277-
std::vector<PixelData> pixbuf;
278-
do {
279-
bboxT.rowMin = bbox.rowMin;
280-
bboxT.colMax = std::min(bbox.colMax, uint16_t(bboxT.colMin + o2::itsmft::ClusterPattern::MaxColSpan - 1));
281-
do { // Select a subset of pixels fitting the reduced bounding box
282-
bboxT.rowMax = std::min(bbox.rowMax, uint16_t(bboxT.rowMin + o2::itsmft::ClusterPattern::MaxRowSpan - 1));
283-
for (const auto& pix : pixArrBuff) {
284-
if (bboxT.isInside(pix.getRowDirect(), pix.getCol())) {
285-
pixbuf.push_back(pix);
277+
BBox bboxT(bbox); // truncated box
278+
std::vector<PixelData> pixbuf;
279+
do {
280+
bboxT.rowMin = bbox.rowMin;
281+
bboxT.colMax = std::min(bbox.colMax, uint16_t(bboxT.colMin + o2::itsmft::ClusterPattern::MaxColSpan - 1));
282+
do { // Select a subset of pixels fitting the reduced bounding box
283+
bboxT.rowMax = std::min(bbox.rowMax, uint16_t(bboxT.rowMin + o2::itsmft::ClusterPattern::MaxRowSpan - 1));
284+
for (const auto& pix : pixArrBuff) {
285+
if (bboxT.isInside(pix.getRowDirect(), pix.getCol())) {
286+
pixbuf.push_back(pix);
287+
}
286288
}
287-
}
288-
if (!pixbuf.empty()) { // Stream a piece of cluster only if the reduced bounding box is not empty
289-
parent->streamCluster(pixbuf, &labelsBuff, bboxT, parent->mPattIdConverter, compClusPtr, patternsPtr, labelsClusPtr, nlab, true);
290-
pixbuf.clear();
291-
}
292-
bboxT.rowMin = bboxT.rowMax + 1;
293-
} while (bboxT.rowMin < bbox.rowMax);
294-
bboxT.colMin = bboxT.colMax + 1;
295-
} while (bboxT.colMin < bbox.colMax);
289+
if (!pixbuf.empty()) { // Stream a piece of cluster only if the reduced bounding box is not empty
290+
parent->streamCluster(pixbuf, &labelsBuff, bboxT, parent->mPattIdConverter, compClusPtr, patternsPtr, labelsClusPtr, nlab, true);
291+
pixbuf.clear();
292+
}
293+
bboxT.rowMin = bboxT.rowMax + 1;
294+
} while (bboxT.rowMin < bbox.rowMax);
295+
bboxT.colMin = bboxT.colMax + 1;
296+
} while (bboxT.colMin < bbox.colMax);
297+
}
296298
}
297299
}
298300
}
@@ -451,8 +453,8 @@ void Clusterer::print() const
451453
{
452454
// print settings
453455
LOGP(info, "Clusterizer squashes overflow pixels separated by {} BC and <= {} in row/col seeking down to {} neighbour ROFs", mMaxBCSeparationToSquash, mMaxRowColDiffToMask, mSquashingDepth);
454-
LOG(info) << "Clusterizer masks overflow pixels separated by < " << mMaxBCSeparationToMask << " BC and <= "
455-
<< mMaxRowColDiffToMask << " in row/col";
456+
LOGP(info, "Clusterizer masks overflow pixels separated by < {} BC and <= {} in row/col", mMaxBCSeparationToMask, mMaxRowColDiffToMask);
457+
LOGP(info, "Clusterizer does {} drop huge clusters", mDropHugeClusters ? "" : "not");
456458

457459
#ifdef _PERFORM_TIMING_
458460
auto& tmr = const_cast<TStopwatch&>(mTimer); // ugly but this is what root does internally

0 commit comments

Comments
 (0)