Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix L1TCaloSummary memory leak in UCTSummaryCard related to UCTRegion… #40735

Merged
merged 2 commits into from Feb 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 6 additions & 10 deletions L1Trigger/L1TCaloLayer1/plugins/L1TCaloSummary.cc
Expand Up @@ -102,7 +102,6 @@ class L1TCaloSummary : public edm::stream::EDProducer<> {
edm::EDGetTokenT<L1CaloRegionCollection> regionToken;

UCTLayer1* layer1;
UCTSummaryCard* summaryCard;
};

//
Expand Down Expand Up @@ -148,13 +147,9 @@ L1TCaloSummary::L1TCaloSummary(const edm::ParameterSet& iConfig)
}
}
produces<L1JetParticleCollection>("Boosted");
summaryCard = new UCTSummaryCard(&pumLUT, jetSeed, tauSeed, tauIsolationFactor, eGammaSeed, eGammaIsolationFactor);
}

L1TCaloSummary::~L1TCaloSummary() {
if (summaryCard != nullptr)
delete summaryCard;
}
L1TCaloSummary::~L1TCaloSummary() {}

//
// member functions
Expand All @@ -172,7 +167,8 @@ void L1TCaloSummary::produce(edm::Event& iEvent, const edm::EventSetup& iSetup)
// independently creating regions from TPGs for processing by the summary card. This results
// in a single region vector of size 252 whereas from independent creation we had 3*6 vectors
// of size 7*2. Indices are mapped in UCTSummaryCard accordingly.
summaryCard->clearRegions();
UCTSummaryCard summaryCard =
UCTSummaryCard(&pumLUT, jetSeed, tauSeed, tauIsolationFactor, eGammaSeed, eGammaIsolationFactor);
std::vector<UCTRegion*> inputRegions;
inputRegions.clear();
edm::Handle<std::vector<L1CaloRegion>> regionCollection;
Expand All @@ -194,9 +190,9 @@ void L1TCaloSummary::produce(edm::Event& iEvent, const edm::EventSetup& iSetup)
test->setRegionSummary(i.raw());
inputRegions.push_back(test);
}
summaryCard->setRegionData(inputRegions);
summaryCard.setRegionData(inputRegions);

if (!summaryCard->process()) {
if (!summaryCard.process()) {
edm::LogError("L1TCaloSummary") << "UCT: Failed to process summary card" << std::endl;
exit(1);
}
Expand All @@ -206,7 +202,7 @@ void L1TCaloSummary::produce(edm::Event& iEvent, const edm::EventSetup& iSetup)
double phi = -999.;
double mass = 0;

std::list<UCTObject*> boostedJetObjs = summaryCard->getBoostedJetObjs();
std::list<UCTObject*> boostedJetObjs = summaryCard.getBoostedJetObjs();
for (std::list<UCTObject*>::const_iterator i = boostedJetObjs.begin(); i != boostedJetObjs.end(); i++) {
const UCTObject* object = *i;
pt = ((double)object->et()) * caloScaleFactor * boostedJetPtFactor;
Expand Down