32 std::vector<edm::EDGetTokenT<edm::Association<pat::PackedCandidateCollection>>>
pf2pcs_;
43 produces<edm::ValueMap<reco::CandidatePtr>>();
49 std::vector<edm::Handle<edm::Association<pat::PackedCandidateCollection>>> pf2pcs(pf2pcs_.size());
52 for (
unsigned int i = 0,
n = pf2pcs.size();
i <
n; ++
i) {
53 iEvent.getByToken(pf2pcs_[
i], pf2pcs[
i]);
55 std::vector<reco::CandidatePtr> outptrs;
56 outptrs.reserve(
pf->size());
57 for (
unsigned int i = 0,
n =
pf->size();
i <
n; ++
i) {
59 const auto& newpfRef = (*pf2pf)[oldpfRef];
61 for (
const auto& pf2pc : pf2pcs) {
62 if (pf2pc->contains(newpfRef.id())) {
63 outptrs.push_back(
refToPtr((*pf2pc)[newpfRef]));
69 edm::LogPrint(
"PackedPFCandidateRefMixer") <<
"oldpfRef: " << oldpfRef.
id() <<
" / " << oldpfRef.
key() <<
"\n";
70 edm::LogPrint(
"PackedPFCandidateRefMixer") <<
"newpfRef: " << newpfRef.id() <<
" / " << newpfRef.key() <<
"\n";
71 edm::LogPrint(
"PackedPFCandidateRefMixer") <<
"and I have " << pf2pcs.size() <<
" rekey maps." 73 for (
const auto& pf2pc : pf2pcs) {
74 edm::LogPrint(
"PackedPFCandidateRefMixer") <<
"this map has keys in: " 76 for (
const auto& pair : pf2pc->ids()) {
77 edm::LogPrint(
"PackedPFCandidateRefMixer") <<
"\t" << pair.first <<
"\n";
80 throw cms::Exception(
"LogicError") <<
"A packed candidate has refs that we don't understand\n";
85 filler.insert(
pf, outptrs.begin(), outptrs.end());
T getParameter(std::string const &) const
ProductID id() const
Accessor for product ID.
Ptr< typename C::value_type > refToPtr(Ref< C, typename C::value_type, refhelper::FindUsingAdvance< C, typename C::value_type > > const &ref)
key_type key() const
Accessor for product key.
~PackedPFCandidateRefMixer() override
edm::EDGetTokenT< std::vector< reco::PFCandidate > > pf_
#define DEFINE_FWK_MODULE(type)
Log< level::Warning, true > LogPrint
edm::EDGetTokenT< edm::ValueMap< reco::PFCandidateRef > > pf2pf_
PackedPFCandidateRefMixer(const edm::ParameterSet &iConfig)
std::vector< edm::EDGetTokenT< edm::Association< pat::PackedCandidateCollection > > > pf2pcs_
edm::Ref< l1t::PFCandidateCollection > PFCandidateRef
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override