Skip to content

Commit

Permalink
Fixed memory leak in RegionalMuonGMTUnpacker
Browse files Browse the repository at this point in the history
  • Loading branch information
Dr15Jones committed Dec 11, 2024
1 parent 99becea commit f00a113
Showing 1 changed file with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,14 @@ namespace l1t {
unsigned int linkId = blockId / 2;
int processor;
RegionalMuonCandBxCollection* regionalMuonCollection;
RegionalMuonShowerBxCollection* regionalMuonShowerCollection;
RegionalMuonShowerBxCollection* regionalMuonShowerCollection = nullptr;
tftype trackFinder;
if (linkId > 47 && linkId < 60) {
regionalMuonCollection = static_cast<GMTCollections*>(coll)->getRegionalMuonCandsBMTF();
regionalMuonShowerCollection =
new RegionalMuonShowerBxCollection(); // To avoid warning re uninitialised collection
trackFinder = tftype::bmtf;
processor = linkId - 48;
} else if (linkId > 41 && linkId < 66) {
regionalMuonCollection = static_cast<GMTCollections*>(coll)->getRegionalMuonCandsOMTF();
regionalMuonShowerCollection =
new RegionalMuonShowerBxCollection(); // To avoid warning re uninitialised collection
if (linkId < 48) {
trackFinder = tftype::omtf_pos;
processor = linkId - 42;
Expand All @@ -68,8 +64,9 @@ namespace l1t {
return false;
}
regionalMuonCollection->setBXRange(firstBX, lastBX);
regionalMuonShowerCollection->setBXRange(firstBX, lastBX);

if (regionalMuonShowerCollection) {
regionalMuonShowerCollection->setBXRange(firstBX, lastBX);
}
LogDebug("L1T") << "nBX = " << nBX << " first BX = " << firstBX << " lastBX = " << lastBX;

// Get the BX blocks and unpack them
Expand Down Expand Up @@ -127,7 +124,8 @@ namespace l1t {
// Fill RegionalMuonShower objects. For this we need to look at all six words together.
RegionalMuonShower muShower;
if (RegionalMuonRawDigiTranslator::fillRegionalMuonShower(
muShower, bxPayload, processor, trackFinder, useEmtfNominalTightShowers_, useEmtfLooseShowers_)) {
muShower, bxPayload, processor, trackFinder, useEmtfNominalTightShowers_, useEmtfLooseShowers_) and
regionalMuonShowerCollection) {
regionalMuonShowerCollection->push_back(bx, muShower);
}
} else {
Expand Down

0 comments on commit f00a113

Please sign in to comment.