22 template <
typename jetType>
25 : hltLeptonTag(iConfig.getParameter<
edm::
InputTag>(
"HltLeptonTag")),
26 sourceJetTag(iConfig.getParameter<
edm::
InputTag>(
"SourceJetTag")),
28 minDeltaR2_(iConfig.getParameter<double>(
"minDeltaR") *
std::
abs(iConfig.getParameter<double>(
"minDeltaR"))) {
38 produces<JetCollectionVector>();
39 produces<JetCollection>();
42 template <
typename jetType>
48 template <
typename jetType>
55 desc.add<
double>(
"minDeltaR", 0.5);
65 template <
typename jetType>
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::InputTag sourceJetTag
edm::EDGetTokenT< std::vector< jetType > > m_theJetToken
std::string defaultModuleLabel()
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Abs< T >::type abs(const T &t)
edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > m_theLeptonToken
edm::RefVector< JetBxCollection > JetRefVector
~HLTJetCollectionsForBoostedLeptonPlusJets() override
edm::InputTag hltLeptonTag
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
HLTJetCollectionsForBoostedLeptonPlusJets(const edm::ParameterSet &)
std::vector< reco::RecoEcalCandidateRef > VRphoton
void produce(edm::Event &, const edm::EventSetup &) override