Skip to content

Commit 122ff45

Browse files
authored
Add missing delete of pointers (#2104)
minor
1 parent 8d777ac commit 122ff45

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

Modules/TOF/src/TrendingRate.cxx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,21 +136,33 @@ void TrendingRate::computeTOFRates(TH2F* h, std::vector<int>& bcInt, std::vector
136136
if (hb->GetBinContent(1)) {
137137
hb->Scale(hs->GetBinContent(1) / hb->GetBinContent(1));
138138
} else {
139+
delete hb;
140+
delete hs;
141+
139142
continue;
140143
}
141144
const float overall = hs->Integral();
142145
if (overall <= 0.f) {
143146
ILOG(Info, Support) << "no signal for BC index " << ibc << ENDM;
147+
delete hb;
148+
delete hs;
149+
144150
continue;
145151
}
146152
const float background = hb->Integral();
147153
if (background <= 0.f) {
148154
ILOG(Info, Support) << "no background for BC index " << ibc << ENDM;
155+
delete hb;
156+
delete hs;
157+
149158
continue;
150159
}
151160
const float prob = (overall - background) / overall;
152161
if ((1.f - prob) < 0.f) {
153162
ILOG(Info, Support) << "Probability is 1, can't comute mu" << ENDM;
163+
delete hb;
164+
delete hs;
165+
154166
continue;
155167
}
156168
const float mu = TMath::Log(1.f / (1.f - prob));
@@ -159,6 +171,9 @@ void TrendingRate::computeTOFRates(TH2F* h, std::vector<int>& bcInt, std::vector
159171
bcRate.push_back(rate);
160172
if (prob <= 0.f) {
161173
ILOG(Warning, Support) << "Probability is 0, can't compute pileup" << ENDM;
174+
delete hb;
175+
delete hs;
176+
162177
continue;
163178
}
164179
bcPileup.push_back(mu / prob);

0 commit comments

Comments
 (0)