Skip to content

Commit d39d094

Browse files
committed
Avoid maybe-uninitialized warning in BaseTnPEfficiencyTask::analyze
1 parent bc22d28 commit d39d094

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

DQMOffline/MuonDPG/src/BaseTnPEfficiencyTask.cc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,7 @@ void BaseTnPEfficiencyTask::analyze(const edm::Event& event, const edm::EventSet
142142
for (const auto i_tag : preSel_tag_indices) {
143143
reco::Muon tag = (*muons).at(i_tag);
144144
float pt_max = 0.;
145-
int max_pt_idx;
146-
bool pair_found = false;
145+
int max_pt_idx = -1;
147146

148147
for (const auto i_probe : preSel_probe_indices) {
149148
//Prevent tag and probe to be the same object
@@ -166,12 +165,11 @@ void BaseTnPEfficiencyTask::analyze(const edm::Event& event, const edm::EventSet
166165

167166
float pair_pt = (tag.polarP4() + preSel_probe.polarP4()).Pt();
168167
if (pair_pt > pt_max) {
169-
pair_found = true;
170168
pt_max = pair_pt;
171169
max_pt_idx = i_probe;
172170
}
173171
}
174-
if (pair_found) {
172+
if (max_pt_idx != -1) {
175173
probe_indices.push_back(max_pt_idx);
176174
tag_indices.push_back(i_tag);
177175
}

0 commit comments

Comments
 (0)