83 vector<reco::RecoChargedCandidateRef> muonCands;
86 vector<Ref<reco::ElectronCollection>> eleCands;
92 vector<Ref<reco::RecoEcalCandidateCollection>> clusCands;
98 typename JetCollection::const_iterator
jet;
101 unique_ptr<JetCollectionVector> product(
new JetCollectionVector);
103 std::vector<size_t> usedCands;
105 if (!muonCands.empty()) {
106 for (
jet = theJetCollectionHandle->begin();
jet != theJetCollectionHandle->end();
jet++) {
109 for (
size_t candNr = 0; candNr < muonCands.size(); candNr++) {
110 if (
std::find(usedCands.begin(), usedCands.end(), candNr) != usedCands.end())
113 std::vector<edm::Ptr<reco::PFCandidate>> pfConstituents = cleanedJet.getPFConstituents();
115 i_candidate != pfConstituents.end();
117 if (
reco::deltaR2((*muonCands[candNr]), (**i_candidate)) < 1
e-6) {
118 cleanedJet.setP4(cleanedJet.p4() - muonCands[candNr]->p4());
119 usedCands.push_back(candNr);
125 allSelections->push_back(cleanedJet);
129 if (!eleCands.empty()) {
130 for (
jet = theJetCollectionHandle->begin();
jet != theJetCollectionHandle->end();
jet++) {
133 for (
size_t candNr = 0; candNr < eleCands.size(); candNr++) {
134 if (
std::find(usedCands.begin(), usedCands.end(), candNr) != usedCands.end())
137 std::vector<edm::Ptr<reco::PFCandidate>> pfConstituents = cleanedJet.getPFConstituents();
139 i_candidate != pfConstituents.end();
142 cleanedJet.setP4(cleanedJet.p4() - eleCands[candNr]->p4());
143 usedCands.push_back(candNr);
149 allSelections->push_back(cleanedJet);
153 if (!photonCands.empty()) {
154 for (
jet = theJetCollectionHandle->begin();
jet != theJetCollectionHandle->end();
jet++) {
157 for (
size_t candNr = 0; candNr < photonCands.size(); candNr++) {
158 if (
std::find(usedCands.begin(), usedCands.end(), candNr) != usedCands.end())
161 std::vector<edm::Ptr<reco::PFCandidate>> pfConstituents = cleanedJet.getPFConstituents();
163 i_candidate != pfConstituents.end();
165 if (
reco::deltaR2((*photonCands[candNr]), (**i_candidate)) < 1
e-6) {
166 cleanedJet.setP4(cleanedJet.p4() - photonCands[candNr]->p4());
167 usedCands.push_back(candNr);
173 allSelections->push_back(cleanedJet);
177 if (!clusCands.empty()) {
178 for (
jet = theJetCollectionHandle->begin();
jet != theJetCollectionHandle->end();
jet++) {
181 for (
size_t candNr = 0; candNr < clusCands.size(); candNr++) {
182 if (
std::find(usedCands.begin(), usedCands.end(), candNr) != usedCands.end())
185 std::vector<edm::Ptr<reco::PFCandidate>> pfConstituents = cleanedJet.getPFConstituents();
187 i_candidate != pfConstituents.end();
189 if (
reco::deltaR2((*clusCands[candNr]), (**i_candidate)) < 1
e-6) {
190 cleanedJet.setP4(cleanedJet.p4() - clusCands[candNr]->p4());
191 usedCands.push_back(candNr);
197 allSelections->push_back(cleanedJet);
203 std::sort(allSelections->begin(), allSelections->end(), compJets);
209 cleanedJetRefs.reserve(
jets.size());
210 for (
unsigned iJet = 0; iJet <
jets.size(); ++iJet) {
211 cleanedJetRefs.push_back(
JetRef(cleanedJetHandle, iJet));
214 product->emplace_back(cleanedJetRefs);
void getObjects(Vids &ids, VRphoton &refs) const
various physics-level getters:
std::vector< Jet > JetCollection
edm::Ref< JetBxCollection > JetRef
edm::EDGetTokenT< std::vector< jetType > > m_theJetToken
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > m_theLeptonToken
edm::RefVector< JetBxCollection > JetRefVector
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
std::vector< reco::RecoEcalCandidateRef > VRphoton