8 std::vector<reco::GsfElectronRef> UniqueElectrons;
10 for (reco::GsfElectronCollection::const_iterator elec =
electrons->begin(); elec !=
electrons->end(); ++elec) {
12 reco::GsfElectronCollection::const_iterator BestDuplicate = elec;
13 for (reco::GsfElectronCollection::const_iterator elec2 =
electrons->begin(); elec2 !=
electrons->end(); ++elec2) {
15 if (elec->superCluster() == elec2->superCluster()) {
16 edm::LogDebug_(
"",
"MySelection.cc", 122) <<
"e/p Best duplicate = " << BestDuplicate->eSuperClusterOverP()
17 <<
"\telec2 = " << elec2->eSuperClusterOverP();
18 if (fabs(BestDuplicate->eSuperClusterOverP() - 1.) >= fabs(elec2->eSuperClusterOverP() - 1.)) {
19 BestDuplicate = elec2;
20 edm::LogDebug_(
"",
"MySelection.cc", 122) <<
"elec2 is now best duplicate";
22 edm::LogDebug_(
"",
"MySelection.cc", 122) <<
"BestDuplicate remains best duplicate";
26 if (BestDuplicate == elec)
27 UniqueElectrons.push_back(electronRef);
30 return UniqueElectrons;