4 #ifndef PhysicsTools_PatAlgos_PATJetSelector_h
5 #define PhysicsTools_PatAlgos_PATJetSelector_h
33 produces<std::vector<pat::Jet>>();
34 produces<reco::GenJetCollection>(
"genJets");
35 produces<std::vector<CaloTower>>(
"caloTowers");
36 produces<reco::PFCandidateCollection>(
"pfCandidates");
37 produces<edm::OwnVector<reco::BaseTagInfo>>(
"tagInfos");
46 auto patJets = std::make_unique<std::vector<Jet>>();
48 auto genJetsOut = std::make_unique<reco::GenJetCollection>();
49 auto caloTowersOut = std::make_unique<std::vector<CaloTower>>();
50 auto pfCandidatesOut = std::make_unique<reco::PFCandidateCollection>();
51 auto tagInfosOut = std::make_unique<edm::OwnVector<reco::BaseTagInfo>>();
55 iEvent.getRefBeforePut<std::vector<CaloTower>>(
"caloTowers");
69 bool selectedLoose =
false;
77 for (CaloTowerFwdPtrVector::const_iterator itowerBegin = ijet->caloTowersFwdPtr().begin(),
78 itowerEnd = ijet->caloTowersFwdPtr().end(),
83 caloTowersOut->push_back(**itower);
87 for (reco::PFCandidateFwdPtrVector::const_iterator icandBegin = ijet->pfCandidatesFwdPtr().begin(),
88 icandEnd = ijet->pfCandidatesFwdPtr().end(),
93 pfCandidatesOut->push_back(**icand);
97 for (TagInfoFwdPtrCollection::const_iterator iinfoBegin = ijet->tagInfosFwdPtr().begin(),
98 iinfoEnd = ijet->tagInfosFwdPtr().end(),
103 tagInfosOut->push_back(**iinfo);
107 if (ijet->genJet() !=
nullptr) {
108 genJetsOut->push_back(*(ijet->genJet()));
121 unsigned int caloTowerIndex = 0;
122 unsigned int pfCandidateIndex = 0;
123 unsigned int tagInfoIndex = 0;
124 unsigned int genJetIndex = 0;
130 bool selectedLoose =
false;
132 selectedLoose =
true;
141 for (CaloTowerFwdPtrVector::const_iterator itowerBegin = ijet->caloTowersFwdPtr().begin(),
142 itowerEnd = ijet->caloTowersFwdPtr().end(),
143 itower = itowerBegin;
150 patJets->back().updateFwdCaloTowerFwdPtr(itower - itowerBegin,
156 for (reco::PFCandidateFwdPtrVector::const_iterator icandBegin = ijet->pfCandidatesFwdPtr().begin(),
157 icandEnd = ijet->pfCandidatesFwdPtr().end(),
165 patJets->back().updateFwdPFCandidateFwdPtr(icand - icandBegin,
171 for (TagInfoFwdPtrCollection::const_iterator iinfoBegin = ijet->tagInfosFwdPtr().begin(),
172 iinfoEnd = ijet->tagInfosFwdPtr().end(),
180 patJets->back().updateFwdTagInfoFwdPtr(iinfo - iinfoBegin,
186 if (ijet->genJet() !=
nullptr) {
187 patJets->back().updateFwdGenJetFwdRef(
207 iDesc.
setComment(
"Energy Correlation Functions adder");
210 iDesc.
add<
std::string>(
"cutLoose",
"")->setComment(
"Loose jet selection. Will keep nLoose loose jets.");
211 iDesc.
add<
bool>(
"filter",
false)->setComment(
"Filter selection?");
212 iDesc.
add<
unsigned>(
"nLoose", 0)->setComment(
"Keep nLoose loose jets that satisfy cutLoose");
213 descriptions.
add(
"PATJetSelector", iDesc);