Skip to content

Commit 80eed89

Browse files
dstoccosawenzel
authored andcommitted
Fix clusterizer that was incorrectly handling large clusters
1 parent 0418447 commit 80eed89

File tree

4 files changed

+12
-9
lines changed

4 files changed

+12
-9
lines changed

Detectors/MUON/MID/Base/src/Mapping.cxx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,9 @@ double Mapping::getStripSize(int strip, int cathode, int column, int deId) const
146146
int ichamber = Constants::getChamber(deId);
147147
int stripPitch = (cathode == 0) ? mDetectionElements[rpcType].columns[column].stripPitchBP
148148
: mDetectionElements[rpcType].columns[column].stripPitchNBP;
149+
if (cathode == 0) {
150+
strip = 0;
151+
}
149152

150153
return getStripSize(ichamber, stripPitch, strip);
151154
}

Detectors/MUON/MID/Clustering/include/MIDClustering/Clusterizer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class Clusterizer
7474
Cluster2D& nextCluster();
7575
void makeClusters(const int& deIndex);
7676
void makeCluster(PreCluster& clBend, PreCluster& clNonBend, const int& deIndex);
77-
void makeCluster(std::vector<PreCluster*> pcBlist, const int& deIndex, PreCluster* clNonBend = nullptr);
77+
void makeCluster(std::vector<PreCluster*>& pcBlist, const int& deIndex, PreCluster* clNonBend = nullptr);
7878

7979
Mapping mMapping; ///< Mapping
8080
std::unordered_map<int, PatternStruct> mMpDEs; ///< internal mapping

Detectors/MUON/MID/Clustering/src/Clusterizer.cxx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ void Clusterizer::preClusterizeNBP(PatternStruct& de)
150150
pc->area[icolumn].setXmax(limit);
151151
LOG(DEBUG) << " adding col " << icolumn << " strip " << istrip << " (" << pc->area[icolumn].getXmin() << ", "
152152
<< pc->area[icolumn].getXmax() << ") (" << pc->area[icolumn].getYmin() << ", "
153-
<< pc->area[icolumn].getYmax();
153+
<< pc->area[icolumn].getYmax() << ")";
154154
} else {
155155
pc = nullptr;
156156
}
@@ -163,12 +163,12 @@ void Clusterizer::preClusterizeNBP(PatternStruct& de)
163163
void Clusterizer::preClusterizeBP(PatternStruct& de)
164164
{
165165
/// PreClusterizes bending plane
166-
PreCluster* pc = nullptr;
167166
double limit = 0;
168167
for (int icolumn = mMapping.getFirstColumn(de.deId); icolumn < 7; ++icolumn) {
169168
if ((de.firedColumns & (1 << icolumn)) == 0) {
170169
continue;
171170
}
171+
PreCluster* pc = nullptr;
172172
int firstLine = mMapping.getFirstBoardBP(icolumn, de.deId);
173173
int lastLine = mMapping.getLastBoardBP(icolumn, de.deId);
174174
for (int iline = firstLine; iline <= lastLine; ++iline) {
@@ -213,7 +213,7 @@ void Clusterizer::makeClusters(const int& deIndex)
213213
int icolumn = pcNB.firstColumn;
214214
if (icolumn == pcNB.lastColumn) {
215215
// This is the most simple and common case: the NBP pre-cluster is on
216-
// on single column. So it can be easily matched with the BP
216+
// one single column. So it can be easily matched with the BP
217217
// since the corresponding contours are both rectangles
218218
for (int ib = 0; ib < mNPreClusters[icolumn]; ++ib) {
219219
PreCluster& pcB = mPreClusters[icolumn][ib];
@@ -225,7 +225,7 @@ void Clusterizer::makeClusters(const int& deIndex)
225225
std::vector<std::vector<PreCluster*>> pcBneighbours;
226226
LOG(DEBUG) << "Spanning non-bend: " << icolumn << " -> " << pcNB.lastColumn;
227227
buildListOfNeighbours(icolumn, pcNB.lastColumn, pcBneighbours);
228-
for (const auto pcBlist : pcBneighbours) {
228+
for (auto& pcBlist : pcBneighbours) {
229229
makeCluster(pcBlist, deIndex, &pcNB);
230230
}
231231
}
@@ -241,7 +241,7 @@ void Clusterizer::makeClusters(const int& deIndex)
241241
/// Search for monocathodic clusters in the BP
242242
std::vector<std::vector<PreCluster*>> pcBneighbours;
243243
buildListOfNeighbours(0, 6, pcBneighbours, true);
244-
for (const auto pcBlist : pcBneighbours) {
244+
for (auto& pcBlist : pcBneighbours) {
245245
makeCluster(pcBlist, deIndex);
246246
}
247247
}
@@ -263,7 +263,7 @@ void Clusterizer::makeCluster(PreCluster& clBend, PreCluster& clNonBend, const i
263263
{
264264
/// Makes the cluster from pre-clusters
265265
Cluster2D& cl = nextCluster();
266-
int icolumn = clNonBend.firstColumn;
266+
int icolumn = clBend.firstColumn;
267267
cl.deId = (uint8_t)deIndex;
268268
cl.xCoor = 0.5 * (clNonBend.area[icolumn].getXmax() + clNonBend.area[icolumn].getXmin());
269269
cl.yCoor = 0.5 * (clBend.area[icolumn].getYmax() + clBend.area[icolumn].getYmin());
@@ -278,7 +278,7 @@ void Clusterizer::makeCluster(PreCluster& clBend, PreCluster& clNonBend, const i
278278
}
279279

280280
//______________________________________________________________________________
281-
void Clusterizer::makeCluster(std::vector<PreCluster*> pcBlist, const int& deIndex, PreCluster* clNonBend)
281+
void Clusterizer::makeCluster(std::vector<PreCluster*>& pcBlist, const int& deIndex, PreCluster* clNonBend)
282282
{
283283
/// Makes the cluster from pre-clusters
284284
// This is the general case:

Detectors/MUON/MID/Clustering/test/testClusterizer.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ bool isWithinUncertainties(float xPos, float yPos, Cluster2D& cl)
260260
std::vector<ColumnData> getFiredStrips(float xPos, float yPos, int deId, Mapping& mapping)
261261
{
262262
// This is a quite simple case just for testing purposes.
263-
// The fired strips are simply the fired stripp itself + its neighbours.
263+
// The fired strips are simply the fired strip itself + its neighbours.
264264
// However, in the bending plane, this also consists of strips with no overlap
265265
// with the non-bending plane
266266
std::vector<ColumnData> columns;

0 commit comments

Comments
 (0)