58 iConfig.getParameter<edm::
InputTag>(
"trackToGenAssoc"))),
60 iConfig.getParameter<edm::
InputTag>(
"trackToPackedCandidatesAssoc"))),
62 iConfig.getParameter<edm::
InputTag>(
"genToPrunedAssoc"))),
64 iConfig.getParameter<edm::
InputTag>(
"genToPrunedAssocWithStatusOne"))),
65 tracksToken_(consumes<edm::
View<
reco::Track>>(iConfig.getParameter<edm::
InputTag>(
"tracks"))) {
66 produces<edm::Association<reco::GenParticleCollection>>();
75 auto pcCollection = trackToPackedCandidatesAssoc.ref();
78 auto prunedCollection = genToPrunedAssoc.ref();
83 const auto&
tracks = *trackHandle;
85 auto out = std::make_unique<edm::Association<reco::GenParticleCollection>>(prunedCollection);
88 if (not trackToGenAssocHandle.isValid()
or not trackToGenAssocHandle->contains(trackHandle.id())) {
96 const auto& trackToGenAssoc = *trackToGenAssocHandle;
100 std::vector<int>
indices(pcCollection->size(), -1);
102 for (
size_t i = 0;
i <
tracks.size();
i++) {
105 auto pc = trackToPackedCandidatesAssoc[
track];
115 auto newGenWSO = genToPrunedAssocWSO[
gen];
116 if (newGenWSO.isNull()) {
120 auto newGen = genToPrunedAssoc[newGenWSO];
121 if (newGen.isNull()) {
125 indices[pc.index()] = newGen.index();
140 descriptions.
add(
"packedCandidatesGenAssociationDefault", desc);
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
edm::EDGetTokenT< edm::Association< pat::PackedCandidateCollection > > trackToPcToken_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
PackedCandidateGenAssociationProducer(const edm::ParameterSet &)
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
#define DEFINE_FWK_MODULE(type)
edm::EDGetTokenT< edm::Association< reco::GenParticleCollection > > trackToGenToken_
std::vector< pat::PackedCandidate > PackedCandidateCollection
void insert(const H &h, I begin, I end)
auto const & tracks
cannot be loose
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
edm::EDGetTokenT< edm::Association< reco::GenParticleCollection > > genToPrunedWSOToken_
bool get(ProductID const &oid, Handle< PROD > &result) const
ParameterDescriptionBase * add(U const &iLabel, T const &value)
edm::EDGetTokenT< edm::Association< reco::GenParticleCollection > > genToPrunedToken_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
edm::EDGetTokenT< edm::View< reco::Track > > tracksToken_