49 : src_(consumes<edm::
View<
reco::GenJet> >(iConfig.getParameter<edm::
InputTag>(
"src"))),
51 iConfig.getParameter<edm::
InputTag>(
"packedGenParticles"))),
52 cut_(iConfig.getParameter<std::
string>(
"cut")),
53 cutLoose_(iConfig.getParameter<std::
string>(
"cutLoose")),
54 nLoose_(iConfig.getParameter<unsigned>(
"nLoose")),
55 clearDaughters_(iConfig.getParameter<bool>(
"clearDaughters")),
56 dropSpecific_(iConfig.getParameter<bool>(
"dropSpecific")) {
57 produces<std::vector<reco::GenJet> >();
58 produces<edm::Association<std::vector<reco::GenJet> > >(
"slimmedGenJetAssociation");
68 auto out = std::make_unique<vector<reco::GenJet> >();
74 auto genJetSlimmedGenJetAssociation = make_unique<edm::Association<std::vector<reco::GenJet> > >();
76 auto mapping = std::make_unique<std::vector<int> >();
77 mapping->reserve(
src->size());
82 bool selectedLoose =
false;
83 if (nLoose_ > 0 && nl < nLoose_ && cutLoose_(*it)) {
88 bool pass = cut_(*it) || selectedLoose;
90 mapping->push_back(-1);
97 mapping->push_back(nm++);
99 if (clearDaughters_) {
106 std::map<unsigned int, reco::CandidatePtr> ptrs;
107 for (
unsigned int i = 0;
i < old.size();
i++) {
111 ptrs[((*gp2pgp)[old[
i]]).
key()] =
refToPtr((*gp2pgp)[old[
i]]);
113 for (std::map<unsigned int, reco::CandidatePtr>::iterator itp = ptrs.begin(); itp != ptrs.end();
126 auto asso = std::make_unique<edm::Association<std::vector<reco::GenJet> > >(orphanHandle);
128 slimmedAssoFiller.insert(
src, mapping->begin(), mapping->end());
129 slimmedAssoFiller.fill();
131 iEvent.
put(
std::move(asso),
"slimmedGenJetAssociation");
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
Ptr< typename C::value_type > refToPtr(Ref< C, typename C::value_type, refhelper::FindUsingAdvance< C, typename C::value_type > > const &ref)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
~PATGenJetSlimmer() override
const StringCutObjectSelector< reco::GenJet > cutLoose_
virtual const daughters & daughterPtrVector() const
references to daughtes
const bool clearDaughters_
reset daughters to an empty vector
Matcher of reconstructed objects to L1 Muons.
const StringCutObjectSelector< reco::GenJet > cut_
const edm::EDGetTokenT< edm::Association< std::vector< pat::PackedGenParticle > > > gp2pgp_
const bool dropSpecific_
drop the specific
tuple key
prepare the HTCondor submission files and eventually submit them
Jets made from MC generator particles.
virtual void clearDaughters()
clear daughter references
std::vector< CandidatePtr > daughters
collection of references to daughters
const edm::EDGetTokenT< edm::View< reco::GenJet > > src_
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
void setSpecific(const Specific &spec)
set the specific (note: responsibility of keeping it consistent with the jet daughers belongs to the ...
void addDaughter(const CandidatePtr &)
add a daughter via a reference
PATGenJetSlimmer(const edm::ParameterSet &iConfig)