Skip to content

Commit 45eff1c

Browse files
committed
Merge pull request #495 in B2/basf2 from bugfix/BII-8901-r6 to release/06-00
* commit 'f6ad1b6c62899e203468f31c8c1b4fc081392a3c': Simplify the first switch between release-05 and release-06 versions; Better clarify that the fix is temporary Fix segfault error in ECLCRFinder module when very noisy events are processed
2 parents a29bb29 + f6ad1b6 commit 45eff1c

File tree

2 files changed

+31
-7
lines changed

2 files changed

+31
-7
lines changed

ecl/modules/eclCRFinder/include/ECLCRFinderModule.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ namespace Belle2 {
8181
int m_fullBkgdCount; /**< Number of expected background digits at full background. TODO move to DB*/
8282

8383
/** Other variables. */
84+
bool m_isOnlineProcessing{false}; /**< flag for identifying the online processing. */
85+
8486
double m_energyCutMod[3] {}; /**< modified energy cut taking into account bkgd per event for seed, neighbours, ...*/
8587
int m_tempCRId = -1; /**< Temporary CR ID*/
8688

ecl/modules/eclCRFinder/src/ECLCRFinderModule.cc

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
#include <ecl/modules/eclCRFinder/ECLCRFinderModule.h>
1111

1212
// FRAMEWORK
13+
#include <framework/core/Environment.h>
1314
#include <framework/gearbox/Unit.h>
15+
#include <framework/logging/LogConfig.h>
1416
#include <framework/logging/Logger.h>
1517

1618
//ECL
@@ -125,11 +127,17 @@ void ECLCRFinderModule::initialize()
125127
m_cellIdToTempCRIdVec.resize(8737); /**< cellid -> CR. */
126128
m_calDigitStoreArrPosition.resize(8737);
127129

130+
// Check if we are running this module online
131+
m_isOnlineProcessing = (Environment::Instance().getRealm() == LogConfig::c_Online) ? true : false;
132+
if (m_isOnlineProcessing) {
133+
m_energyCut[1] = 1.5 * Belle2::Unit::MeV;
134+
m_energyCutBkgd[1] = 1.5 * Belle2::Unit::MeV;
135+
}
128136
}
129137

130138
void ECLCRFinderModule::beginRun()
131139
{
132-
;
140+
133141
}
134142

135143
void ECLCRFinderModule::event()
@@ -239,9 +247,14 @@ void ECLCRFinderModule::event()
239247

240248
//-------------------------------------------------------
241249
// 'find" in a map is faster if the number of seeds is not too large, can be replaced easily once we know what seed cuts we want.
250+
// This is weird: if we are running online, we use behaviour that was in place until release-05,
251+
// otherwise we use the one implemented since release-06
252+
// This is fundamental for avoiding a segfault error caused by veeery noisy ECL events,
253+
// but note it is a temporary fix.
242254
for (unsigned int pos = 1; pos < m_cellIdToSeedVec.size(); ++pos) {
243-
if (m_cellIdToSeedVec[pos] > 0 and m_cellIdToCheckVec[pos] == 0) {
244-
m_cellIdToCheckVec[pos] = 1;
255+
// check for m_isOnlineProcessing is for release-05 behaviour
256+
if (m_cellIdToSeedVec[pos] > 0 and (m_cellIdToCheckVec[pos] == 0 or m_isOnlineProcessing)) {
257+
if (!m_isOnlineProcessing) m_cellIdToCheckVec[pos] = 1; // release-06 and newer versions
245258
checkNeighbours(pos, m_tempCRId, 0);
246259
++m_tempCRId; // This is just a number, will be replaced by a consecutive number later in this module
247260
}
@@ -332,10 +345,19 @@ void ECLCRFinderModule::checkNeighbours(const int cellid, const int tempcrid, co
332345

333346
B2DEBUG(300, " --> ECLCRFinderModule::checkNeighbours(): m_cellIdToTempCRIdVec[" << neighbour << "] " <<
334347
m_cellIdToTempCRIdVec[neighbour]);
335-
if (m_cellIdToCheckVec[neighbour] == 0) { // only check again if we have not looked at that digit before
336-
m_cellIdToCheckVec[neighbour] = 1;
337-
checkNeighbours(neighbour, tempcrid, 1);
338-
348+
// This is weird: if we are running online, we use behaviour that was in place until release-05,
349+
// otherwise we use the one implemented since release-06
350+
// This is fundamental for avoiding a segfault error caused by veeery noisy ECL events,
351+
// but note it is a temporary fix.
352+
if (m_isOnlineProcessing) { // release-05
353+
if (m_cellIdToTempCRIdVec[neighbour] == 0) { // found
354+
checkNeighbours(neighbour, tempcrid, 1);
355+
}
356+
} else { // release-06 and newer versions
357+
if (m_cellIdToCheckVec[neighbour] == 0) { // only check again if we have not looked at that digit before
358+
m_cellIdToCheckVec[neighbour] = 1;
359+
checkNeighbours(neighbour, tempcrid, 1);
360+
}
339361
}
340362
}
341363
}

0 commit comments

Comments
 (0)