24 template <
typename jetType>
26 hltLeptonTag(iConfig.getParameter<
edm::InputTag > (
"HltLeptonTag")),
27 sourceJetTag(iConfig.getParameter<
edm::InputTag > (
"SourceJetTag")),
28 minDeltaR_(iConfig.getParameter< double > (
"minDeltaR"))
38 produces<JetCollectionVector>();
39 produces<JetCollection>();
42 template <
typename jetType>
50 template <
typename jetType>
58 desc.
add<
double> (
"minDeltaR", 0.5);
69 template <
typename jetType>
88 vector<reco::RecoChargedCandidateRef> muonCands;
91 vector<Ref<reco::ElectronCollection> > eleCands;
97 vector<Ref<reco::RecoEcalCandidateCollection> > clusCands;
103 typename JetCollection::const_iterator
jet;
105 unique_ptr<JetCollection> allSelections(
new JetCollection);
106 unique_ptr<JetCollectionVector> product(
new JetCollectionVector);
108 std::vector<size_t> usedCands;
110 if(!muonCands.empty()){
111 for (jet = theJetCollectionHandle->begin(); jet != theJetCollectionHandle->end(); jet++) {
113 jetType cleanedJet = *
jet;
114 for(
size_t candNr=0;candNr<muonCands.size();candNr++){
115 if (
std::find(usedCands.begin(),usedCands.end(),candNr)!=usedCands.end())
continue;
117 std::vector<edm::Ptr<reco::PFCandidate> > pfConstituents = cleanedJet.getPFConstituents();
118 for(std::vector<
edm::Ptr<reco::PFCandidate> >::const_iterator i_candidate = pfConstituents.begin(); i_candidate != pfConstituents.end(); ++i_candidate){
119 if (
deltaR((*muonCands[candNr]),(**i_candidate))<0.001) {
120 cleanedJet.setP4( cleanedJet.p4() - muonCands[candNr]->p4());
121 usedCands.push_back(candNr);
127 allSelections->push_back(cleanedJet);
131 if(!eleCands.empty()){
132 for (jet = theJetCollectionHandle->begin(); jet != theJetCollectionHandle->end(); jet++) {
134 jetType cleanedJet = *
jet;
135 for(
size_t candNr=0;candNr<eleCands.size();candNr++){
136 if (
std::find(usedCands.begin(),usedCands.end(),candNr)!=usedCands.end())
continue;
138 std::vector<edm::Ptr<reco::PFCandidate> > pfConstituents = cleanedJet.getPFConstituents();
139 for(std::vector<
edm::Ptr<reco::PFCandidate> >::const_iterator i_candidate = pfConstituents.begin(); i_candidate != pfConstituents.end(); ++i_candidate){
140 if (
deltaR((*eleCands[candNr]),(**i_candidate))<0.001) {
141 cleanedJet.setP4( cleanedJet.p4() - eleCands[candNr]->p4());
142 usedCands.push_back(candNr);
148 allSelections->push_back(cleanedJet);
152 if(!photonCands.empty()){
153 for (jet = theJetCollectionHandle->begin(); jet != theJetCollectionHandle->end(); jet++) {
155 jetType cleanedJet = *
jet;
156 for(
size_t candNr=0;candNr<photonCands.size();candNr++){
157 if (
std::find(usedCands.begin(),usedCands.end(),candNr)!=usedCands.end())
continue;
159 std::vector<edm::Ptr<reco::PFCandidate> > pfConstituents = cleanedJet.getPFConstituents();
160 for(std::vector<
edm::Ptr<reco::PFCandidate> >::const_iterator i_candidate = pfConstituents.begin(); i_candidate != pfConstituents.end(); ++i_candidate){
161 if (
deltaR((*photonCands[candNr]),(**i_candidate))<0.001) {
162 cleanedJet.setP4( cleanedJet.p4() - photonCands[candNr]->p4());
163 usedCands.push_back(candNr);
169 allSelections->push_back(cleanedJet);
173 if(!clusCands.empty()){
174 for (jet = theJetCollectionHandle->begin(); jet != theJetCollectionHandle->end(); jet++) {
176 jetType cleanedJet = *
jet;
177 for(
size_t candNr=0;candNr<clusCands.size();candNr++){
178 if (
std::find(usedCands.begin(),usedCands.end(),candNr)!=usedCands.end())
continue;
180 std::vector<edm::Ptr<reco::PFCandidate> > pfConstituents = cleanedJet.getPFConstituents();
181 for(std::vector<
edm::Ptr<reco::PFCandidate> >::const_iterator i_candidate = pfConstituents.begin(); i_candidate != pfConstituents.end(); ++i_candidate){
182 if (
deltaR((*clusCands[candNr]),(**i_candidate))<0.001) {
183 cleanedJet.setP4( cleanedJet.p4() - clusCands[candNr]->p4());
184 usedCands.push_back(candNr);
190 allSelections->push_back(cleanedJet);
196 std::sort (allSelections->begin(), allSelections->end(), compJets);
199 JetCollection
const &
jets = *cleanedJetHandle;
201 JetRefVector cleanedJetRefs;
203 for (
unsigned iJet = 0; iJet < jets.size(); ++iJet) {
204 cleanedJetRefs.push_back(
JetRef(cleanedJetHandle, iJet));
207 product->emplace_back(cleanedJetRefs);
std::string defaultModuleLabel()
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::InputTag sourceJetTag
edm::EDGetTokenT< std::vector< jetType > > m_theJetToken
edm::RefVector< JetBxCollection > JetRefVector
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
edm::Ref< JetBxCollection > JetRef
edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > m_theLeptonToken
ParameterDescriptionBase * add(U const &iLabel, T const &value)
double deltaR(double eta1, double eta2, double phi1, double phi2)
~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