21 template <
typename jetType>
24 : hltLeptonTag(iConfig.getParameter<
edm::
InputTag>(
"HltLeptonTag")),
25 sourceJetTag(iConfig.getParameter<
edm::
InputTag>(
"SourceJetTag")),
26 minDeltaR_(iConfig.getParameter<double>(
"minDeltaR")) {
36 produces<JetCollectionVector>();
37 produces<JetCollection>();
40 template <
typename jetType>
46 template <
typename jetType>
53 desc.
add<
double>(
"minDeltaR", 0.5);
63 template <
typename jetType>
81 vector<reco::RecoChargedCandidateRef> muonCands;
84 vector<Ref<reco::ElectronCollection>> eleCands;
90 vector<Ref<reco::RecoEcalCandidateCollection>> clusCands;
96 typename JetCollection::const_iterator
jet;
98 unique_ptr<JetCollection> allSelections(
new JetCollection);
99 unique_ptr<JetCollectionVector> product(
new JetCollectionVector);
101 std::vector<size_t> usedCands;
103 if (!muonCands.empty()) {
104 for (jet = theJetCollectionHandle->begin(); jet != theJetCollectionHandle->end(); jet++) {
106 jetType cleanedJet = *
jet;
107 for (
size_t candNr = 0; candNr < muonCands.size(); candNr++) {
108 if (
std::find(usedCands.begin(), usedCands.end(), candNr) != usedCands.end())
111 std::vector<edm::Ptr<reco::PFCandidate>> pfConstituents = cleanedJet.getPFConstituents();
113 i_candidate != pfConstituents.end();
115 if (
deltaR((*muonCands[candNr]), (**i_candidate)) < 0.001) {
116 cleanedJet.setP4(cleanedJet.p4() - muonCands[candNr]->p4());
117 usedCands.push_back(candNr);
123 allSelections->push_back(cleanedJet);
127 if (!eleCands.empty()) {
128 for (jet = theJetCollectionHandle->begin(); jet != theJetCollectionHandle->end(); jet++) {
130 jetType cleanedJet = *
jet;
131 for (
size_t candNr = 0; candNr < eleCands.size(); candNr++) {
132 if (
std::find(usedCands.begin(), usedCands.end(), candNr) != usedCands.end())
135 std::vector<edm::Ptr<reco::PFCandidate>> pfConstituents = cleanedJet.getPFConstituents();
137 i_candidate != pfConstituents.end();
139 if (
deltaR((*eleCands[candNr]), (**i_candidate)) < 0.001) {
140 cleanedJet.setP4(cleanedJet.p4() - eleCands[candNr]->p4());
141 usedCands.push_back(candNr);
147 allSelections->push_back(cleanedJet);
151 if (!photonCands.empty()) {
152 for (jet = theJetCollectionHandle->begin(); jet != theJetCollectionHandle->end(); jet++) {
154 jetType cleanedJet = *
jet;
155 for (
size_t candNr = 0; candNr < photonCands.size(); candNr++) {
156 if (
std::find(usedCands.begin(), usedCands.end(), candNr) != usedCands.end())
159 std::vector<edm::Ptr<reco::PFCandidate>> pfConstituents = cleanedJet.getPFConstituents();
161 i_candidate != pfConstituents.end();
163 if (
deltaR((*photonCands[candNr]), (**i_candidate)) < 0.001) {
164 cleanedJet.setP4(cleanedJet.p4() - photonCands[candNr]->p4());
165 usedCands.push_back(candNr);
171 allSelections->push_back(cleanedJet);
175 if (!clusCands.empty()) {
176 for (jet = theJetCollectionHandle->begin(); jet != theJetCollectionHandle->end(); jet++) {
178 jetType cleanedJet = *
jet;
179 for (
size_t candNr = 0; candNr < clusCands.size(); candNr++) {
180 if (
std::find(usedCands.begin(), usedCands.end(), candNr) != usedCands.end())
183 std::vector<edm::Ptr<reco::PFCandidate>> pfConstituents = cleanedJet.getPFConstituents();
185 i_candidate != pfConstituents.end();
187 if (
deltaR((*clusCands[candNr]), (**i_candidate)) < 0.001) {
188 cleanedJet.setP4(cleanedJet.p4() - clusCands[candNr]->p4());
189 usedCands.push_back(candNr);
195 allSelections->push_back(cleanedJet);
201 std::sort(allSelections->begin(), allSelections->end(), compJets);
204 JetCollection
const&
jets = *cleanedJetHandle;
206 JetRefVector cleanedJetRefs;
208 for (
unsigned iJet = 0; iJet < jets.size(); ++iJet) {
209 cleanedJetRefs.push_back(
JetRef(cleanedJetHandle, iJet));
212 product->emplace_back(cleanedJetRefs);
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
void getObjects(Vids &ids, VRphoton &refs) const
various physics-level getters:
std::vector< Jet > JetCollection
bool getByToken(EDGetToken token, Handle< PROD > &result) const
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)
edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > m_theLeptonToken
ParameterDescriptionBase * add(U const &iLabel, T const &value)
edm::RefVector< JetBxCollection > JetRefVector
~HLTJetCollectionsForBoostedLeptonPlusJets() override
edm::InputTag hltLeptonTag
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